/* Eagle Eye — compact dark dashboard
   Muted charcoal shell, disciplined grid, one selective blue accent.
   Order: tokens → base → shell → controls → panels → data → overlays. */

:root {
  color-scheme: dark;

  /* surfaces sit only slightly above the field;
     neutrals carry a faint warm cast (R > G > B by 2-6 points, never more) */
  --bg: #11100f;
  --surface: #1a1816;
  --surface-2: #201e1c;
  --surface-3: #282624;
  --line: #292725;
  --line-2: #35322f;

  /* text leans soft warm off-white, never stark */
  --ink: #ebe8e4;
  --ink-2: #b5b1ac;
  --muted: #807c77;
  --faint: #58544f;

  /* the only energetic interruption */
  --accent: #3d7dff;
  --accent-ink: #85acff;
  --accent-soft: rgba(61, 125, 255, .13);
  --accent-line: rgba(61, 125, 255, .40);

  /* state markers stay deliberately quiet */
  --amber: #c6a065;
  --amber-soft: rgba(198, 160, 101, .12);
  --red: #c68585;
  --red-soft: rgba(198, 133, 133, .12);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-xs: 5px;

  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gap: 10px;
  --pad: 13px;
  --ctl: 28px;
  --row: 38px;
  --rail: 218px;

  --ease: .14s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.45;
  letter-spacing: -.002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
h3 { font-size: 13px; font-weight: 600; }

a { color: var(--accent-ink); }

::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: var(--line-2); background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #423e3a; background-clip: content-box; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 16, 15, .82);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 8px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
}

.brand-text { display: flex; align-items: baseline; gap: 7px; }
.brand-name { font-size: 12.5px; font-weight: 600; }
.brand-sub { color: var(--muted); font-size: 10.5px; }

.metrics {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
}
.metric-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.metric-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.page {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--gap);
  max-width: 1520px;
  margin: 0 auto;
  padding: var(--gap) 14px 26px;
  align-items: start;
}

.rail { display: grid; gap: var(--gap); position: sticky; top: 56px; min-width: 0; }
.main-col { display: grid; gap: var(--gap); min-width: 0; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--gap); }

/* ---------- controls ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: var(--ctl);
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.button:hover { background: var(--surface-3); color: var(--ink); }

.button-primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}
.button-primary:hover { background: #4f89ff; color: #fff; }

.button-sm { height: 25px; padding: 0 8px; font-size: 11px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transition: background var(--ease), color var(--ease);
}
.icon-button:hover { background: var(--surface-3); color: var(--ink); }

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--ease);
}
.text-button:hover { color: var(--accent-ink); }

.input, .input-suffix, select, .search-box {
  width: 100%;
  height: var(--ctl);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color var(--ease), background var(--ease);
}

.input, select { padding: 0 9px; font-size: 11.5px; }
.input::placeholder { color: var(--faint); }

select {
  appearance: none;
  padding-right: 22px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 51%),
    linear-gradient(-45deg, transparent 50%, var(--muted) 51%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
select option { background: var(--surface-2); color: var(--ink); }

.input:hover, select:hover, .input-suffix:hover, .search-box:hover { border-color: var(--line-2); }

.input:focus, select:focus, .input-suffix:focus-within, .search-box:focus-within {
  border-color: var(--accent-line);
  background: var(--surface-3);
  outline: none;
}

.input-suffix { display: flex; align-items: center; overflow: hidden; }
.input-suffix input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 0 0 9px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.input-suffix input::placeholder { color: var(--faint); font-family: var(--font); }
.input-suffix span { padding: 0 8px; color: var(--faint); font-size: 10px; white-space: nowrap; }

.search-box { display: flex; align-items: center; gap: 7px; padding: 0 9px; color: var(--faint); }
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}
.search-box input::placeholder { color: var(--faint); }
.search-box input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); }

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 11.5px;
  cursor: pointer;
}
.check-row input { width: 12px; height: 12px; accent-color: var(--accent); }
.check-count { margin-left: auto; color: var(--faint); font-family: var(--mono); font-size: 10.5px; }

.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}
.segmented button {
  height: 21px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
}
.segmented button:hover { color: var(--ink-2); }
.segmented button.active { background: var(--surface-3); color: var(--ink); }

.status { color: var(--faint); font-size: 10.5px; font-weight: 400; }

/* ---------- panels ---------- */

.panel, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-head, .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .card-head h2 {
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.head-actions, .card-head-actions { display: flex; align-items: center; gap: 9px; }

.panel-body, .card-body { display: grid; gap: 11px; padding: var(--pad); }

/* ---------- sources ---------- */

.source-entry { display: grid; gap: 6px; }
.source-entry .button { width: 100%; }

.source-list { display: grid; gap: 4px; }

.source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  transition: border-color var(--ease);
}
.source-item:hover { border-color: var(--line-2); }
.source-item:hover .source-actions { opacity: 1; }

.source-index { display: none; }

.source-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
}

.source-meta { grid-column: 1; color: var(--muted); font-size: 10px; }
.source-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  gap: 1px;
  opacity: .45;
  transition: opacity var(--ease);
}

.mini-button {
  width: 20px; height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  transition: background var(--ease), color var(--ease);
}
.mini-button:hover { background: var(--surface-3); color: var(--ink); }

.source-empty {
  padding: 14px 10px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-xs);
  color: var(--faint);
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- filters ---------- */

.filters .panel-body { gap: 12px; }

.field-group { display: grid; gap: 5px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.field-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.preset-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.preset-chip {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.preset-chip:hover { background: var(--surface-3); color: var(--ink-2); }
.preset-chip.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}

/* ---------- results ---------- */

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
}
.results-head h2 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -.005em;
}
.results-head h2 #visibleCount {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.results-actions { display: flex; gap: 5px; }

.insight-strip { display: flex; flex-wrap: wrap; gap: 5px; }
.insight-strip:empty { display: none; }

.insight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.insight strong {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
}
.insight i { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.insight.accent { border-color: var(--accent-line); background: var(--accent-soft); }
.insight.accent i { background: var(--accent); }
.insight.accent strong { color: var(--accent-ink); }
.insight.amber i { background: var(--amber); }

.table-panel { overflow: hidden; }
.table-scroll { max-height: min(58vh, 620px); overflow: auto; }

.pricing-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.pricing-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 29px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  white-space: nowrap;
}
.pricing-table th[data-sort] { cursor: pointer; user-select: none; transition: color var(--ease); }
.pricing-table th[data-sort]:hover { color: var(--ink-2); }

.pricing-table th[data-sort]::after {
  content: "↑";
  margin-left: 4px;
  opacity: 0;
  font-size: 9px;
}
.pricing-table th[data-sort]:hover::after { opacity: .4; }
.pricing-table th.sorted { color: var(--accent-ink); }
.pricing-table th.sorted::after { opacity: 1; }
.pricing-table th.sorted.desc::after { content: "↓"; }

.pricing-table td {
  height: var(--row);
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  vertical-align: middle;
  white-space: nowrap;
}
.pricing-table tbody tr { cursor: pointer; }
.pricing-table tbody tr:hover td { background: var(--surface-2); }
.pricing-table tbody tr:last-child td { border-bottom: 0; }

.sticky-col { position: sticky; left: 0; }
.pricing-table th.sticky-col { z-index: 3; }
.pricing-table td.sticky-col { z-index: 2; box-shadow: 1px 0 0 var(--line); }

.model-cell { display: flex; align-items: center; gap: 8px; min-width: 180px; }

.provider-flag {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
}

.model-name { color: var(--ink); font-size: 12px; font-weight: 500; }
.provider-name { display: block; margin-top: -1px; color: var(--faint); font-size: 10px; }

.number, .context-value, .projected-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.number.cheapest { color: var(--accent-ink); font-weight: 600; }
.number.missing { color: var(--faint); }
.unit { margin-left: 4px; color: var(--faint); font-size: 9px; }
.projected-value.best { color: var(--accent-ink); font-weight: 600; }

.batch-badge, .confidence-badge, .change-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 500;
}
.batch-badge.none { border-color: transparent; background: transparent; color: var(--faint); }
.confidence-high { color: var(--ink-2); }
.confidence-medium { border-color: transparent; background: var(--amber-soft); color: var(--amber); }
.confidence-low { border-color: transparent; background: var(--red-soft); color: var(--red); }

.source-link { color: var(--muted); font-size: 10.5px; text-decoration: none; transition: color var(--ease); }
.source-link:hover { color: var(--accent-ink); }
.source-age { display: block; margin-top: 1px; color: var(--faint); font-size: 9px; }

.group-row td {
  height: 24px !important;
  padding: 0 11px;
  background: var(--surface-2) !important;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
}
.group-row { cursor: default; }
.group-count { margin-left: 6px; color: var(--faint); font-weight: 400; letter-spacing: 0; }

.table-empty { padding: 44px 20px; text-align: center; }
.table-empty h3 { color: var(--ink-2); font-size: 12.5px; }
.table-empty p { margin: 5px auto 13px; max-width: 340px; color: var(--faint); font-size: 11.5px; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px var(--pad);
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}
.legend { display: flex; gap: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i, .legend-dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; }
.dot-accent, .dot-cyan { background: var(--accent); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-green { background: var(--accent); }

/* ---------- projection ---------- */

.projection-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.projection-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.projection-card {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.projection-card.best { border-color: var(--accent-line); background: var(--accent-soft); }
.projection-card .small-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.projection-card .projection-model {
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 11px;
}
.projection-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.projection-card.best strong { color: var(--accent-ink); }
.projection-card .projection-delta { margin-top: 1px; color: var(--faint); font-size: 9.5px; }

/* ---------- json ---------- */

.json-viewer {
  height: 176px;
  padding: 10px 11px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #141211;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.json-viewer .json-key { color: var(--accent-ink); }
.json-viewer .json-string { color: #b8a887; }
.json-viewer .json-number { color: #a8b6cc; }

/* ---------- footer ---------- */

.page-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  color: var(--faint);
  font-size: 10.5px;
}
.page-footer .text-button { margin-left: 8px; }

/* ---------- drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(10, 9, 8, .58);
}

.detail-drawer {
  position: fixed;
  top: 0; right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: min(420px, 94vw);
  height: 100dvh;
  transform: translateX(100%);
  border-left: 1px solid var(--line-2);
  background: var(--surface);
  transition: transform .18s cubic-bezier(.4, 0, .2, 1);
}
.detail-drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 13px var(--pad);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { color: var(--ink); font-size: 13.5px; text-transform: none; letter-spacing: -.01em; }
.drawer-subtitle { margin-top: 2px; color: var(--muted); font-size: 11px; }
.drawer-content { padding: var(--pad) var(--pad) 32px; overflow: auto; }

.detail-section { margin-bottom: 18px; }
.detail-section-title {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.detail-item {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}
.detail-item span { display: block; color: var(--muted); font-size: 9.5px; }
.detail-item strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.snippet {
  padding: 9px 10px;
  border-left: 2px solid var(--line-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
}

.drawer-actions { display: flex; gap: 6px; }

.edit-field { display: grid; gap: 4px; margin-top: 8px; }
.edit-field label { color: var(--muted); font-size: 10.5px; }
.edit-field input {
  height: var(--ctl);
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  outline: none;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  transition: border-color var(--ease), background var(--ease);
}
.edit-field input:focus { border-color: var(--accent-line); background: var(--surface-3); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 20;
  transform: translate(-50%, 10px);
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  font-size: 11.5px;
  transition: opacity var(--ease), transform var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- light variant (same discipline, lifted) ---------- */

.light-mode {
  color-scheme: light;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #f7f6f4;
  --surface-3: #efedea;
  --line: #e7e4e0;
  --line-2: #d8d4cf;
  --ink: #1d1b19;
  --ink-2: #55514c;
  --muted: #7d7872;
  --faint: #a39e97;
  --accent: #2f6bf0;
  --accent-ink: #1f56cf;
  --accent-soft: rgba(47, 107, 240, .08);
  --accent-line: rgba(47, 107, 240, .32);
  --amber: #8a6316;
  --amber-soft: rgba(138, 99, 22, .1);
  --red: #a34a4a;
  --red-soft: rgba(163, 74, 74, .1);
}
.light-mode .topbar { background: rgba(246, 245, 243, .84); }
.light-mode .json-viewer { background: var(--surface-2); }
.light-mode .json-viewer .json-string { color: #8a6316; }
.light-mode .json-viewer .json-number { color: #4a5d8a; }
.light-mode .drawer-backdrop { background: rgba(28, 25, 22, .28); }
.light-mode .toast { background: #1d1b19; color: #fff; border-color: #1d1b19; }
.light-mode ::-webkit-scrollbar-thumb { background: var(--line-2); background-clip: content-box; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
  .rail { position: static; grid-template-columns: 1fr 1fr; }
  .metrics .metric:nth-child(3) { display: none; }
}

@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-sub { display: none; }
  .metrics { display: none; }
  .topbar-actions { margin-left: auto; }
  .page { padding: var(--gap) 10px 22px; }
  .rail { grid-template-columns: 1fr; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .projection-summary, .projection-controls { grid-template-columns: 1fr; }
  .page-footer { flex-direction: column; align-items: flex-start; gap: 5px; }
  .table-footer { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
