@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap');

/* ════════════════════════════════════════════════════════════════════════════
   ArBooks design system
   ────────────────────────────────────────────────────────────────────────────
   Everything on screen is built from the tokens and component classes below.
   Use them; don't invent one-off colors, sizes or spacing. If a screen truly
   needs a new component, add it to the COMPONENTS part of this file and list
   it here.

   TOKENS (CSS custom properties on :root)
     Color      --brand-50 … --brand-950   deep green, the ArBooks identity
                --gray-0 … --gray-950      neutrals (a touch of green)
                --bg  --surface  --surface-2  --surface-sunk
                --text  --text-2 (secondary)  --text-3 (hints)  --line  --line-strong
                --accent  --accent-hover  --accent-press  --accent-soft  --accent-text
                --money-in  --money-out    amounts coming in / going out
                --success|--warning|--danger|--info  each with -bg, -line, -text
     Type       --font-sans  --font-mono
                --text-xs 12  --text-sm 13  --text-md 14 (body)  --text-lg 16
                --text-xl 18  --text-2xl 22  --text-3xl 26  --text-4xl 32
                Money is tabular everywhere (font-variant-numeric: tabular-nums).
     Space      --sp-1 4px  --sp-2 8  --sp-3 12  --sp-4 16  --sp-5 20  --sp-6 24  --sp-8 32  --sp-10 40
     Radius     --r-xs 4px  --r-sm 6  --r-md 8  --r-lg 12  --r-full
     Shadow     --shadow-xs  --shadow-sm  --shadow-md  --shadow-lg  --shadow-xl
     Focus      --ring (box-shadow for fields)  :focus-visible draws a 2px outline
     Layout     --nav-w  --topbar-h  --content-max
     Old names (--spruce, --paper, --ink, --muted, --line, --moss, --amber, --brick…)
     still work: they point at the tokens above.

   COMPONENTS
     Buttons     <button> is primary. Variants: .btn (for <a>), .quiet / .secondary,
                 .ghost, .danger, .link; sizes .sm, .lg; .icon-btn (square, icon only);
                 .btn-group (buttons butted together).
     Fields      input, select, textarea get the standard look. label.field = label over
                 its field. .row = fields side by side; .form-grid = responsive grid of
                 fields; .help = hint under a field; input.money / input.qty right-align.
                 .input-icon wraps an input with a leading icon.
     Tables      On phones (<640px) list tables become stacked cards: app.js adds .stack and
                 data-label to tables in .table-wrap with 4+ columns and no typing fields.
                 .table-wrap around a <table> (card frame, scrolls sideways). th/td default
                 rules; td.num / th.num right-aligned money; tr.clickable rows; tfoot or
                 tr.total = totals row; table.zebra stripes; table.compact = dense rows;
                 .table-wrap.sticky (max-height + sticky header).
     Cards       .panel (section card), .card (link card), .tiles (KPI tiles),
                 .stat (label + big number inside a tile).
     Page header .page-head > div (h1, p.sub) + .toolbar (actions). Built by head().
     Tabs        .tabs > a|button (.on or aria-current/aria-selected) underline tabs.
                 .settings-tabs and .report-tabs use the same look.
                 .chips > .chip = filter chips (.on / aria-pressed), .chip .count.
                 .segmented > button = two to four options in one control.
     Badges      .pill / .badge with .success .warning .danger .info .neutral
                 (.pill.open .paid .credit .print .void .new kept). .tag = small label.
     Notices     .notice.error|.ok|.warn|.info (inline). Flash "ok" notices float
                 as toasts; toast(text, kind) in app.js shows one anywhere.
     Empty       .empty (table cell / short line); .empty-state (icon, h3, p, actions):
                 emptyState({ icon, title, text, actions }) in app.js.
     Loading     .skel (shimmer block), .skel-line, .skel-row; skeleton(n) in app.js;
                 every page shows .page-skeleton while it loads.
     Dialogs     <dialog class="panel"> (+ .wide); .dlg-head (title + X); .dlg-foot (sticky
                 action bar: Cancel left, then secondary, then primary). modal() builds this
                 and turns a dialog's last row of buttons into the footer by itself;
                 <dialog class="panel drawer"> slides in from the right.
                 modal(title, ...body) and drawer(title, ...body) in app.js.
     Menus       .menu (pop-up list) > .menu-item | .menu-head | .menu-sep;
                 menuButton(label, items) in app.js makes a "more actions" button.
     Icons       icon(name, size) in app.js: line icons that take the text color.
     Switch      label.switch > input[type=checkbox] + span.switch-track: on/off toggle.
     Banking     .bank-tiles > a.bank-tile (books vs bank tile), .rmark.r/.c (R/C marks), .carousel-dots (phone strip position),
                 tr.quick-add (register entry row), .filter-panel (toggled filter fields).
     Combo box   .combo > input.combo-input + .combo-list > .combo-opt: type-to-search picker,
                 combo({ id, label, items, value, onPick }) in app.js.
     Steps       ol.steps > li.step(.done|.now) > .step-dot + .step-text: a record's stages.
     Money in    .rp-top (fields + .rp-hero big amount), .rp-bar (title, search, actions),
                 .rp-grid (tick-and-amount table, tr.on = ticked), .rp-foot > .rp-verdict + .rp-sum
                 (dl of figures, .big total): Receive payment, Receive money, Deposit checks.
                 .sheet.dep-slip = printed deposit ticket (.dep-acct, .dep-box).
     Form bar    .form-bar (.form-bar-left / -total / -right): sticky dark action bar at the
                 bottom of a long form (Cancel and drafts left, Save buttons right).
     Settings    .set-page > .set-nav (tabs down the left) + .set-content > .set-section (title, .set-rows dl,
                 .set-pencil; .editing holds .set-form with .set-actions). setSection() in app.js builds one.
     Users       .users-table, .user-cell, .user-status; .role-cards > .role-card(.on) with .role-can/.role-cant
                 lists (Add user); .history-list (a person's audit trail, in a drawer).
     Shell       .shell > .nav (left menu) + .workspace > .topbar + main.
                 head(title, sub, ...actions) draws the page header.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Brand: deep spruce green */
  --brand-50: #eef6f2;
  --brand-100: #d7ebe1;
  --brand-200: #b0d6c4;
  --brand-300: #80ba9f;
  --brand-400: #4f9a7a;
  --brand-500: #2d7d5f;
  --brand-600: #1f6a50;
  --brand-700: #195842;
  --brand-800: #164536;
  --brand-900: #13372d;
  --brand-950: #0e2a23;

  /* Neutrals */
  --gray-0: #ffffff;
  --gray-25: #fafbfa;
  --gray-50: #f4f6f5;
  --gray-100: #eceff0;
  --gray-150: #e3e8e6;
  --gray-200: #d6ddda;
  --gray-300: #bcc6c2;
  --gray-400: #92a09a;
  --gray-500: #66736e;
  --gray-600: #4f5b57;
  --gray-700: #3a4541;
  --gray-800: #252e2b;
  --gray-900: #161d1b;

  /* Roles */
  --bg: #f3f5f4;
  --surface: var(--gray-0);
  --surface-2: var(--gray-25);
  --surface-sunk: var(--gray-50);
  --text: var(--gray-900);
  --text-2: var(--gray-600);
  --text-3: var(--gray-500);
  --line: var(--gray-150);
  --line-strong: var(--gray-300);
  --accent: var(--brand-600);
  --accent-hover: var(--brand-700);
  --accent-press: var(--brand-800);
  --accent-soft: var(--brand-50);
  --accent-text: var(--brand-700);

  /* Meaning */
  --money-in: #127245;
  --money-out: #b42318;
  --success: #17804e;  --success-bg: #e8f5ee;  --success-line: #b5dcc6;  --success-text: #0f5f39;
  --warning: #b26b00;  --warning-bg: #fdf4e3;  --warning-line: #f0d39b;  --warning-text: #7a4a03;
  --danger: #c4321f;   --danger-bg: #fdeeeb;   --danger-line: #f1c0b8;   --danger-text: #9b2615;
  --info: #2f63b0;     --info-bg: #ebf2fc;     --info-line: #bfd3f0;     --info-text: #234c88;

  /* Type */
  --font-sans: 'Public Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 26px;
  --text-4xl: 32px;

  /* Space, radius, depth */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-full: 999px;
  --shadow-xs: 0 1px 2px rgba(16, 32, 26, .05);
  --shadow-sm: 0 1px 3px rgba(16, 32, 26, .08), 0 1px 2px rgba(16, 32, 26, .04);
  --shadow-md: 0 4px 12px rgba(16, 32, 26, .08), 0 2px 4px rgba(16, 32, 26, .04);
  --shadow-lg: 0 12px 32px rgba(16, 32, 26, .14), 0 4px 8px rgba(16, 32, 26, .06);
  --shadow-xl: 0 24px 56px rgba(16, 32, 26, .22), 0 8px 16px rgba(16, 32, 26, .08);
  --ring: 0 0 0 3px rgba(45, 125, 95, .25);
  --focus: var(--brand-500);
  --ease: cubic-bezier(.2, .7, .3, 1);

  /* Layout */
  --nav-w: 252px;
  --topbar-h: 60px;
  --content-max: 1360px;
  --field-h: 36px;

  /* Old names, still used by page styles further down */
  --spruce: var(--brand-600);
  --spruce-2: var(--brand-700);
  --spruce-ink: #ffffff;
  --paper: var(--bg);
  --ink: var(--text);
  --muted: var(--text-2);
  --moss: var(--success);
  --moss-bg: var(--success-bg);
  --amber: var(--warning);
  --amber-bg: var(--warning-bg);
  --brick: var(--danger);
  --brick-bg: var(--danger-bg);
  --radius-sm: var(--r-sm);
  --radius: var(--r-md);
  --sub: var(--text-2);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-md)/1.5 var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--brand-100); }
a { color: var(--accent-text); text-decoration: none; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-800); text-decoration: underline; }
.btn:hover, .nav a:hover, .menu-item:hover, a.card:hover, a.dash-row:hover, .tabs a:hover, .settings-tabs a:hover, .report-tabs a:hover, a.chip:hover, .search-more:hover { text-decoration: none; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }
code, kbd { font-family: var(--font-mono); font-size: .92em; }
kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface); color: var(--text-2); font-size: 11px; }

h1 { font: 700 var(--text-3xl)/1.15 var(--font-sans); letter-spacing: -.015em; margin: 0; color: var(--text); }
h2 { font: 600 var(--text-xl)/1.3 var(--font-sans); letter-spacing: -.005em; margin: var(--sp-8) 0 var(--sp-3); color: var(--text); }
h3 { font: 600 var(--text-lg)/1.35 var(--font-sans); margin: var(--sp-5) 0 var(--sp-2); }
h4 { font: 600 var(--text-md)/1.4 var(--font-sans); margin: var(--sp-4) 0 var(--sp-2); }
p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }
.sub { color: var(--text-2); margin: var(--sp-1) 0 0; }
.small { font-size: var(--text-sm); }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.money-in, .up { color: var(--money-in); }
.money-out, .neg, .down { color: var(--money-out); }
strong.neg { color: var(--money-out); }
.owed { color: var(--warning-text); font-weight: 600; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
button, .btn {
  display: inline-block; padding: 7px 14px;
  font: 600 var(--text-md)/20px var(--font-sans); letter-spacing: .005em;
  border-radius: var(--r-sm); border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
/* The standard buttons (not the page-specific ones that restyle <button>) line up icons and text.
   :is() gives this the weight of button.quiet, so it beats the base rule above; size and variant rules below still win. */
:is(button:not([class]), button.quiet, button.secondary, button.primary, button.ghost, button.danger, button.sm, button.lg, button.icon-btn, button.new-btn, .btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--field-h); white-space: nowrap;
}
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button:active, .btn:active { background: var(--accent-press); }
button:disabled, .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
button:disabled:hover { background: var(--accent); border-color: var(--accent); }
button svg, .btn svg { flex: none; }

/* Secondary: white with a border. .quiet is the old name. */
button.quiet, .btn.quiet, button.secondary, .btn.secondary {
  background: var(--surface); color: var(--gray-800); border-color: var(--line-strong);
}
button.quiet:hover, .btn.quiet:hover, button.secondary:hover, .btn.secondary:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--text); }
button.quiet:active, .btn.quiet:active { background: var(--gray-100); }
button.quiet:disabled:hover { background: var(--surface); border-color: var(--line-strong); }
button.quiet.on, .btn.quiet.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--brand-300); }

/* Ghost: no frame until hovered */
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--gray-700); box-shadow: none; }
button.ghost:hover, .btn.ghost:hover { background: var(--gray-100); border-color: transparent; color: var(--text); }

/* Danger: destructive actions */
button.danger, .btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
button.danger:hover, .btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); }
button.danger.solid, .btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Link-looking button */
button.link {
  display: inline; min-height: 0; padding: 2px; border: none; background: none; box-shadow: none;
  color: var(--accent-text); font-weight: 500; text-decoration: none; text-underline-offset: 2px; white-space: normal; text-align: inherit;
}
button.link:hover { background: none; color: var(--brand-800); text-decoration: underline; }
button.link:disabled:hover { background: none; }

/* Sizes */
button.sm, .btn.sm { min-height: 28px; padding: 3px 10px; font-size: var(--text-sm); line-height: 20px; }
button.lg, .btn.lg { min-height: 44px; padding: 10px 20px; font-size: var(--text-lg); }
.icon-btn { width: var(--field-h); padding: 0; }
.icon-btn.sm { width: 28px; }
.btn-group { display: inline-flex; }
.btn-group > * { border-radius: 0; }
.btn-group > *:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group > *:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group > * + * { margin-left: -1px; }

/* ── Fields ─────────────────────────────────────────────────────────────── */
input, select, textarea {
  font: 400 var(--text-md)/20px var(--font-sans); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 7px 10px; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]), select { height: var(--field-h); }
input:hover, select:hover, textarea:hover { border-color: var(--gray-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input:disabled, select:disabled, textarea:disabled { background: var(--gray-50); color: var(--text-3); cursor: not-allowed; }
input[readonly] { background: var(--gray-25); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f5b57' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px;
}
select[multiple] { background-image: none; padding-right: 10px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0 2px; accent-color: var(--accent); vertical-align: middle; cursor: pointer; }
input[type=file] { padding: 5px; font-size: var(--text-sm); }
input[type=file]::file-selector-button { font: 600 var(--text-sm)/1 var(--font-sans); padding: 6px 10px; margin-right: 10px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); color: var(--gray-800); cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
textarea { line-height: 1.45; }
input.money, input.qty { text-align: right; width: 110px; font-variant-numeric: tabular-nums; }
input.qty { width: 80px; }
input.saved { outline: 2px solid var(--success); outline-offset: 1px; transition: outline-color .6s; }

label.field { display: grid; gap: 5px; font-size: var(--text-sm); font-weight: 600; color: var(--gray-700); }
label.field input, label.field textarea, label.field select { font-weight: 400; color: var(--text); }
label.field.grow { min-width: 200px; }
label.field.grow input { width: 100%; }
.field[hidden] { display: none; }
.help { font-size: var(--text-xs); color: var(--text-3); font-weight: 400; }
.row { display: flex; gap: var(--sp-3) var(--sp-4); align-items: flex-end; flex-wrap: wrap; }
.row + .row { margin-top: var(--sp-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-icon > input { padding-left: 34px; width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
legend { font-weight: 600; padding: 0 4px; }
label.radio, label.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
label.radio { margin: 4px 0; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--surface); font-variant-numeric: tabular-nums; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; background: var(--surface); box-shadow: var(--shadow-xs); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-2); background: var(--gray-25); white-space: nowrap; padding-top: 9px; padding-bottom: 9px;
}
thead th { border-bottom-color: var(--gray-200); }
tbody th { text-transform: none; letter-spacing: 0; font-size: var(--text-md); color: var(--text); background: var(--surface); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:hover > td { background: var(--gray-25); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover > td { background: var(--brand-50); }
tfoot td, tr.total td { font-weight: 700; border-top: 1px solid var(--gray-300); border-bottom: none; background: var(--gray-25); }
tfoot tr:last-child td { box-shadow: inset 0 -3px 0 -1px var(--surface), inset 0 -4px 0 -1px var(--gray-300); }
table.zebra tbody tr:nth-child(even) > td { background: var(--gray-25); }
table.compact th, table.compact td { padding: 5px 10px; }
table.compact td { font-size: var(--text-sm); }
.table-wrap.sticky { max-height: 70vh; overflow: auto; }
.table-wrap.sticky thead th, table.sticky thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--gray-200); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable .arrow { font-size: 10px; color: var(--accent); }
th.pick, td.pick { width: 34px; padding-right: 0; }
/* Buttons inside table rows are compact, and an actions cell may wrap rather than push the table wider. */
td :is(button:not(.link):not(.chip):not(.access-pill):not(.grid-n), .btn) { min-height: 30px; padding: 4px 10px; font-size: var(--text-sm); }
td:last-child:has(> :is(button, .btn, a) + :is(button, .btn, a)) { white-space: normal; }
tr.muted td { color: var(--text-2); }
td a:not(.btn) { text-decoration: none; font-weight: 500; }
td a:not(.btn):hover { text-decoration: underline; }
td.nowrap { white-space: nowrap; }
.table-wrap > table > :last-child > tr:last-child > td { border-bottom: none; }

/* ── Cards, panels and tiles ────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-5) var(--sp-6); box-shadow: var(--shadow-xs); }
.panel + .panel { margin-top: var(--sp-4); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel > .table-wrap { box-shadow: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
a.card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); color: inherit; }
.card strong { font-size: var(--text-lg); margin-right: 6px; }
.card p { margin: 6px 0 0; }
.panel.planned ul { line-height: 1.6; }
/* Taxes (#/taxes): what's due next, a card per tax, a return's filed status */
.tax-next .tn-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.tax-next .tn-head h2 { margin: 0; }
.tax-due-list { list-style: none; margin: 0; padding: 0; }
.tax-due-list li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--sp-3) var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.tax-due-list li:first-child { border-top: 0; }
.tdl-main { display: grid; gap: 2px; min-width: 0; }
.tdl-title { font-weight: 600; font-size: var(--text-lg); color: var(--text); }
.tdl-when { font-size: var(--text-md); color: var(--text-2); }
.tax-section { font-size: var(--text-xl); margin: var(--sp-6) 0 var(--sp-3); }
.tax-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tax-card { display: flex; flex-direction: column; gap: 2px; }
.tax-card .tc-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.tax-card .tc-fig { font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.tax-card .tc-line { font-weight: 500; }
.tax-status .ts-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.tax-status p { margin: var(--sp-2) 0 0; }
.tax-status .row { margin-top: var(--sp-3); }
.tax-card .tc-left { display: block; margin-top: 2px; }
.tax-phone-sub { display: none; }
main.hover-off tbody tr:hover > td, main.hover-off tbody tr.clickable:hover > td { background: inherit; }
.closed-days { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.closed-days .chip { display: inline-flex; align-items: center; gap: 6px; }
.tax-return-bar { display: flex; justify-content: flex-end; margin: 0 0 var(--sp-3); }
.tax-return-bar select { min-width: 200px; }
@media (max-width: 640px) {
  .tax-due-list li { grid-template-columns: 1fr auto; }
  .tax-due-list li > .btn { grid-column: 1 / -1; justify-self: start; }
  .tax-return-bar { justify-content: stretch; }
  .tax-phone-sub { display: block; }
  .tax-return-bar .btn-group { width: 100%; }
  .tax-return-bar select { flex: 1; min-width: 0; }
}
.tiles { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.tiles > div, .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); display: grid; gap: 2px; min-width: 190px; box-shadow: var(--shadow-xs); }
.tiles span, .stat-label { font-size: var(--text-xs); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-bottom: var(--sp-4); background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-xs); }
.stat { display: grid; gap: 2px; align-content: start; padding: var(--sp-3) var(--sp-5); background: var(--surface); min-width: 0; }
.stat .stat-value { font-size: var(--text-xl); }
.stat.danger .stat-value { color: var(--danger); }
.stat.warning .stat-value { color: var(--warning-text); }
.stat-note { font-size: var(--text-xs); color: var(--text-2); }
.tiles strong, .stat-value { font: 700 var(--text-2xl)/1.2 var(--font-sans); letter-spacing: -.01em; }

/* ── Page header ────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head .sub { font-size: var(--text-md); margin-top: 6px; }
.toolbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
button.back {
  display: inline-flex; min-height: 0; padding: 0; margin: 0 0 var(--sp-2); border: none; background: none; box-shadow: none;
  color: var(--text-2); font-weight: 600; font-size: var(--text-sm);
}
button.back:hover { background: none; color: var(--accent-text); text-decoration: underline; }
.crumbs { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--sp-1); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); text-decoration: underline; }

/* ── Tabs, chips, segmented ─────────────────────────────────────────────── */
.tabs, .settings-tabs {
  display: flex; flex-wrap: wrap; gap: 0 var(--sp-1); margin: 0 0 var(--sp-5);
  border-bottom: 1px solid var(--gray-200); padding: 0;
}
.tabs > a, .tabs > button, .settings-tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 0;
  padding: 10px 12px 11px; margin-bottom: -1px; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--text-2); font: 600 var(--text-md)/20px var(--font-sans); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tabs > a:hover, .tabs > button:hover, .settings-tabs a:hover { color: var(--text); background: none; border-bottom-color: var(--gray-300); }
.tabs > .on, .tabs > [aria-current='page'], .tabs > [aria-selected='true'], .settings-tabs a.on {
  color: var(--accent-text); border-bottom-color: var(--accent); background: none;
}

.report-tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin-bottom: var(--sp-5); border-bottom: 1px solid var(--gray-200); padding-bottom: var(--sp-3); }
.report-tabs .tab-group { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.report-tabs .tab-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-right: 6px; }
.report-tabs a { padding: 5px 10px; border-radius: var(--r-sm); color: var(--gray-700); text-decoration: none; font-weight: 500; }
.report-tabs a:hover { background: var(--gray-100); color: var(--text); }
.report-tabs a[aria-current='page'] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand-200); }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px;
  border-radius: var(--r-full); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: none;
  color: var(--gray-700); font: 500 var(--text-sm)/20px var(--font-sans); cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--gray-400); background: var(--gray-50); color: var(--text); }
.chip.on, .chip[aria-pressed='true'], .chip[aria-selected='true'] { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.chip .count { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: var(--r-full); background: var(--gray-100); color: var(--text-2); line-height: 18px; }
.chip.on .count, .chip[aria-selected='true'] .count { background: rgba(255, 255, 255, .2); color: #fff; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--gray-100); border-radius: var(--r-md); }
.segmented > button, .segmented > a { min-height: 30px; padding: 4px 12px; border: 0; background: transparent; color: var(--text-2); box-shadow: none; font-size: var(--text-sm); border-radius: var(--r-sm); text-decoration: none; }
.segmented > button:hover, .segmented > a:hover { background: rgba(255, 255, 255, .6); color: var(--text); }
.segmented > .on, .segmented > [aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-full);
  font-size: var(--text-xs); font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-700);
}
.pill.success, .badge.success, .pill.paid { background: var(--success-bg); color: var(--success-text); }
.pill.warning, .badge.warning, .pill.open, .pill.new { background: var(--warning-bg); color: var(--warning-text); }
.pill.danger, .badge.danger, .pill.print { background: var(--danger-bg); color: var(--danger-text); }
.pill.info, .badge.info, .pill.credit { background: var(--info-bg); color: var(--info-text); }
.pill.void { background: var(--gray-100); color: var(--text-2); text-decoration: line-through; }
.badge.dot::before, .pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: var(--r-xs); background: var(--gray-100); color: var(--text-2); font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px; }
.tag.warn { background: var(--warning-bg); color: var(--warning-text); }
.tag.ok { background: var(--success-bg); color: var(--success-text); }

/* ── Notices and toasts ─────────────────────────────────────────────────── */
.notice { padding: 10px 14px; border-radius: var(--r-md); margin: 0 0 var(--sp-4); border: 1px solid var(--line); background: var(--surface); }
.notice.error { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-line); }
.notice.ok { background: var(--success-bg); color: var(--success-text); border-color: var(--success-line); }
.notice.warn { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-line); }
.notice.info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
.notice.flash { display: flex; gap: 12px; align-items: flex-start; }
.notice.flash > span { flex: 1; }
.notice.flash .close, .toast .close {
  min-height: 0; padding: 0 2px; border: none; background: none; box-shadow: none; color: inherit;
  font-size: 20px; line-height: 1; opacity: .6;
}
.notice.flash .close:hover, .toast .close:hover { opacity: 1; background: none; }
.notice.flash.fading, .toast.fading { opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }

/* A confirmation floats at the bottom of the screen; it's still part of the page. */
.notice.flash.ok, .toast {
  position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: max-content; max-width: min(560px, calc(100vw - 32px)); margin: 0;
  padding: 12px 14px 12px 16px; border: 0; border-radius: var(--r-md);
  background: var(--gray-900); color: #fff; box-shadow: var(--shadow-lg);
  animation: toast-in .22s var(--ease);
}
.notice.flash.ok::before, .toast.ok::before {
  content: ''; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: var(--brand-400) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/12px no-repeat;
}
.notice.flash.ok.fading { transform: translate(-50%, 6px); }
.toast { display: flex; gap: 12px; align-items: flex-start; }
.toast.error { background: var(--danger-text); }
.toast-host .toast + .toast { bottom: 84px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.practice-banner { display: flex; align-items: center; gap: 8px; background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-line); border-radius: var(--r-md); padding: 8px 14px; margin-bottom: var(--sp-4); font-weight: 600; }

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty { padding: var(--sp-8) var(--sp-6); text-align: center; color: var(--text-2); }
td.empty { background: var(--surface) !important; }
.empty-state { display: grid; justify-items: center; gap: var(--sp-2); text-align: center; padding: var(--sp-10) var(--sp-6); color: var(--text-2); }
.empty-state .es-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--sp-1); }
.empty-state h3 { margin: 0; color: var(--text); font-size: var(--text-lg); }
.empty-state p { margin: 0; max-width: 46ch; }
/* The one-line "No … yet." messages across the app get the same look: an icon above, centered, in a soft card. */
div.empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-8) var(--sp-6); background: var(--surface); border: 1px dashed var(--gray-200); border-radius: var(--r-md); }
div.empty::before {
  content: ''; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231f6a50' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.panel div.empty, .dash-card div.empty { border: 0; padding: var(--sp-6) var(--sp-4); }
/* A row of related links under a list */
.links-row { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: var(--sp-4); font-size: var(--text-sm); }
.links-row a { font-weight: 500; }
.empty-state .toolbar { margin-top: var(--sp-3); justify-content: center; }

/* ── Loading skeletons ──────────────────────────────────────────────────── */
.skel, .skel-line {
  display: block; border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-50) 40%, var(--gray-100) 80%) 0 0 / 300% 100%;
  animation: skel 1.4s ease-in-out infinite;
}
.skel-line { height: 12px; margin: 10px 0; }
.skel-line.w-90 { width: 90%; } .skel-line.w-75 { width: 75%; } .skel-line.w-60 { width: 60%; } .skel-line.w-40 { width: 40%; } .skel-line.w-25 { width: 25%; }
.skel-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4); padding: 12px 0; border-bottom: 1px solid var(--line); }
.skel-row:last-child { border-bottom: 0; }
.skel-row .skel-line { margin: 0; }
.skel-block { display: grid; gap: 2px; }
.page-skeleton { display: grid; gap: var(--sp-5); }
.page-skeleton .skel-title { height: 28px; width: 240px; border-radius: var(--r-sm); }
.page-skeleton .skel-sub { height: 14px; width: 340px; max-width: 70%; }
.page-skeleton .skel-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-5) var(--sp-6); }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ── Dialogs and drawers ────────────────────────────────────────────────── */
dialog { color: var(--text); }
dialog.panel {
  max-width: min(560px, calc(100vw - 32px)); width: 100%; max-height: calc(100vh - 48px); overflow: auto;
  border: 0; border-radius: var(--r-lg); padding: var(--sp-6); box-shadow: var(--shadow-xl);
}
dialog.panel.wide { max-width: min(880px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(14, 26, 22, .5); backdrop-filter: blur(2px); }
dialog[open] { animation: dlg-in .18s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin: calc(var(--sp-6) * -1) calc(var(--sp-6) * -1) var(--sp-5); padding: var(--sp-4) var(--sp-6); border-bottom: 1px solid var(--line); position: sticky; top: calc(var(--sp-6) * -1); background: var(--surface); z-index: 2; }
.dlg-head h2 { font-size: var(--text-xl); margin: 0; }
.dlg-head button.quiet { border-color: transparent; box-shadow: none; color: var(--text-2); }
.dlg-head button.quiet:hover { background: var(--gray-100); color: var(--text); }
.dlg-head .dlg-x { margin-right: -8px; color: var(--text-2); }
/* The footer bar stays at the bottom of the dialog while its body scrolls. Cancel, then other actions, then the main one. */
dialog .dlg-foot, .dlg-foot {
  position: sticky; bottom: calc(var(--sp-6) * -1); z-index: 2;
  display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: var(--sp-2);
  margin: var(--sp-6) calc(var(--sp-6) * -1) calc(var(--sp-6) * -1); padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--line); background: var(--gray-25); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.dlg-foot > :first-child:not(:only-child) { margin-right: auto; }
dialog h3 { font-size: var(--text-lg); margin: var(--sp-5) 0 var(--sp-2); }
dialog textarea { font: inherit; padding: 8px 10px; width: 100%; }
/* Line grids in dialogs fit the dialog: fields fill their column instead of fixed widths. */
dialog td > :is(input, select):not([type=checkbox]):not([type=radio]) { width: 100%; min-width: 0; }
dialog td > input.money { min-width: 96px; }
dialog td:has(> select) { min-width: 180px; }
button.add-line { margin-top: var(--sp-2); padding-left: 8px; color: var(--accent-text); }
button.add-line:hover { color: var(--brand-800); background: var(--accent-soft); }
.foot-total { display: inline-flex; gap: 6px 10px; align-items: baseline; font-size: var(--text-md); color: var(--text-2); margin-right: var(--sp-2); }
.foot-total strong { color: var(--text); font-size: var(--text-lg); }
.foot-total.ok strong { color: var(--success); }
.foot-total.off strong { color: var(--warning-text); }
.dlg-foot > .foot-total:nth-child(2) { margin-left: auto; }
/* The total shows once, in the footer bar */
dialog:has(.foot-total:not([hidden])) .table-wrap > table > tfoot { display: none; }
/* Line grids: the account picker a third, the description the most room, the amount to the column's right edge */
dialog .table-wrap > table { table-layout: auto; }
dialog .table-wrap > table td:has(> select) { width: 32%; }
dialog .table-wrap > table td.num:has(> input.money), dialog .table-wrap > table th.num { width: 140px; }
dialog .table-wrap > table td.num > input.money { width: 100%; }
dialog .table-wrap > table td:has(> .rm-line), dialog .table-wrap > table :is(th, td):last-child:empty { width: 36px; padding-left: 0; padding-right: 4px; }
dialog .row + .table-wrap, dialog .row ~ .table-wrap, dialog .row + p + .table-wrap { margin-top: var(--sp-5) !important; }
button.rm-line { color: var(--text-3); }
button.rm-line:hover { color: var(--danger); background: var(--danger-bg); }
.export-btn { display: none !important; }
select.tabs-picker { display: none; }
dialog.panel.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: none; max-width: min(520px, 100vw); border-radius: 0;
  animation: drawer-in .22s var(--ease);
}
dialog.panel.drawer .dlg-head { border-radius: 0; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Menus (pop-up lists: "more actions", + New, the person menu) ───────── */
.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: calc(100vw - 16px); max-height: calc(100vh - 80px); overflow: auto;
  padding: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); animation: menu-in .12s var(--ease);
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: var(--r-sm); background: none; box-shadow: none; color: var(--text);
  font: 500 var(--text-md)/20px var(--font-sans); text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible, .menu-item.on { background: var(--gray-100); color: var(--text); outline: none; }
.menu-item svg { color: var(--text-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); color: var(--danger-text); }
.menu-item .menu-sub { margin-left: auto; color: var(--text-3); font-size: var(--text-xs); font-weight: 500; }
.menu-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-note { padding: 6px 10px 8px; font-size: var(--text-sm); color: var(--text-2); white-space: normal; }

/* The + New menu: QuickBooks-style columns */
.menu.new-menu { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(170px, 1fr)); gap: 4px 8px; padding: 10px; }
.new-menu .new-col { display: grid; align-content: start; gap: 1px; }

/* ════════════════════════════════════════════════════════════════════════════
   App shell: left menu, top bar, page area
   ════════════════════════════════════════════════════════════════════════════ */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.workspace { display: flex; flex-direction: column; min-width: 0; }
main { padding: var(--sp-6) var(--sp-8) 72px; max-width: var(--content-max); width: 100%; min-width: 0; }

/* ── Left menu ── */
.nav {
  --nav-bg: var(--brand-950);
  --nav-text: #c9dbd4;
  --nav-dim: #8fada3;
  --nav-hover: rgba(255, 255, 255, .07);
  --nav-line: rgba(255, 255, 255, .09);
  background: var(--nav-bg); color: var(--nav-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.nav-top { padding: 14px 14px 10px; display: grid; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px; color: #fff; text-decoration: none; font: 700 18px/1 var(--font-sans); letter-spacing: -.01em; }
.nav a.brand { min-height: 0; padding: 2px 4px; font-size: 17px; font-weight: 700; }
.nav a.brand:hover { color: #fff; background: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(140deg, var(--brand-400), var(--brand-600)); color: #fff; font-size: 15px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }

/* The business switcher: a card that is a native <select id="biz"> underneath. */
.biz-switch {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-md); background: rgba(255, 255, 255, .06); border: 1px solid var(--nav-line);
  transition: background-color .12s, border-color .12s;
}
.biz-switch.can-switch:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); }
.biz-switch:focus-within { border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(128, 186, 159, .25); }
.biz-avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: #fff; color: var(--brand-800); font-weight: 700; font-size: 13px; overflow: hidden; }
.biz-avatar { position: relative; }
.biz-avatar img { opacity: 0; transition: opacity .15s; }
.biz-avatar.has-logo img { opacity: 1; }
.biz-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; background: #fff; }
.biz-text { min-width: 0; flex: 1; display: grid; line-height: 1.25; }
.biz-name { color: #fff; font-weight: 600; font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-role { color: var(--nav-dim); font-size: var(--text-xs); }
.biz-switch > svg { color: var(--nav-dim); flex: none; }
.biz-switch:has(> .biz-btn) { padding: 0; }
button.biz-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; padding: 8px 10px; border: 0; border-radius: var(--r-md);
  background: none; box-shadow: none; color: inherit; font-weight: 400; text-align: left;
}
button.biz-btn:hover { background: none; color: inherit; }
button.biz-btn > svg { color: var(--nav-dim); flex: none; }
/* Kept for scripts: a 1px select under the card, never in the way */
.biz-switch select.biz-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.menu.biz-menu { min-width: 260px; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--nav-text); text-decoration: none; font-weight: 500; font-size: var(--text-md); line-height: 20px;
}
.nav a:hover { background: var(--nav-hover); color: #fff; }
.nav a[aria-current='page'] { background: rgba(128, 186, 159, .16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-300); }
.nav-ico { flex: none; width: 18px; height: 18px; color: var(--nav-dim); }
.nav a:hover .nav-ico, .nav a[aria-current='page'] .nav-ico { color: var(--brand-200); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item { position: relative; }
.nav-star { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; min-height: 0; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--r-xs); background: none; box-shadow: none; color: var(--nav-dim); align-items: center; justify-content: center; }
.nav-item:hover .nav-star, .nav-star:focus-visible { display: inline-flex; }
.nav-star:hover { background: var(--nav-hover); color: #fff; }
.nav-star.on svg { fill: currentColor; }
.nav-pin .nav-star.on { display: inline-flex; color: var(--brand-300); opacity: .55; }
.nav-pin:hover .nav-star.on, .nav-pin a[aria-current='page'] + .nav-star.on { opacity: 1; }
.nav-pin a { padding-right: 34px; }
.nav-item:hover:has(.nav-star) .nav-count { visibility: hidden; }
@media (hover: none) { .nav-star { display: none !important; } }
.menu-title, .menu-cancel { display: none; }
.new-menu .menu-title, .new-menu .menu-cancel { grid-column: 1 / -1; }
.biz-item { min-height: 44px; }
.biz-item .chip-avatar { background: var(--gray-100); color: var(--gray-700); }
.biz-item.current .chip-avatar { background: var(--brand-700); color: #fff; }
.biz-item-text { display: grid; line-height: 1.25; min-width: 0; }
.biz-item-text .menu-sub { margin: 0; }
.biz-item > svg:last-child { margin-left: auto; color: var(--accent); }
.menu-hint { grid-column: 1 / -1; padding: 8px 10px 2px; margin-top: 4px; border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--text-3); }
.menu-hint kbd { margin: 0 1px; }
.menu .menu-item:hover { background: none; }
.menu .menu-item:focus { background: var(--brand-50); color: var(--accent-text); outline: none; box-shadow: inset 2px 0 0 var(--accent); }
.menu .menu-item:focus svg { color: var(--accent); }
.nav-item.nav-apart { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--nav-line); }

/* Groups fold open and shut */
.nav .nav-block { margin-top: 1px; }
.nav button.nav-section {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px;
  background: none; border: 0; border-radius: var(--r-sm); box-shadow: none; cursor: pointer;
  font: 500 var(--text-md)/20px var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--nav-text); text-align: left;
}
.nav button.nav-section:hover { color: #fff; background: var(--nav-hover); }
.nav button.nav-section .nav-ico { color: var(--nav-dim); }
.nav button.nav-section.has-current { color: #fff; }
.nav button.nav-section.has-current .nav-ico { color: var(--brand-200); }
.nav button.nav-section .chev { margin-left: auto; color: var(--nav-dim); transition: transform .15s var(--ease); }
.nav button.nav-section[aria-expanded='true'] .chev { transform: rotate(90deg); }
.nav .nav-group { display: grid; gap: 1px; margin: 1px 0 4px 19px; padding: 0 0 0 8px; list-style: none; border-left: 1px solid var(--nav-line); }
.nav .nav-group[hidden] { display: none; }
.nav .nav-group a { min-height: 30px; padding: 5px 10px; font-size: var(--text-md); }
.nav .nav-group a[aria-current='page'] { box-shadow: none; }
.nav .nav-head { margin: 14px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-dim); }
.nav-scroll { position: relative; }
.nav .soon { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; border-radius: var(--r-full); background: rgba(255, 255, 255, .1); color: var(--nav-text); line-height: 16px; }
.nav-count { margin-left: auto; background: var(--brand-400); color: #fff; border-radius: var(--r-full); min-width: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.nav a[aria-current='page'] .nav-count { background: var(--brand-300); color: var(--brand-950); }

/* The person, at the foot of the menu */
.nav-foot { padding: 8px 10px 12px; border-top: 1px solid var(--nav-line); }
button.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; padding: 8px; border: 0; border-radius: var(--r-md);
  background: none; box-shadow: none; color: var(--nav-text); text-align: left; font-weight: 400;
}
button.user-btn:hover { background: var(--nav-hover); color: #fff; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-300); color: var(--brand-950); font: 700 12px/1 var(--font-sans); letter-spacing: .02em; }
.user-text { min-width: 0; flex: 1; display: grid; line-height: 1.25; }
.user-name { color: #fff; font-weight: 600; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mail { color: var(--nav-dim); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.user-btn > svg { color: var(--nav-dim); }
.menu .menu-who { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; }
.menu .menu-who .user-name { color: var(--text); }
.menu .menu-who .user-mail { color: var(--text-2); font-size: var(--text-sm); }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-8);
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .search { position: relative; flex: 1; max-width: 560px; }
.topbar .search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; min-height: 38px; padding: 8px 54px 8px 36px; border-radius: var(--r-md);
  background: var(--gray-50); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.search-input:hover { background: var(--surface); border-color: var(--gray-300); }
.search-input:focus { background: var(--surface); }
.search-input::placeholder { color: var(--text-3); }
.topbar .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.topbar .search:focus-within kbd { display: none; }
.topbar-title { display: none; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.topbar .icon-btn { color: var(--text-2); }
button.nav-toggle { display: none; }
button.new-btn { padding-left: 12px; border-radius: var(--r-full); }
.scrim { display: none; }

/* Search drop-down (from the top bar) */
.search-drop { position: fixed; z-index: 85; width: 480px; max-width: calc(100vw - 16px); max-height: 70vh; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6px; }
.search-head { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 10px 10px 4px; }
.search-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; }
.search-item .sub { font-size: var(--text-sm); margin: 0; }
.search-item .num { color: var(--text-2); }
.search-item:hover, .search-item.on { background: var(--brand-50); }
.search-pad { padding: 6px 10px; }
.search-more { display: block; padding: 10px 10px 6px; border-top: 1px solid var(--line); margin-top: 6px; font-weight: 600; text-decoration: none; }
.search-form .row { align-items: end; }

/* Top bar: compact business switcher, bell, gear */
.biz-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 4px 10px 4px 4px; border-radius: var(--r-full); color: var(--text); font-weight: 600; font-size: var(--text-md); }
button.biz-chip { min-height: 38px; }
.biz-chip svg { color: var(--text-3); flex: none; }
.chip-avatar { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--brand-700); color: #fff; font-size: 11px; font-weight: 700; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.bell { position: relative; color: var(--text-2); }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.menu.bell-menu { width: min(400px, calc(100vw - 16px)); white-space: normal; }
.bell-menu .dash-list { margin: 0; }
.bell-menu .dash-row { padding: 8px 10px; border-radius: var(--r-sm); border-top: 0; color: var(--text); text-decoration: none; }
.bell-menu .dash-row + .dash-row { box-shadow: 0 -1px 0 var(--line); }
.bell-menu a.dash-row:hover { background: var(--gray-100); }
.topbar .icon-btn, .topbar .bell { color: var(--text-2); }
.bell-count { background: var(--warning); }
.bell-count.alert { background: var(--danger); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.topbar-me { display: none !important; }
@media (min-width: 961px) { .biz-chip { display: none !important; } }
/* The + New menu sits on its own layer under the button */
.menu.new-menu { box-shadow: var(--shadow-xl); border-color: var(--gray-200); }
/* Page actions: on a computer every button shows and More is hidden */
.more-btn { display: none !important; }
.page-head .info-btn { display: none !important; vertical-align: 4px; margin-left: 6px; color: var(--text-3); }
.page-head.show-sub .info-btn { color: var(--accent); }

/* Fields: a type-to-pick list (datalist) gets the same arrow as a select */
input[list] {
  padding-right: 32px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f5b57' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 16px;
}
input[list]::-webkit-calendar-picker-indicator { opacity: 0; cursor: pointer; }

/* Actions at the foot of a card get room above them */
.panel > button, .panel > .btn, .panel > p:has(> button:only-child), .panel > dl + button,
.panel form > :is(button, .btn):not(:first-child), .panel label.field + :is(button, .btn) { margin-top: var(--sp-3); }
/* Wide tables show a soft edge where there's more to scroll */
.table-wrap {
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(16,32,26,.14), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(16,32,26,.14), transparent) right center / 12px 100% no-repeat scroll,
    var(--surface);
}
.table-wrap > table { background: transparent; }

/* First paint, before the app has loaded */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-mark { width: 40px; height: 40px; border-radius: 10px; font-size: 20px; animation: boot 1.2s ease-in-out infinite alternate; }
@keyframes boot { from { opacity: .45; } to { opacity: 1; } }

/* ── Phones and small tablets ── */
/* Phones: list tables become compact two-line rows (name and amount, then a grey line of the rest), like the
   QuickBooks and Xero phone apps. app.js marks each cell data-m="title|amount|sub|act|pick|hide|full" and adds td.m-sub. */
td.m-sub, td.m-status, td.m-flag { display: none; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot { display: block; width: 100%; min-width: 0 !important; }
  table.stack tr {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title amount" "sub status" "flag flag" "act act"; column-gap: 12px; row-gap: 2px; align-items: center;
    min-height: 62px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  }
  table.stack.has-pick tr { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "pick title amount" "pick sub status" "pick flag flag" "pick act act"; }
  table.stack td.m-flag { grid-area: flag; display: block; font-size: var(--text-sm); font-weight: 600; }
  table.stack td.m-flag:empty { display: none; }
  table.stack td.m-status { grid-area: status; align-self: start; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; white-space: nowrap; padding-top: 1px; }
  table.stack td.m-status .m-date { font-size: var(--text-sm); color: var(--text-2); }
  table.stack td.m-status:empty { display: none; }
  table.stack td.m-status .pill { margin: 0 !important; }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { padding: 0; border: 0; background: none !important; min-width: 0; }
  /* The name may take two lines; a note under it (a memo) is grey; badges stay badges */
  table.stack td[data-m='title'] { grid-area: title; font-weight: 600; text-align: left; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.35; }
  table.stack td[data-m='title'] > div { display: inline; }
  table.stack td[data-m='title'] > div + div, table.stack td[data-m='title'] > .sub { margin-left: 6px; font-weight: 400; color: var(--text-2); font-size: var(--text-sm); }
  table.stack td[data-m='title'] .tag, table.stack td[data-m='title'] .pill { margin-left: 6px; vertical-align: 1px; }
  table.stack td[data-m='title'] .branch-mark { display: none; }
  table.stack td[data-m='amount'] { grid-area: amount; align-self: start; text-align: right; font-weight: 600; white-space: nowrap; }
  table.stack td[data-m='amount'][data-sign='in'] { color: var(--money-in); }
  table.stack td[data-m='amount'][data-sign='in']::before { content: '+'; }
  table.stack td[data-m='amount'][data-sign='out']::before { content: '−'; }
  table.stack td.m-sub { grid-area: sub; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--text-2); font-size: var(--text-sm); line-height: 1.4; white-space: normal; }
  table.stack td.m-sub .pill, table.stack td.m-sub .tag { margin: 0; vertical-align: 1px; }
  table.stack td.m-sub .m-dot { color: var(--text-3); }
  /* Group and subtotal rows are section headers, not items */
  table.stack tr[data-mgroup] { min-height: 0; padding: 8px 14px; background: var(--gray-50); grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title amount"; }
  table.stack tr[data-mgroup] td[data-m='title'] { font-size: var(--text-sm); color: var(--text-2); -webkit-line-clamp: 1; }
  table.stack tr[data-mgroup] td[data-m='title'] > :is(strong, b) { color: var(--text); }
  table.stack tr[data-mgroup] td[data-m='amount'] { font-size: var(--text-sm); }
  table.stack td.m-sub:empty { display: none; }
  table.stack td:is([data-m='sub'], [data-m='hide']) { display: none; }
  table.stack td[data-m='act'] { grid-area: act; width: auto; text-align: left; padding-top: 6px; position: relative; z-index: 1; }
  table.stack td[data-m='act'] > div { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
  table.stack td[data-m='pick'] { grid-area: pick; position: relative; z-index: 1; padding-right: 2px; }
  table.stack td[data-m='full'] { grid-column: 1 / -1; }
  /* Tapping a row follows its main link */
  table.stack td[data-m='title'] a:first-of-type::after { content: ''; position: absolute; inset: 0; }
  table.stack tfoot tr { background: var(--gray-25); min-height: 48px; grid-template-areas: "title amount"; grid-template-columns: minmax(0, 1fr) auto; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; z-index: 70;
    transform: translateX(-102%); transition: transform .22s var(--ease), box-shadow .22s;
  }
  .shell.nav-open .nav { transform: none; box-shadow: var(--shadow-xl); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(14, 26, 22, .45); }
  button.nav-toggle { display: inline-flex; }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .topbar .search kbd { display: none; }
  .search-input { padding-right: 10px; }
  main { padding: var(--sp-5) var(--sp-4) 56px; }
}
@media (max-width: 560px) {
  :root { --topbar-h: 56px; }
  button.new-btn .new-word { display: none; }
  button.new-btn { width: 38px; padding: 0; }
  h1 { font-size: var(--text-2xl); }
  .page-head { margin-bottom: var(--sp-5); align-items: flex-start; }
  .page-head .toolbar { width: 100%; }
  .panel { padding: var(--sp-4); }
  dialog.panel { padding: var(--sp-5); }
  .dlg-head { margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) var(--sp-4); padding: var(--sp-3) var(--sp-5); top: calc(var(--sp-5) * -1); }
  dialog .dlg-foot { margin: var(--sp-5) calc(var(--sp-5) * -1) calc(var(--sp-5) * -1); padding: var(--sp-3) var(--sp-5); bottom: calc(var(--sp-5) * -1); }
  .menu.new-menu { grid-template-columns: 1fr; }
  dialog.panel, dialog.panel.wide {
    margin: auto 0 0; width: 100%; max-width: 100%; max-height: 96dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
    animation: sheet-in .22s var(--ease);
  }
  dialog .dlg-foot { padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); border-radius: 0; }
  dialog select, dialog label.field > :is(input, select, textarea) { width: 100%; max-width: none !important; }
  .report-tabs { display: none !important; }
  select.tabs-picker { display: block; width: 100%; margin-bottom: var(--sp-4); font-weight: 600; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats:has(> .stat:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 10px 12px; }
  .stat .stat-value { font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat .stat-label { font-size: 11px; }
  .menu-title, .menu-cancel { display: none; }
.new-menu .menu-title, .new-menu .menu-cancel { grid-column: 1 / -1; }
.biz-item { min-height: 44px; }
.biz-item .chip-avatar { background: var(--gray-100); color: var(--gray-700); }
.biz-item.current .chip-avatar { background: var(--brand-700); color: #fff; }
.biz-item-text { display: grid; line-height: 1.25; min-width: 0; }
.biz-item-text .menu-sub { margin: 0; }
.biz-item > svg:last-child { margin-left: auto; color: var(--accent); }
.menu-hint { display: none; }
  .topbar-gear, .topbar-help { display: none !important; }
  .biz-chip .chip-name, .biz-chip > svg { display: none; }
  .biz-chip { padding: 4px; }
  /* Page actions: the main one shows; the rest go in More */
  .page-head .toolbar > .ov { display: none !important; }
  .page-head .toolbar > .more-btn { display: inline-flex !important; }
  .topbar-me { display: inline-flex !important; }
  /* Record pages: leave out empty fields; the rest two to a line */
  main .details dl { grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .details dl > div.blank { display: none; }
  .details dd { overflow-wrap: break-word; }
  .details > .page-head { flex-wrap: nowrap; align-items: center; }
  .details > .page-head .toolbar { width: auto; }
  /* List rows: name and meta at the top, whatever the right column holds */
  table.stack tr { align-items: start; align-content: start; }
  /* Forms: every field full width; dates pair up two to a line */
  .row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); align-items: end; }
  .row > * { grid-column: 1 / -1; min-width: 0 !important; width: 100%; }
  .row > label.field:has(> input[type=date]), .row > label.field:has(> input.money), .row > label.field:has(> input.qty) { grid-column: auto; }
  .row > label.field > :is(input, select, textarea) { width: 100%; }
  .row > :is(button, .btn) { width: auto; justify-self: start; }
  /* Report toolbars: Run is the main button, the outputs are one Export menu */
  main .toolbar > .ov-export { display: none !important; }
  main .toolbar > .export-btn { display: inline-flex !important; }
  main .toolbar > button.run-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
  main .toolbar:not(.page-head .toolbar) > .row { grid-column: 1 / -1; }
  /* Report tabs: one strip that scrolls sideways */
  .report-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 4px 14px; padding-bottom: 8px; scrollbar-width: none; margin-left: calc(var(--sp-4) * -1); margin-right: calc(var(--sp-4) * -1); padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .report-tabs::-webkit-scrollbar { display: none; }
  .report-tabs .tab-group { flex-wrap: nowrap; flex: none; }
  .report-tabs a { white-space: nowrap; }
  /* Menus open as a sheet from the bottom, over a dimmed page */
  .menu {
    left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; max-width: none; max-height: 80vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 0 0 100vmax rgba(14, 26, 22, .45), var(--shadow-xl); animation: sheet-in .2s var(--ease);
  }
  .menu::before { content: ''; display: block; width: 36px; height: 4px; margin: 2px auto 8px; border-radius: 2px; background: var(--gray-200); }
  .menu-item { min-height: 44px; }
  .menu-title { display: block; padding: 2px 10px 10px; font-weight: 700; font-size: var(--text-lg); color: var(--text); }
  .menu-cancel { display: flex; justify-content: center; width: 100%; min-height: 44px; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 600; box-shadow: none; }
  .menu-cancel:hover { background: var(--gray-50); color: var(--text); }
  .bell-menu .menu-head:first-of-type { display: none; }
  /* Search opens across the top bar when tapped */
  .topbar .search:focus-within { position: absolute; left: 8px; right: 8px; max-width: none; z-index: 5; }
  /* Filter rows (dates, pickers, search) become a tidy two-column grid */
  main .toolbar:not(.page-head .toolbar):has(> :is(input, select)) { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  main .toolbar:not(.page-head .toolbar):has(> :is(input, select)) > * { width: 100%; min-width: 0; }
  main .toolbar:not(.page-head .toolbar):has(> :is(input, select)) > .grow { display: none; }
  main .toolbar:not(.page-head .toolbar) > .row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  main .toolbar:not(.page-head .toolbar) > .row > * { width: 100%; min-width: 0; }
  /* Dialog line grids: each line is a card, label over field; the total sits in the footer bar */
  dialog .table-wrap { overflow: visible; border: 0; box-shadow: none; background: none; }
  dialog .table-wrap > table, dialog .table-wrap > table > :is(tbody, tfoot), dialog .table-wrap > table tr { display: block; width: 100%; min-width: 0 !important; background: none; }
  dialog .table-wrap > table > thead { display: none; }
  dialog .table-wrap > table > tbody > tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  dialog .table-wrap > table > tbody > tr > td { display: block; padding: 0; border: 0; text-align: left; background: none !important; }
  dialog .table-wrap > table > tbody > tr > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--text-sm); font-weight: 600; color: var(--gray-700); }
  dialog .table-wrap > table > tbody > tr > td:first-child { grid-column: 1 / -1; }
  dialog .table-wrap > table > tbody > tr > td:empty { display: none; }
  dialog .table-wrap > table > tbody > tr > td:last-child:has(> button.rm-line) { position: absolute; top: 6px; right: 6px; }
  dialog .table-wrap > table > tbody > tr:has(button.rm-line) > td:first-child { padding-right: 32px; }
  dialog .table-wrap > table input.money { width: 100%; }
  dialog .table-wrap > table > tbody > tr > td { width: auto !important; min-width: 0 !important; }
  dialog .table-wrap > table > tbody > tr > td:has(> input:not(.money):not([type=checkbox])) { grid-column: 1 / -1; }
  dialog .table-wrap > table > tfoot { display: none; }
  dialog .foot-total { display: flex; flex-basis: 100%; order: -1; justify-content: flex-end; margin: 0 0 4px; }
.reg-sum { display: flex; flex-wrap: wrap; gap: 6px; }
  .reg-sum > span { padding: 4px 10px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line); font-size: var(--text-sm); }
  .reg-sum > span:empty { display: none; }
  .reg-sum > span.sub { background: none; border: 0; padding-left: 0; }
  /* Long help sentences under a title wait behind the "i" button */
  .page-head .sub { display: none; }
  .page-head.show-sub .sub { display: block; }
  .page-head .info-btn { display: inline-flex !important; }
  main .toolbar.toolbar:has(> input[type=date] + span + input[type=date]) { grid-template-columns: 1fr auto 1fr auto; align-items: center; }
  main .toolbar.toolbar:has(> input[type=date] + span + input[type=date]) > * { width: auto; }
  main .toolbar.toolbar:has(> input[type=date] + span + input[type=date]) > input { width: 100%; padding-left: 6px; padding-right: 4px; font-size: var(--text-sm); }
  .tiles > div { min-width: 0; flex: 1 1 140px; }
  /* Wide tables scroll sideways inside their frame instead of squeezing every word onto its own line. */
  .table-wrap > table:not(.stack):has(tr > :nth-child(4)) { min-width: 720px; }
  .table-wrap > table:not(.stack):has(tr > :nth-child(4)) :is(th, td.num, td:first-child) { white-space: nowrap; }
  th, td { padding: 9px 10px; }
  .balance-strip .verdict { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  body { background: #fff; }
  .nav, .topbar, .scrim, .page-head, .no-print, .toolbar, .search-drop, .menu, .toast, .notice.flash { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .table-wrap, .panel { box-shadow: none; }
  .sheet { border: none; margin: 0; padding: 0.4in 0.5in; break-after: page; }
  .sheet:last-child { break-after: auto; }
}

/* ── Combo box: type to search, pick from a list (combo() in app.js) ──── */
.combo { position: relative; display: block; min-width: 0; }
.combo > input.combo-input { width: 100%; padding-right: 30px; }
.combo-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; display: flex; }
.combo-list { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(520px, 92vw); max-height: 300px; overflow: auto;
  margin: 0; padding: var(--sp-1); list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.combo-opt { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--sp-4); padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--text-md); line-height: 1.3; }
.combo-opt.on, .combo-opt:hover { background: var(--accent-soft); }
.combo-opt.on { box-shadow: inset 2px 0 0 var(--accent); }
.combo-hint { color: var(--text-2); font-size: var(--text-sm); font-variant-numeric: tabular-nums; text-align: right; }
.combo-sub { grid-column: 1 / -1; color: var(--text-3); font-size: var(--text-xs); }
.combo-new .combo-label { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 600; }
.btn-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--warning); vertical-align: 2px; }
.inline-check { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-weight: 600; }
.combo-none { padding: 8px 10px; color: var(--text-3); font-size: var(--text-sm); }

/* ── Steps: where a record is in its life (ordered → packed → shipped → paid) ── */
.steps { display: flex; gap: 0; margin: 0 0 var(--sp-5); padding: var(--sp-4) var(--sp-5); list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.step { flex: 1; display: grid; gap: var(--sp-2); align-content: start; position: relative; min-width: 0; padding-right: var(--sp-4); }
.step:not(:last-child)::after { content: ''; position: absolute; left: 34px; right: 8px; top: 13px; height: 2px; background: var(--line); border-radius: 2px; }
.step.done:not(:last-child)::after { background: var(--brand-300); }
.step-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700; color: var(--text-3); background: var(--surface); border: 2px solid var(--line-strong); position: relative; z-index: 1; }
.step.done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.now .step-dot, .step[aria-current='step']:not(.done) .step-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-text { display: grid; gap: 1px; min-width: 0; font-size: var(--text-sm); }
.step-text strong { font-size: var(--text-md); }
.step-note { color: var(--text-2); font-size: var(--text-sm); line-height: 1.35; }
.steps.void { opacity: .6; }
.warn-text { color: var(--warning-text); }

/* ── Form bar: a long form's actions, stuck to the bottom of the screen ── */
.form-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-5) calc(-1 * var(--sp-2)) 0; padding: var(--sp-3) var(--sp-4);
  background: var(--gray-900); color: #fff; border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -6px 20px rgba(14, 42, 35, .18); }
.form-bar-left, .form-bar-right { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.form-bar-right { margin-left: auto; }
.form-bar-total { display: flex; align-items: baseline; gap: var(--sp-2); margin-left: var(--sp-4); font-variant-numeric: tabular-nums; }
.form-bar-total span { color: var(--gray-300); font-size: var(--text-sm); }
.form-bar-total strong { font-size: var(--text-xl); }
.form-bar :is(.btn.ghost, button.ghost) { color: var(--gray-100); }
.form-bar :is(.btn.ghost, button.ghost):hover { background: rgba(255, 255, 255, .1); color: #fff; }
.form-bar :is(button.quiet, .btn.quiet) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.form-bar :is(button.quiet, .btn.quiet):hover { background: rgba(255, 255, 255, .1); border-color: #fff; }
.form-bar button[type=submit] { background: var(--brand-500); border-color: var(--brand-500); }
.form-bar button[type=submit]:hover { background: var(--brand-400); }
.form-bar .danger-text { color: #ffb4a8; }

/* ════════════════════════════════════════════════════════════════════════════
   Page styles (each screen's own pieces, built on the system above)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Attention list on Today ─────────────────────────────────── */
.attention { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.attention a { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.attention a:last-child { border-bottom: none; }
.attention a:hover { background: #f6f9f8; }
.attention strong { font-size: 16px; }
.attention .amt { font: 600 19px/1 var(--font-sans); align-self: center; grid-row: span 2; }
.attention span { color: var(--muted); font-size: 14px; }

/* ── The balance strip (Receive payment) ─────────────────────── */
.balance-strip {
  position: sticky; bottom: 0; margin-top: 18px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 20px; border-radius: var(--radius); border: 2px solid var(--brick); background: var(--brick-bg);
  transition: background-color .25s, border-color .25s;
}
.balance-strip .verdict { font: 700 24px/1 var(--font-sans); color: var(--brick); min-width: 220px; }
.balance-strip .math { display: flex; gap: 22px; color: var(--ink); font-size: 14px; }
.balance-strip .math b { display: block; font-size: 17px; }
.balance-strip.ok { border-color: var(--moss); background: var(--moss-bg); }
.balance-strip.ok .verdict { color: var(--moss); }
.balance-strip.over { border-color: var(--amber); background: var(--amber-bg); }
.balance-strip.over .verdict { color: #7a5410; }
.balance-strip button { margin-left: auto; }
/* Round 29: before anything is typed or ticked the strip is neutral, not an error. It turns red only once there's
   something on the page that doesn't add up (a ticked line with too little to cover it). Pure CSS so every screen
   that uses the strip gets it: nothing ticked and no .ok/.over state = untouched. .balance-strip.off forces red. */
:where(main, dialog):not(:has(tbody input[type=checkbox]:checked)) .balance-strip:not(.ok, .over, .off) { border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
:where(main, dialog):not(:has(tbody input[type=checkbox]:checked)) .balance-strip:not(.ok, .over, .off) .verdict { color: var(--text-2); font-size: var(--text-xl); }


/* ── Print views ─────────────────────────────────────────────── */
.print-only { display: none; }
.sheet { background: #fff; color: #000; padding: 36px 44px; max-width: 8.5in; margin: 0 auto 24px; border: 1px solid var(--line); }
.sheet header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.sheet .title { font: 700 24px/1 var(--font-sans); }
.sheet .copy { font-size: 12px; color: #444; margin-top: 4px; }
.sheet .logo { display: block; max-width: 220px; max-height: 100px; margin-bottom: 8px; }
.sheet .biz { font-weight: 700; }
.sheet .addr { font-size: 13px; color: #333; }
.sheet .thanks { margin-top: 36px; text-align: center; font: italic 700 16px/1.2 var(--font-sans); }
.logo-preview { width: 180px; height: 80px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 6px; background: #fff; }
.logo-preview img { max-width: 170px; max-height: 72px; }
.sheet table th { background: #fff; color: #000; border-bottom: 2px solid #000; }
.sheet .sig { margin-top: 48px; display: flex; gap: 40px; }
.sheet .sig div { flex: 1; border-top: 1px solid #000; padding-top: 6px; font-size: 13px; }


.qbo-step { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.qbo-step h3 { font: 600 14px/1.2 var(--font-sans); margin: 0 0 4px; }

/* Customers and price list */
.branch { padding-left: 14px; }
td.branch { padding-left: 34px; }
.branch-mark { color: var(--muted); margin: 0 6px 0 -18px; display: inline-block; width: 12px; }
tr.branch-row td { border-top-color: transparent; }
.price-grid input.money { width: 6.5em; }
.price-grid tr.group th { text-align: left; background: transparent; padding-top: 16px; }

/* Banking, reconcile, chart of accounts */
table.split select { max-width: 320px; }
table.split input:not(.money) { width: 100%; }
button.link.left { text-align: left; padding: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.thumbs figure { margin: 0; width: 220px; }
.thumbs img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.thumbs figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; word-break: break-all; }

.acct-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-tabs a { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); min-width: 170px; }
.acct-tabs a span { font-size: 13px; color: var(--muted); }
.acct-tabs a.on { border-color: var(--spruce); box-shadow: inset 0 -3px 0 var(--spruce); }
.reg-sum { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 10px; }
table.register td { vertical-align: top; }

/* ── Reconcile ─────────────────────────────────────────────────
   .rec-sum      the statement summary (sticky under the top bar): ending − cleared = difference, and Finish now
   .rec-filters  Payments / Deposits / All tabs, cleared filter, search
   table.rec     the books' transactions; tr.ticked, tr.cursor (keyboard), .rec-how (why it matched)
   .rec-report   the printable reconciliation report (.sheet); .rec-done = the "Reconciled" banner over it */
.rec-tiles > div { flex: 1 1 180px; }
.rec-tiles > div.warn strong { color: var(--warning); }
.rec-sum { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; align-items: stretch; gap: var(--sp-6); margin-bottom: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: var(--sp-4) var(--sp-6); }
.rec-sum { flex-wrap: wrap; }
.rec-sum-hint { flex-basis: 100%; margin: 0; padding-top: var(--sp-2); border-top: 1px solid var(--line); font-size: var(--text-sm); color: var(--info-text); display: flex; align-items: center; gap: 6px; }
.rec-hints h3 { font: 700 var(--text-sm)/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 0 0 var(--sp-2); }
.rec-hint { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-2) var(--sp-3); align-items: start; padding: var(--sp-3); margin-bottom: var(--sp-2);
  border: 1px solid var(--info-line); background: var(--info-bg); border-radius: var(--r-md); color: var(--info-text); }
.rec-hint p { margin: 0; color: var(--text); }
.rec-hint svg { margin-top: 2px; }
input.rec-bal { min-width: 150px; }
.combo { position: relative; flex: 1 1 220px; min-width: 200px; }
.combo > input { width: 100%; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow: auto; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: var(--sp-1); }
.combo-head { padding: 6px 10px 4px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.combo-opt { display: grid; gap: 1px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; }
.combo-opt.new { display: flex; align-items: center; gap: 6px; color: var(--accent-text); }
.combo-opt.on, .combo-opt:hover { background: var(--accent-soft); }
.combo-name { font-weight: 600; }
.combo-why { font-size: var(--text-xs); color: var(--text-2); }
select.auto-filled { box-shadow: 0 0 0 3px var(--success-line); transition: box-shadow .3s; }
dialog.rec-zoom-dlg { overflow: visible; }
dialog.rec-zoom-dlg .rec-step { display: grid; gap: var(--sp-3); }
dialog.rec-zoom-dlg img.rec-zoom { max-height: 44vh; }
.bl-noimg.big { padding: var(--sp-8); }
.rec-start-head p.sub { margin: 2px 0 0; }
.rec-main-cause { padding: var(--sp-4); border: 1px solid var(--info-line); background: var(--info-bg); border-radius: var(--r-md); margin-bottom: var(--sp-4); }
.rec-main-cause h3, .rec-hints h3 { font: 700 var(--text-sm)/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 0 0 var(--sp-2); }
.rec-main-cause p { margin: 0 0 var(--sp-2); font-size: var(--text-md); }
.rec-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rec-items li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 10px; background: var(--surface); border-radius: var(--r-sm); font-size: var(--text-sm); }
.rec-items strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-items .out { color: var(--money-out); } .rec-items .in { color: var(--money-in); }
.rec-hint.bad { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-text); }
.rec-adjust { margin-top: var(--sp-3); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.rec-adjust summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.rec-adjust[open] > * + * { margin-top: var(--sp-3); }
.bank-line.voided { border-color: var(--danger-line); box-shadow: inset 3px 0 0 var(--danger); }
.bl-flag { margin: 0; }
.bl-pre { margin: 0; font-size: var(--text-sm); color: var(--success-text); display: flex; gap: 6px; align-items: center; }
.bank-line .bl-head .bl-date, .bank-line .bl-head .num { white-space: nowrap; }
.rec-more { display: none; }
.pair-btn { padding: 0 4px; min-height: 0; border: 0; background: none; box-shadow: none; display: inline-flex; align-items: center; gap: 2px; color: var(--text-3); }
.pair-btn[aria-expanded='true'] svg { transform: rotate(180deg); }
table.rec tr.rec-pair td { background: var(--surface-2); padding-top: 6px; padding-bottom: 6px; cursor: default; }
.rec-pair-box { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--text-sm); padding-left: 34px; }
.rec-pair-box .num { margin-left: auto; }
.rec-rep-bank { margin-top: 2px; }
.rec-start-tabs { margin-bottom: var(--sp-3); }
.bank-review, .bank-line, table.rec tr { scroll-margin-top: calc(var(--topbar-h) + 200px); }
.rec-math { flex: 1; display: grid; gap: var(--sp-3); min-width: 0; }
.rec-top, .rec-bottom { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.rec-bottom { padding-top: var(--sp-3); border-top: 1px dashed var(--line-strong); }
.rec-fig { display: grid; gap: 1px; }
.rec-fig strong { font: 600 var(--text-lg)/1.2 var(--font-sans); font-variant-numeric: tabular-nums; }
.rec-fig.big strong { font: 700 var(--text-3xl)/1.1 var(--font-sans); letter-spacing: -.01em; }
.rec-fig span { font-size: var(--text-xs); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rec-op { font-size: var(--text-xl); color: var(--text-3); font-weight: 600; }
.rec-verdict { display: flex; align-items: center; gap: var(--sp-4); padding-left: var(--sp-6); border-left: 1px solid var(--line); min-width: 330px; }
.rec-verdict > div { display: grid; gap: 1px; }
.rec-verdict > div span { font-size: var(--text-xs); color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rec-verdict > div strong { font: 700 var(--text-3xl)/1.1 var(--font-sans); color: var(--warning-text); font-variant-numeric: tabular-nums; }
.rec-verdict button { margin-left: auto; }
.rec-v-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--warning-bg); color: var(--warning); font: 800 24px/1 var(--font-sans); border: 2px solid var(--warning-line); }
.rec-sum.ok { border-color: var(--success-line); background: linear-gradient(90deg, var(--surface) 55%, var(--success-bg)); }
.rec-sum.ok .rec-v-icon { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.rec-sum.ok .rec-verdict > div strong { color: var(--success-text); }
.rec-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.rec-sec-head h2 { margin: 0 0 2px; }
.rec-sec-head p { margin: 0; }
.kbd-hint { font-size: var(--text-xs); }
.kbd-hint kbd { margin: 0 1px; }
.rec-filters { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.rec-filters .segmented .count { margin-left: 6px; font-size: var(--text-xs); color: var(--text-3); font-weight: 600; }
.rec-filters .segmented .on .count { color: var(--accent-text); }
.rec-search { margin-left: auto; width: 260px; }
table.rec tbody tr { cursor: pointer; }
table.rec tbody tr:hover td { background: var(--surface-2); }
table.rec tr.ticked td { background: var(--success-bg); }
table.rec tr.ticked:hover td { background: #dcefe4; }
table.rec.stack tr.ticked, table.rec.stack tr.ticked td { background: var(--success-bg); }
table.rec tr.cursor td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
table.rec tr.cursor td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
table.rec td { padding-top: 7px; padding-bottom: 7px; }
table.rec tbody td:nth-child(2) { white-space: nowrap; }
table.rec tfoot td { font-weight: 600; color: var(--text-2); }
.rec-how { font-size: var(--text-xs); white-space: nowrap; cursor: help; }
.rec-bottom-bar { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); }
.rec-start-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.rec-start-head h2 { margin: 0; }
.rec-way > p.sub { margin-top: 0; }
.rec-foot { margin-top: var(--sp-3); }
td.rec-acts { white-space: nowrap; }
td.rec-acts .link { margin-right: var(--sp-3); }
.rec-done { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); margin-bottom: var(--sp-4); border-radius: var(--r-lg);
  background: var(--success-bg); border: 1px solid var(--success-line); color: var(--success-text); }
.rec-done h2 { margin: 0 0 2px; color: var(--success-text); }
.rec-done p { margin: 0; }
.rec-done .toolbar { margin-left: auto; }
.rec-done-icon { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--success); }
.rec-rep-bar { margin-bottom: var(--sp-3); }
.rec-rep-bar select { min-width: 240px; }
.sheet.rec-report { max-width: 9in; }
.rec-rep-head { display: grid !important; width: 100%; justify-items: center; gap: 4px; text-align: center; padding-bottom: var(--sp-4); border-bottom: 2px solid var(--text); }
.rec-rep-head .biz { font-size: var(--text-lg); }
.rec-rep-sec { margin-top: var(--sp-6); }
.rec-rep-sec h3 { font: 700 var(--text-md)/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 var(--sp-2); }
table.rec-rep-sum { max-width: 520px; }
table.rec-rep-sum tr.total td { font-weight: 700; border-top: 1px solid var(--text); }
table.rec-rep-sum tr.ok td { color: var(--success-text); font-weight: 700; }
table.rec-rep-sum tr.bad td { color: var(--danger-text); font-weight: 700; }
.rec-report tfoot td { font-weight: 700; }
.rec-report tbody td:first-child { white-space: nowrap; }
.bank-line .bl-img .img-btn { padding: 0; border: 0; background: none; box-shadow: none; min-height: 0; cursor: zoom-in; }
.bank-line.is-check { grid-template-columns: minmax(200px, 300px) 1fr; align-items: start; gap: var(--sp-4); }
.bank-line.is-check .thumbs { margin: 0; }
.bank-line.is-check .thumbs img { max-height: none; width: 100%; min-height: 120px; background: var(--surface-sunk); }
.bank-line.is-check .thumbs figure { width: 100%; }
.bank-line .bl-main { display: grid; gap: var(--sp-2); min-width: 0; }
.bank-line .bl-head .num.out { color: var(--money-out); }
.bank-line .bl-head .num.in { color: var(--money-in); }
.bl-noimg { display: grid; justify-items: center; gap: 6px; text-align: center; padding: var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--text-3); font-size: var(--text-sm); background: var(--surface-sunk); }
.bl-match .pill { align-self: center; }
.tick-all { display: inline-flex; gap: 6px; align-items: center; margin-bottom: var(--sp-2); }
.rec-done-list { margin-top: var(--sp-3); }
.rec-zoom-form { margin-top: var(--sp-4); }
.rec-zoom-form .row { align-items: end; }
img.rec-zoom { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
@media (max-width: 1100px) {
  .rec-sum { flex-direction: column; gap: var(--sp-3); }
  .rec-verdict { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: var(--sp-3); min-width: 0; }
}
@media (max-width: 640px) {
  .rec-sum { padding: var(--sp-2) var(--sp-4); position: sticky; top: var(--topbar-h); gap: var(--sp-2); }
  .rec-sum .rec-math { display: none; order: 2; }
  .rec-sum.open .rec-math { display: grid; }
  .rec-sum.open { position: static; }
  .rec-sum.open .rec-bottom { display: flex; }
  .rec-sum .rec-verdict { border-top: 0; padding-top: 0; gap: var(--sp-2); order: 1; }
  .rec-more { display: inline-flex; gap: 4px; align-items: center; }
  .rec-sum.open .rec-more svg { transform: rotate(180deg); }
  .rec-sum-hint { order: 3; }
  .rec-bottom .rec-fig { flex: 1 1 40%; }
  .rec-top { flex-wrap: nowrap; gap: var(--sp-3); }
  .rec-top .rec-fig { flex: 1; }
  .rec-op { display: none; }
  .rec-fig.big strong { font-size: var(--text-lg); }
  .rec-verdict > div strong { font-size: var(--text-xl); }
  .rec-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
  .rec-tiles > div { padding: var(--sp-2) var(--sp-3); }
  .rec-tiles span { font-size: 10px; }
  .rec-tiles strong { font-size: var(--text-lg); }
  .rec-fig strong { font-size: var(--text-md); }
  .rec-bottom { display: none; }
  .rec-v-icon { display: none; }
  .rec-search { margin-left: 0; width: 100%; }
  .rec-filters .segmented { flex: 1 1 auto; }
  .kbd-hint { display: none; }
  .bank-line.is-check { grid-template-columns: 1fr; }
  .rec-done { flex-wrap: wrap; }
  .rec-done .toolbar { margin-left: 0; }
  .sheet.rec-report { padding: var(--sp-4); }
}
@media print {
  .rec-rep-bar, .rec-done { display: none !important; }
  .sheet.rec-report { max-width: none; }
  .rec-report .table-wrap { border: 0; }
}

/* ── Banking (#/banking): account tiles, register tools, bank feed, rules ── */
.tabs > a .count { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: var(--r-full); background: var(--gray-100); color: var(--text-2); line-height: 18px; }
.tabs > a .count.warn { background: var(--warning-bg); color: var(--warning-text); }
.bank-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-5); }
.bank-tile { display: grid; gap: var(--sp-2); min-width: 0; align-content: start; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-xs); }
.bank-tile:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow-sm); }
.bank-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.bt-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.bt-name { font-weight: 600; font-size: var(--text-md); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-mask { color: var(--text-3); font-weight: 400; }
.bt-review { flex: none; }
.bt-figs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bt-fig { display: grid; gap: 1px; min-width: 0; }
.bt-fig + .bt-fig { padding-left: var(--sp-3); border-left: 1px solid var(--line); }
.bt-fig strong { font-size: var(--text-xl); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bt-fig span { font-size: var(--text-xs); color: var(--text-2); }
.bt-fig.muted strong { color: var(--text-3); }
.bt-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--sp-3); font-size: var(--text-xs); color: var(--text-2); }
.bt-diff { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.bt-diff.ok { color: var(--success-text); }
.bt-diff.off { color: var(--warning-text); }
.bank-subtabs { margin-bottom: var(--sp-4); }
.reg-toolbar { margin-bottom: var(--sp-3); }
.reg-toolbar .spacer { flex: 1; }
.reg-search { flex: 1 1 200px; max-width: 300px; }
.reg-toolbar .reg-dates input { width: 140px; }
table.register td:first-child, .bank-body td.date { white-space: nowrap; }
.reg-toolbar .icon-btn svg { margin: 0; }
.reg-dates { display: inline-flex; align-items: center; gap: var(--sp-2); }
.reg-toolbar button svg { margin-right: 6px; vertical-align: -3px; }
.filter-panel { margin: 0 0 var(--sp-3); padding: var(--sp-4); }
.amount-range { flex-wrap: nowrap; align-items: center; gap: var(--sp-2); }
.amount-range input { width: 100%; min-width: 0; }
.filter-chips { align-items: center; margin-bottom: var(--sp-3); }
.filter-chips .chip svg { margin-left: 2px; }
.rmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; }
.rmark.r { background: var(--success-bg); color: var(--success-text); }
.rmark.c { background: var(--info-bg); color: var(--info-text); }
.reg-legend { margin: var(--sp-2) 0 0; }
.reg-legend .rmark { width: 18px; height: 18px; font-size: 10px; }
table.register td.reg-r { text-align: center; }
table.register thead tr.quick-add td { background: var(--accent-soft); padding: 6px 6px; vertical-align: middle; border-bottom: 1px solid var(--brand-200); }
tr.quick-add input, tr.quick-add select { width: 100%; min-width: 0; min-height: 32px; font-size: var(--text-sm); }
tr.quick-add td:nth-child(1) input { min-width: 128px; }
tr.quick-add td:nth-child(4) select { max-width: 220px; }
tr.quick-add .qa-act { white-space: nowrap; }
tr.quick-add .qa-err { display: block; color: var(--danger-text); font-size: var(--text-xs); white-space: normal; max-width: 180px; }
.feed-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.feed-from { margin: 0; }
td.feed-act { white-space: nowrap; }
.feed-table .tag { margin-left: 6px; }
.feed-bankdesc { margin: 0 0 var(--sp-4); padding: var(--sp-3); background: var(--surface-sunk); border-radius: var(--r-md); }
.feed-pane { margin-top: var(--sp-4); }
.feed-pane > p:last-child { margin: var(--sp-4) 0 0; }
.feed-cands { display: grid; gap: var(--sp-2); }
.feed-cand { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.feed-cand:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.feed-cand .pill { margin-left: var(--sp-2); }
.rule-make { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--sp-3); }
.check-line { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0; font-weight: 500; }
.bt-why { font-size: var(--text-xs); color: var(--text-2); line-height: 1.4; }
.reg-more { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.reg-density > button { min-height: 28px; }
table.register.compact td { padding-top: 9px; padding-bottom: 9px; white-space: nowrap; }
table.register.compact td.reg-payee { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
table.register.compact td.reg-acct { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.register.compact .reg-memo { color: var(--text-3); }
.feed-what { display: grid; gap: 3px; justify-items: start; }
.feed-modes { flex-wrap: wrap; margin-bottom: var(--sp-1); }
.feed-modes .count { font-size: 11px; font-weight: 700; margin-left: 6px; padding: 0 6px; border-radius: var(--r-full); background: var(--success-bg); color: var(--success-text); }
.feed-cand { align-items: flex-start; }
.feed-cand input { margin-top: 3px; }
.fc-body { display: grid; gap: 2px; min-width: 0; }
.fc-top { display: flex; flex-wrap: wrap; gap: 4px var(--sp-2); align-items: center; }
.fc-meta { font-size: var(--text-sm); color: var(--text-2); }
.fc-why { font-size: var(--text-xs); color: var(--success-text); }
.fc-why.warn { color: var(--warning-text); }
.feed-cand.differs { opacity: .7; cursor: default; }
.feed-find { margin-top: var(--sp-4); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.feed-find summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
.feed-find .form-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.feed-hint { display: flex; gap: 6px; align-items: flex-start; color: var(--success-text); background: var(--success-bg); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-3); }
.feed-hint:empty { display: none; }
.feed-hint svg { flex: none; margin-top: 2px; }
.feed-rule, .rule-sec { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4) var(--sp-4); margin: var(--sp-4) 0 0; display: grid; gap: var(--sp-3); }
.feed-rule legend, .rule-sec legend { font-weight: 600; font-size: var(--text-sm); padding: 0 6px; }
.feed-rule .check-line { margin: 0; }
.rule-intro { margin: 0 0 var(--sp-2); }
.rule-cond { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.rule-cond .rule-lbl { width: 90px; font-weight: 600; font-size: var(--text-sm); }
.rule-cond > input:not(.money) { flex: 1 1 220px; }
.rule-cond > input.money { width: 120px; }
.rule-extra { display: grid; gap: var(--sp-2); }
.rule-extra:empty { display: none; }
.rule-splits { display: grid; gap: var(--sp-2); }
.rule-splits .rule-cond select:first-child { flex: 1 1 220px; }
.rule-cond > select + input.money { width: 120px; }
.field.full { grid-column: 1 / -1; }
.split-table th:nth-child(1) { width: 42%; } .split-table th:nth-child(2) { width: 22%; } .split-table th:nth-child(3) { width: 36%; }
.split-table input, .split-table select { width: 100%; }
.rule-preview { font-size: var(--text-sm); background: var(--surface-sunk); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); }
.rule-preview:empty { display: none; }
.rule-preview ul { margin: 4px 0 0; padding-left: 18px; }
.switch.m-switch { display: none; }
.switch.m-switch .small { margin-left: 6px; align-self: center; }
/* A small on/off switch around a checkbox (.switch > input + .switch-track). */
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-track { width: 34px; height: 20px; border-radius: var(--r-full); background: var(--gray-300); transition: background .15s; position: relative; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .bank-tiles { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--sp-2); margin: 0 calc(-1 * var(--sp-4)) var(--sp-4); padding: 0 var(--sp-4) 2px; }
  .bank-tile { flex: 0 0 82%; scroll-snap-align: start; }
  .bt-fig strong { font-size: var(--text-lg); }
  main .toolbar.reg-toolbar.reg-toolbar.reg-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  main .toolbar.reg-toolbar.reg-toolbar.reg-toolbar > button { width: auto; }
  .reg-toolbar .reg-search { grid-column: 1 / -1; max-width: none; }
  .reg-toolbar .reg-dates, .reg-toolbar .spacer, .reg-toolbar .reg-print { display: none; }
  .reg-toolbar select { width: 100%; }
  .bank-subtabs { flex-wrap: nowrap; overflow-x: auto; }
  .bank-subtabs > a { white-space: nowrap; }
  .switch.m-switch { display: inline-flex; margin-right: auto; }
  td.rule-act { display: flex !important; align-items: center; gap: var(--sp-3); }
  .reg-density { display: none !important; }
  table.stack.feed-table td.m-sub { display: block; overflow: visible; -webkit-line-clamp: unset; }
  table.stack.feed-table td.m-sub .m-part { white-space: normal; }
  .rule-cond .rule-lbl { width: 100%; }
}
@media print {
  .bank-tiles, .bank-subtabs, .reg-toolbar, .filter-panel, .filter-chips, tr.quick-add, .tabs { display: none !important; }
}



/* Statement upload and review */
.stmt-check { margin-top: 14px; border: 1px solid var(--line); border-left: 5px solid var(--brick); border-radius: var(--radius); padding: 12px 16px; background: var(--surface); }
.stmt-check.ok { border-left-color: var(--moss); }
.stmt-check ul { margin: 6px 0 12px; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.stmt-check li::before { display: inline-block; width: 1.4em; font-weight: 700; }
.stmt-check li.good::before { content: '✓'; color: var(--moss); }
.stmt-check li.bad::before { content: '✕'; color: var(--brick); }
.stmt-check li.bad { color: var(--brick); }
.stmt-check li.note::before { content: '·'; color: var(--muted); }
.stmt-check li.note { color: var(--muted); }
.bank-review { margin-bottom: 16px; }
.bank-lines { display: grid; gap: 10px; }
.bank-line { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; }
.bank-line .bl-head { display: flex; gap: 14px; align-items: baseline; }
.bank-line .bl-head .num { margin-left: auto; }
.bank-line select { max-width: 340px; }
.bank-line .thumbs img { max-height: 120px; width: auto; }

/* Customer ledger */
table.summary tr.on td { background: var(--moss-bg); }
table.summary tr.month td { font-size: 14px; }
.flag { color: var(--brick); font-weight: 600; }

.details dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; margin: 8px 0 0; }
.details dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.details dd { margin: 2px 0 0; }

@media print { button.back { display: none; } }

@media print { .sheet.skip-print { display: none !important; } }



/* Guided loan entries */
fieldset.choices { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
fieldset.choices legend { font-weight: 600; margin-bottom: 6px; }
label.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
label.choice:has(input:checked) { border-color: var(--spruce-2); background: var(--paper); }
label.choice input { margin-top: 3px; }
label.choice strong { display: block; font-weight: 600; color: var(--ink); }
label.choice { font-weight: 400; color: var(--ink); }
label.choice .sub { display: block; }
.preview { margin-top: 12px; padding: 10px 14px; background: var(--moss-bg); border-left: 3px solid var(--moss); border-radius: var(--radius-sm); }
.preview:empty { display: none; }
.preview h3 { margin: 0 0 4px; font-size: 14px; }
.preview ul { margin: 0; padding-left: 18px; }
.flag-text { color: var(--amber); }
p.tip { margin: 6px 0 0; }

td.nowrap { white-space: nowrap; }

/* Customer drill-down: transactions under their month */
table.summary tr.tx td { font-size: 14px; background: var(--surface); }
table.summary tr.tx td:first-child { padding-left: 44px; }
.tx-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.tx-links:empty { display: none; }
dl.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 12px; }
dl.facts dt { font-size: 12px; color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 600; }
details.acct-lines { margin-top: 14px; }
details.acct-lines summary { cursor: pointer; font-weight: 600; color: var(--muted); }

/* Reports */
table.gl tr.group th { text-align: left; background: #f3f6f5; padding-top: 14px; }
table.gl td { font-size: 14px; }
h2 .tag { vertical-align: middle; }

button.link.drill { color: inherit; text-decoration: none; font: inherit; padding: 0; }
button.link.drill:hover, button.link.drill:focus-visible { text-decoration: underline; color: var(--moss, #2f5d50); }


/* Menu sections and placeholders */

/* Report tabs, grouped */

/* Order status filter and pills */

/* Chart of accounts groups */
h2.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h2.group-head .fold { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
h2.group-head .caret { display: inline-block; width: 1em; color: var(--muted); }
h2.group-head .group-total { font: 500 14px/1 var(--font-sans); color: var(--muted); }
table.coa tr.type-row td { background: var(--surface-sunk); }
/* Chart of accounts: tick column, indented sub-accounts, the bank-balance flag; the new-account form. */
table.coa th.pick, table.coa td.pick { width: 36px; padding-right: 0; }
@media (min-width: 641px) {
  table.coa { table-layout: fixed; width: 100%; }
  table.coa col.c-pick { width: 40px; } table.coa col.c-no { width: 86px; } table.coa col.c-type { width: 170px; }
  table.coa col.c-detail { width: 160px; } table.coa col.c-bal { width: 148px; } table.coa col.c-act { width: 186px; }
  table.coa td { overflow-wrap: anywhere; }
}
.coa-incl { font-size: var(--text-xs); }
table.coa tr.coa-ctx td { opacity: .5; }
.tag.coa-role { cursor: help; }
/* Phone cards in two lines: name and amount, then the grey line with View and ⋯ on its right. */
@media (max-width: 640px) {
  table.stack.two-line tbody tr:not([data-mgroup]):has(> td.m-right) > td[data-m='act'] { display: block !important; float: right; clear: right; margin: 2px 0 0 10px; padding: 0; }
  table.stack.two-line tbody tr:has(> td.m-right) > td[data-m='act'] > div { flex-wrap: nowrap; gap: 4px; }
  table.stack.two-line td[data-m='act'] :is(.btn, button) { min-height: 30px; padding: 3px 10px; font-size: var(--text-sm); }
  table.stack.two-line td[data-m='act'] .kebab { padding: 3px 4px; }
  table.stack.two-line tbody tr:has(> td.m-right) > td.m-sub:not(:empty) { line-height: 30px; margin-top: 2px; }
  table.stack.two-line tbody tr::after { content: ''; display: block; clear: both; }
  table.stack.je-list td.m-right .pill.success { display: none; }
  table.stack.two-line .coa-incl, table.stack.two-line .coa-desc { display: none; }
}
table.coa td.nowrap, table.coa th:nth-child(2) { white-space: nowrap; }
table.coa tr.sub-acct td { background: var(--surface-2); }
.coa-name { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.coa-branch { color: var(--text-3); margin-right: -2px; }
.coa-desc { margin-top: 2px; }
.coa-off { color: var(--warning); margin-left: 4px; vertical-align: -2px; }
.coa-group + .coa-group { margin-top: var(--sp-5); }
h2.group-head .group-total strong { color: var(--text); font-weight: 600; }
.acct-form { display: grid; gap: var(--sp-4); }
.acct-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: end; }
.acct-grid .span2 { grid-column: span 2; }
.acct-grid .span3 { grid-column: 1 / -1; }
.acct-grid .span3:empty { display: none; }
.acct-grid input:not([type=checkbox]), .acct-grid select { width: 100%; }
.acct-grid label.check { display: inline-flex; align-items: center; gap: var(--sp-2); }
.acct-open { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin: 0; }
.acct-open legend { font-weight: 600; font-size: var(--text-sm); padding: 0 var(--sp-1); }
.acct-open .help { margin: var(--sp-2) 0 0; }
.acct-place { display: grid; gap: 2px; padding: var(--sp-3) var(--sp-4); background: var(--accent-soft); border: 1px solid var(--brand-100); border-radius: var(--r-md); }
.acct-place-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-text); }
@media (max-width: 640px) {
  .acct-grid { grid-template-columns: minmax(0, 1fr); }
  .acct-grid .span2 { grid-column: auto; }
}
button.link.sub { color: var(--muted); text-decoration: none; padding: 0; }
button.link.sub:hover { text-decoration: underline; color: var(--spruce); }

/* Incoming orders: the email beside the order it became */
.split:not(table) { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
@media (max-width: 1500px) { .split:not(table) { grid-template-columns: 1fr; } }
.email-pane { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.email-body { white-space: pre-wrap; word-break: break-word; font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f7f8f7; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 10px 0 0; }
.email-frame { width: 100%; min-height: 480px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 10px; }
.email-pane .attach { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.incoming-lines td.from-email { max-width: 260px; font-size: 13px; color: var(--muted); }
.incoming-lines tr.unsure td { background: #fff8e6; }
.incoming-lines .learn { display: block; color: var(--ink, inherit); font-size: 13px; margin-top: 4px; }
textarea.code { width: 100%; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.can-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.can-total { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; }
.can-total .amt { font: 600 21px/1.1 var(--font-sans); margin: 4px 0; }
.can-total span { color: var(--muted); font-size: 13px; }
.split > .panel { margin-top: 0; }

/* Search box in the menu and its drop-down */
@media print { .search-drop { display: none !important; } }

/* Prime cost report */
table.prime td.pc-ok { color: var(--moss); background: var(--moss-bg); }
table.prime td.pc-watch { color: var(--amber); background: var(--amber-bg); }
table.prime td.pc-over { color: var(--brick); background: var(--brick-bg); }
table.prime tr.pc-total td { border-top: 2px solid var(--line, #d9dedc); }
table.prime th .small { font-weight: 600; }
table.prime td.pc-warn { color: #9a4a12; background: #fbe8d9; }
table.prime td.pc-alert { color: var(--brick); background: var(--brick-bg); }
.sheet-preview { margin: 10px 0; }
.sheet-preview .table-wrap { max-height: 420px; overflow: auto; border: 1px solid #d6dedb; border-radius: 6px; }
table.sheet { font-size: 13px; border-collapse: collapse; }
table.sheet td { padding: 3px 8px; border-bottom: 1px solid #e6ebe9; white-space: nowrap; }
table.sheet tr:first-child td { font-weight: 600; background: #f2f4f3; position: sticky; top: 0; }
.people-pick { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.people-pick fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; display: grid; gap: 4px; }
.people-pick legend { font-weight: 600; }
.confirm-email { margin: 10px 0; }
.confirm-email textarea, dialog textarea { width: 100%; }
.add-person input[type=search] { width: 100%; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; margin: 8px 0 12px; }
.sales-board { margin-bottom: 8px; }
.sales-board .tiles .tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: var(--radius); }
.sales-board .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.sales-board .tile > span:first-child { font-size: 13px; color: var(--muted); font-weight: 600; }
.sales-board .tile strong { font-size: 24px; }
.sales-board .delta { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.sales-board .up { color: #1d6b48; font-weight: 600; }
.sales-board .down { color: #a23a2a; font-weight: 600; }
.week-bars { display: flex; gap: 14px; align-items: flex-end; height: 170px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.week-bars .wk { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-bars .pair { display: flex; gap: 2px; align-items: flex-end; height: 140px; }
.week-bars .bar { width: 14px; border-radius: 4px 4px 0 0; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 13px; margin-bottom: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.ideas { margin: 0; padding-left: 18px; display: grid; gap: 10px; }
.ideas .tag { margin-left: 8px; }
.store-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }
.store-chart { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.week-bars.mini { height: 100px; gap: 6px; padding-top: 6px; }
.week-bars.mini .pair { height: 70px; }
.week-bars.mini .bar { width: 9px; }
.week-bars.mini .small { font-size: 10px; }

/* Shipping: the stage steps on an order, the pickup calendar, standing orders */
ol.stages { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: st; }
ol.stages li { counter-increment: st; padding: 4px 12px; border-radius: 999px; background: #eef1f0; color: var(--muted); font-size: 13px; font-weight: 600; }
ol.stages li::before { content: counter(st) '. '; }
ol.stages li.done { background: var(--moss-bg); color: var(--moss); }
ol.stages li.now { background: var(--spruce); color: #fff; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day.other { background: transparent; opacity: .6; }
.cal-today { outline: 2px solid var(--focus); outline-offset: -2px; }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-week { display: grid; gap: 8px; }
.cal-week .panel { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.cal-item { display: block; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: var(--radius-sm); border-left: 3px solid var(--muted); background: #eef1f0; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-week .cal-item { white-space: normal; font-size: 14px; padding: 6px 8px; }
.cal-item .cal-stage { color: var(--muted); font-size: 11px; }
.cal-item.planned { background: transparent; border: 1px dashed var(--muted); border-left-width: 3px; }
.cal-item.packing { border-left-color: var(--brick); background: var(--brick-bg); }
.cal-item.to_pack { border-left-color: var(--amber); background: var(--amber-bg); }
.cal-item.ready, .cal-item.pickup_set { border-left-color: #2f5a8f; background: #e8eef7; }
.cal-item.shipped { border-left-color: var(--moss); background: var(--moss-bg); }
.standing { padding: 10px 0; border-top: 1px solid var(--line); }
.standing:first-of-type { border-top: none; }
.standing.muted { opacity: .6; }
@media (max-width: 700px) { .cal-month { grid-template-columns: 1fr; } .cal-dow, .cal-day.other { display: none; } .cal-day { min-height: 0; } }
.pull-sizes { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.pull-sizes strong { font: 700 21px/1.1 var(--font-sans); }
.tickbox { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--muted); border-radius: 3px; vertical-align: middle; }
@media print { main > .print-only, main > div > h2.print-only { display: block; } .pull-block { border: none; padding: 0; break-inside: avoid; } .pull-block a { color: inherit; text-decoration: none; } }
input.line-note { width: 100%; min-width: 140px; }
@media print { tr.no-print { display: none; } }
/* Ticking several rows and acting on them all */
.select-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 10px 14px; margin-bottom: 10px; background: var(--spruce); color: #fff; border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.select-bar button.quiet { background: #fff; }
.select-bar button.link { color: #fff; }
.bank-line .bl-head label.pick { margin-right: 6px; }
.batch-print { display: none; }
@media print { body.printing-batch > *:not(.batch-print) { display: none !important; } body.printing-batch .batch-print { display: block; } body.printing-batch .batch-print .sheet:last-child { break-after: auto; } }
.select-bar button:not(.quiet):not(.danger):not(.link) { background: #fff; color: var(--spruce); border-color: #fff; box-shadow: inset 0 0 0 2px var(--amber); }

.chips.flow .step { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #eef1f0; color: var(--muted); font-size: 12px; font-weight: 700; }
.chips.flow .chip.on .step { background: rgba(255,255,255,.25); color: #fff; }
.from-email-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 12px; padding: 8px 12px; background: #e8eef7; border-radius: var(--radius); font-size: 14px; }
.from-email-line .btn { margin-left: auto; }
a.mail-mark { text-decoration: none; color: #2f5a8f; }
@media print { html, body, .shell, main { min-height: 0 !important; height: auto !important; } }
.chip.new-chip { text-decoration: none; border-style: dashed; }
td.what { min-width: 160px; }
.cal-month .cal-item { white-space: normal; }
.cal-item .cal-stage { display: block; }
.step-cell > div { margin-top: 6px; }
.canning-grid th:first-child, .canning-grid td:first-child { min-width: 11em; }

/* Calendar events (production schedule) */
.cal-num { display: flex; justify-content: space-between; align-items: center; }
.cal-add { border: 0; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 4px; cursor: pointer; opacity: 0; }
.cal-day:hover .cal-add, .cal-week .cal-add, .cal-add:focus { opacity: 1; }
.cal-week h3 { display: flex; justify-content: space-between; }
.cal-item.ev { border-left-color: #6b6b6b; background: #f0f0f0; }
.cal-item.ev.done { opacity: .55; }
.cal-item.ev-brewing, .chip.ev-brewing.on { border-left-color: #8a5a1f; background: #f6ecdf; }
.cal-item.ev-transfer, .chip.ev-transfer.on { border-left-color: #5b4b8a; background: #ece8f6; }
.cal-item.ev-carbonating, .chip.ev-carbonating.on { border-left-color: #1f7a8a; background: #e2f2f4; }
.cal-item.ev-canning, .chip.ev-canning.on { border-left-color: #a03a5a; background: #f6e4ea; }
.cal-item.ev-kegging, .chip.ev-kegging.on { border-left-color: #4b6b2f; background: #e9f1e1; }
.cal-item.ev-cleaning, .chip.ev-cleaning.on { border-left-color: #7a7a7a; background: #efefef; }
.cal-item.ev-delivery, .chip.ev-delivery.on { border-left-color: #2f5a8f; background: #e8eef7; }
.chip.ev-chip.on { border-left-width: 4px; border-left-style: solid; color: var(--ink); }
.chip.ev-pickup.on { border-left: 4px solid #2f5a8f; }
.chip.ev-chip { color: var(--ink); background: var(--surface); }
.chip.ev-chip:not(.on) { opacity: .5; text-decoration: line-through; border-left: 4px solid transparent; }
.chip.ev-pickup.on { background: #e8eef7; color: var(--ink); }
.chip.ev-other.on { border-left: 4px solid #6b6b6b; background: #f0f0f0; color: var(--ink); }

/* The phone "Calendar" app (/calendar/): no menu */
.cal-only { max-width: 1100px; margin: 0 auto; padding: 10px 12px 40px; }
.cal-only-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.cal-only main { padding: 0; max-width: none; }
.qr-box svg { width: 150px; height: 150px; background: #fff; }
@media (max-width: 700px) {
  /* phones: the month is a list of the days that have something, plus today */
  .cal-month .cal-day:not(:has(.cal-item)):not(.cal-today) { display: none; }
  .cal-add { opacity: 1; }
}
.cal-dow-sm { display: none; }
@media (max-width: 700px) { .cal-dow-sm { display: inline; } }

/* Business logo at the top of the menu */
.cal-logo img { max-height: 40px; max-width: 140px; object-fit: contain; display: block; }

.cal-by { font-size: .85em; font-style: italic; }

/* ── Home page cards ──
   .dash-kpis > .dash-kpi (.act .good .warn .bad) = the headline figures; .dash-grid > .dash-card.size-1|2|3;
   .acct-card = one bank account (bank vs ArBooks); .chart (+ .chart-tip) = SVG charts from barChart()/areaChart();
   .stack-bar = one split bar with a legend; .cust-list = the Customize dialog's list. */
.dash-kpis { display: flex; flex-wrap: wrap; gap: 1px; margin-bottom: var(--sp-4); background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.dash-kpi { flex: 1 1 160px; display: grid; gap: 2px; align-content: start; padding: var(--sp-4) var(--sp-5); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; position: relative; }
a.dash-kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.kpi-value { font-size: var(--text-3xl); font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-note { font-size: var(--text-sm); color: var(--text-2); }
.dash-kpi.act { box-shadow: inset 3px 0 0 var(--warning); } .dash-kpi.act .kpi-value { color: var(--warning-text); }
.dash-kpi.good .kpi-value { color: var(--success); }
.dash-kpi.warn { box-shadow: inset 3px 0 0 var(--warning); }
.dash-kpi.bad { box-shadow: inset 3px 0 0 var(--danger); } .dash-kpi.bad .kpi-value { color: var(--money-out); }
.dash-kpi .up { color: var(--money-in); } .dash-kpi .down { color: var(--money-out); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; gap: var(--sp-4); align-items: start; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5) var(--sp-5); min-width: 0; box-shadow: var(--shadow-xs); }
.dash-card.size-2 { grid-column: span 2; }
.dash-card.size-3 { grid-column: 1 / -1; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; }
  .dash-card.size-2 { grid-column: auto; }
  .dash-kpi { flex-basis: 40%; padding: var(--sp-3) var(--sp-4); }
  .biz-table-wrap { display: none; }
  .kpi-value { font-size: var(--text-2xl); }
  .dash-card { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
}
.dash-card > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: var(--sp-3); }
.dash-card > header h3 a { color: inherit; text-decoration: none; }
.dash-card > header h3 a:hover { color: var(--accent-text); }
.open-link { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-text); }
.dash-card .empty-state { padding: var(--sp-5) var(--sp-3); }
.dash-card .empty-state .es-icon { width: 40px; height: 40px; }
.dash-error { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--danger-line); background: var(--danger-bg); border-radius: var(--r-md); color: var(--danger-text); }
.dash-error > div { flex: 1; } .dash-error svg { margin-top: 2px; flex: none; }
.dash-subhead { margin: var(--sp-4) 0 0; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: var(--text-xs); }
.card-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.card-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.dash-bullets { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--text-sm); }
.dash-bullets .tag { margin-right: 4px; }
.dash-group { margin-top: var(--sp-3); }
.dash-row .btn.sm { pointer-events: none; white-space: nowrap; }
a.dash-row:hover .btn.sm { border-color: var(--accent); color: var(--accent-text); }
/* Bank accounts */
.acct-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.acct-total-books { display: grid; justify-items: end; gap: 0; text-align: right; }
.acct-total-books strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sp-3); }
.acct-card { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); min-width: 0; container-type: inline-size; }
.acct-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--text); text-decoration: none; }
.acct-head:hover strong { color: var(--accent-text); }
.acct-figs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.acct-figs > div { min-width: 0; overflow-wrap: anywhere; }
.acct-figs .nowrap { white-space: normal; }
.acct-num { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
/* A narrow account card stacks the bank figure over the ArBooks figure so nothing runs past its edge */
@container (max-width: 300px) {
  .acct-figs { grid-template-columns: minmax(0, 1fr); }
  .acct-card .acct-figs > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: var(--sp-2); }
}
.acct-figs > div + div { border-left: 1px solid var(--line); padding-left: var(--sp-3); }
.acct-num { font-size: var(--text-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.acct-diff { display: flex; justify-content: space-between; padding-top: var(--sp-2); border-top: 1px solid var(--line); min-height: 26px; align-items: center; }
.acct-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart .bar.in, .chart .bar.pos, .chart .bar.sales { fill: var(--brand-500); }
.chart .bar.out { fill: var(--warning); opacity: .8; }
.chart .bar.neg { fill: var(--money-out); opacity: .85; }
.chart .bar.ly { fill: var(--gray-300); }
.chart .hit { fill: transparent; }
.chart .hit[class*='link'], .chart .bar-group.link .hit { cursor: pointer; }
.chart .bar-group.on .bar { filter: brightness(.88); }
.chart .bar-group.on .hit { fill: var(--gray-100); opacity: .45; }
.chart .area { fill: var(--brand-100); opacity: .6; }
.chart .line { fill: none; stroke: var(--brand-600); stroke-width: 2.2; stroke-linejoin: round; }
.chart .dot { fill: var(--surface); stroke: var(--brand-600); stroke-width: 2.5; pointer-events: none; }
.chart-tip { position: absolute; top: -6px; transform: translateY(-100%); z-index: 3; min-width: 180px; padding: 8px 10px; background: var(--gray-900); color: #fff; border-radius: var(--r-sm); box-shadow: var(--shadow-md); font-size: var(--text-xs); pointer-events: none; display: grid; gap: 2px; }
.chart-tip > div { display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-tip > div:first-child { margin-bottom: 2px; }
.chart-tip > div:last-child:not(:first-child) span:only-child { color: var(--gray-300); }
.chart-tip .in span::before, .chart-tip .out span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--brand-300); }
.chart-tip .out span::before { background: var(--warning); }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin: var(--sp-3) 0 var(--sp-1); font-size: var(--text-xs); color: var(--text-2); }
.chart-legend i, .sb-label i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .this i { background: var(--brand-500); } .chart-legend .ly i { background: var(--gray-300); }
.cf-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.cf-fig { display: grid; gap: 2px; }
.cf-fig strong { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.cf-fig.in i { background: var(--brand-500); } .cf-fig.out i { background: var(--warning); }
.cf-note { margin: var(--sp-2) 0 0; }
.sb-label { display: inline-flex; align-items: center; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.stack-bar { margin-top: var(--sp-3); }
.sb-bar { display: flex; gap: 2px; height: 12px; border-radius: var(--r-full); overflow: hidden; background: var(--gray-100); }
.sb-seg { display: block; min-width: 4px; }
.sb-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
.sb-item { display: grid; gap: 0; color: var(--text); text-decoration: none; }
a.sb-item:hover strong { color: var(--accent-text); text-decoration: none; }
.sb-item strong { font-variant-numeric: tabular-nums; font-size: var(--text-md); }
.sb-item.zero { opacity: .55; }
.sb-seg.ok, .sb-item.ok i { background: var(--brand-400); }
.sb-seg.mid, .sb-item.mid i { background: var(--warning-line); }
.sb-seg.late, .sb-item.late i { background: var(--warning); }
.sb-seg.bad, .sb-item.bad i { background: var(--danger); }
.pl-rows { display: grid; gap: var(--sp-3); margin: var(--sp-3) 0 var(--sp-4); }
.pl-row { display: grid; gap: 4px; color: var(--text); text-decoration: none; }
.pl-row:hover .pl-row-head span { color: var(--accent-text); }
.pl-row-head { display: flex; justify-content: space-between; font-size: var(--text-sm); }
.pl-bars { display: grid; gap: 3px; }
.pl-bar { display: block; height: 8px; border-radius: var(--r-full); min-width: 3px; }
.pl-bar.inc { background: var(--brand-500); } .pl-bar.exp { background: var(--warning); } .pl-bar.was { background: var(--gray-200); height: 5px; }
.spark-head { display: flex; justify-content: space-between; margin-bottom: 4px; padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.sales-figs { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--sp-4); align-items: end; }
.sales-figs .fig { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .cf-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-figs { grid-template-columns: 1fr 1fr; } .sales-figs > :first-child { grid-column: 1 / -1; }
  .acct-grid { grid-template-columns: 1fr; }
  .acct-total-books { justify-items: start; text-align: left; }
}
/* Masonry (desktop): app.js sets each card's row span from its height */
@media (min-width: 641px) {
  .dash-grid.packed { grid-auto-rows: 4px; row-gap: 0; align-items: start; grid-auto-flow: row; }
  .dash-grid.packed > .dash-card { margin-bottom: var(--sp-4); }
}
.head-acts { display: inline-flex; align-items: center; gap: var(--sp-2); }
.dash-card .fold-btn { display: none; }
.dash-card.foldable .fold-btn { display: inline-grid; }
.dash-card.foldable > header { margin-bottom: 0; }
.dash-card.foldable:not(.folded) > header { margin-bottom: var(--sp-3); }
.dash-card.folded > .dash-body { display: none; }
.dash-card.folded { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.dash-card.foldable:not(.folded) .fold-btn svg { transform: rotate(180deg); }
.dash-card.folded > header h3 { font-size: var(--text-md); }
.dash-callout { padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); border-radius: var(--r-md); background: var(--warning-bg); border: 1px solid var(--warning-line); color: var(--warning-text); font-size: var(--text-sm); }
/* Empty cards shrink to one line at the end of the grid */
.dash-card.slim { order: 90; grid-column: auto; padding: var(--sp-3) var(--sp-4); box-shadow: none; background: var(--surface-2); }
.dash-card.slim > header { margin-bottom: 2px; }
.dash-card.slim > header h3 { font-size: var(--text-md); }
.dash-card.slim .empty-state { display: block; padding: 0; text-align: left; }
.dash-card.slim .empty-state .es-icon, .dash-card.slim .empty-state h3 { display: none; }
.dash-card.slim .empty-state p { font-size: var(--text-sm); max-width: none; margin: 0; text-align: left; }
.dash-card.slim .empty-state .toolbar { justify-content: flex-start; margin-top: var(--sp-2); }
/* Partial periods and labels on charts */
.chart .hatch { fill: var(--surface); opacity: .55; }
.chart .bar-group.partial .bar { opacity: .7; }
.chart .val { font-size: 10.5px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-legend .part i { background: repeating-linear-gradient(45deg, var(--brand-500) 0 2px, var(--brand-200) 2px 4px); }
.chart .ml { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.chart .ml.part { stroke-dasharray: 4 4; }
.chart .md { fill: var(--surface); stroke-width: 2; }
.chart .s0, .chart-legend .s0 i { stroke: var(--brand-600); background: var(--brand-600); }
.chart .s1, .chart-legend .s1 i { stroke: var(--info); background: var(--info); }
.chart .s2, .chart-legend .s2 i { stroke: var(--warning); background: var(--warning); }
.chart .s3, .chart-legend .s3 i { stroke: var(--gray-500); background: var(--gray-500); }
.chart .s4, .chart-legend .s4 i { stroke: var(--danger); background: var(--danger); }
.acct-figs > .on .acct-num { color: var(--text); }
.acct-figs > div:not(.on) .acct-num { color: var(--text-2); }
.pill.used { margin-left: 6px; font-size: 10px; vertical-align: 3px; }
.acct-num > .pill.used { margin-left: 0; vertical-align: baseline; }
.keg-tot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.keg-tot > div { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; gap: 0 var(--sp-3); justify-content: start; }
.keg-tot .kpi-label { grid-column: 1 / span 3; }
.keg-tot .fig { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.dash-row.clickable { cursor: pointer; }
.dash-row.clickable:hover { background: var(--surface-2); }
/* Phone: tighter folded cards and account cards, so the page stays short */
@media (max-width: 640px) {
  .dash-grid { gap: var(--sp-3); }
  .dash-card.folded { padding: 10px var(--sp-4); margin-top: -4px; border-radius: var(--r-md); box-shadow: none; }
  .dash-card.folded > header h3 { font-size: var(--text-md); font-weight: 600; }
  .dash-card.folded .open-link { display: none; }
  .acct-card { padding: var(--sp-2) var(--sp-3); gap: 6px; }
  .acct-diff { display: none; }
  .acct-foot .sub { display: none; }
  .acct-num { font-size: var(--text-lg); }
  .acct-total { margin-bottom: var(--sp-2); }
  .acct-total-books { display: none; }
  .card-tools { flex-wrap: nowrap; gap: 4px; }
  .card-tools .segmented > button { padding: 4px 8px; font-size: var(--text-xs); min-height: 28px; }
  .cf-note { display: none; }
  .dash-kpi .kpi-note { font-size: var(--text-xs); }
}
.show-extra { margin-top: var(--sp-2); }
/* Round 29: Home and the owner overview sit in the same centered column as every other page (--content-max),
   lined up with the top bar's search and buttons. Three card columns fit inside it. */
/* Needs attention rows stay one or two lines: the rest of the explanation is a click away */
[data-card='attention'] .dash-row > div:first-child > .sub, .bell-menu .dash-row > div:first-child > .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-details summary { cursor: pointer; }
.row-details ul { margin: 4px 0 0 16px; padding: 0; display: grid; gap: 4px; }
/* "More": the lower cards, smaller */
.dash-more-head { margin: var(--sp-6) 0 var(--sp-3); font-size: var(--text-md); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.dash-more .dash-card { padding: var(--sp-3) var(--sp-4); box-shadow: none; }
.dash-more .dash-card > header h3 { font-size: var(--text-md); }
.dash-more .dash-big { font-size: 1.4rem; }
.head-fig { display: none; white-space: normal; word-break: normal; margin-left: var(--sp-2); font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dash-card.folded .head-fig { display: inline; }
.dash-card.folded .head-fig:not(:empty)::before { content: '· '; }
/* Compact search: one line, recent searches beside it */
.dash-card.compact > header { display: none; }
.dash-card.compact { padding: var(--sp-3) var(--sp-4); }
.dash-search-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.dash-search-row .input-icon { flex: 1 1 200px; }
.dash-search-row input[type=search] { width: 100%; }
.dash-chip-box .dash-chips { flex-wrap: nowrap; overflow: hidden; }
.dash-search-out:not(:empty) { margin-top: var(--sp-3); }
dialog.cust-dialog::backdrop { position: fixed; inset: 0; }
/* Owner overview table (computer) and cards (phone) */
.biz-cards { display: none; gap: var(--sp-2); }
.biz-card { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); text-decoration: none; background: var(--surface-2); }
.biz-card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.biz-card-figs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-3); }
.biz-card-figs > div { display: grid; }
.biz-card-figs strong { font-variant-numeric: tabular-nums; font-size: var(--text-lg); }
.biz-card-figs .down { color: var(--money-out); }
@media (max-width: 760px) { .biz-cards { display: grid; } }
.biz-table td { vertical-align: top; white-space: normal; }
.biz-table td .sub { max-width: 16ch; display: block; margin-left: auto; }
.biz-table td:not(.num) .sub { margin-left: 0; }
.biz-table .row-acts .toolbar { flex-wrap: nowrap; gap: 4px; justify-content: flex-end; }
.biz-table .row-acts { white-space: nowrap; }
.biz-table tfoot td { font-weight: 650; }
.biz-table .down { color: var(--money-out); }
/* Customize dialog */
@media (min-width: 641px) { dialog.cust-dialog { width: min(520px, calc(100vw - 24px)); } }
.cust-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: 4px; max-height: 56vh; overflow: auto; }
.cust-item { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: grab; }
.cust-item label { flex: 1; display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; margin: 0; }
.cust-item.off label span { color: var(--text-3); }
.cust-item.dragging { opacity: .4; }
.cust-item.over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.cust-grip { color: var(--text-3); font-size: 16px; line-height: 1; padding: 0 2px; }
.cust-move { display: flex; gap: 2px; }
.dash-card > header h3 { margin: 0; font-size: var(--text-lg); font-weight: 650; color: var(--text); }
.dash-edit { display: flex; gap: 4px; }
.dash-edit button { padding: 2px 8px; }
.dash-big { font-size: 1.8rem; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dash-big.owed { color: var(--brick); } .dash-big.warn { color: var(--amber); }
.dash-list { display: grid; margin-top: 8px; }
.dash-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; align-items: center; }
.dash-row:first-child { border-top: none; }
a.dash-row:hover { background: var(--paper); }
.dash-row.warn > div:first-child > div:first-child { color: var(--brick); }
.dash-row.pending { opacity: .6; }
.dash-row .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-banks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dash-bank { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.dash-bank:hover { border-color: var(--spruce-2); }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.dash-tile { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.dash-tile:hover { border-color: var(--spruce-2); }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* This week: one calendar strip, days butted together with shared borders. */
.dash-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.dash-day { border-left: 1px solid var(--line); padding: 0 0 6px; min-height: 96px; display: grid; gap: 4px; align-content: start; font-size: .85rem; background: var(--surface); }
.dash-day:nth-child(7n+1) { border-left: none; }
.dash-day:nth-child(n+8) { border-top: 1px solid var(--line); }
.dash-day:nth-child(7n+6), .dash-day:nth-child(7n) { background: var(--paper); }
.dash-day > :not(.dash-dayname) { margin: 0 6px; }
.dash-dayname { font-weight: 600; font-size: .78rem; color: var(--muted); text-align: center; padding: 4px 0; border-bottom: 1px solid var(--line); background: var(--paper); text-transform: uppercase; letter-spacing: .03em; }
.dash-day.today { background: #f4f8f6; }
.dash-day.today .dash-dayname { background: var(--spruce); color: var(--spruce-ink); border-bottom-color: var(--spruce); }
.dash-day .cal-item { font-size: .8rem; }
.dash-search-out { margin-top: 10px; }
.dash-card input[type=search] { width: 100%; }
.dash-search-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-search-cols h4 { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dash-hidden { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
@media (max-width: 760px) {
  .dash-week { grid-template-columns: 1fr; }
  .dash-day { min-height: 0; grid-template-columns: 74px 1fr; border-left: none; border-top: 1px solid var(--line); padding: 0; }
  .dash-day:first-child { border-top: none; }
  .dash-dayname { grid-row: 1 / span 9; border-bottom: none; border-right: 1px solid var(--line); text-align: left; padding: 6px; }
  .dash-day > :not(.dash-dayname) { margin: 4px 6px; }
  .dash-search-cols { grid-template-columns: 1fr; }
}
.dash-card .up, .dash-row .up { color: var(--money-in); font-weight: 600; }
.dash-card .down { color: var(--money-out); font-weight: 600; }
.dash-card .warn { color: var(--amber); }

.dash-day.can-add { cursor: pointer; }
.dash-day.can-add:hover { background: #eef4f1; }
.dash-dayname { position: relative; }
.dash-add { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: inherit; font-weight: 700; font-size: 1rem; line-height: 1; padding: 0 4px; cursor: pointer; opacity: 0; }
.dash-day:hover .dash-add, .dash-add:focus { opacity: 1; }
.dash-day button.cal-item { text-align: left; width: calc(100% - 12px); border: none; font: inherit; cursor: pointer; }
.dash-empty { color: var(--muted); }
@media (max-width: 760px) { .dash-add { opacity: 1; } }

/* Screen lock */
body.locked { background: var(--paper); }
.lock-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.lock-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; width: min(420px, 100%); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.lock-card h1 { margin: 6px 0 8px; font-size: 1.5rem; }
.lock-brand { font-weight: 700; letter-spacing: .04em; color: var(--spruce); text-transform: uppercase; font-size: .85rem; }
.lock-card .field { display: grid; margin: 10px 0; }
.lock-card input[type=password] { font-size: 1.1rem; padding: 10px 12px; }
.lock-card button[type=submit] { width: 100%; padding: 10px; font-size: 1rem; }
.lock-msg { color: var(--brick); min-height: 1.2em; margin: 4px 0; }

/* Settings tabs */
.people-grid select { min-width: 110px; }
.people-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; margin: 8px 0 12px; }

.person-bizs { display: grid; gap: 8px; }
.person-biz { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; display: grid; gap: 6px; }
.person-biz .feature-grid { margin-top: 6px; }

/* Setup: tabs across the top, and the pages under a tab. Menu counts. */
.setup-strip { margin-bottom: 4px; }
.setup-strip .settings-tabs { margin-bottom: 12px; }
.setup-pages { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 16px; font-size: .92rem; }
.setup-pages a { text-decoration: none; color: var(--muted); padding: 2px 0; border-bottom: 2px solid transparent; }
.setup-pages a:hover { color: inherit; }
.setup-pages a.on { color: inherit; font-weight: 600; border-bottom-color: var(--spruce); }

/* Calendar drag and drop */
.cal-item[draggable="true"] { cursor: grab; }
.cal-item.dragging { opacity: .4; }
.cal-day.cal-drop, .cal-week .panel.cal-drop { outline: 2px dashed #2f5a8f; outline-offset: -2px; background: #e8eef7; }

/* A pickup that isn't on an order yet: same blue as order pickups */
.cal-item.ev-pickup { border-left-color: #2f5a8f; background: #e8eef7; }

tr.sub-row td { background: var(--paper); }

/* Seasonal beers: the year in twelve cards. */
.seas-year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.seas-year .panel { margin: 0; padding: 12px 14px; min-height: 130px; display: flex; flex-direction: column; gap: 5px; }
.seas-year h3 { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.seas-year .cal-add { opacity: 1; font-size: 18px; }
.seas-year .panel.seas-now { border-color: var(--spruce); box-shadow: inset 0 3px 0 var(--spruce); }
.seas-item { white-space: normal; font-size: 14px; padding: 6px 8px; cursor: pointer; }
.seas-item.seas-planned { border-left-color: var(--moss); background: var(--moss-bg); }
.seas-item.seas-idea { background: transparent; border: 1px dashed var(--muted); border-left-width: 3px; }
.seas-item.cont { opacity: .6; }
.seas-item:hover, .seas-item:focus-visible { outline: 2px solid var(--spruce); outline-offset: 1px; }
.seas-item .cal-stage { display: block; white-space: normal; }
.seas-tag { margin-left: 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.seas-brews { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.seas-loose { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
@media (max-width: 1150px) { .seas-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .seas-year { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .seas-year { grid-template-columns: 1fr; } .seas-year .panel { min-height: 0; } }
@media print { .seas-year { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } .seas-year .panel { break-inside: avoid; min-height: 0; } .seas-year .cal-add { display: none; } }

/* Setup → People: count grid, filter chips, access pills */
.people-grid { margin: 12px 0; }
.people-grid th, .people-grid td { padding: 6px 10px; }
.people-grid td.num, .people-grid th.num { text-align: center; }
.people-grid .link.on { text-decoration: underline; font-weight: 700; }
.grid-n { min-width: 40px; padding: 3px 8px; background: var(--surface); color: var(--spruce); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
.grid-n:hover:not(:disabled) { border-color: var(--spruce); }
.grid-n.on { background: var(--spruce); color: var(--spruce-ink); border-color: var(--spruce); }
.grid-n:disabled { color: var(--muted); background: transparent; border-color: transparent; cursor: default; }
.people-filters { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; background: #fbfcfb; }
.people-filters > summary { cursor: pointer; font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.chip-title { font-size: 13px; font-weight: 600; color: var(--muted); min-width: 64px; }
.access-pills { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.access-pill { background: none; border: 0; padding: 0; text-align: left; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.access-pill:hover { text-decoration: underline; }
.access-pill.dim { color: var(--muted); }
.access-pill.dim strong { font-weight: 500; }
.people-group h3 { margin: 16px 0 6px; }
.people-bulk { margin: 4px 0 6px; }
@media (max-width: 760px) { .chip-title { min-width: 0; flex-basis: 100%; } }
@media (max-width: 760px) {
  .people-group .table-wrap { overflow: visible; }
  .people-group thead { display: none; }
  .people-group table, .people-group tbody { display: block; }
  .people-group tr { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .people-group td { border: 0; padding: 0; }
  .people-group td:first-child { grid-row: span 5; padding-top: 4px; }
  .people-group td.row { flex-wrap: wrap; }
  .people-group td.num { text-align: left; }
}

/* Setup → People & access: the Users table, Add user steps, role cards, history */
.users-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.users-head h2 { margin: 0 0 2px; }
.users-head .sub { margin: 0; }
.user-tabs { margin: var(--sp-3) 0 var(--sp-3); }
.user-tabs .count { margin-left: 6px; font-size: var(--text-xs); font-weight: 700; padding: 0 7px; border-radius: var(--r-full); background: var(--gray-100); color: var(--text-2); line-height: 18px; display: inline-block; }
.user-tabs [aria-selected='true'] .count { background: var(--accent-soft); color: var(--accent-text); }
.users-tools { gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-2); }
.users-tools .input-icon { flex: 1 1 260px; max-width: 360px; }
.users-tools select { width: auto; }
.user-showing { margin: 0 0 0 auto; }
.people-filters > summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.people-filters > summary::-webkit-details-marker { display: none; }
.people-filters > summary .count { font-size: var(--text-xs); font-weight: 700; padding: 0 7px; border-radius: var(--r-full); background: var(--accent); color: #fff; line-height: 18px; }
.people-bulk { gap: var(--sp-2); align-items: center; padding: var(--sp-2) var(--sp-3); background: var(--accent-soft); border-radius: var(--r-md); }
.users-table { table-layout: fixed; }
.users-table th.tick, .users-table td.tick { width: 44px; }
.users-table th:nth-child(2) { width: 26%; } .users-table th:nth-child(3) { width: 24%; } .users-table th:nth-child(4) { width: 15%; } .users-table th:nth-child(5) { width: 14%; } .users-table th:nth-child(6) { width: 190px; }
.users-table td { overflow-wrap: anywhere; }
.user-cell { display: flex; align-items: center; gap: var(--sp-3); }
.user-cell .chip-avatar { width: 32px; height: 32px; border-radius: var(--r-full); background: var(--brand-100); color: var(--brand-800); font-size: var(--text-xs); }
.user-name { font-weight: 600; color: var(--text); text-align: left; }
.user-role strong { font-weight: 600; }
.user-status { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.user-actions { gap: var(--sp-1); justify-content: flex-end; flex-wrap: nowrap; }
.users-foot { margin: var(--sp-4) 0 0; }
@media (min-width: 761px) { .user-dialog { width: min(820px, 96vw); } }
.user-dialog .form-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.user-steps { padding: var(--sp-3) var(--sp-4); box-shadow: none; background: var(--surface-2); }
.user-step { min-height: 260px; }
.set-h { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--text-md); }
.loc-ticks { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; }
.loc-tick { gap: 8px; align-items: center; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.role-card { display: grid; gap: 6px; align-content: start; text-align: left; padding: var(--sp-3) var(--sp-4); min-height: 0; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-md); font-weight: 400; box-shadow: none; }
.role-card:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); color: var(--text); }
.role-card.on:hover:not(:disabled) { background: var(--accent-soft); }
.role-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-xs); background: var(--accent-soft); }
.role-card:disabled { opacity: .45; }
.role-card-head { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); }
.role-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; background: var(--surface); }
.role-card.on .role-dot { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); background: var(--accent); }
.role-can, .role-cant { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--text-sm); }
.role-can li::before { content: '✓'; color: var(--success-text); font-weight: 700; margin-right: 6px; }
.role-cant li { color: var(--text-2); }
.role-cant li::before { content: '✕'; color: var(--danger-text); font-weight: 700; margin-right: 6px; }
.user-summary { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.user-summary ul { margin: 6px 0 0; padding-left: 18px; }
.lose-list { margin: var(--sp-2) 0 var(--sp-3); padding-left: 18px; display: grid; gap: 4px; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--line); }
.history-list li { position: relative; padding: 6px 0 12px 16px; }
.history-list li::before { content: ''; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-400); }
.history-list li.ev-revoke::before { border-color: var(--danger-text); }
.history-list li.ev-invite::before, .history-list li.ev-password_link::before { border-color: var(--info-text); }
.history-facts { margin-bottom: var(--sp-4); }
@media (max-width: 760px) {
  .table-wrap > table.users-table, .users-table tbody { display: block; table-layout: auto; width: 100%; min-width: 0 !important; }
  .users-table .user-actions { display: flex; flex-wrap: nowrap; }
  .user-cell > div { min-width: 0; }
  .user-cell .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
  .users-table thead { display: none; }
  .users-table tr { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: 'tick name act' '. role role' '. status last'; gap: 6px 10px; padding: 12px; border-bottom: 1px solid var(--line); align-items: center; }
  .users-table td { border: 0; padding: 0; display: block; }
  .users-table td:nth-child(1) { grid-area: tick; grid-row: auto; padding: 0; }
  .users-table td:nth-child(2) { grid-area: name; }
  .users-table td:nth-child(3) { grid-area: role; }
  .users-table td:nth-child(4) { grid-area: status; }
  .users-table td:nth-child(5) { grid-area: last; text-align: right; font-size: var(--text-sm); color: var(--text-2); }
  .users-table td:nth-child(6) { grid-area: act; }
  .users-table td:nth-child(5) .lastin::before { content: 'Last in '; }
  .user-showing { margin: 0; flex-basis: 100%; }
  .users-tools .input-icon { max-width: none; }
  .user-actions { justify-content: flex-start; }
  .role-cards { grid-template-columns: 1fr; }
  .user-steps .step-note { display: none; }
  .user-steps { padding: var(--sp-2) var(--sp-3); }
  .user-steps .step:not(:last-child)::after { left: 30px; }
}

/* Setup → Business: sections with a pencil, edited in place (Company, Sales, Expenses, Advanced) */
.set-page { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.set-nav { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); display: grid; gap: 2px; }
.set-nav a { display: block; padding: 8px 12px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; text-decoration: none; border-left: 3px solid transparent; }
.set-nav a:hover { background: var(--surface-sunk); color: var(--text); }
.set-nav a.on { background: var(--surface); color: var(--text); font-weight: 600; border-left-color: var(--accent); box-shadow: var(--shadow-xs); }
.set-content { display: grid; gap: var(--sp-4); min-width: 0; }
.set-content > .panel { margin: 0; }
.set-section { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr) 40px; gap: var(--sp-5); padding: var(--sp-5) var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.set-section:not(.editing):has(.set-pencil) { cursor: pointer; }
.set-section:hover:not(.editing):has(.set-pencil) { border-color: var(--line-strong); }
.set-section:hover:not(.editing) .set-pencil { color: var(--accent-text); }
.set-section.editing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.set-title h3 { margin: 0 0 4px; font-size: var(--text-lg); }
.set-note { margin: 0; color: var(--text-2); font-size: var(--text-sm); line-height: 1.4; }
.set-body { min-width: 0; }
.set-rows { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); gap: 10px var(--sp-5); margin: 0; }
.set-rows dt { color: var(--text-2); }
.set-rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.set-pencil { color: var(--text-3); justify-self: end; align-self: start; }
.set-locked { margin-top: var(--sp-2); display: flex; gap: 4px; align-items: center; }
.set-form { grid-column: 2 / 4; display: grid; gap: var(--sp-3); }
.set-form .form-grid { margin: 0; }
.set-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.set-msg { color: var(--danger-text); margin: 0; min-height: 0; }
.set-msg:empty { display: none; }
.set-logo { max-height: 56px; max-width: 200px; display: block; }
.set-test { gap: var(--sp-2); margin-top: var(--sp-3); align-items: center; }
.set-radios { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.set-radios legend { font-weight: 600; font-size: var(--text-sm); margin-bottom: 4px; }
.set-closebox { display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.set-closebox .switch { gap: 10px; }
.set-close { display: grid; gap: var(--sp-3); }
.set-warn { margin: 0; }
.set-links { grid-template-columns: 220px minmax(0, 1fr); }
.set-linklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px var(--sp-4); }
.set-linklist a { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.pre { white-space: pre-line; }
.clip3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1100px) { .set-section { grid-template-columns: minmax(0, 1fr) 40px; } .set-title { grid-column: 1; } .set-body { grid-column: 1 / 3; } .set-section > .set-pencil { grid-row: 1; grid-column: 2; } .set-form { grid-column: 1 / 3; } .set-links { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .set-page { grid-template-columns: 1fr; gap: var(--sp-3); }
  .set-nav { position: static; display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); }
  .set-nav a { border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; white-space: nowrap; }
  .set-nav a.on { box-shadow: none; background: none; border-bottom-color: var(--accent); }
  .set-section { padding: var(--sp-4); gap: var(--sp-3); }
  .set-rows { grid-template-columns: 1fr; gap: 2px; }
  .set-rows dt { font-size: var(--text-sm); margin-top: 8px; }
  .set-rows dt:first-child { margin-top: 0; }
  .set-actions button { flex: 1; }
}

/* Setup → Business → Company details */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.kv dt { color: var(--sub, #666); }
dl.kv dd { margin: 0; white-space: pre-line; }

/* Invoices list: the step cell wraps its actions instead of pushing the table past the card */
.row-actions { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.row-actions > button:first-child:not(.link) { min-height: 30px; }
button.kebab { color: var(--text-2); }
td.step-cell { width: 1%; white-space: nowrap; text-align: right; }
@media (max-width: 560px) { main .toolbar > .row > * { grid-column: auto; } }
.panel:has(> .empty-state) { margin-top: var(--sp-4); }
.back-ico { transform: rotate(180deg); margin-right: 2px; }

/* ── Record pages (customer, vendor): recordPage() and detailGrid() in app.js ── */
.record-head { align-items: flex-start; }
.record-title { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.record-avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md); background: var(--brand-700); color: #fff; font-weight: 700; font-size: var(--text-lg); }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.record-meta .sub { margin: 0; }
.record-contact { display: inline-flex; gap: 2px; margin-left: 4px; }
.record-contact .btn { color: var(--text-2); }
.btn-group.split-btn > button:first-child { border-right-color: rgba(255, 255, 255, .25); }
.btn-group.split-btn .split-caret { width: 34px; padding: 0; }
.record-stats .stat { gap: 4px; }
.stat-bar { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--gray-100); overflow: hidden; }
.stat-bar > i { display: block; height: 100%; border-radius: 2px; background: var(--gray-400); }
.stat-bar.warning > i { background: var(--warning); }
.stat-bar.danger > i { background: var(--danger); }
.stat-bar.success > i { background: var(--success); }
.tab-count { padding: 0 7px; border-radius: var(--r-full); background: var(--gray-100); color: var(--text-2); font-size: 11px; font-weight: 700; line-height: 18px; }
.tabs > [aria-selected='true'] .tab-count { background: var(--accent-soft); color: var(--accent-text); }
.record-pane > * + * { margin-top: var(--sp-4); }
.record-pane > h2 { margin-top: var(--sp-6); }
.filter-row { margin-bottom: var(--sp-3); }
dl.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; margin: 0; }
dl.kv-grid > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
dl.kv-grid dt { color: var(--text-2); font-size: var(--text-sm); font-weight: 600; }
dl.kv-grid dd { margin: 0; overflow-wrap: break-word; word-break: normal; }
.add-details { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: var(--sp-4); padding: 10px 14px; border: 1px dashed var(--gray-300); border-radius: var(--r-md); background: var(--gray-25); }
@media (max-width: 760px) {
  dl.kv-grid { grid-template-columns: 1fr; gap: 0; }
  dl.kv-grid > div { grid-template-columns: 120px minmax(0, 1fr); padding: 8px 0; }
  .record-avatar { width: 40px; height: 40px; font-size: var(--text-md); }
  .record-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .page-head.record-head .toolbar > .split-btn, .page-head.record-head .toolbar > button { flex: none; }
}

/* Menu: the money-checks alert, Customize menu */
.nav-alert { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px 0 5px; border-radius: var(--r-full); background: rgba(178, 107, 0, .22); color: #f4c46d; font-size: 11px; font-weight: 700; line-height: 18px; }
.nav-alert::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #f0a92e; }
.nav-customize { margin-top: 10px; }
.nav-customize button { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 4px 10px; border: 0; background: none; box-shadow: none; color: var(--nav-dim); font: 500 var(--text-xs)/1.4 var(--font-sans); }
.nav-customize button:hover { color: #fff; background: none; text-decoration: underline; }
ol.cm-pins { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); }
ol.cm-pins li { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
ol.cm-pins li:last-child { border-bottom: 0; }
.up-ico { transform: rotate(-90deg); } .down-ico { transform: rotate(90deg); }
.cm-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.cm-all fieldset { margin: 0; padding: 6px 10px 8px; }
.cm-row { display: flex; align-items: center; gap: 4px; }
.cm-star { color: var(--gray-400); }
.cm-star.on { color: var(--warning); }
.cm-star.on svg { fill: currentColor; }
td > button.link { vertical-align: baseline; padding: 0; }
@media (max-width: 640px) {
  table.stack td[data-m='amount'] { min-width: max-content; }
  table.stack td[data-m='title'] { overflow-wrap: break-word; }
  table.stack td.m-sub .m-part { white-space: nowrap; }
  table.stack td.m-status .m-bal { font-size: var(--text-xs); color: var(--text-3); }
  /* While rows are ticked, their actions sit at the bottom of the screen */
  .select-bar:not([hidden]) { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); top: auto; z-index: 50; margin: 0; box-shadow: var(--shadow-xl); }
  main:has(.select-bar:not([hidden])) { padding-bottom: 160px; }
}

/* Record pages, round 9 */
.people-table.flush { border: 0; box-shadow: none; border-radius: 0; }
.people-table td > :is(input, select):not([type=checkbox]) { width: 100%; min-width: 110px; }
.people-table th { white-space: normal; }
.inline-alert { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; font-size: var(--text-sm); }
.inline-alert > svg { flex: none; margin-top: 2px; }
.not-found h1 { font-size: var(--text-2xl); margin: 0; }
.nf-search { width: min(360px, 100%); margin-top: var(--sp-2); }
.stat-label .short { display: none; }
@media (max-width: 600px) {
  main .details dl.kv-grid { display: block; }
  main .details dl.kv-grid > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  main .details dl.kv-grid dt { flex: none; max-width: 45%; }
  main .details dl.kv-grid dd { text-align: right; min-width: 0; }
}
@media (max-width: 420px) {
  .stats, .record-stats { grid-template-columns: 1fr 1fr !important; }
  .stats > .stat:nth-child(3):last-child { grid-column: 1 / -1; }
  .stat .stat-value { font-size: var(--text-lg); }
}

/* ── Lists: filterBar() and listTable() ── */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.filter-bar .fb-search { width: min(320px, 100%); }
.filter-bar .fb-count { color: var(--text-2); font-size: var(--text-sm); white-space: nowrap; }
a.name-link, span.name-link { color: var(--accent-text); font-weight: 600; text-decoration: none; }
a.name-link:hover, tr.clickable:hover span.name-link { text-decoration: underline; }
th.act-col, td.act-col { width: 1%; white-space: nowrap; text-align: right; }
td.act-col .row-actions, td.step-cell .row-actions { justify-content: flex-end; }
table tr.total td, tfoot tr.total td { font-weight: 700; }
.differ-dot { display: inline-block; width: 8px; height: 8px; margin: 0 6px 1px 8px; border-radius: 50%; background: var(--warning); vertical-align: middle; cursor: help; }
.explain-line { display: block; margin: 0 0 var(--sp-3); font-size: var(--text-sm); color: var(--text-2); }
.explain-line .differ-dot { margin-left: 0; }
.record-contact-line { margin-top: 6px; font-size: var(--text-sm); color: var(--text-2); }
.record-contact-line:empty { display: none; }
.record-contact-line a { color: var(--text-2); }
.sum-fold > summary { display: none; }
@media (max-width: 640px) {
  .filter-bar .fb-search { width: 100%; }
  table.stack td[data-m='amount'][data-label]:not([data-sign])::before { content: attr(data-label) ' '; font-weight: 400; font-size: var(--text-xs); color: var(--text-3); }
  table.stack td[data-m='amount'][data-sign='neg']::before { content: attr(data-label) ' −'; font-weight: 400; font-size: var(--text-xs); color: var(--text-3); }
  table.stack tr { min-height: 64px; }
  table.stack tfoot tr { min-height: 48px; }
  /* Banking: accounts scroll sideways; dates and balances fold into one line */
  .acct-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--sp-4) * -1); padding: 0 var(--sp-4) 2px; }
  .acct-tabs::-webkit-scrollbar { display: none; }
  .acct-tabs a { flex: none; min-width: 150px; padding: 8px 12px; }
  .sum-fold { margin: var(--sp-3) 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .sum-fold > summary { display: flex; align-items: center; gap: 6px; padding: 10px 12px; cursor: pointer; font-size: var(--text-sm); color: var(--text-2); list-style: none; }
  .sum-fold > summary::-webkit-details-marker { display: none; }
  .sum-fold > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); }
  .sum-fold[open] > summary::after { transform: rotate(-135deg); }
  .sum-fold > .toolbar { margin: 0 12px 12px !important; }
  .bank-stats { display: none; }
}

/* Round 11: invoices list, record transactions, phone chips and batch bar */
.show-more { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.tx-list .filter-bar .chip { min-height: 28px; }
@media (max-width: 640px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(var(--sp-4) * -1); margin-right: calc(var(--sp-4) * -1); padding: 2px var(--sp-4); -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
  .chips::-webkit-scrollbar { display: none; }
  .chips > * { flex: none; }
  .select-bar:not([hidden]) { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  .select-bar > strong { white-space: nowrap; font-size: var(--text-sm); }
  .select-bar .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; }
  .select-bar .toolbar > button { min-height: 32px; padding: 4px 10px; font-size: var(--text-sm); flex: none; }
  .select-bar > button.link { flex: none; }
}
tfoot tr.total td { white-space: nowrap; }
.phone-only { display: none; }
@media (max-width: 640px) { .phone-only { display: inline; } }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid > .field.wide { grid-column: 1 / -1; }
.form-grid > .field > :is(input, select, textarea) { width: 100%; }
@media (max-width: 560px) { .form-grid.two { grid-template-columns: 1fr; } }
.notice.info.explain-line .differ-dot { margin-left: 0; }
td.cust-cell { min-width: 140px; }
.list-table td.act-col, .list-table th.act-col { padding-left: 4px; }
.list-table th.num, .list-table td.num { padding-left: 8px; }
@media (max-width: 640px) { td.cust-cell { min-width: 0; } }

/* Round 13: list columns size to their content */
.list-table td.c-fit, .list-table th.c-fit { width: 1%; white-space: nowrap; }
.list-table td.c-name .cell-in { min-width: 140px; max-width: 280px; }
.list-table td.c-short .cell-in { max-width: 120px; }
.list-table td.c-text .cell-in { max-width: 200px; }
.list-table .cell-in { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-table .cell-in > div { display: inline; }
.list-table .cell-in > div::before { content: none; }
.list-table .cell-in > * + div::before { content: ' · '; color: var(--text-3); }
.list-table .cell-in > .pill, .list-table .cell-in > div > .pill { margin-left: 4px; }
.list-table td { padding-top: 8px; padding-bottom: 8px; }
/* Selected rows are tinted */
tbody tr:has(> td.pick input[type=checkbox]:checked) > td, tbody tr:has(> td:first-child > input[type=checkbox]:checked) > td { background: var(--brand-50); }
/* Sort cues: a faint arrow on hover, the real one when sorted */
th.sortable .arrow:empty::after { content: ' ↕'; opacity: 0; transition: opacity .12s; }
th.sortable:hover .arrow:empty::after { opacity: .45; }
th.sortable[aria-sort='ascending'], th.sortable[aria-sort='descending'] { color: var(--text); }
/* The batch bar floats over the list instead of pushing it down */
@media (min-width: 641px) {
  .select-bar:not([hidden]) { position: fixed; z-index: 50; bottom: 24px; top: auto; left: calc(var(--nav-w) + (100vw - var(--nav-w)) / 2); transform: translateX(-50%); width: max-content; max-width: calc(100vw - var(--nav-w) - 48px); margin: 0; box-shadow: var(--shadow-xl); }
  main:has(.select-bar:not([hidden])) { padding-bottom: 120px; }
}
@media (max-width: 960px) and (min-width: 641px) { .select-bar:not([hidden]) { left: 50%; max-width: calc(100vw - 32px); } }
/* The money bar */
.money-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-xs); }
.mb-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.mb-fig { display: grid; gap: 2px; }
.mb-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.mb-label i { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.mb-fig.open .mb-label i { color: var(--warning); } .mb-fig.late .mb-label i { color: var(--danger); } .mb-fig.paid .mb-label i { color: var(--success); }
.mb-fig strong { font-size: var(--text-xl); }
.mb-bar { display: flex; gap: 3px; height: 8px; margin-top: var(--sp-3); border-radius: 4px; overflow: hidden; background: var(--gray-100); }
.mb-bar span { min-width: 4px; } .mb-bar .open { background: var(--warning); } .mb-bar .late { background: var(--danger); } .mb-bar .paid { background: var(--success); }
@media (max-width: 640px) {
  .mb-figures { gap: var(--sp-2); } .mb-fig strong { font-size: var(--text-md); } .money-bar { padding: var(--sp-3); }
  table.stack tr:not(:has(> td[data-m='amount'])):not(:has(> td.m-status:not(:empty))) { min-height: 0; }
  .list-table .cell-in { white-space: normal; overflow: visible; min-width: 0 !important; max-width: none !important; }
  .list-table .cell-in > div { display: block; } .list-table .cell-in > * + div::before { content: none; }
}
/* The name column takes what's left and cuts long names short; short code columns stay narrow */
@media (min-width: 641px) {
  .list-table td.c-name { width: 30%; max-width: 0; min-width: 140px; }
  .list-table td.c-name .cell-in { min-width: 0; max-width: none; }
  .list-table td.c-short { width: 110px; max-width: 110px; }
  .list-table td.c-short .cell-in { max-width: 110px; }
  .list-table td.c-text { max-width: 180px; }
  .list-table td.c-text .cell-in { max-width: 180px; }
}
.list-table th, .list-table td { padding-left: 10px; padding-right: 10px; }

/* Round 14: list column policy (listTable): the growing column takes the spare width; every other column fits its content */
.list-table > table { table-layout: auto; }
.list-table th.c-name, .list-table td.c-name { width: 100% !important; max-width: 0 !important; min-width: 220px !important; }
.list-table td.c-name .cell-in { min-width: 0 !important; max-width: none !important; }
.list-table th.c-fit, .list-table td.c-fit, .list-table th.c-text, .list-table td.c-text, .list-table th.num, .list-table td.num { width: 1%; white-space: nowrap; }
.list-table td.c-text { max-width: none !important; }
.list-table td.c-text .cell-in { max-width: 260px !important; }
.list-table td.c-short, .list-table td.c-short .cell-in { width: 1%; max-width: 130px !important; }
.list-table th.pick, .list-table td.pick { width: 36px; min-width: 36px; }
.list-table th.act-col, .list-table td.act-col { width: 1%; text-align: right; }
/* Money bar: four figures, the bar splits the open total */
.mb-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mb-fig.total strong { font-size: var(--text-2xl); }
.mb-note { margin: var(--sp-2) 0 0; font-size: var(--text-sm); color: var(--text-2); }
@media (max-width: 640px) { .mb-figures { grid-template-columns: 1fr 1fr; } .mb-fig.total strong { font-size: var(--text-lg); } }
/* Page header: title on the left, actions on the right (main first), extra ones in More */
@media (min-width: 961px) {
  .page-head { flex-wrap: nowrap; align-items: flex-start; }
  .page-head > div:first-child { flex: 1 1 auto; }
  .page-head > .toolbar { flex: none; flex-wrap: nowrap; padding-top: 2px; }
  .page-head > .toolbar > .ov2 { display: none !important; }
  .page-head > .toolbar.has-ov2 > .more-btn { display: inline-flex !important; }
}
.list-table td.c-short .cell-in { max-width: 100px !important; }
.list-table td.c-text:not(.c-short) .cell-in { max-width: 200px !important; }
@media (max-width: 1499px) { .list-table th.c-name, .list-table td.c-name { min-width: 180px !important; } .list-table td.c-text:not(.c-short) .cell-in { max-width: 160px !important; } }
@media (max-width: 1399px) and (min-width: 641px) { .list-table .c-low { display: none; } }
@media (max-width: 1299px) { .list-table td.c-text:not(.c-short) .cell-in { max-width: 140px !important; } }

/* Round 15: the name column is capped; spare width sits in a spacer before the actions */
.list-table th.c-name, .list-table td.c-name { width: auto !important; max-width: none !important; min-width: 220px !important; }
.list-table td.c-name .cell-in { max-width: clamp(260px, 30vw, 560px) !important; }
.list-table th.spacer, .list-table td.spacer { width: 100%; padding: 0 !important; }
@media (max-width: 640px) { table.stack td.spacer { display: none; } }
.overdue-text { color: var(--danger) !important; }
.menu .menu-item { justify-content: flex-start; text-align: left; }
.mb-note.ok { color: var(--success-text); }
.mb-note .chip { margin-left: 4px; min-height: 26px; padding: 2px 10px; }
@media (max-width: 640px) {
  /* Money bar on a phone: the headline and what's late, then the one note */
  .money-bar { padding: 10px 12px; }
  .mb-figures { display: flex; gap: 16px; align-items: baseline; }
  .mb-fig.open, .mb-fig.paid, .mb-fig .sub, .mb-bar { display: none; }
  .mb-fig { display: flex; flex-direction: column; }
  .mb-fig strong { font-size: var(--text-lg) !important; }
  .mb-note { margin-top: 6px; font-size: var(--text-xs); }
  /* Rows without an amount stay short */
  table.stack tr { min-height: 0 !important; }
  table.stack tr:has(> td[data-m='amount']) { min-height: 56px !important; }
  /* Batch bar clear of the phone's bottom edge */
  .select-bar:not([hidden]) { bottom: calc(12px + env(safe-area-inset-bottom)) !important; left: 8px !important; right: 8px !important; transform: none !important; width: auto !important; max-width: none !important; overflow: hidden; }
}
/* The name shares the spare width with the spacer (about a third), and can shrink with … when space is short */
.list-table th.c-name, .list-table td.c-name { width: 34% !important; max-width: 0 !important; min-width: 200px !important; }
.list-table td.c-name .cell-in { max-width: none !important; }
.list-table th.spacer, .list-table td.spacer { width: 66%; }
@media (max-width: 1299px) { .list-table th.c-name, .list-table td.c-name { min-width: 170px !important; } }
.mb-from { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-3); }
@media (max-width: 640px) {
  .mb-from { display: none; }
  .mb-label { white-space: nowrap; }
  /* A row with no amount lets the name use the whole width */
  table.stack tr:not(:has(> td[data-m='amount'])) > td[data-m='title'] { grid-column-end: -1; }
  table.stack tr { row-gap: 0; }
  table.stack tr > td.m-sub:not(:empty) { margin-top: 2px; }
}
@media (max-width: 640px) {
  .list-table table.stack td.c-name, .list-table table.stack th.c-name { width: auto !important; max-width: none !important; min-width: 0 !important; }
  table.stack tr { row-gap: 0 !important; }
  .select-bar:not([hidden]) > strong { font-size: var(--text-sm); }
  .select-bar .bb-clear-word { display: none; }
}
.select-bar .bb-clear-x { display: none; }
@media (max-width: 640px) { .select-bar .bb-clear-x { display: inline-flex; } }

/* Round 16: one policy. The growing column (the name, or Details) takes all the spare width; every other column fits its
   content, so the figures sit together at the right, next to the actions. */
.list-table th.c-name, .list-table td.c-name { width: 100% !important; max-width: 0 !important; min-width: 200px !important; }
.list-table th.spacer, .list-table td.spacer { display: none; }
@media (max-width: 1299px) { .list-table th.c-name, .list-table td.c-name { min-width: 170px !important; } }
@media (max-width: 640px) {
  /* Phone rows are grids: no table widths apply to their cells */
  table.stack td, table.stack th { width: auto !important; max-width: none !important; min-width: 0 !important; }
  table.stack td[data-m='title'] { min-width: 0 !important; }
  table.stack td[data-m='amount'] { flex: none; }
  /* The right column (amount, then due date and status) stays at the top, whatever the name's height */
  table.stack tr { grid-template-areas: "title amount" "title status" "sub status" "flag flag" "act act" !important; align-items: start; padding-top: 9px !important; padding-bottom: 9px !important; }
  table.stack.has-pick tr { grid-template-areas: "pick title amount" "pick title status" "pick sub status" "pick flag flag" "pick act act" !important; }
  table.stack tr:not(:has(> td.m-status:not(:empty))) { grid-template-areas: "title amount" "sub sub" "flag flag" "act act" !important; }
  table.stack.has-pick tr:not(:has(> td.m-status:not(:empty))) { grid-template-areas: "pick title amount" "pick sub sub" "pick flag flag" "pick act act" !important; }
  table.stack tr:has(> td[data-m='amount']) { min-height: 0 !important; }
  /* Section rows (Chart of accounts types, By year): one line */
  table.stack tr[data-mgroup] > td[data-m='title'] { display: block !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.stack tr[data-mgroup] { grid-template-areas: "title amount" !important; }
}
@media (max-width: 1599px) and (min-width: 641px) { .list-table .c-low { display: none; } .list-table td.c-text:not(.c-short) .cell-in { max-width: 130px !important; } }
@media (max-width: 1299px) and (min-width: 641px) { .list-table td.c-text:not(.c-short) .cell-in { max-width: 110px !important; } .list-table td.c-short .cell-in { max-width: 80px !important; } }
.list-table td.what { min-width: 0; }
.list-table td.c-short, .list-table th.c-short { width: 1% !important; max-width: none !important; }
.list-table td.c-short .cell-in { max-width: 84px !important; }
.list-table th.c-name, .list-table td.c-name { min-width: 170px !important; }
@media (max-width: 1299px) and (min-width: 641px) { .list-table th.c-name, .list-table td.c-name { min-width: 150px !important; } }
@media (max-width: 1299px) and (min-width: 641px) { .list-table .c-lower { display: none; } }
@media (max-width: 1299px) and (min-width: 641px) { .list-table th, .list-table td { padding-left: 6px; padding-right: 6px; } }
td.m-right { display: none; }
@media (max-width: 640px) {
  /* Phone list rows: the right block floats; the name and grey line flow beside it */
  table.stack tbody tr:not([data-mgroup]):has(> td.m-right) { display: block !important; position: relative; padding: 10px 14px !important; min-height: 0 !important; }
  table.stack.has-pick tbody tr:not([data-mgroup]):has(> td.m-right) { padding-left: 48px !important; }
  table.stack tbody tr:has(> td.m-right) > td.m-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; float: right; margin: 0 0 2px 12px; padding: 0; white-space: nowrap; text-align: right; }
  table.stack tbody tr:has(> td.m-right) > td[data-m='amount'], table.stack tbody tr:has(> td.m-right) > td.m-status { display: none !important; }
  table.stack tbody tr:has(> td.m-right) > td[data-m='title'] { display: block !important; -webkit-line-clamp: unset; }
  table.stack tbody tr:has(> td.m-right) > td.m-sub:not(:empty) { display: block !important; margin-top: 2px; }
  table.stack tbody tr:has(> td.m-right) > td.m-flag:not(:empty), table.stack tbody tr:has(> td.m-right) > td[data-m='act'] { display: block !important; clear: both; }
  table.stack tbody tr:has(> td.m-right) > td[data-m='pick'] { position: absolute; left: 14px; top: 11px; }
  table.stack tbody tr:has(> td.m-right)::after { content: ''; display: block; clear: both; }
  .m-amt { font-weight: 600; }
  .m-amt[data-label]:not([data-sign])::before { content: attr(data-label) ' '; font-weight: 400; font-size: var(--text-xs); color: var(--text-3); }
  .m-amt[data-sign='neg']::before { content: attr(data-label) ' −'; font-weight: 400; font-size: var(--text-xs); color: var(--text-3); }
  .m-amt[data-sign='in'] { color: var(--money-in); } .m-amt[data-sign='in']::before { content: '+'; }
  .m-amt[data-sign='out']::before { content: '−'; }
  td.m-right .m-bal { font-size: var(--text-xs); color: var(--text-3); }
  td.m-right .m-date { font-size: var(--text-sm); color: var(--text-2); }
}
@media (max-width: 640px) { table.stack tr[data-mgroup] > td[data-m='title'] .sub { margin-left: 0 !important; } }
.list-table td.c-short .cell-in, .list-table .cell-in { width: auto !important; }

/* Round 17: money bar = the ledger on the left; the open items split by age, to scale, on the right */
.money-bar { display: grid; grid-template-columns: minmax(180px, 1fr) 3fr; gap: 8px 32px; align-items: start; }
.mb-ledger { display: grid; gap: 2px; padding-right: 24px; border-right: 1px solid var(--line); }
.mb-ledger strong { font-size: var(--text-2xl); }
.mb-open { display: grid; gap: 8px; }
.mb-open-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mb-open .mb-bar { margin-top: 0; }
.mb-legend { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: var(--text-sm); color: var(--text-2); }
.mb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mb-legend i { width: 10px; height: 10px; border-radius: 2px; }
.mb-legend .open i { background: var(--warning); } .mb-legend .late i { background: var(--danger); } .mb-legend .paid i { background: var(--success); }
.mb-legend strong { color: var(--text); }
.money-bar > .mb-note { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) {
  .money-bar { grid-template-columns: 1fr; gap: 6px; }
  .mb-ledger { border-right: 0; padding-right: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .mb-ledger strong { font-size: var(--text-lg); }
  .mb-open .mb-bar, .mb-open { display: grid !important; }
  .mb-legend .paid { display: none; }
  .mb-legend { font-size: var(--text-xs); gap: 2px 12px; }
}
/* Phone page header: title, main button and More on one line */
@media (max-width: 640px) {
  .page-head { flex-wrap: nowrap !important; align-items: center !important; margin-bottom: var(--sp-3) !important; gap: 8px; }
  .page-head > div:first-child { flex: 1 1 auto; min-width: 0; }
  .page-head h1 { font-size: var(--text-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-head .toolbar { width: auto !important; flex: none; flex-wrap: nowrap; }
  .page-head .toolbar > :is(button, .btn) { min-height: 34px; padding: 5px 10px; font-size: var(--text-sm); }
  .page-head .toolbar > :is(button, .btn):not(.icon-btn):not(.more-btn) > svg { display: none; }
  .page-head.record-head { flex-wrap: wrap !important; }
  .page-head.ph-wrap { flex-wrap: wrap !important; }
  .page-head.ph-wrap h1 { white-space: normal; overflow: visible; }
  .page-head.ph-wrap .toolbar { width: 100% !important; }
  main > p.sub:first-of-type { display: none; }
}
details.pull-summary > summary { display: none; list-style: none; cursor: pointer; }
@media (max-width: 640px) {
  details.pull-summary > summary { display: flex; gap: 8px; align-items: center; }
  details.pull-summary > summary::after { content: '▾'; margin-left: auto; color: var(--text-3); }
  details.pull-summary:not([open]) { padding: 10px 14px; }
}
@media (max-width: 640px) { .page-hint { display: none; } }
.nav-head-row { display: flex; align-items: center; justify-content: space-between; }
button.nav-edit { min-height: 0; width: 22px; height: 22px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--nav-dim); border-radius: var(--r-xs); }
button.nav-edit:hover { background: var(--nav-hover); color: #fff; }
.nav-tip { display: flex; gap: 6px; align-items: flex-start; margin: 2px 4px 6px; padding: 8px 10px; border-radius: var(--r-sm); background: rgba(255,255,255,.07); color: var(--nav-text); font-size: var(--text-xs); line-height: 1.4; }
.nav-tip button.link { color: var(--brand-200); font-size: inherit; padding: 0; }
button.nav-tip-x { min-height: 0; padding: 0 2px; border: 0; background: none; box-shadow: none; color: var(--nav-dim); font-size: 16px; line-height: 1; }
.cm-handle { cursor: grab; color: var(--text-3); letter-spacing: -2px; padding: 0 6px 0 0; user-select: none; }
ol.cm-pins li.dragging { opacity: .4; } ol.cm-pins li.drop { box-shadow: inset 0 2px 0 var(--accent); }
@media (max-width: 640px) {
  .mb-open .mb-bar { display: flex !important; }
  table.stack tfoot td { border: 0 !important; box-shadow: none !important; }
}
@media (max-width: 640px) {
  /* Compact money bar on phones: ledger, then open invoices with what's over 30 days, then the note */
  .money-bar { padding: 10px 12px; gap: 4px; }
  .mb-ledger .sub { display: none; }
  .mb-ledger .mb-label::after { content: ' (ledger)'; text-transform: none; letter-spacing: 0; font-weight: 500; }
  .mb-open { gap: 4px; }
  .mb-open-head .sub, .mb-open .mb-bar, .mb-legend .open { display: none !important; }
  .mb-open-head { display: inline-flex; }
  .mb-open { display: flex !important; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .mb-note { font-size: var(--text-xs); line-height: 1.4; margin: 2px 0 0 !important; }
  /* Filter bar: search and one dropdown on one line, the count under it */
  .filter-bar { display: grid !important; grid-template-columns: 1fr auto; gap: 8px; }
  .filter-bar > .fb-search { width: auto !important; }
  .filter-bar > select { width: auto !important; max-width: 140px; }
  .filter-bar > .grow { display: none; }
  .filter-bar > .fb-count, .filter-bar > label.check { grid-column: 1 / -1; }
  .filter-bar > .fb-count { font-size: var(--text-xs); }
}

/* Round 18: the menu list scrolls between the fixed header and footer, with a fade when there's more */
.nav { overflow: hidden; }
.nav-top, .nav-foot { flex: none; }
.nav-scroll { flex: 1 1 auto; min-height: 0; padding-bottom: 20px; }
.nav-scroll.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
@media (max-width: 640px) {
  .page-head h1 { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.2; }
  details.pull-summary { margin-bottom: var(--sp-3); }
  .mb-legend .open { display: inline-flex !important; }
}
/* Round 18: the growing column is the only one without a width; its text box adds nothing to the table's sizing
   (width 0, filling its cell), so it takes exactly the space left after every other column fits its content. */
@media (min-width: 641px) {
  .list-table th.c-name, .list-table td.c-name { width: auto !important; max-width: none !important; min-width: 170px !important; }
  .list-table td.c-name .cell-in { width: 0 !important; min-width: 100% !important; max-width: none !important; }
}
@media (min-width: 641px) {
  .list-table > table[style*='fixed'] td.c-name .cell-in, .list-table > table[style*='fixed'] .cell-in { width: auto !important; min-width: 0 !important; max-width: none !important; }
  .list-table > table[style*='fixed'] td { overflow: hidden; }
}
.list-table td.cust-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Round 19 */
.nav-scroll.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent); }
td.total-label { white-space: nowrap; }
@media (max-width: 640px) {
  .page-head { flex-wrap: wrap !important; }
  .page-head > div:first-child { flex: 1 0 auto; }
  .page-head h1 { white-space: nowrap !important; }
}
.nav-foot .nav-customize { margin: 0 0 4px; }
@media (max-width: 640px) {
  td.m-right .m-st { display: inline-flex; gap: 6px; align-items: center; }
  table.stack td[data-m='title'] .tag, table.stack td[data-m='title'] span.sub.nowrap { display: none !important; }
  table.stack tbody tr:has(> td.m-right) { padding-top: 8px !important; padding-bottom: 8px !important; }
}
.list-table > table[style*='px'] { width: auto; } .list-table:has(> table[style*='width']) { background: var(--surface); }
@media (max-width: 640px) { td.m-right .m-st { flex-direction: row; } }

/* Round 21 */
.list-table > table { width: 100% !important; }
.list-table th.tail, .list-table td.tail { padding: 0 !important; }
.list-table td.c-id, .list-table th.c-id { white-space: nowrap; }
.page-hint { margin: 0 0 var(--sp-3); }
@media (max-width: 640px) {
  table.stack td.tail { display: none !important; }
  table.stack td[data-m='act'] .kebab { display: none; }
  table.stack td[data-m='act'] .row-actions { justify-content: flex-start; padding-top: 6px; }
  table.stack td[data-m='act'] .row-actions > :first-child { min-height: 30px; }
}
@media (min-width: 641px) { .list-table .c-dropped { display: none !important; } }
/* Round 22: the top of the menu (Home, Daily) stays put; All pages scrolls under it */
.nav-lists { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.nav .nav-fixed { flex: none; list-style: none; margin: 0; padding: 4px 10px 0; display: grid; gap: 1px; }
.nav-lists > .nav-scroll { flex: 1 1 auto; min-height: 60px; }
.nav-scroll.more-above:not(.more-below) { -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.35), #000 10px); mask-image: linear-gradient(to bottom, transparent, #000 16px); }
.nav-scroll.more-above.more-below { -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.35), #000 10px, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
.nav-fixed .nav-head:first-of-type { margin-top: 10px; }
.nav-scroll > ul > .nav-head:first-child { margin-top: 8px; }
/* The menu's scroll always rests on a whole item */
@media (max-width: 640px) {
  main .chips { -webkit-mask-image: none; mask-image: none; }
  main .chips.more-right { -webkit-mask-image: linear-gradient(to right, #000 70%, transparent 98%); mask-image: linear-gradient(to right, #000 70%, transparent 98%); }
  main .chips.more-left { -webkit-mask-image: linear-gradient(to right, transparent 2%, #000 22%); mask-image: linear-gradient(to right, transparent 2%, #000 22%); }
  main .chips.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent 2%, #000 18%, #000 72%, transparent 98%); mask-image: linear-gradient(to right, transparent 2%, #000 18%, #000 72%, transparent 98%); }
  /* Record transaction detail lines: two lines at most, ending in … */
  table.stack tbody tr:has(> td.m-right) > td.m-sub:not(:empty) { display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  /* Filter rows: search (and its dropdown) on top; Show inactive and the count share the next line */
  .filter-bar > label.check { grid-column: 1 / 2 !important; }
  .filter-bar > label.check + .grow + .fb-count, .filter-bar > label.check ~ .fb-count { grid-column: 2 / 3 !important; justify-self: end; align-self: center; }
  .filter-bar:not(:has(> select)) > .fb-search { grid-column: 1 / -1; }
}
.nav .nav-fixed > .nav-head:last-child { margin: 14px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--nav-line); }
.nav .nav-head { margin-top: 16px; }
.skel-table td { height: 46px; }
.money-bar { min-height: 120px; }
@media (max-width: 640px) {
  .money-bar { min-height: 0; }
  /* Chip rows wrap on a phone, so every tab is in sight */
  main .chips { flex-wrap: wrap !important; overflow: visible; margin-left: 0; margin-right: 0; padding: 0; -webkit-mask-image: none !important; mask-image: none !important; }
  main .chips .chip { min-height: 30px; padding: 3px 10px; }
}
@media (max-width: 640px) { .incoming-search { width: 100%; min-width: 0 !important; } }

/* Round 24: on short screens the part of the menu that stays put uses tighter 30px rows. */
.nav-compact .nav-fixed a { min-height: 30px; padding-top: 4px; padding-bottom: 4px; }
.nav-compact .nav-fixed .nav-head { margin-top: 8px; }
.nav-compact .nav-fixed .nav-item.nav-apart { margin-top: 4px; padding-top: 4px; }
.nav-compact .nav-fixed > .nav-head:last-child { margin-top: 8px; padding-bottom: 4px; }
.nav-scroll { scroll-padding-top: 8px; }
/* The open group's heading sticks to the top of the scrolling menu, so a page deep in a long group still shows which group it is in. */
.nav-scroll .nav-block > .nav-section[aria-expanded='true'] { position: sticky; top: -4px; z-index: 2; background: var(--nav-bg); }
/* Round 24: tab chips become one picker on phones. */
.chip-pick { display: none; }
@media (max-width: 640px) {
  main .chips[role='tablist'] { display: none !important; }
  .chip-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; margin: 0 0 10px; max-width: 100%;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); font-size: var(--text-sm); font-weight: 500; }
  .chip-pick-k { color: var(--text-2); font-weight: 400; }
  .chip-pick-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip-pick svg { flex: none; color: var(--text-2); }
}
.menu .menu-item.on { font-weight: 600; color: var(--brand-700, var(--text)); }
.menu .menu-count { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
/* Round 24: a phone row's main action is a small pill at the right of its second line, under the amount. */
@media (max-width: 640px) {
  table.stack tbody tr.m-inline-act:has(> td.m-right) > td[data-m='act'] { display: block !important; float: right; clear: right; margin: 6px 0 0 12px; padding: 0 !important; width: auto; }
  table.stack tbody tr.m-inline-act > td[data-m='act'] .row-actions { padding-top: 0; gap: 0; justify-content: flex-end; }
  table.stack tbody tr.m-inline-act > td[data-m='act'] :is(button, a.btn):not(.kebab) { min-height: 32px; padding: 3px 12px; border-radius: 999px; font-size: var(--text-sm); line-height: 1.2; white-space: nowrap; }
  table.stack tbody tr.m-inline-act > td.m-sub:not(:empty) { margin-top: 4px; }
  table.stack tbody tr.m-inline-act > td.m-sub .pill { margin-right: 4px; padding: 0 7px; font-size: var(--text-xs); }
}
/* Round 24: one phone page header everywhere. Line 1: title and (i). Line 2: the main button (stretched) and More. */
@media (max-width: 640px) {
  main .page-head:not(.record-head) { flex-wrap: wrap !important; align-items: center !important; gap: 10px !important; }
  main .page-head:not(.record-head) > div:first-child { flex: 1 1 100% !important; }
  main .page-head:not(.record-head) > .toolbar { width: 100% !important; flex: 1 1 100% !important; display: flex; flex-wrap: nowrap; gap: 8px; padding-top: 0; }
  main .page-head:not(.record-head) > .toolbar:empty { display: none; }
  main .page-head:not(.record-head) > .toolbar > :is(button, .btn, .split-btn):first-child { flex: 1 1 auto; justify-content: center; min-height: 40px; }
  main .page-head:not(.record-head) > .toolbar > :is(button, .btn, .split-btn):not(:first-child) { flex: none; min-height: 40px; }
}
/* Round 24: the action column lines up: buttons right-aligned, a gap where a row has no ⋯. */
.kebab-gap { display: inline-block; width: 28px; height: 1px; flex: none; }
td.act-col .row-actions { display: flex; justify-content: flex-end; }
@media (max-width: 640px) { .kebab-gap { display: none; } }
/* Round 24: list pages load in their own shape. */
.list-skeleton { display: block; }
.list-skeleton .skel-btn { display: inline-block; height: 36px; border-radius: var(--r-sm); }
.list-skeleton .skel-btn.primary { background: var(--brand-100); }
.list-skeleton .skel-field { display: inline-block; height: 36px; border-radius: var(--r-sm); }
.list-skeleton .filter-bar { margin-bottom: 12px; }
@media (max-width: 640px) { .list-skeleton .skel-btn:not(:first-child):not(:last-child) { display: none; } .list-skeleton .skel-field { width: 48% !important; } }
@media (max-width: 640px) {
  .skel-table thead { display: none; }
  .skel-table td { display: none; height: auto; }
  .skel-table td.pick, .skel-table td:nth-child(2), .skel-table td.skel-amt { display: table-cell; padding-top: 18px; padding-bottom: 18px; }
  .skel-table td.num { width: 30%; }
  .skel-table td:nth-child(2) .skel-line::after { content: ''; }
}
@media (max-width: 640px) {
  .list-skeleton .page-head .skel-sub { display: none; }
  .list-skeleton .page-head .toolbar > .skel-btn:first-child { flex: 1 1 auto; width: auto !important; height: 40px; }
  .list-skeleton .page-head .toolbar > .skel-btn:last-child:not(:first-child) { width: 96px !important; height: 40px; }
  .skel-table table { width: 100%; table-layout: fixed; min-width: 0 !important; }
  .skel-table td.pick { width: 44px; }
  .list-skeleton .filter-bar { display: flex; gap: 8px; }
}
@media (max-width: 640px) { .list-skeleton .filter-bar > .skel-field { display: block !important; flex: 1 1 0; width: auto !important; } }
@media (max-width: 640px) { .chip-pick[aria-expanded='true'], .chip-pick:active { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); } .chip-pick[aria-expanded='true'] .chip-pick-k { color: var(--text-2); } }

/* Round 25: the menu's scrolling part. Cues (a fade and a small chevron) over an edge with more of the menu beyond it. */
.nav-scroll-wrap { position: relative; flex: 1 1 auto; min-height: 60px; display: flex; flex-direction: column; }
.nav-scroll-wrap > .nav-scroll { flex: 1 1 auto; min-height: 0; -webkit-mask-image: none !important; mask-image: none !important; }
.nav-cue { position: absolute; left: 0; right: 8px; height: 14px; display: flex; justify-content: center; pointer-events: none; opacity: 0; transition: opacity .15s; color: var(--nav-dim); z-index: 3; }
.nav-cue.up { top: 0; align-items: flex-start; background: linear-gradient(to bottom, var(--nav-bg) 30%, transparent); }
.nav-cue.up svg { transform: rotate(180deg); }
.nav-cue.down { bottom: 0; align-items: flex-end; background: linear-gradient(to top, var(--nav-bg) 30%, transparent); }
.nav-scroll-wrap.more-above > .nav-cue.up, .nav-scroll-wrap.more-below > .nav-cue.down { opacity: 1; }
/* The sticky group heading sits under the top cue's chevron: push the cue's chevron to the right edge then. */
.nav-scroll-wrap.more-above > .nav-cue.up { justify-content: flex-end; padding-right: 6px; background: none; }
/* Footer: you, then Customize menu and Help as small buttons. */
.nav .nav-foot { display: flex; align-items: center; gap: 2px; }
.nav .nav-foot > .user-btn { flex: 1 1 auto; min-width: 0; }
.nav .nav-foot-btn { flex: none; width: 30px; min-height: 30px; color: var(--nav-dim); background: none; border: 0; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; }
.nav .nav-foot-btn:hover { color: #fff; background: var(--nav-hover); }
/* The first-run tip is one line. */
.nav-tip { align-items: center; padding: 4px 8px; margin: 0 4px 4px; white-space: nowrap; }
.nav-tip > span { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.nav-cue.down svg { transform: rotate(90deg); }
.nav-cue.up svg { transform: rotate(-90deg); }
.nav-scroll-wrap { flex: 0 1 auto; }
.nav-lists { justify-content: flex-start; }
.nav-scroll-wrap { box-sizing: border-box; padding-bottom: 14px; }
.nav-scroll-wrap > .nav-scroll { padding-bottom: 0 !important; }
/* Round 25: a long part of a phone row's grey line (a memo) wraps by word and ends in an ellipsis, never cut mid-word. */
@media (max-width: 640px) { table.stack td.m-sub .m-part.m-long { white-space: normal; } table.stack td.m-sub { text-overflow: ellipsis; word-break: normal; overflow-wrap: break-word; } }
/* Round 25: phone rows. Pills are small (28px, 13px text) with a bigger tap area; idle rows show no button. */
@media (max-width: 640px) {
  table.stack tbody tr.m-idle > td[data-m='act'], table.stack tbody tr.m-idle:has(> td.m-right) > td[data-m='act'] { display: none !important; }
  table.stack tbody tr.m-inline-act > td[data-m='act'] :is(button, a.btn):not(.kebab) { min-height: 28px !important; height: 28px; padding: 0 11px !important; font-size: 13px !important; position: relative; }
  table.stack tbody tr.m-inline-act > td[data-m='act'] :is(button, a.btn):not(.kebab)::after { content: ''; position: absolute; inset: -6px -4px; }
  table.stack tbody tr.m-inline-act > td[data-m='act'] { margin-top: 4px; }
  table.stack tbody tr:has(> td.m-right) { padding-top: 9px !important; padding-bottom: 9px !important; }
}
/* Round 25: the phone money bar keeps "Paid out, last 30 days" as one short line, as on a computer. */
@media (max-width: 640px) { .mb-legend .paid { display: inline-flex !important; flex-basis: 100%; white-space: nowrap; } }
/* Round 26: Orders. On a phone the row's first line is the customer and what they asked for. */
.m-item { display: none; }
@media (max-width: 640px) { table.stack td[data-m='title'] .m-item { display: inline; color: var(--text-2); font-weight: 400; } }
/* Round 26: grey-line parts are whole units ("· Dec 1, 2026"); a long memo may wrap inside itself. */
@media (max-width: 640px) { table.stack td.m-sub .m-part:not(.m-long) { display: inline-block; white-space: nowrap; } }
/* Round 26: a record's transactions on a phone leave out the running balance, so the details get the width. */
@media (max-width: 640px) { td.m-right .m-bal, td.m-status .m-bal { display: none !important; } }
/* Round 26: a filter bar under a card (Invoices' To pull) sits the same distance below it as under the money bar. */
main :is(.panel, details.panel, .pull-summary):not([hidden]) + .filter-bar { margin-top: var(--sp-4); }
/* Round 27: a phone row with a button is a two-line grid: name | amount, then the grey line | the button. The grey line
   is one line, cut with …, so the button always sits at the right of line 2, in the same place on every row. */
@media (max-width: 640px) {
  table.stack tbody tr.m-inline-act:has(> td.m-right), table.stack.has-pick tbody tr.m-inline-act.m-inline-act.m-inline-act:has(> td.m-right) { display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; grid-template-rows: auto !important; grid-template-areas: "title right" "sub act" "flag flag" !important; column-gap: 12px; row-gap: 4px; align-items: center; }
  table.stack tbody tr.m-inline-act:has(> td.m-right)::after { display: none; }
  table.stack tbody tr.m-inline-act > td.m-right { grid-area: right; float: none !important; margin: 0 !important; align-self: start; }
  table.stack tbody tr.m-inline-act > td[data-m='title'] { grid-area: title; min-width: 0; }
  table.stack tbody tr.m-inline-act > td.m-sub { grid-area: sub; display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-width: 0; margin: 0 !important; white-space: normal; overflow: hidden; }
  table.stack tbody tr.m-inline-act > td.m-sub:empty { display: block !important; }
  table.stack tbody tr.m-inline-act > td.m-sub .m-part { display: inline; white-space: nowrap; }
  table.stack tbody tr.m-inline-act:has(> td.m-right) > td[data-m='act'] { grid-area: act; float: none !important; clear: none !important; margin: 0 !important; justify-self: end; }
  table.stack tbody tr.m-inline-act > td.m-flag { grid-area: flag; }
}
@media (max-width: 640px) { table.stack tbody tr.m-inline-act:has(> td.m-right) > td[data-m='pick'] { grid-area: auto !important; } }
/* Round 27: one container on wide screens. Pages sit in a centered column (--content-max), and the top bar's search and
   buttons line up with that column's edges. */
@media (min-width: 641px) {
  main { margin-left: auto; margin-right: auto; }
  .topbar { padding-left: max(var(--sp-8), calc((100% - var(--content-max)) / 2 + var(--sp-8))); padding-right: max(var(--sp-8), calc((100% - var(--content-max)) / 2 + var(--sp-8))); }
}
/* ════════════════════════════════════════════════════════════════════════════
   Report document (P&L, balance sheet, trial balance, transaction detail)
   .rpt-filters  the period and filter bar      .rpt-bar   Customize, Favorites, exports
   .rpt-doc      the document card: .rpt-head (business, .rpt-title, .rpt-period, .rpt-meta),
                 .rpt-tools (collapse), .rpt-scroll (scrolls both ways; sticky header row and
                 first column), table.rpt, .rpt-foot (generated on)
   table.rpt rows: tr.r-group-head (caret + name), tr.r-acct, tr.r-subtotal (ruled above),
                 tr.r-net (shaded), tr.r-grand (double rule), tr.r-check (balance check)
   ════════════════════════════════════════════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rpt-filters { align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.rpt-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-2); }
.rpt-field > span:first-child { letter-spacing: .02em; }
.rpt-dates { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.rpt-dates input[type=text] { width: 112px; }
.rpt-bar { align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.rpt-doc.narrow { max-width: 1100px; margin-left: auto; margin-right: auto; }
.rpt-scroll-wrap { position: relative; }
.rpt-scroll-wrap::after, .rpt-scroll-wrap::before { content: ''; position: absolute; top: 0; bottom: 0; width: 36px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 4; }
.rpt-scroll-wrap::after { right: 0; background: linear-gradient(to left, var(--surface), rgba(255,255,255,0)); }
.rpt-scroll-wrap.more-right::after { opacity: 1; }
.rpt-more { display: none; position: absolute; top: 8px; right: 6px; z-index: 5; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); color: var(--text); align-items: center; justify-content: center; }
.rpt-scroll-wrap.more-right > .rpt-more { display: inline-flex; }
.rpt-print-split { display: none; }
.rpt-colpick { display: none; }
.rpt-summary-row > .grow { flex: 1; }
.rpt-fit-btn[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--brand-200); }
table.rpt.rpt-compact :is(th, td) { padding: 3px 6px; font-size: var(--text-xs); }
table.rpt.rpt-compact td.num { min-width: 0; }
table.rpt.rpt-compact tbody th { min-width: 200px; width: 200px; }
table.rpt.rpt-compact thead th { font-size: 11px; letter-spacing: .02em; white-space: normal; }
table.rpt.rpt-compact thead th:first-child { width: 200px; }
table.rpt.rpt-compact .rpt-parent { display: none; }
table.rpt.rpt-compact tr.r-grand > :is(th, td) { font-size: var(--text-sm); }
.cz .cz-dates { margin-top: var(--sp-3); }
.rpt-parent { color: var(--text-3); font-size: var(--text-sm); }
iframe.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.rpt-ties { margin-top: var(--sp-2); display: flex; gap: var(--sp-2); justify-content: center; align-items: center; flex-wrap: wrap; font-weight: 600; }
.rpt-ties .pill { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.rpt-hidden-note { margin: var(--sp-3) var(--sp-4); }
.entry-ref { margin-top: -6px; }
.rpt-filter-label { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.rpt-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.rpt-head { text-align: center; padding: var(--sp-6) var(--sp-6) var(--sp-5); border-bottom: 1px solid var(--line); }
.rpt-co { font-size: var(--text-lg); color: var(--text-2); }
.rpt-title { font-size: var(--text-2xl); font-weight: 700; margin: 4px 0 2px; letter-spacing: -.01em; }
.rpt-period { color: var(--text); font-size: var(--text-md); }
.rpt-meta { margin-top: var(--sp-2); display: flex; gap: var(--sp-2); justify-content: center; align-items: center; flex-wrap: wrap; font-size: var(--text-sm); color: var(--text-3); }
.rpt-meta .pill { display: inline-flex; align-items: center; gap: 2px; }
.rpt-crumbs { font-size: var(--text-sm); color: var(--text-3); margin-bottom: var(--sp-2); }
.rpt-tools { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rpt-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.rpt-float { position: fixed; z-index: 25; overflow: hidden; background: var(--surface); box-shadow: 0 2px 6px rgba(16, 32, 26, .10); }
.rpt-float table.rpt { table-layout: fixed; }
.rpt-float table.rpt thead th { position: static; }
.rpt-float table.rpt thead th:first-child { position: sticky; left: 0; }
.rpt-summary { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; font-weight: 500; color: var(--text); }
.rpt-summary-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin: calc(var(--sp-2) * -1) 0 var(--sp-3); }
.rpt-summary-text { display: block; white-space: normal; text-align: left; min-width: 0; }
.menu-empty { margin: 4px 12px 8px; max-width: 260px; font-size: var(--text-sm); color: var(--text-2); }
.rpt-summary-text > span + span { margin-left: 6px; }
.rpt-bar { flex-wrap: nowrap; }
.rpt-bar > :not(.rpt-summary):not(.grow) { flex: none; }
.rpt-summary-text .dot { color: var(--text-3); }
.rpt-summary[aria-expanded='true'] > svg { transform: rotate(180deg); }
.rpt-fav-tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: 600; color: var(--warning-text); background: var(--warning-bg); border-radius: var(--r-full); padding: 2px 10px; }
.rpt-fav-tag[hidden] { display: none; }
.rpt-filters { padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.rpt-note { margin-top: 4px; font-size: var(--text-sm); color: var(--text-2); font-style: italic; }
.attach-preview { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.attach-preview > span { flex: 1; }
.entry-edit-note { display: flex; align-items: center; gap: var(--sp-3); justify-content: space-between; }
.rpt-scroll:focus-visible { outline-offset: -2px; }
.rpt-loading { padding: var(--sp-5) var(--sp-6); display: grid; gap: var(--sp-4); }
.rpt-foot { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--text-3); }
table.rpt { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
table.rpt :is(th, td) { padding: 6px var(--sp-4); border-bottom: 0; background: var(--surface); white-space: nowrap; font-size: var(--text-md); }
table.rpt thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: right; vertical-align: bottom; padding-top: var(--sp-3); padding-bottom: var(--sp-2);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); box-shadow: inset 0 -1px 0 var(--line-strong); }
table.rpt thead th.calc { color: var(--text-3); }
table.rpt thead .th-sub { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-3); margin-top: 2px; }
table.rpt tbody th { position: sticky; left: 0; z-index: 1; text-align: left; font-weight: 400; white-space: nowrap; min-width: 320px; color: var(--text); }
table.rpt td.good, table.rpt td.pct.good { color: var(--success-text); }
table.rpt td.bad, table.rpt td.pct.bad { color: var(--danger-text); }
table.rpt td.neg, table.rpt td.neg a { color: var(--danger-text); }
table.rpt thead th:first-child { left: 0; z-index: 3; text-align: left; width: 100%; }
table.rpt td.num { min-width: 112px; }
table.rpt td.pct { color: var(--text-2); min-width: 80px; }
table.rpt td.zero { color: var(--text-3); }
table.rpt tbody tr:hover > :is(td, th) { background: var(--brand-50); }
table.rpt .rpt-caret { min-height: 22px; width: 22px; height: 22px; padding: 0; margin: -2px 4px -2px 0; vertical-align: middle; color: var(--text-2); }
table.rpt a.rpt-amt { color: inherit; font-weight: inherit; text-decoration: none; border-bottom: 1px dotted transparent; }
table.rpt a.rpt-amt:hover, table.rpt a.rpt-amt:focus-visible { color: var(--accent-text); border-bottom-color: currentColor; text-decoration: none; }
table.rpt tr.r-group-head > th { font-weight: 600; padding-top: 10px; }
table.rpt tr.r-group-head.r-top > th { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: var(--text-sm); padding-top: var(--sp-4); }
table.rpt tr.r-group-closed > :is(th, td) { font-weight: 600; }
table.rpt tr.r-empty-line > th { color: var(--text-3); font-style: italic; }
table.rpt tr.r-subtotal > :is(th, td) { font-weight: 600; padding-bottom: 10px; }
table.rpt tr.r-subtotal > td.num { box-shadow: inset 0 1px 0 var(--gray-400); }
table.rpt tr.r-subtotal.r-top > :is(th, td) { font-weight: 700; }
table.rpt tr.r-net > :is(th, td) { font-weight: 700; background: var(--surface-sunk); padding-top: 9px; padding-bottom: 9px; }
table.rpt tr.r-net > td.num { box-shadow: inset 0 1px 0 var(--gray-500); }
table.rpt tr.r-grand > :is(th, td) { font-weight: 700; font-size: var(--text-lg); }
table.rpt tr.r-grand > td.num { box-shadow: inset 0 1px 0 var(--text), inset 0 -4px 0 -1px var(--surface), inset 0 -5px 0 -1px var(--text); padding-bottom: 12px; }
table.rpt tr.r-net + tr > :is(th, td), table.rpt tr.r-subtotal.r-top + tr > :is(th, td) { padding-top: var(--sp-3); }
table.rpt tr.r-check > :is(th, td) { font-size: var(--text-sm); color: var(--text-2); border-top: 1px dashed var(--line-strong); padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); }
table.rpt tr.r-check .pill { display: inline-flex; align-items: center; gap: 2px; }
table.rpt tr.r-muted > :is(th, td) { color: var(--text-2); }
table.rpt.rpt-detail tbody th { min-width: 0; font-weight: 400; white-space: nowrap; }
table.rpt.rpt-detail tr.r-group-head > th { font-weight: 700; padding-top: var(--sp-3); }
table.rpt.rpt-detail td.memo { white-space: normal; min-width: 180px; max-width: 360px; }
table.rpt.rpt-detail thead th:not(.num) { text-align: left; }
table.rpt.rpt-detail thead th:first-child { width: auto; }
table.rpt.rpt-detail td.memo { width: 100%; }
.cz { display: grid; gap: var(--sp-5); }
.cz h3 { margin: 0 0 var(--sp-2); font-size: var(--text-md); }
.cz section + section { border-top: 1px solid var(--line); padding-top: var(--sp-4); }
.cz-choices { display: flex; flex-direction: column; gap: 2px; }
.cz label.check { display: flex; margin: 4px 0; }
.cz-indent { display: flex; gap: var(--sp-5); padding-left: 26px; }
.cz-label { margin: var(--sp-3) 0 2px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.fav-list { list-style: none; padding: 0; margin: 0; }
.fav-row { display: grid; gap: var(--sp-2); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) {
  .rpt-bar { display: flex !important; flex-wrap: wrap; align-items: center; }
  .rpt-bar > * { width: auto !important; flex: 1 1 auto; }
  .rpt-bar > .rpt-period-pick { flex: 1 1 100%; }
  .rpt-filters[hidden] { display: none !important; }
  .rpt-summary { font-size: var(--text-sm); }
  .rpt-bar > .grow, .rpt-bar > .rpt-fav-tag { display: none; }
  .rpt-filters { display: grid !important; grid-template-columns: 1fr; }
  .rpt-head { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
  .rpt-title { font-size: var(--text-xl); }
  table.rpt :is(th, td) { padding: 6px 10px; font-size: var(--text-sm); }
  .rpt-colpick { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); margin-left: auto; }
  .rpt-colpick select { width: auto; max-width: 52vw; min-height: 32px; padding-top: 2px; padding-bottom: 2px; }
  .rpt-tools { flex-wrap: wrap; }
  table.rpt { --rpt-indent: 8px; }
  table.rpt tbody th { width: 45vw; min-width: 45vw; max-width: 45vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--line); }
  table.rpt tbody th .rpt-label { white-space: nowrap; }
  table.rpt tbody th.show-all, table.rpt tbody th.show-all .rpt-label { white-space: normal; overflow: visible; }
  table.rpt .rpt-caret { margin-right: 2px; }
  table.rpt.rpt-detail tbody th { width: auto; min-width: 0; max-width: none; }
  .rpt-float table.rpt thead th:first-child { min-width: 0; }
  table.rpt.phone-one .pc-hide { display: none; }
  /* Transaction detail on a phone: one list row each (date · name, then type and memo; amount and running total right) */
  table.rpt.rpt-detail, table.rpt.rpt-detail > tbody { display: block; width: 100%; }
  table.rpt.rpt-detail > thead { display: none; }
  table.rpt.rpt-detail tbody tr { display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; row-gap: 2px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
  table.rpt.rpt-detail tbody tr > * { padding: 0 !important; position: static; white-space: normal; min-width: 0; max-width: none; width: auto; box-shadow: none; background: none; }
  table.rpt.rpt-detail tbody tr:not(.r-acct) > * { grid-column: 1 / 3; }
  table.rpt.rpt-detail tbody tr:not(.r-acct) > td.num { grid-column: 3; grid-row: 1; }
  table.rpt.rpt-detail tbody tr:not(.r-acct) > td.num:last-child { grid-row: 2; }
  table.rpt.rpt-detail tbody tr:not(.r-acct) > td:empty, table.rpt.rpt-detail tbody tr:not(.r-acct) > td.num:empty { display: none; }
  table.rpt.rpt-detail .c-date { grid-area: 1 / 1; font-weight: 500; white-space: nowrap !important; }
  table.rpt.rpt-detail tbody tr:hover > * { background: none !important; }
  table.rpt.rpt-detail tbody tr:hover { background: var(--brand-50); }
  table.rpt.rpt-detail .c-date::after { content: ' ·'; color: var(--text-3); }
  table.rpt.rpt-detail .c-name { grid-area: 1 / 2; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }
  table.rpt.rpt-detail .c-type { grid-area: 2 / 1; font-size: var(--text-xs); color: var(--text-2); white-space: nowrap !important; }
  table.rpt.rpt-detail .c-memo { grid-area: 2 / 2; font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }
  table.rpt.rpt-detail .c-no { display: none; }
  table.rpt.rpt-detail .c-amt { grid-area: 1 / 3; font-weight: 600; }
  table.rpt.rpt-detail .c-run { grid-area: 2 / 3; font-size: var(--text-xs); }
  /* Account names on a phone, everywhere: up to two lines, then … (tap to see it all) */
  table.rpt:not(.rpt-detail) tbody th { white-space: normal !important; }
  table.rpt:not(.rpt-detail) tbody th .rpt-label { white-space: normal; display: -webkit-inline-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; vertical-align: middle; max-width: calc(100% - 26px); }
  table.rpt:not(.rpt-detail) tbody th .rpt-label { width: calc(100% - 26px); }
  table.rpt:not(.rpt-detail) tbody th:not(:has(.rpt-caret)) .rpt-label { width: 100%; max-width: 100%; }
  table.rpt.rpt-tb tbody th { padding-left: 16px !important; }
  table.rpt:not(.rpt-detail) tbody th.show-all .rpt-label { -webkit-line-clamp: unset; }
  table.rpt:is(.phone-one, .rpt-fit) tbody th { position: static; width: auto; min-width: 0; max-width: none; white-space: normal; overflow: visible; box-shadow: none; }
  table.rpt:is(.phone-one, .rpt-fit) tbody th .rpt-label { white-space: normal; display: -webkit-inline-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; vertical-align: middle; max-width: calc(100% - 26px); }
  table.rpt:is(.phone-one, .rpt-fit) thead th:first-child { position: static; width: auto; }
  table.rpt:is(.phone-one, .rpt-fit) :is(td.num, th.num) { min-width: 0; width: auto; padding-left: 4px; padding-right: 8px; }
  table.rpt:is(.phone-one, .rpt-fit) tbody th { padding-right: 4px; }
  table.rpt tr.r-grand > :is(th, td) { font-size: var(--text-md); }
  table.rpt.rpt-tb td.num { min-width: 0; padding-left: 6px; }
  .rpt-parent { display: none; }
  table.rpt td.num { min-width: 92px; }
  .rpt-tools .sub { display: none; }
}
@media print {
  @page { margin: 0.5in 0.5in 0.6in; @bottom-right { content: 'Page ' counter(page) ' of ' counter(pages); font: 8pt sans-serif; color: #666; } }
  @page rpt-wide { size: letter landscape; margin: 0.5in 0.5in 0.6in; @bottom-right { content: 'Page ' counter(page) ' of ' counter(pages); font: 8pt sans-serif; color: #666; } }
  .rpt-doc.print-landscape { page: rpt-wide; }
  .rpt-doc.print-split > .rpt-scroll-wrap { display: none; }
  .rpt-doc.print-split > .rpt-print-split { display: block; }
  .rpt-split-page + .rpt-split-page { break-before: page; }
  .rpt-split-cap { font-size: 9pt; color: #555; margin: 0 0 4px; }
  .rpt-scroll-wrap::after, .rpt-more, .rpt-hidden-note { display: none !important; }
  table.rpt tr.r-acct:not(.r-first) .cur { display: none; }
  table.rpt tr.r-subtotal > td.num, table.rpt tr.r-net > td.num { box-shadow: none !important; border-top: 0.75pt solid #444 !important; }
  table.rpt tr.r-grand > td.num { box-shadow: none !important; border-top: 0.75pt solid #000 !important; border-bottom: 2.5pt double #000 !important; }
  .rpt-parent { display: none; }
  .neg-auto .neg-sign { display: none; }
  .neg-auto::before { content: '('; }
  .neg-auto::after { content: ')'; }
  table.rpt tbody th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 200px; min-width: 200px; max-width: 200px; }
  table.rpt.rpt-detail tbody th { width: auto; min-width: 0; max-width: none; }
  .rpt-float { display: none !important; }
  table.rpt tbody th { box-shadow: none !important; min-width: 0; }
  table.rpt :is(th, td) { background: none !important; }
  table.rpt thead th { box-shadow: none !important; border: 0 !important; border-bottom: 1px solid #555 !important; }
  .rpt-head { border-bottom: 0; }
  .rpt-doc.narrow { max-width: none; }
  .rpt-doc { border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .rpt-scroll { max-height: none; overflow: visible; }
  .rpt-head { padding-top: 0; }
  table.rpt thead { display: table-header-group; }
  table.rpt thead th, table.rpt tbody th { position: static; }
  table.rpt tr { break-inside: avoid; }
  table.rpt tr.r-group-head { break-after: avoid; }
  table.rpt :is(th, td) { font-size: calc(10pt * var(--pz, 1)); padding: calc(3px * var(--pz, 1)) calc(6px * var(--pz, 1)); }
  table.rpt thead th { font-size: calc(8pt * var(--pz, 1)) !important; }
  table.rpt tr.r-group-head.r-top > th { font-size: calc(9pt * var(--pz, 1)); }
  table.rpt tr.r-grand > :is(th, td) { font-size: calc(11pt * var(--pz, 1)); }
  table.rpt { --rpt-indent: calc(14px * var(--pz, 1)); }
  table.rpt td.num, table.rpt td.pct { min-width: 0; }
  .rpt-split-page table.rpt tbody th { min-width: 200px; }
  table.rpt thead th:first-child { width: auto; }
  table.rpt .rpt-caret { display: none; }
  table.rpt a.rpt-amt { border: 0; }
  .rpt-foot { border-top: 1px solid #999; }
}
/* ── Order / invoice form ────────────────────────────────────── */
.inv-drafts { margin: 0 0 var(--sp-4); padding: var(--sp-2) var(--sp-4); background: var(--info-bg); border: 1px solid var(--info-line); border-radius: var(--r-md); font-size: var(--text-sm); }
.inv-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); min-width: 0; }
.inv-form > .panel { margin: 0; }
.inv-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: var(--sp-6); background: linear-gradient(var(--brand-50), var(--surface) 70%); }
.inv-top-cust { display: grid; gap: var(--sp-3); align-content: start; }
.inv-top-cust .combo { max-width: 460px; }
.inv-cust-input { font-size: var(--text-lg); font-weight: 600; min-height: 42px; }
.inv-cust-info { display: grid; gap: var(--sp-2); }
.inv-cust-tags { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.inv-cust-dl, .inv-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--sp-4); margin: 0; font-size: var(--text-sm); }
.inv-cust-dl dt, .inv-dl dt { color: var(--text-3); font-weight: 600; }
.inv-cust-dl dd, .inv-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.inv-top-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4); align-content: start; }
.inv-top-meta .inv-no { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.inv-no span { color: var(--text-2); font-size: var(--text-sm); font-weight: 600; }
.inv-no strong { font-size: var(--text-2xl); font-variant-numeric: tabular-nums; }
.inv-top-meta input[type=date] { width: 100%; }
.inv-lines-panel { padding: 0; overflow: visible; }
.inv-lines-wrap { border: 0; box-shadow: none; overflow: visible; border-radius: var(--r-lg) var(--r-lg) 0 0; }
table.inv-lines { width: 100%; }
table.inv-lines th.ln, table.inv-lines td.ln { width: 34px; text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; }
table.inv-lines td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
table.inv-lines td.prod { width: 34%; }
table.inv-lines td.desc input { width: 100%; }
table.inv-lines input.qty { width: 76px; }
table.inv-lines input.money { width: 96px; }
table.inv-lines input.typed { background: var(--warning-bg); border-color: var(--warning-line); }
table.inv-lines td.line-amt { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 96px; }
table.inv-lines th.rm, table.inv-lines td.rm { width: 40px; }
table.inv-lines tr.empty input:disabled { background: transparent; border-color: transparent; }
table.inv-lines tr.empty .combo-input { border-style: dashed; }
.inv-keg-head td { background: var(--surface-sunk); border-top: 1px solid var(--line); padding: 8px 10px; }
.inv-keg-toggle { display: inline-flex; gap: var(--sp-2); align-items: center; font-size: var(--text-sm); cursor: pointer; }
.inv-keg-toggle span { color: var(--text-2); }
.inv-keg-rows tr.keg td { background: var(--surface-2); }
.inv-lines-tools { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }
.inv-bottom { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: var(--sp-4); align-items: start; }
.inv-bottom > .panel { margin: 0; }
.inv-notes { display: grid; gap: var(--sp-4); }
.inv-notes textarea { width: 100%; resize: vertical; }
.inv-notes .field { display: grid; gap: 5px; }
.field-label { font-size: var(--text-sm); font-weight: 600; color: var(--gray-700); }
.inv-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--text-sm); }
.inv-files li { display: flex; gap: var(--sp-2); align-items: center; }
.inv-files .file-btn, .inv-notes .file-btn { justify-self: start; }
.inv-totals { display: grid; gap: var(--sp-2); font-variant-numeric: tabular-nums; }
.inv-tot-row { display: flex; justify-content: space-between; gap: var(--sp-4); font-size: var(--text-md); color: var(--text-2); }
.inv-tot-row strong { color: var(--text); font-weight: 600; }
.inv-tot-row.grand { margin-top: var(--sp-2); padding-top: var(--sp-3); border-top: 2px solid var(--text); color: var(--text); font-weight: 700; font-size: var(--text-lg); }
.inv-tot-row.grand strong { font-size: var(--text-3xl); font-weight: 700; }
.danger-text { color: var(--danger-text); }
.ellipsis { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ── Journal entry form and page ─────────────────────────────── */
.je-top { display: grid; grid-template-columns: minmax(180px, 220px) minmax(180px, 260px); gap: var(--sp-4); align-items: start; background: linear-gradient(var(--brand-50), var(--surface) 70%); }
.je-top input { width: 100%; }
table.je-lines { width: 100%; }
table.je-lines th.ln, table.je-lines td.ln { width: 34px; text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; }
table.je-lines td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
table.je-lines td.acct { width: 30%; min-width: 220px; }
table.je-lines td.desc input { width: 100%; }
table.je-lines td.name { width: 18%; min-width: 150px; }
table.je-lines input.money { width: 120px; }
table.je-lines th.rm, table.je-lines td.rm { width: 40px; }
table.je-lines td.more { display: none; }
table.je-lines :is(td.num, td.desc, td.name) input::placeholder { color: transparent; }
/* A spreadsheet-like grid: cells ruled, fields borderless until pointed at or typed in. */
table.je-lines tbody td:not(.ln):not(.rm) { border-left: 1px solid var(--line); padding-left: 4px; padding-right: 4px; }
table.je-lines tbody :is(input, .combo-input) { border-color: transparent; background: transparent; box-shadow: none; }
table.je-lines tbody tr:hover :is(input, .combo-input) { border-color: var(--line); background: var(--surface); }
table.je-lines tbody :is(input, .combo-input):focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
table.je-lines tbody tr:not(.empty) .combo-caret, table.je-lines tbody tr.empty .combo-caret { opacity: .5; }
table.je-lines tbody td.acct .combo-input { font-weight: 500; }
table.je-lines tr.empty td.rm button { visibility: hidden; }
table.je-lines tr.je-needs td.acct .combo-input { border-color: var(--danger); }
table.je-lines input.bad, .je-top input.bad { border-color: var(--danger); background: var(--danger-bg); }
table.je-lines tfoot td { background: var(--surface-sunk); padding-top: 10px; padding-bottom: 10px; font-variant-numeric: tabular-nums; }
table.je-lines tfoot td.num { padding-right: 22px; }
.je-side { font-weight: 400; }
.je-bar-total { gap: var(--sp-2) var(--sp-3); }
.je-bar-total em { font-style: normal; font-weight: 700; font-size: var(--text-sm); padding: 2px 10px; border-radius: var(--r-full); }
.je-bar-total em.ok { background: var(--success); color: #fff; }
.je-bar-total em.off { background: var(--danger); color: #fff; }
.je-rules h3 { margin: 0 0 var(--sp-2); font-size: var(--text-sm); }
.je-rules ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: var(--text-sm); color: var(--text-2); }
.je-status-line { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.je-page { margin-top: var(--sp-2); }
.je-main { display: grid; gap: var(--sp-3); min-width: 0; }
.je-main > .panel { margin: 0; }
.je-h { margin: var(--sp-2) 0 0; font-size: var(--text-lg); }
table.je-view { width: 100%; }
table.je-view td.ln, table.je-view th.ln { width: 34px; color: var(--text-3); text-align: center; }
table.je-view tfoot td { background: var(--surface-sunk); }
@media (max-width: 640px) {
  .je-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
  table.je-lines thead { display: none; }
  table.je-lines, table.je-lines tbody, table.je-lines tfoot { display: block; width: 100%; min-width: 0 !important; }
  table.je-lines tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: relative; }
  table.je-lines td { display: block; padding: 0; border: 0; width: auto !important; min-width: 0 !important; }
  table.je-lines td.ln { display: none; }
  table.je-lines tbody td:not(.ln):not(.rm) { border-left: 0; padding: 0; }
  table.je-lines tbody :is(input, .combo-input) { border-color: var(--line-strong); background: var(--surface); }
  table.je-lines td.acct { grid-column: 1 / -1; padding-right: 36px; }
  table.je-lines td.desc, table.je-lines td.name { grid-column: auto; }
  table.je-lines td.rm { position: absolute; right: 8px; top: 10px; }
  table.je-lines input.money { width: 100%; }
  table.je-lines :is(td.num, td.desc, td.name) input::placeholder { color: var(--text-3); }
  table.je-lines tfoot tr { grid-template-columns: 1fr auto auto; align-items: center; background: var(--surface-sunk); }
  table.je-lines tfoot td:first-child { display: none; }
  table.je-lines tfoot td { background: none; padding: 0 !important; }
  table.je-lines tfoot td[colspan] { grid-column: 1 / -1; }
  table.je-lines tr:not(.open) td.desc, table.je-lines tr:not(.open) td.name { display: none; }
  table.je-lines td.more { display: block; grid-column: 1 / -1; }
  table.je-lines td.more button { padding: 0; }
  /* Room under the grid so the sticky bar never sits over the totals. */
  .je-form { padding-bottom: var(--sp-8); }
  .je-form .inv-lines-panel { scroll-margin-bottom: 200px; }
  table.je-lines tfoot td { border: 0 !important; }
}
@media print {
  .je-page { grid-template-columns: minmax(0, 1fr); }
  .je-page .inv-side { display: none; }
}

/* ── Invoice page ────────────────────────────────────────────── */
.inv-page-head h1 { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.inv-status { font-size: var(--text-sm); line-height: 22px; padding: 1px 10px; }
.inv-actions button svg, .inv-actions .btn svg { margin-right: 6px; }
.inv-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-5); align-items: start; }
.inv-doc { min-width: 0; }
.inv-doc-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.inv-doc-bar h2 { margin: 0; font-size: var(--text-lg); }
.inv-doc-bar .segmented { margin-left: auto; }
.inv-preview .sheet { margin: 0; box-shadow: var(--shadow-md); border-radius: var(--r-sm); }
.inv-side { display: grid; gap: var(--sp-4); position: sticky; top: var(--sp-4); }
.side-card { margin: 0; display: grid; gap: var(--sp-2); }
.side-card h3 { margin: var(--sp-2) 0 0; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.side-card h3:first-child { margin-top: 0; }
.inv-money-row { display: flex; justify-content: space-between; color: var(--text-2); font-variant-numeric: tabular-nums; }
.inv-money-row strong { color: var(--text); }
.inv-money-row.big { padding-top: var(--sp-2); border-top: 1px solid var(--line); font-weight: 700; color: var(--text); align-items: baseline; }
.inv-money-row.big strong { font-size: var(--text-3xl); color: var(--money-in); }
.inv-money-row.big.owed strong { color: var(--text); }
.side-card > .btn { justify-self: start; }
.inv-pays { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.inv-pays li { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--sp-3); font-size: var(--text-sm); }
.inv-pays li .sub { grid-column: 1; }
.inv-pays li strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-variant-numeric: tabular-nums; }
.inv-pays button.link { text-align: left; padding: 0; }
.activity { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: var(--sp-3); border-left: 2px solid var(--line); }
.activity li { display: grid; gap: 1px; position: relative; font-size: var(--text-sm); }
.activity li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-300); }
.activity .act-meta { color: var(--text-3); font-size: var(--text-xs); }
.activity li.act-email_failed .act-what { color: var(--danger-text); }
.inv-print { display: none; }
.narrow-only { display: none; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: var(--text-sm); line-height: 1.45; }
.inv-parties .sh-label { margin-bottom: 2px; }
.inv-parties .link { display: inline-flex; align-items: center; gap: 4px; padding: 0; margin-top: 2px; }
.inv-addr-edit { align-self: start; }
.inv-notes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.inv-notes > .field:last-child { grid-column: 1 / -1; }
.sh-mark { display: inline-block; margin-left: 12px; padding: 2px 9px; border: 2px solid #1f6a50; border-radius: 4px; font-size: 13px; letter-spacing: .1em; vertical-align: 5px; color: #1f6a50; }
.sh-mark.void { border-color: #9b2615; color: #9b2615; }
.sh-none { color: #8a948f; font-style: italic; }
.sheet .sh-how.sh-paid-full { color: #1f6a50; font-weight: 700; font-size: 13px; }
.sh-details dd, .sh-details dt { white-space: nowrap; }
.pill.sm { font-size: 11px; line-height: 16px; padding: 0 6px; margin-left: 6px; }

/* Email dialog: fields beside the email as the customer sees it */
dialog.email-dlg { width: min(1080px, 96vw); }
.email-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--sp-5); }
.email-fields { display: grid; gap: var(--sp-3); align-content: start; }
.email-fields input, .email-fields textarea { width: 100%; }
.email-attach { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--text-sm); }
.email-look { display: grid; gap: 5px; align-content: start; }
iframe.email-preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--r-md); background: #f3f5f4; }
.email-log summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-2); }

/* ── Printed invoice and packing slip (.sheet) ──────────────── */
.sheet .sh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.sheet .sh-title { font: 700 26px/1 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: #1f6a50; margin-bottom: 4px; }
.sheet .sh-top .copy { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #555; }
.sheet .sh-top .logo { max-width: 130px; max-height: 96px; margin: 0; }
.sheet .biz { margin-top: 8px; }
.sh-band { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 18px; padding: 14px 16px; margin-bottom: 18px; background: #eef6f2; border-radius: 4px; font-size: 13px; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sh-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #5b6763; margin-bottom: 3px; }
.sh-party strong { display: block; font-size: 14px; }
.sh-details { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; align-content: start; }
.sh-details dt { color: #5b6763; }
.sh-details dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sheet table.sh-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet table.sh-lines th { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: #5b6763; border-bottom: 1.5px solid #161d1b; padding: 6px 8px; }
.sheet table.sh-lines td { padding: 7px 8px; border-bottom: 1px solid #e3e8e6; }
.sheet table.sh-lines .ln { width: 26px; color: #5b6763; text-align: left; }
.sheet table.sh-lines .tick { width: 60px; text-align: center; }
.sheet table.sh-lines tr.sh-group td { padding-top: 14px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #5b6763; border-bottom-color: #c9d2ce; }
.sheet table.sh-lines tfoot td { font-weight: 700; border-bottom: 0; background: none; }
.sh-bottom { display: grid; grid-template-columns: 1fr minmax(240px, 46%); gap: 24px; margin-top: 14px; align-items: start; }
.sh-msg-text, .sh-msg { white-space: pre-line; font-size: 13px; }
.slip-sheet .sh-msg { margin-top: 16px; }
.sheet table.sh-totals { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet table.sh-totals td { padding: 4px 8px; border: 0; background: none; }
.sheet table.sh-totals tr.sh-total td { border-top: 1.5px solid #161d1b; font-weight: 700; font-size: 14px; padding-top: 7px; }
.sheet table.sh-totals tr.sh-paid td { color: #4f5b57; font-size: 12px; }
.sheet table.sh-totals tr.sh-due td { background: #eef6f2; color: #1f6a50; font-weight: 700; font-size: 16px; padding: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .thanks { margin: 30px 0 4px; }
.sheet .sh-how { text-align: center; font-size: 11px; color: #5b6763; margin: 4px 0 0; }
.sh-kegs { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; margin-top: 16px; padding: 12px 14px; border: 1px solid #c9d2ce; border-radius: 4px; font-size: 13px; }
.sh-blanks { display: flex; gap: 16px; flex-wrap: wrap; }
.sh-blanks .blank { display: inline-block; width: 42px; border-bottom: 1px solid #161d1b; height: 14px; vertical-align: bottom; }
.sheet .sig { margin-top: 44px; gap: 28px; }

@media print {
  main:has(> .inv-print) > :not(.inv-print) { display: none !important; }
  main > .inv-print { display: block; }
  .inv-print .sheet.skip-print { display: none !important; }
}

@media (max-width: 980px) {
  .inv-page { grid-template-columns: minmax(0, 1fr); }
  .inv-side { position: static; }
  .inv-top, .inv-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wide-only { display: none !important; }
  .narrow-only { display: inline; }
  .inv-parties { grid-template-columns: 1fr 1fr; }
  .inv-addr-edit { grid-column: 1 / -1; justify-self: start; }
  .inv-notes { grid-template-columns: minmax(0, 1fr); }
  .inv-actions { flex-wrap: nowrap; }
  table.inv-lines tr.empty { grid-template-columns: minmax(0, 1fr) 64px 80px; align-items: center; }
  table.inv-lines tr.empty td.desc, table.inv-lines tr.empty td.line-amt, table.inv-lines tr.empty td.rm { display: none; }
  table.inv-lines tr.empty td.prod { grid-column: auto; padding-right: 0; }
  table.inv-lines tr.empty input:disabled { border: 1px dashed var(--line-strong); }
  table.inv-lines input::placeholder { color: var(--text-3); }
  .inv-form { padding-bottom: var(--sp-2); }
  .steps { padding: var(--sp-3); overflow-x: auto; }
  .step { padding-right: var(--sp-2); min-width: 78px; }
  .step-note { font-size: var(--text-xs); }
  .inv-top { gap: var(--sp-4); }
  .inv-top-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .inv-top-meta input[type=date] { min-width: 0; }
  table.inv-lines thead { display: none; }
  table.inv-lines, table.inv-lines tbody { display: block; min-width: 0 !important; width: 100%; }
  .inv-lines-wrap { overflow: visible; }
  table.inv-lines tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.inv-lines td { display: block; padding: 0; border: 0; width: auto !important; }
  table.inv-lines td.ln { display: none; }
  table.inv-lines td.prod, table.inv-lines td.desc { grid-column: 1 / -1; }
  table.inv-lines td.rm { position: absolute; right: 8px; }
  table.inv-lines tr { position: relative; }
  table.inv-lines td.prod { padding-right: 36px; }
  table.inv-lines input.qty, table.inv-lines input.money { width: 100%; }
  table.inv-lines td.line-amt { align-self: center; text-align: right; }
  table.inv-lines .inv-keg-head tr { display: block; }
  table.inv-lines tr.keg td.desc { grid-column: 1 / -1; }
  .kbd-hint { display: none; }
  .form-bar { margin-left: calc(-1 * var(--sp-4)); margin-right: calc(-1 * var(--sp-4)); border-radius: 0; padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
  .form-bar-total { margin-left: 0; order: -1; flex: 1; justify-content: flex-start; gap: var(--sp-3); }
  .form-bar-left { order: 0; }
  .form-bar-right { margin-left: 0; width: 100%; }
  .form-bar-right { flex-wrap: nowrap; gap: 6px; }
  .form-bar-right > * { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; font-size: var(--text-sm); white-space: normal; line-height: 1.15; }
  .form-bar-left > * { padding: 4px 8px; min-height: 0; font-size: var(--text-sm); }
  table.inv-lines tr.keg td.num { background: none; align-self: center; text-align: right; }
  /* The preview reflows for a phone; the PDF menu has the page as it prints. */
  .inv-preview .sheet { padding: 18px 16px; font-size: 14px; }
  .inv-preview .sh-top { gap: 12px; }
  .inv-preview .sh-top .logo { max-width: 64px; max-height: 64px; }
  .inv-preview .sheet .sh-title { font-size: 20px; }
  .inv-preview .sh-band { grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; font-size: 13px; }
  .inv-preview .sh-details { grid-column: 1 / -1; border-top: 1px solid #c9d2ce; padding-top: 8px; }
  .inv-preview .sh-details dd { text-align: left; }
  .inv-preview table.sh-lines { font-size: 13px; }
  .inv-preview table.sh-lines th { font-size: 11px; padding: 6px 4px; }
  .inv-preview table.sh-lines td { padding: 7px 4px; }
  .inv-preview table.sh-lines .ln { display: none; }
  .inv-preview .sh-bottom { grid-template-columns: 1fr; gap: 12px; }
  .inv-preview .sh-kegs { grid-template-columns: 1fr; }
  .inv-preview .sheet .sig { flex-direction: column; gap: 28px; }
  .inv-preview .sheet .sh-how { font-size: 12px; }
  .email-cols { grid-template-columns: 1fr; }
  iframe.email-preview { height: 380px; }
}
.inv-top-meta label.field { align-content: start; }
html:has(.form-bar) { scroll-padding-bottom: 96px; }
.notice.email-warn { display: block; } .notice.email-warn .inline-check { justify-content: flex-start; width: auto; } .notice.email-warn .inline-check input { width: auto; margin: 0; }

/* Grouped money checks on Home: a small table of the items */
.mini-table { width: 100%; margin-top: 6px; font-size: var(--text-xs); border-collapse: collapse; }
.mini-table th { text-align: left; font-weight: 600; color: var(--text-2); padding: 2px 4px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tr.clickable { cursor: pointer; } .mini-table tr.clickable:hover td { background: var(--surface-2); }
.mini-table .down { color: var(--money-out); }
table.summary tr.in-group td { background: var(--warning-bg); }
table.summary tr.focus td { background: var(--warning-bg); box-shadow: inset 0 1px 0 var(--warning-line), inset 0 -1px 0 var(--warning-line); }
table.summary tr.focus td { outline: 2px solid var(--warning); outline-offset: -2px; }
table.summary tr.focus td:first-child { box-shadow: inset 3px 0 0 var(--warning), inset 0 1px 0 var(--warning-line), inset 0 -1px 0 var(--warning-line); }

.biz-table td:first-child { min-width: 9.5em; }
.biz-table td:first-child a strong { white-space: nowrap; }
.dash-card.folded > header { align-items: flex-start; }
.dash-card.folded > header h3 { min-width: 0; }

/* Grouped to-do rows: the items open on their own full-width line, scrolling inside if needed */
.dash-row.grouped { grid-template-columns: minmax(0, 1fr) auto; }
.dash-row.grouped > .row-details-body { grid-column: 1 / -1; min-width: 0; }
.mini-wrap { max-width: 100%; overflow-x: auto; }
.row-toggle { padding: 0; text-align: left; }
.mini-table td a { color: inherit; }
.menu.bell-menu { overflow-x: hidden; }
.bell-menu .dash-row { min-width: 0; }
[data-card='attention'] .dash-row > div:first-child > .sub { cursor: default; }
/* "More" on a computer: a tidy grid of same-height bars */
@media (min-width: 641px) { .dash-more .dash-card.folded { min-height: 52px; } }
[data-card='attention'] .dash-row > div:first-child > .sub.full { display: block; -webkit-line-clamp: unset; overflow: visible; }

/* Overview: names and accounts truncate with an ellipsis instead of breaking */
[data-card='cash'] .dash-row > div:first-child > div:first-child, [data-card='reviewAll'] .dash-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-table td.num, .biz-table th.num { white-space: nowrap; }

/* Masonry: a card stretched to end level fills with its own background */
@media (min-width: 641px) { .dash-grid.packed > .dash-card.stretched { align-self: stretch; margin-bottom: var(--sp-4); } }
.bell-menu > .dash-list, .bell-menu > div > .small.sub:first-child { padding-left: 10px; padding-right: 10px; }

/* ── Bills: enter a bill, the bill page, Pay bills, Print checks ─────────────
   .bill-dlg (wide bill form: .bill-layout = .bill-main + .bill-side receipt pane), .vendor-card,
   .att-drop / .att-view / .att-list (a receipt or PDF and its preview), .bill-page (.bp-main + .bp-side),
   .panel-head (h2 + an action), ol.timeline (activity), .pay-head / .pay-total / .pay-table / .pay-foot,
   .print-setup / .voucher-key (Print checks). */
dialog.panel.bill-dlg { max-width: min(1180px, calc(100vw - 32px)); }
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-6); align-items: start; }
.bill-main > * + * { margin-top: var(--sp-4); }
.bill-top { display: flex; gap: var(--sp-6); align-items: flex-start; }
.bill-who { flex: 1; min-width: 0; }
.bill-who label.field > input { width: 100%; }
.bill-amount { text-align: right; flex: none; }
.bill-amount .mb-label { display: block; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.bill-big { display: block; font-size: var(--text-4xl); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.bill-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.bill-fields .field > :is(input, select) { width: 100%; }
.vendor-card { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-sunk); font-size: var(--text-sm); color: var(--text-2); }
.vendor-card .vc-name { font-weight: 600; color: var(--text); }
.vendor-card .vc-credit { color: var(--info-text); font-weight: 600; }
.warn-text { color: var(--warning-text); }
.warn-text svg { vertical-align: -2px; }
.bill-lines th.ln, .bill-lines td.ln { width: 28px; color: var(--text-3); text-align: center; padding-left: 6px; padding-right: 0; }
.bill-lines td.act, .bill-lines th.act { width: 40px; padding-left: 0; }
.bill-under { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-2) !important; }
.bill-under .add-line { margin: 0; }
.bill-side { position: sticky; top: 0; }
.att-drop { display: grid; justify-items: center; gap: 6px; padding: var(--sp-8) var(--sp-4); min-height: 280px; align-content: center; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.att-drop:hover, .att-pane.drag .att-drop { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.att-drop input[type=file], .file-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.att-view { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface-sunk); }
.att-view .att-img { display: block; width: 100%; max-height: 520px; object-fit: contain; background: var(--surface-sunk); }
.att-view .att-pdf { display: block; width: 100%; height: 460px; border: 0; background: #fff; }
.att-list { list-style: none; margin: var(--sp-2) 0; padding: 0; display: grid; gap: 4px; font-size: var(--text-sm); }
.att-list li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.att-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.att-pane .file-btn { position: relative; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.panel-head h2 { margin: 0; font-size: var(--text-lg); }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > .panel-head { padding: var(--sp-4) var(--sp-5) 0; }
.panel.flush > .table-wrap { border: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); }
.panel.flush > p.pad { padding: 0 var(--sp-5) var(--sp-4); margin: 0; }
.panel.att-panel > p.pad { margin: 0; }
.row-links { display: inline-flex; gap: var(--sp-3); white-space: nowrap; }
.bill-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-5); align-items: start; }
.bp-main, .bp-side { display: grid; gap: var(--sp-4); min-width: 0; }
.bill-page h2 { font-size: var(--text-lg); margin: 0 0 var(--sp-3); }
ol.timeline { list-style: none; margin: 0; padding: 0; }
ol.timeline li { position: relative; display: flex; gap: var(--sp-3); padding: 0 0 var(--sp-4); }
ol.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 4px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
ol.timeline .tl-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--brand-400); box-shadow: 0 0 0 3px var(--accent-soft); }
ol.timeline strong { font-weight: 600; font-size: var(--text-md); }
.pill.sm { font-size: 11px; padding: 0 6px; margin-left: 8px; vertical-align: 1px; }

.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-6); background: var(--surface-2); }
.pay-fields { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: flex-start; }
.pay-fields .field > :is(input, select) { min-width: 180px; }
.pay-fields .help { margin-top: 4px; font-size: var(--text-sm); color: var(--text-2); font-weight: 400; }
.pay-total { text-align: right; }
.pay-total .mb-label { display: block; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.pay-big { display: block; font-size: var(--text-4xl); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pay-foot { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.pay-foot .grow { flex: 1; }
.pay-foot-info { color: var(--text-2); font-size: var(--text-sm); }
.pay-foot .foot-total { margin: 0; }
.filter-bar .chips { margin: 0; }

.print-setup { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--sp-4); align-items: stretch; margin-bottom: var(--sp-4); }
.print-setup > .panel { margin: 0; }
.print-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.print-fields .field > :is(input, select) { width: 100%; }
.print-fields .help { display: block; margin-top: 4px; font-weight: 400; color: var(--text-2); font-size: var(--text-sm); }
.print-actions { margin-top: var(--sp-4); align-items: center; }
.print-actions .grow { flex: 1; }
.voucher-key { display: flex; gap: var(--sp-4); align-items: flex-start; }
.voucher-key p { margin: 4px 0 0; }
.vk-sheet { flex: none; width: 74px; height: 96px; display: grid; grid-template-rows: 1fr 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); overflow: hidden; }
.vk-sheet > div { display: grid; place-items: center; font-size: 9px; color: var(--text-2); border-bottom: 1px dashed var(--line-strong); }
.vk-sheet > div:last-child { border-bottom: 0; }
.vk-check { background: var(--accent-soft); color: var(--accent-text) !important; font-weight: 700; }
.print-queue td.chk-no { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-text); }

@media (max-width: 1100px) {
  .bill-layout, .bill-page, .print-setup { grid-template-columns: 1fr; }
  .bill-side { position: static; }
  .att-drop { min-height: 0; padding: var(--sp-5); }
}
@media (max-width: 640px) {
  .bill-top { flex-direction: column-reverse; gap: var(--sp-2); }
  .bill-amount { text-align: left; }
  .bill-big, .pay-big { font-size: var(--text-3xl); }
  .bill-fields { grid-template-columns: 1fr 1fr; }
  .kbd-hint { display: none; }
  .bill-lines table, .bill-lines tbody, .bill-lines tr { display: block; }
  .bill-lines thead { display: none; }
  .bill-lines tr { display: grid; grid-template-columns: 1fr 120px 36px; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
  .bill-lines td { display: block; padding: 0 !important; border: 0 !important; }
  .bill-lines td.ln { display: none; }
  .bill-lines td:nth-child(2) { grid-column: 1 / -1; }
  .bill-lines td:nth-child(3) { grid-column: 1 / 2; }
  .bill-lines tfoot { display: none; }
  .att-view .att-pdf { height: 300px; }
  .pay-head { flex-direction: column-reverse; gap: var(--sp-3); }
  .pay-total { text-align: left; }
  .pay-fields { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .pay-fields .field:first-child { grid-column: 1 / -1; }
  .pay-fields .field > :is(input, select) { min-width: 0; width: 100%; }
  .pay-foot { margin: var(--sp-3) calc(var(--sp-4) * -1) 0; border-radius: 0; border-left: 0; border-right: 0; padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .pay-foot-info { width: 100%; }
  .pay-foot .grow { display: none; }
  .pay-foot button { flex: 1; }
  .print-fields { grid-template-columns: 1fr; }
  .voucher-key { display: none; }
  .print-actions button { flex: 1; }
}
.dup-warn { margin: var(--sp-3) 0 0 !important; font-size: var(--text-sm); } .dup-warn svg { vertical-align: -2px; }
.bill-fields, .print-fields { align-items: start; }
.vc-section + .table-wrap, .vc-section + h2 { margin-top: var(--sp-4); }
.pay-chips { margin: var(--sp-4) 0 var(--sp-3); }
@media (max-width: 640px) {
  .pay-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: var(--sp-3) calc(var(--sp-4) * -1) var(--sp-2); padding: 0 var(--sp-4); }
  .pay-chips .chip { flex: none; }
}
@media (max-width: 640px) {
}
/* A/P and A/R aging: blank cells stay blank; on a phone each vendor is a card with its buckets. */
table.aging-table td.empty-cell { color: transparent; }
@media (max-width: 640px) {
  table.aging-table, table.aging-table tbody, table.aging-table tfoot { display: block; width: 100%; min-width: 0 !important; }
  table.aging-table thead { display: none; }
  table.aging-table tr { display: block; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  table.aging-table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0 !important; border: 0 !important; text-align: right; }
  table.aging-table td.ag-name { font-weight: 600; text-align: left; padding-bottom: 6px !important; }
  table.aging-table td.num::before { content: attr(data-label); color: var(--text-2); font-weight: 400; text-align: left; }
  table.aging-table td.empty-cell, table.aging-table td.num:empty { display: none; }
  table.aging-table td[data-label=Total] { border-top: 1px solid var(--line) !important; margin-top: 4px; padding-top: 6px !important; font-weight: 700; }
  table.aging-table tfoot tr { background: var(--surface-sunk); }
}
@media (max-width: 640px) {
  .pay-chips { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); padding-right: 40px; }
  dialog.panel.bill-dlg { max-width: 100%; }
}
/* ── Combo box: type to search, pick from a list (combo() in app.js) ──── */
.combo { position: relative; display: block; min-width: 0; }
.combo > input.combo-input { width: 100%; padding-right: 30px; }
.combo-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; display: flex; }
.combo-list { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(520px, 92vw); max-height: 300px; overflow: auto;
  margin: 0; padding: var(--sp-1); list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.combo-opt { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--sp-4); padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--text-md); line-height: 1.3; }
.combo-opt.on, .combo-opt:hover { background: var(--accent-soft); }
.combo-opt.on { box-shadow: inset 2px 0 0 var(--accent); }
.combo-hint { color: var(--text-2); font-size: var(--text-sm); font-variant-numeric: tabular-nums; text-align: right; }
.combo-sub { grid-column: 1 / -1; color: var(--text-3); font-size: var(--text-xs); }
.combo-new .combo-label { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 600; }
.combo-none { padding: 8px 10px; color: var(--text-3); font-size: var(--text-sm); }
.bill-who .combo { width: 100%; }
/* Aging report (A/P and A/R): the report frame, a name column, then equal-width figure columns. */
.aging-doc .rpt-tools { padding: var(--sp-3) var(--sp-6); }
.aging-scroll { overflow-x: auto; }
table.aging-table, table.aging-detail { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.aging-table th:first-child, table.aging-table td.ag-name { width: 28%; padding-left: var(--sp-6); }
table.aging-table th:last-child, table.aging-table td:last-child, table.aging-detail th:last-child, table.aging-detail td:last-child { padding-right: var(--sp-6); }
table.aging-table :is(th, td) { padding-top: 10px; padding-bottom: 10px; }
table.aging-table td.num, table.aging-detail td.num { font-variant-numeric: tabular-nums; }
table.aging-table td[data-label=Total], table.aging-table th:last-child { font-weight: 600; }
table.aging-table tfoot td, table.aging-detail tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }
table.aging-detail :is(th, td) { padding: 8px 12px; }
table.aging-detail th:first-child, table.aging-detail td:first-child { padding-left: var(--sp-6); }
table.aging-detail tr.ag-group th { text-align: left; padding-top: var(--sp-4); font-size: var(--text-md); background: var(--surface-2); }
table.aging-detail tr.ag-sub td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.inline-num { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-2); }
.inline-num input { width: 64px; }
@media (max-width: 640px) {
  .aging-doc .rpt-tools { padding: var(--sp-3); }
  table.aging-table { table-layout: auto; }
  table.aging-table td.ag-name { width: auto; padding-left: 0; }
  table.aging-table tfoot td { border-top: 0; }
  .aging-scroll { padding: var(--sp-3); }
  table.aging-detail, table.aging-detail tbody, table.aging-detail tfoot { display: block; }
  table.aging-detail thead { display: none; }
  table.aging-detail tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  table.aging-detail td, table.aging-detail th { display: block; padding: 0 !important; border: 0 !important; }
  table.aging-detail td:nth-child(n+2):not(:last-child) { font-size: var(--text-sm); color: var(--text-2); }
  table.aging-detail tbody tr:not(.ag-sub) td:nth-child(2)::before { content: 'Dated '; }
  table.aging-detail td[data-label='Due date']:not(:empty)::before { content: 'Due '; }
  table.aging-detail td.overdue-text::after { content: ' days late'; }
  table.aging-detail td[data-label=Column] { display: none; }
  table.aging-detail td:last-child { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
  table.aging-detail tr.ag-sub, table.aging-detail tfoot tr { display: flex; justify-content: space-between; }
}
@media (max-width: 640px) {
  .pay-fields .field:has(#pmethod), .pay-fields .field:has(#pref) { grid-column: 1 / -1; }
  .pay-chips { padding-right: 56px; }
}
.vendor-card .vc-nudge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: var(--r-full); background: var(--warning-bg); color: var(--warning-text); font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
#baddr { min-height: 0; }
.aging-note { margin: 0; padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.aging-detail tr.ag-credit td { color: var(--info-text); }
@media (max-width: 640px) { .aging-note { padding: var(--sp-3); } }
.recent-head { font-size: var(--text-lg); margin: var(--sp-6) 0 var(--sp-3); }
.recent-checks td.act-col { width: 1%; white-space: nowrap; } .recent-checks .row-links button { white-space: nowrap; }

/* Pay bills, grouped by vendor: a vendor row (name, open, credit to use), its bills, and a message row under a bill. */
.pay-table td { vertical-align: middle; }
.pay-table td.num input.money { width: 112px; min-width: 0; }
.pay-table input.money.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); color: var(--danger-text); }
.pay-table tr.pb-group td { background: var(--surface-2); border-top: 1px solid var(--line-strong); padding-top: 10px; padding-bottom: 10px; }
.pay-table tr.pb-group .name-link { font-weight: 600; }
.pay-table td.pb-gopen { font-weight: 600; }
.pay-table .pb-credit-in { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pay-table tr.pb-bill td.pb-ref { padding-left: var(--sp-6); }
.pay-table tr.pb-bill.on td { background: var(--accent-soft); }
.pay-table td.pb-due span + span { margin-left: 8px; }
.pay-table td.pb-pay .pb-left { margin-top: 3px; text-align: right; }
.pay-table td.pb-pay .pb-left:empty { display: none; }
.pay-table tr.pb-msg td { padding: 0 var(--sp-4) 10px; background: var(--accent-soft); }
.pb-msg-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 14px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--warning-bg); color: var(--warning-text); font-size: var(--text-sm); }
.pb-msg-in .link { font-weight: 600; }
.pb-noaddr { margin-left: 10px; }
@media (max-width: 640px) {
  .pay-table { border: 0; background: none; box-shadow: none; overflow: visible; }
  .pay-table table, .pay-table tbody { display: block; width: 100%; min-width: 0 !important; }
  .pay-table thead { display: none; }
  .pay-table tbody tr { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-top: 0; }
  .pay-table tbody td { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
  .pay-table tr.pb-group { margin-top: var(--sp-3); border-top: 1px solid var(--line-strong); border-radius: var(--r-md) var(--r-md) 0 0; background: var(--surface-2); grid-template-columns: 32px minmax(0, 1fr) auto; }
  .pay-table tr.pb-group td.pb-gname { grid-column: 2; }
  .pay-table tr.pb-group td.pb-gcredit { grid-column: 2 / -1; justify-self: end; }
  .pay-table tr.pb-group td.pb-gcredit:empty { display: none; }
  .pay-table tr.pb-bill { grid-template-areas: 'pick ref open' 'pick due due' 'pick pay pay'; }
  .pay-table tr.pb-bill.on { background: var(--accent-soft); }
  .pay-table tr.pb-bill td.pick { grid-area: pick; align-self: start; }
  .pay-table tr.pb-bill td.pb-ref { grid-area: ref; font-weight: 600; }
  .pay-table tr.pb-bill td.pb-date { display: none; }
  .pay-table tr.pb-bill td.pb-due { grid-area: due; font-size: var(--text-sm); color: var(--text-2); }
  .pay-table tr.pb-bill td.pb-open { grid-area: open; }
  .pay-table tr.pb-bill td.pb-pay { grid-area: pay; display: flex !important; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 8px; margin-top: 6px !important; }
  .pay-table tr.pb-bill td.pb-pay::before { content: 'Pay'; font-size: var(--text-sm); color: var(--text-2); }
  .pay-table tr.pb-bill td.pb-pay .pb-left { flex-basis: 100%; }
  .pay-table td.num input.money { width: 128px; }
  .pay-table tr.pb-msg { display: block; padding: 0 12px 10px; background: var(--accent-soft); }
  .pay-table tr.pb-msg[hidden] { display: none; }
  .pay-table tr.pb-msg td { display: block; }
  .pb-msg-in { justify-content: flex-start; }
  .pay-table tbody tr:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
}
.pay-table tr.pb-group .vc-nudge { white-space: nowrap; }
@media (max-width: 640px) {
  .pay-table tr.pb-group td.pb-gname { display: flex !important; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .pb-noaddr { margin-left: 0; }
  table.aging-detail tr.ag-group { display: block; }
  table.aging-detail tr.ag-group th { display: block; width: 100%; }
  table.aging-detail td[data-label=Column] { display: block !important; grid-column: 1 / -1; font-size: var(--text-sm); }
  table.aging-detail td[data-label='Days past due'] { grid-column: 1 / -1; }
  table.aging-detail td[data-label='Days past due']:not(:empty)::after { content: none; }
  .recent-checks, .recent-checks tbody { display: block; }
  .recent-checks thead { display: none; }
  .recent-checks tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .recent-checks td { display: block; padding: 0 !important; border: 0 !important; }
  .recent-checks td.act-col { grid-column: 1 / -1; width: auto; text-align: right; }
}
@media (max-width: 640px) {
  table.aging-detail td[data-label=Column] { display: none !important; }
  table.aging-detail td[data-label='Days past due'], table.aging-detail td[data-label='Days old'] { grid-column: 1 / -1; text-align: left; font-size: var(--text-sm); }
  table.aging-detail td.overdue-text::after { content: none; }
  .pay-table tr.pb-group td.pb-gopen { grid-column: 3; grid-row: 1; }
}
@media (max-width: 640px) { table.aging-detail tr.ag-group { padding: 0 !important; } table.aging-detail tr.ag-group th { padding: 10px 12px !important; } }
.check-to-addr { font-size: var(--text-md); line-height: 1.5; }
.recent-checks .row-links { gap: var(--sp-2); }
.bill-who label.field { display: block; width: 100%; }
.bill-who label.field > .combo { width: 100%; }
@media (max-width: 640px) {
  /* Pay bills vendor header: name and total on line 1, the address note on line 2, the credit box on line 3. */
  .pay-table tr.pb-group { position: relative; display: block !important; padding: 10px 12px 10px 44px; }
  .pay-table tr.pb-group td.pick { position: absolute; left: 12px; top: 12px; }
  .pay-table tr.pb-group td.pb-gname { display: block !important; padding-right: 110px !important; }
  .pay-table tr.pb-group td.pb-gopen { position: absolute; right: 12px; top: 10px; }
  .pay-table tr.pb-group .pb-noaddr { display: inline-flex; margin-top: 6px; }
  .pay-table tr.pb-group td.pb-gcredit { display: flex !important; justify-content: flex-end; margin-top: 8px !important; }
  .pay-table tr.pb-group td.pb-gcredit:empty { display: none !important; }
  /* Recently printed: one card per check. */
  .recent-checks { min-width: 0 !important; width: 100%; }
  .recent-checks tr { grid-template-columns: auto 1fr auto; grid-template-areas: 'no date amt' 'payee payee payee' 'act act act'; }
  .recent-checks td.chk-no { grid-area: no; }
  .recent-checks td:nth-child(2) { grid-area: date; color: var(--text-2); }
  .recent-checks td:nth-child(3) { grid-area: payee; }
  .recent-checks td.num { grid-area: amt; font-weight: 600; }
  .recent-checks td.act-col { grid-area: act; margin-top: 6px !important; }
  .recent-checks .row-links { display: flex; justify-content: flex-end; }
  .recent-checks .row-links button { flex: 1; }
  .bill-side, .bill-who { width: 100%; }
}
table.aging-detail tr.ag-credit td { color: inherit; }
table.aging-detail tr.ag-credit td:last-child, table.aging-detail tr.ag-credit td.ag-doc a { color: var(--info-text); }
table.aging-detail td.ag-doc { white-space: nowrap; }
/* The vendor note under the picker is a static line, not a menu. */
.vendor-card { background: none; padding: 0; margin-top: 6px; border-radius: 0; }
.pay-table th .sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.pay-table th[aria-sort=ascending] .sort-ind::after { content: '▲'; font-size: 9px; }
.pay-table th[aria-sort=descending] .sort-ind::after { content: '▼'; font-size: 9px; }
.chip.due-by { gap: 6px; padding-right: 4px; }
.chip.due-by input { height: 26px; padding: 0 6px; font-size: var(--text-sm); border-radius: var(--r-full); }

/* ════════════════════════════════════════════════════════════════════════════
   Reports center (#/reports)
   .rc-search    the find box          .rc-top    Favorites tiles + Recently run, side by side
   .rc-panel     a card                .rc-cats   the categories (details), two columns on a wide screen
   .rc-row       a report: .rc-link (.rc-name, .rc-desc) and its .rc-star
   ════════════════════════════════════════════════════════════════════════════ */
.rc-search { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4); margin-bottom: var(--sp-5); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: var(--text-3); }
.rc-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rc-search-input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; outline: none; background: transparent; font-size: var(--text-md); padding: 14px 0; }
.rc-basis { white-space: nowrap; }
.rc-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.rc-h { display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: var(--sp-3) var(--sp-5); font-size: var(--text-md); font-weight: 650; color: var(--text); border-bottom: 1px solid var(--line); }
.rc-h > svg { color: var(--text-3); flex: none; }
.rc-h3 { margin: var(--sp-3) var(--sp-5) 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.rc-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); align-items: start; }
.rc-favs .rc-h > svg { color: var(--warning); fill: var(--warning); }
.rc-tiles { list-style: none; margin: 0; padding: var(--sp-3); display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: var(--sp-3); }
.rc-tile { position: relative; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); transition: border-color .12s, background .12s; }
.rc-tile:hover { border-color: var(--brand-300); background: var(--brand-50); }
.rc-tile > a { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-3) 40px var(--sp-3) var(--sp-4); color: inherit; text-decoration: none; min-height: 100%; }
.rc-tile .rc-star { position: absolute; top: 6px; right: 6px; }
.rc-tile .rc-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-recent-list { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-5) var(--sp-3); }
.rc-recent-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.rc-recent-list li:last-child { border-bottom: 0; }
.rc-recent-list a { font-weight: 500; text-decoration: none; }
.rc-recent-list a:hover { text-decoration: underline; }
.rc-empty { margin: 0; padding: var(--sp-4) var(--sp-5); }
.rc-cats { columns: 2; column-gap: var(--sp-4); }
.rc-cats > .rc-cat { break-inside: avoid; display: block; margin-bottom: var(--sp-4); }
.rc-cat > summary { cursor: pointer; list-style: none; user-select: none; }
.rc-cat > summary::-webkit-details-marker { display: none; }
.rc-cat > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .12s; }
.rc-cat:not([open]) > summary { border-bottom: 0; }
.rc-cat:not([open]) > summary::after { transform: rotate(-45deg); }
.rc-count { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); background: var(--gray-100); border-radius: var(--r-full); padding: 1px 8px; }
.rc-list { list-style: none; margin: 0; padding: 0; }
.rc-row { display: flex; align-items: center; gap: var(--sp-2); padding-right: var(--sp-3); border-bottom: 1px solid var(--gray-100); }
.rc-row:last-child { border-bottom: 0; }
.rc-row:hover { background: var(--brand-50); }
.rc-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px var(--sp-5); color: inherit; text-decoration: none; }
.rc-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rc-name { font-weight: 600; color: var(--accent-text); }
.rc-link:hover .rc-name { text-decoration: underline; }
.rc-desc { font-size: var(--text-sm); color: var(--text-2); line-height: 1.35; }
.rc-cat-tag { align-self: flex-start; margin-top: 2px; font-size: var(--text-xs); color: var(--text-3); }
.rc-star { color: var(--gray-400); flex: none; }
.rc-star:hover { color: var(--warning); }
.rc-star.on { color: var(--warning); }
.rc-star.on svg { fill: currentColor; }
.report-tabs a.rt-all { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-text); }
@media (max-width: 900px) { .rc-top { grid-template-columns: minmax(0, 1fr); } .rc-cats { columns: 1; } }
@media (max-width: 640px) {
  .rc-search { padding: 0 var(--sp-3); margin-bottom: var(--sp-4); }
  .rc-basis { display: none; }
  .rc-tiles { grid-template-columns: minmax(0, 1fr); padding: var(--sp-2); gap: var(--sp-2); }
  .rc-h { padding: var(--sp-3) var(--sp-4); }
  .rc-link { padding: 10px var(--sp-4); }
  .rc-recent-list { padding: var(--sp-1) var(--sp-4) var(--sp-2); }
}

/* ════════════════════════════════════════════════════════════════════════════
   General ledger (table.gl-table) and audit log (table.audit-table), inside a .rpt-doc
   gl rows: tr.gl-acct (caret, account, line count; totals when folded), tr.gl-begin, tr.gl-line (opens the entry),
   tr.gl-total (ruled above), tfoot tr.gl-grand (double rule). td.gl-phone is the one-cell line on a phone.
   ════════════════════════════════════════════════════════════════════════════ */
table.gl-table, table.audit-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.gl-table :is(th, td), table.audit-table :is(th, td) { padding: 7px 10px; text-align: left; vertical-align: top; font-size: var(--text-sm); }
table.gl-table thead th, table.audit-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.gl-table :is(th, td):first-child, table.audit-table :is(th, td):first-child { padding-left: var(--sp-6); }
table.gl-table :is(th, td):last-child, table.audit-table :is(th, td):last-child { padding-right: var(--sp-6); }
table.gl-table .num, table.gl-table th.num { text-align: right; white-space: nowrap; }
table.gl-table td.gl-date { white-space: nowrap; width: 104px; }
table.gl-table td.gl-type { white-space: nowrap; color: var(--text-2); }
table.gl-table td.gl-no { white-space: nowrap; color: var(--text-2); }
table.gl-table td.gl-memo { color: var(--text-2); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.gl-table td.gl-phone { display: none; }
table.gl-table tr.gl-acct > :is(th, td) { padding-top: var(--sp-4); background: var(--surface-2); border-top: 1px solid var(--line); font-size: var(--text-md); font-weight: 650; }
table.gl-table tr.gl-acct > th { padding-left: 14px; }
table.gl-table tr.gl-acct a { color: var(--text); text-decoration: none; }
table.gl-table tr.gl-acct a:hover { color: var(--accent-text); text-decoration: underline; }
table.gl-table tr.gl-acct.closed > :is(th, td) { padding-top: 7px; padding-bottom: 7px; font-weight: 500; background: var(--surface); }
table.gl-table .gl-count { margin-left: var(--sp-2); font-size: var(--text-xs); font-weight: 500; color: var(--text-3); }
table.gl-table tr.gl-begin td { color: var(--text-2); font-style: italic; }
table.gl-table tr.gl-line:hover td { background: var(--brand-50); cursor: pointer; }
table.gl-table tr.gl-line:focus-visible td { background: var(--brand-50); outline: none; }
table.gl-table tr.gl-total td { font-weight: 650; border-top: 1px solid var(--line-strong); padding-bottom: var(--sp-3); }
table.gl-table tr.gl-grand td { font-weight: 700; font-size: var(--text-md); border-top: 2px solid var(--line-strong); border-bottom: 3px double var(--line-strong); padding-top: 10px; padding-bottom: 10px; }
.gl-scroll { overflow-x: auto; }
table.audit-table tr.audit-day th { padding-top: var(--sp-4); background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--line); font-size: var(--text-sm); }
table.audit-table td { border-bottom: 1px solid var(--gray-100); }
table.audit-table tr.clickable:hover td { background: var(--brand-50); cursor: pointer; }
table.audit-table td.audit-when { white-space: nowrap; width: 110px; color: var(--text-2); }
table.audit-table td.audit-who { white-space: nowrap; width: 170px; }
table.audit-table td.audit-what { width: 260px; }
table.audit-table td.audit-detail { overflow-wrap: anywhere; }
table.audit-table td.audit-open { width: 56px; text-align: right; }
.audit-act { font-weight: 600; }
.audit-act.act-add { color: var(--success-text); }
.audit-act.act-del { color: var(--danger-text); }
.audit-more { display: flex; justify-content: center; padding: var(--sp-4); border-top: 1px solid var(--line); }
.rpt-doc.rpt-narrow-doc { max-width: 960px; margin-left: auto; margin-right: auto; }
table.aging-table td.ag-credit-cell { color: var(--info-text); }
@media (max-width: 640px) {
  table.gl-table thead { display: none; }
  table.gl-table, table.gl-table tbody, table.gl-table tfoot { display: block; }
  table.gl-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
  table.gl-table :is(th, td) { padding: 0 !important; border: 0 !important; background: none !important; }
  table.gl-table tr.gl-acct { background: var(--surface-2); border-top: 1px solid var(--line); padding-top: 12px; }
  table.gl-table tr.gl-acct > th { grid-column: 1 / -1; }
  table.gl-table tr.gl-acct > td:empty, table.gl-table td.gl-x { display: none; }
  table.gl-table tr.gl-acct.closed > td { font-size: var(--text-sm); color: var(--text-2); text-align: left; }
  table.gl-table tr.gl-acct.closed > td::before { content: attr(data-label) ' '; color: var(--text-3); }
  table.gl-table tr.gl-acct.closed { grid-template-columns: repeat(3, auto); justify-content: start; }
  table.gl-table tr.gl-line td:is(.gl-date, .gl-type, .gl-no, .gl-name, .gl-memo) { display: none; }
  table.gl-table tr.gl-line td.gl-phone { display: flex; flex-direction: column; grid-row: 1 / 3; min-width: 0; }
  .gl-ph-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gl-ph-sub { font-size: var(--text-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.gl-table tr.gl-line td.gl-dr:empty, table.gl-table tr.gl-line td.gl-cr:empty { display: none; }
  table.gl-table tr.gl-line td.gl-cr::before { content: '−'; }
  table.gl-table tr.gl-line td.gl-cr { color: var(--text); }
  table.gl-table tr.gl-line td.gl-bal { font-size: var(--text-xs); color: var(--text-3); }
  table.gl-table tr.gl-line td.gl-bal::before { content: 'Bal. '; }
  table.gl-table tr.gl-begin td:first-child, table.gl-table tr.gl-total td:first-child, table.gl-table tr.gl-grand td:first-child { grid-column: 1 / -1; }
  table.gl-table tr.gl-begin td.num, table.gl-table tr.gl-total td.num, table.gl-table tr.gl-grand td.num { text-align: left; font-size: var(--text-sm); }
  table.gl-table tr.gl-total { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  table.gl-table tr.gl-total td.num::before, table.gl-table tr.gl-grand td.num::before { content: attr(data-label) ' '; font-weight: 400; color: var(--text-3); }
  table.gl-table tr.gl-grand { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  table.gl-table tr.gl-begin { display: flex; justify-content: space-between; }
  table.audit-table thead { display: none; }
  table.audit-table, table.audit-table tbody { display: block; }
  table.audit-table tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
  table.audit-table :is(th, td) { padding: 0 !important; border: 0 !important; width: auto !important; }
  table.audit-table tr.audit-day th { grid-column: 1 / -1; padding: 4px 0 !important; background: none; }
  table.audit-table tr.audit-day { background: var(--surface-2); }
  table.audit-table td.audit-what { grid-column: 2; grid-row: 1; }
  table.audit-table td.audit-when { grid-column: 1; grid-row: 1; }
  table.audit-table td.audit-open { grid-column: 3; grid-row: 1; }
  table.audit-table td.audit-who { grid-column: 2 / -1; font-size: var(--text-xs); color: var(--text-3); }
  table.audit-table td.audit-detail { grid-column: 2 / -1; }
  table.audit-table td.audit-detail:empty { display: none; }
}
/* The filter panel over the other reports (ledger, aging, audit…): labeled controls, then the outputs at the right. */
.rpt-ctl { display: flex; align-items: flex-end; gap: var(--sp-3) var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.rpt-ctl-fields { display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; flex: 1; min-width: 0; }
.rpt-ctl-fields > .inline-num, .rpt-ctl-fields > label.check { align-self: flex-end; min-height: 38px; display: inline-flex; align-items: center; gap: 6px; }
.rpt-ctl-fields .rpt-field > select, .rpt-ctl-fields .rpt-field > input { min-width: 0; }
.rpt-ctl-fields .inline-num input { width: 64px; }
.rpt-ctl-out { display: flex; gap: var(--sp-2); align-items: center; }
.rpt-ctl-out > button { display: inline-flex; align-items: center; gap: 6px; }
table.aging-detail td.ag-doc { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .rpt-ctl { padding: var(--sp-3); gap: var(--sp-3); }
  .rpt-ctl-fields { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .rpt-ctl-fields > .rpt-field:first-child:nth-last-child(n+3) { grid-column: 1 / -1; }
  .rpt-ctl-fields .rpt-field > :is(select, input), .rpt-ctl-fields .rpt-field .segmented { width: 100%; }
  .rpt-ctl-out { width: 100%; }
  .rpt-ctl-out > * { flex: 1; justify-content: center; }
}
.rpt-ctl-fields .rpt-field > select { max-width: 230px; }
.rpt-ctl-fields .rpt-field > input[type=search] { width: 200px; }
.rpt-ctl-fields input.num-sm { width: 64px; }
.rpt-ctl-fields .rpt-field[hidden] { display: none; }
table.gl-table td.gl-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-ent { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: var(--r-full); background: var(--gray-100); color: var(--text-2); font-size: var(--text-xs); line-height: 18px; vertical-align: 1px; }
:is(table.gl-table, table.audit-table) th.sortable .arrow { position: absolute; margin-left: 2px; }
:is(table.gl-table, table.audit-table) th.sortable { position: sticky; }
@media (max-width: 640px) {
  .rpt-ctl-fields > * { min-width: 0; }
  .rpt-ctl-fields .rpt-field input[type=date], .rpt-ctl-fields .rpt-field > input[type=search] { width: 100%; min-width: 0; }
  .rpt-ctl-fields .rpt-dates { min-width: 0; }
  .rpt-ctl-fields .rpt-dates input { min-width: 0; flex: 1; }
  .rpt-ctl-fields .rpt-field > select { max-width: none; }
  .rpt-ctl-fields > label.check, .rpt-ctl-fields > .rpt-run { grid-column: 1 / -1; }
}
.rpt-tools { flex-wrap: wrap; }
.rpt-tools > .small.sub:not(:last-child), .rpt-tools > label.check { white-space: nowrap; }
/* Aging figures read as figures (black), with a link underline on hover; unused credits in the info color. */
table.aging-table td.num a, table.aging-detail td.num a { color: inherit; text-decoration: none; }
table.aging-table td.num a:hover, table.aging-detail td.num a:hover { color: var(--accent-text); text-decoration: underline; }
table.aging-table td[data-label='Unused credits'] { color: var(--info-text); }
table.aging-detail th:first-child { width: 30%; }
table.aging-detail td.ag-doc { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 640px) {
  table.aging-detail tr { grid-template-columns: minmax(0, 1fr) auto; }
  table.aging-detail tbody tr:not(.ag-sub) td:nth-child(2):empty { display: none; }
  table.aging-detail td:last-child { white-space: nowrap; }
}
/* The memo takes what room is left (cut with …), so the amounts always fit; "paid part" sits under the type. */
table.gl-table td.gl-memo { max-width: 0; width: 100%; }
table.gl-table .gl-paid { display: block; width: fit-content; margin-top: 2px; font-size: 11px; }
/* ── Money in: Receive payment, Receive money, Deposit checks ───────────── */
.rp-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
.rp-form > .panel { margin: 0; }
.rp-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-6); align-items: start; }
.rp-top-main { display: grid; gap: var(--sp-4); min-width: 0; }
.rp-who { display: grid; grid-template-columns: minmax(240px, 380px) minmax(150px, 200px); gap: var(--sp-4); align-items: end; }
.rp-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; max-width: 860px; }
.rp-fields .field > :is(input, select, textarea, .combo) { width: 100%; }
.rp-fields .help { font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-fields.four { grid-template-columns: minmax(140px, .9fr) minmax(110px, .8fr) minmax(130px, 1fr) minmax(210px, 1.3fr); max-width: none; }
.rp-amt { margin-top: var(--sp-3); width: 200px; }
.rp-amt input.money { width: 100%; font-size: var(--text-lg); height: 44px; font-weight: 600; }
.rp-foot-left { display: grid; gap: var(--sp-4); align-content: start; }
.rp-foot-left .field { max-width: 520px; }
.rp-hero { display: grid; justify-items: end; gap: 2px; padding: var(--sp-2) 0 0; text-align: right; min-width: 220px; }
.rp-hero > span { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.rp-hero-amt { font-size: var(--text-4xl); line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rp-hero small { color: var(--text-3); font-size: var(--text-sm); }
.rp-cust { min-height: 20px; }
.rp-cust-figs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rp-cust-figs { align-items: stretch; }
.rp-cust-figs > div:not(.rp-cust-links) { display: grid; gap: 0; padding: var(--sp-2) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); min-width: 140px; }
.rp-cust-figs > div.credit { background: var(--success-bg); border-color: var(--success-line); }
.rp-cust-figs span { font-size: var(--text-xs); color: var(--text-2); }
.rp-cust-figs strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.rp-cust-figs small { font-size: var(--text-xs); color: var(--text-3); }
.rp-cust-links { display: grid; align-content: center; gap: 2px; padding: 0 var(--sp-2); }
.rp-items-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.rp-items-bar h2 { margin: 0; font-size: var(--text-lg); }
.rp-items-bar .input-icon { width: 230px; }
.rp-items-bar .grow { flex: 1; }
.rp-items h3, .dep-other h3, .dep-back h3 { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--text-md); }
.rp-items > div:first-child h3 { margin-top: 0; }
.rp-grid th.pick, .rp-grid td.pick { width: 36px; padding-right: 0; }
.rp-grid td.num input.money { width: 120px; }
.rp-grid tbody tr.on { background: var(--accent-soft); }
.rp-grid tbody tr.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rp-grid tfoot td { font-weight: 600; }
.rp-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: var(--sp-5); align-items: start; margin-top: var(--sp-4); }
.rp-verdict { margin: 0; }
.rp-sum dl { margin: 0; display: grid; gap: 6px; }
.rp-sum dl > div { display: flex; justify-content: space-between; gap: var(--sp-4); font-variant-numeric: tabular-nums; }
.rp-sum dt { color: var(--text-2); }
.rp-sum dd { margin: 0; font-weight: 600; }
.rp-sum .sep { border-top: 1px solid var(--line); padding-top: 6px; }
.rp-sum .big { border-top: 2px solid var(--line-strong); padding-top: 8px; font-size: var(--text-lg); }
.rp-sum .big dt { color: var(--text); font-weight: 600; }
.rp-sum .big.off dd { color: var(--danger); }
.rp-sum .big.over dd { color: var(--info-text); }
.rp-m-open { display: none; }
.rp-where { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin: 0 0 var(--sp-4); color: var(--text-2); }
.plain-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: 4px; }
.dep-other .table-wrap input, .dep-other .table-wrap select { width: 100%; min-width: 90px; }
.dep-other td.num input.money { width: 110px; }
.dep-hist-h { margin: var(--sp-8) 0 var(--sp-3); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.dep-hist-h h2 { margin: 0; }
.list-more { margin-top: var(--sp-3); text-align: center; }
/* The printed deposit ticket */
.sheet.dep-slip header { align-items: stretch; border-bottom: 2px solid #000; padding-bottom: 14px; margin-bottom: 18px; }
.sheet.dep-slip .title { text-transform: uppercase; letter-spacing: .08em; font-size: 20px; margin-bottom: 8px; }
.dep-acct { display: grid; gap: 6px; text-align: right; }
.dep-acct > div { display: grid; }
.dep-acct span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #444; }
.dep-acct strong { font-size: 15px; }
.dep-acct .last4 strong { font: 700 22px/1.1 var(--font-mono); border: 2px solid #000; padding: 2px 10px; justify-self: end; }
.dep-slip-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; align-items: start; }
.dep-slip-body table td, .dep-slip-body table th { padding: 6px 8px; }
.dep-slip-body tfoot td { font-weight: 700; border-top: 2px solid #000; }
.dep-box { margin: 0; border: 2px solid #000; display: grid; }
.dep-box > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid #999; font-variant-numeric: tabular-nums; }
.dep-box > div:last-child { border-bottom: 0; }
.dep-box dt { font-size: 13px; }
.dep-box dd { margin: 0; font-weight: 600; }
.dep-box .sep { border-top: 1px solid #000; }
.dep-box .net { background: #f1f1f1; font-size: 16px; }
.dep-box .net dd { font-weight: 800; }
.sheet.dep-slip.void { position: relative; }
.sheet.dep-slip.void::after { content: 'VOID'; position: absolute; inset: 0; display: grid; place-items: center; font: 800 120px/1 var(--font-sans); color: rgba(196, 50, 31, .16); transform: rotate(-18deg); pointer-events: none; }
@media print { .rp-form, .dep-hist-h { display: none; } .dep-slip-body { grid-template-columns: minmax(0, 1fr) 2.6in; } }
@media (max-width: 900px) {
  .rp-top { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .rp-hero { justify-items: stretch; text-align: left; padding: 0; }
  .rp-hero .rp-amt { margin-top: 2px; }
  .rp-foot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .rp-who { grid-template-columns: minmax(0, 1fr); }
  .rp-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rp-fields .field.wide-m { grid-column: 1 / -1; }
  .rp-fields.four { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rp-fields.four > .field:nth-child(4) { grid-column: 1 / -1; }
  .rp-fields .help { white-space: normal; }
  .rp-amt { width: 100%; }
  .rp-hero-amt { display: none; }
  .rp-hero:not(:has(.rp-amt)) { display: none; }
  .rp-hero > span { font-size: var(--text-sm); letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 600; }
  .rp-cust-figs > div { flex: 1 1 120px; min-width: 0; padding: var(--sp-2) var(--sp-3); }
  .rp-items-bar .input-icon { width: 100%; order: 5; }
  .rp-form .table-wrap.rp-grid > table { min-width: 0 !important; width: 100% !important; }
  .rp-grid.dep-grid tbody tr.on td:first-child { box-shadow: none; }
  .rp-grid:not(.dep-grid) :is(th, td):is(:nth-child(3), :nth-child(4), :nth-child(5), :nth-child(6)) { display: none; }
  .rp-m-open { display: block; }
  .rp-grid table td { padding-left: 8px; padding-right: 8px; }
  .rp-cust-figs > div { flex: 1 1 28%; } .rp-cust-figs small { display: none; }
  .rp-grid td.num input.money { width: 96px; }
  .dep-grid th:nth-child(3), .dep-grid td:nth-child(3), .dep-grid th:nth-child(5), .dep-grid td:nth-child(5) { display: none; }
  .dep-grid th:nth-child(4), .dep-grid td:nth-child(4) { display: table-cell; }
  .sheet.dep-slip { padding: 20px 16px; }
  .sheet.dep-slip header { flex-direction: column; gap: 12px; }
  .dep-acct { text-align: left; } .dep-acct .last4 strong { justify-self: start; }
  .dep-slip-body { grid-template-columns: 1fr; }
}
.where-card { display: grid; gap: var(--sp-2); justify-items: start; }
.where-card h2 { margin-bottom: var(--sp-1) !important; }
.where-card p { margin: 0; }
/* Deposit page: the slip with a side column (statement status, activity) on screen */
.dep-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-5); align-items: start; }
.dep-page > .sheet.dep-slip { margin: 0; max-width: none; }
.slip-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.slip-link:hover { color: var(--accent); }
@media print { .dep-page { display: block; } .slip-link { text-decoration: none; } }
@media (max-width: 1100px) { .dep-page { grid-template-columns: minmax(0, 1fr); } }
/* Deposit checks: lines of other money. A grid row each on a wide screen, a labelled card each on a phone. */
.dep-ol { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.3fr) 100px 100px 120px 36px; gap: var(--sp-2); align-items: center; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.dep-ol-head { padding: 0 0 var(--sp-1); font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.dep-ol-head .num { text-align: right; }
.dep-ol .field { margin: 0; gap: 0; min-width: 0; }
.dep-ol .field > :is(input, select) { width: 100%; min-width: 0; }
.dep-ol-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dep-ol input.money { text-align: right; }
@media (max-width: 640px) {
  .dep-ol-head { display: none; }
  .dep-ol { position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3); margin-bottom: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .dep-ol .field { gap: 4px; }
  .dep-ol-l { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
  .dep-ol .from { grid-column: 1 / -1; padding-right: 36px; }
  .dep-ol .acct, .dep-ol .note { grid-column: 1 / -1; }
  .dep-ol .amt { grid-column: 1 / -1; }
  .dep-ol-rm { position: absolute; top: 8px; right: 8px; }
}
.field-error { margin: var(--sp-2) 0 0; color: var(--danger-text); font-size: var(--text-sm); font-weight: 500; }
input.money.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); color: var(--danger-text); }
@media (min-width: 641px) { .pay-apps td.m-only, .pay-apps th:nth-child(2), .pay-apps tfoot td:nth-child(2) { display: none; } }
@media (max-width: 1180px) and (min-width: 641px) { .rp-fields.four { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.form-bar-why { color: #ffb4a8; font-size: var(--text-sm); font-weight: 500; align-self: center; }
.form-bar-why:empty { display: none; }
.rp-part { margin-left: var(--sp-2); }
.edit-blocked { display: inline-grid; justify-items: center; gap: 2px; }
.edit-blocked small { font-size: var(--text-xs); max-width: 220px; text-align: center; line-height: 1.3; }
@media (max-width: 640px) {
  .rp-fields.four > .field:nth-child(3) { grid-column: 1 / -1; }
  .page-head.wrap-m { flex-wrap: wrap; }
  .page-head.wrap-m > .toolbar { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .page-head.wrap-m { flex-wrap: wrap !important; align-items: flex-start !important; }
  .page-head.wrap-m > div:first-child { flex: 1 1 100%; }
  .page-head.wrap-m > .toolbar { flex: 1 1 100%; width: 100%; justify-content: flex-start; }
}
/* Round 29: the register fits the main column (1028px at 1280 wide) without scrolling sideways. Payee and Account take
   what room is left and end in "…"; the amounts, R and Balance always show. */
@media (min-width: 641px) {
  table.register { width: 100%; }
  table.register td.reg-payee { width: 34%; max-width: 0 !important; overflow: hidden; text-overflow: ellipsis; }
  table.register td.reg-acct { width: 20%; min-width: 180px; max-width: 0 !important; overflow: hidden; text-overflow: ellipsis; }
  table.register thead th:nth-child(4) { min-width: 180px; }
  table.register td.reg-payee > *, table.register td.reg-acct > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.register tr.quick-add td:nth-child(1) input { min-width: 0; width: 132px; }
  table.register tr.quick-add td:nth-child(4) select { max-width: none; }
}
/* Round 29, phones: the account-card carousel keeps the 16px page gutter when it snaps, and tab bars that scroll
   sideways fade on the side that has more. */
@media (max-width: 640px) {
  .bank-tiles { scroll-padding-inline: var(--sp-4); }
  .bank-tiles > * { scroll-snap-align: start; }
  main :is(.tabs, .acct-tabs).more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
  main :is(.tabs, .acct-tabs).more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px); mask-image: linear-gradient(to right, transparent, #000 48px); }
  main :is(.tabs, .acct-tabs).more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
}
/* Round 30: the money bar keeps vendor credits as their own legend item, and a mismatch with the ledger reads amber. */
.mb-legend .credit i { background: var(--info); }
.mb-legend .credit strong { color: var(--money-in); }
.mb-note.warn { color: var(--warning-text); }
/* Round 30: a list with room to spare gives it to the actions column; its buttons sit at the right edge. */
@media (min-width: 641px) { .list-table table.act-wide td.act-col .row-actions { justify-content: flex-end; } .list-table table.act-wide td.act-col { text-align: right; } }
/* Round 30: carousel position under a phone's sideways card strip (carouselDots in app.js). Hidden on wider screens. */
.carousel-dots { display: none; }
@media (max-width: 640px) {
  .carousel-dots { display: flex; align-items: center; justify-content: center; gap: 6px; margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
  .carousel-dots .cd-dot { width: 8px; height: 8px; min-height: 0; padding: 0; border: 0; border-radius: var(--r-full); background: var(--gray-300); }
  .carousel-dots .cd-dot.on { background: var(--accent); width: 18px; }
  .carousel-dots .cd-label { margin-left: 6px; font-size: var(--text-xs); color: var(--text-3); }
}
/* Round 31: a link inside a headline tile (the tile itself is a link), e.g. "$15,903.31 to clean up". */
.dash-kpi .kpi-link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.dash-kpi .kpi-link:hover { color: var(--accent-hover); }
/* Round 31: the register's four tabs fit a 390px phone without scrolling (tighter padding, 13px); narrower phones
   still scroll with the fade. */
@media (max-width: 640px) {
  main .tabs.bank-subtabs { gap: 0; justify-content: space-between; }
  main .tabs.bank-subtabs > a { padding-left: 7px; padding-right: 7px; font-size: var(--text-sm); }
  main .tabs.bank-subtabs > a .count { margin-left: 4px; }
}
/* Round 31: a report row whose label wraps keeps its amount on the label's first line. */
@media (max-width: 640px) { table.rpt tbody tr > :is(th, td) { vertical-align: top; } }
/* Round 31: the register search keeps room for its whole placeholder. */
@media (min-width: 641px) { .reg-toolbar .reg-search { flex: 1 1 236px; min-width: 236px; max-width: 320px; } .reg-toolbar .reg-dates input { width: 128px; } .reg-toolbar > select { width: 146px; } .reg-toolbar .reg-search { min-width: 262px; } }
/* Round 33: a group heading row inside a plain table (Clean up: "Already matches the ledger"). */
tr.group-head > td { background: var(--surface-sunk); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 640px) { table.stack tr.group-head { display: block; padding: 0; } table.stack tr.group-head > td { display: block !important; } }
.cleanup-count { margin: 0 0 var(--sp-3); font-size: var(--text-sm); }
/* Round 34: branches sit indented under their parent in list tables (the parent's balance is the family total). */
@media (min-width: 641px) {
  .list-table tr.branch-row td.c-name .cell-in { padding-left: 22px; }
  .list-table tr.branch-row .branch-mark { margin: 0 6px 0 -18px; }
}
.cleanup-sum { display: grid; gap: 4px; margin: 0 0 var(--sp-3); }
/* Round 35: Clean up's Oldest stays on one line; Customer takes the spare width. */
@media (min-width: 641px) { .cleanup-table td:nth-child(6), .cleanup-table th:nth-child(6), .cleanup-table td.num, .cleanup-table th.num { white-space: nowrap; } .cleanup-table .pill { white-space: nowrap; } .cleanup-table td, .cleanup-table th { padding-left: 10px; padding-right: 10px; } }
/* Round 35: the dark menu column runs the page's full height (the menu itself stays sticky at the top). */
@media (min-width: 641px) { .shell { background: linear-gradient(to right, var(--brand-950) var(--nav-w), transparent var(--nav-w)); } }
/* Round 36: phone list cards. The amount's note ("family total", "less credits", "open, not in ledger") stays under the
   amount; branches keep their arrow and indent; the grey line wraps in full: money is never cut off with "…". */
.amt-note { white-space: normal; line-height: 1.3; }
@media (max-width: 640px) {
  table.stack td.m-right .m-amt-note { display: block; font-size: var(--text-xs); font-weight: 400; color: var(--text-3); white-space: normal; text-align: right; max-width: 160px; margin-left: auto; }
  table.stack td[data-m='title'] .branch-mark { display: inline-block; margin: 0 4px 0 0; width: auto; color: var(--text-3); }
  table.stack tbody tr.branch-row > td:not(.m-right):not([data-m='pick']):not(.pick) { padding-left: 18px; }
  table.stack td.m-sub:not(:empty), table.stack tbody tr:has(> td.m-right) > td.m-sub:not(:empty), table.stack tbody tr.m-inline-act > td.m-sub:not(:empty) {
    display: block !important; -webkit-line-clamp: unset !important; overflow: visible !important; text-overflow: clip !important; white-space: normal !important; }
}
@media (max-width: 640px) { table.stack tbody tr.m-inline-act > td.m-sub .m-part.m-long { white-space: normal; } table.stack tbody tr > td.m-sub { min-width: 0; overflow-wrap: anywhere; } }
/* Round 36: a list's name column wraps to two lines instead of cutting the name short. */
@media (min-width: 641px) {
  .list-table td.c-name .cell-in { white-space: normal !important; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: clip; }
}
.list-table table.measuring .amt-note { white-space: nowrap; }
.amt-note.nowrap { white-space: nowrap; }
/* Tie-out pills: the full sentence on a computer; on a phone the short one, and the pill wraps rather than clipping. */
.rpt-ties .tie-short { display: none; }
@media (max-width: 640px) {
  .rpt-ties .tie-long { display: none; }
  .rpt-ties .tie-short { display: inline; }
  .rpt-ties .pill, .rpt-meta .pill { white-space: normal; max-width: 100%; height: auto; text-align: left; }
}
table.aging-table td.ag-name a { color: inherit; text-decoration: none; font-weight: 500; }
table.aging-table td.ag-name a:hover { color: var(--accent-text); text-decoration: underline; }
.ag-count { margin-left: 8px; font-weight: 400; }
.ag-count { white-space: nowrap; }
.aging-left-out { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; background: var(--info-bg); color: var(--info-text); }
.aging-left-out svg { flex: none; align-self: center; }
.rc-tile .rc-desc { -webkit-line-clamp: 3; }
.rc-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
table.gl-table td.gl-date button.link { font-size: inherit; padding: 0; min-height: 0; color: var(--text-3); }
table.gl-table tr.gl-year td { font-style: normal; color: var(--text-2); background: var(--surface-2); border-top: 1px dashed var(--line-strong); }
table.aging-table td[data-label='Credits and unmatched'] { color: var(--info-text); }
/* Aging headings wrap onto two lines rather than running into the next ("Credits and unmatched" beside "Total"). */
table.aging-table thead th { white-space: normal; vertical-align: bottom; line-height: 1.25; overflow-wrap: normal; }
table.aging-table thead th.num { padding-left: 14px; }
table.aging-table thead th:nth-last-child(2) { max-width: 120px; }
.aging-left-out { display: block; } .aging-left-out svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
@media (min-width: 641px) and (max-width: 1320px) {
  table.aging-table { table-layout: auto; }
  table.aging-table th:first-child, table.aging-table td.ag-name { width: auto; min-width: 180px; }
  table.aging-table thead th:nth-last-child(2) { min-width: 96px; }
  table.aging-table :is(th, td) { padding-left: 10px; padding-right: 10px; }
}
table.aging-table thead th:last-child { padding-left: 18px; }
table.aging-table thead th.num { white-space: nowrap; } table.aging-table thead th.num:nth-last-child(2) { white-space: normal; }
@media (min-width: 641px) and (max-width: 1320px) {
  table.aging-table th:first-child, table.aging-table td.ag-name { min-width: 130px; }
  table.aging-table :is(th, td) { padding-left: 6px; padding-right: 6px; font-size: var(--text-sm); }
  table.aging-table :is(th, td):first-child { padding-left: var(--sp-4); }
  table.aging-table :is(th, td):last-child { padding-right: var(--sp-4); }
  table.aging-table thead th { font-size: 11px; }
}
/* The line a link pointed at (e.g. Accounts Receivable from the aging report's "Ties to" pill). */
table.rpt tr.rpt-focus > :is(th, td) { background: var(--warning-bg) !important; box-shadow: inset 0 1px 0 var(--warning-line), inset 0 -1px 0 var(--warning-line); font-weight: 600; }
/* ── Dense report grids between phone and wide screens (about 1100–1320px windows) ── */
table.gl-table .gl-name-memo { display: none; }
@media (min-width: 641px) and (max-width: 1320px) {
  table.gl-table :is(th, td) { padding: 6px 6px; }
  table.gl-table :is(th, td):first-child { padding-left: var(--sp-4); }
  table.gl-table :is(th, td):last-child { padding-right: var(--sp-4); }
  table.gl-table td.gl-name { max-width: none; white-space: normal; overflow: visible; }
  table.gl-table td.gl-date { width: auto; }
  table.gl-table td.gl-type { white-space: normal; }
  table.gl-table .num { min-width: 0; }
}
/* Narrower still: the memo goes under the name, so all the figures stay in view. */
@media (min-width: 641px) and (max-width: 1180px) {
  /* The memo column folds to nothing (kept, so the columns of the other rows still line up). */
  table.gl-table thead th:nth-child(5), table.gl-table td.gl-memo { width: 0; max-width: 0; padding: 0 !important; font-size: 0; overflow: hidden; }
  table.gl-table thead th:nth-child(5) .arrow { display: none; }
  table.gl-table .gl-name-memo { display: block; overflow-wrap: anywhere; }
  table.gl-table td.gl-name { min-width: 140px; }
  /* The Column column folds to nothing (kept, so the subtotal rows still line up); dates stay on one line. */
  table.aging-detail td[data-label=Column], table.aging-detail thead th:nth-last-child(2) { width: 0; max-width: 0; padding: 0 !important; font-size: 0; overflow: hidden; }
  table.aging-detail td[data-label='Due date'], table.aging-detail td:nth-child(2) { white-space: nowrap; }
  table.aging-detail th:first-child { width: auto; }
  table.aging-table th:first-child, table.aging-table td.ag-name { min-width: 190px; }
  table.aging-table :is(th, td).num { padding-left: 8px; padding-right: 2px; white-space: nowrap; }
  table.aging-table td.ag-name { min-width: 200px; }
}
table.gl-table .gl-name-memo { margin: 0; line-height: 1.35; }
@media (min-width: 641px) and (max-width: 1180px) {
  table.aging-table td.ag-name, table.aging-table th:first-child { min-width: 160px; }
  table.aging-table :is(th, td).num { padding-left: 6px; }
  table.aging-table thead th.num { white-space: normal; }
}
@media (min-width: 641px) and (max-width: 1180px) {
  table.aging-table thead th.num { white-space: nowrap; vertical-align: bottom; }
  table.aging-table thead th.num:nth-last-child(2), table.aging-table thead th.num:nth-last-child(3) { white-space: normal; }
  table.aging-table :is(th, td):last-child { padding-right: var(--sp-4) !important; }
}
/* Families in the aging and balance summaries: parent heading, branches indented, a family total ruled above. */
table.aging-table tr.ag-fam-head td { padding-top: 12px; padding-bottom: 4px; font-weight: 600; border-bottom: 0; }
table.aging-table tr.ag-child td.ag-name { padding-left: calc(var(--sp-6) + 18px); }
table.aging-table tr.ag-fam-total td { font-weight: 600; border-top: 1px solid var(--line-strong); }
@media (min-width: 641px) and (max-width: 1320px) { table.aging-table tr.ag-child td.ag-name { padding-left: calc(var(--sp-4) + 16px); } }
@media (max-width: 640px) { table.aging-table tr.ag-fam-head { padding-bottom: 0; border-bottom: 0; background: none; } table.aging-table tr.ag-child { margin-left: 12px; } }
/* The filter card folded: one line of what's picked, Edit, and the outputs. */
.rpt-ctl-sum { display: none; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; color: var(--text-2); }
.rpt-ctl-sum > svg { color: var(--text-3); flex: none; }
.rpt-ctl-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.rpt-ctl.folded { padding-top: var(--sp-2); padding-bottom: var(--sp-2); align-items: center; }
.rpt-ctl.folded .rpt-ctl-sum { display: flex; }
.rpt-ctl.folded .rpt-ctl-fields { display: none; }
@media (max-width: 640px) { .rpt-ctl.folded .rpt-ctl-sum { width: 100%; } }
.rpt-info { padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--line); background: var(--surface-2); } .rpt-info p { margin: 0 0 4px; } .rpt-info-btn { min-height: 0; width: 24px; height: 24px; padding: 0; color: var(--text-3); } .aging-note[hidden], .rpt-info[hidden] { display: none; }
table.audit-table td.audit-detail { overflow-wrap: normal; word-break: normal; } @media (min-width: 641px) and (max-width: 1320px) { table.audit-table td.audit-who { width: 110px; } table.audit-table td.audit-what { width: 200px; } }
