/* Page layer over the design-system release 2.0.4 tokens and kit (linked above). No raw hex values here. */
/* Every section sits on the kit column: .wrap uses the kit's width and gutter tokens, like .kit-wrap. */
*, *::before, *::after {box-sizing: border-box;}
html {-webkit-text-size-adjust: 100%;}
body {margin: 0;}
.wrap {width: 100%; max-width: var(--kit-max); margin-inline: auto; padding-inline: var(--kit-gutter);}
.visually-hidden {position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;}
.controls {display: grid; grid-template-columns: auto auto 1fr; gap: 14px 28px; align-items: end; padding-block: 28px 8px;}
.controls-title {grid-column: 1 / -1; font-size: clamp(24px, 3vw, var(--viz-type-section)); margin: 0; line-height: 1.2;}
.controls-lead {grid-column: 1 / -1; margin: 0; max-width: 64ch;}
.control {margin: 0; padding: 0; border: 0; min-width: 0;}
.control > label, .control > legend {display: block; font-size: var(--viz-type-small); color: var(--viz-muted); margin-bottom: 6px; padding: 0;}
.legend-tail {white-space: nowrap;}
select {width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--viz-border); border-radius: 8px; background: var(--viz-surface); color: var(--viz-foreground);}
.segments {display: flex; flex-wrap: wrap; border: 1px solid var(--viz-border); border-radius: 8px; overflow: hidden; background: var(--viz-surface); width: max-content; max-width: 100%;}
.seg {position: relative; display: block;}
.seg input {position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer;}
.seg span {display: block; padding: 10px 14px; min-height: 44px; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; border-right: 1px solid var(--viz-grid);}
.seg:last-child span {border-right: 0;}
.seg input:checked + span {background: var(--viz-foreground); color: var(--viz-background);}
.seg input:focus-visible + span {outline: 3px solid var(--viz-focus); outline-offset: -3px;}
.seg:hover span {text-decoration: underline; text-underline-offset: .2em;}
.controls-note, .status {grid-column: 1 / -1; margin: 0; font-size: var(--viz-type-small); color: var(--viz-muted);}
.status:empty, .controls-note:empty {display: none;}
.status.error {color: var(--viz-foreground); border-inline-start: 4px solid var(--viz-accent); padding-left: 10px;}
.chart-section {padding-block: 36px 8px;}
.chart-section h2 {font-size: clamp(24px, 3vw, var(--viz-type-section)); margin: 0 0 8px; line-height: 1.2;}
.takeaway {font-size: clamp(18px, 2vw, 20px); max-width: 64ch; margin: 0 0 14px;}
.explain {max-width: 64ch; color: var(--viz-muted); margin: 0 0 12px; font-size: var(--viz-type-small);}
.chart {margin: 0; width: 100%; min-height: 340px;}
/* These figures predate the kit's figure.chart card: keep their original open layout. */
figure.chart {display: block; padding: 0; background: none; border: 0; border-radius: 0;}
.chart-short {min-height: 260px;}
.chart-gap {min-height: 170px;}
.gap-intro {margin-top: 18px;}
.chart-cal {min-height: 220px;}
.chart svg {display: block; width: 100%; height: auto; overflow: visible;}
.chart text {font-family: var(--viz-font-body); font-size: 13px; fill: var(--viz-muted);}
.chart .label-strong {fill: var(--viz-foreground); font-size: 14px;}
.chart .label-plan {fill: var(--viz-accent); font-size: 14px; font-weight: 600;}
.chart .halo {stroke: var(--viz-background); stroke-width: 4px; paint-order: stroke; stroke-linejoin: round;}
.legend {display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--viz-type-small); color: var(--viz-muted); margin-bottom: 6px;}
.key {display: inline-flex; align-items: center; gap: 6px;}
.key i {display: inline-block; width: 22px; height: 10px;}
.key-plan i {height: 0; border-top: 3px solid var(--viz-accent);}
.key-mean i {height: 0; border-top: 2px dashed var(--viz-foreground);}
.key-band50 i {background: var(--viz-sequential-3);}
.key-band90 i {background: var(--viz-sequential-1); border: 1px solid var(--viz-sequential-2);}
.key-actual i {width: 10px; border-radius: 50%; background: var(--viz-foreground);}
.key-miss i {width: 10px; border-radius: 50%; border: 2px solid var(--viz-foreground); background: transparent;}
.key-cal i {width: 10px; border-radius: 50%; background: var(--viz-foreground);}
.key-cal-below i {width: 10px; border-radius: 50%; border: 2px solid var(--viz-loss); background: transparent;}
.key-target i {height: 0; border-top: 2px dashed var(--viz-accent);}
.note {font-size: var(--viz-type-small); color: var(--viz-muted); max-width: 70ch; margin: 8px 0;}
.table-toggle summary {cursor: pointer; color: var(--viz-link); padding-block: 10px; font-size: var(--viz-type-small);}
.table-scroll {overflow-x: auto; max-width: 100%;}
table {border-collapse: collapse; font-size: var(--viz-type-small); font-variant-numeric: tabular-nums; min-width: 560px;}
caption {text-align: left; color: var(--viz-muted); padding-bottom: 6px;}
th, td {padding: 5px 10px; border-bottom: 1px solid var(--viz-grid); text-align: right;}
th[scope="row"], thead th:first-child {text-align: left; font-weight: 400; white-space: nowrap;}
thead th {color: var(--viz-muted); font-weight: 400; vertical-align: bottom;}
.method {padding-bottom: 8px;}
.method ul {padding-left: 1.1em; max-width: 72ch; margin: 8px 0 16px;}
.method li {margin-bottom: 10px; font-size: 16px;}
.method strong {font-family: var(--viz-font-heading); font-weight: 600;}
.downloads {font-size: var(--viz-type-small);}
footer.site .footer-notes p {display: block; max-width: 90ch; margin: 0 0 12px; line-height: 1.5;}
footer.site .footer-notes a {display: inline; min-height: 0;}
td.num {font-family: var(--viz-font-figures); font-variant-numeric: tabular-nums lining-nums;}
@media (max-width: 759px) {
  .controls {grid-template-columns: 1fr;}
  .segments {width: 100%;}
  .seg {flex: 1 1 0;}
  .seg span {padding-inline: 4px;}
  .chart {min-height: 300px;}
  .chart-short {min-height: 230px;}
  .chart-cal {min-height: 200px;}
  .chart-gap {min-height: 170px;}
}
@media print {
  body {background: white;}
  .controls {display: none;}
  details {display: block;}
}
/* Chart marks: colors through CSS so theme switches need no redraw. */
.weekend {fill: var(--viz-grid); opacity: .45;}
.gridline {stroke: var(--viz-grid); stroke-width: 1;}
.axis-zero {stroke: var(--viz-foreground); stroke-width: 1.2;}
.band90 {fill: var(--viz-sequential-1); stroke: var(--viz-sequential-2); stroke-width: 1;}
.band50 {fill: var(--viz-sequential-3); opacity: .85;}
.mean-line {fill: none; stroke: var(--viz-foreground); stroke-width: 1.6; stroke-dasharray: 5 4;}
.plan-line {fill: none; stroke: var(--viz-accent); stroke-width: 3.2; stroke-linejoin: round;}
.actual-in {fill: var(--viz-foreground);}
.actual-out {fill: var(--viz-background); stroke: var(--viz-foreground); stroke-width: 2;}
.leader {stroke: var(--viz-foreground); stroke-width: 1;}
.curve-line {fill: none; stroke: var(--viz-sequential-4); stroke-width: 2;}
.curve-dot {fill: var(--viz-sequential-4);}
.curve-plan {fill: var(--viz-accent); stroke: var(--viz-background); stroke-width: 2;}
.curve-point {fill: var(--viz-background); stroke: var(--viz-foreground); stroke-width: 2;}
/* Cost above the cheapest choice: the same units and marks as the curve. */
.gap-bar {fill: var(--viz-sequential-4);}
.gap-plan {fill: var(--viz-accent);}
.gap-point {fill: var(--viz-background); stroke: var(--viz-foreground); stroke-width: 2;}
/* Signed monthly differences: gain (teal) when the percentile plan saved, loss (coral) when it cost more. */
.bar-pos {fill: var(--viz-gain);}
.bar-neg {fill: var(--viz-loss);}
.chart text.value {font-family: var(--viz-font-figures);}
.chart text.value.text-gain {fill: var(--viz-gain);}
.chart text.value.text-loss {fill: var(--viz-loss);}
.year-rule {stroke: var(--viz-border); stroke-width: 1; stroke-dasharray: 2 3;}
/* Replay regimes and per-month calibration. */
.regime-rule {stroke: var(--viz-foreground); stroke-width: 1; stroke-dasharray: 4 3;}
.target-line {stroke: var(--viz-accent); stroke-width: 2; stroke-dasharray: 6 4;}
.chart .label-target {fill: var(--viz-accent); font-weight: 600;}
.cal-dot {fill: var(--viz-foreground);}
.cal-below {fill: var(--viz-background); stroke: var(--viz-loss); stroke-width: 2.4;}
/* Hero width for a two-clause headline, period shading, the re-plan check, the model comparison and the one-month explorer. */
section.hero h1 {max-width: 34ch; font-size: clamp(1.9rem, 3.6vw, 2.9rem);}
/* The page's data tables keep a 560 px minimum inside their scroll regions; the hero KPI table must not. */
table.kpis {min-width: 0;}
section.hero > * {min-width: 0;}
section.hero .hero-dek {max-width: 52rem;}
.month-control {max-width: 320px; margin: 8px 0 18px;}
.chart-section h3 {font-size: clamp(19px, 2.2vw, 22px); margin: 26px 0 8px; line-height: 1.25;}
.chart-section h3.month-title {margin-top: 6px;}
.shade {fill: var(--viz-grid); opacity: .5;}
.chart .label-year {fill: var(--viz-muted); font-size: 12px;}
.bar-fired {fill: var(--viz-accent);}
.bar-quiet {fill: var(--viz-bar);}
.bar-best {fill: var(--viz-accent);}
.bar-model {fill: var(--viz-bar);}
.chart-models {min-height: 420px;}
.key-gain i {background: var(--viz-gain);}
.key-loss i {background: var(--viz-loss);}
.key-shade i {background: var(--viz-grid);}
.key-fired i, .key-best i {background: var(--viz-accent);}
.key-quiet i, .key-other i {background: var(--viz-bar);}
.period-table {margin: 10px 0 16px;}
.period-table td:nth-child(6), .period-table th:nth-child(6) {white-space: nowrap;}
/* Inside a horizontally scrolling table region, keep headers whole and the caption readable without scrolling. */
.table-scroll thead th {white-space: nowrap; overflow-wrap: normal;}
@media (max-width: 759px) {
  .table-scroll caption {max-width: calc(100vw - 2 * var(--kit-gutter)); position: sticky; left: 0;}
}
/* Prose sections (plain words, money, experience, causes, tools, rollout, AI) on the kit column, a readable measure. */
.block {padding-block: 36px 8px;}
.block h2 {font-size: clamp(24px, 3vw, var(--viz-type-section)); margin: 0 0 10px; line-height: 1.2;}
.block p, .block ul.notes {max-width: 70ch;}
/* The closing reader prompt: plain text that wraps on a phone, readable with JavaScript off. */
.block.use {padding-block: 36px 32px;}
pre.prompt {white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; margin: 1rem 0 0; padding: 1rem; font-family: var(--viz-font-figures); font-size: .875rem; line-height: 1.55; background: var(--viz-panel); color: var(--viz-foreground); border: 1px solid var(--viz-rule); border-radius: 6px;}
ul.notes {padding-left: 1.2rem;}
ul.notes li {margin: 0 0 12px;}
dl.glossary {display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; max-width: 72ch; margin: 16px 0 0;}
dl.glossary dt {font-weight: 600;}
dl.glossary dd {margin: 0;}
table.money th, table.money td {text-align: left;}
table.uses th, table.uses td {vertical-align: top; text-align: left;}
table.uses th[scope="row"] {white-space: normal; max-width: 24ch; font-weight: 600;}
table.uses td {max-width: 38ch;}
@media (max-width: 759px) {
  dl.glossary {grid-template-columns: 1fr; gap: 2px;}
  dl.glossary dd {margin-bottom: 8px;}
  /* The tools table reads as stacked cards on a phone instead of scrolling sideways. */
  table.uses, table.uses tbody, table.uses tr, table.uses th, table.uses td, table.uses caption {display: block; min-width: 0; max-width: none;}
  table.uses th[scope="row"] {max-width: none;}
  table.uses thead {display: none;}
  table.uses tr {padding: 10px 0; border-bottom: 1px solid var(--viz-grid);}
  table.uses th, table.uses td {border: 0; padding: 2px 0;}
  table.uses td::before {content: attr(data-label); display: block; color: var(--viz-muted);}
  /* The money table too: one card per cost multiple, label on the left, value on the right. */
  table.money, table.money tbody, table.money tr, table.money caption {display: block; min-width: 0;}
  table.money thead {display: none;}
  table.money tr {padding: 8px 0; border-bottom: 1px solid var(--viz-grid);}
  table.money th, table.money td {display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 2px 0; text-align: right;}
  table.money th::before, table.money td::before {content: attr(data-label); color: var(--viz-muted); text-align: left; font-weight: 400;}
}
