/* SPVA Multi-AI design system. Dark first, cyan = selection/activity/primary data, violet = advanced intelligence,
   status colours are semantic only (verified good / warning / error). 4px spacing scale. */
:root {
  --bg: #080b12; --surface: #101622; --card: #151d2b; --card-2: #1a2334; --line: #263247; --line-soft: #1d283a;
  --fg: #f1f5f9; --muted: #94a3b8; --faint: #64748b;
  --cyan: #35d6ff; --cyan-soft: rgba(53,214,255,.12); --cyan-line: rgba(53,214,255,.45);
  --violet: #8b7cff; --violet-soft: rgba(139,124,255,.14);
  --good: #36d399; --good-soft: rgba(54,211,153,.13);
  --warn: #f5b942; --warn-soft: rgba(245,185,66,.13);
  --bad: #fb7185; --bad-soft: rgba(251,113,133,.13);
  --info-soft: rgba(148,163,184,.13);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 28px; --t-3xl: 40px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --side-w: 244px; --side-w-min: 64px; --top-h: 60px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: var(--t-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--cyan); color: #04121a; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.shell.collapsed { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; padding: var(--s3) var(--s2); overflow-y: auto; overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); min-height: 44px; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: 0 0 auto; }
.brand .bn { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.brand .bn b { font-size: var(--t-lg); font-weight: 650; letter-spacing: .02em; }
.brand .bn span { font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s4); }
.nav .grp { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: var(--s4) var(--s3) var(--s1); white-space: nowrap; }
.nav a, .nav .soon { position: relative; display: flex; align-items: center; gap: var(--s3); padding: 8px var(--s3); border-radius: var(--r-md); color: var(--muted); font-size: var(--t-md); white-space: nowrap; min-height: 38px; }
.nav a:hover { background: var(--card); color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--cyan-soft); color: var(--fg); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cyan); }
.nav a[aria-current="page"] .icon { color: var(--cyan); }
.nav .soon { opacity: .55; cursor: default; }
.nav .tag { margin-left: auto; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; border-radius: 99px; background: var(--info-soft); color: var(--muted); }
.nav .tag.on { background: var(--good-soft); color: var(--good); }
.side .foot { margin-top: auto; padding-top: var(--s4); }
.collapse-btn { display: flex; align-items: center; gap: var(--s3); width: 100%; background: none; border: 1px solid var(--line-soft); border-radius: var(--r-md); color: var(--muted); padding: 8px var(--s3); white-space: nowrap; }
.collapse-btn:hover { color: var(--fg); background: var(--card); }
.shell.collapsed .bn, .shell.collapsed .nav .grp, .shell.collapsed .nav .lbl, .shell.collapsed .nav .tag, .shell.collapsed .collapse-btn .lbl { display: none; }
.shell.collapsed .nav a, .shell.collapsed .nav .soon, .shell.collapsed .collapse-btn { justify-content: center; padding-inline: 0; }
.shell.collapsed .collapse-btn .icon { transform: rotate(180deg); }
.scrim { position: fixed; inset: 0; background: rgba(4,7,12,.65); z-index: 40; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s5); background: rgba(8,11,18,.88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
.top h1 { font-size: var(--t-lg); font-weight: 600; white-space: nowrap; }
.top .ctx { color: var(--muted); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top .sp { flex: 1; }
.top .menu-btn { display: none; }
.icon-btn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; background: none; border: 1px solid var(--line-soft); border-radius: var(--r-md); color: var(--muted); }
.icon-btn:hover { color: var(--fg); background: var(--card); }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #1a0509; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.icon-btn .dot.warn { background: var(--warn); color: #231703; }
.statuspill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line-soft); font-size: var(--t-sm); white-space: nowrap; }
.statuspill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.statuspill.operativa i { background: var(--good); } .statuspill.con_avisos i { background: var(--warn); } .statuspill.con_errores i { background: var(--bad); }
.fresh { font-size: var(--t-sm); color: var(--muted); white-space: nowrap; }
.pop { position: absolute; right: var(--s5); top: calc(var(--top-h) - 6px); width: min(380px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 18px 50px rgba(0,0,0,.5); padding: var(--s3); z-index: 30; max-height: 70vh; overflow: auto; }
.pop h4 { font-size: var(--t-sm); color: var(--muted); font-weight: 500; padding: var(--s1) var(--s2) var(--s2); }

#view { padding: var(--s5); max-width: 1320px; width: 100%; margin: 0 auto; outline: none; }
.loading { color: var(--muted); padding: var(--s7) 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s5); }
.page-head h2 { font-size: var(--t-2xl); letter-spacing: -.02em; }
.page-head p { margin: var(--s1) 0 0; color: var(--muted); max-width: 70ch; }
.grid { display: grid; gap: var(--s4); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.row.between { justify-content: space-between; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); min-width: 0; }
.panel > .ph { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s4) var(--s4) 0; }
.panel > .ph h3 { font-size: var(--t-lg); }
.panel > .ph .sub { font-size: var(--t-sm); color: var(--muted); }
.panel > .pb { padding: var(--s4); }
.panel.flat { background: transparent; border-color: var(--line-soft); }
.panel.hero { background: linear-gradient(180deg, rgba(53,214,255,.06), rgba(21,29,43,0) 60%), var(--card); border-color: var(--line); }
.panel.adv { border-color: rgba(139,124,255,.35); }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.eyebrow.v { color: var(--violet); } .eyebrow.c { color: var(--cyan); }
.big { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--t-3xl); line-height: 1.05; letter-spacing: -.03em; font-weight: 500; }
.med { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--t-2xl); line-height: 1.1; letter-spacing: -.02em; font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font-size: var(--t-sm); }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line-soft); margin: var(--s3) 0; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--info-soft); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.good, .badge.CORE, .badge.ok, .badge.confirmed, .badge.operativa { background: var(--good-soft); color: var(--good); }
.badge.warn, .badge.MIX, .badge.partial, .badge.questionable, .badge.con_avisos, .badge.probable { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge.TRASH, .badge.failed, .badge.out, .badge.con_errores { background: var(--bad-soft); color: var(--bad); }
.badge.cyan, .badge.evaluated { background: var(--cyan-soft); color: var(--cyan); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.chip { display: inline-block; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; line-height: 20px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s4); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card-2); color: var(--fg); font-weight: 500; font-size: var(--t-md); }
.btn:hover { border-color: var(--cyan-line); text-decoration: none; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #04121a; }
.btn.primary:hover { box-shadow: 0 0 0 4px var(--cyan-soft); }
.btn.sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.input, .select { min-height: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 var(--s3); min-width: 0; width: 100%; }
.select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover { border-color: var(--cyan-line); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); align-items: end; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { background: none; border: 0; border-radius: 8px; padding: 5px 12px; color: var(--muted); font-size: var(--t-sm); font-weight: 500; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--cyan-soft); color: var(--cyan); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { padding: 10px var(--s3); text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--surface); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--fg); }
th[aria-sort] { color: var(--cyan); }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover td { background: rgba(53,214,255,.05); }
tbody tr.click:focus-visible { outline-offset: -2px; }
td .wrap-ok { white-space: normal; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s2) 0; color: var(--muted); font-size: var(--t-sm); flex-wrap: wrap; }

/* probability bar */
.pbar { display: inline-flex; align-items: center; gap: var(--s2); min-width: 120px; }
.pbar .tr { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 56px; }
.pbar .fl { position: absolute; inset: 0 auto 0 0; background: var(--cyan); border-radius: 3px; }
.pbar .v { font-family: var(--mono); font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: right; }
.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.stackbar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--t-sm); color: var(--muted); }
.legend > span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c, var(--faint)); }

/* states */
.empty { border: 1px dashed var(--line); border-radius: var(--r-lg); padding: var(--s5); color: var(--muted); background: rgba(21,29,43,.4); }
.empty b { color: var(--fg); display: block; margin-bottom: 4px; font-weight: 600; }
.note { border-left: 3px solid var(--cyan-line); background: var(--cyan-soft); padding: var(--s3) var(--s4); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: var(--t-sm); color: var(--muted); }
.note.warn { border-color: var(--warn); background: var(--warn-soft); } .note.bad { border-color: var(--bad); background: var(--bad-soft); }
.note b { color: var(--fg); }
.alert { display: grid; grid-template-columns: 18px 1fr; gap: var(--s3); padding: var(--s3); border-radius: var(--r-md); }
.alert + .alert { margin-top: 2px; }
.alert .t { font-weight: 600; font-size: var(--t-sm); } .alert .d { color: var(--muted); font-size: var(--t-sm); overflow-wrap: anywhere; } .alert .w { color: var(--faint); font-size: 12px; }
.alert.bad .icon { color: var(--bad); } .alert.warn .icon { color: var(--warn); } .alert.info .icon { color: var(--muted); }
.skel { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 37%, var(--card) 63%); background-size: 400% 100%; animation: sh 1.2s ease infinite; border-radius: var(--r-md); }
@keyframes sh { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* tooltip */
.tip { position: relative; border-bottom: 1px dotted var(--faint); cursor: help; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; background: #0b1220; border: 1px solid var(--line); color: var(--fg); padding: 8px 10px; border-radius: var(--r-md); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; line-height: 1.4; white-space: normal; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.45); text-align: left; }
.tip:hover::after, .tip:focus::after { opacity: 1; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(4,7,12,.6); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 51; overflow-y: auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); box-shadow: -20px 0 60px rgba(0,0,0,.5); }
.drawer .close { position: absolute; top: var(--s3); right: var(--s3); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.chart .ax { stroke: var(--line); stroke-width: 1; } .chart .gr { stroke: var(--line-soft); stroke-width: 1; }
.chart-cap { font-size: var(--t-sm); color: var(--muted); margin: var(--s2) 0 0; }

/* sport cards, sources, schedule */
.sports { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.sport { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.sport.off { opacity: .6; }
.src3 { display: flex; gap: var(--s2); flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; }
.step i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.step.y { color: var(--fg); } .step.y.green i { background: var(--good); } .step.y.amber i { background: var(--warn); } .step.y.red i { background: var(--bad); }
.term { background: #060910; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: var(--s3) var(--s4); font-family: var(--mono); font-size: 12px; color: #b8c4d6; overflow-x: auto; white-space: pre; max-height: 360px; }
.slot-row { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--s3) var(--s4); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft); }
.slot-row:last-child { border-bottom: 0; }
.slot-row .tm { font-family: var(--mono); font-size: var(--t-xl); font-weight: 500; }

@media (max-width: 1080px) { .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.open .side { transform: none; }
  .shell.collapsed .bn, .shell.collapsed .nav .grp, .shell.collapsed .nav .lbl, .shell.collapsed .nav .tag, .shell.collapsed .collapse-btn .lbl { display: revert; }
  .shell.collapsed .nav a, .shell.collapsed .nav .soon, .shell.collapsed .collapse-btn { justify-content: flex-start; padding-inline: var(--s3); }
  .collapse-btn { display: none; }
  .top { padding: 0 var(--s4); }
  .top .menu-btn { display: grid; }
  .top .ctx, .fresh { display: none; }
  .top { gap: var(--s2); }
  .top h1 { font-size: var(--t-md, 15px); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .statuspill { font-size: 0; padding: 6px; gap: 0; }
  .statuspill i { margin: 0; }
  #view { padding: var(--s4); }
  .page-head h2 { font-size: var(--t-xl); }
  .big { font-size: 32px; }
  .pop { right: var(--s3); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.wrap-ok { white-space: normal; min-width: 220px; }
