/* ============================================================================
   PathForward public calculators — shared styles (/calculators/*)
   ============================================================================
   The app's palette in page form: warm cream and white in light, deep forest
   in dark, forest green for action, gold for the one thing to notice.
   data-theme is set before paint by each page's head script (the saved
   pff_theme, else the device's setting), exactly as Landing.html does. */
:root {
  --cx-bg: #f7f3ea;
  --cx-surface: #ffffff;
  --cx-surface-2: #fbf8f1;
  --cx-line: #e5ddcd;
  --cx-ink: #17231c;
  --cx-muted: #56615b;
  --cx-forest: #123524;
  --cx-forest-2: #1b4a31;
  --cx-green: #2e7d32;
  --cx-green-hover: #276a2b;
  --cx-green-ink: #1f6b2a;
  --cx-green-tint: rgba(46, 125, 50, .08);
  --cx-gold: #f2c14e;
  --cx-gold-hover: #ffd36a;
  --cx-gold-tint: rgba(242, 193, 78, .18);
  --cx-red: #b3261e;
  --cx-red-tint: rgba(179, 38, 30, .07);
  --cx-blue: #1a5fb4;
  --cx-a: #2e7d32;
  --cx-b: #1a5fb4;
  --cx-c: #8a938d;
  --cx-shadow: 0 1px 2px rgba(23, 35, 28, .05), 0 8px 24px rgba(23, 35, 28, .06);
  --cx-radius: 18px;
  color-scheme: light;
}
[data-theme="dark"] {
  --cx-bg: #0e1612;
  --cx-surface: #15201a;
  --cx-surface-2: #1a271f;
  --cx-line: #2a392f;
  --cx-ink: #eef3ef;
  --cx-muted: #a8b5ac;
  --cx-forest: #0b2217;
  --cx-forest-2: #133222;
  --cx-green-ink: #7fd98c;
  --cx-green-tint: rgba(127, 217, 140, .09);
  --cx-gold-tint: rgba(242, 193, 78, .14);
  --cx-red: #ff8f85;
  --cx-red-tint: rgba(255, 143, 133, .09);
  --cx-blue: #8ab4ff;
  --cx-a: #6fcf7c;
  --cx-b: #8ab4ff;
  --cx-c: #6f7b73;
  --cx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cx-bg); color: var(--cx-ink);
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cx-blue); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cx-blue); outline-offset: 2px; }
.cx-skip { position: absolute; left: -9999px; top: 8px; z-index: 10; padding: 10px 14px; border-radius: 10px; background: var(--cx-surface); color: var(--cx-ink); }
.cx-skip:focus { left: 8px; }
.cx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cx-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Header */
.cx-header { border-bottom: 1px solid var(--cx-line); background: var(--cx-surface); }
.cx-header .cx-wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.cx-logo { display: inline-flex; align-items: center; margin-right: auto; }
.cx-logo img { height: 40px; width: auto; display: block; }
.cx-logo .for-dark { display: none; }
[data-theme="dark"] .cx-logo .for-dark { display: block; }
[data-theme="dark"] .cx-logo .for-light { display: none; }
.cx-nav { display: flex; align-items: center; gap: 6px; }
.cx-nav a { padding: 8px 12px; border-radius: 10px; color: var(--cx-ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.cx-nav a:hover, .cx-nav a[aria-current="page"] { background: var(--cx-green-tint); color: var(--cx-green-ink); }
.cx-theme {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--cx-line); background: var(--cx-surface-2);
  color: var(--cx-ink); font-size: 1.05rem; cursor: pointer; display: grid; place-items: center;
}
.cx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 999px; background: var(--cx-green); color: #fff; font: inherit; font-weight: 800; font-size: .95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.cx-btn:hover { background: var(--cx-green-hover); }
.cx-btn.is-gold { background: var(--cx-gold); color: #123524; }
.cx-btn.is-gold:hover { background: var(--cx-gold-hover); }
.cx-btn.is-quiet { background: transparent; color: var(--cx-ink); border: 1.5px solid var(--cx-line); }
.cx-btn.is-quiet:hover { background: var(--cx-surface-2); }
@media (max-width: 720px) {
  .cx-nav .cx-hide-sm { display: none; }
  .cx-logo img { height: 34px; }
  .cx-header .cx-wrap { gap: 8px; }
  .cx-btn { padding: 10px 14px; }
}

/* Hero */
.cx-hero { padding: 36px 0 18px; }
.cx-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 5px 12px; border-radius: 999px;
  background: var(--cx-gold-tint); color: var(--cx-ink); font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.cx-hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.cx-lead { margin: 0; max-width: 62ch; font-size: 1.1rem; color: var(--cx-muted); }

/* The tool: inputs beside results on wide screens */
.cx-tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; padding: 10px 0 36px; }
@media (max-width: 960px) { .cx-tool { grid-template-columns: 1fr; } }
.cx-card { background: var(--cx-surface); border: 1px solid var(--cx-line); border-radius: var(--cx-radius); box-shadow: var(--cx-shadow); padding: 22px; min-width: 0; }
.cx-card h2 { margin: 0 0 14px; font-size: 1.15rem; font-weight: 800; }
.cx-results { position: sticky; top: 16px; }
@media (max-width: 960px) { .cx-results { position: static; } }

/* Fields */
.cx-field { display: grid; gap: 6px; margin: 0 0 14px; }
.cx-label { font-size: .86rem; font-weight: 700; color: var(--cx-ink); }
.cx-hint { font-size: .8rem; color: var(--cx-muted); margin-top: -2px; }
.cx-input, .cx-select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--cx-line); border-radius: 12px;
  background: var(--cx-surface-2); color: var(--cx-ink); font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums;
}
.cx-input:focus, .cx-select:focus { border-color: var(--cx-green); outline: 3px solid var(--cx-green-tint); outline-offset: 0; }
.cx-money, .cx-pct { position: relative; display: block; }
.cx-money > span, .cx-pct > span { position: absolute; top: 50%; transform: translateY(-50%); color: var(--cx-muted); font-weight: 700; pointer-events: none; }
.cx-money > span { left: 12px; }
.cx-money > .cx-input { padding-left: 26px; }
.cx-pct > span { right: 12px; }
.cx-pct > .cx-input { padding-right: 30px; }
.cx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .cx-two { grid-template-columns: 1fr; } }

/* Rows of debts or bills */
.cx-rows { display: grid; gap: 10px; margin: 0 0 12px; }
.cx-row { display: grid; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--cx-line); border-radius: 14px; background: var(--cx-surface-2); }
/* Each row: the name (and remove) on top, the amounts in a line beneath —
   at every width, so nothing is ever cut off mid-number. */
.cx-row.is-debt { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.cx-row.is-bill { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; }
.cx-row .cx-name { grid-column: 1 / -2; }
.cx-row .cx-x { grid-column: -2 / -1; grid-row: 1; align-self: end; }
.cx-row.is-bill .cx-name { grid-column: 1 / -2; }
.cx-row .cx-field { margin: 0; }
.cx-row .cx-label { font-size: .76rem; color: var(--cx-muted); }
.cx-row .cx-input { min-height: 42px; padding-top: 8px; padding-bottom: 8px; background: var(--cx-surface); }
.cx-x { width: 42px; height: 42px; border: 0; border-radius: 12px; background: none; color: var(--cx-muted); font-size: 1.3rem; cursor: pointer; }
.cx-x:hover { background: var(--cx-red-tint); color: var(--cx-red); }
.cx-add { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 14px; border: 1.5px dashed var(--cx-line);
  border-radius: 12px; background: none; color: var(--cx-green-ink); font: inherit; font-weight: 800; cursor: pointer; }
.cx-add:hover { background: var(--cx-green-tint); }
.cx-tools-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.cx-link { background: none; border: 0; padding: 6px 2px; color: var(--cx-blue); font: inherit; font-size: .88rem; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Results */
.cx-head { margin: 0 0 4px; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cx-muted); }
.cx-big { margin: 0; font-size: clamp(1.7rem, 3.6vw, 2.4rem); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.cx-big em { font-style: normal; color: var(--cx-green-ink); }
.cx-sub { margin: 6px 0 0; color: var(--cx-muted); font-size: .98rem; }
.cx-tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--cx-surface-2); border: 1px solid var(--cx-line); margin: 0 0 16px; }
.cx-tab { min-height: 38px; padding: 6px 16px; border: 0; border-radius: 999px; background: none; color: var(--cx-muted); font: inherit; font-weight: 800; cursor: pointer; }
.cx-tab[aria-pressed="true"] { background: var(--cx-surface); color: var(--cx-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cx-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.cx-stat { padding: 12px 14px; border-radius: 14px; background: var(--cx-surface-2); border: 1px solid var(--cx-line); }
.cx-stat dt { font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--cx-muted); }
.cx-stat dd { margin: 4px 0 0; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cx-stat dd small { display: block; font-size: .8rem; font-weight: 600; color: var(--cx-muted); }
.cx-note { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; font-size: .92rem; line-height: 1.5; background: var(--cx-green-tint); color: var(--cx-ink); }
.cx-note strong { color: var(--cx-green-ink); }
.cx-note.is-warn { background: var(--cx-red-tint); }
.cx-note.is-warn strong { color: var(--cx-red); }
.cx-note.is-gold { background: var(--cx-gold-tint); }
.cx-chart { margin: 16px 0 6px; }
.cx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.cx-chart .ax { stroke: var(--cx-line); stroke-width: 1; }
.cx-chart .zero { stroke: var(--cx-red); stroke-width: 1.2; stroke-dasharray: 4 4; }
.cx-chart text { fill: var(--cx-muted); font-size: 11px; font-family: inherit; }
.cx-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 0; font-size: .84rem; color: var(--cx-muted); }
.cx-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.cx-legend i.is-dash { background: repeating-linear-gradient(90deg, var(--cx-c) 0 5px, transparent 5px 9px) !important; }
.cx-order { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: cx; }
.cx-order li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--cx-surface-2); border: 1px solid var(--cx-line); counter-increment: cx; }
.cx-order li::before { content: counter(cx); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--cx-forest-2); color: #fff; font-size: .8rem; font-weight: 800; }
.cx-order b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-order small { color: var(--cx-muted); font-size: .82rem; }
.cx-order .when { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-order .when small { display: block; font-weight: 600; }
.cx-pays { display: grid; gap: 10px; margin: 14px 0 0; }
.cx-pay { border: 1px solid var(--cx-line); border-radius: 14px; overflow: hidden; }
.cx-pay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; background: var(--cx-surface-2); font-weight: 800; }
.cx-pay-head small { color: var(--cx-muted); font-weight: 600; }
.cx-pay ul { list-style: none; margin: 0; padding: 4px 14px; }
.cx-pay li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--cx-line); font-size: .93rem; }
.cx-pay li:last-child { border-bottom: 0; }
.cx-pay li span:last-child, .cx-pay-left b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-pay-left { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--cx-line); font-weight: 700; }
.cx-pay-left.is-short { background: var(--cx-red-tint); color: var(--cx-red); }
.cx-pay-left.is-ok b { color: var(--cx-green-ink); }
.cx-empty { color: var(--cx-muted); font-size: .92rem; padding: 8px 0; }
.cx-bar { height: 12px; border-radius: 999px; background: var(--cx-surface-2); border: 1px solid var(--cx-line); overflow: hidden; margin: 12px 0 6px; }
.cx-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--cx-green), #57a85f); border-radius: 999px; }
.cx-bar-legend { display: flex; justify-content: space-between; font-size: .82rem; color: var(--cx-muted); font-variant-numeric: tabular-nums; }

/* Save / start band inside the results */
.cx-save { margin: 18px 0 0; padding: 16px; border-radius: 16px; background: var(--cx-forest); color: #fff; display: grid; gap: 10px; }
.cx-save p { margin: 0; color: #fff; font-size: .95rem; line-height: 1.5; }
.cx-save p strong { color: var(--cx-gold); }
.cx-save .cx-btn { justify-self: start; }
.cx-save small { color: #cfe0d4; font-size: .8rem; }

/* Article + FAQ below the tool */
.cx-article { padding: 8px 0 40px; }
.cx-article .cx-wrap > section { max-width: 760px; }
.cx-article h2 { margin: 30px 0 10px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.cx-article p, .cx-article li { font-size: 1.02rem; color: var(--cx-ink); }
.cx-article p { margin: 0 0 12px; }
.cx-faq details { border: 1px solid var(--cx-line); border-radius: 14px; background: var(--cx-surface); margin: 0 0 10px; }
.cx-faq summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.cx-faq summary::-webkit-details-marker { display: none; }
.cx-faq summary::after { content: '+'; font-weight: 800; color: var(--cx-muted); }
.cx-faq details[open] summary::after { content: '−'; }
.cx-faq details > div { padding: 0 16px 14px; color: var(--cx-ink); }
.cx-faq details > div p:last-child { margin-bottom: 0; }

/* The closing band */
.cx-band { background: linear-gradient(135deg, var(--cx-forest), var(--cx-forest-2)); color: #fff; padding: 36px 0; }
.cx-band .cx-wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cx-band h2 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 800; color: #fff; }
.cx-band p { margin: 0; max-width: 60ch; color: #d7e6dc; }
.cx-band .cx-btn { font-size: 1rem; min-height: 50px; padding: 12px 24px; }

/* Hub cards */
.cx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; padding: 10px 0 40px; }
.cx-tile { display: grid; gap: 8px; align-content: start; padding: 22px; border-radius: var(--cx-radius); background: var(--cx-surface); border: 1px solid var(--cx-line);
  box-shadow: var(--cx-shadow); color: var(--cx-ink); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.cx-tile:hover { transform: translateY(-2px); border-color: var(--cx-green); }
.cx-tile .ic { font-size: 1.8rem; line-height: 1; }
.cx-tile h2 { margin: 4px 0 0; font-size: 1.25rem; font-weight: 800; }
.cx-tile p { margin: 0; color: var(--cx-muted); }
.cx-tile .go { margin-top: 6px; color: var(--cx-green-ink); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .cx-tile { transition: none; } .cx-tile:hover { transform: none; } }

/* Footer */
.cx-footer { border-top: 1px solid var(--cx-line); background: var(--cx-surface); padding: 24px 0 36px; font-size: .9rem; color: var(--cx-muted); }
.cx-footer .cx-wrap { display: grid; gap: 12px; }
.cx-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cx-footer a { color: var(--cx-ink); font-weight: 600; text-decoration: none; }
.cx-footer a:hover { text-decoration: underline; }
.cx-footer p { margin: 0; max-width: 80ch; }
.cx-rows.is-spaced { margin-top: 12px; }
.cx-field.is-spaced, .cx-head.is-spaced { margin-top: 18px; }
@media (max-width: 600px) { .cx-wrap { padding: 0 16px; } .cx-card { padding: 18px 16px; } }
@media (max-width: 480px) { .cx-nav { display: none; } .cx-logo img { height: 30px; } }
@media (max-width: 600px) { .cx-stat dd { font-size: 1.15rem; } }
.cx-card h2.is-spaced-h { margin-top: 24px; }
.cx-big em.is-red { color: var(--cx-red); }
.cx-due { color: var(--cx-muted); font-size: .8rem; margin-left: 4px; font-weight: 600; }
.cx-range { display: flex; gap: 8px; flex-wrap: wrap; }
.cx-chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--cx-line); background: var(--cx-surface-2); color: var(--cx-ink); font: inherit; font-weight: 700; cursor: pointer; }
.cx-chip[aria-pressed="true"] { border-color: var(--cx-green); background: var(--cx-green-tint); color: var(--cx-green-ink); }
