@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;450;500;600&display=swap');
/* =====================================================================
   Financial Calculators — shared stylesheet  (PASSERINE THEME)
   ---------------------------------------------------------------------
   Site-wide Passerine theme: natural blues & greens, warm paper
   background, white cards, square corners, Outfit headings + Inter body.
   Nearly the entire look is driven by the :root design tokens below, so
   future re-themes mostly mean editing those tokens.
   The previous Apple-style stylesheet is preserved as
   styles-original-apple-backup.css.
   ===================================================================== */

/* ---------- Design tokens (Passerine) ---------- */
:root {
  /* Type families */
  --font-head: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Neutrals — warm paper background, white cards */
  --bg:        #FAFBF8;
  --surface:   #FFFFFF;
  --surface-2: #EEF1EA;       /* slightly deeper tint so text sits on it clearly */
  --hairline:        #DCDFD4; /* firmer edges for card/table definition */
  --hairline-strong: #C2C8B8;

  /* Type — darkened for stronger contrast on the warm background */
  --ink:   #1F2730;           /* primary text, near-black */
  --ink-2: #36424D;           /* body / secondary text (was #51606D) */
  --ink-3: #586470;           /* labels / muted text (was #7C8893) */

  /* Single accent — bluebird blue */
  --accent:      #4D87B9;
  --accent-2:    #3A6B96;
  --accent-soft: rgba(77, 135, 185, 0.10);

  /* Status (used sparingly) — tuned to the natural palette */
  --good:      #5F7464;   /* moss green */
  --good-soft: rgba(95, 116, 100, 0.10);
  --warn:      #B07A3C;   /* warm bark/amber */
  --warn-bg:   #F7F1E6;
  --warn-bd:   rgba(176, 122, 60, 0.28);
  --bad:       #B3534A;   /* muted clay red */
  --bad-soft:  rgba(179, 83, 74, 0.10);

  /* Series colors (charts, stacks) — Passerine chart palette */
  --series-1: #4D87B9; /* bluebird blue  (stocks)    */
  --series-2: #5F7464; /* moss green     (portfolio) */
  --series-3: #87A878; /* sage green     (bonds)     */
  --series-4: #C9A24B; /* sand/seed gold (cash)      */
  --series-5: #A7C8E8; /* soft sky blue             */
  --series-6: #7FA0B5; /* dusty blue                */

  /* Shape — square corners */
  --radius-lg: 2px;
  --radius-md: 2px;
  --radius-sm: 2px;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  /* Final safety net: never let the document itself scroll sideways. */
  overflow-x: clip;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-feature-settings: "tnum";
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  /* Defensive: keep body inside the viewport at every width. */
  max-width: 100%;
  overflow-x: clip;
}

/* Defense: media should never push its parent wider than the viewport. */
img, svg, video, iframe {
  max-width: 100%;
}
img, video { height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------- Page shell ---------- */
.page {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 28px 80px;
  /* Prevent any rogue child from forcing the shell wider. */
  min-width: 0;
}

/* ---------- Top bar (brand + nav) ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 24px;
  gap: 16px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 600; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--ink); }

.brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff;
  display: inline-grid; place-items: center;
  font-size: 14px; font-weight: 700;
}

/* Passerine brand logo (bluebird). White art field blends onto the
   warm background via multiply so no white box shows. */
.brand-logo {
  height: 92px; width: auto; display: block;
  mix-blend-mode: multiply;
  /* a touch more punch so the bird reads crisply on the warm paper bg */
  filter: contrast(1.12) saturate(1.1);
}

/* Headings in Outfit; body stays Inter. */
h1, h2, h3, h4, .brand, .stat-num, .tile-value {
  font-family: var(--font-head);
}

.nav-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  color: var(--ink-2); text-decoration: none;
  font-size: 14px; padding: 8px 12px; border-radius: 999px;
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-link.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

/* Backwards-compat: existing pages use .home-link / .app-kicker */
.home-link {
  display: inline-flex; align-items: center;
  color: var(--ink-2); text-decoration: none;
  font-size: 14px; padding: 8px 12px; border-radius: 999px;
}
.home-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

.app-kicker {
  margin: 0 0 10px;
  color: var(--ink-3);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ---------- Hero (page header) ---------- */
.hero {
  padding: 28px 0 28px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--ink-3);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
}

h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.lede, .subtitle {
  margin: 14px 0 0;
  max-width: 760px;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.55;
}

/* ---------- Layout grids ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  /* Keep the layout grid itself from extending past the page shell. */
  max-width: 100%;
  min-width: 0;
}

.sidebar { display: grid; gap: 20px; align-content: start; min-width: 0; }
.main    { display: grid; gap: 20px; min-width: 0; }
/* Grid children (cards, etc.) must be allowed to shrink instead of overflowing. */
.sidebar > *, .main > * { min-width: 0; max-width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  /* No drop shadow — hairline does the lifting */
}

.card + .card { margin-top: 0; } /* parent grid handles gaps */

.card-header {
  padding: 22px 24px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-body { padding: 14px 24px 22px; }

/* ---------- Inputs ---------- */
.inputs { display: grid; gap: 18px; }

.field { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 14px; font-weight: 500;
  color: var(--ink); margin-bottom: 8px;
}

.input-wrap { position: relative; }

.input-wrap .prefix,
.input-wrap .suffix {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 15px; pointer-events: none;
}
.input-wrap .prefix { left: 14px; }
.input-wrap .suffix { right: 14px; }

.input-wrap input,
.input-wrap select,
.field > input,
.field > select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.input-wrap.has-prefix input,
.input-wrap.has-prefix select { padding-left: 28px; }
.input-wrap.has-suffix input,
.input-wrap.has-suffix select { padding-right: 28px; }

.input-wrap input:focus,
.input-wrap select:focus,
.field > input:focus,
.field > select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field .hint,
.field small {
  display: block;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

/* Native select arrow (since we removed the default appearance) */
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px !important;
}

/* Radios / checkboxes — light treatment, accent color */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--hairline);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented button.active,
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--hairline);
}

/* Buttons */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Inline rate / summary box ---------- */
.rate-box {
  margin-top: 4px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}
.rate-box strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rate-box > div {
  display: flex; justify-content: space-between; gap: 12px;
}

/* ---------- Validation ---------- */
.warning {
  margin-top: 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  color: var(--warn);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}
.warning ul { margin: 0; padding-left: 18px; }
.warning li + li { margin-top: 4px; }

/* ---------- Source note (cross-page handoff) ---------- */
.source-note {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(77, 135, 185, 0.16);
  color: #003e7e;
  font-size: 13px; line-height: 1.55;
}
.source-note a { color: var(--accent); font-weight: 600; text-decoration: none; }
.source-note a:hover { text-decoration: underline; }

/* ---------- Hero metrics: tiles row ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
.tile {
  background: var(--surface);
  padding: 20px 22px 18px;
}
.tile .label,
.tile-label {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0 0 10px;
}
.tile .value,
.tile-value {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
.tile .note,
.tile-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}
.tile .delta { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.tile .delta.good { color: var(--good); }
.tile .delta.warn { color: var(--warn); }
.tile .delta.bad  { color: var(--bad); }

/* Backwards-compat: old metrics-grid / metric-card */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
.metric-card {
  background: var(--surface);
  padding: 20px 22px 18px;
  border-radius: 0;
  box-shadow: none;
  border: 0;
}
.metric-label {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0 0 10px;
}
.metric-value {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
.metric-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}

/* ---- Result tiles arranged in scenario columns (lease / buy / difference) ---- */
.scenario-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.scenario-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.scenario-col-head {
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 12px 22px;
}
.scenario-col-head span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.scenario-col .metric-card { flex: 1; }
.verdict-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .scenario-tiles { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .verdict-tiles { grid-template-columns: 1fr; }
}

/* ---------- Explain block (the "why this matters" intro) ---------- */
.explain {
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid rgba(77, 135, 185, 0.14);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}
.explain > div { margin: 0; }
.explain > div + div { margin-top: 8px; }
.explain strong { color: var(--ink); font-weight: 600; }

/* ---------- Badges ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  color: var(--ink-2);
  font-size: 12px; font-weight: 500;
}

/* ---------- Chart ---------- */
.chart-card .card-body { padding: 8px 16px 20px; }
.chart-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 8px 10px;
  flex-wrap: wrap;
  gap: 10px;
}
.chart-toolbar h2 {
  margin: 0;
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
}
.chart-wrap {
  position: relative;
  height: 360px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
/* Chart.js renders an inline-styled canvas — keep it fenced to the wrap. */
.chart-wrap > canvas { max-width: 100% !important; }

/* ---------- Tables ---------- */
.table-card .card-body { padding: 0 0 8px; }
.table-wrap {
  overflow: auto;
  max-height: 460px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13.5px;
}
th, td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
}
.num, td.num, th.num {
  text-align: right;
}
thead th {
  position: sticky; top: 0;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--hairline-strong);
  /* Allow multi-word headers to wrap so the table stays narrower. */
  white-space: normal;
  vertical-align: bottom;
  line-height: 1.3;
}
tbody tr:hover { background: var(--surface-2); }
tbody td strong { color: var(--ink); font-weight: 600; }
tbody tr:nth-child(even) { background: transparent; }

.empty {
  padding: 32px;
  text-align: center;
  color: var(--ink-3);
}

/* ---------- Concepts card ---------- */
.concepts h3 {
  margin: 0 0 10px;
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.concepts ul { margin: 0; padding-left: 0; list-style: none; }
.concepts li {
  position: relative;
  padding: 12px 0 12px 26px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}
.concepts li:first-child { border-top: 0; padding-top: 4px; }
.concepts li::before {
  content: ""; position: absolute;
  left: 0; top: 18px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}
.concepts li:first-child::before { top: 10px; }

/* ---------- Quick Guide / markdown content ---------- */
.guide-card .card-body { padding-top: 8px; }
.guide-content {
  color: var(--ink-2);
  font-size: 14px; line-height: 1.7;
}
.guide-content h1,
.guide-content h2,
.guide-content h3 {
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 18px 0 6px;
  line-height: 1.25;
  font-weight: 600;
}
.guide-content h1 { font-size: 17px; margin-top: 0; }
.guide-content h2 { font-size: 15px; }
.guide-content h3 { font-size: 14px; color: var(--ink-2); }
.guide-content p { margin: 0 0 10px; }
.guide-content ul,
.guide-content ol { margin: 0 0 10px; padding-left: 20px; }
.guide-content li + li { margin-top: 4px; }
.guide-content strong { color: var(--ink); font-weight: 600; }

/* ---------- Home page calculator grid ---------- */
.calculator-groups {
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 100%;
  box-sizing: border-box;
}

.calculator-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.group-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.group-subtitle {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  min-height: 170px;
}
.card-link:hover {
  border-color: var(--hairline-strong);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transform: translateY(-1px);
}
.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-size: 1.25rem;
  margin-bottom: 14px;
}
.card-title-link {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
  text-transform: none;
}
.card-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.card-foot {
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Quote / about ---------- */
.quote-footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 14px;
  max-width: 900px;
  color: var(--ink-3);
}
.quote-item {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
}

.home-badge {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
}

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.18);
  width: min(640px, calc(100vw - 32px));
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}
.dialog-card { padding: 24px; background: var(--surface); }
.dialog-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.dialog-body { color: var(--ink-2); line-height: 1.65; display: grid; gap: 14px; font-size: 15px; }
.dialog-quote {
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.dialog-quote p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dialog-button {
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.dialog-button:hover { background: var(--surface-2); }

.quote-help {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.quote-help:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Page-specific patterns (re-styled in the new system) ---------- */

/* Lesson tile (401k page) */
.lesson-tile {
  margin: 0 0 24px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}
.lesson-kicker {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0 0 8px;
}
.lesson-title {
  margin: 0 0 16px;
  font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink); line-height: 1.35;
}
.lesson-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.lesson-point { background: var(--surface); padding: 14px 16px; }
.lesson-point-label {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 4px;
}
.lesson-point-text { color: var(--ink-2); font-size: 14px; line-height: 1.45; }
@media (max-width: 700px) { .lesson-points { grid-template-columns: 1fr; } }

/* Theme toggle (401k page) — neutralized; kept functional */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  padding: 7px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}
.topbar-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Bands (credit scores) */
.band-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.band-item { background: var(--surface); padding: 16px 18px; }
.band-name {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 6px;
}
.band-score { color: var(--ink); font-size: 13px; margin-bottom: 8px; }
.band-apr {
  color: var(--ink); font-size: clamp(18px, 2vw, 22px); font-weight: 600;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  word-break: break-word; overflow-wrap: anywhere;
}
.band-payment { color: var(--ink-2); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.range-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 600;
  margin-left: 8px;
}

/* Pills */
.pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.pill-green { background: var(--good-soft); color: var(--good); border-color: rgba(36,138,61,0.2); }
.pill-amber { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }

/* Strategy pills (debt strategy planner) */
.strategy-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.strategy-pill {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 500;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  cursor: pointer;
}
.strategy-pill:hover { background: var(--surface-2); color: var(--ink); }
.strategy-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Toggle group / button (chart toggles, scenario toggles, etc.) */
.toggle-group {
  display: inline-flex; padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.toggle-button {
  border: 0; background: transparent;
  color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 8px;
  cursor: pointer;
}
.toggle-button.active,
.toggle-button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--hairline);
}
.chart-toggle { display: inline-flex; align-items: center; gap: 6px; }

/* Section labels / titles / notes */
.section-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 22px 24px; }
.section-label {
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin: 0 0 8px;
}
.section-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.section-note { color: var(--ink-3); font-size: 13px; line-height: 1.55; }

/* Scenario cards (save, then buy) */
.scenario-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.scenario-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}
.scenario-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.scenario-title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.scenario-subtitle { margin: 0 0 12px; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.scenario-meta { color: var(--ink-3); font-size: 12px; }
.scenario-metrics { display: grid; gap: 8px; margin-top: 10px; }

/* Debt cards (debt strategy planner) */
.debt-grid { display: grid; gap: 14px; }
.debt-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.debt-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.debt-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.debt-meta { color: var(--ink-3); font-size: 12px; }

/* Summary helpers */
.summary-grid { display: grid; gap: 12px; }
.summary-stack { display: grid; gap: 6px; }
.summary-box {
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.summary-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.summary-line-label { color: var(--ink-3); font-size: 13px; }
.summary-line-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-label { color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.summary-value { color: var(--ink); font-size: clamp(18px, 2vw, 22px); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; word-break: break-word; overflow-wrap: anywhere; min-width: 0; }
.summary-note { color: var(--ink-3); font-size: 12px; }

/* Advice / comparison panels (mortgage points) */
.advice-box {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid rgba(77, 135, 185, 0.14);
  color: var(--ink-2);
  font-size: 14px; line-height: 1.55;
}
.advice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.advice-link {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 999px;
  background: var(--accent); color: #fff;
  text-decoration: none; font-size: 13px; font-weight: 500;
}
.advice-link:hover { background: var(--accent-2); color: #fff; text-decoration: none; }
.comparison-note { color: var(--ink-3); font-size: 13px; line-height: 1.55; margin-top: 8px; }

/* Charts grid (multi-chart pages) */
.charts-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.chart-wrap.wide-chart { height: 420px; }
.chart-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); }
.chart-card .card-header { padding: 18px 20px 4px; }
.chart-header { padding: 18px 20px 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chart-note { color: var(--ink-3); font-size: 12px; padding: 0 20px 16px; line-height: 1.5; }

/* Checkbox / switch fields */
.checkbox-field, .check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
}
.checkbox-field label, .check-row label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink);
  cursor: pointer; margin: 0;
}
.check-switch { padding: 10px 0; }

/* Field actions (buttons inside an input card) */
.field-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.ghost-button:hover { background: var(--surface-2); color: var(--ink); }

/* Variants for metric tiles — JS toggles these to tone the value color */
.metric-card.metric-neutral  .metric-value { color: var(--ink); }
.metric-card.metric-positive .metric-value { color: var(--good); }
.metric-card.metric-negative .metric-value { color: var(--bad); }
.metric-card.metric-amber    .metric-value { color: var(--warn); }
.metric-card.muted           .metric-value { color: var(--ink-3); }
/* Same toning, applied when the JS adds the class to a generic .tile */
.tile.metric-neutral  .value { color: var(--ink); }
.tile.metric-positive .value { color: var(--good); }
.tile.metric-negative .value { color: var(--bad); }
.tile.metric-amber    .value { color: var(--warn); }

/* Overflow grid (very wide content) */
.overflow-grid { overflow-x: auto; }

/* ---------- Misc utility ---------- */
.muted { color: var(--ink-3); }
.tabular { font-variant-numeric: tabular-nums; }
.spacer-sm { height: 12px; }
.spacer-md { height: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .tiles, .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .page { padding: 20px 16px 60px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .nav-actions { justify-content: flex-start; }
  .tiles, .metrics-grid { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  table { min-width: 600px; }
  .grid { grid-template-columns: 1fr; }
  .lesson-points { grid-template-columns: 1fr; }
}

/* Site-wide copyright + trademark line (shared footer) */
.site-copyright {
  text-align: center;
  padding: 26px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  color: #586470;
  background: var(--bg);
  border-top: 1px solid var(--hairline);
}
.site-copyright p { margin: 0; }
.site-copyright .sc-tm { margin-top: 6px; font-size: 12px; color: #6B7680; }
.site-copyright .sc-tm a { color: var(--accent); text-decoration: none; }
.site-copyright .sc-tm a:hover { text-decoration: underline; }


/* calc-learn component — Phase 1 calculator->article cross-links */
.calc-learn{ max-width:1200px; margin:8px auto 40px; padding:0 16px; }
.calc-learn h2{ font-family:var(--font-head); font-size:20px; font-weight:700; color:var(--ink); margin:0 0 4px; }
.calc-learn .cl-intro{ font-family:var(--font-body); font-size:14px; color:var(--ink-3); margin:0 0 18px; }
.calc-learn-grid{ display:grid; gap:16px; grid-template-columns:repeat(auto-fit, minmax(230px, 1fr)); }
.cl-card{ display:block; background:var(--surface); border:1px solid var(--hairline); border-top:3px solid var(--accent); border-radius:var(--radius-md); padding:16px 16px 14px; transition:border-color .15s ease, box-shadow .15s ease; }
.cl-card:hover{ text-decoration:none; border-color:var(--hairline-strong); box-shadow:0 2px 10px rgba(31,39,48,.06); }
.cl-card .cl-cat{ font-family:var(--font-body); text-transform:uppercase; letter-spacing:.09em; font-size:11px; font-weight:700; color:var(--accent-2); margin-bottom:6px; }
.cl-card .cl-title{ font-family:var(--font-head); font-size:17px; font-weight:700; color:var(--ink); line-height:1.25; margin:0 0 6px; }
.cl-card:hover .cl-title{ color:var(--accent-2); }
.cl-card .cl-sum{ font-family:var(--font-body); font-size:13.5px; line-height:1.5; color:var(--ink-2); margin:0 0 8px; }
.cl-card .cl-read{ font-family:var(--font-body); font-size:12px; font-weight:600; color:var(--ink-3); }
@media (max-width:1000px){ .calc-learn{ padding:0 16px; } }


/* hub pages */
.hub{ max-width:1200px; margin:0 auto; padding:16px 16px 60px; }
.hub-crumb{ font-family:var(--font-body); font-size:13px; color:var(--ink-3); margin:6px 0 16px; }
.hub-crumb a{ color:var(--accent-2); }
.hub-title{ font-family:var(--font-head); font-size:34px; font-weight:800; color:var(--ink); margin:0 0 10px; }
.hub-intro{ font-family:var(--font-body); font-size:16px; line-height:1.6; color:var(--ink-2); max-width:72ch; margin:0 0 8px; }
.hub-sec{ font-family:var(--font-head); font-size:20px; font-weight:700; color:var(--ink); margin:30px 0 14px; padding-bottom:8px; border-bottom:1px solid var(--hairline); display:flex; align-items:baseline; gap:10px; }
.hub-count{ font-family:var(--font-body); font-size:13px; font-weight:600; color:var(--ink-3); background:var(--surface-2); border-radius:999px; padding:2px 10px; }


/* articles search + start-here */
.pub-search{ margin:4px 0 18px; }
.pub-search input[type=search]{ width:100%; box-sizing:border-box; font-family:var(--font-body); font-size:15px; color:var(--ink); background:var(--surface); border:1px solid var(--hairline-strong); border-radius:var(--radius-md); padding:11px 14px; }
.pub-search input[type=search]:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.pub-search-none{ font-family:var(--font-body); font-size:14px; color:var(--ink-2); margin:14px 2px 0; }
.starthere{ margin:6px 0 26px; border:1px solid var(--hairline); border-left:3px solid var(--accent); border-radius:var(--radius-md); background:var(--surface); padding:16px 18px; }
.starthere h2{ font-family:var(--font-head); font-size:16px; font-weight:700; margin:0 0 4px; color:var(--ink); }
.starthere .sh-intro{ font-family:var(--font-body); font-size:13.5px; color:var(--ink-3); margin:0 0 12px; }
.sh-steps{ display:flex; flex-wrap:wrap; gap:10px; }
.sh-step{ display:flex; align-items:center; gap:10px; flex:1 1 200px; border:1px solid var(--hairline); border-radius:var(--radius-md); padding:10px 12px; text-decoration:none; background:var(--bg); transition:border-color .15s ease; }
.sh-step:hover{ border-color:var(--accent); text-decoration:none; }
.sh-num{ font-family:var(--font-head); font-weight:800; color:#fff; background:var(--accent); width:24px; height:24px; border-radius:999px; display:flex; align-items:center; justify-content:center; font-size:13px; flex:0 0 auto; }
.sh-step .sh-t{ font-family:var(--font-body); font-size:13.5px; color:var(--ink); font-weight:600; line-height:1.3; }
