/* =====================================================================
   Business Apostle - Investment Calculator
   styles.css : tokens, layout, components, charts, print.

   Mobile-first. No framework, no external font, no gradient, no shadow
   beyond a hairline lift. The palette is shared with Business Apostle
   Wealth Score and Money Diagnostics so the tools read as one family.
   ===================================================================== */

:root {
  color-scheme: light;

  --ink: #16202c;
  --ink-soft: #4a5563;
  --ink-faint: #6b7685;
  --navy: #0f2a43;
  --navy-dark: #0a1e30;
  --green: #1a6f47;
  --green-dark: #145637;
  --green-tint: #e7f2ec;
  --gold: #a8842b;
  --amber: #96580a;
  --amber-tint: #fdf1de;
  --red: #a92318;
  --red-tint: #fbe9e7;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-alt: #f1f0ec;
  --border: #d5d8dd;
  --border-strong: #9aa2ad;
  --focus: #0b57d0;

  --chart-1: #0f2a43;
  --chart-2: #1a6f47;
  --chart-3: #96580a;
  --chart-4: #6b4fa1;
  --chart-5: #2f7d95;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(16, 32, 44, 0.06);
  --shadow: 0 2px 8px rgba(16, 32, 44, 0.08);

  --measure: 68ch;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 { line-height: 1.25; color: var(--navy); margin: 0 0 var(--space-3); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.92rem; }
p { margin: 0 0 var(--space-4); max-width: var(--measure); }
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; max-width: var(--measure); }
li { margin-bottom: var(--space-2); }
strong { font-weight: 650; }
a { color: var(--focus); }
textarea { font-family: var(--font); font-size: 1rem; width: 100%; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -60px;
  z-index: 50;
  background: var(--navy);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top 120ms ease-in;
}
.skip-link:focus { top: 0; }

.optional { font-weight: 400; color: var(--ink-faint); }

/* ------------------------------ header ------------------------------ */

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  /* The step chips scroll horizontally inside their own container. Clipping on
     this axis stops a sticky ancestor from leaking that scrollable width into
     the document, which would let the whole page slide sideways on a phone. */
  overflow-x: clip;
  max-width: 100vw;
}
.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  flex-wrap: wrap;
}
.app-header__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--space-3); margin: 0; max-width: none; }
/* Placeholder tile, not the Business Apostle mark. It is the same neutral file
   as the app icon, so there is exactly one artefact to replace with the
   official Ascent Emblem: see assets/BRAND-ASSETS-README.txt. */
.brand__mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  flex: 0 0 auto;
  display: block;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: 0.74rem; color: var(--ink-soft); letter-spacing: 0.14em; text-transform: uppercase; }
.brand__product { font-size: 1rem; font-weight: 650; color: var(--navy); }

/* ----------------------------- progress ----------------------------- */

.progress { padding: 0 var(--space-4) var(--space-3); max-width: 1180px; margin: 0 auto; }
.progress__label { margin: 0 0 var(--space-2); font-size: 0.84rem; color: var(--ink-soft); font-weight: 600; }
.progress__track { height: 6px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--green); border-radius: 999px; transition: width 200ms ease-out; }

.steps { margin-top: var(--space-3); overflow-x: clip; max-width: 100%; }
.steps__list {
  display: flex;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-1);
  overflow-x: auto;
  max-width: none;
  scrollbar-width: thin;
}
.steps__item { margin: 0; flex: 0 0 auto; }
.steps__button {
  font: inherit;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  white-space: nowrap;
}
.steps__button[aria-current="step"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 650; }
.steps__button[disabled] { opacity: 0.45; cursor: not-allowed; }
.steps__button .steps__tick { color: var(--green-dark); font-weight: 700; }
.steps__button[aria-current="step"] .steps__tick { color: #bfe6d2; }

/* ------------------------------ layout ------------------------------ */

main { display: block; }
.view {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
}
.lede { font-size: 1.12rem; color: var(--ink-soft); font-family: var(--font-serif); }
.view-intro { color: var(--ink-soft); }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

.card-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; margin-bottom: var(--space-5); }

.button-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }

/* ------------------------------ buttons ----------------------------- */

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 11px 18px;
  min-height: var(--tap);
  min-width: var(--tap);
  cursor: pointer;
  background: var(--surface);
  color: var(--navy);
  line-height: 1.2;
}
.btn--primary { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn--primary:hover { background: var(--green); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--navy); }
.btn--secondary:hover { background: var(--surface-alt); }
.btn--quiet { background: transparent; border-color: var(--border); color: var(--ink-soft); }
.btn--quiet:hover { background: var(--surface-alt); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--large { font-size: 1.05rem; padding: 14px 24px; }
.btn--small { padding: 7px 12px; min-height: 36px; font-size: 0.86rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------- forms ------------------------------ */

form { max-width: none; }
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin: 0 0 var(--space-5);
  min-width: 0;
}
legend { font-weight: 650; color: var(--navy); padding: 0 var(--space-2); }

.field { margin-bottom: var(--space-4); min-width: 0; }
.field > label, .field > .field__label { display: block; font-weight: 600; margin-bottom: var(--space-2); }
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 11px var(--space-3);
  min-height: var(--tap);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: var(--red);
  border-width: 2px;
}
.hint { font-size: 0.88rem; color: var(--ink-soft); margin: var(--space-2) 0 0; }
.field-error { font-size: 0.88rem; color: var(--red); font-weight: 600; margin: var(--space-2) 0 0; }
.field-warning { font-size: 0.88rem; color: var(--amber); margin: var(--space-2) 0 0; }

.field--switch { margin-bottom: var(--space-3); }
.switch { display: flex; align-items: flex-start; gap: var(--space-3); font-weight: 500; min-height: var(--tap); padding: 6px 0; }
.switch input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; }

.choice-row { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.choice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 4px 0;
  font-weight: 500;
}
.choice input { width: 20px; height: 20px; flex: 0 0 auto; }
.choice-stack { display: flex; flex-direction: column; gap: var(--space-1); }

.choice-cards { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
.choice-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--surface);
  display: block;
  cursor: pointer;
}
.choice-card:has(input:checked) { border-color: var(--green-dark); border-width: 2px; background: var(--green-tint); }
.choice-card__head { display: flex; align-items: center; gap: var(--space-3); font-weight: 650; color: var(--navy); }
.choice-card__head input { width: 20px; height: 20px; flex: 0 0 auto; }
.choice-card__question { font-family: var(--font-serif); font-style: italic; color: var(--navy); margin: var(--space-2) 0; }
.choice-card__body { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* --------------------------- callouts ------------------------------- */

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-4);
  margin: 0 0 var(--space-5);
}
.callout h2, .callout h3 { font-size: 1rem; margin-bottom: var(--space-2); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout--privacy { border-left-color: var(--green-dark); background: var(--green-tint); }
.callout--disclaimer { border-left-color: var(--amber); background: var(--amber-tint); }
.callout--limits { border-left-color: var(--navy); }
.callout--info { border-left-color: var(--chart-5); }
.callout--projection { border-left-color: var(--amber); background: var(--amber-tint); }
.callout--attention { border-left-color: var(--red); background: var(--red-tint); }
.callout--note { border-left-color: var(--amber); }

.badge-row { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0 0 var(--space-5); max-width: none; }
.badge { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 0.84rem; color: var(--ink-soft); }

.how-list li { margin-bottom: var(--space-3); }

/* ------------------------- error summaries -------------------------- */

.error-summary {
  border: 2px solid var(--red);
  background: var(--red-tint);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.error-summary h3 { color: var(--red); font-size: 1rem; }
.error-summary ul { margin-bottom: 0; }
.error-summary a { color: var(--red); font-weight: 600; }
.warning-summary {
  border: 1px solid var(--amber);
  background: var(--amber-tint);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.warning-summary h3 { color: var(--amber); font-size: 1rem; }
.warning-summary ul { margin-bottom: 0; }

/* --------------------------- opportunity ---------------------------- */

.opp-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.opp-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}
.opp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 650;
  color: var(--navy);
}
.opp-chip__swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--series-colour, var(--navy)); flex: 0 0 auto; }
.opp-chip__pattern { font-size: 0.78rem; color: var(--ink-soft); font-weight: 400; }

.template-prompts { font-size: 0.9rem; color: var(--ink-soft); }

details.group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  background: var(--surface);
}
details.group > summary,
.chart__data > summary,
details.group > div summary {
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-weight: 650;
  color: var(--navy);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
}
/* display:flex removes the native marker, so the disclosure arrow is drawn
   here instead. It rotates on open and is hidden from assistive technology,
   which already announces the expanded state. */
details.group > summary::-webkit-details-marker,
.chart__data > summary::-webkit-details-marker { display: none; }
details.group > summary::before,
.chart__data > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0; height: 0;
  border-left: 7px solid var(--green-dark);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 120ms ease-out;
}
details[open].group > summary::before,
details[open].chart__data > summary::before { transform: rotate(90deg); }
details.group > div { padding: 0 var(--space-4) var(--space-4); }
details.group[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); }

.row-list { list-style: none; padding: 0; margin: 0 0 var(--space-3); max-width: none; }
.row-list > li { margin: 0 0 var(--space-3); }
.row-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; align-items: end; }

/* ----------------------------- results ------------------------------ */

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--series-colour, var(--navy));
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.result-card__title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.metric-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; margin-bottom: var(--space-3); }
.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--surface-alt);
}
.metric__label { font-size: 0.8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 var(--space-1); font-weight: 650; }
.metric__value { font-size: 1.18rem; font-weight: 700; color: var(--navy); margin: 0; font-variant-numeric: tabular-nums; }
.metric__value--negative { color: var(--red); }
.metric__note { font-size: 0.82rem; color: var(--ink-soft); margin: var(--space-1) 0 0; }

.lens {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.lens__head { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; align-items: baseline; }
.lens__question { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); margin: var(--space-1) 0 var(--space-3); }
.lens__statement { font-weight: 600; color: var(--navy); }
.lens__rows { list-style: none; padding: 0; margin: 0; max-width: none; }
.lens__row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--border); margin: 0; flex-wrap: wrap; }
.lens__name { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.lens__value { font-variant-numeric: tabular-nums; }
.lens__leads { font-size: 0.78rem; background: var(--green-tint); color: var(--green-dark); border-radius: 999px; padding: 2px 8px; font-weight: 650; }

.reading { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 0.86rem; }
.reading__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.reading--good .reading__dot { background: var(--green-dark); }
.reading--ok .reading__dot { background: var(--chart-5); }
.reading--watch .reading__dot { background: var(--amber); }
.reading--attention .reading__dot { background: var(--red); }
.reading--unknown .reading__dot { background: var(--border-strong); }

.flag {
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.flag--attention { border-left-color: var(--red); }
.flag__level { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--amber); }
.flag--attention .flag__level { color: var(--red); }
.flag__title { font-size: 1rem; margin: var(--space-1) 0 var(--space-2); }
.flag__settle { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* ------------------------------ charts ------------------------------ */

.chart {
  margin: 0 0 var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.chart__caption { margin-bottom: var(--space-3); }
.chart__title { margin: 0 0 var(--space-2); font-size: 1rem; }
.chart__description { font-size: 0.9rem; color: var(--ink-soft); margin: 0; }
.chart__canvas { width: 100%; overflow-x: auto; }
.chart__svg { width: 100%; height: auto; min-width: 320px; display: block; }
.chart__footnote { font-size: 0.84rem; color: var(--ink-soft); margin: var(--space-3) 0 0; }
.chart__empty { font-size: 0.92rem; color: var(--ink-soft); background: var(--surface-alt); border-radius: var(--radius); padding: var(--space-4); margin: 0; }
.chart__data { margin-top: var(--space-3); }
.chart__data > summary { font-weight: 600; padding-left: 0; }

.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__grid--zero { stroke: var(--border-strong); stroke-width: 1.5; }
.chart__tick { font-size: 11px; fill: var(--ink-soft); font-family: var(--font); }
.chart__axis-label { font-size: 11px; fill: var(--ink-soft); font-family: var(--font); }
.chart__group-label { font-size: 11px; fill: var(--ink); font-family: var(--font); font-weight: 600; }
.chart__group-note { font-size: 10px; fill: var(--ink-soft); font-family: var(--font); }
.chart__missing { font-size: 14px; fill: var(--ink-soft); }
.chart__line { fill: none; stroke: var(--series-colour, var(--navy)); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--reference { stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart__point { fill: var(--series-colour, var(--navy)); stroke: var(--surface); stroke-width: 1.5; cursor: help; }
.chart__point:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chart__bar:focus-visible { outline: 3px solid var(--focus); }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: 0; margin: 0 0 var(--space-3); max-width: none; }
.legend__item { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: 0.86rem; }
.legend__swatch { width: 22px; height: 12px; background: var(--series-colour, var(--navy)); border-radius: 2px; flex: 0 0 auto; position: relative; }
.legend__swatch--dashed, .legend__swatch--dotted, .legend__swatch--dash-dot, .legend__swatch--long-dash { background: none; border-top: 3px solid var(--series-colour, var(--navy)); height: 3px; }
.legend__swatch--dashed { border-top-style: dashed; }
.legend__swatch--dotted { border-top-style: dotted; }
.legend__swatch--dash-dot { border-top-style: dashed; }
.legend__swatch--long-dash { border-top-style: dashed; }
.legend__swatch--diagonal::after { content: ""; position: absolute; inset: 0; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.75) 0 2px, transparent 2px 5px); }
.legend__swatch--dots::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,0.85) 1px, transparent 1.2px); background-size: 5px 5px; }
.legend__pattern { color: var(--ink-soft); }

/* ------------------------------ tables ------------------------------ */

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-scroll:focus-visible { outline: 3px solid var(--focus); }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.data-table caption { text-align: left; padding: var(--space-3); font-weight: 650; color: var(--navy); }
.data-table th, .data-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table thead th { background: var(--surface-alt); white-space: nowrap; }
.data-table td { font-variant-numeric: tabular-nums; }
.scroll-cue { font-size: 0.84rem; color: var(--ink-soft); margin: var(--space-2) 0 0; }

/* --------------------------- scenario lab --------------------------- */

.lab-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); padding: 0; list-style: none; max-width: none; }
.lab-tabs li { margin: 0; }
.lab-tab {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface-alt);
  color: var(--ink-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 16px;
  min-height: var(--tap);
  cursor: pointer;
}
.lab-tab[aria-selected="true"] { background: var(--surface); color: var(--navy); border-color: var(--border); box-shadow: inset 0 3px 0 var(--green-dark); }

.slider-field { margin-bottom: var(--space-4); }
.slider-field__label { display: block; font-weight: 600; margin-bottom: var(--space-2); }
.slider-field__row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.slider-field__row input[type="range"] { flex: 1 1 180px; min-width: 140px; height: var(--tap); accent-color: var(--green-dark); }
.slider-field__row input[type="text"] { flex: 0 0 120px; width: 120px; min-height: var(--tap); font: inherit; padding: 10px var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.slider-field__unit { font-weight: 600; color: var(--ink-soft); }
.slider-field__bounds { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-soft); margin: var(--space-1) 0 0; max-width: none; }

/* ---------------------------- action plan --------------------------- */

.action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.action--before { border-left-color: var(--red); }
.action--soon { border-left-color: var(--amber); }
.action--later { border-left-color: var(--chart-5); }
.action--done { opacity: 0.72; background: var(--surface-alt); }
.action__urgency { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--ink-soft); }
.action__title { font-size: 1rem; margin: var(--space-1) 0 var(--space-2); }
.action__why { font-size: 0.92rem; color: var(--ink-soft); }
.action__how { font-size: 0.92rem; }
.action__check { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; min-height: var(--tap); }
.action__check input { width: 22px; height: 22px; }

/* ------------------------------ exports ----------------------------- */

.export-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.export-card h3 { margin-bottom: var(--space-2); }
.export-card__privacy { font-size: 0.88rem; background: var(--surface-alt); border-radius: var(--radius-sm); padding: var(--space-3); }
.card-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
#result-card { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); display: block; margin-bottom: var(--space-4); }
.card-options { margin-bottom: var(--space-4); }

/* ------------------------------ stepnav ----------------------------- */

.stepnav {
  position: sticky;
  overflow-x: clip;
  max-width: 100vw;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 15;
}
.stepnav__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.stepnav__status { font-size: 0.84rem; color: var(--ink-soft); margin: 0; text-align: center; flex: 1 1 auto; }

/* ------------------------------ footer ------------------------------ */

.app-footer {
  background: var(--navy);
  color: #dfe6ee;
  padding: var(--space-5) var(--space-4);
}
.app-footer p { max-width: 80ch; margin: 0 auto var(--space-3); font-size: 0.88rem; }
.app-footer__meta { color: #9fb2c6; }

/* ------------------------------ dialogs ----------------------------- */

.dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 640px;
  width: calc(100% - 32px);
  color: var(--ink);
  background: var(--surface);
}
.dialog::backdrop { background: rgba(10, 30, 48, 0.55); }
.glossary dt { font-weight: 650; color: var(--navy); margin-top: var(--space-3); }
.glossary dd { margin: var(--space-1) 0 0; color: var(--ink-soft); }

.report-container { display: none; }

/* ------------------------------ helpers ----------------------------- */

.muted { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--space-4); }
.unavailable { color: var(--ink-soft); font-style: normal; }
.unavailable__reason { font-size: 0.84rem; color: var(--ink-soft); margin: var(--space-1) 0 0; }

/* ============================ breakpoints =========================== */

@media (min-width: 600px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.8rem; }
}

@media (min-width: 860px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .view { padding: var(--space-6) var(--space-5) var(--space-7); }
}

@media (min-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h1 { font-size: 2rem; }
}

/* ------------------------ motion and contrast ----------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .btn--primary, .btn--danger { background: ButtonFace; color: ButtonText; }
  .progress__bar, .reading__dot { forced-color-adjust: none; background: Highlight; }
  .chart__line, .chart__point { forced-color-adjust: none; }
  .choice-card:has(input:checked) { border: 3px solid Highlight; }
  .steps__button[aria-current="step"] { border: 3px solid Highlight; }
  .legend__swatch { forced-color-adjust: none; }
}

/* ------------------------------- print ------------------------------ */

@media print {
  :root { --bg: #ffffff; }
  body { background: #fff; font-size: 10.5pt; }
  .app-header, .stepnav, .app-footer, main, .skip-link, dialog { display: none !important; }
  .report-container { display: block !important; }

  .report { color: #000; }
  .report__header { border-bottom: 2pt solid #0f2a43; padding-bottom: 8pt; margin-bottom: 14pt; }
  .report__brand { font-size: 9pt; letter-spacing: 0.18em; text-transform: uppercase; color: #0f2a43; margin: 0 0 4pt; }
  .report__meta { font-size: 9pt; color: #333; }
  .report__disclaimer { font-size: 8.5pt; border: 0.5pt solid #999; padding: 6pt; background: #f6f5f2; }
  .report__section { margin-bottom: 14pt; page-break-inside: avoid; }
  .report__section h3 { font-size: 12pt; border-bottom: 0.5pt solid #999; padding-bottom: 3pt; }
  .report__muted { font-size: 8.5pt; color: #444; }
  .report__list { font-size: 9pt; }
  .report__glossary { font-size: 9pt; }
  .report__glossary dt { font-weight: 700; margin-top: 6pt; }
  .report__footer { border-top: 0.5pt solid #999; padding-top: 8pt; font-size: 8.5pt; color: #333; }
  .report .data-table { font-size: 8.5pt; width: 100%; page-break-inside: auto; }
  .report .data-table th, .report .data-table td { border-bottom: 0.5pt solid #bbb; padding: 3pt 4pt; }
  .report .table-scroll { overflow: visible; border: 0; }
  .report .chart { border: 0.5pt solid #bbb; padding: 6pt; page-break-inside: avoid; }
  .report .chart__data { display: block; }
  .report .chart__data > summary { display: none; }
  .report details { display: block; }
  .report details > summary { display: none; }
  .report .legend { font-size: 8pt; }
  a[href]::after { content: ""; }
  @page { margin: 14mm; }
}
