/* Instrument theme for the Retirement Planner.
   Load AFTER Bootstrap 5.3 (CDN). Plain CSS, no build step.
   Markup rules: design-reference/README.md → "Instrument theme".
   Visual source: Retirement Planner Instrument.dc.html. */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  --rp-bg: #eef0f3;          /* page */
  --rp-surface: #fff;        /* cards */
  --rp-surface-2: #f7f8fa;   /* table header, read-only field */
  --rp-inset: #eef0f3;       /* segmented track, value pills */
  --rp-appbar: #151a22;      /* app bar only */

  --rp-ink: #151a22;         /* primary text */
  --rp-ink-2: #3a424e;       /* labels, body */
  --rp-muted: #5d6673;       /* helper text (5.9:1 on white) */
  --rp-faint: #8b94a1;       /* decoration only: row numbers, "—" */
  --rp-on-dark: #fff;
  --rp-on-dark-muted: #9aa4b2;
  --rp-on-dark-rule: #3a4250;   /* outlines on the app bar: the "Early preview" chip */

  --rp-border: #dfe3e8;      /* card edge */
  --rp-rule: #e8ebef;        /* rows inside cards */
  --rp-rule-strip: #eef0f3;  /* dividers in the metric strip */
  --rp-control: #d3d8df;     /* inputs, secondary buttons */

  --rp-primary: #2863ab;          /* oklch(0.5 0.13 255) */
  --rp-primary-rgb: 40, 99, 171;
  --rp-primary-hover: #1f5596;    /* oklch(0.45 0.12 255) */
  --rp-primary-tint: #e9f1fc;     /* oklch(0.96 0.025 255): linked chips, selected rows */
  --rp-primary-tint-edge: #d3e0f1;  /* the edge of a primary-tint band: the welcome bar */
  --rp-appbar-accent: #67aaed;    /* oklch(0.72 0.12 250): active nav underline, logo mark */

  --rp-success: #177c49;  --rp-success-tint: #daf7e3;  /* ≥ 85% */
  --rp-caution: #ba7331;                                /* 70–84% */
  --rp-caution-ink: #9a5f28;  /* amber for small text: --rp-caution is 3.8:1 on white, this is 5.2:1 */
  --rp-danger:  #c0453b;                                /* < 70% */
  --rp-danger-hover: #a33b32;  /* the delete button's hover: --rp-danger 85% toward black */

  /* Tinted chips and cells. Each ink is ≥ 6.5:1 on its own background. */
  --rp-phase-bridge-ink: #154d8c;    --rp-phase-bridge-bg: #e7edf6;    /* year-by-year "Bridge" */
  --rp-phase-ss-ink: #00572e;        --rp-phase-ss-bg: #e3f2ec;        /* "Social Security" */
  --rp-phase-unfunded-ink: #9a2a23;  --rp-phase-unfunded-bg: #fbe9e4;  /* "Unfunded" */
  /* Other phases ("Working", "One working") use --rp-ink-2 on --rp-rule. */
  --rp-row-unfunded: #fdf3f0;        /* a year-by-year row with an unfunded shortfall */
  --rp-changed-bg: #edf6ff;          /* compare: an assumption that differs from the baseline */
  --rp-changed-ink: var(--rp-primary-hover);  --rp-changed-border: #a0c0eb;  /* its "changed" tag */
  --rp-notice-bg: #fff3df;  --rp-notice-border: #eccb9e;  /* amber notice: unsaved changes not in Compare */
  --rp-seg-past-border: #c3cad3;  /* dashed outline of the "Past markets" tab segment (Historical) */

  /* Charts (SVG fill/stroke). Year by year: change in the balance, in the legend's order:
     You added, Market gain, You took out, Market loss, Shortfall year.
     Up = in, down = out; solid = you, light = market. */
  --rp-chart-added: #3f9b65;          /* You added (contributions + saved surplus) */
  --rp-chart-gain: #aadcba;           /* Market gain */
  --rp-chart-out: var(--rp-primary);  /* You took out (gross withdrawals) */
  --rp-chart-loss: #a4c0e4;           /* Market loss */
  --rp-chart-unfunded: #c0453b;       /* Shortfall year mark */
  /* Historical tab: the market-return strip. The history line is --rp-ink and the
     ran-out line --rp-chart-unfunded; the band and bridge are the fan chart's. */
  --rp-chart-market-up: var(--rp-chart-added);     /* market return, up */
  --rp-chart-market-down: #de8c80;                 /* market return, down. Bars only, never text */
  --rp-chart-in-ink: var(--rp-success);        /* "↑ In" label */
  --rp-chart-out-ink: var(--rp-primary-hover); /* "↓ Out" label */
  /* What moves it: bars for a step that helps / hurts the chance of lasting */
  --rp-chart-helps: var(--rp-chart-added);         /* green, as "Added" on Year by year */
  --rp-chart-hurts: var(--rp-chart-market-down);   /* soft red. Bars only, never text */
  --rp-chart-balance-fill: rgba(40, 99, 171, .10); /* balance strip area; its line is --rp-primary */
  --rp-chart-grid: #eef0f3;
  --rp-chart-axis: #b9c0ca;          /* axis lines only: 1.9:1, too faint for text */
  --rp-chart-label: var(--rp-muted); /* axis labels and notes on charts (5.8:1) */
  --rp-chart-bridge: rgba(40, 99, 171, .08);   /* bridge span on the charts: a light primary tint */
  --rp-chart-property: #7b5c3e;       /* home layer: top edge, hatch stripes, sale line */
  --rp-chart-property-fill: #f2efec;  /* home layer: tint under the stripes */
  --rp-chart-property-ink: #644628;   /* "+ $X home" and sale labels (8:1 on white) */
  --rp-chart-spark-band: #dbe4f0;   /* scenario-list sparkline: 10th–90th band */
  /* Stocks vs. bonds: one risk curve per market outlook */
  --rp-chart-outlook-conservative: var(--rp-caution-ink);
  --rp-chart-outlook-base: var(--rp-primary);
  --rp-chart-outlook-optimistic: var(--rp-success);
  --rp-chart-outlook-custom: var(--rp-ink);  /* not in the design: Custom's curve, when selected */
  --rp-chart-outlook-band: rgba(40, 99, 171, .08); /* shaded range, Conservative to Optimistic */
  --rp-bridge-fill: rgba(40, 99, 171, .12);    /* swatch on the bridge card */
  --rp-bridge-edge: rgba(40, 99, 171, .35);
  --rp-bridge-hatch: rgba(40, 99, 171, .045);
  --rp-cmp-1: #2863ab;  --rp-cmp-2: #94468f;  --rp-cmp-3: #5a493d;

  --rp-radius: 6px;         /* buttons, inputs */
  --rp-radius-card: 8px;
  --rp-shadow-card: 0 1px 2px rgba(20, 24, 31, .05);
  --rp-shadow-btn: 0 1px 1px rgba(20, 24, 31, .05);
  --rp-shadow-primary: 0 1px 2px rgba(20, 24, 31, .2), inset 0 1px 0 rgba(255, 255, 255, .15);
  --rp-shadow-pop: 0 8px 24px rgba(20, 24, 31, .12);
  --rp-focus: 0 0 0 3px rgba(40, 99, 171, .2);

  --rp-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --rp-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Bootstrap mapping. --bs-body-bg stays white: Bootstrap 5.3 also uses it for cards,
     inputs, dropdowns and modals. The page colour is set on body below. */
  --bs-body-bg: var(--rp-surface);
  --bs-body-color: var(--rp-ink);
  --bs-body-font-family: var(--rp-sans);
  --bs-body-font-size: 13px;
  --bs-font-monospace: var(--rp-mono);
  --bs-secondary-color: var(--rp-muted);
  --bs-tertiary-bg: var(--rp-surface-2);
  --bs-border-color: var(--rp-border);
  --bs-border-radius: var(--rp-radius);
  --bs-border-radius-lg: var(--rp-radius-card);
  --bs-primary: var(--rp-primary);
  --bs-primary-rgb: var(--rp-primary-rgb);
  --bs-link-color: var(--rp-primary);
  --bs-link-color-rgb: var(--rp-primary-rgb);
  --bs-link-hover-color: var(--rp-primary-hover);
  --bs-link-hover-color-rgb: 31, 85, 150;  /* --rp-primary-hover; Bootstrap 5.3's a:hover reads this one */
  --bs-success: var(--rp-success);
  --bs-danger: var(--rp-danger);
  --bs-focus-ring-color: rgba(var(--rp-primary-rgb), .2);
}
body { background: var(--rp-bg); -webkit-font-smoothing: antialiased; }
/* Checkboxes and radios: Bootstrap 5.3 compiles its own blue into these rather than reading
   --bs-primary, and its unchecked border (#dfe3e8) is near-invisible on white. Faint is 3:1. */
.form-check-input { border-color: var(--rp-faint); }
.form-check-input:checked { background-color: var(--rp-primary); border-color: var(--rp-primary); }
.form-check-input:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }

/* ── 2. App bar ─────────────────────────────────────────────── */
/* <nav class="navbar rp-appbar" data-bs-theme="dark"> */
.rp-appbar { background: var(--rp-appbar); height: 48px; padding: 0 24px; align-items: stretch; }
.rp-appbar .navbar-brand { display: flex; align-items: center; gap: 9px; margin: 0; padding: 0; font: 600 13.5px var(--rp-sans); color: #fff; } /* margin: the .nav gap spaces it */
.rp-appbar .nav { gap: 24px; height: 100%; }
.rp-appbar .nav-link { display: flex; align-items: center; height: 100%; padding: 0; font: 400 12.5px var(--rp-sans); color: var(--rp-on-dark-muted); }
.rp-appbar .nav-link:hover { color: #fff; }
.rp-appbar .nav-link.active { font-weight: 500; color: #fff; box-shadow: inset 0 -2px 0 var(--rp-appbar-accent); }
.rp-appbar .rp-user { display: flex; align-items: center; font: 400 12px var(--rp-mono); color: var(--rp-on-dark-muted); }
.rp-appbar .rp-icon-btn { width: 28px; height: 28px; border-radius: 6px; color: var(--rp-on-dark-muted); }
.rp-appbar .rp-icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* Early preview chip, every nav (22-T1) */
.rp-preview-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px;
  border: 1px solid var(--rp-on-dark-rule); border-radius: 5px;
  font: 400 12px var(--rp-mono); color: var(--rp-on-dark); white-space: nowrap; }
.rp-preview-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rp-appbar-accent); flex: none; }
.rp-preview-short { display: none; }
/* Phones: no chip. Even as "Preview" it squeezed the brand to "1…" (decisions.md 2026-10-12). */
@media (max-width: 575.98px) {
  .rp-preview-chip { display: none; }
}

/* ── 3. Page header ────────────────────────────────────────── */
.rp-breadcrumb { font: 400 11.5px var(--rp-mono); color: var(--rp-muted); margin-bottom: 6px; }
.rp-breadcrumb .current, .rp-breadcrumb [aria-current="page"] { color: var(--rp-ink); }
.rp-page-title { font: 600 24px/1.2 var(--rp-sans); letter-spacing: -.01em; color: var(--rp-ink); margin: 0; }
.rp-page-title.is-small { font-size: 20px; line-height: 1.25; } /* list, compare, empty state */

/* ── 4. Cards ──────────────────────────────────────────────── */
.card { --bs-card-border-color: var(--rp-border); --bs-card-border-radius: var(--rp-radius-card); --bs-card-spacer-y: 16px; --bs-card-spacer-x: 18px; box-shadow: var(--rp-shadow-card); }
.rp-card-title { font: 600 13px var(--rp-sans); color: var(--rp-ink); margin-bottom: 3px; }

/* Metric strip: ONE card, three cells. Not three cards. The third, money left, is wider
   (21-A2, 12 Oct 2026), so "Chance portfolio lasts to 95" stays on one line. */
.rp-metrics { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 2.2fr); background: var(--rp-surface); border: 1px solid var(--rp-border); border-radius: var(--rp-radius-card); box-shadow: var(--rp-shadow-card); }
/* Compact since 2026-10-10 (§4.1, 1b): about 25px shorter, so the charts start higher. */
.rp-metric { padding: 10px 18px; }
.rp-metric + .rp-metric { border-left: 1px solid var(--rp-rule-strip); }
.rp-metric-label { font: 500 11.5px var(--rp-sans); color: var(--rp-muted); margin-bottom: 5px; } /* sentence case */
.rp-metric-value { font: 500 24px/1 var(--rp-mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--rp-ink); }
.rp-metric-note { font: 400 11.5px var(--rp-sans); color: var(--rp-muted); margin-top: 5px; }
/* Money left: three figures, each with its caption, so all the captions line up. Only these
   are nowrap: 21-A2 made every label and caption nowrap, which overflowed the cells below
   about 1060px and on phones, so the other cells' text wraps where it doesn't fit. */
.rp-metric-cases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rp-metric-cases .rp-metric-value,
.rp-metric-cases .rp-metric-note { white-space: nowrap; }
.rp-metric-value.is-ran-out { color: var(--rp-danger); }
.rp-metric-bar { height: 6px; border-radius: 2px; background: #e3e7ec; margin-top: 12px; overflow: hidden; }
.rp-metric-bar > span { display: block; height: 100%; border-radius: 2px; background: currentColor; }
@media (max-width: 767.98px) {
  .rp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-metric:nth-child(3) { border-left: 0; }
  .rp-metric:nth-child(n+3) { border-top: 1px solid var(--rp-rule-strip); }
  .rp-metric-left { grid-column: span 2; }  /* on its own row, under chance and spend */
  /* Three "ran out"s at 24px overflow a 375px phone. On its own row, smaller figures
     can't misalign with the other cells' captions. */
  .rp-metric-cases { gap: 8px; }
  .rp-metric-cases .rp-metric-value { font-size: min(24px, 5.8vw); }
}

/* Inputs card (§4.1, README rule 15, since 2026-10-10): the first card in the slider rail,
   collapsed to the toggle and a one-line summary. Edit inputs sits top right. */
.rp-inputs { position: relative; padding: 14px 18px 12px; } /* relative: the More card is placed against it */
.rp-inputs-toggle { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; color: var(--rp-ink); cursor: pointer; }
.rp-inputs-title { display: flex; align-items: center; gap: 6px; min-height: 25px; font: 600 13px var(--rp-sans); } /* was the Edit inputs button's height; the pencil centres on it */
.rp-inputs-chevron { font: 400 10px var(--rp-mono); color: var(--rp-muted); transition: transform 150ms; }
.rp-inputs-toggle[aria-expanded="true"] .rp-inputs-chevron { transform: rotate(90deg); }
.rp-inputs-summary { display: flex; flex-direction: column; margin-top: 6px; padding-left: 16px; font: 400 11.5px/1.5 var(--rp-sans); color: var(--rp-muted); }
.rp-inputs-summary-line { font: 400 12px/1.5 var(--rp-mono); color: var(--rp-ink); }
.rp-inputs-toggle[aria-expanded="true"] .rp-inputs-summary { display: none; }
/* Edit inputs: a pencil since 2026-10-12 (21-A6), centred on the 25px title row, its glyph
   at the card's 18px padding. */
.rp-inputs > .rp-icon-link { position: absolute; top: 12px; right: 11px; }
/* Icon-only link (21-A6) */
.rp-icon-link { flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; color: var(--rp-muted); }
.rp-icon-link:hover { background: var(--rp-bg); color: var(--rp-ink); }
.rp-icon-link:focus-visible { outline: 2px solid var(--rp-primary); outline-offset: 1px; }
.rp-inputs-body { padding-top: 6px; }
.rp-inputs-note { margin: 0 0 8px; font: 400 11.5px/1.5 var(--rp-sans); color: var(--rp-muted); }
.rp-inputs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-top: 1px solid var(--rp-rule); font: 400 12px var(--rp-sans); color: var(--rp-muted); }
.rp-inputs-row .rp-v { font: 500 12.5px var(--rp-mono); color: var(--rp-ink); text-align: right; }
.rp-inputs-more-row { padding-top: 8px; border-top: 1px solid var(--rp-rule); }
.rp-inputs-more-wrap { display: inline-flex; } /* not positioned: the More card goes against the whole Inputs card */
.rp-inputs-more { border: 0; background: none; padding: 4px 6px; margin: 0 -6px; border-radius: 5px; font: 500 12px var(--rp-sans); color: var(--rp-primary); white-space: nowrap; cursor: pointer; }
.rp-inputs-more[aria-expanded="true"] { background: var(--rp-primary-tint); }
/* More card (§4.1, design 5a): under the Inputs card, right-aligned to it, so it spreads
   left over the charts. */
.rp-inputs-card {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 470px; max-width: calc(100vw - 32px); padding: 14px 16px 12px;
  background: var(--rp-surface); border: 1px solid var(--rp-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,24,31,.14);
}
.rp-inputs-card-title { font: 600 13px var(--rp-sans); color: var(--rp-ink); margin-bottom: 6px; }
.rp-inputs-card-row { display: grid; grid-template-columns: 24px 110px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--rp-rule); }
.rp-inputs-card-row .n { font: 500 10.5px var(--rp-mono); color: var(--rp-faint); }
.rp-inputs-card-row .k { font: 500 12px var(--rp-sans); color: var(--rp-ink-2); }
.rp-inputs-card-row .v { display: flex; flex-direction: column; font: 400 12px/1.5 var(--rp-mono); color: var(--rp-ink); }
.rp-inputs-card-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rp-rule); font-size: 11.5px; color: var(--rp-muted); }
.rp-inputs-card-foot a { font-weight: 500; color: var(--rp-primary); text-decoration: none; white-space: nowrap; }
@media (max-width: 767.98px) {
  /* The rail is full width here: the card takes the Inputs card's width. */
  .rp-inputs-card { left: 0; width: auto; max-width: none; }
}

/* First-visit tour (BUILD-SPEC §4.5, README rule 16). The ring is only a shadow: never add
   positioning, display or radius to the part, since some parts position their own children
   (the inputs strip's More card below 768px). The pin and card live in .rp-tour-layer. */
.is-touring { box-shadow: 0 0 0 2px var(--rp-appbar-accent), 0 0 0 6px rgba(103, 170, 237, .28); }
.rp-tour-layer { position: absolute; top: 0; left: 0; width: 0; height: 0; z-index: 30; } /* no positioned ancestor: page coordinates */
.rp-tour-pin {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--rp-appbar-accent); color: var(--rp-appbar);
  font: 600 11.5px/22px var(--rp-mono); text-align: center;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(20, 24, 31, .25);
}
.rp-tour-card {
  position: absolute; background: var(--rp-appbar); color: var(--rp-on-dark); border-radius: 8px;
  padding: 11px 13px; box-shadow: 0 8px 24px rgba(20, 24, 31, .25); font-size: 12.5px; line-height: 1.5;
}
.rp-tour-card::before { content: ""; position: absolute; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); }
.rp-tour-card[data-pointer="up"]::before { top: -5px; left: var(--rp-tour-pt, 40px); }
.rp-tour-card[data-pointer="right"]::before { top: var(--rp-tour-pt, 22px); right: -5px; }
.rp-tour-card[data-pointer="none"]::before { display: none; }
.rp-tour-num { flex: none; font: 600 11px var(--rp-mono); color: var(--rp-appbar-accent); }
.rp-tour-card strong { font-weight: 600; }
.rp-tour-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid #2a313c;
}
.rp-tour-count { font: 400 11px var(--rp-mono); color: var(--rp-on-dark-muted); }
.rp-tour-exit { font-size: 12px; color: var(--rp-on-dark-muted); background: none; border: 0; padding: 0; }
.rp-tour-back { font-size: 12px; font-weight: 500; color: var(--rp-on-dark); background: none; border: 1px solid var(--rp-on-dark-rule); border-radius: 5px; padding: 4px 10px; }
.rp-tour-next { font-size: 12px; font-weight: 500; color: var(--rp-appbar); background: #fff; border: 0; border-radius: 5px; padding: 5px 11px; }
/* The welcome card (§4.5, design 5a without its veil): a native <dialog>, opened with showModal().
   These reset the browser's own dialog styles. Fixed to the window, centred; tour.js sets its top
   to 24px below the sample strip. No veil: the backdrop is transparent. */
.rp-tour-welcome {
  position: fixed; top: var(--rp-tour-welcome-top, 96px); left: 0; right: 0; bottom: auto; margin: 0 auto;
  width: 420px; max-width: none; padding: 18px 20px 14px; border: 0; border-radius: 10px;
  background: var(--rp-appbar); color: var(--rp-on-dark); box-shadow: 0 16px 40px rgba(20, 24, 31, .3);
  font-size: 13px; line-height: 1.55;
}
.rp-tour-welcome::backdrop { background: transparent; }
.rp-tour-welcome .rp-tour-eyebrow { font: 500 11px var(--rp-mono); color: var(--rp-appbar-accent); }
.rp-tour-welcome h2 { font-size: 16px; font-weight: 600; line-height: 1.35; margin: 6px 0 8px; }
.rp-tour-welcome p { margin: 0 0 8px; color: #d5dae1; } /* body text on --rp-appbar, 11.9:1 */
.rp-tour-welcome p:last-of-type { margin-bottom: 0; }
.rp-tour-welcome .rp-tour-foot { margin-top: 14px; padding-top: 11px; }
@media (max-width: 991.98px) {
  /* tour.js moves the card into the flow after its part: below 992px the slider rail sits under the chart. */
  .rp-tour-card { position: static; width: auto !important; margin: 10px 16px; }
  .rp-tour-card::before { display: none; }
  .rp-tour-welcome { left: 16px; right: 16px; width: auto; }
}

/* Bridge callout: a white card, marked by a faint diagonal hatch and a swatch
   that matches the bridge shading on the Balance over time chart. */
.rp-bridge { display: grid; grid-template-columns: auto auto 1fr; gap: 28px; align-items: center; background-color: var(--rp-surface); background-image: repeating-linear-gradient(135deg, transparent 0 7px, var(--rp-bridge-hatch) 7px 8px); border: 1px solid var(--rp-border); border-radius: var(--rp-radius-card); box-shadow: var(--rp-shadow-card); padding: 16px 20px; }
.rp-bridge .rp-metric-label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rp-bridge .rp-bridge-swatch { width: 9px; height: 9px; border-radius: 2px; background: var(--rp-bridge-fill); box-shadow: inset 0 0 0 1px var(--rp-bridge-edge); }
.rp-bridge .rp-bridge-value { font: 500 22px/1 var(--rp-mono); color: var(--rp-ink); }
.rp-bridge .rp-bridge-sub { font: 400 11.5px var(--rp-mono); color: var(--rp-muted); margin-top: 5px; }
.rp-bridge p { font: 400 12px/1.55 var(--rp-sans); color: var(--rp-ink-2); margin: 0; }
@media (max-width: 767.98px) { .rp-bridge { grid-template-columns: 1fr 1fr; } .rp-bridge p { grid-column: 1 / -1; } }

/* ── 5. Segmented tabs (chart tabs) ────────────────────────── */
/* <ul class="nav rp-seg" role="tablist"> with .nav-link buttons */
.rp-seg { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: 7px; background: var(--rp-inset); margin: 12px 14px 0; } /* align-self: a Bootstrap .card is a flex column, which would stretch it */
.rp-seg .nav-link { font: 500 12px var(--rp-sans); padding: 6px 12px; border-radius: 5px; color: var(--rp-muted); border: 0; }
.rp-seg .nav-link:hover { color: var(--rp-ink); }
.rp-seg .nav-link.active { background: #fff; color: var(--rp-ink); box-shadow: 0 1px 2px rgba(20, 24, 31, .12); }
.rp-seg .nav-link:focus-visible { box-shadow: var(--rp-focus); }
/* Chart tabs in two groups (§4.1 Historical tab): "Simulated futures", a divider, then
   "Past markets" alone in a dashed segment, so the two kinds never read as one control. */
.rp-tab-groups { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.rp-tab-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rp-tab-group-label { font: 500 10.5px var(--rp-mono); color: var(--rp-muted); text-transform: uppercase; letter-spacing: .06em; padding-left: 2px; }
.rp-tab-divider { width: 1px; height: 28px; margin-bottom: 3px; background: var(--rp-border); }
.rp-seg.is-past { background: var(--rp-surface); border: 1px dashed var(--rp-seg-past-border); }
.rp-seg.is-past .nav-link.active { background: var(--rp-bg); box-shadow: inset 0 0 0 1px var(--rp-control); }

/* ── 6. Buttons ────────────────────────────────────────────── */
.btn { --bs-btn-font-family: var(--rp-sans); --bs-btn-font-size: 12.5px; --bs-btn-font-weight: 500; --bs-btn-padding-y: 7px; --bs-btn-padding-x: 13px; --bs-btn-border-radius: var(--rp-radius); --bs-btn-focus-box-shadow: var(--rp-focus); }
.btn-primary { --bs-btn-bg: var(--rp-primary); --bs-btn-border-color: var(--rp-primary); --bs-btn-hover-bg: var(--rp-primary-hover); --bs-btn-hover-border-color: var(--rp-primary-hover); --bs-btn-active-bg: var(--rp-primary-hover); --bs-btn-active-border-color: var(--rp-primary-hover); --bs-btn-disabled-bg: var(--rp-primary); --bs-btn-disabled-border-color: var(--rp-primary); box-shadow: var(--rp-shadow-primary); }
/* Secondary = white button. Use .btn-outline-secondary in templates. */
.btn-outline-secondary { --bs-btn-color: var(--rp-ink); --bs-btn-bg: #fff; --bs-btn-border-color: var(--rp-control); --bs-btn-hover-color: var(--rp-ink); --bs-btn-hover-bg: var(--rp-surface-2); --bs-btn-hover-border-color: #c3c9d2; --bs-btn-active-color: var(--rp-ink); --bs-btn-active-bg: var(--rp-inset); --bs-btn-active-border-color: #c3c9d2; box-shadow: var(--rp-shadow-btn); }
.btn-link { --bs-btn-color: var(--rp-muted); --bs-btn-hover-color: var(--rp-ink); text-decoration: none; }
/* Destructive confirm only (Delete scenario). White on --rp-danger is 5.1:1. */
.btn-danger { --bs-btn-bg: var(--rp-danger); --bs-btn-border-color: var(--rp-danger); --bs-btn-hover-bg: var(--rp-danger-hover); --bs-btn-hover-border-color: var(--rp-danger-hover); --bs-btn-active-bg: var(--rp-danger-hover); --bs-btn-active-border-color: var(--rp-danger-hover); box-shadow: var(--rp-shadow-primary); }
.rp-btn-add { border-style: dashed; box-shadow: none; color: var(--rp-ink-2); } /* "+ Add stream" */
.btn-sm { --bs-btn-font-size: 12px; --bs-btn-padding-y: 6px; --bs-btn-padding-x: 11px; }
.rp-btn-block { width: 100%; --bs-btn-padding-y: 9px; }

/* ── 7. Forms ──────────────────────────────────────────────── */
.form-label { font: 400 12px var(--rp-sans); color: var(--rp-ink-2); margin-bottom: 5px; }
.form-control, .form-select { font: 400 13px var(--rp-mono); padding: 8px 11px; border-color: var(--rp-control); border-radius: var(--rp-radius); color: var(--rp-ink); }
.form-control.is-text, .form-select.is-text { font-family: var(--rp-sans); } /* names, labels, word choices */
.form-select { padding-right: 32px; } /* room for Bootstrap's arrow, which the shared padding above removes */
.form-control:focus, .form-select:focus { border-color: var(--rp-primary); box-shadow: var(--rp-focus); }
.form-control::placeholder { color: var(--rp-faint); }
.form-text { font: 400 11.5px/1.45 var(--rp-sans); color: var(--rp-muted); margin-top: 5px; }
.form-control:disabled, .form-control[readonly] { background: var(--rp-surface-2); border-color: #e3e7ec; color: var(--rp-muted); }

/* Slider. Set --fill on the input from JS: el.style.setProperty('--fill', pct + '%') */
.form-range { height: 16px; }
.form-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--rp-primary) var(--fill, 50%), #e3e7ec var(--fill, 50%)); }
.form-range::-moz-range-track { height: 4px; border-radius: 2px; background: #e3e7ec; }
.form-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--rp-primary); }
.form-range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(20, 24, 31, .18), 0 1px 3px rgba(20, 24, 31, .25); }
.form-range::-moz-range-thumb { width: 16px; height: 16px; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(20, 24, 31, .18), 0 1px 3px rgba(20, 24, 31, .25); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--rp-primary), 0 0 0 4px rgba(var(--rp-primary-rgb), .2); }
.form-range:focus::-moz-range-thumb { box-shadow: 0 0 0 1px var(--rp-primary), 0 0 0 4px rgba(var(--rp-primary-rgb), .2); }
.rp-slider-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rp-slider-head label { font: 400 12px var(--rp-sans); color: var(--rp-ink-2); }
.rp-value-pill { font: 500 12px var(--rp-mono); color: var(--rp-ink); padding: 2px 7px; border-radius: 4px; background: var(--rp-inset); font-variant-numeric: tabular-nums; }

/* ── 8. Labels, chips, badges ──────────────────────────────── */
/* Table headers and group labels: mono, uppercase. Metric labels are NOT this (see .rp-metric-label). */
.rp-micro { font: 500 10.5px var(--rp-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--rp-muted); }
.rp-section-no { font: 500 10.5px var(--rp-mono); color: var(--rp-primary); background: var(--rp-primary-tint); padding: 2px 5px; border-radius: 4px; }
.rp-default-tag { font: 500 10px var(--rp-mono); color: var(--rp-muted); border: 1px solid var(--rp-control); padding: 1px 5px; border-radius: 3px; }
.badge.rp-baseline { font: 500 10px var(--rp-mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 20px; background: var(--rp-primary); color: #fff; }
.badge.rp-shared { font: 500 10px var(--rp-mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 20px; background: transparent; border: 1px solid var(--rp-control); color: var(--rp-muted); }
.rp-linked { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--rp-sans); color: var(--rp-primary); background: var(--rp-primary-tint); border: 1px solid #b9cdea; border-radius: 5px; padding: 5px 9px; }
.rp-linked::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Front page (§4.5): after a point whose feature isn't live yet. The notice tokens; no token of its own. */
.rp-soon { display: inline-block; margin-left: 8px; padding: 2px 6px; border-radius: 4px; font: 500 10.5px var(--rp-mono); color: var(--rp-caution-ink); background: var(--rp-notice-bg); border: 1px solid var(--rp-notice-border); vertical-align: 2px; }

/* ── 9. Numbers and status ─────────────────────────────────── */
.rp-num { font-family: var(--rp-mono); font-variant-numeric: tabular-nums; }
.rp-ok { color: var(--rp-success); }
.rp-warn { color: var(--rp-caution); }
.rp-bad { color: var(--rp-danger); }
/* Under the save buttons: "Matches saved scenario" or, with .is-dirty, "Unsaved exploration". */
.rp-dirty { text-align: center; font: 400 11.5px var(--rp-sans); color: var(--rp-muted); }
.rp-dirty.is-dirty { color: var(--rp-caution-ink); }

/* ── 10. Tables (list, year-by-year, compare, editor rows) ─── */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--rp-rule); font-size: 13px; margin: 0; }
.table > thead th { font: 500 10.5px var(--rp-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--rp-muted); background: var(--rp-surface-2); border-bottom-color: var(--rp-border); padding: 8px 10px; white-space: nowrap; }
.table td { padding: 7px 10px; vertical-align: middle; }
.table td.rp-num, .table th.rp-num { text-align: right; }

/* ── 11. Menus and popovers ────────────────────────────────── */
.dropdown-menu { --bs-dropdown-border-color: var(--rp-border); --bs-dropdown-border-radius: var(--rp-radius-card); --bs-dropdown-box-shadow: var(--rp-shadow-pop); --bs-dropdown-padding-x: 6px; --bs-dropdown-padding-y: 6px; --bs-dropdown-link-hover-bg: var(--rp-surface-2); --bs-dropdown-link-active-bg: var(--rp-primary-tint); --bs-dropdown-link-active-color: var(--rp-ink); box-shadow: var(--bs-dropdown-box-shadow); }
.dropdown-item { border-radius: 6px; padding: 8px 10px; }

/* What moves it (§4.1, 26-what-moves-it.png): HTML rows, not SVG. Bar widths are set
   inline as a percentage of the half (largest move = 55%). */
.rp-sens-head { font: 600 15px/1.4 var(--rp-sans); color: var(--rp-ink); text-wrap: pretty; margin: 0; }
.rp-sens-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1fr); align-items: center; min-height: 42px; border-top: 1px solid var(--rp-rule); }
.rp-sens-name { font: 600 12.5px var(--rp-sans); color: var(--rp-ink); }
.rp-sens-step { font: 400 11px var(--rp-mono); color: var(--rp-muted); }
.rp-sens-side { display: flex; align-items: center; gap: 6px; align-self: stretch; }
.rp-sens-side.is-hurts { justify-content: flex-end; --c: var(--rp-chart-hurts); }
.rp-sens-side.is-helps { border-left: 1px solid var(--rp-faint); --c: var(--rp-chart-helps); }
.rp-sens-bar { height: 16px; background: var(--c); }
.is-hurts .rp-sens-bar { border-radius: 2px 0 0 2px; }
.is-helps .rp-sens-bar { border-radius: 0 2px 2px 0; }
.rp-sens-row.is-outside .rp-sens-bar { background: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--c); }
.rp-sens-delta { font: 500 12px var(--rp-mono); font-variant-numeric: tabular-nums; }
.is-hurts .rp-sens-delta { color: var(--rp-danger); }
.is-helps .rp-sens-delta { color: var(--rp-chart-in-ink); }
.rp-sens-dir { font: 400 11px var(--rp-sans); color: var(--rp-muted); white-space: nowrap; }
.rp-sens.is-stale .rp-sens-row { opacity: .5; }
@media (max-width: 600px) {
  .rp-sens-row { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); }
  .rp-sens-dir { white-space: normal; }
}

/* Scenario list sparkline (§4.3, design 1a in Scenario List Explorations) */
.rp-spark { display: flex; align-items: center; gap: 10px; }
.rp-spark svg { display: block; flex: none; width: 200px; height: 40px; overflow: visible; }
.rp-spark-base { stroke: var(--rp-chart-axis); stroke-width: 1; }
.rp-spark-retire { stroke: var(--rp-border); stroke-width: 1; stroke-dasharray: 2 2; }
.rp-spark-band { fill: var(--rp-chart-spark-band); }
.rp-spark-median { fill: none; stroke: var(--rp-primary); stroke-width: 1.75; stroke-linejoin: round; }
.rp-spark-dot { fill: var(--rp-chart-unfunded); }
.rp-spark-note { font: 400 11px/1.3 var(--rp-mono); color: var(--rp-chart-label); white-space: pre-line; }
.rp-spark-note.is-out { color: var(--rp-danger); }
.rp-spark-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 12px; color: var(--rp-muted); margin-top: 12px; }
.rp-spark-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rp-spark-key-line { width: 16px; height: 2px; background: var(--rp-primary); }
.rp-spark-key-band { width: 16px; height: 10px; background: var(--rp-chart-spark-band); }
.rp-spark-key-tick { width: 0; height: 12px; border-left: 1px dashed var(--rp-chart-axis); }

/* Ask card (BUILD-SPEC §11, change list 15-C1). Every answer is text; figures in mono. */
.rp-ask { padding: 14px 18px 16px; }
.rp-ask.is-compact { padding: 10px 12px 10px 18px; }
.rp-ask.is-compact .rp-ask-more { display: none; }
.rp-ask-title { font: 600 13px/1.4 var(--rp-sans); color: var(--rp-ink); margin: 0 4px 0 0; }
.rp-ask-line { font-size: 12px; color: var(--rp-muted); margin: 8px 0 0; }
.rp-ask-input { display: flex; align-items: center; gap: 8px; }
.rp-ask-field { position: relative; flex: 1; min-width: 0; }
.rp-ask-field .form-control { width: 100%; padding-right: 34px; }
.rp-ask-clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--rp-muted); font-size: 17px; line-height: 24px; padding: 0; text-align: center; cursor: pointer; }
.rp-ask-clear:hover { background: var(--rp-bg); color: var(--rp-ink); }
.rp-ask-field .form-control::placeholder { color: var(--rp-muted); }
.rp-ask-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rp-ask-example { font: 400 11.5px/1.4 var(--rp-sans); color: var(--rp-ink); background: var(--rp-bg); border: 1px solid var(--rp-border); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.rp-ask-example:hover { border-color: var(--rp-control); background: var(--rp-surface); }
.rp-ask-answer-area { border-top: 1px solid var(--rp-rule); margin-top: 14px; padding-top: 12px; }
.rp-ask-wait, .rp-ask-ran { font-size: 11.5px; line-height: 1.5; color: var(--rp-muted); margin: 0 0 6px; }
.rp-ask-answer { font-size: 14px; line-height: 1.6; color: var(--rp-ink); margin: 0; }
.rp-ask-figure { font-family: var(--rp-mono); font-weight: 500; }
.rp-ask-follow { font-size: 12.5px; color: var(--rp-muted); margin: 8px 0 0; }
.rp-ask-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.rp-ask-hint { font-size: 11.5px; color: var(--rp-muted); margin: 0; }
.rp-ask-link { font: 500 12px/1.4 var(--rp-sans); color: var(--rp-primary); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.rp-ask-link:hover { color: var(--rp-primary-hover); text-decoration: underline; }
.rp-ask-dismiss { margin-left: auto; color: var(--rp-muted); }
.rp-ask-privacy { font-size: 11px; color: var(--rp-muted); margin: 12px 0 0; }
.rp-also { border-top: 1px solid var(--rp-rule); margin-top: 14px; padding-top: 10px; }
.rp-also-title { font-size: 11.5px; color: var(--rp-muted); margin: 0 0 6px; }
.rp-also-rows { margin: 0; }
.rp-also-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.rp-also-row dt { font: 400 12px/1.5 var(--rp-sans); color: var(--rp-ink); }
.rp-also-row dd { font: 500 12px/1.5 var(--rp-mono); color: var(--rp-ink); margin: 0; text-align: right; }
.rp-also-row dd.is-proposed { color: var(--rp-primary); }
/* Ask's rings on the sliders (15-C1): centred on where the thumb would be, over the track. */
/* The input is a block so the wrapper is exactly its height and the ring's 50% is the track's
   centre; inline, it sat on a text line 5px taller. The margin keeps that 5px in the rail. */
.rp-range { position: relative; margin-bottom: 5px; }
.rp-range .form-range { display: block; }
.rp-ask-ring { position: absolute; top: 50%; left: calc(8px + (100% - 16px) * var(--ring-at, 0)); width: 20px; height: 20px; border: 2px solid var(--rp-primary); border-radius: 50%; background: var(--rp-surface); pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(.4); transition: opacity .3s, transform .3s; }
.rp-ask-ring.is-shown { opacity: 1; transform: translate(-50%, -50%) scale(1); }
/* Below 992px the rail is under the charts: the card lists the values itself (§11 "Narrow"). */
.rp-ask-changes { margin: 10px 0 0; padding: 8px 10px; background: var(--rp-bg); border-radius: 6px; }
.rp-ask-changes .rp-also-row dd { color: var(--rp-primary); }
.rp-ask-hint.is-narrow { display: none; }
@media (min-width: 992px) { .rp-ask-changes { display: none; } }
@media (max-width: 991.98px) { .rp-ask-hint.is-wide { display: none; } .rp-ask-hint.is-narrow { display: block; } }
@media (prefers-reduced-motion: reduce) { .rp-ask-ring { transition: none; } }
/* §11 "Options" (40-ask-range-options.png): rows that apply on click. */
.rp-ask-options { display: flex; flex-direction: column; border: 1px solid var(--rp-border); border-radius: 7px; overflow: hidden; margin-top: 12px; }
.rp-ask-options-head { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: var(--rp-surface-2); font-size: 11.5px; color: var(--rp-muted); }
.rp-ask-options-head span:first-child { flex: 1; }
.rp-ask-options-now { font-family: var(--rp-mono); }
.rp-ask-option { display: grid; grid-template-columns: minmax(0, 1fr) 48px 72px; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-top: 1px solid var(--rp-rule-strip); background: var(--rp-surface); text-align: left; font: inherit; cursor: pointer; transition: background-color .2s; }
.rp-ask-option:hover:not(:disabled) { background: rgba(var(--rp-primary-rgb), .05); }
.rp-ask-option[aria-pressed="true"] { background: var(--rp-primary-tint); }
.rp-ask-option:disabled { cursor: default; }
.rp-ask-option-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rp-ask-option-label { font: 500 12.5px/1.3 var(--rp-sans); color: var(--rp-ink); }
.rp-ask-option-note { font: 400 11.5px/1.3 var(--rp-sans); color: var(--rp-muted); }
.rp-ask-option-tag { align-self: flex-start; font: 500 11px/1.4 var(--rp-sans); color: var(--rp-ink-2); background: var(--rp-inset); border-radius: 20px; padding: 1px 8px; }
.rp-ask-option-chance { font: 500 15px/1 var(--rp-mono); color: var(--rp-ink); text-align: right; }
.rp-ask-option-act { font: 500 12px/1 var(--rp-sans); color: var(--rp-primary); text-align: right; }
.rp-ask-option[aria-pressed="true"] .rp-ask-option-act { color: var(--rp-ink); }
.rp-ask-option:disabled .rp-ask-option-act { color: var(--rp-faint); }
@media (max-width: 991.98px) { .rp-ask-option { grid-template-columns: minmax(0, 1fr) 40px 62px; } }
@media (prefers-reduced-motion: reduce) { .rp-ask-option { transition: none; } }
