/* ==========================================================================
   Hermes console design system (2026-08-14 redesign)
   --------------------------------------------------------------------------
   One dark, cool-tinted surface family + ONE desaturated green accent.
   Serves BOTH worlds: the Jinja templates (base.html) and render.py's
   queue shell — every component class the queue markup emits
   (.card .bubble .said .factrow button[data-act=…]) lives here so the two
   read as one product. Geist (self-hosted, /static/fonts) for UI,
   Geist Mono for ids/phones/counts.

   Shell: fixed left sidebar (icon rail on tablet, off-canvas sheet on
   phone via the #nav-toggle checkbox — no JS required) + slim topbar.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

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

:root {
  color-scheme: dark;

  /* surfaces, darkest → most raised */
  --bg: #0b0e13;
  --bg-sunken: #090c10;          /* inputs, code wells */
  --surface: #10141b;            /* cards, panels, table container */
  --surface-2: #151a23;          /* hovers, table header, chips */
  --surface-3: #1b212c;          /* raised hovers, active nav */
  --border: #232b38;
  --border-soft: #1a212b;
  --border-strong: #2e3a4b;

  /* text */
  --text: #e8edf4;
  --dim: #96a2b4;
  --faint: #5e6b7d;

  /* the one accent + semantic colors, all desaturated to sit in the dark */
  --accent: #3ec489;
  --accent-hi: #52d49b;
  --accent-soft: rgba(62, 196, 137, .12);
  --accent-line: rgba(62, 196, 137, .32);
  --accent-ink: #08130e;         /* text on accent fills */
  --ok: var(--accent);
  --ok-text: #9fe2c3;
  --danger: #e0655f;
  --danger-soft: rgba(224, 101, 95, .11);
  --danger-line: rgba(224, 101, 95, .32);
  --danger-text: #f0aeab;
  --warn: #d9a13f;
  --warn-soft: rgba(217, 161, 63, .11);
  --warn-line: rgba(217, 161, 63, .32);
  --warn-text: #e7c78d;
  --info: #6aa9e0;
  --info-soft: rgba(106, 169, 224, .11);
  --info-line: rgba(106, 169, 224, .28);
  --info-text: #a9c9ee;

  /* type scale — 13px base UI for density; drafts/chat read at 15px */
  --fs-2xs: .6875rem;   /* 11 — table headers, group labels */
  --fs-xs: .75rem;      /* 12 — meta, hints */
  --fs-sm: .8125rem;    /* 13 — base UI, tables, buttons */
  --fs-md: .875rem;     /* 14 — form inputs, emphasized rows */
  --fs-lg: .9375rem;    /* 15 — draft bubbles, chat */
  --fs-xl: 1.0625rem;   /* 17 — card titles, lead names */
  --fs-2xl: 1.25rem;    /* 20 — page h1 */
  --fs-num: 1.625rem;   /* 26 — stat tile numbers */

  /* spacing scale */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;

  /* radii — tighter inside, softer on containers */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* shadows tinted with the background hue, single top-light source */
  --shadow-1: 0 1px 2px rgba(4, 8, 14, .5);
  --shadow-2: 0 4px 16px rgba(3, 7, 13, .45);
  --shadow-3: 0 16px 48px rgba(2, 6, 12, .55);
  --ring: 0 0 0 3px rgba(62, 196, 137, .22);

  /* shell geometry */
  --side-w: 15rem;
  --side-w-rail: 3.75rem;
  --topbar-h: 3.25rem;

  /* z-scale: content < sticky th < batch bar < topbar < sidebar < scrim(phone) */
  --z-sticky: 5;
  --z-bar: 20;
  --z-topbar: 30;
  --z-side: 40;
  --z-scrim: 35;

  --speed: 160ms;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

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

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-sm)/1.55 "Geist", -apple-system, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  font-weight: 430;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1 {
  font-size: var(--fs-2xl); font-weight: 620; letter-spacing: -.022em;
  line-height: 1.25; margin: 0 0 var(--sp-4); text-wrap: balance;
}
h2 {
  font-size: var(--fs-2xs); font-weight: 580; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint); margin: var(--sp-8) 0 var(--sp-3);
}

.mono, td.mono {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .925em; font-variant-numeric: tabular-nums;
}
.num { font-variant-numeric: tabular-nums; }

::selection { background: rgba(62, 196, 137, .25); }

/* ---- app shell: sidebar + topbar + content --------------------------- */

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  z-index: var(--z-side);
  display: flex; flex-direction: column;
  background: #0d1017;
  border-right: 1px solid var(--border-soft);
  overflow-y: auto; overflow-x: hidden;
  transition: transform 240ms var(--ease);
}

.side-brand {
  display: flex; align-items: center; min-height: var(--topbar-h);
  padding: 0 var(--sp-4); flex-shrink: 0;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .1rem;
  font-weight: 640; font-size: 1rem; letter-spacing: -.015em;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }

.side-nav { padding: var(--sp-2) var(--sp-2) var(--sp-6); flex: 1; }
.side-group { margin-bottom: var(--sp-4); }
.side-label {
  font-size: var(--fs-2xs); font-weight: 560; text-transform: uppercase;
  letter-spacing: .11em; color: var(--faint);
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
  white-space: nowrap; overflow: hidden;
}
.side-link {
  position: relative;
  display: flex; align-items: center; gap: .6rem;
  padding: .44rem var(--sp-2); margin: 1px 0;
  border-radius: var(--r-md);
  color: var(--dim); font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: color var(--speed), background var(--speed);
}
.side-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.side-link.active { color: var(--text); background: var(--surface-3); }
.side-link.active::before {
  content: ""; position: absolute; left: -.5rem; top: 50%;
  width: 2px; height: 1.1rem; transform: translateY(-50%);
  background: var(--accent); border-radius: 2px;
}
.side-link svg {
  width: 1.1rem; height: 1.1rem; flex-shrink: 0;
  stroke: currentColor; opacity: .82;
}
.side-link.active svg { color: var(--accent); opacity: 1; }

/* content column sits right of the sidebar */
.frame { margin-left: var(--side-w); min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--topbar-h); padding: 0 var(--sp-6);
  background: rgba(11, 14, 19, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-title {
  font-size: var(--fs-sm); font-weight: 560; color: var(--dim);
  letter-spacing: -.005em;
}
.topbar-side { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.topbar-side form { margin: 0; }

/* hamburger — visible on phones only */
.nav-btn {
  display: none; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; margin-left: -.5rem;
  border-radius: var(--r-md); color: var(--dim); cursor: pointer;
  transition: color var(--speed), background var(--speed);
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-btn svg { width: 1.15rem; height: 1.15rem; stroke: currentColor; }

.nav-scrim {
  display: none; position: fixed; inset: 0; z-index: var(--z-scrim);
  background: rgba(5, 8, 12, .6); backdrop-filter: blur(2px);
}

main.container, .container {
  width: 100%; max-width: 74rem; margin: 0 auto;
  padding: var(--sp-6) var(--sp-6) var(--sp-10);
}
.container-narrow { max-width: 46rem; }
/* queue + lead pages (render.py shell): phone-first single column */
body.page-narrow main.container { max-width: 46rem; }

/* tablet: icon rail */
@media (max-width: 68rem) {
  :root { --side-w: var(--side-w-rail); }
  .side-brand { justify-content: center; padding: 0; }
  .brand span:not(.dot) { display: none; }
  .brand { font-size: 1.05rem; }
  .side-label { visibility: hidden; height: .9rem; padding-bottom: 0; }
  .side-link { justify-content: center; padding: .55rem 0; }
  .side-link span { display: none; }
  .side-link.active::before { left: 0; }
}

/* phone: off-canvas sheet, hamburger in topbar */
@media (max-width: 44rem) {
  :root { --side-w: 0rem; }
  .sidebar {
    width: 16rem; transform: translateX(-102%);
    box-shadow: var(--shadow-3);
    border-right: 1px solid var(--border);
  }
  .sidebar .side-brand { justify-content: flex-start; padding: 0 var(--sp-4); }
  .sidebar .brand span:not(.dot) { display: inline; }
  .sidebar .side-label { visibility: visible; height: auto; padding: var(--sp-2) var(--sp-2) var(--sp-1); }
  .sidebar .side-link { justify-content: flex-start; padding: .6rem var(--sp-2); }
  .sidebar .side-link span { display: inline; }
  .sidebar .side-link.active::before { left: -.5rem; }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-scrim { display: block; }
  .nav-btn { display: inline-flex; }
  .frame { margin-left: 0; }
  .topbar { padding: 0 var(--sp-4); }
  main.container, .container { padding: var(--sp-4) var(--sp-4) var(--sp-10); }
}

/* ---- page header ------------------------------------------------------ */

.pagehead {
  display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.pagehead h1 { margin: 0; }
.pagehead .spacer { flex: 1; }
.pagehead-text { min-width: 0; }
.pagehead-text h1 { margin-bottom: .15rem; }
.page-desc {
  color: var(--dim); font-size: var(--fs-sm); margin: 0;
  max-width: 42rem; text-wrap: pretty;
}

/* ---- feedback --------------------------------------------------------- */

.flash {
  display: flex; align-items: baseline; gap: .5rem;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: #b9ecd4; padding: .6rem .85rem; border-radius: var(--r-md);
  margin-bottom: var(--sp-4); font-size: var(--fs-sm);
}
.flash::before { content: "✓"; font-weight: 640; color: var(--accent); }
.flash-error, .error {
  background: var(--danger-soft); border: 1px solid var(--danger-line);
  color: #f3c3c0; padding: .6rem .85rem; border-radius: var(--r-md);
  margin-bottom: var(--sp-4); font-size: var(--fs-sm);
}
.flash-error::before { content: none; }

.empty {
  color: var(--dim); padding: var(--sp-10) var(--sp-6); text-align: center;
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  background: rgba(16, 20, 27, .5); font-size: var(--fs-sm);
}
.empty::before {
  content: ""; display: block; width: 2rem; height: 2rem;
  margin: 0 auto var(--sp-3); background: var(--faint); opacity: .8;
  -webkit-mask: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11.5l2.2-6A1.5 1.5 0 0 1 6.6 4.5h6.8a1.5 1.5 0 0 1 1.4 1l2.2 6v3a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 14.5z'/%3E%3Cpath d='M3 11.5h4l1 2h4l1-2h4'/%3E%3C/svg%3E");
  mask: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11.5l2.2-6A1.5 1.5 0 0 1 6.6 4.5h6.8a1.5 1.5 0 0 1 1.4 1l2.2 6v3a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 14.5z'/%3E%3Cpath d='M3 11.5h4l1 2h4l1-2h4'/%3E%3C/svg%3E");
}
.empty .hint { display: block; margin-top: var(--sp-2); color: var(--faint); font-size: var(--fs-xs); }

/* ---- surfaces --------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4); box-shadow: var(--shadow-1);
}
.card:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}

/* ---- tables ------------------------------------------------------------
   Dense operator tables: 11px uppercase headers, 13px cells, row hover,
   left text / right numbers, mono for ids & phones. Every list table sits
   in a .table-wrap so it scrolls horizontally in its own container on
   phones instead of breaking the page. */

.table-wrap {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  overflow: auto; max-height: 80dvh;
  margin: var(--sp-2) 0 var(--sp-6);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { margin: 0; }
.table-wrap tr:last-child td { border-bottom: 0; }

table { width: 100%; border-collapse: collapse; margin: var(--sp-2) 0 var(--sp-5); }
th {
  position: sticky; top: 0; z-index: var(--z-sticky);
  text-align: left; font-size: var(--fs-2xs); font-weight: 560;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
  background: var(--surface-2);
  padding: .5rem .85rem; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  text-align: left; padding: .55rem .85rem; font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border-soft); vertical-align: top;
}
td.num { text-align: right; font-family: "Geist Mono", ui-monospace, monospace;
         font-size: .78rem; color: var(--dim); white-space: nowrap; }
tbody tr, table tr { transition: background var(--speed); }
tr:hover td { background: rgba(21, 26, 35, .6); }
/* plain tables inside cards (number detail) — quieter, no chrome */
.card table { margin: var(--sp-3) 0 0; }
.card th { position: static; background: transparent; }
.card tr:hover td { background: transparent; }
.card tr:last-child td { border-bottom: 0; }

/* ---- badges & status --------------------------------------------------
   State language across the product:
   ok/active/released → green · warn/paused/held → amber ·
   danger/frozen/rejected/opted-out → red · neutral/info → blue-grey. */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: var(--fs-2xs); font-weight: 580;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .14rem .48rem; border-radius: 5px;
  background: var(--info-soft); color: var(--info-text);
  border: 1px solid var(--info-line);
  white-space: nowrap; vertical-align: middle;
}
.badge-ok { background: var(--accent-soft); color: var(--ok-text); border-color: var(--accent-line); }
.badge-danger, .badge-err, .badge.escalation {
  background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line);
}
.badge-warn { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-line); }

.ladder { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap;
          font-family: "Geist Mono", ui-monospace, monospace; }
.ladder .rung-current { color: var(--accent); font-weight: 620; }
.meta { color: var(--dim); font-size: var(--fs-xs); margin: .3rem 0; }
.stale { color: var(--warn); font-weight: 600; font-size: var(--fs-xs); margin: .3rem 0; }
.hint { color: var(--faint); font-size: var(--fs-xs); }

/* ---- buttons -----------------------------------------------------------
   Hierarchy: bare <button> / .button  = primary (accent fill)
              .secondary               = bordered surface
              .danger                  = quiet danger (tinted, never a red fill)
              .btn-quiet               = text-only */

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; min-height: 2.25rem; border: 1px solid transparent;
  border-radius: var(--r-md); padding: .42rem .95rem;
  font: inherit; font-size: var(--fs-sm); font-weight: 560; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; text-align: center; white-space: nowrap;
  transition: background var(--speed) var(--ease),
              border-color var(--speed) var(--ease),
              color var(--speed) var(--ease),
              transform var(--speed) var(--ease);
}
button:hover, .button:hover { background: var(--accent-hi); text-decoration: none; }
button:active, .button:active { transform: scale(.98); }
button:focus-visible, .button:focus-visible, a:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.secondary, .button.secondary {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
button.secondary:hover, .button.secondary:hover {
  background: var(--surface-3); border-color: var(--border-strong);
}
button.danger, .button.danger {
  background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line);
}
button.danger:hover { background: rgba(224, 101, 95, .2); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-quiet {
  display: inline-flex; align-items: center;
  background: none; border: 0; color: var(--faint); font: inherit;
  font-size: var(--fs-sm); cursor: pointer; padding: .35rem .6rem;
  border-radius: var(--r-md); min-height: 0; font-weight: 500;
  transition: color var(--speed), background var(--speed);
}
.btn-quiet:hover { color: var(--text); background: var(--surface-2); }

/* Legacy queue action buttons (render.py cards; a/e/r shortcuts):
   approve = the page's primary action; reject = quiet danger;
   edit = secondary. */
button[data-act=approve] { background: var(--accent); color: var(--accent-ink); }
button[data-act=approve]:hover { background: var(--accent-hi); }
button[data-act=reject] { background: var(--danger-soft); color: var(--danger-text);
                          border-color: var(--danger-line); }
button[data-act=reject]:hover { background: rgba(224, 101, 95, .2); }
button[data-act=edit] { background: var(--surface-2); color: var(--text);
                        border-color: var(--border); }
button[data-act=edit]:hover { background: var(--surface-3); }

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

label { display: block; font-size: var(--fs-xs); color: var(--dim); font-weight: 540; }
label.small { display: block; font-size: var(--fs-xs); color: var(--faint); margin-top: var(--sp-3); }
.stack label { margin-bottom: var(--sp-4); }
.stack .hint { display: block; margin-top: .3rem; font-weight: 430; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], textarea, select {
  width: 100%; background: var(--bg-sunken); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: .5rem .65rem; font: inherit; font-size: var(--fs-md);
  margin-top: .3rem;
  transition: border-color var(--speed), box-shadow var(--speed);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); outline: none; box-shadow: var(--ring);
}
input[type=checkbox] { accent-color: var(--accent); width: 1rem; height: 1rem; }
textarea { min-height: 3.2rem; resize: vertical; line-height: 1.5; }
textarea.code, .code textarea {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-xs); line-height: 1.6;
}
select { appearance: none; padding-right: 1.9rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235e6b7d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center;
  background-size: .95rem;
}
form.stack { max-width: 30rem; }
form.stack button[type=submit] { margin-top: var(--sp-2); }

/* inline filter/search rows */
.row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }
.row button { flex: 0 0 auto; }
.row input[type=text] { flex: 1 1 11rem; width: auto; margin-top: 0; }
.row select { width: auto; margin-top: 0; }
.row label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; white-space: nowrap; }
.row > a { align-self: center; }

/* filter chips (CRM stage links) */
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; margin: var(--sp-3) 0; }
.chip-row a {
  display: inline-flex; align-items: center;
  font-size: var(--fs-xs); font-weight: 520; color: var(--dim);
  padding: .22rem .6rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none;
  transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.chip-row a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.chip-row a.on {
  color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line);
}

/* ---- queue cards (render.py markup) ------------------------------------
   The most-used surface in the product: lead name prominent, draft text
   readable at 15px, approve = primary, reject = quiet danger. */

.top { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.top .badge { text-transform: uppercase; }
.id { color: var(--faint); font-size: var(--fs-xs);
      font-family: "Geist Mono", ui-monospace, monospace; }
.name { font-weight: 600; letter-spacing: -.01em; }

.qcard { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.qcard .top { margin-bottom: .4rem; }
.qcard-lead { font-size: var(--fs-xl); font-weight: 620; letter-spacing: -.015em;
              margin: .1rem 0 .2rem; }
.qcard-lead a { color: var(--text); }
.qcard-lead a:hover { color: var(--accent-hi); text-decoration: none; }
.qcard-lead .meta { font-size: var(--fs-xs); font-weight: 460; margin: 0; }

.said {
  color: var(--dim); font-size: var(--fs-sm); margin: var(--sp-3) 0;
  padding: .45rem .75rem; border-left: 2px solid var(--border-strong);
  background: rgba(21, 26, 35, .5); border-radius: 0 var(--r-md) var(--r-md) 0;
}
.bubble {
  background: var(--surface-3); border: 1px solid var(--border-soft);
  border-radius: 12px 12px 12px 4px;
  padding: .6rem .85rem; margin: .4rem 0; font-size: var(--fs-lg);
  line-height: 1.55; max-width: 36rem;
}
.detail { color: var(--text); font-size: var(--fs-sm); margin: var(--sp-2) 0; white-space: pre-wrap; }

.qcard form { margin-top: var(--sp-3); }
.qcard .row { margin-top: var(--sp-2); }
.qcard .row button { flex: 1 1 auto; min-height: 2.6rem; }
.qcard .row button[data-act=approve] { flex: 1.6 1 auto; }
.qcard input[name=by] { max-width: 15rem; }

details { margin-top: var(--sp-3); }
details > summary {
  cursor: pointer; color: var(--dim); padding: .3rem 0;
  min-height: 44px; display: flex; align-items: center; list-style: none;
  font-size: var(--fs-sm);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--faint); margin-right: .4rem;
                            font-size: .7rem; }
details[open] > summary::before { content: "▾"; }

.factrow { display: flex; gap: var(--sp-2); font-size: var(--fs-sm); margin: .25rem 0; }
.factrow .slot { color: var(--faint); min-width: 8rem; }
.turn { font-size: var(--fs-sm); margin: .3rem 0; }
.turn .dir { color: var(--faint); margin-right: .4rem;
             font-family: "Geist Mono", ui-monospace, monospace; font-size: var(--fs-2xs); }

/* per-card batch checkbox — pushed to the header's right edge, thumb-sized */
.batch-check-label {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: var(--fs-xs); color: var(--dim); cursor: pointer;
  padding: .25rem 0; user-select: none;
}
.top .batch-check-label { margin-left: auto; }
.batch-check-label input { width: 1.1rem; height: 1.1rem; cursor: pointer; }

/* select-all toolbar above the sections */
.queue-tools {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: .5rem .85rem; margin-bottom: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
}
.queue-tools .hint { margin-left: auto; }

/* batch action bar — a sheet fixed to the bottom of the viewport that
   slides up as soon as any card checkbox is checked (CSS :has(), with a
   JS class fallback set by the same script that wires select-all). */
.batch-bar {
  position: fixed; bottom: 0; left: var(--side-w); right: 0; z-index: var(--z-bar);
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: .7rem var(--sp-6) calc(.7rem + env(safe-area-inset-bottom));
  background: rgba(16, 20, 27, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 32px rgba(3, 7, 13, .5);
  transform: translateY(110%); visibility: hidden;
  transition: transform 220ms var(--ease), visibility 220ms;
}
body:has(.batch-check:checked) .batch-bar,
body.has-batch-selection .batch-bar { transform: none; visibility: visible; }
.batch-count {
  font-size: var(--fs-sm); font-weight: 580; color: var(--accent);
  font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: var(--sp-2);
}
.batch-bar input[type=text] { flex: 1 1 8rem; width: auto; margin-top: 0; max-width: 13rem; }
.batch-bar button { min-height: 2.6rem; }
body.page-queue main.container { padding-bottom: 10rem; }
@media (max-width: 44rem) {
  .batch-bar { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .batch-bar input[type=text] { max-width: none; }
  .batch-bar button { flex: 1 1 auto; }
}

/* ---- chats thread (M5): in = left/grey, out = right/blue --------------- */

.thread { display: flex; flex-direction: column; gap: .15rem; margin: var(--sp-4) 0; }
.thread .bubble { max-width: 34rem; }
.thread .bubble.in { margin-right: auto; border-radius: 12px 12px 12px 4px; }
.thread .bubble.out {
  margin-left: auto; background: var(--info-soft); color: var(--text);
  border-color: var(--info-line); border-radius: 12px 12px 4px 12px;
}
.bubble-media { color: var(--dim); font-style: italic; }

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

.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--sp-4);
}
.cards-grid .card { margin-bottom: 0; display: flex; flex-direction: column; }
.cards-grid .card .row { margin-top: auto; padding-top: var(--sp-3); }
.step-bar {
  display: flex; flex-wrap: wrap; gap: .3rem; margin: var(--sp-2) 0; font-size: var(--fs-2xs);
}
.step-bar span {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 5px; padding: .12rem .45rem; color: var(--dim);
  font-family: "Geist Mono", ui-monospace, monospace;
}

/* ---- specifics ----------------------------------------------------------- */

/* Pairing QR must sit on white to scan reliably from a dark page. */
.qr-frame {
  display: inline-block; background: #fff; padding: 14px;
  border-radius: var(--r-lg); box-shadow: var(--shadow-2); line-height: 0;
}
.card-center { text-align: center; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-6 { margin-top: var(--sp-6); }
.backlink { display: inline-block; margin-top: var(--sp-4); font-size: var(--fs-sm); }
.prewrap { white-space: pre-wrap; }
.panel-lede { margin-top: 0; }
.row-tight { max-width: 30rem; }
.row-nowrap { flex-wrap: nowrap; margin-top: 0; }
.row-nowrap input[type=text] { min-width: 8rem; }
.ladder-block { margin-bottom: var(--sp-2); }
.panel.container-narrow { max-width: 34rem; }
.findings-list .badge { margin-right: .35rem; }

/* Login: single centered panel, nothing else on the page. */
body.login-page {
  display: grid; place-items: center; padding: var(--sp-6);
  background:
    radial-gradient(60rem 30rem at 70% -10%, rgba(62, 196, 137, .06), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 22rem; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6); box-shadow: var(--shadow-3);
}
.login-card .brand { font-size: 1.15rem; }
.login-card h1 { font-size: var(--fs-xl); margin: var(--sp-5) 0 var(--sp-4); }
.login-card label { margin-top: var(--sp-3); }
.login-card button { width: 100%; margin-top: var(--sp-4); min-height: 2.5rem; }

/* Settings diff/draft blocks keep their pre look but themed */
pre, code {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-xs);
}
pre {
  background: var(--bg-sunken); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: .8rem .95rem; overflow-x: auto;
}
.findings-list { margin: var(--sp-2) 0 var(--sp-5); padding-left: 1.2rem; }
.findings-list li { margin: .3rem 0; font-size: var(--fs-sm); }

/* ---- overview stat tiles -------------------------------------------------- */

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--sp-3); margin: var(--sp-2) 0 var(--sp-6);
}
.tile {
  display: block; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4); text-decoration: none;
  color: var(--text); box-shadow: var(--shadow-1);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
}
a.tile:hover { border-color: var(--accent-line); text-decoration: none;
               transform: translateY(-1px); }
.tile-n {
  display: block; font-size: var(--fs-num); font-weight: 620;
  letter-spacing: -.02em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tile-l {
  display: block; color: var(--faint); font-size: var(--fs-2xs); font-weight: 540;
  text-transform: uppercase; letter-spacing: .07em; margin-top: .35rem;
}
.tile-sub { display: block; color: var(--dim); font-size: var(--fs-xs); margin-top: .35rem; }
.tile-warn { border-color: var(--warn-line); }
.tile-warn .tile-n { color: var(--warn); }

/* ---- copilot chat ----------------------------------------------------------- */

.chat-thread {
  max-height: 55dvh; overflow-y: auto; padding: var(--sp-1);
  display: flex; flex-direction: column; gap: .45rem; margin-bottom: var(--sp-4);
}
.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-assistant { justify-content: flex-start; }
.chat-bubble {
  max-width: 46rem; padding: .6rem .9rem; border-radius: 12px;
  font-size: var(--fs-lg); line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-user .chat-bubble {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-bottom-right-radius: 4px;
}
.chat-assistant .chat-bubble {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
}
.chat-tool { justify-content: center; }
.chat-toolline {
  color: var(--faint); font-size: var(--fs-xs);
  font-family: "Geist Mono", ui-monospace, monospace;
  max-width: 46rem; overflow-wrap: anywhere;
}
.chat-input { display: flex; gap: var(--sp-2); align-items: stretch; margin-top: var(--sp-3); }
.chat-input input { flex: 1; margin-top: 0; }
.chat-upload { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-4); }
.chat-upload input[type=file] { flex: 1; width: auto; margin-top: 0; font-size: var(--fs-xs); }
.attachment-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: var(--sp-3) 0; }
.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: .25rem .7rem; font-size: var(--fs-xs);
}
.chip-size { color: var(--faint); }

.confirm-card {
  background: var(--surface); border: 1px solid var(--warn-line);
  border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-1);
}
.confirm-head { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: .4rem; }
.confirm-args { color: var(--dim); font-size: var(--fs-xs); margin-bottom: var(--sp-2);
                overflow-wrap: anywhere; }
.confirm-texts { margin-bottom: var(--sp-2); }
.confirm-quote { color: var(--text); font-size: var(--fs-sm); margin: .15rem 0;
                 overflow-wrap: anywhere; }
.confirm-card .row { margin-top: .4rem; max-width: 18rem; }
.confirm-card .row form { display: contents; }

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

@media (max-width: 44rem) {
  th, td { padding: .5rem .6rem; }
  .qcard .row button { min-height: 2.9rem; }        /* thumb-sized */
  .qcard input[name=by] { max-width: none; }
  .pagehead { gap: var(--sp-3); }
  .cards-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- numbers screens: status/connection pills + facts grid (2026-08-15
   design-system pass — fleet list + number detail). Additive only: no rule
   above this point is touched. ------------------------------------------ */

/* fifth badge tone (retired): the four existing badge-* classes cover
   info/ok/danger/warn; retired needs a quiet neutral, not "info" blue. */
.badge-muted { background: var(--surface-2); color: var(--faint); border-color: var(--border); }

/* connection pill: a dot + label, independent of the status badge —
   ladder/status state and live socket state are two different facts and
   were being run together as bare text before this pass. */
.pill-conn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: var(--fs-xs); font-weight: 540; color: var(--dim);
  padding: .16rem .55rem .16rem .45rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  white-space: nowrap; vertical-align: middle;
}
.pill-conn-dot { width: .5rem; height: .5rem; border-radius: 999px; flex-shrink: 0; background: var(--faint); }
.pill-conn-ok { color: var(--ok-text); border-color: var(--accent-line); background: var(--accent-soft); }
.pill-conn-ok .pill-conn-dot { background: var(--accent); }
.pill-conn-danger { color: var(--danger-text); border-color: var(--danger-line); background: var(--danger-soft); }
.pill-conn-danger .pill-conn-dot { background: var(--danger); }
.pill-conn-wait { color: var(--warn-text); border-color: var(--warn-line); background: var(--warn-soft); }
.pill-conn-wait .pill-conn-dot { background: var(--warn); animation: pill-pulse 1.3s ease-in-out infinite; }
.pill-conn-unknown { color: var(--faint); border-color: var(--border); background: var(--surface-2); }
.pill-conn-unknown .pill-conn-dot { background: var(--faint); }
.pill-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

@keyframes pill-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(217, 161, 63, .45); }
  50% { opacity: .55; box-shadow: 0 0 0 .3rem rgba(217, 161, 63, 0); }
}

/* fleet list: the id+phone cell as one linked block, so the row's primary
   identity is the click target instead of a bare mono id. */
.acct-link { display: inline-flex; flex-direction: column; gap: .1rem; color: var(--text); }
.acct-link:hover { color: var(--accent-hi); text-decoration: none; }
.acct-id { font-weight: 620; font-size: var(--fs-md); letter-spacing: -.01em; }
.acct-phone { color: var(--dim); font-size: var(--fs-xs); }

/* number detail: facts as a compact two-column definition grid instead of
   a raw <table> dump. */
.facts-grid { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; margin: var(--sp-2) 0 0; max-width: 30rem; }
.facts-grid dt { color: var(--faint); font-size: var(--fs-xs); font-weight: 540; white-space: nowrap; margin: 0; }
.facts-grid dd { color: var(--text); font-size: var(--fs-sm); margin: 0; }
@media (max-width: 30rem) {
  .facts-grid { grid-template-columns: 1fr; gap: .05rem 0; }
  .facts-grid dt { margin-top: .6rem; }
}

/* pairing card states: waiting (CSS-only spinner) and connected confirmation */
.pairing-waiting {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4); text-align: center;
}
.pairing-spinner {
  width: 2rem; height: 2rem; border-radius: 999px; flex-shrink: 0;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  animation: pairing-spin .8s linear infinite;
}
@keyframes pairing-spin { to { transform: rotate(360deg); } }
.pairing-connected { display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--ok-text); font-weight: 560; padding: var(--sp-2) 0; }
.pairing-connected .pill-conn-dot { width: .65rem; height: .65rem; background: var(--accent); }

/* actions card: primary reconnect action, then secondary controls, then
   the "Advanced" signals drawer, then retire pinned to the bottom. */
.action-primary-row { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.action-primary-row .button { align-self: stretch; justify-content: center; }
@media (min-width: 26rem) { .action-primary-row .button { align-self: flex-start; padding-left: 1.4rem; padding-right: 1.4rem; } }
.action-explain { margin: 0; }
.actions-divider { margin: var(--sp-5) 0; border: 0; border-top: 1px solid var(--border-soft); }
.retire-block { margin-top: var(--sp-5); }

/* ---- queue redesign (2026-08-15): each approval is a DECISION card —
   conversation context on the left, the draft + actions on the right, and
   the header carries time pressure (age, expiry) and identity (stage,
   campaign, number). Additive only. -------------------------------------- */

.queue-tabs { margin-bottom: var(--sp-4); }

.expiry {
  font-size: var(--fs-2xs); color: var(--faint);
  font-family: "Geist Mono", ui-monospace, monospace; white-space: nowrap;
}
.expiry-soon { color: var(--warn); font-weight: 600; }

.qcard-stage { text-transform: uppercase; }
.qcard-meta { font-size: var(--fs-xs); font-weight: 460; margin: 0; }

.qcard-body { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); margin-top: var(--sp-2); }
@media (min-width: 58rem) {
  .qcard-body { grid-template-columns: minmax(16rem, 1fr) minmax(0, 1.25fr); align-items: start; }
}

.mini-thread {
  background: var(--bg-sunken); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: .6rem .75rem; margin: var(--sp-2) 0;
}
.mini-thread-label, .draft-label, .hold-chips-label {
  font-size: var(--fs-2xs); font-weight: 560; text-transform: uppercase;
  letter-spacing: .09em; color: var(--faint);
}
.mini-thread-label { margin-bottom: .35rem; }
.draft-label { margin-bottom: .1rem; }
.mrow { display: flex; margin: .25rem 0; font-size: var(--fs-sm); line-height: 1.5; }
.mrow-text { max-width: 92%; padding: .3rem .6rem; border-radius: 9px; overflow-wrap: anywhere; }
.mrow.in .mrow-text { background: var(--surface-2); border: 1px solid var(--border-soft); }
.mrow.out { justify-content: flex-end; }
.mrow.out .mrow-text { background: var(--info-soft); border: 1px solid var(--info-line); color: var(--text); }
.mrow em { color: var(--dim); font-style: italic; }

.hold-chips { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: var(--sp-3) 0; }
.chip-hold {
  display: inline-flex; align-items: center; font-size: var(--fs-2xs); font-weight: 560;
  color: var(--warn-text); background: var(--warn-soft);
  border: 1px solid var(--warn-line); border-radius: 999px; padding: .16rem .55rem;
  white-space: nowrap;
}

.esc-note {
  background: var(--danger-soft); border: 1px solid var(--danger-line);
  border-radius: var(--r-md); padding: .6rem .8rem; margin: var(--sp-3) 0;
  font-size: var(--fs-sm); color: var(--text);
}
.esc-note b { color: var(--danger-text); font-weight: 600; }

.kbd-hints { margin-top: var(--sp-3); color: var(--faint); font-size: var(--fs-2xs); }
.kbd-hints kbd {
  display: inline-block; min-width: 1.2rem; text-align: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: .05rem .3rem;
  font-family: "Geist Mono", ui-monospace, monospace; font-size: .68rem;
  color: var(--dim); margin-right: .1rem;
}

/* ---- chats redesign (2026-08-15): two-pane thread with day separators,
   per-bubble time + delivery ticks (only where the outbox ack join
   resolves), and a lead context panel. Additive only. ------------------- */

.thread-layout { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); align-items: start; }
@media (min-width: 62rem) {
  .thread-layout { grid-template-columns: minmax(0, 1fr) 17rem; }
  .thread-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
}

.thread-older { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); }

.day-sep {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-2); color: var(--faint); font-size: var(--fs-2xs);
  text-transform: uppercase; letter-spacing: .08em;
}
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border-soft); }

.bubble-group { display: flex; flex-direction: column; margin: .1rem 0; }
.bubble-group.out { align-items: flex-end; }
.bubble-group.in { align-items: flex-start; }
.bubble-group .bubble { margin: 0; }
.bubble-meta {
  color: var(--faint); font-size: var(--fs-2xs); margin: .15rem .3rem 0;
  font-variant-numeric: tabular-nums;
}
.sender-tag { color: var(--info-text); font-weight: 560; }
.tick { color: var(--faint); letter-spacing: -.12em; }
.tick-read { color: var(--info); }

.composer { margin-top: var(--sp-5); max-width: 34rem; }
.composer .hint { display: block; margin-top: .4rem; }

.side-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-1); font-size: var(--fs-sm);
}
.side-card-warn { border-color: var(--warn-line); }
.side-card-label {
  font-size: var(--fs-2xs); font-weight: 560; text-transform: uppercase;
  letter-spacing: .09em; color: var(--faint); margin-bottom: var(--sp-2);
}
.facts-grid-tight { max-width: none; gap: .35rem 1rem; }
.side-card .hint { display: inline-block; margin-top: var(--sp-2); }

/* conversation list: rows instead of a raw table */
.convo-list {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  margin-top: var(--sp-4); overflow: hidden;
}
.convo-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: .7rem var(--sp-4); color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--speed);
}
.convo-row:last-child { border-bottom: 0; }
.convo-row:hover { background: var(--surface-2); text-decoration: none; }
.convo-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.convo-name { font-weight: 600; letter-spacing: -.01em; }
.convo-preview {
  color: var(--dim); font-size: var(--fs-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convo-preview em { color: var(--faint); }
.convo-dir { color: var(--faint); }
.convo-side { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.convo-age { color: var(--faint); font-size: var(--fs-xs); white-space: nowrap;
             font-variant-numeric: tabular-nums; }
@media (max-width: 44rem) {
  .convo-side .badge { display: none; }
}

/* ---- overview redesign (2026-08-15): sparklines, pipeline funnel,
   number health cards, activity feed. Additive only. -------------------- */

.tile { position: relative; overflow: hidden; }
.tile-spark {
  position: absolute; right: .6rem; bottom: .6rem;
  width: 6rem; height: 1.6rem; opacity: .85;
}
.tile-spark polyline {
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
a.tile-sub { color: var(--info-text); }
a.tile-sub:hover { text-decoration: underline; }

.funnel-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-1); margin-bottom: var(--sp-6);
}
.funnel-bar {
  display: flex; height: .9rem; border-radius: 999px; overflow: hidden;
  gap: 2px; background: var(--bg-sunken);
}
.funnel-seg { min-width: .35rem; }
.funnel-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: var(--sp-3); }
.funnel-key { display: inline-flex; align-items: center; gap: .4rem;
              font-size: var(--fs-xs); color: var(--dim); }
.funnel-key b { color: var(--text); font-weight: 600; }
.funnel-dot { width: .55rem; height: .55rem; border-radius: 2px; display: inline-block; }
.seg-0 { background: #3ec489; } .seg-1 { background: #52b7d4; }
.seg-2 { background: #6a8fe0; } .seg-3 { background: #a583d9; }
.seg-4 { background: #d9a13f; } .seg-5 { background: #8d9aac; }
.seg-6 { background: #5e6b7d; }
.funnel-dot.seg-0 { background: #3ec489; } .funnel-dot.seg-1 { background: #52b7d4; }
.funnel-dot.seg-2 { background: #6a8fe0; } .funnel-dot.seg-3 { background: #a583d9; }
.funnel-dot.seg-4 { background: #d9a13f; } .funnel-dot.seg-5 { background: #8d9aac; }
.funnel-dot.seg-6 { background: #5e6b7d; }

.num-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-6);
}
.num-card {
  display: block; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4); color: var(--text);
  text-decoration: none; box-shadow: var(--shadow-1);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.num-card:hover { border-color: var(--accent-line); text-decoration: none; transform: translateY(-1px); }
.num-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.num-card-conn { margin: var(--sp-3) 0; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.cap-row { display: flex; align-items: center; gap: var(--sp-2); margin-top: .35rem; }
.cap-label { flex: 0 0 7.5rem; color: var(--faint); font-size: var(--fs-2xs);
             font-family: "Geist Mono", ui-monospace, monospace; white-space: nowrap; }
.cap-track { flex: 1; height: .3rem; border-radius: 999px; background: var(--bg-sunken);
             overflow: hidden; }
.cap-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent);
            opacity: .8; max-width: 100%; }

.feed {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden;
}
.feed-row {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding: .5rem var(--sp-4); border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
}
.feed-row:last-child { border-bottom: 0; }
.feed-dot { width: .45rem; height: .45rem; border-radius: 999px; flex-shrink: 0;
            align-self: center; }
.feed-dot-msg { background: var(--info); }
.feed-dot-audit { background: var(--faint); }
.feed-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-who { color: var(--dim); font-size: var(--fs-xs); min-width: 0;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.feed-when { color: var(--faint); font-size: var(--fs-xs); white-space: nowrap;
             font-variant-numeric: tabular-nums; }

/* ---- settings control panel (Phase 2 redesign) ---- */
.cp-strip { display: flex; align-items: center; gap: var(--sp-3);
            flex-wrap: wrap; margin-bottom: var(--sp-4); }
.cp-strip .spacer { flex: 1; }
.cp-grid { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.cp-grid .card h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-sm);
                    font-weight: 620; letter-spacing: .01em; }
.offer-row { display: flex; align-items: flex-start; gap: var(--sp-3);
             padding: var(--sp-2) 0; }
.offer-row + .offer-row { border-top: 1px solid var(--line); }
.offer-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.usp-list { margin: var(--sp-2) 0 0; padding-left: 1.1rem;
            display: grid; gap: .35rem; }
.usp-list li { color: var(--dim); font-size: var(--fs-sm); }
.mt-1 { margin-top: var(--sp-2); }
.seq-steps { margin: var(--sp-3) 0 0; padding-left: 1.4rem;
             display: grid; gap: .6rem; }
.seq-steps li { display: grid; grid-template-columns: auto 1fr auto;
                gap: var(--sp-3); align-items: baseline; }
.seq-step-id { color: var(--faint); font-size: var(--fs-xs); }
.seq-step-goal { font-size: var(--fs-sm); }
@media (max-width: 40rem) { .seq-steps li { grid-template-columns: 1fr; gap: .15rem; } }
.adv-block { margin-top: var(--sp-5); }
.adv-block > summary { color: var(--faint); cursor: pointer;
                       font-size: var(--fs-sm); }

/* campaigns cards (Phase 2): stat row + proportional step bar */
.camp-stats { display: flex; flex-wrap: wrap; gap: .35rem 1.2rem; margin-top: var(--sp-2); }
.camp-stat { color: var(--dim); font-size: var(--fs-sm); }
.camp-stat b { color: var(--text); font-weight: 620; }
.camp-bar { margin-top: var(--sp-3); }

/* autopilot decision cards (Phase 2) */
.ap-card .bubble { margin-top: var(--sp-2); }
.ap-card .hold-chips { margin-top: var(--sp-2); }
