/* Layout: inputs on the left like a service ticket, results pinned on the right like a gauge readout. */
:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --ink: #15222c;
  --muted: #546570;
  --line: #d4dde2;
  --cool: #1d5f8a;      /* accent: controls, focus */
  --heat: #b8560f;      /* gains: money you're missing */
  --heat-soft: #f8eadf;
  --good: #2c7a4b;
  --good-soft: #e3f1e8;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Public Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e161c; --surface: #16222b; --ink: #e3ebf0; --muted: #96a7b2; --line: #2a3a45;
    --cool: #6fb2e0; --heat: #f0a057; --heat-soft: #33251a; --good: #6cc792; --good-soft: #17301f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e161c; --surface: #16222b; --ink: #e3ebf0; --muted: #96a7b2; --line: #2a3a45;
  --cool: #6fb2e0; --heat: #f0a057; --heat-soft: #33251a; --good: #6cc792; --good-soft: #17301f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  margin: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1120px; margin: 0 auto; padding-block: 40px 56px; display: grid; gap: 32px; }

header { display: grid; gap: 10px; max-width: 46rem; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.1rem, 5vw, 3.2rem); line-height: 1.02; margin: 0; text-wrap: balance; }
header p.lede { margin: 0; color: var(--muted); max-width: 40rem; }

.grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.inputs { display: grid; gap: 24px; min-width: 0; }
.example-note { margin: 0; font-size: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 8px 12px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 14px; min-width: 0; }
legend { font-family: var(--display); font-weight: 600; font-size: 1.35rem; padding: 0; margin-bottom: 4px; }
.field { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; padding-bottom: 0; }
.field label { font-weight: 600; font-size: 15px; }
.field .help { margin: 0; font-size: 13px; color: var(--muted); }
.ctrl { display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem; gap: 14px; align-items: center; }
.group-intro { margin: 0; font-size: 14px; background: var(--heat-soft); border-radius: 6px; padding: 10px 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fold { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.fold-toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: none; border: 0; color: var(--ink); font: inherit; text-align: left; padding: 14px 16px; cursor: pointer; border-radius: 8px; }
.fold-toggle:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
.fold-title { display: block; font-family: var(--display); font-weight: 600; font-size: 1.35rem; }
.fold-note { display: block; font-size: 13px; color: var(--muted); }
.chev { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--cool); border-bottom: 2px solid var(--cool);
  transform: rotate(45deg); transition: transform .25s ease; margin-right: 4px; }
.fold.open .chev { transform: rotate(-135deg); }
.fold-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.fold.open .fold-body { grid-template-rows: 1fr; }
.fold-inner { overflow: hidden; min-height: 0; }
.fold-inner fieldset { padding: 4px 16px 16px; }
@media (prefers-reduced-motion: reduce) { .fold-body, .chev { transition: none; } }
.pair { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pair-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.pair .field { border-bottom: 0; padding-bottom: 0; }
.pair .ctrl { grid-template-columns: minmax(0, 1fr) 7rem; gap: 10px; }
@media (max-width: 560px) { .pair .ctrl { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
input[type="range"] { width: 100%; accent-color: var(--cool); margin: 0; height: 28px; }
.box { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 10px; height: 40px; }
.box:focus-within { border-color: var(--cool); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cool) 25%, transparent); }
.box span { color: var(--muted); font-size: 15px; }
.box input { border: 0; background: transparent; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; width: 100%; min-width: 0; text-align: right; padding: 0 4px; outline: none; }
input[type="range"]:focus-visible { outline: 2px solid var(--cool); outline-offset: 3px; }

.results { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: grid; gap: 18px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
@media (max-width: 860px) { .results { position: static; } }
.now { margin: 0; }
.now b, .num { font-variant-numeric: tabular-nums; }
.sub { margin: 0; font-size: 14px; color: var(--muted); }

.headline { display: grid; gap: 4px; background: var(--heat-soft); border-radius: 8px; padding: 18px; }
.headline .big { font-family: var(--display); font-weight: 700; color: var(--heat); font-size: clamp(2.2rem, 6vw, 3.1rem); line-height: 1; font-variant-numeric: tabular-nums; }
.headline .what { font-weight: 600; }
.headline.good { background: var(--good-soft); }
.headline.good .big { color: var(--good); font-size: clamp(1.8rem, 4.5vw, 2.4rem); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; gap: 2px; padding: 12px 0; border-top: 1px solid var(--line); }
.steps .row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.steps .name { font-weight: 600; }
.steps .gain { font-weight: 600; color: var(--heat); font-variant-numeric: tabular-nums; }
.steps .detail { font-size: 14px; color: var(--muted); }
.steps .there { color: var(--good); font-weight: 600; }

.side { margin: 0; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.side b { color: var(--ink); }

.cta { display: grid; gap: 8px; }
.btn { display: block; text-align: center; text-decoration: none; font-weight: 700; font-size: 16px;
  background: var(--cool); color: var(--surface); border-radius: 8px; padding: 14px 18px; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.btn.off { background: var(--line); color: var(--muted); cursor: default; }
.cta small { color: var(--muted); font-size: 13px; text-align: center; }

footer { font-size: 13px; color: var(--muted); max-width: 46rem; }
@media (prefers-reduced-motion: no-preference) { .big { transition: color .2s; } }

/* Light/dark toggle (theme.js), top right corner. */
.theme-toggle {
  position: fixed; top: max(12px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); z-index: 10;
  font: 600 13px var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--cool); }
.theme-toggle:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
