:root {
  color-scheme: light dark;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16191d;
  --muted: #5b6470;
  --line: #dde1e6;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ec;
  --ok: #17703f;
  --ok-soft: #e4f4ea;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --focus: #2b6cdf;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #191d23;
    --surface-2: #20252c;
    --text: #e8ebef;
    --muted: #9aa4b0;
    --line: #2f353e;
    --accent: #4cc3a2;
    --accent-ink: #062019;
    --accent-soft: #15322b;
    --ok: #5fd08f;
    --ok-soft: #14301f;
    --bad: #ff8a80;
    --bad-soft: #3a1b19;
    --warn: #f2c15b;
    --warn-soft: #352a12;
    --focus: #7aa7ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr, .sr-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }

/* header */
.site { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: inline-block; position: relative; flex: none; }
.logo::before, .logo::after { content: ""; position: absolute; left: 6px; right: 6px; height: 3px; border-radius: 2px; background: var(--accent-ink); top: 8px; box-shadow: 0 6px 0 var(--accent-ink); }
.logo::after { top: 20px; right: 11px; box-shadow: none; }
nav { display: flex; gap: 18px; }
nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
nav a:hover { color: var(--text); }
@media (max-width: 560px) { nav { display: none; } }

/* hero + tool */
.hero { padding: 40px 0 28px; }
h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; max-width: 22ch; }
.lede { font-size: clamp(17px, 2vw, 19px); color: var(--muted); max-width: 62ch; margin: 0 0 16px; }
.privacy-pill { display: inline-flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); padding: 10px 14px; border-radius: 10px; margin: 0 0 22px; max-width: 100%; }
.privacy-pill svg { color: var(--accent); flex: none; margin-top: 3px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px -12px rgb(0 0 0 / .12); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 190px; padding: 24px 16px; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 10px; cursor: pointer; color: var(--muted); transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: var(--accent-soft); border-color: var(--accent); }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop svg { color: var(--accent); }
.drop-main { font-size: 18px; font-weight: 600; color: var(--text); }
.drop-main u { color: var(--accent); text-underline-offset: 3px; }
.drop-sub { font-size: 14px; }
.samples { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.link { background: none; border: 0; padding: 2px 4px; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pw { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.pw[hidden] { display: none; }
.pw input { flex: 1 1 200px; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-width: 100%; }
.status { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.status[data-kind="ok"] { background: var(--ok-soft); color: var(--ok); }
.status[data-kind="err"] { background: var(--bad-soft); color: var(--bad); }
.status[data-kind="warn"] { background: var(--warn-soft); color: var(--warn); }
.status[data-kind="busy"]::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status[data-kind="busy"]::before { animation: none; } }

/* buttons */
.btn { font: inherit; font-size: 15px; font-weight: 600; min-height: 42px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }

/* result */
.result { padding: 8px 0 32px; }
.result[hidden] { display: none; }
.result-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 12px; }
.result-head h2 { margin: 0; font-size: 24px; }
.summary { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.warnings { margin: 0 0 12px; padding: 10px 12px 10px 30px; background: var(--warn-soft); color: var(--warn); border-radius: 8px; font-size: 14px; }
.panel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 820px) { .panel-grid { grid-template-columns: 1fr; } }
.recon-box, .opts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.recon-box h3, .opts h3 { margin: 0 0 10px; font-size: 16px; }
.bal-inputs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.bal-inputs label, .opts label { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); gap: 4px; flex: 1 1 150px; }
#recon dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
#recon dt { font-size: 13px; color: var(--muted); }
#recon dd { margin: 0; font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
#recon small { font-family: system-ui, sans-serif; color: var(--muted); }
.verdict { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict.na { background: var(--surface-2); color: var(--muted); }
.opt-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap:not(.plain) { max-height: 70vh; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
#rows th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
#rows th.debit, #rows th.credit, #rows th.amount, #rows th.balance { text-align: right; }
#rows td.debit, #rows td.credit, #rows td.amount, #rows td.balance { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
#rows td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
#rows td.description { min-width: 220px; }
#rows td.n, #rows th.n { color: var(--muted); width: 1%; text-align: right; }
#rows td[contenteditable]:hover { background: var(--surface-2); }
#rows td[contenteditable]:focus { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--surface); }
#rows td[aria-invalid="true"] { background: var(--bad-soft); }
#rows tr.mismatch td { background: var(--bad-soft); }
#rows td.debit:not(:empty) { color: var(--bad); }
#rows td.credit:not(:empty) { color: var(--ok); }
.del { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; width: 28px; height: 28px; border-radius: 6px; display: block; cursor: pointer; }
.del:hover { background: var(--bad-soft); color: var(--bad); }

/* content */
.content { border-top: 1px solid var(--line); padding: 40px 0 24px; }
.prose { max-width: 820px; }
.prose h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.25; margin: 40px 0 12px; letter-spacing: -0.01em; }
.prose section:first-child h2 { margin-top: 0; }
.prose h3 { font-size: 17px; margin: 0 0 8px; }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.prose li { margin: 6px 0; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 44px; margin: 14px 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card ul { padding-left: 18px; margin: 0; font-size: 15px; }
.compare td, .compare th { font-size: 15px; }
.compare tbody th { color: var(--text); white-space: normal; }
details { border-bottom: 1px solid var(--line); padding: 4px 0; }
summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
details p { margin: 0 0 14px; }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 20px 0 32px; }
