:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16191d;
  --muted: #5a636e;
  --border: #dfe3e8;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e9efff;
  --ok: #157347;
  --ok-soft: #e6f4ec;
  --warn: #9a5b00;
  --warn-soft: #fdf2df;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1d222b;
    --text: #e7eaee;
    --muted: #9aa4b0;
    --border: #2b313c;
    --accent: #7ea2ff;
    --accent-ink: #0b1020;
    --accent-soft: #1a2442;
    --ok: #5cc98d;
    --ok-soft: #12291d;
    --warn: #f0b45a;
    --warn-soft: #2d2212;
    --bad: #ff8a80;
    --bad-soft: #301615;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.3rem); letter-spacing: -.02em; margin-top: .4em; }
h2 { font-size: 1.35rem; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
p, ul, ol { margin: 0 0 1em; }
li { margin: .25em 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand svg { flex: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
main { padding: 8px 0 48px; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 46em; }
.notice { font-size: .85rem; color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin-top: 20px; }
.crumbs a { color: var(--muted); }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0 36px; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }

/* ---------- cards & forms ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
label { font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="number"], input[type="password"], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn {
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; border-radius: 8px; padding: 8px 14px; min-height: 40px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.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.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- calculator: laid out like FinCEN's online FBAR ---------- */
:root { --field: #565c65; --field-off: #dfe1e2; --field-off-ink: #565c65; --tab: #6b737c; --req: #d83933; }
@media (prefers-color-scheme: dark) {
  :root { --field: #6b7685; --field-off: #262c36; --field-off-ink: #9aa4b0; --tab: #3a414c; --req: #ff8a80; }
}
.field { display: grid; gap: 4px; }
.ff { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 24px 20px; margin-top: 18px; scroll-margin-top: 8px; }
.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.tab { display: grid; place-items: center; text-align: center; font-size: .85rem; font-weight: 700; line-height: 1.15; color: #fff; background: var(--tab); border-radius: 2px; min-height: 52px; padding: 6px 8px; text-decoration: none; overflow-wrap: break-word; }
.tab:hover, .tab:focus-visible { background: var(--accent); color: var(--accent-ink); }
.tab-panel { scroll-margin-top: 12px; }
.panel-title { margin: 28px 0 0; padding: 12px 16px; font-size: 1.05rem; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 2px; letter-spacing: 0; }
.tab-panel:first-of-type .panel-title { margin-top: 20px; }

/* sections, "Need help?" bars */
.fsec { padding: 20px 0; border-bottom: 1px solid var(--border); }
.fsec h3 { margin: 0 0 14px; font-size: 1.2rem; }
.nh { background: var(--surface-2); margin: 0 0 18px; }
.nh summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 700; font-size: .9rem; cursor: pointer; }
.nh summary::-webkit-details-marker { display: none; }
.nh summary::before { content: '?'; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; font-size: .72rem; line-height: 1; }
.nh summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.nh[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.nh-body { padding: 0 16px 12px 44px; font-size: .9rem; }
.nh-body p { margin: 0 0 .6em; }

/* fields: label above a square box, on a 12-column grid like the FinCEN form */
.fx-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px 16px; align-items: start; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: 1 / -1; }
.fx { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fx-lab { font-weight: 700; font-size: .85rem; line-height: 1.3; }
.req { color: var(--req); font-style: normal; font-weight: 700; }
.fx-sub { margin-bottom: -8px; }
h4.fx-sub { font-size: 1rem; margin: 6px 0 -4px; padding-top: 14px; border-top: 1px dashed var(--border); }
.fx-hint { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.fx-note { font-size: .85rem; font-weight: 600; margin: 4px 0 0; }
.ff input[type="text"], .ff select, .fx-box { border-radius: 0; border: 1px solid var(--field); min-height: 40px; font-size: .92rem; }
.ff input[type="text"]:disabled { background: var(--field-off); border-color: var(--field-off); color: var(--field-off-ink); }
.ff input[type="text"]:disabled::placeholder { color: transparent; }
.ff select:disabled, .ff textarea:disabled { background: var(--field-off); border-color: var(--field-off); color: var(--field-off-ink); opacity: 1; }
.ff textarea { width: 100%; border-radius: 0; border: 1px solid var(--field); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; padding: 8px 10px; resize: vertical; }
.ff textarea:disabled::placeholder { color: transparent; }
.fx.is-off .fx-lab { color: var(--muted); }
.fx-hint:empty { display: none; }
.fx-hint .warn { color: var(--warn); font-weight: 600; }
.prep-items { display: contents; }
.fincen-only { margin: 4px 0 12px; }
/* ID numbers: shown as ••••1234 while the box isn't being edited (the real value stays in the input). */
.secret { position: relative; }
.secret input { width: 100%; }
.secret-mask { display: none; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: .92rem; letter-spacing: .06em; }
.secret.masked input { color: transparent; }
.secret.masked .secret-mask { display: block; }
.guide-cta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; font-size: .95rem; }
.fx-box { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface); position: relative; overflow-wrap: anywhere; line-height: 1.3; }
.fx-box.ph { color: var(--muted); font-style: italic; }
.fx-box.val { font-weight: 650; }
.fx-box.off { background: var(--field-off); border-color: var(--field-off); color: var(--field-off-ink); font-style: italic; }
.fx-box.sel { padding-right: 46px; }
.fx-box.sel::before { content: ''; position: absolute; right: 36px; top: 7px; bottom: 7px; border-left: 1px solid currentColor; opacity: .45; }
.fx-box.sel::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); }
.fx-icon { margin-left: auto; flex: none; }
.fx-check { padding-top: 26px; }
.c12.fx-check { padding-top: 0; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.chk input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.yn { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.yn-count { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.n-box { width: 64px; min-height: 36px; justify-content: center; font-style: normal; }

/* our own additions: running total, calculator box */
.strip { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding: 18px 0 4px; }
.strip-total { display: grid; }
.strip-total strong { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.strip .verdict { flex: 1 1 320px; margin: 0; }
.accounts { display: grid; gap: 16px; }
.acct { border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 4px 16px 18px; background: var(--surface); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 12px; }
.acct-head h4 { margin: 0; font-size: 1.02rem; }
.acct-part { font-size: .78rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.acct-head .btn { margin-left: auto; }
.i15-out { font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.i15-out.empty { color: var(--muted); font-weight: 500; font-size: .95rem; }
.calc15 { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; }
.calc15-title { font-weight: 700; font-size: .85rem; }
.calc15-title span { font-weight: 500; color: var(--muted); }
.calc15-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; }
.calc15 label, .label-like { font-size: .82rem; font-weight: 600; }
.calc15 input[type="text"], .calc15 select { border-radius: 8px; border-color: var(--border); }
.acct-out { font-size: .88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.acct-out strong { color: var(--text); font-variant-numeric: tabular-nums; }
.acct-out .warn { color: var(--warn); }
.acct-file { font-size: .85rem; color: var(--ok); }
.rate-input { display: none; gap: 8px; align-items: center; flex-wrap: wrap; }
.rate-input.show { display: flex; }
.rate-input input { width: 160px; }
.helper { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; display: grid; gap: 6px; }
.helper label { font-size: .85rem; font-weight: 700; }
.helper label span { font-weight: 500; color: var(--muted); }
.helper select { border-radius: 8px !important; border-color: var(--border) !important; max-width: 520px; }
.fx-src { font-size: .78rem; color: var(--ok); font-weight: 600; }
.found { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-top: 12px; font-size: .9rem; }
.found-title { font-weight: 700; }
.found-title span { font-weight: 500; color: var(--muted); }
.found ul { margin: 6px 0 0; padding-left: 1.2em; }
.found .warn { color: var(--warn); }
.year-hint { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-note { font-size: .85rem; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 10px; margin: 0; }
.btn.add { margin-top: 14px; }
.empty { margin: 4px 0; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
.result .total { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.steps li { margin: .4em 0; }
.keep { margin-top: 12px; }
@media (max-width: 720px) {
  .ff { padding: 0 14px 16px; }
  .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab { min-height: 46px; font-size: .78rem; }
  .fx-grid > * { grid-column: 1 / -1; }
  .fx-grid > .c3, .fx-grid > .c2 { grid-column: span 6; }
  .fx-gap { display: none; }
  .fx-check { padding-top: 0; }
  .calc15-row { grid-template-columns: 1fr; }
  .yn-count { margin-left: 0; }
}

.verdict { border-radius: 8px; padding: 12px 14px; font-weight: 600; margin-bottom: 12px; }
.verdict small { display: block; font-weight: 400; margin-top: 4px; color: inherit; opacity: .9; }
.verdict.yes { background: var(--warn-soft); color: var(--warn); }
.verdict.no { background: var(--ok-soft); color: var(--ok); }
.verdict.none { background: var(--surface-2); color: var(--muted); }
.report { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 10px 0; }
.report th, .report td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.report th { font-size: .8rem; color: var(--muted); font-weight: 600; }
details.more { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 650; }
.f8938 { display: grid; gap: 10px; margin-top: 10px; max-width: 560px; }

/* ---------- file dialog ---------- */
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(10, 14, 20, .55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-head h2 { margin: 0; font-size: 1.1rem; }
.dlg-body { padding: 16px 20px 20px; display: grid; gap: 14px; }
#guidedlg { width: min(640px, calc(100vw - 24px)); }
.gd-intro { margin: 0; }
.gd-steps { list-style: none; counter-reset: gd; margin: 0; padding: 0; display: grid; gap: 14px; }
.gd-steps li { counter-increment: gd; position: relative; padding-left: 44px; }
.gd-steps li::before { content: counter(gd); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; }
.gd-steps h3 { margin: 4px 0 4px; font-size: 1rem; }
.gd-steps p { margin: 0 0 8px; font-size: .92rem; }
.gd-once { font-weight: 500; color: var(--muted); }
.gd-state { font-size: .88rem; color: var(--muted); }
.gd-state.ok { color: var(--ok); font-weight: 600; }
.gd-state.warn { color: var(--warn); font-weight: 600; }
a.btn.disabled { opacity: .5; pointer-events: none; }
.gd-notes { border-top: 1px solid var(--border); padding-top: 10px; color: var(--muted); }
.gd-notes p { margin: 0 0 6px; }
.dlg-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.drop { border: 2px dashed var(--border); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.preview-wrap { overflow: auto; max-height: 260px; border: 1px solid var(--border); border-radius: 8px; }
.preview { border-collapse: collapse; font-size: .82rem; width: 100%; }
.preview td, .preview th { padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.preview th { background: var(--surface-2); position: sticky; top: 0; text-align: left; }
.preview .sel { background: var(--accent-soft); }
.preview tr.hit td { background: var(--ok-soft); font-weight: 650; }
.result-box { border-radius: 8px; padding: 12px 14px; background: var(--surface-2); }
.result-box .big { font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.error { color: var(--bad); }
.privacy-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 3px 10px; }

/* ---------- content pages ---------- */
.article h2 { margin-top: 1.8em; }
.article table, .data-table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: .95rem; }
.article th, .article td, .data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; vertical-align: top; }
.article th, .data-table th { font-size: .85rem; color: var(--muted); font-weight: 650; }
.table-scroll { overflow-x: auto; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; margin: 1.2em 0; }
.callout p:last-child { margin-bottom: 0; }
.example { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 1em 0 1.4em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 1em 0 2em; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; margin-bottom: 4px; }
.cards span { color: var(--muted); font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: .5em 0 1.5em; padding: 0; list-style: none; }
.chips li { margin: 0; }
.chips a { display: inline-block; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); font-size: .9rem; }
.chips a:hover, .chips a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.filter { max-width: 320px; margin: .5em 0; }
.mini-conv { display: grid; grid-template-columns: 1fr 140px; gap: 10px; align-items: end; max-width: 520px; }
.mini-conv output { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.faq dt { font-weight: 650; margin-top: 1em; }
.faq dd { margin: .3em 0 0; }

@media print {
  .site-header, .site-footer, .btn, .btn-row, details.more, .no-print, .lede, .notice, #newyear, section.article, .acct-file, .sec-note, .empty, dialog, .tabs, .nh, .strip, .calc15-title span, .helper, .fx-src { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .panel-title { font-size: 14pt; margin: 16pt 0 0; padding: 0 0 3pt; color: #000; background: none; border-bottom: 2px solid #000; break-after: avoid; }
  .ff { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .fsec { padding: 10pt 0; break-inside: auto; }
  .fx-grid { gap: 8pt 10pt; }
  .acct { break-inside: avoid; border-left-width: 1px; }
  .fx-box, .ff input[type="text"], .ff select, .ff textarea { min-height: 0; padding: 3pt 5pt; }
  .ff input[type="text"]::placeholder, .ff textarea::placeholder { color: transparent; }
  input, select { background: transparent; appearance: none; -webkit-appearance: none; }
  .calc15 { background: none; border: 1px dashed #bbb; }
}

/* PDF password prompt, PDF-to-CSV page */
.pass { display: grid; gap: 6px; background: var(--warn-soft); border-radius: 8px; padding: 12px 14px; }
.pass label { font-size: .92rem; }
.pass input { max-width: 260px; }
.conv-out { margin-top: 16px; display: grid; gap: 12px; }
.conv-stats { font-size: .92rem; }
.conv-wrap { overflow: auto; max-height: 480px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.conv-table { border-collapse: collapse; font-size: .85rem; width: 100%; }
.conv-table th, .conv-table td { padding: 5px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
.conv-table th { background: var(--surface-2); position: sticky; top: 0; }
.conv-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.conv-table tr.extra td { color: var(--muted); font-style: italic; }

/* ---------- first screen: 1 statement PDF → 2 CSV → 3 FBAR form ---------- */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch; margin: 20px 0 12px; }
.flow-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 270px; transition: border-color .15s, background-color .15s; }
.flow-step.over { border-color: var(--accent); background: var(--accent-soft); }
.flow-step.done { border-color: var(--accent); }
.flow-h { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.flow-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.flow-step.done .flow-n { background: var(--accent); color: var(--accent-ink); }
.flow-step.busy .flow-n { animation: flow-pulse 1s ease-in-out infinite; }
@keyframes flow-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .flow-step.busy .flow-n { animation: none; } }
.flow-drop { flex: 1; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 16px 12px; }
.flow-drop .small { margin: 0; }
.flow-icon { color: var(--muted); }
.flow-step.filled .flow-drop { display: none; }
.flow-empty { flex: 1; display: grid; align-content: center; justify-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 0 6px; }
.flow-empty p { margin: 0; }
.flow-done { display: grid; gap: 10px; align-content: start; }
.flow-arrow { display: grid; place-items: center; color: var(--border); }
.flow-arrow.on { color: var(--accent); }
.flow .warn { color: var(--warn); }
.fl-file { display: grid; gap: 2px; overflow-wrap: anywhere; }
.fl-table { overflow: auto; max-height: 190px; border: 1px solid var(--border); border-radius: 8px; }
.preview.mini { font-size: .74rem; }
.preview.mini td, .preview.mini th { padding: 3px 6px; max-width: 9em; }
.preview .sel2 { background: var(--surface-2); }
.fl-warn { background: var(--warn-soft); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: .9rem; display: grid; gap: 8px; justify-items: start; }
.fl-acct { display: grid; gap: 6px; }
.fl-15 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; flex-wrap: wrap; }
.fl-15 strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.fl-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; border-top: 1px solid var(--border); }
.fl-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); margin: 0; }
.fl-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.fl-total strong { font-variant-numeric: tabular-nums; }
.fl-yes, .fl-no { font-size: .8rem; font-weight: 650; border-radius: 999px; padding: 2px 8px; }
.fl-yes { background: var(--warn-soft); color: var(--warn); }
.fl-no { background: var(--ok-soft); color: var(--ok); }
#flow-form .flow-done { flex: 1; }
.ff-title { margin: 30px 0 4px; scroll-margin-top: 8px; }
.ff-lede { color: var(--muted); max-width: 52em; margin-bottom: 0; }
@media (max-width: 860px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow-arrow { height: 30px; transform: rotate(90deg); }
  .flow-step { min-height: 0; }
}
@media print { .ff-lede, .ff-title { display: none !important; } }
.preview.mini .sel2:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
.preview.mini th.sel2:first-child { z-index: 2; }
.result-box .warn { color: var(--warn); }
.lede-note { font-size: .9rem; color: var(--muted); max-width: 52em; margin-top: -6px; }
@media print { .lede-note { display: none !important; } }
/* PDF-to-CSV and unlock pages: a tall drop area */
#pc-drop, #ul-drop { min-height: 280px; display: grid; align-content: center; justify-items: center; gap: 10px; }
#pc-drop .small, #ul-drop .small { margin-top: 0 !important; }
/* first screen with several files: all of them stay listed */
.fl-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fl-files li { display: grid; gap: 1px; margin: 0; padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.fl-files li.on { background: var(--accent-soft); }
.fl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fl-chip { font: inherit; font-size: .78rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 3px 10px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.fl-accts { display: grid; gap: 4px; }
.fl-list li.on { background: var(--accent-soft); border-radius: 6px; padding-left: 6px; padding-right: 6px; }
.fl-pick { font: inherit; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fl-pick:hover { color: var(--accent); text-decoration: underline; }
.fl-files li { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.fl-fi { display: grid; gap: 1px; min-width: 0; }
.fl-x { font: inherit; font-size: .85rem; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.fl-x:hover { color: var(--bad); background: var(--bad-soft); }
.fl-rm:hover { color: var(--bad); }
