/* Payout Recon prototype styles. Round 6 visual system.
 *
 * Font: IBM Plex Sans, one family, served from assets/fonts (latin subset, woff2, SIL OFL in OFL.txt).
 *   No third-party request at runtime.
 *   Tabular figures on every amount. IDs and bank descriptors use the same font.
 * Weights (two): 400 body, 500 headings, labels, buttons, totals. No 600.
 * Type scale:
 *   12px  table headers only
 *   13px  sub-labels, pills, meta, buttons inside cards
 *   14px  text inside cards, notes and dialogs; buttons outside cards
 *   15px  body text outside cards; card titles (500)
 *   18px  section headings (500), modal titles
 *   24px  page titles (500), summary figures
 *   40px  landing hero only (32px on phones)
 * Palette: ink blue accent for primary actions and links, one cool grey family
 *   tinted to the accent hue, status colors only for status.
 * Radius scale: 4px inputs, buttons, chips' inner parts; 8px cards and notes; 10px dialogs; pills fully round.
 * Amounts (pattern a): see .amt. $0.00 means zero, "—" means no amount yet, "n/a" means the column does not apply.
 */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --border: #dbe1e7;
  --border-strong: #c2cbd4;
  --text: #15202b;
  --text-2: #3e4c5b;
  --text-3: #556372;
  --accent: #1d4f73;
  --accent-hover: #163e5b;
  --accent-active: #112f45;
  --accent-weak: #e7eff5;
  --accent-border: #b6cadb;
  --ok: #146138;
  --ok-bg: #e5f2ea;
  --ok-border: #b5d9c3;
  --warn: #84480a;
  --warn-bg: #fbefdb;
  --warn-border: #eccf9c;
  --neutral-pill: #e8ecf0;
  --bad: #a3231a;
  --bad-bg: #fbeae8;
  --bad-border: #efc1bc;
  --bar-muted: #a9b5c1;
  --sk: #e3e8ed;
  --radius-lg: 10px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 1px rgba(21, 32, 43, .04), 0 2px 3px -1px rgba(21, 32, 43, .07);
  --shadow-pop: 0 2px 4px rgba(21, 32, 43, .06), 0 12px 28px -6px rgba(21, 32, 43, .22);
  --font: "IBM Plex Sans", sans-serif;
  --t-xs: 13px;
  --t-th: 12px;
  --t-sm: 14px;
  --t-md: 15px;
  --t-lg: 18px;
  --t-xl: 24px;
  --t-hero: 40px;
  --section-gap: 44px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-md);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:active { color: var(--accent-active); }
h1, h2, h3, h4 { margin: 0; font-weight: 500; font-style: normal; text-wrap: balance; color: var(--text); }
h1 { font-size: var(--t-xl); line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: var(--t-lg); line-height: 1.3; }
h3, h4 { font-size: var(--t-md); line-height: 1.35; }
p { margin: 0; text-wrap: pretty; max-width: 75ch; }
strong, b { font-weight: 500; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: var(--t-xs); }
.code-id { font-variant-numeric: tabular-nums slashed-zero; overflow-wrap: anywhere; letter-spacing: .01em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Focus: one visible ring on every control */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.btn:focus-visible, .chip:focus-visible, .input:focus-visible { border-radius: var(--radius-sm); }
.chip:focus-visible { border-radius: 999px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.radio-card input:focus-visible { outline: none; }

/* Accounting amounts (pattern a): right-aligned tabular figures, negatives in
 * parentheses, positives keep the space of the closing paren so decimals align. */
.amt { position: relative; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt .rp { visibility: hidden; }
.amt .rp.on { visibility: visible; }
.amt.zero { color: var(--text-3); }
.amt.none { color: var(--text-3); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0;
  /* Phase 9: the sidebar runs the full page height (its background and border), and its content sticks */
  align-self: stretch;
}
.sidebar-inner { position: sticky; top: 0; height: 100vh; padding: 18px 14px; box-sizing: border-box; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; font-size: var(--t-md); }
.logo { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo svg { width: 16px; height: 16px; }
.org-name { font-size: var(--t-md); font-weight: 500; padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: var(--t-md);
}
.nav a svg { width: 16px; height: 16px; flex: none; }
.nav a:active { background: var(--neutral-pill); }
.nav a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); font-weight: 500; }
.nav .count, .mobile-nav .count { margin-left: auto; background: var(--warn-bg); color: var(--warn); border-radius: 999px; font-size: var(--t-xs); padding: 0 7px; font-weight: 500; line-height: 20px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; font-size: var(--t-xs); }
.conn { display: flex; flex-direction: column; gap: 4px; }
.conn div { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.conn .ok-mark { width: 12px; height: 12px; color: var(--ok); flex: none; }
.conn .conn-bad { color: var(--bad); }
.conn .conn-bad .ok-mark { color: var(--bad); width: 14px; height: 14px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { display: none; }
.topbar .spacer { flex: 1; }
.sample-pill {
  display: inline-flex; align-items: center;
  font-size: var(--t-xs); font-weight: 500; color: var(--warn);
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  padding: 1px 10px; border-radius: 999px; white-space: nowrap;
}
.topbar .today { color: var(--text-3); font-size: var(--t-xs); white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--neutral-pill); color: var(--text-2); display: grid; place-items: center; font-size: var(--t-xs); font-weight: 500; flex: none; }
.mobile-nav, .mobile-nav.hscroll { display: none; }
.content { padding: 32px; max-width: 1240px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head .titles p { margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: var(--t-xs); color: var(--text-3); margin-bottom: 8px; }
.crumbs a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 500; font-size: var(--t-sm); line-height: 1.2;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: 0 1px 0 rgba(21, 32, 43, .05);
}
.btn:active { background: var(--neutral-pill); border-color: var(--text-3); }
.btn svg { width: 14px; height: 14px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-active); border-color: var(--accent-active); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:active { background: #7c1a13; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--text-2); }
.btn-ghost:active { background: var(--neutral-pill); color: var(--text); }
.btn-sm, .card .btn, .note .btn, .modal .btn { height: 32px; padding: 0 12px; font-size: var(--t-xs); }
.btn-lg { height: 44px; padding: 0 18px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; }
.spinner { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status pills (they carry data, always with a label) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-xs); font-weight: 500; line-height: 20px;
  padding: 0 8px; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-posted, .pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-matched { background: var(--accent-weak); color: var(--accent); }
.pill-resolved, .pill-transit, .pill-neutral { background: var(--neutral-pill); color: var(--text-2); }
.pill-review, .pill-mismatch, .pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-missing { background: var(--bad-bg); color: var(--bad); }
.pill-ready { background: var(--accent-weak); color: var(--accent); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: var(--t-sm); }
.card h2, .card h3 { font-size: var(--t-md); font-weight: 500; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { margin-top: 2px; }
.card-body { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: var(--section-gap) 0 12px; flex-wrap: wrap; }
.section-title p { margin-top: 2px; }

/* ---------- Summary strip (month figures). One band, cells divided by rules ---------- */
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); }
.summary .grp { grid-column: span var(--span, 1); display: grid; align-content: start; grid-template-columns: repeat(var(--span, 1), minmax(0, 1fr)); border-left: 1px solid var(--border); }
.summary .grp:first-child { border-left: 0; }
.summary .grp-label { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--text-3); padding: 10px 16px 0; }
.stat { padding: 6px 16px 14px; min-width: 0; text-align: right; }
.stat .label { font-size: var(--t-xs); color: var(--text-2); font-weight: 500; }
.stat .label .info-tip { margin-left: 4px; }
.stat .basis { font-size: var(--t-xs); color: var(--text-3); }
.stat .value { font-size: var(--t-xl); font-weight: 500; line-height: 1.2; margin-top: 8px; white-space: nowrap; letter-spacing: -0.01em; }
.stat .foot { font-size: var(--t-xs); color: var(--text-3); margin-top: 4px; text-wrap: balance; }
.summary.simple .stat { padding-top: 12px; }
.summary.simple .stat + .stat { border-left: 1px solid var(--border); }
.stat.attention .value { color: var(--warn); }

/* ---------- Notes ---------- */
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: var(--t-sm); }
.note .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.note .body { min-width: 0; flex: 1; }
.note h3 { margin-bottom: 4px; }
.note p + p { margin-top: 6px; }
.note .note-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; justify-content: flex-end; }
.note-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.note-warn .icon { color: var(--warn); }
.note-info { background: var(--accent-weak); border-color: var(--accent-border); }
.note-info .icon { color: var(--accent); }
.note-ok { background: var(--ok-bg); border-color: var(--ok-border); }
.note-next { background: var(--surface); border-color: var(--ok-border); }
.note-next .icon { color: var(--ok); }
.note-ok .icon { color: var(--ok); }
.note-plain .icon { color: var(--text-3); }
.note-bad { background: var(--bad-bg); border-color: var(--bad-border); }
.note-bad .icon { color: var(--bad); }
.note-lock { background: var(--surface-2); border-color: var(--border-strong); }
.note-lock .icon { color: var(--text-2); }
/* No grey text on colored surfaces */
.note-warn .muted, .note-warn .subtle, .note-info .muted, .note-info .subtle, .note-ok .muted, .note-ok .subtle, .note-bad .muted, .note-bad .subtle, .line-note .muted { color: var(--text); }
.bad { color: var(--bad); }

/* ---------- Tables (pattern b: light row dividers, no zebra) ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
table.data th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: var(--t-th);
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; background: var(--surface); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th.num, table.data td.num { text-align: right; white-space: nowrap; }
table.data tr.group td { background: var(--bg); font-size: var(--t-xs); font-weight: 500; color: var(--text-2); padding: 8px 14px; }
table.data tr.group-action td, .mgroup.group-action { background: var(--surface-2); color: var(--text); }
table.data tfoot td { font-weight: 500; border-top: 1px solid var(--border-strong); border-bottom: 0; background: var(--surface); }
.cell-sub { display: block; font-size: var(--t-xs); color: var(--text-3); }
.cell-sub.warn { color: var(--warn); }
.diff { color: var(--warn); }

/* Page-sticky table (pattern b): the page scrolls, not the table. The header row sticks
 * under the top bar, group label rows under the header, totals to the window bottom. */
table.page-sticky thead th { position: sticky; top: var(--stick-top, 0); z-index: 3; }
table.page-sticky tr.group td { position: sticky; top: var(--group-top, 0); z-index: 2; box-shadow: 0 1px 0 var(--border); }
table.page-sticky tfoot td { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -1px 0 var(--border-strong), 0 -2px 0 rgba(21, 32, 43, .05); border-top-color: transparent; }
table.page-sticky.stuck thead th { box-shadow: 0 1px 0 var(--border-strong), 0 2px 0 rgba(21, 32, 43, .06); }
table.payouts-table th, table.payouts-table td.status, table.payouts-table td.status .cell-sub { white-space: nowrap; }
table.payouts-table td, table.payouts-table th { padding-left: 12px; padding-right: 12px; }
table.payouts-table td.qcell { min-width: 170px; }
@media (max-width: 1100px) { .wide-table { overflow-x: auto; } }

/* Inline row expansion (pattern d) */
.exp-btn { width: 28px; height: 28px; border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); display: inline-grid; place-items: center; flex: none; padding: 0; }
.exp-btn:active { background: var(--neutral-pill); }
.exp-btn svg { width: 14px; height: 14px; }
.exp-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.first-cell { display: flex; align-items: flex-start; gap: 10px; }
.first-cell .exp-btn { margin: -4px 0 -4px -6px; }
tr.is-open > td { border-bottom-color: transparent; }
tr.expand > td { background: var(--surface-2); padding-top: 2px; padding-bottom: 12px; font-size: var(--t-xs); color: var(--text-2); vertical-align: top; }
tr.expand > td.first { padding-left: 50px; }

/* Statement layout (pattern c): indent 24px per level, single rule above a
 * subtotal, double rule under the grand total. Rules span the amount column only. */
.stmt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.stmt td, table.data .stmt td { padding: 5px 0; vertical-align: top; border: 0; background: transparent; }
.stmt td.num, table.data .stmt td.num { text-align: right; white-space: nowrap; padding-left: 16px; width: 1%; }
.stmt td.lbl, table.data .stmt td.lbl { padding-left: calc(var(--lv, 0) * 24px); }
.stmt .lv1 { --lv: 1; }
.stmt .lv2 { --lv: 2; }
.stmt tr.subtotal td.num .amt { display: inline-block; border-top: 1px solid var(--text-3); padding-top: 4px; }
.stmt tr.subtotal td { font-weight: 500; }
.stmt tr.grand td { font-weight: 500; }
.stmt tr.grand td.num .amt { display: inline-block; border-top: 1px solid var(--text-3); border-bottom: 3px double var(--text-3); padding: 4px 0 2px; }
.stmt tr.gap td, table.data .stmt tr.gap td { padding-top: 14px; }
.stmt .cell-sub { margin-top: 1px; }

/* Phone list version of tables */
.mlist { display: none; }
.mitem { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.mitem:last-child { border-bottom: 0; }
.mitem:active { background: var(--surface-2); }
.mitem .top, .mitem .bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mitem .mid { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0; }
.mitem .amount { font-size: var(--t-lg); font-weight: 500; }
.mitem .bottom { font-size: var(--t-xs); color: var(--text-2); }
.mitem .pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mgroup { padding: 8px 16px; background: var(--bg); font-size: var(--t-xs); font-weight: 500; color: var(--text-2); border-bottom: 1px solid var(--border); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: flex-end; }
.filters .ffield { display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--text-2); }
.filters .ffield select.input { width: auto; min-width: 190px; height: 34px; font-size: var(--t-sm); }
.filters .fclear { font-size: var(--t-xs); height: 34px; display: inline-flex; align-items: center; }
.filter-phone { display: none; }
.filter-line { font-size: var(--t-xs); color: var(--text-2); flex: 1; min-width: 0; }
.filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-group .flabel { font-size: var(--t-xs); color: var(--text-3); margin-right: 2px; }
.chip {
  font: inherit; font-size: var(--t-xs); font-weight: 500; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.chip:active { border-color: var(--text-3); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip .n { margin-left: 5px; color: var(--text-3); }
.chip[aria-pressed="true"] .n { color: #dfe5ea; }

/* Info icon with a tooltip (on hover and on focus) */
.info-tip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; background: transparent; color: var(--text-3); cursor: help; vertical-align: -4px; border-radius: 50%; }
.info-tip svg { width: 15px; height: 15px; }
.info-tip .tip { display: none; position: absolute; right: -8px; top: calc(100% + 8px); width: 280px; padding: 10px 12px; background: var(--text); color: #fff; border-radius: 6px; font-size: var(--t-xs); font-weight: 400; line-height: 1.4; text-align: left; z-index: 20; box-shadow: var(--shadow-pop); white-space: normal; }
.info-tip:focus-visible .tip, .info-tip[aria-expanded="true"] .tip { display: block; }
@media (hover: hover) and (pointer: fine) { .info-tip:hover .tip { display: block; } .info-tip:hover { color: var(--text); } }

/* Segmented control: parent radius 6, padding 2, so buttons get 4 */
.segmented { display: inline-flex; background: var(--neutral-pill); border-radius: 6px; padding: 2px; gap: 2px; max-width: 100%; }
.segmented button {
  font: inherit; font-size: var(--t-xs); font-weight: 500; border: 0; background: transparent; color: var(--text-2);
  padding: 6px 12px; border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.segmented button:active { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(21, 32, 43, .14); }

/* Horizontal scroll rows: a chevron shows only on the side with hidden items */
.hscroll { position: relative; display: flex; min-width: 0; max-width: 100%; }
.hscroll > .hs-inner { overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.hscroll > .hs-inner::-webkit-scrollbar { display: none; }
.hs-hint { position: absolute; top: 0; bottom: 0; width: 28px; display: none; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface); pointer-events: none; z-index: 2; }
.hs-hint svg { width: 14px; height: 14px; }
.hs-hint.l { left: 0; border-right: 1px solid var(--border); }
.hs-hint.r { right: 0; border-left: 1px solid var(--border); }
.hscroll.more-l .hs-hint.l, .hscroll.more-r .hs-hint.r { display: flex; }
.hscroll.on-pill .hs-hint { background: var(--neutral-pill); border-color: var(--border-strong); }

/* ---------- Key-value list ---------- */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: var(--t-sm); margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.meta div { min-width: 0; }
.meta dt { font-size: var(--t-xs); color: var(--text-3); }
.meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* ---------- Waterfall (payout breakdown, statement style with bars) ---------- */
.waterfall { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.waterfall td { padding: 6px 0; vertical-align: middle; }
.waterfall td.lbl { padding-left: calc(var(--lv, 0) * 24px); width: 34%; }
.waterfall tr.lv1 { --lv: 1; }
.waterfall td.bar { padding: 6px 16px; }
.waterfall td.num { text-align: right; white-space: nowrap; width: 1%; }
.waterfall tr.subtotal td { font-weight: 500; }
.waterfall tr.subtotal td.num .amt { display: inline-block; border-top: 1px solid var(--text-3); padding-top: 4px; }
.waterfall tr.grand td { font-weight: 500; }
.waterfall tr.grand td.num .amt { display: inline-block; border-top: 1px solid var(--text-3); border-bottom: 3px double var(--text-3); padding: 4px 0 2px; }
.waterfall tr.gap td { padding-top: 16px; }
.waterfall tr.dim td { color: var(--text-3); }
.wf-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 2px; }
.wf-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; min-width: 2px; }
.wf-bar.total { background: var(--accent); }
.wf-bar.minus { background: var(--bar-muted); }
.wf-bar.warn { background: var(--warn-border); }
.wf-bar.zero { background: var(--border-strong); }

/* ---------- Checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .state { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.checklist .state svg { width: 12px; height: 12px; }
.checklist .done .state { background: var(--ok); color: #fff; }
.checklist .confirmed .state { background: var(--surface); color: var(--ok); border: 1px solid var(--ok-border); }
.checklist .open .state { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.checklist .wait .state { background: var(--neutral-pill); color: var(--text-2); }
.checklist .item-body { flex: 1; min-width: 0; }
.checklist .item-body h3 { font-size: var(--t-sm); font-weight: 500; }
.checklist .item-body h3 .who { font-weight: 400; color: var(--text-2); }
.checklist .item-body p { color: var(--text-2); font-size: var(--t-xs); margin-top: 2px; }
.checklist .item-act { flex: none; align-self: center; }
.checklist .wait .item-body h3 { color: var(--text-2); }
.checklist .fr-more { margin-top: 4px; font-size: var(--t-xs); color: var(--text-2); }
.checklist .fr-more summary { color: var(--accent); cursor: pointer; }
.checklist .fr-more p { margin-top: 4px; }
.item-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: var(--t-xs); }
.item-link { display: inline-flex; align-items: center; gap: 6px; }
.item-link .why { color: var(--text-3); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: var(--t-sm); font-weight: 500; }
.field .hint { font-size: var(--t-xs); color: var(--text-3); }
.field label { text-wrap: balance; }
.input, select.input {
  height: 38px; width: 100%; padding: 0 11px; font: inherit; font-size: var(--t-sm); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23556372' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; text-overflow: ellipsis; }
.input.invalid { border-color: var(--bad); }
.error-text { color: var(--bad); font-size: var(--t-xs); }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-card { position: relative; display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer; background: var(--surface); font-size: var(--t-sm); }
.radio-card input { margin: 3px 0 0; accent-color: var(--accent); flex: none; width: 16px; height: 16px; }
.radio-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-weak); }
.radio-card .rc-title { display: block; font-weight: 500; }
.radio-card .rc-desc { display: block; color: var(--text-2); font-size: var(--t-xs); margin-top: 2px; text-wrap: pretty; }
.radio-card:has(input:checked) .rc-desc { color: var(--text); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 50%; bottom: 24px; pointer-events: none; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: var(--t-sm); box-shadow: var(--shadow-pop); animation: toast-in .2s var(--ease-out); }
.toast.out { animation: toast-out .12s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ---------- Journal entry ---------- */
.je-table { table-layout: fixed; }
.je-table th.num, .je-table td.num { width: 132px; }
.je-table td:first-child, .je-table th:first-child { overflow-wrap: normal; word-break: normal; hyphens: none; }
.je-table .acct-num { color: var(--text-3); margin-right: 6px; }
.je-meta { display: flex; flex-wrap: wrap; gap: 2px 20px; font-size: var(--t-xs); color: var(--text-3); margin-top: 2px; }
.balanced { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: var(--t-xs); font-weight: 500; }
.balanced svg { width: 13px; height: 13px; }
.posted-card { padding: 22px 22px 20px; }
.posted-card .ph { display: flex; gap: 12px; align-items: flex-start; }
.posted-card .big-check { width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; }
.posted-card .big-check svg { width: 15px; height: 15px; }
.posted-card p { margin-top: 4px; color: var(--text-2); }
.posted-card .row { margin-top: 16px; justify-content: flex-end; }
.feed-line { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; border-top: 1px solid currentColor; border-color: var(--warn-border); padding-top: 10px; margin-top: 10px; font-size: var(--t-xs); color: var(--text); }
.action-bar .row { margin-left: auto; justify-content: flex-end; }
.action-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.big-num { font-size: var(--t-sm); font-weight: 500; white-space: nowrap; }
.big-num.warn { font-size: var(--t-lg); color: var(--warn); }
.content.narrow { max-width: 824px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(21, 32, 43, .45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade-in .2s var(--ease-out); }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: 100%; max-width: 540px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; font-size: var(--t-sm); animation: pop-in .24s var(--ease-out); transform-origin: center; }
.modal-back.out { animation: fade-out .12s ease-in forwards; }
.modal-back.out .modal { animation: pop-out .12s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.95); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.97); } }
.modal-head { padding: 22px 22px 0; }
.modal-head h2 { font-size: var(--t-lg); font-weight: 500; }
.modal .kv .sub { display: block; font-size: var(--t-xs); color: var(--text-3); }
.modal-body { padding: 12px 22px 4px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-body .kv { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 18px; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
textarea.input { height: auto; min-height: 60px; padding: 8px 11px; resize: vertical; line-height: 1.45; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-list .radio-card { padding: 11px 14px; }
.radio-card .inline-select { display: block; margin-top: 8px; max-width: 320px; }

/* ---------- Roll-forward and history ---------- */
.proof { display: grid; grid-template-columns: repeat(6, auto); justify-content: start; gap: 2px 20px; padding: 16px 18px; border-bottom: 1px solid var(--border); align-items: end; }
.proof .pf { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.proof .pf-l { font-size: var(--t-xs); color: var(--text-3); white-space: nowrap; }
.proof .pf-v { font-size: var(--t-lg); font-weight: 500; text-align: right; }
.proof .pf.result .pf-v { font-weight: 500; }
.proof-line { max-width: none; padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: var(--t-sm); }
.rf-table td.lbl { padding-left: calc(14px + var(--lv, 0) * 24px); }
.rf-table tr.lv1 { --lv: 1; }
.rf-table tr.subtotal td.num .amt { display: inline-block; border-top: 1px solid var(--text-3); padding-top: 4px; }
.rf-table tr.subtotal td { font-weight: 500; }
.rf-table tfoot td.num .amt { display: inline-block; border-bottom: 3px double var(--text-3); padding-bottom: 2px; }
.rf-table tbody tr td { border-bottom-color: transparent; padding-top: 7px; padding-bottom: 7px; }
.rf-table tbody tr.rule td { border-bottom-color: var(--border); }
.rf-lists { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border-top: 1px solid var(--border); }
.rf-lists > div { padding: 14px 18px 16px; min-width: 0; }
.rf-lists > div + div { border-left: 1px solid var(--border); }
.rf-lists h3 { font-size: var(--t-sm); margin-bottom: 6px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.entry-history .history li { display: block; }
.history li:last-child { border-bottom: 0; }
.history .when { color: var(--text-3); white-space: nowrap; width: 128px; flex: none; }
.history li.event { background: var(--surface-2); font-weight: 500; }

/* ---------- Loading, empty and error states ---------- */
.sk { display: inline-block; height: 12px; border-radius: 3px; background: var(--sk); vertical-align: middle; max-width: 100%; }
.sk.t { height: 24px; }
.sk.v { height: 24px; }
.sk-row { display: flex; align-items: center; gap: 12px; }
.state-box { padding: 40px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.state-box h2 { font-size: var(--t-lg); }
.state-box p { color: var(--text-2); }
.state-box .row { margin-top: 6px; }
.state-box.err h2 { color: var(--text); }
.err-code { font-size: var(--t-xs); color: var(--text-3); }

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1100px) {
  .summary { --cols: 3; }
  .summary .grp { grid-column: span 3; border-left: 0; }
  .summary .grp + .grp { border-top: 1px solid var(--border); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Responsive: phone ---------- */
@media (max-width: 760px) {
  :root { --section-gap: 36px; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; height: 52px; gap: 10px; }
  .topbar .brand { display: flex; }
  .brand { min-height: 44px; }
  .input, select.input { height: 44px; }
  .topbar .today { display: none; }
  .mobile-nav, .mobile-nav.hscroll { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 52px; z-index: 9; }
  .mobile-nav .hs-inner { display: flex; gap: 4px; padding: 4px 12px; }
  .mobile-nav a { display: flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 44px; border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--t-sm); white-space: nowrap; }
  .mobile-nav a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); font-weight: 500; }
  .content { padding: 20px 16px 40px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head .actions { width: 100%; }
  h1 { font-size: 22px; }
  .summary { --cols: 2; }
  .summary .grp { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .grp .stat:nth-child(even) { border-left: 0; }
  .summary .grp .stat:last-child:nth-child(2n) { grid-column: 1 / -1; }
  .summary.simple { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .summary.simple .stat:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
  .stat { padding: 6px 14px 12px; }
  .stat .value { font-size: var(--t-lg); }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .desktop-only { display: none !important; }
  .mlist { display: block; }
  .meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .waterfall td.lbl { width: auto; }
  .waterfall td.bar { display: none; }
  .radio-cards { grid-template-columns: minmax(0, 1fr); }
  .checklist li { flex-wrap: wrap; padding: 12px 14px; }
  .checklist .item-act { width: 100%; padding-left: 32px; }
  .action-bar { padding: 12px 14px; }
  .action-bar > * { width: 100%; }
  .action-bar .btn { flex: 1; }
  .note { padding: 12px 14px; }
  .note .note-actions .btn, .posted-card .row .btn { flex: 1; }
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 12px 12px 0 0; max-height: 100%; }
  .modal-head { padding: 18px 16px 0; }
  .modal-body { padding: 10px 16px 4px; }
  .modal-foot { padding: 14px 16px 16px; }
  .modal-foot .btn { flex: 1; }
  .history li { flex-direction: column; gap: 2px; padding: 10px 14px; }
  .history .when { width: auto; }
  table.data th, table.data td { padding: 10px 12px; }
  .je-table th.num, .je-table td.num { width: 104px; }
  .proof { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px; }
  .proof .pf { flex-direction: row; justify-content: space-between; grid-column: 1 / -1; align-items: baseline; gap: 12px; }
  .proof .pf-v { font-size: var(--t-md); }
  .proof .pf.result { border-top: 1px solid var(--border); padding-top: 8px; }
  .rf-lists { grid-template-columns: minmax(0, 1fr); }
  .rf-lists > div { padding: 12px 14px 14px; }
  .rf-lists > div + div { border-left: 0; border-top: 1px solid var(--border); }
  /* Journal and roll-forward tables on phones: one block per line, account or label on
   * its own line, each amount beneath it with its column name (H1, H2). No sideways scroll. */
  table.stack-phone, table.stack-phone tbody, table.stack-phone tfoot, table.stack-phone tr, table.stack-phone td { display: block; width: auto; }
  table.stack-phone { table-layout: auto; }
  table.stack-phone thead { display: none; }
  table.stack-phone tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.stack-phone tbody tr:last-child { border-bottom: 0; }
  table.stack-phone tfoot tr { border-top: 1px solid var(--border-strong); border-bottom: 0; }
  table.data.stack-phone td, table.data.stack-phone tfoot td { padding: 0; border: 0; background: transparent; }
  table.data.stack-phone td.num, .je-table.stack-phone td.num { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 4px; width: auto; text-align: right; }
  table.data.stack-phone td.num::before { content: attr(data-label); color: var(--text-2); font-size: var(--t-xs); font-weight: 400; text-align: left; }
  table.data.stack-phone td.num:empty { display: none; }
  .je-table.stack-phone .acct-num { display: block; font-size: var(--t-xs); margin: 0; }
  .rf-table.stack-phone td.lbl { padding-left: calc(var(--lv, 0) * 16px); }
  .rf-table.stack-phone td.num { padding-left: calc(var(--lv, 0) * 16px); }
  .rf-table.stack-phone tbody tr td { padding-top: 0; padding-bottom: 0; }
  .rf-table.stack-phone tbody tr { border-bottom: 1px solid var(--border); }
  .batch-je table.data.stack-phone tr { padding-left: 0; padding-right: 0; }
  .filters { display: none; }
  .info-tip { width: 44px; height: 44px; margin: -13px -13px -13px -9px; vertical-align: middle; }
  .info-tip .tip { position: fixed; top: auto; left: 16px; right: 16px; width: auto; }
  .filter-phone { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
  .filter-phone .btn { flex: none; }
  .state-box { padding: 28px 16px; }
}
@media (min-width: 761px) { .phone-only { display: none !important; } }
.warn { color: var(--warn); }

/* ---------- One-line notices ---------- */
.line-note { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; margin-bottom: 20px; border: 1px solid var(--ok-border); background: var(--ok-bg); border-radius: var(--radius); font-size: var(--t-sm); color: var(--text); }
.line-note .icon { width: 16px; height: 16px; color: var(--ok); flex: none; }
.line-note span.t { flex: 1; min-width: 0; }
.line-note .x { flex: none; width: 32px; height: 32px; border: 0; background: transparent; color: var(--text); border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; }
.line-note .x:active { background: rgba(21, 32, 43, .08); }
.line-note .x svg { width: 14px; height: 14px; }
.note-line { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); font-size: var(--t-sm); }
.note-line .icon { width: 16px; height: 16px; color: var(--ok); flex: none; }
.note-line .t { flex: 1; min-width: 0; }
.note-line .btn { height: 32px; padding: 0 12px; }
.dash { display: flex; flex-direction: column; }
.preview-line { margin-top: 10px; font-size: var(--t-xs); color: var(--text-3); }
.preview-line.off { color: var(--warn); }
.preview-line .linkish { font-size: var(--t-xs); }
.action-bar.solo { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 16px; background: var(--surface); box-shadow: var(--shadow); }
.action-bar .why:empty { display: none; }
/* The primary action stays in view at every width (H6) */
.action-bar.sticky { position: sticky; bottom: 12px; z-index: 8; box-shadow: 0 -1px 0 var(--border), 0 -6px 12px -6px rgba(21, 32, 43, .12), var(--shadow); }

/* ---------- Batch post and match ---------- */
.batch-list { list-style: none; margin: 0; padding: 0; }
.batch-list > li { border-bottom: 1px solid var(--border); }
.batch-list > li:last-child { border-bottom: 0; }
.batch-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 36px; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; }
.batch-row.nox { grid-template-columns: 28px minmax(0, 1fr) auto; }
.batch-row input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.batch-row .bmain { min-width: 0; }
.batch-row .bmain .cell-sub { margin-top: 1px; }
.batch-row .amt { text-align: right; }
.batch-row .exp { width: 32px; height: 32px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.batch-row .exp:active { background: var(--neutral-pill); }
.batch-row .exp svg { width: 14px; height: 14px; }
.batch-row .exp[aria-expanded="true"] svg { transform: rotate(90deg); }
.batch-je { padding: 0 18px 16px 58px; }
.batch-je .table-wrap { max-width: 760px; }
.batch-row.batch-head { padding-top: 8px; padding-bottom: 8px; font-size: var(--t-th); font-weight: 500; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.batch-row.batch-head .amt-h { text-align: right; }
.batch-je .je-part { font-size: var(--t-xs); color: var(--text-2); font-weight: 500; margin: 12px 0 2px; }
.batch-je table.data th { background: transparent; }
.batch-je table.data td, .batch-je table.data th { padding: 7px 0 7px 12px; }
.batch-je table.data td:first-child, .batch-je table.data th:first-child { padding-left: 0; }
.batch-je table.data tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.check-label { display: contents; }
.done-list { list-style: none; margin: 0; padding: 0; }
.done-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.done-list li:last-child { border-bottom: 0; }
.ob-step-label { display: none; }

@media (max-width: 760px) {
  /* Tap targets: 44px on phones */
  .btn, .btn-sm, .card .btn, .note .btn, .modal .btn, .note-line .btn { height: auto; min-height: 44px; }
  .chip { height: 44px; padding: 0 14px; }
  .segmented button { min-height: 44px; padding: 8px 14px; }
  .all-pick { min-height: 44px; }
  .line-note .x { width: 44px; height: 44px; }
  .linkish.tap { min-height: 44px; display: inline-flex; align-items: center; }
  .item-links { flex-direction: column; gap: 0; margin: 8px 0 0; font-size: var(--t-sm); }
  .item-link { min-height: 44px; justify-content: space-between; border-top: 1px solid var(--border); color: var(--text); }
  .item-link::after { content: "›"; color: var(--text-3); font-size: var(--t-lg); }
  .item-link .why { margin-left: auto; }
  .checklist .item-act .btn { width: 100%; }
  .mitem { min-height: 44px; }
  .dash .dash-stats { order: 2; }
  .dash .dash-list { order: 1; }
  .dash .dash-stats .section-title { margin-top: var(--section-gap); }
  .action-bar.sticky { bottom: 0; margin: 16px -16px -40px; border-radius: 0; border-left: 0; border-right: 0; }
  .action-bar.sticky .why { font-size: var(--t-xs); }
  .batch-row { padding: 8px 6px 8px 10px; gap: 8px; grid-template-columns: 36px minmax(0, 1fr) auto 44px; }
  .batch-row.nox { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .batch-row .chk { width: 36px; height: 44px; display: grid; place-items: center; }
  .batch-row .exp { width: 44px; height: 44px; }
  .batch-je { padding: 0 12px 12px; }
  .note-line { flex-wrap: wrap; }
  .note-line .btn { margin-left: auto; }
  .ob-step-label { display: block; }
}

/* ---------- Hover: pointer devices only ---------- */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .brand:hover, .nav a:hover, .mitem:hover, a.btn:hover, a.shot:hover { text-decoration: none; }
  .crumbs a:hover { text-decoration-color: currentColor; }
  .nav a:hover { background: var(--bg); color: var(--text); }
  .nav a[aria-current="page"]:hover { background: var(--accent-weak); color: var(--accent-active); }
  .linkish:hover { text-decoration: underline; color: var(--accent-hover); }
  .btn:hover { background: var(--surface-2); border-color: var(--text-3); }
  .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn-danger:hover { background: #87201a; border-color: #87201a; }
  .btn-ghost:hover { background: var(--neutral-pill); border-color: transparent; color: var(--text); }
  .chip:hover { border-color: var(--text-3); color: var(--text); }
  .chip[aria-pressed="true"]:hover { color: #fff; }
  .segmented button:hover { color: var(--text); }
  .mitem:hover { background: var(--surface-2); }
  table.data tbody tr.hoverable:hover > td { background: var(--surface-2); }
  .exp-btn:hover, .batch-row .exp:hover { background: var(--neutral-pill); color: var(--text); }
  .line-note .x:hover { background: rgba(21, 32, 43, .08); }
  .radio-card:hover { border-color: var(--text-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
table.fixed-table { table-layout: fixed; }
table.fixed-table td { overflow-wrap: break-word; }

/* ---------- Build 1: final design-review fixes ---------- */
/* Table cells are weight 400; only totals and group labels are 500 */
table.data td { font-weight: 400; }
table.data tfoot td, table.data tr.group td { font-weight: 500; }
/* Payouts table: fixed column widths, so filtering never moves a column */
table.payouts-table { table-layout: fixed; min-width: 1040px; }
table.payouts-table td.qcell { min-width: 0; }
table.payouts-table td { overflow-wrap: anywhere; }
table.payouts-table td.status .cell-sub { white-space: normal; }
/* QuickBooks rejected an entry */
.pill-rejected { background: var(--bad-bg); color: var(--bad); }
/* A voided entry, while the payout is not posted again */
.note-void { background: var(--surface-2); border-color: var(--border-strong); }
.note-void .icon { color: var(--text-2); }
/* Entry history: one dated row per event */
.entry-history .history li { display: flex; gap: 14px; }
.entry-history .history .when { flex: none; min-width: 112px; color: var(--text-2); font-variant-numeric: tabular-nums; }
/* Roll-forward: what each entry not posted yet would move */
.stmt tr.np-head td { padding-top: 10px; }
.stmt tr.np-part td.lbl { padding-left: 24px; color: var(--text-2); }
.rf-rule { font-size: var(--t-xs); color: var(--text-2); font-weight: 400; display: block; }
@media (max-width: 760px) {
  .entry-history .history li { flex-direction: column; gap: 2px; }
}
@media (max-width: 760px) {
  /* Batch rows: the payout and entry links get a 44px tap area without changing the row height */
  .batch-row .bmain a { display: inline-block; padding: 13px 0; margin: -13px 0; }
}
@media (max-width: 760px) {
  /* The group with the info icon stacks in one column, so its label and the icon's 44px tap area fit on one line */
  .summary .grp:has(.info-tip) { grid-template-columns: minmax(0, 1fr); }
  .summary .grp:has(.info-tip) .stat + .stat { border-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
}

/* ---------- Fix round 1 ---------- */
/* A missing deposit kept open is still a problem: amber, not the grey of Resolved (U-H1) */
.pill-kept { background: var(--warn-bg); color: var(--warn); }
/* Error toast, for example when the clipboard refuses a copy (U-L10) */
.toast.err { background: var(--bad); }
/* The figure's explanation opens above its icon, so it never covers the figures beside it (U-L8) */
.info-tip .tip { top: auto; bottom: calc(100% + 8px); }
/* Close: Open items amounts say what they are (A-L4) */
.open-amt { display: inline-flex; align-items: baseline; gap: 6px; }
.open-amt .what { color: var(--text-3); font-size: var(--t-xs); }
/* On a phone the row's sentence takes the full width and the labelled amount sits under it, right-aligned,
   so neither breaks into short ragged lines */
.open-amt { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 760px) {
  .mitem .bottom:has(> .open-amt) { flex-wrap: wrap; row-gap: 4px; }
  .mitem .bottom:has(> .open-amt) > span:first-child { flex: 1 1 100%; }
  .mitem .bottom > .open-amt { margin-left: auto; }
}
/* Close: the roll-forward's sign rule, shown on phones where the table header is hidden (A-L2) */
.rf-rule-phone { display: none; font-size: var(--t-xs); color: var(--text-2); margin-left: 8px; }
.rf-head-right { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stmt tr.unexplained td { color: var(--warn); font-weight: 500; }
/* Missing deposit: when to worry, one line under the actions (U-H5) */
.worry-line { margin-top: 8px; font-size: var(--t-xs); color: var(--text-2); }
/* Dashboard: the chargeback evidence deadline under the QuickBooks status (U-M4) */
.cell-sub.due { color: var(--warn); }
/* Confirm button help text (U-M6) */
.confirm-help { font-size: var(--t-xs); color: var(--text-2); }
/* Batch rows: the payout is plain text, the chevron opens the entry */
.batch-row .bname { font-weight: 500; }
@media (max-width: 760px) {
  .rf-rule-phone { display: inline; }
  /* Text links get a 44px tap area on phones (A-L3) */
  .crumbs a, .stmt td.lbl a { display: inline-flex; align-items: center; min-height: 44px; }
  .crumbs { margin-bottom: 0; }
  /* Phone dashboard: the month totals come first, as one compact row with space under it (U-M11) */
  .dash .dash-stats { order: 1; margin-bottom: 20px; }
  .dash .dash-list { order: 2; }
  .dash .dash-stats .section-title { margin-top: 0; }
  .dash .summary { display: flex; overflow-x: auto; scrollbar-width: none; }
  .dash .summary .grp { display: contents; }
  .dash .summary .grp-label { display: none; }
  .dash .summary .stat { flex: 0 0 auto; min-width: 132px; padding: 10px 14px; text-align: left; border-left: 1px solid var(--border); border-top: 0; }
  .dash .summary .grp:first-child .stat:first-of-type { border-left: 0; }
  .dash .summary .stat .value { font-size: var(--t-lg); margin-top: 2px; }
  .dash .dash-list .section-title { margin-top: 0; }
}
/* Account mapping: a choice with one possible account reads as text (U-L4) */
.input-static { display: flex; align-items: center; min-height: 36px; font-size: var(--t-sm); color: var(--text); }
@media (max-width: 760px) {
  /* The compact totals row: every figure side by side, the same padding (U-M11) */
  .dash .summary .grp:has(.info-tip) .stat + .stat { border-top: 0; padding-top: 10px; border-left: 1px solid var(--border); }
}

/* ---------- Account menu (avatar) ---------- */
.acct-menu { position: relative; display: flex; }
.avatar-btn { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; border-radius: 50%; cursor: pointer; flex: none; }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.avatar-btn[aria-expanded="true"] .avatar { background: var(--accent-weak); color: var(--accent); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 30; padding: 6px; font-size: var(--t-sm); animation: pop-in .16s var(--ease-out); transform-origin: top right; }
.menu[hidden] { display: none; }
.menu-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.menu-name { font-weight: 500; }
.menu-sub { font-size: var(--t-xs); color: var(--text-2); overflow-wrap: anywhere; }
.menu-item { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--radius-sm); font: inherit; font-size: var(--t-sm); color: var(--text); cursor: pointer; text-align: left; }
.menu-item:active { background: var(--neutral-pill); }
@media (hover: hover) and (pointer: fine) { .menu-item:hover { background: var(--surface-2); } }
@media (max-width: 760px) {
  .menu-item { min-height: 44px; }
  .avatar-btn { width: 44px; height: 44px; margin-right: -7px; }
}
@media (prefers-reduced-motion: reduce) { .menu { animation: none; } }

/* ---------- Sign in, reset password, accept invite ---------- */
.auth-page { background: var(--surface); }
.auth-nav { display: flex; align-items: center; gap: 16px; padding: 16px 32px; max-width: 1200px; margin: 0 auto; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 56px 16px 72px; }
.auth-wrap h1 { text-wrap: balance; }
.auth-wrap .lede { color: var(--text-2); margin-top: 8px; text-wrap: pretty; }
.auth-card { padding: 24px; margin-top: 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .note { margin-bottom: 14px; }
.auth-card .label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-card .label-row a { font-size: var(--t-xs); }
.auth-card .fixed { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--t-sm); overflow-wrap: anywhere; }
.auth-alt { margin-top: 20px; font-size: var(--t-sm); color: var(--text-2); }
/* Site footer links (landing and sign-in): Privacy, Terms, contact, the marketing site */
.site-foot { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: var(--t-xs); }
.site-foot a { color: var(--text-2); }
.site-foot a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.auth-foot { max-width: 1200px; margin: 0 auto; padding: 24px 32px 40px; border-top: 1px solid var(--border); }
a.text-link, .auth-wrap a:not(.btn):not(.brand) { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-border); text-underline-offset: 2px; }
@media (max-width: 760px) {
  .auth-nav { padding: 12px 16px; }
  .auth-wrap { padding: 28px 16px 48px; }
  .auth-card { padding: 18px; }
  .auth-card .label-row a, .auth-alt a { display: inline-flex; align-items: center; min-height: 44px; }
  .auth-foot { padding: 16px 16px 32px; }
  .site-foot { gap: 0 20px; }
  .site-foot a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---------- Team ---------- */
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list > li { display: grid; grid-template-columns: minmax(0, 1fr) 180px 220px; align-items: center; gap: 8px 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.member-list > li:last-child { border-bottom: 0; }
.member-list .who { min-width: 0; }
.member-list .who .name { font-weight: 500; }
.member-list .who .cell-sub { overflow-wrap: anywhere; }
.member-list .role select.input { height: 34px; font-size: var(--t-sm); }
.member-list .role .role-text { color: var(--text-2); padding-left: 12px; }
.member-list .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.member-list .you { color: var(--text-3); font-weight: 400; }
.invite-form { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 12px; align-items: end; }
.invite-form .btn { height: 38px; }
.invite-form.two { grid-template-columns: minmax(0, 1fr) 180px; }
.link-box { display: flex; gap: 8px; margin-top: 8px; }
.link-box .input { flex: 1; min-width: 0; font-size: var(--t-xs); }
.role-help { margin: 0; font-size: var(--t-xs); color: var(--text-2); max-width: 70ch; }
.owner-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.owner-form .btn { height: 38px; }
@media (max-width: 760px) {
  .member-list > li { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
  .member-list .role select.input { height: 44px; }
  .member-list .acts { justify-content: flex-start; margin-left: -12px; }
  .member-list .role .role-text { padding-left: 0; }
  .owner-form { grid-template-columns: minmax(0, 1fr); }
  .owner-form .btn { height: 44px; }
  .member-list .acts .btn { height: 44px; }
  .invite-form, .invite-form.two { grid-template-columns: minmax(0, 1fr); }
  .invite-form .btn { height: 44px; }
  .link-box { flex-direction: column; }
  /* In a column, flex: 1 gave the field a zero basis: 20px tall on a phone (layout review 1) */
  .link-box .input { flex: none; height: 44px; }
  .link-box .btn { height: 44px; }
}

/* ---------- Phase 9: sync status (design 3.3) and the fix loop (3.2) ---------- */
.sync-line { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-top: 10px; font-size: var(--t-xs); color: var(--text-2); min-height: 18px; }
.note-bad .sync-line, .note-warn .sync-line, .note-info .sync-line { color: var(--text); }
.sync-err { color: var(--bad); }
.sync-mark { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; transform: translateY(-1px); }
.sync-line .sync-mark + .sync-err { margin-left: 0; }
.sb-sync { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: baseline; }
.sb-sync.plain { display: block; }
.sb-sync .sync-mark { grid-column: 1; }
.sb-sync .sync-err, .sb-sync .sb-t { grid-column: 2; }
.sb-sync.plain .sb-t { display: inline; }
.sb-sync .linkish { grid-column: 2; justify-self: start; margin-top: 2px; font-size: var(--t-xs); }
.sb-sync.plain .linkish { margin-left: 6px; }
.page-sync { margin-top: 6px; }
.page-sync .linkish { font-size: var(--t-xs); margin-left: 6px; }
.btn.busy, .btn.busy:disabled { color: var(--text-3); background: var(--surface-2); border-style: dashed; border-color: var(--border-strong); gap: 8px; opacity: 1; box-shadow: none; }
.note .note-actions.loop { justify-content: flex-start; align-items: center; margin-top: 8px; }
.note .note-actions.loop .btn[data-resync] { min-width: 108px; justify-content: center; }
.note .worry-line { margin-top: 12px; font-size: var(--t-xs); }
.nw { white-space: nowrap; }
.page-note { margin-bottom: 20px; }
.found-line { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--ok-border); background: var(--ok-bg); border-radius: var(--radius); font-size: var(--t-sm); color: var(--text); }
.found-line .icon { width: 16px; height: 16px; color: var(--ok); flex: none; }
@media (max-width: 760px) {
  .note .note-actions.loop { flex-direction: column; align-items: stretch; margin-left: -30px; }
  .note .note-actions.loop .btn { width: 100%; flex: none; }
  .note .note-actions.loop .btn-ghost { min-height: 40px; }
  .stat-row .stat { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
}
.glabel-more { font-weight: 400; margin-left: 8px; }
.mgroup.mtotal { font-weight: 400; }
@media (max-width: 760px) { .meta .full { grid-column: 1 / -1; } }
.je-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--border); }
.amt-inline { margin-left: 6px; color: var(--text); }
.bmain .pill { margin-left: 8px; }
@media (max-width: 760px) { .bmain .pill { margin-left: 0; margin-top: 4px; } }
.check-note { display: block; margin-top: 6px; }
@media (max-width: 760px) {
  .summary.phone-rows { grid-template-columns: minmax(0, 1fr) !important; }
  .summary.phone-rows .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; text-align: left; border-left: 0 !important; grid-column: auto !important; border-top: 1px solid var(--border); }
  .summary.phone-rows .stat:first-child { border-top: 0; }
  .summary.phone-rows .stat .label, .summary.phone-rows .stat .basis, .summary.phone-rows .stat .foot { grid-column: 1; }
  .summary.phone-rows .stat .value { grid-column: 2; grid-row: 1 / span 3; text-align: right; font-variant-numeric: tabular-nums; }
}
/* M3: the sidebar error line: mark inline with the first line, text and Re-sync on one column */
.conn .sb-sync { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-items: start; color: var(--text-2); }
.conn .sb-sync .sync-mark { margin-top: 5px; transform: none; }
.conn .sb-sync.plain { display: block; }
@media (max-width: 760px) {
  .page-sync .linkish, .connect-box [data-disconnect] { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
  .note .note-actions.loop .btn-ghost { min-height: 44px; }
}

/* ---------- Phase 7: Connections ---------- */
.conn-list { list-style: none; margin: 0; padding: 0; }
.conn-list > li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: start; gap: 4px 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.conn-list > li:last-child { border-bottom: 0; }
.conn-list .glyph { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; font-weight: 500; color: var(--text-2); background: var(--neutral-pill); font-size: var(--t-md); }
.conn-list .name { font-weight: 500; display: block; }
.conn-list .detail { display: block; color: var(--text-2); font-size: var(--t-sm); margin-top: 2px; max-width: 60ch; }
.conn-list .state { display: flex; align-items: flex-start; gap: 6px; font-size: var(--t-xs); margin-top: 6px; color: var(--text-2); }
.conn-list .state svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.conn-list .state.ok svg { color: var(--ok); }
.conn-list .state.bad { color: var(--bad); }
.conn-list .acts { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.conn-list .acts .btn { white-space: nowrap; }
.conn-note { margin: 12px 0 0; font-size: var(--t-xs); color: var(--text-2); }
.import-list { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--border); }
.import-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--t-sm); }
.import-list .fname { overflow-wrap: anywhere; }
.import-list .meta { color: var(--text-2); white-space: nowrap; }
@media (max-width: 760px) {
  .conn-list > li { grid-template-columns: 40px minmax(0, 1fr); padding: 14px; }
  .conn-list .acts { grid-column: 1 / -1; flex-direction: column; align-items: stretch; margin-top: 8px; }
  .conn-list .acts .btn { width: 100%; height: 44px; }
  .import-list li { flex-direction: column; gap: 2px; }
  /* A 44px tap area on the inline link without moving the text */
  .conn-list .detail a { display: inline-block; padding: 13px 0; margin: -13px 0; }
  #files .note-actions .btn { width: 100%; height: 44px; }
}

/* Restricted-key steps (deploy r2): onboarding, the key dialog and Connections */
.key-steps { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--t-sm); }
.key-steps li { padding-left: 2px; }

/* ==========================================================================
 * Plaid bank matching (plaid design 6). Every rule below either styles markup that only a company with bank
 * matching gets, or is scoped under body.bk, which only such a company's pages carry. The unflagged pages are
 * Phase 9's, pixel for pixel (design 9.3).
 * ========================================================================== */
/* Deposit card: Bank and QuickBooks side by side (6.3) */
.ev-card { margin-bottom: 16px; }
.ev-card .card-head h2:focus { outline: none; }
.ev-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ev { min-width: 0; padding: 0 24px; }
.ev:first-child { padding-left: 0; border-right: 1px solid var(--border); }
.ev:last-child { padding-right: 0; }
.ev-h { font-size: var(--t-sm); font-weight: 500; margin: 0; }
.ev-acct { font-size: var(--t-xs); color: var(--text-2); margin: 2px 0 10px; }
.ev .kv { margin: 0; }
.ev .kv dd { font-variant-numeric: tabular-nums; }
/* r4 L6, r5 M9: one right edge; positive and text values keep the width of ")" */
.ev .kv dd:not(:has(.amt.neg))::after { content: ")"; visibility: hidden; }
.ev .kv dd .amt .rp:not(.on) { display: none; }
.ev .kv dd.dd-warn, .ev .kv dd.dd-warn .amt { color: var(--warn); }
.ev-desc { font-size: var(--t-xs); color: var(--text-2); margin: 8px 0 0; overflow-wrap: anywhere; text-wrap: pretty; }
.ev-sub { font-size: var(--t-xs); color: var(--text-2); margin: 12px 0 4px; }
.ev .ev-act { margin: 4px 0 0; font-size: var(--t-xs); }
.ev .ev-link { margin: 10px 0 0; font-size: var(--t-xs); }
.ev-near { margin-left: 12px; }
.ev-near .kv { font-size: var(--t-xs); }
.ev-near .kv dt, .ev-near .kv dd { color: var(--text-2); }
.ev-near .grp { padding: 12px 0; }
.ev-near .grp:first-child { padding-top: 4px; }
.ev-near .grp:last-child { padding-bottom: 0; }
.ev-near .grp + .grp { border-top: 1px solid var(--border); }
.ev-near .ev-desc { margin-top: 2px; }
.code-id.nw, .nw { white-space: nowrap; }
.linkish-a { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* r5 M12: the grey note has a neutral tint and no border */
.note.bk-plain { background: var(--neutral-pill); border-color: transparent; }
.later-note .later-go { display: block; margin-top: 10px; }
.later-note .later-go .btn { white-space: nowrap; }
/* In bank (6.4, leftover H1): the dash and its sub-line in normal flow, both on the numeric edge */
.inb .amt { display: inline-block; }
.inb .cell-sub { text-align: right; }
.inb .cell-sub::after { content: ")"; visibility: hidden; }
/* Sidebar bank line (6.6, r5 L12): text and mark share the state colour; every mark is 12px */
.conn [data-conn="bank"] .ok-mark { width: 12px; height: 12px; }
.conn [data-conn="bank"].conn-bad, .conn [data-conn="bank"].conn-bad .ok-mark { color: var(--bad); width: auto; }
.conn [data-conn="bank"].conn-bad .ok-mark { width: 12px; height: 12px; }
.conn [data-conn="bank"].conn-warn, .conn [data-conn="bank"].conn-warn .ok-mark { color: var(--warn); }
.conn [data-conn="bank"].conn-mute, .conn [data-conn="bank"].conn-mute .ok-mark { color: var(--text-2); }
/* r5 M3: a phone shows the non-healthy bank line next to the sync line on Payouts and Close */
.page-sync .bk-line { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.page-sync .bk-line svg { width: 12px; height: 12px; flex: none; }
.bk-line.warn { color: var(--warn); }
.bk-line.bad { color: var(--bad); }
.bk-line.mute { color: var(--text-2); }
/* Connections bank row (6.2): one grid and action columns for every row (leftover M5) */
.bk .conn-list > li .acts { display: grid; grid-template-columns: var(--a1w, auto) var(--a2w, auto); justify-content: end; column-gap: 8px; }
.bk .conn-list > li .acts > span { display: flex; justify-content: flex-end; }
.bk .conn-list .acts .ph { visibility: hidden; }
.bk .conn-list .state .when { white-space: nowrap; }
.conn-list .state.warn { color: var(--warn); }
.conn-list .state.warn svg { color: var(--warn); }
.conn-list .state.mute svg { color: var(--text-3); }
.conn-list .state.mute.big { font-size: var(--t-sm); }
.conn-list .noted { display: block; font-size: var(--t-xs); color: var(--text-2); margin-top: 4px; }
.conn-list .noted:focus { outline: none; }
.bk .conn-list .state, .bk .conn-list .detail, .bk .cell-sub, .bk .check-note { text-wrap: pretty; }
.bk .conn-list .btn.busy { border-style: solid; }
@media (prefers-reduced-motion: reduce) { .bk .spinner { animation: none; } }
/* Onboarding bank step (6.1) */
.connect-box.no-glyph .who { padding-left: 0; }
.acct-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.acct-pick .radio-card .rc-desc, .acct-pick .radio-card:has(input:checked) .rc-desc { color: var(--text-2); font-size: var(--t-xs); }
.bk-asked { display: flex; gap: 8px; align-items: flex-start; margin: 22px 0 0; }
.bk-asked svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--text-3); }
.bk-asked:focus { outline: none; }
.stepper .skip { color: var(--text-3); }
.stepper .skip .bar { background: var(--border-strong); }
/* Leftover H2: desktop keeps "Back, then Skip on the right"; a phone stacks Skip first by DOM order */
.step-foot.bk-foot { flex-direction: row-reverse; justify-content: flex-start; }
/* Mock Plaid Link (ALLOW_MOCK_ADAPTERS only) */
.mock-link .inst { display: flex; align-items: center; gap: 12px; }
.mock-link .inst .glyph { width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; background: var(--neutral-pill); font-weight: 500; color: var(--text-2); }
/* Close: the not-checked list and the later-sync lines */
.check-unchecked { display: block; margin-top: 6px; font-size: var(--t-xs); color: var(--text-2); }
.check-unchecked a { color: var(--text-2); }
.rf-ghost { font-size: var(--t-xs); margin: 12px 0 0; }
/* Flagged layout fixes (r2 H4, r3 L5): stacked phone figures, "Crosses month-end" wraps */
.bk table.payouts-table td.nowrap .cell-sub { white-space: normal; }
.bk table.payouts-table td.inb .cell-sub { white-space: nowrap; }
.bk .cell-sub, .bk .bottom span { text-wrap: pretty; }
.mtotal-bank { font-weight: 400; }
:root .bk :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--surface); }
@media (max-width: 760px) {
  .ev-grid { grid-template-columns: minmax(0, 1fr); }
  .ev { padding: 0; }
  .ev:first-child { border-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; }
  .ev-near .ev-act a, .ev-near .ev-act button { display: inline-block; padding: 4px 0 22px; margin: -4px 0 -22px; }
  .ev-near .grp { padding: 14px 0; }
  .ev .undo-act { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 12px; }
  .bk .dash #stats { display: flex; flex-direction: column; overflow: visible; }
  .bk .dash #stats .grp { border-left: 0 !important; display: flex; flex-direction: column; }
  .bk .dash #stats .stat { flex: none; min-width: 0; width: 100%; }
  .bk .dash #stats .stat, .bk .dash #stats .stat * { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  .bk .dash #stats .stat.bank-fig { border-top: 1px solid var(--border); }
  .bk .conn-list > li .acts { display: flex; }
  .bk .conn-list > li .acts > span { display: contents; }
  .bk .conn-list .acts .ph { display: none; }
  .step-foot.bk-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .step-foot.bk-foot .btn { flex: none; width: 100%; }
  .bk .modal-back.sheet { align-items: flex-end; padding: 0; }
  .bk .modal-back.sheet .modal { border-radius: 10px 10px 0 0; max-width: none; }
  .bk .modal-back.sheet .modal-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .mclose-total { display: block; }
}
