* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; background: var(--ground); color: var(--ink); font: var(--text-md)/var(--lh-md) var(--font-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, textarea, input { max-width: 100%; }
button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface); cursor: pointer; font-size: var(--text-sm); line-height: var(--lh-sm); transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
button:hover { background: var(--sunk); }
button:disabled { color: var(--ink-2); background: var(--sunk); cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--live); outline-offset: 4px; }
a { color: var(--live-ink); text-underline-offset: 3px; }
strong, b { font-weight: var(--weight-medium); }
h1, h2, h3, h4, p { margin: 0 0 16px; }
h1 { max-width: 20ch; margin-bottom: 16px; font: 400 clamp(36px, 3.7vw, 50px)/1.08 var(--font-editorial); letter-spacing: -.025em; text-wrap: balance; }
h2 { margin-top: 32px; font: 400 var(--text-lg)/var(--lh-lg) var(--font-text); letter-spacing: -.02em; }
h3 { font-size: var(--text-md); line-height: var(--lh-md); font-weight: 500; }
h4 { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: 500; }
p { max-width: 68ch; }
ul, ol { padding-left: 24px; }
li { margin-block: 8px; }
code, pre, .quantity, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-size: .88em; overflow-wrap: anywhere; }
pre { max-width: 100%; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--ground); font-size: var(--text-xs); line-height: var(--lh-sm); tab-size: 2; }
[hidden] { display: none !important; }
.skip { position: fixed; left: 16px; top: -72px; z-index: 5; padding: 12px 16px; background: var(--surface); }
.skip:focus { top: 12px; }

header { position: sticky; top: 0; z-index: 3; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 max(24px, calc((100vw - 1352px) / 2)); border-bottom: 1px solid var(--line-strong); background: var(--ground); }
.brand { color: var(--ink); text-decoration: none; font: 400 32px/36px var(--font-editorial); white-space: nowrap; }
.brand span { display: inline-block; margin-left: 10px; vertical-align: middle; color: var(--ink-2); font: var(--text-xs)/var(--lh-xs) var(--font-mono); }
header button { flex: none; background: transparent; }
.studio-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); max-width: 1400px; margin-inline: auto; }
.studio-shell > aside { position: sticky; top: 72px; height: calc(100dvh - 72px); overflow: auto; display: flex; flex-direction: column; padding: 32px 20px 24px; border-right: 1px solid var(--line-strong); }
.rail-title { font: 400 var(--text-lg)/var(--lh-lg) var(--font-editorial); margin-bottom: 28px; }
.eyebrow { color: var(--ink-2); font: var(--text-xs)/var(--lh-xs) var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; margin-bottom: 12px; }
nav { display: grid; gap: 4px; }
nav button { display: flex; align-items: baseline; gap: 12px; padding: 12px 10px; text-align: left; background: transparent; border-color: transparent; }
nav button span { color: var(--ink-2); font: var(--text-xs)/var(--lh-sm) var(--font-mono); }
nav button[aria-current], nav button[aria-pressed="true"] { background: var(--live-soft); color: var(--live-ink); }
.rail-bottom { margin-top: auto; padding-top: 32px; color: var(--ink-2); font-size: var(--text-xs); line-height: var(--lh-sm); }
.rail-bottom p { margin-bottom: 12px; }
.rail-bottom a { display: block; padding-block: 10px; }
main { min-width: 0; padding: 36px 40px 56px; }
main:focus { outline: none; }
main > :first-child { margin-top: 0; }
.lede { max-width: 65ch; margin-bottom: 24px; color: var(--ink-2); font-size: var(--text-md); line-height: var(--lh-md); }
.note { color: var(--ink-2); font-size: var(--text-sm); line-height: var(--lh-sm); }
.strip { display: flex; flex-wrap: wrap; gap: 16px 32px; padding-block: 16px; margin-block: 24px; border-block: 1px solid var(--line-strong); font-size: var(--text-sm); line-height: var(--lh-sm); }
.strip > * { min-width: 0; margin: 0; }
.strip > div { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 4px; }
.strip strong { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.strip > div > strong { font-size: var(--text-lg); line-height: var(--lh-lg); }
.callout { padding: 16px 20px; border-left: 3px solid var(--live); background: var(--live-soft); margin-block: 24px; font-size: var(--text-md); line-height: var(--lh-md); }
.callout > :last-child { margin-bottom: 0; }
.paper { min-width: 0; margin-block: 24px; padding: 24px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-3); }
.paper > h2:first-child, .paper > h3:first-child { margin-top: 0; }
.paper > :last-child { margin-bottom: 0; }
.two-up, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-block: 24px; }
.two-up > *, .form-grid > * { min-width: 0; }
.two-up > .paper { margin: 0; }
.field { display: grid; align-content: start; gap: 8px; min-width: 0; margin-block: 20px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.form-grid > .field { margin: 0; }
.field > span, .field > label { display: block; }
.field .note { margin: 0; }
textarea, select, input:not([type="checkbox"]):not([type="radio"]) { width: 100%; min-width: 0; border: 1px solid var(--ink-2); border-radius: var(--r-2); background: var(--surface); padding: 12px; font-size: var(--text-sm); line-height: var(--lh-sm); }
textarea { display: block; min-height: 112px; resize: vertical; }
select { min-height: 46px; padding-right: 32px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding-block: 10px; margin-block: 8px; font-size: var(--text-sm); line-height: var(--lh-sm); cursor: pointer; }
fieldset { min-width: 0; margin: 0; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-2); }
legend { padding-inline: 4px; font-size: var(--text-sm); line-height: var(--lh-sm); }
fieldset .check { margin-block: 0; }
.job-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; align-content: start; }
.job-options .check { gap: 8px; }
input[type="checkbox"], input[type="radio"] { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--live); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 24px; }
.primary { color: var(--surface); background: var(--ink); border-color: var(--ink); }
.primary:hover { color: var(--surface); background: var(--ink-2); border-color: var(--ink-2); }
.primary:disabled { color: var(--ink-2); background: var(--sunk); border-color: var(--line-strong); }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; max-width: 72ch; margin-block: 0 24px; padding: 14px 16px; border: 1px solid var(--line-strong); border-left: 4px solid var(--ink); border-radius: var(--r-2); background: var(--surface); font-size: var(--text-sm); line-height: var(--lh-sm); }
.notice p { flex: 1 1 28ch; margin: 0; }
.notice[role="alert"] { border: 2px solid var(--fail); }
.status { min-height: 20px; margin-block: 16px; font-size: var(--text-sm); line-height: var(--lh-sm); overflow-wrap: anywhere; }
.status:empty { min-height: 0; margin: 0; }
.status.error, #storage.error { color: var(--fail); border-left: 3px solid var(--fail); padding-left: 12px; }

.experiment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 24px; }
.experiment { position: relative; display: block; padding: 18px 20px; text-align: left; }
.experiment .eyebrow { display: block; margin-bottom: 8px; }
.experiment h3, .experiment .title, .experiment > strong { display: block; margin-bottom: 8px; font: 500 var(--text-md)/var(--lh-md) var(--font-text); }
.experiment .description { margin-bottom: 8px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.experiment > :last-child { margin-bottom: 0; }
.experiment[aria-pressed="true"] { border-color: var(--live); background: var(--live-soft); box-shadow: inset 3px 0 0 var(--live); }
.experiment[aria-pressed="true"] .eyebrow { color: var(--live-ink); }
.budget { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding-block: 16px; border-block: 1px solid var(--line-strong); margin-block: 24px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.budget strong { font: 400 var(--text-md)/var(--lh-md) var(--font-mono); font-variant-numeric: tabular-nums; }
.budget-track { display: flex; gap: 4px; flex: 1 1 180px; max-width: 320px; height: 12px; }
.budget-track > i { display: block; flex: 1; min-width: 0; height: 100%; background: var(--sunk); border: 1px solid var(--line-strong); border-radius: var(--r-1); }
.budget-track > i.spent { background: var(--ink); border-color: var(--ink); }

.graph-panel { min-width: 0; margin-block: 24px; border: 1px solid var(--line-strong); border-radius: var(--r-3); overflow: hidden; background: var(--surface); }
.graph-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.graph-heading h2, .graph-heading h3, .graph-heading p { margin: 0; }
.graph-heading h2, .graph-heading h3 { font: 500 var(--text-md)/var(--lh-md) var(--font-text); }
.graph-heading .eyebrow { color: var(--live-ink); }
.graph-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-gutter: stable; background: var(--ground); }
svg.graph { display: block; width: 100%; max-width: 100%; height: auto; margin-inline: auto; }
.graph .edge { fill: none; stroke: var(--ink-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.graph marker path { fill: var(--ink-2); }
.graph .node { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.graph .node.changed, .graph .node.changed rect, .graph rect.changed { fill: var(--live-soft); stroke: var(--live); stroke-width: 2; }
.graph .node.selected, .graph .node.selected rect, .graph rect.selected { stroke: var(--ink); stroke-width: 2.5; }
.graph .node.missed, .graph .node.missed rect, .graph rect.missed { fill: var(--fail-soft); stroke: var(--fail); stroke-width: 2; stroke-dasharray: 5 3; }
.graph .node-label { fill: var(--ink); stroke: none; font: 500 14px var(--font-mono); }
.graph .node-time { fill: var(--ink-2); font: 12px var(--font-mono); }
.graph .edge.affected { stroke: var(--ink); stroke-width: 2.5; }
.graph .node-state { fill: var(--ink-2); stroke: none; font: 12px var(--font-text); }
.graph .node.missed .node-state { fill: var(--fail); }
.graph-caption { padding: 16px 20px; border-top: 1px solid var(--line); font-size: var(--text-sm); line-height: var(--lh-sm); }
.graph-caption > :last-child { margin-bottom: 0; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: var(--text-xs); line-height: var(--lh-sm); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend span::before { content: ""; width: 14px; height: 14px; flex: none; border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface); }
.legend .changed::before { border-color: var(--live); background: var(--live-soft); }
.legend .selected::before { border: 2px solid var(--ink); }
.legend .missed::before { border: 2px dashed var(--fail); background: var(--fail-soft); }

.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin-block: 20px; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--lh-sm); }
th, td { border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; padding: 12px; }
th { color: var(--ink-2); font-weight: 500; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td { font-variant-numeric: tabular-nums; }
td .note, td p { margin: 0; }
.cell-label { display: none; }
.wide-table td:last-child .cell-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cost-chart { margin-block: 24px; padding-block: 8px; border-block: 1px solid var(--line-strong); }
.cost-row { display: grid; grid-template-columns: minmax(144px, 1fr) minmax(120px, 2fr) minmax(70px, auto); align-items: center; gap: 16px; padding-block: 16px; border-bottom: 1px solid var(--line); font-size: var(--text-sm); line-height: var(--lh-sm); }
.cost-row:last-child { border-bottom: 0; }
.cost-row > :first-child { margin: 0; }
.cost-bar { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 2px; height: 20px; min-width: 0; }
.cost-bar i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-1); }
.cost-bar i.blank { background: var(--sunk); }
.cost-row.invalid .cost-bar i:not(.blank) { background: var(--fail); }
.cost-row.invalid .quantity { color: var(--fail); }
.cost-row .quantity { text-align: right; font-size: var(--text-sm); line-height: var(--lh-sm); }
.receipt { min-width: 0; margin-block: 24px; padding: 24px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-3); }
.receipt h2:first-child, .receipt h3:first-child { margin-top: 0; }
.receipt .eyebrow { overflow-wrap: anywhere; }
.receipt > :last-child { margin-bottom: 0; }
.feedback { margin-block: 20px; padding: 16px 20px; border-left: 3px solid var(--live); background: var(--live-soft); font-size: var(--text-md); line-height: var(--lh-md); }
.feedback p:last-child { margin-bottom: 0; }
.history { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line-strong); }
details { margin-block: 16px; }
summary { min-height: 44px; padding-block: 12px; cursor: pointer; font-size: var(--text-sm); line-height: var(--lh-sm); }
.hint { padding-inline: 16px; border: 1px solid var(--line); border-radius: var(--r-2); }
.hint > :not(summary) { font-size: var(--text-sm); line-height: var(--lh-sm); }
footer { display: flex; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; padding: 20px max(24px, calc((100vw - 1352px) / 2)); border-top: 1px solid var(--line-strong); color: var(--ink-2); font-size: var(--text-xs); line-height: var(--lh-sm); }

@media (max-width: 1100px) {
  .studio-shell { grid-template-columns: 212px minmax(0, 1fr); }
  .studio-shell > aside { padding-inline: 16px; }
  main { padding: 32px 24px 48px; }
  .cost-row { grid-template-columns: minmax(120px, 1fr) minmax(100px, 1.5fr) minmax(60px, auto); gap: 12px; }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 76px; }
  header { height: 64px; padding-inline: 16px; }
  .brand span { display: none; }
  header button { padding-inline: 12px; }
  .studio-shell { display: block; }
  .studio-shell > aside { position: static; display: block; height: auto; overflow: visible; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .studio-shell > aside > .eyebrow, .rail-title { display: none; }
  nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-block: 4px; }
  nav button { flex: none; gap: 8px; white-space: nowrap; padding: 10px; }
  nav button:not([aria-current]):not([aria-pressed="true"]) { font-size: 0; gap: 0; }
  nav button span { font-size: var(--text-xs); }
  .rail-bottom { margin: 0; padding: 0; }
  .rail-bottom #progress, .rail-bottom a { display: none; }
  .rail-bottom #storage { margin: 4px 0; font-size: var(--text-xs); line-height: var(--lh-xs); }
  .rail-bottom #storage:empty { display: none; }
  main { padding: 24px 16px 40px; }
  h1 { font-size: 36px; max-width: 22ch; }
  h2 { margin-top: 28px; }
  .lede { margin-bottom: 20px; }
  .two-up, .form-grid, .experiment-grid { grid-template-columns: 1fr; gap: 12px; }
  .paper, .receipt { padding: 16px; }
  .experiment { padding: 16px; }
  .callout, .feedback { padding: 14px 16px; }
  .graph-heading, .graph-caption { padding: 12px 16px; }
  .cost-row { grid-template-columns: minmax(0, 1fr) 4ch; gap: 8px 12px; }
  .cost-row > :first-child { grid-column: 1 / -1; }
  .cost-bar { height: 18px; }
  .actions { align-items: stretch; }
  .actions > button { flex: 1 1 180px; }
  th, td { padding: 10px 8px; }
  .wide-table, .wide-table tbody { display: block; width: 100%; }
  .wide-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .wide-table tbody tr { display: block; padding-block: 12px; border-bottom: 1px solid var(--line-strong); }
  .wide-table tbody tr:first-child { border-top: 1px solid var(--line-strong); }
  .wide-table td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 6px 0; border: 0; }
  .wide-table .cell-label { display: block; color: var(--ink-2); }
  .wide-table .cell-value { min-width: 0; overflow-wrap: anywhere; }
  footer { padding: 16px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* I14: the frozen work target on the policy bar. */
.cost-bar { position: relative; }
.cost-bar .target { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1px; background: var(--live-ink); border-radius: 1px; }
.cost-bar { display: block; background: var(--sunk); border-bottom: 1px solid var(--ink-2); margin-top: 18px; }
.cost-bar > i { border-radius: 0; }
.cost-target-label { position: absolute; bottom: calc(100% + 3px); left: 0; transform: translateX(-50%); font: 12px/16px var(--font-mono); color: var(--live-ink); white-space: nowrap; font-weight: 400; }
.cost-verdict { display: block; margin-top: 5px; font: 12px/18px var(--font-text); }
.cost-row.invalid .cost-verdict { color: var(--fail); }
/* M32: generated-input edges and the dependency the planner's graph lacks. */
.graph .edge.generated { stroke-dasharray: 6 4; }
.graph .edge.ghost { stroke: var(--fail); stroke-dasharray: 2 4; stroke-width: 2; }
.graph .edge-label { font: 12px var(--font-mono); fill: var(--ink-2); }
.graph .edge-label-leader { stroke: var(--ink-2); stroke-width: 1; }
@media(max-width:600px) { .graph .node-label { font-size: 12px; } }
