/* Courtline — dark analytics terminal.
   Palette: deep navy-black surfaces, white text, green = positive edge, red = negative, amber = warnings,
   a cool blue reserved for anything the MODEL produced (projection, model probability). */
:root {
  --bg: #04070c;
  --panel: #0a1019;
  --panel-2: #0e1623;
  --line: #1a2432;
  --line-2: #243142;
  --text: #eaf0f7;
  --muted: #8e9aab;
  --dim: #5f6b7c;
  --pos: #27d58a;
  --pos-bg: rgba(39, 213, 138, .10);
  --neg: #ff5a5f;
  --neg-bg: rgba(255, 90, 95, .10);
  --warn: #f5a524;
  --warn-bg: rgba(245, 165, 36, .10);
  --model: #6aa9ff;
  --model-bg: rgba(106, 169, 255, .12);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--sans); min-height: 100vh; }
a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--model); }
:focus-visible { outline: 2px solid var(--model); outline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.45rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; color: var(--text); }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
h4 { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
p { margin: .5rem 0; }
.mono, .kpi-v, .big, td.r { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .acc { color: var(--model); } .warn-t { color: var(--warn); }
.up { color: #c9d6e6; } .down { color: var(--muted); }
.lead { color: var(--muted); max-width: 72ch; }

/* ── Header / disclaimer ─────────────────────── */
.hdr { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(env(safe-area-inset-top, 0px) + .6rem) 1rem .6rem; background: rgba(4, 7, 12, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; font: 600 1.05rem var(--mono); letter-spacing: .02em; }
.brand-mark { width: 10px; height: 10px; align-self: center; border: 2px solid var(--model); border-radius: 50%; box-shadow: 0 0 0 3px var(--model-bg); }
.brand-sub { font: 400 .72rem var(--sans); color: var(--dim); letter-spacing: .06em; text-transform: uppercase; }
.hdr-status { display: flex; gap: 1rem; font: .78rem var(--mono); color: var(--muted); }
.disclaimer { padding: .4rem 1rem; font-size: .78rem; color: var(--warn); background: var(--warn-bg); border-bottom: 1px solid rgba(245, 165, 36, .2); }

/* ── Layout ──────────────────────────────────── */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-content: start; min-height: calc(100vh - 90px); }
.nav { position: sticky; top: 50px; align-self: start; display: flex; flex-direction: column; padding: 1rem .5rem; gap: 2px; border-right: 1px solid var(--line); min-height: calc(100vh - 90px); }
.nav a { padding: .5rem .75rem; border-radius: var(--r); text-decoration: none; color: var(--muted); font-size: .9rem; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a[aria-current] { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--model); }
.main { padding: 1.25rem clamp(1rem, 3vw, 2rem) 4rem; max-width: 1180px; width: 100%; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: sticky; top: 49px; z-index: 15; flex-direction: row; overflow-x: auto; min-height: 0; padding: .4rem .5rem; border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); scrollbar-width: none; }
  .nav a { white-space: nowrap; font-size: .85rem; padding: .4rem .65rem; }
  .nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--model); }
  .brand-sub { display: none; }
  .hdr-status { gap: .6rem; font-size: .72rem; }
  .hdr-status .upd { display: none; }
}

.page-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; }
.stack { display: grid; gap: 1rem; }

/* ── Buttons & forms ─────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; font: 500 .85rem var(--sans); color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: .5rem .85rem; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-family: var(--mono); font-weight: 600; letter-spacing: .02em; }
.btn.danger { color: var(--neg); border-color: rgba(255, 90, 95, .4); }
.btn.tiny { padding: .2rem .5rem; font-size: .75rem; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.scan-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; }
.panel h2 { margin-top: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: .8rem 1rem; }
label { display: block; font-size: .78rem; color: var(--muted); }
label.full { margin-top: .8rem; }
label.check { display: flex; align-items: center; gap: .45rem; color: var(--text); font-size: .85rem; }
input, select { display: block; width: 100%; margin-top: .3rem; font: .9rem var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); padding: .45rem .55rem; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--model); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9rem; }
.actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 1rem 0; }
.league-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .35rem 1rem; margin-top: .9rem; max-height: 320px; overflow: auto; padding-right: .5rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }

/* ── Banners / states ────────────────────────── */
.banner { padding: .65rem .85rem; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); margin: .75rem 0; font-size: .88rem; }
.banner.warn { border-color: rgba(245, 165, 36, .4); background: var(--warn-bg); color: var(--warn); }
.banner.err { border-color: rgba(255, 90, 95, .45); background: var(--neg-bg); color: var(--neg); }
.banner.ok { border-color: rgba(39, 213, 138, .4); background: var(--pos-bg); color: var(--pos); }
.banner.exp { border-color: rgba(245, 165, 36, .4); color: var(--warn); font-family: var(--mono); font-size: .8rem; letter-spacing: .02em; }
.scanline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; font: .78rem var(--mono); color: var(--muted); padding: .5rem 0; border-bottom: 1px dashed var(--line-2); margin-bottom: 1rem; }
.scanline b { color: var(--text); font-weight: 500; }
.empty { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 2rem 1.25rem; text-align: center; }
.empty-t { font-weight: 600; margin-bottom: .25rem; }
.empty .btn { margin-top: .75rem; }
.loading { color: var(--muted); padding: 2rem 0; font-family: var(--mono); }
.nobet { border: 1px solid var(--line-2); border-radius: var(--r); padding: 1.5rem; background: var(--panel); }
.nobet-t { font: 600 clamp(1.2rem, 3.6vw, 1.8rem) var(--mono); letter-spacing: .04em; margin-bottom: .4rem; }
.crumbs { margin: 0 0 .5rem; font-size: .85rem; }
.vs { color: var(--dim); font-weight: 400; }

/* ── KPIs ────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; margin: 0 0 .5rem; }
.kpi { padding: .75rem .9rem; box-shadow: 1px 1px 0 var(--line); }
.kpi-l { font-size: .72rem; color: var(--muted); letter-spacing: .03em; }
.kpi-v { font-size: 1.35rem; font-weight: 500; margin-top: .15rem; }
.kpi-v small { font-size: .75rem; color: var(--dim); }
.kpi-v.warn { color: var(--warn); }

/* ── Pick card ───────────────────────────────── */
.pick { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem 1.1rem; }
.pick-out { opacity: .8; border-style: dashed; }
.pick-h { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: start; }
.pick-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font: .74rem var(--mono); color: var(--muted); }
.rank { color: var(--text); font-weight: 600; }
.tag { font: 600 .66rem var(--mono); letter-spacing: .08em; padding: .1rem .4rem; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); }
.tag.f2 { color: var(--bg); background: var(--model); border-color: var(--model); }
.tag.rnd { color: var(--warn); border-color: rgba(245, 165, 36, .5); }
.pick-match { font-size: 1.05rem; margin: .35rem 0 .15rem; }
.pick-match a { text-decoration: none; }
.pick-sel { font: 600 1.25rem var(--mono); letter-spacing: .02em; }
.pick-odds { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.pick-odds .big { font-size: 1.9rem; font-weight: 500; line-height: 1; }
.pick-odds .dim { font-size: .72rem; }
.figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem 1rem; margin: .5rem 0 .8rem; }
.fig dt { font-size: .7rem; color: var(--muted); }
.fig dd { margin: .1rem 0 0; font: 500 1rem var(--mono); }
.fig dd.neg-dir, .fig dd.pos-dir { color: var(--text); }
@media (max-width: 560px) { .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pick-odds .big { font-size: 1.5rem; } }
.status { font: 600 .74rem var(--mono); letter-spacing: .08em; padding: .35rem .6rem; border-radius: 3px; margin-bottom: .85rem; }
.status.ok { color: var(--pos); background: var(--pos-bg); }
.status.no { color: var(--muted); background: var(--panel-2); letter-spacing: .02em; font-weight: 500; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }
.reasons, .risks { margin: 0; padding-left: 1rem; font-size: .86rem; }
.reasons li, .risks li { margin: .2rem 0; }
.reasons li::marker { color: var(--pos); }
.risks li { color: #e9c989; } .risks li::marker { color: var(--warn); }
.q { font-family: var(--mono); }
.q-ex { color: var(--pos); } .q-good { color: #9fe3c0; } .q-lim { color: var(--warn); } .q-ins { color: var(--neg); }

/* Signature: distribution gauge */
.gauge { display: block; width: 100%; max-width: 520px; height: auto; margin: .6rem 0 .2rem; }
.g-curve { fill: none; stroke: var(--model); stroke-width: 1.5; }
.g-area { fill: var(--model-bg); }
.g-axis { stroke: var(--line-2); }
.g-side { stroke: var(--model); stroke-width: 2; opacity: .6; }
.g-line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.g-proj { stroke: var(--model); stroke-width: 2; }
.g-t { font: 11px var(--mono); fill: var(--muted); }
.g-tp { fill: var(--model); }

/* ── Upcoming games list ─────────────────────── */
.games { display: grid; gap: .5rem; }
.day { font: 500 .78rem var(--mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 1rem 0 .1rem; }
.game { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: center; padding: .7rem .9rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; }
.game:hover { border-color: var(--line-2); background: var(--panel-2); }
.game-time { font-size: .95rem; color: var(--muted); }
.game-teams > div:not(.dim) { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-mk { display: grid; grid-template-columns: repeat(5, 4rem); gap: .5rem; text-align: right; }
.mk span { display: block; font-size: .66rem; }
.mk b { font-weight: 500; font-size: .92rem; }
.game-pick { grid-column: 2 / -1; font: .78rem var(--mono); color: var(--muted); }
.game-pick.ok { color: var(--text); }
@media (max-width: 720px) {
  .game { grid-template-columns: 3rem minmax(0, 1fr); }
  .game-mk { grid-column: 1 / -1; grid-template-columns: repeat(5, 1fr); text-align: left; border-top: 1px dashed var(--line); padding-top: .45rem; }
  .game-pick { grid-column: 1 / -1; }
}

/* ── Tables ──────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: .45rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font: 500 .7rem var(--sans); color: var(--muted); letter-spacing: .04em; background: var(--panel-2); white-space: nowrap; }
th.r, td.r { text-align: right; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
tr:last-child td { border-bottom: 0; }
.res { font: 600 .75rem var(--mono); padding: .05rem .4rem; border-radius: 3px; }
.res-W { color: var(--pos); background: var(--pos-bg); } .res-L { color: var(--neg); background: var(--neg-bg); } .res-P, .res-V { color: var(--muted); background: var(--panel-2); }
.manual { display: inline-flex; gap: .25rem; align-items: center; }
.mi { width: 3.4rem; margin: 0; padding: .2rem .35rem; font-size: .78rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: .5rem 0 1rem; }
.tabs a { padding: .35rem .75rem; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; font-size: .82rem; color: var(--muted); }
.tabs a[aria-current] { color: var(--bg); background: var(--text); border-color: var(--text); }
.tabs.small a { font-size: .75rem; padding: .2rem .6rem; }

details { margin: 1.25rem 0; }
summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: .3rem 0; }
details.log ul { font: .78rem var(--mono); color: var(--muted); padding-left: 1rem; }

/* ── Scan drawer ─────────────────────────────── */
.drawer { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 40; width: min(460px, calc(100vw - 2rem)); background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 12px 40px rgba(0, 0, 0, .6); }
.drawer-h { display: flex; justify-content: space-between; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); font: .82rem var(--mono); }
.drawer-log { margin: 0; padding: .6rem .8rem .8rem 2rem; max-height: 260px; overflow: auto; font: .74rem/1.55 var(--mono); color: var(--muted); }
.drawer-log .req { color: var(--dim); } .drawer-log .wait { color: var(--model); } .drawer-log .warn { color: var(--warn); }
.drawer-log .err { color: var(--neg); } .drawer-log .done { color: var(--pos); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
