/* KilowattWatch. Day and night electricity: cool near-white page, charcoal header, high-voltage yellow.
   Night indigo is used only for the lowest-price hours in the 24-hour band, so the band reads night to day.
   Serif headings, sans body, mono only for figures. Dark mode is night charcoal with the same yellow.
   Every dark value lives in BOTH blocks below; components use variables only. */

:root {
  --bg: #f4f5f2;
  --bg-tint: #e9ebe6;
  --panel: #ffffff;
  --ink: #17181c;
  --muted: #555962;
  --line: #d5d8d1;
  --line-strong: #17181c;
  --field: #7b7f87;
  --brand: #17181c;
  --brand-2: #2c2e36;
  --on-brand: #f4f5f2;
  --on-brand-muted: #b9bcc4;
  --accent: #f2c200;
  --accent-ink: #17181c;
  --link: #17181c;
  --warn: #a3320b;
  --own: #17181c;
  --lvl-0: #1a1d4e;
  --lvl-1: #f7e9a8;
  --lvl-2: #f2c200;
  --lvl-3: #e8590c;
  --lvl-none: #ffffff;
  --grid: #e2e4de;
  --stats-bg: #eceee8;
  --seg-track: #dfe2db;
  --seg-on-bg: #ffffff;
  --seg-on-ink: #17181c;
  --seg-off-ink: #3f434b;
  --sel-bg: #fbefbf;
  --check: #17181c;
  --s0: #17181c;
  --s1: #c2570c;
  --s2: #8a6d00;
  --s3: #2d5f9a;
  --s4: #a1305a;
  --s5: #6b6f7a;
  --serif: "Iowan Old Style", Charter, Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a;
    --bg-tint: #1b1c21;
    --panel: #212329;
    --ink: #f1f1ec;
    --muted: #a9acb5;
    --line: #383b44;
    --line-strong: #f1f1ec;
    --field: #7d818c;
    --brand: #0c0d10;
    --brand-2: #2c2e36;
    --on-brand: #f1f1ec;
    --on-brand-muted: #a9acb5;
    --accent: #f2c200;
    --accent-ink: #15161a;
    --link: #f5d24a;
    --warn: #ffb38a;
    --own: #f5d24a;
    --lvl-0: #4a52b8;
    --lvl-1: #e3d38f;
    --lvl-2: #f2c200;
    --lvl-3: #ff7a2e;
    --lvl-none: #15161a;
    --grid: #30333b;
    --stats-bg: #2a2c33;
    --seg-track: #121317;
    --seg-on-bg: #34363e;
    --seg-on-ink: #f1f1ec;
    --seg-off-ink: #c3c6ce;
    --sel-bg: #3d3618;
    --check: #f2c200;
    --s0: #f1f1ec;
    --s1: #ff9a4d;
    --s2: #f2c200;
    --s3: #7cb4f0;
    --s4: #f08db8;
    --s5: #a9acb5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15161a;
  --bg-tint: #1b1c21;
  --panel: #212329;
  --ink: #f1f1ec;
  --muted: #a9acb5;
  --line: #383b44;
  --line-strong: #f1f1ec;
  --field: #7d818c;
  --brand: #0c0d10;
  --brand-2: #2c2e36;
  --on-brand: #f1f1ec;
  --on-brand-muted: #a9acb5;
  --accent: #f2c200;
  --accent-ink: #15161a;
  --link: #f5d24a;
  --warn: #ffb38a;
  --own: #f5d24a;
  --lvl-0: #4a52b8;
  --lvl-1: #e3d38f;
  --lvl-2: #f2c200;
  --lvl-3: #ff7a2e;
  --lvl-none: #15161a;
  --grid: #30333b;
  --stats-bg: #2a2c33;
  --seg-track: #121317;
  --seg-on-bg: #34363e;
  --seg-on-ink: #f1f1ec;
  --seg-off-ink: #c3c6ce;
  --sel-bg: #3d3618;
  --check: #f2c200;
  --s0: #f1f1ec;
  --s1: #ff9a4d;
  --s2: #f2c200;
  --s3: #7cb4f0;
  --s4: #f08db8;
  --s5: #a9acb5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--sans);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; box-shadow: 0 0 0 2px var(--ink); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 12px 16px; z-index: 20; font-weight: 600; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; float: none !important; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); max-width: 26ch; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 16px; }

/* ---- Header band ---- */
.site-header { background: var(--brand); color: var(--on-brand); border-bottom: 4px solid var(--accent); }
.header-row { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-brand); text-decoration: none; min-height: 44px; }
.logo { color: var(--on-brand); flex: none; }
.logo-arc { stroke: var(--accent); }
.logo-bolt { fill: var(--accent); }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.015em; }
.wordmark em, .footer-brand em { font-style: italic; font-weight: 400; color: var(--accent); }
.site-header nav { margin-left: auto; }
.nav { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--on-brand); text-decoration: none; font-weight: 500; border-radius: var(--r); }
.nav a:hover { background: var(--brand-2); text-decoration: underline; }
.theme-toggle { min-height: 44px; padding: 0 14px; background: transparent; color: var(--on-brand); border: 1px solid var(--on-brand-muted); border-radius: var(--r); font: inherit; font-size: 0.94rem; cursor: pointer; }
.theme-toggle:hover { background: var(--brand-2); }
@media (max-width: 699px) {
  .site-header nav { order: 3; width: 100%; margin: 0 -9px; }
  .theme-toggle { margin-left: auto; }
  .nav { gap: 0; flex-wrap: wrap; }
  .nav a { padding: 0 9px; font-size: 0.94rem; white-space: nowrap; }
}

/* ---- Hero ---- */
.hero { padding: 28px 0 24px; }
.lede { font-size: 1.1rem; max-width: 72ch; margin: 12px 0 0; color: var(--muted); }
.noscript { margin-top: 16px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--panel); }

/* ---- Tool: result and inputs ---- */
.tool { display: grid; gap: 24px; align-items: start; padding-bottom: 48px; }
@media (min-width: 1000px) { .tool { grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; } }

.result { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line-strong); border-radius: 0 0 var(--r) var(--r); padding: 20px 16px 16px; min-width: 0; }
@media (min-width: 700px) { .result { padding: 24px 24px 20px; } }
.result-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin-bottom: 16px; }
.result-head h2 { flex: 1 1 100%; font-size: 1.35rem; }
.plan-pick { flex: 1 1 240px; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; min-width: 0; border: 0; padding: 0; }
label, legend { font-weight: 600; font-size: 0.97rem; padding: 0; }
input[type="number"], input[type="text"], select {
  width: 100%; min-height: 46px; padding: 8px 12px; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--field); border-radius: var(--r);
}
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
select { padding-right: 28px; }
input:hover, select:hover { border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--warn); border-width: 2px; }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0; }
.error { font-size: 0.92rem; color: var(--warn); font-weight: 600; margin: 0; }
.error:empty, .hint:empty { display: none; }
.note { font-size: 0.92rem; color: var(--muted); }
.muted { color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
.affix { display: flex; align-items: stretch; }
.affix .cur { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--field); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--bg-tint); font-family: var(--mono); color: var(--muted); }
.affix input { border-radius: 0 var(--r) var(--r) 0; min-width: 0; }

/* segmented radio control: a recessed track with the chosen option raised and underlined in yellow */
.seg { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-direction: row; flex-wrap: wrap; gap: 0; min-width: 0; }
.seg legend { margin-bottom: 6px; float: left; width: 100%; }
.seg label { position: relative; flex: 1 1 0; min-width: 0; font-weight: 500; background: var(--seg-track); padding: 3px 0; }
.seg label span { height: 100%; }
.seg label:first-of-type { border-radius: var(--r) 0 0 var(--r); padding-left: 3px; }
.seg label:last-of-type { border-radius: 0 var(--r) var(--r) 0; padding-right: 3px; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px 12px; border: 1px solid transparent; border-radius: 3px; color: var(--seg-off-ink); text-align: center; font-size: 0.95rem; transition: background-color 150ms, color 150ms, box-shadow 150ms; }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--seg-on-bg); color: var(--seg-on-ink); border-color: var(--line); box-shadow: inset 0 -3px 0 var(--accent); font-weight: 650; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 0 2px var(--ink); position: relative; z-index: 1; }
#season-toggle { flex: 0 1 auto; margin: 0; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; margin: 0 0 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--check); flex: none; }

/* ---- 24-hour band ---- */
.band-figure { margin: 0; }
.band-wrap { min-height: 250px; }
@media (min-width: 560px) { .band-wrap { min-height: 340px; } }
.band-svg { display: block; max-width: 100%; height: auto; }
.band-svg rect { transition: y 200ms, height 200ms; }
.lvl-0 { fill: var(--lvl-0); }
.lvl-1 { fill: var(--lvl-1); }
.lvl-2 { fill: var(--lvl-2); }
.lvl-3 { fill: var(--lvl-3); }
.lvl-none { fill: var(--lvl-none); }
.grid { stroke: var(--grid); stroke-width: 1; }
.base { stroke: var(--line-strong); stroke-width: 2; }
.tick { stroke: var(--line-strong); stroke-width: 1; }
.axis { fill: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.axis-title { fill: var(--muted); font: 600 12px var(--sans); }
.bar-label { fill: var(--ink); font: 600 13px var(--mono); stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.win-best { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.win-halo { fill: none; stroke: var(--panel); stroke-width: 7; }
.win-best-frame { fill: none; stroke: var(--ink); stroke-width: 3; }
.win-usual-frame { fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 7 5; }
.win-edge { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.win-label { fill: var(--ink); font: 600 12px var(--sans); }
.win-usual { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 5 3; }
.band-key { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 6px; font-size: 0.97rem; }
.band-key li { display: flex; gap: 10px; align-items: baseline; }
.band-key strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.key { flex: none; width: 28px; height: 12px; display: inline-block; position: relative; top: 1px; }
.key-best { border: 3px solid var(--ink); }
.key-usual { border: 3px dashed var(--ink); }

/* ---- Headline figures ---- */
.stats { display: grid; grid-template-columns: 1fr 1fr; background: var(--stats-bg); color: var(--ink); border-top: 3px solid var(--ink); border-radius: 0 0 var(--r) var(--r); margin: 0 0 20px; min-height: 190px; overflow: hidden; }
@media (min-width: 700px) and (max-width: 999px), (min-width: 1160px) { .stats { grid-template-columns: 1.25fr 1fr 1fr 1fr; min-height: 118px; } }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: -1px 0 0 -1px; min-width: 0; }
.stat-label { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.stat-value { font: 600 1.55rem/1.2 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 0.83rem; color: var(--muted); line-height: 1.35; }
.stat-main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stat-main .stat-label, .stat-main .stat-sub { color: var(--accent-ink); }
.stat-main .stat-value { font-size: 1.9rem; }
.verdict { font-size: 1.05rem; margin: 12px 0 12px; min-height: 3em; max-width: 70ch; }

details { border-top: 1px solid var(--line); }
summary { cursor: pointer; padding: 12px 0; font-weight: 600; min-height: 44px; }
summary:hover { text-decoration: underline; }
.calc ol { margin: 0 0 12px; padding-left: 22px; font-size: 0.97rem; max-width: 72ch; }
.calc li { margin-bottom: 6px; }
.worked { background: var(--bg-tint); padding: 12px 14px; border-left: 4px solid var(--accent); font-size: 0.97rem; max-width: 72ch; }

/* ---- Inputs column ---- */
.inputs { background: var(--bg-tint); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 16px 8px; min-width: 0; }
.inputs h2 { font-size: 1.35rem; margin-bottom: 16px; }
.inputs .unit-row { grid-template-columns: minmax(0, 1fr) 112px; }
.inputs .narrow input { text-align: center; font-family: var(--mono); }
.charging { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 14px; margin: 4px 0 16px; min-height: 216px; font-size: 0.95rem; }
.charging h3 { font-family: var(--sans); font-size: 0.95rem; letter-spacing: 0; color: var(--muted); font-weight: 600; }
.charging .big { margin: 2px 0 8px; }
.charging .big strong { font: 600 1.5rem var(--mono); }
.charging .big .muted { font-size: 0.85rem; display: block; font-family: var(--mono); }
.charging ul { margin: 0; padding-left: 18px; }
.charging li { margin-bottom: 4px; }
.warn { color: var(--warn); font-weight: 600; margin: 8px 0 0; }
.more { margin-top: 4px; }
.public-line { font-size: 0.95rem; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 18px; font: inherit; font-weight: 600; color: var(--ink); background: var(--panel); border: 1px solid var(--ink); border-radius: var(--r); cursor: pointer; transition: background-color 150ms; }
.btn:hover { background: var(--bg-tint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.95); }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 0.94rem; font-weight: 500; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); text-decoration: underline; }
.btn.quiet:hover { color: var(--warn); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--sel-bg); color: var(--ink); border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }

/* ---- Sections ---- */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-tint { background: var(--bg-tint); }
.section-lede { max-width: 68ch; color: var(--muted); margin: 12px 0 24px; }
.section h3 { margin: 32px 0 12px; }
.compare-controls { display: flex; flex-wrap: wrap; gap: 8px 32px; align-items: end; margin-bottom: 16px; }
.inline-field { margin: 0; flex: 0 1 340px; }

/* ---- Comparison table ---- */
.table-wrap { min-height: 320px; overflow-x: auto; }
table.compare { width: 100%; border-collapse: collapse; background: var(--panel); border-top: 3px solid var(--line-strong); border-bottom: 3px solid var(--line-strong); }
.compare th, .compare td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font-size: 0.92rem; font-weight: 600; color: var(--muted); vertical-align: bottom; white-space: nowrap; }
.compare .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare thead .num { font-family: var(--sans); }
.compare .strong { font-weight: 700; font-size: 1.08rem; }
.compare tbody th { font-weight: 600; min-width: 220px; }
.compare tr.is-selected > * { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.compare tr.is-selected th { box-shadow: inset 4px 0 0 var(--accent); }
.plan-link { font: inherit; font-weight: 600; color: var(--link); background: none; border: 0; padding: 4px 0; min-height: 32px; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sort { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 4px; min-height: 32px; }
.sort:hover { color: var(--ink); }
th[aria-sort] .sort { color: var(--ink); text-decoration: none; }
th[aria-sort="ascending"] .sort::after { content: " \2191"; }
th[aria-sort="descending"] .sort::after { content: " \2193"; }
.strip { display: block; width: 100%; max-width: 240px; height: 10px; margin-top: 8px; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 1px 7px; border: 1px solid var(--field); border-radius: 3px; color: var(--muted); vertical-align: 2px; white-space: nowrap; font-family: var(--sans); }
.tag-own { border-color: var(--own); color: var(--own); }
.tag-cheap { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

@media (max-width: 900px) {
  .table-wrap { overflow: visible; }
  table.compare, .compare tbody, .compare tr, .compare th, .compare td { display: block; }
  .compare thead { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .compare thead tr { display: contents; }
  .compare thead th { padding: 0; border: 0; display: none; }
  .compare thead th:has(.sort) { display: block; }
  .compare thead::before { content: "Sort by"; font-size: 0.92rem; color: var(--muted); align-self: center; }
  .compare tbody tr { padding: 12px; border-bottom: 2px solid var(--line-strong); }
  .compare tbody th { padding: 0 0 8px; border: 0; min-width: 0; }
  .compare td { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px dotted var(--line); text-align: right; white-space: normal; }
  .compare td:last-child { border-bottom: 0; }
  .compare td.num { white-space: normal; }
  .compare td::before { flex: 1 1 50%; }
  .compare td::before { content: attr(data-label); font-family: var(--sans); font-weight: 500; color: var(--muted); text-align: left; }
  .compare tr.is-selected th { box-shadow: none; }
  .compare tr.is-selected { box-shadow: inset 4px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
  .compare tr.is-selected > * { background: none; }
}

/* ---- Month chart ---- */
.chart-wrap { min-height: 240px; max-width: 900px; }
@media (min-width: 560px) { .chart-wrap { min-height: 300px; } }
.chart { display: block; max-width: 100%; height: auto; }
.series { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.s0 { stroke: var(--s0); } .s1 { stroke: var(--s1); } .s2 { stroke: var(--s2); }
.s3 { stroke: var(--s3); } .s4 { stroke: var(--s4); } .s5 { stroke: var(--s5); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 0.95rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { flex: none; }

/* ---- Your plans ---- */
.toast { min-height: 1.5em; font-weight: 600; margin: 0 0 16px; }
.toast:empty { min-height: 0; margin: 0; }
.plan-list { list-style: none; padding: 0; margin: 24px 0 16px; border-top: 3px solid var(--line-strong); background: var(--panel); min-height: 300px; }
.plan-item { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.plan-item.own { box-shadow: inset 4px 0 0 var(--accent); }
.plan-main { flex: 1 1 320px; min-width: 0; }
.plan-item h3 { margin: 0 0 4px; font-size: 1.15rem; }
.plan-meta { margin: 0; font-size: 0.94rem; color: var(--muted); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-empty { padding: 16px; border-bottom: 1px solid var(--line); color: var(--muted); }

.editor { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 0 0 var(--r) var(--r); padding: 20px 16px; margin: 0 0 24px; max-width: 860px; }
@media (min-width: 700px) { .editor { padding: 24px; } }
.editor h3 { margin: 0 0 16px; font-size: 1.35rem; }
.season-block { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 4px; margin: 16px 0; min-width: 0; }
.season-block legend { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; padding: 0 8px; }
.band-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px dotted var(--line); }
.band-row .btn { margin-bottom: 16px; justify-self: start; }
@media (min-width: 640px) {
  .band-row { grid-template-columns: 130px 130px minmax(140px, 1fr) auto; border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
}
.cover { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.cover-label { font: 12px var(--mono); color: var(--muted); }
.cover-strip { flex: 1; border: 1px solid var(--field); display: block; }
.cover-strip .strip { max-width: none; margin: 0; height: 14px; }
.cover-strip .lvl-none { fill: var(--lvl-none); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---- Guide and FAQ ---- */
.prose > * { max-width: 70ch; }
.prose h2 { max-width: 24ch; margin-bottom: 8px; }
.prose ul { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.formula { font-family: var(--mono); font-size: 0.98rem; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 16px; }
.glossary { margin: 0; display: grid; gap: 4px 20px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0 0 10px; }
@media (min-width: 700px) { .glossary { grid-template-columns: 200px 1fr; } .glossary dd { margin: 0 0 6px; } }
.faq { border-top: 1px solid var(--line); }
.faq:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { font-family: var(--serif); font-size: 1.15rem; padding: 14px 0; }
.faq p { margin: 0 0 16px; }

/* ---- Result bar: the main figure stays on screen while the tool is in use ---- */
.mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px max(16px, calc((100% - 1180px) / 2 + 32px)) calc(6px + env(safe-area-inset-bottom)); background: var(--brand); color: var(--on-brand); border-top: 3px solid var(--accent); transition: transform 200ms; }
.mobile-bar[hidden] { display: none; }
.mobile-bar.is-hidden { transform: translateY(110%); }
.mobile-bar.is-top { top: 0; bottom: auto; border-top: 0; border-bottom: 3px solid var(--accent); padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; }
.mobile-bar.is-top.is-hidden { transform: translateY(-110%); }
.rb-text { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; }
.rb-line { font-size: 0.95rem; line-height: 1.3; }
.rb-line b { font: 700 1.3rem/1.15 var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); }
.rb-line b.rb-2 { font-size: 1.05rem; color: var(--on-brand); }
.mobile-plan { font-size: 0.8rem; color: var(--on-brand-muted); overflow-wrap: anywhere; }
.rb-details { flex: none; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 12px; color: var(--on-brand); border: 1px solid var(--on-brand-muted); border-radius: var(--r); font-weight: 600; text-decoration: none; }
.rb-details:hover { background: var(--brand-2); }
.has-bar .site-footer { padding-bottom: calc(32px + 72px + env(safe-area-inset-bottom)); }
#result { scroll-margin-top: 12px; }
@media (max-width: 479px) { .mobile-plan { display: none; } .rb-line { font-size: 0.9rem; } }

/* ---- Phone: touch targets and long lists ---- */
.band-list { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.92rem; }
.band-list li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.band-list .sw { width: 12px; height: 12px; flex: none; display: inline-block; }
.band-list .sw.lvl-0 { background: var(--lvl-0); } .band-list .sw.lvl-1 { background: var(--lvl-1); }
.band-list .sw.lvl-2 { background: var(--lvl-2); } .band-list .sw.lvl-3 { background: var(--lvl-3); }
.band-list b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.more-row { margin: 12px 0; display: none; }
.site-footer a { color: var(--on-brand); }
.footer-nav { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 8px 0 0; }
.copyright { margin-top: 8px; }
@media (max-width: 900px) {
  .plan-link, .sort { min-height: 44px; display: inline-flex; align-items: center; }
  .sort { padding: 6px 4px; }
}
@media (max-width: 600px) {
  .more-row { display: block; }
  .more-row .btn { width: 100%; }
  .compare tbody:not(.all) tr:nth-child(n+4):not(.is-selected) { display: none; }
  .plan-list:not(.all) .plan-item.example { display: none; }
  .table-wrap, .plan-list { min-height: 0; }
}

.guide-sec summary { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.guide-sec summary::-webkit-details-marker { display: none; }
.guide-sec summary::before { content: "+"; font: 600 1.2rem var(--mono); width: 18px; flex: none; }
.guide-sec[open] summary::before { content: "\2212"; }
.guide-sec summary h3 { margin: 0; }
.guide-sec:last-of-type { border-bottom: 1px solid var(--line); }

@media (max-width: 1279px) { .stat-main .stat-value { font-size: 2.1rem; } }
@media (max-width: 600px) {
  .stat-main { grid-column: 1 / -1; }
  .stat:last-child { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .stat { padding: 12px; }
  .stat-value { font-size: 1.4rem; }
  .band-row .affix .cur { padding: 0 7px; }
  .band-row .affix input { padding: 8px 6px; }
}

/* ---- Hero call to action, example note ---- */
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 20px 0 0; }
.hero-cta-note { color: var(--muted); font-size: 0.95rem; }
@media (max-width: 600px) { .hero-cta-note { min-height: 3em; line-height: 1.5; flex-basis: 100%; } }
.example-note { margin: 0 0 12px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--bg-tint); font-size: 0.95rem; }

/* ---- Text pages ---- */
.page { padding-top: 28px; padding-bottom: 56px; }
.page h1 { margin-bottom: 8px; }
.page h2 { font-size: 1.4rem; margin: 32px 0 10px; }
.page .lede { margin: 12px 0 8px; }
.page a { overflow-wrap: anywhere; }
a.btn { text-decoration: none; }
.crumb { font-size: 0.92rem; color: var(--muted); margin: 0 0 12px; }
.crumb a { display: inline-block; padding: 12px 0; }
#delete-status { font-weight: 600; margin-left: 8px; }

/* ---- Advertisement slots (hidden unless ads are switched on) ---- */
.ad-slot { padding: 24px 0; border-top: 1px solid var(--line); }
.ad-label { font-size: 0.8rem; color: var(--muted); margin: 0 0 6px; }
.ad-box { min-height: 120px; max-width: 100%; overflow: hidden; }
@media (max-width: 600px) { .ad-box { min-height: 280px; } }

/* ---- Quick entry in the plan editor ---- */
.paste { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.paste textarea { width: 100%; min-height: 112px; padding: 10px 12px; font: 16px/1.5 var(--mono); color: var(--ink); background: var(--panel); border: 1px solid var(--field); border-radius: var(--r); resize: vertical; }
.paste textarea:hover { border-color: var(--ink); }
.paste textarea::placeholder { color: var(--muted); opacity: 0.75; font-style: italic; }
.paste-actions { margin: 2px 0 0; }
.paste-status { margin: 0; min-height: 1.4em; font-size: 0.92rem; }
.paste-status.hint { color: var(--ink); }
.rows-intro { margin: 8px 0 8px; font-weight: 600; font-size: 0.95rem; color: var(--muted); }
.fix { margin: 0 0 8px; }
.fix:empty { display: none; }

/* ---- Sibling tools ---- */
.siblings { background: var(--bg-tint); border-top: 1px solid var(--line); padding: 32px 0 24px; }
.siblings h2 { font-size: 1.3rem; margin-bottom: 8px; }
.sibling-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px 32px; }
@media (min-width: 800px) { .sibling-list { grid-template-columns: 1fr 1fr; } }
.sibling-list li { display: flex; flex-direction: column; max-width: 60ch; }
.sibling-list a { display: inline-flex; align-items: center; min-height: 44px; align-self: flex-start; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.sibling-list span { color: var(--muted); font-size: 0.95rem; }

/* ---- Article ---- */
.article .meta { color: var(--muted); font-size: 0.92rem; margin: 0 0 16px; }
.article table { border-collapse: collapse; width: 100%; max-width: 560px; margin: 8px 0 16px; background: var(--panel); font-size: 0.95rem; }
.article th, .article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.article td.num, .article th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.article pre { font: 16px/1.6 var(--mono); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 16px; overflow-x: auto; margin: 8px 0 16px; }
.article ol, .article ul { padding-left: 22px; }
.article li { margin-bottom: 8px; }
.table-scroll { overflow-x: auto; }
.ad-inline { padding: 16px 0; margin: 16px 0; border-bottom: 1px solid var(--line); }
.article .callout { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 16px; margin: 16px 0; }

/* ---- Round 9: stale figures, nav fit, touch targets at every width ---- */
.stats.is-stale { opacity: 0.45; }
.nav-short { display: none; }
@media (max-width: 360px) { .nav-long { display: none; } .nav-short { display: inline; } }
.plan-link, .sort { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }

/* ---- Footer ---- */
.site-footer { background: var(--brand); color: var(--on-brand-muted); padding: 32px 0; font-size: 0.94rem; }
.site-footer p { max-width: 80ch; margin: 0 0 8px; }
.footer-brand { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--on-brand); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  body { background: #fff; padding-bottom: 0; }
  .section, .tool { padding: 16px 0; }
  details.calc > *, details.faq > * { display: block; }
  .stats, .site-header, .site-footer { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .plan-actions, #add-plan, .compare-controls, #reset-inputs { display: none !important; }
  .site-header nav, .theme-toggle, .mobile-bar, .inputs, #plan-form { display: none !important; }
}
