/* Early-retirement「5 条线自测」calculator (/labs/zh/fire/). Loaded after site.css (same paper / ink palette and fonts);
   not with calc.css or calc-ss.css. Ported from the 财智极客 episode-6 standalone page's style.css: its own header, fonts
   and page chrome are dropped for the Labs ones, and site.css's defaults for wide data tables are undone for the
   check-up sheet. Only this page loads it, so most class names are not scoped; rules that override site.css are scoped
   to .fire-page. No inline styles: the page is served under style-src 'self'.
   Result colours: the episode-2 (Social Security calculator) green / orange pair, validated on #fbf8f2. */
.fire-page {
  --surface: #fbf8f2; --grid: #e7e0d3; --accent: #1c5cab; --measure: 44rem;
  --ok: #1b8f68; --ok-bg: #e2f1ea; --ok-ink: #0d5a40;
  --off: #d0582a; --off-bg: #fbe4d8; --off-ink: #86300c;
  --you: #1d1b18; --warn-bg: #fbe9dc; --warn-ink: #7a3410;
}
.fire-page [hidden] { display: none !important; }
.fire-page .hero { padding-bottom: 0.6rem; }
.fire-page h4 { font-size: 0.98rem; margin: 0 0 0.3rem; }
.fire-page code { font-size: 0.88em; background: var(--paper-deep); padding: 0.05rem 0.3rem; border-radius: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0; }
.badge { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); border: 1px solid var(--rule); background: var(--surface);
  border-radius: 999px; padding: 0.18rem 0.75rem; }
.boot { margin: 1.6rem 0 0; padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper-deep);
  color: var(--ink-soft); font-size: 0.92rem; }

/* ---- layout */
.calc { display: grid; gap: clamp(1.4rem, 3vw, 2.6rem); grid-template-columns: minmax(0, 1fr); margin-top: 1.8rem; }
@media (min-width: 64rem) { .calc { grid-template-columns: minmax(0, 23.5rem) minmax(0, 1fr); align-items: start; } }

/* ---- form */
.calc-form { background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 14px; padding: 1.3rem 1.3rem 1.2rem; }
.calc-form h2 { margin-bottom: 0.4rem; }
.form-note { margin: 0 0 1rem; font-size: 0.86rem; color: var(--ink-soft); }
.calc-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.calc-form fieldset.group { border-top: 1px solid var(--rule); padding-top: 0.85rem; margin-top: 0.4rem; margin-bottom: 0.4rem; }
.calc-form fieldset.inner { margin: 0 0 1rem; }
.calc-form legend { font-weight: 700; font-size: 1rem; margin-bottom: 0.45rem; padding: 0; }
.calc-form fieldset.inner legend { font-size: 0.95rem; }
.calc-form .field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.3rem; margin-bottom: 0.9rem; min-width: 0; align-content: start; }
.calc-form label, .calc-form .label { font-weight: 700; font-size: 0.92rem; }
.calc-form .hint { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.5; font-weight: 400; }
.calc-form .hint a { color: var(--accent); }
.calc-form fieldset > p.hint { margin: -0.3rem 0 0.9rem; }
.calc-form input[type=number], .calc-form input[type=text], .calc-form select { font: inherit; font-variant-numeric: tabular-nums;
  width: 100%; min-width: 0; padding: 0.5rem 0.65rem; border: 1px solid #cfc5b2; border-radius: 8px; background: var(--surface); color: var(--ink); }
.calc-form input::placeholder { color: #8f887c; }
.calc-form select { padding-right: 0.4rem; }
.calc-form input:hover, .calc-form select:hover { border-color: var(--ink-soft); }
.calc-form :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.calc-form .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 0.8rem; }
.money-row { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.money-row .prefix, .money-row .unit { color: var(--muted); font-weight: 700; }
.money-row input { flex: 1 1 5rem; }
.calc-form .radios { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; margin-bottom: 0.7rem; }
.calc-form .radios label { font-weight: 400; display: inline-flex; gap: 0.45rem; align-items: center; cursor: pointer; }
.calc-form .radios.stack { flex-direction: column; gap: 0.5rem; }
.calc-form .radios.stack label { align-items: flex-start; }
.calc-form .radios.stack input { margin-top: 0.35rem; }
.calc-form .radios.stack b { font-weight: 700; font-size: 0.92rem; }
.calc-form input[type=radio], .calc-form input[type=checkbox] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.calc-form .seg label { font-weight: 400; font-size: 0.88rem; display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  border: 1px solid #cfc5b2; background: var(--surface); border-radius: 999px; padding: 0.2rem 0.75rem 0.2rem 0.5rem; }
.calc-form .seg label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.calc-form .seg label:hover { border-color: var(--ink-soft); }
.link-note { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 0.85rem; margin: 0.5rem 0 0.7rem; }
.fire-page .actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin-top: 0; }
.example { font-size: 0.9rem; font-weight: 700; color: var(--accent); }
.calc-form .reset { font: inherit; font-size: 0.9rem; background: none; border: 1px solid var(--ink-soft); color: var(--ink);
  border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; }
.calc-form .reset:hover { background: var(--surface); }
.calc-form .reset:active { transform: translateY(1px); }

/* ---- results */
.calc-results { min-width: 0; }
.calc-results h2 { margin-bottom: 0.8rem; }
.calc-results .status { margin: 0 0 1rem; max-width: var(--measure); padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--warn-bg);
  color: var(--warn-ink); border: 1px solid #efc6a8; font-size: 0.88rem; }

/* tables: undo site.css's defaults for wide data tables (min-width, nowrap columns, pinned row heads, uppercase heads,
   a ruled top, row hover) */
.fire-page .table-wrap { overflow-x: auto; margin-top: 0.8rem; border-top: 0; }
.fire-page table { min-width: 0; }
.fire-page tbody tr:hover, .fire-page tbody tr:hover th { background: none; }
.fire-page tbody th { position: static; box-shadow: none; background: none; }

/* the check-up sheet: a clipboard-like table */
.fire-page table.checkup { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
.fire-page table.checkup thead th { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-align: left; padding: 0.7rem 0.9rem 0.5rem;
  border-bottom: 2px solid var(--ink); letter-spacing: 0.04em; text-transform: none; background: var(--surface); }
.fire-page table.checkup tbody th, .fire-page table.checkup td { padding: 0.85rem 0.9rem; border-top: 1px solid var(--rule); border-bottom: 0;
  text-align: left; vertical-align: top; font-size: 0.93rem; white-space: normal; }
.fire-page table.checkup tbody tr:first-child th, .fire-page table.checkup tbody tr:first-child td { border-top: 0; }
.fire-page table.checkup tbody th { font-weight: 700; font-size: 1rem; width: 24%; padding-left: 0.9rem; background: var(--surface); }
.fire-page table.checkup td.mine { font-weight: 700; width: 36%; }
.fire-page table.checkup td.range { color: var(--ink-soft); width: 26%; }
.fire-page table.checkup td.result { width: 14%; white-space: nowrap; }
.fire-page table.checkup tbody tr:hover, .fire-page table.checkup tbody tr:hover th { background: var(--surface); }
.verdict { display: inline-block; font-weight: 700; font-size: 0.9rem; border-radius: 6px; padding: 0.12rem 0.55rem; }
.v-ok { background: var(--ok-bg); color: var(--ok-ink); }
.v-low, .v-high { background: var(--off-bg); color: var(--off-ink); }
.v-none { background: var(--paper-deep); color: var(--muted); font-weight: 400; }
.fire-page table.checkup tr.r-withdraw td.mine, .fire-page table.checkup tr.r-withdraw th { font-size: 1.02rem; }
p.verdict { display: block; font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); line-height: 1.5; border-radius: 0;
  margin: 1.1rem 0 0.2rem; padding: 0 0 0 0.8rem; border-left: 5px solid var(--off); max-width: var(--measure); }
p.verdict.pass { border-left-color: var(--ok); }

.block { margin-top: 2.3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.block h3 { font-size: 1.12rem; margin-bottom: 0.5rem; }
.sub-note, .note-line { color: var(--ink-soft); font-size: 0.93rem; max-width: var(--measure); margin: 0.2rem 0 0.6rem; }
.note-line { margin: 0.5rem 0; }
.note-line.strong { color: var(--ink); font-weight: 700; }
.note-line.caution { border-left: 3px solid var(--off); padding-left: 0.8rem; }
.note-line:empty { display: none; }
ul.plain { margin: 0.4rem 0 0.6rem; padding-left: 1.2rem; max-width: var(--measure); }
ul.plain li { margin: 0.35rem 0; color: var(--ink-soft); font-size: 0.93rem; }
.person { border-left: 4px solid var(--ok); padding: 0.1rem 0 0.1rem 0.9rem; margin: 0.8rem 0; max-width: var(--measure); }
.person.warn { border-left-color: var(--off); }
.person ul.plain { margin-top: 0.2rem; }

/* Social Security table */
.fire-page table.data { border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; width: 100%; max-width: 46rem; }
.fire-page table.data th, .fire-page table.data td { padding: 0.42rem 0.7rem 0.42rem 0; border-top: 1px solid var(--rule); border-bottom: 0;
  text-align: right; white-space: nowrap; vertical-align: baseline; }
.fire-page table.data thead th { border-top: 0; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.fire-page table.data th:first-child { text-align: left; }
.fire-page table.data tbody th { font-weight: 700; padding-left: 0; }
.fire-page table.data tr.short td { color: var(--off-ink); }

/* charts */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; padding: 0; margin: 0.4rem 0 0.2rem; font-size: 0.84rem; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
span.swatch { display: inline-block; width: 1.1rem; height: 0.22rem; border-radius: 2px; flex: none; background: var(--accent); }
span.swatch.s-you { background: none; height: 0; border-top: 2px dashed var(--you); }
span.swatch.s-fail { background: var(--off); width: 0.22rem; height: 0.8rem; }
.chart-fig { margin: 1rem 0 0.4rem; min-width: 0; max-width: 52rem; }
.chart-fig figcaption { font-size: 0.88rem; font-weight: 700; color: var(--ink-soft); margin: 0 0 0.1rem; }
.chart { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 0.3rem 0.2rem 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* SVG marks */
.chart svg text { font-family: var(--font); }
.axis .gridline { stroke: var(--grid); stroke-width: 1; }
.axis .baseline { stroke: #b9b0a2; stroke-width: 1; }
.tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s-req { stroke: var(--accent); stroke-width: 1.6; }
.line.s-net { stroke: var(--accent); stroke-width: 2.2; }
.area.s-net { fill: var(--accent); opacity: 0.12; }
.ref { stroke: var(--you); stroke-width: 1.4; stroke-dasharray: 5 4; }
.ref.s-cliff { stroke: var(--off); stroke-width: 1.4; }
.ref-label { font-size: 12px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.rug line { stroke: var(--off); stroke-width: 1; }
circle.mark { stroke: var(--surface); stroke-width: 2; fill: var(--ink); }
circle.mark.s-fail { fill: var(--off); }
circle.mark.s-req, circle.mark.s-net { fill: var(--accent); }
circle.mark.s-you { fill: var(--you); }
.mark-label { font-size: 12.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.hit { fill: transparent; cursor: crosshair; }
.crosshair { stroke: var(--ink-soft); stroke-width: 1; }
.tip-bg { fill: #fffdf8; stroke: var(--rule); stroke-width: 1; filter: drop-shadow(0 2px 6px rgba(40, 30, 10, 0.14)); }
.tip-title { font-size: 12px; font-weight: 700; fill: var(--ink); }
.tip-row { font-size: 12px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---- notes */
.calc-notes { margin-top: 4rem; padding-top: 1.6rem; border-top: 2px solid var(--ink); max-width: 54rem; }
.calc-notes h2 { margin-top: 1.8rem; }
.calc-notes h2:first-child { margin-top: 0; }
.calc-notes ul { padding-left: 1.2rem; }
.calc-notes li { margin: 0.4rem 0; font-size: 0.94rem; }
.calc-notes .sources a { color: var(--accent); }
.fire-page .fire-disclaimer { font-weight: 700; margin-top: 1.6rem; color: var(--ink); }   /* above site.css's .prose p */

/* ---- narrow screens: each check-up row becomes a card */
@media (max-width: 40rem) {
  .fire-page table.checkup, .fire-page table.checkup tbody, .fire-page table.checkup tr, .fire-page table.checkup th,
  .fire-page table.checkup td { display: block; width: auto; }
  .fire-page table.checkup thead { display: none; }
  .fire-page table.checkup tbody tr { padding: 0.75rem 0.9rem; border-top: 1px solid var(--rule); }
  .fire-page table.checkup tbody tr:first-child { border-top: 0; }
  .fire-page table.checkup tbody th, .fire-page table.checkup td, .fire-page table.checkup td.mine, .fire-page table.checkup td.range,
  .fire-page table.checkup td.result { border: 0; padding: 0.1rem 0; width: auto; }
  .fire-page table.checkup tbody th { margin-bottom: 0.25rem; }
  .fire-page table.checkup td::before { content: attr(data-label) "："; color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-right: 0.3rem; }
  .fire-page table.checkup td.result { margin-top: 0.3rem; white-space: normal; }
}
@media (max-width: 30rem) {
  .calc-form { padding: 1rem 0.9rem; }
  .fire-page table.data { font-size: 0.82rem; }
  .fire-page table.data th, .fire-page table.data td { padding-right: 0.45rem; white-space: normal; }
}
