/* Demo · software de gestión deportiva y sistema de la liga. Tokens del brief (BRIEF-PROPUESTA.md). */
:root {
  --noche: #0A1712; --cancha: #0E6B43; --cesped: #19A15F; --lima: #C6F24E;
  --texto: #10201A; --fondo: #F3F7F4; --gris: #5A6B63; --gris2: #8FA098; --linea: #DCE6E0; --blanco: #FFFFFF;
  --amarillo: #E8B400; --rojo: #C8412F; --naranja: #D9731E;
  /* derivados */
  --noche-2: #12241C; --noche-3: #1B3228; --hundido: #EAF1EC;
  --ok-f: #E2F3EA; --av-f: #FBF0D6; --mal-f: #F8E4E0; --nar-f: #FBEADB;
  --sombra: 0 0 0 1px rgba(16,32,26,.06), 0 1px 2px rgba(16,32,26,.05), 0 4px 14px -6px rgba(16,32,26,.08);
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  --t: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13.5px/1.5 var(--t); color: var(--texto); background: var(--fondo); -webkit-font-smoothing: antialiased; letter-spacing: -.005em; }
a { color: var(--cancha); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.ic { flex: none; }
.muted { color: var(--gris); }
.nota { font-size: 11.5px; color: var(--gris2); }

/* ---------- Estructura del back office ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--noche); color: #B9CBC1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px 14px; overflow-y: auto; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side .marca { display: flex; align-items: center; gap: 10px; padding: 2px 8px 10px; color: #fff; }
.side .marca .sello { width: 34px; height: 34px; border-radius: 9px; background: var(--cancha); display: grid; place-items: center; color: var(--lima); flex: none; }
.side .marca b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.side .marca small { display: block; font-size: 11px; color: #7E978A; }
.side .marca .iso { width: 36px; height: 36px; flex: none; }
.side .marca b.tf { font-size: 18px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.side .club { display: flex; align-items: center; gap: 9px; margin: 0 4px 6px; padding: 8px 10px; border-radius: 10px; background: var(--noche-2); border: 1px solid rgba(255,255,255,.05); font-size: 12px; color: #D7E4DC; }
.side .club .esc { width: 24px; height: 24px; border-radius: 6px; background: #7A1F1F; color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; flex: none; }
.side .club small { display: block; color: #7E978A; font-size: 10.5px; }
.side .club .cambiar { margin-left: auto; color: #7E978A; font-size: 10.5px; }
.side .grupo { display: flex; align-items: center; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #62796D; padding: 10px 10px 3px; font-weight: 600; }
.side .grupo a.evo { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-weight: 500; color: #7E978A; background: rgba(255,255,255,.04); padding: 1px 7px 1px 5px; border-radius: 10px; font-size: 10.5px; }
.side .grupo a.evo:hover, .side .grupo a.evo.on { color: var(--lima); background: rgba(198,242,78,.08); }
.side a.item { display: flex; align-items: center; gap: 10px; padding: 5.5px 10px; border-radius: 8px; color: #B9CBC1; font-weight: 500; font-size: 12.5px; white-space: nowrap; position: relative; transition: background .15s, color .15s; }
.side a.item:hover { background: rgba(255,255,255,.05); color: #fff; }
.side a.item.on { background: rgba(198,242,78,.09); color: #fff; }
.side a.item.on::before { content: ''; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lima); }
.side a.item .cnt { margin-left: auto; font-size: 10.5px; background: rgba(200,65,47,.22); color: #FFB3A6; padding: 0 7px; border-radius: 10px; }
.side .pie { margin-top: auto; padding: 10px 8px 0; font-size: 11px; color: #62796D; display: flex; align-items: center; gap: 8px; }
.side .pie img { height: 26px; background: #fff; border-radius: 6px; padding: 2px 4px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(243,247,244,.88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); position: sticky; top: 0; z-index: 5; }
.top .miga { color: var(--gris); font-size: 12.5px; }
.top .miga b { color: var(--texto); font-weight: 600; }
.top .der { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.buscador { display: flex; align-items: center; gap: 8px; background: var(--blanco); border: 1px solid var(--linea); border-radius: 9px; padding: 6px 11px; width: 300px; color: var(--gris2); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.buscador kbd { margin-left: auto; font: 10.5px var(--t); border: 1px solid var(--linea); border-radius: 4px; padding: 0 5px; }
.icono-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--gris); position: relative; }
.icono-btn i { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--rojo); box-shadow: 0 0 0 2px var(--fondo); }
.yo { display: flex; align-items: center; gap: 9px; font-size: 12px; line-height: 1.25; }
.yo small { display: block; color: var(--gris2); font-size: 11px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--cancha); color: #fff; font-weight: 600; font-size: 11.5px; flex: none; letter-spacing: 0; }
.content { padding: 22px 28px 48px; max-width: 1480px; width: 100%; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.head h1 { font-size: 23px; font-weight: 600; }
.head p { margin: 3px 0 0; color: var(--gris); max-width: 78ch; font-size: 13px; }
.head .acciones { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ---------- Piezas ---------- */
.card { background: var(--blanco); border-radius: var(--r-l); box-shadow: var(--sombra); padding: 16px 18px; min-width: 0; }
.card > header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card > header > div { min-width: 0; }
.card > header h3 { font-size: 14px; font-weight: 600; }
.card > header .ayuda { display: block; color: var(--gris); font-size: 11.5px; margin-top: 1px; }
.card > header .tot { margin-left: auto; font-size: 12px; color: var(--gris); white-space: nowrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.g-7-5 { grid-template-columns: 7fr 5fr; } .g-8-4 { grid-template-columns: 8fr 4fr; } .g-4-8 { grid-template-columns: 4fr 8fr; } .g-5-7 { grid-template-columns: 5fr 7fr; } .g-3-6-3 { grid-template-columns: 3fr 6fr 3fr; }
.mb { margin-bottom: 14px; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--linea); border-radius: 9px; padding: 7px 13px; font-weight: 500; font-size: 12.5px; cursor: pointer; background: var(--blanco); color: var(--texto); transition: transform .12s, background .15s; white-space: nowrap; }
.btn:hover { background: #F8FBF9; }
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--cancha); border-color: var(--cancha); color: #fff; }
.btn.pri:hover { background: #0B5A38; }
.btn.lima { background: var(--lima); border-color: var(--lima); color: var(--noche); font-weight: 600; }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cesped); outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.sin::before { display: none; }
.b-ok { background: var(--ok-f); color: #0E7A4B; } .b-av { background: var(--av-f); color: #946F00; } .b-mal { background: var(--mal-f); color: var(--rojo); } .b-nar { background: var(--nar-f); color: #B35A10; } .b-neu { background: var(--hundido); color: var(--gris); } .b-noche { background: var(--noche); color: var(--lima); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--hundido); color: var(--gris); font-weight: 500; }
.f1 { display: inline-flex; align-items: center; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--ok-f); color: #0E7A4B; letter-spacing: .02em; }
.evo { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #EDEFEA; color: var(--gris); letter-spacing: .02em; }

/* Semáforo */
.sem { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sem.ok { background: var(--cesped); } .sem.duda { background: var(--amarillo); } .sem.naranja { background: var(--naranja); } .sem.rojo, .sem.lesion { background: var(--rojo); } .sem.sancion { background: #7C5CC4; }

/* Franja de KPI */
.kpis { display: grid; grid-template-columns: repeat(var(--k, 6), 1fr); background: var(--blanco); border-radius: var(--r-l); box-shadow: var(--sombra); margin-bottom: 14px; overflow: hidden; }
.kpi { padding: 14px 16px; border-left: 1px solid var(--linea); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .lbl { font-size: 11.5px; color: var(--gris); font-weight: 500; }
.kpi .val { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.03em; margin: 5px 0 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--gris2); letter-spacing: 0; }
.kpi .sub { font-size: 11.5px; color: var(--gris2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub b { font-weight: 600; }
.kpi.hero { background: var(--noche); color: #fff; }
.kpi.hero .lbl, .kpi.hero .sub { color: #8FA89B; }
.kpi.hero .val { color: var(--lima); }
.up { color: #0E7A4B; font-weight: 600; } .down { color: var(--rojo); font-weight: 600; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--linea); stroke-width: 1; }
.chart .ax { font: 10.5px var(--t); fill: var(--gris2); }
.chart .ax.val { fill: var(--texto); font-weight: 600; }
.chart .ax.eje { fill: var(--gris); font-size: 11.5px; font-weight: 500; }
.leyenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--gris); margin-top: 6px; }
.leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.hbars { display: flex; flex-direction: column; gap: 8px; }
.hb-row { display: grid; grid-template-columns: 118px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; }
.hb-l { color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 9px; background: var(--hundido); border-radius: 5px; overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 5px; }
.hb-v { text-align: right; font-weight: 600; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--gris2); font-size: 10.5px; padding: 7px 8px; border-bottom: 1px solid var(--linea); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.link { cursor: pointer; transition: background .12s; }
.tbl tbody tr.link:hover { background: #F6FAF7; }
.tbl tbody tr.dest { background: #F3FAE3; }
.tbl .r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c, .tbl th.c { text-align: center; }
.ent { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ent b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent small { color: var(--gris); font-size: 11.5px; }
.dorsal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--hundido); font-weight: 600; font-size: 11.5px; flex: none; font-variant-numeric: tabular-nums; }
.tbl td.r, .tbl td.num { white-space: nowrap; }
.minibar { display: inline-block; width: 44px; height: 6px; background: var(--hundido); border-radius: 3px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.minibar span { display: block; height: 100%; background: var(--cesped); border-radius: 3px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--linea); margin-bottom: 14px; }
.tabs button, .tabs a { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--gris); font-weight: 500; font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tabs .on { color: var(--texto); border-color: var(--cancha); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills a, .pills button { border: 1px solid var(--linea); background: var(--blanco); border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--gris); cursor: pointer; }
.pills .on { background: var(--noche); border-color: var(--noche); color: #fff; }

/* EVA IA */
.eva { background: var(--noche); color: #C5D6CC; border-radius: var(--r-l); padding: 16px 18px; position: relative; overflow: hidden; }
.eva::after { content: ''; position: absolute; right: -70px; top: -70px; width: 200px; height: 200px; border-radius: 50%; border: 22px solid rgba(198,242,78,.05); }
.eva h3 { color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.eva h3 .ic { color: var(--lima); }
.eva .sug { border-top: 1px solid rgba(255,255,255,.08); padding: 11px 0; font-size: 12.5px; }
.eva .sug:last-child { padding-bottom: 0; }
.eva .sug b { color: #fff; font-weight: 600; }
.eva .sug .acc { display: flex; gap: 8px; margin-top: 8px; }
.eva .btn { background: rgba(255,255,255,.07); border-color: transparent; color: #fff; }
.eva .btn.lima { background: var(--lima); color: var(--noche); }
.eva .cita { color: var(--lima); font-weight: 600; }

/* Línea de tiempo */
.linea { position: relative; padding-left: 22px; }
.linea::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--hundido); }
.hito { position: relative; padding-bottom: 12px; }
.hito:last-child { padding-bottom: 0; }
.hito::before { content: ''; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--cancha)); box-shadow: 0 0 0 3px var(--blanco); }
.hito .f { font-size: 11px; color: var(--gris2); display: flex; gap: 8px; align-items: center; }
.hito .f .area { color: var(--c); font-weight: 600; }
.hito b { display: block; font-size: 12.8px; font-weight: 600; margin-top: 1px; }
.hito p { margin: 1px 0 0; font-size: 12px; color: var(--gris); }

/* Alertas */
.alerta { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--linea); font-size: 12.5px; }
.alerta:last-child { border-bottom: 0; padding-bottom: 0; }
.alerta .i { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.alerta b { font-weight: 600; display: block; }
.alerta small { color: var(--gris); font-size: 11.5px; }
.i-mal { background: var(--mal-f); color: var(--rojo); } .i-av { background: var(--av-f); color: #946F00; } .i-nar { background: var(--nar-f); color: var(--naranja); } .i-ok { background: var(--ok-f); color: var(--cancha); }

.fila { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linea); font-size: 12.5px; }
.fila:last-child { border-bottom: 0; }
.fila .der { margin-left: auto; }

/* Interruptor */
.sw { position: relative; width: 34px; height: 20px; border-radius: 20px; background: #CBD6D0; flex: none; cursor: pointer; transition: background .15s; border: 0; padding: 0; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s cubic-bezier(.23,1,.32,1); }
.sw.on { background: var(--cesped); }
.sw.on::after { transform: translateX(14px); }

/* Cancha y pizarra */
.cancha { width: 100%; height: auto; display: block; border-radius: 10px; }
.cuerpo { display: block; margin: 0 auto; height: auto; }
.cuerpo .ax { font: 10px var(--t); fill: var(--gris2); }

/* Candado de confidencialidad */
.velado { position: relative; }
.velado .tras { filter: blur(5px); user-select: none; pointer-events: none; opacity: .55; }
.velado .sobre { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; }
.velado .sobre .cand { width: 52px; height: 52px; border-radius: 50%; background: var(--noche); color: var(--lima); display: grid; place-items: center; margin: 0 auto; box-shadow: 0 8px 22px rgba(10,23,18,.25); }

.fade { animation: fade .28s cubic-bezier(.23,1,.32,1); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade { animation: none; } }

@media (max-width: 1100px) {
  .g4, .g3 { grid-template-columns: 1fr 1fr; } .g-7-5, .g-8-4, .g-4-8, .g-5-7, .g-3-6-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .kpis { grid-template-columns: 1fr 1fr; }
  .buscador, .yo span { display: none; } .content { padding: 18px 16px; } .top { padding: 0 16px; }
}
