/* =============================================================
 * BetterMoneyTools.com — styles.css
 * Calm, confident, modern. Deep navy + sage-teal on warm white.
 * Tokens → reset → primitives → layout → components → calculators.
 * ============================================================= */

/* ---------- Feature flags ----------
 * Two site-wide features are hidden until they're ready to launch.
 * To turn either feature back ON, comment out (or delete) the
 * matching rule below. No HTML changes required.
 *
 *   1) Email capture box ("The printable Money Dashboard" on the
 *      home page). Hide until the email list is live.
 *   2) Sponsored ad placements (top + bottom of every calculator
 *      page). Hide until the first sponsor is signed.
 */
.email-capture { display: none !important; }
.ad-slot       { display: none !important; }
/* ---------- End feature flags ---------- */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg:               #fbfaf7;   /* warm off-white */
  --surface:          #ffffff;
  --surface-soft:     #f4f3ee;
  --surface-tint:     #f7f9fb;

  /* Borders */
  --border:           #ebe9e2;
  --border-strong:    #d8d5cc;
  --border-focus:     #0a2540;

  /* Brand */
  --primary:          #0a2540;   /* deep navy — confidence */
  --primary-700:      #061a2f;
  --primary-soft:     #eef2f6;
  --primary-tint:     #f4f7fa;

  --accent:           #4a8a7b;   /* sage teal — calm */
  --accent-700:       #36695e;
  --accent-soft:      #eaf2ef;

  /* Brand-specific accent — the bright green used in the logo wordmark */
  --brand-green:      #22c55e;
  --brand-green-700:  #16a34a;

  /* Text */
  --text:             #0a1929;
  --text-muted:       #5a6573;
  --text-subtle:      #8a8f99;
  --text-on-dark:     #f4f7fa;

  /* Semantic */
  --pos:              #15803d;
  --pos-soft:         #ecfdf5;
  --neg:              #b91c1c;
  --neg-soft:         #fef2f2;
  --warn:             #b45309;
  --warn-soft:        #fffbeb;

  /* Shadows — extremely subtle, financial-grade */
  --shadow-xs:        0 1px 2px rgba(10, 25, 41, 0.04);
  --shadow-sm:        0 1px 3px rgba(10, 25, 41, 0.05), 0 1px 2px rgba(10, 25, 41, 0.03);
  --shadow-md:        0 4px 12px rgba(10, 25, 41, 0.06), 0 2px 4px rgba(10, 25, 41, 0.04);
  --shadow-lg:        0 12px 32px rgba(10, 25, 41, 0.08), 0 4px 12px rgba(10, 25, 41, 0.04);

  /* Radii */
  --r-sm:             8px;
  --r:                12px;
  --r-lg:             16px;
  --r-xl:             24px;
  --r-pill:           999px;

  /* Spacing — 4pt 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;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Inter", var(--font-sans);

  /* Misc */
  --container: 1140px;
  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; color: inherit; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  margin: 0 0 var(--s-4);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 { font-size: 2.25rem; letter-spacing: -0.03em; }
h2 { font-size: 1.75rem; letter-spacing: -0.025em; }
h3 { font-size: 1.125rem; letter-spacing: -0.015em; }
h4 { font-size: 0.95rem; }
p  { margin: 0 0 var(--s-4); color: var(--text); }

::selection { background: var(--accent-soft); color: var(--primary); }

@media (min-width: 768px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.125rem; }
}

/* Utility: tabular numbers everywhere money appears */
.num, .kpi__value, .schedule-table, .compare-value, [data-fmt="money"], [data-fmt="money2"], [data-fmt="pct"], [data-fmt="months"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- Container ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
@media (min-width: 768px) { .container { padding: 0 var(--s-7); } }

/* ---------- Top nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 92px;
  gap: var(--s-5);
}
.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }

/* Full-color logo — sized for a strong, branded presence */
.brand__logo {
  height: 76px;
  width: auto;
  display: block;
}

@media (max-width: 1024px) {
  .nav { height: 80px; }
  .brand__logo { height: 64px; }
}
@media (max-width: 768px) {
  .nav { height: 68px; }
  .brand__logo { height: 52px; }
}
@media (max-width: 480px) {
  .nav { height: 60px; }
  .brand__logo { height: 42px; }
}
.nav-links {
  display: none;
  gap: var(--s-5);
  align-items: center;
}
.nav-links > a.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
  padding: 6px 0;
}
.nav-links > a.nav-link:hover { color: var(--text); }
.nav-links > a.nav-link.active { color: var(--primary); }
.nav-links > a.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--brand-green);
  border-radius: 2px;
}
/* Per-category dropdowns */
.nav-dropdown { position: relative; }
.nav-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 6px 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.nav-dropdown__trigger:hover,
.nav-dropdown__trigger.active { color: var(--primary); }
.nav-dropdown__trigger.active {
  position: relative;
}
.nav-dropdown__trigger.active::after {
  content: '';
  position: absolute;
  left: 0; right: 14px; bottom: -2px;
  height: 2px;
  background: var(--brand-green);
  border-radius: 2px;
}
.nav-dropdown__chevron { font-size: 0.7rem; transition: transform var(--transition); }
.nav-dropdown.is-open .nav-dropdown__chevron { transform: rotate(180deg); }

.nav-dropdown__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 180ms cubic-bezier(.4,0,.2,1), transform 180ms cubic-bezier(.4,0,.2,1), visibility 180ms;
  z-index: 60;
}
.nav-dropdown.is-open .nav-dropdown__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav-dropdown__menu a {
  display: block;
  padding: 9px 14px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-dropdown__menu a:hover {
  background: var(--surface-tint);
  color: var(--primary);
  text-decoration: none;
}
.nav-dropdown__menu a.active {
  color: var(--primary);
  background: var(--accent-soft);
}

/* Hamburger-icon trigger (used by the "More" menu) */
.nav-dropdown__trigger--icon {
  padding: 6px 8px;
  gap: 0;
}
.nav-dropdown__trigger--icon .nav-dropdown__trigger-label {
  display: none;
}
.nav-dropdown__burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 22px;
  height: 16px;
}
.nav-dropdown__burger > span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background var(--transition), transform var(--transition);
}
.nav-dropdown__trigger--icon:hover .nav-dropdown__burger > span,
.nav-dropdown.is-open .nav-dropdown__trigger--icon .nav-dropdown__burger > span {
  background: var(--primary);
}
.nav-dropdown__trigger--icon.active::after { display: none; }

/* Right-aligned dropdown menu (anchors to right edge of trigger) */
.nav-dropdown__menu--right {
  left: auto;
  right: 0;
}

/* Sectioned dropdown menu — used by "More" to group Site / Articles / Legal */
.nav-dropdown__menu--sectioned {
  min-width: 240px;
  padding: var(--s-2) var(--s-2) var(--s-3);
}
.nav-dropdown__section + .nav-dropdown__section {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-dropdown__heading {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 6px 14px 4px;
}

/* Mobile: icon trigger collapses to a "More" section header like the others */
@media (max-width: 767.98px) {
  .nav-dropdown__trigger--icon {
    padding: var(--s-3) 0 var(--s-2);
  }
  .nav-dropdown__trigger--icon .nav-dropdown__burger { display: none; }
  .nav-dropdown__trigger--icon .nav-dropdown__trigger-label { display: inline; }
  .nav-dropdown__menu--right { right: auto; }
  .nav-dropdown__menu--sectioned { padding: 0; }
  .nav-dropdown__section + .nav-dropdown__section {
    margin-top: var(--s-2);
    padding-top: var(--s-2);
  }
  .nav-dropdown__heading {
    padding: 6px 0 2px;
    font-size: 0.65rem;
    color: var(--text-muted);
  }
}

/* Mobile: dropdowns become inline category sections inside the burger menu */
@media (max-width: 767.98px) {
  .nav-dropdown { width: 100%; }
  .nav-dropdown__trigger {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-subtle);
    padding: var(--s-3) 0 var(--s-2);
    pointer-events: none; /* always-open on mobile */
  }
  .nav-dropdown__chevron { display: none; }
  .nav-dropdown__menu {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
    min-width: 0;
  }
  .nav-dropdown__menu a {
    padding: 10px 0;
    font-size: 1rem;
  }
  .nav-dropdown__menu a:hover { background: transparent; }
}

.nav-toggle {
  display: inline-flex; flex-direction: column; gap: 4px;
  padding: 8px; border-radius: var(--r-sm);
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform var(--transition);
}
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
}
@media (max-width: 767.98px) {
  .nav-links.open {
    display: flex; flex-direction: column;
    align-items: stretch;
    /* Fixed (not absolute) so the menu stays put while the user scrolls inside
       it, and so its own overflow:auto handles scrolling instead of letting
       the gesture fall through to the page below. */
    position: fixed; top: 68px; left: 0; right: 0;
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    padding: var(--s-4) var(--s-5) var(--s-5);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    gap: var(--s-3);
    z-index: 50;
  }
  .nav-links a { padding: 10px 0; font-size: 1rem; }
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--s-9) 0 var(--s-7);
  position: relative;
  overflow: hidden;
}
/* Compact hero used on individual calculator pages — title only, no tool grid */
.hero--compact { padding: var(--s-8) 0 var(--s-6); }
.hero--compact h1 { margin-bottom: var(--s-3); font-size: 2rem; }
@media (min-width: 768px) { .hero--compact h1 { font-size: 2.5rem; } }
.hero--compact .hero__lead { margin-bottom: 0; font-size: 1.05rem; }
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 400px at 20% 0%, rgba(74, 138, 123, 0.08), transparent 60%),
    radial-gradient(ellipse 600px 300px at 80% 30%, rgba(10, 37, 64, 0.04), transparent 60%);
  pointer-events: none;
}
.hero > .container { position: relative; }
.hero h1 {
  max-width: 780px;
  margin-bottom: var(--s-5);
}
.hero__lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.6;
  margin-bottom: var(--s-6);
}
.hero__cta {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent-700);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  margin-bottom: var(--s-5);
}
.eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 22px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  border: 1px solid var(--primary);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.18);
}
.btn--ghost {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}
.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
}
.btn--accent:hover {
  background: var(--accent-700);
  border-color: var(--accent-700);
  color: #fff;
}
.btn--sm {
  padding: 7px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-subtle);
  font-size: 1.1rem;
  line-height: 1;
  display: inline-grid; place-items: center;
  transition: all var(--transition);
}
.icon-btn:hover {
  color: var(--neg);
  border-color: var(--neg);
  background: var(--neg-soft);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: border-color var(--transition);
}
.card + .card { margin-top: var(--s-4); }
@media (max-width: 600px) { .card { padding: var(--s-5); } }

/* ---------- Sections ---------- */
.calc-section {
  padding: var(--s-9) 0 var(--s-8);
  scroll-margin-top: 88px;
  position: relative;
}
.calc-section + .calc-section { border-top: 1px solid var(--border); }
/* When a calculator is the only thing on its page, tighter top padding */
.calc-section--solo { padding-top: var(--s-6); }

.calc-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s-5); margin-bottom: var(--s-7);
}
.calc-header__text { max-width: 640px; }
.calc-header__text h2 { margin-bottom: var(--s-3); }
.calc-header__text p {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.025rem;
  line-height: 1.55;
}
.calc-header__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.calc-grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 1080px) {
  .calc-grid { grid-template-columns: 1.1fr 1fr; gap: var(--s-6); }
}

/* Stretch a column's child card to fill the row's full height —
   used when one side has a single card and the other has multiple stacked. */
.col-stretch { display: flex; flex-direction: column; }
.col-stretch > .card { flex: 1; min-height: 0; }

/* ---------- Form fields ---------- */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field > span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
}

/* Suppress number input spinner arrows everywhere — they steal ~16px of room
   and clash with our minimal aesthetic. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input:hover,
.field select:hover { border-color: #b8b4a8; }
.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 4px;
  font-style: italic;
}

/* Read-only inputs — visually distinct from editable fields. Used for
   computed/derived values like "Total monthly" or "Sum of minimums". */
.field input[readonly],
.prefix-input input[readonly],
input[readonly] {
  background: var(--surface-tint);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
  cursor: default;
}
.field input[readonly]:focus,
.prefix-input input[readonly]:focus,
input[readonly]:focus {
  outline: none;
  border-color: var(--border);
  box-shadow: none;
}
.field input[readonly]:hover,
.prefix-input input[readonly]:hover,
input[readonly]:hover {
  border-color: var(--border);
}

/* 3-column variant for the debt-payoff plan card (mins / extra / total). */
.field-row--three { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .field-row--three { grid-template-columns: 1fr 1fr 1fr; }
}

/* Inline info-tooltip next to a form label.
   Markup pattern: <span>Label <button class="field-info" aria-label="…">i<span class="field-info__tip">…</span></button></span> */
.field-info {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-subtle);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-style: normal;
  font-family: Georgia, serif;
  line-height: 1;
  margin-left: 6px;
  vertical-align: 1px;
  border: 0;
  padding: 0;
  cursor: help;
  transition: background var(--transition);
}
.field-info:hover,
.field-info.is-open { background: var(--primary); }
.field-info:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.18);
}
.field-info__tip {
  /* Anchored ABOVE the badge so it never overlaps the input below.
     pointer-events stays `none` even when visible so the cursor can pass
     through it to interact with whatever's underneath. */
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text);
  color: #fff;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 400;
  font-family: var(--font-sans);
  font-style: normal;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  white-space: normal;
  width: 260px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms cubic-bezier(.4,0,.2,1), transform 180ms cubic-bezier(.4,0,.2,1), visibility 180ms;
  pointer-events: none;
  z-index: 50;
}
.field-info__tip::before {
  /* Down-pointing arrow attached to the bottom of the tip */
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--text);
}
.field-info__tip strong { color: #fff; font-weight: 600; }
.field-info:hover .field-info__tip,
.field-info:focus-visible .field-info__tip,
.field-info.is-open .field-info__tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  /* Note: pointer-events stays `none` — keeps the input below clickable. */
}
/* Mobile / narrow viewports: anchor-left so the tooltip doesn't overflow */
@media (max-width: 480px) {
  .field-info__tip { left: 0; transform: translateY(4px); width: min(260px, calc(100vw - 32px)); }
  .field-info__tip::before { left: 12px; }
  .field-info:hover .field-info__tip,
  .field-info.is-open .field-info__tip { transform: translateY(0); }
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}
.field-row {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
}

.subhead {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-4);
  gap: var(--s-3);
}
.subhead h3 { margin: 0; }

/* ---------- Tab / segmented control ---------- */
.tabs {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.tabs button {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.strategy-hint {
  margin: var(--s-3) 0 0;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}
.strategy-hint strong { color: var(--accent-700); font-weight: 600; }
.strategy-hint .muted { color: var(--text-muted); }

/* ---------- Slider ---------- */
.slider-row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-2) 0;
}
.slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-soft);
  border-radius: var(--r-pill);
  outline: none;
  cursor: pointer;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  background: var(--primary);
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong);
  cursor: pointer;
  transition: transform var(--transition);
}
.slider-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }
.slider-row input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--primary);
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.slider-row .slider-value {
  min-width: 84px;
  text-align: right;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* Typed-input variant — number box paired with the slider */
.slider-input {
  position: relative;
  flex: 0 0 auto;
}
.slider-input__prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  pointer-events: none;
}
.slider-input input[type="number"] {
  width: 110px;
  padding: 9px 12px 9px 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--primary);
  text-align: right;
  transition: all var(--transition);
}
.slider-input input[type="number"]:hover { border-color: #b8b4a8; }
.slider-input input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}

/* ---------- Results panel ---------- */
.results {
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
}

.kpi-grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr 1fr;
}
.kpi-grid--3 {
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .kpi-grid--3 { grid-template-columns: repeat(3, 1fr); }
}
.kpi {
  padding: var(--s-4);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color var(--transition);
}
.kpi__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.kpi__value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi__value.pos { color: var(--pos); }
.kpi__value.neg { color: var(--neg); }
.kpi__hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: var(--s-2);
}

/* Hero KPI — the big, confident number */
/* Hover/tap breakdown popover for KPIs that have a "show me the math" detail */
.kpi--info {
  cursor: help;
  position: relative;
  outline: none;
}
.kpi--info:hover { border-color: var(--border-strong); }
.kpi--info:focus-visible { box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10); }
.kpi__info {
  display: inline-grid;
  place-items: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-subtle);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-style: normal;
  font-family: Georgia, serif;
  line-height: 1;
  margin-left: 4px;
  vertical-align: 2px;
  transition: background var(--transition);
}
.kpi--info:hover .kpi__info,
.kpi--info.is-open .kpi__info { background: var(--primary); }
.kpi__breakdown {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px; right: -8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: var(--s-3);
  font-size: 0.85rem;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 180ms cubic-bezier(.4,0,.2,1), transform 180ms cubic-bezier(.4,0,.2,1), visibility 180ms;
  pointer-events: none;
  min-width: 260px;
}
.kpi--info:hover .kpi__breakdown,
.kpi--info:focus-within .kpi__breakdown,
.kpi--info.is-open .kpi__breakdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.kpi__breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.kpi__breakdown-row:last-child { border-bottom: 0; }
.kpi__breakdown-row:first-child { padding-top: 0; }
.kpi__breakdown-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
}
.kpi__breakdown-label strong {
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
}
.kpi__breakdown-label small {
  color: var(--text-subtle);
  font-size: 0.75rem;
  line-height: 1.4;
}
.kpi__breakdown-value {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.kpi__breakdown-total {
  border-top: 1px solid var(--border-strong);
  border-bottom: 0 !important;
  margin-top: 4px;
  padding-top: 10px !important;
}
.kpi__breakdown-total .kpi__breakdown-label strong { color: var(--primary); font-weight: 600; }
.kpi__breakdown-total .kpi__breakdown-value { color: var(--primary); }

.kpi--hero {
  grid-column: 1 / -1;
  background: var(--primary);
  border: 0;
  color: #fff;
  padding: var(--s-5) var(--s-6);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
}
.kpi--hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 400px; height: 300px;
  background: radial-gradient(circle, rgba(74, 138, 123, 0.25), transparent 60%);
  pointer-events: none;
}
.kpi--hero .kpi__label {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.82rem;
  margin-bottom: var(--s-2);
  position: relative;
}
.kpi--hero .kpi__value {
  color: #fff;
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  position: relative;
}
.kpi--hero .kpi__hint {
  color: rgba(255, 255, 255, 0.65);
  margin-top: var(--s-2);
  font-size: 0.9rem;
  position: relative;
}

/* ---------- Tool cards (landing) ---------- */
.tool-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: 1fr;
  margin-top: var(--s-7);
}
@media (min-width: 600px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  display: flex;
  flex-direction: column;
  padding: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: inherit;
  transition: all var(--transition);
  position: relative;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  color: inherit;
}
.tool-card__icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-700);
  display: grid; place-items: center;
  margin-bottom: var(--s-4);
}
.tool-card__icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; }
.tool-card h3 { margin: 0 0 6px; color: var(--text); font-size: 1.05rem; }
.tool-card p  { margin: 0; color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }
.tool-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.tool-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-700);
  border-radius: var(--r-pill);
}
.tool-card__arrow {
  color: var(--text-subtle);
  font-size: 1.1rem;
  transition: transform var(--transition), color var(--transition);
}
.tool-card:hover .tool-card__arrow { color: var(--accent); transform: translateX(3px); }

/* ---------- Debt rows ----------
 * Two layouts:
 *   • Mobile (< 760px): each row stacks. Per-field labels visible inline.
 *   • Desktop (>= 760px): table-style — column headers above the list,
 *     individual field labels hidden so inputs get full column width.
 */
.debt-list { display: flex; flex-direction: column; gap: var(--s-3); }

/* Each debt is a card: name + remove button on top, stacked labeled fields below.
   Mirrors the visual treatment of .ef-cat__body so the two calculators feel
   consistent on mobile. */
.debt-row {
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-tint);
  transition: border-color var(--transition);
}
.debt-row:hover { border-color: var(--border-strong); }

.debt-row__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.debt-row__head .d-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
}
.debt-row__head .d-name:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}
.debt-row__head .d-remove { flex-shrink: 0; }

.debt-row__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}
.debt-row__body .field { min-width: 0; }
.debt-row__body .field input { min-width: 0; }

@media (min-width: 600px) {
  .debt-row__body { grid-template-columns: 2fr 1fr 1.5fr; }
}

.debt-warning {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  background: var(--warn-soft);
  border: 1px solid #fde68a;
  color: var(--warn);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}

/* Goal-mode date input matches the rest of our form fields */
input[type="month"] {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}
input[type="month"]:hover { border-color: #b8b4a8; }
input[type="month"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}

/* Inline feedback when the goal date is infeasible / already met */
.goal-warning {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Per-debt progress bars */
.debt-bar { margin-top: var(--s-4); }
.debt-bar:first-child { margin-top: 0; }
.debt-bar__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.92rem; margin-bottom: 6px;
}
.debt-bar__name { font-weight: 500; color: var(--text); }
.debt-bar__date { color: var(--text-muted); font-size: 0.82rem; }
.debt-bar__track {
  height: 8px;
  background: var(--surface-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.debt-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: var(--r-pill);
  transition: width 350ms cubic-bezier(.4, 0, .2, 1);
}
.debt-bar__meta {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--text-muted); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Timeline */
.timeline {
  position: relative;
  margin-top: var(--s-5);
  padding: 36px 12px 56px;
  height: auto;
  min-height: 130px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 12px; right: 12px; top: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
  border-radius: 2px;
  opacity: 0.35;
}
.timeline__node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.timeline__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--primary);
  box-shadow: 0 0 0 4px rgba(10, 37, 64, 0.06);
}
.timeline__label {
  position: absolute;
  top: 24px;
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--text);
  line-height: 1.3;
}
.timeline__label strong {
  display: block;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 2px;
}
.timeline__label span { color: var(--text-muted); }
.timeline__node:nth-child(even) .timeline__label { top: auto; bottom: 24px; }

/* Schedule table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.schedule-table th, .schedule-table td {
  padding: 11px var(--s-3);
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.schedule-table th:first-child, .schedule-table td:first-child { text-align: left; }
.schedule-table thead th {
  color: var(--text-muted); font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-tint);
  position: sticky; top: 0;
}
.schedule-table tbody tr:hover { background: var(--surface-tint); }
.schedule-wrap {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

/* ---------- Removable extra-asset field ---------- */
.field--removable { position: relative; }
.field--removable > span {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 28px; /* room for × button */
}
.field--removable .ea-label {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  width: 100%;
  font-family: inherit;
}
.field--removable .ea-label:hover { color: var(--text); }
.field--removable .ea-label:focus {
  outline: none;
  color: var(--text);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.field--removable .ea-remove {
  position: absolute;
  top: 0; right: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-subtle);
  font-size: 1.1rem;
  line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all var(--transition);
}
.field--removable .ea-remove:hover {
  color: var(--neg);
  background: var(--neg-soft);
  border-color: var(--neg);
}

/* + Add another asset… picker (looks like a ghost button, behaves like a select) */
.add-row {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px dashed var(--border);
}
.add-row select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--primary);
  padding: 10px 36px 10px 16px;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%230a2540' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.add-row select:hover {
  border-color: var(--accent);
  color: var(--accent-700);
  background-color: var(--accent-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2336695e' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
}
.add-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}

/* ---------- Suffix input (for %/yr fields) ---------- */
.suffix-input {
  position: relative;
  display: flex;
}
.suffix-input input {
  width: 100%;
  padding-right: 48px; /* room for suffix */
}
.suffix-input .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
}

/* ---------- Projection card sections ---------- */
.proj-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  margin-top: var(--s-5);
}
.proj-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s-3);
}

/* CapEx reserve rows (homeownership) — same shape as liab-detail-row */
.capex-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--r);
  align-items: end;
  margin-bottom: var(--s-3);
}
.capex-row:last-child { margin-bottom: 0; }
@media (min-width: 720px) {
  .capex-row { grid-template-columns: 1.4fr 1fr 0.9fr 0.9fr; }
}
.capex-row__name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.capex-row__name strong { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.capex-row__name .muted { font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* Per-debt detail rows (debtMode === 'detail') */
.liab-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.liab-detail-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--r);
  align-items: end;
}
@media (min-width: 720px) {
  .liab-detail-row {
    grid-template-columns: 1.4fr 0.9fr 1.1fr;
    align-items: end;
  }
}
.liab-detail-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.liab-detail-name strong {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}
.liab-detail-name .muted {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* Linked-from-Debt-Payoff banner (debtMode === 'link') */
.link-banner__filled,
.link-banner__empty {
  padding: var(--s-4);
  border-radius: var(--r);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.link-banner__empty {
  background: var(--surface-tint);
  border-left-color: var(--border-strong);
}
.link-banner__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.link-banner__head strong {
  color: var(--accent-700);
  font-size: 0.95rem;
}
.link-banner p { margin: 0 0 4px; font-size: 0.9rem; }
.link-banner p:last-child { margin-bottom: 0; }

/* Source note shown at the top of the liability breakdown popover */
.kpi__breakdown-source {
  display: inline-block;
  padding: 3px 10px;
  margin-bottom: var(--s-3);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-700);
  border-radius: var(--r-pill);
}

.proj-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

/* ---------- Net worth ---------- */
.nw-bar { margin-bottom: var(--s-4); }
.nw-bar:last-child { margin-bottom: 0; }
.nw-bar__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.92rem; margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.nw-bar__head span:last-child { color: var(--text-muted); font-weight: 500; }
.nw-bar__track {
  height: 8px;
  background: var(--surface-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.nw-bar__fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 350ms cubic-bezier(.4, 0, .2, 1);
}
.nw-bar--pos .nw-bar__fill { background: var(--accent); }
.nw-bar--neg .nw-bar__fill { background: #d97757; }

.split-bar {
  display: flex;
  height: 16px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--surface-soft);
}
.split-bar__seg {
  display: grid; place-items: center;
  font-size: 0.7rem; color: #fff; font-weight: 600;
  transition: width 300ms cubic-bezier(.4, 0, .2, 1);
}
.split-bar__seg.liquid   { background: var(--accent); }
.split-bar__seg.illiquid { background: var(--primary); }
.split-legend {
  display: flex; gap: var(--s-5); flex-wrap: wrap;
  margin-top: var(--s-3);
  font-size: 0.88rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.split-legend .dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 8px;
  vertical-align: middle;
}
.split-legend .dot.liquid   { background: var(--accent); }
.split-legend .dot.illiquid { background: var(--primary); }

.compare-grid {
  display: grid; gap: var(--s-3);
  grid-template-columns: 1fr;
  margin-top: var(--s-4);
}
@media (min-width: 600px) { .compare-grid { grid-template-columns: repeat(3, 1fr); } }
.compare-cell {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s-4);
  display: flex; flex-direction: column; gap: 4px;
  border-left: 3px solid var(--border-strong);
}
.compare-cell.pos { border-left-color: var(--pos); }
.compare-cell.neg { border-left-color: var(--neg); }
.compare-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.compare-value {
  font-size: 1.25rem; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.compare-pct {
  font-size: 0.85rem; color: var(--text-muted);
}

#nw-snapshot-select {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%235a6573' stroke-width='1.5'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
#nw-snapshot-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.10);
}

/* ---------- Emergency fund: categorized essentials ---------- */
.ef-essentials {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.ef-cat {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--transition);
}
.ef-cat[open] { border-color: var(--border-strong); }

.ef-cat summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background var(--transition);
}
.ef-cat summary::-webkit-details-marker { display: none; }
.ef-cat summary:hover { background: var(--surface-tint); }
.ef-cat summary::before {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-right: var(--s-2);
}
.ef-cat[open] summary::before { transform: rotate(45deg); }
.ef-cat__name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  font-size: 0.95rem;
}
.ef-cat__total {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-700);
  font-size: 0.9rem;
}
.ef-cat__body {
  padding: var(--s-2) var(--s-4) var(--s-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
  background: var(--surface-tint);
}
@media (min-width: 600px) {
  .ef-cat__body { grid-template-columns: 1fr 1fr; }
}

/* Total monthly essentials — prominent rollup */
.ef-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--primary);
  color: #fff;
  border-radius: var(--r);
  margin-bottom: var(--s-4);
}
.ef-total__label {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0;
}
.ef-total__value {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* "Why isn't Netflix here?" explainer note */
.info-note {
  padding: var(--s-4) var(--s-5);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}
.info-note strong {
  display: block;
  color: var(--accent-700);
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.92rem;
}
.info-note p { margin: 0; color: var(--text-muted); }

/* $-prefix decoration on essential expense inputs */
.prefix-input {
  position: relative;
  display: flex;
}
.prefix-input input {
  width: 100%;
  padding-left: 26px;
}
.prefix-input__prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  pointer-events: none;
}

/* Suffix variant — symbol sits on the right (e.g. "%" on APR fields). */
.prefix-input--suffix input {
  padding-left: 14px;
  padding-right: 26px;
}
.prefix-input__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  pointer-events: none;
}

/* ---------- Emergency fund ---------- */
.ef-progress {
  position: relative;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  overflow: hidden;
  margin: var(--s-5) 0 var(--s-3);
}
.ef-progress__fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  transition: width 400ms cubic-bezier(.4, 0, .2, 1), background 200ms ease;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}
.ef-progress__fill[data-risk="high"]   { background: linear-gradient(90deg, #fca5a5, var(--neg)); }
.ef-progress__fill[data-risk="medium"] { background: linear-gradient(90deg, #fcd34d, var(--warn)); }
.ef-progress__fill[data-risk="low"]    { background: linear-gradient(90deg, var(--accent), var(--pos)); }

.risk {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r);
  background: var(--surface-tint);
  border-left: 3px solid var(--border-strong);
}
.risk[data-risk="high"]   { background: var(--neg-soft);  border-left-color: var(--neg); }
.risk[data-risk="medium"] { background: var(--warn-soft); border-left-color: var(--warn); }
.risk[data-risk="low"]    { background: var(--pos-soft);  border-left-color: var(--pos); }
.risk__label {
  font-weight: 600; display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}
.risk__note { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Monetization placeholders ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-tint);
  color: var(--text-subtle);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin: var(--s-7) 0;
}
.affiliate-block {
  margin-top: var(--s-5);
  padding: var(--s-5);
  border-radius: var(--r);
  background: var(--surface-tint);
  border: 1px solid var(--border);
}
.affiliate-block h4 {
  margin: 0 0 var(--s-3);
  color: var(--text);
  font-size: 0.95rem;
  display: flex; align-items: center; gap: var(--s-2);
}
.affiliate-block h4::before {
  content: '';
  width: 4px; height: 16px;
  background: var(--accent);
  border-radius: 2px;
}
.affiliate-block ul {
  margin: 0; padding-left: var(--s-5);
  color: var(--text); font-size: 0.92rem;
  line-height: 1.7;
}
.affiliate-block .muted { font-size: 0.78rem; margin-top: var(--s-3); margin-bottom: 0; }

.email-capture {
  background: var(--primary);
  color: #fff;
  border-radius: var(--r-lg);
  padding: var(--s-7) var(--s-6);
  margin: var(--s-9) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.email-capture::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(74, 138, 123, 0.2), transparent 60%);
  pointer-events: none;
}
.email-capture > * { position: relative; }
.email-capture h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: var(--s-2);
}
.email-capture p {
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: var(--s-5);
  max-width: 520px;
  margin-left: auto; margin-right: auto;
}
.email-capture form {
  display: flex; gap: var(--s-2);
  max-width: 480px; margin: 0 auto;
  flex-wrap: wrap; justify-content: center;
}
.email-capture input[type="email"] {
  flex: 1; min-width: 220px;
  padding: 12px 16px;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: var(--r-sm);
  transition: all var(--transition);
}
.email-capture input[type="email"]::placeholder { color: rgba(255, 255, 255, 0.5); }
.email-capture input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(74, 138, 123, 0.25);
}

/* ---------- Landing tool groups (Phase 2) ---------- */
.tools-section {
  padding: var(--s-7) 0 var(--s-6);
}
.tool-group { margin-bottom: var(--s-7); }
.tool-group:last-child { margin-bottom: 0; }
.tool-group h2 {
  font-size: 1.25rem;
  margin: 0 0 var(--s-4);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.tool-group .tool-grid { margin-top: 0; }

/* ---------- Landing-page features grid ---------- */
.features {
  padding: var(--s-8) 0 var(--s-6);
  border-top: 1px solid var(--border);
}
.features__grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .features__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .features__grid { grid-template-columns: repeat(4, 1fr); } }
.feature {
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.feature__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-700);
  display: grid; place-items: center;
  margin-bottom: var(--s-3);
}
.feature__icon svg { width: 20px; height: 20px; }
.feature h3 { margin: 0 0 4px; font-size: 1rem; }
.feature p  { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }

/* ---------- Cross-links section (bottom of each calculator page) ---------- */
.cross-links {
  padding: var(--s-8) 0 var(--s-6);
  border-top: 1px solid var(--border);
}
.cross-links h2 {
  font-size: 1.5rem;
  margin-bottom: var(--s-2);
}
.cross-links .tool-grid {
  margin-top: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .cross-links .tool-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: var(--s-8) 0 var(--s-6);
  margin-top: var(--s-9);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--primary); }
.footer-grid {
  display: grid; gap: var(--s-6);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 {
  color: var(--text);
  margin: 0 0 var(--s-3);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: var(--s-2); font-size: 0.92rem; }
.site-footer .legal {
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-subtle);
}
.site-footer .legal p { margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: all 250ms cubic-bezier(.4, 0, .2, 1);
  z-index: 100;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--ok    { background: var(--pos); }
.toast--error { background: var(--neg); }
.toast--info  { background: var(--primary); }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ===== Email gate modal ===== */
.email-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 41, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--s-3, 1rem);
  animation: email-gate-fade 0.18s ease-out;
}
.email-gate-dialog {
  background: #fff;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  padding: 2rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(10, 25, 41, 0.35);
}
.email-gate-dialog h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.email-gate-dialog > p {
  color: #5a6573;
  margin-top: 0;
  margin-bottom: 1.25rem;
}
.email-gate-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: 0;
  font-size: 1.75rem;
  cursor: pointer;
  color: #5a6573;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}
.email-gate-close:hover { color: #0a2540; }
@keyframes email-gate-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.email-gate-dialog .formkit-fields {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: stretch;
}
.email-gate-dialog .formkit-field,
.email-gate-dialog .formkit-submit {
  margin: 0;
}
.email-gate-dialog .formkit-field { flex: 1 1 60%; }
.email-gate-dialog .formkit-submit { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 480px) {
  .email-gate-dialog .formkit-fields { flex-wrap: wrap; }
  .email-gate-dialog .formkit-field,
  .email-gate-dialog .formkit-submit { flex: 1 1 100%; }
}
