@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0A0C0F;
  --side: #0C0E12;
  --panel: #101318;
  --card: #111419;
  --line: #1C2129;
  --active: #161A20;
  --active-2: #1E232B;
  --text: #E9EDF2;
  --muted: #7D8794;
  --faint: #4A525E;
  --accent: #C6F432;
  --ok: #4ADE80;
  --warn: #F5B544;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--sans); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #0A0C0F; padding: 6px 10px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }
.mono { font-family: var(--mono); }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.side {
  background: var(--side); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 28px 16px 40px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; padding: 0 12px; height: 24px; }
.mark { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 8px; margin-top: 44px; }
.nav a {
  position: relative; display: block; height: 32px; line-height: 32px; padding: 0 16px;
  border-radius: 8px; color: var(--muted); font-size: 14px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 500; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 2px; height: 16px; border-radius: 1px; background: var(--accent);
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 22px; }
.next { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.next .name { font-size: 17px; font-weight: 500; margin-top: 8px; }
.next .circ { font-size: 12px; color: var(--muted); margin-top: 2px; }
.next .when { font-family: var(--mono); font-size: 12px; margin-top: 6px; }
.next .eyebrow + .when { margin-top: 6px; }
.next .gap { height: 22px; }
.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.sources { padding: 0; }
.sources .eyebrow { margin-bottom: 12px; }
.src { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; }
.src .dot { margin-top: 5px; }
.src-name { font-size: 13px; font-weight: 500; }
.src-state { font-size: 12px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: #F25555; }
.dot.off { background: var(--faint); }

main { padding: 32px 32px 32px; min-width: 0; outline: none; }
.loading, .error-box { color: var(--muted); padding: 40px 0; font-size: 13px; }
.error-box { color: var(--text); }

/* ------------------------------------------------------------ header */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; min-height: 84px; }
.head .eyebrow { font-size: 11px; letter-spacing: 1.5px; }
.head h1 { font-size: 32px; font-weight: 500; letter-spacing: -0.5px; margin: 6px 0 4px; line-height: 1.2; }
.head .meta { font-size: 13px; color: var(--muted); }
.head-right { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.tabs { display: flex; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.tabs button, .tabs span {
  font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted);
  background: none; border: 0; border-radius: 6px; height: 28px; padding: 0 14px; min-width: 52px; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] { background: var(--active-2); color: var(--text); }
.tabs .na { cursor: help; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; }
.picker {
  appearance: none; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237D8794' fill='none' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 9px; height: 36px; padding: 0 32px 0 12px;
  font-family: var(--mono); font-size: 12px; font-weight: 500; cursor: pointer;
}
.picker:hover { border-color: #2A313B; }

/* ------------------------------------------------------------ panels */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px 20px; min-width: 0; position: relative; }
.panel h2 { font-size: 15px; font-weight: 500; margin: 0; }
.panel .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.kpi { padding: 20px 20px 18px; min-height: 108px; }
.kpi .val { font-size: 28px; font-weight: 500; letter-spacing: -0.5px; margin-top: 10px; line-height: 1.15; }
.kpi .val.mono { font-family: var(--mono); }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.cdot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.cbar { width: 3px; height: 14px; border-radius: 1px; background: var(--c, var(--muted)); flex: none; display: inline-block; }
.legend { display: flex; gap: 20px; font-family: var(--mono); font-size: 11px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { flex: none; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font-family: var(--mono); }
.chart .ax { fill: var(--faint); font-size: 10px; }
.chart .grid-l { stroke: #1A1F26; stroke-width: 1; }

.cols-overview { grid-template-columns: 752fr 400fr; }
.stack { display: grid; gap: 16px; align-content: start; }
.cols-half { grid-template-columns: 1fr 1fr; }
.cols-tele { grid-template-columns: 752fr 400fr; }
.cols-strategy { grid-template-columns: 820fr 332fr; }
.cols-standings { grid-template-columns: 560fr 592fr; }
.cols-schedule { grid-template-columns: 800fr 352fr; }
.mt { margin-top: 16px; }

/* ------------------------------------------------------------ tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 1px; color: var(--faint); text-transform: uppercase; text-align: left; padding: 0 0 12px; }
.t th.r, .t td.r { text-align: right; }
.t td { padding: 0; height: 28px; white-space: nowrap; }
.t td.n { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 32px; }
.t td.num { font-family: var(--mono); font-size: 12px; }
.t td.dim { color: var(--muted); font-size: 12px; }
.t td.faint, .t tr.out td { color: var(--faint); }
.t .code { font-weight: 500; display: inline-flex; align-items: center; gap: 10px; }
.t tr.hl td { background: var(--active); }
.t tr.hl td:first-child { border-radius: 6px 0 0 6px; padding-left: 12px; }
.t tr.hl td:last-child { border-radius: 0 6px 6px 0; padding-right: 12px; }
.t.dense td { height: 17.8px; font-size: 12px; }
.t.dense .code { gap: 9px; }
.t .lime { color: var(--accent); }
.classif { margin: 0 -12px; }
.classif td:first-child, .classif th:first-child { padding-left: 12px; }
.classif td:last-child, .classif th:last-child { padding-right: 12px; }
.pill { font-family: var(--mono); font-size: 9px; letter-spacing: .6px; padding: 3px 8px; border-radius: 99px; background: var(--active-2); color: var(--muted); }
.pill.lime { background: var(--accent); color: #0A0C0F; font-weight: 600; }

.bar { height: 8px; border-radius: 2px; background: var(--c, var(--muted)); width: calc(var(--w, 0) * 1%); min-width: 3px; opacity: var(--o, 1); }
.bar-cell { width: 100%; padding: 0 16px !important; }

/* ------------------------------------------------------------ telemetry */
.pickers { display: flex; gap: 12px; margin: -8px 0 16px; flex-wrap: wrap; }
.pick { display: inline-flex; align-items: center; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 9px; height: 36px; padding-left: 14px; }
.pick label { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--faint); text-transform: uppercase; }
.pick select { appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237D8794' fill='none' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 14px center; border: 0; height: 34px; padding: 0 40px 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; cursor: pointer; }
.pick select option { background: var(--panel); }
.frames { position: relative; margin-top: 18px; }
.frame { display: grid; grid-template-columns: 76px 1fr; gap: 0; }
.frame .lbl { font-size: 11px; color: var(--muted); padding-top: 6px; }
.frame .lbl small { display: block; font-family: var(--mono); font-size: 9px; color: var(--faint); margin-top: 2px; }
.frame .box { background: #0D1014; border-radius: 4px; margin-bottom: 8px; }
.frames .xl { font-family: var(--mono); font-size: 10px; color: var(--faint); letter-spacing: 1px; margin-left: 76px; }
.lock {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(382px, 86%);
  background: var(--card); border: 1px solid #262C35; border-radius: 12px; padding: 22px 24px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.lock h3 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }
.lock p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.lock .row { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.lock .status { font-family: var(--mono); font-size: 11px; color: var(--text); border: 1px solid #2A313B; border-radius: 8px; padding: 9px 14px; display: inline-flex; gap: 8px; align-items: center; }
.lock .hint { font-size: 12px; color: var(--faint); }
.track-empty { color: var(--muted); font-size: 13px; padding: 120px 0; text-align: center; }

/* ------------------------------------------------------------ schedule */
.wk-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 13px 0 13px; border-top: 1px solid var(--line); }
.wk-row:first-of-type { border-top: 0; }
.wk-row .s { font-size: 13px; font-weight: 500; }
.wk-row .d { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wk-row .tm { display: flex; gap: 32px; font-family: var(--mono); font-size: 13px; }
.wk-row .tm .u { color: var(--muted); }
.wk-row.race .s { color: var(--accent); }
.wk-head { display: flex; justify-content: flex-end; gap: 40px; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--faint); padding: 26px 0 8px; }
.eyebrow.lime { color: var(--accent); }
.wins-row { display: grid; grid-template-columns: 48px 1fr 32px; align-items: center; height: 40px; font-size: 13px; font-weight: 500; }
.wins-row .sq { display: flex; gap: 6px; }
.wins-row .sq i { width: 14px; height: 14px; border-radius: 3px; background: var(--c); display: block; }
.wins-row .r { text-align: right; font-family: var(--mono); font-weight: 400; }
.rd { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.t tr.nextrow td { background: #12160F; }
.t tr.nextrow td:first-child { border-radius: 6px 0 0 6px; }
.t tr.nextrow td:last-child { border-radius: 0 6px 6px 0; }
.t tr.nextrow .rd { color: var(--accent); }
.cal td { height: 32.4px; }
.cal { margin: 0 -12px; width: calc(100% + 24px); }
.cal td:first-child, .cal th:first-child { padding-left: 12px; }
.cal td:last-child, .cal th:last-child { padding-right: 12px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .cols-overview, .cols-tele, .cols-strategy, .cols-standings, .cols-schedule, .cols-half { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; margin-top: 14px; gap: 4px; }
  .nav a { white-space: nowrap; padding: 0 12px; }
  .side-foot { display: none; }
  main { padding: 20px 16px; }
  .head { flex-direction: column; }
  .head-right { margin-top: 0; flex-wrap: wrap; }
  .kpis { grid-template-columns: 1fr; }
  .panel { padding: 18px 16px; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.panel h2.big { font-size: 20px; margin-top: 6px; }

/* spacing fixes */
.t th, .t td { padding-right: 12px; }
.t th:last-child, .t td:last-child { padding-right: 0; }
.t span.dim { color: var(--muted); font-size: 12px; }
.win { display: inline-flex; align-items: center; gap: 12px; }
.next .when { white-space: nowrap; letter-spacing: -0.2px; }
.lock .status, .lock .hint { white-space: nowrap; }
.stack, .grid > * { min-width: 0; }
@media (max-width: 1180px) {
  .cols-overview, .cols-tele, .cols-strategy, .cols-standings, .cols-schedule, .cols-half { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .head h1 { font-size: 26px; }
}
@media (max-width: 820px) {
  .cal td:nth-child(3), .cal th:nth-child(3) { display: none; }
}
