/* AI Bandwidth dashboard — tokens per the validated reference palette.
   Light is the base; dark swaps under prefers-color-scheme. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --claude: #2a78d6;
  --codex: #eb6834;
  --status-good: #0ca30c;
  --status-warn: #fab219;
  --status-critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --claude: #3987e5;
    --codex: #d95926;
  }
}

* { box-sizing: border-box; margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
  padding: 24px 16px 48px;
}
.wrap { max-width: 880px; margin: 0 auto; }

.masthead h1 {
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.updated { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.updated .stale {
  color: var(--status-critical);
  font-weight: 600;
}

/* --- stat cards --- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.card h2 { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.series-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.series-key.dashed { height: 0; border-radius: 0; background: none !important; border-top: 2px dashed; }
.card .hero {
  font-size: 2.3rem;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1.1;
}
.card .hero small { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--grid);
  margin: 10px 0 14px;
  overflow: hidden;
}
.meter > span { display: block; height: 100%; border-radius: 4px; }
.meta { list-style: none; padding: 0; font-size: 0.85rem; color: var(--ink-2); }
.meta li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.meta .k { color: var(--muted); }
.meta .v { font-variant-numeric: tabular-nums; text-align: right; }
.pace { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.pace .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.no-data { color: var(--muted); font-size: 0.9rem; margin-top: 8px; }

/* --- chart card --- */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.range-btn {
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
}
.range-btn:hover { background: var(--grid); }
.range-btn.is-active {
  color: var(--ink);
  border-color: var(--baseline);
  font-weight: 600;
}
.chart-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; }
.chart-shell { position: relative; }
canvas { width: 100%; height: 320px; display: block; touch-action: pan-y; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  padding: 8px 10px;
  font-size: 0.8rem;
  min-width: 150px;
  z-index: 2;
}
.tooltip .tt-date { color: var(--muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-key.dashed { height: 0; border-radius: 0; background: none !important; border-top: 2px dashed; }
.tooltip .tt-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.tooltip .tt-name { color: var(--ink-2); }
.legend { display: flex; gap: 18px; margin-top: 10px; font-size: 0.82rem; color: var(--ink-2); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }

.table-view { margin-top: 14px; font-size: 0.85rem; }
.table-view summary { cursor: pointer; color: var(--muted); }
.table-view table { border-collapse: collapse; margin-top: 8px; width: 100%; }
.table-view th, .table-view td {
  text-align: left;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums;
}
.table-view th { color: var(--muted); font-weight: 500; }

.foot { margin-top: 20px; color: var(--muted); font-size: 0.8rem; }
.foot a { color: var(--ink-2); }
