/* Same system as dscr-calculator (type, spacing, fields, cards); own accent and a cream paper from the Canva art. */
:root {
  color-scheme: light;
  --paper: #F6F4EC;
  --panel: #FFFFFF;
  --ink: #1E2A2D;
  --muted: #566467;
  --line: #DDDAD0;
  --field: #AEB3AA;
  --accent: #1F6F4A;
  --pos: #1F6F4A;  --pos-bg: #E2F0E7;
  --warn: #8F5600; --warn-bg: #FDEFD8;
  --neg: #B23A2E;  --neg-bg: #FBE7E3;
  /* Expense bar, fixed order (validated: dataviz validate_palette, adjacent pairs, white surface). */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
[data-tone="pos"], [data-tone="pass"] { --tone: var(--pos); --tone-bg: var(--pos-bg); }
[data-tone="warn"] { --tone: var(--warn); --tone-bg: var(--warn-bg); }
[data-tone="neg"], [data-tone="fail"] { --tone: var(--neg); --tone-bg: var(--neg-bg); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 7vw, 2.75rem); font-weight: 760; margin: 0 0 8px; }
h2 { font-size: 1.5rem; font-weight: 700; margin: 40px 0 12px; }
h3 { font-size: 1.15rem; font-weight: 680; margin: 28px 0 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; font-weight: 680; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 6px; }

.intro { padding: 28px 0 20px; max-width: 62ch; }
.lede { font-size: 1.125rem; color: var(--muted); margin: 0; }
.note { background: var(--warn-bg); padding: 10px 14px; border-radius: 8px; }

/* Calculator: one column on phones, inputs | results from 900px. */
.calc { display: grid; gap: 16px; }
.pill {
  position: sticky; top: 0; z-index: 2; margin: 0 -16px 12px;
  padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
  font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
}
.pill b { font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--tone, var(--ink)); }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .pill { display: none; }
}

fieldset { margin: 0 0 16px; padding: 8px 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-width: 0; }
fieldset:last-child { margin-bottom: 0; }
legend { padding: 0 6px; margin-left: -6px; font-weight: 700; font-size: 1.05rem; }
.field { display: grid; gap: 6px; margin-top: 14px; min-width: 0; }
legend + .field, legend + .row > .field:first-child, legend + .row > .field:nth-child(2) { margin-top: 2px; }
.field > label { font-weight: 560; }
.row { display: grid; gap: 0 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.affix {
  display: flex; align-items: center; min-height: 48px;
  border: 1px solid var(--field); border-radius: 8px; background: var(--panel);
}
.affix:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.affix span { padding: 0 12px; color: var(--muted); white-space: nowrap; }
.affix span:first-child { padding-right: 0; }
.affix input:first-child { padding-left: 12px; }
input, select { font: inherit; font-size: 1.0625rem; color: var(--ink); }
.affix input {
  flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0 8px;
  border: 0; background: transparent; font-variant-numeric: tabular-nums;
}
.affix input:focus { outline: none; }
select {
  min-height: 48px; padding: 0 36px 0 12px; border: 1px solid var(--field); border-radius: 8px;
  -webkit-appearance: none; appearance: none; background-color: var(--panel);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.hint { margin: 6px 0 0; font-size: 0.9rem; color: var(--muted); }

/* Results */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px 20px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 6px; }
.card h3 { font-size: 1rem; margin: 22px 0 10px; }
.result { border-top: 6px solid var(--tone, var(--line)); }
.ratio { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.big { font-size: clamp(3.5rem, 16vw, 4.75rem); font-weight: 760; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--tone, var(--ink)); }
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  color: var(--tone, var(--muted)); background: var(--tone-bg, var(--paper));
  font-weight: 680; font-size: 0.95rem; white-space: nowrap;
}
.annual { margin: 8px 0 0; color: var(--muted); }
.annual b { color: var(--ink); font-variant-numeric: tabular-nums; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.metrics div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.metrics dt { font-size: 0.875rem; color: var(--muted); }
.metrics dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; }
.metrics dd small { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }

.bar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; background: var(--line); }
.bar span { flex: 0 0 0; min-width: 0; }
.legend { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.95rem; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.2em; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.legend li[hidden] { display: none; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend b, .legend small { text-align: right; font-variant-numeric: tabular-nums; }
.legend b { font-weight: 600; }
.legend small { color: var(--muted); font-size: 0.85rem; }
.inout { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.inout b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.btn {
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 650;
}
.btn:hover { background: #17583A; }
#share-status { color: var(--muted); font-size: 0.9rem; }

.checks { list-style: none; margin: 4px 0 0; padding: 0; }
.checks li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; padding-bottom: 0; }
.checks .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 680; }
.checks p { margin: 4px 0 0; font-size: 0.95rem; color: var(--muted); }
.checks b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.out-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }

.targets { margin: 4px 0 0; display: grid; grid-template-columns: 1fr auto; font-variant-numeric: tabular-nums; }
.targets dt, .targets dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.targets dd { text-align: right; font-weight: 700; }
.small { font-size: 0.875rem; color: var(--muted); margin: 10px 0 0; }

/* Reserved for ads later, so adding them shifts nothing. Empty until then. */
.ad-slot { min-height: 250px; margin: 16px 0; }

/* Article */
.guide, .faq, .disclaimer, .prose { max-width: 68ch; }
.guide { margin-top: 24px; }
.guide ul, .guide ol { padding-left: 1.2em; }
.guide li { margin-bottom: 10px; }
.formula {
  margin: 18px 0; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums;
}
.formula span { display: block; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.guide table { border-collapse: collapse; min-width: 560px; width: 100%; font-size: 0.95rem; }
.guide th, .guide td { padding: 10px 12px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.guide thead th { border-bottom: 2px solid var(--ink); }
.guide tbody th { font-weight: 650; }
.faq h2 { margin-top: 8px; }
.disclaimer { margin: 32px 0 48px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 0.95rem; }
.disclaimer p { margin: 0; }

.prose { padding-top: 28px; padding-bottom: 48px; }
.prose h1 { font-size: clamp(1.9rem, 6vw, 2.4rem); }
.prose ul { padding-left: 1.2em; }

.foot { border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 0.95rem; padding: 18px 0 28px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot nav a { display: inline-flex; align-items: center; min-height: 44px; }
.foot p { margin: 8px 0 0; }
