/* KiraDuit: ledger-green ink on paper, with a banknote-gold highlight for the answer. */
:root {
  --paper: #f7f8f5;
  --surface: #ffffff;
  --ink: #142320;
  --muted: #5a6b66;
  --line: #dde3df;
  --brand: #0b5345;
  --brand-ink: #ffffff;
  --gold: #f6c453;
  --gold-soft: #fdf3d8;
  --tint: #edf4f1;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1714; --surface: #15201c; --ink: #e5ede9; --muted: #9aaba5; --line: #283632;
    --brand: #2f9c83; --brand-ink: #06110e; --gold: #f6c453; --gold-soft: #2e2711; --tint: #17251f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font); }
a { color: var(--brand); }
a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.4rem); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 750; }

.top { background: var(--brand); color: var(--brand-ink); }
.top-in, .nav-in, .main, .foot-in { max-width: 1060px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.logo-mark { background: var(--gold); color: #3b2a00; font: 800 0.8rem var(--font); padding: 4px 6px; border-radius: 6px; letter-spacing: 0.02em; }
.lang { color: inherit; font-size: 0.9rem; opacity: 0.9; }
.nav { background: color-mix(in srgb, var(--brand) 85%, #000); }
.nav-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-block: 6px; }
.nav-in::-webkit-scrollbar { display: none; }
.nav a { color: var(--brand-ink); text-decoration: none; font-size: 0.9rem; padding: 6px 10px; border-radius: 99px; white-space: nowrap; opacity: 0.88; }
.nav a:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }

.main { display: grid; gap: 32px; padding-block: 28px 48px; }
.intro { display: grid; gap: 8px; }
.lede { margin: 0; color: var(--muted); font-size: 1.1rem; max-width: 62ch; }

.calc-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 860px) { .calc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } .result { position: sticky; top: 16px; } }

.calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label { font-weight: 600; font-size: 0.95rem; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hint-cap { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.control { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; }
.control:focus-within { border-color: var(--brand); }
.control input, .control select { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; font: 600 1.1rem var(--font); padding: 11px 12px; font-variant-numeric: tabular-nums; }
.control input:focus, .control select:focus { outline: none; }
.affix { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 0.9rem; background: var(--tint); white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.result { display: grid; gap: 14px; background: var(--tint); border-radius: var(--radius); padding: 20px; min-width: 0; }
.hero { display: grid; gap: 2px; background: var(--surface); border-radius: 10px; padding: 16px 18px; border-left: 6px solid var(--gold); }
.hero-label { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.hero-value { font-size: clamp(2rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-sub { font-size: 0.9rem; color: var(--muted); }
.rows { margin: 0; display: grid; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.row dt { color: var(--muted); }
.row dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row.total { border-bottom: 0; border-top: 1.5px solid var(--ink); }
.row.total dt { color: var(--ink); font-weight: 650; }
.sub { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-top: 6px; }
.hint { margin: 0; font-size: 0.9rem; color: var(--muted); }
.yearly summary { cursor: pointer; font-weight: 650; color: var(--brand); padding: 4px 0; }
.tablebox { overflow-x: auto; margin-top: 8px; max-height: 420px; overflow-y: auto; border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.8rem; }

.ad { display: grid; gap: 4px; min-height: 280px; }
.ad-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

.prose { max-width: 68ch; display: grid; gap: 14px; }
.prose p, .prose ul { margin: 0; }
.prose ul { padding-left: 20px; display: grid; gap: 6px; }
.prose h2 { margin-top: 10px; }
.prose .src { font-size: 0.9rem; color: var(--muted); }
.email { user-select: all; font-family: var(--mono); font-weight: 600; }

.related { display: grid; gap: 14px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { display: grid; gap: 4px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.card b { color: var(--brand); font-size: 1.02rem; }
.card span { color: var(--muted); font-size: 0.92rem; }
.card:hover { border-color: var(--brand); transform: translateY(-1px); }
.card.big { padding: 20px; }

.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { display: grid; gap: 6px; padding-block: 24px 36px; font-size: 0.9rem; color: var(--muted); }
.foot p { margin: 0; }
.foot-nav { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.why { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.working summary { cursor: pointer; font-weight: 650; color: var(--brand); padding: 4px 0; }
.working ol { margin: 8px 0 0; padding: 12px 12px 12px 32px; background: var(--surface); border-radius: 8px; display: grid; gap: 4px; font-variant-numeric: tabular-nums; font-size: 0.93rem; }
.stamp { margin: 0; font-size: 0.88rem; color: var(--muted); }
.stamp::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: 1px; }
.nav-notes { border: 1px solid rgba(255, 255, 255, 0.35); }
.byline { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--muted); }
.byline img, .avatar { border-radius: 50%; object-fit: cover; }
.intro.author { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.note-meta { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.prose blockquote { margin: 0; padding: 4px 16px; border-left: 4px solid var(--gold); color: var(--muted); }
.prose code { font-family: var(--mono); font-size: 0.92em; background: var(--tint); padding: 1px 5px; border-radius: 4px; }
.cta { display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 650; padding: 10px 16px; border-radius: 10px; }

/* "Number looks wrong?" report form under each calculator */
.feedback { margin: 16px 0 0; border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 10px 16px; background: var(--surface); }
.feedback summary { cursor: pointer; font-weight: 650; color: var(--brand); }
.fb-form { display: grid; gap: 12px; margin-top: 12px; max-width: 560px; }
.fb-form .control input, .fb-form .control select, .fb-form textarea { font-weight: 400; font-size: 1rem; }
.fb-form textarea { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; font: 1rem var(--font); padding: 11px 12px; resize: vertical; }
.fb-form textarea:focus { outline: none; }
.fb-form button { justify-self: start; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; font: 650 1rem var(--font); padding: 10px 16px; cursor: pointer; }
.fb-form button:disabled { opacity: 0.6; cursor: wait; }
.fb-form button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-status { margin: 0; font-weight: 600; }
.fb-status:empty { display: none; }
