/* ==========================================================================
   Panel de Torneos — tema "cancha": verdes profundos + acento lima de marcador
   ========================================================================== */
:root {
  --pitch-900: #07140d;
  --pitch-800: #0b2014;
  --pitch-700: #0f2c1b;
  --pitch-600: #163d26;
  --line: rgba(198, 255, 0, 0.14);
  --lime: #c6ff2e;
  --lime-soft: #a8e000;
  --chalk: #eaf3ec;
  --muted: #8aa595;
  --danger: #ff5a5a;
  --ok: #c6ff2e;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: "Manrope", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(198, 255, 0, 0.07), transparent 60%),
    var(--pitch-900);
  color: var(--chalk);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Bebas Neue", "Manrope", sans-serif;
  letter-spacing: 0.04em;
  font-weight: 400;
  line-height: 1;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout con barra lateral ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background:
    repeating-linear-gradient(180deg, transparent 0 56px, rgba(255,255,255,0.012) 56px 112px),
    var(--pitch-800);
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; padding: 0 8px; }
.brand .ball {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--lime);
  display: grid; place-items: center;
  color: var(--pitch-900); font-weight: 800; font-size: 18px;
  box-shadow: 0 0 24px rgba(198, 255, 0, 0.35);
}
.brand .brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.brand .name { font-family: "Bebas Neue", sans-serif; font-size: 26px; letter-spacing: 0.06em; }
.brand .name small { display: block; font-size: 11px; letter-spacing: 0.22em; color: var(--muted); font-family: "Manrope"; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  padding: 12px 14px; border-radius: 10px; color: var(--muted);
  font-weight: 600; font-size: 14px; transition: all 0.16s ease;
  display: flex; align-items: center; gap: 10px;
}
.nav a:hover { background: var(--pitch-700); color: var(--chalk); }
.nav a.active { background: var(--pitch-600); color: var(--lime); }
.nav a .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.nav a .ic { flex-shrink: 0; opacity: 0.85; }
.nav a.active .ic { opacity: 1; }

.sidebar .foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; }

/* ---------- Contenido ---------- */
.main { padding: 30px 40px 56px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.topbar .page-title { font-size: 40px; }
.user-chip {
  display: flex; align-items: center; gap: 12px;
  background: var(--pitch-700); border: 1px solid var(--line);
  padding: 8px 8px 8px 16px; border-radius: 999px;
}
.user-chip .who { font-size: 13px; font-weight: 700; }
.user-chip .who small { display: block; color: var(--muted); font-weight: 500; }
.btn-logout {
  background: var(--pitch-600); color: var(--chalk); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-logout:hover { color: var(--danger); }

/* ---------- Tarjetas ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: linear-gradient(180deg, var(--pitch-700), var(--pitch-800));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.card .big { font-family: "Bebas Neue", sans-serif; font-size: 56px; color: var(--lime); margin-top: 6px; }
.card .sub { color: var(--muted); font-size: 13px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; background: rgba(198,255,0,0.1); color: var(--lime);
}
.status-pill.bad { background: rgba(255,90,90,0.12); color: var(--danger); }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--lime); color: var(--pitch-900);
  font-weight: 800; font-size: 14px; padding: 11px 20px; border: none; border-radius: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(198,255,0,0.25); }
.btn.ghost { background: transparent; color: var(--chalk); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--pitch-600); box-shadow: none; }

/* ---------- Tablas ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 18px; }
.section-head h2 { font-size: 30px; }

table { width: 100%; border-collapse: collapse; }
.panel-table {
  background: var(--pitch-800); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.panel-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 14px 16px; background: var(--pitch-700);
  border-bottom: 1px solid var(--line);
}
.panel-table td { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 14px; }
.panel-table tr:last-child td { border-bottom: none; }
.panel-table tbody tr:hover { background: var(--pitch-700); }
.panel-table .num { text-align: center; font-variant-numeric: tabular-nums; }
/* Un icono como cabecera de columna: sin la línea base del texto de 11px que
   lo dejaría descolgado, y sin heredar el interlineado de la etiqueta. */
.panel-table th .ic { display: inline-block; vertical-align: middle; }
.panel-table .pts { color: var(--lime); font-weight: 800; }
.rank { color: var(--muted); font-family: "Bebas Neue", sans-serif; font-size: 20px; width: 36px; }
.rank.top { color: var(--lime); }

.estado-tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.estado-tag.programado { background: rgba(138,165,149,0.16); color: var(--muted); }
.estado-tag.en_curso { background: rgba(198,255,0,0.14); color: var(--lime); }
.estado-tag.finalizado { background: rgba(255,255,255,0.06); color: var(--chalk); }

.rol-tag { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; text-transform: capitalize; }
.rol-tag.superadmin { background: rgba(198,255,0,0.16); color: var(--lime); }
.rol-tag.entrenador { background: rgba(94,160,255,0.16); color: #8cc0ff; }
.rol-tag.arbitro { background: rgba(255,196,0,0.16); color: #ffce5a; }
.rol-tag.jugador { background: rgba(138,165,149,0.16); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 48px; font-size: 15px; }

/* ---------- Formularios ---------- */
.form-card { max-width: 560px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--pitch-900); border: 1px solid var(--line);
  color: var(--chalk); padding: 12px 14px; border-radius: 10px; font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(198,255,0,0.12);
}
/* El indicador nativo del calendario (date/datetime-local) lo pinta el
   navegador en negro, invisible sobre el fondo oscuro de los inputs.
   Invertido queda claro. El pseudo-elemento solo existe en Chromium/WebKit;
   Firefox pinta el suyo ya tematizado y lo ignora sin romperse. */
.field input::-webkit-calendar-picker-indicator {
  filter: invert(1); opacity: .75; cursor: pointer;
}
.field input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-actions { display: flex; gap: 12px; margin-top: 26px; }

/* ---------- Flashes ---------- */
.flashes { margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.flash {
  padding: 13px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line);
}
.flash.error { background: rgba(255,90,90,0.1); color: var(--danger); border-color: rgba(255,90,90,0.3); }
.flash.ok { background: rgba(198,255,0,0.08); color: var(--lime); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--pitch-700), var(--pitch-800));
  border: 1px solid var(--line); border-radius: 20px; padding: 40px 34px; box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-card .brand { justify-content: center; margin-bottom: 28px; }
.login-card h1 { font-size: 30px; text-align: center; margin-bottom: 4px; }
.login-card .tagline { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-hint { margin-top: 22px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.7; }
.login-hint code { color: var(--lime); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .main { padding: 22px; }
}

/* ---------- Utilidades de espaciado (evita atributos style="" inline) ---------- */
.mb-18 { margin-bottom: 18px; }
.mb-22 { margin-bottom: 22px; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }

/* ---------- Marcador (detalle de partido) ---------- */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.scoreboard .team { text-align: center; }
.scoreboard .team-name { font-family: "Bebas Neue", sans-serif; font-size: 30px; letter-spacing: 0.03em; }
.scoreboard .team-tag { color: var(--muted); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 4px; }
.scoreboard .score { display: flex; align-items: center; gap: 14px; }
.scoreboard .score-num { font-family: "Bebas Neue", sans-serif; font-size: 72px; color: var(--lime); line-height: 1; }
.scoreboard .score-sep { font-family: "Bebas Neue", sans-serif; font-size: 48px; color: var(--muted); }
.scoreboard-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  margin-top: 18px; color: var(--muted); font-size: 13px; }
.card-note { color: var(--muted); font-size: 14px; }

/* ---------- Línea de tiempo de eventos ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.event { display: flex; align-items: center; gap: 14px; background: var(--pitch-800);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.event-min { font-family: "Bebas Neue", sans-serif; font-size: 22px; color: var(--lime); width: 42px; }
.event-icon { width: 28px; display: flex; align-items: center; justify-content: center; }

/* Tarjetas de árbitro: aquí el color ES la información (amarilla vs roja), así
   que no se hereda de currentColor como en el resto de iconos. */
.ic-amarilla { color: #f2b53c; }
.ic-roja { color: var(--danger); }
.event-type { font-weight: 700; text-transform: capitalize; font-size: 14px; }
.event-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Barra de filtro ---------- */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.filter-bar label { color: var(--muted); font-size: 14px; font-weight: 600; }
.filter-bar select { background: var(--pitch-900); border: 1px solid var(--line); color: var(--chalk);
  padding: 10px 14px; border-radius: 10px; font-family: inherit; font-size: 14px; min-width: 220px; }
.filter-bar select:focus { outline: none; border-color: var(--lime); }

/* ---------- Alineación en cancha ---------- */
.cancha-wrap { max-width: 520px; margin: 0 auto; }
.cancha { position: relative; width: 100%; aspect-ratio: 2/3; background: #1d4a30;
          border-radius: 10px; overflow: hidden; }
.cancha-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.cancha-fila { position: absolute; left: 0; right: 0; display: flex;
               justify-content: space-evenly; transform: translateY(-50%); }
/* Posiciones fijas por línea: las 3 formaciones del sistema (4-4-2, 4-3-3,
   3-5-2) siempre producen 4 filas (arquero + 3 líneas), así que el reparto
   vertical es estático -> sin cálculos ni atributos de estilo inline. */
.cancha-fila-l0 { top: 94%; } .cancha-fila-l1 { top: 79%; }
.cancha-fila-l2 { top: 64%; } .cancha-fila-l3 { top: 51%; }
.cancha-fila-v0 { top: 6%; }  .cancha-fila-v1 { top: 21%; }
.cancha-fila-v2 { top: 36%; } .cancha-fila-v3 { top: 49%; }
.cancha-pl { text-align: center; width: 60px; }
.cancha-avw { position: relative; width: 36px; height: 36px; margin: 0 auto 4px; }
/* La inicial es el fondo (z-index base); la foto va encima cuando existe, y los
   distintivos por encima de la foto. Sin esto la inicial (más tardía en el DOM)
   tapaba la foto. */
.cancha-avatar { position: absolute; inset: 0; width: 36px; height: 36px; z-index: 1;
                 border-radius: 9px; object-fit: cover; border: 1px solid rgba(255,255,255,.35); }
.cancha-inicial { position: absolute; inset: 0; display: flex; align-items: center;
                  justify-content: center; border-radius: 9px; font-size: 16px; color: #dfe9e2;
                  background: linear-gradient(135deg,#5b7d66,#31513d); border: 1px solid rgba(255,255,255,.35); }
.cancha-nm { font-size: 9.5px; line-height: 1.25; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.bg { position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center;
      border-radius: 50%; font-size: 8px; font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.55); }
.bg-gol { right: -6px; top: -5px; background: var(--chalk); color: var(--pitch-900); min-width: 16px; height: 16px; padding: 0 3px; }
.bg-asis { left: -6px; bottom: -4px; background: var(--pitch-800); width: 16px; height: 16px; color: var(--chalk); border: 1px solid rgba(255,255,255,.35); }
.bg-tar { right: -6px; bottom: -4px; width: 11px; height: 14px; border-radius: 2px; }
.bg-amarilla { background: #f2b53c; } .bg-roja { background: var(--danger); }
.bg-out { left: -6px; top: -5px; background: #e0393e; color: #fff; width: 15px; height: 15px; font-size: 9px; }
.bg-in { left: -6px; top: -5px; background: #22a06b; color: #fff; width: 15px; height: 15px; font-size: 9px; }
.cancha-aviso { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center; z-index: 2; }
.cancha-aviso-local { top: 50%; height: 50%; }
.cancha-aviso-visitante { top: 0; height: 50%; }
.cancha-aviso span { background: rgba(7,20,13,.72); border: 1px dashed rgba(198,255,0,.35);
                     color: var(--lime); border-radius: 10px; padding: 9px 16px; font-size: 12px; font-weight: 600; }
/* ---------- Banca ---------- */
/* La cabecera repite la rejilla de la banca para que cada rótulo caiga sobre
   su columna: "Local" pegado al borde izquierdo de la cancha y "Visitante" al
   derecho. */
.banca-h { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: center; margin: 16px 0 6px; }
/* Los tres van con columna explícita: si alguno queda en colocación
   automática, el grid no le encuentra hueco en la fila y le inventa una
   columna implícita a la derecha. */
.banca-h .c { grid-row: 1; grid-column: 1; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; font-size: 10px; }
.banca-h .c.r { grid-column: 2; text-align: right; }
/* Cruza las dos columnas para centrarse en el ancho completo: como el hueco
   entre columnas está en el medio, el rótulo cae justo sobre él. */
.banca-h .c.m { grid-column: 1 / -1; text-align: center; }
.banca { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.banca-i { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.banca-i.r { flex-direction: row-reverse; text-align: right; }
/* .cancha-avw trae `margin: 0 auto` para centrarse en la cancha; dentro de la
   banca es un ítem flex y ese auto se come el espacio libre, que es lo que
   descuadraba las dos columnas. Aquí no lleva margen y no se encoge. */
.banca-i .cancha-avw { margin: 0; flex: none; }
/* ---------- Eventos por grupo ---------- */
.evgrupo-titulo { display: flex; align-items: center; gap: 8px; font-size: 13px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.evgrupo-titulo:first-of-type { margin-top: 4px; }
.evgrupo { display: grid; grid-template-columns: 1fr 30px 1fr; gap: 10px; align-items: center; padding: 7px 16px; }
.evgrupo + .evgrupo { border-top: 1px solid rgba(255,255,255,.06); }
.evgrupo .l { text-align: right; } .evgrupo .r { text-align: left; }
.evgrupo .i { display: flex; align-items: center; justify-content: center; }
.evgrupo .event-min { font-family: "Bebas Neue", sans-serif; font-size: 13px; color: var(--lime); margin-left: 4px; }
