/* qros dashboard. Tokens mirror rasmuscodes.github.io so the embedded demo looks native there. */

:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --surface-3: #ebe8de;
  --ink: #1a1a18;
  --ink-2: #2f2e2a;
  --muted: #6b6963;
  --faint: #8f8c84;
  --rule: #e6e2d8;
  --rule-strong: #d3cec1;
  --accent: #14594b;
  --accent-hover: #0d4237;
  --accent-ink: #f6f3ea;
  --accent-soft: #e3efea;
  --long: #157347;
  --long-soft: #e2f2e8;
  --short: #b42318;
  --short-soft: #fbe9e6;
  --watch: #8a5a00;
  --watch-soft: #f8edd3;
  --neutral: #475467;
  --neutral-soft: #eceef2;
  /* chart roles (dataviz reference palette, validated against these surfaces) */
  --chart-surface: #ffffff;
  --grid: #ebe8de;
  --axis: #c9c4b6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --div-pos: #2a78d6;
  --div-neg: #e34948;
  --div-mid: #f0efec;
  --band-oos: rgba(42, 120, 214, 0.06);
  --band-holdout: rgba(26, 26, 24, 0.07);
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121413; --surface: #181b19; --surface-2: #1f2321; --surface-3: #262b28;
    --ink: #ecebe5; --ink-2: #d8d6ce; --muted: #a19e95; --faint: #7c7970;
    --rule: #2a2e2b; --rule-strong: #3a3f3b;
    --accent: #5ec2a7; --accent-hover: #82d4be; --accent-ink: #0b1f1a; --accent-soft: #163730;
    --long: #5cc98c; --long-soft: #173527; --short: #f47b6e; --short-soft: #3b1b18;
    --watch: #e7b54d; --watch-soft: #382c11; --neutral: #a9b2c1; --neutral-soft: #262b33;
    --chart-surface: #181b19; --grid: #262b28; --axis: #3d423e;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --div-pos: #3987e5; --div-neg: #e66767; --div-mid: #383835;
    --band-oos: rgba(57, 135, 229, 0.09); --band-holdout: rgba(236, 235, 229, 0.07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121413; --surface: #181b19; --surface-2: #1f2321; --surface-3: #262b28;
  --ink: #ecebe5; --ink-2: #d8d6ce; --muted: #a19e95; --faint: #7c7970;
  --rule: #2a2e2b; --rule-strong: #3a3f3b;
  --accent: #5ec2a7; --accent-hover: #82d4be; --accent-ink: #0b1f1a; --accent-soft: #163730;
  --long: #5cc98c; --long-soft: #173527; --short: #f47b6e; --short-soft: #3b1b18;
  --watch: #e7b54d; --watch-soft: #382c11; --neutral: #a9b2c1; --neutral-soft: #262b33;
  --chart-surface: #181b19; --grid: #262b28; --axis: #3d423e;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --div-pos: #3987e5; --div-neg: #e66767; --div-mid: #383835;
  --band-oos: rgba(57, 135, 229, 0.09); --band-holdout: rgba(236, 235, 229, 0.07);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.embed { background: transparent; }
a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--mono); font-size: .86em; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ shell */
.shell { max-width: 1240px; margin: 0 auto; padding: 0 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 700 13px/1 var(--mono); }
.brand__title { font: 650 17px/1.2 var(--sans); }
.brand__sub { font: 400 13px/1.3 var(--sans); color: var(--muted); }
.topbar__actions { display: flex; gap: 8px; align-items: center; }
body.embed .topbar { padding-top: 6px; }
.nav { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--rule); margin-bottom: 18px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 9px 12px 10px; font: 550 14px/1 var(--sans); color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.synthetic-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin: 0 0 18px; border-radius: var(--radius); background: var(--watch-soft); color: var(--ink-2); font-size: 14px; }
.synthetic-banner b { color: var(--ink); }

/* ------------------------------------------------------------------ building blocks */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--tiles { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
@media (max-width: 860px) { .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card__title { font: 650 15px/1.3 var(--sans); }
.card__sub { font-size: 13px; color: var(--muted); }
.section-title { font: 650 20px/1.25 var(--sans); margin: 26px 0 4px; }
.section-sub { color: var(--muted); margin: 0 0 14px; max-width: 80ch; }
.page-title { font: 700 26px/1.2 var(--sans); margin: 4px 0 6px; }
.lead { color: var(--ink-2); max-width: 80ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.tile__label { font: 500 13px/1.3 var(--sans); color: var(--muted); }
.tile__value { font: 650 26px/1.15 var(--sans); margin-top: 4px; }
.tile__note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hash { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font: 600 12px/1.6 var(--sans); white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font: 500 12px/1.6 var(--sans); background: var(--surface-2); color: var(--ink-2); margin: 0 4px 4px 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font: 550 13.5px/1.2 var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn--sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.callout { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; color: var(--ink-2); }
.callout b { color: var(--ink); }
.callout--truth { border-left: 3px solid var(--watch); background: var(--watch-soft); }
.callout--good { border-left: 3px solid var(--long); background: var(--long-soft); }
.callout--bad { border-left: 3px solid var(--short); background: var(--short-soft); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* verdict and severity badges: colour + icon + word, never colour alone */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font: 650 12px/1.6 var(--sans); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; flex: none; }
.badge--robust { background: var(--long-soft); color: var(--long); }
.badge--fragile { background: var(--watch-soft); color: var(--watch); }
.badge--no-edge, .badge--insufficient, .badge--running, .badge--failed { background: var(--neutral-soft); color: var(--neutral); }
.badge--invalid { background: var(--short-soft); color: var(--short); }
.badge--critical { background: var(--short-soft); color: var(--short); }
.badge--warning { background: var(--watch-soft); color: var(--watch); }
.badge--info { background: var(--neutral-soft); color: var(--neutral); }
.badge--supported { background: var(--long-soft); color: var(--long); }
.badge--rejected, .badge--inconclusive, .badge--draft, .badge--registered { background: var(--neutral-soft); color: var(--neutral); }
.badge--abandoned { background: var(--short-soft); color: var(--short); }
.gate { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px/1.4 var(--sans); }
.gate--pass { color: var(--long); }
.gate--fail { color: var(--short); }
.gate--na { color: var(--faint); }
.gate svg { width: 13px; height: 13px; }
.wcount { display: inline-flex; gap: 6px; font: 600 12px/1 var(--sans); }
.wcount span { display: inline-flex; align-items: center; gap: 3px; }
.wcount .c { color: var(--short); }
.wcount .w { color: var(--watch); }
.wcount .i { color: var(--faint); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; z-index: 1; }
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--ink); }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.data tbody tr.is-selected { background: var(--accent-soft); }
table.data tr:last-child td { border-bottom: 0; }
td.neg { color: var(--short); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.filters input[type="search"], .filters select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule-strong); background: var(--surface); min-width: 0; }
.filters input[type="search"] { width: min(260px, 100%); }
.filters label { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); }
.chart .axis text, .chart .tick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band-label { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart .crosshair { stroke: var(--faint); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.chart .ref { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ref-label { fill: var(--muted); font-size: 11px; }
.chart .end-label { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 6px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }
.chart-legend i.box { width: 10px; height: 10px; border-radius: 3px; }
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.chart-foot .small { color: var(--muted); }
.tooltip { position: fixed; z-index: 50; pointer-events: none; min-width: 120px; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: 0 6px 24px rgba(0,0,0,.12); font-size: 12.5px; color: var(--ink-2); }
.tooltip .tt-title { font-weight: 600; color: var(--muted); margin-bottom: 4px; font-size: 12px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tooltip .tt-key { display: inline-block; width: 12px; height: 2px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.table-view { margin-top: 10px; max-height: 320px; overflow: auto; border: 1px solid var(--rule); border-radius: 8px; }
.scale-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.scale-legend .bar { height: 8px; width: 160px; border-radius: 4px; }

/* ------------------------------------------------------------------ specific views */
.tour { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.tour a { display: block; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none; }
.tour a:hover { border-color: var(--accent); }
.tour .n { font: 600 12px/1 var(--mono); color: var(--accent); }
.tour .t { font: 650 15px/1.3 var(--sans); margin: 6px 0 4px; }
.tour .d { font-size: 13px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 12px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--rule-strong); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: -2px; width: 1px; background: var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline li.k-critical::before { background: var(--short); }
.timeline li.k-good::before { background: var(--long); }
.timeline li.k-warn::before { background: var(--watch); }
.timeline .when { font: 500 12px/1.4 var(--mono); color: var(--faint); display: block; }
.diff { font-size: 14px; line-height: 1.55; }
.diff del { background: var(--short-soft); color: var(--short); text-decoration: line-through; }
.diff ins { background: var(--long-soft); color: var(--long); text-decoration: none; }
.dag { overflow-x: auto; }
.dag svg { display: block; }
.dag .node rect { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 1; }
.dag .node.kind-raw rect { stroke: var(--ink-2); }
.dag .node.flag-bad rect { stroke: var(--short); stroke-width: 1.5; }
.dag .node text { fill: var(--ink); font-size: 12px; font-family: var(--sans); }
.dag .node text.sub { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.dag .edge { fill: none; stroke: var(--axis); stroke-width: 1.4; }
.dag .edge-label { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.dag .node:hover rect, .dag .node:focus rect { stroke: var(--accent); }
.hashcheck { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; align-items: baseline; font-size: 13.5px; }
.match-yes { color: var(--long); font-weight: 650; }
.match-no { color: var(--short); font-weight: 650; }
.range { width: 100%; accent-color: var(--accent); }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.ci { position: relative; height: 22px; }
.ci .line { position: absolute; top: 10px; height: 2px; background: var(--series-1); border-radius: 2px; }
.ci .dot { position: absolute; top: 6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 0 2px var(--chart-surface); }
.ci .zero { position: absolute; top: 2px; bottom: 2px; width: 1px; background: var(--axis); }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.footer { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
@media (max-width: 640px) {
  .page-title { font-size: 22px; }
  .tile__value { font-size: 22px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 6px; }
}
@media print { .nav, .topbar__actions, .chart-foot button { display: none !important; } }
