/* ============================================================
   Buy or Rent? — Stylesheet
   Aesthetic: modern fintech / clean financial product
   Typography: Inter (body/UI) · Instrument Serif (display)
              · JetBrains Mono (numbers)
   ============================================================ */

/* ─── Tokens ─── */
:root {
  /* Palette — modern neutral */
  --bg:              #ffffff;
  --bg-alt:          #f1f5f9;
  --surface:         #ffffff;
  --surface-sunk:    #f8fafc;
  --ink:             #0f172a;
  --ink-2:           #1e293b;
  --ink-3:           #64748b;
  --rule:            #cbd5e1;
  --rule-strong:     #94a3b8;

  /* Brand & semantic */
  --navy:            #4f46e5;
  --navy-ink:        #4338ca;
  --sage:            #15803d;    /* buy */
  --sage-bg:         #dcfce7;
  --sage-bg-strong:  #bbf7d0;
  --slate:           #4f46e5;    /* rent */
  --slate-bg:        #eef2ff;
  --slate-bg-strong: #b8c4d4;
  --rust:            #a16207;
  --rust-bg:         #fef9e7;

  /* Spacing scale */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;

  /* Type */
  --serif:  "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radius — modern fintech */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Elevation — soft layered shadows */
  --shadow-sm: 0 1px 2px rgba(10,10,10,.04), 0 1px 1px rgba(10,10,10,.03);
  --shadow-md: 0 4px 8px rgba(10,10,10,.04), 0 2px 4px rgba(10,10,10,.04);
  --shadow-lg: 0 12px 24px rgba(10,10,10,.06), 0 4px 8px rgba(10,10,10,.04);

  /* Modern v2 aliases — for shared widgets (feedback/share) */
  --bg-soft:        var(--surface-sunk);
  --bg-elevated:    var(--surface);
  --bg-sunken:      var(--bg-alt);
  --muted:          var(--ink-3);
  --accent:         var(--navy);
  --accent-soft:    #eef2ff;
  --good:           var(--sage);
  --bad:            #b91c1c;

  /* Layout */
  --container-w: 1200px;
  --gutter: 24px;

  color-scheme: light;
}

/* ─── Dark theme — synced with diytools design system v1 ─── */
/* Trigger A: explicit user override via [data-theme="dark"] on <html>. */
:root[data-theme="dark"] {
  --bg:              #0f172a;
  --bg-alt:          #0f172a;
  --surface:         #1e293b;
  --surface-sunk:    #0f172a;
  --ink:             #f8fafc;
  --ink-2:           #e2e8f0;
  --ink-3:           #94a3b8;
  --rule:            #1e293b;
  --rule-strong:     #334155;
  --navy:            #6366f1;
  --navy-ink:        #a5b4fc;
  --sage:            #a8c99a;
  --sage-bg:         #2a3a26;
  --sage-bg-strong:  #3a4f30;
  --slate:           #a5bfda;
  --slate-bg:        #1f2a38;
  --slate-bg-strong: #2a3848;
  --rust:            #c89760;
  --rust-bg:         #3a2e1c;
  color-scheme: dark;
}
/* Trigger B: OS pref dark — only when user hasn't explicitly chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:              #0f172a;
    --bg-alt:          #0f172a;
    --surface:         #1e293b;
    --surface-sunk:    #0f172a;
    --ink:             #f8fafc;
    --ink-2:           #e2e8f0;
    --ink-3:           #94a3b8;
    --rule:            #1e293b;
    --rule-strong:     #334155;
    --navy:            #6366f1;
    --navy-ink:        #a5b4fc;
    --sage:            #a8c99a;
    --sage-bg:         #2a3a26;
    --sage-bg-strong:  #3a4f30;
    --slate:           #a5bfda;
    --slate-bg:        #1f2a38;
    --slate-bg-strong: #2a3848;
    --rust:            #c89760;
    --rust-bg:         #3a2e1c;
    color-scheme: dark;
  }
}

/* ─── diytools shared chrome + theme toggle ─── */
.dt-chrome {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.dt-chrome .dt-wordmark {
  font-family: var(--serif);
  font-size: 22px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; text-transform: none;
}
.dt-chrome .dt-wordmark em { font-style: italic; color: var(--navy); }
.dt-chrome .dt-right { display: flex; align-items: center; gap: 14px; }
.dt-chrome .dt-crumb a {
  color: var(--ink-3); text-decoration: none;
  border-bottom: 1px dotted var(--rule-strong);
}
.dt-chrome .dt-crumb a:hover { color: var(--ink); }
.dt-theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border: 1px solid var(--rule); border-radius: var(--r-md, 8px);
  background: transparent; color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.dt-theme-toggle:hover { color: var(--ink); border-color: var(--ink); background: var(--bg-alt); }
.dt-theme-toggle [data-theme-icon] { font-size: 12px; line-height: 1; }
@media print { .dt-chrome, .dt-theme-toggle { display: none !important; } }

/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ─── Container ─── */
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─── Type utilities ─── */
.mono { font-family: var(--mono); font-feature-settings: "tnum", "zero"; font-variant-numeric: tabular-nums; }
.overline {
  display: inline-block;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}
.hint { color: var(--ink-3); font-weight: 400; font-size: 13px; }

/* Body bg: soft slate-50 (matches React app) */
body { background: #f8fafc; }

/* ─── Masthead — React pattern: clean white card on slate body ─── */
.masthead {
  position: relative;
  padding: 48px 40px;
  margin: 24px var(--gutter) 32px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
}
.masthead::after { display: none; }
.masthead > * { position: relative; z-index: 1; }
.masthead__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.masthead__brand { min-width: 0; }
.overline--mast {
  display: inline-block;
  margin-bottom: var(--s-3);
  padding: 5px 12px;
  background: var(--accent-soft, #eef2ff);
  border: 1px solid #e0e7ff;
  border-radius: 9999px;
  color: var(--accent, #4f46e5);
  font-weight: 600;
}
.masthead__title {
  font-family: var(--serif);
  font-size: clamp(46px, 8vw, 80px);
  line-height: 0.96;
  letter-spacing: -0.025em;
  font-weight: 400;
  font-style: italic;
  margin: 0;
  color: var(--ink);
}
.masthead__meta {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.masthead__date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.masthead__actions {
  display: flex;
  gap: var(--s-2);
}
.btn-text {
  background: #ffffff;
  border: 1px solid var(--rule-strong);
  color: var(--ink-2);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 9999px;
  transition: all 0.15s ease;
}
.btn-text:hover {
  background: var(--bg-alt);
  border-color: var(--ink-3);
  color: var(--ink);
}
.btn-text:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.20);
}
.masthead__sub {
  margin: var(--s-5) 0 0;
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-2);
  max-width: 720px;
  line-height: 1.35;
}

/* ─── Main layout ─── */
.main {
  padding: var(--s-6) var(--gutter);
}

/* ─── Selector ─── */
.selector {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.selector__group { min-width: 0; }
.selector__group .overline { display: block; margin-bottom: var(--s-3); }
.selector__tabs {
  display: flex;
  gap: var(--s-1);
  flex-wrap: wrap;
}
.ctab {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all 0.15s ease;
}
.ctab__code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--surface-sunk);
  border-radius: var(--r-md, 8px);
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.ctab__name {}
.ctab:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}
.ctab.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--bg);
}
.ctab.is-active .ctab__code {
  background: rgba(255, 255, 255, 0.15);
  color: var(--bg);
}
.ctab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.20);
}

.residency {
  display: flex;
  gap: var(--s-1);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: 4px;
}
.res-opt {
  cursor: pointer;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: var(--r-md, 8px);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
}
.res-opt input { position: absolute; opacity: 0; pointer-events: none; }
.res-opt:has(input:checked) {
  background: var(--ink);
  color: var(--bg);
}
.res-opt:hover:not(:has(input:checked)) {
  color: var(--ink);
}

/* ─── Workspace grid ─── */
.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-6);
  align-items: start;
}

/* ─── Inputs ─── */
.inputs {
  position: sticky;
  top: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: var(--s-5);
}
.inputs__section {
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--rule);
}
.inputs__section:last-of-type { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.section-h {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 var(--s-4);
  letter-spacing: -0.01em;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--s-3);
  min-width: 0;
}
.field:last-child { margin-bottom: 0; }
.field label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.field-row .field { margin-bottom: 0; }

.input-wrap {
  display: flex;
  align-items: stretch;
  background: var(--surface-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  transition: all 0.15s ease;
  overflow: hidden;
}
.input-wrap:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.12);
  background: var(--surface);
}
.input-wrap input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--mono);
  font-feature-settings: "tnum";
  color: var(--ink);
  font-weight: 500;
  -moz-appearance: textfield;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.affix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  font-family: var(--mono);
}
.affix--prefix { border-right: 1px solid var(--rule); }
.affix--suffix { border-left: 1px solid var(--rule); }

/* Advanced */
.inputs__advanced {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.inputs__advanced summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  user-select: none;
}
.inputs__advanced summary::-webkit-details-marker { display: none; }
.inputs__advanced summary .section-h { margin: 0; }
.adv-chev {
  margin-left: auto;
  width: 10px; height: 10px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.inputs__advanced[open] .adv-chev {
  transform: rotate(-135deg);
}
.adv-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.field--compact label { font-size: 12px; }
.field--compact .input-wrap input { padding: 7px 10px; font-size: 13px; }
.field--compact .affix { padding: 0 10px; font-size: 12px; }

.inputs__footer {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.inputs__footer p { margin: 0; }

/* ─── Results ─── */
.results {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  min-width: 0;
}

/* Verdict */
.verdict {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
}
.verdict::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--ink-3);
  transition: background 0.2s ease;
}
.verdict.is-buy::before { background: var(--sage); }
.verdict.is-rent::before { background: var(--slate); }
.verdict__headline {
  font-family: var(--serif);
  font-size: clamp(36px, 4.5vw, 56px);
  font-style: italic;
  line-height: 1.0;
  margin: var(--s-2) 0 var(--s-3);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.verdict.is-buy .verdict__headline { color: var(--sage); }
.verdict.is-rent .verdict__headline { color: var(--slate); }
.verdict__detail {
  margin: 0;
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.5;
  max-width: 600px;
}
.verdict__confidence {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.conf-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-md, 8px);
  background: var(--surface-sunk);
  color: var(--ink-2);
  letter-spacing: 0.03em;
}
.conf-pill.conf-strong { background: var(--sage-bg-strong); color: var(--sage); }
.conf-pill.conf-moderate { background: var(--sage-bg); color: var(--sage); }
.conf-pill.conf-marginal { background: var(--rust-bg); color: var(--rust); }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
}
.metric {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.metric__label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.metric__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.metric__sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: var(--s-5);
}
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.panel__head .section-h { margin: 0; }

/* Legend */
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.legend__item {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend__dot {
  width: 12px; height: 3px; border-radius: var(--r-md, 8px);
}
.legend__dot--buy { background: var(--sage); }
.legend__dot--rent { background: var(--slate); border-bottom: 2px dashed var(--slate); height: 5px; background: transparent; }

/* Chart */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
}

/* Heatmap */
.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}
.heatmap {
  display: grid;
  gap: 2px;
  min-width: 480px;
}
.hm-row {
  display: grid;
  grid-template-columns: 80px repeat(6, minmax(0, 1fr));
  gap: 2px;
}
.hm-cell {
  padding: 10px 6px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--r-md, 8px);
  background: var(--surface-sunk);
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 50px;
}
.hm-cell--label {
  background: transparent;
  font-weight: 600;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hm-cell--corner { background: transparent; }
.hm-cell.b-3 { background: var(--sage-bg-strong); color: var(--sage); }
.hm-cell.b-2 { background: var(--sage-bg); color: var(--sage); }
.hm-cell.b-1 { background: color-mix(in srgb, var(--sage-bg) 50%, var(--surface-sunk)); color: var(--sage); }
.hm-cell.r-1 { background: color-mix(in srgb, var(--slate-bg) 50%, var(--surface-sunk)); color: var(--slate); }
.hm-cell.r-2 { background: var(--slate-bg); color: var(--slate); }
.hm-cell.r-3 { background: var(--slate-bg-strong); color: var(--slate); }
.hm-cell__delta { font-weight: 600; font-size: 11px; }
.hm-cell__hint { font-size: 9px; opacity: 0.7; }

.heatmap-legend {
  margin-top: var(--s-3);
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}
.hm-leg { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.hm-sq { width: 10px; height: 10px; border-radius: var(--r-md, 8px); }
.hm-sq--buy { background: var(--sage-bg-strong); }
.hm-sq--rent { background: var(--slate-bg-strong); }

/* Detail table */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.detail-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.detail-table tr:last-child td { border-bottom: none; }
.detail-table td:first-child { color: var(--ink-2); }
.detail-table td:last-child {
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}

/* Notes */
.notes {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 8px);
  padding: var(--s-5);
  border-left: 4px solid var(--navy);
}
.notes .section-h { margin-bottom: var(--s-3); }
.notes p {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.cb-notes {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
}
.cb-notes .overline { display: block; margin-bottom: var(--s-2); color: var(--rust); }
.cb-notes p { font-size: 15px; }

/* Footer */
.footer {
  margin-top: var(--s-9);
  padding: var(--s-6) 0 var(--s-7);
  border-top: 1px solid var(--rule);
  background: var(--bg-alt);
}
.disclaimer {
  max-width: 760px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.disclaimer .overline { display: block; margin-bottom: 6px; }
.disclaimer code { font-family: var(--mono); font-size: 12px; }
.colophon {
  margin-top: var(--s-4);
  font-size: 12px;
  color: var(--ink-3);
}
.version { font-size: 11px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--r-md, 8px);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .inputs { position: static; }
  .selector { flex-direction: column; align-items: stretch; gap: var(--s-4); }
}
@media (max-width: 640px) {
  .masthead { padding: 40px 24px 48px; margin: 16px var(--gutter) 24px; border-radius: var(--r-md, 8px); }
  .masthead__sub { font-size: 18px; }
  .main { padding: var(--s-5) var(--gutter); }
  .panel { padding: var(--s-4); }
  .verdict { padding: var(--s-5); }
  .ctab__name { display: none; }
  .ctab { padding: 8px 10px; }
  .metric__value { font-size: 18px; }
}

/* ─── Animations ─── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.verdict, .metric, .panel, .notes {
  animation: fade-up 0.4s ease backwards;
}
.verdict { animation-delay: 0.05s; }
.metrics .metric:nth-child(1) { animation-delay: 0.10s; }
.metrics .metric:nth-child(2) { animation-delay: 0.15s; }
.metrics .metric:nth-child(3) { animation-delay: 0.20s; }
.metrics .metric:nth-child(4) { animation-delay: 0.25s; }

/* ─── Print ─── */
@media print {
  :root {
    --bg: #FFFFFF;
    --bg-alt: #F8F8F8;
    --surface:         #ffffff;
    --surface-sunk: #F4F4F0;
    --rule: rgba(0, 0, 0, 0.20);
  }
  body { background: white; font-size: 11pt; }
  .masthead { padding: 0 0 16pt; }
  .masthead__actions, .btn-text, #shareBtn, #resetBtn, #printBtn { display: none !important; }
  .inputs { position: static; box-shadow: none; page-break-inside: avoid; }
  .workspace { grid-template-columns: 280px 1fr; gap: 16pt; }
  .panel, .metric, .verdict, .notes { box-shadow: none; page-break-inside: avoid; }
  .footer { margin-top: 24pt; }
  .toast { display: none; }
  .verdict__headline { font-size: 32pt; }
  .chart-wrap { height: 200pt; }
}
