/* Lexbound CRM dashboard. Tokens from the dataviz reference palette (surfaces, ink, the accent blue, status
   colours); the dark theme is its own set of steps, not an inversion. No inline styles anywhere: the CSP
   allows styles from this file only. */

:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f6f6f3;
  --side: #efefeb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6964;  /* 4.8:1 on the side, 5.3:1 on a card: #7a7873 was 3.8-4.3:1, under AA (2026-09-30) */
  --hairline: rgba(11, 11, 11, 0.10);
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #e6f0fc;
  --accent-wash-2: #cde2fb;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-wash: #e5f4e5;
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --warning-wash: #fff4db;
  --critical: #d03b3b;
  --critical-ink: #a42727;
  --critical-wash: #fbe9e9;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 1px rgba(11, 11, 11, 0.03);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222221;
    --side: #131312;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #8f8d87;
    --hairline: rgba(255, 255, 255, 0.10);
    --grid: #2c2c2a;
    --baseline: #383835;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: #16263a;
    --accent-wash-2: #1c3350;
    --good-ink: #0ca30c;
    --good-wash: #132613;
    --warning-ink: #fab219;
    --warning-wash: #2b2310;
    --critical: #e66767;
    --critical-ink: #f08a8a;
    --critical-wash: #2e1616;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --side: #131312;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #8f8d87;
  --hairline: rgba(255, 255, 255, 0.10);
  --grid: #2c2c2a;
  --baseline: #383835;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: #16263a;
  --accent-wash-2: #1c3350;
  --good-ink: #0ca30c;
  --good-wash: #132613;
  --warning-ink: #fab219;
  --warning-wash: #2b2310;
  --critical: #e66767;
  --critical-ink: #f08a8a;
  --critical-wash: #2e1616;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); line-height: 1.45;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.98rem; }
p { margin: 0.4rem 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
small { font-size: 0.85em; }
.muted { color: var(--muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }  /* a long word with no space (a template name) wraps, not widens its column */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ── icons ──────────────────────────────────────────────────────────────────────────────────────────── */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon.xs { width: 12px; height: 12px; vertical-align: -1px; }

/* ── the shell ──────────────────────────────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 12px; background: var(--side); border-right: 1px solid var(--hairline);
  overflow-y: auto;  /* on a laptop's screen the sections and Sign out are taller than the window */
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700;
}
.brand.big { font-size: 1.3rem; margin-bottom: 8px; }
.brand.big .brand-mark { width: 34px; height: 34px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500;
}
.nav-item:hover { background: var(--hairline); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 1px var(--hairline); }
.nav-item.active .icon { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.me { display: flex; align-items: center; gap: 10px; }
.me-name { display: flex; flex-direction: column; font-weight: 500; line-height: 1.2; min-width: 0; }
.me-name small { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; cursor: pointer; text-align: left; }
.linkish:hover { color: var(--ink); text-decoration: underline; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--hairline);
}
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1400px; width: 100%; }
.foot { padding: 16px 28px 24px; color: var(--muted); font-size: 0.85rem; }

/* ── the search box ─────────────────────────────────────────────────────────────────────────────────── */
.lookup { position: relative; flex: 1; max-width: 640px; display: flex; align-items: center; }
.lookup > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.lookup input {
  width: 100%; padding: 9px 12px 9px 38px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font: inherit;
}
.lookup input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash-2); }
.lookup-results:empty { display: none; }
.lookup-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; padding: 6px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); max-height: 70vh; overflow: auto;
}
.lookup-group { padding: 8px 10px 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.lookup-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink); }
.lookup-item:hover, .lookup-item:focus { background: var(--accent-wash); text-decoration: none; outline: none; }
.lookup-text { display: flex; flex-direction: column; min-width: 0; }
.lookup-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lookup-item.all { color: var(--accent-ink); font-size: 0.92rem; }
.lookup-empty { padding: 10px; color: var(--muted); }

/* ── avatars, badges, chips ─────────────────────────────────────────────────────────────────────────── */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-wash-2); color: var(--accent-ink); font-weight: 600; font-size: 0.82rem;
}
.avatar.sm { width: 26px; height: 26px; font-size: 0.72rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.lg .icon { width: 26px; height: 26px; }
.avatar.square { border-radius: 8px; background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--hairline); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink-2);
  font-size: 0.82rem; white-space: nowrap; margin: 1px 0;
}
.chip {
  display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink-2); font-size: 0.8rem; white-space: nowrap;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.outcome { padding: 1px 7px; border-radius: 4px; background: var(--accent-wash); color: var(--accent-ink); font-size: 0.82rem; }
/* support: how well the sources back a fact (not a status: no status colours) */
.support { font-size: 0.8rem; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.support-verified { background: var(--accent-wash); color: var(--accent-ink); }
/* stages: an icon-less dot + the word; the word always carries it */
.stage { display: inline-flex; align-items: center; gap: 5px; font-size: 0.85rem; white-space: nowrap; }
.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--baseline); }
.stage-customer::before { background: var(--good); }
.stage-beta::before { background: var(--accent); }
.stage-trial::before { background: #1baf7a; }
.stage-churned::before, .stage-trial_ended::before { background: var(--muted); }
/* the pipeline (0030): a hollow dot before any contact, then one hue growing stronger with each step towards a
   deal (the accent mixed into the neutral dot colour, which each theme sets), won and lost in their status hues */
.stage-never_contacted::before, .stage-prospect::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--baseline); }
.stage-contacted::before { background: color-mix(in srgb, var(--accent) 45%, var(--baseline)); }
.stage-conversation::before { background: color-mix(in srgb, var(--accent) 65%, var(--baseline)); }
.stage-demo::before { background: color-mix(in srgb, var(--accent) 82%, var(--baseline)); }
.stage-proposal::before { background: var(--accent); }
.stage-won::before { background: var(--good); }
.stage-lost::before { background: var(--critical); }

/* ── buttons and fields ─────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink); font: inherit;
  font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.tiny { padding: 2px 8px; font-size: 0.8rem; }
.btn.wide { width: 100%; justify-content: center; padding: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 0.82rem; color: var(--ink-2); font-weight: 500; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.grow, .grow { flex: 1; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 7px 9px; min-width: 0; width: 100%;
}
.field.inline select, .field.inline input { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash-2); }
input[type="checkbox"], input[type="radio"] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); }
.fieldset { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 8px 10px 10px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.fieldset legend { padding: 0 4px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
/* two short fields side by side (from, to), however narrow the form */
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1 1 150px; }
.form-error:empty { display: none; }
.alert {
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--critical-wash); color: var(--critical-ink);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}
.flash {
  margin: 16px 28px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--good-wash);
  color: var(--good-ink); display: flex; align-items: center; gap: 8px; font-weight: 500;
}
.flash a { color: inherit; text-decoration: underline; }
/* a write refused, nothing changed (app.py `back_to` kind "refused"): an alert, never the success green */
.flash.refused {
  background: var(--critical-wash); color: var(--critical-ink);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}

/* ── busy: a request under way (app.js). The form's buttons are disabled until it answers, so a double
   click writes once; the button pressed says it is working. htmx's own indicator styles are off (base.html). */
.htmx-request, [aria-busy="true"] { cursor: progress; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::after {
  content: ""; width: 0.8em; height: 0.8em; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: spin 0.7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::after { animation: none; border-right-color: currentColor; opacity: 0.5; } }
/* a part that loads after the page and did not (app.js): said, with Retry */
.load-failed { color: var(--critical-ink); font-size: 0.9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.load-failed .btn { color: var(--ink); }
.note { margin-top: 10px; font-size: 0.88rem; color: var(--ink-2); }
.warn-line { color: var(--warning-ink); display: inline-flex; align-items: center; gap: 4px; font-size: 0.88rem; }

/* ── cards and layout ───────────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .more { margin-left: auto; font-size: 0.9rem; }
.card-head > .muted:last-child { margin-left: auto; font-size: 0.85rem; }
.card-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 0.88rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { max-width: 70ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { margin: 6px 0 -6px; font-size: 1rem; }
.grid { display: grid; gap: 18px; }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.g-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.g-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.empty { color: var(--muted); padding: 6px 0; }
.loading { color: var(--muted); }

/* ── KPI tiles ──────────────────────────────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow); color: var(--ink);
}
.kpi:hover { text-decoration: none; border-color: var(--accent); }
.kpi-label { font-size: 0.85rem; color: var(--ink-2); font-weight: 500; }
.kpi-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.kpi-sub { font-size: 0.82rem; color: var(--muted); }

/* ── Today (board 42, today.py): what to act on in one card of tabs, one line per item; at <= 980 px one
   column, the meetings first ────────────────────────────────────────────────────────────────────────── */
.today-count { margin: 0 0 8px; font-size: 0.88rem; }
.today-tabs { flex-wrap: wrap; margin: -6px 0 12px; }
.today-tabs a { display: inline-flex; align-items: baseline; gap: 2px; }
.today-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.today-tabs .count:empty { display: none; }
.today-tabs .count.overdue { color: var(--critical-ink); font-weight: 600; }
/* a line (Today's panels): an icon, whom and when, the subject or the start of the text, the actions */
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--grid); }
.line:first-child { border-top: 0; padding-top: 2px; }
.line-icon {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-ink);
}
.line-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.line-head { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.line-text { margin: 0; font-size: 0.9rem; color: var(--ink-2); min-width: 0; }
p.line-text, .line-text > summary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-text > summary { cursor: pointer; list-style: none; }
.line-text > summary::-webkit-details-marker { display: none; }
.line-text > summary:hover { color: var(--ink); }
.line-text .whole { margin-top: 6px; color: var(--ink); }
.line-actions { flex: none; display: flex; gap: 6px; align-items: center; }
.line-actions form { margin: 0; }
.flash-line {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 10px;
  padding: 6px 10px; border-radius: var(--radius-sm); background: var(--good-wash); color: var(--good-ink);
  font-size: 0.88rem;
}
/* a step on one line (Today): the day, the step and whom, Done */
.step.compact { padding: 7px 0; align-items: center; }
.step.compact .step-who { font-size: 0.88rem; color: var(--ink-2); }
@media (max-width: 560px) {
  .today-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .today-tabs a { padding: 8px 6px; }
  .line { flex-wrap: wrap; row-gap: 6px; }
  .line-body { flex-basis: calc(100% - 36px); }
  .line-actions { margin-left: 36px; }
}
.meeting-list { list-style: none; margin: 0; padding: 0; }
.meeting { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--grid); }
.meeting:first-child { border-top: 0; padding-top: 2px; }
.meeting-at { flex: none; min-width: 3.2em; font-weight: 600; font-variant-numeric: tabular-nums; }
.meeting-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meeting-title { overflow-wrap: anywhere; }
.meeting-who { font-size: 0.92rem; }
.meeting.over .meeting-at, .meeting.over .meeting-title { color: var(--muted); }
.meeting.cancelled .meeting-title { text-decoration: line-through; }
.call-pick { margin-bottom: 10px; }
.call-list { list-style: none; margin: 0; padding: 0; }
.call-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--grid); }
.call-list li:first-child { border-top: 0; padding-top: 2px; }
.call-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 10px 0 0; font-size: 0.88rem; }
/* saved lists (lists.py): the lists page's rows; "Save this search" opens under its button, inside the page */
.saved-lists { list-style: none; margin: 0; padding: 0; }
.saved-list { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--grid); }
.saved-list:first-child { border-top: 0; padding-top: 2px; }
.saved-list-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.saved-list-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.saved-list-name { font-weight: 600; overflow-wrap: anywhere; }
.saved-list-search { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.saved-list-actions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; justify-content: flex-end; max-width: 50%; }
.saved-list-actions .form-error:empty { display: none; }
@media (max-width: 560px) {
  .saved-list { flex-direction: column; }
  .saved-list-actions { max-width: none; justify-content: flex-start; }
  .saved-list-actions .pop-body, .save-search .pop-body { right: auto; left: 0; width: min(300px, calc(100vw - 32px)); }
}
@media (max-width: 980px) {
  .today-grid { display: flex; flex-direction: column; align-items: stretch; }
  .today-grid > .col { display: contents; }
  .today-grid .t-meetings { order: 1; }
  .today-grid .t-work { order: 2; }
  .today-grid .t-calls { order: 3; }
  .today-grid .t-lists { order: 4; }
}

/* ── charts (charts.py draws them; the marks follow the dataviz rules) ─────────────────────────────── */
.chart-wrap { margin: 0; position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--baseline); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .col { cursor: default; outline: none; }
.chart .col:hover .bar, .chart .col:focus .bar { fill: var(--accent-ink); }
.chart .col:focus .hit { fill: var(--accent-wash); }
.empty-chart { position: absolute; inset: 30% 10% auto; text-align: center; color: var(--muted); font-size: 0.9rem; }
.table-view { margin-top: 10px; font-size: 0.9rem; }
.table-view summary { cursor: pointer; color: var(--ink-2); }
.tooltip {
  position: absolute; z-index: 50; pointer-events: none; min-width: 120px; padding: 8px 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); font-size: 0.85rem;
}
.tip-value { font-size: 1.1rem; font-weight: 600; }
.tip-title { color: var(--ink-2); margin-bottom: 4px; }
.tip-row { color: var(--ink-2); }
.tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bars li > a, .bars .bar-row {
  display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr) 64px; gap: 10px; align-items: center;
  padding: 4px 6px; border-radius: var(--radius-sm); color: var(--ink);
}
.bars li > a:hover { background: var(--surface-2); text-decoration: none; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { width: 100%; height: 10px; display: block; }
.bar-fill { fill: var(--accent); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ── tables ─────────────────────────────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--grid);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.rows tbody tr:hover { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.past td { color: var(--muted); }
.row-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); }
.results { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.results .table { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }

/* ── lists (people and organisation search) ─────────────────────────────────────────────────────────── */
.list-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--hairline);
}
/* a field that grows starts from a usable width, or its siblings squeeze it to nothing (/sends' "To": 41 px) */
.filter-bar .field.inline.grow { flex: 1 1 220px; }
.filter-bar .field.inline.grow > input, .filter-bar .field.inline.grow > select { flex: 1; width: 100%; }
.start h3 { margin-top: 18px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.preset {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--hairline); color: var(--ink); background: var(--surface-2);
}
.preset:hover { border-color: var(--accent); text-decoration: none; }
.preset .icon { grid-row: span 2; color: var(--accent); margin-top: 2px; }
.preset span { color: var(--muted); font-size: 0.85rem; }

/* ── entity pages ───────────────────────────────────────────────────────────────────────────────────── */
.entity-head { display: flex; gap: 16px; align-items: flex-start; }
.entity-title { flex: 1; min-width: 0; }
.entity-sub { color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.scope select { width: auto; }
.contact-for { flex-wrap: wrap; justify-content: flex-end; }
.contact-for .seg { flex-wrap: wrap; }
.contacts, .links, .steps, .gate { list-style: none; margin: 0; padding: 0; }
.contact { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--grid); position: relative; }
.contact:first-child { border-top: 0; }
.contact-icon { color: var(--accent); margin-top: 2px; }
.contact-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.contact-value { font-size: 1.05rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; word-break: break-all; }
.gate { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.gate li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.gate li.ok { background: var(--good-wash); color: var(--good-ink); }
.gate li.refused { background: var(--critical-wash); color: var(--critical-ink); }
.gate li.warn { background: var(--warning-wash); color: var(--warning-ink); }
.facts { margin: 0; display: flex; flex-direction: column; }
.facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--muted); font-size: 0.88rem; }
.facts dd { margin: 0; }
.fact-meta { display: block; }
.links li { padding: 7px 0; border-top: 1px solid var(--grid); display: flex; flex-direction: column; }
.links li:first-child { border-top: 0; }
.links li.past a { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
/* a tab's count (Sends), and a column head that sorts: its arrow says the order it shows */
.tabs a .count { margin-left: 4px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.table th a.sort { color: inherit; }
.table th[aria-sort="descending"] a.sort::after { content: " ↓"; }
.table th[aria-sort="ascending"] a.sort::after { content: " ↑"; }
.actions-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; }
details.action > summary { cursor: pointer; padding: 6px 0; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; list-style: none; }
details.action > summary::-webkit-details-marker { display: none; }
details.action[open] > summary { color: var(--ink); }
details.action > form { padding: 6px 0 10px; }
.danger-zone > summary { color: var(--critical-ink) !important; }
details.pop { position: relative; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
.pop-body {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; width: 300px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16); font-size: 0.9rem;
}

/* ── the log form ───────────────────────────────────────────────────────────────────────────────────── */
.log-form { display: flex; flex-direction: column; gap: 12px; }
.seg { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 8px; align-self: flex-start; box-shadow: inset 0 0 0 1px var(--hairline); }
.seg-item { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 1px var(--hairline); }
.seg-item:has(input:focus-visible) { outline: 2px solid var(--accent); }
.more-notes > summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.more-notes[open] { display: flex; flex-direction: column; gap: 10px; }

/* ── timelines ──────────────────────────────────────────────────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.event { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); }
.event:first-child { border-top: 0; padding-top: 2px; }
.event-icon {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-ink);
}
.kind-note .event-icon { background: var(--surface-2); color: var(--ink-2); }
.kind-product_event .event-icon { background: var(--good-wash); color: var(--good-ink); }
.event-body { flex: 1; min-width: 0; }
.event-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.event-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.event-meta { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.notes { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 0.9rem; }
.notes dt { color: var(--muted); }
.notes dd { margin: 0; overflow-wrap: anywhere; }
.more-row { padding: 10px 0 0; text-align: center; list-style: none; }
.steps li { border-top: 1px solid var(--grid); }
.steps li:first-child { border-top: 0; }
.steps a { display: flex; flex-direction: column; padding: 9px 0; color: var(--ink); }
.steps a:hover { text-decoration: none; }
.steps a:hover b { color: var(--accent-ink); }
.steps span { color: var(--ink-2); }
/* next steps (board 40): each says when it is due, in words and a colour; Done at its side */
.steps-page { display: flex; flex-direction: column; gap: 18px; }
.step-list { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--grid); }
.step:first-child { border-top: 0; padding-top: 2px; }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.step-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.step-text { overflow-wrap: anywhere; }
.step-who { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; font-size: 0.92rem; }
.step-done { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.step-done .form-error { max-width: 260px; font-size: 0.85rem; }
.due { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.due-overdue { background: var(--critical-wash); color: var(--critical-ink); }
.due-today { background: var(--warning-wash); color: var(--warning-ink); }
.due-undated { font-weight: 500; color: var(--muted); }
.due-done, .chip.done { background: var(--good-wash); color: var(--good-ink); }
.step.is-done .step-text { color: var(--muted); text-decoration: line-through; }
.due-count { color: var(--critical-ink); }
/* the pipeline card (board 40): a deal per product; a write's preview before Confirm */
.pipeline-owner { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.deal-list { list-style: none; margin: 0 0 8px; padding: 0; }
.deal { padding: 8px 0; border-top: 1px solid var(--grid); display: flex; flex-direction: column; gap: 2px; }
.deal:first-child { border-top: 0; }
.deal-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.preview-box { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-wash); color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.preview-box p { margin: 0; }
.form-result:empty { display: none; }
.bare-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stat-list { margin: 0; }
.stat-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--grid); }
.stat-list > div:first-child { border-top: 0; }
.stat-list dt { color: var(--ink-2); }
.stat-list dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ── evidence ───────────────────────────────────────────────────────────────────────────────────────── */
.evidence { margin-top: 16px; }
.evidence h3 { margin-bottom: 6px; }
/* a narrow card scrolls the table rather than squeezing its columns until snippets break letter by letter */
.evidence .table { min-width: 620px; }
.evidence tr.state-rejected td, .evidence tr.state-superseded td, .evidence tr.state-stale td,
.evidence tr.state-dropped td, .evidence tr.state-marks-it-wrong td, .evidence tr.state-overruled td { color: var(--muted); }
.snippet {
  margin: 4px 0 0; padding: 4px 8px; border-left: 2px solid var(--grid); color: var(--ink-2); font-size: 0.85rem;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5em; overflow: auto;
}

/* ── suppressions: each stop, its keys, why, and its lift ──────────────────────────────────────────── */
.stops { list-style: none; margin: 0; padding: 0; }
.stop { padding: 12px 0; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 6px; }
.stop:first-child { border-top: 0; padding-top: 0; }
.stop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.stop-no { margin-left: auto; font-size: 0.82rem; }
.stop-keys { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.9rem; overflow-wrap: anywhere; }
.stop-why { margin: 0; color: var(--ink-2); font-size: 0.9rem; overflow-wrap: anywhere; }
.stop.erasure .stop-head b { color: var(--muted); }
.filter-note { margin: 8px 2px 0; }
.lift-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; margin-top: 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.lift-body p { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

/* ── segments and products ──────────────────────────────────────────────────────────────────────────── */
.seg-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 0; }
.seg-numbers dt { font-size: 0.82rem; color: var(--muted); }
.seg-numbers dd { margin: 0; font-size: 1.35rem; font-weight: 600; }
.product-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.product-tile { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--hairline); color: var(--ink); background: var(--surface-2); }
.product-tile:hover { border-color: var(--accent); text-decoration: none; }
.product-name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.product-stages { font-size: 0.88rem; color: var(--ink-2); }
.product-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.product.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash-2); }
.stage-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.plans { margin-top: 6px; font-size: 0.9rem; }

/* ── sign-in and error pages ────────────────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 28px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; gap: 12px;
}
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.error-head { font-size: 1.3rem; }

/* ── categorical slots (the reference palette, in its fixed order; dark steps below) ─────────────────── */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; }
}
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; }
.slot-1 { fill: var(--series-1); background: var(--series-1); }
.slot-2 { fill: var(--series-2); background: var(--series-2); }
.slot-3 { fill: var(--series-3); background: var(--series-3); }
.slot-4 { fill: var(--series-4); background: var(--series-4); }
.slot-5 { fill: var(--series-5); background: var(--series-5); }
.slot-6 { fill: var(--series-6); background: var(--series-6); }

/* ── maps ───────────────────────────────────────────────────────────────────────────────────────────── */
.map { width: 100%; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--hairline); z-index: 0; }
.map.tall { height: 460px; }
.map.small { height: 190px; margin: 8px 0 4px; }
.map.loading { opacity: 0.6; }
.map-card .card-head { margin-bottom: 10px; }
.map-summary { margin: 8px 0 0; font-size: 0.85rem; }
.map-note { font-size: 0.8rem; margin: 0; }
/* the tiles recede so the data is what reads: grey in light, dimmed and inverted in dark */
.leaflet-tile-pane { filter: grayscale(1) contrast(0.92) brightness(1.04); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(0.78) contrast(0.9); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(0.78) contrast(0.9); }
.leaflet-container { font-family: var(--font); font-size: 0.85rem; background: var(--surface-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-tooltip { background: var(--surface); color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.leaflet-tooltip { border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.leaflet-tooltip-top::before { border-top-color: var(--surface); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); font-size: 0.7rem; }
.leaflet-control-attribution a { color: var(--ink-2); }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--hairline); }
.map-pop { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.map-pop a { font-weight: 600; }
.seg-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.chip-button {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface);
  color: var(--ink-2); font: inherit; font-size: 0.82rem; cursor: pointer;
}
.chip-button:hover { color: var(--ink); border-color: var(--baseline); }
.chip-button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── the stat tile's trend, the 100% bars ───────────────────────────────────────────────────────────── */
.kpi-spark { position: relative; }
.spark { width: 100%; height: 28px; margin-top: 6px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent); opacity: 0.1; }
.spark-dot { fill: var(--accent); }
.stacked { margin: 0 0 16px; }
.stacked figcaption { font-size: 0.85rem; color: var(--ink-2); font-weight: 500; margin-bottom: 6px; }
.stacked-bar { width: 100%; height: 16px; display: block; border-radius: 4px; overflow: hidden; }
.stacked-bar rect:hover { opacity: 0.85; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.88rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ── a segment's coverage, as a funnel ──────────────────────────────────────────────────────────────── */
.funnel { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.funnel li { display: grid; grid-template-columns: minmax(110px, 40%) minmax(0, 1fr) 96px; gap: 8px; align-items: center; font-size: 0.88rem; }
.funnel-label a { color: var(--ink); }
.funnel-track { width: 100%; height: 12px; display: block; background: var(--surface-2); border-radius: 3px; }
.funnel-fill { fill: var(--accent); }
.funnel-fill.step-1 { fill: var(--accent-wash-2); }
.funnel-value { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-note { margin: 8px 0 0; font-size: 0.85rem; }

/* ── working through a list ─────────────────────────────────────────────────────────────────────────── */
.call-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.call-pos { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); }
.call-steps { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.call-steps .btn { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.work-hint { font-size: 0.85rem; margin: -4px 0 0; }
.view-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hairline); }
.view-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.view-tabs a:hover { color: var(--ink); text-decoration: none; }
.view-tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 1px var(--hairline); }
.last-cell { font-size: 0.88rem; min-width: 130px; }
.last { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ── entity pages: actions in the header, the office, the register ──────────────────────────────────── */
.entity-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.address { display: flex; gap: 6px; align-items: flex-start; margin: 0 0 4px; }
.address .icon { color: var(--accent); margin-top: 2px; }
.sub-head { font-size: 0.9rem; margin: 14px 0 6px; }
.people-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.people-chips a { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-sm); color: var(--ink); }
.people-chips a:hover { background: var(--surface-2); text-decoration: none; }
/* Before you call (partials/prep_card.html) and Ask Claude (partials/ask_claude.html), board 42 */
.prep-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.prep-switch .chip { padding: 3px 10px; color: var(--ink-2); }
.prep-switch .chip:hover { text-decoration: none; color: var(--ink); }
.prep-switch .chip.on { background: var(--accent-wash); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-wash-2); }
.prep-facts dd { overflow-wrap: anywhere; }
.prep-card .gate { margin-top: 10px; }
.prep-talks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.prep-talks li { padding-left: 10px; border-left: 2px solid var(--hairline); overflow-wrap: anywhere; }
.prep-points { margin: 0 0 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.prep-more > summary { cursor: pointer; color: var(--ink-2); font-weight: 500; padding: 4px 0; }
.prep-more[open] > summary { color: var(--ink); }
.prep-never > summary { color: var(--critical-ink); }
.ask-claude > summary.btn { display: flex; justify-content: center; }  /* as wide as Send beside it */
.ask-claude .pop-body { width: min(320px, calc(100vw - 32px)); }
.ask-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ask-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; }
.ask-list li > small { grid-column: 1 / -1; overflow-wrap: anywhere; }
.register-full h3 { margin: 16px 0 6px; }
.register-full h3:first-of-type { margin-top: 8px; }

/* ── entity pages: NBB's accounts, a firm at a glance, its group and people, pipeline badges (web-entity) ── */
.pipeline-badges { margin-top: 6px; }
.stage-badge .stage { font-size: 0.82rem; }
.badge.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
/* a figure below zero: the minus sign and a word say it; the colour only repeats it */
.neg { color: var(--critical-ink); }
.chip.neg { background: var(--critical-wash); box-shadow: none; }
.accounts-meta { margin: -2px 0 6px; font-size: 0.88rem; }
.figures > div { grid-template-columns: 130px minmax(0, 1fr); }
.accounts-source { margin: 10px 0 0; font-size: 0.9rem; }
.directors li small { overflow-wrap: anywhere; }
.figures-table td.indent { padding-left: 22px; color: var(--ink-2); }
.figures-table td:first-child { min-width: 180px; }
.accounts-tab h3 { margin: 18px 0 6px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.plain small { display: block; }
.group tr.here td { background: var(--surface-2); }
.group tfoot td { border-top: 1px solid var(--grid); border-bottom: 0; }
.network-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; font-size: 0.88rem; color: var(--ink-2); }
.own-practice { margin-top: 2px; font-size: 0.92rem; }
/* a fact and its "Wrong?": the value on the left, the action on the right */
.fact-line { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.fact-line > :first-child { min-width: 0; flex: 1; }
.links li.fact-line { flex-direction: row; }
details.wrong { flex: none; }
/* managing a record: links and forms in the actions card; the merge pair; a preview */
.action-link { display: flex; align-items: center; gap: 6px; padding: 6px 0; color: var(--ink-2); font-weight: 500; }
.action-link:hover { color: var(--ink); text-decoration: none; }
.action-link.danger { color: var(--critical-ink); }
.merge-pair .card.keep { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }
.preview-card { margin-top: 16px; }
.grid .preview-card { margin-top: 0; }
.preview-entities li { padding: 6px 0; border-top: 1px solid var(--grid); }
.preview-entities li:first-child { border-top: 0; }
.preview-card.danger-zone { box-shadow: var(--shadow), inset 0 0 0 1px var(--critical-ink); }
ul.plain.moved { margin: 8px 0; }
fieldset.asks { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0; }
fieldset.asks legend { font-weight: 600; padding: 0 4px; }
.pick-list li { align-items: center; }
/* a firm's page, one column (<= 980 px, as the person page's person-grid): Contact, then what is worked (the
   tabs, the log form, the activity), then its people, then the rest of the left column in its order */
@media (max-width: 980px) {
  .org-grid > .col { display: contents; }
  .org-grid > .col > * { order: 4; }
  .org-grid > .col:first-child > :first-child { order: 1; }
  .org-grid > .col:last-child > * { order: 2; }
  .org-grid > .col:last-child > :first-child { order: 3; }
}

/* ── activity (board 36): tabs with counts, the filters, the table, a timeline item's subject ─────────── */
.activity-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.party-pick { display: flex; align-items: center; gap: 8px; }
.party-pick .lookup.small { max-width: 420px; }
.party-pick .lookup.small input { padding-top: 6px; padding-bottom: 6px; }
.chip.party { gap: 6px; font-size: 0.9rem; padding: 4px 10px; }
.chip-x { display: inline-flex; color: var(--muted); }
.chip-x:hover { color: var(--ink); }
.count-tabs { margin-bottom: 12px; flex-wrap: wrap; }
.count-tabs .count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; margin-left: 2px; }
.count-tabs a.active .count { color: var(--ink-2); }
.table-scroll { overflow-x: auto; position: relative; }  /* its absolute bits stay in it, not past the page */
/* a popover in a table that scrolls opens in its cell: floating, the scroll box cut it off (/sends' Drafts) */
.table-scroll .pop-body { position: static; width: 16rem; margin-top: 6px; box-shadow: none; }
/* the export log's list in words: wide enough to read, wrapping */
.exports .export-list { min-width: 18rem; overflow-wrap: anywhere; }
.activity-table td { vertical-align: middle; }
.activity-table .one-line { max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-table tr.row-main { cursor: pointer; }
.activity-table tr.row-main.open td { background: var(--surface-2); }
.activity-table tr.row-whole > td { background: var(--surface-2); padding-top: 0; }
.activity-table .linkish { font: inherit; color: var(--accent-ink); }
/* a person's or a firm's Activity: the filters sit in the card, not in a box of their own */
.activity-section .filter-bar { padding: 0; border: 0; background: none; }
.activity-section .count-tabs { margin: 4px 0 8px; }
.table th a.sort { color: inherit; }
.table th a.sort.active { color: var(--ink); }
.dir { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.dir-outbound { background: var(--accent-wash); color: var(--accent-ink); }
.dir-inbound { background: var(--good-wash); color: var(--good-ink); }
.event-subject { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.chip.answered { color: var(--good-ink); }
.channel-split { margin-top: 10px; }
.small-print { font-size: 0.8rem; margin: 8px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── narrower screens ───────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; overflow: visible; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .me-name small { display: none; }
  .g-2-1, .g-1-2, .g-1-1, .list-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; max-height: none; }
  .top, .content, .foot { padding-left: 16px; padding-right: 16px; }
  .flash { margin: 12px 16px 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .entity-head { flex-wrap: wrap; }
  .entity-title { flex: 1 1 200px; }
  .entity-actions { order: 3; width: 100%; align-items: stretch; }
  .seg { flex-wrap: wrap; }
  .map.tall { height: 340px; }
  .call-steps { margin-left: 0; width: 100%; }
  .seg-buttons { margin-left: 0; }
  /* a list's third column on: hidden. Not a table of fields (`keep`: compose's values, a template's check),
     whose inputs would be hidden unfilled */
  .table.rows:not(.keep) th:nth-child(n+3), .table.rows:not(.keep) td:nth-child(n+3) { display: none; }
  .table.rows.keep { display: block; overflow-x: auto; }
  /* tap targets: a small button is still a finger's height */
  .btn.tiny { min-height: 36px; padding: 6px 10px; }
}
@media (max-width: 980px) {
  /* a person's page, one column: Contact, then what is worked (the log form and the activity, or the evidence),
     then the rest of the left column in its order (the audit: the log form started at y = 1,664 of 2,996) */
  .person-grid > .col:first-child { display: contents; }
  .person-grid > .col:first-child > * { order: 3; }
  .person-grid > .col:first-child > :first-child { order: 1; }
  .person-grid > .col:last-child { order: 2; }
}
@media (max-width: 560px) {
  /* the side navigation, compact: the brand and the founder on one line, the sections in one row that scrolls */
  .shell { grid-template-columns: minmax(0, 1fr); }  /* the scrolling row must not widen the page */
  .side { gap: 8px 10px; padding: 8px 16px; }
  .side-foot { order: 1; gap: 10px; padding: 0; }
  .me-name { display: none; }
  .nav { order: 2; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; gap: 6px; padding: 6px 9px; white-space: nowrap; font-size: 0.9rem; }
  /* a contact row's Wrong? and Stop, one under the other beside the value, which keeps its width */
  .contact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; row-gap: 4px; }
  .contact > .contact-icon, .contact > .contact-body { grid-row: span 2; }
  .contact > details.pop { grid-column: 3; justify-self: end; }
}

/* sends (board 24): a send's status history */
.history { margin: 0; padding-left: 1.2em; }
.history li { margin: 0.25em 0; }

/* compose (board 36): each previewed message */
.preview-msg { padding: 10px 0; border-top: 1px solid var(--grid); }
.preview-msg:first-of-type { border-top: 0; }

/* review (board 40): the queue, an item's candidates side by side, the nav's count */
.nav-count {
  margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink);
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.band {
  display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 0.8rem; white-space: nowrap;
  font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.band-likely { background: var(--good-wash); color: var(--good-ink); }
.band-unsure { background: var(--warning-wash); color: var(--warning-ink); }
.band-unlikely { background: var(--critical-wash); color: var(--critical-ink); }
.review-candidates {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-bottom: 16px;
}
.review-candidate { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.review-candidate.chosen { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }
.review-candidate .card-head { margin-bottom: 0; justify-content: space-between; flex-wrap: nowrap; }
.review-candidate .card-head h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.review-facts > div { grid-template-columns: 96px minmax(0, 1fr); padding: 5px 0; font-size: 0.9rem; }
.review-facts dd { overflow-wrap: anywhere; }
.review-reasons { margin: 0; padding: 0; list-style: none; font-size: 0.88rem; display: flex; flex-direction: column; gap: 3px; }
.review-reasons li { overflow-wrap: anywhere; }
.weight { display: inline-block; min-width: 3.2em; font-variant-numeric: tabular-nums; color: var(--muted); }
.weight.for { color: var(--good-ink); }
.weight.against { color: var(--critical-ink); }
.review-pick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--grid); }
.review-found li { flex-direction: row; }
.review-found .check { align-items: flex-start; }
.review-found small { display: block; }
.review-preview { border-color: var(--accent); margin-bottom: 16px; }
.review-steps li { display: block; }
.review-queue td { vertical-align: top; }
.review-subject, .review-decision { margin-bottom: 16px; }
/* a tile that is one link and holds another (the overview's "to link"): the first link covers the tile */
.linked { position: relative; }
.linked:hover { border-color: var(--accent); }
.linked .stretched { color: inherit; }
.linked .stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.linked .above { position: relative; z-index: 1; }
@media (max-width: 560px) {
  .review-queue th:nth-child(n+4), .review-queue td:nth-child(n+4) { display: none; }
  .review-pick .check { width: 100%; }
}

/* import (board 40): a CSV mapped, previewed row by row, then imported */
.import-steps { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; color: var(--ink-2); }
.import-map select { min-width: 12em; max-width: 100%; }
.import-map .one-line { max-width: 28em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-map td { vertical-align: top; }
.import-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.import-counts dt { color: var(--muted); font-size: 0.82rem; }
.import-counts dd { margin: 0; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.import-entities { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.import-rows td { vertical-align: top; overflow-wrap: anywhere; }
.import-rows td:first-child { width: 4em; }
.import-candidate { align-items: flex-start; }
.import-candidate input { margin-top: 3px; }
.refused { color: var(--critical-ink); font-weight: 500; }

/* ── the balance sheet (nbb-sheet): the firm page's Accounts tab, partials/balance_sheet.html ─────────── */
.bs { min-width: 0; }
.bs-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px 28px; }
.bs-sides > * { min-width: 0; }
.bs .bs-sides + .table-scroll, .bs .table-scroll + .table-scroll { margin-top: 14px; }
.bs-table { min-width: 18rem; }
.bs-table tbody th {
  text-align: left; font-size: 0.9rem; font-weight: 400; color: var(--ink); text-transform: none;
  letter-spacing: normal; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top;
}
.bs-table td.num, .bs-table thead th.num { white-space: nowrap; }
.bs-table tbody tr:last-child th { border-bottom: 0; }
.bs-table tr.bs-level-0 th, .bs-table tr.bs-level-0 td { font-weight: 600; border-top: 1px solid var(--baseline); }
.bs-table tr.bs-level-2 th { padding-left: 24px; color: var(--ink-2); }
.bs-table tr.bs-level-2 td { color: var(--ink-2); }
.bs-code { margin-left: 8px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.bs-meaning { display: block; font-size: 0.8rem; color: var(--muted); max-width: 48ch; }
@media (max-width: 560px) {
  .bs-code { display: none; }
}

/* ── five years of accounts (entity-data, board 42): partials/accounts_history.html ──────────────────── */
.history-table { min-width: 30rem; }
.history-table tbody th {
  text-align: left; font-size: 0.9rem; font-weight: 400; color: var(--ink); text-transform: none;
  letter-spacing: normal; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
/* the row's name stays in view while the years scroll sideways at phone width */
.history-table tbody th, .history-table thead th:first-child { position: sticky; left: 0; background: var(--surface); }
.history-table td.num, .history-table thead th.num { white-space: nowrap; vertical-align: top; }
.history-table td small { font-size: 0.75rem; }
.history-fetch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.history-fetch p { margin: 0; flex: 1 1 16rem; }
.spinner {
  display: inline-block; width: 0.9em; height: 0.9em; margin-right: 6px; vertical-align: -0.1em;
  border: 2px solid var(--grid); border-top-color: var(--accent); border-radius: 50%;
  animation: spinner-turn 0.8s linear infinite;
}
@keyframes spinner-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ── a list's export (web-export, board 42): partials/export.html ───────────────────────────────────── */
.export { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.export-contacts .pop-body { width: 320px; }
@media (max-width: 560px) {
  /* open, it takes the row below the buttons instead of floating past the screen's edge */
  .export-contacts[open] { flex: 1 1 100%; }
  .export-contacts .pop-body { position: static; width: auto; margin-top: 6px; box-shadow: none; }
}

/* ── campaigns (web-export, board 42): campaigns.html ────────────────────────────────────────────────── */
.campaign-kpis { margin-bottom: 14px; }
.table tbody th.campaign-name {
  font-size: 0.92rem; font-weight: 500; color: var(--ink); text-transform: none; letter-spacing: normal;
  padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; overflow-wrap: anywhere;
}
.table tbody tr:last-child th.campaign-name { border-bottom: 0; }
.table.campaigns { min-width: 60rem; }
.table td.num small { display: block; }
.batch-links { display: flex; flex-wrap: wrap; gap: 4px 10px; white-space: nowrap; }
.empty-state { display: flex; flex-direction: column; gap: 8px; }
.empty-state h2 { margin: 0; }
.meanings { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 0.9rem; }
.meanings dt { font-weight: 600; }
.meanings dd { margin: 0; color: var(--ink-2); }
@media (max-width: 560px) {
  .kpis.campaign-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .campaign-kpis .kpi-value { font-size: 1.5rem; }
  .meanings { grid-template-columns: minmax(0, 1fr); }
  .meanings dd { margin-bottom: 6px; }
}

/* sends: the channel tabs under the status tabs, the rows' density, "More filters", a batch or person held */
.sends-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: -6px; }
.sends-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.sends-channels a {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2); font-size: 0.88rem; font-weight: 500;
}
.sends-channels a:hover { color: var(--ink); border-color: var(--baseline); text-decoration: none; }
.sends-channels a[aria-current] { background: var(--accent-wash); border-color: var(--accent-wash-2); color: var(--accent-ink); }
.sends-channels .count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.sends-channels a[aria-current] .count { color: inherit; }
.sends-more > summary { list-style: none; }
.sends-more > summary::-webkit-details-marker { display: none; }
.sends-more > summary::after { content: "▾"; font-size: 0.75em; color: var(--muted); }
.sends-more[open] > summary::after { content: "▴"; }
.sends-more > summary .count { padding: 0 6px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); font-size: 0.78rem; }
/* open: a row of its own under the rest (after Filter and Clear), its fields under its summary */
.sends-more[open] { order: 1; flex: 1 1 100%; padding-top: 8px; border-top: 1px solid var(--grid); }
.sends-more-body { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.sends-more-body input[type="text"] { width: 12rem; }
.sends-held { order: 2; flex: 1 1 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sends-channel { display: inline-flex; align-items: center; gap: 5px; }
.sends-channel .icon { color: var(--muted); }
.sends-original { color: var(--muted); }
.sends-original:hover { color: var(--accent); }
/* compact rows: one line each, the notes under a cell left out, a long subject cut short */
.sends-table.compact td, .sends-table.compact th { padding: 5px 8px; }
.sends-table.compact td { font-size: 0.88rem; white-space: nowrap; }
.sends-table.compact .aside { display: none; }
.sends-table.compact .sends-subject { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
/* a phone shows When, To and the status: Drafts' "Delete in Gmail" and Needs attention's next step are in it */
@media (max-width: 560px) {
  .sends-table.rows th.sends-status, .sends-table.rows td.sends-status { display: table-cell; }
}
