:root {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --ink: #1a1a18; --muted: #45433e; --line: #dcd9cf;
  --accent: #8f2d07; --btn: #b93e0b; --accent-ink: #fff; --soft: #fbf1ea;
  --panel: #efece5; --card: #123a2d; --amber: #ffd37a;
  --warn-bg: #fdeceb; --warn-ink: #7a1a13; --info-bg: #fff3c4; --info-ink: #4f3d00;
  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: clamp(1.6rem, 3.6vw, 2.1rem); }
h2 { font-size: 1.1rem; }
code { font: .88em var(--sans); color: var(--ink); background: var(--soft); padding: .05em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--btn); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.logo { font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.logo-dot { color: var(--accent); }

.page-head { margin-bottom: 16px; }
.page-head .lead, .lead { color: var(--muted); margin: 4px 0 0; max-width: none; }
.center .lead { margin: 8px auto 22px; }

.main { min-width: 0; }

/* calculator form: one field, quiet extras */
.field { display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 18px; transition: border-color .15s; }
.field:focus-within { border-color: var(--accent); }
.btn-solve { font: 600 .98rem var(--sans); padding: 12px 26px; border: 0; border-radius: 10px; background: var(--btn); color: var(--accent-ink); cursor: pointer; }
.btn-solve:hover { filter: brightness(1.08); }
.tips, .examples { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.examples { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.examples span { color: var(--muted); }
.examples a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--muted); font-family: var(--sans); font-size: .82rem; }
.examples a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.alert { margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }

/* answer: a plain line, not a card */
.ans-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; line-height: 1.6; }
.ans-label { font: 600 .75rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-right: 6px; }
.ans-big { font-size: 1.9rem; line-height: 2; }
.ans-eq { color: var(--muted); font-size: 1.3rem; }
.ans-alt { font-size: 1.45rem; line-height: 2; }
.ans-actions { display: flex; gap: 18px; }
.link-btn { font: 500 .85rem var(--sans); background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* solution header */
.solution { margin-top: 22px; }
.sol-bar { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 12px; }
.legend { margin: 0 auto 0 0; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-hl { background: #ffd23f; }
.dot-new { background: #6bbcf0; margin-left: 10px; }
.toggle { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 9px; padding: 3px; }
.toggle button { font: 500 .82rem var(--sans); padding: 5px 13px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.toggle button.is-on { background: var(--surface); color: var(--ink); }

/* FAQ */
.faq { margin-top: 36px; }
.faq h2 { margin-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 13px 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; line-height: 1.2; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 14px; color: var(--muted); max-width: 62ch; }


/* home */
.cat { margin-top: 28px; }
.cat-h { font: 600 .75rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.tools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tool { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--soft); transition: background .15s; color: var(--ink); text-decoration: none; }
.tool-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.tool-title { display: block; font-weight: 600; }

@media (max-width: 860px) {
}
@media (max-width: 520px) {
  .field { padding-left: 14px; }
  .field input { font-size: 1.05rem; }
  .btn-solve { padding: 11px 18px; }
  .sol-bar .legend { display: none; }
}
@media print {
  .rail, .tabbar, .appbar, .site-footer, .calc, .ans-actions, .sol-bar, .faq, .skip { display: none !important; }
  body { background: #fff; color: #000; }
}



.schedule { margin-top: 36px; }
.schedule h2 { margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table th:first-child, .table td:first-child { text-align: left; }
.table tbody th { font-weight: 500; }
.schedule .hint { font-size: .82rem; color: var(--muted); margin: 10px 0 0; }
.monthly { margin-top: 18px; }
.monthly summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: .92rem; padding: 6px 0; }
.monthly .table { margin-top: 8px; }

@media print { .schedule .monthly:not([open]) .table { display: table; } }


/* ---------- app shell: rail on desktop, top bar + tab bar on phones ---------- */
:root { --rail: 264px; --tab-h: 62px; }
.logo { font-weight: 600; font-size: 1.2rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--btn); color: var(--accent-ink); font-size: 1rem; }
.logo-dot { color: var(--accent); }

.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px 16px; overflow-y: auto; z-index: 5; }
.rail .logo { padding: 2px 8px 18px; }
.rail-search { position: relative; margin-bottom: 14px; }
.rail-search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; }
.rail-search input { width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: 400 .92rem var(--sans); padding: 0 12px 0 38px; }
.rail-search input:focus { outline: 0; border-color: var(--accent); }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail-cat { font: 600 .7rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 10px 4px; }
.rail-link, .soon-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; font-size: .93rem; font-weight: 500; text-decoration: none; }
.rail-link { color: var(--ink); }
.rail-link:hover { background: var(--soft); }
.rail-link[aria-current] { background: var(--soft); color: var(--accent); font-weight: 600; }
.rail-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--soft); display: grid; place-items: center; font-size: .68rem; font-weight: 700; color: var(--accent); }
.rail-link[aria-current] .rail-ico { background: var(--btn); color: var(--accent-ink); }

.stage { margin-left: var(--rail); min-height: 100vh; display: flex; flex-direction: column; }
.stage main { width: 100%; max-width: 880px; margin: 0 auto; padding: 36px 40px 0; flex: 1; }
.site-footer { width: 100%; max-width: 880px; margin: 72px auto 0; padding: 22px 40px 32px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.site-footer p { margin: 0 0 4px; }
.site-footer strong { color: var(--ink); font-weight: 600; }
.appbar, .tabbar { display: none; }
.tool::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.4rem; line-height: 1; }

@media (max-width: 899px) {
  .rail { display: none; }
  .stage { margin-left: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .stage main { padding: 20px 16px 0; }
  .site-footer { padding: 20px 16px 24px; margin-top: 48px; }
  .appbar { display: flex; align-items: center; position: sticky; top: 0; z-index: 20; height: 52px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line); }
  .tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 500; }
  .tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-current] { color: var(--accent); font-weight: 600; }
  .tab[aria-current] svg { stroke-width: 2.2; }
  .tab[aria-current]::before { content: ""; position: absolute; top: -1px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
}
@media print { .stage { margin-left: 0; } .stage main { padding: 0; max-width: none; } }

/* ---------- content section under the result ---------- */
.more { margin-top: 40px; }
.more h2 { font-size: 1rem; margin: 0 0 8px; }
.more h2:not(:first-child) { margin-top: 24px; }
.eg-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 32px; }
.eg-list li { border-bottom: 1px solid var(--line); }
.eg-list a { display: block; padding: 9px 0; color: var(--ink); text-decoration: none; font-size: .95rem; }
.eg-list a:hover { color: var(--accent); text-decoration: underline; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { padding: 2px 0; }
.soon-line { margin: 28px 0 0; color: var(--ink); }
@media (max-width: 899px) { .eg-list { grid-template-columns: 1fr; } .more { margin-top: 32px; } }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 520px) {
  .table { font-size: .82rem; }
  .table th, .table td { padding: 8px 5px; white-space: nowrap; }
  .table thead th { font-size: .66rem; letter-spacing: .03em; }
}

/* =====================================================================
   Calculator kit: tinted input panel, dark result card, key/value rows
   ===================================================================== */
.form-card { background: var(--panel); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr); align-items: center; gap: 10px; }
.row > label { font-size: .95rem; line-height: 1.25; }
.ctl-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctl { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid #cfc9bb; border-radius: 8px; background: #fff; color: var(--ink); font: 500 1rem var(--sans); }
.ctl:focus { outline: 0; border-color: var(--btn); box-shadow: 0 0 0 3px rgba(185, 62, 11, .18); }
select.ctl { width: auto; flex: none; padding-right: 30px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231a1a18' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center / 11px; }
.suffix { white-space: nowrap; font-size: .9rem; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 2px; }
.btn-ghost, .btn-calc { font: 600 .92rem var(--sans); border-radius: 10px; padding: 9px 18px; cursor: pointer; text-decoration: none; }
.btn-ghost { border: 1.5px solid var(--btn); color: var(--accent); background: transparent; }
.btn-ghost:hover { background: rgba(185, 62, 11, .08); }
.btn-calc { border: 1.5px solid var(--btn); background: var(--btn); color: #fff; }

.calc-grid { display: grid; gap: 14px; }


.result-card { background: var(--card); color: #fff; border-radius: 16px; padding: 18px 20px 14px; }
.rc-label { margin: 0; font-size: .95rem; color: #fff; }
.rc-hero { margin: 4px 0 12px; font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 700; line-height: 1.15; color: var(--amber); letter-spacing: -.01em; }
.rc-hero.sm { font-size: clamp(1.5rem, 5.4vw, 2.1rem); }
.rc-rows { margin: 0; }
.rc-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .2); }
.rc-rows dt { font-size: .95rem; }
.rc-rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rc-actions { display: flex; gap: 18px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .2); }
.result-card .link-btn { color: var(--amber); }
.result-card .math { color: inherit; }
.rc-hero.math { line-height: 1.6; }
.rc-empty { margin: 0; padding: 18px 20px; border-radius: 16px; background: var(--panel); }

.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sched-head h2 { margin: 0; }

/* compact page on phones: title only, no subtitle */
@media (max-width: 899px) {
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 1.5rem; }
}
@media (max-width: 520px) { .page-head .lead { display: none; } .stage main { padding-top: 16px; } }

.form-card .field { background: #fff; border: 1px solid #cfc9bb; border-radius: 10px; padding: 4px 4px 4px 14px; }
.form-card .field:focus-within { border-color: var(--btn); box-shadow: 0 0 0 3px rgba(185, 62, 11, .18); }
.form-card .field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 1.1rem var(--sans); color: var(--ink); }
.result-card { margin-top: 14px; }
.calc-grid .result-card, .calc-grid .rc-empty { margin-top: 0; }
.rc-rows dd.math { font-size: 1em; line-height: 1.8; }
.js-only { display: none; }
.js-live .js-only { display: inline-flex; }
@media (max-width: 899px) { .calc-grid [data-live-target] { margin-top: 0; } }
.result-card .rc-hero.math { color: var(--amber); }

/* desktop: inputs run across the top, result card is hero-left / details-right */
@media (min-width: 900px) {
  .fc-h { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 12px 16px; padding: 16px 18px; }
  .fc-h .row { grid-template-columns: 1fr; gap: 6px; grid-column: span 4; }
  .fc-h .row:first-child { grid-column: span 6; }
  .fc-h .form-actions { grid-column: span 12; justify-content: flex-end; margin: 0; }
  .fc-h .row > label { font-size: .85rem; font-weight: 600; }
  .result-card:has(.rc-main) { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0 32px; align-items: start; padding: 22px 26px; }
  .rc-main { align-self: center; }
  .rc-main .rc-hero { margin-bottom: 0; }
  .rc-side .rc-rows > div:first-child { border-top: 0; padding-top: 0; }
  .rc-side .rc-actions { margin-top: 4px; }
}
@media (min-width: 900px) {
  .fc-h { position: relative; }
  .fc-h .row:first-child { grid-column: span 5; }
  .fc-h .row:nth-child(2) { grid-column: span 3; }
}

/* ---- v3: reading order = title → inputs → headline answer → breakdown ---- */
.fld { display: grid; gap: 10px; }
.fld-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fld-top > label { font-weight: 600; font-size: .95rem; }
.fld-top .ctl-group { flex: 0 1 62%; }
.fld-top .ctl { text-align: right; }
.fld-top select.ctl { text-align: left; }
.rng { width: 100%; margin: 0; accent-color: var(--btn); height: 20px; }
.fc-v { gap: 20px; padding: 18px 20px; }
.fc-v .form-actions { justify-content: flex-start; }
.rc-sub { margin: -6px 0 14px; font-size: .9rem; color: #e4ded3; }
.split-bar { display: block; width: 100%; height: 10px; border-radius: 6px; overflow: hidden; margin: 4px 0 6px; }
.rc-rows-flat > div:first-child { border-top: 0; }
.rc-rows dt small { opacity: .75; margin-left: 4px; font-weight: 400; }
.rc-total dd { font-size: 1.15rem; color: var(--amber); }
.dot-p { background: #ffd37a; margin-right: 8px; }
.dot-i { background: #6f9a88; margin-right: 8px; }
.rc-next { background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; }
.rc-next .rc-label { font-size: .85rem; color: #e4ded3; }
.rc-next-big { margin: 2px 0; font-size: 1.5rem; font-weight: 700; color: #fff; }
.rc-next .rc-sub { margin: 0; }
.rc-tiles { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rc-tiles > div { display: flex; flex-direction: column-reverse; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.2); }
.rc-tiles dd { margin: 0; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.rc-tiles dt { font-size: .8rem; color: #e4ded3; }
@media (max-width: 520px) { .rc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rc-tiles > div { flex-direction: column; }
.rc-main .rc-sub { margin: 6px 0 0; }
.rc-main .rc-hero { margin-bottom: 0; }

.fld-label { font-weight: 600; font-size: .95rem; }
.date3 { display: grid; grid-template-columns: minmax(0, 72px) minmax(0, 1fr) minmax(0, 92px); gap: 8px; }
.date3 select.ctl { width: 100%; }
.fc-date { gap: 16px; }
.fc-v .fld > .fld-top + .rng { display: none; }
@media (min-width: 900px) {
  .fc-date .fld-label { margin-bottom: 2px; }
  .fc-date { align-content: start; }
}
.rc-main { margin-bottom: 14px; }
@media (min-width: 900px) {
  .fc-date { grid-template-columns: 1fr 1fr; align-items: end; }
  .fc-date .form-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .fc-date { position: relative; }
  .rc-main { margin-bottom: 0; }
}
@media (min-width: 900px) { }
/* v4: compact date fields; age answer on top, details underneath */
.date3 { grid-template-columns: 64px minmax(0, 140px) 84px; justify-content: start; }
.date3 select.ctl { width: 100%; }
.fc-date .fld { min-width: 0; }
@media (max-width: 420px) { .date3 { grid-template-columns: 60px minmax(0, 1fr) 80px; } }
@media (min-width: 900px) {
  .fc-date { grid-template-columns: auto auto 1fr; justify-content: start; gap: 16px 40px; }
  .result-card:has(.rc-main) { display: block; padding: 20px 26px 16px; }
  .rc-main { margin-bottom: 14px; }
  .rc-side { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0 28px; align-items: stretch; }
  .rc-side .rc-next { margin: 0; }
  .rc-side .rc-tiles { align-content: center; }
  .rc-side .rc-actions { grid-column: 1 / -1; margin-top: 14px; }
}

.rc-actions { gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--amber); cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.icon-btn .ok { display: none; }
.icon-btn.done svg { display: none; }
.icon-btn.done .ok { display: block; }
@media print { .icon-btn { display: none; } }

/* v5 polish */
.fc-loan { position: relative; align-content: space-evenly; }
@media (min-width: 900px) {
  .tools { max-width: none; }
  .site-footer { margin-top: 48px; }
}
@media (max-width: 520px) {
  .rc-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .rc-tiles dd { font-size: .92rem; }
  .rc-tiles dt { font-size: .72rem; }
  .rc-next { padding: 10px 14px; }
  .rc-next-big { font-size: 1.3rem; }
}

.tool:hover { background: #f6e4d8; }
.tool:focus-visible { outline: 2px solid var(--btn); outline-offset: 2px; }
.tool-icon { background: #fff; }
.cat-grid { display: block; }
@media (min-width: 900px) { .cat-grid { display: block; } }

.tool-text { display: grid; gap: 1px; min-width: 0; }
.tool-cat { font-size: .78rem; color: var(--muted); }
.tools { margin-top: 24px; }

.cat .tools { margin-top: 0; }
.cat { margin-top: 26px; }

.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--btn); margin: 0; }
@media (min-width: 900px) { .fc-date .check { grid-column: 1 / -1; } }

.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin: 0 0 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--soft); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.pill:hover { background: #f6e4d8; }
.pill.is-on { background: var(--btn); color: #fff; }
.solution { margin-top: 28px; }

/* ===== v7: results ===== */
/* stacked under the inputs (phones, fraction, age, date difference): a dark card */
.result-card { background: var(--card); color: #fff; border-radius: 16px; padding: 18px 20px 14px; margin-top: 0; }
.rc-label { color: #fff; font-size: .95rem; font-weight: 400; }
.rc-hero, .result-card .rc-hero.math { color: var(--amber); }
.rc-sub { color: #e4ded3; margin: -6px 0 12px; }
.rc-rows > div { border-top: 1px solid rgba(255, 255, 255, .2); }
.rc-rows-flat > div:first-child { border-top: 0; padding-top: 10px; }
.rc-actions { border-top: 1px solid rgba(255, 255, 255, .2); padding-top: 8px; }
.result-card .link-btn, .icon-btn { color: var(--amber); }
.icon-btn { margin-left: 0; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.rc-total dd { color: var(--amber); }
.dot-p { background: #ffd37a; }
.dot-i { background: #6f9a88; }
.split-bar .p { fill: #ffd37a; }
.split-bar .i { fill: #6f9a88; }
.rc-next { background: rgba(255, 255, 255, .08); border-radius: 12px; padding: 12px 16px; margin: 0 0 12px; }
.rc-next .rc-label { color: #e4ded3; }
.rc-next-big { color: #fff; }
.rc-tiles > div { border-top: 1px solid rgba(255, 255, 255, .2); }
.rc-tiles dt { color: #e4ded3; }
.rc-empty { background: var(--panel); padding: 18px 20px; border-radius: 16px; color: var(--ink); font-weight: 400; }
.calc-grid .rc-empty { margin-top: 0; }
.calc-grid:not(.split) .result-card, .form-card + .result-card, form.calc + .result-card, form.calc + .alert + .result-card { margin-top: 14px; }

@media (min-width: 900px) {
  .result-card:has(.rc-main) { padding: 22px 26px 16px; }
  .rc-side { gap: 0 28px; }
  .fc-date { grid-template-columns: auto auto; justify-content: start; gap: 16px 40px; }
  .fc-date .check, .fc-date .form-actions { grid-column: 1 / -1; }
}

/* inputs: only as wide as they need to be */
.form-card { width: fit-content; max-width: 100%; }
.fld-top { gap: 24px; }
.fld-top > label { min-width: 110px; }
.fld-top .ctl-group { flex: 0 0 auto; }
.fld-top .ctl { width: 140px; }
.fld-top select.ctl { width: auto; min-width: 96px; }
.fld-top .ctl-group select.ctl:first-child { width: 112px; }
.fc-v { padding: 18px 20px; gap: 14px; align-content: start; }
.form-card .field { width: 100%; }
.form-card:has(.field) { width: 100%; }

@media (max-width: 899px) {
  .fld-top > label { min-width: 0; }
  .fld-top .ctl-group { flex: 1 1 auto; justify-content: flex-end; }
  .calc-grid { gap: 22px; }
  .form-card { width: 100%; }
}
@media (max-width: 899px) {
  .fld-top { gap: 12px; }
  .fld-top > label { flex: 0 0 auto; }
  .fld-top .ctl-group { flex: 1 1 0; min-width: 0; max-width: 260px; margin-left: auto; }
  .fld-top .ctl { width: auto; flex: 1 1 0; min-width: 0; }
  .fld-top .ctl-group select.ctl:first-child { flex: 0 0 92px; width: 92px; }
}

.calc-grid:not(.split) .form-card, form.calc > .form-card { width: 100%; }

/* ===== v8: alignment ===== */
.fld-top .ctl-group { position: relative; display: flex; gap: 8px; width: 260px; flex: 0 0 260px; }
.fld-top .ctl-group .ctl { flex: 1 1 0; width: auto; min-width: 0; }
.fld-top .ctl-group select.ctl { flex: 0 0 112px; width: 112px; min-width: 0; }
.fld-top .ctl-group.has-suffix .ctl { padding-right: 42px; }
.suffix-in { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-weight: 500; }
.lbl-sub { font-weight: 400; font-size: .85rem; }
.form-foot { display: flex; align-items: center; justify-content: flex-start; gap: 24px; flex-wrap: wrap; margin-top: 2px; }
.form-foot .check { margin: 0; }
.fc-date { row-gap: 14px; }
@media (max-width: 899px) {
  .fld-top .ctl-group { flex: 1 1 0; width: auto; max-width: 260px; margin-left: auto; }
  .fld-top .ctl-group select.ctl { flex: 0 0 96px; width: 96px; }
}
.rc-rows dt { white-space: nowrap; }
.rc-rows dt small { font-size: .8rem; }


.rc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .35em; font-size: clamp(1.5rem, 5.2vw, 2.2rem); line-height: 1.5; margin: 6px 0 8px; overflow-wrap: anywhere; }
.rc-line .eq { color: #e4ded3; font-weight: 400; }
.rc-line .dec { font-variant-numeric: tabular-nums; }
.rc-line .fr, .rc-line .nu, .rc-line .de { font-weight: 700; }

/* ===== v9: product rows, operation row, hints ===== */
.opt { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 10px; }
.opt-n { font-weight: 600; font-size: .95rem; }
.opt-f { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 96px; gap: 8px; }
.opt-f .ctl { width: 100%; min-width: 0; }
.cur-sel { width: 112px; }
.add3 { grid-template-columns: 100px 84px minmax(0, 110px); }
.form-hint { margin: -4px 0 0; font-size: .9rem; color: var(--muted); }
.rc-rows dd small { font-weight: 400; opacity: .8; }
@media (max-width: 420px) { .opt { grid-template-columns: 1fr; gap: 6px; } .add3 { grid-template-columns: 92px 76px minmax(0, 1fr); } }
@media (min-width: 900px) { .opt-f { grid-template-columns: 96px 96px 96px; } .calc-grid.split .rc-rows dd small { display: inline; } }
.fld-top .ctl-group:has(.cur-sel) { justify-content: flex-end; } @media (min-width: 900px) { .fld-top .ctl-group:has(.cur-sel) { width: auto; flex: 1 1 auto; } }

/* ===== v10: content, crumbs, info pages ===== */
.crumbs { padding-top: 14px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: #a9a294; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs + .main .page-head, .crumbs + .main { padding-top: 0; }
.seo { margin-top: 36px; padding-top: 8px; max-width: 760px; }
.seo h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.seo p, .prose p { line-height: 1.65; margin: 0 0 12px; max-width: 70ch; }
.seo-steps { padding-left: 22px; margin: 0; line-height: 1.6; max-width: 70ch; }
.seo-steps li { margin-bottom: 6px; }
.related { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--soft); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.related a:hover { background: #f6e4d8; }
.prose h2 { font-size: 1.15rem; margin: 26px 0 6px; }
.foot-links { display: flex; gap: 18px; margin-bottom: 8px; }
.foot-links a { color: var(--ink); font-weight: 600; font-size: .9rem; }

.time3 { grid-template-columns: 72px 72px 84px; justify-content: start; }
.time3 .ctl { width: 100%; }
@media (min-width: 1200px) { .fc-time { grid-template-columns: auto auto auto; } }

/* v11: grid children may shrink below their content width (fixes cards overhanging on phones) */
.calc-grid { grid-template-columns: minmax(0, 1fr); }
.calc-grid > * { min-width: 0; }

/* v12: phones - one label column and one control column, so every input shares the same left and right edge */
@media (max-width: 640px) {
  .fc-v .fld-top { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 12px; }
  .fc-v .fld-top > label { min-width: 0; line-height: 1.25; }
  .fc-v .fld-top .ctl-group,
  .fc-v .fld-top .ctl-group:has(.cur-sel) { width: auto; max-width: none; margin: 0; flex: none; justify-content: stretch; }
  .fc-v .fld-top .ctl-group .ctl { flex: 1 1 0; min-width: 0; width: auto; }
  .fc-v .fld-top .ctl-group select.ctl { flex: 0 0 84px; width: 84px; }
}

/* v13: SEO article blocks - formula line and reference tables */
.seo-formula { font-weight: 600; background: var(--soft); border-radius: 10px; padding: 10px 14px; max-width: 70ch; }
.seo-table-wrap { overflow-x: auto; margin: 4px 0 16px; max-width: 70ch; }
.seo-table { border-collapse: collapse; width: 100%; font-size: .93rem; font-variant-numeric: tabular-nums; }
.seo-table caption { text-align: left; font-weight: 600; padding: 0 0 8px; }
.seo-table th, .seo-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.seo-table thead th { border-bottom: 2px solid var(--ink); font-size: .85rem; }
.seo-table th:first-child, .seo-table td:first-child { text-align: left; }
.seo-table tbody th { font-weight: 600; }
.seo ul.plain-list li, .seo-steps li { max-width: 70ch; }
@media print { .seo-table-wrap { overflow: visible; } }

/* v14: BMI scale */
.bmi-bar { display: block; width: 100%; max-width: 360px; margin: 14px 0 6px; color: inherit; }
.bmi-bar rect { fill: currentColor; }
.bmi-bar .b1 { opacity: .22; }
.bmi-bar .b2 { opacity: .5; }
.bmi-bar .b3 { opacity: .3; }
.bmi-bar .b4 { opacity: .16; }
.bmi-bar .bmi-mark { fill: currentColor; }
.bmi-bar text { fill: currentColor; font-size: 10px; font-family: Arial, sans-serif; opacity: .85; }


/* v15: Calculate button is always visible; Reset sits beside it */
.form-card .form-actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; justify-content: flex-start; position: static; }
.form-card .btn-calc { order: -1; display: inline-block; min-width: 132px; height: 42px; font-size: 1rem; }
.form-card .btn-calc:hover { filter: brightness(1.08); }
.form-card .btn-ghost { border: 0; background: none; padding: 2px 0; font-size: .92rem; text-decoration: underline; height: auto; }
.form-card .btn-calc:focus-visible, .form-card .btn-ghost:focus-visible { outline: 3px solid rgba(185, 62, 11, .35); outline-offset: 2px; }
@media (max-width: 520px) { .form-card .form-actions { gap: 18px; } .form-card .btn-calc { flex: 1; } }
[data-live-target].is-busy { opacity: .55; transition: opacity .15s; }

/* v15: schedule views (year / financial year / month) and dated rows */
.js-live .schedule .pane { display: none; }
.js-live .schedule[data-view="year"] .pane-year,
.js-live .schedule[data-view="fy"] .pane-fy,
.js-live .schedule[data-view="month"] .pane-month { display: block; }
.schedule .pane + .pane { margin-top: 18px; }
.table th small, .table td small { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none; }
.table tr.ye th, .table tr.ye td { border-bottom: 2px solid var(--ink); }
.toggle button { white-space: nowrap; }
@media print { .schedule .pane { display: block !important; } .toggle { display: none; } }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .sched-head { flex-wrap: wrap; }
  .sched-head .toggle { width: 100%; display: flex; }
  .sched-head .toggle button { flex: 1; padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 640px) { .schedule .table { font-size: .78rem; } .schedule .table th, .schedule .table td { padding: 8px 4px; } }

/* v16: quick-pick chips under a field */
.quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; justify-content: flex-end; }
.chip { padding: 5px 9px; border-radius: 999px; border: 1px solid #cfc9bb; background: #fff; color: var(--ink); font-weight: 600; font-size: .85rem; text-decoration: none; }
.chip:hover { border-color: var(--btn); }
.chip.is-on { background: var(--btn); border-color: var(--btn); color: #fff; }
@media (max-width: 640px) { .quick { justify-content: flex-start; } }

/* v17: inputs and result sit side by side only where the page is wide enough for both (1200px and up).
   Below that the result stacks under the inputs as the dark card, so long amounts never run off the screen. */
@media (min-width: 1200px) {
  /* side by side with the inputs (loan, percentage): no second box, the result sits on the page */
  .calc-grid.split { grid-template-columns: auto minmax(0, 1fr); gap: 20px 40px; align-items: start; }
  .calc-grid.split [data-live-target] { display: block; }
  .calc-grid.split .result-card { background: none; color: var(--ink); border-radius: 0; padding: 4px 0 0; margin-top: 0; }
  .calc-grid.split .rc-label { color: var(--muted); font-weight: 600; font-size: .9rem; }
  .calc-grid.split .rc-hero { color: var(--accent); }
  .calc-grid.split .rc-sub { color: var(--muted); }
  .calc-grid.split .rc-rows > div, .calc-grid.split .rc-rows-flat > div:first-child { border-top: 1px solid var(--line); }
  .calc-grid.split .rc-actions { border-top: 0; padding-top: 4px; }
  .calc-grid.split .result-card .link-btn, .calc-grid.split .icon-btn, .calc-grid.split .rc-total dd { color: var(--accent); }
  .calc-grid.split .icon-btn { margin-left: -8px; }
  .calc-grid.split .icon-btn:hover { background: var(--soft); }
  .calc-grid.split .dot-p { background: var(--btn); }
  .calc-grid.split .dot-i { background: #bdb5a6; }
  .calc-grid.split .split-bar .p { fill: var(--btn); }
  .calc-grid.split .split-bar .i { fill: #bdb5a6; }
  .calc-grid.split .rc-empty { background: none; padding: 0; color: var(--accent); font-weight: 600; }
  .calc-grid.split .rc-rows dt small { display: none; }
}
@media (min-width: 641px) and (max-width: 1199px) {
  .calc-grid.split { width: fit-content; max-width: 100%; min-width: min(100%, 440px); }
}

/* v18: date group inside a label-left row (FD start date) */
.fld-top .fd-date { grid-template-columns: 62px minmax(0, 1fr) 82px; width: 260px; gap: 8px; flex: 0 0 auto; }
.fld-top .fd-date .ctl { width: 100%; }
@media (max-width: 640px) { .fc-v .fld-top .fd-date { width: auto; } }

@media (max-width: 640px) {
  .fc-v .fld-top .ctl-group.sel-only select.ctl { flex: 1 1 auto; width: 100%; }
  .fc-v .fld-top .fd-date { grid-template-columns: 44px minmax(0, 1fr) 62px; gap: 6px; }
}
.fld-top .fd-date select.ctl, .fld-top .fd-date input.ctl { min-width: 0; }
@media (max-width: 640px) { .fld-top .fd-date .ctl { padding-left: 8px; padding-right: 8px; } .fld-top .fd-date select.ctl { padding-right: 20px; } }
@media (min-width: 641px) and (max-width: 1199px) { .fc-time { grid-template-columns: repeat(2, auto); justify-content: start; gap: 16px 36px; } .fc-time .form-actions { grid-column: 1 / -1; } }

/* v19: PPF year select must show the full "FY 2026-27" label */
.ctl-group.sel-only.fy-wide{min-width:0}
.ctl-group.sel-only.fy-wide select.ctl{width:100%;min-width:9.5em}
@media (max-width:640px){.fc-v .fld-top .ctl-group select.ctl[name="mode"]{min-width:5.6em;padding-left:8px;padding-right:22px}}

/* =====================================================================
   v20: app feel on phones, no sticky header, desktop polish
   ===================================================================== */
html { -webkit-tap-highlight-color: transparent; }
.appbar { position: static !important; }                       /* header scrolls away with the page */
a, button, .chip, .pill, .tab, .tool { touch-action: manipulation; }
.ctl, .btn-calc, .btn-ghost { transition: border-color .15s, box-shadow .15s, background-color .15s, transform .08s; }
.ctl:hover:not(:focus) { border-color: #b7b0a0; }
.btn-calc:hover { background: #a63508; border-color: #a63508; }
.btn-calc:active, .btn-ghost:active, .chip:active, .pill:active { transform: scale(.97); }
[data-live-target="card"] .result-card, [data-live-target="more"] .schedule { animation: rcIn .25s ease-out; }
@keyframes rcIn { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.rc-empty { background: #fdecea; color: #8a1c10; border-radius: 12px; padding: 14px 16px; margin: 0; font-weight: 500; }

/* big screens: use the room */
@media (min-width: 1500px) {
  .stage main, .site-footer { max-width: 1040px; }
}

@media (max-width: 899px) {
  /* top bar: quiet, scrolls away */
  .appbar { height: 54px; border-bottom: 0; background: #fff; padding: 0 12px 0 16px; justify-content: space-between; }
  .appbar.has-back { padding-left: 6px; }
  .appbar-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px 0 6px; color: var(--accent); font-weight: 600; font-size: 1rem; text-decoration: none; border-radius: 12px; }
  .appbar-back svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  .appbar-back:active { background: var(--soft); }
  .appbar-mark { display: inline-flex; }
  .crumbs { display: none; }
  .stage main { padding-top: 4px; }
  .page-head h1 { font-size: 1.7rem; letter-spacing: -.01em; }

  /* tab bar: frosted, bigger targets */
  .tabbar { background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid #e6e1d6; }
  .tab { min-height: 48px; transition: color .15s; }
  .tab:active { background: var(--soft); }

  /* cards feel like native sheets */
  .form-card { border-radius: 22px; padding: 16px; gap: 12px; }
  .result-card { border-radius: 22px; padding: 20px 20px 12px; box-shadow: 0 10px 28px -14px rgba(38, 33, 29, .55); }
  .ctl { height: 48px; border-radius: 12px; font-size: 16px; }
  .form-actions { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
  .form-actions .btn-calc { order: 2; height: 50px; border-radius: 14px; font-size: 1.05rem; box-shadow: 0 6px 16px -8px rgba(185, 62, 11, .8); }
  .form-actions .btn-ghost { order: 1; border: 0; padding: 12px 10px; }
  .chip, .pill { min-height: 40px; display: inline-flex; align-items: center; }
  .quick { gap: 8px; }

  /* home and category lists: tappable rows */
  .tool { min-height: 60px; border-radius: 18px; transition: transform .08s, background-color .15s; }
  .tool:active { transform: scale(.985); background: #f5e3d6; }

  /* schedule + article */
  .schedule { margin-top: 28px; }
  .sched-head { flex-wrap: wrap; gap: 10px; }
  .sched-head .toggle { width: 100%; }
  .sched-head .toggle > * { flex: 1; text-align: center; min-height: 40px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
}
@media (max-width: 899px) and (display-mode: standalone) { .appbar { padding-top: env(safe-area-inset-top, 0px); height: calc(54px + env(safe-area-inset-top, 0px)); } }
@media (max-width: 899px) { .sched-head .toggle { display: flex; } }
.fc-v .fld-top .ctl-group.sel-only { flex: 1 1 auto; }
.fc-v .fld-top .ctl-group.sel-only select.ctl { flex: 1 1 auto; width: 100%; min-width: 0; }

/* v20b: controls share one right-hand column so every field lines up (tablet and desktop) */
@media (min-width: 641px) {
  .fc-v .fld-top { display: grid; grid-template-columns: minmax(130px, 1fr) 280px; align-items: center; gap: 12px; }
  .fc-v .fld-top > .ctl-group, .fc-v .fld-top > .date3 { width: 280px; min-width: 0; }
  .fc-v .fld-top .ctl-group > input.ctl { flex: 1 1 0; min-width: 0; }
  .fc-v .fld-top .ctl-group > select.ctl { flex: 0 0 auto; }
  .fc-v .fld-top .ctl-group.sel-only > select.ctl { flex: 1 1 auto; }
  .fc-v .date3 { display: grid; grid-template-columns: 64px 1fr 84px; gap: 8px; }
  .fc-v .date3 .ctl { width: 100%; min-width: 0; }
}

/* =====================================================================
   v21: compact spacing, so more of the calculator shows on first load
   ===================================================================== */
.stage main { padding-top: 14px; }
.crumbs { padding-top: 0; }
.crumbs ol { font-size: .8rem; line-height: 1.2; }
.page-head { margin-bottom: 10px; }
.page-head h1, h1 { font-size: clamp(1.45rem, 3vw, 1.8rem); }
.page-head .lead, .lead { margin: 2px 0 0; font-size: .95rem; line-height: 1.4; }
.crumbs + .main .page-head { margin-top: 4px; }
.form-card { padding: 12px 16px; gap: 8px; }
.ctl { height: 40px; }
.btn-calc, .btn-ghost { padding: 8px 18px; }
.calc-grid { gap: 12px; }
.calc-grid.split .rc-rows > div { padding: 8px 0; }
.rc-rows > div { padding: 8px 0; }
.rc-hero { margin: 2px 0 8px; }
.result-card { padding: 14px 18px 10px; }
.schedule { margin-top: 22px; }
.more { margin-top: 26px; }
.table th, .table td { padding: 7px 8px; }
.site-footer { margin-top: 44px; padding-top: 16px; }
.quick { margin-top: 2px; }
.rail { padding-top: 14px; }
.rail .logo { padding-bottom: 12px; }
.rail-search { margin-bottom: 8px; }
.rail-cat { margin-top: 12px; }
.rail-link { padding: 5px 10px; }

@media (min-width: 1200px) { .stage main { padding-top: 16px; } }

@media (max-width: 899px) {
  .appbar { height: 46px; }
  .appbar-back { min-height: 40px; }
  .stage main { padding: 0 16px 0; }
  .page-head { margin-bottom: 8px; }
  .page-head h1, h1 { font-size: 1.45rem; }
  .form-card { padding: 12px 14px; gap: 9px; border-radius: 20px; }
  .ctl { height: 46px; }
  .result-card { padding: 16px 18px 8px; border-radius: 20px; }
  .rc-rows > div { padding: 9px 0; }
  .rc-hero { margin: 0 0 6px; }
  .form-actions .btn-calc { height: 48px; }
  .calc-grid { gap: 10px; }
  .tool { min-height: 54px; }
  .schedule { margin-top: 20px; }
  .tabbar { height: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .stage { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 1320px) { .stage main, .site-footer { max-width: 1000px; } }
@media (min-width: 1600px) { .stage main, .site-footer { max-width: 1080px; } }

/* v22: touch targets and legibility from the pixel audit */
@media (max-width: 899px) {
  .appbar-mark { width: 44px; height: 44px; align-items: center; justify-content: center; }
  .toggle button { min-height: 36px; padding-left: 16px; padding-right: 16px; }
  .tab { font-size: .75rem; }
  .field input#expr { height: 46px; }
}
.rail-ico { font-size: .72rem; }
.seo { margin-top: 22px; padding-top: 0; }
.seo h2:first-child { margin-top: 0; }
.seo h2 { margin: 22px 0 6px; font-size: 1.15rem; }
@media (max-width: 899px) { .seo { margin-top: 18px; } .seo h2 { font-size: 1.1rem; } }

/* v23: two date groups read as two separate fields, each filling its half (tablet and desktop) */
@media (min-width: 900px) {
  .fc-date:not(.fc-time) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 0; justify-content: stretch; }
  .fc-date:not(.fc-time) .fld { padding-right: 28px; }
  .fc-date:not(.fc-time) .fld:has(.date3) + .fld:has(.date3) { padding-left: 28px; padding-right: 0; border-left: 1px solid #d6d0c2; }
  .fc-date:not(.fc-time) .date3 { grid-template-columns: 64px minmax(0, 1fr) 88px; justify-content: stretch; width: 100%; }
  .fc-date:not(.fc-time) .fld .date3 .ctl { width: 100%; }
}
@media (min-width: 900px) {
  .fc-date:not(.fc-time) .fld > .ctl-group > select.ctl, .fc-date:not(.fc-time) .fld .row3 > select.ctl { min-width: 7.2em; flex: 0 0 auto; }
}
@media (min-width: 900px) {
  .fc-date:not(.fc-time) .date3.add3 { grid-template-columns: 112px minmax(0, 1fr) 104px; }
}
.fc-v .fld-top .ctl-group select.ctl[name="runit"] { min-width: 7.6em; flex: 0 0 auto; }
@media (max-width: 640px) { .fc-v .fld-top .ctl-group > input.ctl[name="rate"] { flex: 1 1 0; min-width: 0; } }

/* v24: logo mark is an SVG "c." monogram */
.logo-mark { background: none !important; padding: 0; width: 28px; height: 28px; border-radius: 8px; overflow: hidden; }
.logo-mark .logo-svg { display: block; width: 100%; height: 100%; }
@media (max-width: 899px) { .appbar-mark .logo-mark { width: 32px; height: 32px; } }

/* =====================================================================
   v25: home page opens with a working calculator
   ===================================================================== */
.home-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.home-h1 { font-size: 1.3rem; margin: 0 0 8px; }
.home-lead { font-size: .95rem; margin: 0 0 6px; }
.home-lists .cat:first-of-type .cat-h { margin-top: 10px; }
.cat-h { margin: 18px 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

.bc { background: var(--card); color: #fff; border-radius: 22px; padding: 10px 12px 12px; max-width: 420px; margin: 0 auto; width: 100%; box-shadow: 0 10px 28px -16px rgba(38, 33, 29, .6); position: relative; }
.bc-screen { padding: 4px 6px 6px; min-height: 112px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.bc-top { display: flex; justify-content: space-between; margin-bottom: 2px; }
.bc-ico { width: 40px; height: 36px; border: 0; background: transparent; color: #b5d3c6; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.bc-ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bc-ico:hover, .bc-ico:active { background: rgba(255, 255, 255, .1); color: #fff; }
.bc-ico.done { color: var(--amber); }
.bc-expr { min-height: 1.5em; text-align: right; color: #9cc2b2; font-size: 1.1rem; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-variant-numeric: tabular-nums; }
.bc-expr::-webkit-scrollbar { display: none; }
.bc-res { text-align: right; font-size: 2.7rem; font-weight: 600; line-height: 1.2; color: #fff; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bc-pad, .bc-sci { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.bc-sci { grid-template-columns: repeat(5, 1fr); }
.bc-sci[hidden], .bc-hist[hidden] { display: none; }
.k { height: 58px; border: 0; border-radius: 16px; background: #1d4b3b; color: #fff; font: 500 1.35rem var(--sans); cursor: pointer; transition: transform .07s, background-color .12s; }
.k:hover { background: #26604b; }
.k:active { transform: scale(.94); background: #2f7359; }
.k-fn { background: #2b6a53; color: #fff; font-size: 1.15rem; }
.k-op { background: var(--amber); color: #123a2d; font-size: 1.7rem; font-weight: 600; }
.k-op:hover { background: #ffe0a0; }
.k-eq { background: #e0560f; color: #fff; font-size: 1.7rem; }
.k-eq:hover { background: #f06a22; }
.k-sci { height: 44px; font-size: 1.05rem; border-radius: 12px; }
.bc-more { display: block; width: 100%; margin-top: 8px; padding: 8px; border: 0; background: transparent; color: #9cc2b2; font: 500 .85rem var(--sans); cursor: pointer; border-radius: 10px; }
.bc-more:hover { color: #fff; }
.bc-hist { position: absolute; inset: 52px 10px auto 10px; z-index: 3; max-height: 280px; overflow-y: auto; background: #174a39; border-radius: 14px; padding: 6px; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .6); }
.bc-h { display: flex; flex-direction: column; align-items: flex-end; width: 100%; border: 0; background: transparent; color: #9cc2b2; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: 400 .9rem var(--sans); }
.bc-h strong { color: #fff; font-size: 1.15rem; font-weight: 600; }
.bc-h:hover { background: rgba(255, 255, 255, .08); }
.bc-none { margin: 8px; color: #9cc2b2; text-align: center; }
.bc-clr { display: block; margin: 4px auto 2px; border: 0; background: transparent; color: var(--amber); font: 600 .85rem var(--sans); padding: 8px 12px; cursor: pointer; }

@media (min-width: 1000px) {
  .home-grid { grid-template-columns: 380px minmax(0, 1fr); gap: 36px; align-items: start; }
  .home-calc { position: relative; }
  .home-h1 { font-size: 1.6rem; }
  .bc { margin: 0; }
  .home-lists .tools { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .home-lead { margin-top: 0; }
}
@media (max-width: 899px) {
  .home-h1 { margin: 8px 0 8px; }
  .home-lead { display: none; }
  .k { height: 56px; }
  .k-sci { height: 42px; }
}
@media (max-width: 360px) { .k { height: 50px; font-size: 1.2rem; } .bc-res { font-size: 2.3rem; } }
@media (min-width: 1000px) {
  .home-grid { grid-template-columns: 350px minmax(0, 1fr); gap: 30px; }
  .home-lists .tool::after { display: none; }
  .home-lists .tool-title { font-size: .95rem; }
  .home-lists .tool { padding: 10px 12px; }
}

/* v26: home calculator polish (green) */
.bc { background: linear-gradient(180deg, #164634 0%, #123a2d 100%); }
.bc-screen { border-radius: 16px; background: rgba(0, 0, 0, .16); padding: 8px 12px 10px; margin-bottom: 2px; }
.bc-res { font-size: 2.9rem; }
.k-sci { font-size: .95rem; height: 42px; background: #1a4535; }
.k-mode { color: var(--amber); font-weight: 600; font-size: .8rem; }
.bc-ico.done::after { content: "Copied"; position: absolute; right: 52px; top: 12px; font: 600 .75rem var(--sans); color: var(--amber); }
.bc-top { position: relative; }
@media (min-width: 1000px) { .bc-res { font-size: 3.1rem; } .k { height: 62px; } }
@media (prefers-reduced-motion: no-preference) { .bc-res.pop { animation: bcPop .18s ease-out; } }
@keyframes bcPop { from { transform: scale(.97); } to { transform: none; } }

/* v27: cash counter denomination grid */
.fc-cash .den-h { margin: 4px 0 -2px; font-weight: 600; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.den-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.den { display: grid; grid-template-columns: minmax(0, 1fr) 84px; align-items: center; gap: 8px; }
.den label { font-weight: 600; font-size: .95rem; }
.den .ctl { width: 100%; min-width: 0; text-align: right; }
.rc-unit { font-size: .5em; font-weight: 600; opacity: .85; }
@media (min-width: 641px) and (max-width: 1199px) { .fc-cash { width: 100%; } }

/* v28: years / months / weeks / days boxes, and visual groups inside forms */
.dur4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.dur { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.dur .ctl { width: 100%; min-width: 0; text-align: center; font-weight: 500; color: var(--ink, #26211d); }
.fld.fld-g { margin-top: 4px; padding-top: 14px; border-top: 1px dashed #d9d3c6; }
@media (min-width: 900px) { .fc-date .dur4 { max-width: 420px; } }

/* v29: tighter home calculator keys */
.k { height: 48px; border-radius: 14px; font-size: 1.25rem; }
.k-sci { height: 36px; font-size: .9rem; border-radius: 10px; }
@media (max-width: 899px) { .k { height: 50px; } .k-sci { height: 38px; } }
@media (max-width: 360px) { .k { height: 46px; } }
@media (min-width: 1000px) { .k { height: 52px; } }

/* v30: Add days — the amount group sits on its own row under the start date */
@media (min-width: 900px) {
  .fc-date:not(.fc-time) .fld.fld-g { grid-column: 1 / -1; padding-right: 0; border-top: 1px dashed #d9d3c6; padding-top: 14px; }
  .fc-date .fld-g .fld-top { display: flex; align-items: center; gap: 16px; }
  .fc-date .fld-g .fld-top .ctl-group { width: 150px; flex: 0 0 150px; }
  .fc-date .fld-g .dur4 { max-width: 460px; }
}
@media (min-width: 900px) { .fc-date .fld-g .fld-top { justify-content: flex-start; } .fc-date .fld-g .fld-top label { min-width: 60px; } }

/* v31: full calculator (scientific keys always visible), history inside the screen, categories below */
.home-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
.home-calc { position: relative; }
.bc { max-width: 440px; padding: 8px 10px 10px; border-radius: 20px; }
.bc-screen { position: relative; min-height: 0; padding: 8px 12px 8px; justify-content: flex-end; }
.bc-top { position: absolute; top: 4px; left: 4px; margin: 0; gap: 0; justify-content: flex-start; }
.bc-ico { width: 34px; height: 30px; }
.bc-ico.done::after { left: 74px; right: auto; top: 6px; }
.bc-hist { position: static; inset: auto; max-height: 64px; overflow-y: auto; background: transparent; box-shadow: none; padding: 0 0 2px 70px; border-radius: 0; scrollbar-width: thin; }
.bc-hist:empty { display: none; }
.bc-h { flex-direction: row; justify-content: flex-end; align-items: baseline; gap: 8px; padding: 1px 6px; border-radius: 8px; font-size: .82rem; line-height: 1.35; }
.bc-h strong { font-size: .92rem; }
.bc-body { display: grid; gap: 6px; margin-top: 6px; }
.bc-pad, .bc-sci { margin-top: 0; gap: 6px; }
.bc-sci { grid-template-columns: repeat(5, 1fr); }
.k { height: 44px; border-radius: 12px; font-size: 1.2rem; padding: 0; line-height: 1; }
.k-fn, .k-mode { font-size: 1.05rem; }
.k-op, .k-eq { font-size: 1.5rem; }
.k-sci { height: 34px; font-size: .88rem; border-radius: 9px; }
.bc-res { font-size: 2.4rem; line-height: 1.15; }
.bc-expr { font-size: 1rem; min-height: 1.3em; }
@media (min-width: 700px) {
  .bc { max-width: 700px; padding: 10px 12px 12px; }
  .bc-body { grid-template-columns: 3fr 4fr; gap: 10px; align-items: stretch; margin-top: 8px; }
  .bc-sci { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(5, 1fr); }
  .bc-pad { grid-template-rows: repeat(5, 1fr); }
  .k, .k-sci { height: 46px; }
  .k-sci { font-size: .95rem; border-radius: 12px; }
  .bc-hist { max-height: 84px; }
  .bc-res { font-size: 2.9rem; }
}
@media (max-width: 899px) { .k { height: 44px; } .k-sci { height: 34px; } }
@media (max-width: 360px) { .k { height: 42px; } .k-sci { height: 32px; } .bc-res { font-size: 2.1rem; } }
@media (min-width: 700px) and (max-width: 899px) { .k, .k-sci { height: 46px; } }
@media (min-width: 1000px) { .k, .k-sci { height: 46px; } .bc-res { font-size: 3rem; } }
.home-lists { margin-top: 6px; }
.home-lists .cats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 899px) { .home-lists .cats { grid-template-columns: 1fr 1fr; } .home-lists .tool { padding: 12px; } .home-lists .tool::after { display: none; } }

/* v32: Add days — line 1 start date, line 2 "Then" + four boxes side by side */
@media (min-width: 900px) {
  .fc-date:not(.fc-time) .fld.fld-g { display: flex; align-items: flex-end; gap: 14px; }
  .fc-date .fld-g .fld-top { display: grid; gap: 4px; justify-content: stretch; width: 130px; flex: 0 0 130px; }
  .fc-date .fld-g .fld-top label { min-width: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
  .fc-date .fld-g .fld-top .ctl-group { width: 100%; flex: none; }
  .fc-date .fld-g .dur4 { margin-top: 0; flex: 1 1 auto; max-width: 400px; }
}
@media (min-width: 900px) { .fc-date:not(.fc-time) .fld.fld-g > .fld-top { grid-template-columns: minmax(0, 1fr) !important; width: 130px; } .fc-date .fld-g .fld-top .ctl-group select.ctl { width: 100%; } }
.bc-top { z-index: 2; }
.bc-hist { z-index: auto; } .bc-top { z-index: 4; }

/* v33: history lives above the answer and shows when you scroll the screen; smaller keys; 25 scientific keys */
.bc-screen { display: block; position: relative; height: 112px; min-height: 0; padding: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; scroll-snap-type: y proximity; scrollbar-width: thin; scrollbar-color: rgba(255,211,122,.45) transparent; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.bc-screen::-webkit-scrollbar { width: 4px; }
.bc-screen::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.bc-screen::-webkit-scrollbar-thumb { background: rgba(255,211,122,.4); border-radius: 4px; }
.bc-screen::-webkit-scrollbar-thumb:hover { background: rgba(255,211,122,.7); }
.bc-screen.has-hist::before { content: ""; position: sticky; top: 0; display: block; height: 0; }
.bc-cur { position: relative; box-sizing: border-box; min-height: 100%; padding: 8px 14px 8px 12px; display: flex; flex-direction: column; justify-content: flex-end; scroll-snap-align: end; }
.bc-cur::before { content: ""; position: absolute; top: 4px; left: 50%; width: 28px; height: 3px; margin-left: -14px; border-radius: 3px; background: rgba(255,255,255,.22); opacity: 0; }
.has-hist .bc-cur::before { opacity: 1; }
.bc-hist { display: block; position: static; max-height: none; overflow: visible; padding: 10px 14px 0 12px; background: transparent; box-shadow: none; }
.bc-hist:empty { display: none; }
.bc-h { display: flex; width: 100%; justify-content: flex-end; align-items: baseline; gap: 8px; padding: 3px 4px; font-size: .85rem; }
.bc-h strong { font-size: .95rem; }
.bc-clr { display: block; margin: 0 0 4px; padding: 2px 0; background: none; border: 0; color: var(--amber); opacity: .75; font: inherit; font-size: .75rem; cursor: pointer; text-decoration: underline; }
.bc-top { display: none; }
.bc-cur .bc-ico { position: absolute; left: 6px; bottom: 6px; width: 30px; height: 28px; opacity: .8; }
.bc-cur .bc-ico.done::after { left: 38px; top: 4px; }
.bc-res { font-size: 2.2rem; }
.bc-sci { grid-template-columns: repeat(5, 1fr); }
.bc-body, .bc-sci, .bc-pad { gap: 5px; }
.k { height: 40px; border-radius: 11px; font-size: 1.12rem; }
.k-op, .k-eq { font-size: 1.35rem; }
.k-sci { height: 30px; font-size: .8rem; border-radius: 8px; }
@media (min-width: 700px) {
  .bc { max-width: 760px; }
  .bc-screen { height: 128px; }
  .bc-body { grid-template-columns: 5fr 4fr; gap: 10px; }
  .bc-sci { grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); }
  .bc-pad { grid-template-rows: repeat(5, 1fr); }
  .k, .k-sci { height: 40px; }
  .k-sci { font-size: .9rem; border-radius: 10px; }
  .bc-res { font-size: 2.7rem; }
}
@media (max-width: 899px) { .k { height: 40px; } .k-sci { height: 30px; } }
@media (max-width: 360px) { .k { height: 38px; } .k-sci { height: 28px; } }
@media (min-width: 700px) and (max-width: 899px) { .k, .k-sci { height: 40px; } }
@media (min-width: 1000px) { .k, .k-sci { height: 42px; } .bc-res { font-size: 2.9rem; } }

/* v34: column heads in Unit price, room for suffixes, wider pay-period select */
.opt-head { margin-bottom: -4px; }
.opt-head .opt-f span { font-size: .75rem; font-weight: 600; color: var(--muted); }
.opt-head .opt-n { visibility: hidden; }
@media (max-width: 640px) { .opt-head .opt-n { display: none; } .opt-head { grid-template-columns: 1fr; } }
.fld-top .ctl-group.has-suffix .ctl { padding-right: 52px; }
.ctl-group.per-wide select.ctl { flex: 0 0 8.2em; min-width: 8.2em; }

/* v35: cash counter — compact rows, label and input at the same size */
.den { grid-template-columns: minmax(0, 1fr) 92px; gap: 6px; }
.den label { font-size: 1rem; font-weight: 600; line-height: 1; white-space: nowrap; }
.den .ctl { height: 40px; font-size: 1rem; padding: 0 10px; }
.den-grid { gap: 8px 16px; }
.fc-cash .den-h { margin: 2px 0 -4px; }
@media (min-width: 900px) {
  .den label, .den .ctl { font-size: .95rem; }
  .den .ctl { height: 36px; padding: 0 10px; }
  .den-grid { gap: 6px 20px; }
}

/* v36: cash counter — several amounts and note choices */
.fc-cash textarea.ctl { width: 100%; min-height: 64px; resize: vertical; padding: 8px 10px; line-height: 1.35; font-family: inherit; }
.fc-cash .hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.fc-cash .fld-g .den-h { margin: 0 0 8px; }
.chks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.fc-cash textarea.ctl { text-align: left; }
.fc-cash .fld-g .den-h { margin: 0 0 6px; }
.fc-cash .fld-g { gap: 0; }
@media (min-width: 1200px) { .calc-grid.split > .fc-cash { width: 420px; max-width: 100%; } .fc-cash .hint { max-width: 380px; } }
.schedule.sch-mix td:last-child, .schedule.sch-mix th:last-child { text-align: left; }
@media (min-width: 641px) { .fc-cash .fld-top { grid-template-columns: 84px minmax(0, 1fr); } .fc-cash .ctl-group { min-width: 0; } .fc-cash textarea.ctl { max-width: 100%; box-sizing: border-box; } .chks { gap: 8px 12px; } }
