/* Classess CRM — stone, steel and frost. Graphite carries the actions, frosted glass carries the chrome,
   and a brass mark shows everything the AI did. No blue anywhere: every colour below is a stone or a metal. */

:root {
  --paper: #e7e7e3;          /* limestone page under the frost */
  --surface: #fbfbfa;        /* solid panels: tables, inputs, dense lists */
  --surface-2: #efefec;      /* hovers, wells */
  --line: #d8d8d3;           /* hairlines */
  --line-strong: #c3c3bd;
  --field-line: #8b8d92;     /* input and control edges: >= 3:1 on surface */
  --text: #191b1f;
  --muted: #4b5058;
  --faint: #5b6068;          /* >= 4.5:1 on paper, surface and glass */
  --ink: #23262b;            /* graphite: primary actions, active nav, the assistant's voice */
  --ink-strong: #3b4047;     /* graphite hover, today's bar */
  --ink-wash: #e2e3e1;       /* a cool stone tint for chips, icons, the caller's bubble */
  --on-ink: #ffffff;
  --steel: #5d6670;          /* charts and meters */
  --bar: #6f7882;
  --brass: #a8854a;          /* AI marks */
  --brass-ink: #66501f;      /* AI text */
  --brass-wash: #efe9dc;
  --sage: #3b684e;           /* good */
  --sage-wash: #e1eae3;
  --clay: #a2433a;           /* danger, overdue */
  --clay-wash: #f4e4e0;
  --on-clay: #ffffff;
  --focus: #23262b;
  --focus-halo: #ffffff;
  /* glass: chrome and cards only; tables and inputs stay solid */
  --glass: rgb(250 250 249 / .64);
  --glass-strong: rgb(250 250 249 / .84);
  --glass-dense: rgb(249 249 248 / .94);   /* drawer, dialogs, Ask AI: dense text over moving content */
  --glass-line: rgb(25 27 31 / .09);
  --glass-hi: inset 0 1px 0 rgb(255 255 255 / .8);
  --blur: blur(22px) saturate(1.35);
  --scrim: rgb(24 26 30 / .34);
  --device: #212429;         /* the test console handset */
  --device-text: #eceef0;
  --device-muted: #a9aeb5;
  --rail: var(--glass);
  --rail-text: var(--text);
  --rail-muted: var(--muted);
  --backdrop:
    radial-gradient(1100px 760px at -8% -12%, #fafaf8 0%, rgb(250 250 248 / 0) 62%),
    radial-gradient(900px 640px at 108% 4%, #d9dad6 0%, rgb(217 218 214 / 0) 64%),
    radial-gradient(1200px 900px at 55% 118%, #f4f4f1 0%, rgb(244 244 241 / 0) 60%),
    linear-gradient(160deg, #ecece8, #e3e3df);
  --grain-opacity: .05;
  --shadow: 0 1px 1px rgb(20 22 26 / .04), 0 14px 34px -22px rgb(20 22 26 / .26);
  --shadow-lg: 0 2px 6px rgb(20 22 26 / .05), 0 42px 90px -36px rgb(20 22 26 / .42);
  --font-ui: "Instrument Sans", "Noto Sans Devanagari", "Noto Sans Telugu", "Noto Sans Tamil", "Noto Sans Kannada",
    "Noto Sans Bengali", "Noto Sans Gujarati", "Noto Sans Gurmukhi", "Noto Sans Malayalam", "Noto Sans Oriya", system-ui, sans-serif;
  --font-display: var(--font-ui);
  --w-display: 84%;          /* Instrument Sans' width axis: condensed steel for the big type */
  --r-xs: 2px;
  --r-sm: 3px;
  --r: 4px;
  --r-lg: 6px;               /* the most rounding anywhere */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111316; --surface: #1a1d21; --surface-2: #23272c;
    --line: #2c3137; --line-strong: #3a4047; --field-line: #767d86;
    --text: #eceef0; --muted: #b0b5bc; --faint: #989ea6;
    --ink: #d9dde2; --ink-strong: #f2f3f5; --ink-wash: #2a2e34; --on-ink: #15171a;
    --steel: #9aa3ad; --bar: #8c95a0;
    --brass: #c6a568; --brass-ink: #dcc28e; --brass-wash: #2e2a20;
    --sage: #8fc1a1; --sage-wash: #1b2a21; --clay: #e59f93; --clay-wash: #34201e; --on-clay: #15171a;
    --focus: #e8ebee; --focus-halo: #0b0c0e;
    --glass: rgb(31 34 39 / .56); --glass-strong: rgb(27 30 35 / .84); --glass-dense: rgb(26 29 33 / .95); --glass-line: rgb(255 255 255 / .08);
    --glass-hi: inset 0 1px 0 rgb(255 255 255 / .06);
    --scrim: rgb(0 0 0 / .56);
    --device: #0c0d0f; --device-text: #eceef0; --device-muted: #a3a9b0;
    --backdrop:
      radial-gradient(1100px 760px at -8% -12%, #24282e 0%, rgb(36 40 46 / 0) 62%),
      radial-gradient(900px 640px at 108% 4%, #1a1d22 0%, rgb(26 29 34 / 0) 64%),
      radial-gradient(1200px 900px at 55% 118%, #1d2025 0%, rgb(29 32 37 / 0) 60%),
      linear-gradient(160deg, #15171a, #0e1012);
    --grain-opacity: .07;
    --shadow: 0 1px 1px rgb(0 0 0 / .3), 0 14px 34px -22px rgb(0 0 0 / .6);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / .3), 0 42px 90px -36px rgb(0 0 0 / .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111316; --surface: #1a1d21; --surface-2: #23272c;
  --line: #2c3137; --line-strong: #3a4047; --field-line: #767d86;
  --text: #eceef0; --muted: #b0b5bc; --faint: #989ea6;
  --ink: #d9dde2; --ink-strong: #f2f3f5; --ink-wash: #2a2e34; --on-ink: #15171a;
  --steel: #9aa3ad; --bar: #8c95a0;
  --brass: #c6a568; --brass-ink: #dcc28e; --brass-wash: #2e2a20;
  --sage: #8fc1a1; --sage-wash: #1b2a21; --clay: #e59f93; --clay-wash: #34201e; --on-clay: #15171a;
  --focus: #e8ebee; --focus-halo: #0b0c0e;
  --glass: rgb(31 34 39 / .56); --glass-strong: rgb(27 30 35 / .84); --glass-dense: rgb(26 29 33 / .95); --glass-line: rgb(255 255 255 / .08);
  --glass-hi: inset 0 1px 0 rgb(255 255 255 / .06);
  --scrim: rgb(0 0 0 / .56);
  --device: #0c0d0f; --device-text: #eceef0; --device-muted: #a3a9b0;
  --backdrop:
    radial-gradient(1100px 760px at -8% -12%, #24282e 0%, rgb(36 40 46 / 0) 62%),
    radial-gradient(900px 640px at 108% 4%, #1a1d22 0%, rgb(26 29 34 / 0) 64%),
    radial-gradient(1200px 900px at 55% 118%, #1d2025 0%, rgb(29 32 37 / 0) 60%),
    linear-gradient(160deg, #15171a, #0e1012);
  --grain-opacity: .07;
  --shadow: 0 1px 1px rgb(0 0 0 / .3), 0 14px 34px -22px rgb(0 0 0 / .6);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / .3), 0 42px 90px -36px rgb(0 0 0 / .8);
  color-scheme: dark;
}
/* no backdrop-filter, or the viewer asked for less transparency: the same panels, solid */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root, :root[data-theme] { --glass: var(--surface); --glass-strong: var(--surface); --glass-dense: var(--surface); }
}
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-theme] { --glass: var(--surface); --glass-strong: var(--surface); --glass-dense: var(--surface); --scrim: rgb(0 0 0 / .6); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 400 15px/1.5 var(--font-ui); font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* the frost: a still stone-to-white field with a fine grain, fixed under every glass panel */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before { background: var(--backdrop); }
body::after { opacity: var(--grain-opacity); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] body::after { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::after { mix-blend-mode: screen; } }
/* glass recipe, shared by the rail, top bar, drawer, sheets, dialogs, Ask AI and cards */
.glass, .rail, .topbar, .tabbar, .drawer, .modal, .ask, .menu, .panel, .card, .sheet {
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -.005em; }
p { margin: 0; }
a { color: var(--text); text-decoration-color: var(--steel); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-halo); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: var(--r); color: var(--text); }
.skip:focus { top: 8px; }
.num, table, time, .stat-v, .n, .count { font-variant-numeric: tabular-nums; }
kbd, .kbd { font: 500 11px/1 var(--font-ui); padding: 3px 5px; border-radius: var(--r-xs); border: 1px solid currentColor; opacity: .7; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------------------------------------------------------- brand */
/* A text wordmark, no icon: CLASSESS in bold, CRM in regular weight, letter-spaced graphite. Uppercase comes from CSS
   so screen readers say "Classess CRM", not letters. */
.brand { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }
.brand-lg { font-size: 26px; letter-spacing: .18em; margin: 0; }

/* ---------------------------------------------------------- buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 6px 14px; border-radius: var(--r); border: 1px solid var(--field-line);
  background: var(--surface); color: var(--text); font-weight: 550; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); box-shadow: inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); }
.btn-ai { background: var(--brass-wash); border-color: var(--brass); color: var(--brass-ink); }
.btn-ai:hover { background: color-mix(in srgb, var(--brass) 26%, var(--surface)); }
.btn-danger { color: var(--clay); border-color: var(--clay); }
.btn-danger-solid { background: var(--clay); border-color: var(--clay); color: var(--on-clay); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 14px; border-radius: var(--r); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r);
  border: 1px solid transparent; background: transparent; color: inherit; text-decoration: none; font-weight: 600;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }

.field { display: grid; gap: 4px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.field-label svg { width: 13px; height: 13px; }
input[type="text"], input[type="search"], input[type="password"], input[type="tel"], input[type="email"],
input[type="datetime-local"], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 11px; border-radius: var(--r);
  border: 1px solid var(--field-line); background: var(--surface); color: var(--text); font-size: 15px;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; box-shadow: 0 0 0 4px var(--focus-halo); }
.form-error { color: var(--clay); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.notice { padding: 10px 12px; border-radius: var(--r); font-size: 14.5px; }
.notice-warn { background: var(--brass-wash); color: var(--brass-ink); }
.notice-info { background: var(--ink-wash); color: var(--text); border-left: 2px solid var(--steel); }

/* ---------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; background: var(--glass-strong); border: 1px solid var(--glass-line); padding: 32px 28px; border-radius: var(--r-lg);
  box-shadow: var(--glass-hi), var(--shadow-lg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.login-title { font-size: 34px; font-stretch: var(--w-display); font-weight: 700; letter-spacing: -.02em; }
.login-sub { color: var(--muted); }

/* ---------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px 16px; overflow-y: auto;
  background: var(--rail); color: var(--rail-text); border-right: 1px solid var(--glass-line); box-shadow: var(--glass-hi); }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r); color: var(--rail-muted); text-decoration: none; font-weight: 550; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { color: var(--rail-text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav a[aria-current="page"] { color: var(--on-ink); background: var(--ink); box-shadow: inset 0 1px 0 rgb(255 255 255 / .1), 0 6px 14px -8px rgb(20 22 26 / .5); }
.nav .badge { margin-left: auto; font-size: 12px; font-weight: 600; min-width: 20px; padding: 0 6px; border-radius: var(--r-sm); background: var(--clay); color: var(--on-clay); text-align: center; line-height: 20px; }
.rail-foot { margin-top: auto; display: grid; gap: 12px; }
.rail-foot .btn-ai .kbd { margin-left: auto; opacity: 1; }
.rail-line { font-size: 13px; color: var(--rail-muted); padding: 0 6px; }
.rail-line a { color: var(--rail-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rail-line .rail-l { display: block; line-height: 1.5; }
.rail-line .rail-num { display: flex; align-items: center; gap: 6px; }
.rail-line .rail-num.is-default a { font-weight: 700; }
.rail-line .rail-def { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; line-height: 16px; padding: 0 5px; border-radius: var(--r-sm); color: var(--rail-text); box-shadow: inset 0 0 0 1px currentColor; opacity: .8; }
.rail-line a.rail-change { color: var(--rail-muted); white-space: nowrap; }
.rail-tools { display: flex; gap: 2px; }
.rail-tools .icon-btn { color: var(--rail-muted); }
.rail-tools .icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 26%, transparent); flex: none; }

.topbar { display: none; }
.tabbar { display: none; }
.main { min-width: 0; padding: 32px clamp(16px, 3.4vw, 44px) 64px; outline: none; }
.view { max-width: 1240px; margin: 0 auto; display: grid; gap: 28px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 10px 12px 10px 16px;
    background: var(--glass-strong); border-bottom: 1px solid var(--glass-line); box-shadow: var(--glass-hi); }
  .topbar-gap { flex: 1; }
  .main { padding: 20px 16px calc(92px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 25;
    background: var(--glass-strong); border-top: 1px solid var(--glass-line); box-shadow: var(--glass-hi); padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 1px; padding: 6px 0 4px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500; border-radius: var(--r); position: relative; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a[aria-current="page"] { color: var(--text); font-weight: 650; }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -4px; width: 26px; height: 3px; border-radius: 0 0 var(--r-xs) var(--r-xs); background: var(--ink); }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); font-size: 10px; min-width: 16px; line-height: 16px; border-radius: var(--r-sm); background: var(--clay); color: var(--on-clay); text-align: center; padding: 0 4px; }
}

/* ---------------------------------------------------------- page heads */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(28px, 3.6vw, 40px); font-stretch: var(--w-display); font-weight: 700; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 19px; font-weight: 650; display: flex; align-items: baseline; gap: 10px; }
.section-title .count { font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--faint); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a, .link-btn { font-size: 14px; font-weight: 500; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: none; }
.section-head a:hover, .link-btn:hover { text-decoration: underline; }
.panel { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 20px; min-width: 0; box-shadow: var(--glass-hi), var(--shadow); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }

/* ---------------------------------------------------------- dashboard */
.brief { display: grid; gap: 10px; padding: 8px 0 4px; }
.brief-greet { color: var(--muted); font-size: 16px; }
.brief-line { font-family: var(--font-display); font-stretch: var(--w-display); font-weight: 500; font-size: clamp(26px, 3.9vw, 46px); line-height: 1.12; letter-spacing: -.02em; max-width: 26ch; text-wrap: balance; }
.brief-line a { color: inherit; text-decoration: none; font-weight: 700; box-shadow: inset 0 -.1em 0 var(--steel); }
.brief-line a:hover { box-shadow: inset 0 -.3em 0 color-mix(in srgb, var(--steel) 40%, transparent); }
.brief-line a.warn { color: var(--clay); box-shadow: inset 0 -.1em 0 var(--clay); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 36px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { display: grid; gap: 0; min-width: 96px; }
.stat-v { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 13.5px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dash-col { display: grid; gap: 28px; min-width: 0; }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--faint); font: 400 11.5px var(--font-ui); }
.chart .bar { fill: var(--bar); }
.chart .bar.today { fill: var(--ink-strong); }
.chart .bar.zero { fill: var(--line-strong); }
.chart .hit { fill: transparent; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: .78; }
.chart .val { fill: var(--text); font: 600 12px var(--font-ui); }
.tip { position: absolute; pointer-events: none; transform: translate(-50%, -100%); background: var(--ink); color: var(--on-ink);
  padding: 5px 9px; border-radius: var(--r-sm); font-size: 13px; white-space: nowrap; box-shadow: var(--shadow); }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }

/* follow-up rows */
.fu { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 2px; }
.fu-check { width: 24px; height: 24px; border-radius: var(--r-sm); border: 1.5px solid var(--field-line); background: var(--surface); display: grid; place-items: center; padding: 0; color: transparent; }
.fu-check svg { width: 14px; height: 14px; }
.fu-check:hover { border-color: var(--sage); color: var(--sage); }
.fu-check.done { background: var(--sage); border-color: var(--sage); color: var(--paper); }
.fu-title { font-weight: 500; overflow-wrap: anywhere; }
.fu.is-done .fu-title { text-decoration: line-through; color: var(--muted); }
.fu-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13.5px; color: var(--muted); align-items: center; }
.fu-meta svg { width: 14px; height: 14px; vertical-align: -2px; }
.fu-meta .who { color: var(--text); font-weight: 500; text-decoration: none; }
.fu-meta .who:hover { text-decoration: underline; }
.fu-actions { display: flex; gap: 2px; align-items: center; }
.due-over { color: var(--clay); font-weight: 600; }
.due-soon { color: var(--text); font-weight: 500; }
.prio { display: inline-flex; align-items: center; gap: 5px; }
.prio::before { content: ""; width: 7px; height: 7px; border-radius: var(--r-xs); background: var(--faint); }
.prio-high::before { background: var(--clay); }
.prio-medium::before { background: var(--steel); }
.prio-low::before { background: var(--line-strong); }

/* who badges */
.by { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 1px 8px 1px 6px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.by::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.by-ai { background: var(--brass-wash); color: var(--brass-ink); }
.by-vidya { background: var(--ink-wash); color: var(--text); }
.by-human { background: var(--sage-wash); color: var(--sage); }

/* hot leads */
.lead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 2px; text-decoration: none; color: inherit; border-radius: var(--r); }
.lead:hover .lead-name { text-decoration: underline; }
.lead-main { display: grid; gap: 2px; min-width: 0; }
.lead-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.lead-name { font-weight: 600; }
.lead-sub { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--ink-wash); color: var(--text); font-family: var(--font-display); font-weight: 650; font-size: 14px; letter-spacing: .01em; box-shadow: inset 0 0 0 1px var(--line); }
.avatar svg { width: 18px; height: 18px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

.score { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.score svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.score .track { stroke: var(--line); }
.score .arc { stroke: var(--steel); stroke-linecap: butt; }
.score.hot .arc { stroke: var(--sage); }
.score b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-lg { width: 54px; height: 54px; }
.score-lg b { font-size: 16px; }

/* stage pip: progress through the pipeline, not a colour code */
.pip { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.pip i { display: inline-flex; gap: 2px; }
.pip i b { width: 6px; height: 12px; border-radius: var(--r-xs); background: var(--line-strong); }
.pip i b.on { background: var(--ink); }
.pip.won i b { background: var(--sage); }
.pip.lost i b { background: transparent; box-shadow: inset 0 0 0 1.5px var(--clay); }
.pip.lost { color: var(--clay); }
.pip.won { color: var(--sage); }

.stage-bars { display: grid; gap: 10px; }
.stage-bar { display: grid; grid-template-columns: 112px minmax(0, 1fr) 32px; gap: 10px; align-items: center; text-decoration: none; color: inherit; font-size: 14.5px; }
.stage-bar:hover span:first-child { text-decoration: underline; }
.stage-bar .track { height: 10px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.stage-bar .fill { display: block; height: 100%; border-radius: var(--r-sm); background: var(--bar); }
.stage-bar .fill.won { background: var(--sage); }
.stage-bar .fill.lost { background: var(--clay); opacity: .7; }
.stage-bar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; min-height: 26px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); text-decoration: none; white-space: nowrap; }
a.chip:hover { border-color: var(--line-strong); }
.chip.ai { background: var(--brass-wash); border-color: color-mix(in srgb, var(--brass) 45%, transparent); color: var(--brass-ink); }
.chip.ai::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); }
.chip .x { display: grid; place-items: center; width: 20px; height: 20px; margin-right: -6px; border-radius: var(--r-xs); border: 0; background: transparent; color: inherit; padding: 0; }
.chip .x:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.chip .x svg { width: 12px; height: 12px; }
.chip .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip-more { color: var(--muted); font-size: 13px; align-self: center; }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 0; position: relative; }
.feed li::before { content: ""; position: absolute; left: 10px; top: 28px; bottom: -6px; width: 1.5px; background: var(--line); }
.feed li:last-child::before { display: none; }
.feed .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.feed .dot svg { width: 12px; height: 12px; }
.feed .ai .dot { background: var(--brass-wash); color: var(--brass-ink); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--brass) 55%, transparent); }
.feed .vidya .dot { background: var(--ink-wash); color: var(--ink); }
.feed .human .dot { background: var(--sage-wash); color: var(--sage); }
.feed .ai .feed-text { color: var(--text); }
.feed-text { overflow-wrap: anywhere; }
.feed-meta { font-size: 13px; color: var(--faint); }
.feed-meta a { color: var(--muted); font-weight: 500; text-decoration: none; }
.feed-meta a:hover { text-decoration: underline; }

/* empty states */
.empty { display: grid; justify-items: start; gap: 8px; padding: 28px 4px; color: var(--muted); max-width: 52ch; }
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); }
.empty.center { justify-items: center; text-align: center; margin: 0 auto; }
.empty.big { padding: 56px 16px; }

/* ---------------------------------------------------------- contacts */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { position: relative; flex: 1 1 260px; min-width: 0; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.toolbar .search input { padding-left: 36px; }
.toolbar select { width: auto; flex: 0 1 auto; min-width: 0; }
@media (max-width: 640px) { .toolbar select { flex: 1 1 calc(50% - 4px); } }
.result-count { font-size: 14px; color: var(--muted); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; }
.ctable { width: 100%; border-collapse: collapse; }
.ctable th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.ctable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ctable tbody tr:last-child td { border-bottom: 0; }
.ctable tbody tr { cursor: pointer; }
.ctable tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.who-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-cell a { color: var(--text); font-weight: 600; text-decoration: none; }
.who-cell a:hover { text-decoration: underline; }
.who-cell .ph { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctable td.c-who { min-width: 200px; }
.ctable td.c-tags { min-width: 150px; }
.ctable td.c-next { min-width: 200px; }
.ctable td.c-last { white-space: nowrap; font-size: 14px; color: var(--muted); }
.fu-count { display: block; font-size: 12.5px; color: var(--faint); }
.next-cell { max-width: 40ch; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pending-ai { display: inline-flex; align-items: center; gap: 6px; color: var(--brass-ink); font-size: 13.5px; }
.pending-ai::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brass); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }

@media (max-width: 860px) {
  .ctable thead { display: none; }
  .ctable, .ctable tbody, .ctable tr, .ctable td { display: block; }
  .ctable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .ctable tbody tr:last-child { border-bottom: 0; }
  .ctable td { padding: 0; border: 0; }
  .ctable td.c-who { grid-column: 1; }
  .ctable td.c-score { grid-column: 2; grid-row: 1; }
  .ctable td.c-stage, .ctable td.c-tags, .ctable td.c-next, .ctable td.c-last { grid-column: 1 / -1; }
  .ctable td.c-who, .ctable td.c-tags, .ctable td.c-next { min-width: 0; }
  .ctable td.c-last { font-size: 13px; color: var(--faint); display: flex; gap: 10px; }
  .fu-count { display: inline; }
  .next-cell { max-width: none; }
}

/* ---------------------------------------------------------- pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px;
  scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.col { display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--surface) 30%, transparent); border-radius: var(--r-lg); padding: 12px; min-height: 320px; scroll-snap-align: start; border: 1.5px dashed transparent; }
.col.drop { border-color: var(--steel); background: var(--ink-wash); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 4px; }
.col-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.col-head .n { font-family: var(--font-ui); font-size: 13.5px; color: var(--faint); font-weight: 500; }
.col-cards { display: grid; gap: 8px; align-content: start; flex: 1; }
.col-empty { font-size: 13.5px; color: var(--faint); padding: 8px 4px; }
.card { background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; cursor: grab; box-shadow: var(--glass-hi), var(--shadow); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.card-name:hover { text-decoration: underline; }
.card-ph { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-next { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .score { width: 34px; height: 34px; }
.card .score b { font-size: 12px; }

.menu { position: fixed; z-index: 70; min-width: 180px; background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: grid; }
.menu-label { font-size: 12.5px; color: var(--faint); padding: 4px 10px 6px; }
.menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r); display: flex; gap: 8px; align-items: center; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }

/* ---------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 10px 12px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--ink); font-weight: 600; }
.tab .n { font-size: 12.5px; font-weight: 600; padding: 0 7px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); line-height: 19px; }
.tab .n.warn { background: var(--clay-wash); color: var(--clay); }

/* ---------------------------------------------------------- calls */
.calls .row { display: grid; grid-template-columns: 34px minmax(0, 1.1fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 13px 16px; border: 0; background: none; border-bottom: 1px solid var(--line); color: inherit; }
.calls li:last-child .row { border-bottom: 0; }
.calls .row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.kind-ico { width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center; background: var(--ink-wash); color: var(--text); }
.kind-ico svg { width: 17px; height: 17px; }
.kind-ico.demo { background: var(--sage-wash); color: var(--sage); }
.kind-ico.callback { background: var(--brass-wash); color: var(--brass-ink); }
.row-name { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 13.5px; color: var(--muted); }
.row-sum { font-size: 14.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-when { font-size: 13.5px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .calls .row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .calls .row-sum { grid-column: 2 / -1; }
}

/* transcript */
.transcript { display: grid; gap: 10px; padding: 4px 0; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: var(--r-lg); overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble-who { font-size: 12px; font-weight: 600; color: var(--faint); margin-bottom: 2px; }
.msg-user { justify-self: start; }
.msg-user .bubble { background: var(--surface-2); border-bottom-left-radius: var(--r-sm); }
.msg-assistant { justify-self: end; display: grid; justify-items: end; }
.msg-assistant .bubble { background: var(--ink); color: var(--on-ink); border-bottom-right-radius: var(--r-xs); }
.msg-assistant .bubble-who { text-align: right; }
.bubble.tool { background: transparent !important; color: var(--faint) !important; border: 1px dashed var(--line-strong); font-size: 13.5px; }

/* ---------------------------------------------------------- insights */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 28px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 2px 10px; font-size: 14.5px; }
.hbar .lbl { overflow-wrap: anywhere; }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: var(--r-sm); background: var(--bar); }
.hbar .fill.positive { background: var(--sage); }
.hbar .fill.negative { background: var(--clay); }
.hbar .fill.neutral { background: var(--faint); }
.gap-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 16px 0; }
.gap-topic { font-weight: 600; font-size: 16.5px; }
.gap-count { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; line-height: 1; }
.gap-count small { display: block; font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; color: var(--faint); }
.gap-q { grid-column: 1 / -1; display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.gap-q li { color: var(--muted); padding-left: 12px; border-left: 2px solid var(--brass); font-size: 14.5px; overflow-wrap: anywhere; }
.gap-foot { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--faint); }
.digest { white-space: pre-wrap; font-size: 16px; line-height: 1.6; max-width: 70ch; overflow-wrap: anywhere; }
.digest-panel { border-left: 3px solid var(--brass); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); }

/* ---------------------------------------------------------- drawer */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 45; width: min(680px, 100vw); background: var(--glass-dense); border-left: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: .4; } }
.drawer-body { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.d-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--glass-dense); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--line); }
.d-bar .gap { flex: 1; }
.d-sec { padding: 20px 24px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.d-sec:last-child { border-bottom: 0; }
@media (max-width: 520px) { .d-sec { padding: 18px 16px; } }
.d-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.d-name { font-size: 26px; font-stretch: var(--w-display); font-weight: 700; letter-spacing: -.015em; overflow-wrap: anywhere; }
.d-phone { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-phone a { color: inherit; }
.d-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.d-row select { width: auto; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.d-score-reason { font-size: 14px; color: var(--muted); }
.ai-note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brass); border-radius: var(--r-xs) var(--r) var(--r) var(--r-xs); padding: 14px 16px; display: grid; gap: 10px; }
.ai-note-h { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--brass-ink); }
.ai-summary { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.ai-next { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-weight: 500; overflow-wrap: anywhere; }
.ai-next svg { width: 18px; height: 18px; color: var(--brass-ink); margin-top: 2px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; color: var(--muted); }
.facts b { color: var(--text); font-weight: 500; }
.lock-note { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--faint); }
.lock-note svg { width: 12px; height: 12px; }
.tag-add { display: flex; gap: 6px; max-width: 340px; }
.tag-add input { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.d-h { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.addfu { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.addfu .t { grid-column: 1 / -1; }
@media (max-width: 620px) { .addfu { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .addfu .due { grid-column: 1 / -1; } }
.tl { list-style: none; margin: 0; padding: 0; display: grid; }
.tl > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 0; position: relative; }
.tl > li::before { content: ""; position: absolute; left: 10px; top: 30px; bottom: -8px; width: 1.5px; background: var(--line); }
.tl > li:last-child::before { display: none; }
.tl .call-card { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; text-align: left; width: 100%; color: inherit; }
button.call-card:hover { border-color: var(--line-strong); }
.call-card .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.call-card .t span { font-weight: 400; font-size: 13.5px; color: var(--muted); }
.call-card .s { font-size: 14.5px; color: var(--muted); overflow-wrap: anywhere; }
.call-card .open { font-size: 13.5px; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--steel); text-underline-offset: 3px; }
.note-form { display: grid; gap: 8px; }
.note-form .form-actions { justify-content: flex-start; }
.d-loading { padding: 40px 24px; color: var(--muted); }

/* ---------------------------------------------------------- ask AI */
.ask { position: fixed; z-index: 50; right: 16px; bottom: 16px; top: 16px; width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column;
  background: var(--glass-dense); border: 1px solid var(--glass-line); border-radius: var(--r-lg); box-shadow: var(--glass-hi), var(--shadow-lg); overflow: hidden; animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(10px); opacity: .5; } }
@media (max-width: 600px) { .ask { inset: 0; width: 100vw; border-radius: 0; border: 0; } }
.ask-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.ask-title { font-size: 18px; display: flex; align-items: center; gap: 10px; flex: 1; }
.ask-log { flex: 1; overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.ask-intro { color: var(--muted); display: grid; gap: 12px; }
.ask-intro p { max-width: 40ch; }
.suggest { display: grid; gap: 6px; }
.suggest button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 9px 12px; color: var(--text); }
.suggest button:hover { border-color: var(--brass); }
.ask-msg { display: grid; gap: 8px; }
.ask-msg.user { justify-items: end; }
.ask-msg .b { padding: 9px 13px; border-radius: var(--r-lg); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.ask-msg.user .b { background: var(--ink-wash); border-bottom-right-radius: var(--r-xs); }
.ask-msg.assistant .b { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: var(--r-xs); }
.ask-msg.error .b { background: var(--clay-wash); color: var(--clay); }
.ask-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.thinking { display: inline-flex; gap: 4px; padding: 12px 14px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); animation: pulse 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
.ask-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: end; }
.ask-form textarea { min-height: 44px; max-height: 160px; resize: none; }
.ask-ctx { font-size: 13px; color: var(--muted); padding: 0 18px 8px; }

/* ---------------------------------------------------------- modal */
.modal { border: 1px solid var(--glass-line); padding: 0; border-radius: var(--r-lg); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--glass-dense); color: var(--text); box-shadow: var(--glass-hi), var(--shadow-lg); }
.modal::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-in { display: grid; gap: 16px; padding: 22px 24px 20px; }
.modal-in.wide { padding-bottom: 8px; }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 21px; font-weight: 650; overflow-wrap: anywhere; }
.modal-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.shortcuts dt { display: flex; gap: 4px; }
.shortcuts dd { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .modal { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; } .modal-in { padding: 18px 16px; } }

/* ---------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 900px) { .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--on-ink); padding: 11px 12px 11px 16px; border-radius: var(--r); box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.toast.error { background: var(--clay); color: var(--on-clay); }
.toast .msg { flex: 1; overflow-wrap: anywhere; }
.toast button { background: transparent; color: inherit; border: 1px solid currentColor; border-radius: var(--r); padding: 3px 10px; font-weight: 600; opacity: .9; }
.toast.new { border-left: 4px solid var(--brass); }

.skeleton { color: var(--faint); padding: 24px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .chip.ai::before, .ai-dot, .by::before { forced-color-adjust: none; }
  .bar, .fill { forced-color-adjust: none; }
}

/* ---------------------------------------------------------- small-screen fixes */
.view > *, .dash-col > * { min-width: 0; }
@media (max-width: 720px) {
  .calls .row-when { grid-row: 1; grid-column: 3; align-self: start; }
}
@media (max-width: 520px) {
  .fu { grid-template-columns: auto minmax(0, 1fr); }
  .fu-actions { grid-column: 2; margin-left: -8px; }
}
@media (max-width: 420px) {
  .hide-xs { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .d-bar { padding: 10px 12px; gap: 4px; }
}

/* ================================================================ v2: teaching Vidya
   Knowledge, Pitch, FAQ and the browser test console. Same ink/paper/marigold system;
   grades reuse it: leaf = good, slate = deflected, marigold = risky, madder = wrong. */
:root { --g-good: var(--sage); --g-deflected: var(--faint); --g-risky: var(--brass); --g-wrong: var(--clay); }

/* rail groups + mobile "more" */
.nav-group { font-size: 12.5px; font-weight: 600; color: var(--rail-muted); padding: 14px 10px 4px; margin-top: 6px; border-top: 1px solid var(--line); }
.nav .badge.soft { background: var(--brass-wash); color: var(--brass-ink); box-shadow: inset 0 0 0 1px var(--brass); }
@media (max-width: 900px) {
  .tabbar .tab-more { display: grid; justify-items: center; gap: 1px; padding: 6px 0 4px; color: var(--muted); font-size: 11.5px; font-weight: 500; border-radius: var(--r); position: relative; background: none; border: 0; min-width: 0; }
  .tabbar .tab-more svg { width: 21px; height: 21px; }
  .tabbar .tab-more span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .tab-more[aria-current="page"] { color: var(--text); font-weight: 650; }
  .tabbar .tab-more[aria-current="page"]::before { content: ""; position: absolute; top: -4px; width: 26px; height: 3px; border-radius: 0 0 var(--r-xs) var(--r-xs); background: var(--ink); }
  .tabbar .tab-more .dot-badge { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--clay); }
}
.menu a { text-align: left; padding: 9px 10px; border-radius: var(--r); display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.menu a svg { width: 18px; height: 18px; color: var(--muted); }
.menu a:hover, .menu a:focus-visible { background: var(--surface-2); outline: none; }
.menu a[aria-current="page"] { font-weight: 650; color: var(--text); box-shadow: inset 2px 0 0 var(--ink); }
.menu a .badge { margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 18px; padding: 0 5px; border-radius: var(--r-sm); background: var(--clay); color: var(--on-clay); text-align: center; line-height: 18px; }

/* shared controls */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; }
.seg label { position: relative; flex: 1 1 auto; min-width: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: var(--r); font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; text-align: center; white-space: nowrap; }
.seg span small { font-size: 12px; font-weight: 400; color: var(--faint); }
.seg input:checked + span { background: var(--ink); color: var(--on-ink); box-shadow: 0 1px 2px rgb(20 22 26 / .18); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg input:disabled + span { cursor: not-allowed; opacity: .6; }
.seg.block { display: flex; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 38px; height: 22px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--field-line); background: linear-gradient(var(--surface), var(--surface)) 3px 50% / 14px 14px no-repeat, var(--surface-2); transition: background-position .15s; }
.switch input:checked { border-color: var(--ink); background: linear-gradient(var(--on-ink), var(--on-ink)) 19px 50% / 14px 14px no-repeat, var(--ink); }
.switch input:not(:checked) { background: linear-gradient(var(--field-line), var(--field-line)) 3px 50% / 14px 14px no-repeat, var(--surface-2); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { opacity: .55; cursor: not-allowed; }
.badge-test { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: var(--r-sm); line-height: 19px; background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 0 8px; border-radius: var(--r-sm); line-height: 21px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.tag-core { background: var(--ink-wash); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag-detail { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag-off { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag-warn { background: var(--brass-wash); color: var(--brass-ink); }
.tag-bad { background: var(--clay-wash); color: var(--clay); }
.tag-ok { background: var(--sage-wash); color: var(--sage); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spacer { flex: 1; }
.count-note { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.count-note.over { color: var(--clay); font-weight: 600; }
del.d, ins.d { text-decoration: none; border-radius: var(--r-xs); padding: 0 1px; }
del.d { background: var(--clay-wash); color: var(--clay); text-decoration: line-through; text-decoration-thickness: 1px; }
ins.d { background: var(--sage-wash); color: var(--sage); }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
details.disclose > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .12s; margin-right: 2px; }
details.disclose[open] > summary::before { transform: rotate(45deg); }

/* ---------------------------------------------------------- knowledge */
.drop { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 18px; align-items: center; padding: 22px 24px; border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-strong); background: var(--surface); transition: border-color .12s, background .12s; }
.drop.over { border-color: var(--steel); background: var(--ink-wash); }
.drop-ico { width: 48px; height: 48px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--ink-wash); color: var(--text); }
.drop-ico svg { width: 22px; height: 22px; }
.drop-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.drop-sub { font-size: 14px; color: var(--muted); }
.drop-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .drop { grid-template-columns: minmax(0, 1fr); padding: 18px; } .drop-ico { display: none; } }
.docs { margin-top: 10px; }
.doc { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 2px; }
.doc .kind-ico { width: 34px; height: 34px; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; }
.doc-err { grid-column: 2 / -1; font-size: 13.5px; color: var(--clay); overflow-wrap: anywhere; }
.doc-bar { grid-column: 2 / -1; height: 4px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.doc-bar span { display: block; height: 100%; background: var(--steel); border-radius: var(--r-sm); transition: width .15s; }
@media (max-width: 560px) { .doc { grid-template-columns: 34px minmax(0, 1fr); } .doc .row-actions { grid-column: 2; } }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-processing { color: var(--brass-ink); }
.st-processing::before { background: var(--brass); animation: pulse 1.2s ease-in-out infinite; }
.st-done { color: var(--sage); }
.st-error { color: var(--clay); }

.kb-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 6px; }
.kb-tools .search { position: relative; flex: 1 1 240px; min-width: 0; }
.kb-tools .search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.kb-tools .search input { padding-left: 36px; }
.kb-tools select { width: auto; flex: 0 1 auto; }
@media (max-width: 640px) { .kb-tools select { flex: 1 1 calc(50% - 4px); } }
.kb-groups { display: grid; gap: 24px; margin-top: 14px; }
.kb-group h3 { font-size: 16px; font-weight: 650; display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.kb-group h3 .count { font-family: var(--font-ui); font-size: 13.5px; font-weight: 500; color: var(--faint); }
.kc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; width: 100%; text-align: left; padding: 12px 16px; border: 0; background: none; color: inherit; }
.kc:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.kc-title { font-weight: 600; overflow-wrap: anywhere; }
.kc-body { grid-column: 1 / -1; font-size: 14.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; font-size: 12.5px; color: var(--faint); }
.kc-item.archived .kc-title, .kc-item.archived .kc-body { opacity: .6; }
.kc-item .kc { padding-bottom: 6px; }
.kc-item:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.kc-item .kc:hover { background: none; }
.kb-group-sub { font-size: 13.5px; color: var(--faint); margin: -4px 0 8px; }
.kc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 0 16px 12px; font-size: 12.5px; color: var(--faint); }
.kc-facts { display: flex; flex-wrap: wrap; gap: 2px 0; min-width: 0; }
.kc-facts > span + span::before { content: "·"; margin: 0 6px; }
@media (max-width: 560px) { .kc-facts { gap: 2px 10px; } .kc-facts > span + span::before { content: none; } }
.kc-topic { color: var(--muted); font-weight: 600; }
/* what Vidya may say: five statuses, each a word plus a tone (never colour alone) */
.tag.info::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.info-live { background: var(--sage-wash); color: var(--sage); }
.tag.info-direction { background: var(--ink-wash); color: var(--text); }
.tag.info-planned { background: var(--brass-wash); color: var(--brass-ink); }
.tag.info-verify { background: var(--clay-wash); color: var(--clay); }
.tag.info-deprecated { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-strong); text-decoration: line-through; }
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.info-chip { font-size: 13px; min-height: 30px; }
.info-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.info-chip:first-child::before { display: none; }
.info-chip.info-live::before { background: var(--sage); }
.info-chip.info-direction::before { background: var(--steel); }
.info-chip.info-planned::before { background: var(--brass); }
.info-chip.info-verify::before { background: var(--clay); }
.info-chip.info-deprecated::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.info-chips .info-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.info-chips .info-chip[aria-pressed="true"] .n { color: inherit; opacity: .75; }
.info-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* sources: build kit IDs, website pages, notes */
.srcs { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.src { display: inline-flex; align-items: center; max-width: 100%; padding: 0 6px; line-height: 20px; border-radius: var(--r-xs); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
.src-kit { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; letter-spacing: .01em; }
.src-web { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.src-web:hover { text-decoration-color: currentColor; border-color: var(--line-strong); }
.src-note { font-style: italic; border-style: dashed; }
.src-more { font-size: 12px; color: var(--faint); }
.src-prev { margin-top: 2px; min-height: 22px; }
.form-grid > .field.top { align-content: start; }
fieldset.aud-set { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.aud-set legend { padding: 0; margin-bottom: 6px; }
.chk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chk-chip { position: relative; display: inline-flex; }
.chk-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chk-chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 10px; border-radius: var(--r-sm); border: 1px solid var(--field-line);
  background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
.chk-chip span::before { content: ""; width: 12px; height: 12px; border-radius: var(--r-xs); border: 1.5px solid var(--field-line); flex: none; }
.chk-chip input:checked + span { background: var(--ink-wash); color: var(--text); border-color: var(--ink); }
.chk-chip input:checked + span::before { background: var(--ink); border-color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink-wash); }
.chk-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
/* the lead's own words from a demo booking or callback: institution, position, size, the number to ring */
.lead-facts { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.lead-facts a { color: var(--text); }
.said { font-size: 12px; color: var(--faint); font-weight: 400; }
@media (forced-colors: active) { .info-chip::before, .tag.info::before, .chk-chip span::before { forced-color-adjust: none; } .chk-chip input:checked + span { outline: 2px solid CanvasText; } }
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.versions li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.versions .v-h { font-size: 13.5px; font-weight: 600; }
.versions .v-b { grid-column: 1 / -1; font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5em; overflow: hidden; }

.proposal { display: grid; gap: 12px; }
.proposal + .proposal { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.prop-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.prop-title { font-weight: 650; font-size: 16.5px; overflow-wrap: anywhere; }
.prop-from { font-size: 13.5px; color: var(--faint); }
.diff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.diff-pane { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: var(--surface); min-width: 0; }
.diff-pane.new { border-color: color-mix(in srgb, var(--sage) 40%, var(--line)); }
.diff-pane h4 { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.diff-pane .prose { font-size: 15px; }
@media (max-width: 720px) { .diff { grid-template-columns: minmax(0, 1fr); } }

.gap-src { font-size: 13.5px; color: var(--muted); }
.gap-src b { color: var(--text); font-weight: 600; }
.gap-detail { grid-column: 1 / -1; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--brass); font-size: 14.5px; overflow-wrap: anywhere; }
.gap-item details { grid-column: 1 / -1; }
.answer-form { display: grid; gap: 10px; margin-top: 10px; padding: 14px; border-radius: var(--r); background: var(--surface-2); }
.answer-form .form-actions { justify-content: flex-start; margin: 0; }

.meter { display: grid; gap: 6px; }
.meter-track { height: 12px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; position: relative; }
.meter-fill { display: block; height: 100%; border-radius: var(--r-xs); background: var(--steel); }
.meter.over .meter-fill { background: var(--clay); }
.meter-l { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.meter-l b { color: var(--text); font-variant-numeric: tabular-nums; }
.compiled { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.6; max-height: 560px; overflow: auto; padding: 16px 18px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }

/* ---------------------------------------------------------- pitch */
.pitch { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) {
  .pitch { grid-template-columns: minmax(0, 1fr); }
  .pitch.editing .script-nav { display: none; }
  .pitch:not(.editing) .script-ed { display: none; }
}
@media (min-width: 961px) { .back-to-list { display: none !important; } }
.script-nav { display: grid; gap: 18px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 2px; }
@media (max-width: 960px) { .script-nav { position: static; max-height: none; } }
.script-group h2 { font-size: 15px; font-weight: 650; display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px 4px; }
.script-group h2 .count { font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--faint); }
.script-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.script-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--r); border: 1px solid transparent; background: none; color: inherit; }
.script-item:hover { background: var(--surface); border-color: var(--line); }
.script-item[aria-current="true"] { background: var(--surface); border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--ink); }
.script-item .t { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.script-item .secs { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.script-item .w { grid-column: 1 / -1; font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.script-item.off .t { color: var(--muted); }
.script-ed { display: grid; gap: 16px; }
.script-ed .panel { display: grid; gap: 16px; }
.ed-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.ed-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .ed-top, .ed-meta { grid-template-columns: minmax(0, 1fr); } }
.script-body { font-size: 17px !important; line-height: 1.62 !important; min-height: 220px; padding: 14px 16px !important; }
.speak { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; align-items: center; }
.speak-n { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.speak-n b { color: var(--text); font-family: var(--font-display); font-size: 17px; font-weight: 650; }
.ruler { position: relative; height: 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.ruler .band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--sage) 26%, transparent); border-radius: var(--r-sm); }
.ruler .mark { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: var(--r-xs); background: var(--ink); transition: left .15s; }
.ruler.long .mark { background: var(--clay); }
.speak-hint { grid-column: 1 / -1; font-size: 13px; color: var(--faint); }
.speak-hint.long { color: var(--clay); }
.beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: beat; }
.beats li { counter-increment: beat; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.beats li::before { content: counter(beat); width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--ink); color: var(--on-ink); font: 700 13px/1 var(--font-display); }
.beats .bt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.beats .bs { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.beats .bs.long { color: var(--clay); font-weight: 600; }
.beat-check { grid-column: 2 / -1; font-size: 13px; color: var(--faint); font-style: italic; }
.ed-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-bar select { width: auto; min-width: 0; max-width: 180px; }
.dirty-note { font-size: 13.5px; color: var(--brass-ink); font-weight: 500; }
.improve { border-left: 3px solid var(--brass); }
.chip-toggle { cursor: pointer; }
.chip-toggle[aria-pressed="true"] { background: var(--brass-wash); border-color: var(--brass); color: var(--brass-ink); }
.proposal-box { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--brass) 50%, transparent); background: var(--surface); }
.proposal-box .prose { font-size: 16px; line-height: 1.6; }

/* ---------------------------------------------------------- FAQ */
.grade-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--muted); }
.grade-legend span { display: inline-flex; align-items: center; gap: 6px; }
.grade-legend i, .gdot { width: 10px; height: 10px; border-radius: var(--r-xs); display: inline-block; flex: none; }
.g-good { background: var(--g-good); } .g-deflected { background: var(--g-deflected); } .g-risky { background: var(--g-risky); } .g-wrong { background: var(--g-wrong); }
.grades { display: flex; height: 8px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); gap: 2px; min-width: 80px; }
.grades span { display: block; height: 100%; }
.grades-lg { height: 12px; }
.grade { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 0 8px; border-radius: var(--r-sm); line-height: 21px; white-space: nowrap; }
.grade-good { background: var(--sage-wash); color: var(--sage); }
.grade-deflected { background: var(--surface-2); color: var(--muted); }
.grade-risky { background: var(--brass-wash); color: var(--brass-ink); }
.grade-wrong { background: var(--clay-wash); color: var(--clay); }
.faq-list { list-style: none; margin: 0; padding: 0; }
.faq { border-bottom: 1px solid var(--line); }
.faq:last-child { border-bottom: 0; }
.faq > details > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(120px, 200px) 18px; gap: 6px 16px; align-items: center; padding: 14px 16px; }
.faq > details > summary::-webkit-details-marker { display: none; }
.faq > details > summary:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.faq > details > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(45deg); justify-self: center; margin-top: -4px; transition: transform .12s; }
.faq > details[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.faq-n { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 26px; font-weight: 700; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.faq-n small { display: block; font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--faint); margin-top: 3px; }
.faq-t { display: grid; gap: 3px; min-width: 0; }
.faq-topic { font-weight: 650; font-size: 16px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.faq-q { color: var(--muted); font-size: 14.5px; overflow-wrap: anywhere; }
.faq-meta { font-size: 13px; color: var(--faint); }
.faq-g { display: grid; gap: 5px; }
.faq-g .grades { width: 100%; }
.faq-g small { font-size: 12.5px; color: var(--muted); }
@media (max-width: 720px) {
  .faq > details > summary { grid-template-columns: 44px minmax(0, 1fr) 14px; padding: 14px 12px; }
  .faq-g { grid-column: 2 / 3; grid-row: 2; }
  .faq > details > summary::after { grid-column: 3; grid-row: 1; }
  .faq-n { font-size: 22px; }
}
.faq-body { padding: 4px 16px 22px 88px; display: grid; gap: 18px; }
@media (max-width: 720px) { .faq-body { padding: 4px 12px 18px; } }
.qa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.qa { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.qa-q, .qa-a { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
.qa-q b, .qa-a b { font-size: 12.5px; font-weight: 600; color: var(--faint); padding-top: 2px; }
.qa-q span { font-weight: 500; }
.qa-a span { color: var(--text); }
.qa-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; color: var(--muted); padding-left: 70px; }
@media (max-width: 520px) { .qa-q, .qa-a { grid-template-columns: minmax(0, 1fr); gap: 0; } .qa-foot { padding-left: 0; } }
.teach { display: grid; gap: 10px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brass); }
.teach textarea { min-height: 96px; }
.faq-admin { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; }
.faq-admin form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; flex: 1 1 280px; }
.faq-admin .field { flex: 1 1 200px; }
.faq-head-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }

/* ---------------------------------------------------------- test console */
.tv { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .tv { grid-template-columns: minmax(0, 1fr); } }
.tv-side { display: grid; gap: 16px; position: sticky; top: 16px; }
@media (max-width: 960px) { .tv-side { display: contents; } } /* lets the live handset stick across the whole console */
.tv-setup { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 16px; }
.tv-setup legend { padding: 0; }
.tv-q { display: grid; gap: 6px; }
.tv-q > .field-label { color: var(--text); font-weight: 600; font-size: 14px; }
.scen { display: grid; gap: 6px; }
.scen label { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.scen label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.scen input { margin: 3px 0 0; accent-color: var(--ink); width: 16px; height: 16px; }
.scen b { font-weight: 600; }
.scen small { grid-column: 2; font-size: 13px; color: var(--muted); }
.scen-extra { display: grid; gap: 10px; padding: 2px 0 0 0; }
.tv-note { font-size: 13px; color: var(--muted); }

.handset { background: var(--device); color: var(--device-text); border-radius: var(--r-lg); padding: 20px 20px 18px; display: grid; gap: 14px; justify-items: center; text-align: center; box-shadow: var(--shadow); }
.hs-status { font-size: 14.5px; color: var(--device-muted); min-height: 22px; display: inline-flex; align-items: center; gap: 8px; }
.hs-status.live { color: var(--device-text); }
.hs-status .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #8fc1a1; box-shadow: 0 0 0 4px rgb(143 193 161 / .22); }
.hs-time { font-family: var(--font-display); font-stretch: var(--w-display); font-weight: 600; font-size: 44px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--device-text); }
.hs-time small { display: block; font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; color: var(--device-muted); margin-top: 6px; letter-spacing: 0; }
.hs-time.warn { color: #dcc28e; }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 44px; width: 100%; }
.wave i { width: 4px; height: 3px; border-radius: var(--r-xs); background: rgb(255 255 255 / .22); transition: height .06s linear; }
.wave.on i { background: rgb(255 255 255 / .85); }
.wave.muted i { background: rgb(255 255 255 / .14); }
.hs-btns { display: flex; align-items: center; justify-content: center; gap: 18px; }
.call-btn { width: 76px; height: 76px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: #3d6f50;
  box-shadow: 0 10px 26px -12px rgb(61 111 80 / .9), inset 0 1px 0 rgb(255 255 255 / .18), inset 0 -3px 0 rgb(0 0 0 / .18); transition: transform .1s, background .15s; }
.call-btn svg { width: 30px; height: 30px; }
.call-btn:hover { background: #335f44; }
.call-btn:active { transform: scale(.96); }
.call-btn.end { background: #a2433a; box-shadow: 0 10px 26px -12px rgb(162 67 58 / .9), inset 0 1px 0 rgb(255 255 255 / .16), inset 0 -3px 0 rgb(0 0 0 / .18); }
.call-btn.end:hover { background: #8c3830; }
.call-btn.end svg { transform: rotate(135deg); }
.call-btn:disabled { opacity: .6; cursor: progress; }
.call-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 50%; }
.round-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .2); background: rgb(255 255 255 / .06); color: var(--device-text); display: grid; place-items: center; }
.round-btn svg { width: 20px; height: 20px; }
.round-btn:hover { background: rgb(255 255 255 / .12); }
.round-btn[aria-pressed="true"] { background: var(--device-text); color: var(--device); }
.round-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 50%; }
.hs-label { font-size: 12.5px; color: var(--device-muted); }
.hs-err { background: rgb(229 159 147 / .16); color: #f3cfc8; border-radius: var(--r); padding: 10px 12px; font-size: 14px; text-align: left; width: 100%; }
.hs-err:empty { display: none; }

.tv-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: min(72vh, 760px); padding: 0; overflow: hidden; }
.tv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tv-head h2 { font-size: 17px; font-weight: 650; }
.tv-head .chips { flex: 1; }
.speaking { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.speaking i { display: inline-flex; gap: 2px; align-items: center; height: 14px; }
.speaking i b { width: 3px; height: 4px; border-radius: var(--r-xs); background: currentColor; animation: talk .9s ease-in-out infinite; }
.speaking i b:nth-child(2) { animation-delay: .15s; } .speaking i b:nth-child(3) { animation-delay: .3s; } .speaking i b:nth-child(4) { animation-delay: .45s; }
@keyframes talk { 50% { height: 14px; } }
.tv-log { overflow-y: auto; padding: 18px; display: grid; gap: 12px; align-content: start; overscroll-behavior: contain; max-height: 64vh; min-height: 320px; }
@media (max-width: 960px) { .tv-log { max-height: none; min-height: 260px; } }
.tv-log .bubble { font-size: 15.5px; max-width: 100%; }
/* the row carries the width cap: a % on the bubble would resolve against its own shrink-to-fit row and wrap short lines */
.tv-log .msg-user, .tv-log .msg-assistant { max-width: 82%; }
.tv-log .msg-user { display: grid; justify-items: start; }
.tv-log .msg-user .bubble.interim { background: transparent; border: 1px dashed var(--line-strong); color: var(--faint); font-style: italic; }
.tv-log .msg-assistant.streaming .bubble::after { content: ""; display: inline-block; width: 6px; height: 1em; margin-left: 3px; vertical-align: -2px; background: currentColor; opacity: .55; animation: pulse 1s infinite; }
.msg-foot { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--faint); }
.lat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: var(--r-sm); line-height: 20px; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; cursor: help; }
.lat.fast { background: var(--sage-wash); color: var(--sage); }
.lat.slow { background: var(--clay-wash); color: var(--clay); }
.lat svg { width: 12px; height: 12px; }
.tv-event { justify-self: center; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--faint); }
.tv-event .chip { font-size: 13px; }
.tv-event.err { color: var(--clay); }
.tv-empty { align-self: center; justify-self: center; max-width: 46ch; text-align: center; color: var(--muted); display: grid; gap: 8px; padding: 40px 8px; }
.tv-empty .empty-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text); }
.tv-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.tv-sum { display: grid; gap: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--surface-2); justify-self: stretch; }
.tv-sum .stats { border: 0; padding: 0; gap: 8px 28px; }
.tv-sum .stat-v { font-size: 22px; }
.msg-foot:empty { display: none; }
.msg-assistant .msg-foot { justify-content: flex-end; flex-wrap: wrap; }
.gap-item > .tag { align-self: start; justify-self: end; }
details.disclose > summary svg { width: 16px; height: 16px; flex: none; }
.qa .grade-deflected { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.lat-wrap { display: inline-flex; gap: 4px 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.msg-user .lat-wrap { justify-content: flex-start; }
/* phones: during a call the handset shrinks to a sticky bar so Hang up is always in reach */
@media (max-width: 960px) {
  .tv-log { max-height: 58vh; }
  .handset.live { position: sticky; top: 62px; z-index: 5; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "status btns" "time btns"; justify-items: start; text-align: left; gap: 2px 12px; padding: 12px 14px; border-radius: var(--r-lg); }
  .handset.live .hs-status { grid-area: status; }
  .handset.live .hs-time { grid-area: time; font-size: 26px; }
  .handset.live .hs-time small, .handset.live .wave, .handset.live .hs-label { display: none; }
  .handset.live .hs-btns { grid-area: btns; gap: 10px; }
  .handset.live .call-btn { width: 56px; height: 56px; }
  .handset.live .call-btn svg { width: 24px; height: 24px; }
  .handset.live .round-btn { width: 44px; height: 44px; }
  .handset.live .hs-err { grid-column: 1 / -1; }
}
.docs.uploads:not(:empty) { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 16px; margin-top: 12px; }
.menu a .badge.soft { background: var(--brass-wash); color: var(--brass-ink); box-shadow: inset 0 0 0 1px var(--brass); }
.ed-save { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) { .improve .tag-add { flex-wrap: wrap; } .improve .tag-add input { flex: 1 1 100%; } }

/* ================================================================ v3: dialer, lines, costs, standing, notes, settings
   Same stone/steel/frost system. Status colours stay in the stone family: sage = talked, brass = try again,
   clay = failed or blocked, graphite = happening now. */

/* shared */
.seg input:checked + span small { color: inherit; opacity: .78; }
.icon-btn[aria-pressed="true"] { background: var(--ink-wash); color: var(--text); }
.link-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.link-btn svg { width: 14px; height: 14px; }
.clay-t { color: var(--clay); }
.tag svg, .dnc-mark svg { width: 12px; height: 12px; }
input[type="checkbox"] { accent-color: var(--ink); width: 17px; height: 17px; margin: 0; cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .4; }
input[type="number"], input[type="time"] { width: 100%; min-height: 38px; padding: 7px 11px; border-radius: var(--r); border: 1px solid var(--field-line); background: var(--surface); color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
input[type="range"] { accent-color: var(--ink); }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 8px; align-items: start; font-size: 14.5px; cursor: pointer; margin-top: 10px; }
.check input { margin-top: 3px; }
.check small { display: block; color: var(--muted); font-size: 13px; }
.field-switch { align-self: end; min-height: 38px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 550; color: var(--muted); text-decoration: none; justify-self: start; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.page-sub q { color: var(--text); quotes: "“" "”"; }

/* lines meter: the rail's gauge and the phone top bar's readout */
.lines { display: grid; gap: 7px; padding: 10px 10px 11px; border-radius: var(--r); text-decoration: none; color: var(--text);
  background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi); }
.lines:hover { border-color: var(--line-strong); }
.lines-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lines-l { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.lines b { font-size: 15px; font-weight: 650; }
.lines-ticks { display: flex; gap: 2px; height: 8px; }
.lines-ticks i { flex: 1; min-width: 2px; border-radius: var(--r-xs); background: var(--line-strong); }
.lines-ticks i.on { background: var(--ink); }
.lines.full .lines-ticks i.on, .lines-big.full .lines-ticks i.on { background: var(--clay); }
.lines.full b { color: var(--clay); }
.lines-sm { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 9px; min-height: 32px; align-items: center; }
.lines-sm .lines-l { font-size: 12px; }
.lines-sm b { font-size: 14px; }
.lines-sm.busy b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--sage); vertical-align: 2px; }

/* selection bar (contacts and campaign items) */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 36px; }
.selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 4px 4px 4px 12px; border-radius: var(--r);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line-strong); box-shadow: var(--glass-hi), var(--shadow); }
.selbar-n { font-size: 14px; font-weight: 600; margin-right: 4px; font-variant-numeric: tabular-nums; }
/* the row holding a visible selection bar sticks, so the bulk actions stay in reach while you scroll */
.list-head:has(.selbar:not([hidden])), .section-head:has(.selbar:not([hidden])) { position: sticky; top: 10px; z-index: 6; padding: 6px 6px 6px 12px; border-radius: var(--r-lg);
  background: var(--glass-dense); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--shadow); }
.list-head .selbar, .section-head .selbar { border: 0; box-shadow: none; background: transparent; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 900px) { .list-head:has(.selbar:not([hidden])), .section-head:has(.selbar:not([hidden])) { top: 64px; } }
.ctable th.c-sel, .ctable td.c-sel { width: 40px; padding-right: 0; }
.ctable tbody tr.is-sel { background: color-mix(in srgb, var(--ink-wash) 70%, transparent); }
.who-text { display: grid; gap: 1px; min-width: 0; }
.who-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.who-top a { color: var(--text); font-weight: 600; text-decoration: none; }
.who-top a:hover { text-decoration: underline; }
.who-sum { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52ch; }
.who-cell .who-text { flex: 1; }
.dnc-mark { line-height: 19px; }
.card-sum { font-size: 13.5px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-next { display: grid !important; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; align-items: start; }
.card-next svg { width: 14px; height: 14px; margin-top: 3px; color: var(--muted); }
.card-next span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .dnc-mark { justify-self: start; }
@media (max-width: 860px) {
  .ctable tr { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ctable td.c-sel { grid-column: 1; grid-row: 1; width: auto; padding-top: 10px; }
  .ctable td.c-who { grid-column: 2; grid-row: 1; }
  .ctable td.c-score { grid-column: 3; grid-row: 1; }
  .ctable td.c-stage, .ctable td.c-tags, .ctable td.c-next, .ctable td.c-last { grid-column: 2 / -1; }
  .ctable:not(:has(.c-sel)) tr { grid-template-columns: minmax(0, 1fr) auto; }
  .ctable:not(:has(.c-sel)) td { grid-column: 1 / -1; }
  .who-sum { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* calls: cost beside the time */
.calls .row-when { display: grid; justify-items: end; gap: 2px; }
.row-cost { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-card .t .row-cost { margin-left: auto; }
.cost-box { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.cost-box-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; }
.cost-box-h b { font-size: 18px; }
.cost-kv { font-size: 14px; }
.cost-kv dd { text-align: right; }

/* dashboard: what calls cost */
.costs .section-head { flex-wrap: wrap; }
.costs .seg span { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.cost-body { display: grid; gap: 14px; }
.cost-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.cost-v { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 40px; font-weight: 650; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cost-l { font-size: 13.5px; color: var(--muted); }
.cost-rates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cost-rates dt { font-size: 13px; color: var(--muted); }
.cost-rates dd { margin: 0; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cost-split { display: flex; gap: 2px; height: 8px; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-2); }
.cost-split span { display: block; flex-basis: 0; min-width: 3px; }
.cost-split .live, .cost-legend i.live { background: var(--ink); }
.cost-split .post, .cost-legend i.post { background: var(--brass); }
.cost-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cost-legend i { width: 9px; height: 9px; border-radius: var(--r-xs); }

/* drawer: the call guard, where things stand, permission, notes */
.d-guard { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 16px; font-size: 13.5px; background: var(--brass-wash); color: var(--brass-ink); border-bottom: 1px solid var(--line); }
.d-guard.block { background: var(--clay-wash); color: var(--clay); }
.d-guard > svg { width: 16px; height: 16px; flex: none; }
.d-guard > span { flex: 1 1 220px; }
.d-cost b { color: var(--text); }
.standing { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 2px 0 var(--brass); }
.st-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.st-h .d-h { justify-content: flex-start; }
.st-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--faint); }
.st-sum { display: grid; gap: 6px; }
.st-edit { justify-self: start; margin-left: -8px; }
.st-form { display: grid; gap: 8px; }
.st-form .small svg { width: 12px; height: 12px; vertical-align: -1px; }
.st-form .form-actions { justify-content: flex-start; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }
.st-card { display: grid; gap: 2px; align-content: start; padding: 10px 12px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); min-width: 0; }
.st-l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.st-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.st-s { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.st-card .link-btn { justify-self: start; margin-top: 4px; }
.d-h svg { width: 16px; height: 16px; vertical-align: -3px; }
.perm-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 8px; align-items: end; }
.perm-form .form-actions { margin: 0; }
@media (max-width: 620px) { .perm-form { grid-template-columns: minmax(0, 1fr); } .perm-form .form-actions { justify-content: flex-start; } }
.dnc-switch { align-items: flex-start; padding-top: 4px; }
.msg-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 12px; }
.msg-ch { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.msg-ch-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.msg-ch-h span { color: var(--muted); overflow-wrap: anywhere; }
.dnc-switch > span { display: grid; gap: 1px; }
.dnc-switch small { color: var(--muted); font-size: 13px; }
.dnc-switch input:checked { border-color: var(--clay); background: linear-gradient(var(--on-clay), var(--on-clay)) 19px 50% / 14px 14px no-repeat, var(--clay); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note { padding: 9px 10px 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.note.pinned { border-color: var(--line-strong); box-shadow: inset 2px 0 0 var(--ink); }
.note.ai:not(.pinned) { box-shadow: inset 2px 0 0 var(--brass); }
.note-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); }
.note-h .icon-btn.sm { width: 28px; height: 28px; }
.note-acts { display: inline-flex; flex: none; gap: 2px; margin-left: auto; } /* pin, edit and delete wrap as one group */
.note-pin { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--text); }
.note-pin svg { width: 12px; height: 12px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.note .note-form { margin-top: 6px; }
.note-form .form-actions { justify-content: flex-start; }

/* dialer */
.lines-panel { display: grid; gap: 14px; }
.lines-big { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; }
.lines-n { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 22px; color: var(--muted); white-space: nowrap; }
.lines-n b { font-size: 46px; font-weight: 650; color: var(--text); letter-spacing: -.02em; }
.lines-big .lines-ticks { height: 22px; gap: 3px; }
.lines-panel .stats { padding: 0; border: 0; }
.live-calls .live-call { display: grid; grid-template-columns: 34px minmax(0, auto) minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; }
.live-call a { font-weight: 600; color: var(--text); }
.cstat { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--text); }
.cstat i { width: 8px; height: 8px; border-radius: var(--r-xs); background: var(--faint); }
.cstat-running i { background: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 25%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.cstat-running { color: var(--sage); }
.cstat-paused i { background: var(--brass); }
.cstat-paused { color: var(--brass-ink); }
.cstat-draft i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.cstat-draft { color: var(--muted); }
.cstat-done i { background: var(--ink); }
.cstat-cancelled i { background: var(--clay); }
.cstat-cancelled { color: var(--clay); }
.cprog { display: flex; gap: 1px; height: 8px; width: 100%; min-width: 120px; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.cprog span { display: block; height: 100%; }
.cprog .ok { background: var(--sage); }
.cprog .na { background: var(--brass); }
.cprog .bad { background: var(--clay); }
.cprog .skip { background: var(--line-strong); }
.cprog .live { background: var(--ink); }
.camps td { vertical-align: top; }
.camps .cp-name { min-width: 220px; }
.camps .cp-name a { font-weight: 650; color: var(--text); text-decoration: none; }
.camps .cp-name a:hover { text-decoration: underline; }
.camps .cp-prog { min-width: 180px; }
.camps .cp-prog .cprog { margin: 6px 0 6px; }
.camps .cp-out { white-space: nowrap; }
.camps .cp-out > span { display: block; }
.camp-sum { display: grid; gap: 16px; }
.camp-prog { display: grid; gap: 6px; }
.camp-prog .cprog { height: 12px; }
.camp-sum .stats { padding: 0; border: 0; gap: 8px 30px; }
.stat.is-live .stat-v { color: var(--sage); }
.istat { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; padding: 0 8px; border-radius: var(--r-sm); line-height: 22px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); }
.istat-dialing, .istat-ringing, .istat-in_call { background: var(--ink); color: var(--on-ink); }
.istat-completed { background: var(--sage-wash); color: var(--sage); }
.istat-no_answer, .istat-busy { background: var(--brass-wash); color: var(--brass-ink); }
.istat-failed { background: var(--clay-wash); color: var(--clay); }
.istat-skipped, .istat-cancelled { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-strong); }
.items td { vertical-align: top; }
.items td.c-tries { white-space: nowrap; }
.items td.c-call { white-space: nowrap; }
.items td.c-call .row-cost { display: block; }
.items td.c-act .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.items tr.it-in_call, .items tr.it-ringing, .items tr.it-dialing { background: color-mix(in srgb, var(--ink-wash) 60%, transparent); }
@media (max-width: 860px) { .items td.is-empty { display: none !important; } }
@media (max-width: 860px) {
  .camps tr { grid-template-columns: minmax(0, 1fr) auto; }
  .camps td { grid-column: 1 / -1; }
  .camps td.cp-name { grid-column: 1; min-width: 0; }
  .camps td.cp-status { grid-column: 2; grid-row: 1; }
  .camps td.cp-prog { min-width: 0; }
  .camps td.cp-out > span { display: inline; margin-right: 10px; }
  .items td.c-stage, .items td.c-tries, .items td.c-cause, .items td.c-call, .items td.c-act { grid-column: 2 / -1; }
  .items td.c-stage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .items td.c-act .row-actions { justify-content: flex-start; }
  .items td.c-tries::before { content: "Tries "; color: var(--muted); }
}

/* the campaign sheet: a tall glass panel on the right; full screen on phones */
.modal.as-sheet { margin: 0 0 0 auto; width: min(640px, 100vw); height: 100vh; height: 100dvh; max-height: none; max-width: 100vw;
  border-radius: var(--r-lg) 0 0 var(--r-lg); border-right: 0; animation: slide-in .2s ease-out; }
.modal.as-sheet .modal-in { min-height: 100%; align-content: start; padding-bottom: 0; }
.sheet-in .tv-setup { gap: 10px; }
.sheet-in .tv-setup legend { margin-bottom: 8px; }
.sheet-actions { position: sticky; bottom: 0; z-index: 2; margin: auto -24px 0; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-top: 1px solid var(--line); }
@media (max-width: 600px) { .modal.as-sheet { border-radius: 0; } .sheet-actions { margin: auto -16px 0; padding-left: 16px; padding-right: 16px; } }
.purpose-chips { margin-top: 6px; }
.purpose-chips .chip { cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.purpose-chips .chip:hover { border-color: var(--field-line); }
.src-pane { margin-top: 2px; }
.pick { display: grid; gap: 8px; }
.pick-bar { display: flex; align-items: center; gap: 6px; }
.pick-bar > span { flex: 1; }
.pv-list.pick-list li { display: block; padding: 0; }
.pick-row { width: 100%; box-sizing: border-box; display: grid; grid-template-columns: 20px minmax(0, auto) minmax(0, 1fr) auto; gap: 0 10px; align-items: baseline; padding: 7px 12px; cursor: pointer; }
.pick-row:hover { background: var(--surface-2); }
.adv-grid { margin-top: 12px; }
.pv { border-top: 1px solid var(--line); padding-top: 14px; }
.preview { display: grid; gap: 12px; }
.preview[aria-busy="true"] { opacity: .6; }
.pv-head { font-size: 16px; }
.pv-head b { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 26px; font-weight: 650; }
.pv-list { list-style: none; margin: 0; padding: 0; display: grid; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.pv-list li { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 0 10px; align-items: baseline; padding: 7px 12px; border-top: 1px solid var(--line); }
.pv-list li:first-child { border-top: 0; }
.pv-name { font-weight: 600; overflow-wrap: anywhere; }
.pv-list .ph { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-list .who-sum { grid-column: 1 / -1; max-width: none; }
.pv-skips { display: grid; gap: 8px; }
.pv-skip .pv-list { margin-top: 8px; max-height: 200px; }

/* settings */
.settings { display: grid; gap: 24px; max-width: 900px; }
.settings .panel { display: grid; gap: 14px; }
.settings .section-head { margin-bottom: 0; }
.pace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
@media (max-width: 720px) { .pace-grid { grid-template-columns: minmax(0, 1fr); } }
.pace-row { display: flex; align-items: center; gap: 12px; }
.pace-row input { flex: 1; min-width: 0; }
.pace-v { min-width: 56px; text-align: right; font-weight: 650; font-size: 17px; }
.langs th[scope="row"] { font-weight: 400; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.langs tbody tr { cursor: default; }
.langs tbody tr:last-child th { border-bottom: 0; }
.lang-n { display: block; font-weight: 600; }
.lang-native { display: block; font-size: 13.5px; color: var(--muted); }
.langs td select { min-width: 200px; }
.langs td.c-act { text-align: right; width: 1%; white-space: nowrap; }
@media (max-width: 860px) {
  .langs tr { grid-template-columns: minmax(0, 1fr) auto !important; }
  .langs th[scope="row"] { grid-column: 1; padding: 0; border: 0; }
  .langs td { grid-column: 1 / -1 !important; }
  .langs td.c-act { grid-column: 2 !important; grid-row: 1; width: auto; }
  .langs td select { min-width: 0; }
}
.field.narrow { max-width: 360px; }
.settings-actions { position: sticky; bottom: 12px; z-index: 4; justify-content: flex-start; padding: 10px; border-radius: var(--r-lg);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--shadow); }
.pace { align-content: start; }
@media (max-width: 900px) { .settings-actions { bottom: calc(76px + env(safe-area-inset-bottom)); } }
.ed-bar select { max-width: 160px; }
.lines-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
@media (max-width: 720px) { .lines-fields { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 420px) { .topbar { gap: 4px; padding-left: 12px; } .topbar .brand span { display: none; } }

.who-text .ph { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.brief-line a { white-space: nowrap; }
.modal.as-sheet[open] { display: flex; flex-direction: column; }
.modal.as-sheet #modal-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.modal.as-sheet .sheet-in { flex: 1 0 auto; display: flex; flex-direction: column; gap: 16px; }
.switch input[type="checkbox"] { width: 38px; height: 22px; accent-color: auto; opacity: 1; }
.switch input[type="checkbox"]:disabled { opacity: .55; }
@media (max-width: 680px) { .drawer { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ================================================================ v4: team accounts, campaign agenda and knowledge */
/* who is signed in, at the foot of the rail */
.rail-user { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 6px; margin-bottom: -6px; border: 0; border-radius: var(--r); background: transparent; color: var(--rail-text); text-align: left; }
.rail-user:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.rail-user .avatar { width: 24px; height: 24px; font-size: 10.5px; }
.ru-t { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; line-height: 1.2; }
.ru-n { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ru-r { margin-left: auto; font-size: 12.5px; color: var(--rail-muted); flex: none; }

/* read-only for staff */
.perm-note { display: flex; align-items: flex-start; gap: 8px; }
.perm-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--steel); }
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; cursor: not-allowed; }
.seg input:disabled + span { cursor: not-allowed; opacity: .7; }
.dnc-switch small + small { color: var(--faint); }

/* team page */
.team-explain { display: grid; gap: 12px; }
.team-can { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.team-can ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; }
.team-can li { display: flex; align-items: flex-start; gap: 8px; }
.team-can li > span { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: var(--r-sm); }
.team-can li > span svg { width: 13px; height: 13px; stroke-width: 2.4; }
.team-can .yes { background: var(--sage-wash); color: var(--sage); }
.team-can .no { background: var(--surface-2); color: var(--muted); }
@media (max-width: 640px) { .team-can { grid-template-columns: minmax(0, 1fr); } }
.team tbody tr { cursor: default; }
.team td.c-act .row-actions { justify-content: flex-end; flex-wrap: nowrap; gap: 2px; }
.team td.c-act { width: 1%; white-space: nowrap; }
.team .who-top b { font-weight: 600; }
.team tr.is-off td { color: var(--muted); }
.team tr.is-off .who-top b, .team tr.is-off .tag { opacity: .72; }
@media (max-width: 860px) {
  .team tr { grid-template-columns: minmax(0, 1fr) auto !important; }
  .team td.c-who { grid-column: 1 !important; }
  .team td.t-role { grid-column: 2 !important; grid-row: 1; justify-self: end; }
  .team td.t-access, .team td.c-last { grid-column: 1 / -1 !important; }
  .team td.c-act { grid-column: 1 / -1 !important; width: auto; }
  .team td.c-act .row-actions { justify-content: flex-start; flex-wrap: wrap; margin-left: -10px; }
  .team td.c-last::before { content: "Last sign-in "; }
  .team-off td.c-last::before { content: "Removed "; }
}
.pw-row { display: flex; gap: 6px; align-items: center; }
.pw-row input { flex: 1; min-width: 0; }
@media (max-width: 420px) { .pw-row { flex-wrap: wrap; } .pw-row input { flex: 1 1 100%; } }
.mono, .secret-v { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.secret { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--field-line); border-radius: var(--r); background: var(--surface); }
.secret-v { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; user-select: all; }
.kb-switch { align-items: flex-start; }
.kb-switch > span { display: grid; gap: 1px; }
.kb-switch small { color: var(--muted); font-size: 13px; }

/* a campaign's agenda and knowledge: in the sheet */
.cb-set { border: 1px solid var(--line); border-radius: var(--r-lg); margin: 0; padding: 12px 16px 16px; min-width: 0; display: grid; gap: 14px;
  background: color-mix(in srgb, var(--surface) 55%, transparent); }
.cb-legend { padding: 0 6px; margin-left: -6px; font-size: 14.5px; font-weight: 650; color: var(--text); }
.field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 2px; }
.field-foot .btn { flex: none; }
@media (max-width: 520px) { .field-foot { flex-direction: column; } }
.cb-set textarea[name="knowledge"] { min-height: 150px; }
.spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
/* ... and on the campaign page */
.cb-panel { display: grid; gap: 14px; }
.cb-panel .section-head { margin-bottom: 0; flex-wrap: wrap; }
.cb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px 28px; }
@media (max-width: 820px) { .cb-grid { grid-template-columns: minmax(0, 1fr); } }
.cb-block { display: grid; gap: 6px; align-content: start; min-width: 0; }
.cb-l { font-size: 13.5px; font-weight: 500; color: var(--muted); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cb-body { display: grid; gap: 4px; justify-items: start; }
.cb-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.5; }
.cb-text.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
/* narrow phones: signing out lives in the account dialog, so the top bar keeps one icon fewer */
@media (max-width: 480px) { #logout-m { display: none; } }
/* toasts sit in the top layer (a manual popover) so they show above dialogs; undo the popover defaults */
.toasts[popover] { inset: auto; left: 50%; bottom: 20px; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; height: auto; }
@media (max-width: 900px) { .toasts[popover] { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.field-top .count-note, .cb-l .count-note { white-space: nowrap; flex: none; }
.view > .perm-note { justify-self: start; }

/* ================================================================ v5: email — conversations, templates, styles, campaign emails */
/* email statuses: waiting is an outline, sent is stone, opened/clicked is sage, trouble is clay */
.estat { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; padding: 0 8px; border-radius: var(--r-sm); line-height: 22px; white-space: nowrap;
  background: var(--ink-wash); color: var(--text); }
.estat-scheduled, .estat-sending { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--field-line); }
.estat-opened, .estat-clicked { background: var(--sage-wash); color: var(--sage); }
.estat-bounced, .estat-complained, .estat-failed { background: var(--clay-wash); color: var(--clay); }
.estat-suppressed, .estat-cancelled { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-strong); }
.notice-bad { background: var(--clay-wash); color: var(--clay); }
.clay-t { color: var(--clay); }

/* conversations feed */
.convo-filters { display: grid; gap: 12px; }
.day-pick { display: inline-flex; align-items: center; gap: 8px; flex: 0 1 auto; }
input[type="date"] { min-height: 38px; padding: 6px 10px; border-radius: var(--r); border: 1px solid var(--field-line); background: var(--surface); color: var(--text); font-size: 15px; }
.kind-ico.email { background: var(--surface-2); color: var(--steel); box-shadow: inset 0 0 0 1px var(--line); }
.convo .row-who { display: grid; gap: 1px; min-width: 0; }
.convo .row-who .badge-test { justify-self: start; }
.convo .row-subject { color: var(--text); }
.convo .row-when { display: grid; justify-items: end; gap: 4px; }
@media (max-width: 720px) { .day-pick { flex: 1 1 calc(50% - 4px); } .day-pick input { flex: 1; min-width: 0; } }

/* the email itself, always inside a sandboxed frame; emails are designed on white */
.email-frame { display: block; width: 100%; height: 540px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color-scheme: light; }
.email-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 14px/1.55 var(--font-ui); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; max-height: 540px; overflow: auto; }
.email-view .section-head { margin-bottom: 8px; }
.email-dlg .seg span { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.email-tl { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 0; }
.email-tl li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; padding: 6px 0; position: relative; font-size: 14.5px; }
.email-tl li::before { content: ""; position: absolute; left: 4px; top: 22px; bottom: -8px; width: 1.5px; background: var(--line); }
.email-tl li:last-child::before { display: none; }
.ev-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--steel); align-self: center; }
.ev-t { font-weight: 600; }
.email-tl time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ev-d { grid-column: 2 / -1; grid-row: 2; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ev-opened .ev-dot, .ev-clicked .ev-dot, .ev-delivered .ev-dot { background: var(--sage); }
.ev-bounced .ev-dot, .ev-failed .ev-dot, .ev-complained .ev-dot { background: var(--clay); }
.ev-created .ev-dot, .ev-scheduled .ev-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--steel); }

/* wider sheets for editors with a live preview */
.modal.as-sheet.sheet-wide { width: min(1180px, 100vw); }
.modal.as-sheet.sheet-mid { width: min(780px, 100vw); }
#modal2.as-sheet[open] { display: flex; flex-direction: column; }
#modal2-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.ed-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 28px; align-items: start; }
@media (max-width: 920px) { .ed-cols { grid-template-columns: minmax(0, 1fr); } }
.ed-form { display: grid; gap: 14px; min-width: 0; align-content: start; }
.ed-preview { display: grid; gap: 10px; min-width: 0; position: sticky; top: 0; align-content: start; }
.ed-preview .section-head { margin-bottom: 0; }
.ed-preview .seg span { min-height: 28px; padding: 2px 10px; font-size: 13px; }
@media (max-width: 920px) { .ed-preview { position: static; } .ed-preview .email-frame { height: 460px; } }
.pv-subject { font-weight: 600; overflow-wrap: anywhere; }
textarea.mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.5; }
textarea.mono { tab-size: 2; }
.tpl-ed textarea[name="body"] { min-height: 260px; }
#st-html { min-height: 380px; }
.var-chips { gap: 6px; }
.var-chip { cursor: pointer; background: var(--surface); }
.var-chip:hover:not(:disabled) { border-color: var(--field-line); }
.var-chip:disabled { opacity: .6; cursor: not-allowed; }
.save-style-row { display: grid; gap: 8px; justify-items: start; }
.save-style { display: grid; gap: 8px; width: 100%; padding: 12px 14px; border: 1px dashed var(--field-line); border-radius: var(--r); background: var(--surface); }
.save-style .tag-add { max-width: none; }
.need-content { display: grid; gap: 8px; justify-items: start; }
.test-to { border-top: 1px solid var(--line); padding-top: 12px; }
.test-to .tag-add { max-width: none; }
.when-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.when-row input { width: auto; flex: 1 1 200px; }

/* templates list */
.tpl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 16px 10px 0; }
.tpl-main { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; padding: 4px 0 4px 16px; border: 0; background: none; text-align: left; color: inherit; min-width: 0; }
.tpl-text { display: grid; gap: 1px; min-width: 0; }
.tpl-text .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tpl-row .row-actions { flex-wrap: nowrap; }
@media (max-width: 760px) {
  .tpl-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px 10px 0; }
  .tpl-meta { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; padding-left: 62px; }
}

/* styles grid: each card shows the design, scaled down */
.style-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.style-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: grid; }
.style-open { display: block; padding: 0; border: 0; background: none; border-bottom: 1px solid var(--line); }
.style-open:hover .style-thumb { opacity: .9; }
.style-thumb { position: relative; height: 230px; overflow: hidden; background: #efefec; }
.style-frame { position: absolute; top: 0; left: 0; width: 640px; height: 900px; border: 0; transform-origin: 0 0; transform: scale(.38); pointer-events: none; background: #fff; }
.style-foot { display: grid; gap: 8px; padding: 12px 14px; }
.style-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* setup */
.setup { display: grid; gap: 20px; max-width: 900px; }
.setup .panel { display: grid; gap: 14px; }
.setup .section-head { margin-bottom: 0; }
.setup .stats { padding: 12px 0 0; border-bottom: 0; }
.supp-add { max-width: 460px; }
.supp-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 0; }
.supp-list .supp-email { font-weight: 600; overflow-wrap: anywhere; }
.supp-list .small { grid-column: 1; }
.supp-list .btn { grid-column: 2; grid-row: 1 / span 2; }
.sent-tools { margin-bottom: 12px; }
.table-wrap.is-empty { padding: 0 16px; }

/* campaign sheet: channels and email steps */
.chan-row { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.step-row { display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.step-row:first-child { border-top: 0; }
.step-row:not(.is-on) .step-pick { opacity: .62; }
.step-row .switch { font-size: 14px; font-weight: 500; }
.step-pick { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; padding-left: 48px; }
.step-pick select { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 14px; }
@media (max-width: 600px) { .step-pick { grid-template-columns: minmax(0, 1fr); padding-left: 0; } }
.email-window { margin-top: 2px; }
.pv-ch { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: 1px; }
.pv-ch .tag { line-height: 18px; font-size: 11.5px; }
.pv-partial b { color: var(--text); font-weight: 600; }

/* paste or upload a list */
.list-pane { display: grid; gap: 8px; }
.parsed { display: grid; gap: 10px; }
.parsed:empty { display: none; }
.parsed-head b { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 20px; font-weight: 650; }
.parsed-wrap { max-height: 360px; overflow: auto; }
.parsed-table td { padding: 6px 8px; vertical-align: top; }
.parsed-table th { padding: 8px; }
.parsed-table tbody tr { cursor: default; }
.parsed-table input { min-height: 32px; padding: 4px 8px; font-size: 14px; }
.parsed-table td.p-name { min-width: 130px; }
.parsed-table td.p-phone { min-width: 120px; }
.parsed-table td.p-email { min-width: 170px; }
.parsed-table td.p-more { min-width: 120px; display: grid; gap: 2px; padding-top: 10px; }
.parsed-table td.p-x { width: 1%; }
.parsed-table tr.has-issue { background: var(--clay-wash); }
.parsed-table tr.has-issue input { border-color: var(--clay); }
.row-problem { color: var(--clay); font-weight: 600; }
.row-problem:empty { display: none; }
@media (max-width: 860px) {
  .parsed-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important; gap: 6px 8px; padding: 10px 12px; }
  .parsed-table td { padding: 0 !important; min-width: 0 !important; }
  .parsed-table td.p-name { grid-column: 1 / 3 !important; grid-row: 1; }
  .parsed-table td.p-x { grid-column: 3 !important; grid-row: 1; }
  .parsed-table td.p-phone { grid-column: 1 !important; grid-row: 2; }
  .parsed-table td.p-email { grid-column: 2 / -1 !important; grid-row: 2; }
  .parsed-table td.p-more { grid-column: 1 / -1 !important; }
  .parsed-table td.p-more:has(span:empty + .row-problem:empty) { display: none; }
}

/* campaign page: emails panel and the email column */
.camp-mail { display: grid; gap: 14px; }
.camp-mail .section-head { margin-bottom: 0; flex-wrap: wrap; }
.camp-mail .section-title svg { width: 18px; height: 18px; color: var(--steel); align-self: center; }
.camp-mail .stats { padding: 0; border: 0; gap: 8px 28px; }
.stat.is-bad .stat-v { color: var(--clay); }
.step-sum { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; }
.step-sum li { display: grid; grid-template-columns: minmax(0, 15em) minmax(0, 1fr); gap: 2px 14px; }
.step-when { color: var(--muted); }
@media (max-width: 560px) { .step-sum li { grid-template-columns: minmax(0, 1fr); } }
.items td.c-mail .mail-addr { overflow-wrap: anywhere; margin-top: 2px; }
@media (max-width: 860px) {
  .items td.c-mail { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
  .items:not(:has(.c-sel)) td.c-mail { grid-column: 1 / -1; }
  .items td.c-mail .mail-addr { margin-top: 0; }
  .camp-mail .stats { gap: 6px 18px; }
  .camp-mail .stat { min-width: 64px; }
  .camp-mail .stat-v { font-size: 22px; }
}
/* label over value on phones, so long addresses get the whole width */
@media (max-width: 520px) {
  .setup .kv, .email-dlg .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .setup .kv dd, .email-dlg .kv dd { margin-bottom: 8px; }
  .setup .kv dt, .email-dlg .kv dt { font-size: 13px; }
}

/* contact drawer */
.d-email { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; margin-top: 2px; }
.d-email a { color: var(--muted); overflow-wrap: anywhere; }
.call-card .t .estat { line-height: 19px; font-size: 12px; }
.feed .mail .dot { background: var(--surface-2); color: var(--steel); }

/* replies: incoming email is graphite, so it stands out from what we sent */
.estat-received { background: var(--ink); color: var(--on-ink); }
.kind-ico.email.reply { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.feed .mail.reply .dot { background: var(--ink); color: var(--on-ink); }
.email-replies { display: grid; gap: 8px; }
.email-replies .list { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.owner-field { margin-top: 2px; }
.reply-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .reply-fields { grid-template-columns: minmax(0, 1fr); } }
.team-email { overflow-wrap: anywhere; }

/* ---------------------------------------------------------- "i" tips: what a feature does, on hover, focus or tap */
.itip-wrap { display: inline-flex; align-items: center; align-self: center; vertical-align: middle; flex: none; margin-left: 4px; line-height: 0; }
.tip-row { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; }
.tip-row.top { align-items: flex-start; }
.tip-row.top > .itip-wrap { margin-top: 3px; }
.field > .tip-row, .tv-q > .tip-row { justify-self: start; }
.itip { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: none; color: var(--faint); cursor: help; font: inherit; line-height: 0; -webkit-tap-highlight-color: transparent; }
.itip::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; } /* a 28px target around the 14px mark */
.itip > svg.itip-i { width: 14px; height: 14px; color: inherit; vertical-align: 0; align-self: center; stroke-width: 1.9; }
.itip:hover, .itip[data-open] { color: var(--text); }
.itip:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: 0 0 0 3px var(--focus-halo); }
.itip-bubble { display: none; position: fixed; inset: auto; left: 0; top: 0; margin: 0; z-index: 1000; box-sizing: border-box; width: max-content;
  max-width: min(260px, calc(100vw - 16px)); padding: 8px 11px; border: 1px solid var(--glass-line); border-radius: var(--r-lg);
  background: var(--glass-dense); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-hi), var(--shadow);
  color: var(--text); font: 400 13px/1.45 var(--font-ui); font-stretch: normal; letter-spacing: normal; text-transform: none; text-align: left;
  white-space: normal; overflow: visible; overflow-wrap: break-word; cursor: default; user-select: text; }
.itip-bubble:popover-open { display: block; }
.itip-bubble.itip-show { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .itip-bubble:popover-open { animation: itip-in .12s ease-out; }
  @keyframes itip-in { from { opacity: 0; transform: translateY(2px); } }
}
@media (forced-colors: active) { .itip-bubble { border-color: CanvasText; } }
/* a tip after a tab list carries the list's bottom rule on */
.tabs-row { display: flex; align-items: stretch; min-width: 0; }
.tabs-row > .tabs { flex: 0 1 auto; min-width: 0; }
.tabs-row > .itip-wrap { margin: 0; padding: 0 6px; border-bottom: 1px solid var(--line); flex: 1 0 auto; align-self: stretch; }
.chips-tip { display: flex; align-items: flex-start; gap: 4px; }
.chips-tip > .info-chips { flex: 0 1 auto; min-width: 0; }
.chips-tip > .itip-wrap { margin-top: 11px; align-self: flex-start; }
.d-score { gap: 4px; align-self: center; }
.tag-field { margin-top: 12px; max-width: 360px; }
.import-sheet .check { margin-top: 0; }
.tip-row.top > .itip-wrap { align-self: flex-start; }
.field-foot > .tip-row { flex: none; }
.field-foot > p { min-width: 0; }

/* Voice and lines → Phone numbers: the Plivo numbers, the default for outgoing calls */
.num-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.num-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.num-row.is-default { border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--text); }
.num-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.num-pick input { margin: 0; }
.num-main { display: flex; flex-direction: column; min-width: 0; }
.num-v { font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.num-city { font-size: 12.5px; color: var(--muted); }
.num-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.camp-from { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }

/* messages thread (contact drawer) and inbox */
.chat-list { list-style: none; margin: 0 0 10px; padding: 4px 2px; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.bubble { max-width: 85%; padding: 8px 11px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); justify-self: start; min-width: 0; }
.bubble.out { justify-self: end; background: var(--ink-wash); }
.bubble.failed { box-shadow: inset 0 0 0 1px var(--clay); }
.bubble-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.chat-form { display: grid; gap: 8px; }
.chat-form textarea { width: 100%; }
.chat-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.chat-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.tpl-vars { display: grid; gap: 8px; }
.tpl-box { max-width: 100%; justify-self: stretch; }
.inbox-row { text-decoration: none; color: inherit; }
.inbox-row.waiting .row-name { font-weight: 700; }

/* WhatsApp campaigns */
.wa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 0 0 18px; }
.wa-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.wa-stat b { font-size: 22px; }
.wa-stat span { font-size: 13px; color: var(--muted); }
.wa-blank { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; align-items: end; }
.wa-aud { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.wa-aud-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .wa-blank { grid-template-columns: 1fr; } }

/* team inbox: who handles a chat, open / closed, unread (conversations.py) */
.inbox-row.unread .row-name, .inbox-row.unread .row-sum { font-weight: 700; color: var(--text); }
.row-when .unread-n { display: inline-block; font-size: 12px; font-weight: 700; min-width: 20px; padding: 0 6px; border-radius: var(--r-sm); background: var(--ink); color: var(--on-ink); text-align: center; line-height: 20px; }
.convo-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 10px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.convo-owner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.convo-owner .field-label { margin: 0; white-space: nowrap; }
.convo-owner select { min-width: 0; max-width: 220px; }
.convo-state { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* quick replies (quick_replies.py) */
.chat-form { position: relative; }
.qr-pop { display: grid; gap: 6px; padding: 8px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); }
.qr-pop[hidden] { display: none; }
.qr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.qr-item { display: grid; gap: 2px; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.qr-item:hover, .qr-item:focus-visible { background: var(--ink-wash); }
.qr-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.qr-top code { font-size: 12.5px; color: var(--muted); }
.qr-text { margin: 0; font-size: 13.5px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qr-none { padding: 6px 9px; }
.qr-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 6px; }
.qr-new { margin: 0 0 12px; }
.qr-form { display: grid; gap: 10px; margin: 0 0 16px; padding: 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.qr-form textarea { width: 100%; }
.qr-slash { display: flex; align-items: center; gap: 4px; }
.qr-slash input { flex: 1; min-width: 0; }
.qr-manage { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qr-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.qr-main { display: grid; gap: 4px; min-width: 0; }
.qr-manage .qr-text { -webkit-line-clamp: 4; }
.qr-main p.small { margin: 0; }
.qr-acts { display: flex; align-items: center; gap: 6px; flex: none; }

/* files, quotes and reactions in chats (media.py) */
.media { margin: 0 0 4px; }
.media-open { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--r-sm); }
.media-image img { display: block; max-width: 240px; max-height: 260px; height: auto; border-radius: var(--r-sm); background: var(--surface-2); min-width: 60px; min-height: 40px; }
.media-video video { display: block; max-width: 260px; max-height: 260px; border-radius: var(--r-sm); }
.media-audio audio { display: block; width: 240px; height: 40px; }
.media-doc { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.media-doc:hover { background: var(--surface-2); }
.media-doc svg { width: 18px; height: 18px; flex: none; }
.media-doc-name { overflow-wrap: anywhere; font-weight: 600; }
.media-doc small { color: var(--muted); white-space: nowrap; }
.media-note { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-style: italic; }
.media-big { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto 12px; border-radius: var(--r-sm); }
.bubble-quote { display: grid; gap: 1px; width: 100%; margin: 0 0 6px; padding: 5px 8px; border: 0; border-left: 3px solid var(--steel); border-radius: var(--r-xs); background: rgb(127 127 127 / .1); color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.bubble-quote span { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bubble-react { display: flex; gap: 4px; margin: 4px 0 0; }
.bubble-react span { font-size: 15px; line-height: 22px; padding: 0 6px; border-radius: 11px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.bubble-react span.ours { box-shadow: inset 0 0 0 1px var(--steel); }
.bubble { position: relative; }
/* Reply / React float over the bubble's corner on hover or keyboard focus, so they take no room; on touch they sit below */
.bubble-acts { position: absolute; top: -14px; right: 6px; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s; }
.bubble:hover .bubble-acts, .bubble:focus-within .bubble-acts { opacity: 1; pointer-events: auto; }
@media (hover: none) { .bubble-acts { position: static; opacity: 1; pointer-events: auto; margin: 6px 0 0; padding: 0; background: none; box-shadow: none; } }
.chat-list { padding-top: 16px; }
.mini-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.mini-btn:hover { background: var(--surface-2); }
.mini-btn.emoji { font-size: 15px; padding: 0 6px; }
.mini-btn svg { width: 13px; height: 13px; }
.bubble.flash { box-shadow: inset 0 0 0 2px var(--ink); }
.reply-quote { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 10px; border-left: 3px solid var(--steel); border-radius: var(--r-xs); background: var(--surface-2); font-size: 13.5px; }
.reply-quote > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.attach-chip[hidden] { display: none; }
.attach-chip svg { width: 18px; height: 18px; flex: none; }
.attach-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-xs); flex: none; }
.attach-chip audio { height: 34px; max-width: 220px; }
.attach-name { flex: 1; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.chat-form.drop { outline: 2px dashed var(--steel); outline-offset: 4px; }
.chat-form progress { width: 100%; height: 6px; }
.chat-form progress[hidden] { display: none; }
.rec-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: var(--r-sm); background: var(--clay-wash); }
.rec-bar[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clay); animation: rec-pulse 1s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } .bubble-acts { transition: none; } }
.form-actions .btn[hidden] { display: none; }

/* WhatsApp reply buttons and lists (interactive.py) */
.ia { display: grid; gap: 4px; }
.ia-head { margin: 0; font-weight: 700; }
.ia-foot { margin: 0; font-size: 12.5px; color: var(--muted); }
.ia-buttons { display: grid; gap: 4px; margin-top: 4px; }
.ia-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13.5px; font-weight: 600; color: var(--text); text-align: center; }
.ia-btn svg { width: 14px; height: 14px; }
.ia-list { display: grid; gap: 6px; margin-top: 4px; }
.ia-list ul { list-style: none; margin: 0; padding: 0 2px; display: grid; gap: 4px; font-size: 13px; }
.ia-list li { display: grid; }
.ia-list li small { color: var(--muted); }
.ia-list .ia-sec { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 2px; }
.bubble-text.tapped { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tapped-l { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.tapped-l svg { width: 14px; height: 14px; }
.ia-builder .ia-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 20px; align-items: start; }
.ia-fields { display: grid; gap: 12px; }
.ia-side { position: sticky; top: 0; }
.ia-preview { max-width: 100%; justify-self: stretch; }
.ia-opts { display: grid; gap: 8px; }
.ia-opts > .btn { justify-self: start; }
.ia-row { display: flex; gap: 6px; align-items: center; }
.ia-row input { flex: 1; min-width: 0; }
.ia-sec-edit { display: grid; gap: 8px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.ia-sec-edit legend { padding: 0 4px; font-size: 13px; font-weight: 600; }
.ia-sec-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.qr-new { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-ia { max-width: 320px; padding: 8px 10px; border-radius: var(--r); background: var(--ink-wash); }
.qr-item[aria-disabled="true"] { opacity: .55; }
.qr-top .tag { font-size: 11px; }
@media (max-width: 720px) { .ia-builder .ia-grid { grid-template-columns: 1fr; } .ia-side { position: static; } }

/* AI help in the reply box (ai_reply.py) */
.ai-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: var(--r-sm); background: var(--brass-wash); color: var(--brass-ink); font-size: 13.5px; }
.ai-note[hidden] { display: none; }
.ai-note > span { flex: 1; min-width: 0; }
.ai-note svg { width: 15px; height: 15px; flex: none; }
.ai-note.warn { background: var(--clay-wash); color: var(--text); }
.ai-note.busy svg { animation: rec-pulse 1.2s ease-in-out infinite; }
.ai-menu { display: grid; gap: 2px; padding: 6px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); }
.ai-menu[hidden] { display: none; }
.ai-menu button { display: grid; gap: 1px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ai-menu button:hover, .ai-menu button:focus-visible { background: var(--brass-wash); }
.ai-menu small { color: var(--muted); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .ai-note.busy svg { animation: none; } }

/* automations (automations.py) */
.crumbs { margin: 0 0 4px; font-size: 13.5px; }
.crumbs a { color: var(--muted); }
.au-card { margin: 0 0 16px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 12px; }
.au-card > .section-title { margin: 0; }
.au-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.au-inline > .field { min-width: 140px; }
.au-inline > .field.grow { flex: 1; min-width: 220px; }
.au-trig { display: grid; gap: 12px; max-width: 640px; }
.au-chans, .au-days { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
.au-chans legend, .au-days legend { width: 100%; padding: 0 0 4px; font-size: 13px; font-weight: 600; }
.au-dur { display: inline-flex; gap: 6px; }
.au-num { width: 84px; }
.au-steps { display: grid; gap: 8px; }
.au-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.au-step { display: grid; gap: 10px; padding: 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.au-step-h { display: flex; align-items: center; gap: 8px; }
.au-step-h svg { width: 16px; height: 16px; color: var(--muted); }
.au-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 700; }
.au-tools { margin-left: auto; display: flex; gap: 2px; }
.au-step textarea { width: 100%; }
.au-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.au-branch { display: grid; gap: 8px; align-content: start; padding: 10px; border-radius: var(--r); background: var(--surface); border-left: 3px solid var(--sage); }
.au-branch.no { border-left-color: var(--clay); }
.au-branch-h { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.au-branch .au-step { background: var(--surface-2); }
.au-add { position: relative; }
.au-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 6px; padding: 10px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); }
.au-menu-g { display: grid; gap: 2px; align-content: start; }
.au-menu-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 6px 2px; }
.au-pick { display: flex; align-items: center; gap: 8px; padding: 6px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.au-pick:hover, .au-pick:focus-visible { background: var(--ink-wash); }
.au-pick svg { width: 15px; height: 15px; color: var(--muted); }
.au-vars { display: grid; gap: 8px; }
.au-ia { max-width: 320px; padding: 8px 10px; border-radius: var(--r); background: var(--ink-wash); }
.au-save { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 0 0 24px; flex-wrap: wrap; }
.au-save .form-error { margin: 0; }
.au-recipes { margin-top: 24px; }
.au-recipe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.au-recipe { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.au-recipe:hover { background: var(--surface-2); }
.au-recipe span { font-size: 13.5px; color: var(--muted); }
.au-row { text-decoration: none; color: inherit; }
.au-runs { list-style: none; margin: 10px 0 24px; padding: 0; display: grid; gap: 6px; }
.au-runs details { padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.au-runs summary { cursor: pointer; }
.au-err { color: var(--clay); font-size: 13px; }
.au-log { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 2px; font-size: 13.5px; }
.au-log li.bad { color: var(--clay); }
.au-card .switch > span { display: grid; gap: 1px; }
.au-card .switch small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 600px) { .au-card { padding: 12px; } .au-step { padding: 10px; } .au-branch { padding: 8px 6px 8px 8px; } .au-branches { grid-template-columns: 1fr; } }

/* flows (flows.py): the canvas editor */
.fl-top { gap: 10px; }
.fl-settings summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.fl-settings[open] summary { margin-bottom: 10px; }
.fl-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; margin-bottom: 14px; }
.fl-stage { position: relative; min-width: 0; }
.fl-tools { position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 6px; border-radius: var(--r); background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); max-width: calc(100% - 20px); }
.fl-addmenu { position: absolute; top: calc(100% + 6px); left: 0; display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 2px; padding: 8px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-lg); }
.fl-addmenu[hidden] { display: none; }
.fl-canvas { position: relative; height: min(70vh, 680px); min-height: 420px; overflow: hidden; border-radius: var(--r-lg); background-color: var(--surface-2); background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1.2px); background-size: 22px 22px; box-shadow: inset 0 0 0 1px var(--line); cursor: grab; touch-action: none; user-select: none; }
.fl-canvas:active { cursor: grabbing; }
.fl-canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fl-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fl-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.fl-edges path { fill: none; stroke: var(--steel); stroke-width: 2; }
.fl-edges path.hot { stroke: var(--ink); stroke-width: 2.6; }
.fl-edges path.temp { stroke: var(--brass); stroke-dasharray: 6 5; }
.fl-node { position: absolute; display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); cursor: move; }
.fl-node.sel { box-shadow: inset 0 0 0 2px var(--ink), var(--shadow-lg); }
.fl-node.bad { box-shadow: inset 0 0 0 2px var(--clay), var(--shadow); }
.fl-node.warn:not(.sel) { box-shadow: inset 0 0 0 1px var(--brass), var(--shadow); }
.fl-node.fl-start { background: var(--ink-wash); }
.fl-node.fl-handoff, .fl-node.fl-end { background: var(--sage-wash); }
.fl-head { display: flex; align-items: center; gap: 7px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fl-head svg { width: 15px; height: 15px; color: var(--muted); }
.fl-sum { margin: 0; font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fl-outs { display: grid; gap: 3px; margin-right: -12px; }
.fl-out { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.fl-out > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-port { width: 14px; height: 14px; margin-right: -7px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--steel); cursor: crosshair; flex: none; }
.fl-port.on { background: var(--steel); }
.fl-port:hover { box-shadow: inset 0 0 0 2px var(--ink); background: var(--ink); }
.fl-in { position: absolute; left: -7px; top: 16px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--steel); }
.fl-panel { position: sticky; top: 12px; display: grid; gap: 0; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); max-height: calc(100vh - 24px); overflow: auto; }
.fl-panel .tabs { padding: 0 8px; border-bottom: 1px solid var(--line); }
.fl-panel-body { display: grid; gap: 10px; padding: 14px; align-content: start; }
.fl-panel-body textarea, .fl-panel-body input[type="text"] { width: 100%; }
.fl-ph { display: flex; align-items: center; gap: 8px; }
.fl-ph svg { width: 16px; height: 16px; }
.fl-ph .btn { margin-left: auto; }
.fl-opt { display: grid; gap: 6px; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.fl-opt legend { padding: 0 4px; font-size: 12.5px; font-weight: 600; }
.fl-opt .btn { justify-self: start; }
.fl-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.fl-issues li { padding: 5px 8px; border-radius: var(--r-sm); }
.fl-issues li.error { background: var(--clay-wash); }
.fl-issues li.warning { background: var(--brass-wash); color: var(--brass-ink); }
.fl-issues.big li { padding: 8px 10px; }
.linkish { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.fl-try { max-height: 380px; min-height: 160px; }
.fl-info { justify-self: center; font-size: 12.5px; color: var(--muted); text-align: center; }
.fl-info.strong { color: var(--sage); font-weight: 600; }
.fl-info.bad { color: var(--clay); }
.fl-try-opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.fl-try-form { display: flex; gap: 6px; }
.fl-try-form input { flex: 1; min-width: 0; }
.convo-flow { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.convo-flow .tag svg { width: 13px; height: 13px; }
@media (max-width: 1000px) {
  .fl-main { grid-template-columns: 1fr; }
  .fl-panel { position: static; max-height: none; }
  .fl-canvas { height: 60vh; min-height: 360px; }
  .fl-addmenu { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

/* deals (deals.py): Pipeline → Deals */
.page-tabs { margin: 4px 0 16px; border-bottom: 1px solid var(--line); }
.page-tabs .tab { text-decoration: none; }
.deal-bar { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.deal-bar .search { min-width: 200px; }
.wa-stat.warn b { color: var(--clay); }
.col-total { margin: -6px 4px 0; font-size: 13px; color: var(--muted); }
.deal-card { cursor: grab; gap: 6px; }
.deal-card[draggable="false"] { cursor: default; }
.deal-title { padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 650; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.deal-title:hover { text-decoration: underline; }
.deal-val-line { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.deal-val-line b { font-size: 16px; }
.deal-end { min-height: 0; align-self: start; border-color: var(--line-strong); }
.deal-end.won { background: color-mix(in srgb, var(--sage-wash) 60%, transparent); }
.deal-end.lost { background: color-mix(in srgb, var(--clay-wash) 60%, transparent); }
.col.drop { border-color: var(--ink); }
.deal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.deal-form .deal-money { display: flex; gap: 6px; }
.deal-val { width: 160px; }
.deal-lost { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 10px; border-radius: var(--r); background: var(--clay-wash); }
.deal-lost[hidden] { display: none; }
.deal-lost .field { flex: 1; min-width: 200px; }
.deal-actions { flex-wrap: wrap; }
.pick { position: relative; }
.pick input { width: 100%; }
.pick-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 4px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-lg); max-height: 260px; overflow: auto; }
.pick-list[hidden] { display: none; }
.pick-list button { display: grid; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pick-list button:hover, .pick-list button:focus-visible { background: var(--ink-wash); }
.pick-list small { color: var(--muted); }
.stage-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: st; }
.stage-edit li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stage-edit li::before { counter-increment: st; content: counter(st) "."; width: 20px; color: var(--muted); font-size: 13px; }
.stage-edit input[type="text"] { flex: 1; min-width: 140px; }
.stage-pct { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.deal-mini { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.deal-mini li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deal-mini li .linkish { flex: 1; min-width: 0; }
.deal-bar > select { width: auto; min-width: 150px; }
.deal-bar .toolbar { margin: 0; }

/* custom fields (custom_fields.py) and duplicates (duplicates.py) */
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 12px; }
.cf-grid input, .cf-grid select { width: 100%; }
.cf-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.cf-add input[type="text"] { flex: 1; min-width: 180px; }
.cf-add input[hidden] { display: none; }
.cf-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cf-edit > li { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.cf-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cf-row input { flex: 1; min-width: 160px; }
.cf-acts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.dup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dup-pair { padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: grid; gap: 8px; }
.dup-why { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.dup-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dup-col { display: grid; gap: 8px; align-content: start; padding: 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.dup-col .btn { justify-self: start; }
.dup-name { font-weight: 700; font-size: 16px; }
.dup-col dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13.5px; }
.dup-col dt { color: var(--muted); }
.dup-col dd { margin: 0; overflow-wrap: anywhere; }
.dup-col dd.diff { font-weight: 600; }
.dup-notice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 12px; border-radius: var(--r); background: var(--brass-wash); color: var(--brass-ink); font-size: 14px; }
.dup-notice svg { width: 16px; height: 16px; }
.dup-notice > span { flex: 1; min-width: 0; }
@media (max-width: 600px) { .dup-cols { grid-template-columns: 1fr; } }
.wa-list { display: grid; gap: 8px; margin-top: 8px; }
.wa-list[hidden], .wa-aud-row[hidden] { display: none; }
.wa-list textarea { width: 100%; }
.wa-list .btn { justify-self: start; }
.wa-aud input[type="datetime-local"] { margin-top: 8px; }
.wa-aud input[hidden] { display: none; }

/* ---------- the team: who's online, the bell, invite links, viewers (Phase 11) */
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1.5px solid var(--surface); box-sizing: content-box; }
.pdot.online { background: var(--sage); }
.pdot.away { background: var(--brass); }
.pdot.offline { background: transparent; border-color: var(--field-line); width: 7px; height: 7px; }
.presence { display: inline-flex; align-items: center; margin-right: 6px; vertical-align: middle; }
.online-strip { display: flex; align-items: center; gap: 4px; margin-right: 6px; flex-wrap: wrap; }
.online-strip .small { margin-right: 4px; }
.p-av { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink-wash); color: var(--text); font-size: 11.5px; font-weight: 700; }
.p-av .pdot { position: absolute; right: -1px; bottom: -1px; }
.also-here { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--brass-ink); background: var(--brass-wash); border-radius: var(--r-sm); padding: 6px 10px; margin: 0 0 8px; }
.also-here svg { width: 16px; height: 16px; flex: none; }
.bell { position: relative; }
.bell-n { position: absolute; top: -3px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--clay); color: var(--on-clay); font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; }
.notif-list { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.notif { display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; color: var(--text); cursor: pointer; font: inherit; }
.notif:hover { background: var(--ink-wash); }
.notif span { color: var(--muted); font-size: 13.5px; }
.notif time { color: var(--faint); font-size: 12px; }
.notif-list li.unread .notif { border-left: 3px solid var(--ink); }
.notif-list li:not(.unread) .notif b { font-weight: 500; }
.roles-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 4px 0 14px; align-items: center; }
.roles-dl dd { margin: 0; font-size: 13.5px; color: var(--muted); }
.list.invites { list-style: none; padding: 0; margin: 0 0 18px; }
.list.invites .row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
body.read-only .head-actions .btn-primary { display: none; }

/* ---------- integrations: numbers, API keys, webhooks (Phase 12) */
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 4px 0; color: var(--muted); }
.check-row input { margin-top: 3px; }
.check-row code { color: var(--text); font-size: 12.5px; }
.code-block { background: var(--ink-wash); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; margin: 8px 0; }
.code-block code { white-space: pre; }
.list.int-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.list.int-list .row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.list.int-list .row-who { display: grid; gap: 4px; min-width: 0; }
.list.int-list .row-name b { word-break: break-all; }
.list.int-list .is-off { opacity: .7; }

/* ---------- the chat dashboard (Phase 13). Chart hues: validated pair (dataviz validator), stepped per mode */
:root { --viz-in: #257de0; --viz-out: #f47230; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-in: #338ced; --viz-out: #e76624; } }
:root[data-theme="dark"] { --viz-in: #338ced; --viz-out: #e76624; }
.cd { display: grid; gap: 22px; }
.cd-target { display: inline-flex; align-items: center; gap: 6px; }
.cd-att .stats { border-top: 0; padding-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kpi { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.kpi-l { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kpi-v { font-family: var(--font-display); font-stretch: var(--w-display); font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-d { font-size: 12.5px; color: var(--muted); }
.kpi-d.up { color: var(--sage); }
.kpi-d.down { color: var(--clay); }
.wait { font-weight: 600; font-variant-numeric: tabular-nums; }
.wait-ok { color: var(--sage); }
.wait-warn { color: var(--brass-ink); }
.wait-late { color: var(--clay); }
.warn-text { color: var(--clay); font-weight: 600; }
.cd-queue { margin-top: 10px; }
.cd-failed { margin-top: 12px; }
.cd-failed summary, .vtable summary { cursor: pointer; font-size: 13.5px; color: var(--muted); }
.cd-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.cd-auto td { color: var(--muted); }
.vwrap { display: grid; gap: 8px; }
.vlegend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.vlegend span, .vtip span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw-in { background: var(--viz-in); }
.sw-out { background: var(--viz-out); }
.vplot { position: relative; }
.vchart { width: 100%; height: auto; display: block; overflow: visible; }
.vgrid { stroke: var(--line); stroke-width: 1; }
.vbase { stroke: var(--line-strong); stroke-width: 1; }
.vtick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.vin { fill: var(--viz-in); }
.vout { fill: var(--viz-out); }
.vhit { fill: transparent; }
.vslot:hover .vhit { fill: var(--ink-wash); opacity: .6; }
.vtip { position: absolute; top: 0; transform: translateX(-50%); display: grid; gap: 2px; padding: 6px 10px; font-size: 12.5px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }
.hstrip { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; margin: 6px 0 4px; }
.hcell { position: relative; height: 28px; border-radius: 2px; background: color-mix(in oklab, var(--viz-in) var(--a), var(--surface)); border: 1px solid var(--line); }
.hlab { position: absolute; bottom: -17px; left: 0; font-size: 10.5px; color: var(--faint); }
.hstrip + p { margin-top: 18px; }
.login-lang { display: flex; justify-content: center; margin-top: 12px; }
.login-lang select { width: auto; }
@media (max-width: 860px) { .cd-team td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; } }
