/* ==========================================================================
   BuyersWorld Calculator Suite — styles
   Built to the BuyersWorld Design System. Calculators live in the "sand"
   (money) aura family. Light-only, system fonts, zero external requests.
   All colours come from tokens so the one-line --frame brand swap still works.
   ========================================================================== */

:root{
  /* Frame (host app chrome) */
  --frame:        #123f2e;
  --frame-active: #2e7a57;
  --frame-icon:   #c3dccb;

  /* Canvas & ink */
  --canvas:   #e9e7e2;
  --ink:      #26221f;
  --neutral-ink: #4a4038; /* page-chrome text that isn't inside a toned calculator card */

  /* Accents */
  --accent-amber: #e8964f;
  --accent-blue:  #2a63a8;
  --accent-green: #2c6b47;
  --accent-rose:  #c04b6a;
  --highlighter:  #e8f545;

  /* Lines / frosting */
  --hair:   rgba(40,54,43,.14);
  --frost:  rgba(255,255,255,.55);
  --frost-strong: rgba(255,255,255,.7);

  --shell-radius: 30px;
  --card-radius:  26px;
  --inset-radius: 16px;

  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ margin:0; }
body{
  font-family:var(--font);
  background:var(--canvas);
  color:var(--ink);
  font-size:clamp(.75rem,1.3vw,.82rem);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{ margin:0; line-height:1.2; text-wrap:balance; }
a{ color:var(--accent-blue); text-decoration:none; }
button{ font-family:inherit; }

/* ---- Host-app chrome (preview only; the real app supplies this) --------- */
.app-topbar{
  background:var(--frame); color:#fff;
  height:60px; display:flex; align-items:center; gap:14px;
  padding:0 clamp(16px,2.4vw,26px);
}
.app-logo{ font-weight:700; font-size:clamp(1rem,1.8vw,1.15rem); letter-spacing:-.01em; }
.app-logo span{ color:var(--accent-amber); }
.app-topbar .crumb{ font-size:.72rem; opacity:.72; border-left:1px solid rgba(255,255,255,.25); padding-left:14px; }
.app-topbar .preview-tag{
  margin-left:auto; font-size:.745rem; font-weight:700; letter-spacing:.04em;
  background:var(--highlighter); color:#26221f; padding:3px 8px; border-radius:6px;
}

/* ---- Page shell --------------------------------------------------------- */
.canvas{ max-width:1180px; margin:0 auto; padding:clamp(16px,2.4vw,28px) clamp(16px,2.4vw,26px) 60px; }

.page-head{ margin-bottom:20px; }
.page-head h1{ font-size:clamp(1.5rem,3.2vw,2.1rem); color:var(--ink); letter-spacing:-.02em; }
.page-head p.lede{ font-size:clamp(.8rem,1.4vw,.9rem); color:#5b544d; max-width:60ch; margin:8px 0 0; }
.head-meta{ display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; align-items:center; }

/* chips */
.chip{ display:inline-flex; align-items:center; gap:5px; font-size:.745rem; font-weight:700;
  letter-spacing:.03em; padding:3px 8px; border-radius:6px; }
.chip.tag{ background:var(--highlighter); color:#26221f; }
.chip.fresh{ background:rgba(44,107,71,.14); color:var(--accent-green); }
.chip.est{ background:rgba(38,34,31,.08); color:var(--neutral-ink); }
.chip.unlocked{ background:rgba(44,107,71,.14); color:var(--accent-green); }
.chip.muted{ background:rgba(40,54,43,.08); color:#5b544d; }
/* complexity level — neutral for everyday Standard, blue accent for deeper Advanced */
.chip.level-standard{ background:rgba(38,34,31,.08); color:var(--neutral-ink); }
.chip.level-advanced{ background:rgba(42,99,168,.14); color:var(--accent-blue); }
.chip-row{ display:inline-flex; gap:6px; flex-wrap:wrap; align-items:center; }

/* ---- Category menu (sticky in-page nav) --------------------------------- */
/* quick-links nav: sticky top bar with a complexity-filter row and per-category
   groups, each listing its calculators as jump links. */
.quick-nav{
  position:sticky; top:0; z-index:20; background:var(--canvas);
  padding:12px 0 14px; margin-bottom:6px; border-bottom:1px solid var(--hair);
}
.quick-nav a{ transition:background .15s, color .15s; white-space:nowrap; }
/* complexity filter row */
.qn-levels{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:12px; }
.qn-label{ font-size:.745rem; text-transform:uppercase; letter-spacing:.06em; color:#7a726a; font-weight:700; margin-right:2px; }
.qn-lvl{
  font-size:.745rem; font-weight:700; color:var(--neutral-ink);
  background:var(--frost); padding:6px 13px; border-radius:999px;
}
.qn-lvl:hover, .qn-lvl:focus-visible{ background:rgba(38,34,31,.12); }
.qn-lvl.is-active{ background:var(--frame); color:#fff; }
/* category groups + their per-calculator links */
.qn-cats{ display:flex; flex-wrap:wrap; gap:10px 22px; }
.qn-group{ display:flex; flex-direction:column; gap:6px; }
.qn-cat{
  font-size:.745rem; font-weight:700; letter-spacing:.02em; color:var(--neutral-ink);
  background:var(--frost); padding:7px 13px; border-radius:999px;
}
.qn-cat:hover, .qn-cat:focus-visible{ background:rgba(38,34,31,.12); }
.qn-cat.is-active{ background:var(--frame); color:#fff; }
.qn-tools{ display:flex; flex-direction:column; gap:3px; padding-left:4px; }
.qn-tool{ font-size:.745rem; font-weight:500; color:#6b625a; padding:2px 4px; border-radius:6px; }
.qn-tool:hover, .qn-tool:focus-visible{ color:var(--accent-blue); background:rgba(42,99,168,.08); }

/* ---- Category section --------------------------------------------------- */
.category{ margin-top:34px; scroll-margin-top:64px; }
.category > h2{
  font-size:clamp(.95rem,1.7vw,1.15rem); color:var(--ink); margin-bottom:2px;
  display:flex; align-items:baseline; gap:10px;
}
.category > h2 .count{ font-size:.66rem; font-weight:600; color:#8a827a; }
.category > p.cat-note{ font-size:.72rem; color:#7a726a; margin:2px 0 16px; }

.module-list{ display:flex; flex-direction:column; gap:26px; }

/* the toggle row holds the Guest/Member and Standard/Advanced controls side by side */
.toggles{ display:flex; flex-wrap:wrap; gap:8px 22px; justify-content:flex-end; align-items:center; }
/* view-as toggle */
.view-toggle{ display:flex; align-items:center; gap:10px; justify-content:flex-end; padding:2px 0 10px; }
.view-toggle .vt-label{ font-size:.68rem; text-transform:uppercase; letter-spacing:.05em; color:#7a726a; font-weight:700; }
/* Two classes (not one) so this always outranks the tone-based .segmented
   rule below, regardless of source order — the view toggle isn't inside a
   toned calculator, so it must never depend on --tone-ink-rgb. */
.segmented.vt-seg{ background:rgba(40,54,43,.1); }
.segmented.vt-seg button{ padding:6px 14px; color:var(--neutral-ink); }

/* zigzag row: instructions + calculator. align-items:stretch (the grid default)
   makes both columns match the row's height — i.e. the taller item, almost
   always the calculator — so .how (and its demo clip) reaches the same bottom. */
.module-row{ display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
/* minmax(0,…) + min-width:0 stop wide content (e.g. a results table) from
   stretching the row past the screen; tables scroll inside .table-wrap instead. */
.module-row > *{ min-width:0; }
@media (min-width:920px){
  .module-row{ grid-template-columns:minmax(0,0.72fr) minmax(0,1.6fr); align-items:stretch; }
  .module-row.rev{ grid-template-columns:minmax(0,1.6fr) minmax(0,0.72fr); }
  .module-row.rev .how{ order:2; }
  .module-row.rev .calc{ order:1; }
  .how{ align-self:stretch; }
}

/* instructions panel — quiet white shell (grouping surface), lets the sand calc lead.
   display:flex + align-self:stretch (desktop) makes this panel match the height of
   the calculator beside it, so the demo clip's bottom lines up with the calc's bottom. */
.how{ background:#fff; border-radius:22px; padding:20px 22px; box-shadow:0 1px 6px rgba(38,34,31,.06);
  display:flex; flex-direction:column; align-self:start; position:sticky; top:60px; }
.how-top{ flex:0 0 auto; }
.how-title{ font-size:clamp(1rem,1.5vw,1.18rem); color:var(--ink); margin:5px 0 8px; }
.how-blurb{ font-size:.78rem; color:#54504a; margin:0 0 12px; }
.how-steps{ margin:0 0 14px; padding-left:18px; display:flex; flex-direction:column; gap:6px; }
.how-steps li{ font-size:.74rem; color:#54504a; }
.how-steps li::marker{ color:var(--accent-green); font-weight:700; }

/* "how it works" mock demo — a silent looping cursor animation (drag a slider,
   tap Calculate). Pure CSS, no video/image asset. flex:1 + the margin-top gap
   below the steps means this block owns all the leftover height once .how
   stretches to match the calculator, so the clip area reaches the same bottom. */
.how-demo{ margin-top:22px; flex:1 1 auto; display:flex; flex-direction:column; min-height:132px; }
.demo-label{ font-size:.725rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:#a39a8f; margin-bottom:8px; }

/* the mock is a compact STACK of mini rows — ONE PER INPUT the calculator
   actually has (slider, key-in, segmented, radio, select), in the exact order
   they appear on the real form — plus the Calculate button. Height is
   content-driven (flex:0 0 auto); any leftover height in .how-demo (flex:1)
   is quiet space below it. .tone-cream/.tone-green (set to match the
   calculator beside it) drive the same --tone-* variables .calc uses, so the
   calculator and its demo are always "the same colour". Defaults here (green)
   are a defensive fallback only — JS always sets one of the two classes. */
.demo-mock{ position:relative; flex:0 0 auto; display:flex; flex-direction:column; gap:9px;
  border-radius:14px; background:var(--tone-3); border:1px solid rgba(var(--tone-ink-rgb),.14); padding:14px 16px;
  --tone-1:#eef3e4; --tone-2:#cfe0cd; --tone-3:#c3dccb; --tone-ink:#28362b; --tone-ink-rgb:40,54,43; }
.demo-row{ position:relative; height:22px; display:flex; align-items:center; }

/* slider row (reused across every module that has one) */
.demo-track{ position:relative; flex:1; height:6px; border-radius:999px; background:rgba(var(--tone-ink-rgb),.18); }
.demo-fill{ position:absolute; left:0; top:0; height:100%; width:10%; border-radius:999px; background:var(--frame); }
.demo-handle{ position:absolute; top:50%; left:10%; width:14px; height:14px; margin:-7px 0 0 -7px; border-radius:50%;
  background:var(--frame); border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.25); }

/* key-in / select row: a mini field that "fills in" with the module's real default */
.demo-keyin, .demo-select{ width:100%; height:100%; border-radius:6px; background:rgba(255,255,255,.75);
  display:flex; align-items:center; justify-content:space-between; padding:0 9px;
  font-size:.64rem; font-weight:700; color:rgba(var(--tone-ink-rgb),.85); }
.demo-kv{ opacity:0; transform:translateY(2px); transition:opacity .28s ease, transform .28s ease; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.demo-keyin.is-filled .demo-kv, .demo-select.is-filled .demo-kv{ opacity:1; transform:translateY(0); }
.demo-chevron{ color:rgba(var(--tone-ink-rgb),.45); font-size:.725rem; }

/* segmented row: a row of mini pills, one becomes active (the module's actual default) */
.demo-seg{ display:flex; gap:4px; width:100%; height:100%; }
.demo-chip{ flex:1; border-radius:6px; background:rgba(var(--tone-ink-rgb),.12); transition:background .28s ease; }
.demo-chip.is-active{ background:var(--frame); }

/* radio row: a couple of mini dots, one becomes selected */
.demo-radios{ display:flex; gap:14px; height:100%; align-items:center; }
.demo-dot{ width:13px; height:13px; border-radius:50%; border:2px solid rgba(var(--tone-ink-rgb),.32); transition:background .28s ease, border-color .28s ease, box-shadow .28s ease; }
.demo-dot.is-active{ border-color:var(--frame); background:var(--frame); box-shadow:inset 0 0 0 2px #fff; }

/* the button row (a normal flex child now, not absolutely positioned) */
.demo-row-btn{ margin-top:2px; }
.demo-btn{ background:var(--frame); color:#fff; font-size:.745rem; font-weight:700; padding:7px 16px;
  border-radius:8px; transition:transform .18s ease, filter .18s ease; }
.demo-btn.is-pressed{ transform:scale(.93); filter:brightness(1.18); }

/* the cursor — a single element whose position is driven by JS (transform),
   so it can visit however many rows a given module has. */
.demo-cursor{ position:absolute; top:0; left:0; width:12px; height:12px; border-radius:50%; background:#fff;
  opacity:0; box-shadow:0 0 0 2px var(--ink), 0 2px 5px rgba(0,0,0,.22); pointer-events:none; will-change:transform; }
.demo-cursor::after{ content:''; position:absolute; inset:-6px; border-radius:50%; border:2px solid var(--accent-green);
  opacity:0; transform:scale(.4); }
.demo-cursor.is-click::after{ animation:demoRippleOnce .5s ease-out; }
@keyframes demoRippleOnce{
  0%{ opacity:.85; transform:scale(.4); } 100%{ opacity:0; transform:scale(1.7); }
}
/* gate (guests, registered tools) — sits BELOW the calc-head, which still
   shows the calculator's name and status even while it's locked. */
.calc.is-gated{ display:flex; flex-direction:column; }
.gate-wrap{ flex:1; display:flex; align-items:center; justify-content:center; min-height:220px; }
.gate{ text-align:center; max-width:360px; display:flex; flex-direction:column; align-items:center; gap:10px; }
.gate-title{ font-size:1.05rem; color:var(--tone-ink); }
.gate-body{ font-size:.76rem; color:rgba(var(--tone-ink-rgb),.82); margin:0; }
.gate .calc-btn{ width:auto; padding:11px 26px; margin-top:4px; }
.link-btn{ background:none; border:0; color:var(--tone-ink); font-size:.72rem; font-weight:600; text-decoration:underline; cursor:pointer; padding:2px; }
.link-btn:focus-visible{ outline:2px solid var(--accent-green); outline-offset:2px; }

/* ---- Aura calculator card --------------------------------------------- */
/* Alternates between two tones (.tone-cream / .tone-green, set by JS per
   module) instead of one fixed palette. Green here is the fallback default;
   .tone-cream overrides it below. The matching .demo-mock tone class (in the
   instructions panel) uses the SAME variables, so a calculator and its own
   "how it works" clip always share one colour. */
.calc{
  border-radius:var(--card-radius); padding:20px 22px; color:var(--tone-ink);
  background:
    radial-gradient(95% 120% at 20% 10%, var(--tone-1) 0%, transparent 55%),
    radial-gradient(120% 135% at 78% 92%, var(--tone-2) 0%, var(--tone-3) 66%),
    var(--tone-3);
  box-shadow:0 1px 6px rgba(38,34,31,.07);
  --tone-1:#eef3e4; --tone-2:#cfe0cd; --tone-3:#c3dccb; --tone-ink:#28362b; --tone-ink-rgb:40,54,43;
}
.calc.tone-cream, .demo-mock.tone-cream{
  --tone-1:#fbf9f5; --tone-2:#f1ece2; --tone-3:#f6f3ec; --tone-ink:#3a3128; --tone-ink-rgb:58,49,40;
}
.calc-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.calc-head-name{ display:flex; flex-direction:column; gap:2px; }
.calc-head h3{ font-size:clamp(1rem,1.7vw,1.16rem); }
.calc-desc{ font-size:.72rem; color:rgba(var(--tone-ink-rgb),.8); margin:0 0 16px; max-width:62ch; }

.calc-body{ display:grid; gap:20px; grid-template-columns:minmax(0,1fr); }
.calc-body > *{ min-width:0; }

/* inputs / outputs columns */
.io-col{ display:flex; flex-direction:column; gap:14px; }
.io-col h4{ font-size:.66rem; text-transform:uppercase; letter-spacing:.07em; color:rgba(var(--tone-ink-rgb),.6); font-weight:700; }

/* frosted inset (groups a control) */
.field{ background:var(--frost); border-radius:var(--inset-radius); padding:12px 14px; }
.field label, .field .field-label{ display:block; font-size:.72rem; font-weight:600; margin-bottom:7px; color:var(--tone-ink); }
.field .hint{ font-size:.64rem; color:rgba(var(--tone-ink-rgb),.65); margin-top:6px; }

/* key-in number field */
.keyin{ display:flex; align-items:center; background:var(--frost-strong); border-radius:10px; padding:0 10px; }
.keyin .prefix{ font-size:.82rem; color:rgba(var(--tone-ink-rgb),.6); }
.keyin input{
  border:0; background:transparent; width:100%; padding:9px 6px; font-family:inherit;
  font-size:.9rem; font-variant-numeric:tabular-nums; color:var(--tone-ink); font-weight:600;
}
.keyin input:focus{ outline:none; }
.field:focus-within{ box-shadow:0 0 0 2px var(--accent-green); }

/* value readout for slider */
.slider-val{ float:right; font-weight:700; font-variant-numeric:tabular-nums; }

/* range slider */
input[type=range]{ -webkit-appearance:none; appearance:none; width:100%; height:22px; background:transparent; margin:2px 0; }
input[type=range]::-webkit-slider-runnable-track{ height:6px; border-radius:999px;
  background:linear-gradient(90deg, var(--frame) var(--fill,0%), rgba(var(--tone-ink-rgb),.18) var(--fill,0%)); }
input[type=range]::-moz-range-track{ height:6px; border-radius:999px; background:rgba(var(--tone-ink-rgb),.18); }
input[type=range]::-moz-range-progress{ height:6px; border-radius:999px; background:var(--frame); }
input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; appearance:none; width:18px; height:18px;
  margin-top:-6px; border-radius:50%; background:var(--frame); border:3px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.25); cursor:pointer; }
input[type=range]::-moz-range-thumb{ width:16px; height:16px; border-radius:50%; background:var(--frame); border:3px solid #fff; cursor:pointer; }
input[type=range]:focus-visible{ outline:none; }
input[type=range]:focus-visible::-webkit-slider-thumb{ box-shadow:0 0 0 3px rgba(44,107,71,.4); }

/* segmented tabs */
.segmented{ display:flex; background:rgba(var(--tone-ink-rgb),.1); border-radius:12px; padding:3px; gap:3px; }
.segmented button{ flex:1; border:0; background:transparent; padding:8px 6px; border-radius:9px;
  font-size:.7rem; font-weight:600; color:var(--tone-ink); cursor:pointer; transition:background .15s; }
.segmented button[aria-pressed=true]{ background:#fff; box-shadow:0 1px 3px rgba(38,34,31,.12); }
.segmented button:focus-visible{ outline:2px solid var(--accent-green); outline-offset:1px; }

/* radio grid */
.radio-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.radio-grid label{ display:flex; align-items:center; gap:7px; background:var(--frost-strong);
  padding:8px 10px; border-radius:10px; font-size:.72rem; font-weight:600; cursor:pointer; margin:0; }
.radio-grid input{ accent-color:var(--frame); }

/* select */
.field select{ width:100%; border:0; background:var(--frost-strong); border-radius:10px; padding:9px 10px;
  font-family:inherit; font-size:.82rem; font-weight:600; color:var(--tone-ink); }
.field select:focus-visible{ outline:2px solid var(--accent-green); }

/* calculate button */
.calc-btn{ background:var(--frame); color:#fff; border:0; border-radius:12px; padding:11px 18px;
  font-size:.82rem; font-weight:700; cursor:pointer; width:100%; transition:filter .15s; }
.calc-btn:hover{ filter:brightness(1.08); }
.calc-btn:focus-visible{ outline:3px solid rgba(44,107,71,.4); outline-offset:2px; }

/* ---- Results ------------------------------------------------------------ */
.results{ display:flex; flex-direction:column; gap:12px; }
.results[hidden]{ display:none; }

.hero-metric{ background:var(--frost-strong); border-radius:var(--inset-radius); padding:16px 18px; }
.hero-metric .cap{ font-size:.66rem; text-transform:uppercase; letter-spacing:.06em; color:rgba(var(--tone-ink-rgb),.7); font-weight:700; }
.hero-metric .val{ font-size:clamp(1.7rem,4vw,2.4rem); font-weight:800; letter-spacing:-.02em;
  font-variant-numeric:tabular-nums; color:var(--tone-ink); margin-top:2px; }
.hero-metric .sub{ font-size:.72rem; color:rgba(var(--tone-ink-rgb),.8); margin-top:4px; }
.hero-metric.positive .val{ color:var(--accent-green); }

/* stat rows */
.stat-row{ display:flex; justify-content:space-between; align-items:baseline; gap:12px;
  padding:9px 14px; background:var(--frost); border-radius:12px; }
.stat-row .k{ font-size:.72rem; color:rgba(var(--tone-ink-rgb),.85); }
.stat-row .v{ font-size:.85rem; font-weight:700; font-variant-numeric:tabular-nums; color:var(--tone-ink); }
.stat-row .v.rose{ color:var(--accent-rose); }
.stat-row .v.green{ color:var(--accent-green); }

/* side-by-side compare cards */
.compare{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.compare .cc{ background:var(--frost-strong); border-radius:14px; padding:13px 14px; }
.compare .cc .cap{ font-size:.64rem; text-transform:uppercase; letter-spacing:.05em; color:rgba(var(--tone-ink-rgb),.65); font-weight:700; }
.compare .cc .num{ font-size:1.15rem; font-weight:800; font-variant-numeric:tabular-nums; margin-top:3px; }
.compare .cc.stress{ box-shadow:inset 0 0 0 1.5px rgba(232,150,79,.5); }

/* calm alert inset (not alarm styling) */
.alert-inset{ background:var(--frost-strong); border-radius:14px; padding:12px 14px; font-size:.74rem; }
.alert-inset.warn{ box-shadow:inset 0 0 0 1.5px rgba(232,150,79,.55); }
.alert-inset .lead{ font-weight:700; color:var(--accent-amber); }
.alert-inset .mean{ color:rgba(var(--tone-ink-rgb),.85); margin-top:3px; }

/* chart holder sits ON the calculator's own tone */
.chart-wrap{ background:var(--frost); border-radius:14px; padding:12px; }
.chart-legend{ display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; font-size:.68rem; color:rgba(var(--tone-ink-rgb),.85); }
.chart-legend span{ display:inline-flex; align-items:center; gap:6px; }
.chart-legend i{ width:10px; height:10px; border-radius:3px; display:inline-block; }

/* provenance footer on a result */
.provenance{ display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center;
  font-size:.64rem; color:rgba(var(--tone-ink-rgb),.7); margin-top:2px; }
.provenance .src{ font-weight:600; }

/* pending-state note. Falls back to a neutral ink if it ever renders outside
   a toned card (e.g. the top-level "config not loaded" message). */
.pending{ background:var(--frost); border-radius:12px; padding:12px 14px; font-size:.74rem; color:rgba(var(--tone-ink-rgb,74,64,56),.85); }

/* data table (amortisation, accelerated savings, etc.) */
.table-wrap{ background:var(--frost); border-radius:14px; padding:4px; overflow-x:auto; }
.table-wrap.scroll{ max-height:320px; overflow:auto; }
.data-table{ width:100%; border-collapse:collapse; font-size:.7rem; font-variant-numeric:tabular-nums; }
.data-table th, .data-table td{ padding:6px 10px; text-align:left; white-space:nowrap; }
.data-table th{ position:sticky; top:0; background:var(--tone-2); color:var(--tone-ink);
  font-size:.745rem; text-transform:uppercase; letter-spacing:.03em; font-weight:700; z-index:1; }
.data-table td{ border-top:1px solid rgba(var(--tone-ink-rgb),.1); color:rgba(var(--tone-ink-rgb),.9); }
.data-table td.num, .data-table th.num{ text-align:right; }
.data-table tbody tr:nth-child(2n){ background:rgba(255,255,255,.35); }
.table-cap{ font-size:.745rem; color:rgba(var(--tone-ink-rgb),.65); padding:6px 10px 2px; }

/* horizontal stacked proportion bar */
.stackbar{ display:flex; height:22px; border-radius:8px; overflow:hidden; background:rgba(var(--tone-ink-rgb),.1); }
.stackbar .seg{ height:100%; }

/* page-level disclaimer */
.disclaimer{ margin-top:40px; font-size:.66rem; color:#7a726a; border-top:1px solid var(--hair); padding-top:16px; max-width:80ch; }

/* ---- Responsive --------------------------------------------------------- */
/* Below the zigzag breakpoint the calc is full-width, so inputs|results can go
   2-up early; once the calc shares the row (>=920px) it's narrower, so keep it
   single-column until there's real room again (>=1140px). */
@media (min-width:600px) and (max-width:919px){
  .calc-body{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; }
}
@media (min-width:1140px){
  .calc-body{ grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:24px; }
}
@media (max-width:560px){
  .compare, .radio-grid{ grid-template-columns:1fr; }
  .segmented{ flex-wrap:wrap; }
  .how{ position:static; }
}

@media (prefers-reduced-motion:reduce){
  *{ transition:none !important; }
  /* JS checks this same media query and renders one settled frame (all rows
     filled, cursor parked on the button) instead of starting the loop — see
     runDemo() in calculator.js. This block just removes the ripple keyframe. */
  .demo-cursor.is-click::after{ animation:none !important; }
}

/* ---- Embedded in the web app (?embed=1) ----------------------------------
   The host page already has the L-frame, gutters and page heading, so the
   iframe content sits flush and transparent instead of adding its own frame. */
.is-embedded body{ background:transparent; }
.is-embedded .canvas{ max-width:none; padding:0 0 8px; }
.is-embedded .disclaimer{ margin-top:20px; }
/* Sticky offset is for the standalone page's top bar; inside the iframe it
   only pushes the panel down. The host page heading already names the tool. */
.is-embedded .how{ position:static; }
.is-embedded .how-title{ display:none; }
/* Phones/tablets (single column): calculator first, instructions after. */
@media (max-width:919px){ .is-embedded .module-row .calc{ order:-1; } }

/* ---- Band colours for stress tables (Module 18) ------------------------- */
.data-table td.band-comfortable{ background:rgba(44,107,71,.14); color:#1f5136; }
.data-table td.band-stretched{ background:rgba(232,150,79,.2); color:#7a4512; }
.data-table td.band-stress{ background:rgba(196,74,92,.18); color:#7d1f2f; }
.data-table td.is-current{ font-weight:800; box-shadow:inset 0 0 0 2px rgba(var(--tone-ink-rgb),.55); }
.band-key{ display:flex; flex-wrap:wrap; gap:6px 14px; font-size:.68rem; color:rgba(var(--tone-ink-rgb),.8); margin-top:6px; }
.band-key i{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:-1px; }

/* ---- Scheme cards (Module 17) ------------------------------------------- */
.scheme{ background:rgba(255,255,255,.55); border-radius:14px; padding:12px 14px; display:grid; gap:4px; }
.scheme-head{ display:flex; justify-content:space-between; align-items:baseline; gap:10px; flex-wrap:wrap; }
.scheme-name{ font-weight:700; font-size:.8rem; color:var(--tone-ink); }
.scheme-status{ font-size:.68rem; font-weight:700; border-radius:999px; padding:2px 9px; white-space:nowrap; }
.scheme-status.yes{ background:rgba(44,107,71,.16); color:#1f5136; }
.scheme-status.no{ background:rgba(38,34,31,.08); color:rgba(38,34,31,.6); }
.scheme-status.check{ background:rgba(232,150,79,.2); color:#7a4512; }
.scheme-value{ font-weight:800; font-size:.95rem; color:var(--tone-ink); font-variant-numeric:tabular-nums; }
.scheme p{ margin:0; font-size:.7rem; line-height:1.45; color:rgba(var(--tone-ink-rgb),.82); }
.scheme.is-no{ opacity:.78; }

/* ---- Charts (src/utils/charts.js) ---------------------------------------
   Marks carry the series colour; every piece of text uses the card ink. */
.ch{ margin:0; background:var(--frost); border-radius:14px; padding:12px 12px 10px; min-width:0; }
.ch-title{ font-size:.74rem; font-weight:700; color:var(--tone-ink); margin:0 0 2px; }
.ch-sub{ font-size:.66rem; color:rgba(var(--tone-ink-rgb),.7); margin-bottom:4px; }
.ch-plot{ position:relative; width:100%; min-width:0; margin-top:6px; }
.ch-svg{ display:block; overflow:visible; }
.ch-svg .ch-txt{ font:500 10.5px var(--font); fill:rgba(var(--tone-ink-rgb),.72); }
.ch-svg .ch-num{ font-variant-numeric:tabular-nums; }
.ch-svg .ch-note{ font-weight:600; fill:rgba(var(--tone-ink-rgb),.85); }
.ch-svg .ch-strong{ font-weight:700; fill:var(--tone-ink); }
.ch-svg .ch-grid{ stroke:rgba(var(--tone-ink-rgb),.1); stroke-width:1; }
.ch-svg .ch-zero{ stroke:rgba(var(--tone-ink-rgb),.4); stroke-width:1; }
.ch-svg .ch-ref{ stroke:rgba(var(--tone-ink-rgb),.45); stroke-width:1; }
.ch-svg .ch-cross{ stroke:rgba(var(--tone-ink-rgb),.5); stroke-width:1; pointer-events:none; }
.ch-svg .ch-band{ fill:rgba(var(--tone-ink-rgb),.07); }
.ch-svg .ch-hit{ cursor:crosshair; outline:none; }
.ch-svg .ch-hit:focus-visible{ stroke:var(--frame); stroke-width:2; }
.ch-svg .ch-mark{ outline:none; cursor:default; }
.ch-svg .ch-mark:hover, .ch-svg .ch-mark:focus-visible{ filter:brightness(1.12); }
.ch-tip{ display:none; position:absolute; z-index:5; pointer-events:none; min-width:120px; max-width:240px;
  background:#fff; border-radius:10px; padding:7px 10px; box-shadow:0 4px 16px rgba(0,0,0,.14);
  font-size:.68rem; color:var(--tone-ink); }
.ch-tip-h{ font-weight:700; margin-bottom:3px; color:rgba(var(--tone-ink-rgb),.75); }
.ch-tip-r{ display:flex; align-items:center; gap:6px; line-height:1.6; }
.ch-tip-r i{ width:12px; height:2px; border-radius:1px; flex:none; }
.ch-tip-r b{ font-variant-numeric:tabular-nums; }
.ch-tip-r span{ color:rgba(var(--tone-ink-rgb),.7); }
.ch-legend{ display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:8px; font-size:.68rem; color:rgba(var(--tone-ink-rgb),.85); }
.ch-legend span{ display:inline-flex; align-items:center; gap:6px; }
.ch-legend i{ width:10px; height:10px; border-radius:3px; display:inline-block; flex:none; }
.ch-legend i.line{ height:2px; width:14px; border-radius:1px; }
.ch-table{ margin-top:8px; }
.ch-table summary{ cursor:pointer; font-size:.68rem; font-weight:600; color:var(--tone-ink); width:max-content; }
.ch-table .table-wrap{ margin-top:6px; background:rgba(255,255,255,.4); }

/* tall segmented bar: one whole split into parts */
.segbar{ display:flex; gap:2px; height:28px; margin-top:6px; }
.segbar-part{ display:flex; align-items:center; padding-left:8px; border-radius:4px; min-width:2px;
  font-size:.68rem; font-weight:700; white-space:nowrap; overflow:hidden; }

/* horizontal bars */
.hb{ display:grid; gap:6px; margin-top:6px; }
.hb-row{ display:grid; grid-template-columns:minmax(0,9.5em) minmax(0,1fr) auto; align-items:center; gap:10px;
  font-size:.7rem; color:rgba(var(--tone-ink-rgb),.85); border-radius:8px; padding:2px 4px; outline:none; }
.hb-row:focus-visible{ box-shadow:inset 0 0 0 2px var(--frame); }
.hb-row.is-current{ background:rgba(255,255,255,.6); font-weight:700; color:var(--tone-ink); }
.hb-label{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hb-track{ position:relative; height:14px; }
.hb-bar{ position:absolute; top:0; bottom:0; left:0; border-radius:0 4px 4px 0; min-width:2px; }
.hb-bar.neg{ border-radius:4px 0 0 4px; }
.hb-div .hb-track::before{ content:''; position:absolute; left:50%; top:-3px; bottom:-3px; width:1px; background:rgba(var(--tone-ink-rgb),.4); }
.hb-val{ font-variant-numeric:tabular-nums; font-weight:700; color:var(--tone-ink); text-align:right; min-width:5.5em; }
@media (max-width:420px){ .hb-row{ grid-template-columns:minmax(0,7em) minmax(0,1fr) auto; } }

/* LVR band position strip (LMI breakpoint finder) */
.lvr-strip{ position:relative; display:flex; gap:2px; height:26px; margin:22px 0 6px; }
.lvr-strip span{ flex:1 1 0; border-radius:4px; display:flex; align-items:center; justify-content:center;
  font-size:.6rem; font-weight:700; color:rgba(var(--tone-ink-rgb),.75); min-width:0; overflow:hidden; }
.lvr-strip span.is-current{ outline:2px solid var(--tone-ink); outline-offset:1px; color:var(--tone-ink); }
.lvr-pin{ position:absolute; top:-20px; transform:translateX(-50%); font-size:.62rem; font-weight:800; color:var(--tone-ink); white-space:nowrap; }
.lvr-pin::after{ content:''; position:absolute; left:50%; top:14px; width:2px; height:36px; margin-left:-1px; background:var(--tone-ink); }
.lvr-ends{ display:flex; justify-content:space-between; font-size:.6rem; color:rgba(var(--tone-ink-rgb),.65); }

/* breakpoint cards */
.bp-pair{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; }
@media (max-width:560px){ .bp-pair{ grid-template-columns:1fr; } }
.bp{ background:rgba(255,255,255,.6); border-radius:14px; padding:12px 14px; display:grid; gap:3px; }
.bp .cap{ font-size:.62rem; text-transform:uppercase; letter-spacing:.05em; font-weight:700; color:rgba(var(--tone-ink-rgb),.65); }
.bp .num{ font-size:1.05rem; font-weight:800; color:var(--tone-ink); }
.bp p{ margin:0; font-size:.7rem; line-height:1.45; color:rgba(var(--tone-ink-rgb),.85); }
.bp.warn{ background:#f7e4cf; box-shadow:inset 3px 0 0 #d9772f; }
.section-h{ font-size:.66rem; text-transform:uppercase; letter-spacing:.07em; color:rgba(var(--tone-ink-rgb),.65); font-weight:800; margin:6px 0 -2px; }
.data-table td.is-best{ background:rgba(42,99,168,.12); font-weight:700; }

/* ---- Compact layout (spec.layout = 'compact'; preview on the deposit planner)
   Inputs two to a row, sliders with the exact-value box beside the label, and
   results as side-by-side headline figures + small tiles. Sized by the card's
   own width (container queries), so it adapts wherever the card is placed. */
.calc--compact{ container-type:inline-size; padding:18px 20px; }
.calc--compact .calc-body{ grid-template-columns:minmax(0,1fr) !important; gap:18px; }
.calc--compact .io-inputs{ display:grid; grid-template-columns:minmax(0,1fr); gap:10px; }
.calc--compact .io-inputs > h4{ grid-column:1 / -1; }
.calc--compact .field{ padding:10px 12px; }
.calc--compact .field label, .calc--compact .field .field-label{ margin-bottom:6px; }
.calc--compact .field--slider{ display:grid; grid-template-columns:minmax(0,1fr) 118px; column-gap:10px; align-items:center; }
.calc--compact .field--slider .field-label{ grid-column:1; grid-row:1; margin:0; }
.calc--compact .field--slider .slider-val{ display:none; }
.calc--compact .field--slider .keyin{ grid-column:2; grid-row:1; }
.calc--compact .field--slider input[type=range]{ grid-column:1 / -1; grid-row:2; margin-top:10px; width:100%; }
.calc--compact .field--slider .hint{ grid-column:1 / -1; }
.calc--compact .keyin input{ padding:6px 4px; font-size:.84rem; }
.calc--compact .segmented button{ padding-left:4px; padding-right:4px; }
.calc--compact .io-inputs > .calc-btn{ align-self:end; min-height:44px; }
.calc--compact .results{ gap:10px; }
.calc--compact .hero-metric{ padding:14px 16px; }
@container (min-width:560px){
  .calc--compact .io-inputs{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .calc--compact .io-inputs > .span-2{ grid-column:1 / -1; }
}

.pair{ display:grid; grid-template-columns:minmax(0,1fr); gap:10px; }
@container (min-width:520px){ .pair{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); } }
.pair > *{ min-width:0; }
.kpis{ display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:8px; }
.kpi{ background:var(--frost); border-radius:12px; padding:10px 12px; display:grid; gap:2px; min-width:0; }
.kpi .cap{ font-size:.62rem; text-transform:uppercase; letter-spacing:.05em; font-weight:700; color:rgba(var(--tone-ink-rgb),.65); }
.kpi .num{ font-size:1rem; font-weight:800; color:var(--tone-ink); font-variant-numeric:tabular-nums; }
.kpi .num.green{ color:var(--accent-green); }
.kpi .sub{ font-size:.64rem; color:rgba(var(--tone-ink-rgb),.7); }
.calc--compact .pair .hero-metric .val{ font-size:clamp(1.35rem, 5.2cqi, 1.9rem); line-height:1.15; }

/* Compact results: runs of label/value rows in two columns (calculator.js packResults). */
.stat-grid{ display:grid; grid-template-columns:minmax(0,1fr); gap:8px 10px; }
@container (min-width:520px){ .stat-grid{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); } }
.stat-grid > .stat-row{ min-width:0; height:100%; box-sizing:border-box; }
.keyin .suffix{ font-size:.74rem; color:rgba(var(--tone-ink-rgb),.6); white-space:nowrap; padding-left:2px; }
