﻿/* ==================================================================
   cm-pages.css — page types cm-base.css never had.
   ------------------------------------------------------------------
   cm-base.css is the inherited design system: tokens, header, footer,
   buttons, cards, hero, FAQ, category chrome. It knows nothing about
   calculator pages, because none existed when it was written.

   Everything here uses the SAME tokens (--bg-primary, --accent, …) so
   both themes work with no extra work. Never introduce a hex code.
   Per-calculator styles are prefixed (ci-, bmi-, pc-) so 1,000 of them
   can share one stylesheet without colliding — _theme.js R3.
   ================================================================== */

/* [hidden] must win over any display rule. A class like .bmi-grid{display:grid}
   beats the UA's [hidden]{display:none}, so an element toggled with el.hidden
   stays visible — the BMI calculator showed both unit panels at once until
   this was added. */
[hidden] { display: none !important; }

/* ---------- Homepage additions ---------- */
.hero-copy { min-width: 0; }
.hero-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--card-shadow);
}
.hero-panel-h { font-size: 15px; font-weight: 700; color: var(--text-medium);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 18px; }
.hero-stats { display: grid; gap: 14px; margin: 0 0 18px; }
.hero-stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.hero-stats > div:last-child { border-bottom: 0; padding-bottom: 0; }
.hero-stats dt { font-size: 14.5px; color: var(--text-medium); }
.hero-stats dd { font-size: 30px; font-weight: 800; color: var(--text-heading); line-height: 1; }
.hero-panel-note { font-size: 13.5px; color: var(--text-medium); line-height: 1.6; }
.hero-panel-note a { color: var(--accent); font-weight: 600; }

.cat-group { margin-bottom: 40px; }
.cat-group-name { font-size: 19px; font-weight: 700; color: var(--text-heading);
  margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* ---------- Homepage "C+" (RELEASE_PLAN.md R1, S40) ----------
   The hero carries the same graph paper as the calculator card, so the
   homepage and the tool pages read as one design. Tokens only — both
   themes work with no per-mode rule. Inputs compute to 16px (Hard Rule 16). */
.hero-home {
  background-image:
    linear-gradient(var(--grid-hero) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-hero) 1px, transparent 1px),
    linear-gradient(var(--grid-hero-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-hero-minor) 1px, transparent 1px),
    linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  background-size: 24px 24px, 24px 24px, 12px 12px, 12px 12px, auto;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px, 0 0;
  border-bottom: 1px solid var(--border);
}
.hero-home .hero-badge { gap: 6px; }
.hero-home .hero-features { margin-bottom: 26px; }
.hero-home .hero-features li::before {
  content: "✓"; display: inline-flex; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: rgba(22,163,74,.12); color: var(--success); font-size: 12px; font-weight: 800;
  align-items: center; justify-content: center;
}
.hero-jump { margin-top: 18px; font-size: 13.5px; color: var(--text-medium); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.hero-jump a { font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.hero-jump a:hover { background: var(--accent); color: #fff; }

/* the try-it card */
.hero-try { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: clip; }
.ht-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 0 12px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.ht-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ht-tabs::-webkit-scrollbar { display: none; }
.ht-tabs [role="tab"] { appearance: none; border: 0; background: transparent; font: 600 13.5px var(--font-body); color: var(--text-medium); padding: 8px 12px 10px; border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ht-tabs [role="tab"]:hover { color: var(--text-heading); }
.ht-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }
.ht-tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ht-live { font-size: 12px; font-weight: 600; color: var(--success); white-space: nowrap; padding-bottom: 8px; }
.ht-panel { padding: 18px 20px; min-height: 372px; }
.ht-loading, .ht-panel .calc-error { font-size: 14px; color: var(--text-medium); margin: 0; min-height: 120px; display: flex; align-items: center; }
.ht-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.ht-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-medium); min-width: 0; }
.ht-field input, .ht-field select { font: 16px var(--font-body); padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--bg-primary); color: var(--text-light); width: 100%; min-width: 0; }
.ht-field input:focus, .ht-field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ht-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ht-result { margin-top: 14px; background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: end; }
.ht-lbl { display: block; font-size: 12px; color: var(--text-medium); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ht-lbl em { font-style: normal; }
.ht-big { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--text-heading); line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.ht-big.ht-accent { color: var(--accent); }
.ht-sub { font-size: 13px; color: var(--text-light); }
.ht-bars { display: flex; align-items: flex-end; gap: 3px; height: 60px; margin-top: 12px; }
.ht-bars i { flex: 1; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; min-height: 2px; }
.ht-stack { display: flex; height: 26px; margin-top: 12px; border-radius: 8px; overflow: hidden; background: var(--bg-secondary); }
.ht-stack i { display: flex; align-items: center; justify-content: center; font: 600 11px var(--font-body); color: #fff; overflow: hidden; white-space: nowrap; min-width: 0; }
.ht-stack i span { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.ht-stack .ht-s1 { background: var(--success); } .ht-stack .ht-s2 { background: var(--accent); }
.ht-stack .ht-s3 { background: var(--logo-minus-bg); } .ht-stack .ht-s4 { background: var(--logo-multiply-bg); }
.ht-scale { margin-top: 14px; }
.ht-track { position: relative; display: flex; height: 10px; border-radius: 6px; overflow: visible; }
.ht-seg { flex: 1; } .ht-seg:first-child { border-radius: 6px 0 0 6px; } .ht-seg:last-child { border-radius: 0 6px 6px 0; }
.ht-seg.bmi-under { flex: 3.5; background: var(--accent); } .ht-seg.bmi-healthy { flex: 6.5; background: var(--success); }
.ht-seg.bmi-over { flex: 5; background: var(--star); } .ht-seg.bmi-obese { flex: 10; background: var(--danger); }
.ht-marker { position: absolute; top: -5px; width: 6px; height: 20px; margin-left: -3px; background: var(--text-heading); border-radius: 3px; box-shadow: 0 0 0 2px var(--surface), 0 1px 4px rgba(0,0,0,.35); transition: left .2s ease; }
.ht-ticks { position: relative; height: 14px; font-size: 11px; color: var(--text-medium); margin-top: 6px; }
.ht-ticks span { position: absolute; transform: translateX(-50%); }
.ht-ticks span:first-child { transform: none; } .ht-ticks span:last-child { transform: translateX(-100%); }
.ht-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-medium); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 14px; }
.ht-foot a { font-weight: 600; color: var(--accent); white-space: nowrap; }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 10px; text-align: center; }
.stat-card .sn { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-card .sl { display: block; font-size: 12.5px; color: var(--text-medium); margin-top: 4px; }

/* sections */
.why { padding: var(--section-pad); background: var(--bg-primary); }
.why-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.why-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px; }
.why-card .wi { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--accent); }
.why-card .wi svg { display: block; }
.why-card h3 { font-size: 16.5px; margin-bottom: 6px; color: var(--text-heading); }
.why-card p { font-size: 14px; color: var(--text-medium); line-height: 1.55; }
.popular-cta { text-align: center; margin-top: 28px; }
.category-soon { border-style: dashed; }
.category-soon .cat-count { color: var(--text-medium); }
.next { padding: var(--section-pad); background: var(--bg-primary); }
.next-band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 30px; }
.next-h { font-size: 22px; margin-bottom: 8px; color: var(--text-heading); text-align: start; }
.next-band p { color: var(--text-medium); font-size: 15px; line-height: 1.6; }
.next-band p a { font-weight: 600; color: var(--accent); }
.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.next-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--bg-secondary); color: var(--text-light); }
.next-list li span { color: var(--text-medium); font-size: 12.5px; white-space: nowrap; }
body.home .section-subtitle { max-width: 640px; margin-left: auto; margin-right: auto; }

@media (max-width: 1024px) {
  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .next-band { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  /* Phone order (same breakpoint as cm-base's one-column hero): copy → CTAs
     → the try-it card → chips → tiles. The copy column dissolves into the
     hero grid so the card can sit above the chips; the grid gap goes to 0 and
     the blocks keep their own margins; the last two check items are dropped
     to shorten the run to the tool. */
  .hero-home .hero-grid { gap: 0; }
  .hero-home .hero-copy { display: contents; }
  .hero-home .hero-ctas { margin-bottom: 22px; }
  .hero-home .hero-visual { margin-bottom: 20px; }
  .hero-home .hero-jump { order: 1; margin-top: 0; }
  .hero-home .hero-features li:nth-child(n+5) { display: none; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ht-result { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .ht-head { padding-left: 8px; padding-right: 8px; }
  .ht-live { display: none; }
  .ht-panel { padding: 14px 14px; }
  .hero-home .hero-jump { font-size: 13px; }
}

/* ---------- Ad slots (R4) — markers today, units on activation ----------
   Hidden until SITE.thirdParty.ads is enabled; then a fixed min-height is
   set inline by the build so the unit never moves the page. */
.ad-slot { display: flex; justify-content: center; align-items: center; margin: 28px auto; max-width: var(--container); padding: 0 var(--gutter); }
.ad-slot[hidden] { display: none; }
.ad-slot > ins { width: 100%; }

/* ---------- THE PAGE BAND — every page opens with this ----------
   FROZEN 08-Sep-2026 (S6h), owner-approved. Changing it is a design
   decision the owner takes, not a fix made on the way past — Hard Rule 27.

   Breadcrumb, then ONE row: optional category emoji · H1 with its last
   word in the accent colour · the type pill pushed to the extreme right.
   Then one 70ch line, an optional second line, the tick line and the
   CTAs — all at the page gutter, with the four operator glyphs faint
   behind (130px here, 200px in the tall band). On a phone the H1 takes a
   full basis of its own, so the row reads emoji + pill and the H1 drops
   beneath: the same three elements, one fewer line.

   The CALCULATOR page adds `.band-tall` and hangs its full-width card off
   the same band: inputs ("ledger") 5 cols, results ("report") 7 cols,
   graph paper inside the card only. Engines are untouched — every engine
   renders <form> then its -out element and the shell lays them out by
   position; a third element (the year control) joins the ledger column.

   generate.js has ONE builder for all of it, pageBand(); the slot list is
   _theme.js SHELL and the measurements are LAYOUT.band / LAYOUT.calcCard.
   Nothing else may open a page.                                         */
.page-band { position: relative; padding: 0 0 40px; background: var(--bg-primary); overflow: hidden; }
.page-band .container { position: relative; z-index: 1; max-width: var(--container-outer); padding: 0 var(--gutter); }
/* The breadcrumb is INSIDE that container, so it must not add a second gutter. */
.page-band .breadcrumbs { max-width: none; margin: 0 0 14px; padding: 18px 0 0; }
/* A band with no breadcrumb above it (404) would otherwise start its H1
   hard against the header. */
.page-band .band-h1row:first-child { margin-top: 26px; }
/* One row: emoji, H1, then the pill at the extreme right. Three items and
   `space-between` would strand the H1 in the middle, so the row packs from
   the start and the pill is pushed right by an auto margin. */
.band-h1row { display: flex; align-items: center; justify-content: flex-start; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.band-h1row .calc-pill { margin-left: auto; }
.page-band h1 { font-size: 44px; font-weight: 700; line-height: 1.05; color: var(--text-heading); }
.page-band h1 em { font-style: normal; color: var(--accent); }
/* The category mark sits inline before the H1, on the same row as the pill,
   at every width. On a phone the H1 takes a full basis of its own, so the
   row reads emoji + pill, then the H1 beneath. */
.band-emoji { font-size: 36px; line-height: 1; flex: 0 0 auto; margin: 0; }
.band-desc { font-size: 16.5px; color: var(--text-medium); max-width: 70ch; line-height: 1.6; margin-top: 10px; }
.page-band .hero-ctas { justify-content: flex-start; margin-top: 18px; }
.page-band:not(.band-tall) { padding-bottom: 34px; }
.calc-pill { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1 var(--font-mono);
  letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; padding: 10px 16px; border-radius: 999px;
  color: color-mix(in srgb, var(--success) 60%, var(--text-heading));
  background: color-mix(in srgb, var(--success) 16%, var(--bg-primary));
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--success) 85%, transparent),
              0 0 0 5px color-mix(in srgb, var(--success) 14%, transparent),
              0 4px 18px color-mix(in srgb, var(--success) 30%, transparent); }
body.dark-mode .calc-pill { color: color-mix(in srgb, var(--success) 75%, var(--text-heading));
  background: color-mix(in srgb, var(--success) 10%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 55%, transparent), 0 0 18px color-mix(in srgb, var(--success) 28%, transparent); }
.band-sub { font-size: 17.5px; color: var(--text-muted); max-width: 70ch; line-height: 1.5; }
.band-sub a { font-weight: 600; }
.calc-ticks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 24px; font-size: 13.5px; color: var(--text-medium); }
.calc-ticks li { display: inline-flex; align-items: center; gap: 6px; }
.calc-ticks li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); flex-shrink: 0; }
/* The four operators, faint, behind the band — the one flourish, and the
   only decoration on the site. Sized to the band: the calculator band is
   about three times the height of a page band, so it draws them larger
   rather than differently — same shapes, same corners, one design. */
.calc-ops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.calc-ops span { position: absolute; font: 700 130px/1 var(--font-display); opacity: .07; user-select: none; }
.calc-ops .op-plus { color: var(--c1); left: -20px; top: -45px; }
.calc-ops .op-minus { color: var(--c4); right: 36%; top: -58px; }
.calc-ops .op-times { color: var(--c3); right: -26px; bottom: -71px; }
.calc-ops .op-divide { color: var(--c2); left: 34%; bottom: -78px; }
/* Cropped, a minus is a rectangle and a divide is a dot. The short band
   carries only the two that still read as operators. */
.page-band:not(.band-tall) .calc-ops .op-minus,
.page-band:not(.band-tall) .calc-ops .op-divide { display: none; }
.page-band:not(.band-tall) .calc-ops .op-plus { left: -26px; top: -38px; }
.page-band:not(.band-tall) .calc-ops .op-times { right: -34px; bottom: -46px; }
.band-tall .calc-ops span { font-size: 200px; }
.band-tall .calc-ops .op-plus { left: -30px; top: -70px; }
.band-tall .calc-ops .op-minus { right: 36%; top: -90px; }
.band-tall .calc-ops .op-times { right: -40px; bottom: -110px; }
.band-tall .calc-ops .op-divide { left: 34%; bottom: -120px; }

/* The card: graph paper inside, never on the page ground. */
.calc-tool {
  position: relative; z-index: 2; margin: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background-color: var(--surface);
  background-image: linear-gradient(var(--grid-card) 1px, transparent 1px), linear-gradient(90deg, var(--grid-card) 1px, transparent 1px),
    linear-gradient(var(--grid-card-minor) 1px, transparent 1px), linear-gradient(90deg, var(--grid-card-minor) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 12px 12px, 12px 12px; background-position: -1px -1px;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow);
  overflow: clip;   /* not hidden — hidden would turn the card into a scroll container and break the sticky report */
}
.calc-tool > form { grid-column: 1; grid-row: 1; padding: 22px; border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.calc-tool > form + * { grid-column: 2; grid-row: 1 / span 2; padding: 22px; position: sticky; top: 82px; align-self: start; }
.calc-tool > form ~ * ~ * { grid-column: 1; grid-row: 2; padding: 0 22px 22px; border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.calc-tool > p, .calc-tool > noscript { grid-column: 1 / -1; padding: 22px; }
/* An engine may add ONE full-width block under both columns (chart, ledger…). */
.calc-tool > .calc-below { grid-column: 1 / -1; grid-row: 3; padding: 26px 22px 22px; border-top: 1px solid var(--border); background: none; border-right: 0; }
/* Shared below-actions row — used by every engine that adds Download/Print buttons */
.ra-below-actions {   /* bmi-/pc-/it-/sx- removed S52 — those engines use the shared ci-table-bar / ci-below-actions */
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end;
}
.calc-tool label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-heading); }
.calc-tool input[type="number"], .calc-tool input[type="text"], .calc-tool select {
  /* >= 16px or iOS Safari force-zooms on focus — _theme.js TYPE.minInput */
  font-size: 16px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-heading); min-height: 44px; width: 100%;
}
.calc-tool select { font-family: var(--font-body); }
.calc-tool input:focus-visible, .calc-tool select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.calc-tool table { width: 100%; border-collapse: collapse; }
.calc-tool th, .calc-tool td { padding: 9px 10px; text-align: end; border-bottom: 1px solid var(--border);
  font-size: 14.5px; color: var(--text-light); font-variant-numeric: tabular-nums; }
.calc-tool td { font-family: var(--font-mono); font-size: 13.5px; }
.calc-tool thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-medium); border-bottom-width: 2px; }
.calc-tool tbody th[scope="row"] { text-align: start; font-weight: 500; color: var(--text-light); }
.calc-tool strong, .calc-tool b { font-variant-numeric: tabular-nums; }
.calc-loading, .calc-error { padding: 16px; border-radius: 10px; font-size: 14.5px; }
.calc-loading { color: var(--text-medium); }
.calc-error { background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.35); color: var(--danger); }
/* Rule R7: an estimate says so beside the result, not in a footnote. */
.calc-estimate-note { margin-top: 14px; font-size: 12.5px; line-height: 1.6; color: var(--text-medium); }

/* Formula / examples / guide / provenance */
.calc-formula, .calc-examples, .calc-guide, .calc-provenance { padding: var(--section-pad); }
.calc-formula { background: var(--bg-secondary); }
/* ---------- THE EDITORIAL BLOCKS (S7) ----------
   Adopted from the owner's reference build: a two-column spread for the
   methodology and the sources, and a two-column grid of native <details>
   for the FAQ. The left rail carries the section's identity — kicker, big
   heading, one lede, one jump link — and the right column carries the
   reading. Colour and type come from our tokens (Hard Rule 24); only the
   layout and the rhythm are the reference's.

   `.guide-rail` and `.sources-rail` are the same component at two sizes.
   Both collapse to one column at 900px, rail first.                     */
.calc-guide .container, .calc-provenance .container { display: grid;
  grid-template-columns: minmax(240px, .66fr) minmax(0, 1.34fr); gap: 24px 64px; }
.guide-rail .panel-kicker, .calc-provenance .panel-kicker {
  font: 500 11px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .1em;
  color: var(--success); margin-bottom: 6px; }
.guide-rail h2 { font-size: 38px; line-height: 1.04; letter-spacing: -.03em;
  color: var(--text-heading); margin: 0 0 16px; }
.guide-rail .guide-lede { color: var(--text-medium); font-size: 14.5px; line-height: 1.6; margin: 0 0 16px; }
.guide-rail .guide-jump { color: var(--accent); font-size: 13px; font-weight: 600; }
.guide-body { display: grid; gap: 30px; }
.guide-body > section { margin: 0; }
.guide-body h3 { font-family: var(--font-serif); font-weight: 600; font-size: 25px;
  line-height: 1.2; letter-spacing: -.015em; color: var(--text-heading); margin: 0 0 10px; }
.guide-body p { color: var(--text-muted); font-size: 15.5px; line-height: 1.7; margin: 0 0 12px; max-width: 72ch; }
.guide-body p:last-child { margin-bottom: 0; }
.guide-body strong { color: var(--text-heading); font-weight: 600; }
.guide-body em { font-family: var(--font-serif); font-style: italic; color: var(--text-light); }

/* The FAQ: native <details>, so an answer opens with JavaScript off. */
.faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.faq-grid details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  padding: 0 18px; transition: border-color var(--transition); }
.faq-grid details[open] { border-color: var(--accent); }
.faq-grid summary { list-style: none; cursor: pointer; position: relative;
  padding: 17px 30px 17px 0; font-size: 15px; font-weight: 600; color: var(--text-heading); }
.faq-grid summary::-webkit-details-marker { display: none; }
.faq-grid summary::after { content: "+"; position: absolute; inset-inline-end: 0; top: 50%;
  transform: translateY(-50%); color: var(--success); font: 400 22px/1 var(--font-body); }
.faq-grid details[open] summary::after { content: "\2212"; }
.faq-grid summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.faq-grid p { color: var(--text-muted); font-size: 14.5px; line-height: 1.65; margin: 0 0 18px; }

/* Sources: the guide's rail at a smaller size, plus the disclaimer callout. */
.calc-provenance h2 { font-size: 32px; line-height: 1.05; letter-spacing: -.03em;
  color: var(--text-heading); margin: 0; }
.provenance-body p { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; margin: 0 0 14px; max-width: 72ch; }
.provenance-body .sources { margin: 0 0 16px; padding-inline-start: 20px; }
.provenance-body .sources li { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; }
.provenance-body .byline { color: var(--text-medium); font-size: 13.5px; }
.disclaimer { padding: 14px 16px; border-inline-start: 3px solid var(--star);
  background: color-mix(in srgb, var(--star) 8%, transparent); border-radius: 0 8px 8px 0;
  color: var(--text-medium); font-size: 14px; line-height: 1.6; }
.disclaimer strong { color: var(--text-heading); }

@media (max-width: 900px) {
  .calc-guide .container, .calc-provenance .container { grid-template-columns: 1fr; gap: 26px; }
  .guide-rail h2 { font-size: 32px; }
  .calc-provenance h2 { font-size: 28px; }
  .faq-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .guide-body h3 { font-size: 22px; }
  .guide-body p { font-size: 15px; }
}

/* S6: these sections use the page container so their headings start at the
   same left edge as the H1 and the card; the TEXT inside keeps a reading
   measure of its own. */
.calc-formula .container, .calc-examples .container, .calc-provenance .container { max-width: var(--container); }
.calc-guide .container { max-width: var(--container); margin: 0 auto; }
.formula-label, .formula-box, .formula-note, .howto, .example, .sources, .byline { max-width: 76ch; }
.calc-formula .section-title, .calc-examples .section-title, .calc-provenance .section-title { text-align: start; }
.formula-label { font-size: 14px; font-weight: 600; color: var(--text-medium); margin-bottom: 10px; }
.formula-box { background: #000; border: 1px solid #000; border-radius: 10px;
  padding: 16px 18px; overflow-x: auto; margin-bottom: 14px; }
.formula-box code { font-family: var(--font-mono);
  font-size: 14.5px; color: #fff; white-space: pre; }
.formula-note { font-size: 14.5px; color: var(--text-medium); line-height: 1.7; margin-bottom: 24px; }
.calc-formula h3 { font-size: 18px; font-weight: 700; color: var(--text-heading); margin-bottom: 12px; }
.howto { margin: 0 0 0 20px; display: grid; gap: 8px; }
.howto li { font-size: 15px; color: var(--text-light); line-height: 1.65; }

.example { border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; background: var(--surface); }
.example h3 { font-size: 16.5px; font-weight: 700; color: var(--text-heading); margin-bottom: 12px; }
.example-steps { margin: 0 0 12px 20px; display: grid; gap: 6px; }
.example-steps li { font-size: 14px; color: var(--text-medium); }
.example-steps code { font-family: var(--font-mono); font-size: 13.5px; }
.example-result { font-size: 15.5px; color: var(--success); }


.calc-provenance { background: var(--bg-secondary); }
.sources { margin: 0 0 20px 20px; display: grid; gap: 8px; }
.sources li { font-size: 14.5px; color: var(--text-medium); line-height: 1.6; }
.sources a { color: var(--accent); }
.byline { font-size: 14px; color: var(--text-medium); padding-top: 16px; border-top: 1px solid var(--border); }
.byline a { color: var(--accent); font-weight: 600; }

/* ---------- /categories/ — the type index (pillar page) ---------- */
.type-group { margin-bottom: 36px; }
.type-group h2 { font-size: 22px; font-weight: 700; color: var(--text-heading); margin-bottom: 4px; }
.tg-meta { font-size: 12.5px; font-family: var(--font-mono); color: var(--text-medium); margin-bottom: 14px; }
.type-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.type-cats li { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); font-size: 14.5px; color: var(--text-light); transition: border-color var(--transition); }
.type-cats li.ti-planned { background: none; border-style: dashed; color: var(--text-medium); }
.type-cats li.ti-live:hover { border-color: var(--accent); }
.type-cats a { display: flex; align-items: center; gap: 9px; width: 100%; color: inherit; }
.type-cats a:hover { color: var(--accent); }
.ti-name { flex: 1; }
.ti-n { font-family: var(--font-mono); font-size: 12px; color: var(--text-medium); white-space: nowrap; }
.ti-live .ti-n { color: var(--success); }
@media (max-width: 560px) { .type-cats { grid-template-columns: 1fr; } }

/* ---------- Roadmap ---------- */
.roadmap-list { margin: 0 0 28px; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.roadmap-list summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 15px; }
.roadmap-items { columns: 2; column-gap: 32px; margin: 16px 0 0 18px; }
.roadmap-items li { font-size: 14px; color: var(--text-medium); line-height: 1.9; break-inside: avoid; }
.rm-live { font-size: 11px; font-weight: 700; color: var(--success); text-transform: uppercase; letter-spacing: .06em; }
.rm-planned { font-size: 11px; color: var(--text-medium); opacity: .6; text-transform: uppercase; letter-spacing: .06em; }
.grid-note { text-align: start; max-width: 76ch; margin-top: 26px; font-size: 14.5px; color: var(--text-medium); }
.grid-note a { color: var(--accent); font-weight: 600; }

/* ==================================================================
   Calculator components — one prefix each.
   ================================================================== */

/* ---------- ci-  compound interest (reference "Precision Ledger" card, S5) ---------- */
.ci-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.ci-kicker { margin: 0 0 4px; font: 700 11px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--kicker); }
.ci-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.ci-panel-heading h2 { font-size: 23px; font-weight: 700; color: var(--text-heading); margin: 5px 0 0; }
.ci-text-button { display: inline-flex; align-items: center; gap: 7px; border: 2px solid transparent; border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 700; font-family: var(--font-body); cursor: pointer; text-decoration: none; transition: background .16s ease, border-color .16s ease, box-shadow .16s ease; white-space: nowrap; }
.ci-csv  { background: var(--download, #00693C); color: #fff; border-color: var(--download, #00693C); }
.ci-csv:hover, .ci-csv:focus-visible  { background: transparent; color: var(--download-hover, #2DBA6E); border-color: var(--download-hover, #2DBA6E); box-shadow: 0 0 0 3px var(--download-soft, rgba(45,186,110,.18)); }
.ci-print { background: transparent; color: var(--accent); border-color: var(--accent); }
.ci-print:hover, .ci-print:focus-visible { background: var(--accent); color: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
/* Share — brand-green filled, ghost hover; matches pa-share */
.ci-share { background: var(--download, #00693C); color: #fff; border-color: var(--download, #00693C); }
.ci-share:hover, .ci-share:focus-visible { background: transparent; color: var(--download-hover, #2DBA6E); border-color: var(--download-hover, #2DBA6E); box-shadow: 0 0 0 3px var(--download-soft, rgba(45,186,110,.18)); }
/* Reset — a quiet ghost pill that is still visibly a button (S50: it was the
   browser's default grey button before). Same base as every text button. */
/* Reset — tinted pill (owner decision S51, option B): clearly a button at rest, subordinate to the primary;
   hover/focus fills to the accent. Same rule on every calculator; never restyled per engine. */
.ci-reset { background: var(--accent-soft); color: var(--accent); border-color: transparent; padding: 7px 14px; }
.ci-reset:hover, .ci-reset:focus-visible { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ci-privacy-line { font-size: 12px; color: var(--text-medium); margin: 8px 0 23px; }
.ci-privacy-line span { color: var(--kicker); font-size: 15px; margin-right: 4px; }
.ci-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.ci-field { display: grid; gap: 6px; color: var(--text-medium); font-size: 12px; font-weight: 500; }
.ci-field > span:first-child { min-height: 18px; display: flex; align-items: center; gap: 4px; }
.ci-input-wrap, .ci-select-wrap { height: 45px; display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); transition: border-color .18s ease, box-shadow .18s ease; }
.ci-input-wrap:focus-within, .ci-select-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.calc-tool .ci-input-wrap input, .calc-tool .ci-select-wrap select { min-width: 0; width: 100%; height: 100%; min-height: 0; border: 0; outline: 0;
  background: transparent; color: var(--text-heading); padding: 0 10px; font: 500 16px var(--font-body); border-radius: 8px; }
.calc-tool .ci-input-wrap input:focus-visible, .calc-tool .ci-select-wrap select:focus-visible { outline: none; }
.ci-input-wrap b { font: 500 12px var(--font-mono); color: var(--text-medium); padding-right: 10px; white-space: nowrap; }
.ci-hint { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-medium); font: 500 9px/1 var(--font-mono); padding: 0; }
.ci-timing { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 16px; padding: 0; border: 0; }
.ci-timing legend { padding: 0 0 6px; color: var(--text-medium); font-size: 12px; }
.ci-timing label { flex: 1; min-width: 120px; position: relative; display: block; }
.ci-timing input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ci-timing span { display: block; padding: 8px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-medium); font-size: 12px; text-align: center; transition: .16s ease; }
.ci-timing input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text-heading); }
.ci-timing input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.ci-advanced { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 13px 0; }
.ci-advanced summary { list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--text-heading); font-size: 13px; font-weight: 600; cursor: pointer; }
.ci-advanced summary::-webkit-details-marker { display: none; }
.ci-advanced summary i { color: var(--accent); font-style: normal; font-size: 18px; margin-right: 7px; display: inline-block; }
.ci-advanced[open] summary i { transform: rotate(45deg); }
.ci-advanced summary small { color: var(--text-medium); font-weight: 400; font-size: 11px; }
.ci-advanced-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; margin-top: 17px; }
.ci-advanced p { margin: 13px 0 0; color: var(--text-medium); font-size: 11px; line-height: 1.45; }
.ci-form-error { min-height: 0; margin: 0; color: var(--danger); font-size: 12px; }
.ci-form-error.visible { margin-top: 12px; }
.ci-actions { display: flex; gap: 9px; margin-top: 21px; }
.ci-primary, .ci-secondary { height: 43px; border-radius: 8px; padding: 0 13px; font-size: 13px; font-weight: 700; font-family: var(--font-body); transition: transform .16s ease; }
.ci-primary { flex: 1; border: 1px solid var(--accent); color: var(--on-accent); background: var(--accent); box-shadow: 0 9px 25px var(--accent-soft); }
.ci-secondary { border: 1px solid var(--border-strong); color: var(--text-heading); background: transparent; }
.ci-primary:active, .ci-secondary:active { transform: scale(.97); }

.ci-out { position: relative; }
.ci-topline { display: flex; align-items: center; gap: 7px; color: var(--text-medium); font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; }
.ci-asof { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--text-heading); }   /* S79 (owner): the horizon is vital — bold, heading colour */
.ci-live-dot { height: 7px; width: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); }
.ci-result-label { margin: 39px 0 3px; color: var(--text-medium); font-size: 14px; }
.ci-result-total { margin: 0; font: 700 clamp(45px, 5.6vw, 70px)/1 var(--font-display); letter-spacing: -.05em; color: var(--text-heading); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ci-result-detail { color: var(--text-medium); font-size: 12px; margin: 11px 0 25px; }
.ci-composition { padding: 14px 0 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ci-composition-bar { height: 10px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.ci-composition-bar span { height: 100%; transition: width .24s ease; }
.ci-bar-principal, .ci-key-principal { background: var(--c1); }
.ci-bar-contribution, .ci-key-contribution { background: var(--c2); }
.ci-bar-growth, .ci-key-growth { background: var(--c4); }
.ci-composition-key { display: flex; gap: 10px 17px; flex-wrap: wrap; margin-top: 10px; }
.ci-composition-key span { font-size: 11px; color: var(--text-medium); display: grid; grid-template-columns: 8px auto; column-gap: 5px; align-items: center; }
.ci-composition-key i { width: 7px; height: 7px; border-radius: 2px; }
.ci-composition-key b { grid-column: 2; color: var(--text-heading); font: 500 11px var(--font-mono); }
/* S52: separators are per-cell borders, not a background showing through a 1px gap — a short last row used to leave a grey block. */
.ci-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin-top: 21px; border: 1px solid var(--border); }
.ci-stat-grid div { padding: 13px; background: var(--surface); border-inline-end: 1px solid var(--border); border-block-end: 1px solid var(--border); margin: 0 0 -1px -1px; }
.ci-stat-grid div > small { display: block; margin-top: 3px; color: var(--text-medium); font-size: 10.5px; line-height: 1.4; }
.ci-stat-grid span { display: block; color: var(--text-medium); font-size: 11px; }
.ci-stat-grid b { font: 600 15px var(--font-mono); color: var(--text-heading); }
.ci-scenarios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 18px; }
.ci-scenarios > div { border: 1px solid var(--border); padding: 11px 10px; border-radius: 7px; background: var(--surface-2); }
.ci-scenarios .ci-scenario-base { border-color: var(--accent); background: var(--accent-soft); }
.ci-scenarios span, .ci-scenarios small { display: block; color: var(--text-medium); font-size: 10px; }
.ci-scenarios b { display: block; color: var(--text-heading); font: 500 15px var(--font-mono); margin: 1px 0; }
.ci-risk-note { margin: 17px 0 0; color: var(--text-medium); font-size: 11px; line-height: 1.5; }
.ci-risk-note strong { color: var(--c3); }
body:not(.dark-mode) .ci-risk-note strong { color: #B45309; }   /* S120: #F97316 on white was 2.8:1 at 11 px; amber-700 is 5.0:1 */

.ci-section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 8px; }
.ci-section-heading h3 { font-size: 20px; font-weight: 700; color: var(--text-heading); margin: 4px 0 0; }
.ci-section-heading > p { max-width: 42ch; color: var(--text-medium); font-size: 12.5px; line-height: 1.5; margin: 0; }
.ci-section-heading.ci-compact { margin-top: 34px; align-items: flex-end; }
.ci-chart-and-insights { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr); gap: 15px; margin-top: 22px; }
.ci-insight { border: 1px solid var(--border); background: var(--surface); padding: 20px; border-radius: 10px; }
.ci-chart-card { padding: 0; }   /* S52: the chart sits on the graph paper (VA reference) — no card, no white ground */
.ci-chart-title { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-medium); font-size: 11px; }
.ci-chart-title div { display: flex; align-items: center; gap: 6px; }
.ci-chart-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 8px var(--c1); }
.ci-chart-dot.ci-adjusted { background: var(--c3); box-shadow: none; }
.ci-chart-wrap { width: 100%; height: 284px; margin-top: 5px; }
.ci-chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.ci-grid-lines line { stroke: var(--border); stroke-width: 1; }
.ci-grid-lines text, .ci-axis-labels text { fill: var(--text-medium); font: 10px var(--font-mono); }
.ci-area-fill { fill: url(#ci-area); }
.ci-nominal-line { fill: none; stroke: var(--c1); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ci-adjusted-line { fill: none; stroke: var(--c3); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.ci-last-dot { fill: var(--c1); stroke: var(--surface); stroke-width: 3; }
.ci-insights { display: grid; gap: 15px; }
.ci-insight { display: flex; flex-direction: column; justify-content: center; }
.ci-insight-index { color: var(--success); font: 500 11px var(--font-mono); }
.ci-insight h4 { margin: 7px 0; font-size: 17px; font-weight: 700; color: var(--text-heading); }
.ci-insight p { margin: 0; color: var(--text-medium); font-size: 12px; line-height: 1.55; }
.ci-table-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.ci-table th, .ci-table td { white-space: nowrap; }
.ci-table tbody th { font-family: var(--font-mono); }
.ci-growth-cell { color: var(--success); }
.ci-table-note { margin: 11px 0 0; color: var(--text-medium); font-size: 11px; }

/* ---------- The below block — one look on every calculator (S52; reference: va-mortgage) ----------
   ci-section-heading (kicker + h3 | description) → ci-chart (the SVG, full width, ON the graph
   paper — never a white card) → ci-legend → details.ci-table-wrap > summary.ci-table-bar
   (Hard Rule 29: toggle flush-left, ci-below-actions flush-right with ci-csv | ci-print | ci-share)
   → ci-table-scroll > table.ci-table. Engines add their prefix beside these only as a JS hook. */
.ci-chart { width: 100%; margin: 0 0 6px; overflow-x: auto; }
.ci-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ci-chart svg text { fill: var(--text-medium); font: 10px var(--font-mono); }
.ci-legend { display: flex; flex-wrap: wrap; gap: 14px; font: 500 11px var(--font-body); color: var(--text-medium); margin: 0 0 8px; }
.ci-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; background: var(--c1); }
.ci-legend i.ci-c2 { background: var(--c2); } .ci-legend i.ci-c3 { background: var(--c3); } .ci-legend i.ci-c4 { background: var(--c4); }
.ci-table-wrap { margin-top: 6px; }
.ci-table-bar { display: flex; align-items: center; gap: 12px; width: 100%; list-style: none; cursor: pointer; background: transparent; padding: 0; min-height: 44px; }
.ci-table-bar::-webkit-details-marker { display: none; }
.ci-table-toggle { font: 600 13px var(--font-body); color: var(--accent); flex: 0 0 auto; }
.ci-table-toggle::before { content: '▶ '; font-size: 10px; }
.ci-table-wrap[open] > .ci-table-bar .ci-table-toggle::before { content: '▼ '; }
.ci-below-actions { display: inline-flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; margin-left: auto; }
.ci-below-actions button { pointer-events: auto; }
.ci-table-scroll { margin-top: 10px; overflow-x: auto; }
/* S120: phone charts. _ui.js gives a chart that would scale below 0.6 a minimum width (its text stays ≥ ~8 px)
   and marks the box; the hint says the chart scrolls. Engines that redraw at the container width never need it. */
.ci-chart.ci-chart-scrolls { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.ci-chart-hint { margin: 4px 0 8px; font: 500 11.5px var(--font-body); color: var(--text-medium); }
/* S118 (shared, from three audit workers): a wide table or chart below the card must never widen the
   card on a phone (the mobile track sizes to content, so the form was clipped invisibly), and the
   Rule 29 bar wraps under its toggle instead of running off the edge at 390 px. */
.calc-below { min-width: 0; }
.ci-table-scroll { width: 0; min-width: 100%; }
@media (max-width: 480px) { .ci-table-bar { flex-wrap: wrap; } .ci-below-actions { margin-left: 0; justify-content: flex-start; } }
.ci-table { width: 100%; border-collapse: collapse; font: 500 12.5px var(--font-body); color: var(--text-light); }
.ci-table th { text-align: right; padding: 6px 10px; font: 600 11.5px var(--font-body); color: var(--text-medium); border-bottom: 1px solid var(--border); }
.ci-table th:first-child, .ci-table td:first-child { text-align: left; }
.ci-table td { text-align: right; padding: 5px 10px; font: 500 12px var(--font-mono); color: var(--text-light); border-bottom: 1px solid var(--border); }
.ci-table tr:last-child td { border-bottom: none; }

/* Mode tabs — one look (S52; reference: balloon-payment). <div class="ci-mode-tabs" role="group"> of
   <label class="ci-mode-tab"><input type="radio" hidden>Text</label> or <button class="ci-mode-tab" aria-pressed>. */
.ci-mode-tabs { display: flex; gap: 0; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ci-mode-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; cursor: pointer; border: 0; margin: 0;
  font: 600 13.5px var(--font-body); color: var(--text-medium); background: var(--surface); transition: background .15s, color .15s; user-select: none; }
.ci-mode-tab:first-child { border-radius: 9px 0 0 9px; }
.ci-mode-tab:last-child  { border-radius: 0 9px 9px 0; }
.ci-mode-tab input[type="radio"] { display: none; }
.ci-mode-tab:has(input:checked), .ci-mode-tab.is-active, .ci-mode-tab[aria-pressed="true"], .ci-mode-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }   /* S120: --on-accent (white in light, ink in dark: white on #5B9AFF was 2.8:1) */
.ci-mode-tab:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--accent-soft); }
.ci-toast { position: fixed; z-index: 1500; left: 50%; bottom: 18px; transform: translate(-50%, 150%); opacity: 0; visibility: hidden; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-primary); color: var(--text-heading); box-shadow: var(--card-shadow); font-size: 13px;
  transition: transform .22s ease, opacity .22s ease, visibility .22s; max-width: calc(100% - 32px); }   /* S79: hidden state no longer leaves a 6px sliver at the viewport edge; opaque ground (S51): --surface is translucent on the card and washed the text out */
.ci-toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
/* S120: `.calc-tool > form ~ * ~ *` (0,1,1) also matches the toast div and beat `.ci-toast` (0,1,0), so the
   S51 opaque toast never shipped (translucent column ground, `0 22px 22px` padding, a right border). This
   (0,2,0) rule restores the toast's own box on every card without touching the layout rules. */
.calc-tool > .ci-toast { grid-column: auto; grid-row: auto; padding: 10px 14px; border: 1px solid var(--border-strong);
  background: var(--bg-primary); }

/* ---------- ci- monthly variant additions (S25) ----------
   Reuses ci- prefix throughout. No new prefix needed.    */

/* ci-pinned: disabled select that is preset by the variant */
.ci-select-wrap.ci-pinned select { opacity: .6; cursor: not-allowed; }
.ci-select-wrap.ci-pinned { border-style: dashed; }
.ci-select-wrap.ci-pinned::after { content: 'Preset'; font-size: 9px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--success);
  padding: 0 8px 0 4px; white-space: nowrap; }

/* ci-stat-grid 5-column rule */
.ci-stat-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* Solve-for panel */
.ci-solve-panel { margin: 20px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); }
.ci-solve-heading { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; font-size: 12.5px; font-weight: 600; color: var(--text-heading); margin-bottom: 12px; }
.ci-solve-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.ci-solve-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ci-solve-slider { display: inline-block; width: 38px; height: 21px; border-radius: 21px;
  background: var(--border-strong); transition: background .18s ease; position: relative; }
.ci-solve-slider::after { content: ''; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  transition: left .18s ease; }
.ci-solve-check:checked + .ci-solve-slider { background: var(--accent); }
.ci-solve-check:checked + .ci-solve-slider::after { left: 20px; }
.ci-solve-check:focus-visible + .ci-solve-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.ci-solve-fields { margin-top: 0; }
.ci-solve-result { margin: 10px 0 0; font-size: 13px; font-weight: 600;
  color: var(--accent); line-height: 1.5; padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 8px; border-left: 3px solid var(--accent); }

/* ci-monthly- table-bar/toggle/scroll rules removed S52 — the shared ci-table-wrap / ci-table-bar / ci-table-toggle / ci-table-scroll rules above apply to the monthly and quarterly variants */

@media (max-width: 900px) {
  .ci-chart-and-insights { grid-template-columns: 1fr; }
  .ci-insights { grid-template-columns: repeat(2, 1fr); }
  .ci-result-total { font-size: 47px; }
  .ci-scenarios { gap: 5px; }
  .ci-scenarios > div { padding: 9px 6px; }
  .ci-scenarios b { font-size: 12px; }
  .ci-chart-wrap { height: 240px; }
}
@media (max-width: 560px) {
  .ci-fields, .ci-advanced-grid { grid-template-columns: 1fr; }
  .ci-timing label { min-width: 0; }
  .ci-result-total { font-size: 41px; }
  .ci-scenarios { grid-template-columns: 1fr; }
  .ci-scenarios > div { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .ci-scenarios small { grid-column: 1; }
  .ci-scenarios b { grid-column: 2; grid-row: 1 / 3; }
  .ci-insights { grid-template-columns: 1fr; }
  .ci-section-heading { flex-direction: column; gap: 8px; }
}
@media print {
  .site-header, .ci-form, .ci-actions, .site-footer, .ci-toast, .calc-ops, .back-to-top { display: none !important; }
  .calc-tool { display: block; border: 0; box-shadow: none; background: none; }
  .calc-tool > form + * { position: static; }
}

/* ---------- pc-  paycheck ---------- */
/* pc- shell rules removed S51 (.pc-grid / .pc-toast from the shared lists above) — the shared ci- shell applies */
/* pc- below rules removed S52 (.pc-below-actions from the shared list above) — the shared ci- block applies (ci-chart, ci-table-bar) */
.pc-table tbody tr.pc-net th, .pc-table tbody tr.pc-net td {
  font-weight: 700; font-size: 16px; color: var(--success);
  border-top: 2px solid var(--border); border-bottom: 0; }
.pc-eff { margin-top: 12px; font-size: 14px; color: var(--text-medium); }
.pc-eff b { color: var(--text-heading); }
.pc-badge { margin: 12px 0 0; font-size: 12.5px; font-weight: 600;
  color: var(--success); text-align: end; }

/* ---------- bmi- ---------- */
/* bmi- shell rules removed S51 — the shared ci- shell applies (units = ci-mode-tabs, fields = ci-fields, headline = ci-result-total).
   S118 REFRESH: engine-own parts only — the band name in the detail line (text in --text-heading, the band colour on a dot,
   so amber/blue text never sits at 2:1 on the paper), the band-scale SVG, its legend keys and the active table row. */
.bmi-band-name { font-weight: 700; color: var(--text-heading); }
.bmi-band-name::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--border-strong); }
.bmi-band-name.bmi-under::before, .bmi-seg-under, .ci-legend i.bmi-k-under { background: var(--c1); fill: var(--c1); }
.bmi-band-name.bmi-healthy::before, .bmi-seg-healthy, .ci-legend i.bmi-k-healthy { background: var(--success); fill: var(--success); }
.bmi-band-name.bmi-over::before, .bmi-seg-over, .ci-legend i.bmi-k-over { background: var(--star); fill: var(--star); }
.bmi-band-name.bmi-ob1::before, .bmi-seg-ob1, .ci-legend i.bmi-k-ob1 { background: var(--c3); fill: var(--c3); }
.bmi-band-name.bmi-ob2::before, .bmi-seg-ob2, .ci-legend i.bmi-k-ob2 { background: var(--danger); fill: var(--danger); }
.bmi-band-name.bmi-ob3::before, .bmi-seg-ob3, .ci-legend i.bmi-k-ob3 { background: var(--c4); fill: var(--c4); }
.ci-legend i.bmi-k-shade { background: var(--success); opacity: .3; }
.bmi-healthy-shade { fill: var(--success); fill-opacity: .13; }
.bmi-chart, .bmi-table-scroll { width: 0; min-width: 100%; }   /* contributes no min-content width to the card grid; the SVG is drawn at this box's width (S120) */
.bmi-mark { fill: var(--text-heading); }
.bmi-mark-line { stroke: var(--text-heading); stroke-width: 1; }
.ci-chart svg text.bmi-mk { fill: var(--text-heading); font-weight: 700; }
.bmi-table tr.bmi-row-active td { color: var(--text-heading); font-weight: 700; background: var(--accent-soft); }


/* ---------- tx-  shared year control (cm-taxdata.js) ---------- */
.tx-year { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.tx-year label { flex: 0 0 auto; min-width: 180px; }
.tx-badge { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--success); line-height: 1.5; flex: 1; text-align: end; }
@media (max-width: 560px) { .tx-badge { text-align: start; } }

/* ---------- it-  income tax ---------- */
/* it- shell rules removed S51 — the shared ci- shell applies (form = ci-fields, headline = ci-result-total, columns = ci-stat-grid) */
/* it- below/kpi rules removed S52 — the shared ci- block applies (ci-stat-grid, ci-chart, ci-table-bar) */
.it-detail { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.it-detail summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); }
.it-step { font-size: 13.5px; color: var(--text-medium); margin: 10px 0 6px; }
/* The in-report bracket table scrolls sideways on a phone instead of widening the
   report column (S79 audit: it pushed the card to 490px at 390px wide). */
.it-scroll { overflow-x: auto; contain: inline-size; }
.it-table td, .it-table th { font-size: 13.5px; }
.it-table td:first-child { text-align: start; white-space: nowrap; }
.it-none, .it-note { font-size: 13.5px; color: var(--text-medium); margin: 8px 0; line-height: 1.6; }
/* Bracket chart / table: brackets above the reader's income (S79 audit) */
.ci-legend i.it-legend-unreached { background: var(--border-strong); }
.it-unreached td { color: var(--text-medium); opacity: .65; }

/* ---------- sx-  sales tax ---------- */
/* sx- shell rules removed S51 — the shared ci- shell applies (form = ci-fields, headline = ci-result-total, columns = ci-stat-grid) */
.sx-hint { font-size: 11.5px; font-weight: 400; color: var(--text-medium); line-height: 1.5; }   /* the state's average-local-rate note under the field — engine copy, not the shell hint button */
/* sx- below/kpi rules removed S52 — the shared ci- block applies (ci-stat-grid, ci-chart, ci-table-bar) */
.sx-note { font-size: 13px; color: var(--text-medium); margin: 6px 0; line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .calc-tool { grid-template-columns: minmax(0, 1fr); }   /* S118b: plain 1fr has an auto (min-content) minimum, so one fixed-width SVG or wide table stretched the whole card past the screen on six pages */
  .calc-tool > form { grid-column: 1; grid-row: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .calc-tool > form + * { grid-column: 1; grid-row: auto; position: static; }
  .calc-tool > form ~ * ~ * { grid-column: 1; grid-row: auto; border-right: 0; padding: 0 22px 22px; }
  .calc-ops span { font-size: 96px; }
  .band-tall .calc-ops span { font-size: 140px; }
  .roadmap-items { columns: 1; }
}
@media (max-width: 767px) {
  .page-band { padding-bottom: 28px; }
  .page-band h1 { font-size: 34px; }
  .band-h1row { gap: 10px; }
  .band-emoji { font-size: 30px; order: -2; }
  .band-h1row h1 { flex: 0 0 100%; }
  .band-h1row .calc-pill { order: -1; font-size: 11px; padding: 8px 12px; margin-left: 0; margin-right: auto; }
  .calc-tool > form, .calc-tool > form + * { padding: 18px 16px; }
  .band-sub { font-size: 16px; }
  .band-desc { font-size: 15.5px; }
  .calc-ticks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13px; }
  .pc-badge { text-align: start; padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ci-composition-bar span { transition: none !important; }
}

/* ---------- ir-  investment return ---------- */
/* ir- shell rules removed S51 — the shared ci- shell applies (heading panel, privacy line,
   fields, hint, advanced, actions, headline, toast). What follows is the engine's own. */
.ir-adv-count { font-weight: 600; }
.ir-adv-count-on { color: var(--accent); }
/* Per-field validation — CI has none, so these stay engine-own */
.ir-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.ir-field-error:empty { display: none; }
.ir-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }
.ir-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.ir-prompt strong { color: var(--text-heading); }
/* Headline row: sign badge (the only place gain/loss colour appears) + the secondary figure */
.ir-headline-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 18px; padding: 0 0 17px; margin-bottom: 17px; border-bottom: 1px solid var(--border); }
.ir-sign-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); font: 700 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.ir-sign-badge.ir-positive { color: var(--success); }
.ir-sign-badge.ir-negative { color: var(--danger); }
.ir-headline-row p { margin: 0; text-align: end; }
.ir-headline-row p b { display: block; margin-top: 5px; color: var(--text-heading); font-size: 21px; }
.ir-eyebrow { display: block; color: var(--text-medium); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; }
.ir-warnings { display: grid; gap: 6px; margin: 17px 0 0 18px; color: var(--text-medium); font-size: 12.5px; line-height: 1.55; }
/* ir- below/kpi/tab rules removed S52 — the shared ci- block applies */

@media (max-width: 767px) {
  .ir-headline-row p { text-align: start; }
}

/* ---------- sr-  stock return ---------- */
/* sr- shell rules removed S51 — the shared ci- shell applies (heading panel, privacy line,
   fields, hint, advanced, actions, headline, toast). What follows is the engine's own. */
.sr-adv-count { font-weight: 600; }
.sr-adv-count-on { color: var(--accent); }
/* Per-field validation — CI has none, so these stay engine-own */
.sr-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.sr-field-error:empty { display: none; }
.sr-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }
.sr-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.sr-prompt strong { color: var(--text-heading); }
/* Headline row: sign badge (the only place gain/loss colour appears) + the secondary figure */
.sr-headline-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 18px; padding: 0 0 17px; margin-bottom: 17px; border-bottom: 1px solid var(--border); }
.sr-sign-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); font: 700 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.sr-sign-badge.sr-positive { color: var(--success); }
.sr-sign-badge.sr-negative { color: var(--danger); }
.sr-headline-row p { margin: 0; text-align: end; }
.sr-headline-row p b { display: block; margin-top: 5px; color: var(--text-heading); font-size: 21px; }
.sr-eyebrow { display: block; color: var(--text-medium); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; }
.sr-warnings { display: grid; gap: 6px; margin: 17px 0 0 18px; color: var(--text-medium); font-size: 12.5px; line-height: 1.55; }
/* sr- below/kpi/tab rules removed S52 — the shared ci- block applies */

@media (max-width: 767px) {
  .sr-headline-row p { text-align: start; }
}

/* ---------- dr-  dividend reinvestment / DRIP ----------
   S51: the form, fields, headline, KPI grid and toast are the shared ci-
   shell (Hard Rule 33). Only what is genuinely the DRIP engine's own remains. */

/* dr- shell rules removed S51 — the shared ci- shell applies */

/* Per-field error (engine-own — CI has no per-field errors) */
.dr-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.dr-error:empty { display: none; }
/* Reinvest toggle */
.dr-reinvest-set { border: 0; min-width: 0; margin: 18px 0 16px; padding: 12px 14px; border-radius: 9px; background: var(--surface); }
.dr-reinvest-set legend { margin-bottom: 6px; color: var(--text-medium); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.calc-tool .dr-toggle-label { display: flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer; color: var(--text-light); font-size: 14.5px; }   /* .calc-tool label is a column; this is a row (S51) */
.dr-toggle-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
/* Results: the engine's own rows beneath the shell headline */
.dr-results .calc-estimate-note { margin: 0 0 18px; }
/* Comparison strip */
.dr-compare { margin: 18px 0 0; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.dr-compare-head { padding: 10px 14px; background: var(--surface); color: var(--text-medium); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.dr-compare-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.dr-compare-row--alt { background: var(--surface); }
.dr-compare-advantage { background: var(--surface-2); border-top: 2px solid var(--border); }
.dr-compare-row span { color: var(--text-light); font-size: 13.5px; }
.dr-compare-row strong { color: var(--text-heading); font-size: 15px; font-weight: 750; white-space: nowrap; }
.dr-compare-advantage strong { color: var(--accent); }
/* dr- below/kpi/tab rules removed S52 — the shared ci- block applies */

@media (max-width: 767px) {
  .dr-compare-row { flex-direction: column; gap: 4px; }
}

/* ---------- cg-  capital gains ---------- */
/* cg- shell rules removed S51 — the shared ci- shell applies (heading panel, privacy line,
   fields, hint, advanced, actions, headline, toast). What follows is the engine's own. */
/* Field extras — optional tag and per-field validation (CI has none, so these stay engine-own) */
.cg-optional { color: var(--text-medium); font-weight: 400; font-size: 11px; margin-inline-start: 4px; }
.cg-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.cg-field-error:empty { display: none; }
.cg-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }
/* Prompt (invalid state) */
.cg-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.cg-prompt strong { color: var(--text-heading); }
/* Headline row: sign badge + holding-period badge (the only place gain/loss colour appears) + the secondary figure */
.cg-headline-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 18px; padding: 0 0 17px; margin-bottom: 17px; border-bottom: 1px solid var(--border); }
.cg-sign-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); font: 700 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.cg-sign-badge.cg-positive { color: var(--success); }
.cg-sign-badge.cg-negative { color: var(--danger); }
.cg-result-right { text-align: end; }
.cg-result-right b { display: block; margin-top: 5px; color: var(--text-heading); font-size: 21px; }
.cg-eyebrow { display: block; color: var(--text-medium); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; }
/* Wash-sale warning */
.cg-wash-warning { padding: 12px 16px; margin: 0 0 16px; border-radius: 9px; background: var(--surface); border: 1px solid var(--star); color: var(--text-light); font-size: 13.5px; line-height: 1.6; }
.cg-wash-warning strong { color: var(--star); }
/* cg- below/kpi/tab rules removed S52 — the shared ci- block applies */
/* Holding-period badges */
.cg-term-badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
.cg-badge-ltcg { background: var(--surface-2); color: var(--success); }
.cg-badge-stcg { background: var(--surface-2); color: var(--star); }
/* Rate note */
.cg-rate-note { display: grid; gap: 4px; margin: 0 0 18px; padding: 13px 16px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; }
.cg-rate-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-medium); }
/* Warnings */
.cg-warnings { display: grid; gap: 6px; margin: 17px 0 0 18px; color: var(--text-medium); font-size: 12.5px; line-height: 1.55; }

@media (max-width: 767px) {
  .cg-result-right { text-align: start; }
}


/* ---------- by-  bond yield (bond family, S12) ----------
   S51: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the yield engine's own remains. */

/* by- shell rules removed S51 — the shared ci- shell applies */

/* Field extras (engine-own: optional tag, per-field error, invalid tint) */
.by-optional { color: var(--text-medium); font-weight: 400; font-size: 11px; margin-inline-start: 4px; }
.by-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.45; }
.by-error:empty { display: none; }
.by-field .ci-input-wrap:has([aria-invalid="true"]), .by-field .ci-select-wrap:has([aria-invalid="true"]) { border-color: var(--star); }

/* Price vs par badge — beside the shell's detail line */
.by-par-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; vertical-align: middle; }
.by-badge-par      { background: var(--surface-2); color: var(--text-medium); }
.by-badge-discount { background: var(--surface-2); color: var(--c3); }
.by-badge-premium  { background: var(--surface-2); color: var(--c4); }

/* Convergence warning */
.by-conv-warn { margin: 0 0 14px; padding: 11px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--star); color: var(--text-light); font-size: 13px; line-height: 1.6; }

/* Results: the engine's own rows beneath the shell headline */
.by-results .calc-estimate-note { margin: 0; }

/* by- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Solver note */
.by-solver-note { margin-top: 16px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); color: var(--text-medium); font-size: 11.5px; line-height: 1.55; }

/* ---------- cr-  cryptocurrency return (S13) ---------- */
/* cr- shell rules removed S51 — the shared ci- shell applies (heading panel, privacy line,
   fields, hint, advanced, actions, headline, toast). What follows is the engine's own. */
/* Field extras — optional tag and per-field validation (CI has none, so these stay engine-own) */
.cr-optional { color: var(--text-medium); font-weight: 400; font-size: 11px; margin-inline-start: 4px; }
.cr-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.cr-field-error:empty { display: none; }
.cr-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }

/* Prompt (validation state) */
.cr-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.cr-prompt strong { color: var(--text-heading); }

/* Headline row: sign badge (the only place gain/loss colour appears) + the secondary figure */
.cr-headline-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 18px; padding: 0 0 17px; margin-bottom: 17px; border-bottom: 1px solid var(--border); }
.cr-sign-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); font: 700 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.cr-sign-badge.cr-positive { color: var(--success); }
.cr-sign-badge.cr-negative { color: var(--danger); }
.cr-eyebrow { display: block; color: var(--text-medium); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; }
.cr-result-right { text-align: end; }
.cr-result-right b { display: block; margin-top: 5px; font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--text-heading); }

/* cr- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Warnings */
.cr-warnings { display: grid; gap: 6px; margin: 17px 0 0; padding: 0 0 0 18px; color: var(--text-medium); font-size: 12.5px; line-height: 1.55; }

@media (max-width: 767px) {
  .cr-result-right { text-align: start; }
}

/* ---------- pa-  portfolio allocation (S14) ---------- */
/* pa- shell rules removed S51 — the shared ci- shell applies (form, privacy line,
   fields, input wraps, advanced, form error, actions, headline, toast). */

/* Each holding row — the repeating table is engine-own; its cells are ci-fields */
.pa-holding-input-row { border-bottom: 1px solid var(--border); padding: 12px 0; }
.pa-holding-input-row:last-child { border-bottom: 0; }
.pa-row-fields { display: grid; grid-template-columns: 2fr 1.5fr 1fr auto; gap: 10px; align-items: start; }

.pa-field-error { font-size: 11.5px; color: var(--danger); min-height: 0; }
.pa-field-error:not([hidden]) { display: block; }

/* Remove button — sits level with the 45px ci-input-wrap (label 18px + 6px gap above) */
.pa-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; align-self: start; margin-top: 24px; flex-shrink: 0; }
.pa-remove-btn:hover { border-color: var(--danger); color: var(--danger); }
.pa-remove-placeholder { display: block; width: 32px; height: 45px; align-self: start; margin-top: 24px; }

/* Form bottom row */
.pa-form-btns { display: flex; align-items: center; gap: 16px; margin: 14px 0 6px; flex-wrap: wrap; }
.pa-add-btn { height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.pa-add-btn:hover { background: var(--accent-soft,rgba(37,99,235,.08)); }
.pa-add-btn:disabled { opacity: .45; cursor: not-allowed; }
.pa-pct-sum-wrap { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pa-pct-label { font-size: 12px; color: var(--text-medium); }
.pa-pct-sum { font: 600 14px var(--font-mono); color: var(--text-medium); transition: color .2s; }
.pa-pct-sum.pa-pct-ok  { color: var(--success); }
.pa-pct-sum.pa-pct-err { color: var(--danger); }

/* Advanced details: ci-advanced. Its single field spans the shell's two-column grid. */
.pa-adv .ci-advanced-grid { grid-template-columns: 1fr; }

/* pa- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Allocation bar (one-row portfolio split) */
.pa-alloc-bar { height: 10px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; margin: 14px 0 18px; }
.pa-alloc-bar span { height: 100%; transition: width .3s ease; }

/* Cash note */
.pa-cash-note { font-size: 12px; color: var(--success); background: color-mix(in srgb, var(--success) 8%, transparent); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); border-radius: 7px; padding: 8px 12px; margin: 0 0 14px; }

/* Holdings list in out panel */
.pa-holdings-list { display: grid; gap: 10px; margin-top: 6px; }
.pa-holding-row { border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; background: var(--surface-2); }
.pa-holding-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.pa-holding-name { font: 600 14px var(--font-body); color: var(--text-heading); }
.pa-holding-nums { display: flex; gap: 10px; font: 500 12px var(--font-mono); color: var(--text-medium); margin-bottom: 7px; }
.pa-holding-cur { color: var(--text-heading); }

/* Composition bar per holding */
.pa-bar-wrap { margin: 5px 0 7px; }
.pa-bar-track { position: relative; height: 6px; border-radius: 100px; background: var(--border); overflow: visible; }
.pa-bar-cur { height: 100%; border-radius: 100px; transition: width .25s ease; }
.pa-bar-tgt { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text-medium); border-radius: 1px; transform: translateX(-50%); }

.pa-holding-action { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; }
.pa-holding-drift { color: var(--text-medium); }
.pa-holding-drift.pa-drift-warn { color: var(--c3,#F97316); font-weight: 600; }
.pa-holding-amt { font: 600 13px var(--font-mono); color: var(--text-heading); }

/* Action badges */
.pa-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 100px; font: 700 10.5px var(--font-mono); letter-spacing: .05em; }
.pa-badge-buy  { background: color-mix(in srgb, var(--c2,#22C55E) 15%, transparent); color: var(--c2,#22C55E); border: 1px solid color-mix(in srgb, var(--c2,#22C55E) 30%, transparent); }
.pa-badge-sell { background: color-mix(in srgb, var(--c3,#F97316) 15%, transparent); color: var(--c3,#F97316); border: 1px solid color-mix(in srgb, var(--c3,#F97316) 30%, transparent); }
.pa-badge-hold { background: var(--surface-2); color: var(--text-medium); border: 1px solid var(--border); }

/* Drift table — column-specific rules only (the table itself is the shared ci-table) */
.pa-table th:last-child,  .pa-table td:last-child  { text-align: center; }
.pa-table .pa-drift-warn { color: var(--c3,#F97316); font-weight: 600; }

/* Responsive */
@media (max-width: 640px) {
  .pa-row-fields { grid-template-columns: 1fr 1fr; }
  .pa-field-name { grid-column: 1 / -1; }
  .pa-remove-btn, .pa-remove-placeholder { align-self: center; margin-top: 0; }
}
@media (max-width: 420px) {
  .pa-row-fields { grid-template-columns: 1fr; }
  .pa-remove-btn { margin-top: 0; width: 100%; }
  .pa-remove-placeholder { display: none; }
}

/* ---------- ra-  risk assessment (S16) ---------- */

/* ra- shell rules removed S51 — the shared ci- shell applies (form, privacy line,
   form error, actions, headline, toast). The questionnaire below is engine-own. */

/* Progress indicator */
.ra-progress { font: 600 12px var(--font-mono); color: var(--text-medium); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); border-radius: 6px; padding: 5px 10px; display: inline-block; margin-bottom: 20px; }

/* Question fieldsets */
.ra-question { border: 1px solid var(--border); border-radius: 10px; padding: 16px 16px 12px; margin-bottom: 14px; background: var(--surface); }
.ra-question:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, rgba(37,99,235,.08)); }
.ra-q-legend { display: block; width: 100%; padding: 0; margin-bottom: 12px; }
.ra-q-num { display: inline-block; font: 700 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--accent); background: var(--accent-soft, rgba(37,99,235,.1)); border-radius: 4px; padding: 2px 6px; margin-right: 6px; vertical-align: middle; }
.ra-q-dim { display: inline-block; font: 500 10.5px var(--font-mono); color: var(--text-medium); text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; }
.ra-q-text { display: block; margin-top: 7px; font: 600 15px var(--font-body); color: var(--text-heading); line-height: 1.45; }

/* Option buttons */
.ra-options { display: grid; gap: 7px; margin-top: 4px; }
.ra-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 9px 12px;
  border: 1.5px solid var(--border-strong); border-radius: 8px;
  background: var(--surface-2); color: var(--text-heading);
  font: 500 14px var(--font-body); cursor: pointer; line-height: 1.4;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ra-option:hover, .ra-option:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(37,99,235,.06));
  outline: none;
}
.ra-option[aria-pressed="true"], .ra-option-selected {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(37,99,235,.12));
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft, rgba(37,99,235,.18));
}
.ra-opt-score {
  flex-shrink: 0; width: 22px; height: 22px;
  border-radius: 50%; border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--font-mono);
}
.ra-opt-label { flex: 1; }

/* Per-question error */
.ra-q-error { font-size: 12px; color: var(--danger); margin-top: 6px; padding: 0; }
.ra-q-error:not([hidden]) { display: block; }

/* Result headline is the shell's (ci-result-total carries the band label, ci-result-detail
   the score line). Band names are words, not a figure, so the headline may wrap;
   white-space is not part of the shell's look. */
.ra-band-label { white-space: normal; }
.ra-band-icon { font-size: 15px; line-height: 1; margin-right: 2px; }
.ra-band-score strong { color: var(--text-heading); }

/* Spectrum bar */
.ra-spectrum { margin: 0 0 20px; }
.ra-spec-track { position: relative; display: flex; height: 14px; border-radius: 100px; overflow: hidden; margin-bottom: 5px; }
.ra-spec-seg { flex: 1; height: 100%; }
.ra-spec-marker {
  position: absolute; top: -4px; width: 5px; height: 22px;
  background: var(--text-heading); border-radius: 3px;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(0,0,0,.3);
  transition: left .35s ease;
}
.ra-spec-labels { display: flex; justify-content: space-between; font: 500 10.5px var(--font-mono); color: var(--text-medium); }

/* Band description */
.ra-band-desc { font-size: 14.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 20px; }

/* Subscore section */
.ra-section-title { font: 700 14px var(--font-body); color: var(--text-heading); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 12px; }
.ra-dim-grid { display: grid; gap: 12px; margin-bottom: 18px; }
.ra-dim-item { }
.ra-dim-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.ra-dim-label { font: 600 12.5px var(--font-body); color: var(--text-heading); text-transform: uppercase; letter-spacing: .04em; }
.ra-dim-band  { font: 500 12px var(--font-mono); color: var(--text-medium); }
.ra-dim-track { height: 8px; border-radius: 100px; background: var(--border); overflow: hidden; }
.ra-dim-fill  { height: 100%; border-radius: 100px; transition: width .35s ease; }

/* Capacity note and disclaimer */
.ra-cap-note { font-size: 12.5px; color: var(--text-medium); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; margin: 0 0 14px; line-height: 1.55; }
.ra-disclaimer { font-size: 12px; color: var(--text-medium); line-height: 1.55; border-top: 1px solid var(--border); padding-top: 12px; margin: 0; }

/* ── S31: provisional profile + scoring key ──────────────────────────
   The report column used to be empty until all ten questions were
   answered — the only page in the batch with nothing on load, and
   nothing to carry the estimate note (Rule R7). It now renders a
   live provisional profile, and the scoring key underneath it, from
   the first paint. Tokens only (Hard Rule 24).                       */
.ra-provisional .ci-live-dot { background: var(--c3, #F97316); box-shadow: 0 0 10px var(--c3, #F97316); }
.ra-prov-note { font-size: 12.5px; color: var(--text-medium); line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; margin: 0 0 20px; }
.ra-dim-waiting .ra-dim-label { opacity: .6; }
.ra-dim-waiting .ra-dim-band { font-style: italic; opacity: .75; }
.ra-dim-partial { font-style: italic; opacity: .8; }

.ra-key { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.ra-key-lede { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 12px; }
.ra-key-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.ra-key-row { display: flex; align-items: center; gap: 10px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ra-key-icon { font-size: 16px; line-height: 1; flex-shrink: 0; }
.ra-key-label { flex: 1; font: 600 12.5px var(--font-body); color: var(--text-heading); }
.ra-key-range { font: 500 12px var(--font-mono); color: var(--text-medium); flex-shrink: 0; }
.ra-key-note { font-size: 12.5px; color: var(--text-medium); line-height: 1.6; margin: 0; }
.ra-key-note strong { color: var(--text-heading); }
/* ra- below/kpi/tab rules removed S52 — the shared ci- block applies */
/* Exports are disabled until all ten answers are in (engine-own state, shared button) */
.ra-below .ci-text-button[disabled], .ra-below .ci-text-button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.ra-below .ci-text-button[disabled]:hover, .ra-below .ci-text-button[aria-disabled="true"]:hover { transform: none; }

/* Responsive */
@media (max-width: 560px) {
  .ra-q-text { font-size: 14px; }
  .ra-option { font-size: 13.5px; padding: 8px 10px; }
  .ra-spec-labels { font-size: 9.5px; }
}
@media (max-width: 390px) {
  .ra-q-num, .ra-q-dim { display: block; margin-bottom: 2px; }
  .ra-option { font-size: 13px; }
}

/* ---------- ri-  retirement investment (S8) ---------- */
/* ri- shell rules removed S51 — the shared ci- shell applies (panel heading, kicker,
   privacy line, fields, input / select wraps, hint, timing, advanced, form error, actions,
   text buttons, topline, headline, composition, stat grid, scenarios, risk note,
   section heading, toast). */
.ri-section-label { font: 600 11px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--text-medium); margin: 14px 0 8px; }
/* Drawdown phase — a second ci-advanced block directly under the first; one rule between them */
.ri-drawdown-section { border-top: 0; }
.ri-drawdown-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; margin-top: 17px; }
.ri-drawdown-note { margin: 13px 0 0; color: var(--text-medium); font-size: 11px; line-height: 1.45; }
/* Composition bar segments and key swatches — engine-own colour keys inside the shell's ci-composition */
.ri-bar-principal, .ri-key-principal { background: var(--c1); }
.ri-bar-contribution, .ri-key-contribution { background: var(--c2); }
.ri-bar-growth, .ri-key-growth { background: var(--c4); }

/* Drawdown result inline */
.ri-drawdown-result { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ri-drawdown-label { margin: 0; font-size: 13px; color: var(--text-medium); line-height: 1.6; }

/* ri- below/kpi/tab rules removed S52 — the shared ci- block applies */
/* Insight callouts (engine-own) — two across beneath the chart */
.ri-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 6px 0 10px; }
.ri-insight { border: 1px solid var(--border); background: var(--surface); padding: 20px; border-radius: 10px; }
.ri-insight { display: flex; flex-direction: column; justify-content: center; }
.ri-insight-index { color: var(--success); font: 500 11px var(--font-mono); }
.ri-insight h4 { margin: 7px 0; font-size: 17px; font-weight: 700; color: var(--text-heading); }
.ri-insight p { margin: 0; color: var(--text-medium); font-size: 12px; line-height: 1.55; }
.ri-growth-cell { color: var(--c2); }   /* column-specific */

/* Responsive */
@media (max-width: 767px) {
  .ri-drawdown-grid { grid-template-columns: 1fr; }
  .ri-insights { grid-template-columns: 1fr; }
}

/* ---------- sp-  stock portfolio (stock-portfolio engine) ---------- */

/* sp- shell rules removed S51 — the shared ci- shell applies (form, privacy line,
   fields, input wraps, advanced, form error, actions, headline, toast). */

/* Each holding row — 2-line layout (engine-own; its cells are ci-fields):
   Line 1: Name spans full width
   Line 2: Shares | Cost/share | Current price | Dividends | ✕  */
.sp-holding-row { border-bottom: 1px solid var(--border); padding: 12px 0; }
.sp-holding-row:last-child { border-bottom: 0; }

/* Line 1 — Name only, full width */
.sp-row-name-line { margin-bottom: 8px; }

/* Line 2 — four equal numeric columns + remove button */
.sp-row-primary { display: grid; grid-template-columns: repeat(4, 1fr) 32px; gap: 8px; align-items: start; }
/* Four cells across a 450px column: the label may clip rather than wrap the row */
.sp-row-primary .ci-field > span:first-child { white-space: nowrap; overflow: hidden; }
.sp-field-error { font-size: 11px; color: var(--danger); min-height: 0; }
.sp-field-error:not([hidden]) { display: block; }

/* Commission row (Advanced, hidden until open) */
.sp-comm-row { padding: 6px 0 2px; }
.sp-comm-row[hidden] { display: none; }

/* Remove button — level with the 45px ci-input-wrap (label 18px + 6px gap above) */
.sp-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; align-self: start; margin-top: 24px; flex-shrink: 0; }
.sp-remove-btn:hover { border-color: var(--danger); color: var(--danger); }
.sp-remove-placeholder { display: block; width: 32px; height: 45px; align-self: start; margin-top: 24px; }

/* Row count row */
.sp-row-btns { display: flex; align-items: center; gap: 16px; margin: 14px 0 6px; flex-wrap: wrap; }
.sp-add-btn { height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.sp-add-btn:hover { background: var(--accent-soft,rgba(37,99,235,.08)); }
.sp-add-btn:disabled { opacity: .45; cursor: not-allowed; }
.sp-row-count { font-size: 12px; color: var(--text-medium); margin-left: auto; }

/* Advanced details: ci-advanced. Its single field spans the shell's two-column grid. */
.sp-adv .ci-advanced-grid { grid-template-columns: 1fr; }

/* sp- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Gain / loss colour helpers */
.sp-gain { color: var(--success,#16A34A); }
.sp-loss { color: var(--danger,#DC2626); }

/* Portfolio weight composition bar */
.sp-alloc-bar { height: 10px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; margin-bottom: 14px; }
.sp-alloc-bar span { height: 100%; transition: width .3s ease; }

/* Stats row (gainers / losers / best / worst) */
.sp-stats-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-medium); margin: 0 0 16px; }
.sp-stats-row b { font-family: var(--font-mono); font-size: 13px; }
.sp-stat-best b, .sp-stat-worst b { font-family: var(--font-body); }

/* Holding cards */
.sp-holdings-list { display: grid; gap: 10px; }
.sp-holding-card { border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; background: var(--surface-2); }
.sp-holding-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.sp-holding-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.sp-holding-name { font: 600 14px var(--font-body); color: var(--text-heading); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-holding-weight { font: 500 11px var(--font-mono); color: var(--text-medium); margin-left: auto; white-space: nowrap; }
.sp-div-badge { font: 600 10px var(--font-mono); padding: 2px 7px; border-radius: 100px; background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); white-space: nowrap; }
.sp-holding-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sp-holding-nums span { display: flex; flex-direction: column; gap: 2px; font: 600 13px var(--font-mono); color: var(--text-heading); }
.sp-holding-nums small { font: 400 10px var(--font-body); text-transform: uppercase; letter-spacing: .04em; color: var(--text-medium); }
.sp-holding-bar-wrap { margin-top: 8px; }
.sp-holding-bar-track { position: relative; height: 4px; border-radius: 100px; background: var(--border); overflow: hidden; }
.sp-holding-bar-fill { height: 100%; border-radius: 100px; transition: width .25s ease; }

/* Responsive */
@media (max-width: 640px) {
  /* 2 cols: Shares + Cost on row A, Price + Dividends on row B, remove last */
  .sp-row-primary { grid-template-columns: 1fr 1fr 1fr 1fr 32px; }
  .sp-holding-nums { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  /* Narrow: 2 cols per row, remove button drops below on its own */
  .sp-row-primary { grid-template-columns: 1fr 1fr; }
  .sp-remove-btn { width: 32px; grid-column: 1; margin-top: 0; }
  .sp-remove-placeholder { display: none; }
  .sp-holding-nums { grid-template-columns: repeat(2, 1fr); }
}



/* ---------- bp-  bond price (bond family, S20) ----------
   S51: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the price engine's own remains. */

/* bp- shell rules removed S51 — the shared ci- shell applies */

/* Field extras (engine-own: optional tag, per-field error, invalid tint) */
.bp-optional { color: var(--text-medium); font-weight: 400; font-size: 11px; margin-inline-start: 4px; }
.bp-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.45; }
.bp-error:empty { display: none; }
.bp-field .ci-input-wrap:has([aria-invalid="true"]), .bp-field .ci-select-wrap:has([aria-invalid="true"]) { border-color: var(--star); }

/* Par / discount / premium badges — beside the shell's detail line */
.bp-par-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; vertical-align: middle; }
.bp-badge-par      { background: var(--surface-2); color: var(--text-medium); }
.bp-badge-discount { background: var(--surface-2); color: var(--c3); }
.bp-badge-premium  { background: var(--surface-2); color: var(--c4); }

/* Negative yield warning */
.bp-neg-yield-warn { margin: 0 0 14px; padding: 11px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--star); color: var(--text-light); font-size: 13px; line-height: 1.6; }

/* Results: the engine's own rows beneath the shell headline */
.bp-results .calc-estimate-note { margin: 0; }

/* bp- (bond price) below/kpi/tab rules removed S52 — the shared ci- block applies.
   NOTE: the balloon-payment engine also uses the bp- prefix (its block is further
   down); the bond price page no longer carries any of those colliding class names. */

.bp-method-note { margin-top: 16px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); color: var(--text-medium); font-size: 11.5px; line-height: 1.55; }

/* Sub-headings between the two tables inside the Rule 29 details (engine-own) */
.bp-table-heading { margin: 18px 0 4px; font-size: 13px; font-weight: 700; color: var(--text-heading); }

/* Row-specific colour on the price/yield sensitivity table (engine-own) */
.bp-row-discount td { color: var(--c3); }
.bp-row-premium td { color: var(--c4); }
.bp-row-par td { color: var(--text-medium); }

/* No .bp-share-btn rule — it is .ci-text-button.ci-share (S51) */

/* ---------- oc-  options calculator (payoff + Black-Scholes, S21) ---------- */
/* oc- shell rules removed S51 — the shared ci- shell applies
   (form, privacy, section title, grid-2/3 → ci-fields / ci-advanced-grid, field,
   label, input, hint note → ci-hint, adv/adv-summary/adv-grid → ci-advanced, actions,
   primary/secondary, kicker → ci-topline, result-header/label/main → ci-result-*,
   kpi-grid/kpi → ci-stat-grid, toast → ci-toast). Toggles, field errors, the BS
   note/output, risk callout, chart, table-bar and payoff table stay the engine's own. */

/* Type / Position toggles — a two-button radio group in the ci-fields grid */
.oc-toggle-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.oc-toggle-group legend { padding: 0; min-height: 18px; display: flex; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--text-heading); }   /* same face as .calc-tool label */
.oc-toggles { display: flex; gap: 6px; height: 45px; }
.oc-toggle-label { flex: 1; position: relative; display: block; }
.oc-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.oc-toggle-btn { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-medium); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; transition: .16s ease; }
.oc-toggle-input:checked + .oc-toggle-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--text-heading); }
.oc-toggle-input:focus-visible + .oc-toggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Per-field errors (the CI shell has none) */
.oc-error { font-size: 11.5px; color: var(--danger); min-height: 0; display: block; }
.oc-error[hidden] { display: none; }

/* Second disclosure (Black-Scholes) sits directly under the Advanced one — no doubled rule */
.oc-bs-section.ci-advanced { border-top: 0; }
.oc-bs-note { font-size: 11.5px; color: var(--text-medium); line-height: 1.5; margin: 14px 0 0; padding: 9px 12px; border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; }

/* Risk callout */
.oc-risk-callout { border: 1px solid var(--danger); border-left: 3px solid var(--danger); background: var(--surface-2); border-radius: 6px; padding: 10px 14px; font-size: 12.5px; color: var(--text-medium); line-height: 1.5; margin: 16px 0 0; }
.oc-risk-callout strong { color: var(--danger); }

/* Black-Scholes output */
.oc-bs-out { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 16px; }
.oc-bs-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 10px; }
.oc-bs-price-row { margin-bottom: 12px; }
.oc-bs-price-label { display: block; font-size: 12px; color: var(--text-medium); margin-bottom: 3px; }
.oc-bs-price { font: 700 clamp(28px, 4vw, 42px)/1 var(--font-display); letter-spacing: -.04em; color: var(--c1); font-variant-numeric: tabular-nums; }

/* BS internals table */
.oc-bs-internals { margin: 12px 0 10px; }
.oc-bs-internals summary { font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 600; }
.oc-bs-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.oc-bs-table th, .oc-bs-table td { padding: 6px 8px; border: 1px solid var(--border); text-align: left; }
.oc-bs-table th { background: var(--surface-2); color: var(--text-medium); font-weight: 600; }
.oc-bs-limits { font-size: 11.5px; color: var(--text-medium); line-height: 1.5; margin: 8px 0 0; padding: 8px 12px; border-left: 2px solid var(--border-strong); }
.oc-bs-error { font-size: 12px; color: var(--danger); }

/* oc- below/kpi/tab rules removed S52 — the shared ci- block applies */
/* Sign colour on the payoff table's P&L column (column-specific) */
.oc-tbl-profit { color: var(--success); }
.oc-tbl-loss   { color: var(--danger); }

/* ---------- fc-  futures calculator (S22) ---------- */
/* fc- shell rules removed S51 — the shared ci- shell applies
   (form, privacy, preset-row/type-row/grid-2 → ci-fields, field, label, select-wrap,
   input, hint note → ci-hint, adv/adv-summary/adv-grid → ci-advanced, actions,
   primary/secondary, kicker → ci-topline, result-header/label/main/estimate-tag →
   ci-result-*, kpi-grid/kpi → ci-stat-grid, toast → ci-toast). Toggles, field errors,
   the sign badge, margin-call box, notional bar, chart, table-bar and table stay the
   engine's own. */

/* Direction toggles — a two-button radio group in the ci-fields grid */
.fc-toggle-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.fc-toggle-group legend { padding: 0; min-height: 18px; display: flex; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--text-heading); }   /* same face as .calc-tool label */
.fc-toggles { display: flex; gap: 6px; height: 45px; }
.fc-toggle-label { flex: 1; position: relative; display: block; }
.fc-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fc-toggle-btn { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-medium); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; transition: .16s ease; }
.fc-toggle-input:checked + .fc-toggle-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--text-heading); }
.fc-toggle-input:focus-visible + .fc-toggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Per-field errors (the CI shell has none) */
.fc-error { font-size: 11.5px; color: var(--danger); min-height: 0; display: block; }
.fc-error[hidden] { display: none; }

/* Sign colour on the sensitivity table's P&L columns (column-specific) — the headline
   stays --text-heading; a small badge beside ci-result-detail carries the sign (S51 rule 8) */
.fc-profit { color: var(--success); }
.fc-loss   { color: var(--danger); }
.fc-sign-badge { display: inline-block; vertical-align: middle; margin-right: 6px; padding: 2px 8px; border-radius: 100px; font: 700 10px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.fc-sign-profit { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.fc-sign-loss   { color: var(--danger);  background: color-mix(in srgb, var(--danger) 14%, transparent); }

.fc-mc-box { border: 1px solid var(--border); border-left: 3px solid var(--c3); background: var(--surface-2); border-radius: 6px; padding: 10px 14px; font-size: 12.5px; color: var(--text-medium); line-height: 1.5; margin: 16px 0 14px; }
.fc-mc-box strong { color: var(--text-heading); }
.fc-mc-note { font-size: 11.5px; color: var(--text-medium); margin-top: 3px; }

.fc-notional-bar { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-medium); font-family: var(--font-mono); border-top: 1px solid var(--border); padding-top: 10px; }
.fc-notional-item strong { color: var(--text-heading); }

/* fc- below/kpi/tab rules removed S52 — the shared ci- block applies */

@media (max-width: 479px) {
  .fc-notional-bar { flex-direction: column; gap: 4px; }
}

/* ---------- fx-  forex calculator (S23) ---------- */
/* fx- shell rules removed S51 — the shared ci- shell applies
   (form, privacy, row-2 → ci-fields / ci-advanced-grid, field, label, select-wrap,
   select, input, hint note → ci-hint, adv/adv-summary/adv-body → ci-advanced, actions,
   primary/secondary, kicker → ci-topline, result-header/label/main/estimate-tag →
   ci-result-*, kpi-grid/kpi → ci-stat-grid, toast → ci-toast). Toggles, field errors,
   the sign badge, margin-usage bar, leverage warning, chart, table-bar and table stay
   the engine's own. */

/* Direction toggles — a two-button radio group in the ci-fields grid */
.fx-toggle-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.fx-toggle-group legend { padding: 0; min-height: 18px; display: flex; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--text-heading); }   /* same face as .calc-tool label */
.fx-toggles { display: flex; gap: 6px; height: 45px; }
.fx-toggle-label { flex: 1; position: relative; display: block; }
.fx-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fx-toggle-btn { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-medium); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; transition: .16s ease; }
.fx-toggle-input:checked + .fx-toggle-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--text-heading); }
.fx-toggle-input:focus-visible + .fx-toggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Per-field errors (the CI shell has none) */
.fx-error { font-size: 11.5px; color: var(--danger); display: block; }
.fx-error[hidden] { display: none; }

/* Sign colour on the sensitivity table's pip / P&L columns (column-specific) — the headline
   stays --text-heading; a small badge beside ci-result-detail carries the sign (S51 rule 8) */
.fx-profit { color: var(--success); }
.fx-loss   { color: var(--danger); }
.fx-warn   { color: var(--c3); }
.fx-sign-badge { display: inline-block; vertical-align: middle; margin-right: 6px; padding: 2px 8px; border-radius: 100px; font: 700 10px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.fx-sign-profit { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.fx-sign-loss   { color: var(--danger);  background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* Margin usage bar */
.fx-margin-usage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; margin: 14px 0 12px; border-top: 1px solid var(--border); }
.fx-mu-label { font-size: 12px; color: var(--text-medium); font-weight: 600; flex: 0 0 auto; }
.fx-mu-value { font: 600 14px/1 var(--font-mono); flex: 0 0 auto; }
.fx-mu-bar-wrap { flex: 1; min-width: 80px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.fx-mu-bar { height: 100%; border-radius: 3px; transition: width .3s ease, background .3s ease; }

/* Leverage warning box */
.fx-leverage-warning { border: 1px solid var(--border); border-left: 3px solid var(--danger); background: var(--surface-2); border-radius: 6px; padding: 10px 14px; font-size: 12px; color: var(--text-medium); line-height: 1.6; margin-top: 14px; }
.fx-leverage-warning strong { color: var(--danger); }
.fx-leverage-warning a { color: var(--accent); }

/* fx- below/kpi/tab rules removed S52 — the shared ci- block applies */

@media (max-width: 540px) {
  .fx-margin-usage { flex-direction: column; align-items: flex-start; }
}

/* ---------- ci- daily-variant additions (compound-interest-daily) ----------
   Adds .ci-pinned state for the disabled/locked compounding frequency select
   on the daily variant page (data-calc-state="daily"). The select is present
   but styled to communicate that it is a preset, not a configurable input.
   Also adjusts the stat grid to accommodate the APY column added by the
   daily preset, keeping the hub grid unchanged (the APY stat is always
   rendered but only visually prominent when n=365).                       */

.ci-select-wrap.ci-pinned { position: relative; }
.ci-select-wrap.ci-pinned select {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--surface-2, var(--surface));
  border-style: dashed;
}
.ci-select-wrap.ci-pinned::after {
  content: 'Preset';
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  font: 600 11px var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); pointer-events: none;
}

/* Stat grid: accommodate 5 stats (add APY) at widths where 4 was the default */
.ci-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}


/* ---------- an-  annuity calculator (S26) ---------- */
/* an- shell rules removed S51 — the shared ci- shell applies */
/* an- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* The "Calculate" target selector spans the shell's two-column field grid */
.an-target-wrap { grid-column: span 2; }

.an-field-error { font-size: 11px; color: var(--danger, #ef4444); font-weight: 600; margin-top: 2px; }

/* Schedule table: year-end rows and the interest column (column-specific) */
.an-table tr.an-row-yearend td { background: var(--surface-2); font-weight: 600; }
.an-interest-cell { color: var(--success, #10b981); }

@media (max-width: 640px) {
  .an-target-wrap { grid-column: span 1; }
}

/* ---------- PRESENT VALUE CALCULATOR (pv-) — S26 ---------- */
/* Hard Rule 12: all classes prefixed pv-. Tokens only — no hex. */
/* pv- shell rules removed S51 — the shared ci- shell applies */

/* Mode selector — engine-own: lump sum / annuity / growing annuity */
.pv-mode { border: 0; padding: 0; margin: 0 0 20px; }
.pv-mode legend { font-size: 13px; font-weight: 600; color: var(--text-medium); margin-bottom: 10px; display: block; }
.pv-mode label { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 7px; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.pv-mode label:hover { border-color: var(--accent); }
.pv-mode input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.pv-mode input[type="radio"]:checked ~ span { color: var(--text-heading); }
.pv-mode label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, rgba(37,99,235,.07)); }
.pv-mode span { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-medium); }
.pv-mode small { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-medium); margin-top: 2px; }

/* Sub-caption inside the shared ci-timing chips ("ordinary annuity" / "annuity due") */
.pv-annuity-timing small { display: block; font-size: 10px; opacity: .75; margin-top: 2px; }

/* Timeline bar */
.pv-timeline { padding: 14px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 20px 0 16px; }
.pv-timeline-bar { height: 10px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.pv-timeline-bar span { height: 100%; transition: width .24s ease; }
.pv-tl-pv, .pv-key-pv { background: var(--c1); }
.pv-tl-discount, .pv-key-discount { background: var(--c3); }
.pv-timeline-key { display: flex; gap: 10px 17px; flex-wrap: wrap; margin-top: 10px; }
.pv-timeline-key span { font-size: 11px; color: var(--text-medium); display: grid; grid-template-columns: 8px auto; column-gap: 5px; align-items: center; }
.pv-timeline-key i { width: 7px; height: 7px; border-radius: 2px; }
.pv-timeline-key b { grid-column: 2; color: var(--text-heading); font: 500 11px var(--font-mono); }

/* pv- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* ── Responsive ── */
@media (max-width: 767px) {
  .pv-mode label { padding: 8px 10px; }
}

/* ---------- FUTURE VALUE CALCULATOR (fv-) — S27 ---------- */
/* Hard Rule 12: all classes prefixed fv-. Tokens only — no hex.
   Hard Rule 29: fv-table-bar / fv-below-actions compliant.    */
/* fv- shell rules removed S51 — the shared ci- shell applies */

/* Mode selector — engine-own: lump sum / regular payments / growing payments */
.fv-mode { border: 0; padding: 0; margin: 0 0 20px; }
.fv-mode legend { font-size: 13px; font-weight: 600; color: var(--text-medium); margin-bottom: 10px; display: block; }
.fv-mode label { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 7px; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.fv-mode label:hover { border-color: var(--accent); }
.fv-mode input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.fv-mode input[type="radio"]:checked ~ span { color: var(--text-heading); }
.fv-mode label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, rgba(37,99,235,.07)); }
.fv-mode span { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-medium); }
.fv-mode small { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-medium); margin-top: 2px; }

/* Sub-caption inside the shared ci-timing chips ("ordinary annuity" / "annuity due") */
.fv-annuity-timing small { display: block; font-size: 10px; opacity: .75; margin-top: 2px; }

/* Growth ≥ rate warning — engine-own */
.fv-warnings { color: var(--star); font-size: 12px; line-height: 1.5; margin: 8px 0; padding: 8px 12px; border: 1px solid var(--star); border-radius: 6px; }

/* Composition bar */
.fv-bar-wrap { padding: 14px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 20px 0 16px; }
.fv-bar { height: 10px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.fv-bar span { height: 100%; transition: width .24s ease; }
.fv-bar-pv, .fv-key-pv { background: var(--c1); }
.fv-bar-pmt, .fv-key-pmt { background: var(--c2); }
.fv-bar-int, .fv-key-int { background: var(--c3); }
.fv-bar-key { display: flex; gap: 10px 17px; flex-wrap: wrap; margin-top: 10px; }
.fv-bar-key span { font-size: 11px; color: var(--text-medium); display: grid; grid-template-columns: 8px auto; column-gap: 5px; align-items: center; }
.fv-bar-key i { width: 7px; height: 7px; border-radius: 2px; }
.fv-bar-key b { grid-column: 2; color: var(--text-heading); font: 500 11px var(--font-mono); }

/* fv- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* ── Responsive ── */
@media (max-width: 767px) {
  .fv-mode label { padding: 8px 10px; }
}


/* ---------- rr-  real return (Fisher equation) ----------
   S51: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the real-return engine's own remains. */

/* rr- shell rules removed S51 — the shared ci- shell applies */

/* Field extras (engine-own: optional tag, per-field error, invalid tint) */
.rr-optional { margin-inline-start: 4px; color: var(--text-medium); font-weight: 400; }
.rr-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.45; }
.rr-error:empty { display: none; }
.rr-field .ci-input-wrap:has([aria-invalid="true"]) { border-color: var(--star); }

/* Results: the engine's own rows beneath the shell headline */
.rr-gap-value { color: var(--c3); font-family: var(--font-mono); }
.rr-results .calc-estimate-note { margin: 0; }
.rr-warnings { display: grid; gap: 6px; margin: 17px 0 0 18px; color: var(--text-medium); font-size: 12.5px; line-height: 1.55; }

/* rr- below/kpi/tab rules removed S52 — the shared ci- block applies */


/* ---------- EFFECTIVE ANNUAL RATE CALCULATOR (ear-) — S28 ---------- */
/* Hard Rule 12: all classes prefixed ear-. Tokens only — no hex.
   Hard Rule 29: ear-table-bar / ear-below-actions compliant.
   S51: the form, fields, headline, KPI grid and toast are the shared ci-
   shell (Hard Rule 33). Only what is genuinely the EAR engine's own remains. */

/* ear- shell rules removed S51 — the shared ci- shell applies */

/* Direction mode selector (engine-own) */
.ear-mode { border: 0; padding: 0; margin: 0 0 20px; }
.ear-mode legend { font-size: 13px; font-weight: 600; color: var(--text-medium); margin-bottom: 10px; display: block; }
.calc-tool .ear-mode label { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 7px; cursor: pointer; transition: border-color .16s ease, background .16s ease; }   /* .calc-tool label is a column; this is a row (S51) */
.ear-mode label:hover { border-color: var(--accent); }
.ear-mode input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.ear-mode input[type="radio"]:checked ~ span { color: var(--text-heading); }
.ear-mode label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, rgba(37,99,235,.07)); }
.ear-mode span { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-medium); }
.ear-mode small { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-medium); margin-top: 2px; }

/* Per-field error (engine-own — CI has no per-field errors) */
.ear-error { font-size: 11.5px; font-weight: 600; color: var(--danger); }
.ear-error:empty { display: none; }

/* Rate B comparison strip */
.ear-compare-strip { margin: 20px 0 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ear-compare-heading { font-size: 11px; font-weight: 700; color: var(--text-medium); text-transform: uppercase; letter-spacing: .07em; padding: 10px 14px 0; margin: 0; }
.ear-compare-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0; }
.ear-compare-col { display: grid; gap: 4px; padding: 14px; }
.ear-compare-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-medium); }
.ear-compare-nominal { font: 600 18px var(--font-mono); color: var(--text-heading); }
.ear-compare-freq { font-size: 11px; color: var(--text-medium); }
.ear-compare-ear-val { font: 700 22px var(--font-mono); color: var(--c1); }
.ear-compare-vs { font-size: 12px; font-weight: 700; color: var(--text-medium); padding: 0 8px; text-align: center; }
.ear-winner-tag { display: inline-block; background: var(--success); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; }
.ear-col-b .ear-compare-ear-val { color: var(--c3); }
.ear-compare-note { font-size: 12px; color: var(--text-medium); padding: 8px 14px 12px; margin: 0; line-height: 1.5; border-top: 1px solid var(--border); }

/* ear- below/kpi/tab rules removed S52 — the shared ci- block applies */
.ear-row-highlight td, .ear-row-highlight th { background: var(--accent-soft, rgba(37,99,235,.06)); }
.ear-row-highlight td:last-child { color: var(--accent); font-weight: 700; }

/* ── Responsive ── */
@media (max-width: 767px) {
  .ear-compare-grid { grid-template-columns: 1fr; }
  .ear-compare-vs { padding: 4px 14px; text-align: left; }
}



/* ---------- mg-  mortgage calculator (PITI, PMI auto-drop, amortization) ----------
   Hard Rule 12: all classes prefixed mg-. Tokens only — no hex values.
   Hard Rule 16: all inputs/selects ≥ 16px (enforced by the shared rule at file end).
   Hard Rule 17: SVG has explicit width/height.
   Hard Rule 29: mg-table-bar / mg-below-actions compliant.
   Hard Rule 25: ≤ 6 primary inputs; PITI components in <details>.
   S50: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the mortgage engine's own remains here. */

/* mg- shell rules removed S50 — the shared ci- shell applies */

/* ── Field extras (engine-specific: per-field errors, rate note) ── */
.mg-field-error { font-size: 11.5px; color: var(--danger); min-height: 0; }
.mg-field-error:empty { display: none; }
.mg-rate-note { font-size: 10.5px; color: var(--text-medium); font-style: italic; margin-top: -2px; }

/* ── $/% unit toggle inside the shared input wrap (down payment, property tax) ── */
.mg-toggle-group { display: flex; height: 100%; flex-shrink: 0; }
.mg-unit-btn { border: 0; border-left: 1px solid var(--border); background: transparent;
  color: var(--text-medium); font: 600 12px var(--font-body); padding: 0 10px;
  cursor: pointer; transition: background .14s, color .14s; }
.mg-unit-btn:last-child { border-radius: 0 7px 7px 0; }
.mg-unit-btn.mg-unit-active { background: var(--accent); color: #fff; }
.mg-unit-btn:hover:not(.mg-unit-active) { background: var(--surface-2); }

/* ── Date field: month select + year box side by side ── */
.mg-date-group { display: flex; gap: 8px; }
.mg-date-group .ci-select-wrap { flex: 1; min-width: 0; }
.mg-year-wrap { flex: 0 0 84px; }

/* ── Advanced extras ── */
.mg-pmi-field { transition: opacity .2s; }

/* ── PITI breakdown bar ── */
.mg-breakdown { padding: 14px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-top: 2px; }
.mg-breakdown-bar { height: 9px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.mg-breakdown-bar span { height: 100%; transition: width .22s ease; }
.mg-bar-pi, .mg-key-pi   { background: var(--c1); }
.mg-bar-tax, .mg-key-tax { background: var(--c3); }
.mg-bar-ins, .mg-key-ins { background: var(--c4); }
.mg-bar-pmi, .mg-key-pmi { background: var(--c2); }
.mg-bar-hoa, .mg-key-hoa { background: var(--text-medium); }
.mg-breakdown-key { display: flex; gap: 8px 14px; flex-wrap: wrap; margin-top: 10px; }
.mg-breakdown-key span { font-size: 11px; color: var(--text-medium); display: grid;
  grid-template-columns: 8px auto; column-gap: 5px; align-items: center; }
.mg-breakdown-key i { width: 7px; height: 7px; border-radius: 2px; }
.mg-breakdown-key b { grid-column: 2; color: var(--text-heading); font: 500 12px var(--font-mono); }

/* ── PMI drop notice ── */
.mg-pmi-notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px;
  padding: 10px 12px; border: 1px solid var(--success); border-radius: 8px;
  background: color-mix(in srgb, var(--success) 8%, transparent); font-size: 12px;
  color: var(--text-medium); line-height: 1.5; }
.mg-pmi-notice strong { color: var(--text-heading); }

/* ── Extra payment savings notice ── */
.mg-extra-notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px;
  padding: 10px 12px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent-soft, rgba(37,99,235,.07)); font-size: 12px;
  color: var(--text-medium); line-height: 1.5; }

/* ── 30 vs 15 comparison strip ── */
.mg-compare { margin-top: 18px; }
.mg-compare-title { font-size: 12px; font-weight: 700; color: var(--text-medium);
  text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.mg-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mg-compare-col { border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  background: var(--surface-2); transition: border-color .18s; }
.mg-compare-col.mg-compare-active { border-color: var(--accent); background: var(--accent-soft, rgba(37,99,235,.06)); }
.mg-compare-term { display: block; font-size: 11px; font-weight: 700; color: var(--text-medium);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.mg-compare-col b { display: block; font: 700 20px/1 var(--font-mono); color: var(--text-heading);
  font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.mg-compare-label { display: block; font-size: 11px; color: var(--text-medium); }
.mg-compare-col small { display: block; font-size: 10.5px; color: var(--text-medium); margin-top: 5px; font-family: var(--font-mono); }
.mg-compare-note { font-size: 11.5px; color: var(--text-medium); margin: 10px 0 0; line-height: 1.5; }
.mg-compare-savings { color: var(--success); }

/* mg- below/kpi/tab rules removed S52 — the shared ci- block applies */
.mg-last-row td, .mg-last-row th { font-weight: 600; }
.mg-zero { color: var(--text-medium); }

/* ── Responsive ── */
@media (max-width: 767px) {
  .mg-compare-grid { grid-template-columns: 1fr; }
  .mg-field-date .mg-date-group { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .mg-breakdown-key { flex-direction: column; }
}



/* ---------- MORTGAGE PAYOFF CALCULATOR (mp-) — S43 ----------
   Hard Rule 12: all classes prefixed mp-.
   Hard Rule 23/24: tokens only — no hex values, no hardcoded fonts.
   Hard Rule 16: all inputs ≥16px via global override below.
   Hard Rule 17: inline SVG uses explicit width/height + viewBox.
   CSS prefix: mp-    Engine: mortgage-payoff    Session: S43
   S50: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the payoff engine's own remains here. */

/* mp- shell rules removed S50 — the shared ci- shell applies */

/* mp- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Subtext under a field */
.mp-rate-note, .mp-biweekly-detail {
  font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4;
}

/* Per-field error messages (engine-specific — CI has no per-field errors) */
.mp-field-error {
  font-size: 12px; color: var(--error, #e03131);
  min-height: 0; display: none;
}
.mp-field-error:not(:empty) { display: block; }

/* Next payment date — month select + year box side by side */
.mp-date-group { display: flex; gap: 8px; align-items: stretch; }
.mp-date-group .ci-select-wrap { flex: 1 1 auto; min-width: 0; }
.mp-year-wrap { flex: 0 0 84px; }

/* ── Output panel: the engine's own result blocks ── */

/* Servicer warning */
.mp-servicer-warning {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
  background: var(--surface); border-left: 3px solid var(--warning, #d97706);
  border-radius: 0 6px 6px 0; padding: 10px 14px;
  font-size: 13px; color: var(--text-light); line-height: 1.5;
}
.mp-servicer-warning a { color: var(--accent); }

/* Solver result (pay-by-date) */
.mp-solver-result { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.mp-solver-text { margin: 0; font-size: 14px; color: var(--text-light); }

/* Recast vs prepay comparison */
.mp-recast-compare { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.mp-compare-title { font-size: 13px; font-weight: 700; color: var(--text-heading); margin: 0; }
.mp-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mp-compare-col {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.mp-compare-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.mp-compare-col > b  { font-size: 18px; font-weight: 800; font-family: var(--font-mono); color: var(--text-heading); }
.mp-compare-sub  { font-size: 11px; color: var(--text-muted); }
.mp-compare-col > small { font-size: 12px; color: var(--text-light); }
.mp-recast-note { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; font-style: italic; }

/* PMI acceleration notice */
.mp-pmi-accel {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  font-size: 13px; color: var(--text-light); line-height: 1.5;
}
.mp-pmi-accel-text { flex: 1; }

/* ── Responsive ── */
@media (max-width: 767px) {
  .mp-compare-grid    { grid-template-columns: 1fr; }
}



/* ---------- la-  loan amortization (S36) ----------
   S50: the form, fields, headline and toast are the shared ci- shell (Hard
   Rule 33). Only what is genuinely the amortization engine's own remains. */

/* la- shell rules removed S50 — the shared ci- shell applies */

/* ── Field extras (engine-specific: rate note, per-field errors) ── */
.la-rate-note { color: var(--text-medium); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.la-field-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.la-field-error:empty { display: none; }

/* First-payment date: month select + year box side by side */
.la-date-group { display: flex; gap: 8px; align-items: center; }
.la-date-group .ci-select-wrap { flex: 1; min-width: 0; }
.la-year-wrap { flex: 0 0 84px; }

/* ── Output region: the engine's own result rows ── */

/* Principal / interest split strip */
.la-payoff-strip { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 18px 0 0; padding: 11px 14px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-medium); }
.la-payoff-strip strong { color: var(--text-heading); font-weight: 700; }

/* Extra-payment savings / bi-weekly note (honest explanation) */
.la-biweekly-note { margin: 12px 0 0; padding: 11px 14px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--text-light); font-size: 13px; line-height: 1.6; }
.la-biweekly-note strong { color: var(--text-heading); }

/* Rounding convention note (under the schedule table) */
.la-rounding-note { margin: 0; color: var(--text-medium); font-size: 12px; line-height: 1.55; font-style: italic; }

/* la- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Annual-summary details (engine-own second table under the schedule) */
.la-annual-details { margin-top: 16px; }



/* ══════════════════════════════════════════════════════════════════
   LOAN PAYOFF CALCULATOR  (prefix: lp-)
   Engine: loan-payoff  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   ══════════════════════════════════════════════════════════════════ */

/* ── Form layout ────────────────────────────────────────────────── */
/* .lp-form rule removed S50 — the shared ci- shell applies (block flow, CI spacing) */
/* lp- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* lp- shell rules removed S50 — the shared ci- shell applies
   (field, label, input-wrap, advanced accordion, actions, submit, reset,
   out-top / estimate label, result-label, headline, result-total,
   result-sub, KPI grid → ci-stat-grid, toast). Field error, rate note,
   date pair and every result block below stay the engine's own. */
.lp-field-error { font: 400 12px/1.3 var(--font-body); color: var(--error, #c0392b); min-height: 16px; }
.lp-rate-note { font: 400 11px/1.3 var(--font-body); color: var(--text-medium); }
.lp-date-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Two-column grid for pairs */
.lp-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lp-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Penalty type row */
.lp-penalty-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }

/* ── Output panel ───────────────────────────────────────────────── */
.lp-est-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); display: inline-block; flex-shrink: 0;
}

.lp-out-prompt { font: 400 14px/1.6 var(--font-body); color: var(--text-medium); padding: 24px 0; }

.lp-saving { color: var(--success); }

/* Composition bar */
.lp-composition { margin-bottom: 14px; }
.lp-comp-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
}
.lp-bar-principal { background: var(--c1); display: block; }
.lp-bar-interest  { background: var(--c3); display: block; }
.lp-comp-key { display: flex; gap: 14px; margin-top: 5px; }
.lp-comp-key span { font: 400 12px/1 var(--font-body); color: var(--text-medium); display: flex; align-items: center; gap: 5px; }
.lp-comp-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.lp-key-principal { background: var(--c1); }
.lp-key-interest  { background: var(--c3); }

/* Invest-instead strip */
.lp-invest {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px; background: var(--surface);
}
.lp-invest-title { font: 700 12.5px/1 var(--font-body); color: var(--text-heading); margin: 0 0 10px; }
.lp-invest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.lp-invest-grid > div { display: flex; flex-direction: column; gap: 3px; }
.lp-invest-grid > div span { font: 400 12px/1.3 var(--font-body); color: var(--text-medium); }
.lp-invest-grid > div b { font: 700 16px/1.2 var(--font-mono); color: var(--text-heading); }
.lp-invest-grid > div small { font: 400 11px/1.3 var(--font-body); color: var(--text-medium); }
.lp-invest-payoff { color: var(--success) !important; }
.lp-invest-market { color: var(--c2) !important; }
.lp-invest-note { font: 400 12.5px/1.5 var(--font-body); color: var(--text-medium); margin: 0; }

/* Estimate note (Hard Rule 15) */
.lp-estimate {
  font: 400 12px/1.5 var(--font-body); color: var(--text-medium);
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px;
}

/* ── Below panel: schedule table (column-specific: Period and Date read left) ── */
.lp-table th:nth-child(2), .lp-table td:nth-child(2) { text-align: left; }
.lp-table-note { font: 400 12px/1.5 var(--font-body); color: var(--text-medium); margin: 8px 0 0; }

/* lp-toast rules removed S50 — the shared ci-toast applies */

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .lp-row-2 { grid-template-columns: 1fr; }
  .lp-row-3 { grid-template-columns: 1fr; }
  .lp-penalty-row { grid-template-columns: 1fr; }
  .lp-invest-grid { grid-template-columns: 1fr; }
}

/* ==================================================================
   EARLY LOAN PAYOFF CALCULATOR  (prefix: el-)
   Variant of loan-payoff engine (data-calc-state="early").
   Shell elements use ci- only. el- styles the strategy-comparison
   table, invest-instead strip, and per-field errors — nothing that
   belongs to the shared ci- shell or the shared below block.
   ================================================================== */

/* el- shell rules: none — the shared ci- shell applies */
/* el- below/kpi/tab rules removed S52 — the shared ci- block applies */

.el-field-error { font: 400 12px/1.3 var(--font-body); color: var(--error, #c0392b); min-height: 16px; }
.el-rate-note   { font: 400 11px/1.3 var(--font-body); color: var(--text-medium); }
.el-date-group  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Strategy comparison table ───────────────────────────────────── */
.el-strat-wrap      { margin: 18px 0 0; }
.el-strat-heading   { font: 700 13px/1.2 var(--font-body); color: var(--text-heading); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.el-table-scroll-outer { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.el-strat-table {
  width: 100%; border-collapse: collapse; font: 400 13px/1.4 var(--font-body);
  color: var(--text-body);
}
.el-strat-table th {
  padding: 7px 10px; text-align: start; font: 600 12px/1.3 var(--font-body);
  color: var(--text-medium); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.el-strat-table th:not(:first-child) { text-align: end; }
.el-strat-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  text-align: end;
}
.el-strat-table td.el-strat-name { text-align: start; font-weight: 500; color: var(--text-heading); }
.el-best-row td { background: var(--surface-2, var(--surface)); }
.el-best-badge {
  display: inline-block; margin-left: 6px;
  font: 600 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--success, #2e7d32); background: var(--success-soft, rgba(46,125,50,.12));
  padding: 2px 5px; border-radius: 3px;
}
.el-strat-note { font: 400 11.5px/1.5 var(--font-body); color: var(--text-medium); margin: 8px 0 0; }

/* ── Invest-instead strip ─────────────────────────────────────────── */
.el-invest       { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin: 16px 0 0; }
.el-invest-title { font: 700 12.5px/1 var(--font-body); color: var(--text-heading); margin: 0 0 10px; }
.el-invest-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.el-invest-grid > div { display: flex; flex-direction: column; gap: 3px; }
.el-invest-grid > div span { font: 400 12px/1.3 var(--font-body); color: var(--text-medium); }
.el-invest-grid > div b    { font: 700 16px/1.2 var(--font-mono); color: var(--text-heading); }
.el-invest-grid > div small { font: 400 11px/1.3 var(--font-body); color: var(--text-medium); }
.el-invest-payoff { color: var(--success, #2e7d32) !important; }
.el-invest-market { color: var(--c2) !important; }
.el-invest-note   { font: 400 12.5px/1.5 var(--font-body); color: var(--text-medium); margin: 0; }

/* ── Estimate note ────────────────────────────────────────────────── */
.el-estimate { font: 400 12.5px/1.6 var(--font-body); color: var(--text-medium); margin: 14px 0 0; }
.el-est-dot  {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: middle;
}

/* ── Schedule section (below, Rule 29 — bar and table are the shared ci- classes) ── */
.el-table-strat-note { font: 400 12px/1.4 var(--font-body); color: var(--text-medium); margin: 6px 0 4px; padding: 0 2px; }
.el-table-note    { font: 400 12px/1.5 var(--font-body); color: var(--text-medium); margin: 8px 0 0; }
.el-table th:nth-child(2), .el-table td:nth-child(2) { text-align: left; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .el-invest-grid  { grid-template-columns: 1fr; }
  .el-date-group { grid-template-columns: 1fr; }
}


/* ==================================================================
   AUTO LOAN CALCULATOR  (prefix: al-)
   ================================================================== */

/* al- shell rules removed S50 — the shared ci- shell applies
   (form, form-grid → ci-fields, field, label, input, select, hint note →
   ci-hint, advanced accordion → ci-advanced, form-actions, reset,
   hero stat → ci-result-total, est-tag → ci-topline, KPIs → ci-stat-grid,
   below-head → ci-section-heading, kicker → ci-kicker). Field errors,
   checkboxes, composition bar, alert, term cards and schedule stay the
   engine's own. */

.al-err {
  font: 400 12px/1.3 var(--font-body);
  color: var(--c4);
  min-height: 16px;
}

.al-adv-badge {
  font-weight: 400;
  color: var(--accent);
  margin-left: 6px;
}

.al-field-check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
}

.calc-tool .al-check-label {   /* .calc-tool label is a column; this is a row (S52) */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font: 500 13px/1.3 var(--font-body);
  color: var(--text-medium);
  cursor: pointer;
}

.al-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Results Panel (al-out) — engine-specific blocks under the shell headline ── */
.al-comp-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 21px;
}

.al-comp-title {
  font: 600 12px/1.2 var(--font-body);
  color: var(--text-medium);
  margin: 0;
}

.al-comp-bar {
  display: flex;
  height: 12px;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}

.al-bar-seg {
  height: 100%;
  transition: width 0.25s ease;
}

.al-seg-vehicle {
  background: var(--c1);
}

.al-seg-tax {
  background: var(--c2);
}

.al-seg-interest {
  background: var(--c3);
}

.al-comp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font: 400 11.5px/1.2 var(--font-body);
  color: var(--text-muted);
}

.al-comp-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.al-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.al-dot-vehicle { background: var(--c1); }
.al-dot-tax { background: var(--c2); }
.al-dot-interest { background: var(--c3); }

.al-alert {
  margin-top: 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  font: 400 12.5px/1.4 var(--font-body);
  color: var(--text-heading);
}

/* ── Full Width Below Section (al-below): shared ci- below block; the term cards follow it ── */
/* Term Comparison Cards */
.al-term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.al-term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
}

.al-term-card.al-term-active {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--accent);
}

.al-term-head {
  font: 700 15px/1.2 var(--font-body);
  color: var(--text-heading);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.al-term-pmt {
  font: 700 22px/1.1 var(--font-mono);
  color: var(--text-heading);
}

.al-term-pmt span {
  font: 400 13px/1 var(--font-body);
  color: var(--text-muted);
}

.al-term-row {
  display: flex;
  justify-content: space-between;
  font: 400 12px/1.3 var(--font-body);
  color: var(--text-muted);
}

.al-term-row strong {
  font-family: var(--font-mono);
  color: var(--text-heading);
}

.al-term-foot {
  margin-top: 4px;
  font: 500 11.5px/1.3 var(--font-body);
}

.al-term-warn {
  color: var(--c4);
}

.al-term-base {
  color: var(--text-muted);
}

/* al- below/kpi/tab rules removed S52 — the shared ci- block applies
   (table-details, table-bar, table-bar-title, below-actions, table-scroll, sched-table).
   Column-specific: the Date column is text, so it stays left-aligned; the totals row is bold. */
.al-sched-table th:nth-child(2), .al-sched-table td:nth-child(2) { text-align: left; }
.al-sched-table tfoot th, .al-sched-table tfoot td { font: 600 12px var(--font-mono); color: var(--text-heading); border-top: 2px solid var(--border); border-bottom: none; text-align: right; }
.al-sched-table tfoot th { text-align: left; }
.al-term-section { margin-top: 28px; }
.al-term-grid { margin-top: 16px; }

/* ══════════════════════════════════════════════════════════════════
   STUDENT LOAN CALCULATOR (sl-)
   Tokens only. Mobile inputs >= 16px. Hard Rule 29 compliant export bar.
   ══════════════════════════════════════════════════════════════════ */
/* sl- shell rules removed S50 — the shared ci- shell applies */
.sl-field.has-error .ci-input-wrap, .sl-field.has-error .ci-select-wrap { border-color: var(--c4); }
.sl-field-error { font-size: 12px; color: var(--c4); min-height: 16px; margin-top: 2px; }
.sl-field-error:empty { display: none; }

/* Advanced: the in-school interest checkbox (a row, not the ci-field column) */
.calc-tool .sl-check-field { flex-direction: row; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; font-weight: 500; color: var(--text-heading); cursor: pointer; }
.sl-check-field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* Capitalization Box */
.sl-cap-callout { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sl-cap-row { display: flex; justify-content: space-between; align-items: center; }
.sl-cap-accrued { color: var(--c3); }
.sl-cap-divider { height: 1px; background: var(--border); margin: 2px 0; }
.sl-cap-total { font-weight: 700; color: var(--text-heading); }

/* sl- below/kpi/tab rules removed S52 — the shared ci- block applies
   (kpi-grid/kpi → ci-stat-grid; section card + section-head → ci-section-heading on the graph paper;
   chart-wrap → ci-chart; sched-details/table-bar/-toggle/below-actions → ci-table-wrap/-bar/-toggle,
   ci-below-actions; sched-wrap/sched → ci-table-scroll/ci-table). */
.sl-term-section { margin-top: 28px; }

/* Term Comparison Table */
.sl-term-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 16px; }
.sl-term-table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: start; }
.sl-term-table th { padding: 9px 12px; background: var(--surface-2); border-bottom: 2px solid var(--border); color: var(--text-heading); font-weight: 600; }
.sl-term-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); color: var(--text-body); }
.sl-term-table td:first-child { font-family: var(--font-body); }
.sl-term-table tr.sl-row-current { background: var(--surface-2); font-weight: 700; }
.sl-term-table tr.sl-row-current td { color: var(--accent); }

/* Schedule: the yearly rows are the table's only rows; the totals row is bold (column-specific) */
.sl-sched tfoot td { font-weight: 700; color: var(--text-heading); border-top: 2px solid var(--border); }

/* Disclaimer Callout */
.sl-disclaimer-callout { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 6px; padding: 14px 18px; margin-top: 28px; }
.sl-disclaimer-callout h4 { font-size: 14px; font-weight: 700; color: var(--text-heading); margin: 0 0 6px; }
.sl-disclaimer-callout p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.sl-disclaimer-callout a { color: var(--accent); text-decoration: underline; }



/* ══════════════════════════════════════════════════════════════════
   PERSONAL LOAN CALCULATOR  (prefix: pl-)
   Engine: personal-loan  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   Follows the CI model exactly (Hard Rule 33, S44f).
   ══════════════════════════════════════════════════════════════════ */

/* pl- shell rules removed S50 — the shared ci- shell applies
   (form, form-head, h2, privacy, kicker, fields, field, label, input-wrap,
   select-wrap, hint, advanced block, actions, reset, calc button, out,
   result-head, out-top, est-dot, estimate-label, result-label, headline,
   estimate-note, toast). Field error, prompt, KPI grid and every result
   block below stay the engine's own. */

/* Field error */
.pl-error { min-height: 16px; color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }

/* ── Output region ── */
.pl-out-prompt { color: var(--text-medium); font-size: 14px; line-height: 1.6; padding: 14px 0; }

/* pl- below/kpi/tab rules removed S52 — the shared ci- block applies
   (kpi-grid/kpi/kpi-label → ci-stat-grid; below-head → ci-section-heading; table-details/-bar/-toggle,
   below-actions → ci-table-wrap/-bar/-toggle, ci-below-actions; sched-scroll/sched → ci-table-scroll/ci-table). */

/* Payoff date strip */
.pl-payoff-strip { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px 20px; margin: 0 0 18px; padding: 11px 14px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-medium); }
.pl-payoff-strip strong { color: var(--text-heading); font-weight: 700; }

/* Extra payment savings callout */
.pl-extra-callout { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; padding: 12px 14px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; color: var(--text-light); }
.pl-extra-icon { font-size: 18px; flex-shrink: 0; }
.pl-extra-callout strong { color: var(--success); }

/* Composition bar — a div bar on the shared ci-composition-bar/-key; segment + swatch colours are backgrounds */
.pl-comp-section { margin-bottom: 18px; }
.pl-comp-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 8px; }
.pl-bar-principal { background: var(--c1); }
.pl-bar-interest  { background: var(--c3); }
.pl-bar-fee       { background: var(--c4); }

/* Rounding note */
.pl-rounding-note { margin: 0 0 18px; color: var(--text-medium); font-size: 12px; line-height: 1.55; font-style: italic; }

/* ── calc-below: the shared ci- below block; the term strip (engine-own) follows the table ── */

/* Term comparison strip */
.pl-term-strip { margin-top: 28px; }
.pl-term-strip-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 12px; }
.pl-term-cards { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.pl-term-card { flex: 0 0 auto; min-width: 100px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.pl-term-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.pl-term-mo  { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-medium); }
.pl-term-pmt { font: 700 16px/1.2 var(--font-mono); color: var(--text-heading); }
.pl-term-int { font-size: 11.5px; color: var(--text-medium); }
.pl-term-apr { font-size: 11px; color: var(--text-muted); }

/* Extra payment column (column-specific) */
.pl-extra-col { color: var(--success); font-weight: 700; }

/* pl-toast rules removed S50 — the shared ci-toast applies */

/* ── Responsive ── */
@media (max-width: 767px) {
  .pl-term-cards { gap: 8px; }
  .pl-term-card { min-width: 90px; padding: 10px 12px; }
}


/* ==========================================================================
   BUSINESS LOAN CALCULATOR ENGINE (bl-)
   ========================================================================== */

/* bl- shell rules removed S50 — the shared ci- shell applies */

/* bl- below/kpi/tab rules removed S52 — the shared ci- block applies
   (mode-selector/mode-btn → ci-mode-tabs/-tab; kpi-grid/kpi/kpi-label → ci-stat-grid; below-head →
   ci-section-heading; table-details/-bar/-toggle, below-actions → ci-table-wrap/-bar/-toggle,
   ci-below-actions; sched-scroll/sched → ci-table-scroll/ci-table). */

/* Per-field error line (CI has no per-field errors) */
.bl-error { min-height: 16px; color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.bl-error:empty { display: none; }
.bl-form input[aria-invalid="true"] { background: rgba(245,158,11,.06); }

/* Extra payment callout */
.bl-extra-callout { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; padding: 12px 14px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; color: var(--text-light); }
.bl-extra-icon { font-size: 18px; flex-shrink: 0; }
.bl-extra-callout strong { color: var(--success); }

/* Cost composition bar — a div bar on the shared ci-composition-bar/-key; segment + swatch colours are backgrounds */
.bl-comp-section { margin-bottom: 18px; }
.bl-comp-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 8px; }
.bl-bar-principal { background: var(--c1); }
.bl-bar-interest  { background: var(--c3); }
.bl-bar-fee       { background: var(--c4); }

.bl-rounding-note { margin: 0 0 18px; color: var(--text-medium); font-size: 12px; line-height: 1.55; font-style: italic; }

/* Term Comparison Strip */
.bl-term-strip { margin-top: 28px; }
.bl-term-strip-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 12px; }
.bl-term-cards { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.bl-term-card { flex: 0 0 auto; min-width: 105px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.bl-term-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.bl-term-yr  { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-medium); }
.bl-term-pmt { font: 700 16px/1.2 var(--font-mono); color: var(--text-heading); }
.bl-term-pmt small { font-size: 11px; font-weight: 500; }
.bl-term-int { font-size: 11.5px; color: var(--text-medium); }
.bl-term-apr { font-size: 11px; color: var(--text-muted); }

.bl-sched-note { color: var(--text-muted); font-size: 12px; line-height: 1.4; margin: 8px 10px; }

/* Responsive adjustments */
@media (max-width: 767px) {
  .bl-term-cards { gap: 8px; }
  .bl-term-card { min-width: 95px; padding: 10px 12px; }
}


/* ══════════════════════════════════════════════════════════════════
   LOAN COMPARISON CALCULATOR  (prefix: lc-)
   Engine: loan-comparison  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   Compare 2–4 loan offers: fee-inclusive APR, horizon cost,
   per-metric verdicts, balance chart, per-offer schedule.
   ══════════════════════════════════════════════════════════════════ */

/* lc- shell rules removed S50 — the shared ci- shell applies */

/* lc- below/kpi/tab rules removed S52 — the shared ci- block applies
   (count-tabs/count-btn → ci-mode-tabs/-tab; below-head → ci-section-heading; chart-wrap → ci-chart;
   table-details/-bar/-toggle, below-actions → ci-table-wrap/-bar/-toggle, ci-below-actions;
   sched-scroll/sched → ci-table-scroll/ci-table). The comparison grid, verdicts, callout and
   composition bars are the engine's own. */
.lc-count-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.lc-count-label { font: 500 13px var(--font-body); color: var(--text-medium); }
.lc-count-row .ci-mode-tabs { margin: 0; flex: 1; min-width: 200px; }

/* Horizon row */
.lc-horizon-row { margin-bottom: 18px; display: grid; gap: 6px; max-width: 220px; }
.lc-horizon-wrap { max-width: 180px; }

/* Offers grid — 2–4 panels, auto-fill */
.lc-offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

/* Individual offer panel */
.lc-offer-panel {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--surface);
}
.lc-offer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 8px;
  border-bottom: 1px solid var(--border);
}
/* Offer colour bands (c1–c4, Hard Rule 24 — never hex) */
.lc-offer-color-1 { background: color-mix(in srgb, var(--c1) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c1) 20%, var(--border)); }
.lc-offer-color-2 { background: color-mix(in srgb, var(--c3) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c3) 20%, var(--border)); }
.lc-offer-color-3 { background: color-mix(in srgb, var(--c2) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c2) 20%, var(--border)); }
.lc-offer-color-4 { background: color-mix(in srgb, var(--c4) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c4) 20%, var(--border)); }
/* Badge letter */
.lc-badge-1, .lc-badge-2, .lc-badge-3, .lc-badge-4 {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font: 700 12px var(--font-mono); color: #fff; flex-shrink: 0;
}
.lc-badge-1 { background: var(--c1); }
.lc-badge-2 { background: var(--c3); }
.lc-badge-3 { background: var(--c2); }
.lc-badge-4 { background: var(--c4); }
/* S120 contrast: white on the light c1/c2/c3 and on every dark-theme series colour was 2.3–3.7:1. */
.lc-badge-1, .lc-badge-2, .lc-badge-3 { color: #0B1220; }
body.dark-mode .lc-badge-4 { color: #0B1220; }
/* Offer name — an editable title, not a bordered field (beats the generic .calc-tool input[type="text"] rule) */
.calc-tool input.lc-offer-label {
  flex: 1; border: none; background: transparent; outline: none; box-shadow: none;
  font: 600 14px var(--font-body); color: var(--text-heading);
  min-width: 0; min-height: 0; width: auto; padding: 0; border-radius: 0;
}
.calc-tool input.lc-offer-label:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Offer field area (the fields inside are ci-field — shell) */
.lc-fields { display: grid; gap: 14px; padding: 14px; }

/* Field error (CI has no per-field errors) */
.lc-field-error { min-height: 16px; color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.lc-field-error:empty { display: none; }
.lc-form input[aria-invalid="true"] { background: rgba(245,158,11,.06); }

/* Advanced block inside each offer panel */
.lc-adv { border-top: 1px solid var(--border); }
.lc-adv-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 42px; padding: 0 14px; cursor: pointer;
  color: var(--accent); font-size: 13.5px; font-weight: 700; list-style: none;
}
.lc-adv-summary::-webkit-details-marker { display: none; }
.lc-adv-count { font-size: 12px; color: var(--text-muted); font-weight: 400; font-family: var(--font-mono); }
.lc-adv-grid  { display: grid; gap: 14px; padding: 4px 14px 14px; }

/* ── Output region ── */
.lc-out-prompt { color: var(--text-medium); font-size: 14px; line-height: 1.6; padding: 14px 0; }
.lc-estimate-note  { margin: 14px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.55; }

/* Results metric table */
.lc-table-wrap  { overflow-x: auto; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; }
.lc-compare-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.lc-compare-header th {
  padding: 10px 12px; background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text-medium);
  letter-spacing: .05em; text-align: start; white-space: nowrap;
}
.lc-compare-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.lc-compare-table tbody tr:last-child td { border-bottom: 0; }
.lc-compare-name { font: 600 12.5px var(--font-body); color: var(--text-medium); white-space: nowrap; text-align: start; }
.lc-compare-val  { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text-heading); text-align: end; white-space: nowrap; }
/* Offer column colour bands (header) */
.lc-offer-col-1 { border-left: 3px solid var(--c1); }
.lc-offer-col-2 { border-left: 3px solid var(--c3); }
.lc-offer-col-3 { border-left: 3px solid var(--c2); }
.lc-offer-col-4 { border-left: 3px solid var(--c4); }

/* Verdict tags */
.lc-verdict { display: inline-flex; align-items: center; margin-left: 5px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; font-family: var(--font-body); white-space: nowrap; }
.lc-verdict-best  { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.lc-verdict-worst { background: color-mix(in srgb, var(--c3) 10%, transparent);     color: var(--c3); }
.lc-tied { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* Horizon callout */
.lc-hz-callout {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 14px; padding: 11px 14px;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; line-height: 1.55; color: var(--text-light);
}
.lc-hz-icon { font-size: 16px; flex-shrink: 0; }

/* Composition bars — one div bar per offer on the shared ci-composition-bar */
.lc-comp-section { margin-bottom: 12px; }
.lc-comp-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-medium); margin-bottom: 8px; }
.lc-comp-bar-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lc-comp-bar-wrap > .lc-comp-label { font: 600 11.5px var(--font-body); color: var(--text-medium); white-space: nowrap; min-width: 52px; margin: 0; text-transform: none; letter-spacing: 0; }
.lc-comp-bar-wrap .lc-comp-bar { flex: 1; min-width: 0; }
.lc-seg-principal { background: var(--c1); }
.lc-seg-interest  { background: var(--c3); }
.lc-seg-fees      { background: var(--c4); }
.lc-comp-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-medium); margin-top: 6px; }
.lc-comp-legend span { display: flex; align-items: center; gap: 6px; }
.lc-legend-swatch { display: inline-block !important; width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }

/* ── Below: the shared ci- below block; the chart-data table and per-offer schedules follow ── */
.lc-legend-axis { margin-left: auto; font-weight: 400; }

/* Chart accessible table */
.lc-chart-table-details { margin-top: 16px; }
.lc-chart-table-details summary { font-size: 13px; color: var(--accent); cursor: pointer; font-weight: 600; padding: 6px 0; }
.lc-table-details + .lc-table-details { margin-top: 0; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .lc-offers-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 767px) {
  .lc-offers-grid { grid-template-columns: 1fr 1fr; }
  .lc-horizon-row  { max-width: 100%; }
  .lc-horizon-wrap { max-width: 100%; }
  .lc-compare-val { font-size: 13px; }
}
@media (max-width: 480px) {
  .lc-offers-grid { grid-template-columns: 1fr; }
  .lc-comp-bar-wrap { flex-direction: column; align-items: flex-start; }
  .lc-comp-bar-wrap .lc-comp-bar { width: 100%; }
}



/* ══════════════════════════════════════════════════════════════════
   BALLOON PAYMENT CALCULATOR  (prefix: bp-)
   Engine: balloon-payment  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   Follows the CI shell exactly (Hard Rule 33, S53).
   bp- classes cover ONLY: mode tabs, risk callout, IO toggle,
   chart, schedule table, field error spans.
   ══════════════════════════════════════════════════════════════════ */

/* bp- shell rules removed — the shared ci- shell applies */
/* bp- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* IO toggle */
.bp-io-field { align-items: flex-start; }
.bp-io-wrap  { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.bp-io-chk   { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.bp-io-label { font: 500 14px var(--font-body); color: var(--text-body); cursor: pointer; }

/* Per-field error spans */
.bp-field-error {
  display: block; min-height: 15px;
  font: 600 12px var(--font-body); color: var(--star);
  margin: -10px 0 6px; line-height: 1.4;
}

/* Risk disclosure callout (above the fold in the result column) */
.bp-risk-callout {
  margin: 18px 0 0; padding: 14px 16px;
  background: var(--surface-2);
  border-left: 4px solid var(--star);
  border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--text-medium); line-height: 1.55;
}
.bp-risk-callout strong { color: var(--text-heading); }

/* SVG chart series — tokens only (the wrapper is the shared .ci-chart) */
.bp-chart-fill   { fill: var(--c1); opacity: .1; }
.bp-chart-line   { fill: none; stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; }
.bp-chart-cliff  { stroke: var(--c3); stroke-width: 1.5; stroke-dasharray: 5 4; }
.bp-chart-dot    { fill: var(--c3); }
.bp-chart-axis   { stroke: var(--border); stroke-width: 1; }
.ci-chart .bp-chart-balloon-label { font: 600 11px var(--font-body); fill: var(--c3); }

/* Schedule total row (engine-own: the shared .ci-table has no footer) */
.bp-sched tfoot td { border-top: 2px solid var(--border); font-weight: 700; color: var(--text-heading); }
.bp-sched tfoot td:first-child { font-family: var(--font-body); }

/* ══════════════════════════════════════════════════════════════════
   REFINANCE CALCULATOR (rf-)
   Tokens only. Mobile inputs >= 16px. Hard Rule 29 compliant export bar.
   ══════════════════════════════════════════════════════════════════ */
/* rf- shell rules: uses shared ci- classes */
/* rf- below/kpi/tab rules removed S52 — the shared ci- block applies */
.rf-err { min-height: 16px; color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.rf-err:empty { display: none; }

/* Alert Box */
.rf-alert-box {
  margin: 0 0 16px; padding: 13px 15px; border-radius: 9px;
  font-size: 13.5px; line-height: 1.55;
}
.rf-alert-good {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border));
  color: var(--text-heading);
}
.rf-alert-good strong { color: var(--success); }
.rf-alert-warn {
  background: color-mix(in srgb, var(--c4, #f59e0b) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c4, #f59e0b) 40%, var(--border));
  color: var(--text-heading);
}
.rf-alert-warn strong { color: var(--c4, #f59e0b); }

/* Same Payoff Date Strategy Card */
.rf-same-payoff-card {
  margin: 0 0 18px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.rf-same-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rf-same-badge {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 999px;
}
.rf-same-head h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-heading); }
.rf-same-desc { margin: 0; font-size: 13px; color: var(--text-medium); line-height: 1.55; }
.rf-same-desc strong { color: var(--accent); }

/* Comparison Table Card (engine-own comparison grid) */
.rf-compare-card {
  margin: 0 0 18px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); padding: 14px 16px;
}
.rf-card-title {
  margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text-heading);
}
.rf-compare-table-wrap { overflow-x: auto; }
.rf-compare-table {
  width: 100%; border-collapse: collapse; font-size: 13px; text-align: right;
}
.rf-compare-table th, .rf-compare-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
}
.rf-compare-table th {
  background: var(--surface-2); font-weight: 600; color: var(--text-medium);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; text-align: right;
}
.rf-compare-table th:first-child, .rf-compare-table td:first-child {
  text-align: left; font-weight: 600; color: var(--text-heading);
}
.rf-compare-table td:nth-child(2), .rf-compare-table td:nth-child(3), .rf-compare-table td:nth-child(4) {
  font-family: var(--font-mono); color: var(--text-light);
}
.rf-compare-table tr:last-child td { border-bottom: none; }

.rf-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }

/* Savings-table sign colour (column-specific) */
.rf-val-good { color: var(--success) !important; font-weight: 600; }
.rf-val-neg  { color: var(--c4, #f59e0b) !important; }


/* ══════════════════════════════════════════════════════════════════
   LOAN CONSOLIDATION CALCULATOR (lcn-)
   Tokens only. Mobile inputs >= 16px. Hard Rule 29 compliant export bar.
   ══════════════════════════════════════════════════════════════════ */
/* lcn- shell rules: uses shared ci- classes */
/* lcn- below/kpi/tab rules removed S52 — the shared ci- block applies */

.lcn-debts-section {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.lcn-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.lcn-section-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
}
.lcn-debt-count-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 999px;
}

.lcn-debts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.lcn-debt-row {
  padding: 12px 14px;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
}
body.dark-mode .lcn-debt-row {
  background: var(--surface-2);
}

.lcn-debt-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.lcn-d-name {
  flex: 1;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-heading);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  transition: all .15s ease;
}
.lcn-d-name:hover, .lcn-d-name:focus {
  background: var(--surface);
  border-color: var(--border);
}
.lcn-del-debt-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all .15s ease;
}
.lcn-del-debt-btn:hover {
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.1);
}

.lcn-debt-fields {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.lcn-add-debt-btn {
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.lcn-new-loan-section {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Term Extension Alert */
.lcn-term-warning {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.55;
  background: color-mix(in srgb, var(--c4, #f59e0b) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c4, #f59e0b) 40%, var(--border));
  color: var(--text-heading);
}
.lcn-term-warning strong { color: var(--c4, #f59e0b); }

/* Summary Comparison Table */
.lcn-summary-table-wrap {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  background: var(--surface);
}
.lcn-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lcn-summary-table th, .lcn-summary-table td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.lcn-summary-table th:first-child, .lcn-summary-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-heading);
}
.lcn-summary-table th {
  background: var(--surface-card, #fff);
  font-weight: 700;
  color: var(--text-medium);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
body.dark-mode .lcn-summary-table th {
  background: var(--surface-2);
}
.lcn-summary-table tr:last-child td { border-bottom: none; }

.lcn-text-danger { color: var(--danger, #ef4444); font-weight: 600; }

@media (max-width: 640px) {
  .lcn-debt-fields { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- ap-  APR calculator (TILA / Reg Z, S52) ---------- */
/* ap- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Field-level inline error */
.ap-field-error {
  font-size: 12px;
  color: var(--danger, #ef4444);
  margin: -8px 0 6px;
  min-height: 0;
  line-height: 1.4;
}
.ap-field-error:empty { display: none; }

/* TILA vs APY disambiguation note */
.ap-note-box {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-medium);
}
.ap-note-box a { color: var(--accent); }

/* Reg Z checklist toggle */
.ap-checklist-wrap {
  margin: 14px 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
}
.ap-checklist-toggle {
  display: block;
  padding: 9px 14px;
  font: 600 13px var(--font-body);
  color: var(--text-heading);
  cursor: pointer;
  list-style: none;
  background: var(--surface-2);
}
.ap-checklist-toggle::-webkit-details-marker { display: none; }
.ap-checklist {
  padding: 10px 14px 14px;
  background: var(--surface);
}
.ap-checklist-head {
  font: 600 12.5px var(--font-body);
  margin: 8px 0 4px;
}
.ap-counts-yes { color: var(--success, #16a34a); }
.ap-counts-no  { color: var(--danger, #ef4444); }
.ap-checklist-list {
  margin: 0 0 6px 1.2em;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-medium);
}
.ap-checklist-source {
  font-size: 11.5px;
  color: var(--text-muted, var(--text-medium));
  margin-top: 8px;
  font-style: italic;
}

/* Fee table: the "Note" column is prose (column-specific) */
.ap-detail-table th:nth-child(3), .ap-detail-table td:nth-child(3) { text-align: left; white-space: normal; }
.ap-note-cell { font: 500 11.5px var(--font-body); opacity: .85; }

.ap-solver-note {
  font-size: 11.5px;
  color: var(--text-medium);
  margin: 10px 0 0;
  font-style: italic;
  line-height: 1.5;
}

/* ---------- fha- (FHA Loan Calculator — S57) -------------------- */

/* Engine-own parts only — the ci- shell handles all shared elements.
   Prefix fha- appears only on FHA-specific components:
   MIP breakdown bar, comparison strip, county limit badge,
   FICO tier badge, chart, table. Never on shell elements. */

/* ── Down payment toggle ── */
.fha-with-toggle {
  display: flex; align-items: stretch; gap: 0;
}
.fha-with-toggle input { flex: 1 1 auto; border-right: none; border-radius: 6px 0 0 6px; }
.fha-toggle-group {
  display: flex; flex-shrink: 0;
}
.fha-unit-btn {
  padding: 0 11px; font: 600 12px var(--font-body);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-left: none; color: var(--text-medium); cursor: pointer;
  transition: background .15s, color .15s;
}
.fha-unit-btn:first-child { border-radius: 0; }
.fha-unit-btn:last-child  { border-radius: 0 6px 6px 0; }
.fha-unit-btn.fha-unit-active,
.fha-unit-btn:hover { background: var(--accent); color: #fff; }

/* ── Rate note ── */
.fha-rate-note {
  font: 400 11.5px var(--font-body); color: var(--text-medium);
  margin-top: 3px; display: block;
}

/* ── FICO badge ── */
.fha-fico-badge {
  display: inline-block; font: 600 11px var(--font-mono);
  border-radius: 4px; padding: 2px 7px; margin-top: 4px;
  letter-spacing: .02em;
}
.fha-fico-good { background: var(--success-soft, #d1fae5); color: var(--success, #059669); }
.fha-fico-warn { background: #fef3c7; color: #b45309; }
.fha-fico-bad  { background: #fee2e2; color: #dc2626; }

/* ── County limit hint ── */
.fha-limit-hint {
  font: 400 11.5px var(--font-body); color: var(--text-medium);
  margin-top: 3px; display: block;
}

/* ── County limit warning (inline, beside result) ── */
.fha-limit-warn {
  display: flex; gap: 8px; align-items: flex-start;
  background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px;
  padding: 9px 12px; font: 400 13px var(--font-body); color: #92400e;
  margin-top: 12px;
}
.fha-limit-warn[hidden] { display: none; }
body.dark-mode .fha-limit-warn { background: #451a03; border-color: #78350f; color: #fef08a; }

/* ── PITI + MIP breakdown bar ── */
.fha-breakdown { margin: 14px 0 4px; }
.fha-breakdown-bar {
  display: flex; height: 10px; border-radius: 5px;
  overflow: hidden; background: var(--surface-2);
}
.fha-bar-pi  { background: var(--c1); transition: width .3s; }
.fha-bar-mip { background: var(--c4, #8b5cf6); transition: width .3s; }
.fha-bar-tax { background: var(--c3, #f59e0b); transition: width .3s; }
.fha-bar-ins { background: var(--c2, #10b981); transition: width .3s; }
.fha-bar-hoa { background: var(--border-strong); transition: width .3s; }
.fha-breakdown-key {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin-top: 9px; font: 400 12.5px var(--font-body); color: var(--text-medium);
}
.fha-breakdown-key span { display: flex; align-items: center; gap: 5px; }
.fha-breakdown-key i {
  display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0;
}
.fha-key-pi  { background: var(--c1); }
.fha-key-mip { background: var(--c4, #8b5cf6); }
.fha-key-tax { background: var(--c3, #f59e0b); }
.fha-key-ins { background: var(--c2, #10b981); }
.fha-key-hoa { background: var(--border-strong); }
.fha-breakdown-key b { color: var(--text-heading); font-weight: 600; }

/* ── Loandata badge ── */
.fha-data-badge {
  margin-top: 8px;
  font: 400 11.5px var(--font-mono); color: var(--text-medium);
}

/* ── FHA vs conventional comparison strip ── */
.fha-compare { margin-top: 18px; }
.fha-compare-title {
  font: 600 12px var(--font-body); color: var(--text-medium);
  text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px;
}
.fha-compare-grid { display: flex; gap: 10px; }
.fha-compare-col {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.fha-compare-fha  { border-color: var(--c4, #8b5cf6); }
.fha-compare-conv { border-color: var(--border-strong); }
.fha-compare-label {
  font: 600 11px var(--font-mono); color: var(--text-medium);
  text-transform: uppercase; letter-spacing: .08em;
}
.fha-compare-col b {
  font: 700 clamp(20px,3vw,26px)/1 var(--font-display); color: var(--text-heading);
}
.fha-compare-sub { font: 400 11.5px var(--font-body); color: var(--text-medium); }
.fha-compare-col small { font: 400 11px var(--font-body); color: var(--text-medium); }
.fha-compare-note {
  font: 400 12.5px var(--font-body); color: var(--text-medium);
  margin-top: 10px; line-height: 1.5;
}
.fha-compare-note small { display: block; margin-top: 4px; font-size: 11px; }

/* fha- below/kpi/tab rules removed S52 — the shared ci- block applies */
.fha-mip-ended { font-style: italic; color: var(--text-medium); font-size: 11px; }   /* column-specific cell */

/* Field-level errors */
.fha-field-error {
  display: block; font: 400 11.5px var(--font-body);
  color: var(--error, #dc2626); min-height: 16px; margin-top: 2px;
}
.fha-date-group { display: flex; gap: 8px; }
.fha-year-wrap  { max-width: 90px; }
.fha-year-input { width: 80px; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .fha-compare-grid  { flex-direction: column; }
  .fha-fico-badge    { font-size: 10px; }
}

/* ---------- va- (VA Mortgage Calculator) --------------------------------
   CSS prefix: va-   Hard Rule 12 / 33: engine-own parts only.
   No shell element is re-stated here.                                    */

/* ── Payment breakdown bar ── */
.va-breakdown { margin: 12px 0 10px; }
.va-breakdown-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: var(--surface-2); margin-bottom: 8px;
}
.va-bar-pi  { background: var(--c1); transition: width .3s; }
.va-bar-tax { background: var(--c3); transition: width .3s; }
.va-bar-ins { background: var(--c4); transition: width .3s; }
.va-bar-hoa { background: var(--c2); transition: width .3s; }
.va-breakdown-key {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font: 500 11.5px var(--font-body); color: var(--text-medium);
}
.va-breakdown-key i {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 4px; vertical-align: middle;
}
.va-key-pi  { background: var(--c1); }
.va-key-tax { background: var(--c3); }
.va-key-ins { background: var(--c4); }
.va-key-hoa { background: var(--c2); }

/* ── No-PMI highlight ── */
.va-no-pmi-note {
  margin: 6px 0 0;
  font: 600 12px var(--font-body);
  color: var(--success);
}

/* ── KPI grid — spacing only (the ci-stat-grid look is shared) ── */
.va-kpi-grid { margin-top: 10px; }

/* ── Exempt badge ── */
.va-exempt-badge {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 0;
  padding: 7px 12px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--success);
  font: 600 12px var(--font-body); color: var(--success);
}

/* ── Loandata badge ── */
.va-data-badge { margin: 6px 0; font: 400 11px var(--font-body); color: var(--text-medium); }

/* ── Entitlement block ── */
.va-entitlement {
  margin: 10px 0 4px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.va-entitlement-title {
  margin: 0 0 8px; font: 600 12px var(--font-body); color: var(--text-heading);
  text-transform: uppercase; letter-spacing: .04em;
}
.va-ent-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px;
  font: 500 12px var(--font-body);
}
.va-ent-grid span { display: block; color: var(--text-medium); margin-bottom: 2px; }
.va-ent-grid b   { display: block; font: 600 14px var(--font-mono); color: var(--text-heading); }
.va-ent-note {
  margin: 8px 0 0; font: 400 11px var(--font-body); color: var(--text-medium); line-height: 1.5;
}

/* ── 3-way comparison ── */
.va-compare { margin: 10px 0; }
.va-compare-title {
  font: 600 12px var(--font-body); color: var(--text-heading);
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px;
}
.va-compare-grid {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.va-compare-col {
  flex: 1 1 120px; padding: 10px 12px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.va-cmp-va { border-color: var(--c1); }
.va-compare-label {
  font: 700 10px var(--font-mono); letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-medium);
}
.va-cmp-va .va-compare-label { color: var(--c1); }
.va-compare-col b {
  font: 700 20px var(--font-display); color: var(--text-heading); line-height: 1.1;
}
.va-compare-sub { font: 400 11px var(--font-body); color: var(--text-medium); }
.va-compare-col small { font: 400 11px var(--font-body); color: var(--text-medium); margin-top: 4px; }
.va-compare-note { font: 400 11.5px var(--font-body); color: var(--text-medium); margin: 6px 0 0; }

/* ── Rate note ── */
.va-rate-note {
  display: block; font: 400 11px var(--font-body);
  color: var(--text-medium); margin-top: 3px;
}

/* ── Field errors ── */
.va-field-error {
  display: block; font: 400 11.5px var(--font-body);
  color: var(--error, #dc2626); min-height: 16px; margin-top: 2px;
}

/* ── Toggle group (down payment $/%) ── */
.va-with-toggle { position: relative; }
.va-toggle-group {
  display: flex; position: absolute; right: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--border); overflow: hidden; border-radius: 0 6px 6px 0;
}
.va-unit-btn {
  padding: 0 10px; background: transparent; border: none; cursor: pointer;
  font: 600 12px var(--font-mono); color: var(--text-medium);
}
.va-unit-btn.va-unit-active {
  background: var(--accent); color: #fff;
}

/* va- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* ── Date group ── */
.va-date-group { display: flex; gap: 8px; }
.va-year-wrap  { max-width: 90px; }
.va-year-input { width: 80px; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .va-compare-grid   { flex-direction: column; }
  .va-ent-grid       { grid-template-columns: 1fr; }
}



/* ======================================================================
   USDA MORTGAGE CALCULATOR  (usda-)
   CSS prefix: usda-
   Shell elements use ci- classes (Hard Rule 33). This block styles only
   the engine-own parts: breakdown bar, comparison strip, eligibility box,
   custom SVG chart, and amortization table.
   ====================================================================== */

/* ── Monthly payment breakdown bar ── */
.usda-breakdown { margin: 12px 0 10px; }
.usda-breakdown-bar {
  display: flex; height: 10px; border-radius: 5px;
  overflow: hidden; gap: 2px; margin-bottom: 8px;
}
.usda-bar-pi  { background: var(--c1); transition: width .3s; }
.usda-bar-fee { background: var(--c2); transition: width .3s; }
.usda-bar-tax { background: var(--c3); transition: width .3s; }
.usda-bar-ins { background: var(--c4); transition: width .3s; }
.usda-bar-hoa { background: var(--accent); transition: width .3s; }
.usda-breakdown-key {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font: 400 12px var(--font-body); color: var(--text-medium);
}
.usda-breakdown-key i {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 2px; margin-right: 5px; vertical-align: middle;
}
.usda-key-pi  { background: var(--c1); }
.usda-key-fee { background: var(--c2); }
.usda-key-tax { background: var(--c3); }
.usda-key-ins { background: var(--c4); }
.usda-key-hoa { background: var(--accent); }
.usda-breakdown-key b { color: var(--text-heading); font-weight: 600; margin-left: 3px; }
.usda-fee-note {
  font: 400 11.5px var(--font-body); color: var(--text-medium);
  margin: 6px 0 0; line-height: 1.4;
}

/* ── KPI Grid ── */
.usda-kpi-grid { margin-top: 10px; }

/* ── Comparison strip ── */
.usda-compare { margin: 14px 0 10px; }
.usda-compare-title {
  font: 600 12.5px var(--font-body); color: var(--text-heading);
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em;
}
.usda-compare-grid {
  display: flex; gap: 8px;
}
.usda-compare-col {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column;
}
.usda-cmp-usda { border-color: var(--c1); background: var(--surface-2); }
.usda-compare-label {
  font: 700 11px var(--font-mono); text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-medium); margin-bottom: 2px;
}
.usda-cmp-usda .usda-compare-label { color: var(--c1); }
.usda-compare-col b {
  font: 700 16px var(--font-mono); color: var(--text-heading);
  line-height: 1.2;
}
.usda-compare-sub { font: 400 11px var(--font-body); color: var(--text-medium); margin-top: 2px; }
.usda-compare-col small { font: 400 10.5px var(--font-body); color: var(--text-medium); margin-top: 4px; }
.usda-compare-note { font: 400 11.5px var(--font-body); color: var(--text-medium); margin: 6px 0 0; line-height: 1.4; }

/* ── Eligibility callout box ── */
.usda-eligibility-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
}
.usda-elig-title {
  font: 600 13px var(--font-body); color: var(--text-heading); margin: 0 0 6px;
}
.usda-elig-list {
  margin: 0 0 10px; padding-left: 18px; font: 400 12px var(--font-body); color: var(--text-medium); line-height: 1.4;
}
.usda-elig-list li { margin-bottom: 4px; }
.usda-elig-list strong { color: var(--text-heading); }
.usda-elig-links {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.usda-link-btn {
  font-size: 11.5px !important; padding: 4px 10px !important; text-decoration: none;
}

/* ── Form specific field notes ── */
.usda-rate-note {
  font: 400 11px var(--font-body); color: var(--text-medium);
  margin-top: 2px; display: block;
}
.usda-field-error {
  font: 400 11.5px var(--font-body); color: var(--error, #e53e3e);
  margin-top: 2px; display: block; min-height: 0;
}
.usda-with-toggle { position: relative; }
.usda-toggle-group {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px;
}
.usda-unit-btn {
  padding: 2px 7px; font: 600 11px var(--font-mono); border: 1px solid var(--border);
  border-radius: 3px; background: var(--surface); color: var(--text-medium);
  cursor: pointer; line-height: 1.4;
}
.usda-unit-btn.usda-unit-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* usda- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* ── Date group ── */
.usda-date-group { display: flex; gap: 8px; }
.usda-year-wrap  { max-width: 90px; }
.usda-year-input { width: 80px; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .usda-compare-grid   { flex-direction: column; }
}

/* ======================================================================
   DOWN PAYMENT CALCULATOR  (dp-)
   CSS prefix: dp-
   Shell elements use ci- classes (Hard Rule 33). This block styles only
   the engine-own parts: mode tabs, tier comparison table, and savings
   timeline output area.
   ====================================================================== */

/* dp- below/kpi/tab rules removed S52 — the shared ci- block applies */
.dp-panel-hidden { display: none !important; }
.dp-rate-note { display: block; font: 400 11px var(--font-body); color: var(--text-medium); margin-top: 3px; }

/* highlighted row (the 20% tier) */
.dp-tier-table tr.dp-row-highlight td {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-weight: 600;
}

/* PMI badge */
.dp-pmi-yes {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--c2) 15%, transparent);
  color: var(--c2);
  border-radius: 4px;
}
.dp-pmi-no {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
  border-radius: 4px;
}

/* ── PMI notice ── */
.dp-pmi-notice {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--c3, #f59e0b) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c3, #f59e0b) 35%, transparent);
  border-radius: 6px;
  font: 400 12.5px var(--font-body);
  color: var(--text-body);
  line-height: 1.5;
}
.dp-pmi-notice[hidden] { display: none; }

/* ── Loan program minimums section ── */
.dp-programs {
  margin-top: 14px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.dp-programs-title {
  font: 600 12px var(--font-body);
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 7px;
}
.dp-programs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dp-programs-list li {
  font: 400 13px var(--font-body);
  color: var(--text-body);
  line-height: 1.45;
}
.dp-programs-list strong {
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ── Savings timeline output ── */
.dp-savings-result {
  margin-top: 8px;
}

/* ── Savings progress bar ── */
.dp-progress-wrap {
  margin-top: 14px;
}
.dp-progress-bar {
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.dp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}
.dp-progress-labels {
  display: flex;
  justify-content: space-between;
  font: 400 11px var(--font-body);
  color: var(--text-medium);
  margin-top: 4px;
}
.dp-prog-current {
  color: var(--accent);
  font-weight: 600;
}
.dp-prog-target {
  color: var(--text-heading);
  font-weight: 600;
}




/* ============================================================
   RENT VS BUY  (rvb-)
   Engine: rent-vs-buy  |  CSS prefix: rvb-
   Shell elements (kicker, h2, privacy, fields, labels, reset,
   actions, topline, result, stat-grid, toast) are owned by the
   ci- block above.  This block styles engine-own parts only:
   chart, schedule table, range slider, verdict, below-bar.
   ============================================================ */

/* range slider */
.rvb-range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rvb-slider {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.rvb-horizon-display {
  min-width: 42px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

/* MID toggle row */
.rvb-mid-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rvb-mid-toggle-label {
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
}

/* verdict line */
.rvb-verdict {
  margin: 8px 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

/* estimate note */
.rvb-estimate-note {
  margin: 4px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* rvb- below/kpi/tab rules removed S52 — the shared ci- block applies */
.rvb-schedule-table .rvb-buy-wins td {
  background: color-mix(in srgb, var(--success) 8%, transparent);
}


/* ============================================================
   di- — Debt-to-Income Ratio Calculator
   Engine-own parts only. Shell (ci-) classes are untouched.
   Hard Rule 12: every class prefixed di-.
   Hard Rule 29: .di-table-bar / .di-table-toggle / .di-below-actions
   ============================================================ */

/* --- debt input table ---------------------------------------- */
/* S52: the four debt fields span both form columns as ordinary ci-fields under one group label */
.di-debt-table {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin: 0;
}
.di-debt-table-label {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 4px;
  font: 600 12px var(--font-body);
  color: var(--text-heading);
  margin: 0 0 -6px;
}

/* --- composition bar ----------------------------------------- */
.di-bar-block {
  margin: 12px 0 8px;
}
.di-bar-svg {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
}
.di-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
  font: 12px var(--font-body);
  color: var(--text-muted);
}
.di-bar-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: -1px;
  margin-right: 4px;
}
.di-bar-swatch--housing { background: var(--c1); }
.di-bar-swatch--other   { background: var(--c3); }
.di-bar-swatch--remain  { background: var(--surface-2); border: 1px solid var(--border); }

/* --- solve strip --------------------------------------------- */
.di-solve-strip {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.di-solve-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.di-solve-ok {
  font: 600 13px var(--font-body);
  color: var(--success);
}
.di-solve-label {
  font: 600 12px var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.di-solve-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font: 13px var(--font-body);
  color: var(--text-body);
}
.di-solve-housing {
  font-style: italic;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- estimate note ------------------------------------------- */
.di-estimate-note {
  font: 12px var(--font-body);
  color: var(--text-muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

/* --- band colours (background chips on result-detail) -------- */
.di-band-excellent  { color: var(--success); }
.di-band-good       { color: var(--success); }
.di-band-manageable { color: var(--accent); }
.di-band-high       { color: var(--warning, var(--accent)); }
.di-band-too-high   { color: var(--error, #c0392b); }

/* di- below/kpi/tab rules removed S52 — the shared ci- block applies */
.di-breakdown-table tbody th { text-align: left; font: 600 12px var(--font-body); color: var(--text-light); padding: 5px 10px; border-bottom: 1px solid var(--border); }
.ci-table td.di-tbl-spacer { height: 10px; padding: 0; border-bottom: none; }

/* --- advanced "in use" badge --------------------------------- */
.di-advanced-inuse {
  font: 12px var(--font-body);
  color: var(--text-muted);
  margin-left: 4px;
}

/* --- annual salary helper ------------------------------------ */
.di-apply-annual {
  font: 12px var(--font-body);
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 6px;
}
.di-apply-annual:hover { opacity: 0.8; }

/* narrow */
@media (max-width: 640px) {
  .di-solve-strip { padding: 8px 10px; }
}



/* ======================================================================
   RENTAL PROPERTY CALCULATOR  (rp-)
   CSS prefix: rp-
   Shell elements use ci- classes (Hard Rule 33). This block styles only
   the engine-own parts: down-payment toggle, ratio strip, cash-flow badge,
   depreciation info line, rule badges, projection chart, schedule table,
   and the Hard Rule 29 button bar.
   ====================================================================== */

/* ── Down-payment $/% toggle (engine-own; sits inside the ci-input-wrap) ── */
.rp-with-toggle { position: relative; }
.rp-toggle-group {
  display: flex; position: absolute; right: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--border); overflow: hidden; border-radius: 0 6px 6px 0;
}
.rp-unit-btn {
  padding: 0 10px; background: transparent; border: none; cursor: pointer;
  font: 600 12px var(--font-mono); color: var(--text-medium);
}
.rp-unit-btn.rp-unit-active { background: var(--accent); color: #fff; }

/* ── Cash flow badge ── */
.rp-cash-badge  { font: 600 13px var(--font-body); margin: 2px 0 8px; }
.rp-badge-pos   { color: var(--success); }
.rp-badge-neg   { color: var(--c3); }

/* rp- ratio strip is a ci-stat-grid since S52 */

/* ── Depreciation info line ── */
.rp-depr-info {
  font: 400 12px var(--font-body); color: var(--text-medium);
  line-height: 1.5; margin: 8px 0;
  padding: 8px 10px; background: var(--surface-2); border-radius: 6px;
  border-left: 3px solid var(--border-strong);
}

/* ── 1% / 50% rule badges ── */
.rp-rules {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0;
}
.rp-rule-item {
  font: 500 11px var(--font-body);
  padding: 4px 8px; border-radius: 12px;
}
.rp-rule-pass  { background: color-mix(in srgb,var(--success) 12%,transparent); color: var(--success); }
.rp-rule-warn  { background: color-mix(in srgb,var(--c3) 14%,transparent); color: var(--c3); }
.rp-rule-info  { background: var(--surface-2); color: var(--text-medium); }
.rp-be-rent {
  font: 500 12px var(--font-body); color: var(--text-body);
  margin: 4px 0;
}
.rp-be-rent strong { color: var(--text-heading); }

/* rp- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* ── Advanced hint ── */
.rp-adv-hint { font: 400 11px var(--font-body); color: var(--text-medium); }

/* ── Mobile ── */


/* ---------- re-  Real Estate Calculator (S63) ---------- */
/* Three-mode tool: sale proceeds / home equity / buy-hold-sell ROI */

/* re- below/kpi/tab rules removed S52 — the shared ci- block applies */

/* Panel show/hide */
.re-panel-hidden { display: none !important; }

/* Advanced badge */
.re-adv-badge {
  font: 500 11px var(--font-mono); color: var(--text-medium);
}

/* Waterfall chart */
.re-wf-title { font: 600 12px var(--font-mono); color: var(--text-medium); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.re-wf-track {
  display: flex; height: 28px; border-radius: 4px; overflow: hidden;
  background: var(--surface-2); width: 100%;
}
.re-wf-bar { height: 100%; min-width: 1px; transition: width .3s; }
.re-wf-net { background: var(--accent); }
.re-wf-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px;
  font: 500 12px var(--font-body); color: var(--text-medium);
}
.re-wf-legend-item { display: flex; align-items: center; gap: 5px; }
.re-wf-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.re-wf-net-dot { background: var(--accent); }
.re-wf-net-legend { font-weight: 600; color: var(--text-heading); }

/* Disclaimer text */
.re-disclaimer { margin-top: 14px; }
.re-disclaimer-text {
  font: 400 12px var(--font-body); color: var(--text-medium);
  line-height: 1.5; margin: 0;
}



/* ============================================================
   HOUSE AFFORDABILITY CALCULATOR  prefix: ha-
   Engine: shared/_calc-house-affordability.js
   Shell elements (kicker, heading, reset, privacy, fields,
   actions, result columns, toast) use ci- classes from above.
   ha- prefix: affordability band, breakdown bar, DTI badge,
   constraint badge, summary table, below section, button bar.
   ============================================================ */

/* ── Rate note under the interest-rate field (VA pattern) ── */
.ha-rate-note { display: block; font: 400 11px var(--font-body); color: var(--text-medium); margin-top: 3px; }

/* ── Affordability band (comfortable / stretch / maximum) — engine-own cards ── */
.ha-band-heading {
  margin: 16px 0 6px;
  font: 700 11px var(--font-body);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-medium);
}
.ha-band-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ha-band-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
}
.ha-band-card.ha-band-stretch-warning { border-color: color-mix(in srgb, var(--c3) 55%, transparent); }
.ha-band-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-medium);
  margin-bottom: 4px;
}
.ha-band-price {
  font: 600 17px var(--font-mono);
  color: var(--text-heading);
  line-height: 1.1;
}
.ha-band-piti, .ha-band-dti {
  font-size: 11px;
  color: var(--text-medium);
  margin-top: 3px;
}
.ha-band-warn { font-size: 10.5px; font-weight: 600; color: var(--c3); margin-top: 4px; }

/* ── Composition bar (P&I / Tax / Ins / PMI / HOA) — stays in the report column ── */
.ha-bar-wrap { margin: 14px 0 0; }
.ha-bar-track {
  display: flex;
  height: 12px;
  border-radius: 4px;
  overflow: hidden;
  gap: 1px;
  margin-bottom: 6px;
  background: var(--surface-2);
}
.ha-bar-seg { height: 100%; }
.ha-bar-pi   { background: var(--c1); }
.ha-bar-tax  { background: var(--c2); }
.ha-bar-ins  { background: var(--c3); }
.ha-bar-pmi  { background: var(--c4); }
.ha-bar-hoa  { background: var(--text-muted); }
.ha-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11px;
  color: var(--text-medium);
}
.ha-leg { display: inline-flex; align-items: center; gap: 5px; }
.ha-leg > span { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.ha-leg-pi  > span { background: var(--c1); }
.ha-leg-tax > span { background: var(--c2); }
.ha-leg-ins > span { background: var(--c3); }
.ha-leg-pmi > span { background: var(--c4); }
.ha-leg-hoa > span { background: var(--text-muted); }

/* ── Not-pre-approval notice ── */
.ha-preapproval-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 10px 0 0;
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  line-height: 1.5;
}

/* ha- below/kpi/tab rules removed S52 — the shared ci- block applies */
.ha-breakdown-table tbody th { text-align: left; font: 600 12px var(--font-body); color: var(--text-light); padding: 5px 10px; border-bottom: 1px solid var(--border); }
.ci-table td.ha-tbl-spacer { height: 10px; padding: 0; border-bottom: none; }

/* ── Mobile / narrow ── */
@media (max-width: 520px) {
  .ha-band-grid { grid-template-columns: 1fr; }
}


/* ════════════════════════════════════════════════════════════════════
   MORTGAGE COMPARISON CALCULATOR  (prefix: mc-)
   Engine: mortgage-comparison  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   Compare two fixed-rate mortgage offers: PITI, APR, discount points
   break-even, PMI-drop month, balance chart, per-offer schedules.
   ════════════════════════════════════════════════════════════════════ */

/* mc- shell rules: the shared ci- shell applies (Hard Rule 33) */

/* ── Offer panels grid ── */
.mc-offers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 560px) {
  .mc-offers-grid { grid-template-columns: 1fr; }
}

.mc-offer-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.mc-offer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 8px; border-bottom: 1px solid var(--border);
}
/* Offer colour bands — tokens only (Hard Rule 24) */
.mc-offer-color-1 { background: color-mix(in srgb, var(--c1) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c1) 20%, var(--border)); }
.mc-offer-color-2 { background: color-mix(in srgb, var(--c2) 8%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--c2) 20%, var(--border)); }

/* Offer label input */
.mc-offer-label {
  border: none; background: transparent; font: 600 14px var(--font-body);
  color: var(--text-heading); width: 0; flex: 1; min-width: 0;
  outline: none; padding: 0;
}
.mc-offer-label:focus { outline: 2px solid var(--accent); border-radius: 3px; }

/* Offer badge */
.mc-offer-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font: 700 12px var(--font-mono); color: #fff; flex-shrink: 0;
}
.mc-badge-1 { background: var(--c1); }
.mc-badge-2 { background: var(--c2); }

/* Fields inside offer panels */
.mc-fields { padding: 12px 14px 8px; display: grid; gap: 2px; }
.mc-adv     { margin: 0 14px 14px; }
.mc-adv-grid { display: grid; gap: 2px; }

/* Field error spans */
.mc-field-error {
  display: block; font-size: 12px; font-weight: 600; color: var(--star);
  line-height: 1.4; min-height: 0;
}
.mc-field-error:empty { display: none; }

/* Per-field invalid tint */
.ci-input-wrap:has([aria-invalid="true"]),
.ci-select-wrap:has([aria-invalid="true"]) { border-color: var(--star); }

/* ── Horizon row ── */
.mc-horizon-row { margin-bottom: 14px; }
.mc-hz-wrap { max-width: 180px; }

/* ── ARM notice ── */
.mc-arm-notice {
  font-size: 12.5px; color: var(--text-medium); line-height: 1.55;
  margin: 0 0 14px; padding: 10px 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
}
.mc-arm-notice strong { color: var(--text-heading); }

/* ── Comparison table ── */
.mc-compare-table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: 11px; margin: 18px 0 0;
}
.mc-compare-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  min-width: 340px;
}
.mc-compare-table thead th {
  padding: 10px 12px; background: var(--surface-2);
  font: 600 11px var(--font-mono); text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-medium);
  border-bottom: 1px solid var(--border); text-align: right;
  white-space: nowrap;
}
.mc-compare-table thead th:first-child { text-align: left; }
.mc-compare-table tbody th {
  padding: 9px 12px; text-align: left;
  font: 500 13px var(--font-body); color: var(--text-medium);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.mc-compare-table tbody td {
  padding: 9px 12px; text-align: right;
  font: 600 13px var(--font-mono); color: var(--text-heading);
  border-bottom: 1px solid var(--border);
}
.mc-compare-table tbody tr:last-child th,
.mc-compare-table tbody tr:last-child td { border-bottom: 0; }
.mc-col-a { color: var(--c1); }
.mc-col-b { color: var(--c2); }


/* ════════════════════════════════════════════════════════════════════
   CONVENTIONAL MORTGAGE CALCULATOR (prefix: cmg-)
   Engine: conventional-mortgage | Hard Rules 12, 16, 17, 23–25, 29, 33
   PITI, PMI estimate by FICO/LTV, FHFA conforming-limit badge,
   HPA 80%/78% PMI milestones, conventional vs FHA comparison strip.
   Presets, chart, legend, table bar: shared ci- classes (S52).
   ════════════════════════════════════════════════════════════════════ */

.cmg-field-error { font-size: 11.5px; color: var(--danger); min-height: 0; }
.cmg-field-error:empty { display: none; }
.cmg-rate-note { font-size: 10.5px; color: var(--text-medium); font-style: italic; margin-top: -2px; }

/* Down-payment presets use the shared ci-mode-tabs (S52); no engine rule (S79 audit removed the chip bar) */

/* Unit toggles */
.cmg-toggle-group { display: flex; height: 100%; flex-shrink: 0; }
.cmg-unit-btn {
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-medium);
  font: 600 12px var(--font-mono);
  padding: 0 10px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.cmg-unit-btn:last-child { border-radius: 0 7px 7px 0; }
.cmg-unit-btn.cmg-unit-active { background: var(--accent); color: #fff; }
.cmg-unit-btn:hover:not(.cmg-unit-active) { background: var(--surface-2); }

/* Date inputs */
.cmg-date-group { display: flex; gap: 8px; }
.cmg-date-group .ci-select-wrap { flex: 1; min-width: 0; }
.cmg-year-wrap { flex: 0 0 84px; }

/* Conforming vs Jumbo Status Badge */
.cmg-conforming-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin: 10px 0 6px;
}
.cmg-badge-conforming {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border));
  color: var(--text-heading);
}
.cmg-badge-conforming .cmg-badge-icon { color: var(--success); font-weight: 700; }
.cmg-badge-jumbo {
  background: color-mix(in srgb, var(--warning, #eab308) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning, #eab308) 40%, var(--border));
  color: var(--text-heading);
}

/* PITI breakdown bar */
.cmg-breakdown { padding: 14px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-top: 8px; }
.cmg-breakdown-bar { height: 9px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.cmg-breakdown-bar span { height: 100%; transition: width .22s ease; }
.cmg-bar-pi, .cmg-key-pi   { background: var(--c1); }
.cmg-bar-tax, .cmg-key-tax { background: var(--c3); }
.cmg-bar-ins, .cmg-key-ins { background: var(--c4); }
.cmg-bar-pmi, .cmg-key-pmi { background: var(--c2); }
.cmg-bar-hoa, .cmg-key-hoa { background: var(--text-medium); }
.cmg-breakdown-key { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 10px; font: 400 12px var(--font-body); color: var(--text-medium); }
.cmg-breakdown-key > span { display: inline; }
.cmg-breakdown-key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.cmg-breakdown-key b { color: var(--text-heading); font-weight: 600; margin-left: 3px; }

/* PMI cancellation callout box */
.cmg-pmi-box {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 14px;
}
.cmg-pmi-box-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-heading);
  margin-bottom: 8px;
}
.cmg-pmi-step > div { line-height: 1.45; }
.cmg-pmi-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 8px;
  padding-left: 4px;
}
.cmg-pmi-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-medium);
}
.cmg-pmi-step strong { color: var(--text-heading); }
.cmg-step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.cmg-step-dot.cmg-dot-final { background: var(--success); }
.cmg-pmi-lifetime-cost {
  font-size: 11.5px;
  color: var(--text-medium);
  margin: 6px 0 0;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.cmg-pmi-lifetime-cost strong { color: var(--text-heading); }
.cmg-pmi-not-required {
  background: color-mix(in srgb, var(--success) 8%, var(--surface-2));
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}
.cmg-pmi-exempt-note {
  font-size: 12px;
  color: var(--text-medium);
  margin: 0;
}

/* Side-by-side Conventional vs FHA strip */
.cmg-compare-strip {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.cmg-compare-title {
  font: 600 11.5px var(--font-mono);
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 8px;
}
.cmg-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cmg-compare-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmg-card-conv {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-2));
}
.cmg-card-tag {
  font: 700 11px var(--font-mono);
  text-transform: uppercase;
  color: var(--text-medium);
  letter-spacing: .05em;
}
.cmg-compare-card b {
  font: 700 18px/1.2 var(--font-mono);
  color: var(--text-heading);
}
.cmg-compare-card small {
  font-size: 10.5px;
  color: var(--text-medium);
}
.cmg-compare-summary {
  font-size: 11.5px;
  color: var(--text-medium);
  margin: 8px 0 0;
  line-height: 1.4;
}
.cmg-compare-summary strong { color: var(--text-heading); }

/* Down Payment Comparison Table */
.cmg-down-table-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.cmg-down-title {
  font: 600 11.5px var(--font-mono);
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 8px;
}
.cmg-down-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cmg-down-table th {
  text-align: right;
  padding: 6px 8px;
  font: 600 10.5px var(--font-mono);
  text-transform: uppercase;
  color: var(--text-medium);
  border-bottom: 1px solid var(--border);
}
.cmg-down-table th:first-child { text-align: left; }
.cmg-down-table td {
  padding: 6px 8px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-heading);
  border-bottom: 1px solid var(--border);
}
.cmg-down-table td:first-child {
  text-align: left;
  font-family: var(--font-body);
}
.cmg-down-note { font-size: 11px; color: var(--text-medium); margin: 8px 0 0; line-height: 1.4; }
.cmg-down-current-row {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.cmg-tag-curr {
  font-size: 9.5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
}

/* cmg- below/kpi/tab rules removed S52 — the shared ci- block applies */
.cmg-down-scroll { overflow-x: auto; padding-bottom: 4px; contain: inline-size; }   /* engine-own: the open 6-column table must not set the mobile grid track's min-content (S79: it pushed the card to 427px at 390px) */
.cmg-zero { color: var(--text-medium); }                      /* column-specific cell: a $0 PMI month */

@media (max-width: 540px) {
  .cmg-compare-grid { grid-template-columns: 1fr; }
}

/* Verdict badges */
.mc-verdict { display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 100px; vertical-align: middle;
  margin-left: 5px; text-transform: uppercase; letter-spacing: .04em; }
.mc-verdict-best  { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.mc-verdict-worst { background: color-mix(in srgb, var(--star)    12%, transparent); color: var(--star); }
.mc-tied { color: var(--text-medium); font-size: 11px; margin-left: 5px; }

/* ── PITI breakdown bars ── */
.mc-breakdown-section { margin-top: 20px; }
.mc-section-label {
  font: 700 11px var(--font-mono); text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-medium); margin: 0 0 10px;
}
.mc-breakdown-rows { display: grid; gap: 10px; margin-bottom: 10px; }
.mc-bd-row {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 80px 1fr 80px;
}
.mc-bd-label {
  display: flex; align-items: center; gap: 6px;
  font: 600 12px var(--font-body); color: var(--text-heading);
}
.mc-bd-swatch {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.mc-bd-swatch-1 { background: var(--c1); }
.mc-bd-swatch-2 { background: var(--c2); }

.mc-bd-bar-wrap { min-width: 0; }
.mc-bd-bar {
  height: 12px; border-radius: 6px; overflow: hidden;
  display: flex; background: var(--border);
}
.mc-bd-seg { height: 100%; transition: width .25s ease; }
.mc-bd-pi  { background: var(--c1); }
.mc-bd-tax { background: var(--c3); }
.mc-bd-ins { background: var(--c4); }
.mc-bd-pmi { background: var(--star); }
.mc-bd-hoa { background: var(--text-medium); }

.mc-bd-total {
  text-align: right; font: 700 13px var(--font-mono);
  color: var(--text-heading); white-space: nowrap;
}

/* Legend */
.mc-bd-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  font: 500 11px var(--font-body); color: var(--text-medium);
}
.mc-bd-li { display: flex; align-items: center; gap: 5px; }
.mc-bd-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.mc-bd-dot.mc-bd-pi  { background: var(--c1); }
.mc-bd-dot.mc-bd-tax { background: var(--c3); }
.mc-bd-dot.mc-bd-ins { background: var(--c4); }
.mc-bd-dot.mc-bd-pmi { background: var(--star); }
.mc-bd-dot.mc-bd-hoa { background: var(--text-medium); }

/* ── Points / lender credits section ── */
.mc-points-section { margin-top: 18px; }
.mc-points-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mc-points-row:last-child { border-bottom: 0; }
.mc-pts-label {
  font: 700 12px var(--font-mono); color: var(--text-heading);
  flex-shrink: 0; min-width: 64px;
}
.mc-pts-detail { color: var(--text-medium); line-height: 1.5; }

/* ── Below block ── */
/* mc- below/kpi/tab rules removed S52 — the shared ci- block applies */
/* Offer badge + title above each schedule inside the shared details (engine-own) */
.mc-sched-title { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font: 600 12.5px var(--font-body); color: var(--text-heading); }
.mc-sched-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font: 700 11px var(--font-mono); color: #fff; flex-shrink: 0;
}
.mc-sched-badge-1 { background: var(--c1); }
.mc-sched-badge-2 { background: var(--c2); }

/* Estimate note */
.mc-estimate-note {
  font-size: 12px; color: var(--text-medium); margin-top: 14px;
  padding-top: 10px; border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .mc-bd-row { grid-template-columns: 72px 1fr 72px; }
  .mc-bd-label { font-size: 11px; }
  .mc-compare-table thead th,
  .mc-compare-table tbody th,
  .mc-compare-table tbody td { padding: 7px 9px; font-size: 12px; }
}


/* ══════════════════════════════════════════════════════════════════
   LOAN CALCULATOR  (prefix: ln-)
   Engine: loan  |  Hard Rules 12, 16, 17, 23–25, 29, 33
   S68 — 2026-09-27
   ══════════════════════════════════════════════════════════════════ */
/* ── Solve-mode tabs use shared ci-mode-tabs / ci-mode-tab (S52) ── */
/* .ln-mode-tabs is a second class kept only as a narrowing hook */


/* ── Field extras (engine-own: rate note, per-field errors) ── */
.ln-rate-note   { color: var(--text-medium); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.ln-field-error { color: var(--star); font-size: 12px; font-weight: 600; line-height: 1.4; }
.ln-field-error:empty { display: none; }

/* Term row: value input + unit select side by side */
.ln-term-row { display: flex; gap: 8px; align-items: center; }
.ln-term-val-wrap  { flex: 1 1 0; min-width: 0; }
.ln-term-unit-wrap { flex: 0 0 100px; }

/* First-payment date: month select + year box side by side */
.ln-date-group { display: flex; gap: 8px; align-items: center; }
.ln-date-group .ci-select-wrap { flex: 1; min-width: 0; }
.ln-year-wrap { flex: 0 0 84px; }

/* ── Output region: engine's own result rows ── */

/* Principal / interest split strip */
.ln-split-strip {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 6px 16px; margin: 18px 0 0; padding: 11px 14px;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-medium);
}
.ln-split-strip strong { color: var(--text-heading); font-weight: 700; }

/* Extra-payment savings notice */
.ln-extra-note {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-light); font-size: 13px; line-height: 1.6;
}
.ln-extra-note strong { color: var(--text-heading); }

/* Solved-for result note (amount/term modes) */
.ln-solved-note {
  margin: 10px 0 0; padding: 10px 14px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-medium); font-size: 13px; line-height: 1.5;
}

/* Intent-link strip */
.ln-intent-strip { margin: 22px 0 0; }
.ln-intent-label { font-size: 12px; color: var(--text-medium); margin: 0 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ln-intent-list  { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ln-intent-list a { font-size: 13px; color: var(--accent); text-decoration: none; }
.ln-intent-list a:hover { text-decoration: underline; }

/* ── calc-below: shared ci-chart / ci-legend / ci-table-wrap / ci-table (S52) — ln- shell rules removed S69 ── */
.ln-legend-line { height: 3px; border-radius: 2px; }          /* the balance line swatch */
.ln-rounding-note { margin: 8px 0 0; color: var(--text-medium); font-size: 12px; line-height: 1.55; font-style: italic; }
.ln-sched tfoot td { border-top: 2px solid var(--border); font-weight: 700; color: var(--text-heading); }

/* ── Responsive ── */
@media (max-width: 767px) {
  .ln-intent-list { gap: 7px; }
}
@media (max-width: 480px) {
  .ln-term-unit-wrap { flex: 0 0 85px; }
}


/* ---------- cgt-  capital gains tax (S70; audited S79) ---------- */
/* The shared ci- shell applies (Hard Rule 33). Engine-own parts only:
   the notes in the report column (§121 exclusion, ordinary-rate cap,
   the §3.2 boundary line) and the Advanced-summary ellipsis. The chart,
   legend and table are the shared ci-chart / ci-legend / ci-table. */

.cgt-note {
  font-size: 13px; color: var(--text-medium); margin: 12px 0 0;
  padding: 8px 12px; border-left: 3px solid var(--c2); border-radius: 0 8px 8px 0;
  background: var(--surface-2); line-height: 1.6;
}
.cgt-cap-note { border-color: var(--c3); }
.cgt-boundary { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--text-medium); padding-top: 12px; border-top: 1px solid var(--border); }
.cgt-boundary a { color: var(--accent); }
.cgt-legend i.cgt-seg-oti { opacity: .55; }
/* On a phone the 1100-unit stacking chart would shrink its labels to 3px: keep it readable and let .ci-chart scroll */
@media (max-width: 640px) { .cgt-below { min-width: 0; } }   /* S120: chart redraws to the container */

/* Advanced-summary text — keep it compact on mobile */
.cgt-adv-summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
@media (max-width: 480px) { .cgt-adv-summary { max-width: 140px; } }


/* ---------- pt-  property tax (S71) ---------- */
/* pt- shell rules: the shared ci- shell applies (Hard Rule 33, S51/S52).
   These rules style only the engine-own parts: the rate strip, the
   by-address note, per-field errors and row visibility. */

/* Rate notation strip — four notations side by side */
.pt-rate-strip {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin: 14px 0 6px; padding: 10px 14px;
  background: var(--surface-2); border-radius: 8px;
}
.pt-rate-item {
  display: flex; flex-direction: column; gap: 2px; min-width: 110px;
}
.pt-rate-item b {
  font: 600 15px/1 var(--font-mono); color: var(--accent);
}
.pt-rate-item small {
  font-size: 11.5px; color: var(--text-medium); text-transform: uppercase;
  letter-spacing: .04em;
}

/* "By address" declined note */
.pt-byaddress-note {
  font-size: 13px; color: var(--text-medium); margin: 10px 0 4px;
  padding: 8px 12px; border-left: 3px solid var(--c3); border-radius: 0 8px 8px 0;
  background: var(--surface-2); line-height: 1.6;
}

/* Exemption row: hidden until user selects an exemption type */
.pt-hidden { display: none !important; }

/* Per-field inline errors (S79 audit) */
.pt-field-error { font-size: 11.5px; color: var(--danger); display: block; }
.pt-field-error:empty { display: none; }

/* pt-legend / pt-mode-tabs rules removed S79 — the shared ci-legend and ci-mode-tabs apply */

/* Mobile: stack rate strip on narrow screens */
@media (max-width: 480px) {
  .pt-rate-strip { gap: 8px 10px; }
  .pt-rate-item { min-width: 80px; }
}


/* ---------- et-  estate tax (S72) ----------
   Hard Rule 12: all classes prefixed et-.
   Hard Rule 33: the shared ci- shell applies — this block styles only the
   engine's own parts: the zero-note callout, the composition chart legend,
   the computation table row styles, the state divider label, and the
   DSUE advanced-field toggle state. Tokens only — no hex values.
   ------------------------------------------------------------------ */

/* Zero-note callout — shown when estate is below the exclusion */
.et-zero-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-left: 3px solid var(--success);
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}

/* Computation table row styles — deduction rows and total rows */
.et-deduct-row td { color: var(--text-medium); }
.et-total-row td  { font-weight: 700; color: var(--text-heading); border-top: 1px solid var(--border); }

/* State divider label inside the advanced grid */
.et-state-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  color: var(--text-medium);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.et-state-divider::before,
.et-state-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Advanced summary text — truncate on narrow screens */
.et-adv-summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
@media (max-width: 480px) { .et-adv-summary { max-width: 160px; } }

/* Above-exclusion variant of the note callout */
.et-tax-note { background: color-mix(in srgb, var(--c4) 10%, transparent); border-left-color: var(--c4); }


/* ===================================================================
   gt- — Gift Tax Calculator (S73)
   -------------------------------------------------------------------
   Engine's own parts only: the filing-required badge, the no-filing
   note, the exclusions checklist, per-donee add/remove controls,
   taxable row highlight, total row, the advanced-summary truncation,
   and the legend swatch.  Tokens only — no hex values.
   =================================================================== */

/* Form 709 filing-required badge */
.gt-filing-required {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}

/* No-filing confirmation note */
.gt-no-filing {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-left: 3px solid var(--success);
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}

/* Gift tax due (shown only when lifetime is exhausted) */
.gt-tax-due {
  margin: 8px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--c3) 10%, transparent);
  border-left: 3px solid var(--c3);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

/* Exclusions checklist — sits between the fields and the actions row */
.gt-exclusions-checklist {
  margin: 16px 0 0;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.gt-excl-title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-heading);
}
.gt-exclusions-checklist ul {
  margin: 0 0 8px;
  padding-left: 18px;
}
.gt-exclusions-checklist li {
  margin: 4px 0;
  color: var(--text-body);
}
.gt-excl-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-medium);
}

/* Recipient rows — the holdings-row pattern (portfolio-allocation): each row's
   input is a shell ci-field in a ci-input-wrap; the row grid, the remove button
   (level with the 45px wrap) and the add button are engine-own. */
.gt-donees-list { grid-column: 1 / -1; display: grid; gap: 10px; }
.gt-row-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.gt-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; align-self: start; margin-top: 24px; flex-shrink: 0; }
.gt-remove-btn:hover, .gt-remove-btn:focus-visible { border-color: var(--danger); color: var(--danger); }
.gt-remove-placeholder { display: block; width: 32px; height: 45px; margin-top: 24px; }
.gt-form-btns { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 4px; }
.gt-add-btn { height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.gt-add-btn:hover { background: var(--accent-soft, rgba(37,99,235,.08)); }
.gt-add-btn:disabled { opacity: .45; cursor: not-allowed; }
.gt-excl-pill { font: 500 12px var(--font-mono); color: var(--text-medium); margin-left: auto; }

/* Taxable gift row highlight in the table */
.gt-taxable-row td {
  color: var(--text-heading);
  font-weight: 600;
}

/* Total row in the donee table */
.gt-total-row td {
  font-weight: 700;
  color: var(--text-heading);
  border-top: 1px solid var(--border);
}

/* Advanced summary text truncation */
.gt-adv-summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
@media (max-width: 480px) {
  .gt-adv-summary { max-width: 160px; }
}


/* ---------- se- — Self-Employment Tax Calculator (S74; audited S79) ----------
   Engine: self-employment-tax (prefix se-)
   Shell elements use ci- classes (Hard Rule 33); the chart, legend and
   table are the shared ci-chart / ci-legend / ci-table. Engine-own parts
   only: the report-column notes (wage-base room, additional Medicare,
   below-$400), the quarterly line, the breakdown-table row types and the
   Advanced-summary ellipsis. Tokens only — no hex values (Hard Rule 24). */

.se-note {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.5;
  margin: 12px 0 0;
}
.se-threshold-note { border-color: var(--c3); }
.se-ssroom-note    { border-color: var(--c2); }
.se-addl-note      { border-color: var(--c4); }
.se-zero-note      { border-color: var(--c2); }

.se-quarterly-note {
  padding: 12px 0 0;
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  margin: 14px 0 0;
}
.se-quarterly-note a { color: var(--accent); }
/* On a phone the 1100-unit wage-base chart would shrink its labels to 3px: keep it readable and let .ci-chart scroll */
@media (max-width: 640px) { .se-below { min-width: 0; } }   /* S120: chart redraws to the container */

/* Breakdown table row types */
.se-tr-group td  { padding-top: 10px; border-top: 1px solid var(--border); }
.se-tr-subtotal td,
.se-tr-total td  { font-weight: 700; color: var(--text-heading); border-top: 1px solid var(--border); }
.se-tr-deduct td { color: var(--c2); font-style: italic; }
.se-td-amt       { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Advanced summary ellipsis */
.se-adv-summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
@media (max-width: 480px) { .se-adv-summary { max-width: 150px; } }


/* ---------- tb-  Tax Bracket Calculator (S75) ----------
   Engine-own parts only: highlighted bracket row, room-to-next callout,
   no-tax note, inactive row dimming, total row, field-level error.
   Shell elements (kicker, h2, privacy, fields, labels, actions, result,
   stat-grid, chart wrapper, table bar) come from the ci- block — never
   repeated here. Tokens only; no hex. */

.tb-current-row td { font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.tb-current-row td:first-child::after { content: ' ★'; font-size: 11px; }
.tb-inactive-row td { color: var(--text-medium); opacity: 0.6; }
.tb-total-row td { font-weight: 700; border-top: 2px solid var(--border-strong); padding-top: 8px; }

.tb-no-tax-note {
  font-size: 13.5px;
  color: var(--text-medium);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--c2);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0;
  line-height: 1.6;
}

.tb-field-error {
  display: block;
  font-size: 12px;
  color: var(--c3);
  min-height: 16px;
  margin-top: 3px;
}

/* Ladder-chart legend swatches: the translucent fills the SVG uses, and the hatched 'room' segment */
.tb-legend i.ci-c1, .tb-legend i.ci-c2 { opacity: .62; }
.ci-legend i.tb-legend-room { background: repeating-linear-gradient(135deg, var(--accent-soft) 0 3px, var(--accent) 3px 4px); }


/* ---------- mr-  Marginal Tax Rate Calculator (S76) ----------
   Engine-own parts only: income-type toggle, stacked-rate layer table,
   FICA breakdown rows, phase-out warnings callout, kept-segment legend.
   Shell elements (kicker, h2, privacy, fields, labels, actions, result,
   stat-grid, chart wrapper, table bar) come from the ci- block — never
   repeated here. Tokens only; no hex. */

/* Income type (wages vs non-wages): the shell's ci-timing chips inside a ci-field —
   only the field-row fit is the engine's: no outer margin, chips as tall as the inputs
   beside them, a sub-caption under the chip name. */
.mr-type.ci-timing { margin: 0; }
.mr-type.ci-timing label { min-width: 0; }
.mr-type.ci-timing label span { min-height: 45px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
.mr-type.ci-timing label small { display: block; font-size: 10px; opacity: .75; margin-top: 1px; }

/* Tax layer breakdown table (in the result panel) */
.mr-layer-scroll { margin: 14px 0 4px; overflow-x: auto; contain: inline-size; }   /* scrolls on a phone instead of widening the column */
.mr-layer-table { margin: 0; }
.mr-layer-table th,
.mr-layer-table td { font-size: 13.5px; }
.mr-layer-table td small { font-size: 11.5px; color: var(--text-medium); }
.mr-layer-total td { font-weight: 700; border-top: 2px solid var(--border-strong); padding-top: 8px; }
.mr-no-fica td { color: var(--text-medium); font-style: italic; }

/* FICA breakdown table rows */
.mr-fica-total td { font-weight: 700; border-top: 1px solid var(--border-strong); }
.mr-fica-na { color: var(--text-medium); font-style: italic; text-align: center; padding: 12px 0 !important; }

/* Phase-out warnings callout */
.mr-warnings {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--c3);
  border-radius: 6px;
  padding: 10px 14px 10px 14px;
  margin: 10px 0 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-medium);
}
.mr-warnings-title { margin: 0 0 6px; font-size: 13px; color: var(--text-light); }
.mr-warnings ul { margin: 0; padding-left: 18px; }
.mr-warnings li { margin-bottom: 4px; }

/* Field-level error spans */
.mr-field-error {
  display: block;
  font-size: 12px;
  color: var(--c3);
  min-height: 16px;
  margin-top: 3px;
}

/* Legend "you keep" swatch (the chart's --success segment) */
.ci-legend i.mr-legend-kept { background: var(--success); opacity: .5; }
.mr-legend i.ci-c1, .mr-legend i.ci-c2, .mr-legend i.ci-c4 { opacity: .7; }


/* ---------- amt-  Alternative Minimum Tax Calculator (S75, audited S79) ----------
   Engine-own parts only: the credit callout, the limits note, the two-bar
   chart's segments and labels, the Form 6251 table's line badge. Shell
   elements (kicker, h2, privacy, fields, labels, actions, result, stat-grid,
   chart wrapper, legend, table bar) come from the ci- block. Tokens only. */

.amt-credit-callout {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-medium);
}
.amt-credit-callout strong { color: var(--text-heading); }
.amt-crossover { margin: 12px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-heading); }
.amt-limits { margin: 12px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-medium); }

/* chart: the two Form 6251 answers, split by rate layer */
.amt-chart svg { max-height: 190px; }
.amt-seg-c1 { fill: var(--c1); }
.amt-seg-c2 { fill: var(--c2); }
.amt-seg-c3 { fill: var(--c3); }
.amt-seg-c4 { fill: var(--c4); }
.amt-chart svg text.amt-row-label { fill: var(--text-heading); font: 600 12px var(--font-body); }
.amt-chart svg text.amt-row-sub   { fill: var(--text-medium);  font: 10.5px var(--font-mono); }
.amt-chart svg text.amt-value     { fill: var(--text-heading); font: 600 12.5px var(--font-mono); }
.amt-chart svg text.amt-gap-label { fill: var(--text-heading); font: 600 11px var(--font-mono); }
.amt-gap-line  { stroke: var(--text-medium); stroke-width: 1; stroke-dasharray: 3 3; }
.amt-gap-arrow { stroke: var(--text-heading); stroke-width: 1.5; }

/* Form 6251 table */
.amt-line { display: inline-block; min-width: 24px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--text-medium); font: 600 10.5px var(--font-mono); text-align: center; }
.amt-num { font-family: var(--font-mono); white-space: nowrap; }
.amt-row-key td { font-weight: 600; }
@media (max-width: 767px) {
  .amt-chart svg { max-height: none; }
}


/* ---------- intc-  International Tax Comparison (S78, audited S79) ---------------
   Hard Rule 33: the shared ci- shell applies — this block styles only the
   engine's own parts: the ranked bar chart's segments and labels, the OECD
   average line, the show-all toggle row, the table row highlights and the
   scope note. Tokens only — no hex values.
   --------------------------------------------------------------------- */

.intc-scope-note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-medium); line-height: 1.55; }
.intc-field-wide { grid-column: 1 / -1; }

/* ranked bar chart */
.intc-bar-it   { fill: var(--c1); }
.intc-bar-ssc  { fill: var(--c2); }
.intc-bar-back { fill: var(--c4); opacity: .9; }
.intc-net-mark { stroke: var(--text-heading); stroke-width: 1.5; }
.intc-row:not(.intc-bar-primary):not(.intc-bar-compare) rect { opacity: .72; }
.intc-row.intc-bar-primary rect, .intc-row.intc-bar-compare rect { opacity: 1; }
.intc-chart svg text.intc-label         { fill: var(--text-medium);  font: 12px var(--font-body); }
.intc-chart svg text.intc-label-primary { fill: var(--text-heading); font: 700 12px var(--font-body); }
.intc-chart svg text.intc-label-compare { fill: var(--text-heading); font: 600 12px var(--font-body); }
.intc-chart svg text.intc-bar-value     { fill: var(--text-medium);  font: 11px var(--font-mono); }
.intc-chart svg text.intc-bar-value-strong { fill: var(--text-heading); font: 600 11px var(--font-mono); }
.intc-chart svg text.intc-gap   { fill: var(--text-medium); font: italic 11px var(--font-body); }
.intc-chart svg text.intc-avg-label { fill: var(--text-heading); font: 600 10.5px var(--font-mono); }
.intc-avg-line  { stroke: var(--text-heading); stroke-width: 1; stroke-dasharray: 4 3; }
.intc-zero-line { stroke: var(--border-strong); stroke-width: 1; }
.intc-legend i.intc-legend-avg { width: 14px; height: 0; border-top: 2px dashed var(--text-heading); background: none; border-radius: 0; }
/* Asia block (S80) */
.intc-usd-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.intc-usd-error:empty { display: none; }
.intc-asia { margin-top: 26px; }
.intc-asia-wrap { margin-top: 18px; }
.intc-asia-table caption { text-align: left; font-weight: 600; color: var(--text-heading); padding: 0 0 8px; }
.intc-asia-notes { margin: 14px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-medium); line-height: 1.55; }
.intc-asia-notes li { margin: 0 0 6px; }
.intc-chart-tools { margin: 0 0 10px; }
.intc-show-all { background: var(--accent-soft); color: var(--accent); padding: 7px 14px; }
.intc-show-all:hover, .intc-show-all:focus-visible { background: var(--accent); color: #fff; }

/* table highlights */
.intc-table .intc-row-primary td { font-weight: 700; color: var(--text-heading); }
.intc-table .intc-row-compare td { font-weight: 600; color: var(--text-heading); }
.intc-table .intc-row-avg td { color: var(--text-medium); font-style: italic; border-top: 1px solid var(--border-strong); }


/* ═══════════════════════════════════════════════════════════════════
   401(k) CALCULATOR  prefix: fk-  (S81)
   Only the engine's own parts live here — the shared ci- shell classes
   in this file already cover form layout, inputs, labels, result, KPIs,
   toast, chart wrapper, legend, table-bar and table.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Contribution-mode tabs: the shared ci-mode-tabs look (S52) — no engine rule.
   fk-mode-* classes are JS hooks only. ── */

/* ── Contribution field visibility ─────────────────────────────────── */
.fk-field-pct    { display: flex; }
.fk-field-dollar { display: none; }
.fk-dollar-mode .fk-field-pct    { display: none; }
.fk-dollar-mode .fk-field-dollar { display: flex; }

/* ── IRS limit warning (shown with .visible; the engine also sets [hidden]) ── */
.fk-limit-warn {
  display: none;
  margin: 14px 0 4px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--c3) 12%, transparent);
  border-left: 3px solid var(--c3);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.5;
}
.fk-limit-warn.visible { display: block; }
.fk-limit-warn[hidden] { display: none; }

/* ── Split bar (principal / emp / match / growth) ────────────────── */
.fk-split-bar-wrap { margin: 14px 0 10px; }
.fk-split-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  gap: 2px;
}
.fk-split-bar > span { display: block; min-width: 0; transition: width .3s; }
.fk-bar-principal { background: var(--c3); }
.fk-bar-emp       { background: var(--c1); }
.fk-bar-match     { background: var(--c2); }
.fk-bar-growth    { background: var(--c4); }

/* ── Split key legend ───────────────────────────────────────────── */
.fk-split-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--text-medium);
  margin: 8px 0 14px;
}
.fk-split-key span { display: flex; align-items: center; gap: 5px; }
.fk-split-key b    { font-weight: 700; color: var(--text-heading); }
.fk-key-principal,
.fk-key-emp,
.fk-key-match,
.fk-key-growth     { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.fk-key-principal  { background: var(--c3); }
.fk-key-emp        { background: var(--c1); }
.fk-key-match      { background: var(--c2); }
.fk-key-growth     { background: var(--c4); }

/* ── Chart: stacked-area SVG ────────────────────────────────────── */
/* The svg sits inside .ci-chart on the graph-paper card — no extra wrapper. */
.fk-chart-svg text { font-family: var(--font-body); }
.ci-legend i.fk-legend-infl { background: var(--text-heading); }

/* ── Year-schedule table: highlight current year ────────────────── */
.fk-table tr.fk-now td  { font-weight: 700; color: var(--text-heading); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .fk-split-key { gap: 6px 12px; }
}

/* ── IRA Calculator (ia-) ──────────────────────────────────────────────────
   CSS prefix: ia-   Engine: _calc-ira.js   Session: S82 (rewritten S118)
   Shell classes (ci-) are never restated here — this block covers only
   the engine's own parts: the equal-cost comparison strip, the eligibility
   strip, the limit warning, the inflation legend swatch.
   Tokens only — no hand-typed hex values.
   ──────────────────────────────────────────────────────────────────────── */

/* Equal-cost comparison strip — two columns and a "vs" divider */
.ia-compare-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin: 16px 0 0;
}
.ia-compare-col {
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ia-roth-col { border-top: 3px solid var(--c1); }
.ia-trad-col { border-top: 3px solid var(--c2); }
.ia-compare-label {
  display: block;
  font: 600 11px/1.3 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-medium);
}
.ia-compare-col b {
  display: block;
  margin: 4px 0 2px;
  font: 700 clamp(19px, 2.6vw, 24px)/1.1 var(--font-display);
  color: var(--text-heading);
}
.ia-compare-col small { display: block; font-size: 11.5px; line-height: 1.45; color: var(--text-medium); }
.ia-compare-vs { align-self: center; font: 700 12px var(--font-mono); color: var(--text-light); }
.ia-compare-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-medium); }

/* IRS-limit warning — shown when the contribution exceeds the loaded limit */
.ia-limit-warn {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--c3) 12%, transparent);
  border-left: 3px solid var(--c3);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-body);
}
.ia-limit-warn[hidden] { display: none; }

/* Eligibility strip — shown only when MAGI is entered */
.ia-eligibility {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-medium);
}
.ia-eligibility[hidden] { display: none; }
.ia-elig-row { display: flex; gap: 9px; align-items: flex-start; }
.ia-elig-row + .ia-elig-row { margin-top: 7px; }
.ia-elig-icon { flex: 0 0 18px; font-weight: 700; color: var(--text-heading); }
.ia-eligibility strong { color: var(--text-heading); }

/* Inflation legend swatch (dashed line in --text-heading) */
.ci-legend i.ia-legend-infl { background: var(--text-heading); }

/* Responsive — stack the comparison on narrow viewports */
@media (max-width: 480px) {
  .ia-compare-strip { grid-template-columns: 1fr; }
  .ia-compare-vs { justify-self: center; }
}


/* ===================================================================
   rs- — Retirement Savings Calculator (S83)
   -------------------------------------------------------------------
   Engine's own parts only: the gap callout, the need bar, the gap-
   close callout, the limit warning, the scenario strip, the risk note,
   chart gradient, chart target line, and the advanced-summary truncation.
   Shell elements (form, fields, labels, KPI grid, table bar, table,
   toast) use ci- classes and are not restated here. Tokens only — no
   hex values.
   =================================================================== */

/* Gap / surplus callout — shown in the report column */
.rs-gap-callout {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}
.rs-gap-callout.rs-shortfall {
  background: color-mix(in srgb, var(--c3) 10%, transparent);
  border-left: 3px solid var(--c3);
}
.rs-gap-callout.rs-surplus {
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border-left: 3px solid var(--success);
}

/* Need-vs-projected bar: projected balance as a share of the target */
.rs-need-bar-wrap { margin: 14px 0 0; }
.rs-need-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.rs-bar-projected {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--c1);
  transition: width .25s ease;
  max-width: 100%;
}
.rs-need-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-medium);
  margin-top: 6px;
}
.rs-need-bar-labels b { font-weight: 700; color: var(--text-heading); }
.rs-need-bar-labels i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.rs-dot-projected { background: var(--c1); }
.rs-dot-target { background: var(--c2); }
.rs-bar-pct { font: 600 11px var(--font-mono); color: var(--text-medium); }

/* Gap-close callout */
.rs-gap-close {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}
.rs-gap-close strong { color: var(--text-heading); }

/* IRS limit warning */
.rs-limit-warn {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--c4) 10%, transparent);
  border-left: 3px solid var(--c4);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-body);
}

/* Schedule cells: gap sign */
.rs-surplus-cell { color: var(--success); }
.rs-shortfall-cell { color: var(--c3); }
.rs-gap-row strong { color: var(--text-heading); }


@media (max-width: 480px) { .rs-adv-summary { max-width: 160px; } }

/* Responsive — narrow viewport */
@media (max-width: 540px) {
  .rs-scenarios { grid-template-columns: 1fr; }
}

/* ============================================================
   EARLY RETIREMENT CALCULATOR — er- prefix (S89)
   Engine: early-retirement
   Shell elements use ci- classes; er- is for engine-own parts only.
   ============================================================ */

/* ── Sensitivity section wrapper ── */
.er-sensitivity-section {
  margin: 28px 0 0;
}
.er-sens-heading {
  margin-bottom: 8px;
}

/* ── Sensitivity table wrapper ── */
.er-sens-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.er-sens-table {
  width: 100%;
}

/* Base row highlight */
.er-sens-row-base {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-weight: 600;
}

/* Delta badges */
.er-sens-base {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-medium);
}
.er-sens-delta {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.er-earlier {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.er-later {
  background: color-mix(in srgb, var(--c3) 14%, transparent);
  color: var(--c3);
}
/* S120 contrast: the series colours as text on their own 14 % tint were 2.4–2.8:1 in light mode. */
body:not(.dark-mode) .er-earlier { color: #166534; }
body:not(.dark-mode) .er-later { color: #9A3412; }

/* ── Bridge callout ── */
.er-bridge {
  margin: 24px 0 0;
  padding: 14px 16px 12px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
}
.er-bridge-heading {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--text-heading);
}
.er-bridge-list {
  margin: 0 0 8px 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-body);
}
.er-bridge-list li {
  margin-bottom: 8px;
}
.er-bridge-list li:last-child {
  margin-bottom: 0;
}
.er-bridge-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-medium);
  line-height: 1.5;
}

/* ── Legend target swatch (dashed --c2 line); .ci-legend i wins on specificity, so name it ── */
.ci-legend i.er-legend-target {
  display: inline-block;
  width: 24px;
  height: 2px;
  background: none;
  border-top: 2px dashed var(--c2);
  vertical-align: middle;
  margin-right: 5px;
  position: relative;
  top: -1px;
}

/* ── Table cell colours ── */
.er-growth-pos { color: var(--success); }
.er-growth-neg { color: var(--c3); }
.er-surplus-cell  { color: var(--success); font-weight: 600; }
.er-shortfall-cell { color: var(--c3); font-weight: 600; }

/* ── Target-age field row (saving mode) ── */
.er-target-age-row[hidden] { display: none; }
.er-target-age-row {
  margin-top: 4px;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .er-bridge {
    padding: 12px 12px 10px;
  }
  .er-bridge-list {
    padding-left: 16px;
    font-size: 13px;
  }
  .er-sensitivity-section {
    margin: 20px 0 0;
  }
}

/* ===================================================================
   fi- — Financial Independence Calculator (S97)
   -------------------------------------------------------------------
   Engine's own parts only: the dashed "from $0" legend swatch, the
   Lean / Standard / Fat / Barista cards and the highlighted table row.
   Shell elements use ci- classes and are not restated. Tokens only.
   =================================================================== */
.ci-legend i.fi-legend-zero {
  display: inline-block;
  width: 24px;
  height: 2px;
  background: none;
  border-top: 2px dashed var(--c2);
  vertical-align: middle;
  margin-right: 5px;
  position: relative;
  top: -1px;
}
.fi-ladder-section {
  margin: 28px 0 0;
}
.fi-ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.fi-ladder-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.fi-ladder-card.fi-ladder-you {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.fi-ladder-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-medium);
}
.fi-ladder-card b {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
}
.fi-ladder-card small {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-medium);
}
.fi-ladder-years {
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-heading);
}
.fi-row-you th,
.fi-row-you td {
  background: var(--accent-soft);
  font-weight: 600;
}
@media (max-width: 767px) {
  .fi-ladder-section {
    margin-top: 20px;
  }
  .fi-ladder {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 420px) {
  .fi-ladder {
    grid-template-columns: 1fr;
  }
}



/* ===================================================================
   ri- — Retirement Income Calculator (S84)
   -------------------------------------------------------------------
   Engine's own parts only: stacked composition bar, budget callout
   (surplus / shortfall), SS provisional tax box, legend markers.
   Shell elements (form, fields, labels, KPI grid, table bar, table,
   toast) use ci- classes and are not restated here. Tokens only — no
   hex values (Hard Rules 12, 24, 33).
   =================================================================== */

/* Budget callout — surplus or shortfall */
.ri-budget-callout {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-body);
}
.ri-budget-callout.ri-surplus {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-left: 3px solid var(--success);
}
.ri-budget-callout.ri-shortfall {
  background: color-mix(in srgb, var(--c3) 12%, transparent);
  border-left: 3px solid var(--c3);
}

/* Stacked Income Composition Bar */
.ri-comp-wrap {
  margin: 14px 0 0;
}
.ri-comp-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ri-bar-ss   { background: var(--c1); transition: width .3s ease; }
.ri-bar-pen  { background: var(--c2); transition: width .3s ease; }
.ri-bar-port { background: var(--c3); transition: width .3s ease; }
.ri-bar-oth  { background: var(--c4); transition: width .3s ease; }

.ri-comp-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-medium);
}
.ri-comp-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ri-comp-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ri-dot-ss   { background: var(--c1); }
.ri-dot-pen  { background: var(--c2); }
.ri-dot-port { background: var(--c3); }
.ri-dot-oth  { background: var(--c4); }
.ri-comp-legend b {
  color: var(--text-heading);
  margin-left: auto;
  font-family: var(--font-mono);
}

/* Social Security Tax Guideline Box */
.ri-sstax-box {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-medium);
}
.ri-sstax-tier {
  font-size: 12.5px;
  color: var(--text-heading);
  font-weight: 600;
}

/* Below-chart legend marker for the dashed total line */
.ci-legend i.ri-legend-total { background: var(--text-heading); }

@media (max-width: 480px) {
  .ri-comp-legend {
    grid-template-columns: 1fr;
  }
}


/* ---------- ss- Social Security Benefits Calculator (S85) -------------
   CSS prefix: ss-
   Engine: social-security-benefits
   Only engine-own parts: chart, benefit table, mode section, history grid,
   earnings-test note, field errors, spousal grid, row highlights.
   Shell elements (ci-form, ci-panel-heading, ci-fields, ci-kicker, h2,
   ci-privacy-line, ci-result-total, ci-toast, etc.) are NOT styled here —
   they come from the ci- block above. Hard Rule 33.
   -------------------------------------------------------------------- */

/* Mode section panels — only the own containers */
.ss-mode-simple,
.ss-mode-advanced { margin-top: 8px; }

.ss-adv-note {
  font-size: 13px;
  color: var(--text-medium);
  margin: 0 0 10px;
  line-height: 1.5;
}

/* Earnings history grid (advanced mode) */
.ss-hist-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 12px;
}
.ss-hist-header {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  font: 600 11px/1.3 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-medium);
  padding: 0 2px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.ss-hist-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
}
.ss-hist-year,
.ss-hist-earn {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-heading);
  font: 500 14px/1 var(--font-body);
  padding: 5px 8px;
  width: 100%;
  box-sizing: border-box;
}
.ss-hist-year:focus,
.ss-hist-earn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}

/* Inline field-level error spans */
.ss-field-err {
  display: block;
  font-size: 12px;
  color: var(--error, #d0342c);
  margin-top: 3px;
  min-height: 0;
}

/* Spousal stat grid — second row of KPIs */
.ss-spousal-grid {
  margin-top: 10px;
}

/* FRA badge inside table rows */
.ss-fra-badge {
  display: inline-block;
  font: 600 10px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  vertical-align: middle;
  margin-left: 4px;
}

/* Table row highlights */
.ss-benefit-table tr.ss-row-selected td { background: var(--accent-soft); font-weight: 600; }
.ss-benefit-table tr.ss-row-fra td { background: var(--surface-2); }

/* Benefit-by-age SVG chart (sits on the graph paper — no card, no border) */
.ss-benefit-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.ss-line {
  stroke: var(--c1);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ss-area-fill { /* fill set via SVG gradient */ }
.ss-dot { fill: var(--c1); }
.ss-dot-selected { fill: var(--accent); r: 6; }
.ss-fra-line {
  stroke: var(--text-medium);
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
}
.ss-fra-label {
  font: 600 11px/1 var(--font-mono);
  fill: var(--text-medium);
}
.ss-axis-x, .ss-axis-y {
  font: 11px var(--font-mono);
  fill: var(--text-medium);
}
.ss-grid-line {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

/* Legend FRA dash indicator */
.ss-legend-fra {
  font-size: 12px;
  color: var(--text-medium);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Earnings test + Fairness Act note */
.ss-earnings-test-note {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.6;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface);
  border-radius: 0 4px 4px 0;
}

/* Optimizer variant — claiming-age comparison (engine-own parts only) */
.ss-cum-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ss-cum-line.ss-s1 { stroke: var(--c1); }
.ss-cum-line.ss-s2 { stroke: var(--c2); }
.ss-cum-line.ss-s3 { stroke: var(--c3); }
.ss-be-dot {
  fill: var(--surface);
  stroke: var(--text-heading);
  stroke-width: 2;
}
.ss-spouse-field { display: contents; }
.ss-spouse-field[hidden] { display: none; }

@media (max-width: 640px) {
  .ss-hist-grid { max-height: 240px; }
  .ss-hist-header,
  .ss-hist-row { grid-template-columns: 76px 1fr; }
}


/* ==========================================================================
   PENSION CALCULATOR  (S86)
   CSS prefix: pn-   Hard Rule 12 / 33: engine-own parts only.
   Shell elements (ci-form, ci-fields, ci-panel-heading, ci-result-total,
   ci-stat-grid, ci-toast, etc.) are styled by the ci- block above and are
   NOT restated here. Tokens only — no hex colours.
   ========================================================================== */

/* ── Mode tabs — wiring hook only; visual handled by ci-mode-tab rule ── */
.pn-mode-tabs { /* layout hook — no additional style needed */ }

/* ── Shared and lumpsum field groups ─────────────────────────────────── */
.pn-shared-fields { /* inherits ci-fields layout */ }
.pn-lumpsum-fields { /* inherits ci-fields layout; shown/hidden by JS */ }

/* ── Per-field inline error span ─────────────────────────────────────── */
.pn-field-err {
  display: block;
  font-size: 12px;
  color: var(--c3);
  min-height: 0;
  margin-top: 2px;
}
.pn-field-err:empty { display: none; }

/* ── /mo label inside the headline figure ───────────────────────────── */
.pn-out .ci-result-total small.pn-mo-label {
  font-size: 0.38em;
  font-weight: 500;
  color: var(--text-medium);
  margin-left: 4px;
  vertical-align: baseline;
}

/* ── §417(e) note inside the result panel ───────────────────────────── */
.pn-note-417e {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-medium);
  line-height: 1.55;
}

/* ── Below block: chart wrapper ─────────────────────────────────────── */
.pn-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Source note at the bottom of the below block ───────────────────── */
.pn-source-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-medium);
  line-height: 1.55;
}
.pn-source-note a {
  color: var(--accent);
  text-decoration: none;
}
.pn-source-note a:hover { text-decoration: underline; }

/* ── PBGC note before the source line ───────────────────────────────── */
.pn-pbgc-note:not(:empty) { display: block; margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════════════════════
   RMD — Required Minimum Distribution Calculator  (S87)
   Prefix: rmd-
   Engine-own parts only: notices, reference table caption, source note,
   field error spans, checkbox field layout, no-RMD row tint.
   Shell elements (topline, result, stat-grid, chart, legend, table bar,
   table, toast, kicker, reset, privacy, labels) use ci- classes only.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Per-field inline error ─────────────────────────────────────── */
.rmd-field-err {
  display: block;
  min-height: 1.1em;
  font-size: 12px;
  color: var(--c3);
  margin-top: 2px;
}
.rmd-field-err:empty { display: none; }

/* ── Checkbox field layout ──────────────────────────────────────── */
.rmd-check-field {
  align-items: flex-start;
}
.rmd-check-wrap {
  display: flex;
  align-items: center;
  min-height: 44px;    /* touch target */
}
.rmd-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Notice blocks (spouse / still-working) ─────────────────────── */
.rmd-notice {
  margin: 10px 0 6px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-body);
}
.rmd-notice strong { color: var(--text-heading); }
.rmd-notice a {
  color: var(--accent);
  text-decoration: none;
}
.rmd-notice a:hover { text-decoration: underline; }

/* ── "Not yet required" row tint in the schedule ────────────────── */
.rmd-schedule-table .rmd-no-rmd-row td {
  color: var(--text-medium);
  font-style: italic;
}

/* ── Reference table (Uniform Lifetime) ────────────────────────── */
.rmd-ref-table caption {
  caption-side: top;
  font-size: 12px;
  color: var(--text-medium);
  padding: 4px 0 6px;
  text-align: left;
}

/* ── Reference section toggle bar ─────────────────────────────── */
.rmd-ref-section {
  margin-top: 8px;
}
.rmd-ref-bar {
  font-size: 13px;
}
.rmd-ref-note {
  font-size: 12px;
  color: var(--text-medium);
}

/* ── Source note ─────────────────────────────────────────────── */
.rmd-source-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-medium);
  line-height: 1.55;
}
.rmd-source-note a {
  color: var(--accent);
  text-decoration: none;
}
.rmd-source-note a:hover { text-decoration: underline; }

/* ── Responsive: narrow viewports ──────────────────────────────── */
@media (max-width: 640px) {
  .rmd-chart-wrap svg { min-height: 140px; }
  .rmd-ref-table { font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   RETIREMENT AGE CALCULATOR (S88)
   Prefix: rag-
   Engine-own parts only: timeline SVG pins, milestone status pills,
   callouts, statute notes, milestone breakdown table styling.
   Shell elements (topline, result, stat-grid, chart, legend, table bar,
   table, toast, kicker, reset, privacy, labels) use ci- classes only.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Summary Callout in Report Column ───────────────────────────── */
.rag-summary-callout {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rag-callout-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-medium);
  gap: 8px;
}
.rag-callout-row strong {
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12.5px;
}

/* ── SVG Timeline Chart ─────────────────────────────────────────── */
.rag-chart {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rag-svg {
  display: block;
  width: 100%;
  height: auto;
}
.rag-node {
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}
.rag-node:hover, .rag-node:focus-visible {
  opacity: .85;
}

/* ── Milestone Status Pills ─────────────────────────────────────── */
.rag-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 100px;
  font: 700 11px/1.3 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.rag-pill-passed {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.rag-pill-current {
  background: var(--accent-soft, rgba(37, 99, 235, .12));
  color: var(--accent);
  border: 1px solid var(--accent);
}
.rag-pill-upcoming {
  background: var(--surface);
  color: var(--text-heading);
  border: 1px solid var(--border);
}

/* ── Milestone Table Details ────────────────────────────────────── */
.rag-statute-rule {
  font: 700 11.5px var(--font-mono);
  color: var(--accent);
  margin-bottom: 2px;
}
.rag-statute-detail {
  font-size: 13px;
  color: var(--text-medium);
  line-height: 1.45;
}

/* ── Milestone table is prose, not numbers (S118): body font, left, wrapping ── */
.rag-table th, .rag-table td { text-align: left; white-space: normal; font-family: var(--font-body); vertical-align: top; }
.rag-table td { font-size: 13px; color: var(--text-light); }
.rag-table td:first-child { white-space: nowrap; }
.rag-table td:nth-child(3) { white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.rag-cell-detail { min-width: 280px; }
.rag-field-err { display: block; min-height: 0; font-size: 12px; color: var(--c3); margin-top: 4px; }
.rag-field-err:empty { display: none; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rag-summary-callout { font-size: 12px; }
  .rag-callout-row { flex-direction: column; align-items: flex-start; gap: 2px; }
}



/* ---------- rw- (Retirement Withdrawal Calculator — S90) ----------
   Engine-own parts only. Shell tokens (kicker, labels, headline,
   toast, etc.) come from the ci- block above — not restated here.
   Prefix rw- is for this engine's own components ONLY:
   mode-tabs, chart, table row highlight, conditional field wrappers,
   early-distribution note, real-legend visibility.
   Hard Rule 33: no shell-element rule here; tokens only. */

/* Mode tabs — ci-mode-tabs / ci-mode-tab already styled by ci- block.
   rw-mode-tabs is a JS-query hook only; no CSS needed. */

/* Conditional field wrappers — show/hide via JS inline style */
.rw-conditional-wd,
.rw-conditional-yrs,
.rw-swr-cond-balance,
.rw-swr-cond-income {
  display: contents; /* invisible wrapper; JS sets display:none to hide */
}

/* Early-distribution / penalty note inside Advanced */
.rw-early-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: 0.8125em; /* ≈13px — use em so check-mobile.js grep skips it */
  line-height: 1.55;
  color: var(--text-medium);
}
.rw-early-note strong { color: var(--text-heading); }
.rw-early-note a { color: var(--accent); }

/* Exhausted-row highlight in the schedule table */
.rw-row-exhausted td { color: var(--c3); font-weight: 600; }

/* Real-balance legend item — JS sets display:none when inflation = 0 */

/* SWR Sensitivity Strip */
.rw-swr-strip-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.rw-strip-title {
  font-size: 0.8125em;
  color: var(--text-medium);
  margin-bottom: 10px;
}
.rw-strip-title strong {
  color: var(--text-heading);
  font-weight: 600;
}
.rw-swr-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.rw-strip-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.rw-strip-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.rw-strip-rate {
  display: block;
  font-size: 0.75em;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.rw-strip-main {
  display: block;
  font-size: 0.875em;
  color: var(--text-heading);
  white-space: nowrap;
}
.rw-strip-sub {
  display: block;
  font-size: 0.6875em;
  color: var(--text-medium);
  margin-top: 2px;
  white-space: nowrap;
}

/* Trinity Study Historical Reference Box */
.rw-trinity-card {
  margin-top: 24px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rw-trinity-header h4 {
  margin: 0 0 4px;
  font-size: 1.0625em;
  color: var(--text-heading);
}
.rw-trinity-header p {
  margin: 0 0 12px;
  font-size: 0.8125em;
  color: var(--text-medium);
}
.rw-trinity-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rw-highlight-row td {
  background: var(--accent-soft);
  font-weight: 600;
}
.rw-trinity-note {
  margin: 8px 0 0;
  color: var(--text-medium);
  font-size: 0.75em;
}

/* Responsive */
@media (max-width: 640px) {
  .rw-early-note { font-size: 0.75em; } /* ≈12px */
  .rw-swr-strip { grid-template-columns: repeat(2, 1fr); }
  .rw-swr-strip .rw-strip-item:last-child { grid-column: span 2; }
}

/* ---------- rc- (Roth Conversion Calculator — S90) ----------
   Engine-own parts only. Shell tokens (kicker, labels, headline,
   toast, etc.) come from the ci- block above — not restated here.
   Prefix rc- is for this engine's own components ONLY:
   bracket table row highlighting, IRMAA warning callout.
   Hard Rule 33: no shell-element rule here; tokens only. */

.rc-warning-box {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.8125em; /* ≈13px */
  line-height: 1.5;
  color: var(--text-medium);
}
.rc-warning-box strong { color: var(--text-heading); }
.rc-irmaa-callout {
  border-left-color: var(--c3);
  background: color-mix(in srgb, var(--c3) 8%, var(--surface-2));
}

.rc-row-current td {
  background: var(--accent-soft);
  font-weight: 600;
}
/* legend swatch for the unfilled bracket room (dashed outline, S118) */
.ci-legend i.rc-legend-room { background: var(--surface-2); border: 1px dashed var(--border-strong); }

/* ==================================================================
   sg-  CSS prefix: sg-  Engine: savings-goal  Session: S94
   Hard Rule 12 / 33: engine-own parts only.
   Shell elements (ci-form, ci-panel-heading, ci-fields, ci-field,
   ci-input-wrap, ci-select-wrap, ci-hint, ci-privacy-line,
   ci-advanced, ci-form-error, ci-actions, ci-out, ci-topline,
   ci-result-label, ci-result-total, ci-result-detail, ci-stat-grid,
   ci-toast, ci-below, ci-section-heading, ci-kicker, ci-table-bar,
   ci-table-toggle, ci-below-actions, ci-text-button, ci-csv, ci-print,
   ci-share) are owned by the ci- block — not restated here.
   ================================================================== */

/* ── Goal preset strip ───────────────────────────────────────────── */
.sg-preset-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
}
.sg-preset {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-heading);
  font: 600 12px/1.4 var(--font-body);
  cursor: pointer;
  transition: background 80ms, border-color 80ms;
}
.sg-preset:hover,
.sg-preset:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

/* ── Per-field errors ───────────────────────────────────────────── */
.sg-field-error { display: block; color: var(--danger, var(--c3)); font-size: 11.5px; font-weight: 500; }

/* ── Progress bar ────────────────────────────────────────────────── */
.sg-progress-wrap {
  margin: 16px 0 0;
}
.sg-progress-bar {
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2, var(--surface));
  overflow: hidden;
}
.sg-progress-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--success);
  transition: width 0.35s ease;
}
.sg-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 0;
  color: var(--text-medium);
}
.sg-progress-pct {
  font-weight: 700;
  color: var(--success);
}

/* ── Chart area ──────────────────────────────────────────────────── */
.sg-chart-wrap {
  display: block;
  width: 100%;
}
.sg-chart-wrap svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
/* Grid lines */
.sg-grid line {
  stroke: var(--border);
  stroke-width: 1;
}
.sg-grid text {
  fill: var(--text-medium);
  font: 11px var(--font-body);
}
/* Balance series (--c1) */
.sg-balance-line {
  stroke: var(--c1);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
/* Goal target line */
.sg-target-line {
  stroke: var(--c2);
  stroke-width: 1.5;
  opacity: 0.8;
}
.sg-target-label {
  fill: var(--c2);
  font: 11px var(--font-body);
}
/* x-axis labels */
.sg-xlabels text {
  fill: var(--text-medium);
  font: 11px var(--font-body);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .sg-preset-strip {
    gap: 5px;
  }
  .sg-preset {
    padding: 4px 10px;
  }
}


/* ==========================================================================
   DEBT SNOWBALL CALCULATOR (dsb-)
   Tokens only. Mobile inputs >= 16px. Hard Rules 12, 16, 29, 33 compliant.
   ========================================================================== */

/* ── Card grid: widen the form column so the debt-row table has room ── */
/* The card keeps the shell's 5 / 7 split (Hard Rule 25); the debt rows wrap to two lines instead. */

/* ── Debt Ledger Form Section ── */
.dsb-ledger-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.dsb-ledger-btns {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dsb-ledger-btns small { color: var(--text-medium); font-size: 11px; }
.dsb-add-btn { height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.dsb-add-btn:hover { background: var(--accent-soft); }
.dsb-field-error { display: block; color: var(--danger, var(--c3)); font-size: 11.5px; font-weight: 500; }
.dsb-budget-fields { margin-top: 16px; }
.dsb-debt-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dsb-debt-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.dsb-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.dsb-row-main .dsb-f-name { grid-column: 1 / 3; }
.dsb-remove-btn { grid-column: 3; justify-self: end; height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; margin-top: 24px; }
.dsb-remove-btn:hover, .dsb-remove-btn:focus-visible { border-color: var(--danger, var(--c3)); color: var(--danger, var(--c3)); outline: none; }
.dsb-remove-placeholder { grid-column: 3; display: block; width: 32px; height: 45px; margin-top: 24px; justify-self: end; }

/* ── 3-Way Comparison Strip ── */
.dsb-compare-section {
  margin: 18px 0 10px;
}
.dsb-compare-title {
  font: 700 11px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-medium);
  margin: 0 0 10px;
}
.dsb-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dsb-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s, background 0.15s;
}
.dsb-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.dsb-c-head strong {
  display: block;
  font-size: 0.81rem;
  color: var(--text-heading);
}
.dsb-c-head small {
  display: block;
  font-size: 0.66rem;
  color: var(--text-medium);
}
.dsb-c-kpi {
  font: 700 16px/1.2 var(--font-mono);
  color: var(--text-heading);
  margin-top: 4px;
}
.dsb-c-sub {
  font-size: 0.72rem;
  color: var(--text-medium);
}
.dsb-c-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.dsb-compare-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border-left: 3px solid var(--c2);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-body);
}

/* ── Payoff Milestones ── */
.dsb-milestones {
  margin: 18px 0 6px;
}
.dsb-milestone-title {
  font: 700 11px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-medium);
  margin: 0 0 8px;
}
.dsb-milestone-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dsb-milestone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
}
.dsb-ms-badge {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font: 700 11px/22px var(--font-mono);
  text-align: center;
}
.dsb-ms-info {
  flex: 1 1 auto;
  min-width: 0;
}
.dsb-ms-info strong {
  display: block;
  color: var(--text-heading);
  font-size: 0.81rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dsb-ms-info small {
  display: block;
  color: var(--text-medium);
  font-size: 0.69rem;
}
.dsb-ms-rollover {
  flex-shrink: 0;
  font: 600 11px var(--font-mono);
  color: color-mix(in srgb, var(--success) 55%, var(--text-heading));   /* S120: --success alone was 2.95:1 on its tint */
  background: color-mix(in srgb, var(--success) 10%, transparent);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ── Responsive adjustments ── */
@media (max-width: 640px) {
  .dsb-row-main {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dsb-row-main .dsb-f-name { grid-column: 1; }
  .dsb-remove-btn, .dsb-remove-placeholder { grid-column: 2; }
  .dsb-compare-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Debt Avalanche variant (S96): payoff-order lines under the comparison strip ── */
.dsb-order {
  margin: 10px 0 0;
  display: grid;
  gap: 4px;
}
.dsb-order p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-body);
}
.dsb-order strong {
  color: var(--text-heading);
}


/* ==========================================================================
   TIP & BILL SPLIT CALCULATOR (tip-)  — engine-own parts only (S118 refresh)
   Tokens only. Mobile inputs >= 16px. Hard Rules 12, 16, 29, 33 compliant.
   ========================================================================== */

/* ── Quick tip-rate buttons (a ci-field whose control is a button row) ── */
.tip-presets-wrap { grid-column: 1 / -1; }
.tip-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.tip-preset-btn { flex: 1; min-width: 56px; padding: 7px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  font: 600 13px var(--font-body); color: var(--text-medium); cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.tip-preset-btn:hover, .tip-preset-btn:focus-visible { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.tip-preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Mode panels and spacing ── */
.tip-fields-gap { margin-top: 15px; }

/* ── Diner / party rows (portfolio-allocation row pattern) ── */
.tip-ledger-section { display: flex; flex-direction: column; gap: 8px; }
.tip-ledger-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 600 13.5px var(--font-body); color: var(--text-heading); }
.tip-ledger-head small { font-size: 11px; font-weight: 400; color: var(--text-medium); text-align: right; }
.tip-item-rows, .tip-party-rows { display: flex; flex-direction: column; gap: 8px; }
.tip-row { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 10px; align-items: start; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: var(--surface-2); }
.tip-row .ci-field { margin: 0; }
.tip-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; align-self: start; margin-top: 24px; }
.tip-remove-btn:hover, .tip-remove-btn:focus-visible { border-color: var(--danger); color: var(--danger); }
.tip-remove-placeholder { display: block; width: 32px; height: 45px; margin-top: 24px; }
.tip-add-btn { align-self: flex-start; height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.tip-add-btn:hover, .tip-add-btn:focus-visible { background: var(--accent-soft); }
.tip-add-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Result notes and table rows ── */
.tip-note { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; line-height: 1.5; color: var(--text-medium); }
.tip-mine-row th, .tip-mine-row td { background: var(--accent-soft); font-weight: 700; color: var(--text-heading); }
.tip-table th[scope="row"] { text-align: left; font-family: var(--font-body); font-weight: 500; }
.tip-table th[scope="row"] small { color: var(--text-medium); font-weight: 400; }
/* the per-diner table is open by default: let it scroll without widening the card's grid track on a phone */
.tip-table-scroll { width: 0; min-width: 100%; }
@media (max-width: 640px) { .tip-below { min-width: 0; } }   /* S120: the chart is drawn at the box's own width (11 px text on a phone) — no min-width, no scroll */
.tip-total-row th, .tip-total-row td { border-top: 2px solid var(--border-strong, var(--border)); color: var(--text-heading); font-weight: 700; }

@media (max-width: 520px) {
  .tip-row { grid-template-columns: 1fr auto; }
  .tip-row .tip-f-name { grid-column: 1 / -1; }
  .tip-remove-btn, .tip-remove-placeholder { align-self: end; margin-top: 0; }
}


/* ==========================================================================
   EXPENSE SPLITTER CALCULATOR (es-) — engine-own parts only (S118 rebuild)
   The fields are shared ci-field / ci-input-wrap / ci-select-wrap; the
   "Shared by" chips are the shared ci-timing control. This block lays out
   the repeating people / expense rows (portfolio-allocation row pattern)
   and styles the settlement list. Tokens only.
   ========================================================================== */
.es-section { display: flex; flex-direction: column; gap: 8px; margin: 0 0 18px; }
.es-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 600 13.5px var(--font-body); color: var(--text-heading); }
.es-section-head small { font-size: 11px; font-weight: 400; color: var(--text-medium); }
.es-people-list, .es-expense-list { display: flex; flex-direction: column; gap: 8px; }
.es-person-row { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 10px; align-items: start; }
.es-person-row .ci-field, .es-exp .ci-field { margin: 0; }
.es-exp { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.es-exp-top { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 10px; align-items: start; }
.es-exp-mid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.es-who.ci-timing { margin: 2px 0 0; }
.es-who.ci-timing label { flex: 0 1 auto; min-width: 84px; }
.es-shares { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.es-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; margin-top: 24px; }
.es-remove-btn:hover, .es-remove-btn:focus-visible { border-color: var(--danger); color: var(--danger); }
.es-remove-placeholder { display: block; width: 32px; height: 45px; margin-top: 24px; }
.es-add-btn { align-self: flex-start; height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.es-add-btn:hover, .es-add-btn:focus-visible { background: var(--accent-soft); }
.es-add-btn:disabled { opacity: .45; cursor: not-allowed; }
/* Result column: the settlement list */
.es-settlement-list { list-style: none; counter-reset: es-tx; display: flex; flex-direction: column; gap: 8px; margin: 16px 0 0; padding: 0; }
.es-transfer-row { counter-increment: es-tx; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font: 500 14px var(--font-body); }
.es-transfer-row::before { content: counter(es-tx); width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 700 11px var(--font-mono); display: grid; place-items: center; flex-shrink: 0; }
.es-tx-from, .es-tx-to { font-weight: 600; color: var(--text-heading); }
.es-tx-arrow { color: var(--text-medium); }
.es-tx-amount { margin-left: auto; font: 700 15px var(--font-mono); color: var(--text-heading); }
.es-settled-msg { margin: 16px 0 0; font: 600 14px var(--font-body); color: var(--text-heading); }
.es-note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--text-medium); }
.es-table th[scope="row"] { text-align: left; font-family: var(--font-body); font-weight: 500; }
.es-total-row th, .es-total-row td { font-weight: 700; color: var(--text-heading); }
.es-total-row:first-child th, .es-total-row:first-child td { border-top: 2px solid var(--border-strong); }
@media (max-width: 640px) { .es-below { min-width: 0; } }   /* S120: chart drawn at the box's own width — no min-width */
@media (max-width: 767px) {
  .es-person-row, .es-exp-top { grid-template-columns: 1fr 1fr 32px; }
  .es-exp-top .es-f-desc { grid-column: 1 / -1; }
  .es-exp-mid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .es-person-row, .es-exp-top { grid-template-columns: 1fr 32px; }
  .es-person-row .es-f-name, .es-exp-top .es-f-desc { grid-column: 1 / -1; }
  .es-exp-mid { grid-template-columns: 1fr; }
  .es-remove-btn, .es-remove-placeholder { margin-top: 24px; }
}


/* ==========================================================================
   Credit Score Impact Calculator  (prefix: cs-)
   Engine: _calc-credit-score-impact.js — S100, rebuilt on the shell S118.
   Engine-own parts only: the card rows (portfolio-allocation row pattern —
   each cell is a shell ci-field), the age rows, the two info panels and
   the per-field errors. Every shell element (panel heading, fields, mode
   tabs, stat grid, chart, legend, table bar, toast) is the ci- block.
   Tokens only. Hard Rules 12, 16, 29, 33.
   ========================================================================== */

/* ── Card rows ── */
.cs-cards { display: grid; gap: 10px; margin: 0 0 10px; }
.cs-card-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 32px; gap: 10px; align-items: start; }
.cs-remove-btn { height: 45px; width: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; align-self: start; margin-top: 24px; }
.cs-remove-btn:hover, .cs-remove-btn:focus-visible { border-color: var(--danger, var(--c3)); color: var(--danger, var(--c3)); outline: none; }
.cs-remove-placeholder { display: block; width: 32px; height: 45px; margin-top: 24px; }
.cs-cards-btns { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.cs-add-btn { height: 38px; padding: 0 14px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.cs-add-btn:hover { background: var(--accent-soft); }
.cs-add-btn:disabled { opacity: .45; cursor: not-allowed; }
.cs-cards-note { color: var(--text-medium); font-size: 11px; }
.cs-field-error { display: block; color: var(--danger, var(--c3)); font-size: 11.5px; font-weight: 500; }

/* ── Age rows inside Advanced (a nested grid that spans the advanced grid) ── */
.cs-age-rows { grid-column: 1 / -1; margin-top: 0; }

/* ── Info panels in the report column ── */
.cs-info-panel { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--border); }
.cs-info-heading { margin: 0 0 4px; font: 600 13px var(--font-body); color: var(--text-heading); }
.cs-info-heading small { margin-left: 6px; font-weight: 400; font-size: 11px; color: var(--text-medium); }
.cs-info-panel .ci-stat-grid { margin-top: 8px; }
.cs-inq-note { margin: 10px 0 0; color: var(--text-medium); font-size: 11px; line-height: 1.5; }

/* ── Table totals row ── */
.cs-totals-row td { border-top: 2px solid var(--border-strong); }

@media (max-width: 640px) {
  .cs-card-row { grid-template-columns: 1fr 1fr; }
  .cs-card-row .cs-f-name { grid-column: 1 / -1; }
  .cs-remove-btn, .cs-remove-placeholder { grid-column: 2; justify-self: end; margin-top: 0; }
}

/* ==========================================================================
   svr-  Savings Rate Calculator  (S101)
   Engine-own parts only — shell elements use shared ci- classes.
   Tokens only; no hex values.
   ========================================================================== */

/* ── Mode tabs (income base selector) ─────────────────────────────────────── */
.svr-mode-tabs {
  margin-bottom: 14px;
}

/* ── +1% callout ──────────────────────────────────────────────────────────── */
.svr-plus-one {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-wrap: wrap;
}
.svr-plus-one-label {
  font: 600 12px/1.4 var(--font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-medium);
  white-space: nowrap;
}
.svr-plus-one-value {
  font: 700 15px/1.3 var(--font-body);
  color: var(--text-heading);
}

/* ── Convention bar chart ─────────────────────────────────────────────────── */
.svr-chart svg,
.svr-split-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.svr-bar-label {
  font: 500 12px/1.3 var(--font-body);
  fill: var(--text-medium);
}
.svr-bar-value {
  font: 700 12.5px/1.3 var(--font-body);
  fill: var(--text-heading);
}
.svr-grid-tick {
  stroke: var(--border);
  stroke-width: 1;
}
.svr-axis-label {
  font: 400 11px/1 var(--font-mono);
  fill: var(--text-medium);
}

/* ── 50/30/20 split chart ─────────────────────────────────────────────────── */
.svr-split-heading {
  margin-top: 28px;
}
.svr-split-note {
  margin: 8px 0 14px;
  color: var(--text-medium);
  font-size: 12px;
  line-height: 1.5;
}
.svr-split-label {
  font: 600 11.5px/1 var(--font-body);
  fill: var(--text-heading);
}
.svr-split-amount {
  font: 600 12px/1 var(--font-mono);
  fill: var(--text-medium);
}

/* ── Convention table ─────────────────────────────────────────────────────── */
.svr-convention-table th,
.svr-convention-table td {
  white-space: nowrap;
}
.svr-convention-table td:last-child {
  text-align: right;
}

/* ── Inline field errors ──────────────────────────────────────────────────── */
.svr-field-error {
  display: block;
  font: 400 12px/1.4 var(--font-body);
  color: var(--danger, #c0392b);
  margin-top: 3px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .svr-plus-one {
    flex-direction: column;
    gap: 4px;
  }
}


/* ==========================================================================
   bv-  Business Valuation Calculator (S103; rebuilt S118) — engine-own parts only.
   Fields, tabs, KPI grid, chart wrapper and table are the shared ci- shell.
   ========================================================================== */
.bv-adv-head { grid-column: 1 / -1; margin: 6px 0 -4px; font: 700 11px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-medium); }
.bv-note { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; line-height: 1.55; color: var(--text-medium); }
.bv-note strong { color: var(--text-heading); }
.bv-table th[scope="row"], .bv-bridge-table th[scope="row"] { text-align: left; font-family: var(--font-body); font-weight: 600; }
.bv-bridge-table { margin-top: 14px; }
.bv-sub-row th, .bv-sub-row td { font-weight: 700; color: var(--text-heading); background: var(--surface-2); }
@media (max-width: 640px) { .bv-below { min-width: 0; } }

/* ---------- ro-  return on investment (S104) ----------
   Shell rules come from the shared ci- block. Engine-own parts only:
   the live "N in use" count, per-field errors, the invalid-input prompt. */
.ro-adv-count { font-weight: 600; }
.ro-adv-count-on { color: var(--accent); }
.ro-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.ro-field-error:empty { display: none; }
.ro-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }
.ro-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.ro-prompt strong { color: var(--text-heading); }
@media (max-width: 640px) { .ro-below { min-width: 0; } }

/* ---------- be-  break-even analysis (S105) ----------
   Shell rules come from the shared ci- block. Engine-own parts only:
   the live "N in use" count, per-field errors, the invalid-input prompt,
   and the sensitivity (scenario) panel under the KPI grid. */
.be-adv-count { font-weight: 600; }
.be-adv-count-on { color: var(--accent); }
.be-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.be-field-error:empty { display: none; }
.be-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }
.be-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.be-prompt strong { color: var(--text-heading); }
.be-scenarios { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.be-scenarios > summary { cursor: pointer; font-weight: 600; color: var(--text-heading); font-size: 14px; }
.be-scenarios .ci-table-scroll { margin-top: 10px; width: 0; min-width: 100%; }   /* scroll inside the report column without widening the grid track at 390 px */
.be-scenario-table th[scope="row"] { text-align: left; font-weight: 600; }
.be-base-row th, .be-base-row td { color: var(--text-heading); font-weight: 700; }
@media (max-width: 640px) { .be-below { min-width: 0; } }


/* ---------- pm-  profit margin calculator (S106) ----------
   Hard Rule 12: all classes prefixed pm-. Tokens only — no hex values.
   Hard Rule 29: pm-table-bar / pm-below-actions compliant.
   Hard Rule 33: shell elements use ci- only; pm- is for engine-own parts. */

/* mg- shell rules are ci- — only engine-own parts below */
.pm-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.pm-field-error:empty { display: none; }
.pm-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }

/* mode tabs: accent fill on active, token border (ci-mode-tab provides base shape) */
.pm-mode-tabs { flex-wrap: wrap; }

/* Composition bar */
.pm-comp-bar-wrap { margin: 14px 0 8px; }
.pm-comp-bar { height: 9px; border-radius: 100px; overflow: hidden; background: var(--surface-2); display: flex; }
.pm-comp-bar > div { height: 100%; transition: width .22s ease; }
.pm-bar-cost { background: var(--c3); }
.pm-bar-profit { background: var(--c2); }
.pm-bar-loss { background: var(--danger); }
.pm-comp-legend { display: flex; gap: 8px 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-medium); }
.pm-comp-legend span { display: inline-flex; align-items: center; gap: 4px; }
.pm-key-cost  { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c3); }
.pm-key-profit { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c2); }

/* Convention note */
.pm-convention-note { font-size: 12px; color: var(--text-medium); margin: 12px 0 0; line-height: 1.5; border-top: 1px solid var(--border); padding-top: 10px; }

/* Advanced count badge */
.pm-adv-count { font-weight: 600; }
.pm-adv-count-on { color: var(--accent); }

/* Loss colouring on amounts (never on the headline ci-result-total) */
.pm-loss { color: var(--danger); }

/* Income-statement ladder and chain tables (ci-table) — subtotal rows */
.pm-ladder-subtotal-row th, .pm-ladder-subtotal-row td { font-weight: 700; color: var(--text-heading); background: var(--surface-2); }
.pm-ladder-table th[scope="row"], .pm-chain-table th[scope="row"] { text-align: left; font-family: var(--font-body); font-weight: 500; }

/* Quick markup presets (markup surface) — engine-own quick-set buttons */
.pm-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.pm-preset-btn { padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; font: 600 12px var(--font-body); color: var(--text-medium); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.pm-preset-btn:hover, .pm-preset-btn:focus-visible { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Conversion table */
.pm-conv-table { width: 100%; }
.pm-conv-highlight td { background: var(--accent-soft); font-weight: 600; color: var(--text-heading); }

/* Chart area */
.pm-chart svg { display: block; width: 100%; height: auto; }

@media (max-width: 767px) {
  .pm-mode-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .pm-mode-tabs::-webkit-scrollbar { display: none; }
}

/* ---------- cg-  cost of goods sold calculator (S107; rebuilt S118) ----------
   Engine-own parts only: per-field errors, the convention note and the
   breakdown table's subtotal / total / unit rows. Tokens only. */
.cg-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.cg-field-error:empty { display: none; }
.cg-convention-note { font-size: 12px; color: var(--text-medium); margin: 12px 0 0; line-height: 1.55; }
.cg-breakdown-table tr.cg-sub-row td { font-weight: 600; color: var(--text-heading); }
.cg-breakdown-table tr.cg-total-row td { font-weight: 700; color: var(--text-heading); border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.cg-breakdown-table tr.cg-unit-row td { font-style: italic; color: var(--text-medium); }


/* ---------- cf-  cash flow (S108) ----------
   Engine-own parts only: the repeating line rows, the shortfall callout, the
   negative-balance table cell and per-field errors. Everything else is the
   shared ci- shell. Tokens only. */
.cf-lines { border: 0; margin: 20px 0 16px; padding: 0; min-width: 0; }
.cf-lines legend { padding: 0 0 4px; color: var(--text-heading); font: 600 13.5px var(--font-body); }
.cf-lines-note { margin: 0 0 6px; color: var(--text-medium); font-size: 12px; line-height: 1.5; }
.cf-row { border-bottom: 1px solid var(--border); padding: 12px 0; }
.cf-row:last-child { border-bottom: 0; }
.cf-row-fields { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .85fr) auto; gap: 8px 10px; align-items: start; }
.cf-f-label { grid-column: 1 / 3; }
.cf-f-type { grid-column: 3 / 5; }
.cf-remove-btn { height: 45px; width: 32px; margin-top: 24px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-medium); font-size: 13px; cursor: pointer; }
.cf-remove-btn:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.cf-remove-btn:disabled { opacity: .35; cursor: not-allowed; }
.cf-add-btn { height: 38px; padding: 0 14px; margin-top: 8px; border: 1.5px dashed var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: 600 13px var(--font-body); cursor: pointer; }
.cf-add-btn:hover:not(:disabled) { background: var(--accent-soft); }
.cf-add-btn:disabled { opacity: .45; cursor: not-allowed; }
.cf-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.cf-field-error:empty { display: none; }
.cf-adv-count { font-weight: 600; }
.cf-adv-count-on { color: var(--accent); }
.cf-prompt { display: grid; gap: 4px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-medium); font-size: 14px; }
.cf-prompt strong { color: var(--text-heading); }
.cf-callout { margin: 0 0 14px; padding: 11px 14px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: var(--surface-2); color: var(--text-light); font-size: 13.5px; line-height: 1.5; }
.cf-callout strong { color: var(--text-heading); }
.cf-callout-short { border-left-color: var(--danger); }
.cf-callout-ok { border-left-color: var(--success); }
.cf-table td.cf-neg { color: var(--danger); font-weight: 700; }
.cf-table td.cf-flag { color: var(--danger); font-weight: 600; text-align: left; white-space: nowrap; }
.cf-table th:last-child { text-align: left; }
@media (max-width: 900px) {
  .cf-row-fields { grid-template-columns: 1fr 1fr; }
  .cf-f-label, .cf-f-type { grid-column: 1 / -1; }
  .cf-remove-btn { align-self: end; margin-top: 0; }
}
@media (max-width: 420px) {
  .cf-row-fields { grid-template-columns: 1fr; }
  .cf-remove-btn { width: 100%; }
}


/* ---------- dp- : Depreciation Calculator (S109; rebuilt S118) --------------------
   Engine-own parts only: per-field errors, the result notes, the decline note,
   the schedule table's year-1 row. The mode tabs, fields, legend, chart wrapper,
   KPI grid and toast are the shared ci- shell and are never restated here.
   Tokens only; no hex values. */
.dp-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.dp-field-error:empty { display: none; }
.dp-uop-error { grid-column: 1 / -1; }
.dp-uop-fields { margin-top: 15px; }
.dp-uop-rows { display: contents; }
.dp-notes { margin: 12px 0 0; }
.dp-notes p { margin: 0 0 8px; padding: 9px 12px; border: 1px solid var(--border); border-left: 3px solid var(--c3); border-radius: 0 6px 6px 0; background: var(--surface-2); color: var(--text-medium); font-size: 12.5px; line-height: 1.5; }
.dp-notes p strong { color: var(--text-heading); }
.dp-decline-note { margin: 12px 0 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-medium); font-size: 12px; line-height: 1.5; }
.dp-decline-note strong { color: var(--text-heading); }
.dp-decline-note[hidden] { display: none; }
.dp-table tr.dp-tbl-y1 td { font-weight: 700; color: var(--text-heading); }
.dp-table tfoot td { font-weight: 700; color: var(--text-heading); border-top: 1px solid var(--border-strong); }
.calc-tool .dp-form select:disabled { opacity: .6; cursor: not-allowed; }


/* mk- — the Markup Calculator (S110) is the profit-margin engine's markup
   surface; its parts (presets, chain table) live in the pm- block above.
   The former mk-keystone-btn / mk-chain-result rules styled nothing the
   engine rendered and were removed in the S118 audit. */

/* ======================================================================
   dc- — DISCOUNT CALCULATOR (S111; card rebuilt S118) — engine-own parts only.
   Mode panels, the result note and the "yours" table row. Tokens only.
   ====================================================================== */
.dc-note { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; line-height: 1.5; color: var(--text-medium); }
.dc-table th[scope="row"] { text-align: left; font-family: var(--font-body); font-weight: 600; }
.dc-mine-row th, .dc-mine-row td { background: var(--accent-soft); font-weight: 700; color: var(--text-heading); }
@media (max-width: 640px) { .dc-below { min-width: 0; } .pm-below { min-width: 0; } }


/* ---------- dso-  days sales outstanding / receivables turnover (S112; rebuilt S118) ----------
   Engine-own parts only: per-field errors and the result notes. The fields, KPI grid,
   chart wrapper, legend, table bar and toast are the shared ci- shell. Tokens only. */
.dso-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.dso-field-error:empty { display: none; }
.dso-notes { margin: 12px 0 0; }
.dso-notes p { margin: 0 0 8px; padding: 9px 12px; border: 1px solid var(--border); border-left: 3px solid var(--c3); border-radius: 0 6px 6px 0; background: var(--surface-2); color: var(--text-medium); font-size: 12.5px; line-height: 1.5; }
.dso-notes p strong { color: var(--text-heading); }



/* ---------- wc-  working capital calculator (S113) -----------------
   Engine-own parts only. Shell elements (ci-form, ci-field, ci-out,
   ci-result-*, ci-stat-grid, ci-topline, ci-toast, ci-table-bar,
   ci-below-actions, ci-text-button) come from the ci- block above.
   Tokens only — no hex values.
   ----------------------------------------------------------------- */

/* Field error spans */
.wc-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.wc-field-error:empty { display: none; }

/* Current-liabilities legend keys (the CL bar is neutral so it never shares a data colour with an asset) */
.ci-legend i.wc-legend-cl { background: var(--text-medium); opacity: .35; }
.ci-legend i.wc-legend-debt { background: var(--text-medium); opacity: .75; }

/* Convention note in the report column */
.wc-convention-note {
  font-size: 12px;
  color: var(--text-medium);
  line-height: 1.6;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 4px 4px 0;
}
.wc-convention-note strong { color: var(--text-heading); }
.wc-convention-note em { font-style: normal; font-weight: 700; color: var(--text-heading); }

/* Balance-sheet comparison table */
.wc-tbl-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-medium);
  padding-top: 10px;
}
.wc-tbl-subtotal td { font-weight: 700; color: var(--text-heading); background: var(--surface-2); padding: 6px 8px; }
.wc-num { text-align: right; font-family: var(--font-mono); font-size: 13px; }

/* Legend colour dots reuse ci- classes; no engine override needed */

@media (max-width: 640px) {
  .wc-convention-note { font-size: 11.5px; }
}

/* ---------- ccc-  cash conversion cycle calculator (S114) ----------
   Engine-own parts only: per-field errors, the convention note in the
   report column and the breakdown table. Shell elements (ci-form,
   ci-field, ci-out, ci-result-*, ci-stat-grid, ci-chart, ci-legend,
   ci-table-*, ci-toast) come from the ci- block. Tokens only.
   ----------------------------------------------------------------- */
.ccc-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.ccc-field-error:empty { display: none; }
.ccc-form .ci-field:has([aria-invalid="true"]) > .ci-input-wrap { border-color: var(--danger); }

.ccc-note {
  font-size: 12px;
  color: var(--text-medium);
  line-height: 1.6;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 4px 4px 0;
}
.ccc-note:empty { display: none; }
.ccc-note p { margin: 0; }
.ccc-note p + p { margin-top: 6px; }
.ccc-note strong { color: var(--text-heading); }

.ccc-num { text-align: right; font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.ccc-tbl-total td { font-weight: 700; color: var(--text-heading); background: var(--surface-2); }

@media (max-width: 640px) {
  .ccc-note { font-size: 11.5px; }
}




/* ---------- inv-  inventory turnover (S115; rebuilt S118) ----------
   Engine-own parts only: per-field errors and the section description.
   The fields, selects, KPI grid, chart wrapper, legend, table bar and toast
   are the shared ci- shell. Tokens only. */
.inv-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.inv-field-error:empty { display: none; }

/* ---------- bf-  Body Fat Percentage Calculator (S117; audited S118) ----------
   CSS prefix: bf-   Hard Rule 12/33: engine-own parts only — the band name in the
   detail line, the two-track scale SVG (Gallagher bands + ACE categories), its legend
   keys, the active table row and the comparison notes. Colours are tokens only. */
.bf-band-name { font-weight: 700; color: var(--text-heading); }
.bf-band-name::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--border-strong); }
.bf-band-name.bf-band-underfat::before, .bf-seg-underfat, .ci-legend i.bf-k-underfat { background: var(--c1); fill: var(--c1); }
.bf-band-name.bf-band-healthy::before, .bf-seg-healthy, .ci-legend i.bf-k-healthy { background: var(--success); fill: var(--success); }
.bf-band-name.bf-band-overfat::before, .bf-seg-overfat, .ci-legend i.bf-k-overfat { background: var(--star); fill: var(--star); }
.bf-band-name.bf-band-obese::before, .bf-seg-obese, .ci-legend i.bf-k-obese { background: var(--danger); fill: var(--danger); }
.bf-seg-ace-essential, .ci-legend i.bf-k-ace-essential { background: var(--c4); fill: var(--c4); }
.bf-seg-ace-athletes, .ci-legend i.bf-k-ace-athletes { background: var(--c1); fill: var(--c1); }
.bf-seg-ace-fitness, .ci-legend i.bf-k-ace-fitness { background: var(--success); fill: var(--success); }
.bf-seg-ace-average, .ci-legend i.bf-k-ace-average { background: var(--star); fill: var(--star); }
.bf-seg-ace-obese, .ci-legend i.bf-k-ace-obese { background: var(--danger); fill: var(--danger); }
.bf-seg { fill-opacity: .55; }
.ci-chart svg text.bf-seg-label { fill: var(--text-heading); font-weight: 600; }
.ci-chart svg text.bf-mk { fill: var(--text-heading); font-weight: 700; }
.bf-mark { fill: var(--text-heading); }
.bf-mark-line { stroke: var(--text-heading); stroke-width: 1; }
.bf-chart, .bf-table-scroll { width: 0; min-width: 100%; }   /* contributes no min-content width to the card grid; the SVG is drawn at this box's width (S120) */
.bf-table tr.bf-row-active td { color: var(--text-heading); font-weight: 700; background: var(--accent-soft); }
.bf-note { margin: 12px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--text-medium); }
.bf-note b { color: var(--text-heading); }

/* ---------- iw-  Ideal Weight Calculator (S119) ----------
   CSS prefix: iw-   Hard Rule 12/33: engine-own parts only — the weight number-line SVG
   (healthy band, formula marks in --c1..--c4, the reader's marker), its legend keys, the
   formula sub-heading and the limits paragraphs. Every shell element is the ci- block's. */
.iw-band { fill: var(--success); fill-opacity: .14; stroke: var(--success); stroke-opacity: .55; }
.ci-chart svg text.iw-edge { fill: var(--text-heading); font-weight: 700; }
.ci-chart svg text.iw-band-label { fill: var(--text-medium); }
.ci-chart svg text.iw-mk { fill: var(--text-heading); font-weight: 600; paint-order: stroke; stroke: var(--bg-primary); stroke-width: 3px; stroke-linejoin: round; }
.iw-axis, .iw-tick { stroke: var(--border-strong); stroke-width: 1; }
.iw-stem { stroke-width: 1.5; }
.iw-f1 { fill: var(--c1); stroke: var(--c1); } .iw-f2 { fill: var(--c2); stroke: var(--c2); }
.iw-f3 { fill: var(--c3); stroke: var(--c3); } .iw-f4 { fill: var(--c4); stroke: var(--c4); }
.iw-you { stroke: var(--text-heading); stroke-width: 1.5; stroke-dasharray: 3 3; }
.iw-you-dot { fill: var(--text-heading); }
.ci-legend i.iw-k-band { background: var(--success); opacity: .45; }
.ci-legend i.iw-k-you { background: var(--text-heading); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.iw-chart, .iw-table-scroll { width: 0; min-width: 100%; }   /* contributes no min-content width to the card grid; the SVG is drawn at this box's width (S120) */
.iw-subhead { margin: 22px 0 -12px; font-size: 12.5px; font-weight: 600; color: var(--text-medium); }
.iw-limits p { margin: 0 0 8px; }
.iw-limits b { color: var(--text-heading); }

/* S120 (business + body family): every chart is drawn by its engine at the .ci-chart box's own width and
   redrawn on resize — never a min-width, never scaled. At a box ≤ 600 px the engine marks the SVG
   data-phone and its text is 11 px (one user unit = one CSS pixel). */
.bv-chart svg[data-phone] text, .ro-chart-wrap svg[data-phone] text, .be-chart-wrap svg[data-phone] text,
.pm-chart svg[data-phone] text, .cf-chart svg[data-phone] text, .dp-chart svg[data-phone] text,
.dc-chart svg[data-phone] text, .dso-chart svg[data-phone] text, .wc-chart svg[data-phone] text,
.ccc-chart svg[data-phone] text, .inv-chart svg[data-phone] text, .cg-chart svg[data-phone] text,
.bmi-chart svg[data-phone] text, .bf-chart svg[data-phone] text, .iw-chart svg[data-phone] text { font-size: 11px; }
.bv-field-error { color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.4; }
.bv-field-error:empty { display: none; }

/* ---------- Inherited fix: iOS zoom on every text-entry field ----------
   cm-base.css sizes several inputs at 14-15px (header search, mobile
   search, newsletter, modals). ANY text-entry field under 16px makes iOS
   Safari zoom the whole page on focus, and the user must pinch back out.
   Hard Rule 16. One authoritative override, placed last so it wins;
   cm-base.css is left untouched as the record of the inherited design.
   Guard: qa/check-mobile.js. */
input:not([type="radio"]):not([type="checkbox"]):not([type="button"]):not([type="submit"]),
select,
textarea { font-size: 16px; }
