/* Harworth portal. One stylesheet for the client portal (top bar) and the staff workspace (sidebar CRM layout).
   --brand / --accent come from the firm's branding (inline <style> in base.html). */
:root {
  --brand: #1f4e79; --accent: #1f4e79;
  /* --brand-text: the brand as TEXT on a surface (lightened in dark mode); --on-brand: text on a brand-filled button.
     base.html sets --on-brand / --brand-ink when the firm's colour is too light for white text. */
  --brand-text: var(--brand-ink, var(--brand)); --on-brand: #fff; --link: var(--accent);
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8f9fb; --text: #18202c; --muted: #5e6878; --faint: #687182;
  --line: #e3e7ed; --line-strong: #cfd5de;
  --ok: #e6f4ec; --ok-text: #17663a; --err: #fdeceb; --err-text: #a1261d; --warn: #fff4d9; --warn-text: #6e4c00;
  --info: #e9f0fb; --info-text: #1d4f9a; --private: #f1ecfb; --private-text: #5b3aa3;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-text: color-mix(in srgb, var(--brand) 45%, white); --link: color-mix(in srgb, var(--accent) 55%, white);
    --bg: #101318; --surface: #171b22; --surface-2: #1c212a; --text: #e7eaef; --muted: #a1a9b6; --faint: #7f8896;
    --line: #262c36; --line-strong: #343b47;
    --ok: #12301f; --ok-text: #8bd8a9; --err: #3a1916; --err-text: #f4a49c; --warn: #352a0f; --warn-text: #f0d27f;
    --info: #172540; --info-text: #9dbcf2; --private: #261d3b; --private-text: #c8b2f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* label { display: grid } and friends must not override the hidden attribute */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; letter-spacing: -.005em; }
h3 { font-size: .95rem; margin: 0 0 8px; }
h1, h2, h3 { overflow-wrap: break-word; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; vertical-align: -3px; }

/* ---------------------------------------------------------------- client layout */
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.bar { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--brand); }
.bar-in { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.firm { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; }
.firm:hover { text-decoration: none; }
.firm img { max-height: 38px; max-width: 170px; border-radius: 6px; }
@media (prefers-color-scheme: dark) { .firm img { background: #fff; padding: 3px; } }   /* dark logos stay visible */
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); }
main.wrap { padding-top: 28px; padding-bottom: 28px; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .82rem; padding-bottom: 32px; }
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.hero > div:first-child { min-width: 0; flex: 1 1 260px; }
.hero h1 { font-size: 1.7rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.hero p { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- staff workspace */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .firm { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--brand); }
.nav { display: grid; gap: 2px; padding: 12px 10px; }
.nav .group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted);
  font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: color-mix(in srgb, var(--brand) 11%, transparent); color: var(--brand-text); }
.nav .count { margin-left: auto; background: var(--brand); color: var(--on-brand); font-size: .72rem; font-weight: 700; border-radius: 999px;
  padding: 1px 7px; min-width: 20px; text-align: center; }
.side-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side-foot .me { min-width: 0; flex: 1; } .side-foot .me div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .title { font-weight: 650; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .primary, .topbar .secondary { flex: none; white-space: nowrap; }
.topbar .menu { display: none; flex: none; }
.side-backdrop { display: none; }
.page { padding: 24px 28px 40px; width: 100%; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .side.open + .side-backdrop { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(15, 20, 30, .45); }
  @media (prefers-reduced-motion: reduce) { .side { transition: none; } }
  .topbar { padding: 12px 16px; } .topbar .menu { display: inline-flex; }
  .page { padding: 18px 16px 32px; }
}

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  margin-bottom: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; overflow: clip; }   /* clip keeps the rounded corners without trapping sticky children */
.card.flush > .card-head { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.card.flush > .pad { padding: 16px 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.card-head h1, .card-head h2 { margin: 0; }
.narrow { max-width: 460px; margin: 48px auto; }
.grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }
.grid.two.wide-side { grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); }
@media (max-width: 1050px) { .grid.two, .grid.two.wide-side { grid-template-columns: minmax(0, 1fr); } }
/* the Clients page: its table needs the full width sooner than other two-column pages do */
@media (max-width: 1280px) { .grid.two.home { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }   /* minmax(0, …): long content wraps instead of widening the page */
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: flex-end; }
/* text-like inputs grow; radios, checkboxes and pickers keep their own size (:where keeps the specificity of ".row input") */
.row input:where(:not([type=radio], [type=checkbox], [type=hidden], [type=file], [type=color])) { flex: 1 1 200px; }
.row > label { min-width: 0; max-width: 100%; }
.head-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  display: grid; gap: 2px; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi .label { color: var(--muted); font-size: .82rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .sub { color: var(--faint); font-size: .8rem; }

label { display: grid; gap: 6px; font-weight: 550; font-size: .9rem; }
input[type=email], input[type=text], input[type=search], input[type=number], input.text, input.year, input[name=name],
input[name=tax_year], textarea, select {
  font: inherit; font-size: .95rem; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-width: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-text, var(--brand)); outline-offset: 1px;
  border-color: var(--brand); }
textarea { width: 100%; resize: vertical; } input.text { width: 100%; }
select { max-width: 100%; text-overflow: ellipsis; }
fieldset { min-width: 0; }
input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); }
.row input.year, input.year { flex: 0 0 96px; width: 96px; }
/* a tick box or radio with its text beside it (never above): the box stays on the first line, long text wraps next to it */
label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 450; }
label.check input[type=checkbox], label.check input[type=radio] { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--brand); }
label.check > span { min-width: 0; }
label.check select { margin: 4px 0 0 6px; }

button { font: inherit; cursor: pointer; }
.primary, .btn, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--radius-sm);
  padding: 9px 15px; font-weight: 600; font-size: .92rem; border: 1px solid transparent; text-decoration: none; line-height: 1.2; }
.primary, .btn { background: var(--brand); color: var(--on-brand); }
.primary:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.secondary:hover { background: var(--surface-2); text-decoration: none; }
.danger { color: var(--err-text); }
.primary.danger { background: var(--err-text); color: var(--surface); }
button:disabled, button[aria-disabled=true] { opacity: .6; cursor: default; }
/* a submitted form: its buttons are disabled and the one that was pressed shows a spinner */
form[aria-busy=true] { cursor: progress; }
button.is-busy { opacity: 1; cursor: progress; }
button.is-busy::after { content: ""; width: 12px; height: 12px; flex: none; display: inline-block; margin-left: 6px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; vertical-align: -1px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.is-busy::after { animation: none; border-right-color: currentColor; opacity: .5; } }
.link { background: none; border: 0; color: var(--link); padding: 0; font-weight: 500; }
.link.danger { color: var(--err-text); }
/* small outlined control (folder tools): clearly a button, lighter than .secondary */
.mini { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; font-size: .8rem; font-weight: 550; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; }
.mini:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.mini .icon { width: 13px; height: 13px; }
.link:hover { text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
/* break-word (not anywhere): a long word may break, but a column never collapses to one character per line */
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); overflow-wrap: break-word; vertical-align: middle; }
th { white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 20px; }
.table-scroll { overflow-x: auto; }
th.pick, td.pick { width: 40px; }
td.num, th.num { text-align: right; white-space: nowrap; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
a.person:hover strong { text-decoration: underline; }
.person .who-text { min-width: 0; } .person .who-text div { overflow: hidden; text-overflow: ellipsis; }
.person .who-text .email { white-space: nowrap; max-width: 34ch; }   /* the full address is in its title */
/* The Clients table always fits its card above the stacked-card breakpoint: fixed layout, the name column takes what
   is left (its email ellipsizes), and status pills wrap inside their cells instead of pushing Docs out of view. */
@media (min-width: 641px) {
  #client-table { table-layout: fixed; }
  #client-table th.pick { width: 48px; } #client-table th.stage { width: 24%; } #client-table th.portal { width: 176px; }
  #client-table th.num { width: 68px; }
  #client-table .who-text { flex: 1 1 0; } #client-table .who-text .email { max-width: 100%; }
  #client-table td .pill { white-space: normal; border-radius: 12px; }
}
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: var(--brand-text); background: color-mix(in srgb, var(--brand) 13%, var(--surface)); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }

.tag, .pill { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; border-radius: 999px; padding: 2px 9px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; vertical-align: 1px; }
.pill.ok, .tag.ok { background: var(--ok); color: var(--ok-text); border-color: transparent; }
.pill.warn, .tag.lock { background: var(--warn); color: var(--warn-text); border-color: transparent; }
.pill.info { background: var(--info); color: var(--info-text); border-color: transparent; }
.pill.err { background: var(--err); color: var(--err-text); border-color: transparent; }
.tag.new { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.notes-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: .76rem; font-weight: 600; border-radius: 999px; padding: 2px 8px;
  background: var(--info); color: var(--info-text); }
.notes-chip.private { background: var(--private); color: var(--private-text); }
.notes-chip.add { background: transparent; color: var(--faint); border: 1px dashed var(--line-strong); }
.notes-chip .icon { width: 13px; height: 13px; }
.notes-chip:hover { text-decoration: none; filter: brightness(.97); }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); background: var(--ok); color: var(--ok-text); overflow-wrap: anywhere;
  margin: 0 0 14px; font-size: .92rem; }
.flash.error { background: var(--err); color: var(--err-text); }
.flash.dev { background: #fff6d6; color: #6b5400; }
.callout { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.callout.warn { background: var(--warn); color: var(--warn-text); border-color: transparent; }

/* tabs (client record) */
/* the rule under the strip is an inset shadow, so the active tab's underline sits on it without a negative margin
   (which made the strip scroll vertically) */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin: 0 0 20px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; }
.tabs a { flex: none; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--brand-text); border-bottom-color: var(--brand-text); }
.tabs .n { font-size: .75rem; color: var(--faint); margin-left: 4px; }
.tabs .count-dot { margin-left: 5px; }
.panel[hidden] { display: none; }

.record-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.record-head .grow { flex: 1; min-width: 220px; }
.record-head h1 { margin: 0 0 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.feed .dot .icon { width: 15px; height: 15px; }
.feed li.unread .dot { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-text); border-color: transparent; }
.feed li.private .dot { background: var(--private); color: var(--private-text); border-color: transparent; }
.feed li > div { min-width: 0; }
.feed .text { font-size: .9rem; overflow-wrap: anywhere; } .feed .when, .feed time { color: var(--faint); font-size: .78rem; }
.feed .split { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; }
.feed li.unread .text { font-weight: 600; }

/* files */
.drop { display: grid; gap: 6px; justify-items: center; text-align: center; border: 2px dashed var(--line-strong); border-radius: var(--radius);
  padding: 26px 18px; font-weight: 500; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--brand-text); color: var(--text); }
.drop.over { background: color-mix(in srgb, var(--brand) 8%, var(--surface-2)); }
.drop .icon { width: 28px; height: 28px; color: var(--brand-text); }
.drop input[type=file] { max-width: 100%; font-size: .85rem; }
.drop .chosen:empty, .attach .chosen:empty { display: none; }
.drop .chosen { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
/* With scripting, the zone / label is the trigger and the script lists the chosen files, so the native "Choose Files" button is
   hidden but stays focusable (keyboard, required-field messages). Without scripting the native control shows as before. */
@media (scripting: enabled) {
  .drop, .attach { position: relative; }
  .drop input[type=file], .attach input[type=file] { position: absolute; left: 50%; bottom: 4px; width: 1px; height: 1px; margin: 0; padding: 0;
    opacity: 0; overflow: hidden; }
  .attach input[type=file] { left: 8px; bottom: 0; }
  .drop:focus-within, .attach:focus-within { outline: 2px solid color-mix(in srgb, var(--brand-text) 60%, transparent); outline-offset: 2px; }
}
.upload-progress { display: grid; gap: 4px; }
.upload-progress .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand-text); transition: width .2s; }
.upload-progress.indeterminate .bar i { width: 35% !important; animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }
@media (prefers-reduced-motion: reduce) { .upload-progress.indeterminate .bar i { animation: none; width: 100% !important; opacity: .5; } }
.file-list { display: grid; gap: 8px; }
.file-list:empty { display: none; }
.file-row { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.file-row .name-in { display: flex; align-items: center; gap: 6px; }
.file-row .name-in input { flex: 1; }
.file-row .meta { overflow-wrap: anywhere; }
.file-row.too-big { border-color: var(--err-text); } .file-row.too-big .meta { color: var(--err-text); }
.file-row .ext, .file-row .meta { color: var(--faint); font-size: .82rem; }
/* long file names wrap inside their box (anywhere), so the buttons beside them stay on screen */
.fname { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 500; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.fname .icon { color: var(--faint); margin-top: 2px; }
h1.fname .icon, h2.fname .icon { margin-top: 5px; }
.locked { color: var(--muted); }
.note { white-space: pre-line; margin-top: 3px; }

/* notes thread */
.thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.msg.private { background: var(--private); border-color: transparent; }
.msg.mine { border-left: 3px solid var(--brand); }
.msg .msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.msg .msg-head strong { color: var(--text); overflow-wrap: anywhere; }
.msg .body { white-space: pre-line; overflow-wrap: anywhere; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; width: max-content; max-width: 100%; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 7px 12px; font-weight: 500; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { accent-color: var(--brand); }

/* invoices */
.invoice-due { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
  margin-bottom: 14px; border-radius: var(--radius); background: var(--warn); color: var(--warn-text); }
.invoice-due .muted { color: inherit; opacity: .85; }
.invoice-due > div, .invoice-head > div { min-width: 0; overflow-wrap: anywhere; }
.invoice { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; display: grid; gap: 6px; }
.invoice-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.invoice-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; margin-top: 4px; }
.markpaid { flex-basis: 100%; } .markpaid summary { cursor: pointer; width: max-content; }
.markpaid form { margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.amount { font-size: 2.2rem; font-weight: 750; letter-spacing: -.02em; margin: 4px 0; }
.gate { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 14px; margin: 0; } .gate legend { padding: 0 6px; }
.gate-fields { margin-top: 6px; } .row label.grow { flex: 1 1 260px; } input.money { width: 140px; }
.return-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.returned { border-top: 3px solid var(--brand); }
.invite { margin-bottom: 16px; } .invite summary { list-style: none; width: max-content; max-width: 100%; cursor: pointer; }
.invite summary::-webkit-details-marker { display: none; }
.invite-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.search { margin: 0; flex: 1 1 260px; display: flex; min-width: 0; } .search input { flex: 1; width: 100%; }
/* bulk actions for the ticked clients: one bordered group per action, each input beside its own button */
.bulk-bar { display: grid; gap: 10px; margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.bulk-count { font-weight: 650; font-size: .9rem; }
.bulk-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; margin: 0; min-width: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); }
.bulk-group select, .bulk-group input { padding: 6px 10px; font-size: .88rem; min-width: 0; }
.bulk-group select { max-width: 220px; } .bulk-group input.tag-box { width: 130px; } .bulk-group input.year { flex: 0 0 76px; width: 76px; }
.bulk-group .secondary, .bulk-group .primary { padding: 6px 11px; font-size: .85rem; white-space: nowrap; }
@media (min-width: 901px) { .bulk-bar.sticky { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -6px 16px rgba(16, 24, 40, .08); } }
tr.bad td { color: var(--err-text); }
.summary { padding-left: 20px; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); }
.order-list li.skip { opacity: .6; }
.order-list .grow { flex: 1; min-width: 0; }
.order-list input[name=order] { width: 60px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid var(--line); }
.logo-preview { max-height: 56px; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.dns { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; overflow-wrap: anywhere; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-text); font-weight: 700; font-size: .85rem; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; color: var(--faint); }

.show-sm { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .card { padding: 16px; }
  /* touch targets: at least 32px high on a phone */
  .mini, summary.mini, button.mini, a.mini, .doc-actions button, .doc-actions .btn, .doc-actions summary { min-height: 32px; display: inline-flex; align-items: center; }
  main a:not(.btn):not(.firm) { padding-block: 5px; }
  .menu-pop .pop, .folder-menu .pop { max-width: calc(100vw - 32px); }
  .board-hint { display: block; }
}

/* ---------------------------------------------------------------- phase 2: CRM, folders, chat, e-sign */
.count-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .72rem; font-weight: 700; vertical-align: 1px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); }
.filters select { padding: 6px 10px; font-size: .88rem; min-width: 0; max-width: min(100%, 260px); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-weight: 500; font-size: .85rem; background: var(--surface); cursor: pointer; }
.chip input { accent-color: var(--brand); }
.tagline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* pipeline */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin-bottom: 10px; }
.step-btn { display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 500; font-size: .85rem; }
.step-btn .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: .75rem; font-weight: 700; }
.step-btn.done { color: var(--text); } .step-btn.done .n { background: var(--ok); color: var(--ok-text); }
.step-btn .n .icon { width: 13px; height: 13px; stroke-width: 2.6; }
/* the current step must read as the active one, not a disabled one: brand-text colour, heavier weight, filled number */
.step-btn.on { border-color: var(--brand-text); color: var(--brand-text); font-weight: 650; background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--brand-text); }
.step-btn.on .n { background: var(--brand); color: var(--on-brand); }
@media (prefers-color-scheme: dark) { .step-btn.on .n { background: var(--brand-text); color: var(--surface); } }
.step-btn:hover { border-color: var(--line-strong); color: var(--text); }
.step-btn.on:hover { border-color: var(--brand-text); color: var(--brand-text); }

/* folder tree */
.tree { display: grid; gap: 8px; }
.tree .sub { margin: 6px 0 0 18px; padding-left: 10px; border-left: 2px solid var(--line); }
details.folder { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
details.folder > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
details.folder > summary::-webkit-details-marker { display: none; }
/* a drawn chevron (the "▸" glyph rendered as a tiny dot in some fonts) */
details.folder > summary::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 5px 2px 3px; border: solid var(--muted);
  border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; }
details.folder[open] > summary::before { transform: rotate(45deg); margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { details.folder > summary::before { transition: none; } }
details.folder > summary:hover::before { border-color: var(--text); }
details.folder.area-private { background: var(--surface-2); }
.folder-name { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.folder-name .icon { color: var(--brand-text); }
.folder-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px 34px; }
.doc-list { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 2px; }
.doc-list.pad { padding: 12px 20px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: var(--radius-sm); }
.doc-row:hover { background: var(--surface-2); }
.doc-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.doc-main > div { flex-basis: 100%; }
.doc-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.doc-row > input[type=checkbox] { flex: none; }
.empty-folder { padding: 0 14px 10px 32px; margin: 0; }
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop .pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(320px, calc(100vw - 16px)); padding: 14px;
  max-height: calc(100vh - 16px); overflow-y: auto; text-align: left; font-weight: 400;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.folder-menu .pop { left: 0; right: auto; }
/* ui.js pins an open popup to the viewport (position: fixed, clamped to the screen) so no card, scrolling log or
   nested folder can clip it; the rules above are the no-script fallback */
.menu-pop .pop.pinned { position: fixed; right: auto; bottom: auto; margin: 0; }
.menu-pop.wide .pop { width: min(420px, calc(100vw - 16px)); }
.tpl-folder { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tpl-folder:last-of-type { border-bottom: 0; }
.file-opts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.file-opts select { padding: 6px 10px; font-size: .88rem; }

/* tasks on the client home */
.task-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
  margin-bottom: 14px; border-radius: var(--radius); background: var(--info); color: var(--info-text); }
.task-card .icon { vertical-align: -3px; }
.task-card > div { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.task-card .primary { flex: none; }
.finish { border-left: 4px solid var(--ok-text); }

/* secure messages */
.chat { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.chat-log { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-height: 60vh; overflow-y: auto; padding: 4px 2px; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { min-width: 0; max-width: min(640px, 85%); padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.bubble-row.mine .bubble { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border-color: transparent; border-bottom-right-radius: 4px; }
.bubble-row.theirs .bubble { border-bottom-left-radius: 4px; }
.bubble-row.internal .bubble { background: var(--private); border: 1px dashed color-mix(in srgb, var(--private-text) 40%, transparent); }
.bubble-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.bubble-head strong { color: var(--text); }
.bubble .body { overflow-wrap: anywhere; }
.rich ul, .rich ol { margin: 4px 0; padding-left: 20px; }
.mention { font-weight: 600; color: var(--private-text); }
.receipt { color: var(--faint); margin-top: 4px; text-align: right; }
.receipt .icon { width: 13px; height: 13px; }
.edit-msg { margin-top: 4px; } .edit-msg .pop { right: 0; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.composer-top, .composer-bottom { justify-content: space-between; }
.toolbar { display: flex; align-items: center; gap: 4px; }
.toolbar .icon-btn { width: 32px; height: 32px; }
.attach { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--link); cursor: pointer; min-width: 0; }
.attach input { max-width: 190px; font-size: .8rem; }
.attach .chosen { color: var(--text); font-weight: 500; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-bottom select { min-width: 0; max-width: min(100%, 280px); }
.draft-state { margin-left: auto; }
.new-msgs { justify-self: center; }

/* e-signatures */
.sign-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .sign-layout { grid-template-columns: 1fr; } }
.sign-pages { display: grid; gap: 18px; }
.page-wrap { position: relative; width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: var(--shadow);
  overflow: hidden; user-select: none; }
.place .page-wrap { cursor: crosshair; }
.page-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.page-no { position: absolute; right: 8px; bottom: 6px; font-size: .72rem; color: #8a93a3; background: rgba(255, 255, 255, .85);
  padding: 1px 6px; border-radius: 4px; }
.sig-field { position: absolute; display: flex; align-items: center; justify-content: center; border: 2px dashed #8a93a3;
  border-radius: 4px; background: rgba(138, 147, 163, .12); color: #4b5563; font-size: .72rem; font-weight: 600; overflow: hidden;
  white-space: nowrap; }
.sig-field.mine { border-color: #d97706; background: rgba(251, 191, 36, .22); color: #92400e; animation: pulse 1.6s ease-in-out infinite; }
.sig-field.done { border-style: solid; border-color: #16a34a; background: rgba(22, 163, 74, .1); color: #166534; }
.sig-field.placed { border-style: solid; border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--brand); cursor: move; touch-action: none; }
.sig-field.placed.date { border-color: #0e7490; color: #0e7490; background: rgba(14, 116, 144, .12); }
.sig-field.placed.initials { border-color: #7c3aed; color: #7c3aed; background: rgba(124, 58, 237, .12); }
.sig-field .grip { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: currentColor; cursor: nwse-resize;
  clip-path: polygon(100% 0, 100% 100%, 0 100%); }
@keyframes pulse { 50% { background: rgba(251, 191, 36, .38); } }
@media (prefers-reduced-motion: reduce) { .sig-field.mine { animation: none; } }
.sign-panel { position: sticky; top: 80px; }
.field-kinds { display: grid; gap: 6px; }
.field-kinds label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-weight: 500; cursor: pointer; }
.field-kinds label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.field-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.field-kinds .icon { color: var(--brand-text); }
.sig-preview { font: italic 2rem/1.2 "Snell Roundhand", "Brush Script MT", "Segoe Script", cursive, serif; color: #14213d;
  padding: 10px 14px; border-bottom: 2px solid var(--line-strong); min-height: 60px; background: #fff; border-radius: 6px 6px 0 0; overflow: hidden; }
.sig-pad { width: 100%; height: 150px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); touch-action: none; }
.consent { align-items: flex-start; } .consent span { font-size: .85rem; }

/* ---------------------------------------------------------------- WYSIWYG editor */
.rte { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.rte:focus-within { outline: 2px solid var(--brand-text, var(--brand)); outline-offset: 1px; border-color: var(--brand); }
.rte.invalid { border-color: var(--err-text); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rte-btn { min-width: 30px; height: 28px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--muted); font-size: .88rem; line-height: 1; }
.rte-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.rte-btn.on { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-text); }
.rte-count { padding: 2px 10px 4px; text-align: right; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
.rte-count.over { color: var(--err-text); font-weight: 600; }
.rte-area { position: relative; padding: 10px 12px; font-size: .95rem; line-height: 1.55; color: var(--text); outline: none; overflow-wrap: anywhere;
  max-height: 50vh; overflow-y: auto; font-weight: 400; }
.rte-area ul, .rte-area ol, .rich ul, .rich ol { margin: 4px 0; padding-left: 22px; }
.rte-area a, .rich a { text-decoration: underline; }
.rte.rte-empty .rte-area::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; position: absolute; left: 12px; top: 10px; }
.rich p { margin: 0 0 6px; } .rich p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- Messages page */
.messages-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.messages-layout > * { min-width: 0; }
.messages-layout .threads-card { position: sticky; top: 80px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; }
.messages-layout .threads { overflow-y: auto; }
.back-to-threads { display: none; }
/* one column: the open conversation comes first, the list of conversations follows it */
@media (max-width: 1000px) {
  .messages-layout { grid-template-columns: minmax(0, 1fr); }
  .messages-layout > .threads-col { order: 2; }
  .messages-layout .threads-card { position: static; max-height: none; }
  .messages-layout .threads { overflow-y: visible; }
  .back-to-threads { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; font-weight: 600; }
}
.thread-search { max-width: 280px; padding: 7px 10px; }
.card-head .thread-search { flex: 1 1 160px; min-width: 0; }
.threads { list-style: none; margin: 0; padding: 0; }
.threads li + li { border-top: 1px solid var(--line); }
.thread-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--text); }
.thread-row:hover { background: var(--surface-2); text-decoration: none; }
.thread-row.on { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand); }
.thread-main { flex: 1; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; gap: 10px; }
.thread-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-top .when, .thread-top time { color: var(--faint); font-size: .78rem; white-space: nowrap; }
.thread-preview { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-row.unread strong, .thread-row.unread .thread-preview { color: var(--text); font-weight: 650; }
.compose-to { align-items: flex-end; }

.preparer-note { margin-bottom: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) {
  .bar .firm { font-size: .95rem; }
  .bar .firm img { max-height: 32px; }
  .who .secondary { white-space: nowrap; padding: 7px 11px; }
  .bar .firm { min-width: 0; } .bar .firm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* firm logo + name in the sidebar: logo on top, name under it, scaled to fit */
.side .firm.stacked { flex-direction: column; align-items: flex-start; gap: 8px; }
.side .firm.stacked img { max-height: 56px; max-width: 100%; object-fit: contain; border-radius: 6px; }
.side .firm.stacked span { font-size: .92rem; line-height: 1.25; font-weight: 650; overflow-wrap: anywhere; }
.side .firm.logo-only img { max-height: 64px; }
.bar .firm.logo-only img { max-height: 44px; max-width: 240px; }
.firm img { object-fit: contain; }

.confirm-dialog { max-width: 520px; width: calc(100% - 32px); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 22px 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.confirm-dialog::backdrop { background: rgba(15, 20, 30, .45); }
.confirm-dialog h2 { display: flex; align-items: center; gap: 8px; }
.confirm-dialog p { overflow-wrap: anywhere; }
.confirm-dialog .actions { margin-top: 16px; }
/* a control someone may not use: the wrapper takes the hover (title) and focus, the disabled button can't */
.restricted { display: inline-block; cursor: not-allowed; }
.restricted > button[disabled] { pointer-events: none; opacity: .55; }
.tax-year-row { align-items: center; justify-content: space-between; }
.tax-year-now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.confirm-dialog select[multiple] { width: 100%; }

/* workflows + automations */
.wf-card + .wf-card { border-top: 1px solid var(--line); }
.wf-flow { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: wf; }
.wf-flow li { counter-increment: wf; display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); min-width: 150px; position: relative; }
.wf-flow li::before { content: counter(wf); position: absolute; top: -8px; left: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.wf-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wf-step { display: grid; grid-template-columns: 26px minmax(140px, 1.2fr) minmax(180px, 1.4fr) minmax(140px, 1fr) auto; gap: 8px;
  align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.wf-step .step-n { width: 24px; height: 24px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  color: var(--brand-text); font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.wf-step select { padding: 7px 8px; font-size: .88rem; min-width: 0; width: 100%; }
/* on the wide grid a step without a tag keeps the empty column so the rows line up (overrides the global [hidden] rule) */
.wf-step .tag-in[hidden] { display: block !important; visibility: hidden; }
/* narrow screens: number on the left, then name, trigger, tag and the move / remove buttons stacked in one column */
@media (max-width: 900px) {
  .wf-step { grid-template-columns: 26px minmax(0, 1fr); padding: 10px; }
  .wf-step > :not(.step-n) { grid-column: 2; }
  .wf-step .step-n { grid-column: 1; grid-row: 1; }
  .wf-step .tag-in[hidden] { display: none !important; }
  .wf-step .actions { justify-content: flex-end; }
}
.auto-row.paused { opacity: .6; }
.auto-row .dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand-text); flex: none; }
.auto-row { align-items: flex-start; }
.wf-editor { margin-bottom: 20px; }
.wf-editor .wf-steps { max-width: 1100px; }

/* ---------------------------------------------------------------- small screens (last, so it wins over the rules above) */
@media (max-width: 640px) {
  .card.flush > .card-head, .card.flush > .pad, .filters, .bulk-bar { padding-left: 16px; padding-right: 16px; }
  .card.flush table th:first-child, .card.flush table td:first-child { padding-left: 16px; }
  .card.flush table th:last-child, .card.flush table td:last-child { padding-right: 16px; }
  /* the client list as stacked cards: tick box and name on the first line, stage / portal / documents under the name */
  table.cards-sm, table.cards-sm tbody { display: block; }
  table.cards-sm thead tr { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
  table.cards-sm thead { display: block; }
  table.cards-sm thead th { display: none; padding: 0; border: 0; background: none; }
  table.cards-sm thead th.pick { display: block; width: auto; }
  table.cards-sm thead th.pick::after { content: " Select all"; text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; }
  table.cards-sm tbody tr { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 16px 12px 50px;
    border-bottom: 1px solid var(--line); }
  table.cards-sm tbody tr:last-child { border-bottom: 0; }
  table.cards-sm tbody td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  table.cards-sm tbody tr:hover td { background: none; }
  table.cards-sm td.pick { position: absolute; left: 16px; top: 20px; width: auto; }
  table.cards-sm td.client { flex: 1 1 100%; }
  table.cards-sm td.client .email { max-width: 100%; }
  table.cards-sm td.stage:not(:has(.pill)) { display: none; }
  table.cards-sm td.num { text-align: left; color: var(--muted); font-size: .82rem; }
  table.cards-sm td.num::after { content: " " attr(data-label); }
  .composer-bottom .primary { margin-left: auto; }
  .record-head .actions { width: 100%; }
  .sign-panel { position: static; }
}

/* ---------------------------------------------------------------- streamlining (Nov 2026) */
/* setup list pages (templates, workflows, automations): one row pattern, actions on the right */
.card.flush > .lead { padding: 12px 20px 0; margin: 0; }
.setup-list .doc-row { align-items: flex-start; }
.setup-list .doc-main { flex: 1 1 auto; min-width: 0; }
.setup-list .doc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 12px; flex: 0 1 auto; max-width: 46%; padding-top: 2px; }
.setup-list .wf-flow { margin-top: 12px; }
.empty .primary, .empty .secondary { margin-top: 4px; }
.tag.kv .k { font-weight: 500; opacity: .8; } .tag.kv .k::after { content: ":"; }
a.tag.lock:hover { text-decoration: underline; }
.secondary.danger { color: var(--err-text); }
.field-label { display: block; font-weight: 550; font-size: .9rem; margin-bottom: 6px; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
.flash.flag { margin: 0 0 4px; } td .flash.flag { margin: 6px 0 0; }
.callout.actions { margin-bottom: 20px; } .callout.actions .grow { flex: 1 1 260px; }

/* a part of a form or card that stays folded until it is wanted */
details.more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--link); font-weight: 550; font-size: .92rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-weight: 700; margin-left: 2px; }
details.more[open] > summary::after { content: "\2212"; }
details.more > summary:hover { text-decoration: underline; }
details.more > summary h2 { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
details.more[open] > summary { margin-bottom: 12px; }
.card > details.more { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.danger-zone { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }

/* searchable pick list: a filter box above tick boxes or radios */
.picker { display: grid; gap: 6px; min-width: 0; }
.pick-list { list-style: none; margin: 0; padding: 4px; max-height: 232px; overflow-y: auto; display: grid; gap: 1px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); }
.pick-list li { padding: 5px 8px; border-radius: 6px; } .pick-list li[hidden] { display: none; }
.pick-list li:hover, .pick-list li:focus-within { background: var(--surface-2); }
.pick-list label.check { align-items: center; cursor: pointer; overflow-wrap: anywhere; }
.pick-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); }
dialog .pick-list { max-height: min(232px, 34vh); }

/* Follow / Following: the label says what a press does once the pointer or the keyboard is on it */
.follow-btn.on { border-color: var(--brand-text); color: var(--brand-text); }
.follow-btn .hot { display: none; }
.follow-btn.on:hover .hot, .follow-btn.on:focus-visible .hot { display: inline; }
.follow-btn.on:hover .idle, .follow-btn.on:focus-visible .idle { display: none; }

/* signing: your own open fields are links to the signing panel; on one column a bar that stays on screen leads there */
a.sig-field { text-decoration: none; cursor: pointer; } a.sig-field:focus-visible { outline: 3px solid var(--brand-text); outline-offset: 2px; }
.sign-panel { scroll-margin-top: 84px; } #share, #editor, #new-invoice { scroll-margin-top: 84px; }
.sign-bar { display: none; }
@media (max-width: 1000px) {
  .sign-bar { display: flex; position: sticky; bottom: 0; z-index: 6; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); margin: 0 -16px; background: var(--surface);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(16, 24, 40, .1); }
  .sign-bar.at-panel { display: none; }
}
@media (max-width: 640px) { .setup-list .doc-row { flex-wrap: wrap; } .setup-list .doc-actions { max-width: 100%; justify-content: flex-start; } }

/* ---- setup wizard ("Customize your platform"), the setup checklist, and switches ---- */
.pill.text { display: inline-block; }          /* a pill that may wrap reads as one run of text, not flex chunks */
.pill.text .icon { vertical-align: -2px; }
.drop.compact { padding: 14px 16px; gap: 4px; }
.drop.compact .icon { width: 22px; height: 22px; }
.gate:has(> .gate-fields[hidden]) { border-color: transparent; padding: 0; }     /* a collapsed option draws no empty frame */
.gate:has(> .gate-fields[hidden]) legend { padding: 0; }
.setup { max-width: 920px; min-width: 0; }
.setup > nav { min-width: 0; max-width: 100%; overflow: hidden; }
.setup-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; }
.setup-steps li { flex: 0 1 auto; }
.setup-steps a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-weight: 500; font-size: .84rem; white-space: nowrap; }
.setup-steps a:hover { text-decoration: none; border-color: var(--line-strong); color: var(--text); }
.setup-steps .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: .75rem; font-weight: 700; }
.setup-steps .n .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.setup-steps .done a { color: var(--text); } .setup-steps .done .n { background: var(--ok); color: var(--ok-text); }
.setup-steps .on a { border-color: var(--brand-text); color: var(--brand-text); font-weight: 650; box-shadow: inset 0 0 0 1px var(--brand-text);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.setup-steps .on .n { background: var(--brand); color: var(--on-brand); }
@media (prefers-color-scheme: dark) { .setup-steps .on .n { background: var(--brand-text); color: var(--surface); } }
.setup-count { margin: 0 0 12px; }
.setup-card h1 { font-size: 1.45rem; margin: 0 0 6px; }
.setup-card h2 { font-size: 1.02rem; margin: 26px 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.setup-card h3 { font-size: .9rem; margin: 14px 0 6px; display: flex; align-items: center; gap: 6px; }
.setup-card fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.setup-card fieldset.plain > legend { padding: 0; margin-bottom: 4px; }
.setup-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.setup-nav .back { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }
.profile-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 16px 0; }
.profile-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-weight: 400; }
.profile-card:hover { border-color: var(--brand-text); }
.profile-card strong, .profile-card .small { display: block; }
.profile-card .pick-mark { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; }
.profile-card .pick-mark .icon { display: none; width: 12px; height: 12px; stroke-width: 3; }
.profile-preview { display: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 4px 18px 14px; }
.profile-preview h2 { margin-top: 14px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 24px; }
.preview-stages { margin: 0; padding-left: 1.3em; } .preview-stages li { margin-bottom: 6px; }
.preview-stages strong, .preview-stages .small { display: block; }
.preview-list { margin: 0; padding-left: 1.2em; } .preview-list li { margin-bottom: 5px; }
.setup-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup-stages li { display: grid; grid-template-columns: 24px minmax(160px, 300px) minmax(0, 1fr); gap: 4px 10px; align-items: center; }
.setup-stages .n { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem;
  font-weight: 700; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-text); }
.setup-autos, .setup-slots, .setup-team { list-style: none; margin: 0 0 8px; padding: 0; }
.setup-autos li, .setup-slots li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.setup-autos li:first-child, .setup-slots li:first-child { border-top: 0; }
.setup-autos .grow, .setup-slots .grow { flex: 1 1 280px; min-width: 0; }
.setup-team li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.setup-team li > span { min-width: 0; overflow-wrap: anywhere; } .setup-team .small { display: block; }
.waiting { color: var(--warn-text); background: var(--warn); border-radius: var(--radius-sm); padding: 4px 8px; margin-top: 4px; display: inline-block; }
.waiting a { color: inherit; text-decoration: underline; }
.switch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .82rem; min-width: 92px; }
.switch .knob { width: 20px; height: 20px; border-radius: 50%; background: var(--faint); flex: none; }
.switch.on { background: var(--ok); border-color: transparent; color: var(--ok-text); flex-direction: row-reverse; padding: 4px 4px 4px 10px; justify-content: space-between; }
.switch.on .knob { background: var(--ok-text); }
.switch.wait { background: var(--warn); border-color: transparent; color: var(--warn-text); flex-direction: row-reverse; padding: 4px 4px 4px 10px; justify-content: space-between; }
.switch.wait .knob { background: var(--warn-text); }
.setup-checklist { margin-bottom: 20px; }
.setup-checklist .card-head { margin-bottom: 8px; }
.setup-checklist h2 .icon { vertical-align: -3px; }
.setup-meter { width: 100%; height: 6px; accent-color: var(--brand); margin: 0 0 10px; }
.checklist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 20px; }
.checklist li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.checklist li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.checklist .tick { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; }
.checklist .done { color: var(--muted); }
.checklist .done .tick { background: var(--ok); border-color: transparent; color: var(--ok-text); }
.checklist .tick .icon { width: 11px; height: 11px; stroke-width: 3; }
@media (max-width: 640px) {
  .setup-steps { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .setup-steps li { flex: none; }
  .setup-steps li:not(.on) .label { display: none; }   /* the link keeps its name in aria-label */
  .setup-steps li:not(.on) a { padding: 8px; }
  .setup-stages li { grid-template-columns: 24px minmax(0, 1fr); }
  .setup-stages li .small { grid-column: 2; }
  .setup-nav .back { margin-left: 0; }
  .setup-nav .primary, .setup-nav .secondary { flex: 1 1 100%; }
  .setup-autos form, .setup-slots form, .setup-slots a.secondary { flex: 1 1 100%; }
  .setup-slots .secondary { width: 100%; }
}

/* ---- the client record: contact, internal notes, households, tasks, document requests */
input[type=date], input[type=tel] { font: inherit; font-size: .95rem; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-width: 0; max-width: 100%; }
.facts .wide { grid-column: 1 / -1; }
.facts dd { overflow-wrap: anywhere; }
.facts .address span { display: block; }
.notes-timeline { margin-top: 10px; }
.notes-timeline .note-body { white-space: pre-wrap; }
.notes-timeline li.pinned { background: color-mix(in srgb, var(--private) 45%, transparent); border-radius: var(--radius-sm); padding-left: 8px; padding-right: 8px; }
.notes-timeline .when.split { margin-top: 2px; }
.task-list { padding-left: 0; padding-right: 0; }
.card.flush .task-list.pad { padding: 4px 12px 10px; }
.task-row { align-items: flex-start; }
.task-row > form { flex: none; display: flex; }
.task-check { flex: none; width: 24px; height: 24px; margin-top: 1px; padding: 0; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--surface); color: transparent; display: inline-flex; align-items: center; justify-content: center; }
.task-check .icon { width: 13px; height: 13px; stroke-width: 3; }
.task-check:hover, .task-check:focus-visible { border-color: var(--ok-text); color: var(--ok-text); }
.task-row.done .task-check { background: var(--ok); border-color: transparent; color: var(--ok-text); }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 0 6px; }
.task-meta > span:not(:last-child)::after { content: "\00b7"; margin-left: 6px; color: var(--faint); }
.list-head { display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 14px 20px 2px; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.list-head .n { font-weight: 600; color: var(--faint); }
.list-head.overdue { color: var(--err-text); }
.filters .seg label { padding: 5px 10px; font-size: .88rem; }
@media (max-width: 640px) { .list-head { padding-left: 16px; padding-right: 16px; } }
.ask-progress { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.ask-progress i { display: block; height: 100%; background: var(--ok-text); border-radius: 999px; min-width: 0; }
.ask-summary { display: grid; gap: 8px; margin-bottom: 12px; }
.ask-reminders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 14px; }
.ask-reminders .grow { flex: 1 1 260px; min-width: 0; } .ask-reminders .icon { vertical-align: -3px; }
.ask-item.is-na, .ask-item.is-accepted { background: var(--surface-2); }
.ask-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.ask { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); }
.ask.is-returned { border-color: var(--err-text); }
.ask.is-received, .ask.is-accepted { background: var(--surface-2); }
.ask-main { display: flex; gap: 10px; flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.ask-main > div { min-width: 0; }
.ask-mark { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ok-text); }
.ask.is-received .ask-mark, .ask.is-accepted .ask-mark { background: var(--ok); border-color: transparent; }
.ask-mark .icon { width: 12px; height: 12px; stroke-width: 3; }
.ask-reason { margin-top: 4px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--err); color: var(--err-text); }
.ask-upload { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 1 auto; max-width: 100%; }
.ask-upload .attach { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.ask-upload .file-list { flex-basis: 100%; }
.ask-upload .file-list:empty { display: none; }
/* the Send button appears once a file is chosen (where :has is understood; otherwise it is simply always there) */
.ask-upload:not(:has(input[type=file]:valid)) > button { display: none; }
.ask-row { padding-top: 4px; }
.who-text .company { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .ask-upload { justify-content: flex-start; width: 100%; } }

/* ---- working the book of business: List | Board switch, saved views, the pipeline board */
.book-switch { margin-bottom: 16px; } .book-switch .icon { width: 16px; height: 16px; margin-right: 2px; }
.views-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.views-bar .views-label { font-weight: 600; margin-right: 2px; }
a.view-chip { color: var(--text); padding: 4px 11px; } a.view-chip:hover { text-decoration: none; background: var(--surface-2); }
a.view-chip.on { background: var(--info); color: var(--info-text); border-color: transparent; }
.view-chip .icon { width: 13px; height: 13px; }
.view-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.view-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; } .view-list .grow { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.filters input[type=search] { padding: 6px 10px; font-size: .88rem; flex: 1 1 160px; min-width: 0; max-width: 260px; }
.board-intro { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-top: 12px; padding-bottom: 0; }
.board-status { margin: 12px 20px 0; }
/* position: relative: the cards' screen-reader-only spans (absolute) scroll with the board instead of widening the page */
.board { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px 18px; overflow-x: auto;
  scroll-snap-type: x proximity; scrollbar-width: thin; }
.board-col { flex: 0 0 272px; max-width: 86vw; scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board-col > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; }
.board-col > header h2 { margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.board-col > header .n { flex: none; font-size: .76rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; }
.board-col.unstaged { border-style: dashed; }
.board-col.over { border-color: var(--brand-text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.board-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 8px; }
.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow);
  display: grid; gap: 6px; min-width: 0; }
.board-card[draggable=true] { cursor: grab; } .board-card.dragging { opacity: .45; } .board-card.saving { opacity: .7; }
.bc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bc-name { font-weight: 650; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.bc-meta { display: flex; flex-wrap: wrap; gap: 4px; } .bc-meta:empty { display: none; } .bc-meta .icon { width: 12px; height: 12px; }
.bc-meta a.pill:hover { text-decoration: underline; }
.bc-who .icon { width: 13px; height: 13px; vertical-align: -2px; } .bc-company, .bc-who { overflow-wrap: anywhere; }
.bc-move .pop { width: min(260px, calc(100vw - 16px)); padding: 10px; }
.move-list { display: grid; gap: 2px; } .move-list p { margin: 2px 6px 6px; }
.move-opt { text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 8px; color: var(--text); font-weight: 500; }
.move-opt:hover:not(:disabled), .move-opt:focus-visible { background: var(--surface-2); }
.board-none, .board-more { margin: 8px 4px 2px; }
@media (max-width: 640px) {
  .views-bar { padding-left: 16px; padding-right: 16px; }
  .board { padding: 12px 16px 16px; scroll-snap-type: x mandatory; } .board-col { flex-basis: min(300px, 84vw); }
  .board-status { margin: 12px 16px 0; }
}

/* the Requests tab's empty state already has an "Ask for a document" button: the folded form below it shows its own
   heading only once it is open (or when the button can't open it: no scripting) */
@media (scripting: enabled) { details.ask-first:not([open]) { display: none; } }

/* ---- the client timeline */
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; } .tl-filters .n { font-size: .74rem; color: var(--faint); font-weight: 600; }
.tl-filters a.on .n { color: inherit; opacity: .8; }
.timeline .text .pill { margin-right: 2px; } .timeline .tl-line { overflow-wrap: anywhere; margin-top: 1px; }
.timeline li.failed .dot { background: var(--err); color: var(--err-text); border-color: transparent; }
.timeline .when .pill { vertical-align: 0; } .timeline .when .pill .icon { width: 11px; height: 11px; }
.tl-foot { margin: 12px 0 0; }
.views-bar .views-bulk { margin-left: auto; white-space: nowrap; } .views-bulk .icon { width: 15px; height: 15px; }

/* ---- bulk messages */
input[type=time] { font: inherit; font-size: .95rem; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-width: 0; max-width: 100%; }
.audience { display: grid; gap: 10px; } .audience .big { font-size: 1.15rem; font-weight: 650; }
.who-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.who-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.who-list li:last-child { border-bottom: 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 4px; }
.stat-row div { min-width: 84px; } .stat-row dt { color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-row dd { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.msg-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); overflow-wrap: anywhere; }
@media (max-width: 640px) { .views-bar .views-bulk { margin-left: 0; flex-basis: 100%; } }
@media (max-width: 1050px) { .compose-grid > .audience { order: -1; } }   /* one column: who gets it comes before the message */

/* ---- reports: plain tables with a bar beside one column */
.report-range input[type=date] { padding: 6px 10px; font-size: .88rem; } .inline-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.report-range #range-note { flex-basis: 100%; }
.pad-callout { margin: 14px 20px 0; }
.report-table { border-top: 1px solid var(--line); } .report-table:first-of-type { border-top: 0; }
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 14px 20px 10px; margin: 0; }
.report-head h2 { margin: 0; }
table.report th[scope=row] { text-transform: none; letter-spacing: 0; font-size: inherit; font-weight: 600; color: var(--text); background: none;
  white-space: normal; padding-left: 20px; }
table.report tfoot th, table.report tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); }
table.report td.num, table.report th.num { font-variant-numeric: tabular-nums; }
table.report .bar-col { width: 18%; min-width: 70px; padding-right: 20px; }
svg.bar { display: block; width: 100%; height: 8px; } svg.bar rect { fill: var(--brand-text); opacity: .75; }
@media (max-width: 640px) { .report-head, .pad-callout { padding-left: 16px; padding-right: 16px; } .pad-callout { margin: 12px 16px 0; }
  table.report .bar-col { display: none; } table.report th[scope=row] { padding-left: 16px; } }

/* ---- intake form (public) and prospects ---- */
.hp-field { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }   /* a box people never see */
.field-error { display: block; color: var(--err-text); font-weight: 500; font-size: .88rem; }
.intake [aria-invalid="true"] { border-color: var(--err-text); }
.intake fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; } .intake legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.card.narrow.intake { max-width: 560px; }
.intake-message { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.intake-fields li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.flash.warn { background: var(--warn); color: var(--warn-text); }
.invite-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.invite-banner > .icon { flex: none; } .invite-banner[hidden] { display: none; }
.invite-banner .grow { flex: 1 1 260px; min-width: 0; }
.pill.warn .icon { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------------------------------------------------------------- fillable PDFs (/fill): inputs over the page images.
   Positions are percentages of the page and the font is a share of the page width (cqw), so everything scales with the
   page on a phone. A field on a rotated page is turned with it. */
.fill-pages .page-wrap { container-type: inline-size; user-select: auto; color-scheme: light; }
.fill-field { position: absolute; font-size: 12px; line-height: 1.15; }
.fill-field > input, .fill-field > textarea, .fill-field > select, .fill-field > .fill-sig {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0 .25em; box-sizing: border-box;
  font: inherit; color: #111; background: rgba(219, 234, 254, .6); border: 1px solid rgba(37, 99, 235, .6); border-radius: 2px; }
.fill-field > textarea { resize: none; padding: .15em .25em; overflow: auto; }
.fill-field > select { padding: 0 .1em; }
.fill-field > input[type=checkbox], .fill-field > input[type=radio] { padding: 0; accent-color: var(--brand); cursor: pointer; }
.fill-field.req > input, .fill-field.req > textarea, .fill-field.req > select { border-color: #d97706; box-shadow: inset 3px 0 0 #d97706; }
.fill-field.ro > input, .fill-field.ro > textarea, .fill-field.ro > select { background: transparent; border-color: transparent; color: #111; opacity: 1; }
.fill-field > :focus { outline: 2px solid var(--brand-text); outline-offset: 1px; background: #fff; }
.fill-field > .fill-sig { display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600;
  color: #92400e; background: rgba(251, 191, 36, .22); border: 2px dashed #d97706; }
.fill-field.rot90, .fill-field.rot270 { container-type: size; }
.fill-field.rot90 > *, .fill-field.rot270 > *, .fill-field.rot180 > * { inset: auto; left: 50%; top: 50%; }
.fill-field.rot90 > * { width: 100cqh; height: 100cqw; transform: translate(-50%, -50%) rotate(90deg); }
.fill-field.rot270 > * { width: 100cqh; height: 100cqw; transform: translate(-50%, -50%) rotate(-90deg); }
.fill-field.rot180 > * { transform: translate(-50%, -50%) rotate(180deg); }
.fill-key { display: inline-block; width: 10px; height: 10px; vertical-align: -1px; border: 1px solid #d97706; box-shadow: inset 3px 0 0 #d97706; }
/* ---- imports (TaxDome households) and the People card */
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain > li { margin: 2px 0; }
details > summary h2.inline { display: inline; font-size: 1.05rem; margin: 0; }
details + details { margin-top: 12px; }
.person-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.person-tools select, .person-tools input { padding: 4px 8px; font-size: .85rem; }
details.inline { display: inline-block; } details.inline > summary { cursor: pointer; list-style: none; color: var(--accent, inherit); }
details.inline > summary::-webkit-details-marker { display: none; } details.inline[open] { display: block; flex-basis: 100%; }

/* every press shows it landed: buttons give a little on press; a form that was just saved glows once (ui.js) */
button:not(:disabled):active, .button:active, .primary:active, .secondary:active, .btn:active { transform: translateY(1px) scale(.985); }
form.just-done { border-radius: var(--radius-sm); animation: just-done 1.6s ease-out; }
@keyframes just-done { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }
/* the page's messages, shown at the bottom of the screen when the page came back to where it was (ui.js) */
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px;
  max-width: min(420px, calc(100vw - 32px)); transition: opacity .35s, transform .35s; animation: toast-in .25s ease-out; }
.toasts.leaving { opacity: 0; transform: translateY(8px); }
.toast { margin: 0; display: flex; align-items: flex-start; gap: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.toast-x { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.1rem; line-height: 1; padding: 0 2px; opacity: .7; }
@keyframes toast-in { from { transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { form.just-done, .toasts { animation: none; } button:active { transform: none; } }

/* bulk file import (import.js): where you are in the three steps, the drop zone, the folders added */
.import-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; font-size: .85rem; color: var(--faint); }
.import-steps li { display: inline-flex; align-items: center; gap: 7px; }
.import-steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: .75rem; }
.import-steps li.on { color: var(--text); font-weight: 600; }
.import-steps li.on b { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.import-steps li.done { color: var(--muted); }
.import-steps li.done b { background: var(--ok); color: var(--ok-text); border-color: transparent; }
.import-drop { margin: 14px 0; padding: 34px 18px; }
.import-drop .actions { margin: 6px 0 0; justify-content: center; }
.staged { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.staged li { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 4px; }
.staged-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.staged-head strong { overflow-wrap: anywhere; }
.staged-head select { margin-left: auto; width: auto; }

/* skip link: visible only on focus */
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--brand-text, var(--brand)); border: 2px solid var(--brand-text, var(--brand)); border-radius: var(--radius-sm); }
.skip:focus { top: 8px; }
main:focus { outline: none; }
.toast-x { min-width: 28px; min-height: 28px; cursor: pointer; }
.toast-x:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
/* mobile board: a fade at the right edge says the row scrolls sideways */
@media (max-width: 640px) { .board { mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); } }
.notes-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; }
@media (max-width: 640px) { .notes-chip { min-height: 32px; padding-inline: 8px; } }
.client-nav { display: flex; gap: 4px; margin-left: 16px; flex: 1; }
.client-nav a { padding: 8px 12px; min-height: 32px; border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.client-nav a[aria-current=page] { font-weight: 650; background: var(--surface-2); }
@media (max-width: 640px) { .client-nav { margin-left: 4px; } .client-nav a { padding: 6px 8px; } }

/* Home */
.attention, .pipeline { list-style: none; margin: 0; padding: 0; }
.attention li + li { border-top: 1px solid var(--line); }
.attention a { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: inherit; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pipeline a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; }
.pipeline a:hover { text-decoration: none; border-color: var(--line-strong); }
.pipeline .n { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.pipeline .stage-name { color: var(--muted); font-size: .82rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
