/* Statement extractor: one stylesheet, no build step.
 *
 * Direction "A2, bank ink": an accountant's working ledger in a bank's own
 * blue. A navy masthead and homepage hero, a blue-tinted page, white sheets
 * for the work itself; the transaction table stays the one memorable element -
 * a ruled ledger: a hairline under every row, figures in tabular numerals,
 * debits in red ink. Headings in Schibsted Grotesk, text in Public Sans,
 * sample figures in IBM Plex Mono (all self-hosted, static/fonts, OFL).
 *
 * Theme: tokens on :root. Dark applies when the visitor chose it
 * (data-theme="dark", set before paint by theme-init.js), or when they left
 * it on System and the OS is dark. Regions (masthead, hero, strip, footer,
 * bands) have tokens of their own, so a palette change is a token change.
 */

@font-face {
  font-family: "Public Sans";
  src: url("/static/fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/static/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #e9f0f9;
  --surface: #ffffff;
  --surface-2: #f2f6fc;
  --ink: #0f2340;
  --ink-2: #33486a;
  --muted: #4f6386;
  --rule: #c8d6ea;
  --rule-strong: #a9bcd8;
  --field-border: #6f84a6; /* form fields: 3:1 on every surface (WCAG 1.4.11) */
  --accent: #1d4f91;
  --accent-hover: #163d70;
  --accent-ink: #ffffff;
  --accent-soft: #d9e6f7;
  --debit: #9c2f25;
  --credit: #1f6b43;
  --ok: #1f6b43;      --ok-bg: #e2f0e6;
  --warn: #7a4f00;    --warn-bg: #fbefd6;
  --bad: #a12c22;     --bad-bg: #fbe5e2;
  --focus: #2f6fd0;
  --shadow: 0 1px 2px rgb(15 35 64 / 7%), 0 4px 16px rgb(15 35 64 / 6%);
  --shadow-lift: 0 2px 4px rgb(15 35 64 / 8%), 0 18px 40px rgb(15 45 87 / 22%);

  /* regions */
  --head-bg: #0b2447;       --head-ink: #ffffff;  --head-ink-2: #c4d4ec;
  --head-line: #1f3d68;     --head-hover: rgb(255 255 255 / 9%);
  --head-cta: #ffffff;      --head-cta-ink: #0b2447;
  --hero-bg: linear-gradient(180deg, #0b2447 0%, #16437e 70%, #1d4f91 100%);
  --hero-ink: #ffffff;      --hero-ink-2: #cbdaf0;  --hero-eyebrow: #9cc0ef;
  --strip-bg: #d9e6f7;
  --alt-bg: #f6f9fd;
  --trust-bg: #0f2d57;      --trust-ink: #ffffff;   --trust-ink-2: #cbdaf0;
  --band-bg: #1d4f91;       --band-ink: #ffffff;    --band-ink-2: #d3e1f4;  --band-eyebrow: #ffd38a;
  --foot-bg: #0b2447;       --foot-ink: #b5c6e0;    --foot-strong: #ffffff;  --foot-link: #d6e4f7;

  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Schibsted Grotesk", "Public Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.3125rem;
  --step-3: 1.75rem;
  --step-4: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem);
  --radius-s: 4px;
  --radius-m: 6px;
  --radius-l: 10px;
  --radius-xl: 14px;
  --gutter: clamp(1rem, 3vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f1418;
    --surface: #171e24;
    --surface-2: #1c242b;
    --ink: #e6ebef;
    --ink-2: #c3ccd3;
    --muted: #95a1ab;
    --rule: #2a333b;
    --rule-strong: #3d4851;
    --field-border: #6b7782;
    --accent: #8fb4ea;
    --accent-hover: #a9c6f0;
    --accent-ink: #0f1a2a;
    --accent-soft: #1e2d42;
    --debit: #f0958a;
    --credit: #84cfa3;
    --ok: #8fd4aa;      --ok-bg: #173024;
    --warn: #e8c06a;    --warn-bg: #33290f;
    --bad: #f2998f;     --bad-bg: #3a1d1a;
    --focus: #8fb4ea;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 20%);
    --shadow-lift: 0 1px 2px rgb(0 0 0 / 40%), 0 12px 32px rgb(0 0 0 / 35%);
    --head-bg: #171e24;     --head-ink: #e6ebef;  --head-ink-2: #c3ccd3;
    --head-line: #2a333b;   --head-hover: rgb(255 255 255 / 6%);
    --head-cta: #8fb4ea;    --head-cta-ink: #0f1a2a;
    --hero-bg: linear-gradient(180deg, #151c22 0%, #0f1418 100%);
    --hero-ink: #e6ebef;    --hero-ink-2: #c3ccd3;  --hero-eyebrow: #8fb4ea;
    --strip-bg: #171e24;
    --alt-bg: #141a1f;
    --trust-bg: #1e2d42;    --trust-ink: #e6ebef;   --trust-ink-2: #c3ccd3;
    --band-bg: #1e2d42;     --band-ink: #ffffff;    --band-ink-2: #b4c2cf;  --band-eyebrow: #e8c06a;
    --foot-bg: #171e24;     --foot-ink: #95a1ab;    --foot-strong: #e6ebef;  --foot-link: #c3ccd3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1418;
  --surface: #171e24;
  --surface-2: #1c242b;
  --ink: #e6ebef;
  --ink-2: #c3ccd3;
  --muted: #95a1ab;
  --rule: #2a333b;
  --rule-strong: #3d4851;
  --field-border: #6b7782;
  --accent: #8fb4ea;
  --accent-hover: #a9c6f0;
  --accent-ink: #0f1a2a;
  --accent-soft: #1e2d42;
  --debit: #f0958a;
  --credit: #84cfa3;
  --ok: #8fd4aa;      --ok-bg: #173024;
  --warn: #e8c06a;    --warn-bg: #33290f;
  --bad: #f2998f;     --bad-bg: #3a1d1a;
  --focus: #8fb4ea;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 20%);
  --shadow-lift: 0 1px 2px rgb(0 0 0 / 40%), 0 12px 32px rgb(0 0 0 / 35%);
  --head-bg: #171e24;     --head-ink: #e6ebef;  --head-ink-2: #c3ccd3;
  --head-line: #2a333b;   --head-hover: rgb(255 255 255 / 6%);
  --head-cta: #8fb4ea;    --head-cta-ink: #0f1a2a;
  --hero-bg: linear-gradient(180deg, #151c22 0%, #0f1418 100%);
  --hero-ink: #e6ebef;    --hero-ink-2: #c3ccd3;  --hero-eyebrow: #8fb4ea;
  --strip-bg: #171e24;
  --alt-bg: #141a1f;
  --trust-bg: #1e2d42;    --trust-ink: #e6ebef;   --trust-ink-2: #c3ccd3;
  --band-bg: #1e2d42;     --band-ink: #ffffff;    --band-ink-2: #b4c2cf;  --band-eyebrow: #e8c06a;
  --foot-bg: #171e24;     --foot-ink: #95a1ab;    --foot-strong: #e6ebef;  --foot-link: #c3ccd3;
}

/* --- base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

/* `hidden` always wins over a component's own display. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

/* Proportional figures in headings: Schibsted Grotesk's tabular forms give
   "," and "." a full figure's width, which reads as a space before them. */
h1, h2, h3 { font-family: var(--font-display); font-variant-numeric: normal; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 1rem; top: -5rem; z-index: 10;
  padding: .5rem .9rem; background: var(--surface); border-radius: var(--radius-m);
  box-shadow: var(--shadow);
}
.skip:focus { top: .75rem; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ref { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* --- shell ----------------------------------------------------------------- */

.masthead {
  background: var(--head-bg);
  color: var(--head-ink);
  border-bottom: 1px solid var(--head-line);
}
.masthead-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: .6rem var(--gutter);
  display: flex;
  align-items: center;
  gap: .5rem 1.5rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  color: var(--head-ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.01em;
}
.brand:hover { color: var(--head-ink); }
.beta {
  font-family: var(--font); font-size: .6875rem; font-weight: 700; letter-spacing: .06em;
  padding: .15rem .4rem; border-radius: var(--radius-s);
  color: #5e3c00; background: #fbe3b0;
}

.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--head-ink-2); text-decoration: none; font-weight: 550;
  padding: .45rem .7rem; border-radius: var(--radius-m);
}
.nav a:hover { background: var(--head-hover); color: var(--head-ink); }
.nav a[aria-current="page"] { color: var(--head-ink); background: var(--head-hover); box-shadow: inset 0 -2px 0 var(--head-ink-2); }
/* Credits left (main._visitor), pushed to the end of the nav: a <details>
   whose summary is the pill and whose body is the small menu (nav.html). */
.credits-menu { margin-left: auto; align-self: center; position: relative; }
.credits-menu summary {
  list-style: none; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--head-line); color: var(--head-ink);
  font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.credits-menu summary::-webkit-details-marker { display: none; }
.credits-menu summary:hover, .credits-menu[open] summary, .credits-menu summary[aria-current] { background: var(--head-hover); border-color: var(--head-ink-2); }
.credits-menu summary svg { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.credits-menu[open] summary svg { transform: rotate(180deg); }
.credits-pop {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 20;
  width: min(19rem, calc(100vw - 2 * var(--gutter)));
  display: grid; gap: .6rem; padding: 1rem 1.1rem;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: var(--radius-l);
  box-shadow: var(--shadow-lift); font-size: var(--step--1);
}
.credits-pop-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.credits-pop-head span:first-child { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }
.credits-pop-balance { color: var(--muted); font-size: var(--step-0); }
.credits-pop-balance strong { font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; margin-right: .2rem; }
.credits-pop-beta { padding: .55rem .75rem; border-radius: var(--radius-m); background: var(--accent-soft); color: var(--accent); }
.nav .credits-pop a { color: var(--accent); background: none; padding: 0; font-weight: 650; }
.nav .credits-pop a:hover { color: var(--accent-hover); text-decoration: underline; }

.masthead-tools { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
/* The header's "free credits" button: the form says the same at phone width. */
@media (max-width: 560px) { .masthead .masthead-cta { display: none; } }
.auth { min-height: 2.25rem; display: flex; align-items: center; }
/* Buttons in the masthead: outlined on the navy, the call to action solid. */
.masthead .btn { background: transparent; color: var(--head-ink); border-color: var(--head-line); }
.masthead .btn:hover { background: var(--head-hover); border-color: var(--head-ink-2); color: var(--head-ink); }
.masthead .btn.primary { background: var(--head-cta); border-color: var(--head-cta); color: var(--head-cta-ink); }
.masthead .btn.primary:hover { background: var(--head-cta); color: var(--head-cta-ink); opacity: .92; }

.theme-switch {
  display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--head-line);
  border-radius: var(--radius-m); background: transparent;
}
.theme-switch label {
  display: grid; place-items: center; width: 2rem; height: 1.85rem;
  border-radius: var(--radius-s); color: var(--head-ink-2); cursor: pointer;
}
.theme-switch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-switch svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch label:hover { color: var(--head-ink); }
.theme-switch label:has(input:checked) { background: var(--head-hover); color: var(--head-ink); box-shadow: inset 0 0 0 1px var(--head-ink-2); }
.theme-switch label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

.page {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.75rem) var(--gutter) 4rem;
}

.footer {
  background: var(--foot-bg);
  color: var(--foot-ink);
  font-size: var(--step--1);
}
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 1.75rem var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem;
}
.footer-about { display: grid; gap: .25rem; max-width: 34rem; }
.footer-about strong { color: var(--foot-strong); font-family: var(--font-display); font-size: var(--step-0); }
.footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: start; }
.footer a { color: var(--foot-link); }
.footer a:hover { color: var(--foot-strong); }

.intro { margin-bottom: 1.75rem; max-width: 46rem; }
.intro h1 { max-width: 22ch; }
.lede { margin-top: .6rem; color: var(--ink-2); font-size: var(--step-1); max-width: 58ch; }
.intro-row {
  max-width: none; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}

/* --- controls -------------------------------------------------------------- */

.btn, button {
  font: inherit;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.5rem;
  padding: .5rem 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.small { min-height: 2rem; padding: .25rem .65rem; font-size: var(--step--1); }
.btn.danger, .danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
button:disabled, .btn[disabled] { opacity: .55; cursor: progress; }

button.link {
  background: none; border: 0; padding: 0; color: var(--accent);
  text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}

.field { display: grid; gap: .35rem; max-width: 24rem; }
.field > span { font-weight: 600; font-size: var(--step--1); color: var(--ink-2); }
input[type="password"], input[type="text"], input[type="search"] {
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .7rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: inherit;
  font: inherit;
}

/* Small dropdown for secondary actions. A <details>, so no script. */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; font-size: .8em; color: var(--muted); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5;
  min-width: 13rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m);
  box-shadow: var(--shadow);
  display: grid;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left;
  padding: .5rem .65rem; border: 0; border-radius: var(--radius-s);
  background: none; color: var(--ink); text-decoration: none; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel .danger { color: var(--bad); }

/* --- upload ---------------------------------------------------------------- */

.sheet {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}

.upload {
  max-width: 46rem;
  padding: clamp(1rem, 3vw, 1.75rem);
  display: grid;
  gap: 1.1rem;
}

.dropzone {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .25rem 1rem;
  padding: 1.6rem 1.4rem;
  border: 1.5px dashed var(--field-border);
  border-radius: var(--radius-m);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The real input covers the zone: clicks, keyboard and drops all reach it. */
.dropzone input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dropzone-icon {
  grid-row: span 2;
  fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.dropzone-text { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; }
.dropzone-text strong { font-size: var(--step-1); }
.dropzone-hint { color: var(--muted); }
.dropzone-file { color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }
.dropzone-file:empty { display: none; }
/* One password field per chosen file (ui.js), when several are chosen. */
[data-password-list] { display: grid; gap: .5rem; }
[data-password-list]:empty { display: none; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dropzone.has-file .dropzone-hint { display: none; }
.dropzone.has-file .dropzone-text strong::after { content: " (change)"; font-weight: 400; color: var(--muted); font-size: var(--step-0); }

.limits {
  display: flex; flex-wrap: wrap; gap: .3rem 1.25rem;
  margin: 0; padding: 0; list-style: none;
  color: var(--muted); font-size: var(--step--1);
}
.limits li::before { content: "·" / ""; margin-right: .45rem; color: var(--rule-strong); font-weight: 700; }
.limits li:first-child::before { content: none; }

.password summary {
  cursor: pointer; color: var(--accent); font-weight: 550; width: fit-content;
}
.password[open] summary { margin-bottom: .75rem; }

.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }

.fineprint { color: var(--muted); font-size: var(--step--1); max-width: 60ch; }

/* htmx sets .htmx-request on the hx-indicator element for the request's duration */
.busy { display: none; align-items: center; gap: .55rem; color: var(--muted); font-size: var(--step--1); }
.busy.htmx-request { display: flex; }
.spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result { max-width: 46rem; }
.result:not(:empty) { margin-top: 1.25rem; }
.result .panel { margin-top: 0; }

/* --- homepage (index.html) ------------------------------------------------ */

/* The homepage's <main>: full width, each section a band with its own .wrap. */
.landing { flex: 1; width: 100%; }
.wrap { max-width: 1160px; margin: 0 auto; padding-inline: var(--gutter); }
.eyebrow {
  font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.hero { background: var(--hero-bg); color: var(--hero-ink); padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 6vw, 4.75rem); }
.hero .eyebrow { color: var(--hero-eyebrow); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 4vw, 3rem); align-items: start; }
.hero-copy { display: grid; gap: 1.25rem; min-width: 0; }
.hero h1 { font-size: var(--step-4); line-height: 1.04; font-weight: 800; letter-spacing: -0.025em; max-width: 16ch; }
.hero-lede { color: var(--hero-ink-2); font-size: 1.1875rem; max-width: 34em; }
.hero .upload { max-width: none; color: var(--ink); box-shadow: var(--shadow-lift); border-color: transparent; border-radius: var(--radius-xl); }
.hero .result { color: var(--ink); max-width: none; }
.hero-note { display: flex; gap: .5rem; align-items: center; color: var(--hero-ink-2); font-size: var(--step--1); }
.hero-note svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The thesis, drawn: a statement page and the checked sheet made from it. */
.sample { position: relative; min-width: 0; padding-top: .5rem; color: var(--ink); }
.sample-pdf {
  width: 86%; padding: 1.1rem 1.25rem; font-size: .6875rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m);
}
.sample-pdf-head {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  border-bottom: 2px solid var(--ink); padding-bottom: .5rem; margin-bottom: .6rem;
}
.sample-pdf-head strong { font-size: .75rem; letter-spacing: .04em; }
.sample-pdf-rows { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: .25rem .75rem; font-size: .625rem; white-space: nowrap; }
.sample-pdf-lines { margin-top: .75rem; display: grid; gap: .4rem; }
.sample-pdf-lines span { height: 6px; border-radius: 3px; background: var(--rule); }
.sample-sheet {
  position: relative; margin: -2.25rem 0 0 8%;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-l);
  overflow: hidden; box-shadow: var(--shadow-lift);
}
.sample-sheet-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--rule);
  font-size: var(--step--1);
}
.sample-sheet .ledger-wrap { border: 0; border-radius: 0; }
.sample-sheet table { width: 100%; border-collapse: collapse; font-size: .6875rem; }
.sample-sheet th, .sample-sheet td { padding: .5rem .55rem; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.sample-sheet th { font-family: var(--font); font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.sample-sheet tbody tr:last-child td { border-bottom: 0; }
.sample-sheet .num { text-align: right; }
.sample-sheet .debit { color: var(--debit); }
.sample-sheet .credit { color: var(--credit); }
.sample-caption { margin: .6rem 0 0 8%; color: var(--hero-ink-2); font-size: .75rem; }
.verified {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .15rem .55rem; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); font-weight: 600; font-size: .75rem;
}

.facts-band { background: var(--strip-bg); border-bottom: 1px solid var(--rule); padding-block: 1.75rem; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin: 0; }
.facts div { display: grid; gap: .1rem; }
.facts dt { order: 2; color: var(--ink-2); font-size: var(--step--1); }
.facts dd { order: 1; margin: 0; font-family: var(--font-display); font-variant-numeric: normal; font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; }

.section { padding-block: clamp(3rem, 7vw, 5rem); }
.section-alt { background: var(--alt-bg); border-block: 1px solid var(--rule); }
.section-head { display: grid; gap: .6rem; max-width: 44rem; margin-bottom: 2rem; }
.section-head h2, .section h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }

.trust {
  background: var(--trust-bg); color: var(--trust-ink); border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 2.5rem; align-items: start;
}
.trust .eyebrow { color: var(--hero-eyebrow); }
.trust-copy { display: grid; gap: .75rem; }
.trust-copy p, .trust li span span { color: var(--trust-ink-2); }
.trust ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.trust li { display: flex; gap: .85rem; }
.trust svg, .cap svg, .limit svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trust svg { margin-top: .15rem; }

.caps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden;
}
.cap { background: var(--surface); padding: 1.6rem; display: grid; gap: .6rem; align-content: start; }
.cap svg {
  width: 2.6rem; height: 2.6rem; padding: .5rem; border-radius: 10px;
  color: var(--accent); background: var(--accent-soft); stroke-width: 1.8;
}
.cap h3 { font-size: 1.1875rem; }
.cap p { color: var(--ink-2); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.steps li {
  display: grid; gap: .45rem; align-content: start;
  background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--accent);
  border-radius: var(--radius-l); padding: 1.25rem;
}
.steps .mono { color: var(--accent); font-size: var(--step--1); }
.steps strong { font-family: var(--font-display); font-variant-numeric: normal; font-size: 1.25rem; }
.steps li > span:last-child { color: var(--ink-2); }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 3rem); }
.two > div { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.chips li {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 .85rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: .875rem;
}
.more-link { font-weight: 600; }
/* A chip that is a link (the homepage's banks, a bank page's others): the
   whole pill is the target. */
.chips a {
  display: flex; align-items: center; min-height: 2.25rem;
  margin: 0 -.85rem; padding: 0 .85rem; border-radius: 999px;
  color: inherit; text-decoration: none;
}
.chips li:has(a:hover) { border-color: var(--accent); color: var(--accent); }

/* A bank's page (bank.html): the upload form beside what it gives. */
.bank-page { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.bank-upload .upload { max-width: none; }
/* A statement's column headings, as a ruled header row that wraps. */
.prose ol.stmt-cols {
  list-style: none; padding: 0; margin: .5rem 0 .75rem;
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-m);
  background: var(--surface); overflow: hidden;
}
.prose ol.stmt-cols li {
  margin: 0 !important; padding: .4rem .7rem; flex: 1 1 auto;
  font-size: var(--step--1); font-weight: 650; color: var(--ink-2); white-space: nowrap;
  border-right: 1px solid var(--rule); box-shadow: 0 1px 0 var(--rule);
}
.bank-others { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--rule); display: grid; gap: 1rem; }
@media (max-width: 860px) { .bank-page { grid-template-columns: 1fr; } }

.limit-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.limit { display: flex; gap: .85rem; padding: 1.1rem 1.25rem; }
.limit + .limit { border-top: 1px solid var(--rule); }
.limit svg { width: 1.35rem; height: 1.35rem; margin-top: .1rem; color: var(--bad); }
.limit.warn svg { color: var(--warn); }
.eyebrow.warn { color: var(--warn); }

.band {
  background: var(--band-bg); color: var(--band-ink-2); border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; gap: 1.5rem 2rem; align-items: center; justify-content: space-between;
}
.band > div { display: grid; gap: .6rem; max-width: 44rem; }
.band .eyebrow { color: var(--band-eyebrow); }
.band h2 { color: var(--band-ink); }
.band .btn { background: #ffffff; color: #0b2447; border-color: #ffffff; min-width: 12rem; min-height: 2.75rem; }
.band .btn:hover { background: #eef3fa; color: #0b2447; }

.faq { display: grid; gap: 0; }
.faq > * { max-width: 52rem; }
.faq h2 { margin-bottom: 1rem; }
.faq details { border-bottom: 1px solid var(--rule); padding-block: .9rem; }
.faq summary { font-weight: 600; cursor: pointer; min-height: 2rem; display: flex; align-items: center; }
.faq details p { margin-top: .5rem; color: var(--ink-2); max-width: 68ch; }

@media (max-width: 860px) {
  .hero-grid, .two, .trust { grid-template-columns: 1fr; }
  .caps, .steps { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sample { display: none; }
}

/* --- panels, notes --------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-top: 1.25rem;
}
.panel h2 { font-size: var(--step-1); margin-bottom: .4rem; }

.note { color: var(--muted); font-size: var(--step--1); margin-top: .6rem; max-width: 72ch; }

.callout {
  margin: 1rem 0 0;
  padding: .75rem 1rem;
  border-left: 3px solid var(--rule-strong);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  background: var(--surface-2);
  color: var(--ink-2);
  max-width: 80ch;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.callout .detail { display: block; margin-top: .3rem; color: var(--muted); font-size: var(--step--1); }

.problem { border-left: 3px solid var(--bad); }
.problem-message { font-weight: 550; max-width: 70ch; }
.problem p + p { margin-top: .75rem; }

.crumbs {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline;
  margin-bottom: 1rem; color: var(--muted); font-size: var(--step--1);
}
.crumbs [aria-current] { color: var(--ink-2); overflow-wrap: anywhere; }
.after-problem { margin-top: 1.25rem; }
.job-title { font-size: var(--step-2); font-weight: 650; overflow-wrap: anywhere; margin-bottom: 1rem; }
.page > .panel:first-of-type { margin-top: 0; }

.pending { overflow: hidden; position: relative; margin-top: 0; }
.pending h1 { font-size: var(--step-1); font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.pending p { color: var(--ink-2); max-width: 70ch; margin-top: .5rem; }
.pending-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; font-size: var(--step--1); color: var(--muted) !important; }
.pending-offline { display: none; color: var(--warn); font-weight: 600; }
.pending.is-offline .pending-offline { display: inline; }
.pending.is-offline .pending-bar span { animation-play-state: paused; background: var(--warn); }
.pending-bar { height: 3px; margin: calc(-1 * clamp(1rem, 3vw, 1.5rem)) calc(-1 * clamp(1rem, 3vw, 1.5rem)) 1rem; background: var(--accent-soft); overflow: hidden; }
.pending-bar span { display: block; width: 30%; height: 100%; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.badge {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: var(--radius-s);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}
.badge.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* --- a statement's result -------------------------------------------------- */

/* Not one box: a head on the page, the checks, the four totals, then the
   transactions and the details as cards. */
.statement { display: grid; gap: 1.25rem; min-width: 0; }
.statement > * { min-width: 0; }

.statement-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem 1.5rem;
}
.statement-title { min-width: 0; flex: 1 1 22rem; }
.statement-title h1 { font-size: var(--step-3); overflow-wrap: anywhere; }
.statement-title .acct { font-family: var(--font-mono); font-size: .7em; font-weight: 400; color: var(--muted); white-space: nowrap; }
[data-autofocus]:focus { outline: none; }
[data-autofocus]:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.statement-meta {
  display: flex; flex-wrap: wrap; gap: .2rem 0; margin-top: .4rem;
  color: var(--ink-2);
}
.statement-meta > span + span::before { content: "·"; margin-inline: .5rem; color: var(--muted); }
.statement-ref { margin-top: .25rem; color: var(--muted); font-size: var(--step--1); display: flex; flex-wrap: wrap; gap: 0 .5rem; }
.statement-ref .file { font-family: var(--font-mono); overflow-wrap: anywhere; }
.statement-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.statement-actions svg.dots { fill: currentColor; }

/* The balance check's verdict, one band. */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  padding: 1rem 1.15rem; border-radius: var(--radius-l);
  background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2);
}
.notice > svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notice-text { flex: 1 1 18rem; display: grid; gap: .2rem; min-width: 0; }
.notice-text strong { color: inherit; }
.notice-text span { font-size: var(--step--1); }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.warn .btn { background: transparent; color: var(--warn); border-color: currentColor; }
.notice.warn .btn:hover { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.statement > .callout { margin: 0; }

.tiles.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.tiles-4 .tile dd { font-family: var(--font-mono); font-size: var(--step-1); font-weight: 500; overflow-wrap: anywhere; }
.tile dd.cr { color: var(--credit); }
.tile dd.dr { color: var(--debit); }
@media (max-width: 860px) { .tiles.tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.statement-section { padding: clamp(1rem, 2.5vw, 1.4rem); }
.statement-section h2 { font-size: var(--step-1); margin-bottom: .85rem; }
.statement-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; margin-bottom: .85rem; }
.statement-section-head h2 { margin: 0; }
.statement-section-head > :last-child { margin-left: auto; }
.statement-section-head .link { font-size: var(--step--1); }

/* The ledger: ruled rows and columns, figures right-aligned. */
.ledger-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
}
.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--step--1); }
.ledger th, .ledger td { padding: .45rem .75rem; text-align: left; vertical-align: top; }
.ledger thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  border-bottom: 1.5px solid var(--rule-strong);
  font-weight: 650; color: var(--ink-2); white-space: nowrap;
}
/* Ruled, not banded: a hairline under every row, like a ledger book's ruling,
   so the eye follows a row across without blocks of tint. Nothing else is
   filled, which leaves colour for hover and for rows that need review. */
.ledger td, .ledger tbody th { border-bottom: 1px solid var(--rule); }
.ledger tbody tr:last-child > * { border-bottom: 0; }
.ledger tr > * + * { border-left: 1px solid var(--rule); }
.ledger tbody tr:hover > * { background: var(--accent-soft); }
.ledger .k-money { text-align: right; white-space: nowrap; }
.ledger .k-date { white-space: nowrap; }
.ledger td.k-text { min-width: 13rem; max-width: 34rem; overflow-wrap: anywhere; }
.ledger td.debit { color: var(--debit); }
.ledger td.credit { color: var(--credit); }
.ledger tbody tr.flagged > * { background: var(--bad-bg) !important; }
.ledger tbody tr.flagged > :first-child { box-shadow: inset 3px 0 0 var(--bad); }
.flag::before {
  content: "!"; display: inline-grid; place-items: center;
  width: 1rem; height: 1rem; margin-right: .4rem; border-radius: 50%;
  background: var(--bad); color: var(--surface); font-size: .7rem; font-weight: 800;
}

/* The transaction toolbar (transactions.js reveals it once every row is in). */
.txn-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem;
  margin-bottom: .85rem;
}
.txn-tools[hidden] { display: none; }
.txn-search { position: relative; flex: 1 1 18rem; max-width: 28rem; }
.txn-search svg {
  position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round;
}
.txn-search input { padding-left: 2.1rem; }
.seg {
  display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--rule);
  border-radius: var(--radius-m); background: var(--surface-2);
}
.seg[hidden] { display: none; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; padding: .3rem .75rem; border-radius: var(--radius-s);
  font-size: var(--step--1); font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 1px var(--field-border); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.check-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: var(--step--1); font-weight: 600; color: var(--bad); cursor: pointer;
}
.check-toggle[hidden] { display: none; }
.check-toggle input { width: 1rem; height: 1rem; accent-color: var(--bad); }
.txn-count { margin-left: auto; color: var(--muted); font-size: var(--step--1); white-space: nowrap; }
.txn-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.txn-empty[hidden] { display: none; }
.txn .note:empty { display: none; }

.ledger .k-row { width: 1%; text-align: right; color: var(--muted); font-weight: 400; white-space: nowrap; }
.ledger tbody tr:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.ledger th .sort {
  display: inline-flex; align-items: center; gap: .3rem; width: 100%;
  padding: 0; border: 0; background: none; color: inherit;
  font: inherit; font-weight: 650; cursor: pointer; justify-content: inherit;
}
.ledger th.k-money .sort, .ledger th.k-row .sort { justify-content: flex-end; }
.ledger th .sort:hover { color: var(--ink); }
.sort-icon { width: .6rem; color: var(--muted); }
.sort-icon::before { content: "↕"; opacity: .45; font-size: .8em; }
th[aria-sort="ascending"] .sort-icon::before { content: "↑"; opacity: 1; color: var(--accent); }
th[aria-sort="descending"] .sort-icon::before { content: "↓"; opacity: 1; color: var(--accent); }

.details {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem 2rem; margin: 0;
}
.details div { border-top: 1px solid var(--rule); padding-top: .5rem; }
.details dt { color: var(--muted); font-size: var(--step--1); }
.details dd { margin: .15rem 0 0; font-weight: 550; overflow-wrap: anywhere; }

/* --- history and credits ---------------------------------------------------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-head h1 { font-size: var(--step-3); }
.page-head p { margin-top: .3rem; color: var(--muted); max-width: 60ch; }
.btn svg.icon { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.history {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  overflow: hidden;
  font-size: var(--step--1);
  box-shadow: var(--shadow);
}
.history th {
  text-align: left; font-weight: 650; color: var(--muted);
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .75rem .9rem; border-bottom: 1px solid var(--rule-strong);
  background: var(--surface-2); white-space: nowrap;
}
.history td { padding: .8rem .9rem; vertical-align: middle; }
.history tbody + tbody td { border-top: 1px solid var(--rule); }
.history tbody:hover td { background: var(--surface-2); }
.history .k-money { text-align: right; font-variant-numeric: tabular-nums; }
.history .file { font-weight: 600; max-width: 22rem; overflow-wrap: anywhere; }
.history .file a { color: var(--ink); text-decoration: none; }
.history .file a:hover { color: var(--accent); text-decoration: underline; }
.history .when { font-family: var(--font-mono); font-size: .8125rem; color: var(--ink-2); }
.history .sub { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; margin-top: .1rem; }
.history .cr { color: var(--ok); }
.history .delta { font-weight: 650; font-family: var(--font-mono); }
.history .bal { font-family: var(--font-mono); }

/* "Keeping your data", at the foot of My statements. */
.keeping {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: var(--step--1);
}
.keeping svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* The Credits page's three figures. */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile {
  display: grid; gap: .3rem; align-content: start; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-l);
}
.tile dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tile dd { margin: 0; font-family: var(--font-display); font-size: var(--step-3); font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile dd.tile-note { font-family: var(--font); font-size: .8125rem; font-weight: 400; color: var(--muted); }
.beta-note {
  margin-bottom: 1.25rem; padding: .75rem 1rem; border-radius: var(--radius-m);
  background: var(--accent-soft); color: var(--accent); font-size: var(--step--1); max-width: none;
}
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr; } }

.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: .3rem; }

.more { margin-top: 1rem; }

/* History filters. */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem;
  margin-bottom: 1.1rem;
}
.filter-search { position: relative; flex: 1 1 16rem; max-width: 24rem; align-self: flex-end; }
.filter-search svg {
  position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round;
}
.filter-search input { padding-left: 2.1rem; }
.filter { display: grid; gap: .25rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.filter > span, .filter > legend { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); padding: 0; }
.filter-dates { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.filter-dates legend { width: 100%; margin-bottom: .25rem; }
select, input[type="date"] {
  min-height: 2.5rem;
  padding: .45rem .6rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: var(--step--1);
}
.filter-summary { margin-bottom: .75rem; color: var(--muted); font-size: var(--step--1); }
#history-results.htmx-request, .filters.htmx-request + #history-results { opacity: .6; transition: opacity .15s; }

.empty-state {
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius-l);
  display: grid; gap: 1rem; justify-items: start;
}

.deletions { list-style: none; padding: 0; margin: .75rem 0 0; }
.deletions li {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: .6rem 0; border-top: 1px solid var(--rule);
}
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--rule)); }
.danger-zone p + p { margin-top: .9rem; }

/* --- help and policy pages --------------------------------------------------- */

.prose-page { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.toc { position: sticky; top: 1.5rem; display: grid; gap: .15rem; font-size: var(--step--1); }
.toc a { color: var(--ink-2); text-decoration: none; padding: .3rem .6rem; border-left: 2px solid var(--rule); }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.prose { max-width: 44rem; }
.prose section + section { margin-top: 2.25rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.prose h2 { margin-bottom: .7rem; }
.prose h3 { margin: 1.4rem 0 .5rem; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: .75rem; }
.prose ul { padding-left: 1.2rem; margin: .5rem 0 0; }
.prose li + li { margin-top: .45rem; }
.policy-draft { max-width: 44rem; margin: 0 0 1.75rem; }
.bank-filter { display: block; max-width: 20rem; margin: 1rem 0 .75rem; }
.bank-list {
  list-style: none; margin: 0; padding: 0;
  columns: 3 13rem; column-gap: 2rem;
  font-size: var(--step--1); color: var(--ink-2);
}
.prose .bank-list { padding: 0; }
.bank-list li { break-inside: avoid; padding: .2rem 0; margin: 0 !important; }
.more-details { margin-top: 1.1rem; }
.more-details summary { cursor: pointer; color: var(--accent); font-weight: 550; width: fit-content; }
.more-details[open] summary { margin-bottom: 1rem; }
.details dd.muted { font-weight: 400; }
.problem-page { max-width: 40rem; }
.problem-page h1 { font-size: var(--step-2); }
.problem-page .actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- dialogs -------------------------------------------------------------- */

.dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.25rem 1.4rem 1.3rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 40px rgb(0 0 0 / 25%);
}
.dialog::backdrop { background: rgb(15 22 28 / 45%); }
.dialog[open] { animation: dialog-in .14s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px); } }
.dialog h2 { font-size: var(--step-1); overflow-wrap: anywhere; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.dialog-x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 1.4rem; line-height: 1; padding: .1rem .35rem; border-radius: var(--radius-s);
}
.dialog-x:hover { background: var(--surface-2); color: var(--ink); }
.dialog p { max-width: none; }
#confirm-detail { margin-top: .5rem; color: var(--ink-2); }
.dialog-form { display: grid; gap: .9rem; }
.dialog-form .note { margin-top: 0; }
.field-wide { max-width: none; }
textarea {
  width: 100%; resize: vertical; min-height: 7rem;
  padding: .55rem .7rem; border: 1px solid var(--field-border); border-radius: var(--radius-m);
  background: var(--surface); color: inherit; font: inherit;
}
input[type="text"][name="row"] { max-width: 8rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.dialog-form .dialog-actions { margin-top: 0; }
.feedback-status:empty { display: none; }
.form-error { color: var(--bad); font-weight: 600; font-size: var(--step--1); }
.dialog-done p { color: var(--ink-2); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn.danger-solid:hover { filter: brightness(1.08); color: var(--surface); }

/* --- settings ---------------------------------------------------------------- */

.settings { max-width: 46rem; display: grid; gap: 1.25rem; }
.settings .panel { margin-top: 0; }
.settings .panel p + p { margin-top: .75rem; }
.seg-large span { padding: .45rem 1rem; font-size: var(--step-0); }
.seg-large { margin-top: .5rem; }
.deletion-label { overflow-wrap: anywhere; min-width: 0; }

/* --- narrow screens -------------------------------------------------------- */

/* The review queue (admin_review.html): the history's table, plus a detail row. */
.small { font-size: var(--step--1); }
.review code, .review-banks code { font-size: var(--step--1); overflow-wrap: anywhere; }
.review .badge { margin: 0 .15rem .15rem 0; }
.review tr.review-detail td { padding-top: 0; }
.review-detail p { margin: .25rem 0; max-width: 60rem; overflow-wrap: anywhere; }
.review-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .4rem; }
.review-form input[type=text] { flex: 1 1 18rem; max-width: 32rem; }
.review-banks { margin-bottom: .75rem; }
.review-banks tr[aria-current] td { background: var(--surface-2); font-weight: 600; }
/* /admin/metrics: the hourly bar, failures as its red share. */
.metrics th[scope=row] { text-align: left; font-weight: 500; }
.bar-cell { width: 40%; }
.bar { display: block; height: .7rem; min-width: 2px; background: var(--rule-strong); border-radius: 2px; overflow: hidden; }
.bar-bad { display: block; height: 100%; background: var(--bad, #c0392b); }

code.secret { user-select: all; padding: .15rem .4rem; border: 1px solid var(--rule); border-radius: 4px; }

@media (max-width: 720px) {
  .masthead-inner { gap: .4rem .75rem; position: relative; }
  .masthead-tools { margin-left: auto; }
  /* The navigation is one row that scrolls sideways, edge to edge, rather
     than wrapping into three (signed in, with the balance, it took a third of
     a phone's screen). The balance comes first so it is never scrolled away;
     its menu is anchored to the masthead, not the pill, so the scrolling row
     (overflow clips what it contains) doesn't cut it off. */
  .nav {
    order: 3; flex: 1 1 100%; flex-wrap: nowrap; align-items: center;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-inline: calc(-1 * var(--gutter)); padding: .1rem var(--gutter) .3rem;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; white-space: nowrap; padding-inline: .6rem; }
  .nav a:first-of-type { margin-left: -.6rem; }
  .credits-menu { order: -1; margin: 0 .35rem 0 0; position: static; flex: 0 0 auto; }
  .credits-pop { top: calc(100% + .25rem); right: var(--gutter); }

  .statement-actions { width: 100%; }
  .statement-actions .btn.primary { flex: 1; }
  /* Tighter, so Excel, CSV and the "more" menu share one row down to 320px
     (the menu used to wrap onto a line alone). Still wraps: a statement of
     several accounts has two more buttons here. */
  .statement-actions { gap: .4rem; }
  .statement-actions .btn { padding-inline: .75rem; white-space: nowrap; }

  /* History: each job's <tbody> becomes a card; labels come from data-label. */
  .history, .history tbody, .history tr, .history td { display: block; }
  .history { border: 0; background: none; overflow: visible; }
  .history thead { display: none; }
  .history tbody {
    background: var(--surface); border: 1px solid var(--rule);
    border-radius: var(--radius-l); padding: .4rem 0; margin-bottom: .75rem;
  }
  .history tbody + tbody td { border-top: 0; }
  .history tbody:hover td { background: none; }
  .history td { padding: .3rem 1rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .history td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .history td.file { display: block; text-align: left; font-size: var(--step-0); padding-block: .5rem .35rem; max-width: none; }
  .history td.file::before { content: none; }
  .history .k-money { text-align: right; }
  .row-actions { justify-content: flex-start !important; flex-wrap: wrap; padding-block: .6rem !important; }

  /* Transactions: each row a card instead of a table too wide to see the
     amounts in. Date and amount on top, the narration under them, then every
     other column as a labelled line (data-label, from result.html and
     transactions.js), and the CSV row beside the balance. The header row,
     and with it column sorting, is hidden; search and the filters stay. The
     box no longer scrolls on its own: the page does. */
  .ledger-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; }
  .ledger, .ledger tbody { display: block; }
  .ledger thead { display: none; }
  .ledger tbody tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem;
    padding: .75rem .15rem; border-bottom: 1px solid var(--rule);
  }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger tbody tr > * {
    display: block; order: 4; flex: 1 1 100%; min-width: 0; max-width: none;
    padding: 0; border: 0 !important; background: none !important; text-align: left;
  }
  .ledger tbody td:empty { display: none; }
  .ledger tbody td::before { content: attr(data-label); color: var(--muted); margin-right: .5rem; }
  .ledger tbody tr:hover > * { background: none; }
  .ledger tbody tr.flagged { background: var(--bad-bg); box-shadow: inset 3px 0 0 var(--bad); padding-left: .75rem; padding-right: .5rem; }
  .ledger tbody tr.flagged > :first-child { box-shadow: none; }

  .ledger tbody td.k-date { order: 1; flex: 1 1 auto; font-size: var(--step-0); font-weight: 600; color: var(--ink); }
  .ledger tbody td.debit, .ledger tbody td.credit, .ledger tbody td.c-amount {
    order: 2; flex: 0 0 auto; margin-left: auto; text-align: right;
    font-size: var(--step-0); font-weight: 650;
  }
  .ledger tbody td.debit::before, .ledger tbody td.credit::before, .ledger tbody td.c-amount::before { font-size: var(--step--1); font-weight: 400; }
  .ledger tbody td.c-narration { order: 3; color: var(--ink-2); }
  .ledger tbody td.k-date::before, .ledger tbody td.c-narration::before { content: none; }
  .ledger tbody th.k-row { order: 7; flex: 1 1 auto; width: auto; text-align: left; font-size: var(--step--1); }
  .ledger tbody th.k-row::before { content: "Row "; }
  .ledger tbody td.c-balance { order: 8; flex: 0 0 auto; margin-left: auto; text-align: right; }
  .prose-page { grid-template-columns: 1fr; gap: 1.25rem; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
  .toc a { border-left: 0; padding: .2rem 0; }
  .filter-search { flex-basis: 100%; max-width: none; }
  .filter { flex: 1 1 9rem; }
  .filter select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .spinner, .pending-bar span { animation: none; }
}

@media (forced-colors: active) {
  .ledger tbody tr.flagged > :first-child { border-left: 3px solid Mark; }
  .theme-switch label:has(input:checked) { outline: 2px solid Highlight; }
}
