/* ============================================================
   Build Desk — design tokens
   Light and dark are chosen per surface, not inverted. --accent is for fills
   (buttons, selection); --accent-ink is for text and links, so both pass contrast.
   The accent preset is data-accent on <html>: indigo (default), teal, rose or blue (blue keeps the neutral indigo surfaces).
   Every preset sets the same variables in light, system dark and forced dark,
   so a preset block never leaks its light values into dark mode.
   Project-kind colors (--kind-*) are a validated colorblind-safe set.
   Calm by default: four type sizes (--fs-sm, --fs-md, --fs-lg, --fs-xl), one spacing scale (--space-*), borders
   only for real boundaries, shadows only on things that float (menus, dialogs, toasts), one accent, and secondary
   text (--muted) that still passes AA contrast in every theme.
   ============================================================ */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --page: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eff1f6;
  --surface-3: #e5e8f0;
  --ink: #151821;
  --ink-2: #4f5566;
  --muted: #5f6577;
  --grid: #e8eaf1;
  --border: rgba(21, 24, 33, 0.08);
  --border-strong: rgba(21, 24, 33, 0.16);
  --accent: #4b56d2;
  --accent-hover: #3f49bd;
  --accent-ink: #4b56d2;
  --accent-wash: rgba(75, 86, 210, 0.1);
  --accent-wash-2: rgba(75, 86, 210, 0.18);
  --on-accent: #ffffff;
  --series-1: #4b56d2;
  --series-track: #dfe1f7;
  --kind-web: #2a78d6;
  --kind-phone: #0f9d8a;
  --kind-both: #7b57d1;
  --kind-other: #8b8286;
  --good: #0ca30c;
  --good-ink: #0b7a0b;
  --warning: #e3a008;
  --warning-ink: #8a5f00;
  --serious: #e0693f;
  --serious-ink: #a8431f;
  --critical: #d03b3b;
  --critical-ink: #b42b2b;
  --tooltip-bg: #151821;
  --tooltip-ink: #ffffff;
  --backdrop: rgba(15, 17, 23, 0.45);
  --shadow-sm: 0 1px 2px rgba(21, 24, 33, 0.05), 0 1px 1px rgba(21, 24, 33, 0.03);
  --shadow-md: 0 6px 16px rgba(21, 24, 33, 0.08), 0 2px 4px rgba(21, 24, 33, 0.05);
  --shadow-lg: 0 24px 64px rgba(21, 24, 33, 0.22), 0 4px 12px rgba(21, 24, 33, 0.08);
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 26px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --reading: 760px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 140ms;
  --med: 220ms;
}
:root[data-accent="teal"] {
  --page: #f3f6f6;
  --surface-2: #edf2f2;
  --surface-3: #e2e9e9;
  --ink: #131c1c;
  --ink-2: #4d5959;
  --muted: #5a6666;
  --grid: #e5ecec;
  --border: rgba(19, 28, 28, 0.08);
  --border-strong: rgba(19, 28, 28, 0.16);
  --accent: #0f7c80;
  --accent-hover: #0b6c70;
  --accent-ink: #0f7c80;
  --accent-wash: rgba(15, 124, 128, 0.1);
  --accent-wash-2: rgba(15, 124, 128, 0.18);
  --series-1: #0f7c80;
  --series-track: #d3eaea;
  --tooltip-bg: #131c1c;
  --backdrop: rgba(12, 18, 18, 0.45);
}
:root[data-accent="rose"] {
  --page: #f6f3f2;
  --surface-2: #f3eff0;
  --surface-3: #ebe5e7;
  --ink: #1b1618;
  --ink-2: #5a5255;
  --muted: #6a6165;
  --grid: #ece7e8;
  --border: rgba(27, 22, 24, 0.08);
  --border-strong: rgba(27, 22, 24, 0.16);
  --accent: #b8336a;
  --accent-hover: #a62d5f;
  --accent-ink: #b8336a;
  --accent-wash: rgba(184, 51, 106, 0.1);
  --accent-wash-2: rgba(184, 51, 106, 0.18);
  --series-1: #b8336a;
  --series-track: #f1d9e3;
  --tooltip-bg: #1b1618;
  --backdrop: rgba(20, 15, 17, 0.45);
}

:root[data-accent="blue"] {
  --accent: #146ef5;
  --accent-hover: #0f5ad9;
  --accent-ink: #0f5ad9;
  --accent-wash: rgba(20, 110, 245, 0.1);
  --accent-wash-2: rgba(20, 110, 245, 0.18);
  --series-1: #146ef5;
  --series-track: #d8e6fd;
}

/* Dark, set once for "system" (inside the media query, so a light OS keeps light values)
   and once for an explicit dark theme. Keep the two copies in sync. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f1117;
    --surface: #181b23;
    --surface-2: #20242e;
    --surface-3: #2a2f3b;
    --ink: #f2f4f8;
    --ink-2: #c3c8d4;
    --muted: #a0a6b4;
    --grid: #262a35;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #5c67e6;
    --accent-hover: #6d78f0;
    --accent-ink: #a5acff;
    --accent-wash: rgba(92, 103, 230, 0.2);
    --accent-wash-2: rgba(92, 103, 230, 0.32);
    --series-1: #8a93ff;
    --series-track: #2a2d4a;
    --kind-web: #3d85e0;
    --kind-phone: #1aa38f;
    --kind-both: #8d6fe0;
    --kind-other: #8f868a;
    --good: #2fc02f;
    --good-ink: #5ad65a;
    --warning: #f0b429;
    --warning-ink: #f5c95c;
    --serious: #f07f55;
    --serious-ink: #f59a78;
    --critical: #e05252;
    --critical-ink: #f07a7a;
    --tooltip-bg: #f2f4f8;
    --tooltip-ink: #0f1117;
    --backdrop: rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  }
  :root:where(:not([data-theme="light"]))[data-accent="teal"] {
    --page: #0e1313;
    --surface: #171d1d;
    --surface-2: #1f2727;
    --surface-3: #283232;
    --ink: #f1f6f6;
    --ink-2: #c0cccc;
    --muted: #9caaaa;
    --grid: #232c2c;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #127f80;
    --accent-hover: #179192;
    --accent-ink: #5fd3cf;
    --accent-wash: rgba(18, 127, 128, 0.22);
    --accent-wash-2: rgba(18, 127, 128, 0.34);
    --series-1: #4cc4c0;
    --series-track: #1f3a3a;
    --tooltip-bg: #f1f6f6;
    --backdrop: rgba(0, 0, 0, 0.55);
  }
  :root:where(:not([data-theme="light"]))[data-accent="rose"] {
    --page: #121012;
    --surface: #1c191b;
    --surface-2: #262224;
    --surface-3: #312b2e;
    --ink: #f6f2f3;
    --ink-2: #c9c0c4;
    --muted: #a59ca0;
    --grid: #2d282b;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #cf3d78;
    --accent-hover: #da4f87;
    --accent-ink: #f08ab5;
    --accent-wash: rgba(207, 61, 120, 0.18);
    --accent-wash-2: rgba(207, 61, 120, 0.3);
    --series-1: #e8769f;
    --series-track: #3a2530;
    --tooltip-bg: #f6f2f3;
    --backdrop: rgba(0, 0, 0, 0.55);
  }
  :root:where(:not([data-theme="light"]))[data-accent="blue"] {
    --accent: #1f6fe8;
    --accent-hover: #3a82f0;
    --accent-ink: #7cb0ff;
    --accent-wash: rgba(31, 111, 232, 0.2);
    --accent-wash-2: rgba(31, 111, 232, 0.32);
    --series-1: #6ea6ff;
    --series-track: #1f2d4a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1117;
  --surface: #181b23;
  --surface-2: #20242e;
  --surface-3: #2a2f3b;
  --ink: #f2f4f8;
  --ink-2: #c3c8d4;
  --muted: #a0a6b4;
  --grid: #262a35;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #5c67e6;
  --accent-hover: #6d78f0;
  --accent-ink: #a5acff;
  --accent-wash: rgba(92, 103, 230, 0.2);
  --accent-wash-2: rgba(92, 103, 230, 0.32);
  --series-1: #8a93ff;
  --series-track: #2a2d4a;
  --kind-web: #3d85e0;
  --kind-phone: #1aa38f;
  --kind-both: #8d6fe0;
  --kind-other: #8f868a;
  --good: #2fc02f;
  --good-ink: #5ad65a;
  --warning: #f0b429;
  --warning-ink: #f5c95c;
  --serious: #f07f55;
  --serious-ink: #f59a78;
  --critical: #e05252;
  --critical-ink: #f07a7a;
  --tooltip-bg: #f2f4f8;
  --tooltip-ink: #0f1117;
  --backdrop: rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"][data-accent="teal"] {
  --page: #0e1313;
  --surface: #171d1d;
  --surface-2: #1f2727;
  --surface-3: #283232;
  --ink: #f1f6f6;
  --ink-2: #c0cccc;
  --muted: #9caaaa;
  --grid: #232c2c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #127f80;
  --accent-hover: #179192;
  --accent-ink: #5fd3cf;
  --accent-wash: rgba(18, 127, 128, 0.22);
  --accent-wash-2: rgba(18, 127, 128, 0.34);
  --series-1: #4cc4c0;
  --series-track: #1f3a3a;
  --tooltip-bg: #f1f6f6;
  --backdrop: rgba(0, 0, 0, 0.55);
}
:root[data-theme="dark"][data-accent="rose"] {
  --page: #121012;
  --surface: #1c191b;
  --surface-2: #262224;
  --surface-3: #312b2e;
  --ink: #f6f2f3;
  --ink-2: #c9c0c4;
  --muted: #a59ca0;
  --grid: #2d282b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #cf3d78;
  --accent-hover: #da4f87;
  --accent-ink: #f08ab5;
  --accent-wash: rgba(207, 61, 120, 0.18);
  --accent-wash-2: rgba(207, 61, 120, 0.3);
  --series-1: #e8769f;
  --series-track: #3a2530;
  --tooltip-bg: #f6f2f3;
  --backdrop: rgba(0, 0, 0, 0.55);
}
:root[data-theme="dark"][data-accent="blue"] {
  --accent: #1f6fe8;
  --accent-hover: #3a82f0;
  --accent-ink: #7cb0ff;
  --accent-wash: rgba(31, 111, 232, 0.2);
  --accent-wash-2: rgba(31, 111, 232, 0.32);
  --series-1: #6ea6ff;
  --series-track: #1f2d4a;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font: var(--fs-md)/1.5 var(--font);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1 { font: 650 var(--fs-xl)/1.2 var(--font-display); letter-spacing: -0.015em; }
h2 { font: 600 var(--fs-lg)/1.3 var(--font-display); letter-spacing: -0.005em; }
h3 { font: 600 var(--fs-md)/1.35 var(--font-display); }
a { color: var(--accent-ink); }
button { font-family: inherit; }
kbd { font: 12px/1 var(--font); background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; color: var(--ink-2); }
code { font: var(--fs-sm) ui-monospace, Consolas, "Cascadia Mono", monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.icon { width: 15px; height: 15px; flex: none; vertical-align: -2px; }
::selection { background: var(--accent-wash-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.mono { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: var(--fs-sm); word-break: break-all; }
.num { font-variant-numeric: tabular-nums; }
.danger-text { color: var(--critical-ink); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.spread { justify-content: space-between; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.grow { flex: 1; min-width: 0; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
/* A row's title as a real button (keyboard and screen readers), drawn as plain text */
.row-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.row-link:hover { color: var(--accent-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); height: 100%; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 14px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff; font: 700 14px/1 var(--font-display);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, #ffffff), var(--accent) 60%, color-mix(in srgb, var(--accent) 70%, #000000));
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font: 650 var(--fs-md)/1.2 var(--font-display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-name.placeholder { color: var(--ink-2); }
.brand-sub { font-size: var(--fs-sm); color: var(--muted); }
.new-wrap { position: relative; }
.btn-new { width: 100%; justify-content: center; height: 40px; font-size: var(--fs-md); }
.btn-new .chev { margin-left: auto; opacity: 0.8; }
.search-trigger {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; margin-top: 2px;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--ink-2); }
.search-trigger .icon { width: 16px; height: 16px; flex: none; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd { flex: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; height: 40px; padding: 0 12px;
  border: 0; background: transparent; color: var(--ink-2);
  border-radius: var(--radius-sm); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.nav-item .icon { width: 19px; height: 19px; flex: none; }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.nav-more { display: none; }
.nav-badge { background: var(--critical); color: #fff; font-size: 11px; font-weight: 650; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; line-height: 1.5; }
.nav-badge.soft { background: var(--accent-wash-2); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 0; color: var(--muted); font-size: var(--fs-sm); }
.sidebar-foot .status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.sidebar-foot .status.busy::before { background: var(--warning); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.main { overflow: auto; min-width: 0; scroll-behavior: smooth; }
.page { max-width: 1240px; margin: 0 auto; padding: var(--space-6) 40px 72px; display: flex; flex-direction: column; gap: var(--space-5); animation: fade var(--med) var(--ease); }
.page.wide { max-width: 1480px; }
/* List-style pages read in one column, about 760px wide */
.page.narrow { max-width: calc(var(--reading) + 80px); }
@keyframes fade { from { opacity: 0; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: var(--space-1); color: var(--ink-2); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loading { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 24px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; width: fit-content; }
.back:hover { color: var(--ink); }
.back .icon { width: 16px; height: 16px; }

/* dropdown menu */
.menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 280px;
  animation: pop var(--fast) var(--ease);
}
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu-item > span > span:first-child { white-space: nowrap; font-weight: 550; }
.menu.right { left: auto; right: 0; }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-xs);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item:disabled { opacity: 0.5; cursor: default; background: transparent; }
.menu-item .icon { width: 17px; height: 17px; color: var(--ink-2); flex: none; }
.menu-item .menu-hint { display: block; font-size: var(--fs-sm); color: var(--muted); }
.menu-item.danger { color: var(--critical-ink); }
.menu-item.danger .icon { color: var(--critical-ink); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px var(--space-5); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.card-head .row { gap: 6px; }
.card-head h2 .count { color: var(--muted); font-weight: 500; }
.table-card { padding: 6px 8px 8px; overflow-x: auto; }
.row-chevron { margin-left: 10px; opacity: 0.6; }
.table tr.clickable:hover .row-chevron { opacity: 1; color: var(--accent-ink); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px var(--space-4); text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }
.stat-label { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.stat-value { font: 650 var(--fs-lg)/1.3 var(--font-display); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-warning .stat-value { color: var(--warning-ink); }
.stat-critical .stat-value { color: var(--critical-ink); }
/* Icons in colored squares read as template filler; they are not drawn anywhere. */
.stat-icon, .later-icon, .tell-icon, .welcome-icon { display: none !important; }

/* Figures: a few labelled numbers in one quiet line, never tiles. */
.figures { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); margin: 0; }
.figure { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.figure dt { font-size: var(--fs-sm); color: var(--ink-2); }
.figure dd { margin: 0; font: 650 var(--fs-lg)/1.3 var(--font-display); font-variant-numeric: tabular-nums; }
.figure dd.figure-sub { font: 400 var(--fs-sm)/1.4 var(--font); color: var(--muted); }
.figure.warning dd:not(.figure-sub) { color: var(--warning-ink); }
.figure.critical dd:not(.figure-sub) { color: var(--critical-ink); }
.figure.good dd:not(.figure-sub) { color: var(--good-ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2-wide { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1000px) { .grid-2, .grid-2-wide { grid-template-columns: 1fr; } }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; width: 100%; }
.check-item:hover { background: var(--surface-2); }
.check-item .circle { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.done .circle { background: var(--good); border-color: var(--good); }
.check-item.done span:not(.circle) { color: var(--muted); text-decoration: line-through; }
.check-item .circle .icon { width: 14px; height: 14px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--med) var(--ease); }

/* a feature that arrives in a later update */
.later { color: var(--ink-2); font-size: var(--fs-md); }
.later-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.later-icon .icon { width: 16px; height: 16px; }

/* ---------- lists and tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 44px; padding: var(--space-3) 0; border-bottom: 1px solid var(--grid); }
.list-row:last-child { border-bottom: 0; }
.list-row > div:first-child { min-width: 0; flex: 1; }
.list-row > div.time-col:first-child { flex: none; }
.list-row > .time-col + div { flex: 1; min-width: 0; }
.list-row.clickable { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--radius-sm); transition: background var(--fast) var(--ease); }
.list-row.clickable:hover { background: var(--surface-2); }
.list-row.open { align-items: flex-start; flex-wrap: wrap; }
.row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.list-group + .list-group { margin-top: 12px; }
.list-group-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: var(--space-1) 0; }
.list-group-title.overdue { color: var(--critical-ink); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.clickable td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.table tr.clickable td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.cell-title { font-weight: 550; }
.cell-sub { font-size: var(--fs-sm); color: var(--muted); }
.cell-sub.danger-text { color: var(--critical-ink); }
.row-muted td { opacity: 0.55; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn + .btn { margin-left: 6px; }
.ext { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--muted); }
.ext:hover { color: var(--accent-ink); }
.ext .icon { width: 14px; height: 14px; }
button.ext { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 550; min-height: 36px; padding: 0 var(--space-4);
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--critical); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--critical); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
/* Text button: a link-looking action for the least important choice in an area */
.btn-text { border-color: transparent; background: transparent; color: var(--accent-ink); padding: 0 var(--space-2); }
.btn-text:hover { background: transparent; text-decoration: underline; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--fs-sm); border-radius: var(--radius-xs); }
.btn .chev { width: 14px; height: 14px; margin-right: -4px; color: var(--ink-2); }
.btn-sm .icon { width: 14px; height: 14px; }
.btn.danger { color: var(--critical-ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-icon { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-2); width: 36px; height: 36px; border-radius: var(--radius-xs); display: inline-grid; place-items: center; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon .icon { width: 17px; height: 17px; }
.link { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; text-align: left; }
.link:hover { text-decoration: underline; }
.badge { display: inline-block; font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; padding: 0 7px; border-radius: var(--radius-xs); background: var(--surface-2); color: var(--ink-2); vertical-align: 1px; }
.badge-accent { background: var(--surface-2); color: var(--ink); }
.badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; padding: 1px 8px 1px 7px; border-radius: var(--radius-xs); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.chip-good .chip-dot { background: var(--good); }
.chip-warning { color: var(--warning-ink); }
.chip-warning .chip-dot { background: var(--warning); }
.chip-serious { color: var(--serious-ink); }
.chip-serious .chip-dot { background: var(--serious); }
.chip-critical { color: var(--critical-ink); }
.chip-critical .chip-dot { background: var(--critical); }
.chip-accent .chip-dot { background: var(--accent); }
.chip-kind-web .chip-dot { background: var(--kind-web); }
.chip-kind-phone .chip-dot { background: var(--kind-phone); }
.chip-kind-both .chip-dot { background: var(--kind-both); }
.chip-kind-other .chip-dot { background: var(--kind-other); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg-item { font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--ink-2); min-height: 32px; padding: 4px 14px; cursor: pointer; border-radius: 8px; white-space: nowrap; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.seg-item:hover { color: var(--ink); }
.seg-item.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg-item .seg-count { color: var(--muted); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  height: 38px; padding: 0 12px; width: 100%;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
/* Text boxes grow with what's in them (Chrome and Edge; elsewhere they can still be dragged taller), start at three
   lines, and stop growing at most of the screen height so a very long note scrolls inside instead. */
textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; field-sizing: content; min-height: calc(3lh + 20px); max-height: 70vh; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input:disabled { opacity: 0.6; }
input[type="checkbox"] { accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 9px; min-height: 38px; cursor: pointer; }
.check input { height: 17px; width: 17px; margin: 0; flex: none; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > :first-child { flex: 1; }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 240px; max-width: 380px; }
.toolbar select { width: auto; }
.toolbar .count { margin-left: auto; color: var(--ink-2); font-size: var(--fs-sm); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { font: inherit; font-size: var(--fs-sm); font-weight: 500; min-height: 32px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 4px 13px; cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.filter-chip:hover { background: var(--surface-2); color: var(--ink); }
.filter-chip.active { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- forms and modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; animation: fadein var(--fast) var(--ease); }
@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 600px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop var(--med) var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 10px; gap: 12px; }
.modal-head h2 { font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 6px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--grid); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.modal.confirm { width: 440px; }
.modal.confirm .modal-body { padding: 24px 24px 18px; }
.modal.confirm h2 { font-size: var(--fs-lg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid > * { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.span-2, .field.span-2 { grid-column: span 2; }
.span-3, .field.span-3 { grid-column: 1 / -1; }
.field-label { font-size: var(--fs-sm); color: var(--ink); font-weight: 600; }
.field-hint { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.45; }
.form-section { grid-column: 1 / -1; font-size: var(--fs-md); font-weight: 600; color: var(--ink); margin-top: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--grid); }
.form-section.first { margin-top: 0; padding-top: 0; border-top: 0; }
.notice { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-3) 14px; font-size: var(--fs-md); }
.notice.error { background: rgba(208, 59, 59, 0.12); color: var(--critical-ink); }
.who-select { width: auto; flex: none; }
.pin-code { font-size: var(--fs-lg); letter-spacing: 0.12em; }
.notice.warn { background: rgba(227, 160, 8, 0.16); }
.notice.ok { background: rgba(12, 163, 12, 0.12); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: var(--space-2) 14px; font-size: var(--fs-md); margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.compact { grid-template-columns: 100px 1fr; }
.empty { padding: var(--space-4) 0; color: var(--ink-2); display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.table-card > .empty { padding: var(--space-4) 14px; }
.empty p { max-width: 64ch; margin: 0; }
.empty .empty-title { color: var(--ink); font-weight: 600; margin-right: 4px; }
.empty-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.empty-actions:empty { display: none; }
.welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.welcome-item { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.welcome-item p { flex: 1; }
.welcome-icon { width: 30px; height: 30px; }
.welcome-icon .icon { width: 16px; height: 16px; }
pre.preview { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; font: var(--fs-sm)/1.55 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; margin: 0; }
details.fold summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); }
.picker { position: relative; }
.picker-menu { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); margin-top: 6px; max-height: 240px; overflow: auto; padding: 4px; animation: pop var(--fast) var(--ease); }
.picker-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-xs); }
.picker-item:hover, .picker-item.active { background: var(--surface-2); }
.picker-item .cell-sub { white-space: nowrap; }
.selected-client { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.selected-client span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }

/* ---------- avatars ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: inline-grid; place-items: center; font: 650 var(--fs-sm)/1 var(--font-display); flex: none; letter-spacing: 0.02em; }
.avatar.lg { width: 56px; height: 56px; font-size: var(--fs-lg); }

/* ---------- pipeline: ball, waiting chips, quick picks ---------- */
.ball { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; padding: 1px 8px; border-radius: var(--radius-xs); white-space: nowrap; background: var(--surface-2); }
.ball .icon { display: none; }
.ball.me { color: var(--ink); font-weight: 600; }
.ball.client { color: var(--ink-2); }
.ball-days { color: var(--muted); font-weight: 500; }
.ball.me .ball-days { color: inherit; opacity: 0.8; }
.next-line { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); min-width: 0; }
.next-line .icon { width: 13px; height: 13px; flex: none; position: relative; top: 2px; color: var(--muted); }
.next-line .due { color: var(--muted); white-space: nowrap; }
.next-line .due.late { color: var(--critical-ink); font-weight: 550; }
.picks { display: flex; gap: 6px; flex-wrap: wrap; }
.whats-next { flex-basis: 100%; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; margin: 4px 0 2px; background: var(--surface-2); border-radius: var(--radius-sm); }
.whats-next .form-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; }
.whats-next input[type="date"] { width: 150px; }
.whats-next input, .whats-next select { background: var(--surface); }

/* ---------- boards (Leads and Projects) ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
/* Six work stages wrap into rows on a desktop instead of scrolling sideways. */
.board.projects { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); overflow: visible; }
.board-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; border: 1px dashed transparent; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.board-col.drop { border-color: var(--accent); background: var(--accent-wash); }
.board-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.board-col-head .sum { font-weight: 500; }
.board-empty { font-size: var(--fs-sm); color: var(--muted); text-align: center; padding: 18px 8px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow-sm); cursor: pointer; display: flex; flex-direction: column; gap: 7px; text-align: left; font: inherit; color: inherit; width: 100%; transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.pcard:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.pcard[draggable="true"] { cursor: grab; }
.pcard.dragging { opacity: 0.45; transform: scale(0.98); }
.pcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pcard-client { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pcard-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pcard-money { font-size: var(--fs-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; margin-left: auto; }
.lead-seg { display: none; }

/* ---------- project page (Part B: declutter) ----------
   One header (name, client, one status line, one primary action, More), a compact stage line with a thin progress bar,
   then four tabs. List-style tabs (Overview, Money, Messages) read in one column about 760px wide. */
.project-head { display: flex; flex-direction: column; gap: 10px; }
.ph-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 16px; flex-wrap: wrap; }
.ph-title { min-width: 0; flex: 1 1 320px; }
.ph-title h1 { overflow-wrap: anywhere; }
.ph-client { margin-top: 4px; color: var(--ink-2); }
.ph-client-link { color: var(--accent-ink); font-weight: 500; text-decoration: none; }
.ph-client-link:hover { text-decoration: underline; }
.ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.more-wrap { position: relative; }
.ph-status { color: var(--ink); max-width: 76ch; line-height: 1.5; }
.ph-sep { color: var(--ink-2); }
.ph-overdue { color: var(--critical-ink); font-weight: 600; }
.ph-risk { color: var(--warning-ink); font-size: var(--fs-sm); }
.ph-link { background: none; border: 0; padding: 2px 4px; margin-left: 2px; color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-xs); }
.ph-link:hover { text-decoration: underline; }
.ph-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph-stage { display: flex; flex-direction: column; gap: 6px; max-width: 420px; margin-top: 2px; }
.ph-stage-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.ph-stage-line strong { color: var(--ink); font-weight: 600; }
.ph-stage-count { color: var(--ink-2); }
.ph-progress { appearance: none; -webkit-appearance: none; width: 100%; height: 4px; border: 0; border-radius: 2px; background: var(--surface-3); color: var(--accent); overflow: hidden; display: block; }
.ph-progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 2px; }
.ph-progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
.ph-progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.next-form { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); max-width: 760px; }
.next-form input { background: var(--surface); }
.next-form-row { display: flex; gap: 12px 16px; flex-wrap: wrap; align-items: flex-end; }
.next-form-row input[type="date"] { width: 170px; }
.next-form .seg { background: var(--surface-3); }
.next-form .btn-row { margin-top: 0; }
.project-head .whats-next { max-width: 760px; }
.project-tabs { margin-top: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--grid); overflow-x: auto; scrollbar-width: none; }
.tab { font: inherit; font-weight: 550; color: var(--ink-2); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; margin-bottom: -1px; cursor: pointer; white-space: nowrap; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 650; }
.tab .tab-later { font-size: var(--fs-sm); color: var(--muted); margin-left: 6px; font-weight: 500; }
.project-col { display: flex; flex-direction: column; gap: 16px; max-width: 760px; min-width: 0; }
.project-part { min-width: 0; scroll-margin-top: 16px; }
.form-grid.one-col { grid-template-columns: 1fr; }
.details-h { font-size: var(--fs-sm); font-weight: 600; margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--grid); }
.timeline { display: flex; flex-direction: column; }
.tl-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); align-items: start; font-size: var(--fs-sm); }
.tl-row:last-child { border-bottom: 0; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 6px 0 0 4px; }
.tl-row.internal .tl-dot { background: var(--ink-2); }
.tl-row.client .tl-dot { background: var(--kind-phone); }
.tl-when { color: var(--ink-2); font-size: var(--fs-sm); white-space: nowrap; }
.link-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: center; }
.link-list { display: flex; flex-direction: column; gap: 10px; }
.link-row .field-label { display: flex; flex-direction: column; gap: 1px; }
.link-who { font-size: var(--fs-sm); font-weight: 400; color: var(--ink-2); }
.discovery-q { display: flex; flex-direction: column; gap: 5px; }
@media (max-width: 640px) {
  .ph-actions { width: 100%; }
  .ph-actions > .btn-primary { flex: 1; justify-content: center; }
  .ph-stage { max-width: none; }
  .link-row { grid-template-columns: 1fr; gap: 4px; }
  .project-tabs .tab { flex: 1; text-align: center; padding: 10px 8px; }
}
@media (pointer: coarse) {
  .ph-link { min-height: 44px; padding: 0 10px; }
  .project-page .tab, .project-page .seg-item, .project-page .btn { min-height: 44px; }
  .next-form input { min-height: 44px; }
}

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { font-size: var(--fs-lg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; container-type: inline-size; }
@container (max-width: 620px) { .cal-ev .ev-time { display: none; } }
.cal-dow { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); text-align: center; padding: 4px 0 8px; }
/* A month reads as one sheet: hairlines between weeks, no box around every day */
.cal-cell { min-height: 100px; border: 0; border-top: 1px solid var(--grid); border-radius: 0; padding: 6px 4px; background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other { background: transparent; color: var(--muted); }
.cal-cell.other:hover { background: var(--surface-2); }
.cal-cell.today .cal-day { background: var(--accent); color: var(--on-accent); }
.cal-cell.selected { background: var(--accent-wash); }
.cal-day { font-size: var(--fs-sm); font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; margin-bottom: 2px; }
.cal-dots { display: none; gap: 3px; }
.cal-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-ev { font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; padding: 2px 6px; border-radius: 4px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--kind-other); background: color-mix(in oklab, var(--kind-other) 14%, transparent); }
button.cal-ev { display: block; width: 100%; border-top: 0; border-right: 0; border-bottom: 0; font-family: inherit; text-align: left; cursor: pointer; }
button.cal-ev:hover { filter: brightness(0.96); }
.cal-ev.discovery { border-left-color: var(--kind-web); background: color-mix(in oklab, var(--kind-web) 14%, transparent); }
.cal-ev.call { border-left-color: var(--kind-phone); background: color-mix(in oklab, var(--kind-phone) 14%, transparent); }
.cal-ev.review { border-left-color: var(--kind-both); background: color-mix(in oklab, var(--kind-both) 14%, transparent); }
.cal-ev.milestone { border-left-color: var(--accent); background: var(--accent-wash); }
.cal-ev.launch { border-left-color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); }
.cal-ev.invoice { border-left-color: var(--warning); background: color-mix(in oklab, var(--warning) 16%, transparent); }
.cal-ev.reminder { border-left-color: var(--muted); background: transparent; color: var(--ink-2); }
.cal-ev.done { opacity: 0.5; text-decoration: line-through; }
.cal-more { font-size: var(--fs-sm); color: var(--ink-2); padding-left: 6px; }
.cal-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-2); margin-top: var(--space-3); }
.cal-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--kind-other); vertical-align: middle; }
.cal-legend .discovery::before { background: var(--kind-web); }
.cal-legend .call::before { background: var(--kind-phone); }
.cal-legend .review::before { background: var(--kind-both); }
.cal-legend .milestone::before { background: var(--accent); }
.cal-legend .launch::before { background: var(--good); }
.cal-legend .invoice::before { background: var(--warning); }
.cal-legend .reminder::before { background: transparent; border: 1.5px solid var(--muted); }
.day-panel .list-row { align-items: flex-start; }
.time-col { width: 72px; flex: none; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; font-size: var(--fs-sm); padding-top: 2px; }

/* ---------- client header ---------- */
.client-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.client-head h1 { margin-bottom: 2px; overflow-wrap: anywhere; }
.contact-line { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: var(--fs-md); color: var(--ink-2); margin-top: var(--space-1); }
.contact-line a { color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.contact-line a:hover { text-decoration: underline; }
.contact-line.small { font-size: var(--fs-sm); margin-top: 2px; }
.contact-line .icon { width: 14px; height: 14px; color: var(--muted); }
.contact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: 14px 0; border-bottom: 1px solid var(--grid); }
.contact-row:last-child { border-bottom: 0; }
.portal-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.portal-status .icon { width: 13px; height: 13px; }
.client-since { margin-top: var(--space-1); font-size: var(--fs-sm); color: var(--muted); }
.client-head h1 .badge { vertical-align: 6px; }
.contact-main { min-width: 0; }
/* Clients list: one column of rows; the right side carries only what needs attention */
.client-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid); }
.client-list .list-row.clickable { margin: 0; padding-left: var(--space-2); padding-right: var(--space-2); border-radius: 0; }
.client-facts { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.toolbar .search.search-wide { max-width: none; }
.portal-actions { margin-top: 8px; flex-wrap: wrap; }

/* ---------- payments ---------- */
.pay-list { display: flex; flex-direction: column; }
.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: var(--fs-md); }
.pay-row:last-child { border-bottom: 0; }
.money-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.money-summary .stat { padding: 0; background: transparent; border: 0; }
.money-summary .stat-value { font-size: var(--fs-lg); }

/* ---------- settings editors ---------- */
.plan-wrap { overflow-x: auto; margin: 0 -4px; }
.plan-table { min-width: 560px; }
.plan-table td, .plan-table th { padding: 5px 4px; }
.plan-table input, .plan-table select { height: 34px; }
.plan-table td.check-cell { text-align: center; }
.plan-table td.check-cell input { width: 17px; height: 17px; }
.plan-table .plan-days { width: 84px; }
.plan-table .plan-pct { width: 70px; }
.settings .input-row input[inputmode="numeric"] { max-width: 120px; }
.settings .input-row:has(input[inputmode="numeric"]) { justify-content: flex-start; }
.settings .input-row:has(input[inputmode="numeric"]) > :first-child { flex: 0 1 120px; }
.sum-line { font-size: var(--fs-sm); color: var(--muted); }
.sum-line.ok { color: var(--good-ink); }
.sum-line.bad { color: var(--critical-ink); font-weight: 550; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.swatch:hover { background: var(--surface-2); }
.swatch.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch-dot { width: 20px; height: 20px; border-radius: 7px; flex: none; }

/* ---------- bar list (single series) ---------- */
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(48px, 70px) 1fr 96px; align-items: center; gap: 12px; font-size: var(--fs-sm); position: relative; padding: 2px 0; border-radius: 6px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); padding-left: 4px; }
.bar-track { height: 16px; background: var(--series-track); border-radius: 0 4px 4px 0; }
.bar-fill { height: 16px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; transition: width var(--med) var(--ease); }
.bar-fill.zero { min-width: 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); padding-right: 4px; }
.bar-row.current .bar-label { color: var(--ink); font-weight: 600; }
.tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--tooltip-bg); color: var(--tooltip-ink); font-size: var(--fs-sm); padding: 5px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: var(--shadow-md); }

/* ---------- command palette ---------- */
.palette-backdrop { align-items: flex-start; padding-top: 12vh; }
.palette { width: 660px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop var(--med) var(--ease); display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--grid); }
.palette-input .icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
.palette-input input { height: 52px; background: transparent; border: 0; box-shadow: none; padding: 0; font-size: 16px; }
.palette-input input:focus { background: transparent; border: 0; box-shadow: none; }
.palette-list { overflow: auto; padding: 8px; }
.palette-group { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: 10px 10px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-sm); }
.palette-item.active { background: var(--accent-wash); }
.palette-icon { width: 20px; color: var(--muted); display: grid; place-items: center; flex: none; }
.palette-icon .icon { width: 17px; height: 17px; }
.palette-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-main > span:first-child { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-go { color: var(--muted); opacity: 0; }
.palette-item.active .palette-go { opacity: 1; }
.palette-go .icon { width: 16px; height: 16px; }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--grid); font-size: var(--fs-sm); color: var(--muted); }
.palette-foot kbd { margin-right: 3px; }

/* ---------- phone: More sheet ---------- */
.sheet-backdrop { align-items: flex-end; padding: 0; }
.more-sheet { width: 100%; background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: sheetin var(--med) var(--ease); }
@keyframes sheetin { from { transform: translateY(24px); opacity: 0; } }
.more-sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 0 auto 12px; }
.more-sheet h2 { font-size: var(--fs-md); color: var(--ink-2); padding: 4px 4px 8px; font-weight: 600; }
.more-sheet .sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 0 10px; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 550; border-radius: var(--radius-sm); text-align: left; cursor: pointer; }
.more-sheet .sheet-item:hover, .more-sheet .sheet-item.active { background: var(--surface-2); }
.more-sheet .sheet-item.active { color: var(--accent-ink); }
.more-sheet .sheet-item .icon { width: 20px; height: 20px; color: var(--ink-2); }
.more-sheet .sheet-item:disabled { opacity: 0.5; }
.more-sheet .sheet-item .menu-hint { display: block; font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }
.more-sheet .status { display: inline-flex; align-items: center; gap: 6px; }
.more-sheet .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.more-sheet .status.busy::before { background: var(--warning); animation: pulse 1s infinite; }
.more-sheet .sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 10px 0; margin-top: 8px; border-top: 1px solid var(--grid); font-size: var(--fs-sm); color: var(--muted); }

/* ---------- a page that hit a render error ---------- */
.error-card h2 { margin-bottom: 6px; }
.error-card pre { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font: 12.5px/1.5 ui-monospace, Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; color: var(--critical-ink); max-height: 180px; overflow: auto; }

/* ---------- printable sheet ---------- */
.sheet-wrap { max-width: 760px; margin: 0 auto; padding: 28px 32px 56px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 44px; box-shadow: var(--shadow-sm); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--accent); padding-bottom: 16px; margin-bottom: 20px; }
.sheet-head h1 { font-size: 24px; }
.sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 8px; }
.sheet-tools { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
@media print {
  .sheet-tools, .sidebar, .toasts, .fab { display: none !important; }
  .sheet-wrap { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; box-shadow: none; }
  body { background: #fff; color: #000; }
  .app { display: block; }
  .main { overflow: visible; }
}

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--tooltip-bg); color: var(--tooltip-ink); padding: 11px 16px; border-radius: var(--radius); font-size: var(--fs-md); font-weight: 500; box-shadow: var(--shadow-lg); max-width: min(560px, calc(100vw - 32px)); animation: toastin var(--med) var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px); } }
.toast.error { background: var(--critical); color: #fff; }
.toast-action { font: inherit; font-weight: 650; background: transparent; border: 0; color: inherit; cursor: pointer; padding: 4px 8px; margin: -4px -6px -4px 0; border-radius: 999px; text-decoration: underline; text-underline-offset: 2px; }
.toast-action:hover { background: rgba(128, 128, 128, 0.2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 16px 10px 12px; align-items: stretch; }
  .brand { justify-content: center; padding: 2px 0 12px; }
  .brand-text, .nav-label, .nav-badge.soft, .search-trigger span, .search-trigger kbd, .btn-new .label, .btn-new .chev, .sidebar-foot .status { display: none; }
  .btn-new { padding: 0; }
  .search-trigger { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 0; position: relative; }
  .nav-item .nav-badge { position: absolute; top: 4px; right: 8px; }
  .menu { left: 0; right: auto; }
  .sidebar-foot { justify-content: center; }
  .page { padding: 28px 28px 72px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { order: 2; flex-direction: row; align-items: center; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); gap: 0; }
  .brand, .new-wrap, .search-trigger, .sidebar-foot { display: none; }
  .sidebar nav { flex-direction: row; margin: 0; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; height: 52px; font-size: var(--fs-sm); font-weight: 500; padding: 4px 6px; flex: 1 1 0; min-width: 0; }
  .nav-item.tab-hide { display: none; }
  .nav-item.nav-more { display: flex; }
  .nav-label { display: block !important; max-width: 100%; }
  .nav-item .icon { width: 20px; height: 20px; }
  .nav-item .nav-badge { top: 2px; right: calc(50% - 22px); }
  .main { order: 1; }
  .page { padding: 20px 16px 96px; }
  .card { padding: var(--space-4); }
  .figures { gap: var(--space-3) var(--space-5); }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2, .field.span-2, .form-section { grid-column: span 1; }
  .cal-cell { min-height: 60px; padding: 5px; }
  .cal-cell .cal-ev, .cal-cell .cal-more { display: none; }
  .cal-dots { display: flex; }
  .money-summary { grid-template-columns: 1fr; }
  .sheet { padding: 20px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal-backdrop.sheet-backdrop { padding: 0; }
  .modal { max-height: 92vh; }
  .fab { position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 25; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; box-shadow: var(--shadow-lg); }
  .fab .icon { width: 24px; height: 24px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .board.leads { display: block; }
  .board.leads .board-col { display: none; }
  .board.leads .board-col.shown { display: flex; }
  .lead-seg { display: inline-flex; width: 100%; }
  .lead-seg .seg-item { flex: 1; padding: 6px 8px; }
  .board.projects { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(240px, 84%); overflow-x: auto; scroll-snap-type: x mandatory; }
  .board.projects .board-col { scroll-snap-align: start; }
  .whats-next .form-grid { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr; gap: 5px; }
  .stat-value { font-size: var(--fs-xl); }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-row .stat { padding: 13px 14px; }
  .kpi-row .stat-icon { display: none; }
  .kpi-row .stat-label { padding-right: 0; }
}
@media (max-width: 340px) { .kpi-row { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .hide-phone { display: none !important; } }
/* On phones a row's buttons drop under its text instead of squeezing it. */
@media (max-width: 720px) {
  .list-row { flex-wrap: wrap; }
  .list-row > div:first-child { flex: 1 1 200px; }
  .list-row > .row-right { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .list-row > .time-col + div { flex: 1 1 160px; }
}
@media (min-width: 721px) { .fab { display: none; } }

@media (max-width: 1000px) and (min-width: 861px) { .hide-md { display: none !important; } }

/* tables become cards on narrow screens */
@media (max-width: 860px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; }
  .table.responsive tr { padding: 10px 6px; border-bottom: 1px solid var(--grid); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 6px; border: 0; text-align: left !important; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-sm); flex: none; }
  .table.responsive td:not([data-label])::before { content: none; }
  .table.responsive td > .cell-stack { text-align: right; min-width: 0; }
  .table.responsive td.actions { justify-content: flex-end; }
  /* The payment plan: each milestone is a small labelled card, every field visible without scrolling sideways. */
  .plan-wrap { overflow-x: visible; margin: 0; }
  .plan-table.responsive { min-width: 0; }
  .plan-table.responsive tr { padding: 10px 0; }
  .plan-table.responsive td { padding: 4px 0; }
  .plan-table.responsive td > input:not([type="checkbox"]), .plan-table.responsive td > select { flex: 0 1 60%; min-width: 0; width: auto; }
  .plan-table.responsive td.check-cell { text-align: left; }
}

/* ---------- status strips (assistant log, from Makeup Studio) ---------- */
.status-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-md); padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.ok { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.15); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(227, 160, 8, 0.18); }

/* ---------- choice cards and toggles ---------- */
.setup-steps { margin: 4px 0 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.setup-steps > li { counter-increment: step; position: relative; padding-left: 40px; display: flex; flex-direction: column; gap: 8px; }
.setup-steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; font-size: var(--fs-sm); display: grid; place-items: center; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.choice:hover { background: var(--surface-2); }
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.choice .badge { margin-left: 4px; vertical-align: 1px; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: 1fr; } }
.toggle-list { display: flex; flex-direction: column; }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.toggle-row:last-child { border-bottom: 0; }
input.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 0; padding: 0; position: relative; cursor: pointer; flex: none; transition: background var(--fast) var(--ease); }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--fast) var(--ease); }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus { box-shadow: 0 0 0 3px var(--accent-wash); }

/* ---------- sign-in (server version) ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--page); }
.login-card { width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 14px; animation: pop var(--med) var(--ease); }
.login-card h1 { font-size: var(--fs-xl); }
.login-brand { display: flex; align-items: center; gap: 10px; font: 650 var(--fs-md)/1.2 var(--font-display); color: var(--ink-2); min-width: 0; }
.login-brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-btn { height: 42px; margin-top: 4px; }

/* Settings > Public site: the price guide as two-line rows (name, group, prices, AI and remove on top; the description
   below at full width), so nothing is cut off or pushed past the card at any width; then the link and key rows */
.guide-list { display: flex; flex-direction: column; border-top: 1px solid var(--grid); }
.guide-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--grid); min-width: 0; }
.guide-top { display: grid; grid-template-columns: 132px 104px 104px auto minmax(0, 1fr); gap: 8px; align-items: end; }
/* The name gets the whole first line, so long service names are never cut off */
.guide-top > .guide-name { grid-column: 1 / -1; }
.guide-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.guide-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.guide-row:not(:first-child) .guide-top .guide-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.guide-field input, .guide-field select { height: 34px; width: 100%; min-width: 0; }
.guide-desc textarea { width: 100%; min-height: calc(2lh + 20px); }
.guide-desc .guide-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.guide-ai { display: inline-flex; align-items: center; gap: 6px; height: 34px; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.guide-remove { align-self: end; justify-self: end; }
.public-link input[readonly] { color: var(--ink-2); }
.public-spend { font-size: var(--fs-sm); padding-top: 6px; }
.public-key-status.ok { color: var(--good-ink); }
@media (max-width: 760px) {
  .guide-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .guide-name { grid-column: 1 / -1; }
  .guide-row .guide-top .guide-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .guide-ai { justify-self: start; }
  .guide-remove { justify-self: end; }
}

/* Project > Overview: what a public-site lead sent */
.inquiry-card .inquiry-h { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); margin: 14px 0 4px; }
.inquiry-card .inquiry-text { margin: 0; font-size: var(--fs-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.inquiry-qa { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-md); }
.inquiry-qa li > div { overflow-wrap: anywhere; }

/* Project > Build: Build with Claude. The plan is Claude's markdown, rendered as text (headings, lists, bold) */
.build-next { margin: 0 0 12px; font-size: var(--fs-md); }
.build-head .card-head { flex-wrap: wrap; }
.plan-md { font-size: var(--fs-md); line-height: 1.55; overflow-wrap: anywhere; }
.plan-md > :first-child { margin-top: 0; }
.plan-md p { margin: 0 0 10px; }
.plan-md .plan-h { font-size: var(--fs-md); font-weight: 650; margin: 18px 0 6px; }
.plan-md .plan-h4 { font-size: var(--fs-md); font-weight: 650; color: var(--ink-2); margin: 14px 0 4px; }
.plan-md ul, .plan-md ol { margin: 0 0 10px; padding-left: 22px; display: flex; flex-direction: column; gap: 3px; }
.plan-md code { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: var(--fs-md); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.plan-md hr { border: 0; border-top: 1px solid var(--grid); margin: 14px 0; }
.build-plan .btn-row, .build-previews .btn-row { border-top: 1px solid var(--grid); padding-top: 14px; }
.build-note-form { margin-top: 14px; border-top: 1px solid var(--grid); padding-top: 14px; }
.build-preview { align-items: flex-start; }
.build-preview-note { margin: 6px 0 0; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.build-request, .build-log-text { font-size: var(--fs-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.build-preview-actions { flex: none; }
.build-hosting { flex-wrap: wrap; }
.build-missing { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.build-brief { margin: 10px 0 0; max-height: 420px; overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.build-sees .error-text { color: var(--critical-ink); }
/* The build's side column: two cards, each split into parts by hairlines (no cards inside cards) */
.build-sub { border-top: 1px solid var(--grid); margin-top: var(--space-4); padding-top: var(--space-4); }
.build-sub-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.build-sub-head h3 { font-size: var(--fs-md); font-weight: 600; }
@media (max-width: 560px) {
  .build-preview { flex-direction: column; flex-wrap: nowrap; gap: 10px; }
  .build-preview > div:first-child { flex: none; width: 100%; }
  .build-preview-actions { flex-wrap: wrap; }
}

/* Settings > Claude builder */
.builder-status { font-size: var(--fs-sm); padding-top: 6px; }
.builder-status.ok { color: var(--good-ink); }
.builder-saved { font-size: var(--fs-sm); }

/* Slice 4, owner screens: files, reviews, feedback, change requests, updates, "What we need from you" */
.chip .icon { width: 13px; height: 13px; }
.switch-row { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); cursor: pointer; }
.switch-row.small { font-size: var(--fs-sm); color: var(--ink-2); }
.switch-row input { width: auto; margin: 0; }
.switch-row .icon { width: 13px; height: 13px; vertical-align: -2px; }
.error-text { color: var(--critical-ink); }

/* uploads */
.drop-zone { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 22px 16px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); text-align: center; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.drop-zone.over { border-color: var(--accent); background: var(--accent-wash); }
.drop-zone.compact { padding: 10px 12px; justify-content: flex-start; }
.drop-zone .drop-hint { flex-basis: 100%; }
.drop-zone.compact .drop-hint { flex-basis: auto; }
.upload-queue { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(80px, 160px); align-items: center; gap: 10px; font-size: var(--fs-sm); }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-bar { display: block; height: 6px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.upload-bar > span { display: block; height: 100%; background: var(--accent); transition: width var(--fast) var(--ease); }
.upload-queue li.done .upload-bar > span { background: var(--good); }

/* Files tab */
.file-group-title { font-size: var(--fs-sm); font-weight: 650; margin: 18px 0 8px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.file-group-title + .file-grid { margin-top: 0; }
.file-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; min-width: 0; }
.file-card-thumb { display: block; background: var(--surface-2); }
.file-card-thumb .file-thumb.large { width: 100%; height: 120px; border-radius: 0; }
.file-card-body { padding: 10px 12px 4px; min-width: 0; }
.file-card-actions { display: flex; gap: 2px; padding: 4px 6px 8px; margin-top: auto; }
.file-name { font-size: var(--fs-sm); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-thumb { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; background: var(--surface-2); overflow: hidden; color: var(--ink-2); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-thumb.large { width: 72px; height: 72px; }
.file-thumb-icon { flex-direction: column; gap: 2px; font-size: 10px; font-weight: 650; letter-spacing: 0.03em; text-decoration: none; }
.file-picker { display: flex; flex-direction: column; gap: 8px; }
.file-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; }
.file-pick { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.file-pick.on { background: var(--accent-wash); }
.file-pick input { width: auto; margin: 0; }
.attached { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attached-file { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 10px; color: inherit; text-decoration: none; }
.attached-file .file-thumb { width: 32px; height: 32px; }

/* comment threads (Feedback, review items, change requests) */
.thread { display: flex; flex-direction: column; }
.thread-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.comment { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); max-width: 92%; align-self: flex-start; }
.comment.mine { align-self: flex-end; background: var(--accent-wash); }
.comment.internal { background: transparent; border: 1px dashed var(--border); }
.comment.resolved .comment-body { color: var(--muted); }
.comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.comment-who { font-weight: 600; font-size: var(--fs-sm); }
.comment-lock { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--ink-2); }
.comment-lock .icon { width: 12px; height: 12px; }
.comment-body { font-size: var(--fs-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.comment-actions:empty { display: none; }
.comment-done { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.comment-done input { width: auto; margin: 0; }
.thread.compact { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--grid); }
.thread-reply { display: flex; flex-direction: column; gap: 8px; }
.thread-reply-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* change requests */
.change-req + .change-req { border-top: 1px solid var(--grid); }
.change-req .list-row { border-bottom: 0; }
.change-detail { margin: -4px 0 10px; font-size: var(--fs-md); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Reviews tab */
.review-group { display: flex; flex-direction: column; gap: 12px; }
.review-group-title { font-size: var(--fs-sm); font-weight: 650; margin: 6px 0 0; }
.round-card .card-head { align-items: flex-start; flex-wrap: wrap; }
.round-chips { flex-wrap: wrap; }
.round-note { margin: 0 0 12px; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.round-items { display: flex; flex-direction: column; gap: 12px; }
.round-item { padding-bottom: 12px; border-bottom: 1px solid var(--grid); }
.round-item-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.round-item-main .cell-sub a { color: var(--accent-ink); word-break: break-all; }
.decision { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.decision.ok { background: rgba(12, 163, 12, 0.08); }
.decision.changes { background: rgba(224, 105, 63, 0.1); }
.decision-note { margin: 6px 0; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.to-address { margin-top: 12px; }
.round-thread { margin-top: 12px; font-size: var(--fs-sm); }
.round-thread summary { cursor: pointer; color: var(--ink-2); }
.round-card .btn-row { margin-top: 14px; }
.item-titles { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.item-title-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; align-items: center; }
.item-title-row .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item { margin-bottom: 6px; }

/* checklists: "Feedback to address" and "What we need from you" */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.check-item { padding: 6px 0; border-bottom: 1px solid var(--grid); position: relative; }
.check-item:last-child { border-bottom: 0; }
.check-item > label { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-md); cursor: pointer; }
.needs-card .needs-list .check-item > label { padding-right: 76px; }
.check-item > label input { width: auto; margin: 3px 0 0; flex: none; }
.check-item.done > label > span > span:first-child, .check-item.done .comment-body { text-decoration: line-through; color: var(--muted); }
.needs-card .need-actions { position: absolute; top: 2px; right: 0; display: flex; align-items: center; gap: 2px; }
.needs-card .need-note { margin: 4px 0 0 26px; font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.needs-card .attached { margin-left: 26px; }
.needs-card .need-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.needs-card .need-form input { flex: 1 1 220px; min-width: 0; }
.needs-card .need-form select { flex: 0 1 180px; }
.needs-card .need-form .notice { flex-basis: 100%; }

/* Updates tab */
.update-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.update-card .card-head { margin-bottom: 8px; align-items: flex-start; }
.update-title { margin: 0; font-size: var(--fs-md); font-weight: 650; overflow-wrap: anywhere; }
.update-body { font-size: var(--fs-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.update-card .btn-row { margin-top: 10px; }
.update-editor { margin-top: 14px; border-top: 1px solid var(--grid); padding-top: 14px; }

/* Build tab: Edit plan and the second-opinion switch */
.build-plan-edit { margin-top: 4px; }
.build-plan-text { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: var(--fs-sm); line-height: 1.5; }
.build-plan-when { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 560px) {
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .comment { max-width: 100%; }
  .upload-queue li { grid-template-columns: minmax(0, 1fr) auto; }
  .upload-queue li > :last-child { grid-column: 1 / -1; }
  .item-title-row { grid-template-columns: 1fr; gap: 2px; }
  .round-item-main .file-thumb.large { width: 56px; height: 56px; }
  .files-tab .card-head { flex-wrap: wrap; }
}

/* Final slice: care plans, packages, apps, the assistant, build costs and margins */
.check-line { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.check-line input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.care-mrr { font-size: var(--fs-md); }
.care-card .kv { margin-bottom: 4px; }
.care-drafts { margin: 8px 0; }
.care-form select, .care-form input { max-width: 100%; }
.apps-list .app-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.app-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.app-copy a { overflow-wrap: anywhere; }
.app-alerts { border-color: var(--critical-ink); }
.app-alerts .cell-title .chip { margin-right: 6px; }
.build-app-down { margin-bottom: 0; }
.build-app .kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.build-costs .card-head strong { font-size: var(--fs-md); }
.build-proposal-note { margin-top: 12px; align-items: center; gap: 10px; flex-wrap: wrap; }
.assistant-try { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; font-size: var(--fs-sm); font-family: inherit; }
.assistant-key-status.ok { color: var(--good-ink); }
.margins-card .card-foot { padding: 10px 14px 0; }
.p-care-price { font-weight: 650; }
.p-care-includes { margin: 6px 0; font-size: var(--fs-md); }
@media (max-width: 720px) {
  .apps-list .app-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- Settings: the section list beside one section at a time ----------
   Desktop: a sticky list on the left, the chosen section on the right. Below 900px the list is its own screen
   (#settings) and a section opens on its own (#settings/<id>) with a Back to Settings link. Inside a section, groups
   are split by whitespace and a hairline, never a card per group. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.settings { gap: 18px; --placeholder: color-mix(in srgb, var(--ink-2) 62%, var(--muted)); }
.settings input::placeholder, .settings textarea::placeholder { color: var(--placeholder); }
.settings-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.settings-nav ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-nav-heading { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); padding: 0 10px; }
.settings-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-xs); color: var(--ink); text-decoration: none; font-weight: 500; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.settings-nav-item .icon { display: none; color: var(--ink-2); width: 16px; height: 16px; }
.settings-nav-item:hover { background: var(--surface-2); }
.settings-nav-item.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; }
.settings-version { font-size: var(--fs-sm); color: var(--ink-2); padding: 0 10px; line-height: 1.45; }
.settings-pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 32px 6px; min-width: 0; max-width: 840px; }
.settings-back { display: none; }
.settings-pane-head h2 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.settings-pane-head h2:focus { outline: none; }
.settings-pane-head p { margin-top: 6px; color: var(--ink-2); max-width: 64ch; }
.settings-parts { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--grid); margin-top: 18px; }
.settings-part { display: inline-flex; align-items: center; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); font-weight: 550; text-decoration: none; white-space: nowrap; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.settings-part:hover { color: var(--ink); }
.settings-part.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 650; }
.settings-body { margin-top: 18px; }
.sgroup { display: flex; flex-direction: column; gap: 14px; padding: 22px 0 24px; border-top: 1px solid var(--grid); min-width: 0; }
.settings-parts + .settings-body { margin-top: 0; }
.settings-parts + .settings-body > .sgroup:first-child { border-top: 0; }
.sgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sgroup-head h3 { font-size: var(--fs-md); font-weight: 650; }
.sgroup-intro { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; max-width: 68ch; }
.sgroup-head + .sgroup-intro { margin-top: -8px; }
.sgroup-body { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sfield { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sfield-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sfield-label { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.sfield-hint { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.45; max-width: 68ch; }
.sfield-error { font-size: var(--fs-sm); color: var(--critical-ink); font-weight: 550; line-height: 1.45; max-width: 68ch; }
.sfield.has-error input, .sfield.has-error textarea { border-color: var(--critical); }
.save-note { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 550; color: var(--good-ink); animation: fadein var(--fast) var(--ease); }
.save-note .icon { width: 14px; height: 14px; }
.save-note.saving { color: var(--ink-2); }
.settings .w-num { width: 88px; }
.settings .w-price { width: 120px; }
.settings .w-time { width: 140px; }
.settings .w-sm { max-width: 240px; }
.settings .w-md { max-width: 400px; }
.settings .w-lg { max-width: 620px; }
.input-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-inline > input { flex: none; }
.input-prefix, .input-suffix { color: var(--ink-2); font-size: var(--fs-sm); }
.key-row { flex-wrap: wrap; }
.key-row > input { flex: 1 1 240px; }
.key-status { font-size: var(--fs-sm); color: var(--ink-2); }
.key-status.ok { color: var(--good-ink); }
.status-loading { color: var(--ink-2); font-size: var(--fs-sm); }
.status-problem { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.soft-text { color: var(--ink-2); font-size: var(--fs-sm); }
.empty-line { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); }
.empty-line .link { margin-left: 4px; }
.settings .btn-row.tight { margin-top: 0; }
.settings .notice p + p { margin-top: 6px; }
.settings .toggle-row { align-items: flex-start; }
.settings .toggle-row input.switch { margin-top: 1px; }
.toggle-list > .toggle-row:last-of-type { border-bottom: 0; }
.toggle-list > .toggle-row:first-child { padding-top: 0; }
.toggle-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.toggle-hint { display: block; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.45; margin-top: 2px; font-weight: 400; }
.toggle-extra { flex: none; }
.radio-list { display: flex; flex-direction: column; }
.radio-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.radio-row:first-child { padding-top: 0; }
.radio-row:last-child { border-bottom: 0; }
.radio-row input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
.radio-row .badge { margin-left: 4px; vertical-align: 1px; }
.settings .seg { flex-wrap: wrap; }
.swatch-indigo { background: #4b56d2; }
.swatch-teal { background: #0f7c80; }
.swatch-rose { background: #b8336a; }
.swatch-blue { background: #146ef5; }
.settings-kv { grid-template-columns: 110px minmax(0, 1fr); }
.settings-kv dt { color: var(--ink-2); }
.care-mrr { padding-bottom: 16px; }
.settings .public-spend { padding-top: 0; }
.settings .builder-status { padding-top: 0; }

/* Editors: one row per item, labels above the first row's fields (every row's on phones and for packages) */
.editor { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.editor-label { font-size: var(--fs-sm); font-weight: 600; }
.editor-actions { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.editor-actions.spread { justify-content: space-between; }
.guide-check { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; font-size: var(--fs-sm); color: var(--ink); white-space: nowrap; cursor: pointer; }
.guide-check input { width: 17px; height: 17px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.guide-top.plan-top { grid-template-columns: 150px 112px 84px auto minmax(0, 1fr); }
.guide-top.care-top { grid-template-columns: minmax(0, 1fr) 120px auto auto auto; }
.guide-top.care-top > .guide-name, .guide-top.package-top > .guide-name { grid-column: auto; }
.guide-top.package-top { grid-template-columns: minmax(0, 1fr) 140px auto; }
.guide-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.guide-pair select { height: 34px; }
.guide-list.labels-every .guide-row { gap: 10px; padding: 16px 0; }
.guide-list.labels-every .guide-row .guide-top .guide-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
.package-list .guide-check { white-space: normal; align-items: flex-start; }
.package-list .guide-check input { margin-top: 2px; }
.package-list textarea { min-height: calc(2lh + 20px); }
.list-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--grid); max-width: 680px; }
.list-edit-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.list-edit-num { color: var(--ink-2); font-size: var(--fs-sm); text-align: right; font-variant-numeric: tabular-nums; }
.list-edit-row textarea { min-height: 36px; height: auto; padding: 7px 12px; resize: none; field-sizing: content; max-height: none; }
.public-url { font-size: var(--fs-md); color: var(--ink); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; overflow-wrap: anywhere; max-width: 620px; user-select: all; }
.list-editor { display: flex; flex-direction: column; gap: 10px; }

/* The one save bar: stays at the bottom of the screen while the section has unsaved changes */
.save-bar { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 4px -32px 0; padding: 12px 32px; background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.07); border-radius: 0 0 var(--radius) var(--radius); }
.save-bar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.save-bar-problem { color: var(--critical-ink); font-size: var(--fs-sm); font-weight: 550; line-height: 1.45; }
.save-bar-actions { display: flex; gap: 8px; margin-left: auto; }
body:has(.save-bar) .toasts { bottom: 96px; }
/* The floating New button would sit on top of Save on phones; it steps aside while there are unsaved changes */
body:has(.save-bar) .fab { display: none; }

/* A greyed-out button still shows why on hover */
.settings .btn:disabled { pointer-events: auto; cursor: not-allowed; }
.settings .btn:disabled:active { transform: none; }
.settings .btn:not(.btn-primary):not(.btn-ghost):disabled:hover { background: var(--surface); }
.settings .btn-ghost:disabled:hover { background: transparent; }
.settings .btn-primary:disabled:hover { background: var(--accent); }

@media (max-width: 899px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .settings-nav { position: static; gap: 22px; }
  .settings-open .settings-nav { display: none; }
  .settings-index .settings-pane { display: none; }
  .settings-open .settings-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .settings-back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: -8px 0 6px; color: var(--accent-ink); font-weight: 600; text-decoration: none; }
  .settings-back .icon { width: 17px; height: 17px; }
  .settings-nav-heading { padding: 0 4px; }
  .settings-nav ul { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; gap: 0; }
  .settings-nav li + li .settings-nav-item { border-top: 1px solid var(--grid); }
  .settings-nav-item { min-height: 50px; padding: 10px 14px 10px 16px; border-radius: 0; }
  .settings-nav-item .icon { display: block; }
  .settings-index .settings-nav-item.active { background: transparent; color: var(--ink); font-weight: 500; }
  .settings-version { padding: 0 4px; }
}
@media (max-width: 720px) {
  .settings-pane { padding: 20px 16px 4px; }
  .save-bar { margin: 4px -16px 0; padding: 12px 16px; }
  .save-bar-actions { flex: 1 1 auto; justify-content: flex-end; }
  body:has(.save-bar) .toasts { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .guide-top.plan-top, .guide-top.care-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* Phones: group (or kind) on its own line, then the two numbers, then the checkbox beside Remove */
  .guide-top > .guide-field:has(> .guide-group), .guide-top.plan-top > .guide-field:nth-child(2) { grid-column: 1 / -1; }
  .guide-top.package-top { grid-template-columns: minmax(0, 1fr) auto; }
  .guide-top.package-top > .guide-name, .guide-top.care-top > .guide-name { grid-column: 1 / -1; }
  .guide-pair { grid-template-columns: minmax(0, 1fr); }
  .settings-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .settings-kv dd + dt { margin-top: 10px; }
}
@media (max-width: 560px) {
  .settings-parts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; border-bottom: 0; }
  .settings-part { justify-content: center; text-align: center; white-space: normal; margin: 0; padding: 9px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
  .settings-part.active { border-color: var(--accent); background: var(--accent-wash); }
  .settings-parts + .settings-body > .sgroup:first-child { padding-top: 18px; }
}
@media (pointer: coarse) {
  .btn, .btn-sm, .btn-icon, .seg-item, .filter-chip, .tab, .menu-item, .back, .row-link { min-height: 44px; }
  .btn-icon { min-width: 44px; }
  .settings .btn, .settings .btn-icon, .settings .seg-item, .settings .swatch, .settings-part, .settings-nav-item { min-height: 44px; }
  .settings .btn-icon { min-width: 44px; }
  .settings input:not([type="checkbox"]):not([type="radio"]), .settings select { min-height: 44px; }
  .settings .guide-check, .settings .toggle-row, .settings .radio-row { min-height: 44px; }
  .settings .link { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ==========================================================================
   Part A: navigation, Work (leads and projects) and Today
   Owned by the navigation and Today pages (app.js, pages/work.js, work-row.js, leads.js, projects.js, today.js).
   Text first, hairlines between rows, no cards inside cards, one reading column (about 760px of content).
   ========================================================================== */

/* Sidebar: the quieter group (Assistant, Settings) sits under a hairline in lighter text. */
.nav-sep { height: 1px; background: var(--grid); margin: var(--space-2) var(--space-3); }
.nav-item.quiet { color: var(--ink-2); font-size: var(--fs-sm); height: 36px; }
.nav-item.quiet .icon { width: 17px; height: 17px; }

/* One reading column for Today, the Work list and the "later" pages. */
.page.today, .page.work-page:not(.wide), .page.later-page { max-width: 840px; }
.later-text { color: var(--ink-2); max-width: 64ch; }

/* ---------- Work ---------- */
.work-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.work-body { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.work-tools .count { color: var(--ink-2); font-size: var(--fs-sm); }
.work-hint, .work-empty { color: var(--ink-2); font-size: var(--fs-sm); }
.work-empty .link { margin-left: var(--space-1); }

.work-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid); }
.work-row { border-bottom: 1px solid var(--grid); }
.work-row-link, .work-row-head {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.7fr) minmax(0, 1.5fr) minmax(0, 0.85fr);
  gap: var(--space-2) var(--space-4); align-items: start;
}
.work-row-head { padding: var(--space-2) var(--space-2); font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.work-row.work-row-head { display: grid; }
.work-row-link { padding: var(--space-3) var(--space-2); min-height: 44px; color: var(--ink); text-decoration: none; border-radius: var(--radius-xs); transition: background var(--fast) var(--ease); }
.work-row-link:hover { background: var(--surface-2); }
.work-row.inactive .work-row-link { color: var(--ink-2); }
.work-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.work-client { font-size: var(--fs-md); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.work-project, .work-notes { overflow-wrap: anywhere; }
.work-stage, .work-wait { color: var(--ink); }
.work-step { color: var(--ink); overflow-wrap: anywhere; }
.work-due.late { color: var(--critical-ink); font-weight: 600; }
.work-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Board cards on Work: flat, text first. */
.work-page .pcard { box-shadow: none; }
.work-page .pcard:hover { box-shadow: none; border-color: var(--border-strong); }
.pcard-head { min-width: 0; }
.pcard-next { font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }
.pcard-due { color: var(--ink-2); white-space: nowrap; }
.pcard-due.late { color: var(--critical-ink); font-weight: 600; }
.pcard-foot { display: flex; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-2); }
.pcard-client { color: var(--ink-2); font-size: var(--fs-sm); }

/* ---------- Today ---------- */
.today { gap: var(--space-6); }
.today-head { display: flex; flex-direction: column; gap: var(--space-2); }
.today-summary { color: var(--ink-2); max-width: 64ch; }
.today-date { color: var(--ink); font-weight: 600; }
.today-note, .today-clear { color: var(--ink-2); }
.today-section { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.today-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.today-section-head .count { color: var(--ink-2); font-weight: 500; margin-left: var(--space-1); }

.today .needs-list, .today .coming-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid); }
.today .need-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--grid); min-height: 44px; }
.today .need-row.open { flex-wrap: wrap; }
.today .need-main { flex: 1 1 260px; min-width: 0; }
.today .need-title { font-weight: 600; overflow-wrap: anywhere; }
.today .need-sub { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.today .need-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.today .need-note { font-size: var(--fs-sm); color: var(--ink-2); }
.today .need-form { flex-basis: 100%; min-width: 0; }
.today .need-form .whats-next { margin: 0; }
.today .need-send { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
/* Only the most urgent row's button is filled; the rest stay quiet so the list isn't a column of blue. */
.today .needs-list > .need-row:not(:first-child) .btn-primary { background: var(--surface); border-color: var(--border-strong); color: var(--accent-ink); }
.today .needs-list > .need-row:not(:first-child) .btn-primary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.part-jumps { display: flex; flex-wrap: wrap; gap: var(--space-1); }
@media (pointer: coarse) { .part-jumps .btn { min-height: 44px; } }

.coming-list li { border-bottom: 1px solid var(--grid); }
.coming-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: var(--space-4); width: 100%; min-height: 44px; padding: var(--space-3) var(--space-2); border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background var(--fast) var(--ease); }
.coming-row:hover { background: var(--surface-2); }
.coming-when { font-weight: 600; display: flex; flex-direction: column; }
.coming-time { font-weight: 400; font-size: var(--fs-sm); color: var(--ink-2); }
.coming-what { display: flex; flex-direction: column; min-width: 0; }
.coming-title { overflow-wrap: anywhere; }
.coming-sub { font-size: var(--fs-sm); color: var(--ink-2); }
.coming-all { align-self: flex-start; min-height: 36px; }

/* Phones: rows stack, each cell says what it is, and every control is a 44px target. */
@media (max-width: 720px) {
  .work-row-head { display: none !important; }
  .work-row-link { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .work-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; color: var(--ink-2); white-space: pre; }
  .work-stage, .work-wait { flex-direction: row; flex-wrap: wrap; }
  .work-bar .seg { width: 100%; }
  .work-bar .seg-item { flex: 1; min-height: 44px; }
  .today .need-row { flex-wrap: wrap; }
  .today .need-actions { flex-wrap: wrap; }
  .today .need-actions .btn, .today .need-send .btn, .today .link { min-height: 44px; }
  .today .link { display: inline-flex; align-items: center; }
  .coming-row { grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-3); }
}
@media (pointer: coarse) {
  .today .need-actions .btn, .today .need-send .btn, .work-bar .seg-item, .work-tools .seg-item { min-height: 44px; }
}
/* ---------- end of Part A ---------- */

/* ---------- the Review screen and Send step (docs/HANDS-OFF.md; pages/project-review.js) ----------
   One screen, four parts in reading order: plan, proposal, checklist, reply. Two columns on wide screens, one on
   phones. Parts are split by hairlines, not cards. A line still waiting for its price carries a warning edge. */
.review { display: flex; flex-direction: column; gap: var(--space-5); }
.review-intro, .review-hint, .review-reason { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.review-note { margin: 0; padding: var(--space-2) var(--space-3); border-left: 3px solid var(--warning); color: var(--ink-2); }
.review-empty, .review-done { margin: 0; }
.review-questions h2 { font-size: var(--fs-md); margin: 0 0 var(--space-2); }
.review-questions ul { margin: 0; padding-left: var(--space-5); }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5) var(--space-6); }
@media (min-width: 1100px) { .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.review-part { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; padding-top: var(--space-4); border-top: 1px solid var(--border); }
.review-part-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 32px; }
.review-part-head h2 { margin: 0; }
.review-part textarea, .review-field input { width: 100%; }
.review-plan { font: var(--fs-sm)/1.55 ui-monospace, Consolas, "Cascadia Mono", monospace; }
.review-field { display: flex; flex-direction: column; gap: var(--space-1); }
.review-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.review-line { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0 var(--space-2) var(--space-3); border-left: 3px solid transparent; border-bottom: 1px solid var(--border); }
.review-line.needs-price { border-left-color: var(--warning); }
.review-line-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review-line-detail { color: var(--muted); font-size: var(--fs-sm); }
.review-line-tag { font-size: var(--fs-sm); color: var(--ink-2); }
.review-line-tag.set-price { color: var(--warning-ink); font-weight: 600; }
.review-line-price { flex: none; }
.review-line-price.input-inline { flex-wrap: nowrap; gap: var(--space-1); }
.review-line-price input { width: 112px; text-align: right; }
.review-suggested { display: flex; flex-direction: column; gap: var(--space-2); }
.review-suggested p { margin: 0; }
.review-suggested .btn-row { margin: 0; }
.review-total { margin: 0; text-align: right; }
.review-approve { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--border-strong); }
.review-approve .review-reason { flex: 1 1 280px; }
.review-problem { flex-basis: 100%; margin: 0; color: var(--critical-ink); }
.review-send { max-width: 720px; gap: var(--space-3); }
.review-send-title { margin: 0; }
.review-subject { margin: 0; }
.review-send textarea { width: 100%; }
@media (max-width: 720px) {
  .review-line { flex-direction: column; }
  .review-approve { justify-content: stretch; }
  .review-approve .btn, .review-send-actions .btn, .review-part-head .btn { min-height: 44px; }
  .review-approve .btn { flex: 1 1 100%; }
}
/* The Review screen ends in its own single action (Approve, or Open email on the Send step): the + button steps aside. */
body:has(.review) .fab { display: none; }
/* ---------- end of the Review screen ---------- */
