/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Paleta de marca (manual PC). DEFAULT = CLARO ("la app arranca en Claro"). El OSCURO está
     abajo en :root[data-theme="dark"]. Gotcha del claro: #77FF9B NUNCA como texto/ícono/borde
     sobre fondo claro (1.2:1) → --green va #007651; el verde de RELLENO (botones/barras) usa
     --green-solid #77FF9B con texto oscuro encima. */
  --bg:         #fcfbfc;
  --surface:    #ffffff;
  --surface2:   #eef1ef;
  --border:     #d2d2d2;
  --green:      #007651;
  --green-solid:#77ff9b;
  --blue:       #095cb1;
  --muted:      #686b68;   /* antes #7f817f: no llegaba a 4,5:1 (mínimo WCAG AA) sobre los fondos del tema */
  --text:       #18231c;
  --text2:      #595959;
  --danger:     #ac1c1d;
  --warning:    #945900;
  --yellow:     var(--warning);   /* alias: el JS del tablero usa --yellow */
  --chart-grid: rgba(0,0,0,.08);
  --radius:    12px;
  --header-h: 56px;
  /* Tipografías de marca (manual PC): Boldonse=display, Familjen=UI/cuerpo, JetBrains=datos */
  --font-display: 'Boldonse', system-ui, sans-serif;
  --font-body:    'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
/* MODO OSCURO (alternativo; el manual lo deja completo "por si acaso"). El toggle setea
   data-theme="dark". En oscuro el verde SÍ va como texto/ícono (#77FF9B), y el relleno
   coincide (--green-solid = --green = #77FF9B). */
:root[data-theme="dark"] {
  --bg:         #121a15;
  --surface:    #1b241e;
  --surface2:   #26322b;
  --border:     rgba(224,255,235,.09);
  --green:      #77ff9b;
  --green-solid:#77ff9b;
  --blue:       #91c1ff;
  --muted:      #9a9d9a;   /* antes #7f817f: no llegaba a 4,5:1 (mínimo WCAG AA) sobre los fondos del tema */
  --text:       #eef1ef;
  --text2:      #a9b0ab;
  --danger:     #ffa196;
  --warning:    #ffc973;
  --yellow:     var(--warning);   /* alias: el JS del tablero usa --yellow */
  --chart-grid: rgba(255,255,255,.06);
  color-scheme: dark;
}
html, body { height: 100%; font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }
/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
/* ── Utils ────────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-4    { gap: 4px; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.gap-16   { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ── Typography ────────────────────────────────────────────────────────────── */
.t-muted  { color: var(--muted); }
/* Oculto visual: solo lo leen los lectores de pantalla (avisos de sección, errores, etc.) */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
/* Error de validación junto al campo */
.field-error{color:var(--danger);font-size:12px;margin-top:4px;min-height:0}
.input[aria-invalid="true"]{border-color:var(--danger)}
.t-green  { color: var(--green); }
.t-blue   { color: var(--blue); }
.t-danger { color: var(--danger); }
.t-warn   { color: var(--warning); }
.t-xs  { font-size: 11px; }
.t-sm  { font-size: 12px; }
.t-md  { font-size: 13px; }
.t-lg  { font-size: 16px; }
.t-xl  { font-size: 20px; }
.t-2xl { font-size: 26px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--green-solid); color: #18231c; }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-danger { background: rgba(255,161,150,.12); color: var(--danger); }
.btn-danger:hover { background: rgba(255,161,150,.22); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
/* ── Form controls ──────────────────────────────────────────────────────────── */
.input, .select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus { border-color: var(--green); }
.input[aria-invalid="true"], .input[aria-invalid="true"]:focus { border-color: var(--danger); }
.select option { background: var(--surface); }
/* ── Badge ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: rgba(119,255,155,.15); color: var(--green); }
.badge-blue  { background: rgba(145,193,255,.15); color: var(--blue); }
.badge-gray  { background: var(--surface2); color: var(--text2); }
/* ── Skeleton loader ────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .35; }
}
@keyframes aiDot {
  0%,80%,100% { opacity: .2; transform: scale(.8); }
  40%         { opacity: 1;  transform: scale(1); }
}
.skel {
  background: var(--surface2);
  border-radius: 6px;
  animation: pulse 1.6s ease-in-out infinite;
}
.skel-text  { height: 14px; }
.skel-title { height: 20px; width: 55%; }
.skel-big   { height: 40px; width: 70px; }
/* ── Login overlay ──────────────────────────────────────────────────────────── */
#loginOverlay {
  position: fixed; inset: 0;
  background: rgba(10,11,18,.96);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
}
.login-logo {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 28px;
  text-align: center;
}
.login-logo .p-green { color: var(--green); }
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.login-field label { font-size: 12px; font-weight: 500; color: var(--text2); }
.login-field .input { width: 100%; }
#loginError { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 18px; }
/* ── Header ─────────────────────────────────────────────────────────────────── */
#header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 24px;
  z-index: 100;
}
.logo { font-family: var(--font-display); font-size: 16px; letter-spacing: .01em; }
.logo .p-green { color: var(--green); }
.nav-tabs { display: flex; gap: 4px; flex: 1; }
.nav-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text2);
  transition: background .15s, color .15s;
  cursor: pointer;
  display: block;
  text-decoration: none;
}
.nav-tab:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.nav-tab:hover { background: var(--surface2); color: var(--text); }
.nav-tab.active { background: rgba(119,255,155,.12); color: var(--green); }
.header-right { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; border: none; background: none; cursor: pointer; }
.org-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  font-size: 12px; font-weight: 500;
}
.org-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-solid);
  color: #18231c;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* ── App layout ─────────────────────────────────────────────────────────────── */
#app {
  padding-top: var(--header-h);
  min-height: 100vh;
}
.tab-view { display: none; }
.tab-view.active { display: flex; }
/* ── TABLERO layout ─────────────────────────────────────────────────────────── */
#tabTablero {
  gap: 0;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
/* Sidebar */
.t-sidebar {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.t-sidebar-header {
  padding: 14px 14px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.t-sidebar-body { overflow-y: auto; flex: 1; padding: 8px 0; }
.sess-date-group { padding: 8px 14px 4px; font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.sess-item-mini {
  padding: 8px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.sess-item-mini:hover { background: var(--surface2); }
.sess-item-mini.active {
  border-left-color: var(--green);
  background: rgba(119,255,155,.07);
}
.sess-item-mini .s-device { font-size: 11px; font-weight: 600; color: var(--text); }
.sess-item-mini .s-meta   { font-size: 10px; color: var(--muted); margin-top: 1px; }
/* Center + Right */
.t-center {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.t-right {
  width: 260px;
  min-width: 260px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Big stat row */
.big-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.big-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.big-stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.big-stat-icon.green { background: rgba(119,255,155,.12); }
.big-stat-icon.blue  { background: rgba(145,193,255,.12); }
.big-stat-num { font-size: 30px; font-weight: 800; line-height: 1; }
.big-stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 500; }
/* Org center card */
.org-center-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.org-big-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), #00bfa5);
  color: #18231c;
  font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
/* Player table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 9px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.arrow-link { color: var(--green); font-size: 14px; }
/* Sub-tabs */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.sub-tab {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sub-tab.active { background: rgba(119,255,155,.12); color: var(--green); }
.sub-tab:hover:not(.active) { background: var(--surface2); color: var(--text); }
/* Squad scroll */
.squad-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.squad-card {
  min-width: 160px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  flex-shrink: 0;
}
.squad-card-name { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.squad-card-meta { font-size: 11px; color: var(--text2); line-height: 1.8; }
/* Activity feed */
.feed-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.feed-body { flex: 1; min-width: 0; }
.feed-date { font-size: 12px; font-weight: 600; }
.feed-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* ── SEASON layout ──────────────────────────────────────────────────────────── */
#tabSeason {
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filters-bar label { font-size: 11px; font-weight: 600; color: var(--muted); }
.filters-bar .select { padding: 6px 10px; font-size: 12px; }
.chart-card { flex: 1; }
.chart-wrap { position: relative; height: 340px; }
/* ── Squad Season (multi-club overview) ─────────────────────────────────────── */
#squadSeasonSection {
  display: none;
}
#squadSeasonSection.visible {
  display: block;
}
.squad-season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.squad-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  position: relative;
  overflow: hidden;
}
.squad-card:hover { border-color: var(--green); transform: translateY(-2px); }
.squad-card.active-club {
  border-color: var(--green);
  background: linear-gradient(135deg, rgba(119,255,155,.06) 0%, var(--surface) 80%);
}
.squad-card-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--border);
}
.squad-card-bar.active { background: var(--green-solid); }
.squad-card-logo {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; display: block; margin-bottom: 10px;
}
.squad-card-initials {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: var(--green);
  margin-bottom: 10px; flex-shrink: 0;
}
.squad-card-name {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.squad-card-meta { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.squad-card-active-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: .05em;
  background: rgba(119,255,155,.15); color: var(--green);
  border: 1px solid rgba(119,255,155,.3); border-radius: 10px;
  padding: 1px 7px; margin-bottom: 8px; text-transform: uppercase;
}
/* ── Táctico ────────────────────────────────────────────────────────────────── */
#tabTactico { height:calc(100vh - var(--header-h)); overflow:hidden; padding:12px; gap:0; }
.tactico-layout { display:grid; grid-template-columns:250px 1fr; gap:10px; flex:1; min-height:0; overflow:hidden; }
.tactico-sidebar { display:flex; flex-direction:column; gap:6px; overflow:hidden; }
.tactico-main { display:flex; flex-direction:column; overflow:hidden; }
.tactico-placeholder { display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; flex:1; color:var(--muted); font-size:14px; text-align:center; padding:32px; }
.tactico-field-wrap { position:relative; flex:1; min-height:0; min-width:0; background:#196e38; border-radius:8px; overflow:hidden; }
.tactico-field-wrap canvas { width:100%; height:100%; display:block; }
/* Escenario Táctico: video + cancha. Apilados por defecto; lado a lado en pantalla ancha. */
#tacticoStage { display:flex; flex-direction:column; gap:8px; flex:1; min-height:0; }
#tacticoVideoPane .yt-box { position:relative; width:100%; aspect-ratio:16/9; max-height:38vh; background:#000; border-radius:8px; overflow:hidden; }
@media (min-width:980px) {
  #tacticoStage.has-video { flex-direction:row; align-items:stretch; }
  #tacticoStage.has-video > #tacticoVideoPane { flex:0 0 58%; min-width:0; }
  #tacticoStage.has-video > #tacticoVideoPane .yt-box { flex:1; aspect-ratio:auto; max-height:none; min-height:0; }
}
.tactico-controls { display:flex; align-items:center; gap:8px; background:var(--surface2);
  border-radius:8px; padding:8px 12px; flex-shrink:0; }
.tactico-scrubber { flex:1; cursor:pointer; accent-color:var(--green); }
.tactico-ctrl-btn { background:var(--surface2); border:none; border-radius:6px; color:var(--text);
  width:32px; height:32px; cursor:pointer; font-size:14px; display:flex; align-items:center;
  justify-content:center; transition:background .12s; flex-shrink:0; }
.tactico-ctrl-btn:hover { background:var(--border); }
.tactico-time { font-family:var(--font-mono),monospace; font-size:13px; font-weight:600; white-space:nowrap; min-width:38px; }
.tactico-legend { display:flex; flex-wrap:wrap; gap:6px; padding:2px 0; flex-shrink:0; }
.tactico-legend-item { display:flex; align-items:center; gap:6px; font-size:12px; padding:2px 7px 2px 5px; border-radius:6px; cursor:pointer; user-select:none; border:1px solid transparent; }
.tactico-legend-item.is-sel { background:var(--surface2); border-color:var(--green,#77ff9b); }
.tactico-legend-item.is-hidden .tactico-legend-dot, .tactico-legend-item.is-hidden .tactico-legend-name { opacity:.32; }
.tactico-legend-dot { width:13px; height:13px; border-radius:50%; flex-shrink:0; }
.tactico-eye { font-size:11px; opacity:.55; line-height:1; }
.tactico-eye:hover { opacity:1; }
.tactico-events { flex-shrink:0; margin-top:2px; }
/* Sincronizar: 2 líneas de tiempo (video + cuartos) alineadas sobre el eje del video; se arrastra la de cuartos. */
.tac-sync-tracks { position:relative; }
.tac-sync-track { position:relative; width:100%; height:24px; background:var(--surface2); border-radius:5px; box-shadow:inset 0 0 0 1px var(--border); }
.tac-sync-video { cursor:pointer; margin-bottom:6px; background:linear-gradient(rgba(145,193,255,.10),rgba(145,193,255,.03)); }
.tac-sync-splits { cursor:grab; touch-action:none; overflow:hidden; }
.tac-sync-splits:active { cursor:grabbing; }
.tac-sync-splits-inner { position:absolute; inset:0; }
.tac-sync-cap { position:absolute; top:1px; left:6px; font-size:9px; color:var(--muted); pointer-events:none; z-index:1; }
.tac-sync-block { position:absolute; top:2px; height:20px; background:rgba(145,193,255,.26); border:1px solid rgba(145,193,255,.5); border-radius:3px; overflow:hidden; pointer-events:none; }
.tac-sync-block span { position:absolute; top:4px; left:4px; font-size:9px; color:var(--text); white-space:nowrap; text-shadow:0 1px 2px rgba(0,0,0,.6); }
.tac-sync-bhandle { position:absolute; top:-4px; height:32px; width:16px; margin-left:-8px; z-index:5; cursor:ew-resize; touch-action:none; display:flex; align-items:center; justify-content:center; }
.tac-sync-bhandle b { width:4px; height:100%; border-radius:3px; background:#91c1ff; box-shadow:0 0 0 1px rgba(0,0,0,.45); }
.tac-sync-bhandle.on b { background:#77ff9b; }
.tac-sync-playhead { position:absolute; top:0; height:54px; width:0; border-left:2px solid #ffc973; box-shadow:0 0 6px rgba(255,201,115,.55); pointer-events:none; z-index:6; margin-left:-1px; }
.tactico-events-head { display:flex; align-items:center; gap:6px; font-size:12px; margin-bottom:4px; }
.tactico-events-list { display:flex; flex-wrap:wrap; gap:4px; max-height:132px; overflow:auto; }
.tactico-event { display:flex; align-items:center; gap:8px; font-size:12px; padding:4px 9px; border-radius:6px; border:1px solid var(--border); background:var(--surface); color:var(--text); cursor:pointer; white-space:nowrap; }
.tactico-event:hover { border-color:var(--green,#77ff9b); background:var(--surface2); }
.tactico-event-header { font-size:13px; font-weight:600; color:var(--text); flex-shrink:0; }
.tactico-sidebar-item { padding:10px 12px; border-radius:8px; cursor:pointer;
  background:var(--surface2); display:flex; flex-direction:column; gap:3px; transition:background .12s; }
.tactico-sidebar-item:hover { background:var(--border); }
.tactico-sidebar-item.active { border:1.5px solid var(--green); }
.tactico-sidebar-item-name { font-size:13px; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tactico-sidebar-item-meta { font-size:11px; color:var(--muted); }

/* ── EQUIPO layout ──────────────────────────────────────────────────────────── */
#tabEquipo {
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}
.top-performers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.performer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.performer-icon { font-size: 24px; margin-bottom: 8px; }
.performer-name { font-size: 14px; font-weight: 700; }
.performer-val  { font-size: 20px; font-weight: 800; color: var(--green); margin-top: 2px; }
.performer-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* Expandable row */
.expand-row td { background: var(--surface2) !important; }
.expand-content { padding: 10px 10px 8px; }
.mini-sess { font-size: 11px; color: var(--text2); display: flex; gap: 20px; }
/* ── SESIONES layout ─────────────────────────────────────────────────────────── */
#tabSesiones {
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.compare-panel { display: flex; flex-direction: column; gap: 12px; }
.compare-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.compare-stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
}
.compare-stat-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.compare-stat-val   { font-size: 18px; font-weight: 800; margin-top: 2px; }
.diff-table { width: 100%; border-collapse: collapse; }
.diff-table th {
  text-align: left;
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
}
.diff-table td { padding: 9px 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.diff-table tr:last-child td { border-bottom: none; }
.diff-better { color: var(--green); font-weight: 700; }
.diff-worse  { color: var(--danger); }
/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,11,18,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px;
  width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-title {
  font-size: 16px; font-weight: 700;
  margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-field { display: flex; flex-direction: column; gap: 5px; }
.modal-field label { font-size: 11px; font-weight: 600; color: var(--text2); }
.modal-field .input,
.modal-field .select { width: 100%; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
  position: relative;
}
.photo-upload-area:hover { border-color: var(--green); }
.photo-preview {
  width: 70px; height: 70px; border-radius: 50%;
  object-fit: cover;
  display: block; margin: 0 auto 8px;
  border: 2px solid var(--green);
}
/* Org switcher */
.org-switcher {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 230px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.org-switch-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.org-switch-item:hover { background: var(--surface2); }
.org-switch-item.active { background: rgba(119,255,155,.08); }
.org-switch-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.org-switch-dot.active { background: var(--green-solid); }
/* Radar wrap */
.sess-sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: var(--surface); transition: background .12s;
}
.sess-sidebar-item:hover  { background: var(--surface2); }
.sess-sidebar-item.active { background: rgba(119,255,155,.1); border-left: 2px solid var(--green); }
/* Evento con varias sesiones: una fila plegada que se abre para ver a cada jugador */
.sess-evt-head { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:8px; cursor:pointer; background:var(--surface); border:1px solid var(--border); transition:background .12s; }
.sess-evt-head:hover { background:var(--surface2); }
.sess-evt-head .sess-evt-car { font-size:12px; color:var(--muted); width:10px; flex-shrink:0; }
.sess-evt-car::before { content:'\25B8'; }
.sess-evt.open .sess-evt-car::before { content:'\25BE'; }
.sess-evt-n { font-size:10px; font-weight:700; padding:2px 7px; border-radius:99px; background:var(--surface2); color:var(--muted); flex-shrink:0; }
.sess-evt-body { display:none; flex-direction:column; gap:3px; margin:3px 0 4px 12px; padding-left:6px; border-left:2px solid var(--border); }
.sess-evt.open .sess-evt-body { display:flex; }
.squad-cmp-wrap { position: relative; height: 220px; }
/* Venue list */
.venue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.venue-item {
  background: var(--surface2); border-radius: 10px; padding: 12px 14px;
  border: 1px solid var(--border); transition: border-color .15s; position: relative;
}
.venue-item:hover { border-color: rgba(255,255,255,.15); }
.venue-item-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.venue-item-meta { font-size: 11px; color: var(--text2); }
.venue-item-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.venue-arrow-indicator {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--green); margin-left: 6px;
}
.radar-wrap { position: relative; height: 260px; margin: 0 auto; max-width: 340px; }
/* Breakdown table */
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.breakdown-table th {
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right;
}
.breakdown-table th:first-child { text-align: left; }
.breakdown-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.breakdown-table td:first-child { text-align: left; font-weight: 500; }
.breakdown-table tr:last-child td { border-bottom: none; }
/* ── Admin tab ─────────────────────────────────────────────────────────────── */
#tabAdmin {
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}
.admin-section { display: flex; flex-direction: column; gap: 16px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; font-size: 10px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.admin-table td {
  padding: 8px 10px; font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.025); }
.admin-table-wrap { max-height: 400px; overflow-y: auto; border-radius: 8px; border: 1px solid var(--border); }
/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(60px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  transition: transform .25s, opacity .25s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.toast-bad { border-color: var(--danger); color: var(--danger); }

/* ── Session detail: resumen + actividad lado a lado ──────────────────────── */
.sess-top-row{display:grid;grid-template-columns:220px 1fr;gap:12px;align-items:stretch}
.sess-summary-card{display:flex;flex-direction:column;justify-content:center;gap:10px}
.sess-summary-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.sess-summary-name{font-size:15px;font-weight:700;line-height:1.3}
.sess-summary-meta{font-size:11px;color:var(--muted);margin-top:3px;line-height:1.4}
.sess-summary-score{width:48px;height:48px;border-radius:50%;border:3px solid var(--green);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.sess-summary-score-num{font-size:16px;font-weight:800}
.sess-summary-divider{height:1px;background:var(--border)}
.sess-summary-icons{display:flex;justify-content:space-between;gap:6px}
.sess-summary-icon-item{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:12px;font-weight:700}
.sess-summary-icon-item span{font-size:16px}
#sessActivityCard{display:flex;flex-direction:column}
@media(max-width:700px){.sess-top-row{grid-template-columns:1fr}}

/* ── Session detail maps (v3) ─────────────────────────────────────────────── */
.sess-maps-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;align-items:start}
@media(max-width:820px){.sess-maps-grid{grid-template-columns:1fr}}
.sess-map-dots{display:flex;justify-content:center;gap:8px;margin-top:10px}
.sess-map-dots .dot{width:8px;height:8px;border-radius:50%;background:var(--muted);cursor:pointer;transition:background .15s}
.sess-map-dots .dot.active{background:var(--green-solid)}
@media(max-width:600px){.sess-vol-int-grid{grid-template-columns:1fr!important}}

/* ── Header responsive ──────────────────────────────────────────────────────── */
@media(max-width:700px){
  /* Nav tabs: horizontal scroll, no wrap */
  header nav { overflow-x:auto; -webkit-overflow-scrolling:touch; flex-shrink:0; scrollbar-width:none; }
  header nav::-webkit-scrollbar { display:none; }
  /* Header right: hide less-used buttons, keep Descargar datos + Salir */
  .header-right .btn-hide-mobile { display:none !important; }
  .header-right { gap:6px; }
}
.sess-map-canvas-wrap{position:relative;width:100%;aspect-ratio:105/70;background:#196e38;border-radius:6px;overflow:hidden}
.sess-map-canvas-wrap.sport-hockey{aspect-ratio:914/550}
.sess-map-canvas-wrap.sport-rugby{aspect-ratio:120/70}
/* ── Rugby: Contactos · Back in Game ── */
.big-card{display:flex;flex-direction:column;gap:12px}
.big-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
.big-sub{font-size:11px;color:var(--muted)}
.big-grid{display:grid;grid-template-columns:minmax(260px,400px) minmax(0,1fr);gap:16px;align-items:start}
.big-legend{display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:6px;font-size:11px;color:var(--muted)}
.big-legend i,.big-dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:5px;vertical-align:middle}
.big-stats{display:flex;flex-direction:column;gap:10px;min-width:0}
.big-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px}
/* Mapa del arquero/a (2026-11-29) */
.arq-mapa{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--border);padding-top:10px}
.arq-mapa-vistas{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
.arq-mapa-vistas figure{margin:0;display:flex;flex-direction:column;gap:6px;max-width:620px}
.arq-svg{width:100%;height:auto;border-radius:8px;display:block}
/* Secciones plegables del detalle de sesión (2026-11-30) */
.secc-head{cursor:pointer;align-items:center;flex-wrap:nowrap;border-radius:8px}
.secc-head:focus-visible{outline:2px solid var(--green);outline-offset:4px}
.secc-chev{font-size:14px;color:var(--muted);transition:transform .15s;flex-shrink:0}
.secc-plegable.abierta .secc-chev{transform:rotate(90deg)}
.secc-plegable:not(.abierta){gap:0}
.arq-mapa-det{border-top:1px solid var(--border);padding-top:10px}
.arq-mapa-det>summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px}
.arq-mapa-det>summary::-webkit-details-marker{display:none}
.arq-mapa-det>summary::before{content:'▸';color:var(--muted);transition:transform .15s}
.arq-mapa-det[open]>summary::before{transform:rotate(90deg)}
.arq-mapa-det>.arq-mapa{border-top:0;padding-top:8px}
.big-kpi{background:var(--surface2);border-radius:8px;padding:8px 10px}
.big-kpi-lbl{font-size:10px;font-weight:600;color:var(--muted);letter-spacing:.05em;text-transform:uppercase}
.big-kpi-val{font-size:20px;font-weight:700;color:var(--text);margin-top:2px}
.big-kpi-sub{font-size:10px;color:var(--muted);margin-top:2px}
.big-bar-row{display:grid;grid-template-columns:110px minmax(0,1fr);gap:8px;align-items:center}
.big-bar-lbl{font-size:12px;color:var(--text2)}
.big-table td,.big-table th{white-space:nowrap}
.big-detalle summary{cursor:pointer;font-size:12px;color:var(--text2)}
.big-scroll{max-height:240px;overflow:auto;margin-top:6px}
@media(max-width:900px){.big-grid{grid-template-columns:1fr}}
.sess-map-title{font-size:11px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}
.zone-bar{display:flex;height:22px;border-radius:5px;overflow:hidden;gap:2px}
.zone-bar-seg{display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:#fff;letter-spacing:.02em}
.zone-legend{display:flex;flex-direction:column;gap:5px;margin-top:8px}
.zone-legend-row{display:flex;align-items:center;gap:7px;font-size:12px}
.zone-dot{width:10px;height:10px;border-radius:50%}
/* Activity chart */
.activity-chart-wrap{position:relative;flex:1;min-height:140px;cursor:pointer;background:rgba(255,255,255,.03);border-radius:6px;overflow:hidden}
.activity-chart-wrap:hover::after{content:'🔍 Ampliar';position:absolute;top:5px;right:8px;font-size:11px;background:rgba(0,0,0,.6);padding:2px 7px;border-radius:4px;color:#fff;pointer-events:none}
/* Activity modal */
.act-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.87);z-index:9000;display:flex;align-items:center;justify-content:center;padding:12px}
.act-modal-inner{background:var(--surface);border-radius:12px;padding:20px;width:min(98vw,1020px);max-height:92vh;overflow-y:auto;display:flex;flex-direction:column;gap:14px}
.act-modal-chartbox{position:relative;height:240px;flex-shrink:0;user-select:none;touch-action:pan-y}
.act-sel-overlay{position:absolute;top:0;height:100%;background:rgba(119,255,155,.18);border:2px solid var(--green);pointer-events:none;display:none}
.act-crop-strip{position:relative;height:46px;flex-shrink:0;margin-top:6px;user-select:none;touch-action:none}
.act-crop-track{position:absolute;inset:0;overflow:hidden;border-radius:6px;background:#11161d;box-shadow:inset 0 0 0 1px var(--border)}
.act-crop-track canvas{position:absolute;inset:0;width:100%;height:100%}
.act-crop-dim{position:absolute;top:0;height:100%;background:rgba(8,11,16,.60);pointer-events:none;z-index:1}
.act-crop-win{position:absolute;top:0;height:100%;background:rgba(145,193,255,.08);border-left:2px solid #91c1ff;border-right:2px solid #91c1ff;pointer-events:none;z-index:2}
.act-crop-handle{position:absolute;top:0;height:100%;width:26px;margin-left:-13px;cursor:ew-resize;touch-action:none;z-index:3;display:flex;align-items:center;justify-content:center}
.act-crop-handle b{width:4px;height:60%;border-radius:3px;background:#91c1ff;box-shadow:0 0 0 1px rgba(0,0,0,.5)}
/* Manijas 🟠 para corregir los bordes de un tramo ya hecho (se elige con ✏️ en la tabla). Van SOBRE el gráfico, no en la barra de crop. */
.act-edit-handle{position:absolute;width:24px;margin-left:-12px;cursor:ew-resize;touch-action:none;z-index:4;display:none;align-items:center;justify-content:center}
.act-edit-handle b{width:4px;height:100%;border-radius:3px;background:#ffc973;box-shadow:0 0 0 1px rgba(0,0,0,.55)}
.split-table{width:100%;border-collapse:collapse;font-size:12px}
.split-table tr.sel-edit{background:rgba(255,201,115,.12)}
.split-table tr.sel-edit td{color:var(--fg)}
.split-table th{font-size:11px;font-weight:600;color:var(--muted);text-transform:uppercase;padding:5px 8px;border-bottom:1px solid var(--border)}
.split-table td{padding:6px 8px;border-bottom:1px solid var(--border)}
.split-table tr:last-child td{border-bottom:none}
.act-modal-btns{display:flex;gap:8px;flex-wrap:wrap}

/* ── Report Modals ─────────────────────────────────────────────────────────── */
.report-overlay{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:300;display:flex;align-items:flex-start;justify-content:center;overflow-y:auto;padding:16px 0}
.report-modal{background:var(--surface);border-radius:14px;width:min(98vw,1060px);margin:auto;display:flex;flex-direction:column;position:relative}
.report-modal-header{display:flex;align-items:center;gap:14px;padding:20px 24px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.report-modal-header h2{margin:0;font-size:18px;font-weight:700;color:var(--text)}
.report-modal-body{padding:20px 24px;display:flex;flex-direction:column;gap:16px}
.report-close{margin-left:auto;background:none;border:none;color:var(--muted);font-size:20px;cursor:pointer;padding:4px 8px;line-height:1;border-radius:6px}
.report-close:hover{background:var(--bg);color:var(--text)}
.report-summary-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px}
.report-stat-card{background:var(--bg);border-radius:10px;padding:14px 16px;display:flex;flex-direction:column;gap:4px}
.report-stat-val{font-size:22px;font-weight:700;color:var(--text);line-height:1.1}
.report-stat-lbl{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.report-filter-bar{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.report-filter-bar label{font-size:12px;color:var(--muted);white-space:nowrap}
.report-chart-box{position:relative;height:280px}
.report-section-title{font-size:13px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:6px}
.report-sessions-list{overflow-x:auto}
.report-sessions-list table{width:100%;border-collapse:collapse;font-size:12px}
.report-sessions-list th{font-size:11px;color:var(--muted);text-transform:uppercase;padding:6px 10px;border-bottom:1px solid var(--border);white-space:nowrap;text-align:right}
.report-sessions-list th:first-child,.report-sessions-list td:first-child{text-align:left}
.report-sessions-list td{padding:7px 10px;border-bottom:1px solid var(--border);text-align:right;white-space:nowrap}
.report-sessions-list tr:hover td{background:var(--bg)}
.report-metric-select{background:var(--bg);border:1px solid var(--border);color:var(--text);border-radius:8px;padding:5px 10px;font-size:12px;cursor:pointer}
.report-team-table-wrap{overflow-x:auto}
.report-team-table{width:100%;border-collapse:collapse;font-size:12px}
.report-team-table th{font-size:11px;color:var(--muted);text-transform:uppercase;padding:7px 10px;border-bottom:1px solid var(--border);white-space:nowrap;text-align:right}
.report-team-table th:first-child,.report-team-table td:first-child{text-align:left}
.report-team-table td{padding:8px 10px;border-bottom:1px solid var(--border);text-align:right}
.report-team-table tr:hover td{background:var(--bg)}
.report-session-checks{display:flex;flex-direction:column;gap:6px;max-height:220px;overflow-y:auto;background:var(--bg);border-radius:8px;padding:10px 14px;border:1px solid var(--border)}
.report-session-check{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text);cursor:pointer}
.report-session-check input[type=checkbox]{accent-color:var(--green);width:14px;height:14px;cursor:pointer}
.report-player-avatar{width:30px;height:30px;border-radius:50%;object-fit:cover;display:inline-block;vertical-align:middle}
.report-player-initials{width:30px;height:30px;border-radius:50%;background:var(--surface2);display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--muted);vertical-align:middle}
/* ── Report Builder ─────────────────────────────────────────────────────────── */
.rb-title-input{background:transparent;border:none;border-bottom:2px solid var(--border);color:var(--text);font-size:18px;font-weight:700;padding:4px 0;outline:none;width:100%}
.rb-title-input:focus{border-bottom-color:var(--green)}
.rb-subtitle-input{background:transparent;border:none;border-bottom:1px solid var(--border);color:var(--muted);font-size:12px;padding:3px 0;outline:none;width:100%}
.rb-subtitle-input:focus{border-bottom-color:var(--green)}
.rb-session-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px;max-height:220px;overflow-y:auto}
.rb-session-card{display:flex;align-items:flex-start;gap:8px;background:var(--bg);border-radius:8px;padding:10px 12px;border:2px solid var(--border);cursor:pointer;transition:border-color .15s,background .15s;user-select:none}
.rb-session-card.selected{border-color:var(--green);background:rgba(119,255,155,.07)}
.rb-session-card input[type=checkbox]{accent-color:var(--green);width:14px;height:14px;margin-top:2px;flex-shrink:0;cursor:pointer}
.rb-session-card-info{flex:1;min-width:0}
.rb-session-card-name{font-size:12px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rb-session-card-meta{font-size:11px;color:var(--muted);margin-top:1px}
.rb-metrics-table{width:100%;border-collapse:collapse;font-size:12px}
.rb-metrics-table th{font-size:11px;color:var(--muted);text-transform:uppercase;padding:7px 10px;border-bottom:1px solid var(--border);white-space:nowrap;text-align:right;background:var(--surface2)}
.rb-metrics-table th:first-child{text-align:left}
.rb-metrics-table td{padding:7px 10px;border-bottom:1px solid var(--border);text-align:right;white-space:nowrap}
.rb-metrics-table td:first-child{text-align:left;color:var(--text);font-weight:500}
.rb-metrics-table tr:hover td{background:var(--surface2)}
.rb-metrics-table .col-total{color:var(--green);font-weight:700}
.rb-metrics-table .col-avg{color:var(--blue)}
.rb-custom-row{display:flex;align-items:center;gap:6px;margin-bottom:6px;background:var(--bg);border-radius:8px;padding:8px 12px;flex-wrap:wrap}
.rb-custom-label-input{background:var(--surface2);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:5px 8px;font-size:12px;width:150px;flex-shrink:0}
.rb-custom-label-input:focus{outline:none;border-color:var(--green)}
.rb-custom-eq{color:var(--muted);font-size:13px;padding:0 2px;flex-shrink:0}
.rb-custom-result{font-size:14px;font-weight:700;color:var(--green);min-width:80px;text-align:right;flex-shrink:0}
.rb-notes{width:100%;min-height:90px;background:var(--bg);border:1px solid var(--border);border-radius:8px;color:var(--text);font-size:13px;padding:12px;resize:vertical;box-sizing:border-box;font-family:inherit}
.rb-notes:focus{outline:none;border-color:var(--green)}
/* ── Impresión de reportes ─────────────────────────────────────────────────────
   El contenido a imprimir se CLONA en #printArea (ver printReport()): los canvas
   pasan a <img> con sus píxeles actuales y los inputs/selects a texto plano.
   Es el patrón robusto — no depende de re-mostrar modales fixed/flex en print,
   que quebraba el layout y salían hojas negras o vacías. */
#printArea{display:none}
#printArea{
  /* Paleta clara scopeada: todo lo que usa var(--*) adentro imprime legible */
  --bg:#ffffff; --surface:#ffffff; --surface2:#f4f5f7; --border:#d9dce3;
  --green:#0a8f4d; --blue:#1d5fd6; --muted:#555a63; --text:#111318; --text2:#3f4550;
  --danger:#b91c1c; --warning:#b45309;
  background:#fff; color:#111;
}
#printArea .report-modal{width:100%!important;max-width:none!important;border:none!important;border-radius:0!important;background:#fff!important;color:#111!important}
#printArea .report-modal *{box-shadow:none!important;text-shadow:none!important}
#printArea .report-close,#printArea .report-print-btn,#printArea .report-apply-btn,
#printArea .report-filter-bar,#printArea .report-session-checks,
#printArea .rb-session-grid,#printArea button{display:none!important}
#printArea .report-stat-card{border:1px solid #ddd;background:#f9f9f9}
#printArea .report-chart-box{background:#fff;border:1px solid #eee}
#printArea img.print-chart{width:100%;max-height:240px;object-fit:contain;display:block}
#printArea table{width:100%}
@media print {
  @page { margin: 12mm; }
  body > *:not(#printArea){display:none!important}
  #printArea{display:block!important}
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* ── Mobile (≤767px) · Fase 1: shell + TABLERO ──────────────────────────────── */
@media (max-width:767px){
  /* Header con menú hamburguesa */
  #header{ flex-wrap:wrap; height:auto; min-height:var(--header-h); padding:0 12px; gap:8px; }
  .nav-toggle{ display:flex; align-items:center; justify-content:center; margin-left:auto;
               width:38px; height:38px; border-radius:8px; font-size:20px; color:var(--text); background:var(--surface2); }
  .nav-tabs, .header-right{ display:none; }
  #header .logo{ flex-shrink:0; }
  #header.nav-open{ padding-bottom:10px; }
  #header.nav-open .nav-tabs,
  #header.nav-open .header-right{ display:flex; flex-direction:column; align-items:stretch; flex:0 0 100%; gap:4px; }
  #header.nav-open .nav-tabs{ border-top:1px solid var(--border); padding-top:8px; }
  #header.nav-open .header-right{ gap:8px; margin-top:4px; }
  #header.nav-open .header-right .btn-hide-mobile{ display:flex !important; }
  .nav-tab{ padding:11px 12px; font-size:13px; }
  .header-right .btn{ justify-content:flex-start; text-align:left; padding:10px 12px; }
  .org-pill{ max-width:none; align-self:flex-start; }

  /* TABLERO: resumen primero; sesiones y actividad como cards abajo */
  #tabTablero{ flex-direction:column; height:auto; overflow:visible; padding:12px; gap:12px; }
  .t-center{ order:1; padding:0; overflow-y:visible; }
  .t-sidebar{ order:2; width:100%; min-width:0; max-height:44vh; border-right:none;
              border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); overflow:hidden; }
  .t-right{ order:3; width:100%; min-width:0; border-left:none;
            border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); overflow:hidden; }
  /* Tablas anchas (plantel): scroll horizontal para que la flecha no quede afuera */
  .tbl-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  #playerSummaryTable td, #playerSummaryTable th{ white-space:nowrap; }

  /* Grids multi-columna → 1 columna */
  .big-stats-row{ grid-template-columns:1fr; }
  .tactico-layout{ grid-template-columns:1fr; height:auto; overflow:visible; }

  /* SESIONES: acordeón de cards (lista full-width + detalle bajo demanda) */
  #sesModeView{ grid-template-columns:1fr !important; overflow:visible !important; }
  #sessSidebar{ overflow-y:visible; }
  #sessDetailWrap{ display:none; overflow:visible; }
  #sessDetailWrap.show-mobile{ display:block; margin-top:12px; }
  .sess-sidebar-item{ border:1px solid var(--border); margin-bottom:6px; padding:11px 12px; }
  .sess-sidebar-item.expanded{ border-color:var(--green); background:rgba(119,255,155,.06); }
}
/* ── Sistema de iconos (Fase 1) — outline estilo Vuesax Linear: grilla 24, trazo 1.5, sin relleno,
   toman currentColor (el color del componente, como pide el manual). Tamaños del manual sm16/md20/lg24.
   NOTA: los paths son placeholders FIELES al estilo; se reemplazan por el export EXACTO del set Vuesax
   del Figma sin tocar nada mas (mismos ids ic-*). ── */
.ic{width:20px;height:20px;flex-shrink:0;display:inline-block;vertical-align:-.18em;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.ic-sm{width:16px;height:16px}
.ic-lg{width:24px;height:24px}

/* Menú "Avanzado" de la sección GPS */
.gps-avanzado{position:relative}
.gps-avanzado>summary{list-style:none;cursor:pointer}
.gps-avanzado>summary::-webkit-details-marker{display:none}
.gps-avanzado>summary::marker{content:''}
.gps-avanzado-menu{position:absolute;right:0;top:calc(100% + 4px);z-index:50;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 14px rgba(0,0,0,.14);padding:6px;white-space:nowrap}

/* ── Novedades / versiones del sistema ─────────────────────────────────────── */
.news-dot { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.news-box { width: min(560px, calc(100vw - 32px)); }
.news-rel { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.news-rel:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.news-rel-t { font-size: 15px; font-weight: 700; color: var(--text); }
.news-rel-d { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.news-badge { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--green); color: #000; vertical-align: middle; margin-left: 4px; }
.news-sec { margin-bottom: 10px; }
.news-sec-t { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.news-ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13px; line-height: 1.45; color: var(--text); }
.rel-form { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rel-grid textarea { resize: vertical; font-family: inherit; }
.rel-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 12px; }
.rel-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rel-row:last-child { border-bottom: none; }
.rel-row-acc { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) { .rel-grid { grid-template-columns: 1fr; } }

/* ── Temporada: control semanal y referencias ─────────────────────────────── */
.temp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.temp-head .select { width: auto; }
.temp-tabla th, .temp-tabla td { text-align: center; white-space: nowrap; }
.temp-tabla th:first-child, .temp-tabla td:first-child { text-align: left; }
.temp-tabla td.temp-cel { font-variant-numeric: tabular-nums; border-radius: 4px; }
.temp-c { display: inline-block; padding: 1px 6px; border-radius: 4px; margin: 2px 2px 0 0; background: var(--surface2, rgba(127,127,127,.12)); }
.temp-azul     { background: rgba(59,130,246,.28) !important; }
.temp-verde    { background: rgba(34,197,94,.24) !important; }
.temp-amarillo { background: rgba(250,204,21,.32) !important; }
.temp-rojo     { background: rgba(239,68,68,.34) !important; }
.temp-leyenda { margin-top: 8px; line-height: 1.9; }
.temp-alerta { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; margin-bottom: 6px; border-radius: 6px; font-size: 13px; border-left: 3px solid transparent; }
.temp-alerta.roja  { background: rgba(239,68,68,.12);  border-left-color: #ef4444; }
.temp-alerta.amar  { background: rgba(250,204,21,.12); border-left-color: #facc15; }
.temp-alerta.azul  { background: rgba(59,130,246,.12); border-left-color: #3b82f6; }
.temp-alerta small { color: var(--muted); }
.temp-alertas-det summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.temp-ref-campos { display: grid; grid-template-columns: 1fr 120px; gap: 6px 10px; align-items: center; }
.temp-ref-campos label { font-size: 13px; }
.temp-ref-campos .input { text-align: right; }
.temp-pto { font-size: 11px; color: var(--muted); }
