:root {
  color-scheme: light;
  --surface-0: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #dddcd7;
  --grid: #e6e5e0;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --band: rgba(235, 104, 52, 0.12);
  --band-edge: #c4521f;
  --error: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --border: #34332f;
    --grid: #2a2a27;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #96958c;
    --accent: #3987e5;
    --series-1: #3987e5;
    --band: rgba(217, 89, 38, 0.18);
    --band-edge: #ef8a5c;
    --error: #f97066;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --border: #34332f;
  --grid: #2a2a27;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #96958c;
  --accent: #3987e5;
  --series-1: #3987e5;
  --band: rgba(217, 89, 38, 0.18);
  --band-edge: #ef8a5c;
  --error: #f97066;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1);
}
h1 { font-size: 17px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 13px; margin: 16px 0 6px; color: var(--text-secondary); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.narrow { max-width: 440px; margin: 40px auto; }
.muted { color: var(--text-muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
label { display: block; margin: 8px 0; color: var(--text-secondary); }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
input, select {
  font: inherit; color: var(--text-primary); background: var(--surface-0);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
label > input { display: block; width: 100%; margin-top: 4px; }
#runway { width: 64px; }
#search { flex: 1 1 260px; min-width: 0; }
button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 6px 12px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0 4px; }
.who { color: var(--text-secondary); }
.msg { min-height: 1.2em; color: var(--text-secondary); }
.msg.error { color: var(--error); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; }
.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-0); }
.callout {
  border-left: 3px solid var(--band-edge); background: var(--band);
  padding: 8px 12px; border-radius: 4px; margin: 4px 0 8px;
}
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.chart .bar { fill: var(--series-1); }
.chart .bar.hover { opacity: 0.75; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--text-muted); font-size: 11px; }
.chart .value-label { fill: var(--text-secondary); font-size: 11px; }
.chart .band { fill: var(--band); }
.chart .band-label { fill: var(--band-edge); font-size: 11px; font-weight: 600; }
.chart .empty { fill: var(--text-muted); font-size: 13px; }
.tooltip {
  position: fixed; pointer-events: none; z-index: 10;
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--text-secondary); }
code { font-size: 12px; }

/* Tabs and question reports (backend spec §46) */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tab {
  background: transparent; color: var(--text-secondary); border: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 8px 12px;
}
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.badge.priority { background: var(--band-edge); }
.small { font-size: 12px; }
.big { font-size: 22px; font-weight: 600; line-height: 1; }
.report-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 12px 0; }
.report-card.is-priority { border-left: 4px solid var(--band-edge); }
.q-content { background: var(--surface-0); border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.q-content p { margin: 4px 0; }
.q-prompt { font-weight: 600; }
.options { margin: 4px 0; padding-left: 18px; }
.options li.correct { font-weight: 600; }
.report-card td { white-space: normal; max-width: 280px; overflow-wrap: anywhere; vertical-align: top; }
.actions { margin-top: 8px; }
.actions .note { flex: 1 1 260px; min-width: 0; }
