@font-face { font-family: "Geist"; src: url(fonts/Geist.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/GeistMono.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/SpaceGrotesk.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
/* Tokens follow the Kubex Autotuner site: navy surfaces, one lime accent. */
:root {
  color-scheme: dark;
  --bg: oklch(14% .02 260);
  --surface: oklch(18% .03 262);
  --raised: oklch(22% .04 262);
  --hover: oklch(21% .035 262);
  --rule: oklch(28% .045 262);
  --rule-strong: oklch(36% .05 262);
  --text: oklch(96% .01 250);
  --muted: oklch(72% .03 255);
  --faint: oklch(64% .03 255);
  --accent: oklch(92% .2 118);
  --on-accent: oklch(16% .03 260);
  --positive: var(--accent);
  --negative: oklch(72% .17 25);
  --amber: oklch(80% .15 75);
  --applying: oklch(68% .16 300);
  --memory: var(--positive);
  --display: "Space Grotesk", system-ui, sans-serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 12px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 20px;
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: 1.45;
}
* { box-sizing: border-box; }
[id] { scroll-margin-top: 72px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--on-accent); }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
button, select, input { font: inherit; }
button, select { background: var(--raised); color: var(--text); border: 1px solid var(--rule-strong); border-radius: 6px; padding: 5px 9px; cursor: pointer; }
button:hover, select:hover { border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Route changes move focus to these containers for screen readers; a frame around the whole section is noise. */
#main:focus-visible, #optimization:focus-visible, #detail:focus-visible, #policies-title:focus-visible { outline: none; }
button:focus-visible { position: relative; z-index: 1; }
h1, h2, h3, p, ol { margin: 0; }
h1, h2 { font-family: var(--display); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: var(--fs-sm); font-weight: 600; }
small { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
code { font: var(--fs-sm) var(--mono); overflow-wrap: anywhere; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.warn { color: var(--amber); }
.changed { color: var(--text); font-weight: 600; }
.muted { color: var(--muted); }
.note { font-size: var(--fs-xs); }
.eyebrow { color: var(--muted); font-size: var(--fs-xs); }

/* App bar */
/* Full-bleed bar; its content lines up with main's 1240px content box. */
.app-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; padding: 0 max(20px, calc((100% - 1240px) / 2)); min-height: 48px; background: var(--bg); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 600 16px var(--display); letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.brand::before { content: ""; width: 22px; height: 22px; background: url(favicon.png) center / contain no-repeat; }
.product-nav { display: flex; align-self: stretch; flex-wrap: wrap; gap: 4px 22px; }
.product-nav a, .product-nav button:disabled { display: flex; align-items: center; gap: 8px; padding: 12px 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-size: var(--fs-sm); }
.product-nav a { color: var(--text); text-decoration: none; }
.product-nav a[aria-current] { border-color: var(--accent); }
.product-nav button:disabled { color: var(--muted); background: transparent; cursor: default; }
.soon { padding: 1px 6px; border: 1px solid var(--rule-strong); border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 16px; }

/* Shell: loop tabs and views, context, scoreboard, timeline, then detail | telemetry */
main { max-width: 1280px; margin-inline: auto; padding: 16px 20px 32px; }
.app, #optimization { display: grid; gap: 12px; }
.workspace-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.loop-tabs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.loop-tabs a { flex: 0 0 auto; display: grid; padding: 6px 12px 7px; border: 1px solid var(--rule); border-radius: 8px; color: var(--text); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
.loop-tabs a:hover { border-color: var(--rule-strong); background: var(--hover); }
.loop-tabs a[aria-current] { border-color: var(--rule-strong); background: var(--raised); box-shadow: inset 0 -2px var(--accent); }
.workspace-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: 8px; }
.workspace-switch a { padding: 4px 12px; border-radius: 5px; color: var(--muted); font-size: var(--fs-sm); text-decoration: none; }
.workspace-switch a:hover { color: var(--text); }
.workspace-switch a[aria-current] { background: var(--raised); color: var(--text); }
.loop-context { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 20px; min-width: 0; margin-top: 4px; font-size: var(--fs-sm); }
.loop-context > h1 { flex-basis: 100%; margin-bottom: 2px; }
.policy-name { flex-basis: 100%; font-size: var(--fs-sm); }
.policy-name a { color: var(--text); }
.context-label { color: var(--text); font-weight: 600; }
.loop-context > span { min-width: 0; }
.loop-objectives { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.loop-objectives > span { white-space: nowrap; }
.running-status { padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius); font-size: var(--fs-sm); }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 14px; border-bottom: 1px solid var(--rule); min-height: 44px; }
label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: var(--fs-xs); }
select { max-width: 100%; padding: 3px 6px; font-size: var(--fs-xs); }

/* Scoreboard: four KPIs. The 1px gaps draw the rules. */
.loop-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; background: var(--rule); }
.loop-results > * { background: var(--surface); }
.verdict-reason { max-width: 72ch; margin-top: 6px; font-size: var(--fs-sm); text-wrap: pretty; }
.arg code { color: var(--muted); }
.kpi { display: flex; flex-direction: column; min-width: 0; padding: 12px 16px; }
.kpi > .impact-reading { margin-top: auto; }
.kpi h3 { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.kpi h3 small { display: inline; margin-left: 4px; color: var(--faint); }
.kpi h3 small::before { content: "· "; }
/* The trace takes whatever height the scoreboard row leaves. */
.kpi-trace { display: block; flex: 1 1 36px; width: 100%; min-height: 36px; max-height: 96px; margin: 10px 0 8px; overflow: hidden; }
.kpi-trace path { fill: none; stroke: var(--muted); stroke-opacity: .6; stroke-width: 1.25; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.kpi-trace line { stroke-width: 1; vector-effect: non-scaling-stroke; }
.kpi-window-before, .kpi-window-after { fill: var(--text); fill-opacity: .04; }
.kpi-zero { stroke: var(--muted); stroke-opacity: .5; stroke-dasharray: 3 3; }
.kpi-mean-after { stroke: var(--kpi-tone); stroke-width: 2 !important; }
.kpi:has(.impact-number.positive) { --kpi-tone: var(--positive); }
.kpi:has(.impact-number.negative) { --kpi-tone: var(--negative); }
.kpi:has(.impact-number.warn) { --kpi-tone: var(--amber); }
.kpi:has(.impact-number.muted) { --kpi-tone: var(--muted); }
.empty-result { grid-column: 1 / -1; display: flex; align-items: center; padding: 14px 16px; }
.impact-number { margin: 4px 0 0; font: 600 clamp(22px, 2vw, 28px)/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.impact-reading { color: var(--muted); font: var(--fs-xs) var(--mono); overflow-wrap: anywhere; }
.config-line { display: flex; align-items: baseline; gap: 8px; font: var(--fs-sm) var(--mono); font-variant-numeric: tabular-nums; }
.config-line > .muted { min-width: 96px; font: var(--fs-xs) var(--sans); }
.config-line strong { font-weight: 600; }
.config-line small { display: inline; }
.config-line .unchanged { color: var(--muted); }
.arrow { color: var(--faint); }
.outcome-status { display: block; min-width: 0; }
.outcome-copy > strong { display: block; color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.outcome-copy > small { margin-top: 1px; color: var(--muted); }

/* Scrollable sidebar: loops and nested steps in time order */
.sort { padding: 3px 8px; font-size: var(--fs-xs); }
.strip { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; max-height: 65vh; background: var(--rule); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden auto; }
.loop-group { display: flex; flex-direction: column; min-width: 0; background: var(--surface); container-type: inline-size; }
.loop-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 12px; width: 100%; padding: 10px 14px; border: 0; border-radius: 0; background: transparent; text-align: left; }
.loop-head > .card-eyebrow { grid-column: 1 / -1; }
.loop-head > .config-change { white-space: normal; overflow-wrap: anywhere; }
button.loop-head:hover { background: var(--hover); }
.loop-head[aria-pressed="true"] { background: var(--raised); box-shadow: inset 2px 0 var(--accent); }
.loop-head > .score { order: 1; font-size: var(--fs-md); }
@container (max-width: 460px) {
  .loop-head { grid-template-columns: minmax(0, 1fr) auto; }
  .loop-head > .config-change { grid-column: 1 / -1; order: 2; }
}
.card-eyebrow { display: flex; gap: 4px; min-width: 0; white-space: nowrap; color: var(--muted); font-size: var(--fs-xs); }
.card-eyebrow > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-eyebrow > .muted { flex: 0 1000 auto; }
.card-eyebrow > .muted::before { content: "· "; }
.config-change { font: var(--fs-xs) var(--mono); }
.config-change > .arg { display: block; }
/* Steps hang off a rail; each dot carries the step's outcome colour. */
.steps { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 0 10px 10px 32px; list-style: none; }
.steps::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 28px; width: 1px; background: var(--rule-strong); }
.steps > li { position: relative; }
.step { --step-color: var(--positive); position: static; display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; }
.step-rejected { --step-color: var(--negative); }
.step-rollback { --step-color: var(--applying); }
.step-memory { --step-color: var(--memory); }
.step:hover { background: var(--hover); border-color: transparent; }
.step[aria-pressed="true"] { background: var(--raised); border-color: var(--rule-strong); }
.step-text { display: grid; min-width: 0; line-height: 1.3; }
.step .stage { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 500; }
.step-scores { font: var(--fs-xs) var(--mono); white-space: nowrap; }
.step-scores .score { font-size: var(--fs-xs); }
.step-outcome { align-self: flex-start; margin-left: auto; color: var(--step-color); font-size: var(--fs-xs); }
.step-arg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: var(--fs-xs) var(--mono); }
.running { color: var(--muted); font: var(--fs-xs) var(--mono); white-space: nowrap; }
.step-dot { position: absolute; left: -17.5px; top: 50%; width: 9px; height: 9px; margin-top: -6.5px; border: 2px solid var(--surface); border-radius: 50%; background: var(--step-color); box-sizing: content-box; }
.badge { display: inline-block; border: 1px solid var(--rule-strong); border-radius: 4px; padding: 0 6px; font-size: var(--fs-xs); line-height: 1.6; white-space: nowrap; }
.accepted { color: var(--positive); }
.rejected { color: var(--negative); }
.memory { color: var(--memory); }
.rollback { color: var(--applying); }
.current { color: var(--text); }

/* Detail | telemetry */
.workspace { display: grid; grid-template-columns: minmax(400px, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: start; }
.detail { padding: 14px 16px 16px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-head h2 { font-size: var(--fs-lg); margin-top: 2px; }
.detail-head > div + div { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.detail .context-line { margin-top: 4px; font-size: var(--fs-sm); }
.detail > h3 { margin: 16px 0 2px; }
.detail > .caption { font-size: var(--fs-xs); }
.detail > .note { margin-top: 10px; }
.detail details { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
.detail summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.detail summary:hover { color: var(--text); }
.detail details > p, .detail details > ul, .detail details > div { margin-top: 8px; font-size: var(--fs-sm); }
.decision-config { display: grid; gap: 2px; }
.score { font: 500 var(--fs-sm) var(--mono); white-space: nowrap; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
td, output, .chart-readout { font-family: var(--mono); }
th, td { padding: 5px 6px; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; }
th:first-child { text-align: left; padding-left: 0; }
td:last-child { padding-right: 0; }
thead th { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
tbody th { font-weight: 400; }
tbody th small { display: inline; margin-left: 3px; color: var(--muted); }
td small { display: inline; margin-left: 6px; font-family: var(--sans); color: var(--muted); }
tr.group th { padding: 12px 0 3px; border-bottom: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
tr.context th, tr.context td:not(.positive):not(.negative):not(.warn) { color: var(--muted); }
.constraints { padding-left: 18px; margin: 8px 0; }
.windows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; font-size: var(--fs-sm); }
.windows p { margin-top: 2px; padding-left: 16px; color: var(--muted); }
.before-key, .after-key, .applying-key, .loop-key, .mean-key, .pin-key { color: var(--text); }
.mean-key::before { content: ""; display: inline-block; width: 14px; margin-right: 6px; vertical-align: 3px; }
.mean-key::before { border-top: 2px dotted var(--text); }
.before-key::before, .after-key::before, .applying-key::before, .loop-key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.before-key::before { background: repeating-linear-gradient(135deg, var(--muted) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.after-key::before { background: color-mix(in srgb, var(--text) 22%, transparent); }
.applying-key::before { background: color-mix(in srgb, var(--applying) 45%, transparent); }
.loop-key::before { background: color-mix(in srgb, var(--text) 10%, transparent); box-shadow: inset 2px 0 color-mix(in srgb, var(--text) 45%, transparent); }
.pin-key::before { content: ""; display: inline-block; height: 10px; margin-right: 6px; border-left: 1px dashed var(--muted); vertical-align: -1px; }

/* Telemetry */
.telemetry > .panel-head > div { min-width: 0; }
#telemetry-window { font-size: var(--fs-xs); }
#telemetry-window, #inspection { overflow-wrap: anywhere; }
.telemetry-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.telemetry-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 6px 14px; border-bottom: 1px solid var(--rule); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: var(--fs-xs); }
.legend > span:last-child { color: var(--muted); }
.inspection { font-size: var(--fs-xs); }
output { font-variant-numeric: tabular-nums; color: var(--text); }
.chart-panel { padding: 8px 14px 2px; border-bottom: 1px solid var(--rule); }
.chart-panel:last-child { border-bottom: 0; }
.chart-panel > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.chart-panel > header > h3 { min-width: 112px; }
.chart-readout { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-family: var(--sans); font-size: var(--fs-xs); }
.chart { margin-top: 2px; }
.chart svg { display: block; width: 100%; font-family: var(--mono); font-size: 11px; fill: var(--text); }
.axis { fill: var(--muted); }
.grid { stroke: var(--rule); stroke-width: 1; }
.trace { fill: none; stroke: var(--series); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.area { pointer-events: none; }
linearGradient stop { stop-color: var(--series); stop-opacity: .12; }
linearGradient stop + stop { stop-opacity: 0; }
.probe { fill: var(--bg); stroke: var(--series); stroke-width: 2; pointer-events: none; }
/* Chart series use the site's chart palette, so lime, amber and red keep their result meanings. */
.series-0 { --series: oklch(68% .14 240); }
.series-1 { --series: oklch(78% .16 150); }
.series-2 { --series: oklch(88% .01 260); }
.series-key { display: grid; min-width: 0; color: var(--muted); white-space: nowrap; }
/* The name carries its line's colour and an underline, so it reads as the legend. */
.series-name { color: var(--series); font-weight: 600; text-decoration: underline 2px var(--series); text-underline-offset: 4px; }
.series-key small { display: inline; margin-left: 2px; color: var(--faint); font: var(--fs-xs) var(--mono); }
.series-key > output { overflow: hidden; text-overflow: ellipsis; color: var(--text); font: var(--fs-sm) var(--mono); }
/* Measurement windows stay neutral so the series and result colours keep their meanings. */
.loop-band { fill: var(--text); fill-opacity: .04; stroke: var(--text); stroke-opacity: .16; }
.loop-band.is-selected { fill-opacity: .08; }
.loop-label { fill: var(--muted); font: 500 var(--fs-xs) var(--sans); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.window-0 { fill: url(#before-hatch); fill-opacity: .22; }
.window-1 { fill: var(--text); fill-opacity: .07; }
.window-applying { fill: var(--applying); fill-opacity: .14; }
.decision-marker { stroke: var(--applying); stroke-width: 1.25; stroke-dasharray: 4 3; }
.pin-accepted { --pin: var(--positive); }
.pin-rejected { --pin: var(--negative); }
.pin-rollback { --pin: var(--applying); }
.pin-memory { --pin: var(--memory); }
.pin-line { stroke: var(--pin); stroke-opacity: .35; stroke-width: 1; stroke-dasharray: 2 3; }
.pin-line.is-selected { stroke-opacity: 1; stroke-width: 1.5; stroke-dasharray: none; }
.pins { position: relative; height: 26px; margin-top: 6px; }
.pins.is-stacked { height: 56px; }
/* A 32px hit area around a 10px dot; the label hangs off to the right. */
.pin { position: absolute; top: calc(var(--lane) * 30px - 3px); left: var(--x); display: flex; align-items: center; gap: 6px; height: 32px; min-width: 32px; margin-left: -16px; padding: 0 0 0 11px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); }
.pin-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pin); }
.pin-label { font: var(--fs-xs) var(--mono); white-space: nowrap; }
.pin:hover, .pin[aria-pressed="true"] { color: var(--text); }
.pin[aria-pressed="true"] { z-index: 1; }
.pin[aria-pressed="true"] .pin-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
/* Window means: thin and dotted under the traces they summarize. */
.mean { stroke: var(--series); stroke-width: 1.5; stroke-dasharray: 1 3; stroke-linecap: round; }
.series-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.delta { font: var(--fs-xs) var(--mono); }
.crosshair { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; pointer-events: none; }

/* Config view: two stacks of cards. */
.policy-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.policy-col { display: grid; gap: 12px; min-width: 0; }
.config-card { padding: 14px 16px; }
.config-card h3 { margin-bottom: 4px; font: 600 15px var(--display); }
.policy-note { grid-column: 1 / -1; }
.ranges { display: grid; gap: 14px; margin: 10px 0 8px; }
.range > p:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: var(--fs-sm) var(--mono); }
.range > p:first-child small { display: inline; }
/* Read-only: the span this run moved through, on the policy's allowed range; the tick is where it settled. */
.range-track { position: relative; height: 4px; margin: 10px 0 4px; background: var(--rule); }
.range-span { position: absolute; top: 0; bottom: 0; left: var(--from); width: calc(var(--to) - var(--from)); background: var(--muted); }
.range-mark { position: absolute; top: -4px; bottom: -4px; left: var(--at); width: 2px; margin-left: -1px; background: var(--text); }
.range-ends { display: flex; justify-content: space-between; color: var(--faint); font: var(--fs-xs) var(--mono); }
.config-card > p { margin-top: 10px; color: var(--muted); font-size: var(--fs-sm); }
.policy-rules { margin: 0; }
.policy-rules > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); padding: 7px 0; font-size: var(--fs-sm); }
.policy-rules > div:last-child { border-bottom: 0; }
.policy-rules dt { color: var(--muted); }
.policy-rules dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.empty, .error { padding: 18px; color: var(--muted); }
.strip > .empty { flex: 1; background: var(--surface); }
.loop-group > .empty { padding: 12px 14px; font-size: var(--fs-sm); }
.error { border: 1px solid var(--negative); color: var(--text); }
.skip { position: fixed; top: -100px; left: 8px; padding: 8px; background: var(--surface); z-index: 10; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (min-width: 1200px) {
  /* Dense flow lifts the timeline beside the scoreboard. */
  #optimization { grid-template-columns: 330px minmax(0, 1fr); grid-auto-flow: dense; align-items: start; }
  #running-status { grid-column: 1 / -1; }
  #loop-results { grid-column: 2; }
  .workspace { grid-column: 2; grid-template-columns: minmax(0, 1fr); }
  .timeline { grid-column: 1; grid-row: span 2; position: sticky; top: 60px; }
  .strip { max-height: calc(100vh - 150px); }
}
#charts:focus-visible { outline-offset: 4px; border-radius: 4px; }
@media (max-width: 960px) {
  .workspace, .policy-panel { grid-template-columns: minmax(0, 1fr); }
  .app-header { gap: 18px; flex-wrap: wrap; padding: 6px 14px 0; }
  main { padding: 14px; }
}
@media (max-width: 720px) {
  .loop-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  [id] { scroll-margin-top: 160px; }
  .app-header { flex-wrap: nowrap; padding-top: 0; }
  .product-nav button:disabled { display: none; }
  .loop-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .loop-tabs small { display: none; }
  main { padding: 12px; }
  .kpi { padding: 10px 12px; }
  .impact-number { font-size: 22px; }
  .windows { grid-template-columns: 1fr; gap: 6px; }
  .chart-readout { flex-basis: 100%; }
  .series-key small { display: block; margin: 0; }
  /* The timeline above already lists every decision; the pin lines stay on the plots. */
  .pins, .loop-key, .legend > span:last-child { display: none; }
  .policy-rules > div { flex-wrap: wrap; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
