/* ═══════════════════════════════════════════════════════════════════════
   Work Room — visual system
   SALY's look (05 Apps/SALY, its styles.css; approved screen by screen in
   its docs/phase-1-notes.md): a slate ground, white panels, an ink-navy top
   bar, the system font and one forest-green accent — so the firm's two
   staff tools read as one (Oct 2026). The client-held signing kiosk keeps
   the firm brand of ntmcpa.com (see 07 Brand/README.md): body.kiosk below.
   Everything themable is a token on :root; the dark theme, the kiosk and
   density modes ONLY redefine tokens — no component rule is ever restyled
   inside a theme or density block.
   ═══════════════════════════════════════════════════════════════════════ */

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

/* ── 0 · Brand fonts — the kiosk's only (files in static/fonts/, copied
   from Website). A face downloads only where a page uses it. ───────────── */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('fonts/inter-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; src: url('fonts/inter-latin-500-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('fonts/inter-latin-600-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('fonts/inter-latin-700-normal.woff2') format('woff2'); font-display: swap; }

/* ── 1 · Tokens (light theme is the default) ─────────────────────────── */
:root {
  /* type — the system font throughout, like SALY */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: var(--font-body);
  --font-label: var(--font-body);   /* small caps-style labels: table heads, badges, legends */
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;   /* real code and hashes only */
  --display-weight: 700;
  --h1-size: 1.3rem;
  --leading: 1.5;
  --h1-tracking: 0;
  --btn-weight: 500;
  --btn-line: var(--border);     /* outlined buttons' edge */

  /* ground & surfaces */
  --bg: #e9edf1;                 /* slate */
  --surface: #ffffff;            /* white panels */
  --surface-2: #f8f9fb;          /* inset, a table's header row */
  --border: #d8dde4;             /* panel hairline */
  --border-row: #eef1f4;         /* between table rows */
  --border-strong: #b9c2cc;
  --row-hover: #f6f8fa;
  --text: #18212b;
  --muted: #5a6573;
  --faint: #66717e;              /* 5.0:1 on white; on the slate ground use --muted */
  --link: #1f5e40;
  --link-hover: #174a32;
  --selection: #cfe3d6;

  /* accent */
  --accent: #1f5e40;
  --accent-contrast: #ffffff;
  --accent-soft: #e4efe8;
  --accent-line: #cfe3d6;
  --focus: #1f5e40;

  /* nav (ink-navy ground in both themes) */
  --nav-bg: #16202a;
  --nav-border: #16202a;
  --nav-fg: #e8edf2;
  --nav-fg-muted: #b7c4cf;
  --nav-brand: #e8edf2;
  --nav-active: #ffffff;
  --nav-chip: #24323f;           /* the open section */
  --nav-chip-hover: #1d2935;
  --nav-sep: #2e3b48;
  --nav-pill-bg: #2f7a55;
  --nav-pill-fg: #ffffff;
  /* the bar's figure boxes and cards (SALY's top bar) — the bar is dark in
     every theme, so the dark blocks leave these alone */
  --nav-box: #1c2733;
  --nav-box-border: #2a3846;
  --nav-pop: #1d2935;
  --nav-pop-border: #33424f;
  --nav-zero: #64778a;
  --nav-ok: #7fd1a6;
  --nav-warn: #ffd77a;
  --nav-alert-bg: #43211a;
  --nav-alert-border: #6b3427;
  --nav-alert-fg: #ffb39e;

  /* buttons */
  --btn-primary-bg: #1f5e40;
  --btn-primary-fg: #ffffff;
  --btn-primary-bg-hover: #1a5137;
  --btn-primary-fg-hover: #ffffff;
  --btn-action-bg: #e4efe8;
  --btn-action-fg: #1f5e40;
  --btn-action-border: #cfe3d6;
  --btn-action-bg-hover: #d6e8dc;
  --btn-danger-bg: #b42318;
  --btn-danger-fg: #ffffff;
  --btn-danger-bg-hover: #912018;
  --btn-disabled-bg: #eef1f4;
  --btn-disabled-fg: #8a94a1;

  /* semantic (danger is true red — well apart from the green accent) */
  --success-fg: #1f5e40; --success-bg: #e4efe8; --success-border: #cfe3d6;
  --warn-fg:    #b54708; --warn-bg:    #fff7ed; --warn-border:    #f1d9a6;
  --danger-fg:  #b42318; --danger-bg:  #fef3f2; --danger-border:  #f5c2bd;
  --redline: #b42318;            /* an edited note's changes */
  --info-fg:    #175cd3; --info-bg:    #eff4fc; --info-border:    #c5d6f2;

  /* count pills in the page (the nav's are --nav-pill-*) */
  --pill-bg: #e3f1e8;
  --pill-fg: #1f5e40;

  /* fields */
  --field-bg: #ffffff;
  --field-border: #b9c2cc;

  /* elevation: panels are flat; only menus and dialogs float */
  --shadow-1: none;
  --shadow-2: 0 12px 32px rgba(16, 24, 40, .18);
  --backdrop: rgba(15, 22, 30, .35);

  /* shape */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;

  /* rhythm & density (comfortable defaults) */
  --fs-base: 14px;
  --pad-cell-y: .55rem;
  --pad-cell-x: .75rem;
  --pad-card-y: 1.1rem;
  --pad-card-x: 1.25rem;
  --pad-queue-y: .85rem;
  --pad-queue-x: 1.1rem;
  --gap-block: 1.25rem;
}

/* ── 2 · Density: compact redefines rhythm tokens only ───────────────── */
body.density-compact {
  --fs-base: 13px;               /* SALY's own size */
  --pad-cell-y: .28rem;
  --pad-cell-x: .55rem;
  --pad-card-y: .75rem;
  --pad-card-x: 1rem;
  --pad-queue-y: .5rem;
  --pad-queue-x: .8rem;
  --gap-block: .8rem;
}

/* ── 3 · Dark theme: ONE token redefinition block ─────────────────────── */
/* SALY has no dark theme; these come from its own top bar (the bar's
   panels, its refund / owe / what-if states). */
body.theme-dark {
  --bg: #111921;
  --surface: #1c2733;
  --surface-2: #16202a;
  --border: #2e3b48;
  --border-row: #24323f;
  --border-strong: #3d4d5e;
  --row-hover: #223040;
  --text: #e8edf2;
  --muted: #b7c4cf;
  --faint: #8fa1b2;
  --link: #7fd1a6;
  --link-hover: #8be0b0;
  --selection: #245c41;

  --accent: #2f7a55;
  --accent-contrast: #ffffff;
  --accent-soft: #173a2a;
  --accent-line: #245c41;
  --focus: #7fd1a6;

  --nav-bg: #0b1117;
  --nav-border: #0b1117;
  --nav-fg: #e8edf2;
  --nav-fg-muted: #8fa1b2;
  --nav-brand: #e8edf2;
  --nav-active: #ffffff;
  --nav-chip: #24323f;
  --nav-chip-hover: #1a2530;
  --nav-sep: #24323f;
  --nav-pill-bg: #2f7a55;
  --nav-pill-fg: #ffffff;

  --btn-primary-bg: #2f7a55;
  --btn-primary-fg: #ffffff;
  --btn-primary-bg-hover: #357f5a;
  --btn-primary-fg-hover: #ffffff;
  --btn-action-bg: #173a2a;
  --btn-action-fg: #8be0b0;
  --btn-action-border: #245c41;
  --btn-action-bg-hover: #1d4733;
  --btn-danger-bg: #b42318;
  --btn-danger-fg: #ffffff;
  --btn-danger-bg-hover: #c9372b;
  --btn-disabled-bg: #1d2935;
  --btn-disabled-fg: #64778a;

  --success-fg: #8be0b0; --success-bg: #173a2a; --success-border: #245c41;
  --warn-fg:    #ffd77a; --warn-bg:    #3a2f12; --warn-border:    #a57d1f;
  --danger-fg:  #ffb39e; --danger-bg:  #43211a; --danger-border:  #6b3427;
  --redline: #ffb39e;
  --info-fg:    #9cc0f5; --info-bg:    #1b2a40; --info-border:    #2f4a70;

  --pill-bg: #173a2a;
  --pill-fg: #8be0b0;

  --field-bg: #16202a;
  --field-border: #3d4d5e;

  --shadow-1: none;
  --shadow-2: 0 12px 32px rgba(0, 0, 0, .45);
  --backdrop: rgba(0, 0, 0, .5);
}

/* Same tokens for theme-system when the device is dark */
@media (prefers-color-scheme: dark) {
  body.theme-system {
    --bg: #111921;
    --surface: #1c2733;
    --surface-2: #16202a;
    --border: #2e3b48;
    --border-row: #24323f;
    --border-strong: #3d4d5e;
    --row-hover: #223040;
    --text: #e8edf2;
    --muted: #b7c4cf;
    --faint: #8fa1b2;
    --link: #7fd1a6;
    --link-hover: #8be0b0;
    --selection: #245c41;

    --accent: #2f7a55;
    --accent-contrast: #ffffff;
    --accent-soft: #173a2a;
    --accent-line: #245c41;
    --focus: #7fd1a6;

    --nav-bg: #0b1117;
    --nav-border: #0b1117;
    --nav-fg: #e8edf2;
    --nav-fg-muted: #8fa1b2;
    --nav-brand: #e8edf2;
    --nav-active: #ffffff;
    --nav-chip: #24323f;
    --nav-chip-hover: #1a2530;
    --nav-sep: #24323f;
    --nav-pill-bg: #2f7a55;
    --nav-pill-fg: #ffffff;

    --btn-primary-bg: #2f7a55;
    --btn-primary-fg: #ffffff;
    --btn-primary-bg-hover: #357f5a;
    --btn-primary-fg-hover: #ffffff;
    --btn-action-bg: #173a2a;
    --btn-action-fg: #8be0b0;
    --btn-action-border: #245c41;
    --btn-action-bg-hover: #1d4733;
    --btn-danger-bg: #b42318;
    --btn-danger-fg: #ffffff;
    --btn-danger-bg-hover: #c9372b;
    --btn-disabled-bg: #1d2935;
    --btn-disabled-fg: #64778a;

    --success-fg: #8be0b0; --success-bg: #173a2a; --success-border: #245c41;
    --warn-fg:    #ffd77a; --warn-bg:    #3a2f12; --warn-border:    #a57d1f;
    --danger-fg:  #ffb39e; --danger-bg:  #43211a; --danger-border:  #6b3427;
    --redline: #ffb39e;
    --info-fg:    #9cc0f5; --info-bg:    #1b2a40; --info-border:    #2f4a70;

    --pill-bg: #173a2a;
    --pill-fg: #8be0b0;

    --field-bg: #16202a;
    --field-border: #3d4d5e;

    --shadow-1: none;
    --shadow-2: 0 12px 32px rgba(0, 0, 0, .45);
    --backdrop: rgba(0, 0, 0, .5);
  }
}

/* ── 3b · The kiosk: the firm brand, for the client holding the iPad ──── */
/* signing/kiosk_base.html is always light, so no dark twin. Paper ground,
   white cards, ink, terracotta — matching ntmcpa.com and the letters. */
body.kiosk {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', ui-serif, Georgia, serif;
  --font-label: var(--font-mono);
  --display-weight: 400;
  --h1-size: 1.7rem;
  --leading: 1.55;
  --h1-tracking: .005em;
  --btn-weight: 600;
  --btn-line: var(--border-strong);

  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --surface-2: #F2EFE7;
  --border: #E4E0D5;
  --border-row: #E4E0D5;
  --border-strong: #CDC7B9;
  --row-hover: #F1EDE3;
  --text: #1C1B19;
  --muted: #58544C;
  --faint: #6E6A5F;
  --link: #8A3B22;
  --link-hover: #6E2F1B;
  --selection: #F0DDD2;

  --accent: #B5502F;
  --accent-contrast: #FFF9F3;
  --accent-soft: #F0DDD2;
  --accent-line: #DBB6A2;
  --focus: #B5502F;

  --nav-bg: #1C1B19;
  --nav-border: #2C2A25;
  --nav-fg: #F7F4EE;

  --btn-primary-bg: #B5502F;
  --btn-primary-fg: #FFF9F3;
  --btn-primary-bg-hover: #8A3B22;
  --btn-primary-fg-hover: #FFF9F3;
  --btn-action-bg: #F0DDD2;
  --btn-action-fg: #8A3B22;
  --btn-action-border: #DBB6A2;
  --btn-action-bg-hover: #E8CDBD;
  --btn-danger-bg: #8C2B2B;
  --btn-danger-fg: #F9EFED;
  --btn-danger-bg-hover: #75221E;
  --btn-disabled-bg: #E9E4D8;
  --btn-disabled-fg: #9A9483;

  --success-fg: #3F6A33; --success-bg: #E7F0E0; --success-border: #B9D3AC;
  --warn-fg:    #7C5C0B; --warn-bg:    #F7EFD2; --warn-border:    #E2CB80;
  --danger-fg:  #8C2B2B; --danger-bg:  #F5E3DF; --danger-border:  #DFB3AB;

  --field-bg: #FFFFFF;
  --field-border: #CDC7B9;

  --shadow-1: 0 1px 2px rgba(28, 27, 25, .05), 0 1px 6px rgba(28, 27, 25, .04);
  --shadow-2: 0 2px 6px rgba(28, 27, 25, .10), 0 8px 24px rgba(28, 27, 25, .08);
  --backdrop: rgba(28, 27, 25, .45);

  --radius-sm: 5px;
  --radius-lg: 12px;
  --fs-base: 15px;
}

/* ── 4 · Base elements ────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--leading);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight); color: var(--text); }
h1 { font-size: var(--h1-size); letter-spacing: var(--h1-tracking); margin-bottom: 1rem; }
h3 { font-size: .95rem; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05em .35em;
}

::selection { background: var(--selection); }

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

img, svg { max-width: 100%; }

/* the kiosk's paper grain on the ground; content layers above it */
body.kiosk::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.02 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
header, main, footer, .flash-messages { position: relative; z-index: 1; }
/* The top bar's cards (Exceptions, the person's menu) open over the page. */
body > header { z-index: 5; }

/* ── 5 · Shell: nav, flash, main, footer ─────────────────────────────── */
/* SALY's top bar: 52px of ink navy, the name, a hairline, then the
   sections as chips — the open one on a lighter chip. */
.top-nav {
  display: flex;
  align-items: center;
  gap: .35rem .9rem;
  flex-wrap: wrap;
  min-height: 52px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  padding: .4rem 1rem;
}
.top-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: .01em;
  color: var(--nav-brand);
  text-decoration: none;
  white-space: nowrap;
}
/* The name, with the backup line under it like SALY's "✓ Saved" — then a
   hairline before the pages. */
.top-nav .brand-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: none;
}
.top-nav .brand-block:not(:last-child) {
  padding-right: .9rem;
  border-right: 1px solid var(--nav-sep);
}
.top-nav .brand:hover { color: var(--nav-active); text-decoration: none; }
.top-nav .backup-line {
  font-size: .68rem;
  color: var(--nav-fg-muted);
  padding-left: calc(23px + .55rem);   /* under the name, past the mark */
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.top-nav .backup-line b { font-weight: 600; }
.top-nav .backup-line:hover { color: var(--nav-fg); text-decoration: none; }
.top-nav .backup-ok b { color: var(--nav-ok); }
.top-nav .backup-late b { color: var(--nav-warn); }
.top-nav .backup-failed b { color: var(--nav-alert-fg); }
.top-nav ul { display: flex; gap: .1rem; list-style: none; flex-wrap: wrap; }
.top-nav ul a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  color: var(--nav-fg-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: .38rem .55rem;
  border-radius: var(--radius-sm);
}
.top-nav ul a:hover { color: var(--nav-fg); background: var(--nav-chip-hover); text-decoration: none; }
.top-nav ul a.active { color: var(--nav-active); background: var(--nav-chip); font-weight: 600; }
.top-nav .count-badge { background: var(--nav-pill-bg); color: var(--nav-pill-fg); }

/* Where things stand: each person's own counts (app/topbar.py), in SALY's
   figure boxes — a small caps name over the number. Each is a link; the
   red one (Exceptions) opens its list, like SALY's figure cards. */
.top-nav .bar-right { display: flex; align-items: center; gap: .9rem; margin-left: auto; flex: none; }
.top-nav .bar-counts { display: flex; gap: 6px; flex: none; }
.top-nav .bar-count {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  height: 40px;
  min-width: 66px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--nav-box-border);
  background: var(--nav-box);
  color: var(--nav-fg);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}
.top-nav .bar-count::-webkit-details-marker { display: none; }
.top-nav .bar-count:hover { border-color: var(--nav-pop-border); color: var(--nav-active); text-decoration: none; }
.top-nav .bar-count-l {
  font-size: .62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--nav-fg-muted);
  white-space: nowrap;
}
.top-nav .bar-count-v { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.top-nav .bar-count.zero .bar-count-v { color: var(--nav-zero); }
.top-nav .bar-count.alert { background: var(--nav-alert-bg); border-color: var(--nav-alert-border); }
.top-nav .bar-count.alert .bar-count-v { color: var(--nav-alert-fg); }
.top-nav details[open] > .bar-count { outline: 2px solid var(--nav-alert-fg); outline-offset: 1px; }

/* The cards a count or the person's initials open */
.top-nav .bar-count-menu, .top-nav .user-menu { position: relative; flex: none; }
.top-nav .bar-pop, .top-nav .menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  background: var(--nav-pop);
  border: 1px solid var(--nav-pop-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  color: var(--nav-fg);
}
.top-nav .bar-pop { width: 380px; padding: .6rem .8rem .7rem; }
.top-nav .bar-pop-head, .top-nav .menu-name {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--nav-fg-muted);
  margin-bottom: .35rem;
}
.top-nav .bar-pop ul { display: block; list-style: none; }
.top-nav .bar-pop li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .4rem 0;
  border-top: 1px solid var(--nav-sep);
  font-size: .82rem;
}
.top-nav .bar-pop li:first-child { border-top: 0; }
.top-nav .bar-pop li a { display: block; padding: 0; color: var(--nav-fg); font-weight: 600; white-space: normal; background: none; }
.top-nav .bar-pop li a:hover { color: var(--nav-active); background: none; text-decoration: underline; }
.top-nav .bar-pop-kind {
  display: block;
  font-size: .64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--nav-alert-fg);
}
.top-nav .bar-pop-when { color: var(--nav-fg-muted); white-space: nowrap; }
.top-nav .bar-pop-all {
  display: block;
  margin-top: .3rem;
  padding-top: .45rem;
  border-top: 1px solid var(--nav-sep);
  font-size: .8rem;
  color: var(--nav-ok);
}

/* Go to: SALY's search button, ⌘K */
.top-nav .goto-open {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font: inherit;
  font-size: .8rem;
  color: var(--nav-fg);
  background: var(--nav-pop);
  border: 1px solid var(--nav-pop-border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.top-nav .goto-open:hover { color: var(--nav-active); border-color: var(--nav-fg-muted); }
.top-nav .goto-open kbd, .goto-field kbd {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--nav-fg-muted);
}

/* The person: initials in a circle; Preferences, Reports, Import, Admin
   and Sign out in the card it opens. */
.top-nav .me {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--nav-pill-bg);
  color: var(--nav-pill-fg);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  list-style: none;
}
.top-nav .me::-webkit-details-marker { display: none; }
.top-nav .me.active, .top-nav .user-menu[open] > .me { outline: 2px solid var(--nav-active); outline-offset: 2px; }
.top-nav .menu-pop {
  width: 210px; padding: .55rem .4rem .4rem;
  max-height: calc(100vh - 76px); overflow-y: auto; overscroll-behavior: contain;
}
.top-nav .menu-name { padding: 0 .55rem; text-transform: none; letter-spacing: 0; font-size: .78rem; color: var(--nav-fg); font-weight: 600; }
.top-nav .menu-pop a {
  display: block;
  padding: .38rem .55rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--nav-fg-muted);
  text-decoration: none;
}
.top-nav .menu-pop a:hover { background: var(--nav-chip-hover); color: var(--nav-fg); text-decoration: none; }
.top-nav .menu-pop a.active { background: var(--nav-chip); color: var(--nav-active); font-weight: 600; }
.top-nav .menu-pop .logout { margin-top: .2rem; border-top: 1px solid var(--nav-sep); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* The Go to box (static/goto.js) */
.goto-dialog {
  width: min(560px, calc(100vw - 2rem));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.goto-dialog::backdrop { background: var(--backdrop); }
.goto-field {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.goto-field kbd { color: var(--muted); }
/* (by id: the general field and focus rules in §10 must not reach it) */
#goto-input, #goto-input:focus-visible {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  padding: .2rem 0;
}
.goto-results { list-style: none; max-height: 50vh; overflow: auto; padding: .35rem; }
.goto-results a {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}
.goto-results [aria-selected="true"] a { background: var(--accent-soft); }
.goto-label { font-weight: 600; }
.goto-sub { color: var(--muted); font-size: .85rem; }
.goto-kind {
  margin-left: auto;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.goto-none { padding: .7rem .6rem; color: var(--muted); }
.goto-hint { border-top: 1px solid var(--border); padding: .5rem .9rem; font-size: .75rem; color: var(--muted); }

/* A narrower window: Go to keeps its icon and key, then the counts take
   their own row on the right rather than crowd the pages. */
@media (max-width: 1520px) {
  .top-nav { column-gap: .7rem; }
  .top-nav ul a { padding-left: .42rem; padding-right: .42rem; }
  .top-nav .bar-right { gap: .7rem; }
  .top-nav .brand-block:not(:last-child) { padding-right: .7rem; }
  .top-nav .bar-count { min-width: 0; padding: 0 7px; }
  .top-nav .bar-count-l { letter-spacing: .04em; }
  .top-nav .goto-open > span { display: none; }
}

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* Flash messages — notices under the header, flat like SALY's */
.flash-messages { max-width: 1100px; margin: 1rem auto 0; padding: 0 1rem; }
main .flash-messages { margin: 0 0 var(--gap-block); padding: 0; }
.flash {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  margin-bottom: .5rem;
  font-size: .92rem;
}
.flash-success { border-color: var(--success-border); background: var(--success-bg); color: var(--success-fg); }
.flash-warning { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-fg); }
.flash-danger  { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); }
.flash a { color: inherit; text-decoration: underline; }

/* The footer sits on the slate ground, where --faint is too light to read:
   its words are --muted. */
footer {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  padding: .9rem 1rem 1.6rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
footer p { font-size: .78rem; }
footer .footer-meta { font-size: .72rem; margin-top: .1rem; }

/* ── 6 · Cards & grids ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad-card-y) var(--pad-card-x);
  margin-bottom: var(--gap-block);
  box-shadow: var(--shadow-1);
}
.card h2 {
  font-size: .95rem;
  margin-bottom: .8rem;
}
.card-grid {
  display: grid;
  /* auto-FIT, not auto-fill: empty tracks collapse, so two cards split
     the full width instead of huddling skinny beside a phantom third
     column. Cards then line up with the full-width sections around
     them no matter how many there are. */
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: var(--gap-block);
}
.card-grid .card { margin-bottom: 0; }
.nav-card { display: block; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.nav-card:hover { border-color: var(--accent); box-shadow: var(--shadow-2); text-decoration: none; color: var(--text); }
.nav-card h2 { color: var(--text); }
.nav-card:hover h2 { color: var(--link); }
.nav-card p { font-size: .9rem; color: var(--muted); margin-top: .4rem; }

/* ── 7 · Page & section headers ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: var(--gap-block);
}
.page-header h1 { margin-bottom: 0; }
.page-header > a:not(.btn) { font-size: .9rem; }
/* On a record's own page (client, return, prep sheet, project) the title
   and the way back stay at the top while the page scrolls — on paper so the
   cards slide under it, with a hairline once something is passing beneath
   (Oct 12 2026). Negative margin + padding leave the unscrolled layout
   exactly as a plain .page-header. format.js measures the header into
   --sticky-header-h: the client page's summary card stops below it, and
   anything scrolled to (the unsaved-changes "Keep editing", a tabbed-to
   field) lands below it too. */
.page-header-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  margin-top: -.75rem;
  margin-bottom: calc(var(--gap-block) - .75rem - 1px);   /* - the hairline */
  padding: .75rem 0;
  border-bottom: 1px solid transparent;
}
.page-header-sticky.is-stuck { border-bottom-color: var(--border); }
html:has(.page-header-sticky) { scroll-padding-top: calc(var(--sticky-header-h, 4rem) + 1rem); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.section-header h2 { margin-bottom: 0; }

/* ── 8 · Tables — recessive hairlines, tabular numerals ──────────────── */
/* A table on the page ground is a white panel with a pale header row, like
   SALY's list of returns; inside a card it's just rows. Separate borders
   (spacing 0) so the panel's corners can round. */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1rem;
}
.data-table:not(.card .data-table) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.data-table:not(.card .data-table) thead th { background: var(--surface-2); }
.data-table:not(.card .data-table) thead th:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); }
.data-table:not(.card .data-table) thead th:last-child { border-top-right-radius: calc(var(--radius-lg) - 1px); }
.data-table th {
  font-family: var(--font-label);
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
  padding: var(--pad-cell-y) var(--pad-cell-x);
}
.data-table td {
  padding: var(--pad-cell-y) var(--pad-cell-x);
  border-bottom: 1px solid var(--border-row);
  vertical-align: top;
}
/* An unbroken token — a 200-character Exchange calendar UID, a long URL —
   would otherwise set the column's minimum width and push the row's action
   buttons off the right edge of the screen, out of reach. break-word (not
   anywhere) keeps ordinary words in the min-content width, so auto layout
   can't squeeze a column narrower than "Individual" and split it mid-word. */
.data-table td { overflow-wrap: break-word; }
.data-table .action-cell { overflow-wrap: normal; }
/* Sortable headers: the link inherits the th's mono/caps styling so a
   sortable column reads as a header, not as a link in a header. */
.data-table th.sortable a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  white-space: nowrap;
}
.data-table th.sortable a:hover { color: var(--text); text-decoration: none; }
.data-table th[aria-sort] a { color: var(--text); }
.sort-arrow { font-size: .8em; color: var(--link); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--row-hover); }
.inactive-row td { opacity: .5; }
.doc-received td { color: var(--muted); }
.sent-row td { opacity: .6; }
.row-backward td { background: var(--danger-bg); }
.row-backward:hover td { background: var(--danger-bg); }
.action-cell { white-space: nowrap; }

/* ── 8b · Meetings + briefs ───────────────────────────────────────────── */
.meeting-day { margin-bottom: calc(var(--gap-block) + .25rem); }
.meeting { margin-bottom: .75rem; }
.meeting-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.meeting-time {
  font-family: var(--font-label);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--link);
}
.meeting-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--display-weight);
  margin-top: .15rem;
}
.meeting-client { margin-top: .5rem; font-size: .95rem; }
.meeting-link {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
}
.meeting-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.meeting-head-actions { display: flex; align-items: center; gap: .5rem; }

/* Three columns of facts, then the tables underneath — the shape of a
   one-page brief you'd read standing up. */
.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding: .9rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.brief-block h4,
.brief-h {
  font-family: var(--font-label);
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  margin-bottom: .4rem;
}
.brief-h { margin-top: 1.1rem; }
.brief-dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; font-size: .85rem; }
.brief-dl dt { color: var(--faint); }
.brief-dl dd { color: var(--text); overflow-wrap: anywhere; }
.brief-block p { font-size: .85rem; }
.brief-flag {
  margin-top: .5rem;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
}
.brief-flag-warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-border);
}
.brief-docs { margin: 0 0 0 1.1rem; font-size: .88rem; }
.brief-docs li { margin-bottom: .15rem; }
.brief-notes { font-size: .88rem; white-space: pre-wrap; }

/* ── 8c · Project checklists ──────────────────────────────────────────── */
.task-list { list-style: none; margin: 0 0 .8rem; }
.task-list li {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  padding: .28rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.task-list li:last-child { border-bottom: none; }
.task-list form { display: inline-flex; }
.task-label { flex: 1; overflow-wrap: anywhere; }
/* Done items recede rather than vanish — the list is also a record of what
   was actually collected. */
.task-done .task-label { color: var(--faint); text-decoration: line-through; }
.task-tick {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--link);
}
.task-tick:hover { color: var(--link-hover); }
.task-remove {
  background: none;
  border: none;
  padding: 0 .2rem;
  cursor: pointer;
  color: var(--faint);
  font-size: 1rem;
  line-height: 1;
}
.task-remove:hover { color: var(--danger-fg); }
.task-add {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
}
.task-add input[type="text"] { flex: 1; min-width: 15rem; }
.tag-client {
  display: inline-block;
  padding: .05rem .35rem;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-border);
  font-family: var(--font-label);
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.template-cell { background: var(--surface-2); }
.template-list { margin-bottom: 0; }

/* ── 9 · Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  min-height: 34px;
  padding: .38rem .9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: var(--btn-weight);
  line-height: 1.4;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); }
.btn-primary:hover { background: var(--btn-primary-bg-hover); color: var(--btn-primary-fg-hover); border-color: var(--btn-primary-bg-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--btn-line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--link); }
.btn-action   { background: var(--btn-action-bg); color: var(--btn-action-fg); border-color: var(--btn-action-border); }
.btn-action:hover { background: var(--btn-action-bg-hover); color: var(--btn-action-fg); }
.btn-danger   { background: var(--btn-danger-bg); color: var(--btn-danger-fg); border-color: var(--btn-danger-bg); }
.btn-danger:hover { background: var(--btn-danger-bg-hover); border-color: var(--btn-danger-bg-hover); }
.btn-disabled { background: var(--btn-disabled-bg); color: var(--btn-disabled-fg); border-color: var(--border); cursor: not-allowed; }
/* Quiet: a real action that should never compete for attention — reversible,
   and not the thing you came to the page to do. */
.btn-quiet    { background: transparent; color: var(--faint); border-color: var(--border); }
.btn-quiet:hover { color: var(--text); border-color: var(--border-strong); }
.btn-sm       { min-height: 0; padding: .2rem .6rem; font-size: .8rem; }
.btn-row      { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
button.btn { font-family: var(--font-body); }

/* Plain .btn (no variant) — quiet outlined button */
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-action):not(.btn-danger):not(.btn-disabled) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--btn-line);
}
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-action):not(.btn-danger):not(.btn-disabled):hover {
  border-color: var(--accent);
  color: var(--link);
}

/* ── 10 · Forms ───────────────────────────────────────────────────────── */
input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="number"], input[type="search"],
input:not([type]), select, textarea {
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  padding: .38rem .6rem;
}
/* The field you're in: SALY's green edge, not an offset outline. Checkboxes
   and radios keep the outline below. */
input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
::placeholder { color: var(--faint); opacity: 1; }

.form-card { max-width: 560px; }
.field-row { margin-bottom: .9rem; }
/* Field names: SALY's small caps-style labels */
.field-row label {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: .3rem;
}
/* ...but a label that is a tick box's sentence reads as one. */
.field-row label:has(> input[type="checkbox"], > input[type="radio"]),
.field-row input[type="checkbox"] + label {
  font-size: .9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.field-row input[type="text"], .field-row input[type="password"],
.field-row input[type="date"], .field-row input[type="number"],
.field-row input[type="email"], .field-row select, .field-row textarea { width: 100%; }
.field-row.has-error input, .field-row.has-error select, .field-row.has-error textarea { border-color: var(--danger-fg); }
.field-error { color: var(--danger-fg); font-size: .8rem; display: block; margin-top: .2rem; }
.form-actions { margin-top: 1.25rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.form-actions-top { margin: 0 0 1rem; }
/* A form whose buttons sit outside any card (My preferences' Save, the
   import's Cancel) ends flush with them, so the card after it keeps its
   distance. A form that ends in a card already has that card's bottom
   margin; the two collapse into one gap. */
form + .card { margin-top: var(--gap-block); }
.form-inline .field-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.form-inline .field-row label { min-width: 120px; margin: 0; }

fieldset.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0;
  padding: 12px 16px;
  background: var(--surface-2);
}
.form-section legend {
  font-family: var(--font-label);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 .5em;
}

.inline-add-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.inline-add-form .field-row { display: flex; align-items: center; gap: .4rem; margin: 0; flex-wrap: wrap; }
.inline-add-form .field-row label { margin: 0; }
.inline-add-form input, .inline-add-form select, .inline-add-form textarea { font-size: .875rem; }

details.inline-details { display: inline-block; }
details.inline-details summary { list-style: none; }
details.inline-details summary::-webkit-details-marker { display: none; }
details.inline-details .inline-form {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .75rem;
  margin-top: .4rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
form.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
/* Client code on the client page: the typed-twice form and the next-code button stack with even spacing. */
.code-assign { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.code-assign form.inline-form { margin-top: 0; }

/* ── 11 · Pipeline dashboard ──────────────────────────────────────────── */
.pipeline-group { margin-bottom: calc(var(--gap-block) + .25rem); }
/* A state's name over its table panel. Its hint sits on the slate ground,
   where --faint is too light: --muted. */
.pipeline-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--display-weight);
  margin-bottom: .5rem;
}
.pipeline-label .hint-inline { color: var(--muted); }
.pipeline-label .count {
  display: inline-block;
  font-family: var(--font-label);
  font-variant-numeric: tabular-nums;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border-radius: 999px;
  padding: .05em .55em;
  font-size: .72rem;
  font-weight: 700;
  margin-left: .4rem;
  vertical-align: middle;
}
/* One set of column widths for every state's table on a page (the
   Dashboard, Projects), so the columns line up down the page instead of
   each table sizing itself to its own rows. Fixed layout reads the widths
   off the <colgroup>: each column holds its longest value on one line
   ("2026-10-18", "Oct 12 · 10:00 AM", "5/13 4 on them", a staff name) and
   the name columns — Client, and a project's name — take the rest.
   Narrower than this they'd be squeezed to a sliver, so each table goes
   back to sizing itself. */
@media (min-width: 961px) {
  .pipeline-table { table-layout: fixed; }

  .dashboard-table .col-year     { width: 4.5em; }
  .dashboard-table .col-type     { width: 5.75em; }
  .dashboard-table .col-docs     { width: 4.75em; }
  .dashboard-table .col-due      { width: 8.5em; }
  .dashboard-table .col-assigned,
  .dashboard-table .col-preparer { width: 9.25em; }
  .dashboard-table .col-meeting  { width: 11em; }

  .projects-table .col-type      { width: 8.5em; }
  .projects-table .col-period    { width: 6.5em; }
  .projects-table .col-checklist { width: 10.25em; }
  .projects-table .col-due       { width: 8.5em; }
  .projects-table .col-assigned  { width: 9.25em; }
}

/* One segmented control, like SALY's zoom: joined buttons, the chosen one
   filled. */
.filter-group {
  display: inline-flex;
  flex-wrap: wrap;                    /* a long one (Projects) wraps on the iPad */
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.filter-group a {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  padding: .32rem .8rem;
  border-left: 1px solid var(--border);
  text-decoration: none;
  color: var(--muted);
}
.filter-group a:first-child { border-left: 0; }
.filter-group a:hover { color: var(--text); background: var(--row-hover); text-decoration: none; }
.filter-group a.active {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.filter-bar { margin-bottom: 1rem; font-size: .875rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }

/* Filter panel + mass-edit bar (clients and returns lists) */
.filter-form { padding-bottom: .9rem; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .6rem .9rem;
}
.filter-grid label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.filter-grid input, .filter-grid select { text-transform: none; letter-spacing: 0; }
.filter-grid input, .filter-grid select { width: 100%; font-weight: 400; color: var(--text); }
.filter-actions {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .9rem;
  font-size: .875rem;
}
.filter-actions .page-note { margin-bottom: 0; }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.bulk-bar label { display: flex; align-items: center; gap: .35rem; font-size: .85rem; }
.bulk-bar select { width: auto; }
.check-label { display: flex; align-items: center; gap: .35rem; font-weight: 400; }
.tick-col { width: 1.8rem; text-align: center; }

/* Mass-edit preview: before is what it was, after is what it becomes */
.preview-counts { font-size: 1rem; margin-bottom: .8rem; }
.value-before { color: var(--muted); }
.value-after { font-weight: 600; }
.bulk-form .op-group { border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .8rem; }

/* State counts row */
.state-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap-block); }
.state-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-1);
  transition: border-color .15s;
}
.state-count:hover { border-color: var(--accent); text-decoration: none; color: inherit; }
.state-count .n {
  font-family: var(--font-label);
  font-variant-numeric: tabular-nums;
  font-size: 1.3em;
  font-weight: 700;
}
.state-count .l {
  font-family: var(--font-label);
  font-size: .62em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  text-align: center;
}

/* Exception strip — SALY's notice boxes: tinted, one hairline, the title
   in the notice's own color */
.exception-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px;
  margin-bottom: calc(var(--gap-block) + .25rem);
}
.exception {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.exception h3 { margin: 0 0 6px; font-size: .95em; color: var(--warn-fg); }
.exception ul { margin: 0; padding-left: 18px; font-size: .9em; }
.exception-urgent {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}
.exception-urgent h3 { color: var(--danger-fg); }

/* ── 11b · A return, left to right (Oct 28 2026) ──────────────────────── */
/* returns/detail.html: the return's own bar (SALY's who + bottom line +
   figures), the row of steps, then three columns — coming in, the work,
   going out. Wide windows: the page is the window's height and each column
   scrolls on its own, as SALY's panes do. Narrower: the columns stack and
   the bar stays at the top while the page scrolls. */
.record-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--gap-block);
}
html:has(.record-bar) { scroll-padding-top: calc(var(--sticky-header-h, 7rem) + 1rem); }
.record-top {
  display: flex;
  align-items: center;
  gap: .9rem 1.2rem;
  flex-wrap: wrap;
  padding: .7rem 1rem .6rem;
}
.record-who { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 0 1 auto; }
.record-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .55rem; }
.record-who h1 { font-size: 1.15rem; margin: 0; }
.record-chip {
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .45rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.record-year { font-size: .82rem; color: var(--muted); }
.record-sub { font-size: .8rem; color: var(--muted); }
.record-flag { color: var(--warn-fg); font-weight: 600; }

/* The step it is on: SALY's refund box, green; amber while parked */
.step-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 150px;
  height: 46px;
  padding: 0 .8rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--link);
}
.step-box-l { font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.step-box-v { font-size: 1.2rem; font-weight: 700; line-height: 1.15; }
.step-box.parked { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.step-box.done { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

/* The figures, right-aligned like SALY's AGI / Total tax */
.record-figures {
  display: flex;
  gap: .4rem 1.3rem;
  flex-wrap: wrap;
  margin-left: auto;
  font-size: inherit;
}
.record-figures .fig { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.record-figures dt {
  font-size: .62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding: 0;
}
.record-figures dd { font-weight: 650; font-size: .95rem; line-height: 1.25; white-space: nowrap; }
.record-figures dd.fig-note { font-weight: 400; font-size: .74rem; color: var(--muted); min-height: 1em; }
.record-figures dd.fig-note.late { color: var(--danger-fg); font-weight: 600; }
.record-figures .fig.ok dd:not(.fig-note) { color: var(--success-fg); }
.record-figures .fig.warn dd:not(.fig-note) { color: var(--warn-fg); }
.record-figures .fig.alert dd:not(.fig-note) { color: var(--danger-fg); }
.record-figures .fig.none dd:not(.fig-note) { color: var(--faint); font-weight: 500; }

/* The steps, left to right; each column's steps carry its color underneath */
.step-row {
  display: flex;
  list-style: none;
  border-top: 1px solid var(--border-row);
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}
.step {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: .74rem;
  padding: .32rem .2rem .38rem;
  color: var(--faint);
  border-right: 1px solid var(--border-row);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step:last-child { border-right: 0; }
.step.zone-in   { box-shadow: inset 0 -3px 0 var(--info-border); }
.step.zone-work { box-shadow: inset 0 -3px 0 var(--accent-line); }
.step.zone-out  { box-shadow: inset 0 -3px 0 var(--warn-border); }
.step-done { color: var(--link); }
.step-done::before { content: "✓ "; font-weight: 700; }
.step-now { background: var(--accent); color: var(--accent-contrast); font-weight: 700; box-shadow: none; }

/* The three columns */
.record-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.column-head {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .6rem;
}
.column-head span { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .78rem; color: var(--muted); }
.column-in .column-head { color: var(--info-fg); }
.column-work .column-head { color: var(--link); }
.column-out .column-head { color: var(--warn-fg); }
.record-column .card { margin-bottom: .8rem; }
.record-column .card h2 { font-size: .9rem; margin-bottom: .55rem; }
.record-column .section-header { margin-bottom: .5rem; }
.col-count, .col-state {
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.col-count.ok, .col-state.ok { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.col-state.alert { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.col-link { font-size: .85rem; margin-top: .5rem; }

/* Coming in: the checklist as SALY's documents list */
.doc-party {
  font-size: .66rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: .6rem 0 .15rem;
}
.doc-party:first-of-type { margin-top: 0; }
.doc-list { list-style: none; }
.doc-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .05rem .6rem;
  padding: .45rem 0;
  border-top: 1px solid var(--border-row);
}
.doc-list .doc-item:first-child { border-top: 0; }
.doc-mark {
  align-self: start;
  width: 17px;
  height: 17px;
  margin-top: .12rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .62rem;
  font-weight: 800;
  border: 1.5px solid var(--border-strong);
}
.doc-received .doc-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.doc-outstanding .doc-mark { border-style: dashed; border-color: var(--warn-fg); }
.doc-name { font-weight: 600; min-width: 0; }
.doc-optional { font-size: .7rem; color: var(--muted); font-weight: 400; }
.doc-when { font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-outstanding .doc-when { color: var(--warn-fg); font-weight: 600; }
.doc-detail {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .3rem .6rem;
}
.doc-sub { font-size: .8rem; color: var(--muted); }
.doc-sub:empty { display: none; }
.doc-actions { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; margin-left: auto; }
.doc-actions form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0; }
.doc-actions select { font-size: .8rem; padding: .2rem .4rem; }
/* A received row's undo and remove: quiet words, full strength on hover */
.btn-text {
  font: inherit;
  font-size: .76rem;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.btn-text:hover { color: var(--text); text-decoration-style: solid; }
.doc-outstanding .doc-actions { margin-left: 0; }

/* "+ Add document", "Record delivery", "Issue invoice": SALY's + links */
details.add-details { margin-top: .6rem; }
details.add-details > summary {
  display: inline-block;
  cursor: pointer;
  color: var(--link);
  font-weight: 500;
  font-size: .88rem;
  list-style: none;
}
details.add-details > summary::-webkit-details-marker { display: none; }
details.add-details[open] > summary { margin-bottom: .5rem; }
.stack-form { display: flex; flex-direction: column; gap: .45rem; }
.stack-form > input, .stack-form > select, .stack-form > textarea { width: 100%; font-size: .875rem; }
.stack-row { display: flex; flex-wrap: wrap; gap: .45rem .7rem; align-items: center; }
.stack-row > select { flex: 1 1 8rem; font-size: .875rem; }
.stack-form .hint { margin: 0; font-size: .78rem; }

/* The work */
.record-column .force-move { display: block; margin-top: .7rem; }
.history { list-style: none; position: relative; padding-left: 1.3rem; }
.history::before {
  content: "";
  position: absolute;
  left: .3rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  background: var(--border);
}
.history-item { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; padding: .3rem 0 .45rem; }
.history-item::before {
  content: "";
  position: absolute;
  left: -1.3rem;
  top: .58rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.history-item.row-backward::before { border-color: var(--warn-fg); }
.history-move { font-weight: 600; }
.history-by { flex-basis: 100%; font-size: .8rem; color: var(--muted); }
.history-note { flex-basis: 100%; font-size: .85rem; }
details.details-card > summary {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  cursor: pointer;
  list-style: none;
}
details.details-card > summary::-webkit-details-marker { display: none; }
details.details-card > summary h2 { margin: 0; }
details.details-card > summary h2::before { content: "▸ "; color: var(--muted); }
details.details-card[open] > summary { margin-bottom: .8rem; }
details.details-card[open] > summary h2::before { content: "▾ "; }

/* Going out */
.out-list { list-style: none; }
.out-list li { display: flex; flex-direction: column; gap: .1rem; padding: .4rem 0; border-top: 1px solid var(--border-row); }
.out-list li:first-child { border-top: 0; padding-top: 0; }
.out-main { font-weight: 600; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.out-sub { font-size: .8rem; color: var(--muted); }
.out-actions { display: flex; gap: .35rem; margin-top: .25rem; }

@media (min-width: 1100px) {
  /* The page is the window: the bar on top, the columns below, each
     scrolling on its own. */
  body.layout-columns { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
  body.layout-columns > header { flex: none; }
  body.layout-columns > .flash-messages { flex: none; max-width: none; width: 100%; margin: .6rem 0 0; padding: 0 1rem; }
  body.layout-columns > footer { display: none; }
  body.layout-columns > main {
    flex: 1;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  body.layout-columns .record-bar {
    position: static;
    flex: none;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
  }
  body.layout-columns .step-row { border-radius: 0; }
  body.layout-columns .record-columns {
    flex: 1;
    min-height: 0;
    gap: 0;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(320px, 380px);
  }
  body.layout-columns .record-column {
    min-height: 0;
    overflow-y: auto;
    padding: .9rem 1rem 2rem;
    border-right: 1px solid var(--border);
  }
  body.layout-columns .record-column:last-child { border-right: 0; }
  body.layout-columns .column-in, body.layout-columns .column-out { background: var(--surface-2); }
}

/* ── 12 · Badges & chips ──────────────────────────────────────────────── */
.status-bar { margin-bottom: var(--gap-block); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
/* Where a record is: a green chip, like SALY's current row */
.status-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  padding: .22rem .6rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--link);
}
/* Small tags: caps-style, like SALY's */
.badge {
  display: inline-block;
  font-family: var(--font-label);
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge-warn   { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.badge-ok     { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.badge-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.count-badge {
  display: inline-block;
  font-family: var(--font-label);
  font-variant-numeric: tabular-nums;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border-radius: 999px;
  padding: .1em .6em;
  font-size: .68em;
  font-weight: 700;
  vertical-align: middle;
}

/* ── 13 · Communications queue ────────────────────────────────────────── */
.queue-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad-queue-y) var(--pad-queue-x);
  margin: 10px 0;
}
.queue-item-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.queue-date {
  margin-left: auto;
  font-family: var(--font-label);
  font-size: .72rem;
  color: var(--faint);
  white-space: nowrap;
}
.queue-to { color: var(--muted); margin: 6px 0; font-size: .92rem; }
.queue-auto { border-left: 4px solid var(--success-fg); }
.queue-call { border-left: 4px solid var(--accent); }
.queue-item .btn-row { margin-top: .6rem; }
.msg-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: .92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: .4rem 0;
}

/* ── 14 · Auth screens — centered card, like SALY's unlock card ───────── */
.auth-card {
  max-width: 430px;
  margin: 8vh auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 2rem 2.25rem;
}
.auth-card h1 { margin-top: 0; margin-bottom: .75rem; }
.auth-card p { margin-bottom: .9rem; }
.auth-card label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.auth-card input[type="text"], .auth-card input[type="password"] {
  width: 100%;
  margin: 2px 0 4px;
}
.auth-card details { margin-bottom: .9rem; }
.auth-card summary { cursor: pointer; color: var(--link); font-size: .9rem; }
.totp-qr { max-width: 220px; margin: 12px auto; }
.totp-qr svg {                          /* QR stays black-on-white so it scans */
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 6px;
}

/* ── 15 · Misc ────────────────────────────────────────────────────────── */
.empty-state { color: var(--muted); font-size: .9rem; padding: 1rem 0; }
.hint { color: var(--muted); font-size: .875rem; margin-bottom: 1rem; }
.page-note { color: var(--muted); font-size: .9em; margin-bottom: 1rem; }
.hint-inline { color: var(--faint); font-family: var(--font-body); font-weight: 400; font-size: .78em; letter-spacing: 0; }
.usage-count { font-variant-numeric: tabular-nums; }

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: .45rem .75rem;
  font-size: .92rem;
}
/* A fact's name: plain gray, like the names on SALY's cards */
dt {
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
  padding-top: .05em;
}
dd { font-variant-numeric: tabular-nums; }

.error-page {
  max-width: 480px;
  margin: 4rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 2rem 2.25rem;
}
.error-page h1 { margin-bottom: 1rem; }
.error-page p { margin-bottom: .6rem; color: var(--muted); }

/* ── 16 · Small screens: nothing scrolls horizontally ─────────────────── */
@media (max-width: 720px) {
  main { padding: 1rem .75rem 2.5rem; }
  .top-nav { gap: .4rem .9rem; padding: .5rem .9rem; }
  .data-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .msg-body { overflow-x: auto; }
  dl { grid-template-columns: 110px 1fr; }
  .form-inline .field-row label { min-width: 0; }
  .auth-card { margin: 4vh auto; padding: 1.5rem 1.25rem; }
}

/* ── 17 · Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}


/* ── Client pages: two-pane layout + field grid (July 9 fix) ─────── */
.client-layout {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}
.client-layout .card { margin-bottom: 0; }
/* Stops just below the sticky page header (section 7), however tall a
   wrapped client name makes it. */
.client-layout .client-summary { position: sticky; top: calc(var(--sticky-header-h, 4rem) + 1rem); }

/* Client info: a name, email, phone or address copies in one click, ready
   to paste into an email (format.js [data-copy]; Oct 12 2026). Reads as
   plain text; hover (or focus, or any touch screen) shows the copy mark,
   and a click turns the value green with a check for a moment (red if the
   browser refused) — nothing pops over the neighbouring rows, nothing
   reflows. The mark sits beside the text, never inline after it, so a
   hidden mark can't wrap onto a line of its own. */
.copy-value {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  max-width: 100%;
  margin: -.1rem -.3rem;
  padding: .1rem .3rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: copy;
}
.copy-value:hover { background: var(--row-hover); }
.copy-text { min-width: 0; overflow-wrap: anywhere; }
.copy-mark {
  flex: none;
  color: var(--faint);
  opacity: 0;
  transition: opacity .12s;
}
.copy-mark svg { display: block; position: relative; top: .15em; }
.copy-value:hover .copy-mark,
.copy-value:focus-visible .copy-mark,
.copy-value.is-copied .copy-mark,
.copy-value.copy-failed .copy-mark { opacity: 1; }
@media (hover: none) { .copy-mark { opacity: .7; } }
.copy-mark .check-icon { display: none; }
.copy-value.is-copied .copy-icon { display: none; }
.copy-value.is-copied .check-icon { display: block; }
.copy-value.is-copied { background: var(--success-bg); color: var(--success-fg); }
.copy-value.is-copied .copy-mark { color: var(--success-fg); }
.copy-value.copy-failed { background: var(--danger-bg); color: var(--danger-fg); }
.copy-value.copy-failed .copy-mark { color: var(--danger-fg); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  column-gap: 1.25rem;
}
.form-grid .field-row-wide { grid-column: 1 / -1; }
dl dd { overflow-wrap: break-word; }

/* Edit switches (format.js [data-edit-lock]): the client page's Contact
   rows and each person's details on Admin → Users stay read-only until
   their switch is on; then the section outlines in accent so it's obvious
   an edit is open (and needs Save). .edit-only parts (Users: the Save
   button and the password to confirm a new sign-in email) show only then. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: .8rem;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 2.1rem;
  height: 1.2rem;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color .15s;
}
.switch input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.2rem - 4px);
  height: calc(1.2rem - 4px);
  border-radius: 50%;
  background: var(--accent-contrast);
  box-shadow: var(--shadow-1);
  transition: transform .15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(.9rem); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-section.is-editing { border-color: var(--accent); }
[data-edit-lock]:not(.is-editing) .edit-only { display: none; }
/* readonly doesn't apply to a dropdown — a locked one just ignores the pointer. */
[data-edit-lock]:not(.is-editing) select { pointer-events: none; }
.user-details + .user-details { margin-top: 1rem; }

/* The access-test bar (Admin → Users → Test access): under the nav on
   every page while this session is narrowed, with the way out. Amber, like
   any other "this isn't the normal state" notice. */
.test-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .5rem 1.4rem;
  border-bottom: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: .88rem;
}
.test-bar p { margin: 0; }
.test-bar form { margin: 0; }
.form-section input[readonly],
.form-section select[readonly] {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}
/* A locked dropdown reads like a locked text box: no arrow to invite a click. */
.form-section select[readonly] {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}
.form-section input[readonly]::placeholder { color: transparent; }  /* typing hints, not data */

/* Small confirm box (native <dialog>) — the unsaved-changes prompt. */
.confirm-dialog {
  margin: auto;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.confirm-dialog::backdrop { background: var(--backdrop); }
.opening-dialog { width: min(38rem, calc(100vw - 2rem)); max-height: min(86vh, 46rem); overflow: auto; }
.opening-actions { margin: 1rem 0 .6rem; }
.confirm-dialog p.opening-note { font-size: .8rem; margin-bottom: 0; }
.confirm-dialog h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.confirm-dialog p { color: var(--muted); margin-bottom: 1.1rem; }
.confirm-dialog p:has(+ .unsaved-list) { margin-bottom: .4rem; }
.unsaved-list { margin: 0 0 1.1rem; padding-left: 1.2rem; font-weight: 600; }
.unsaved-list li + li { margin-top: .15rem; }
@media (max-width: 900px) {
  .client-layout { grid-template-columns: 1fr; }
  .client-layout .client-summary { position: static; }
}


/* ── Meetings: prep notes & files ─────────────────────────────────── */
.meeting-prep { margin-top: .75rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.meeting-prep summary { cursor: pointer; font-family: var(--font-label); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.meeting-prep .prep-note { margin: .5rem 0 0; }
.prep-files { list-style: none; padding: 0; margin: .5rem 0 0; }
.prep-files li { display: flex; align-items: center; gap: .5rem; padding: .15rem 0; }
.prep-files .prep-file-delete { margin: 0; }
.prep-add { display: flex; gap: .5rem; align-items: flex-start; margin-top: .6rem; flex-wrap: wrap; }
.prep-add textarea { flex: 1 1 260px; }
.notes-files-bare { padding: .5rem 0 .25rem; }
.series-prep { margin-bottom: .4rem; }

/* A note: its text, then a quiet attribution line. Once edited, the text is
   a redline against the original wording (migration 026) — removed words
   struck through, added words underlined, both in red. Where notes can be
   edited, the attribution line opens the edit box. */
.note-entry { margin: .6rem 0 0; }
.note-meta { font-size: .78rem; color: var(--faint); margin: .1rem 0 0; }
.note-edited { color: var(--redline); }
.redline del { color: var(--redline); text-decoration: line-through; text-decoration-thickness: 1px; }
.redline ins { color: var(--redline); text-decoration: underline; text-underline-offset: 2px; }
.note-edit > summary, .note-history > summary { cursor: pointer; list-style: none; }
.note-edit > summary::-webkit-details-marker,
.note-history > summary::-webkit-details-marker { display: none; }
.note-edit-link, .note-history > summary { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.note-edit > summary:hover .note-edit-link, .note-history > summary:hover { color: var(--link-hover); }
.note-edit[open] .note-edit-cue { display: none; }
.note-edit .prep-add { margin-top: .35rem; }
.note-history ol { margin: .3rem 0 .2rem 1.2rem; }
.note-history li + li { margin-top: .4rem; }

/* Button with an explanatory hint beside it: the hint wraps in its own
   column, vertically centered against the button. */
.btn-hint { display: flex; align-items: center; gap: .75rem; margin-top: .8rem; }
.btn-hint .btn { flex-shrink: 0; }
.btn-hint .hint-inline { display: block; max-width: 46ch; }

/* File drop zone: one control — click opens the picker, drop or choose
   submits immediately (static/format.js). The native input stays in the
   form (hidden) so no-JS still posts via the noscript button. */
.dropzone {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .8rem 1rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--text);
}
.dropzone input[type="file"] { display: none; }

/* ── Possible duplicates: merge review (clients/merge_review.html) ─────── */
.merge-table th[scope="row"] { width: 11rem; font-weight: 600; color: var(--muted); }
.merge-table td { width: 40%; }
.merge-value { white-space: pre-line; }
.merge-fill { background: var(--success-bg); }
.merge-differs { background: var(--warn-bg); }
.merge-was { color: var(--faint); text-decoration: line-through; }
.merge-swatch { display: inline-block; width: .9em; height: .9em; vertical-align: -.1em;
                border: 1px solid var(--border-strong); border-radius: 2px; }
.merge-blockers { margin: .4rem 0 0 1.2rem; }

/* ── In-office signing (signing/*.html, static/signature-pad.js) ────────── */
/* Ink is a fixed dark blue in both themes — it's the signature's colour on
   the sealed PDF too, so the pad shows what gets filed. */
.sig-pad {
  position: relative;
  height: 220px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  touch-action: none;
}
.sig-pad canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  color: #122060;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.sig-pad .sig-line {
  position: absolute; left: 6%; right: 4%; bottom: 30%;
  border-bottom: 1.5px solid #CDC7B9;
  pointer-events: none;
}
.sig-pad .sig-x {
  position: absolute; left: 2.2%; bottom: calc(30% + 2px);
  color: #9A9483; font-size: 1.3rem; line-height: 1;
  pointer-events: none;
}
.sig-consent {
  display: flex; gap: .7rem; align-items: flex-start;
  margin: 1.1rem 0; font-size: 1.05rem; line-height: 1.45;
}
.sig-consent input[type="checkbox"] { width: 1.5rem; height: 1.5rem; flex: none; margin-top: .1rem; }
.sig-actions { margin-top: .9rem; justify-content: space-between; }
.btn-lg { font-size: 1.05rem; padding: .7rem 1.5rem; }
.sig-thumb {                          /* paper chip: blue ink reads in both themes */
  display: inline-block; vertical-align: middle; margin-left: .4rem;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 3px 10px;
}
.sig-thumb svg { display: block; height: 46px; width: auto; max-width: 260px; color: #122060; }
.doc-frame {
  display: block; width: 100%; height: 62vh; min-height: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.signer-block { border-top: 1px solid var(--border); padding: .9rem 0; }
.signer-block:first-of-type { border-top: 0; padding-top: 0; }
.signer-block h3 { margin-bottom: .35rem; }
.id-form .field-row { margin-bottom: .6rem; }
.check-row { display: flex; gap: .55rem; align-items: flex-start; margin: .45rem 0; }
.check-row input[type="checkbox"] { flex: none; margin-top: .25rem; }
.hash { font-family: var(--font-mono); font-size: .78rem; word-break: break-all; }

/* Kiosk shell: what the client holds. No nav, no links out — the app also
   refuses every non-kiosk page until the preparer unlocks it. */
.kiosk-bar {
  display: flex; align-items: center; gap: .6rem;
  background: var(--nav-bg); color: var(--nav-fg);
  padding: .7rem 1.2rem;
  font-family: var(--font-display); font-size: 1.15rem;
}
.kiosk-main { max-width: 880px; }
.kiosk-main h1 { margin-bottom: .4rem; }
.kiosk-who { font-size: 1.1rem; color: var(--muted); margin-bottom: 1rem; }
.kiosk-center { text-align: center; padding: 10vh 0 4vh; }
.kiosk-center p { font-size: 1.15rem; margin: .6rem 0 1.6rem; }
.kiosk-foot { max-width: 880px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--faint); }
.kiosk-foot summary { cursor: pointer; font-size: .85rem; }
.kiosk-foot form { margin-top: .5rem; }

/* ── Access picks (Admin → Users, Decision Record R17) ────────────────── */
fieldset.access-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: .25rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  margin: .5rem 0;
  flex-basis: 100%;
}
fieldset.access-picks legend { font-weight: 600; padding: 0 .25rem; }
fieldset.access-picks label { display: flex; gap: .4rem; align-items: baseline; margin: 0; }
details.access-edit { border-top: 1px solid var(--border); padding: .6rem 0; }
details.access-edit summary { cursor: pointer; list-style: none; }
details.access-edit summary::-webkit-details-marker { display: none; }
details.access-edit summary .btn { margin-left: .5rem; }
details.access-edit .access-form { padding: .5rem 0 .25rem; }

/* ── General Dashboard (app/dashboard.py) ─────────────────────────────── */
.dash-group + .dash-group { margin-top: 1.1rem; }
.dash-group h3 { font-size: .85rem; margin-bottom: .4rem; display: flex; gap: .5rem; align-items: center; }
.dash-group h3 .count { color: var(--muted); font-weight: 500; }
.dash-table td { vertical-align: middle; }
.dash-table .dash-status { color: var(--muted); white-space: nowrap; width: 11rem; }
.dash-table .dash-due { white-space: nowrap; text-align: right; width: 13rem; }
.dash-table .dash-due .badge { margin-right: .35rem; }
.dash-more { margin-top: .35rem; font-size: .8rem; color: var(--muted); }
@media (max-width: 640px) {
  .dash-table .dash-status { display: none; }
  .dash-table .dash-due { width: auto; }
}
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.dash-list li:last-child { border-bottom: 0; }
.dash-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4.6rem; }
.glance-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.glance-tile { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); text-decoration: none; }
.glance-tile:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.glance-tile.alert { background: var(--danger-bg); border-color: var(--danger-border); }
.glance-value { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.glance-label { font-size: .78rem; color: var(--muted); }
.glance-sub { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.glance-stages { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ── Client page: the Work card (app/client_page.py) ───────────────────── */
.work-table td:first-child { width: 7.5rem; }
.work-kind-assurance { background: var(--accent-soft); border-color: var(--accent-line); color: var(--link); }
.closed-work { margin-top: .8rem; }
.closed-work summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.closed-work table { margin-top: .5rem; }

/* ── Client page header, tags and folded sections (2026-11-14) ─────────── */
.page-header .client-header { flex: 1; }
.client-header { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; }
.client-title { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.client-title h1 { margin: 0; }
.client-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.client-tags a.badge { text-decoration: none; }
.client-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.client-back { font-size: .85rem; margin-left: .25rem; }
.client-subhead { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .4rem; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--muted); font-size: .8rem; }
details.card[open] > summary::before { content: "▾"; }
details.card > summary h2 { margin: 0; font-size: .95rem; }
details.card[open] > summary { margin-bottom: .8rem; }
.work-part { margin-top: 1.1rem; padding-top: .2rem; border-top: 1px solid var(--border); }
.billing-total { margin: 0 0 .4rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
