/* The parts of a moved page (templates/app/_parts.html). Every class is
   app-…, every colour is an --app-* token from tokens.css: no literal
   colour here (tests/test_app_parts.py). Bootstrap is still loaded under
   this, so each part sets the few things Bootstrap's reset would
   otherwise decide (heading and paragraph margins, link underlines). */

/* ── Ground rules shared by every part ─────────────────────────────── */
.app-strip, .app-panel, .app-note, .app-empty, .app-dialog, .app-foot,
.app-facts, .app-details, .app-timeline, .app-rows, .app-form,
.app-tabs, .app-toolbar, .app-table-wrap, .app-btn, .app-badge, .app-who,
.app-side-layout, .app-stats, .app-subtabs, .app-bulk, .app-menu, .app-toasts {
  font-family: var(--app-font); font-size: 14px; line-height: 1.5;
  box-sizing: border-box;
}
.app-strip, .app-panel, .app-note, .app-empty, .app-dialog { color: var(--app-text); }
.app-strip *, .app-panel *, .app-dialog *, .app-form * { box-sizing: border-box; }
.app-strip a, .app-panel a, .app-note a, .app-empty a, .app-dialog a, .app-foot a,
.app-actions .app-muted a {
  color: var(--app-accent-ink); text-decoration: none;
}
.app-strip a:hover, .app-panel a:hover, .app-note a:hover, .app-empty a:hover,
.app-dialog a:hover, .app-foot a:hover, .app-actions .app-muted a:hover { text-decoration: underline; }
.app-strip a:focus-visible, .app-panel a:focus-visible, .app-foot a:focus-visible,
.app-btn:focus-visible, .app-logo-btn:focus-visible, .app-input:focus-visible, .app-select:focus-visible,
.app-check input:focus-visible, .app-dialog-close:focus-visible,
.app-check-cell input:focus-visible, .app-bulk-clear:focus-visible,
.app-side-menu a:focus-visible, .app-subtabs a:focus-visible, a.app-stat:focus-visible,
.app-menu-item:focus-visible, .app-toast a:focus-visible, .app-toast-close:focus-visible {
  outline: 2px solid var(--app-accent-ink); outline-offset: 2px;
}
.app-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.app-muted { color: var(--app-muted); }
/* A cell that must stay on one line (a date and time): the table scrolls
   sideways on a phone instead of the row growing tall. */
.app-nowrap { white-space: nowrap; }

/* ── Layout helpers ────────────────────────────────────────────────── */
.app-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.app-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.app-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* In a dialog the row of buttons sits at the right, like the confirm
   dialog app.js builds (app-dialog-actions). */
.app-dialog .app-actions { justify-content: flex-end; }

/* ── Strip: title on the left, actions on the right ────────────────── */
.app-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; margin: 0 0 16px; min-width: 0;
}
.app-strip-main { min-width: 0; }
.app-strip-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.app-strip h1 { font-size: 18px; font-weight: 600; line-height: 1.3; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.app-strip-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-crumb { font-size: 13px; color: var(--app-muted); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.app-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; padding: 7px 14px; border-radius: var(--app-radius-control);
  border: 1px solid var(--app-accent); background: var(--app-accent);
  color: var(--app-accent-text); cursor: pointer; white-space: nowrap;
}
/* Named with the parts that colour their links, so a button that is a
   link keeps its own text colour inside a strip or a panel. */
.app-btn, a.app-btn, .app-strip a.app-btn, .app-panel a.app-btn, .app-empty a.app-btn,
.app-dialog a.app-btn, .app-foot a.app-btn, .app-note a.app-btn { color: var(--app-accent-text); text-decoration: none; }
.app-btn:hover, a.app-btn:hover { background: var(--app-accent-hover); border-color: var(--app-accent-hover); text-decoration: none; }
.app-btn-second, a.app-btn-second, .app-strip a.app-btn-second, .app-panel a.app-btn-second,
.app-empty a.app-btn-second, .app-dialog a.app-btn-second, .app-foot a.app-btn-second,
.app-note a.app-btn-second {
  background: var(--app-panel); color: var(--app-text); border-color: var(--app-border-input);
}
.app-btn-second:hover, a.app-btn-second:hover { background: var(--app-hover); border-color: var(--app-border-input); }
/* A quiet button that is a toggle and is on (aria-pressed): the soft accent. */
.app-btn-second[aria-pressed="true"] { background: var(--app-accent-soft); border-color: var(--app-accent-line); color: var(--app-accent-ink); }
.app-btn-danger, a.app-btn-danger, .app-strip a.app-btn-danger, .app-panel a.app-btn-danger,
.app-dialog a.app-btn-danger {
  background: var(--app-bad); border-color: var(--app-bad); color: var(--app-panel);
}
.app-btn-danger:hover, a.app-btn-danger:hover { background: var(--app-bad-bg); border-color: var(--app-bad); color: var(--app-bad); }
/* Dark: --app-bad is a pale red made for text, so a button filled with
   it reads as pale pink. There it is the dark red ground with the pale
   red as its words and edge, and fills on hover. */
body.dark-mode .app-btn-danger, body.dark-mode a.app-btn-danger {
  background: var(--app-bad-bg); border-color: var(--app-bad); color: var(--app-bad);
}
body.dark-mode .app-btn-danger:hover, body.dark-mode a.app-btn-danger:hover {
  background: var(--app-bad); border-color: var(--app-bad); color: var(--app-panel);
}
.app-btn-small { padding: 4px 10px; font-size: 13px; }
.app-btn:disabled { opacity: .55; cursor: not-allowed; }
.app-inline-form { display: inline; margin: 0; }

/* ── Panel ─────────────────────────────────────────────────────────── */
.app-panel { background: var(--app-panel); border: 1px solid var(--app-border); border-radius: var(--app-radius); min-width: 0; }
.app-panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--app-border);
}
.app-panel-head h2 { font-size: 14px; font-weight: 600; line-height: 1.5; margin: 0; }
.app-panel-body { padding: 14px 16px; }
.app-panel p { margin: 0; }

/* ── Glance: a chart card (templates/app/_glance.html) ─────────────── */
/* The chart is drawn by static/js/accounting-glances.js, which needs a
   box with a height. Title and subtitle on the left, this period's
   figure and the link on the right; both sides wrap on a phone. */
.app-glance-head, .app-glance-title, .app-glance-side { flex-wrap: wrap; }
.app-glance-title, .app-glance-side { display: flex; align-items: baseline; }
.app-glance-title { gap: 4px 8px; }
.app-glance-side { gap: 4px 12px; font-size: 13px; }
.app-glance-title .app-muted { font-size: 13px; }
.app-glance-total { font-weight: 600; font-variant-numeric: tabular-nums; }
.app-glance-chart { width: 100%; height: 220px; min-width: 0; margin-bottom: 12px; }

/* ── Tabs (links: each tab has its own address) ────────────────────── */
.app-tabs { display: flex; flex-wrap: wrap; gap: 2px 18px; padding: 0 16px; border-bottom: 1px solid var(--app-border); }
.app-tabs a, .app-panel .app-tabs a {
  display: inline-block; padding: 11px 2px 9px; color: var(--app-muted);
  border-bottom: 2px solid transparent; text-decoration: none;
}
.app-tabs a:hover, .app-panel .app-tabs a:hover { color: var(--app-text); text-decoration: none; }
.app-tabs a[aria-current="page"], .app-panel .app-tabs a[aria-current="page"] {
  color: var(--app-accent-ink); border-bottom-color: var(--app-accent); font-weight: 600;
}
.app-tabs-count { font-size: 12px; margin-left: 4px; color: var(--app-muted); font-weight: 400; }

/* ── Toolbar and controls ──────────────────────────────────────────── */
.app-toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 16px; margin: 0; }
.app-input, .app-select {
  font: inherit; font-family: var(--app-font); font-size: 14px; line-height: 1.5; color: var(--app-text);
  background-color: var(--app-panel); border: 1px solid var(--app-border-input);
  border-radius: var(--app-radius-control); padding: 7px 10px; width: 100%; max-width: 100%;
}
/* A drop-down draws its own arrow, padded like the text, instead of the
   browser's, which sat against the right edge (Larry, 2026-11-29). The
   arrow is two gradients in the muted token, so it follows the theme. */
select.app-input:not([multiple]):not([size]), select.app-select:not([multiple]):not([size]) {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--app-muted) 50%),
                    linear-gradient(135deg, var(--app-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.app-input::placeholder { color: var(--app-muted); opacity: 1; }
.app-input[aria-invalid="true"], .app-select[aria-invalid="true"] { border-color: var(--app-bad); }
/* Wide enough that a placeholder such as "Name, email, phone or title"
   is not cut. */
.app-toolbar .app-input { max-width: 22rem; flex: 1 1 16rem; }
/* A search input is wrapped in a span by the page script that adds its
   clear button: the span is the flex child then, so it takes the width. */
.app-toolbar > span:has(> .app-input) { max-width: 22rem; flex: 1 1 16rem; }
.app-toolbar > span:has(> .app-input) > .app-input, .app-field > span:has(> .app-input) > .app-input { width: 100%; max-width: none; }
.app-field > span:has(> .app-input) { display: block; }
.app-toolbar .app-select { width: auto; }
.app-toolbar-meta { margin-left: auto; color: var(--app-muted); font-size: 13px; }
/* A from and a to date, kept together when the toolbar wraps. */
.app-toolbar-range { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.app-toolbar .app-toolbar-range .app-input { width: auto; max-width: none; flex: none; }

/* ── Table ─────────────────────────────────────────────────────────── */
.app-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch;
  /* A shadow on the side where more of the table is hidden (the covers
     scroll with the content; the shades stay put), so a table wider than
     its panel reads as scrollable, not cut off (Larry, 2026-11-29). */
  background:
    linear-gradient(to right, var(--app-panel), var(--app-panel) 40%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--app-panel), var(--app-panel) 40%, transparent) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--app-scroll-shade), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--app-scroll-shade), transparent) right center / 12px 100% no-repeat scroll; }
/* A date and time in a table (cell_time) wraps after the year: the date
   on one line, the time under it, so the column is half as wide and both
   are always shown. The text itself stays one piece. */
.app-table td.app-nowrap > time { display: inline-block; white-space: normal; max-width: 13ch; }
.app-table { border-collapse: collapse; width: 100%; margin: 0; color: var(--app-text); }
.app-table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--app-muted);
  background: var(--app-surface); padding: 8px 16px;
  border-top: 1px solid var(--app-border); border-bottom: 1px solid var(--app-border); white-space: nowrap;
}
.app-table th.app-num { text-align: right; }
.app-table th a, .app-panel .app-table th a { color: inherit; text-decoration: none; }
.app-table th a:hover, .app-panel .app-table th a:hover { color: var(--app-text); text-decoration: none; }
.app-table th[aria-sort] a, .app-panel .app-table th[aria-sort] a { color: var(--app-text); }
.app-table td { padding: 10px 16px; border-bottom: 1px solid var(--app-border); vertical-align: middle; }
.app-table tbody tr:hover { background: var(--app-hover); }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table td .app-name, .app-panel .app-table td a.app-name { font-weight: 600; color: var(--app-text); }
/* The main column (the cell that holds the row's name) keeps a width a
   title can be read in: on a phone the table then scrolls sideways
   inside its panel, and a long title no longer wraps to ten lines. */
.app-table td:has(> .app-name) { min-width: 12rem; overflow-wrap: anywhere; }
/* A row's buttons stay on one line in a cell that does not wrap. */
.app-table td.app-nowrap .app-actions { flex-wrap: nowrap; }
/* The first table of a panel with no heading above it: the panel's own
   edge is the top line. */
.app-panel > .app-table-wrap:first-child th { border-top: 0; }
.app-panel > .app-table-wrap:first-child th:first-child { border-top-left-radius: var(--app-radius); }
.app-panel > .app-table-wrap:first-child th:last-child { border-top-right-radius: var(--app-radius); }
body.rows-compact .app-table td { padding: 5px 16px; }

/* ── Foot of a list ────────────────────────────────────────────────── */
.app-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--app-border); color: var(--app-muted); font-size: 13px;
}
.app-foot-pages { display: flex; gap: 16px; }

/* ── Badge, avatar ─────────────────────────────────────────────────── */
.app-badge {
  display: inline-block; font-size: 12px; font-weight: 500; line-height: 1.5; padding: 1px 8px;
  border-radius: 999px; background: var(--app-surface); color: var(--app-muted);
  border: 1px solid var(--app-border); white-space: nowrap; flex: none; align-self: center;
}
.app-badge-ok { background: var(--app-ok-bg); color: var(--app-ok); border-color: transparent; }
.app-badge-info { background: var(--app-info-bg); color: var(--app-info); border-color: transparent; }
.app-badge-warn { background: var(--app-warn-bg); color: var(--app-warn); border-color: transparent; }
.app-badge-bad { background: var(--app-bad-bg); color: var(--app-bad); border-color: transparent; }
.app-who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.app-avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--app-border); color: var(--app-text);
  font-size: 10px; font-weight: 600; line-height: 1; display: inline-grid; place-items: center; flex: none;
}
.app-avatar-large { width: 36px; height: 36px; font-size: 14px; }

/* ── Facts, details, timeline, rows ────────────────────────────────── */
.app-facts { display: flex; flex-wrap: wrap; gap: 6px 28px; padding: 14px 16px; }
/* A long word (an email, an address) wraps inside its fact and never
   pushes the page wider than the screen. */
.app-facts > div { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.app-facts div > span { display: block; font-size: 12px; color: var(--app-muted); }
.app-facts div strong { font-weight: 600; font-variant-numeric: tabular-nums; }
/* A fact whose value is a part (a badge, a link, a logo) with a small
   button beside it: the label is the direct child span only, so a badge
   inside the value keeps its own look. */
.app-facts .app-btn-small { margin-left: 6px; vertical-align: baseline; }
/* A client's logo as a fact. A logo is drawn for a white page, so its
   ground is white in light and in dark (the accent's text token is white
   in both). */
.app-logo {
  display: block; height: 40px; width: auto; max-width: 140px; object-fit: contain;
  background: var(--app-accent-text); border: 1px solid var(--app-border);
  border-radius: var(--app-radius-control); padding: 3px;
}
/* The logo in a record head: it is the control that changes it, so it
   carries no label and no button. It sits a little larger, centred on
   the facts beside it. */
.app-facts-logo { align-self: center; }
.app-facts-logo .app-btn-small { margin-left: 0; }
.app-logo-btn { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--app-radius-control); }
.app-logo-btn .app-logo { height: 48px; max-width: 160px; }
.app-logo-btn:hover .app-logo { border-color: var(--app-border-strong); }
.app-details { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.app-details dt { color: var(--app-muted); font-weight: 400; }
.app-details dd { margin: 0; overflow-wrap: anywhere; }
.app-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
/* Only the list's own entries: a list inside an entry (an agent's
   triage note, a comment's bullets) keeps normal list layout (2026-11-30,
   HD-5078 showed a bullet list squeezed into the 22px icon column). */
.app-timeline > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.app-timeline > li time { display: block; font-size: 12px; color: var(--app-muted); }
.app-rows { list-style: none; margin: 0; padding: 0; }
.app-rows > li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 16px; border-bottom: 1px solid var(--app-border);
}
.app-rows > li:last-child { border-bottom: 0; }
.app-rows > li > div { min-width: 0; overflow-wrap: anywhere; }

/* ── Form ──────────────────────────────────────────────────────────── */
.app-form { max-width: 620px; display: flex; flex-direction: column; gap: 16px; margin: 0; }
.app-field { min-width: 0; }
.app-field label { display: block; font-weight: 500; margin: 0 0 4px; }
.app-field textarea.app-input { resize: vertical; display: block; }
.app-field-help { font-size: 13px; color: var(--app-muted); margin: 4px 0 0; }
.app-field-error { font-size: 13px; color: var(--app-bad); font-weight: 500; margin: 4px 0 0; }
.app-field-required { color: var(--app-muted); font-weight: 400; font-size: 12px; }
.app-field .app-check, .app-check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.app-check input { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--app-accent); }

/* ── Note, empty state ─────────────────────────────────────────────── */
/* A quiet note: help under a list or above a tool. Neutral, so it does
   not read as a warning. */
.app-note {
  border: 1px dashed var(--app-border-strong); background: var(--app-surface);
  border-radius: var(--app-radius); padding: 10px 14px; font-size: 13px; margin: 0;
  color: var(--app-muted);
}
.app-note strong { color: var(--app-text); }
.app-empty { padding: 36px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.app-empty-title { font-weight: 600; font-size: 15px; margin: 0; }
.app-empty-text { color: var(--app-muted); margin: 0; max-width: 46ch; }
.app-empty-action { margin-top: 10px; }

/* ── Dialog (the browser's own <dialog>) ───────────────────────────── */
.app-dialog {
  background: var(--app-panel); border: 1px solid var(--app-border-strong); border-radius: var(--app-radius);
  padding: 0; width: 480px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto;
}
.app-dialog::backdrop { background: var(--app-overlay); }
.app-dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--app-border);
}
.app-dialog-head h2 { font-size: 15px; font-weight: 600; line-height: 1.5; margin: 0; }
.app-dialog-close {
  background: none; border: 0; padding: 2px 8px; font-size: 20px; line-height: 1;
  color: var(--app-muted); cursor: pointer; border-radius: var(--app-radius-control);
}
.app-dialog-close:hover { background: var(--app-hover); color: var(--app-text); }
.app-dialog-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.app-dialog-body p { margin: 0; }
.app-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* ── Theme menu (base.html): the colour swatches. Their fill comes from
   app.js, which reads each button's data-app-colour. ───────────────── */
.app-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-swatch {
  width: 24px; height: 24px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--app-panel); outline: 1px solid var(--app-border-input);
}
.app-swatch[aria-pressed="true"] { outline: 2px solid var(--app-text); }
/* The focus ring is drawn outside the pressed mark (which is the same
   shape in the text colour), so focus on the chosen swatch still shows:
   declared after the pressed rule and with the same weight, it wins. */
.app-swatch:focus-visible, .app-swatch[aria-pressed="true"]:focus-visible {
  outline: 3px solid var(--app-accent-ink); outline-offset: 3px;
}
.app-swatch-any { width: 30px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }

/* ── Sub-tabs: the sections of the current tab, a quieter second row ─ */
.app-subtabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 16px; font-size: 13px; }
.app-subtabs a, .app-panel .app-subtabs a {
  display: inline-block; padding: 4px 10px; border-radius: var(--app-radius-control);
  color: var(--app-muted); text-decoration: none; white-space: nowrap;
}
.app-subtabs a:hover, .app-panel .app-subtabs a:hover { background: var(--app-hover); color: var(--app-text); text-decoration: none; }
.app-subtabs a[aria-current="page"], .app-panel .app-subtabs a[aria-current="page"] {
  background: var(--app-accent-soft); color: var(--app-accent-ink); font-weight: 600;
}

/* ── Record head: facts, a line, the tabs, in one panel under the strip ─ */
.app-record-head { margin: 0 0 16px; }
.app-record-head .app-tabs { border-bottom: 0; }
.app-record-head .app-facts + .app-tabs { border-top: 1px solid var(--app-border); }

/* ── Side menu layout: sibling pages on the left, the page on the right ─ */
.app-side-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; color: var(--app-text); }
.app-side-menu { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.app-side-menu a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--app-radius-control);
  color: var(--app-text); text-decoration: none; overflow-wrap: anywhere;
}
.app-side-menu a:hover { background: var(--app-hover); text-decoration: none; }
.app-side-menu a[aria-current="page"] { background: var(--app-accent-soft); color: var(--app-accent-ink); font-weight: 600; }
.app-side-group { font-size: 12px; font-weight: 500; color: var(--app-muted); margin: 12px 0 2px; padding: 0 10px; }
.app-side-group:first-child { margin-top: 0; }
.app-side-count { font-size: 12px; font-weight: 400; color: var(--app-muted); font-variant-numeric: tabular-nums; }
.app-side-content { min-width: 0; }

/* ── Count cards above a list ──────────────────────────────────────── */
.app-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.app-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px;
  background: var(--app-panel); border: 1px solid var(--app-border); border-radius: var(--app-radius);
  color: var(--app-text);
}
a.app-stat, .app-panel a.app-stat { color: var(--app-text); text-decoration: none; }
a.app-stat:hover, .app-panel a.app-stat:hover { background: var(--app-hover); border-color: var(--app-border-strong); text-decoration: none; }
/* The card for the filter the list has now: an edge in the accent ink.
   The ground stays the panel so a toned number still reads on it. */
a.app-stat[aria-current="true"] { border-color: var(--app-accent-ink); box-shadow: inset 0 0 0 1px var(--app-accent-ink); }
.app-stat-label { font-size: 12px; color: var(--app-muted); }
.app-stat-value { font-size: 22px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.app-stat-note { font-size: 12px; color: var(--app-muted); }
.app-stat-ok .app-stat-value { color: var(--app-ok); }
.app-stat-warn .app-stat-value { color: var(--app-warn); }
.app-stat-bad .app-stat-value { color: var(--app-bad); }
.app-stat-info .app-stat-value { color: var(--app-info); }

/* ── Bulk selection: the form round the bar and the table ──────────── */
.app-bulk { margin: 0; }
.app-bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 16px;
  background: var(--app-accent-soft); border-top: 1px solid var(--app-accent-line); color: var(--app-text);
}
/* app.js hides the bar while no row is ticked; display above would
   otherwise win over the hidden attribute. */
.app-bulk-bar[hidden] { display: none; }
.app-bulk-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.app-bulk-bar .app-select { width: auto; padding: 4px 28px 4px 10px; font-size: 13px; }
.app-bulk-clear {
  background: none; border: 0; padding: 0; margin-left: auto; font: inherit; font-size: 13px;
  color: var(--app-accent-ink); cursor: pointer;
}
.app-bulk-clear:hover { text-decoration: underline; }
.app-table th.app-check-cell, .app-table td.app-check-cell { width: 32px; padding-right: 0; }
.app-check-cell input { display: block; width: 16px; height: 16px; margin: 0; accent-color: var(--app-accent); cursor: pointer; }
.app-table tbody tr:has(.app-check-cell input:checked) { background: var(--app-accent-soft); }

/* ── Menu: a button that opens a short list (the browser's <details>) ─ */
.app-menu { position: relative; display: inline-block; }
.app-menu > summary { list-style: none; user-select: none; }
.app-menu > summary::-webkit-details-marker { display: none; }
.app-menu-caret { font-size: 11px; line-height: 1; }
.app-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 180px; max-width: calc(100vw - 32px); padding: 4px;
  display: flex; flex-direction: column;
  background: var(--app-panel); border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius); box-shadow: var(--app-shadow-pop);
}
/* app.js sets this when the list would run off the left of the screen
   (a menu at the left of a phone). */
.app-menu[data-app-menu-align="start"] .app-menu-list { right: auto; left: 0; }
.app-menu-form { margin: 0; display: block; }
.app-menu-item, .app-menu .app-menu-list a.app-menu-item {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none;
  font: inherit; font-family: var(--app-font); font-size: 14px; line-height: 1.5;
  color: var(--app-text); text-decoration: none; white-space: nowrap;
  border-radius: var(--app-radius-control); cursor: pointer;
}
.app-menu-item:hover, .app-menu .app-menu-list a.app-menu-item:hover { background: var(--app-hover); text-decoration: none; }
.app-menu-item.app-menu-danger { color: var(--app-bad); }

/* ── Toasts (AppUI.toast): short messages at the foot of the page. The
   assistant's round button sits at the bottom right (base.html: 48px
   tall, 16px from the edges), so the stack starts 80px up, above it,
   and above the phone's home bar. ──────────────────────────────────── */
.app-toasts {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 1090;
  display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.app-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px;
  background: var(--app-panel); color: var(--app-text);
  border: 1px solid var(--app-border-strong); border-left: 4px solid var(--app-info);
  border-radius: var(--app-radius-control); box-shadow: var(--app-shadow-pop);
}
.app-toast-ok { border-left-color: var(--app-ok); }
.app-toast-warn { border-left-color: var(--app-warn); }
.app-toast-bad { border-left-color: var(--app-bad); }
.app-toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
a.app-toast-text { color: var(--app-accent-ink); text-decoration: underline; }
.app-toast-close {
  flex: none; background: none; border: 0; padding: 0 6px; font-size: 18px; line-height: 1.2;
  color: var(--app-muted); cursor: pointer; border-radius: var(--app-radius-control);
}
.app-toast-close:hover { background: var(--app-hover); color: var(--app-text); }

/* A page whose main column holds a list: under 1280px the side column
   goes below it, so the list has the whole width (Larry, 2026-11-29:
   My Work's Updated column was cut off). Cells pad less under 1440px. */
@media (max-width: 1279.98px) {
  .app-cols:has(> :first-child .app-table-wrap) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1439.98px) {
  .app-table td, .app-table th { padding-left: 12px; padding-right: 12px; }
}

/* ── Phone ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .app-cols { grid-template-columns: minmax(0, 1fr); }
  /* The side menu becomes a wrapping row above the page; a group's
     heading takes a line of its own. */
  .app-side-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .app-side-menu { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .app-side-group { flex-basis: 100%; margin: 6px 0 0; padding: 0 2px; }
  /* Tabs stay on one line and scroll sideways inside their own box, so
     seven tabs never push the page wider than the screen. */
  .app-tabs, .app-subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .app-tabs::-webkit-scrollbar, .app-subtabs::-webkit-scrollbar { display: none; }
  .app-tabs a, .app-subtabs a { flex: none; white-space: nowrap; }
  /* The ring is drawn inside the tab: the scrolling box would cut one
     drawn outside it. */
  .app-tabs a:focus-visible, .app-panel .app-tabs a:focus-visible,
  .app-subtabs a:focus-visible, .app-panel .app-subtabs a:focus-visible { outline-offset: -2px; }
}
@media (max-width: 520px) {
  .app-details { grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
  .app-details dd { margin-bottom: 8px; }
  .app-toolbar .app-input { max-width: none; flex-basis: 100%; }
  .app-toolbar > span:has(> .app-input) { max-width: none; flex-basis: 100%; }
  .app-toolbar-meta { margin-left: 0; }
  /* The date range takes the full width: its label on one line, the
     two inputs sharing the next. */
  .app-toolbar-range { flex-basis: 100%; }
  .app-toolbar-range > span:first-child { flex-basis: 100%; }
  .app-toolbar .app-toolbar-range .app-input { flex: 1 1 0; min-width: 0; }
  .app-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .app-toasts { left: 16px; width: auto; max-width: none; }
}

/* ── Section heading: a title and one line of text between two parts of
   a long page (the parts guide). ───────────────────────────────────── */
.app-section { font-family: var(--app-font); color: var(--app-text); margin-top: 12px; max-width: 78ch; }
.app-section h2 { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 0 0 2px; }
.app-section p { font-size: 14px; line-height: 1.5; color: var(--app-muted); margin: 0; }

/* ── A row of filters: filter_form and more_filters ───────────────────
   A GET form whose fields sit side by side and wrap; each field keeps
   its label above it. more_filters folds one under a "More filters"
   line (the browser's <details>). */
.app-filter-form { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 16px; margin: 0;
  font-family: var(--app-font); font-size: 14px; line-height: 1.5; box-sizing: border-box; }
.app-filter-form * { box-sizing: border-box; }
.app-filter-form .app-field { flex: 0 1 auto; }
.app-filter-form .app-field label { font-size: 12px; color: var(--app-muted); margin-bottom: 2px; }
.app-filter-form .app-input, .app-filter-form .app-select { width: auto; max-width: 100%; }
.app-filter-form .app-check { padding-bottom: 7px; }
.app-filter-form > a { padding-bottom: 7px; }
.app-filters { border-top: 1px solid var(--app-border); font-family: var(--app-font); font-size: 14px; }
.app-filters > summary { padding: 8px 16px; cursor: pointer; color: var(--app-accent-ink); list-style-position: inside; }
.app-filters > summary:focus-visible { outline: 2px solid var(--app-accent-ink); outline-offset: -2px; }
.app-filters[open] > summary { border-bottom: 1px solid var(--app-border); }
@media (max-width: 520px) {
  .app-filter-form .app-field { flex: 1 1 100%; }
  .app-filter-form .app-input, .app-filter-form .app-select { width: 100%; }
}

/* ── Tables that are not plain lists ──────────────────────────────────
   app-tree: rows in parent order; a row says how deep it is with
   data-depth and its first cell is indented by that much.
   app-report: a statement (profit and loss, balance sheet): quiet rules,
   section heads, totals. app-row-head, app-row-total and app-row-grand
   are its three kinds of row; they work in any app-table.
   A table that shows every row it has and sorts in the browser takes
   data-table-sort (upstream's rule, further down).
   app-lines: a table of inputs, one row per line of an entry. */
.app-tree tr[data-depth="1"] > :first-child { padding-left: 34px; }
.app-tree tr[data-depth="2"] > :first-child { padding-left: 52px; }
.app-tree tr[data-depth="3"] > :first-child { padding-left: 70px; }
.app-tree tr[data-depth="4"] > :first-child { padding-left: 88px; }
.app-tree tr[data-depth="5"] > :first-child { padding-left: 106px; }
.app-tree tr[data-depth="6"] > :first-child { padding-left: 124px; }
.app-tree-toggle { border: 0; background: none; padding: 0 4px 0 0; color: var(--app-muted); cursor: pointer; font-size: 12px; }
.app-tree-toggle:focus-visible { outline: 2px solid var(--app-accent-ink); outline-offset: 2px; }
.app-report td, .app-report th { padding-top: 6px; padding-bottom: 6px; }
/* A statement with few amount columns is kept narrow, so a name is
   never far from its number (data-cols: how many amount columns). */
.app-report-panel[data-cols="1"] { max-width: 40rem; }
.app-report-panel[data-cols="2"] { max-width: 50rem; }
.app-report-panel[data-cols="3"] { max-width: 60rem; }
.app-report-panel[data-cols="4"] { max-width: 70rem; }
.app-report-panel[data-cols="5"] { max-width: 80rem; }
.app-report tbody th { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--app-text);
  background: none; border-bottom: 1px solid var(--app-border); }
.app-table tr.app-row-head > * { font-weight: 600; padding-top: 14px; border-bottom: 1px solid var(--app-border-strong); background: none; }
.app-table tr.app-row-total > * { font-weight: 600; border-top: 1px solid var(--app-border-strong); }
.app-table tr.app-row-grand > * { font-weight: 700; background: var(--app-surface); border-top: 1px solid var(--app-border-strong); }
.app-table tfoot th, .app-table tfoot td { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 14px;
  color: var(--app-text); background: var(--app-surface); border-top: 1px solid var(--app-border-strong); border-bottom: 0; padding: 10px 16px; }
.app-table tfoot .app-num { text-align: right; }
.app-lines td { padding: 4px 6px; vertical-align: top; }
.app-lines td:first-child, .app-lines th:first-child { padding-left: 16px; }
.app-lines td:last-child, .app-lines th:last-child { padding-right: 16px; }
.app-lines .app-input, .app-lines .app-select { width: 100%; min-width: 90px; }
.app-lines td.app-num .app-input { text-align: right; min-width: 100px; }
.app-lines tbody tr:hover { background: none; }

/* ── Small words ─────────────────────────────────────────────────────
   app-strong: a figure or a name that matters. app-small (upstream's,
   further down): a second, smaller line of text. app-text-ok and app-text-bad: a figure that is
   right (a zero difference) or wrong; a state, never decoration.
   app-mono: a number that is an identifier (an account number). */
.app-strong { font-weight: 600; }
.app-text-ok { color: var(--app-ok); }
.app-text-bad { color: var(--app-bad); }
.app-text-warn { color: var(--app-warn); }
.app-file { width: auto; max-width: 100%; flex: 1 1 220px; }
.app-panel .app-attachments { margin: 0 0 12px; }
.app-field-error:empty { display: none; }
.app-mono { font-family: var(--app-mono); font-size: 13px; }

/* ── Accounting, cash (checks, deposits, receive payment) ────────────
   Written by hand for these pages; candidates for parts are named in
   the piece's report. app-cash-wide: a form page whose form holds a
   table of lines, so the form takes the page's width. app-cash-fields:
   a row of fields in a wide form. app-cash-bar: a row of small actions
   and a hint inside a list's panel. app-cash-acts: a row's links and
   buttons. */
.app-cash-wide .app-form { max-width: none; }
.app-cash-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: start; max-width: 960px; }
.app-cash-fields .app-input, .app-cash-fields .app-select { width: 100%; }
.app-cash-span2 { grid-column: span 2; }
.app-cash-address { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.app-cash-address .app-input { width: 100%; }
.app-cash-address .app-cash-span3 { grid-column: span 3; }
.app-cash-address .app-cash-span2 { grid-column: span 2; }
.app-cash-amount { text-align: right; font-variant-numeric: tabular-nums; }
.app-filter-form .app-cash-grow { flex: 1 1 280px; max-width: 520px; }
.app-filter-form .app-cash-grow .app-input { width: 100%; }
.app-cash-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 16px; margin: 0;
  border-bottom: 1px solid var(--app-border); }
.app-cash-bar-foot { border-bottom: 0; border-top: 1px solid var(--app-border); }
.app-cash-bar-end { margin-left: auto; }
.app-cash-pick { margin: 0; }
.app-cash-acts { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 6px 12px; white-space: nowrap; }
.app-cash-acts .app-inline-form { display: inline-flex; }
/* A row's Delete and Void are quiet until pointed at: a list of filled
   red buttons would shout. */
.app-cash-acts .app-btn-danger { background: none; color: var(--app-bad); border-color: var(--app-border-input); }
.app-cash-acts .app-btn-danger:hover { background: var(--app-bad-bg); color: var(--app-bad); border-color: var(--app-bad); }
.app-cash-col-x { width: 56px; }
.app-table tr.app-cash-void > td { color: var(--app-muted); }
.app-table tr.app-cash-prior > td { background: var(--app-surface); }
.app-cash-col-wide { width: 45%; }
.app-cash-col-amount { width: 14%; }
.app-cash-col-kind { width: 9%; }
.app-cash-col-account { width: 24%; }
.app-cash-run { margin: 0; padding-left: 20px; }
.app-cash-totals { max-width: 22rem; }
.app-cash-totals dd { text-align: right; font-variant-numeric: tabular-nums; }
.app-note.app-cash-alert-warn { border: 1px solid var(--app-warn); background: var(--app-warn-bg); display: flex; flex-direction: column; gap: 8px; }
.app-note.app-cash-alert-bad { border: 1px solid var(--app-bad); background: var(--app-bad-bg); display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) {
  .app-cash-span2 { grid-column: auto; }
  .app-cash-address { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-cash-address .app-cash-span3, .app-cash-address .app-cash-span2 { grid-column: span 2; }
  .app-cash-acts { flex-wrap: wrap; justify-content: flex-start; white-space: normal; }
  .app-details.app-cash-totals { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .app-cash-totals dd { margin-bottom: 0; }
}

/* ── Accounting: journal piece ───────────────────────────────────────
   The journal list, the entry page, the entry form and the templates.
   app-journal-amount: an amount typed into a field (right aligned,
   not the full width). app-journal-cols: the entry's lines beside its
   details, the lines wider than app-cols gives. app-journal-lines and
   app-journal-template-lines: the column widths of the two line
   editors. app-journal-narrow: a short form kept to a readable width.
   app-journal-row-actions: a list row's buttons, kept on one line.
   app-journal-list: the journal's table, its number column kept narrow.
   app-journal-template-vars: the template's variables editor. */
.app-journal-amount { text-align: right; font-variant-numeric: tabular-nums; }
.app-form .app-field .app-journal-amount { max-width: 14rem; }
.app-journal-narrow { max-width: 720px; }
/* A form that holds a line editor is as wide as its panel; its plain
   fields keep the width of a form. */
.app-form:has(.app-journal-lines), .app-form:has(.app-journal-template-lines) { max-width: none; }
.app-form:has(.app-journal-lines) > .app-two, .app-form:has(.app-journal-lines) > .app-field,
.app-form:has(.app-journal-template-lines) > .app-two { max-width: 760px; }
.app-journal-row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.app-journal-lines th:nth-child(1) { width: 30%; }
.app-journal-lines th:nth-child(2), .app-journal-lines th:nth-child(3) { width: 13%; }
.app-journal-lines th:nth-child(5) { width: 18%; }
.app-journal-template-lines th:nth-child(1) { width: 28%; }
.app-journal-template-lines th:nth-child(2) { width: 10%; }
.app-journal-template-lines th:nth-child(5) { width: 16%; }
.app-lines tfoot [data-total] { font-variant-numeric: tabular-nums; }
.app-journal-list th:first-child { width: 5rem; }
@media (min-width: 861px) {
  .app-journal-cols { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app-journal-lines, .app-journal-template-lines { min-width: 760px; }
  .app-journal-template-vars { min-width: 520px; }
  .app-journal-list td:nth-child(5) { min-width: 14rem; }
}

/* ── Accounting, chart piece (chart of accounts, vendors, bank rules,
   reports index, receivables, accountant export) ─────────────────────
   app-row-acts: the last cell of a row, holding its links and small
   buttons at the right. app-alias-list: a plain list of short codes.
   app-report-index: the reports page's panels, two side by side.
   app-detail-row: a row that holds a table about the row above it.
   app-fieldset and app-indent: a group of radio choices in a form, each
   choice's own fields set in under it. */
.app-table td.app-row-acts { text-align: right; }
.app-row-acts > * + * { margin-left: 12px; }
.app-alias-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.app-report-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.app-index-icon { color: var(--app-muted); margin-right: 4px; }
.app-table tr.app-detail-row > td { padding: 0 0 0 28px; background: var(--app-surface); }
.app-table tr.app-detail-row:hover { background: none; }
.app-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.app-fieldset legend { font-size: 14px; font-weight: 600; padding: 0; margin: 0 0 8px; float: none; width: auto; }
.app-indent { margin-left: 24px; }
.app-note strong.app-text-bad { color: var(--app-bad); }
.app-panel-body > p + .app-inline-form, .app-panel-body > p + .app-btn { display: inline-block; margin-top: 4px; }
/* ── More of a form (2026-11-28, the Admin hub): several boxes under one
   label, a control with a button beside it, a secret shown once. ───── */
.app-checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.app-checks legend { font-weight: 500; font-size: 14px; padding: 0; margin: 0 0 4px; float: none; width: auto; }
.app-check-help { display: block; font-size: 13px; color: var(--app-muted); }
.app-field-row { display: flex; gap: 8px; align-items: flex-start; }
.app-field-row .app-input { flex: 1 1 auto; min-width: 0; }
.app-field-row .app-btn { flex: none; }
.app-channel-result:empty { display: none; }
.app-secret { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.app-secret p { margin: 0; }
.app-secret-title { font-weight: 600; }
.app-code { font-family: var(--app-mono); font-size: 13px; overflow-wrap: anywhere; }

/* ── Text made from markdown, and the box a chart is drawn in. ──────── */
.app-prose { font-size: 14px; line-height: 1.6; color: var(--app-text); overflow-wrap: anywhere; }
.app-prose > :first-child { margin-top: 0; }
.app-prose > :last-child { margin-bottom: 0; }
.app-prose h1, .app-prose h2, .app-prose h3, .app-prose h4 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; }
.app-prose p, .app-prose ul, .app-prose ol { margin: 0 0 10px; }
.app-prose ul, .app-prose ol { padding-left: 22px; }
.app-prose code { font-family: var(--app-mono); font-size: 13px; }
.app-prose img { max-width: 100%; height: auto; }
.app-chart { position: relative; height: 260px; min-width: 0; }
.app-chart canvas { max-width: 100%; }

/* ── Admin hub: integrations ── */
/* A block of code or a command to copy (the API keys page): it scrolls
   sideways inside itself, so a long line never widens the page. */
.app-pre {
  font-family: var(--app-mono); font-size: 13px; line-height: 1.5; color: var(--app-text);
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-control);
  padding: 10px 12px; margin: 0 0 10px; overflow-x: auto; white-space: pre; max-width: 100%;
}
/* The line under a box of the checks part may hold an address with no
   space in it (a scope's endpoint): let it break, so it stays inside
   the panel on a phone. */
.app-check-help { overflow-wrap: anywhere; }

/* ── Admin hub: users ── */
/* The hidden attribute on two parts that set a display of their own:
   the tools above a list of boxes (shown by script) and a box the
   filter hides. */
.app-actions[hidden], .app-check[hidden] { display: none; }
/* ── Admin hub: access ── */
/* The section access grid: a select and the answer it gives now, side by
   side; a sub-section set in under its parent. */
.app-access-cell { display: flex; align-items: center; gap: 8px; }
.app-access-cell .app-select { width: auto; min-width: 11rem; }
.app-access-sub { padding-left: 20px; }
/* A before and after in the audit log: fixed-width, breaking inside a
   long value so the column stays narrow, and scrolling inside itself past
   six lines so one long diff does not make the row a screen tall. */
.app-diff { font-family: var(--app-mono); font-size: 12px; line-height: 1.5; min-width: 12rem; max-width: 26rem; max-height: 9.5rem; overflow-y: auto; overflow-wrap: anywhere; }
.app-diff del { color: var(--app-bad); }
.app-diff ins { color: var(--app-ok); text-decoration: none; }
/* A value to copy in a table cell (a demo link): wide enough to read,
   and the rows of a disclosure under it. */
.app-copy-row { min-width: 20rem; align-items: center; }
.app-disclose { margin-top: 6px; font-size: 13px; }
.app-disclose > summary { cursor: pointer; color: var(--app-accent-ink); }
.app-disclose > p { margin: 6px 0; }
.app-disclose > .app-muted { margin-top: 8px; }

/* ── Admin hub: ai ── */
/* The AI usage pages (templates/admin/ai_usage/, admin/ai_gaps.html).
   A form whose fields are a table takes the page's width, not a form's
   one column; the fields under it keep a column a line can be read in. */
.app-ai-wide > .app-form { max-width: none; }
.app-ai-narrow { max-width: 620px; display: flex; flex-direction: column; gap: 16px; }
/* Inputs in the cells of such a table: an amount with its $ before it,
   a short number, a model picker; and a label with its input on a line. */
.app-ai-form-table td { vertical-align: top; }
.app-ai-money { display: inline-flex; align-items: center; gap: 4px; }
.app-ai-money .app-input, .app-input.app-ai-short { width: 6.5rem; font-variant-numeric: tabular-nums; }
.app-select.app-ai-model { min-width: 13rem; }
.app-ai-pair { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.app-ai-pair:first-child { margin-top: 0; }
/* Spend against a budget is the shared meter (templates/_meter.html);
   only its room on these pages is set here. */
.app-ai-spend { margin-top: 12px; max-width: 32rem; }
.app-ai-form-table .app-meter { min-width: 8rem; margin: 4px 0 6px; }
/* A stopped feature or provider on the Overview: the badge, then the
   sentence. */
.app-ai-alert { display: flex; gap: 10px; align-items: flex-start; border-style: solid; border-color: var(--app-bad); background: var(--app-bad-bg); color: var(--app-text); }
/* The daily chart is taller than a glance card's 220px: its legend
   names every feature. */
.app-ai-daily .app-glance-chart { height: 320px; }
/* More about one thing, closed until asked for (a model's other
   settings, a generated tool's source): the browser's <details>. */
.app-ai-more { border-top: 1px solid var(--app-border); padding: 10px 16px; }
.app-ai-more > summary { cursor: pointer; font-weight: 500; }
.app-ai-more[open] > summary { margin-bottom: 12px; }
/* One entry of a list whose entries are a few lines each (a generated
   tool, a gap the assistant logged). */
.app-ai-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--app-border); min-width: 0; }
.app-ai-item:first-child { border-top: 0; }
.app-ai-item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.app-ai-item p { margin: 0; overflow-wrap: anywhere; }
/* A generated tool's source, closed until asked for, inside an item. */
.app-ai-source > summary { cursor: pointer; font-size: 13px; color: var(--app-muted); }
.app-ai-source[open] > summary { margin-bottom: 6px; }
.app-ai-item > .app-form { max-width: 620px; }
.app-ai-quote { border-left: 3px solid var(--app-border-strong); padding-left: 10px; font-style: italic; color: var(--app-muted); }
/* What a provider's Test answered (static/js/admin/ai-provider-test.js). */
.app-ai-result { font-size: 13px; margin: 6px 0 0; color: var(--app-muted); overflow-wrap: anywhere; }
.app-ai-result:empty { display: none; }
.app-ai-result[data-state="ok"] { color: var(--app-ok); }
.app-ai-result[data-state="bad"] { color: var(--app-bad); }
/* ── Small helpers a hub page needs beside the parts ───────────────── */
/* Quiet 13px text: a line of explanation under a control or a table. */
.app-small { font-size: 13px; }
/* A heading inside a panel body or a form (an <h3>). */
.app-subhead { font-size: 14px; font-weight: 600; line-height: 1.5; margin: 0; color: var(--app-text); }
/* Text a person or a program wrote with its own line breaks. On a <pre>
   it is a box that scrolls when long (a run step's detail). */
.app-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.app-prewrap {
  font-family: var(--app-mono); font-size: 12px; line-height: 1.5; color: var(--app-text);
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-control);
  padding: 8px 10px; margin: 6px 0 0; max-height: 24rem; overflow: auto;
}
/* The outcome of something just done, as text beside its button. */
.app-tone-ok { color: var(--app-ok); }
.app-tone-warn { color: var(--app-warn); }
.app-tone-bad { color: var(--app-bad); }
/* A note that says a state: a warning, or a problem. Same shape as
   app-note, in the state's tint. */
.app-note-warn { border: 1px solid var(--app-warn); background: var(--app-warn-bg); color: var(--app-text); }
.app-note-bad { border: 1px solid var(--app-bad); background: var(--app-bad-bg); color: var(--app-text); }
.app-note-warn strong, .app-note-bad strong { color: var(--app-text); }
/* A smaller control, for a cell of a table. */
.app-input-small { padding: 4px 8px; font-size: 13px; }
/* A control with a button beside it (a channel and its Test button). */
.app-input-row { display: flex; gap: 8px; align-items: center; }
.app-input-row .app-input { flex: 1 1 auto; min-width: 0; }
/* A checkbox drawn as a switch: something that is on or off and saves
   when it is changed. */
.app-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; cursor: pointer;
  width: 34px; height: 20px; margin: 0; border-radius: 999px; vertical-align: middle;
  background: var(--app-border-strong); border: 1px solid var(--app-border-input);
  transition: background-color .15s ease;
}
.app-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--app-panel); transition: transform .15s ease;
}
.app-switch:checked { background: var(--app-accent); border-color: var(--app-accent); }
.app-switch:checked::after { transform: translateX(14px); }
.app-switch:disabled { opacity: .55; cursor: not-allowed; }
.app-switch:focus-visible { outline: 2px solid var(--app-accent-ink); outline-offset: 2px; }
/* A long tick list in a box that scrolls (the clients a role checks). */
.app-check-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px;
  max-height: 16rem; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius-control);
}
/* A filter that came with a link, shown with its way out. */
.app-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 16px 12px; font-size: 13px; }
.app-chips .app-badge a { margin-left: 4px; text-decoration: none; }
/* A key of the keyboard. */
.app-kbd {
  font-family: var(--app-mono); font-size: 11px; line-height: 1.4; padding: 0 5px;
  background: var(--app-surface); color: var(--app-text);
  border: 1px solid var(--app-border-input); border-radius: 4px;
}
/* A cell that holds controls needs room to be typed in. */
.app-cell-wide { min-width: 220px; }
/* ── The work queue (Issues, static/js/issues-queue.js): one finding
   open at a time, the rest one line each. A cleared one fades and the
   rest slide up. ───────────────────────────────────────────────────── */
.app-iq-progress { height: 4px; border-radius: 2px; background: var(--app-border); overflow: hidden; }
.app-iq-progress > i { display: block; height: 100%; width: 0; background: var(--app-ok); transition: width .35s ease; }
.app-iq-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; padding: 12px 16px; }
.app-iq-head p { margin: 0; }
.app-iq-keys { font-size: 13px; color: var(--app-muted); }
.app-iq-keys .app-kbd { margin-left: 8px; }
.app-iq-acts .app-kbd { margin-left: 6px; }
[data-iq-item][hidden], .app-iq-group[hidden], [data-iq-empty][hidden] { display: none; }
[data-iq-item] { transition: opacity .2s ease, transform .2s ease; }
.app-iq { font-family: var(--app-font); font-size: 14px; line-height: 1.5; color: var(--app-text); }
/* Not a button or a badge that is a link: those keep their own colour. */
.app-iq a:not(.app-btn):not(.app-badge) { color: var(--app-accent-ink); text-decoration: none; }
.app-iq a:not(.app-btn):not(.app-badge):hover { text-decoration: underline; }
.app-iq a.app-badge { text-decoration: none; }
.app-iq-group { margin-bottom: 20px; }
.app-iq-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; margin-bottom: 6px; }
.app-iq-group-title { font-weight: 600; font-size: 15px; }
.app-iq-group-acts { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-iq-group-acts form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.app-iq-item {
  margin-bottom: 6px; background: var(--app-panel); border: 1px solid var(--app-border);
  border-radius: var(--app-radius); min-width: 0;
}
.app-iq-item.app-iq-cur { border-color: var(--app-accent-ink); box-shadow: inset 0 0 0 1px var(--app-accent-ink); }
[data-iq-item].app-iq-leaving { opacity: 0; transform: translateX(2.5rem); pointer-events: none; }
[data-iq-item].app-iq-entering { opacity: 0; transform: translateX(2.5rem); }
.app-iq-line { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; min-width: 0; }
.app-iq-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.app-iq-cur .app-iq-title { white-space: normal; overflow-wrap: anywhere; }
.app-iq-when { margin-left: auto; font-size: 13px; color: var(--app-muted); white-space: nowrap; }
.app-iq-quick { display: none; gap: 5px; margin: 0 0 0 auto; flex: none; }
.app-iq-mini { padding: 1px 8px; font-size: 12px; }
@media (hover: hover) {
  .app-iq-item:not(.app-iq-cur) .app-iq-line:hover .app-iq-quick { display: flex; }
  .app-iq-item:not(.app-iq-cur) .app-iq-line:hover .app-iq-when { display: none; }
}
.app-iq-body { display: none; padding: 0 14px 14px; }
.app-iq-cur .app-iq-body { display: block; }
.app-iq-detail { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }
.app-iq-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.app-iq-label { width: 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.app-iq-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--app-border); padding-top: 11px; }
.app-iq-acts form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.app-iq-acts-end { margin-left: auto; }
.app-btn.app-iq-ok { border-color: var(--app-ok); color: var(--app-ok); }
.app-btn.app-iq-ok:hover { background: var(--app-ok-bg); border-color: var(--app-ok); color: var(--app-ok); }
.app-iq-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8rem); z-index: 1080;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 14px;
  font-family: var(--app-font); font-size: 14px; line-height: 1.5;
  border-radius: var(--app-radius-control); background: var(--app-panel); color: var(--app-text);
  border: 1px solid var(--app-border-strong); box-shadow: var(--app-shadow-pop); transition: transform .25s ease;
}
.app-iq-toast.app-iq-on { transform: translate(-50%, 0); }
.app-iq-toast.app-iq-bad { border-color: var(--app-bad); }
.app-iq-toast button, .app-iq-toast a {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--app-accent-ink); white-space: nowrap; cursor: pointer; text-decoration: none;
}
.app-iq-page-leaving { opacity: 0; transform: translateX(2.5rem); transition: opacity .2s ease, transform .2s ease; }
.app-iq-place { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
@media (max-width: 520px) { .app-iq-when, .app-iq-keys, .app-iq-source { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .app-iq-item, [data-iq-item], .app-iq-toast, .app-iq-progress > i, .app-iq-page-leaving, .app-switch, .app-switch::after { transition: none; }
}

/* ── A table that sorts in the browser (static/js/table-sort.js): a
   short report table marked data-table-sort. A list uses sort_head. ──── */
.app-table[data-table-sort] thead th { cursor: pointer; user-select: none; }
.app-table[data-table-sort] thead th[data-nosort] { cursor: default; }
.app-table[data-table-sort] thead th:hover { color: var(--app-text); }
.app-table[data-table-sort] thead th[aria-sort="ascending"]::after { content: " \2191"; }
.app-table[data-table-sort] thead th[aria-sort="descending"]::after { content: " \2193"; }
/* A line of text between two panels of a stack keeps the stack's gap. */
.app-stack > p { margin: 0; }
/* A control in a row of small parts is as wide as what it holds. */
.app-actions > .app-input, .app-actions > .app-select { width: auto; }
/* The hidden attribute wins over a part's own display (a button, a row
   of chips a script shows later), also once Bootstrap's reset is gone. */
[class^="app-"][hidden], [class*=" app-"][hidden] { display: none; }
.app-chips:empty { display: none; }

/* ── When a stored value is from, with its Refresh now (as_of) ─────── */
.app-as-of { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
/* ── Accounting, close piece (Home, Reconcile, Close) ────────────────
   Written by hand for these pages; candidates for parts are named in
   the piece's report. Home: app-close-glances (the chart cards, two
   side by side), app-close-three (three short panels in a row),
   app-close-figure (one large figure in a panel), app-close-banner (a
   note with its button at the right), app-close-sync (a short list at
   a panel's foot). A list of the month-end checklist: app-close-checklist
   with app-close-icon for its mark. Reconcile list: app-close-head and
   app-close-title (a panel head holding a badge and buttons),
   app-close-history (a <details> of the account's history at the foot
   of its panel). Close: app-close-reopened (a row that no longer
   holds). The glance card's list (app-glance-list, filled by
   accounting-glances.js: app-glance-detail, app-glance-value,
   app-glance-empty). The Reconcile workspace (a tool): app-rec-head
   (the figures, sticky under the shell; its top is set by
   accounting-reconcile.js), app-rec-fig, app-rec-filters, app-rec-seg
   (a row of radio buttons drawn as one segmented control),
   app-rec-table with app-rec-cleared rows and the round app-rec-tick. */
.app-close-glances { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.app-close-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; align-items: start; }
.app-close-figure { font-size: 24px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.app-close-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.app-close-sync { list-style: none; margin: 0; padding: 10px 16px; border-top: 1px solid var(--app-border); display: flex; flex-direction: column; gap: 2px; }
.app-close-checklist td.app-close-icon { width: 2.5rem; text-align: center; padding-right: 0; }
/* On a phone the checklist keeps readable lines and its wrap scrolls sideways. */
.app-close-checklist td:nth-child(2) { min-width: 12rem; }
.app-close-head { flex-wrap: wrap; }
.app-close-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.app-close-history { border-top: 1px solid var(--app-border); }
.app-close-history > summary { padding: 10px 16px; cursor: pointer; color: var(--app-accent-ink); font-size: 13px; }
.app-close-history[open] > summary { border-bottom: 1px solid var(--app-border); }
.app-close-history-note { padding: 8px 16px 0; }
.app-close-narrow { max-width: 720px; }
.app-close-amount { text-align: right; font-variant-numeric: tabular-nums; max-width: 14rem; }
.app-close-label { display: block; font-weight: 500; margin: 0 0 4px; }
.app-close-panel-line { padding: 10px 16px; border-bottom: 1px solid var(--app-border); }
.app-close-side { max-width: 520px; }
.app-table tr.app-close-reopened > td { color: var(--app-muted); }
.app-glance-detail { margin-left: 6px; }
.app-glance-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-glance-empty { padding: 16px; font-size: 13px; }

.app-rec-head {
  position: sticky; top: 0; z-index: 1010; margin: 0 0 16px;
  background: var(--app-panel); border: 1px solid var(--app-border); border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-pop); padding: 12px 16px; color: var(--app-text);
  font-family: var(--app-font); font-size: 14px; line-height: 1.5;
}
.app-rec-figs { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.app-rec-statement { display: flex; flex-direction: column; gap: 2px; margin-right: auto; min-width: 0; }
.app-rec-label { font-size: 13px; color: var(--app-muted); }
.app-rec-label strong { color: var(--app-text); font-weight: 600; }
.app-rec-fig { display: flex; flex-direction: column; min-width: 7.5rem; }
.app-rec-fig strong { font-size: 20px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.app-rec-fig span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); }
.app-rec-fig span span { font-size: inherit; letter-spacing: inherit; }
.app-rec-diff { flex-direction: row; align-items: center; gap: 8px; }
.app-rec-diff > div { display: flex; flex-direction: column; }
.app-rec-diff strong { font-size: 24px; }
.app-rec-diff > i { font-size: 28px; line-height: 1; }
.app-rec-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--app-border); }
.app-rec-bar > span:first-child { margin-right: auto; }
.app-rec-actions .app-form { display: inline-flex; max-width: none; }
.app-rec-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--app-border); }
.app-rec-filters .app-input { width: auto; }
.app-rec-filters .app-rec-q { flex: 1 1 220px; max-width: 320px; }
.app-rec-shown { margin-left: auto; }
.app-rec-seg { display: inline-flex; border: 1px solid var(--app-border-input); border-radius: var(--app-radius-control); overflow: hidden; }
.app-rec-seg-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.app-rec-seg label { padding: 4px 12px; font-size: 13px; cursor: pointer; margin: 0; background: var(--app-panel); color: var(--app-text); }
.app-rec-seg label + input + label { border-left: 1px solid var(--app-border-input); }
.app-rec-seg-input:checked + label { background: var(--app-accent-soft); color: var(--app-accent-ink); font-weight: 600; }
.app-rec-seg-input:focus-visible + label { outline: 2px solid var(--app-accent-ink); outline-offset: -2px; }
.app-rec-table tbody tr { cursor: pointer; }
.app-rec-table tbody tr.app-rec-cleared > td { background: var(--app-ok-bg); }
.app-rec-table td.app-rec-text { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-rec-table .app-rec-tick-cell { width: 3.5rem; text-align: center; }
.app-rec-tick-cell .app-form { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; max-width: none; }
.app-rec-tick { width: 1.25rem; height: 1.25rem; margin: 0; cursor: pointer; accent-color: var(--app-ok); vertical-align: middle; }
.app-rec-tick:focus-visible { outline: 2px solid var(--app-accent-ink); outline-offset: 2px; }
@media (max-width: 767.98px) {
  .app-rec-head { position: static; }
  .app-rec-fig { min-width: 6rem; }
  .app-rec-statement { flex-basis: 100%; }
}

/* ── Accounting, review piece (the bank-feed grid, templates/accounting/
   review.html, static/js/accounting-review.js) ───────────────────────
   A tool: these are the grid's own shapes, written by hand. app-rv-cards
   and app-rv-card: one card per bank account (bank, books, lines waiting;
   the current one has aria-current). app-rv-grid: the grid, one line per
   bank transaction and a drawer row (app-rv-drawer) under it; on a phone
   each line is a block. app-rv-fldwrap: a picker that reads as plain text
   until pointed at (QuickBooks' look). app-rv-pill: where a suggestion
   came from. app-rv-batch: the ticked lines' bar, kept at the foot of the
   screen. app-rv-toast: the Undo toast with its countdown line.
   app-rv-inv: the Apply to invoice panel. The app-rv-is-… classes are the
   states the script sets (open, current, ticked, leaving, coming back). */
.app-rv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app-rv-attention ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.app-rv-attention .app-inline-form .app-btn { vertical-align: baseline; }
/* Account cards. */
.app-rv-cards { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--app-font); font-size: 14px; line-height: 1.5; }
.app-rv-card {
  position: relative; display: flex; flex-direction: column; width: 290px; max-width: 100%; padding: 11px 14px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-panel);
  color: var(--app-text); text-decoration: none; box-sizing: border-box;
}
a.app-rv-card:hover { border-color: var(--app-accent-ink); color: var(--app-text); text-decoration: none; }
a.app-rv-card[aria-current="true"] { border-color: var(--app-ok); box-shadow: inset 0 0 0 1px var(--app-ok); }
.app-rv-card-name { font-size: 13px; padding-right: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-rv-card-n {
  position: absolute; right: 12px; top: 10px; background: var(--app-text); color: var(--app-panel);
  font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 8px; font-variant-numeric: tabular-nums;
}
.app-rv-card-bank { font-size: 20px; font-weight: 700; margin: 5px 0 1px; font-variant-numeric: tabular-nums; }
.app-rv-card-sub { font-size: 13px; color: var(--app-muted); }
.app-rv-card-diff { font-size: 12px; color: var(--app-warn); }
/* The toolbar: search, two selects, Suggest with AI, the pager. */
.app-rv-tool .app-rv-pager { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.app-rv-pager a { padding: 0 4px; font-size: 16px; }
.app-rv-off { padding: 0 4px; font-size: 16px; color: var(--app-border-strong); }
.app-rv-flash { padding: 0 16px; font-size: 13px; }
.app-rv-flash:not(:empty) { padding-bottom: 10px; }
.app-rv-flash-link { margin-left: 8px; }
.app-rv-spin {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--app-border-strong); border-right-color: transparent; animation: app-rv-spin .75s linear infinite;
}
@keyframes app-rv-spin { to { transform: rotate(360deg); } }
/* The grid. */
.app-table.app-rv-grid { table-layout: fixed; width: 100%; }
.app-rv-grid > thead > tr > th { padding: 8px; font-size: 13px; }
.app-rv-grid > tbody > tr > td { padding: 5px 8px; height: 50px; vertical-align: middle; }
.app-rv-grid > tbody > tr:last-child > td { border-bottom: 1px solid var(--app-border); }
.app-rv-grid > tbody > tr[data-txn-row]:hover > td { background: var(--app-hover); }
.app-rv-grid > tbody > tr:hover { background: none; }
.app-rv-grid > tbody > tr[data-txn-row].app-rv-is-open > td, .app-rv-grid > tbody > tr.app-rv-drawer > td { background: var(--app-surface); }
.app-rv-grid > tbody > tr[data-txn-row].app-rv-is-open > td { border-bottom-color: transparent; }
.app-rv-grid > tbody > tr[data-txn-row].app-rv-is-ticked > td { background: var(--app-accent-soft); }
.app-rv-grid > tbody > tr[data-txn-row].app-rv-is-current > td:first-child { box-shadow: inset 3px 0 0 var(--app-accent); }
.app-rv-grid .app-rv-ck { width: 42px; text-align: center; }
.app-rv-ck input { width: 16px; height: 16px; margin: 0; accent-color: var(--app-accent); cursor: pointer; vertical-align: middle; }
.app-rv-grid .app-rv-date { width: 106px; white-space: nowrap; }
.app-rv-grid .app-rv-amt { width: 112px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.app-rv-grid .app-rv-from { width: 17%; }
.app-rv-grid .app-rv-cat { width: 27%; }
.app-rv-grid .app-rv-act { width: 120px; white-space: nowrap; }
.app-rv-open { cursor: pointer; }
.app-rv-short { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-rv-raw { font-size: 12px; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-rv-empty { padding: 16px; font-size: 13px; }
/* A suggestion reads as plain text; the field shows on hover / focus, as QuickBooks does.
   (searchable-select.js puts a text input beside each picker, with the picker's classes.) */
.app-rv-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.app-rv-cell > .app-rv-fldwrap { flex: 1 1 auto; min-width: 0; }
.app-rv-fldwrap .app-input { border-color: transparent; background-color: transparent; text-overflow: ellipsis; }
tr[data-txn-row]:hover .app-rv-fldwrap .app-input, .app-rv-fldwrap .app-input:focus,
.app-rv-fldwrap.app-rv-is-empty .app-input { border-color: var(--app-border-input); background-color: var(--app-panel); }
.app-rv-pill {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  border-radius: 3px; padding: 2px 6px; background: var(--app-surface); color: var(--app-muted);
}
.app-rv-pill-rule { background: var(--app-ok-bg); color: var(--app-ok); }
.app-rv-pill-match { background: var(--app-info-bg); color: var(--app-info); }
.app-rv-pill-memory { background: var(--app-surface); color: var(--app-muted); border: 1px solid var(--app-border); }
.app-rv-pill-ai { background: var(--app-warn-bg); color: var(--app-warn); }
.app-rv-pill-invoice { background: var(--app-accent-soft); color: var(--app-accent-ink); }
.app-rv-set { color: var(--app-ok); flex: 0 0 auto; }
.app-rv-unsure { color: var(--app-info); flex: 0 0 auto; cursor: help; }
.app-rv-mc { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.app-rv-mc > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-rv-mc small { font-size: 12px; color: var(--app-muted); }
.app-rv-mc small.app-text-warn { color: var(--app-warn); }
/* A button that reads as a link (Post, the drawer's actions, Undo). */
.app-rv-link {
  background: none; border: 0; padding: 2px 4px; font: inherit; font-family: var(--app-font); font-weight: 600;
  color: var(--app-accent-ink); cursor: pointer; text-decoration: none; border-radius: var(--app-radius-control);
}
.app-rv-link:hover { text-decoration: underline; }
.app-rv-link:disabled { color: var(--app-muted); cursor: not-allowed; }
.app-rv-link:focus-visible, .app-rv-chev:focus-visible, .app-rv-card:focus-visible, .app-rv-inv-pick:focus-visible {
  outline: 2px solid var(--app-accent-ink); outline-offset: 2px;
}
.app-rv-act .app-form { display: inline; }
.app-rv-menu { vertical-align: middle; }
.app-rv-chev {
  display: inline-flex; align-items: center; padding: 3px 6px; line-height: 1; cursor: pointer;
  color: var(--app-text); border-radius: var(--app-radius-control);
}
.app-rv-chev:hover { background: var(--app-hover); }
/* The drawer: the rest of a line, under it. */
.app-rv-grid > tbody > tr.app-rv-drawer > td { padding: 4px 16px 16px; height: auto; white-space: normal; }
.app-rv-dr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; max-width: 1100px; }
.app-rv-dr .app-rv-full { grid-column: 1 / -1; }
.app-rv-dr .app-field label { font-size: 13px; margin-bottom: 2px; }
.app-rv-memo { max-width: 520px; }
.app-rv-dr-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 12px; }
.app-rv-dr-foot .app-rv-link { padding: 0; }
.app-rv-grow { margin-left: auto; }
.app-rv-items { max-width: 720px; }
.app-rv-items .app-table td, .app-rv-items .app-table th { padding: 3px 8px; font-size: 13px; }
/* Leaving / coming back (accounting-review.js). */
tr[data-txn-row].app-rv-is-leaving, tr.app-rv-drawer.app-rv-is-leaving { opacity: 0; transition: opacity .18s ease-out; }
tr[data-txn-row].app-rv-is-arriving { opacity: 0; }
tr[data-txn-row].app-rv-is-arrived { opacity: 1; transition: opacity .18s ease-in; }
@media (prefers-reduced-motion: reduce) {
  tr[data-txn-row].app-rv-is-leaving, tr[data-txn-row].app-rv-is-arrived { transition: none; }
  .app-rv-spin { animation: none; }
}
.app-rv-load-next { padding: 0 16px 16px; font-size: 13px; }
.app-rv-note { padding: 8px 16px 0; }
/* The ticked lines' bar (QuickBooks' batch bar): Post / Edit / Exclude, at the foot of the screen. */
.app-bulk-bar.app-rv-batch { position: sticky; bottom: 0; z-index: 20; border-radius: 0 0 var(--app-radius) var(--app-radius); }
.app-rv-batch-sum { font-weight: 600; margin-right: auto; font-variant-numeric: tabular-nums; }
.app-rv-batch .app-form { display: inline; }
.app-rv-batch .app-bulk-clear { margin-left: 0; }
/* The Undo toast: bottom left, one at a time (the newest held action, and how many more). */
.app-rv-toast {
  position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 1080;
  min-width: 260px; max-width: min(460px, calc(100vw - 96px));
  font-family: var(--app-font); font-size: 14px; line-height: 1.5;
  background: var(--app-panel); color: var(--app-text); border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius); box-shadow: var(--app-shadow-pop); overflow: hidden;
}
.app-rv-toast-line { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.app-rv-toast-line + .app-rv-toast-line { border-top: 1px solid var(--app-border); }
.app-rv-toast-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-rv-toast-bar { height: 3px; background: var(--app-accent); transform-origin: left; }
.app-rv-toast-error { color: var(--app-bad); }
.app-rv-toast .app-rv-link { padding: 0; }
/* The pop-ups. */
#split-modal.app-dialog { width: 880px; }
#split-modal .app-form { max-width: none; }
.app-rv-split th:nth-child(1) { width: 34%; }
.app-rv-split th:nth-child(2) { width: 16%; }
.app-rv-split th:nth-child(5) { width: 48px; }
.app-rv-amount { text-align: right; font-variant-numeric: tabular-nums; }
.app-rv-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.app-rv-keys li { display: flex; justify-content: space-between; gap: 16px; }
/* Apply to invoice: the panel in a line's drawer; search hits float over the list. */
.app-rv-inv {
  max-width: 640px; margin-top: 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; background: var(--app-panel); border: 1px solid var(--app-border); border-radius: var(--app-radius-control);
}
.app-rv-inv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.app-rv-inv-close, .app-rv-inv-apply { margin-left: auto; }
.app-rv-inv-find { position: relative; }
.app-rv-inv-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; max-height: 240px; overflow-y: auto;
  background: var(--app-panel); box-shadow: var(--app-shadow-pop); border-radius: var(--app-radius-control);
}
.app-rv-inv-results:empty { display: none; }
.app-rv-inv-hit {
  display: block; width: 100%; text-align: left; padding: 5px 10px; font: inherit; font-size: 13px;
  background: var(--app-panel); color: var(--app-text); border: 1px solid var(--app-border); border-top: 0;
}
.app-rv-inv-hit:first-child { border-top: 1px solid var(--app-border); }
.app-rv-inv-pick { cursor: pointer; }
.app-rv-inv-pick:hover { background: var(--app-hover); }
.app-rv-inv-pick .app-muted { margin-left: 8px; }
.app-rv-inv-table td, .app-rv-inv-table th { padding: 3px 8px; font-size: 13px; }
.app-rv-inv-table input { width: 15px; height: 15px; margin: 0; accent-color: var(--app-accent); }
.app-rv-inv-head { color: var(--app-muted); font-weight: 600; padding-top: 8px; }
body.rows-compact .app-rv-grid > tbody > tr[data-txn-row] > td { height: 37px; padding-top: 2px; padding-bottom: 2px; }
body.rows-compact .app-rv-raw { display: none; }
/* A phone: each line is a block, its tick box at the top right. */
@media (max-width: 900px) {
  .app-rv-grid, .app-rv-grid > tbody, .app-rv-grid > tbody > tr, .app-rv-grid > tbody > tr > td { display: block; width: 100% !important; }
  .app-rv-grid > thead { display: none; }
  .app-rv-grid > tbody > tr[data-txn-row], .app-rv-grid > tbody > tr[data-history-row] {
    position: relative; padding: 6px 0; border-bottom: 1px solid var(--app-border);
  }
  .app-rv-grid > tbody > tr > td { height: auto; border: 0; padding: 2px 12px; text-align: left !important; }
  .app-rv-grid > tbody > tr:last-child > td { border-bottom: 0; }
  .app-rv-grid .app-rv-ck { position: absolute; right: 0; top: 6px; width: auto !important; }
  .app-rv-grid > tbody > tr[data-txn-row].app-rv-is-current > td:first-child { box-shadow: none; }
  .app-rv-grid > tbody > tr[data-txn-row].app-rv-is-current { box-shadow: inset 3px 0 0 var(--app-accent); }
  .app-rv-grid .app-rv-amt:empty { display: none; }
  .app-rv-grid > tbody > tr[data-txn-row] > td.app-rv-date, .app-rv-grid > tbody > tr[data-txn-row] > td:nth-child(3) { padding-right: 44px; }
  .app-rv-dr { grid-template-columns: minmax(0, 1fr); }
  #split-modal .app-rv-split { min-width: 640px; }
}
/* ── Accounting, setup piece (the setup pages, bank feeds, Plaid connect,
   Gusto explorer) ─────────────────────────────────────────────────────
   app-setup-wide: a table inside a form (the Stripe mappings, the feed
   map) takes the page's width, not the form's 620px. app-plaid-tool: the
   Plaid connect tool keeps its narrow column. */
.app-form:has(.app-setup-wide) { max-width: none; }
.app-plaid-tool { max-width: 640px; }
/* app-setup-pages: on these pages the blocks in a panel (a note, a line
   of state, a form) keep 12px apart. */
.app-setup-pages .app-panel-body > * + * { margin-top: 12px; }
/* ── Accounting, qbo piece (QuickBooks import wizard, opening balances,
   compare, history, history proof, the carry preview) ─────────────────
   app-qbo-step: a numbered step of a wizard (a panel with its own id);
   app-qbo-step-no its number; app-qbo-step-body keeps the blocks in it
   12px apart. app-qbo-connection: a note with a button at its right.
   app-qbo-row: fields side by side that wrap (a date and its button).
   app-qbo-job: a running background job, with app-qbo-job-bar the bar
   static/js/accounting-qbo.js moves (a task in progress, not a figure).
   app-qbo-halves: two panels or tables side by side, one column on a
   phone. app-qbo-proof-year: one year of the proof, kept on one sheet
   when printed. */
.app-qbo-step-no {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 6px; border-radius: 11px; background: var(--app-surface); border: 1px solid var(--app-border-strong);
  font-size: 12px; font-weight: 600; color: var(--app-muted); margin-right: 4px;
}
.app-qbo-step-body > * + * { margin-top: 12px; }
.app-qbo-step-body > * { margin-bottom: 0; }
.app-qbo-step .app-table-wrap, .app-qbo-unmapped .app-table-wrap { border: 1px solid var(--app-border); border-radius: var(--app-radius-control); }
.app-qbo-step .app-form, .app-qbo-unmapped .app-form { max-width: none; }
.app-form:has(.app-qbo-unmapped) { max-width: none; }
.app-qbo-connection { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.app-qbo-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.app-qbo-row > .app-field { flex: 0 1 auto; margin: 0; }
.app-qbo-row .app-check { padding-bottom: 8px; }
.app-qbo-year { width: 7.5em; }
.app-qbo-notes ul { margin: 4px 0 0; padding-left: 18px; }
.app-qbo-notes summary { cursor: pointer; color: var(--app-accent-ink); }
.app-qbo-unmapped { border-color: var(--app-warn); }
.app-qbo-job { border: 1px solid var(--app-border); border-radius: var(--app-radius-control); padding: 8px 10px; font-size: 13px; }
.app-qbo-job-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.app-qbo-job-bar { height: 8px; border-radius: 4px; background: var(--app-border); overflow: hidden; }
.app-qbo-job-bar > i { display: block; height: 100%; width: 0; background: var(--app-accent); transition: width .35s ease; }
.app-qbo-job-bar[data-state="ok"] > i { background: var(--app-ok); }
.app-qbo-job-bar[data-state="bad"] > i { background: var(--app-bad); }
.app-qbo-job pre { margin: 8px 0 0; }
.app-qbo-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 860px) { .app-qbo-halves { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .app-qbo-job-bar > i { transition: none; } }
@media print {
  body:has([data-qbo-proof]) nav, body:has([data-qbo-proof]) footer,
  body:has([data-qbo-proof]) [data-tour="hubbar"], body:has([data-qbo-proof]) .app-strip-actions { display: none !important; }
  .app-qbo-proof-year { break-inside: avoid; }
}
.app-qbo-row-acts { justify-content: flex-end; }
.app-qbo-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
/* ── Admin hub: hubs ── */
/* The hub overviews, All settings and Owner Pulse (templates/hubs/,
   pulse/index.html). A grid of panels: a hub's groups of pages, as many
   side by side as fit, one column on a phone. */
.app-hubs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
/* Wider tiles: chart cards and report tables, two side by side on a
   desk, one on a phone; app-hubs-span takes the whole row. */
.app-hubs-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.app-hubs-charts > * { min-width: 0; }
.app-hubs-span { grid-column: 1 / -1; }
/* The line under the title, and a hub page's item link with its icon. */
.app-hubs-lede { margin: 0; }
.app-hubs-item { font-weight: 600; }
.app-hubs-item > i { color: var(--app-muted); margin-right: 4px; }
/* The All settings filter box. */
.app-hubs-search { max-width: 24rem; }
/* An item the filter hid (the rows set a display of their own). */
.app-hubs-filtered[hidden] { display: none; }
/* A long table that scrolls inside its panel (Pulse: churn, overdue). */
.app-hubs-scroll { max-height: 22rem; overflow: auto; }
/* The Sales stage figures: for screen readers and keyboards, out of
   sight until a link inside has the focus. */
.app-hubs-figures:not(:focus-within) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
/* The short list under a glance chart (data-glance-list, filled by
   static/js/accounting-glances.js): label left, value right. */
.app-glance-list { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.app-glance-list li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid var(--app-border); }
.app-glance-list li > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-glance-list li > span > span { margin-left: 4px; color: var(--app-muted); }
/* A one-panel page for a visitor (the console grant result pages). */
.app-hubs-narrow { max-width: 560px; margin: 24px auto; }
/* ── Admin hub: staff ── */
/* A profile picture (templates/staff/_photo.html): the person's own
   colour (an SVG fill) under the initials, the picture over both. */
.app-photo { position: relative; overflow: hidden; }
.app-photo > svg, .app-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
.app-photo > img { object-fit: cover; }
.app-photo-initials { position: relative; }
.app-photo-initials.app-photo-on { color: var(--app-accent-text); }
/* Staff Home: the tour banner (its words, then its two buttons), the
   line under the count cards, one announcement, the quote. */
.app-home-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.app-home-foot { margin: 0; text-align: right; }
@media (max-width: 520px) { .app-home-foot { text-align: left; } }
.app-home-ann { padding: 12px 0; border-top: 1px solid var(--app-border); }
.app-home-ann:first-child { padding-top: 0; border-top: 0; }
.app-home-ann:last-child { padding-bottom: 0; }
.app-home-ann > .app-muted { margin: 4px 0 0; }
.app-home-ann .app-prose { margin-top: 4px; }
.app-home-ann-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.app-home-ann-head .app-subhead { overflow-wrap: anywhere; min-width: 0; }
.app-home-quote { margin: 0 0 6px; font-size: 16px; font-style: italic; line-height: 1.5; color: var(--app-text); }
/* The staff directory on a phone: one card per person; each cell's
   data-label names it. */
@media (max-width: 520px) {
  .app-dir-table thead { display: none; }
  .app-dir-table, .app-dir-table tbody, .app-dir-table tr, .app-dir-table td { display: block; width: 100%; }
  .app-dir-table tr { padding: 8px 0; border-bottom: 1px solid var(--app-border); }
  .app-dir-table tbody tr:last-child { border-bottom: 0; }
  .app-dir-table td { border: 0; padding: 2px 16px; overflow-wrap: anywhere; }
  .app-dir-table td[data-label] { display: flex; gap: 8px; padding-left: 46px; }
  .app-dir-table td[data-label]::before { content: attr(data-label); flex: 0 0 4rem; color: var(--app-muted); font-size: 12px; }
  .app-dir-table td[data-label="Title"]::before { content: none; }
}

/* ── Record head, identity and status (2026-11-29, option B) ──
   record_identity: the picture beside the name, one quiet line of
   facts; record_status: up to four boxes that are each the control. */
.app-identity-who { display: flex; gap: 14px; align-items: center; min-width: 0; }
.app-identity-pic { flex: none; }
.app-identity-meta { margin: 2px 0 0; color: var(--app-muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 14px; overflow-wrap: anywhere; }
.app-status-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); border-bottom: 1px solid var(--app-border); }
.app-status-form { margin: 0; display: flex; min-width: 0; }
.app-status { display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; padding: 12px 16px; border: 0; border-right: 1px solid var(--app-border); background: transparent; color: var(--app-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.app-status-row > :last-child, .app-status-row > :last-child .app-status { border-right: 0; }
.app-status-plain { cursor: default; }
.app-panel a.app-status, .app-panel a.app-status:hover { color: var(--app-text); }
a.app-status:hover, button.app-status:hover { background: var(--app-hover); text-decoration: none; }
a.app-status:focus-visible, button.app-status:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.app-status-label { font-size: 12px; color: var(--app-muted); }
.app-status-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.app-status-value { font-weight: 600; }
.app-status-go { font-size: 12px; color: var(--app-accent-ink); white-space: nowrap; }
.app-status-note { font-size: 12px; color: var(--app-muted); }
.app-status-pick { cursor: default; }
.app-status-select { width: 100%; max-width: 100%; font-weight: 600; }
.app-status .app-meter { margin-top: 4px; }
/* A record with no logo yet: an empty square that says "Add logo" and is
   the control that adds one (the organization page). */
.app-logo-add {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 2px;
  border: 1px dashed var(--app-border-input); border-radius: var(--app-radius-control);
  background: var(--app-accent-soft); color: var(--app-accent-ink);
  font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.1; text-align: center; cursor: pointer;
}
.app-logo-add:hover { border-color: var(--app-accent); }
.app-logo-add:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
/* On a phone a wide logo beside the name would squeeze the name; it
   sits smaller there. */
@media (max-width: 640px) {
  .app-identity-pic .app-logo-btn .app-logo { height: 40px; max-width: 88px; }
}
@media (max-width: 640px) {
  .app-status-row { grid-template-columns: minmax(0, 1fr); }
  .app-status { border-right: 0; border-bottom: 1px solid var(--app-border); }
  .app-status-row > :last-child .app-status, .app-status-row > .app-status:last-child { border-bottom: 0; }
}

/* ── Billing hub (2026-11-29) ──
   app-bill-wide: a page whose one form holds tables (the invoice
   builder's preview), so the form runs the page's width. app-bill-options:
   the form's head row (a field and the buttons, wrapping on a phone).
   app-bill-company: one organization's head in the preview, the tick and
   name on the left, hours and total on the right (app-bill-total). */
.app-bill-wide .app-form { max-width: none; }
.app-bill-options { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.app-bill-options > .app-field { max-width: 12rem; margin: 0; }
.app-bill-company { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; }
.app-bill-company .app-check { font-weight: 600; }
.app-bill-total { text-align: right; }
.app-bill-reassign > .app-select { flex: 0 1 20rem; }

/* ── Drag to reorder (2026-11-29) ──
   app-drag-handle: the grip a row is dragged by (part drag_handle). It
   shows only in a list static/tasks/reorder.js has wired
   ([data-reorder-ready]); without script the row's menu moves it.
   app-drag-ghost / app-drag-chosen / app-drag-fallback: the classes
   SortableJS puts on the row being dragged. app-order-cell: the narrow
   first cell that holds the grip and the row's menu. app-menu-icon: a
   menu whose button is an icon (menu(..., icon=)). app-menu-float: a
   menu inside a table's sideways-scrolling wrap, its list placed over
   the page by app.js so the wrap never cuts it. app-wide-only /
   app-narrow-only: a cell or line shown only wider / narrower than a
   phone (520px), so a table fits a phone without scrolling sideways. */
.app-drag-handle { display: none; align-items: center; justify-content: center; width: 24px; height: 28px; padding: 0;
  border: 0; border-radius: var(--app-radius-control); background: none; color: var(--app-muted);
  cursor: grab; touch-action: none; font-size: 16px; line-height: 1; vertical-align: middle; }
[data-reorder-ready] .app-drag-handle { display: inline-flex; }
.app-drag-handle:hover { color: var(--app-text); background: var(--app-hover); }
.app-drag-handle:active { cursor: grabbing; }
.app-drag-handle:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.app-drag-ghost { opacity: 0.45; background: var(--app-accent-soft); }
.app-drag-chosen { background: var(--app-accent-soft); }
.app-drag-fallback { opacity: 0.9; box-shadow: var(--app-shadow-pop); background: var(--app-panel); }
.app-busy-row { opacity: 0.6; }
.app-table th.app-order-cell, .app-table td.app-order-cell { width: 1%; white-space: nowrap; padding-left: 8px; padding-right: 4px; }
.app-order-cell .app-menu { vertical-align: middle; }
.app-menu-icon { padding: 2px 6px; line-height: 1; }
.app-menu-icon > i { font-size: 15px; }
.app-menu-float .app-menu-list { position: fixed; right: auto; }
.app-rows > li.app-drag-row { justify-content: flex-start; }
.app-rows > li.app-drag-row > div { flex: 1 1 auto; }
.app-narrow-only { display: none; }
@media (max-width: 520px) {
  .app-wide-only, .app-table th.app-wide-only, .app-table td.app-wide-only { display: none; }
  .app-narrow-only { display: block; }
  /* A table that drops columns on a phone is meant to fit it: its name
     column gives up its minimum width and the cells pad less. */
  .app-table:has(.app-wide-only) td:has(> .app-name) { min-width: 0; }
  .app-table:has(.app-wide-only) td, .app-table:has(.app-wide-only) th { padding-left: 8px; padding-right: 8px; }
}

/* ── Client side and sign-in (2026-11-29) ──
   app-signin: the page of a signed-out step (sign in, 2FA, password,
   invite): the plain page ground and one panel in the middle with the
   logo (app-signin-logo) or an icon (app-signin-icon) over its title.
   app-signin-foot: the quiet links under the form. app-signin-more: a
   second way in, folded (<details>: a recovery code).
   app-btn-block: a button the width of its form (the sign-in forms). */
.app-signin { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.app-signin-panel { width: 100%; max-width: 420px; padding: 28px; }
.app-signin-head { text-align: center; margin-bottom: 20px; }
.app-signin-head h1 { font-size: 20px; font-weight: 600; margin: 12px 0 4px; }
.app-signin-head p { color: var(--app-muted); margin: 0; font-size: 13px; }
.app-signin-logo { display: inline-block; }
.app-signin-icon { font-size: 32px; color: var(--app-accent-ink); line-height: 1; }
.app-signin-icon.app-text-bad { color: var(--app-bad); }
.app-signin .app-form { max-width: none; }
.app-signin-foot { text-align: center; margin: 16px 0 0; font-size: 13px; }
.app-signin-more { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--app-border); font-size: 13px; }
.app-signin-more > summary { cursor: pointer; color: var(--app-muted); }
.app-signin-more > .app-form { margin-top: 12px; }
.app-btn-block { width: 100%; justify-content: center; }
@media (max-width: 520px) { .app-signin-panel { padding: 20px 16px; } }
/* app-narrow-page: a page of one short column (two-factor set-up, the
   recovery codes). app-qr-row: the QR code beside its secret (stacked
   on a phone). app-codes: the recovery codes, large mono lines. */
.app-narrow-page { max-width: 760px; }
.app-qr-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.app-qr { max-width: 220px; height: auto; border: 1px solid var(--app-border); border-radius: var(--app-radius-control); }
.app-secret-box { display: block; padding: 8px 10px; background: var(--app-surface); border-radius: var(--app-radius-control); }
.app-codes { font-size: 16px; line-height: 1.7; margin: 0 0 12px; }
/* app-faq: common questions in a flush panel, each a <details> row that
   opens in place. */
.app-faq details { border-bottom: 1px solid var(--app-border); padding: 12px 16px; }
.app-faq details:last-child { border-bottom: 0; }
.app-faq summary { cursor: pointer; font-weight: 500; }
.app-faq details > p { margin: 8px 0 0; color: var(--app-muted); }
/* app-no-print: a control left off paper (Print, the decision form). */
@media print { .app-no-print { display: none; } }
/* app-file-list: a task's files, one link (with its size) to a line. */
.app-file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; }
/* The client Home: app-home-tour (the tour's note, its two buttons at
   the right), app-home-spark (the sessions sparkline under the tiles),
   app-svc-icon (a service's icon in the services rows) and
   app-svc-also (the "also available" heading between the two lists). */
.app-home-tour { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.app-home-spark .app-spark { width: 100%; height: 56px; display: block; }
.app-svc-icon { color: var(--app-accent-ink); }
.app-svc-also { padding: 12px 16px 0; margin: 0; }
.app-stat-note .app-text-ok, .app-stat-note .app-text-bad { font-weight: 600; }
/* The website strip on the client Home (website/_strip*.html): one row
   per hosted site, its name and state, four figures, its actions. */
.app-site-strip { padding: 0; }
.app-site-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px; border-bottom: 1px solid var(--app-border); }
.app-site-row:last-child { border-bottom: 0; }
.app-site-row[data-site-stale] .app-site-figs dd { color: var(--app-muted); }
.app-site-name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.app-site-figs { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.app-site-figs dt { font-size: 12px; font-weight: 400; color: var(--app-muted); }
.app-site-figs dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.app-site-acts { flex: 0 0 auto; }
.app-site-more { padding: 10px 16px; margin: 0; }
/* The client Website and App pages (website/*, hosted_app/*): dashboards
   whose cards static/js/website.js and hosted_app.js refill every 60 s.
   app-site-thumb: the home-page screenshot (app-site-thumb-shot) or the
   monogram beside the name. app-site-grid: three cards in a row (one on
   a phone). app-site-card: a card whose figures can be stale
   ([data-stale] greys them). app-site-big: the card's one big figure.
   app-site-rows: label and value rows. app-site-kpis, app-site-pulse,
   app-site-bars, app-site-legend: the traffic figures, the sparkline
   and its key. app-site-mini: a short table inside a card.
   app-site-feed: what we did, one icon and line each. app-site-reqs: the
   recent requests, stacked. app-site-toast: the page's message box
   (shown with data-show, a problem with data-bad, by the page's script). */
.app-site-thumb { width: 56px; height: 56px; border-radius: var(--app-radius); flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: var(--app-accent-soft); color: var(--app-accent-ink);
  border: 1px solid var(--app-border); }
.app-site-thumb-shot { width: 64px; height: 86px; background: var(--app-surface); }
.app-site-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.app-site-monogram { font-size: 26px; font-weight: 600; line-height: 1; }
.app-site-statusline { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 6px; }
.app-site-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.app-site-grid > div > .app-panel, .app-cols > div > .app-site-card { height: 100%; }
@media (max-width: 980px) { .app-site-grid { grid-template-columns: minmax(0, 1fr); } }
.app-site-card .app-panel-body > p { margin: 0 0 6px; }
.app-site-card[data-stale] .app-site-big, .app-site-card[data-stale] .app-site-rows dd,
.app-site-card[data-stale] .app-site-figs dd { color: var(--app-muted); }
.app-site-card[data-stale] .app-spark { opacity: 0.5; }
.app-site-big { font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.app-site-rows { margin: 8px 0 0; }
.app-site-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--app-border); }
.app-site-rows dt { font-weight: 400; color: var(--app-text); }
.app-site-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.app-site-rows dd > .app-small { display: block; }
.app-site-kpis { margin: 8px 0; }
.app-site-kpis dd { font-size: 22px; }
.app-site-pulse .app-spark, .app-site-bars .app-spark { width: 100%; height: 64px; display: block; margin-top: 8px; }
.app-site-legend { color: var(--app-muted); display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 10px; }
.app-site-legend-ly { opacity: 0.8; }
.app-site-mini { margin: 4px 0 12px; table-layout: fixed; }
.app-site-mini td.app-code { overflow-wrap: anywhere; }
.app-site-feed { list-style: none; margin: 8px 0 0; padding: 0; }
.app-site-feed li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--app-border); align-items: start; }
.app-site-feed-icon { color: var(--app-accent-ink); font-size: 16px; }
@media (max-width: 560px) { .app-site-feed li { grid-template-columns: 28px minmax(0, 1fr); } .app-site-feed li > :last-child { grid-column: 2; } }
.app-site-reqhead { margin-top: 8px; }
.app-site-reqs { list-style: none; margin: 4px 0 0; padding: 0; }
.app-site-reqs li { padding: 10px 0; border-top: 1px solid var(--app-border); overflow-wrap: anywhere; }
.app-site-req-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-site-toast { position: fixed; right: 16px; bottom: 16px; max-width: min(360px, calc(100vw - 32px)); z-index: 1080;
  display: none; padding: 12px 16px; border-radius: var(--app-radius); border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-accent); background: var(--app-panel); color: var(--app-text); box-shadow: var(--app-shadow-pop); }
.app-site-toast[data-show] { display: block; }
.app-site-toast[data-bad] { border-left-color: var(--app-bad); }
.app-site-toast b { display: block; }

/* ── Parts the chrome is built from (step 8, 2026-11-30). Each is shown
   on the parts guide. ──────────────────────────────────────────────── */

/* Menu, more pieces: a label over a group of items, a line between
   groups, an item with an icon in front, the item for the page you are
   on, and a menu that opens from its button's left edge (app-menu-start,
   for a button at the left of a bar). */
.app-menu-label {
  display: block; padding: 8px 10px 2px; margin: 0;
  font-size: 12px; font-weight: 500; line-height: 1.5; color: var(--app-muted);
}
.app-menu-sep { border: 0; border-top: 1px solid var(--app-border); height: 0; margin: 4px 0; opacity: 1; }
.app-menu-item > i:first-child {
  display: inline-block; width: 1.25em; margin-right: 6px; text-align: center; color: var(--app-muted);
}
.app-menu-item[aria-current="page"], .app-menu .app-menu-list a.app-menu-item[aria-current="page"] {
  background: var(--app-accent-soft); color: var(--app-accent-ink); font-weight: 600;
}
.app-menu-item[aria-current="page"] > i:first-child { color: var(--app-accent-ink); }
.app-menu-start .app-menu-list { right: auto; left: 0; }
.app-menu-start[data-app-menu-align="end"] .app-menu-list { left: auto; right: 0; }

/* Message (message): what just happened, at the top of the page after a
   form is sent (a flash). The tone is a stripe on the left; the text
   stays in the text colour on every tone. data-app-dismiss closes it. */
.app-message {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 9px 8px 9px 14px;
  font-family: var(--app-font); font-size: 14px; line-height: 1.5; box-sizing: border-box;
  background: var(--app-info-bg); color: var(--app-text);
  border: 1px solid var(--app-border); border-left: 4px solid var(--app-info);
  border-radius: var(--app-radius-control);
}
.app-message-ok { background: var(--app-ok-bg); border-left-color: var(--app-ok); }
.app-message-warn { background: var(--app-warn-bg); border-left-color: var(--app-warn); }
.app-message-bad { background: var(--app-bad-bg); border-left-color: var(--app-bad); }
.app-message-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.app-message-text a { color: inherit; text-decoration: underline; }
.app-message-close {
  flex: none; background: none; border: 0; padding: 0 6px; font-size: 18px; line-height: 1.2;
  color: var(--app-muted); cursor: pointer; border-radius: var(--app-radius-control);
}
.app-message-close:hover { background: var(--app-hover); color: var(--app-text); }
.app-message-close:focus-visible, .app-disclosure > summary:focus-visible, .app-drawer-close:focus-visible {
  outline: 2px solid var(--app-accent-ink); outline-offset: 2px;
}
.app-messages { display: flex; flex-direction: column; gap: 8px; }

/* Disclosure (disclosure): a heading that opens the part under it (the
   browser's <details>). Several with the same name are one group: opening
   one closes the others. */
.app-disclosure { font-family: var(--app-font); }
.app-disclosure > summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  list-style: none; user-select: none; font-weight: 600; color: var(--app-text);
}
.app-disclosure > summary::-webkit-details-marker { display: none; }
.app-disclosure > summary::after {
  content: ""; flex: none; margin-left: auto; width: 7px; height: 7px;
  border-right: 2px solid var(--app-muted); border-bottom: 2px solid var(--app-muted);
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.app-disclosure[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.app-disclosure > summary:hover { background: var(--app-hover); }

/* Drawer: a side column that is in place from 768px up and, on a phone,
   slides in from the left over the page. [data-app-drawer="#id"] on a
   button opens it; data-app-drawer-close inside it, Escape or a tap on
   the dimmed page closes it. app-drawer-head (its title and close button)
   shows on a phone only. */
.app-drawer-head, .app-drawer-backdrop { display: none; }
.app-drawer-close {
  background: none; border: 0; padding: 2px 8px; font-size: 20px; line-height: 1;
  color: var(--app-muted); cursor: pointer; border-radius: var(--app-radius-control);
}
.app-drawer-close:hover { background: var(--app-hover); color: var(--app-text); }
@media (max-width: 767.98px) {
  .app-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1045;
    width: min(300px, calc(100vw - 48px)); overflow-y: auto; overscroll-behavior: contain;
    background: var(--app-side-bg); color: var(--app-text);
    border-right: 1px solid var(--app-border); box-shadow: var(--app-shadow-pop);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .app-drawer[data-app-drawer-open] { transform: none; visibility: visible; transition: transform .2s ease; }
  .app-drawer-head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--app-border);
  }
  .app-drawer-head h2 { font-family: var(--app-font); font-size: 15px; font-weight: 600; margin: 0; color: var(--app-text); }
  .app-drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 1044; background: var(--app-overlay); }
  body.app-drawer-on { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .app-drawer, .app-drawer[data-app-drawer-open], .app-disclosure > summary::after { transition: none; }
}
/* A toast's link word ("View"), after the message. */
.app-toast-label { margin-left: .6em; font-weight: 600; white-space: nowrap; }
.app-disclosure-body { padding: 0 0 6px; }
/* Text for a screen reader only (app-sr): read out, not shown. */
.app-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The street-address suggestions (static/js/address-autocomplete.js,
   loaded by every address form): a list under the field, themed like
   the menus. app-ac wraps the field, app-ac-menu is the list, app-ac-item
   a suggestion, app-ac-active the one the arrow keys are on. */
.app-ac { position: relative; }
.app-ac-menu {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1060; margin-top: 2px;
  max-height: 260px; overflow-y: auto; padding: 4px 0;
  background: var(--app-panel); border: 1px solid var(--app-border); border-radius: var(--app-radius-control);
  box-shadow: 0 6px 18px var(--app-scroll-shade);
}
.app-ac-item {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left;
  padding: 6px 12px; font: inherit; font-size: 13px; color: var(--app-text); background: transparent; border: 0; cursor: pointer;
}
.app-ac-item > i { color: var(--app-muted); margin-top: 2px; }
.app-ac-item:hover, .app-ac-active { background: var(--app-hover); }
