/* CodeFlow dashboard. One stylesheet, no build step.
   Order: tokens, base, shell, components, charts, pages, small screens. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --line: #e3e7f0;
  --line-strong: #cfd6e4;
  --ink: #0e1424;
  --ink-2: #47516a;
  --ink-3: #626c86;
  --accent: #3562f5;
  --accent-hover: #2a52dc;
  --accent-ink: #2a4fd0;
  --accent-soft: #eaf0ff;
  --focus: #3d6aff;

  --side-bg: #0e1424;
  --side-line: rgba(255, 255, 255, 0.08);
  --side-ink: #a9b2c7;
  --side-ink-strong: #f3f5fa;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(61, 106, 255, 0.22);

  /* tones: badge background, text, dot */
  --neutral-bg: #eef1f6; --neutral-ink: #47516a; --neutral-dot: #8a93a8;
  --run-bg: #e8efff;     --run-ink: #2548c2;     --run-dot: #3d6aff;
  --action-bg: #fff3d6;  --action-ink: #855600;  --action-dot: #e69a00;
  --wait-bg: #f0ebff;    --wait-ink: #5a3fc0;    --wait-dot: #7c5cf0;
  --good-bg: #e0f6ea;    --good-ink: #0c6a3b;    --good-dot: #17a35c;
  --bad-bg: #fde8e8;     --bad-ink: #b3261e;     --bad-dot: #e04545;
  --muted-bg: #f1f2f6;   --muted-ink: #626c86;   --muted-dot: #a4abbb;

  /* chart colours (validated light set; order is fixed) */
  --viz-pipeline: #3d6aff;
  --viz-call: #e69a00;
  --viz-out: #7c5cf0;
  --viz-won: #17a35c;
  --viz-closed: #9aa3b5;
  --viz-attention: #e04545;
  --viz-track: #eef1f8;
  --viz-grid: #e6e9f1;

  --shadow-1: 0 1px 2px rgba(14, 20, 36, 0.05);
  --shadow-2: 0 4px 16px rgba(14, 20, 36, 0.08), 0 1px 2px rgba(14, 20, 36, 0.05);
  --shadow-3: 0 24px 64px rgba(14, 20, 36, 0.22);
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --side-w: 248px;
}

/* dark values, declared twice: once for the OS setting, once for the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0e1a; --surface: #111726; --surface-2: #151c2e; --surface-3: #1b2338;
    --line: #222b42; --line-strong: #2f3a57;
    --ink: #eef1f8; --ink-2: #b7bfd3; --ink-3: #8b95ae;
    --accent: #3d6aff; --accent-hover: #5279ff; --accent-ink: #8ea8ff; --accent-soft: #18244a; --focus: #7d9aff;
    --side-bg: #0c111f; --side-line: rgba(255, 255, 255, 0.07);
    --neutral-bg: #1b2338; --neutral-ink: #b7bfd3; --neutral-dot: #7a849c;
    --run-bg: rgba(61, 106, 255, 0.18);  --run-ink: #a3b8ff;    --run-dot: #5b82ff;
    --action-bg: rgba(230, 154, 0, 0.16); --action-ink: #f2c46a; --action-dot: #e69a00;
    --wait-bg: rgba(124, 92, 240, 0.2);  --wait-ink: #c2b3ff;   --wait-dot: #9079f5;
    --good-bg: rgba(23, 163, 92, 0.17);  --good-ink: #72dba6;   --good-dot: #1eb06c;
    --bad-bg: rgba(224, 69, 69, 0.17);   --bad-ink: #ff9d9d;    --bad-dot: #e85d5d;
    --muted-bg: #161c2c; --muted-ink: #8b95ae; --muted-dot: #5d667d;
    --viz-pipeline: #5b82ff; --viz-call: #c98500; --viz-out: #9079f5; --viz-won: #1eb06c;
    --viz-closed: #646d84; --viz-attention: #e85d5d; --viz-track: #1b2338; --viz-grid: #1f273c;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e1a; --surface: #111726; --surface-2: #151c2e; --surface-3: #1b2338;
  --line: #222b42; --line-strong: #2f3a57;
  --ink: #eef1f8; --ink-2: #b7bfd3; --ink-3: #8b95ae;
  --accent: #3d6aff; --accent-hover: #5279ff; --accent-ink: #8ea8ff; --accent-soft: #18244a; --focus: #7d9aff;
  --side-bg: #0c111f; --side-line: rgba(255, 255, 255, 0.07);
  --neutral-bg: #1b2338; --neutral-ink: #b7bfd3; --neutral-dot: #7a849c;
  --run-bg: rgba(61, 106, 255, 0.18);  --run-ink: #a3b8ff;    --run-dot: #5b82ff;
  --action-bg: rgba(230, 154, 0, 0.16); --action-ink: #f2c46a; --action-dot: #e69a00;
  --wait-bg: rgba(124, 92, 240, 0.2);  --wait-ink: #c2b3ff;   --wait-dot: #9079f5;
  --good-bg: rgba(23, 163, 92, 0.17);  --good-ink: #72dba6;   --good-dot: #1eb06c;
  --bad-bg: rgba(224, 69, 69, 0.17);   --bad-ink: #ff9d9d;    --bad-dot: #e85d5d;
  --muted-bg: #161c2c; --muted-ink: #8b95ae; --muted-dot: #5d667d;
  --viz-pipeline: #5b82ff; --viz-call: #c98500; --viz-out: #9079f5; --viz-won: #1eb06c;
  --viz-closed: #646d84; --viz-attention: #e85d5d; --viz-track: #1b2338; --viz-grid: #1f273c;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.6);
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 680; letter-spacing: -0.022em; text-wrap: balance; }
h2 { font-size: 15px; line-height: 1.35; font-weight: 640; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 620; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(61, 106, 255, 0.25); }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.show-sm { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.icon { flex: none; }
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--r-1);
  background: var(--accent); color: #fff; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--side-line);
  padding: 18px 12px 12px; overflow-y: auto;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--side-ink-strong); }
.side__brand:hover { text-decoration: none; }
.side__brand svg { width: 34px; height: 34px; }
.side__brand span { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.side__group { margin-top: 18px; }
.side__group:first-of-type { margin-top: 4px; }
.side__label {
  padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #8791ab;
}
.side__link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); font-weight: 520; transition: background 0.12s, color 0.12s;
}
.side__link:hover { background: var(--side-hover); color: var(--side-ink-strong); text-decoration: none; }
.side__link.is-active { background: var(--side-active); color: #fff; }
.side__link.is-active .icon { color: #8ea8ff; }
.side__count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: #e69a00; color: #1c1400; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.side__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--side-line); }
.side__user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.side__user-name { color: var(--side-ink-strong); font-weight: 600; line-height: 1.3; }
.side__user-role { font-size: 12px; color: #7f8aa5; }
.side__user > div { min-width: 0; }
.side__user-name, .side__user-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__tools { display: flex; gap: 6px; }
.side__tool {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 8px;
  border: 1px solid var(--side-line); border-radius: 8px; background: transparent; color: var(--side-ink);
  font-size: 12.5px; font-weight: 520;
}
.side__tool:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.side__tools form { flex: 1; display: flex; }
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .top__menu { display: none; }
.top__search { position: relative; flex: 1; max-width: 420px; }
.top__search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.top__search input {
  width: 100%; height: 36px; padding: 0 44px 0 34px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s;
}
.top__search input::placeholder { color: var(--ink-3); }
.top__search input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(61, 106, 255, 0.18); }
.top__search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.top__spacer { flex: 1; }
kbd {
  padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink-3); font: 600 11px/1.5 inherit;
}

.page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 28px 64px; }
.page--narrow > * { max-width: 840px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page__sub { margin-top: 4px; color: var(--ink-2); max-width: 68ch; }
.page__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--ink-3); font-size: 13px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink);
  font-weight: 580; white-space: nowrap; box-shadow: var(--shadow-1);
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { border-color: transparent; background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(53, 98, 245, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn--primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn--good { border-color: transparent; background: #12884c; color: #fff; }
.btn--good:hover { background: #0f7541; border-color: transparent; }
.btn--danger { color: var(--bad-ink); }
.btn--danger:hover { background: var(--bad-bg); border-color: var(--bad-dot); }
.btn--ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn--sm { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn--lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------------------------------------------ forms */

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; }
.field + .field { margin-top: 16px; }
.field > label, .label { font-weight: 580; font-size: 13px; }
.field .hint, .hint { color: var(--ink-3); font-size: 12.5px; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(61, 106, 255, 0.18); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; padding-right: 34px; background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2368728c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2.500 4.500 3.500 3.500 3.500-3.500'/%3E%3C/svg%3E");
}
.select--sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--ink-3); font-size: 12.5px; }
.consent-tick { cursor: pointer; }
.consent-tick strong { font-weight: 580; }
.consent-fields { margin-top: 16px; }
.consent-meta { margin-top: 14px; }
.consent-actions { margin-top: 14px; }

/* choices shown as cards: radio inputs with a label each */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice label {
  display: block; height: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.choice label strong { display: block; font-weight: 600; }
.choice label span { color: var(--ink-3); font-size: 12.5px; }
.choice label:hover { border-color: var(--ink-3); }
.choice input:checked + label { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ cards */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card__head p { color: var(--ink-3); font-size: 13px; margin-top: 1px; }
.card__body { padding: 16px 20px 20px; }
.card__body--flush { padding: 8px 0 0; }
.card__foot { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.card__tools { display: flex; align-items: center; gap: 4px; margin: -4px -8px -4px 0; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid .card + .card { margin-top: 0; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.grid--detail { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack > * { min-width: 0; }
.stack > .card + .card { margin-top: 0; }
.section { margin-top: 28px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section__head h2 { font-size: 16px; }
.toolbar + .section__head { margin-top: 24px; }

/* ------------------------------------------------------------------ badges, avatars, pills */

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px;
  background: var(--neutral-bg); color: var(--neutral-ink); font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); flex: none; }
.badge--run { background: var(--run-bg); color: var(--run-ink); } .badge--run .badge__dot { background: var(--run-dot); }
.badge--action { background: var(--action-bg); color: var(--action-ink); } .badge--action .badge__dot { background: var(--action-dot); }
.badge--wait { background: var(--wait-bg); color: var(--wait-ink); } .badge--wait .badge__dot { background: var(--wait-dot); }
.badge--good { background: var(--good-bg); color: var(--good-ink); } .badge--good .badge__dot { background: var(--good-dot); }
.badge--bad { background: var(--bad-bg); color: var(--bad-ink); } .badge--bad .badge__dot { background: var(--bad-dot); }
.badge--muted { background: var(--muted-bg); color: var(--muted-ink); } .badge--muted .badge__dot { background: var(--muted-dot); }
.badge.is-live .badge__dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--ink-2); font-size: 12px; font-weight: 560; white-space: nowrap;
}
.tag--warn { border-color: color-mix(in srgb, var(--action-dot) 55%, transparent); background: var(--action-bg); color: var(--action-ink); }

.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em; color: #fff; background: #5b6b8c;
}
.avatar--round { border-radius: 50%; }
.avatar--lg { width: 52px; height: 52px; border-radius: 13px; font-size: 18px; }
.avatar--sm { width: 26px; height: 26px; border-radius: 7px; font-size: 10.5px; }
.avatar--1 { background: linear-gradient(135deg, #4f7cff, #3355e0); }
.avatar--2 { background: linear-gradient(135deg, #8a6cf5, #6243d6); }
.avatar--3 { background: linear-gradient(135deg, #1fb57a, #128a5a); }
.avatar--4 { background: linear-gradient(135deg, #f0913c, #d96a1c); }
.avatar--5 { background: linear-gradient(135deg, #e0609a, #c23d79); }
.avatar--6 { background: linear-gradient(135deg, #2aa7c9, #1b7fa3); }

.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who__text { min-width: 0; }
.who__name { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__sub { display: block; color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); font-weight: 560; font-size: 13px; white-space: nowrap;
}
.pill:hover { border-color: var(--ink-3); color: var(--ink); text-decoration: none; }
.pill.is-active { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.pill__n { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.pill.is-active .pill__n { color: inherit; opacity: 0.7; }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-3); }
.seg a {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px;
  color: var(--ink-2); font-size: 13px; font-weight: 560;
}
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.toolbar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar__grow { flex: 1; }
.toolbar .search { position: relative; }
.toolbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.toolbar .search .input { min-height: 34px; padding: 5px 10px 5px 32px; width: 290px; }

/* ------------------------------------------------------------------ tables */

/* position: relative keeps visually hidden text inside the scroll area, so it cannot widen the page */
.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: var(--surface-2); }
.table .right { text-align: right; }
.table .shrink { width: 1%; white-space: nowrap; }
.table .clip { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table--tight th, .table--tight td { padding-left: 8px; padding-right: 8px; }
.table--tight .meter { width: 40px; }
.table td .cell-sub { display: block; color: var(--ink-3); font-size: 12.5px; }
.table thead tr:first-child th:first-child { border-top-left-radius: var(--r-3); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--r-3); }
.card__head + .table-wrap .table th { border-top: 1px solid var(--line); border-radius: 0; }
.card__head + .table-wrap { margin-top: 14px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.pager__nav { display: flex; gap: 6px; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 44px 24px; text-align: center; }
.empty__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 14px; background: var(--surface-3); color: var(--ink-3); }
.empty p { color: var(--ink-3); max-width: 46ch; }
.empty .btn { margin-top: 10px; }
.empty--sm { padding: 26px 20px; }

/* ------------------------------------------------------------------ flash, dialog, menu, tooltip */

.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); box-shadow: var(--shadow-1);
}
.flash > .icon { margin-top: 2px; }
.flash--success { border-color: color-mix(in srgb, var(--good-dot) 40%, var(--line)); background: color-mix(in srgb, var(--good-bg) 55%, var(--surface)); }
.flash--success > .icon { color: var(--good-dot); }
.flash--error { border-color: color-mix(in srgb, var(--bad-dot) 40%, var(--line)); background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
.flash--error > .icon { color: var(--bad-dot); }
.flash__body { flex: 1; min-width: 0; }
.flash__close { margin: -3px -6px -3px 0; }
.secret {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 6px 6px 12px; border: 1px dashed var(--line-strong);
  border-radius: 9px; background: var(--surface);
}
.secret code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 600 14px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }

.banner { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 11px; margin-bottom: 16px; }
.banner > .icon { margin-top: 2px; }
.banner--warn { background: var(--action-bg); color: var(--action-ink); }
.banner--bad { background: var(--bad-bg); color: var(--bad-ink); }
.banner--info { background: var(--run-bg); color: var(--run-ink); }
.banner strong { font-weight: 640; }

dialog.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); overflow: auto;
}
dialog.dialog::backdrop { background: rgba(10, 14, 26, 0.55); backdrop-filter: blur(2px); }
dialog.dialog[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.dialog__head h2 { font-size: 17px; }
.dialog__head p { margin-top: 2px; color: var(--ink-3); font-size: 13px; }
.dialog__body { padding: 16px 22px 4px; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2);
}
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); text-align: left; font-weight: 520;
}
.menu__item:hover { background: var(--surface-3); text-decoration: none; }
.menu__item--danger { color: var(--bad-ink); }
.menu__sep { height: 1px; margin: 6px 0; background: var(--line); }

.tooltip {
  position: fixed; z-index: 200; max-width: 280px; padding: 7px 10px; border-radius: 9px; pointer-events: none;
  background: #0e1424; color: #f3f5fa; box-shadow: var(--shadow-2); font-size: 12.5px; line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.tooltip strong { display: block; font-size: 13.5px; font-weight: 650; }
.tooltip span { color: #a9b2c7; }

/* ------------------------------------------------------------------ stats and charts */

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  position: relative; display: block; padding: 15px 16px 14px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); overflow: hidden;
}
a.stat { transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.stat__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat__label { color: var(--ink-2); font-size: 13px; font-weight: 540; }
.stat__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--ink-3); }
.stat__value { margin-top: 6px; font-size: 28px; line-height: 1.15; font-weight: 680; letter-spacing: -0.025em; }
.stat__sub { margin-top: 3px; color: var(--ink-3); font-size: 12.5px; }
.stat--action .stat__icon { background: var(--action-bg); color: var(--action-ink); }
.stat--good .stat__icon { background: var(--good-bg); color: var(--good-ink); }
.stat--bad .stat__icon { background: var(--bad-bg); color: var(--bad-ink); }
.stat--wait .stat__icon { background: var(--wait-bg); color: var(--wait-ink); }
.stat--run .stat__icon { background: var(--run-bg); color: var(--run-ink); }
.spark { width: 100%; height: 30px; margin-top: 8px; overflow: visible; }
.spark__line { fill: none; stroke: var(--viz-pipeline); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark__area { fill: var(--viz-pipeline); opacity: 0.1; }

.viz-one, .viz-pipeline, .viz-open { background: var(--viz-pipeline); }
.viz-call { background: var(--viz-call); }
.viz-out { background: var(--viz-out); }
.viz-won, .viz-live { background: var(--viz-won); }
.viz-closed, .viz-expired { background: var(--viz-closed); }
.viz-attention, .viz-rejected { background: var(--viz-attention); }

.chart { position: relative; }
.chart__table { display: none; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart__table th, .chart__table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.chart__table thead th { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.chart__table tbody th { font-weight: 540; }
.chart__table td { text-align: right; }
.chart__table thead th:not(:first-child) { text-align: right; }
.chart.is-table > :not(.chart__table) { display: none; }
.chart.is-table > .chart__table { display: table; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 12.5px; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend strong { color: var(--ink); font-weight: 640; font-variant-numeric: tabular-nums; }
.legend__key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart > .legend { margin-bottom: 14px; }

/* columns */
.cols { position: relative; height: 220px; padding: 6px 0 24px 34px; }
.cols__grid { position: absolute; inset: 6px 0 24px 34px; display: flex; flex-direction: column; justify-content: space-between; }
.cols__tick { position: relative; height: 0; border-top: 1px solid var(--viz-grid); }
.cols__tick:last-child { border-top-color: var(--line-strong); }
.cols__tick span { position: absolute; right: calc(100% + 8px); top: -8px; color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cols__bars { position: relative; display: flex; align-items: stretch; height: 100%; gap: 2px; }
.cols__col { position: relative; flex: 1; display: flex; justify-content: center; min-width: 0; border-radius: 6px; outline-offset: -2px; }
.cols__col:hover, .cols__col:focus-visible { background: color-mix(in srgb, var(--viz-pipeline) 7%, transparent); }
.cols__stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; width: min(24px, 62%); height: 100%; }
.cols__seg { height: var(--h); min-height: 3px; border-radius: 0; opacity: 0.55; transition: opacity 0.12s; }
.cols__seg:first-child { border-radius: 4px 4px 0 0; }
.cols__col.is-current .cols__seg, .cols__col:hover .cols__seg, .cols__col:focus-visible .cols__seg { opacity: 1; }
.cols__x { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); color: var(--ink-3); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cols--multi .cols__seg { opacity: 1; }

/* ranked bars and funnel */
.bars { display: grid; gap: 2px; }
.bars__row {
  display: grid; grid-template-columns: minmax(96px, 136px) minmax(0, 1fr) 40px auto; align-items: center; gap: 12px;
  padding: 7px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink);
}
a.bars__row:hover, .bars__row:hover { background: var(--surface-2); text-decoration: none; }
.bars__label { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { display: block; height: 12px; }
.bars__bar { display: block; width: var(--w); min-width: 3px; height: 100%; border-radius: 0 4px 4px 0; }
.bars__bar.is-zero { min-width: 0; }
.bars__track { border-left: 1px solid var(--line-strong); }
.bars__value { text-align: right; font-weight: 640; font-variant-numeric: tabular-nums; }
.bars__note { min-width: 44px; text-align: right; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* segmented bar */
.segs { display: flex; gap: 2px; height: 8px; margin-bottom: 12px; }
.segs--dense { height: 6px; margin-bottom: 0; }
.segs__seg { flex: var(--w) 1 0; min-width: 4px; }
.segs__seg:first-child { border-radius: 4px 0 0 4px; }
.segs__seg:last-child { border-radius: 0 4px 4px 0; }
.segs__seg:only-child { border-radius: 4px; }
.segs__empty { flex: 1; border-radius: 4px; background: var(--viz-track); }

.meter { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--viz-pipeline) 18%, var(--surface)); vertical-align: middle; overflow: hidden; }
.meter__fill { display: block; width: var(--w); height: 100%; border-radius: 3px; background: var(--viz-pipeline); }
.meter--good { background: color-mix(in srgb, var(--viz-won) 18%, var(--surface)); } .meter--good .meter__fill { background: var(--viz-won); }
.meter--action { background: color-mix(in srgb, var(--viz-call) 22%, var(--surface)); } .meter--action .meter__fill { background: var(--viz-call); }
.meter--bad { background: color-mix(in srgb, var(--viz-attention) 18%, var(--surface)); } .meter--bad .meter__fill { background: var(--viz-attention); }
.meter--wide { width: 100%; height: 8px; border-radius: 4px; }

/* ------------------------------------------------------------------ steppers, timelines, lists */

.steps { display: flex; gap: 6px; }
.steps__item { flex: 1; min-width: 0; }
.steps__bar { height: 4px; border-radius: 2px; background: var(--viz-track); }
.steps__item.is-done .steps__bar { background: var(--viz-pipeline); }
.steps__item.is-now .steps__bar { background: linear-gradient(90deg, var(--viz-pipeline) 55%, var(--viz-track) 55%); }
.steps__item.is-won .steps__bar { background: var(--viz-won); }
.steps__item.is-stopped .steps__bar { background: var(--viz-attention); }
.steps__item.is-skipped .steps__bar { background: color-mix(in srgb, var(--viz-pipeline) 30%, var(--viz-track)); }
.steps__label { display: block; margin-top: 7px; color: var(--ink-3); font-size: 12px; font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps__item.is-done .steps__label { color: var(--ink-2); }
.steps__item.is-now .steps__label, .steps__item.is-won .steps__label { color: var(--ink); font-weight: 640; }
.steps__current { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.steps__current strong { color: var(--ink); font-weight: 640; }

.timeline { position: relative; display: grid; gap: 0; }
.timeline__item { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.timeline__item::before { content: ""; position: absolute; left: 14.5px; top: 30px; bottom: 0; width: 1px; background: var(--line); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::before { display: none; }
.timeline__dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); }
.timeline__dot--call { background: var(--action-bg); color: var(--action-ink); }
.timeline__dot--mail { background: var(--wait-bg); color: var(--wait-ink); }
.timeline__dot--good { background: var(--good-bg); color: var(--good-ink); }
.timeline__dot--bad { background: var(--bad-bg); color: var(--bad-ink); }
.timeline__dot--run { background: var(--run-bg); color: var(--run-ink); }
.timeline__title { font-weight: 600; padding-top: 4px; }
.timeline__meta { color: var(--ink-3); font-size: 12.5px; }
.timeline__body { margin-top: 6px; padding: 9px 12px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.rows__item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); color: var(--ink); }
.rows__item:first-child { border-top: 0; }
a.rows__item:hover { background: var(--surface-2); text-decoration: none; }
.rows__grow { flex: 1; min-width: 0; }
.rows__meta { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.rows__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); flex: none; }
.rows__icon--run { background: var(--run-bg); color: var(--run-ink); }
.rows__icon--wait { background: var(--wait-bg); color: var(--wait-ink); }
.rows__icon--action { background: var(--action-bg); color: var(--action-ink); }
.rows__icon--good { background: var(--good-bg); color: var(--good-ink); }
.rows__icon--bad { background: var(--bad-bg); color: var(--bad-ink); }

.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px 12px; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { overflow-wrap: anywhere; }

.copy { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.copy code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink-2); }

/* ------------------------------------------------------------------ pages */

/* login */
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; background: var(--surface); }
.login__art {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 48px; overflow: hidden;
  background: radial-gradient(900px 600px at 15% 0%, #1c2a57 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #2a1f5c 0%, transparent 55%), #0e1424;
  color: #f3f5fa;
}
.login__art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.login__brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.login__brand svg { width: 40px; height: 40px; }
.login__panel { display: grid; place-items: center; padding: 40px 24px; }
.login__form { width: min(380px, 100%); }
.login__form h2 { font-size: 24px; font-weight: 680; letter-spacing: -0.022em; }
.login__form > p { margin: 6px 0 26px; color: var(--ink-2); }
.login__error { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; margin-bottom: 16px; border-radius: 10px; background: var(--bad-bg); color: var(--bad-ink); font-weight: 540; }
.login__foot { margin-top: 22px; color: var(--ink-3); font-size: 12.5px; }

/* error page */
.oops { display: grid; place-items: center; min-height: 100vh; padding: 24px; text-align: center; }
.oops > div { width: 100%; max-width: 900px; min-width: 0; }
.oops__code { font-size: 72px; font-weight: 720; letter-spacing: -0.04em; line-height: 1; color: var(--line-strong); }
.oops h1 { margin-top: 12px; }
.oops p { margin: 8px auto 22px; color: var(--ink-2); max-width: 46ch; }
.oops pre { max-width: 900px; margin: 24px auto 0; padding: 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-align: left; overflow: auto; font-size: 12px; }

/* overview */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hello p { margin-top: 4px; color: var(--ink-2); }
.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.todo__item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.todo__item:hover { text-decoration: none; border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.todo__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; }
.todo__n { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.todo__label { display: block; color: var(--ink-2); font-size: 13px; }
.todo__item.is-zero { box-shadow: none; background: transparent; }
.todo__item.is-zero .todo__icon { background: var(--surface-3); color: var(--ink-3); }
.todo__item.is-zero .todo__n { color: var(--ink-3); }
.todo__icon--action { background: var(--action-bg); color: var(--action-ink); }
.todo__icon--wait { background: var(--wait-bg); color: var(--wait-ink); }
.todo__icon--bad { background: var(--bad-bg); color: var(--bad-ink); }
.todo__icon--run { background: var(--run-bg); color: var(--run-ink); }

/* lead detail */
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.hero__id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hero__id h1 { overflow-wrap: anywhere; }
.hero__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; color: var(--ink-2); }
.hero__meta a { display: inline-flex; align-items: center; gap: 5px; }
.next {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--r-3);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)), var(--surface));
}
.next--good { border-color: color-mix(in srgb, var(--good-dot) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--good-bg) 70%, var(--surface)), var(--surface)); }
.next--bad { border-color: color-mix(in srgb, var(--bad-dot) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--bad-bg) 70%, var(--surface)), var(--surface)); }
.next--quiet { border-color: var(--line); background: var(--surface); }
.next__text { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 320px; }
.next__text .icon { margin-top: 2px; color: var(--accent-ink); }
.next--good .next__text .icon { color: var(--good-ink); }
.next--bad .next__text .icon { color: var(--bad-ink); }
.next--quiet .next__text .icon { color: var(--ink-3); }
.next__text strong { display: block; font-size: 15px; font-weight: 640; }
.next__text span { color: var(--ink-2); }
.next__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shot { position: relative; display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 10; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shot__label { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(14, 20, 36, 0.78); color: #fff; font-size: 11.5px; font-weight: 600; }
.shot--empty { aspect-ratio: 16 / 5; }
.shot__none { display: grid; place-items: center; align-content: center; gap: 6px; height: 100%; color: var(--ink-3); font-size: 12.5px; }
/* changes to the preview: the form that opens in the card, the job on its way, earlier ones */
.pedit { display: grid; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 84px; }
/* nothing to show while the form is closed and no change has been asked for: no divider on its own */
.pedit:not(:has(> :not([hidden]))) { display: none; }
.pedit__blocked { display: flex; align-items: flex-start; gap: 7px; margin-top: 14px; }
.pedit__blocked .icon { flex: none; margin-top: 2px; }
.pedit__form { padding: 14px 16px 16px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.pedit__form .textarea { min-height: 124px; }
.pedit__send { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pedit__send .hint { margin-left: 4px; }
.pedit__job { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.pedit__job.is-open { border-color: color-mix(in srgb, var(--run-dot) 40%, var(--line)); background: color-mix(in srgb, var(--run-bg) 45%, var(--surface)); }
.pedit__job.is-failed { border-color: color-mix(in srgb, var(--bad-dot) 40%, var(--line)); background: color-mix(in srgb, var(--bad-bg) 45%, var(--surface)); }
.pedit__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 30px; }
.pedit__meta { color: var(--ink-3); font-size: 12.5px; }
.pedit__tools { display: flex; gap: 6px; margin-left: auto; }
.pedit__state { color: var(--ink-2); }
.pedit__note { display: flex; align-items: flex-start; gap: 7px; color: var(--action-ink); font-size: 13px; }
.pedit__note .icon { flex: none; margin-top: 2px; }
.pedit__request { padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.pedit__job.is-open .pedit__request { border-left-color: color-mix(in srgb, var(--run-dot) 55%, var(--line-strong)); }
.pedit__answer { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.pedit__answer .label { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.pedit__text { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pedit__text--quiet { font-size: 13px; }
.pedit__earlier > summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 580; cursor: pointer; list-style: none; }
.pedit__earlier > summary::-webkit-details-marker { display: none; }
.pedit__earlier > summary:hover { background: var(--surface-3); color: var(--ink); }
.pedit__earlier > summary .icon { transition: transform 0.12s; }
.pedit__earlier[open] > summary .icon { transform: rotate(90deg); }
.pedit__list { display: grid; gap: 0; margin-top: 6px; list-style: none; padding: 0; }
.pedit__list > li { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.pedit__list > li:first-child { border-top: 0; }

.opens { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.opens__dots { display: flex; gap: 5px; }
.opens__dot { width: 22px; height: 8px; border-radius: 4px; background: var(--viz-track); }
.opens__dot.is-used { background: var(--viz-out); }
.opens__text { color: var(--ink-2); font-size: 13px; }

/* how the flow works: a row of numbered steps */
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: flow; }
.flow__step { position: relative; padding: 0 14px 0 0; }
.flow__step::before {
  counter-increment: flow; content: counter(flow); display: grid; place-items: center; width: 26px; height: 26px; margin-bottom: 9px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 700;
}
.flow__step::after { content: ""; position: absolute; left: 34px; right: 8px; top: 13px; height: 1px; background: var(--line-strong); }
.flow__step:last-child::after { display: none; }
.flow__step strong { display: block; font-weight: 620; }
.flow__step span { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.flow--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board__col { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface-2); }
.board__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; font-weight: 620; }
.board__head .pill__dot { width: 8px; height: 8px; }
.board__n { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.board__cards { display: grid; gap: 8px; padding: 0 8px 8px; max-height: calc(100vh - 290px); overflow-y: auto; }
.board__card { display: block; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.board__card:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.board__card .who__name { font-size: 13.5px; }
.board__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; color: var(--ink-3); font-size: 12px; }
.board__empty { padding: 18px 12px 22px; color: var(--ink-3); font-size: 13px; text-align: center; }

/* lists */
.listcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.listcard { display: flex; flex-direction: column; }
.listcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 0; }
.listcard__top h2 a { color: var(--ink); }
.listcard__desc { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.listcard__nums { display: flex; align-items: baseline; gap: 8px; padding: 14px 20px 10px; }
.listcard__nums strong { font-size: 26px; font-weight: 680; letter-spacing: -0.02em; }
.listcard__body { padding: 0 20px 18px; flex: 1; }
.listcard__body .legend { gap: 5px 14px; }

/* messages */
.msg { border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; }
.msg > summary { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; list-style: none; }
.msg > summary::-webkit-details-marker { display: none; }
.msg > summary:hover { background: var(--surface-2); }
.msg__dir { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; }
.msg__dir--in { background: var(--run-bg); color: var(--run-ink); }
.msg__dir--out { background: var(--wait-bg); color: var(--wait-ink); }
.msg__dir--call { background: var(--action-bg); color: var(--action-ink); }
.msg__main { flex: 1; min-width: 0; }
.msg__line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg__subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__preview { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__who { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__when { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.msg__chev { color: var(--ink-3); transition: transform 0.15s; }
.msg[open] .msg__chev { transform: rotate(90deg); }
.msg[open] .msg__preview { display: none; }
.msg__body { margin: 0 20px 16px 62px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; max-height: 420px; overflow: auto; }
.msg__ctx { margin: -6px 20px 14px 62px; font-size: 12.5px; color: var(--ink-3); }

.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split > div { padding: 14px 20px; border-left: 1px solid var(--line); }
.split > div:first-child { border-left: 0; }
.split dt { color: var(--ink-3); font-size: 12.5px; }
.split dd { margin-top: 2px; font-size: 20px; font-weight: 660; letter-spacing: -0.02em; }
.split dd small { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

.resultbox { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; }
.resultbox + .resultbox { margin-top: 10px; }
.resultbox--good { background: var(--good-bg); color: var(--good-ink); }
.resultbox--warn { background: var(--action-bg); color: var(--action-ink); }
.resultbox--bad { background: var(--bad-bg); color: var(--bad-ink); }
.resultbox ul { margin-top: 4px; display: grid; gap: 2px; font-size: 13px; }
.resultbox a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ clients */

.tag--good { border-color: color-mix(in srgb, var(--good-dot) 45%, transparent); background: var(--good-bg); color: var(--good-ink); }
.tag--bad { border-color: color-mix(in srgb, var(--bad-dot) 45%, transparent); background: var(--bad-bg); color: var(--bad-ink); }
.table td .cell-sub--bad, .cell-sub--bad { color: var(--bad-ink); }
small.cell-sub--bad { display: block; }
.mono-sm { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset + .fieldset { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.fieldset legend { float: left; width: 100%; margin: 0 0 14px; padding: 0; font-weight: 650; font-size: 14px; color: var(--ink); }
.fieldset legend + * { clear: both; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix .input { flex: 1; min-width: 0; }
.input-suffix span { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }

.drop {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-3); background: var(--surface-2); color: var(--ink-2);
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop > .icon { flex: none; color: var(--accent-ink); }
.drop__text { display: grid; gap: 2px; min-width: 0; }
.drop__text strong { color: var(--ink); }
.drop__text span { font-size: 12.5px; overflow-wrap: anywhere; }
.drop.has-file { border-style: solid; border-color: color-mix(in srgb, var(--good-dot) 55%, var(--line)); background: color-mix(in srgb, var(--good-bg) 50%, var(--surface)); }
.drop__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.fieldset .drop + .hint { display: block; margin-top: 10px; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress .meter { flex: 1; height: 8px; }
.progress .num { color: var(--ink-2); font-weight: 600; font-size: 13px; }

.checklist { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.checklist__item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.checklist__item:first-child { border-top: 0; padding-top: 2px; }
.checklist__mark {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-3); color: var(--ink-3); border: 1.5px solid var(--line-strong);
}
.checklist__item.is-ok .checklist__mark { background: var(--good-dot); border-color: var(--good-dot); color: #fff; }
.checklist__item.is-fail .checklist__mark { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad-dot) 60%, transparent); color: var(--bad-ink); }
.checklist__item.is-running .checklist__mark { background: var(--run-bg); border-color: color-mix(in srgb, var(--run-dot) 50%, transparent); color: var(--run-ink); }
.checklist__item.is-running .checklist__mark .icon { animation: spin 1.6s linear infinite; }
.checklist__item.is-skip { opacity: 0.62; }
.checklist__item.is-ok, .checklist__item.is-skip { padding: 9px 0; }
.checklist__item.is-ok .checklist__head strong { font-weight: 560; }
.checklist__item.is-pending .checklist__head strong { color: var(--ink-2); }
.checklist__detail.checklist__detail--quiet { margin: 0; padding: 0; background: none; color: var(--ink-3); font-size: 12.5px; }
.checklist__fold > summary {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer; list-style: none; color: var(--ink-2); font-size: 13px; font-weight: 560;
}
.checklist__fold > summary > .icon { margin-top: 2px; flex: none; }
.checklist__fold > summary small { color: var(--ink-3); font-weight: 450; font-size: 12.5px; }
.checklist__fold > summary::-webkit-details-marker { display: none; }
.checklist__fold > summary .icon { transition: transform 0.15s; }
.checklist__fold[open] > summary { margin-bottom: 12px; }
.checklist__fold[open] > summary .icon { transform: rotate(90deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.checklist__main { display: grid; gap: 4px; min-width: 0; }
.checklist__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.checklist__head strong { font-weight: 620; }
.checklist__by { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--ink-3); font-size: 12px; }
.checklist__hint { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.checklist__detail {
  margin: 2px 0 0; padding: 8px 11px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; white-space: pre-line; overflow-wrap: anywhere;
}
.checklist__item.is-fail .checklist__detail { background: var(--bad-bg); color: var(--bad-ink); }
.checklist__tick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.checklist__when { color: var(--ink-3); font-size: 12px; }

.senders { display: grid; gap: 0; margin: 0 0 14px; padding: 0; list-style: none; }
/* The address and the actions share the first line; the tags sit under the name, so a long address keeps its room. */
.senders__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who actions" "tags tags"; align-items: center; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.senders__row:first-child { border-top: 0; padding-top: 0; }
.senders__who { grid-area: who; display: flex; align-items: center; gap: 10px; min-width: 0; }
.senders__who > span { display: grid; min-width: 0; }
.senders__who strong { font-weight: 580; overflow-wrap: anywhere; }
.senders__who small { color: var(--ink-3); font-size: 12.5px; }
.senders__tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 6px; padding-left: 36px; }
.senders__actions { grid-area: actions; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.senders__add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; }
.senders__add + .hint { display: block; margin-top: 10px; }

.rowlist { margin: 0; padding: 0; list-style: none; }
.rowlist > li + li { border-top: 1px solid var(--line); }
.rowlist > li > a, .rowlist__item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: inherit; }
.rowlist > li > a:hover { background: var(--surface-2); text-decoration: none; }
.rowlist__main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.rowlist__main strong { font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlist__main small { color: var(--ink-3); font-size: 12.5px; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--detail { grid-template-columns: minmax(0, 1fr); }
  .todo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(var(--side-w), 86vw); transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  /* the shadow only while open: closed, it would spill onto the page edge */
  .nav-open .side { transform: none; box-shadow: var(--shadow-3); }
  .scrim { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 26, 0.5); border: 0; }
  .nav-open .scrim { display: block; }
  .top { padding: 0 16px; }
  .top .top__menu { display: inline-flex; }
  .page { padding: 20px 16px 56px; }
  .grid--main, .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login__art { display: none; }
}
@media (min-width: 981px) { .scrim { display: none; } }
@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .stats, .stats--4, .stats--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .todo { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .todo__item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .todo__icon { width: 32px; height: 32px; border-radius: 9px; }
  .form-grid, .choices, .shots { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > div { border-left: 0; border-top: 1px solid var(--line); }
  .split > div:first-child { border-top: 0; }
  .top__search kbd, .top .btn--primary span { display: none; }
  .top .btn--primary { width: 36px; padding: 0; flex: none; }
  .top__search { max-width: none; }
  .top__spacer { display: none; }
  .input, .select, .textarea, .top__search input { font-size: 16px; }
  .pills { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { height: 36px; flex: none; }
  .toolbar > .pills { flex: 1 1 100%; }
  .hero .page__actions { width: 100%; }
  .next__actions { width: 100%; }
  .next__actions .btn, .next__actions form { flex: 1; }
  .next__actions form .btn { width: 100%; }
  .steps__label { display: none; }
  .table td:first-child .badge { margin-top: 6px; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table th:first-child, .table td:first-child { padding-left: 14px; }
  .table th:last-child, .table td:last-child { padding-right: 14px; }
  .table .who { max-width: 62vw; }
  .bars__row { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) 36px auto; gap: 8px; }
  .flow, .flow--3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .flow__step { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 12px; padding: 0; }
  .flow__step::before { grid-row: 1 / span 2; margin: 0; }
  .flow__step::after { display: none; }
  .hide-sm { display: none !important; }
  .show-sm { display: block !important; }
  span.show-sm { display: inline-flex !important; }
  .toolbar .search, .toolbar .search .input { width: 100%; }
  .msg__body, .msg__ctx { margin-left: 20px; }
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
  .pedit__send .hint { flex-basis: 100%; margin-left: 0; }
  .senders__row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "who" "tags" "actions"; }
  .senders__actions { justify-content: flex-start; padding-left: 28px; }
  .senders__add { grid-template-columns: minmax(0, 1fr); }
  .checklist__by { margin-left: 0; }
  .input-suffix { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .side, .top, .page__actions, .scrim { display: none !important; }
  .shell { display: block; }
}
