:root {
  /* ---- Paleta de marca LÖWEX ---- */
  --lowex-primary: #00424a;     /* verde petróleo - color base de la marca */
  --lowex-primary-dark: #00343a; /* petróleo más oscuro para profundidad */
  --lowex-accent:  #c0d401;     /* verde lima - acento de marca */
  --lowex-accent-bright: #e7ff53;/* lima brillante (avatar) para detalles */
  --lowex-cream:   #f7f6f4;     /* blanco hueso del logo */

  --bg:        #f4f6f7;
  --card:      #ffffff;
  --text:      #16282b;
  --muted:     #5f7479;
  --border:    #e2e8ea;
  --success:   #1f9d55;
  --danger:    #d64545;
  --radius:    14px;
  --shadow:    0 2px 14px rgba(0,66,74,0.10);
  --shadow-lg: 0 8px 30px rgba(0,66,74,0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--lowex-primary);
  color: var(--lowex-cream);
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: 0.7rem; }
.topbar .brand img { height: 30px; width: auto; }
.topbar .brand .tag {
  font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--lowex-accent-bright); font-weight: 700; opacity: 0.9;
  border-left: 1px solid rgba(231,255,83,0.35); padding-left: 0.6rem;
}
.topbar nav { display: flex; gap: 0.3rem; align-items: center; }
.topbar nav a, .topbar nav button {
  color: var(--lowex-cream); background: transparent; border: none; cursor: pointer;
  padding: 0.45rem 0.85rem; border-radius: 9px; font-size: 0.9rem; text-decoration: none;
  font-weight: 500; transition: background 0.15s;
}
.topbar nav a:hover, .topbar nav button:hover { background: rgba(231,255,83,0.14); }
.topbar nav a.active { background: var(--lowex-accent); color: var(--lowex-primary); font-weight: 600; }

.container { max-width: 860px; margin: 1.5rem auto; padding: 0 1rem; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: var(--lowex-primary);
  background-image: radial-gradient(circle at 50% 0%, #015560 0%, var(--lowex-primary) 55%, var(--lowex-primary-dark) 100%);
}
.auth-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 2.2rem 2rem; width: 100%; max-width: 410px;
}
.auth-card .logo { text-align: center; margin-bottom: 1.4rem; }
.auth-card .logo img { width: 84px; height: 84px; border-radius: 18px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.4rem; text-align: center; margin-bottom: 0.25rem; color: var(--lowex-primary); font-weight: 800; letter-spacing: -0.01em; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-card .eyebrow {
  text-align: center; font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--lowex-accent); font-weight: 700; margin-bottom: 0.6rem;
}

label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.85rem 0 0.3rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select {
  width: 100%; padding: 0.62rem 0.7rem; border: 1px solid var(--border);
  border-radius: 9px; font-size: 0.95rem; background: #fff; color: var(--text); transition: border 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--lowex-accent); box-shadow: 0 0 0 3px rgba(192,212,1,0.18); }

.btn {
  display: inline-block; width: 100%; margin-top: 1.3rem;
  background: var(--lowex-primary); color: var(--lowex-cream); border: none;
  padding: 0.72rem; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: var(--lowex-primary-dark); }
.btn:active { transform: translateY(1px); }
.btn.accent { background: var(--lowex-accent); color: var(--lowex-primary); }
.btn.accent:hover { background: var(--lowex-accent-bright); }
.btn.small { width: auto; margin: 0; padding: 0.45rem 0.85rem; font-size: 0.85rem; border-radius: 8px; }
.btn.secondary { background: #fff; color: var(--lowex-primary); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg); }

.switch-link { text-align: center; margin-top: 1.1rem; font-size: 0.9rem; color: var(--muted); }
.switch-link a { color: var(--lowex-primary); font-weight: 700; text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

.msg { padding: 0.6rem 0.8rem; border-radius: 9px; font-size: 0.88rem; margin-top: 0.8rem; display: none; }
.msg.error { background: #fde8e8; color: var(--danger); display: block; }
.msg.success { background: #e6f6ec; color: var(--success); display: block; }

/* Campo de contraseña con ojito */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.6rem; }
.pw-toggle {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0.3rem;
  font-size: 1.1rem; line-height: 1; color: var(--muted); width: auto; margin: 0;
}
.pw-toggle:hover { color: var(--lowex-primary); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tab {
  padding: 0.45rem 0.95rem; border-radius: 22px; background: #fff; border: 1px solid var(--border);
  cursor: pointer; font-size: 0.86rem; font-weight: 500; transition: all 0.15s; color: var(--text);
}
.tab:hover { border-color: var(--lowex-accent); }
.tab.active { background: var(--lowex-primary); color: var(--lowex-cream); border-color: var(--lowex-primary); font-weight: 600; }

/* ---------- Match cards ---------- */
.match {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.95rem 1.1rem; margin-bottom: 0.75rem; border: 1px solid transparent;
  transition: box-shadow 0.15s;
}
.match:hover { box-shadow: var(--shadow-lg); }
.match .meta { font-size: 0.74rem; color: var(--muted); margin-bottom: 0.6rem; display: flex; justify-content: space-between; align-items: center; }
.match .meta .gnum { font-weight: 600; letter-spacing: 0.02em; }
.match .row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.6rem; }
.match .team { font-weight: 600; display: flex; align-items: center; gap: 0.45rem; }
.match .team.home { justify-content: flex-end; text-align: right; }
.match .team.away { justify-content: flex-start; text-align: left; }
.match .score-inputs { display: flex; align-items: center; gap: 0.4rem; }
.match .score-inputs input { width: 50px; text-align: center; padding: 0.45rem; font-weight: 700; font-size: 1.05rem; }
.match .vs { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.match .status { font-size: 0.78rem; margin-top: 0.65rem; }
.match.locked { background: #fafbfb; }
.badge { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 7px; font-size: 0.72rem; font-weight: 700; }
.badge.locked { background: #eef1f2; color: var(--muted); }
.badge.points { background: var(--lowex-accent); color: var(--lowex-primary); }
.badge.result { background: var(--lowex-primary); color: var(--lowex-cream); }
.save-state { font-size: 0.75rem; color: var(--success); margin-left: 0.5rem; font-weight: 600; }

.flag { width: 22px; height: 15px; object-fit: cover; vertical-align: -2px; border-radius: 2px; display: inline-block; box-shadow: 0 0 1px rgba(0,0,0,0.4); flex-shrink: 0; }

/* ---------- Leaderboard ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card);
        border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 0.7rem 0.9rem; text-align: left; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
th { background: var(--lowex-primary); color: var(--lowex-cream); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.02em; }
tr.me { background: var(--lowex-accent); font-weight: 800; }
tr.me td { color: var(--lowex-primary); border-bottom-color: rgba(0,66,74,0.15); }
tr.me .rank { color: var(--lowex-primary); }
tr:last-child td { border-bottom: none; }
.rank { font-weight: 800; color: var(--lowex-primary); width: 46px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 1.3rem; margin-bottom: 1rem; }
.card h2 { font-size: 1.05rem; margin-bottom: 0.9rem; color: var(--lowex-primary); font-weight: 700; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.stat { text-align: center; padding: 1rem 0.6rem; background: var(--lowex-primary); border-radius: 11px; }
.stat .n { font-size: 1.7rem; font-weight: 800; color: var(--lowex-accent-bright); line-height: 1; }
.stat .l { font-size: 0.74rem; color: var(--lowex-cream); margin-top: 0.35rem; opacity: 0.85; }

#welcome { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
  .match .row { grid-template-columns: 1fr; gap: 0.5rem; text-align: center; justify-items: center; }
  .match .team.home, .match .team.away { justify-content: center; text-align: center; }
  .match .status { text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; align-items: center; }
  .match .score-inputs { justify-content: center; }
  .topbar .brand .tag { display: none; }
  .topbar nav a, .topbar nav button { padding: 0.4rem 0.6rem; font-size: 0.82rem; }
  /* Tabla de posiciones: compactar para que entren las 6 columnas */
  th, td { padding: 0.5rem 0.45rem; font-size: 0.82rem; }
  .rank { width: 30px; }
}
