/* agent-top ui, in the docs site's Survey look: cool paper, ink, thin rules,
   square corners and monospaced labels. The brand is the hat-and-glasses mark.
   Chart colours are the dataviz reference palette, one fixed slot per harness,
   validated light and dark. */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/Geist.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("fonts/JetBrainsMono.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --page: #eef0f2;
  --card: #f8f9fa;
  --raise: #eef0f2;
  --ink: #12141a;
  --ink-2: #4b5160;
  --muted: #4b5160;
  --faint: #7a8090;
  --grid: #dfe2e7;
  --axis: #b9bdc6;
  --line: #cdd1d8;
  --line-2: #cdd1d8;
  --rail: #dfe2e7;
  --accent: #2453e0;
  --ramp-2: #6a90f6;
  --ramp-3: #9db2ee;
  --wash: rgba(36, 83, 224, 0.07);
  --focus: rgba(36, 83, 224, 0.45);
  --critical: #d03b3b;
  --ok: #1baf7a;
  --shadow: none;
  --h1: #2f63e0; --h2: #d99a1e; --h3: #139a8a; --h4: #b04fb0; --h5: #e2706a; --h6: #3aa0d8;
  --other: #898781;
  --turn: #e9e8e4;
  /* The sidebar is paper with a rule; the hero tile stays ink in both themes. */
  --side: var(--page);
  --side-2: var(--rail);
  --side-ink: var(--ink);
  --side-muted: var(--muted);
  --hero: #12141a;
  --hero-muted: #9aa1b1;
  --on-ink: #ffffff;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0c0e12; --card: #13161c; --raise: #1a1d24;
    --ink: #f3f4f7; --ink-2: #c1c5d0; --muted: #a3a9b7; --faint: #7d8494;
    --grid: #22252d; --axis: #353945; --line: #2a2e38; --line-2: #2a2e38; --rail: #1d2028;
    --hero: #1a1d24; --on-ink: #12141a;
    --accent: #6f8ff0; --ramp-2: #4b6fd8; --ramp-3: #33498f;
    --wash: rgba(111, 143, 240, 0.10); --focus: rgba(111, 143, 240, 0.55);
    --shadow: none;
    --h1: #5b86f0; --h2: #c98f1c; --h3: #16a08f; --h4: #c062c0; --h5: #e0705f; --h6: #3f97d6;
    --turn: #262624;
    --side: var(--page); --side-2: var(--rail);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c0e12; --card: #13161c; --raise: #1a1d24;
  --ink: #f3f4f7; --ink-2: #c1c5d0; --muted: #a3a9b7; --faint: #7d8494;
  --grid: #22252d; --axis: #353945; --line: #2a2e38; --line-2: #2a2e38; --rail: #1d2028;
  --hero: #1a1d24; --on-ink: #12141a;
  --accent: #6f8ff0; --ramp-2: #4b6fd8; --ramp-3: #33498f;
  --wash: rgba(111, 143, 240, 0.10); --focus: rgba(111, 143, 240, 0.55);
  --shadow: none;
  --h1: #5b86f0; --h2: #c98f1c; --h3: #16a08f; --h4: #c062c0; --h5: #e0705f; --h6: #3f97d6;
  --turn: #262624;
  --side: var(--page); --side-2: var(--rail);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
code { font-family: var(--mono); font-size: 0.88em; }
h1 { font: 500 24px/1.2 var(--sans); letter-spacing: -0.02em; margin: 0; }
h2 { font: 500 16px/1.3 var(--sans); letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { stroke-linecap: round; stroke-linejoin: round; }

/* ---- shell: sidebar and main column ---------------------------------------- */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 28px; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; }
.brand .logo { width: 34px; height: 34px; flex: none; fill: var(--ink); }
.brand .name { font: 500 18px var(--sans); letter-spacing: -0.02em; color: var(--ink); }

.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs [role="tab"] { display: flex; align-items: center; gap: 11px; border: 0; background: none; color: var(--side-muted); font: 500 14px var(--sans);
  padding: 9px 10px; border-radius: 0; cursor: pointer; text-align: left; position: relative; }
.tabs [role="tab"] svg { width: 18px; height: 18px; flex: none; stroke: currentColor; stroke-width: 1.6; fill: currentColor; }
.tabs [role="tab"] svg [fill="none"] { fill: none; }
.tabs [role="tab"]:hover { color: var(--side-ink); background: var(--side-2); }
.tabs [role="tab"][aria-selected="true"] { color: var(--page); background: var(--ink); }
.tabs [role="tab"][aria-selected="true"] svg { color: var(--ramp-3); }

.store { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--side-muted); display: grid; gap: 4px; }
.store-state { display: flex; align-items: center; gap: 8px; color: var(--side-ink); font-weight: 500; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #1baf7a; box-shadow: 0 0 0 3px rgba(27, 175, 122, 0.18); }
.store-path { font: 11px/1.4 var(--mono); overflow-wrap: anywhere; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 32px; position: sticky; top: 0; z-index: 4;
  background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { margin-right: auto; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

main { padding: 24px 32px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1360px; width: 100%; transition: opacity 0.15s; }
main.loading { opacity: 0.6; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.panel[hidden] { display: none; }

/* ---- components -------------------------------------------------------------- */

.seg { display: inline-flex; padding: 0; gap: 0; border-radius: 0; background: var(--card); border: 1px solid var(--line); }
.seg button { border: 0; border-left: 1px solid var(--line); background: none; color: var(--ink-2); font: 500 13px var(--sans); padding: 7px 12px; border-radius: 0; cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--page); }

.select[hidden] { display: none; }
.select { display: flex; gap: 8px; align-items: center; font: 500 13px var(--sans); color: var(--ink-2); }
.select select, .search input { font: 500 13px var(--sans); height: 34px; padding: 0 30px 0 11px; border-radius: 0; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 16px; height: 16px; stroke: var(--muted); stroke-width: 1.6; pointer-events: none; }
.search input { padding: 0 11px 0 32px; width: min(300px, 100%); background-image: none; cursor: text; }
.search input::placeholder { color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 0; font: 500 13px var(--sans);
  border: 1px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--page); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; }
.btn.ghost { border-color: transparent; background: none; box-shadow: none; color: var(--ink-2); height: 30px; padding: 0 10px; }
.btn.ghost:hover { background: var(--raise); color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--wash); color: var(--accent); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 0; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--raise); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; fill: currentColor; }
.icon-btn svg [fill="none"] { fill: none; }
/* Older markup in the session detail still says toggle. */
.toggle { font: 500 13px var(--sans); background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 0; padding: 4px 10px; cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 0; padding: 20px 22px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.card-head h2 + .note { margin-right: auto; margin-left: -4px; }
.card-head:has(h2 + .note) h2 { margin-right: 0; }
.note { color: var(--muted); font-size: 12.5px; }
/* A short qualifier beside a heading reads as a label. */
.card-head .note { color: var(--faint); font: 12px var(--mono); }
.foot-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 20px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--sans); padding: 2px 9px 2px 7px; border-radius: 2px;
  background: var(--raise); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 0; }
.badge { font: 500 11.5px var(--sans); padding: 1px 8px; border-radius: 2px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.sub { margin-left: 8px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--wash); }
.err { color: var(--critical); font-weight: 600; }

/* The meter: the logo's stepped bars, used for a share of a whole. */
.meter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; height: 8px; }
.meter i { border-radius: 0; background: var(--rail); }
.meter i.on { background: var(--accent); }
.meter i.on.lo { background: var(--ramp-3); }
.meter i.on.mid { background: var(--ramp-2); }

/* ---- KPIs ------------------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; gap: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 0; padding: 18px 20px; min-width: 0; display: grid; gap: 4px; align-content: start; }
.kpi .label { font: 12px var(--mono); color: var(--faint); }
.kpi .value { font: 500 30px/1.15 var(--sans); letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 13px; }
.kpi .meter { margin-top: 8px; }
.kpi.hero { grid-row: span 2; padding: 22px 24px; background: var(--hero); border-color: var(--hero); color: #fff; }
.kpi.hero .label { color: var(--hero-muted); }
.kpi.hero .value { font-size: 56px; letter-spacing: -0.04em; margin-top: 10px; }
.kpi.hero .sub { color: var(--hero-muted); }
/* The hero's daily bars, in the logo's three blues by height. */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 72px; margin-top: auto; padding-top: 18px; }
.spark i { flex: 1; min-width: 2px; border-radius: 0; background: #9db2ee; }
.spark i.mid { background: #6a90f6; }
.spark i.hi { background: #2453e0; }
.spark i.zero { background: rgba(255, 255, 255, 0.08); height: 2px !important; }
.kpi.hero .spark-axis { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--hero-muted); margin-top: 6px; }
.kpi.warn .value { color: var(--h2); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi.hero { grid-column: 1 / -1; grid-row: auto; } }
@media (max-width: 520px) { .kpis { gap: 12px; } .kpi { padding: 14px; } .kpi .value { font-size: 22px; } .kpi.hero .value { font-size: 40px; } }
@media (max-width: 480px) { .tabs [role="tab"] svg { display: none; } .tabs { gap: 0; } }

/* Harness colours, one fixed slot each (claude, codex, opencode, gemini,
   kodelet, otel): cobalt, gold, teal, plum, coral, sky. Validated with the
   dataviz checks in both modes; the stacked bars keep a 2px gap and a legend
   and table view, which the gold and sky slots need on white. */

/* ---- charts ------------------------------------------------------------------- */

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .key { display: inline-block; width: 9px; height: 9px; border-radius: 0; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .waterfall text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .seg-mark:hover, .chart .seg-mark:focus { filter: brightness(1.12); outline: none; }

.bars { display: grid; gap: 2px; }
.bars .row { display: grid; grid-template-columns: minmax(90px, 36%) 1fr; gap: 12px; align-items: center; padding: 5px 6px; border-radius: 0; font-size: 13px; }
.bars .row:hover, .bars .row:focus { background: var(--raise); outline: none; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-family: var(--mono); font-size: 12px; }
.bars .track { display: grid; grid-template-columns: 1fr 72px; align-items: center; gap: 10px; min-width: 0; }
.bars .lane { min-width: 0; background: var(--rail); border-radius: 0; }
.bars .fill { height: 10px; border-radius: 0; background: var(--accent); min-width: 2px; }
.bars .val { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; font-weight: 500; text-align: right; }

/* ---- tables ------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font: 400 11.5px var(--mono); color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.mono { font-family: var(--mono); font-size: 12px; }
td.trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--raise); }
tbody tr.click { cursor: pointer; }
tbody tr.click:focus { background: var(--wash); outline: none; }
tbody tr[aria-current="true"] { background: var(--wash); box-shadow: inset 3px 0 0 var(--accent); }
.lat { display: inline-block; height: 8px; border-radius: 0; background: var(--h1); vertical-align: middle; margin-right: 8px; }
.lat.p95 { background: var(--h2); }

th .sort { all: unset; cursor: pointer; font: inherit; color: inherit; display: inline-flex; gap: 4px; align-items: center; }
th .sort:hover { color: var(--ink); }
th .sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--ink); }
table.report tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--raise); }
table.report td.share { width: 120px; }
table.report td.share .meter { height: 6px; }
table.report td.cost { font-weight: 600; }

.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.load-error { color: var(--critical); text-align: left; }

/* ---- session detail ---------------------------------------------------------- */

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; margin-bottom: 20px; font-size: 13px;
  padding: 14px 16px; background: var(--raise); border: 1px solid var(--line); border-radius: 0; }
.facts div { min-width: 0; }
.facts .k { font: 11.5px var(--mono); color: var(--faint); }
.facts .v { overflow-wrap: anywhere; font-weight: 500; }
.waterfall { overflow-x: auto; margin-top: 12px; }
.waterfall svg { color: var(--ink); display: block; }
.waterfall h2 { margin: 8px 0; }

/* A panel on the right over the page, scrolled on its own, so the sessions
   table stays in view beside it. Full width on a narrow screen. */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 6; width: min(980px, 72vw); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 0; border-width: 0 0 0 1px; padding: 0 24px 24px; box-shadow: -24px 0 48px rgba(12, 14, 18, 0.14); }
.drawer > .card-head { position: sticky; top: 0; z-index: 1; background: var(--card); padding: 18px 0 14px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.drawer > .card-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; font-size: 17px; }
.drawer-open .foot { padding-bottom: 24px; }
@media (max-width: 900px) { .drawer { width: 100vw; border-width: 0; border-radius: 0; } }
.drawer h2 { margin-bottom: 10px; }

/* Context timeline: the exact prompt in the accent, compactions as rules. */
.ctx:not(:empty) { margin-bottom: 24px; }
.ctx > .card-head { margin-bottom: 8px; }
.ctx > .card-head h2 { margin-bottom: 0; }
.ctx .chart svg { margin-top: 4px; }
.ctx .ctx-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.ctx .ctx-line.thin { stroke: var(--ink-2); stroke-width: 1; stroke-opacity: 0.6; }
.ctx .ctx-fill { fill: var(--accent); fill-opacity: 0.10; }
.ctx .band { fill-opacity: 0.55; }
.ctx .rule { stroke: var(--h2); stroke-width: 1; pointer-events: none; }
.ctx .rule.inferred { stroke-dasharray: 3 3; }
.ctx .rule.on { stroke-width: 2.5; }
.ctx .rule-label { fill: var(--h2); font: 11px var(--mono); pointer-events: none; }
.ctx .rule-label.on { font-weight: 700; }
.ctx .rule-hit { fill: transparent; cursor: pointer; }
.ctx .rule-hit:hover, .ctx .rule-hit:focus { fill: var(--wash); outline: none; }
.ctx .window { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 6 4; pointer-events: none; }
.ctx .window-label { fill: var(--ink-2); font: 11px var(--mono); pointer-events: none; }
.ctx .cross { stroke: var(--ink-2); stroke-dasharray: 2 3; pointer-events: none; }
.ctx .ctx-dot { fill: var(--accent); stroke: var(--card); stroke-width: 1.5; pointer-events: none; }
.ctx .legend { margin-top: 6px; }
.ctx .table-wrap { margin-top: 12px; }
.ctx-sources { margin-top: 12px; display: grid; gap: 2px; }
.ctx-sources h2 { margin-bottom: 2px; }
.ctx-sources .track { grid-template-columns: 1fr 112px; }
.ctx-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.legend .k-rule { width: 0; height: 12px; border-radius: 0; border-left: 2px solid var(--h2); }
.legend .k-rule.inferred { border-left-style: dashed; }
.legend .k-window { width: 14px; height: 0; border-radius: 0; border-top: 2px dashed var(--ink-2); background: none; }

/* Run graph: a neutral trunk for the main agent, the accent for subagents. */
.run:not(:empty) { margin-bottom: 24px; }
.run > .note:only-child { padding: 4px 0; }
.graph svg { overflow: visible; }
.graph text { fill: var(--ink); font: 12px var(--sans); pointer-events: none; }
.graph .dim { fill: var(--muted); }
.graph .name { font-weight: 600; }
.graph .id { fill: var(--muted); font: 11px var(--mono); }
.graph .bad { fill: var(--critical); font-weight: 600; }
.graph .lines { fill: none; pointer-events: none; }
.graph .trunk { stroke: var(--ink-2); stroke-width: 1.5; }
.graph .branch { stroke: var(--accent); stroke-width: 1.5; }
.graph .loose { stroke-dasharray: 3 3; }
.graph circle, .graph rect.turn { pointer-events: none; }
.graph .turn { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.5; }
.graph .agent, .graph .join { fill: var(--accent); stroke: var(--card); stroke-width: 1.5; }
.graph circle.bad { fill: var(--critical); }
.graph .hit { fill: transparent; cursor: pointer; }
.graph .hit:hover, .graph .hit:focus, .graph .hit.on { fill: var(--wash); outline: none; }
.legend .k-turn { border-radius: 50%; border: 1.5px solid var(--ink-2); background: var(--card); }
.legend .k-agent { border-radius: 50%; background: var(--accent); }
.legend .k-loose { height: 0; border-radius: 0; border-top: 2px dashed var(--accent); }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--ink); border-radius: 0;
  padding: 9px 11px; font-size: 12.5px; box-shadow: 0 8px 20px rgba(12, 14, 18, 0.10); max-width: 300px; }
.tip .tv { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.tip .tr { display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.tip .lk { width: 12px; height: 2px; display: inline-block; }

.foot { color: var(--muted); font-size: 12.5px; padding: 8px 32px 28px; }

/* ---- narrow screens: the sidebar folds into a bar on top ------------------------ */

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
  .tabs { flex-direction: row; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .tabs [role="tab"] { padding: 7px 10px; }
    .store { margin: 0 0 0 auto; border: 0; padding: 0; }
  .store-path, .store-sync { display: none; }
  .topbar { position: static; padding: 14px 16px; }
  main { padding: 16px; }
  .foot { padding: 8px 16px 20px; }
  .table-wrap { margin: 0 -20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* A session row opens the side panel; the last cell says so. */
.open-hint { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font: 500 12.5px var(--sans); white-space: nowrap; opacity: 0.75; }
.open-hint svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.8; fill: none; transition: transform 0.12s; }
tbody tr.click:hover .open-hint, tbody tr.click:focus .open-hint, tbody tr[aria-current="true"] .open-hint { color: var(--accent); opacity: 1; }
tbody tr.click:hover .open-hint svg, tbody tr.click:focus .open-hint svg { transform: translateX(2px); }
tbody tr.click:hover { background: var(--wash); }
.hint { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 8px 12px; border-radius: 0; border: 1px solid var(--line); background: var(--raise); color: var(--ink-2); font-size: 13px; }
.hint svg { width: 16px; height: 16px; flex: none; stroke: var(--accent); stroke-width: 1.7; fill: none; }

/* Footprint (RFC-112): every figure a median with its 90% interval. */
td.est { white-space: nowrap; color: var(--ink); }
.fp { display: grid; gap: 20px; }
.kpi.hero .exp { background: #9db2ee; color: #12141a; }
.fp-change { display: flex; align-items: center; gap: 6px; margin-top: 14px; font: 500 14px var(--sans); color: var(--hero-muted); }
.fp-change .arrow { font-size: 10px; }
.fp-change.up { color: #ff8f86; }
.fp-change.down { color: #5fd8a3; }
.fp-method .fp-mname { fill: var(--ink); font: 500 13px var(--sans); }
.fp-method .fp-mnote { fill: var(--faint); font: 11px var(--mono); }
.fp-method .fp-mval { fill: var(--ink); font: 500 12.5px var(--sans); font-variant-numeric: tabular-nums; }
.fp-method .fp-span { fill: var(--accent); fill-opacity: 0.28; }
.fp-method.main .fp-span { fill-opacity: 0.42; }
.fp-method .fp-mid { fill: var(--accent); }
.fp-method.ref .fp-span { fill: var(--other); fill-opacity: 0.35; }
.fp-method.ref .fp-mname, .fp-method.ref .fp-mval { fill: var(--muted); }
.fp-method:hover .fp-span, .fp-method:focus .fp-span { fill-opacity: 0.6; outline: none; }
.fp-bar { fill: var(--accent); fill-opacity: 0.8; }
.fp-whisk { stroke: var(--ink-2); stroke-width: 1.4; fill: none; }
.fp-day:hover .fp-bar, .fp-day:focus .fp-bar { fill-opacity: 1; }
.fp-day:focus { outline: none; }
.legend .k-mid { background: var(--accent); opacity: 0.8; }
.legend .k-whisk { width: 0; height: 12px; border-left: 1.5px solid var(--ink-2); background: none; }
.fp-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0; border-top: 1px solid var(--line); }
.fp-cmp { padding: 16px 18px 4px 0; display: grid; gap: 4px; align-content: start; }
.fp-cmp + .fp-cmp { padding-left: 18px; border-left: 1px solid var(--line); }
.fp-cmp-v { font: 500 32px/1.1 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.fp-cmp-v span { font-size: 14px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.fp-cmp-w { color: var(--ink-2); font-size: 13px; }
.fp-cmp-r { color: var(--faint); font: 11.5px var(--mono); }
.fp-cmp-icon { gap: 10px; }
.fp-cmp-icon > div { display: grid; gap: 4px; }
.cmp-icon { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.cmp-icon .soft { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: none; }
.cmp-icon .hole { fill: var(--card); }
/* The headline row: a compact CO2e card beside its comparisons. */
.fp-top { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.2fr); gap: 20px; }
.fp-top .kpi.hero { grid-row: auto; padding: 18px 20px; }
.fp-top .kpi.hero .value { font-size: 44px; margin-top: 4px; }
.fp-equiv .fp-compare { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fp-equiv .fp-cmp { padding-top: 14px; padding-bottom: 0; }
.fp-equiv .fp-cmp-v { font-size: 28px; }
@media (max-width: 720px) { .fp-equiv .fp-compare { grid-template-columns: 1fr; } }
.kpis.fp-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .fp-top { grid-template-columns: 1fr; } .kpis.fp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fp-truth { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 0; border-top: 1px solid var(--line); }
.fp-truth-col { padding: 14px 18px 0 0; }
.fp-truth-col + .fp-truth-col { padding-left: 18px; border-left: 1px solid var(--line); }
.fp-truth h3 { font: 12px var(--mono); color: var(--faint); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.fp-truth h3::before { content: ""; width: 7px; height: 7px; transform: rotate(45deg); background: var(--ok); }
.fp-truth .est h3::before { background: var(--h2); }
.fp-truth .out h3::before { background: var(--faint); }
.fp-truth ul { margin: 0; padding: 0; list-style: none; }
.fp-truth li { padding: 7px 0; border-top: 1px solid var(--rail); font-size: 13px; color: var(--ink-2); }
.fp-truth li:first-child { border-top: 0; }
@media (max-width: 720px) { .fp-cmp + .fp-cmp, .fp-truth-col + .fp-truth-col { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }
.foot-note a { color: var(--accent); }
/* Energy and CO2e is experimental (RFC-111); its headings say so. */
.exp { display: inline-block; margin-left: 8px; padding: 1px 6px; font: 500 11px var(--mono); vertical-align: 2px; color: var(--page); background: var(--ink); }

/* Insights (RFC-113): one tab, three views under a switch. */
.views { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.views .note { color: var(--muted); font-size: 13px; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.view[hidden] { display: none; }
.select select#project { max-width: 220px; text-overflow: ellipsis; }
.bars .lane.split { display: flex; gap: 2px; background: none; }
.bars .lane.split .fill { min-width: 0; }
.bars .fill.light { background: var(--ramp-3); }
.stack { display: flex; gap: 2px; height: 16px; margin: 6px 0 10px; }
.stack i { display: block; height: 100%; min-width: 2px; }
.stack i:hover, .stack i:focus { filter: brightness(1.12); outline: none; }
.ctx-top { margin-top: 18px; }
.ctx-top h3 { font: 12px var(--mono); color: var(--faint); margin: 0 0 4px; font-weight: 400; }
.ctx-big { margin: 14px 0 0; color: var(--ink-2); }
.ctx-big strong { font: 500 22px var(--sans); color: var(--ink); letter-spacing: -0.02em; margin-right: 4px; }
.fp-compare.fp-intensity { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fp-intensity .fp-cmp-v { font-size: 22px; }
@media (max-width: 1100px) { .fp-compare.fp-intensity { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fp-intensity .fp-cmp { padding-left: 0; border-left: 0; } }
.fp-delta.up { color: var(--critical); }
.fp-delta.down { color: var(--ok); }
