@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(/fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f8fafc; --surface: #ffffff; --surface-2: #f1f5f9; --border: #e2e8f0; --field-border: #8492a6;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --muted-strong: #475569;
  --brand: #0d9488; --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #f0fdfa; --accent-line: #99f6e4;
  --ok: #047857; --ok-dot: #059669; --ok-soft: #ecfdf5; --ok-line: #a7f3d0;
  --warn: #92400e; --warn-icon: #f59e0b; --warn-soft: #fffbeb; --warn-line: #fcd34d;
  --bad: #be123c; --bad-strong: #e11d48; --bad-soft: #fff1f2; --bad-line: #fecdd3;
  --info: #1d4ed8; --info-soft: #eff6ff;
  --bubble-in: #f1f5f9; --bubble-in-ink: #0f172a; --bubble-in-meta: #475569;
  --bubble-out: #0f766e; --bubble-out-ink: #ffffff; --bubble-out-meta: #ccfbf1;
  --note-bg: #fffbeb; --note-ink: #0f172a; --note-label: #92400e; --note-line: #f59e0b;
  --chat-bg: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lift: 0 10px 24px -8px rgba(15, 118, 110, .45), 0 4px 10px rgba(15, 23, 42, .12);
  --radius: 16px; --radius-sm: 12px; --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --av-1: #dbeafe; --av-1-ink: #1e3a8a; --av-2: #fed7aa; --av-2-ink: #7c2d12; --av-3: #ccfbf1; --av-3-ink: #134e4a; --av-4: #ede9fe; --av-4-ink: #4c1d95; --av-5: #fce7f3; --av-5-ink: #831843; --av-6: #e2e8f0; --av-6-ink: #1e293b;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --bottom-nav: 0px; --chip-count-on: #134e4a; --chip-count-on-ink: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #111a2b; --surface-2: #1a2436; --border: #263247; --field-border: #5b6b82;
    --text: #e2e8f0; --text-2: #cbd5e1; --muted: #94a3b8; --muted-strong: #cbd5e1;
    --brand: #2dd4bf; --accent: #2dd4bf; --accent-ink: #042f2e; --accent-soft: #0d2b2a; --accent-line: #1f5f59;
    --ok: #6ee7b7; --ok-dot: #34d399; --ok-soft: #06281f; --ok-line: #14532d;
    --warn: #fcd34d; --warn-icon: #f59e0b; --warn-soft: #2a1f06; --warn-line: #78350f;
    --bad: #fda4af; --bad-strong: #fb7185; --bad-soft: #2d0a12; --bad-line: #881337;
    --info: #93c5fd; --info-soft: #0f1e3a;
    --bubble-in: #1a2436; --bubble-in-ink: #e2e8f0; --bubble-in-meta: #cbd5e1;
    --bubble-out: #115e59; --bubble-out-ink: #ffffff; --bubble-out-meta: #ccfbf1;
    --note-bg: #261c05; --note-ink: #fde68a; --note-label: #fcd34d; --note-line: #b45309;
    --chat-bg: #0b1120; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lift: 0 10px 24px -8px rgba(0, 0, 0, .7);
    --chip-count-on: #99f6e4; --chip-count-on-ink: #042f2e;
    --av-1: #1e3a8a; --av-1-ink: #dbeafe; --av-2: #7c2d12; --av-2-ink: #ffedd5; --av-3: #134e4a; --av-3-ink: #ccfbf1; --av-4: #4c1d95; --av-4-ink: #ede9fe; --av-5: #831843; --av-5-ink: #fce7f3; --av-6: #334155; --av-6-ink: #f1f5f9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2b; --surface-2: #1a2436; --border: #263247; --field-border: #5b6b82;
  --text: #e2e8f0; --text-2: #cbd5e1; --muted: #94a3b8; --muted-strong: #cbd5e1;
  --brand: #2dd4bf; --accent: #2dd4bf; --accent-ink: #042f2e; --accent-soft: #0d2b2a; --accent-line: #1f5f59;
  --ok: #6ee7b7; --ok-dot: #34d399; --ok-soft: #06281f; --ok-line: #14532d;
  --warn: #fcd34d; --warn-icon: #f59e0b; --warn-soft: #2a1f06; --warn-line: #78350f;
  --bad: #fda4af; --bad-strong: #fb7185; --bad-soft: #2d0a12; --bad-line: #881337;
  --info: #93c5fd; --info-soft: #0f1e3a;
  --bubble-in: #1a2436; --bubble-in-ink: #e2e8f0; --bubble-in-meta: #cbd5e1;
  --bubble-out: #115e59; --bubble-out-ink: #ffffff; --bubble-out-meta: #ccfbf1;
  --note-bg: #261c05; --note-ink: #fde68a; --note-label: #fcd34d; --note-line: #b45309;
  --chat-bg: #0b1120; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lift: 0 10px 24px -8px rgba(0, 0, 0, .7);
  --chip-count-on: #99f6e4; --chip-count-on-ink: #042f2e;
  --av-1: #1e3a8a; --av-1-ink: #dbeafe; --av-2: #7c2d12; --av-2-ink: #ffedd5; --av-3: #134e4a; --av-3-ink: #ccfbf1; --av-4: #4c1d95; --av-4-ink: #ede9fe; --av-5: #831843; --av-5-ink: #fce7f3; --av-6: #334155; --av-6-ink: #f1f5f9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 700; letter-spacing: -.01em; }
button { font-family: inherit; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--field-border); border-radius: var(--radius-sm); padding: 9px 12px; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { resize: vertical; width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; stroke-width: 2.2; }
.boot, .loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 48px; color: var(--muted); }
.loading.inline { padding: 8px; justify-content: flex-start; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { transition: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-ghost { color: var(--bad); }
.btn-small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.wide { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; font-size: 20px; line-height: 1; min-width: 40px; min-height: 40px; padding: 8px; cursor: pointer; color: var(--text-2); border-radius: 999px; }
.icon-btn:hover { background: var(--surface-2); }
.link { background: none; border: 0; padding: 2px 6px; color: var(--muted); cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.link.active { color: var(--text); border-bottom-color: var(--brand); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 24px; align-items: start; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.explain { color: var(--muted); margin-top: 2px; }
.dim { opacity: .5; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.w40 { width: 28%; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--text-2); }

.center-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); position: relative; }
.lang-corner { position: absolute; top: calc(16px + var(--safe-top)); right: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.demo-accounts h2 { font-size: 17px; margin: 0; }
.demo-list { display: flex; flex-direction: column; gap: 8px; }
.demo-account { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.demo-account:hover, .demo-account:focus-visible { border-color: var(--accent); }
.demo-account .muted { color: var(--muted-strong); font-size: 13px; }
.demo-roles { font-size: 13px; color: var(--text-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand.big { font-size: 21px; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); flex: none; }
.logo svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; padding: calc(16px + var(--safe-top)) 12px calc(16px + var(--safe-bottom)); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.side .brand { padding: 0 6px; }
.ws-switch select { width: 100%; font-weight: 700; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; }
.side nav a .nav-label { flex: 1; }
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-count, .pill-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; min-width: 22px; text-align: center; line-height: 18px; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.me { color: var(--text); font-weight: 700; }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted-strong); }
.live span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on span { background: var(--ok-dot); }
.live.off span { background: var(--warn-icon); }
.local-pill { font-size: 12px; font-weight: 700; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); padding: 6px 10px; border-radius: 999px; text-align: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.bottom-nav { display: none; }
.page { padding: 28px 32px 56px; max-width: 1180px; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.page.narrow { max-width: 560px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.ws-tile { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex: none; }
.ws-pick { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.ws-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-pick select { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.ws-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

.fab { position: fixed; right: calc(20px + var(--safe-right)); bottom: calc(24px + var(--bottom-nav) + var(--safe-bottom)); z-index: 35; display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 24px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; box-shadow: var(--shadow-lift); }
.inbox .fab { position: absolute; bottom: 16px; right: 16px; }
.fab:hover { text-decoration: none; filter: brightness(1.08); }
.fab svg.i { width: 22px; height: 22px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.client-card { color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.client-card:hover { border-color: var(--brand); text-decoration: none; }
.client-name { font-weight: 700; font-size: 15px; }
.tpl-card { text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.tpl-card:hover, .tpl-card.selected { border-color: var(--brand); }
.tpl-card.selected { box-shadow: 0 0 0 2px var(--brand); }
.tpl-name { font-family: var(--mono); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.tpl-snippet { font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 12px 12px 12px 4px; padding: 10px 12px; }
.tpl-snippet span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty.small { padding: 24px 12px; }
.empty-title { font-weight: 700; color: var(--text); font-size: 15px; }
.health-strip { display: block; padding: 12px 16px; border-radius: var(--radius); font-weight: 700; border: 1px solid transparent; }
.health-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.health-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.health-fail { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted-strong); font-weight: 700; letter-spacing: .02em; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.small td, .table.small th { padding: 7px 10px; font-size: 13px; }
.clickable { cursor: pointer; }
.clickable:hover td { background: var(--accent-soft); }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 1px 3px 1px 0; font-family: var(--mono); }
.tag.removable { cursor: pointer; font: inherit; font-size: 12px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 180px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; }

.filter-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--brand); }
.chip .count { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 0 8px; line-height: 20px; background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip .count.alert { background: var(--bad-soft); color: var(--bad); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.active .count { background: var(--chip-count-on); color: var(--chip-count-on-ink); }

.badge, .pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; line-height: 18px; }
.badge-ok, .pill-window { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge-bad, .pill-optout, .pill-unassigned { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.badge-muted, .pill-template { background: var(--surface-2); color: var(--muted-strong); border-color: var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill-window .dot { background: var(--ok-dot); }
.pill-agent { background: var(--surface); color: var(--text-2); border-color: var(--border); padding-left: 3px; }
.pill-agent .mini-av { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 9.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; letter-spacing: -.02em; }

.alert { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--text); }
.alert-body { flex: 1; min-width: 0; }
.alert-error { background: var(--bad-soft); border-color: var(--bad-line); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn-line); border-left: 4px solid var(--warn-icon); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.meta-error { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--bad-line); font-size: 13px; }
.steps { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.steps .ok { color: var(--ok); }
.steps .bad { color: var(--bad); font-weight: 700; }

.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: calc(6vh + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(15, 23, 42, .3); }
.modal.wide { max-width: 920px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--bad); font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.help { position: relative; display: inline-block; vertical-align: middle; }
.help-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--field-border); background: var(--surface); color: var(--text-2); font-size: 11px; font-weight: 800; cursor: pointer; padding: 0; line-height: 18px; }
.help-pop { position: absolute; z-index: 20; top: 26px; left: -8px; width: 280px; max-width: 80vw; background: var(--text); color: var(--bg); padding: 10px 12px; border-radius: 12px; font-size: 13px; font-weight: 500; line-height: 1.45; box-shadow: var(--shadow); letter-spacing: 0; }

.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 12px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted-strong); white-space: nowrap; }
.tab.active { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.toasts { position: fixed; bottom: calc(16px + var(--bottom-nav) + var(--safe-bottom)); right: 16px; left: auto; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lift); max-width: 360px; font-weight: 600; }
.toast-bad { background: var(--bad); color: #fff; }

.progress { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.seg { display: block; height: 100%; }
.seg-read { background: var(--accent); }
.seg-delivered { background: var(--brand); opacity: .55; }
.seg-sent { background: var(--info); }
.seg-failed { background: var(--bad-strong); }
.seg-skipped { background: var(--muted); opacity: .4; }
.seg-queued { background: var(--border); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats.compact { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; color: var(--text); }
a.stat { font-weight: inherit; }
a.stat:hover { border-color: var(--brand); text-decoration: none; }
.stat-n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-l { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.stat.ok .stat-n { color: var(--ok); }
.stat.bad .stat-n { color: var(--bad); }
.stat.muted .stat-n { color: var(--muted-strong); }
.funnel { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list a { color: var(--text); margin-bottom: 4px; }

.account { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.account-number { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.account-facts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.account-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.quality { font-size: 12.5px; font-weight: 700; }
.q-green { color: var(--ok); }
.q-yellow { color: var(--warn); }
.q-red { color: var(--bad); }
.connect { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.connect-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.option { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.option:hover:not(:disabled) { border-color: var(--brand); background: var(--accent-soft); }
.option:disabled { opacity: .6; cursor: wait; }
.consent-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; margin: 0; background: var(--bg); }
.consent-box legend { font-weight: 700; padding: 0 4px; }
.attrs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; margin: 8px 0 0; }
.attrs dt { color: var(--muted); font-weight: 600; }
.attrs dd { margin: 0; }
.dropzone { border: 2px dashed var(--field-border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; display: block; color: var(--text-2); font-weight: 600; }
.dropzone:hover { border-color: var(--brand); color: var(--accent); }
.dropzone input { display: block; margin: 0 auto 8px; }

.bubble-preview { background: var(--surface-2); padding: 14px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble { max-width: 520px; padding: 9px 13px 6px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; position: relative; line-height: 1.45; }
.bubble.in { background: var(--bubble-in); color: var(--bubble-in-ink); border-bottom-left-radius: 6px; }
.bubble.out { background: var(--bubble-out); color: var(--bubble-out-ink); border-bottom-right-radius: 6px; }
.bubble.note { background: var(--note-bg); color: var(--note-ink); border: 1.5px dashed var(--note-line); border-radius: 14px; }
.bubble.failed { background: var(--bad-soft); color: var(--text); border: 1px solid var(--bad-strong); }
.bubble-preview .bubble { width: 100%; max-width: 340px; }
.tpl-header { font-weight: 800; margin-bottom: 4px; }
.tpl-footer { font-size: 12px; color: var(--bubble-out-meta); margin-top: 4px; }
.tpl-buttons { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 340px; }
.tpl-buttons span { background: var(--surface); color: var(--accent); border: 1px solid var(--border); text-align: center; padding: 8px; border-radius: 12px; font-size: 13px; font-weight: 700; }
.media-ph { display: block; background: rgba(255, 255, 255, .15); color: inherit; padding: 24px; text-align: center; border-radius: 10px; font-size: 12px; font-weight: 700; }
.sample { margin-bottom: 12px; }

.stepper { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.stepper button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; min-height: 36px; padding: 5px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted-strong); }
.stepper button:disabled { cursor: default; opacity: .7; }
.stepper .current button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); opacity: 1; }
.stepper .done button { color: var(--accent); border-color: var(--brand); background: var(--accent-soft); }
.audience { display: flex; flex-direction: column; gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--brand); }
.radio-card select { margin-top: 6px; max-width: 100%; }
.map-row { display: grid; grid-template-columns: minmax(110px, 1fr) 130px minmax(120px, 1.4fr) minmax(100px, 1fr); gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.map-var { display: flex; flex-direction: column; }
.var { font-family: var(--mono); font-weight: 700; color: var(--accent); }

.av { position: relative; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; letter-spacing: -.02em; flex: none; background: var(--av-1); color: var(--av-1-ink); }
.av.sm { width: 36px; height: 36px; font-size: 13px; }
.av.c2 { background: var(--av-2); color: var(--av-2-ink); }
.av.c3 { background: var(--av-3); color: var(--av-3-ink); }
.av.c4 { background: var(--av-4); color: var(--av-4-ink); }
.av.c5 { background: var(--av-5); color: var(--av-5-ink); }
.av.c6 { background: var(--av-6); color: var(--av-6-ink); }
.av-badge { position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); display: inline-flex; align-items: center; justify-content: center; background: var(--ok-dot); color: #fff; }
.av-badge.closed { background: var(--muted-strong); }
.av-badge svg.i { width: 12px; height: 12px; stroke-width: 2.4; }

.inbox { display: grid; grid-template-columns: 380px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.inbox-list { position: relative; min-width: 0; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
.inbox-list-head { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.inbox-strip { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .03em; }
.inbox-strip .live { letter-spacing: .06em; text-transform: uppercase; color: var(--ok); }
.inbox-strip .live.off { color: var(--warn); }
.inbox-strip .sep { width: 1px; height: 16px; background: var(--border); }
.inbox-strip .strip-item { display: inline-flex; align-items: center; gap: 5px; }
.inbox-search { width: 100%; }
.conv-list { list-style: none; margin: 0; padding: 12px 12px 104px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.conv { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 400; overflow: hidden; }
.conv:hover { border-color: var(--accent-line); text-decoration: none; }
.conv.active { box-shadow: inset 4px 0 0 var(--brand); border-color: var(--accent-line); }
.conv .av { grid-row: span 3; align-self: start; }
.conv-top { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; min-width: 0; }
.conv-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 12px; font-weight: 700; color: var(--muted-strong); white-space: nowrap; flex: none; }
.conv-time.unread { color: var(--accent); }
.conv-preview { color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-preview .who { color: var(--accent); font-weight: 700; }
.conv.has-unread .conv-preview { color: var(--text); font-weight: 600; }
.conv-foot { display: flex; gap: 6px; align-items: flex-end; min-width: 0; margin-top: 4px; }
.conv-foot .chips { flex: 1; min-width: 0; flex-wrap: wrap; }
.conv-foot .ticks { margin-left: auto; font-size: 13px; color: var(--muted-strong); }
.conv-foot .ticks-read { color: var(--accent); }
.thread { display: flex; flex-direction: column; min-height: 0; background: var(--chat-bg); }
.empty-thread { align-items: center; justify-content: center; }
.thread-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: calc(10px + var(--safe-top)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.thread-id { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 200px; }
.thread-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.thread-who strong { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.thread-actions select { max-width: 180px; }
.back-link { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; background: var(--surface); border: 1px solid var(--border); color: var(--muted-strong); font-size: 12px; font-weight: 700; padding: 2px 12px; border-radius: 999px; margin: 8px 0; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.msg.note { justify-content: center; }
.msg .bubble { max-width: min(560px, 80%); }
.msg.note .bubble { max-width: min(600px, 92%); width: 100%; }
.src { font-size: 11.5px; font-weight: 800; letter-spacing: .02em; color: var(--bubble-out-meta); margin-bottom: 2px; }
.bubble.in .src { color: var(--accent); }
.bubble.note .src { color: var(--note-label); display: flex; gap: 6px; align-items: center; }
.bubble.failed .src { color: var(--bad); }
.meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11.5px; font-weight: 600; margin-top: 3px; }
.bubble.in .meta { color: var(--bubble-in-meta); }
.bubble.out .meta { color: var(--bubble-out-meta); }
.bubble.note .meta { color: var(--note-label); }
.bubble.failed .meta { color: var(--muted-strong); }
.ticks { font-size: 11.5px; letter-spacing: -2px; font-weight: 800; }
.bubble.out .ticks-read { color: #ffffff; }
.ticks-failed { color: var(--bad); letter-spacing: 0; font-weight: 800; }
.fail-reason { font-size: 12px; color: var(--bad); margin-top: 6px; border-top: 1px dashed var(--bad-line); padding-top: 6px; white-space: normal; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px calc(12px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; }
.composer.noting textarea { background: var(--note-bg); border: 1.5px dashed var(--note-line); color: var(--note-ink); }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea { flex: 1; border-radius: 20px; padding: 10px 16px; }
.compose-row .btn { min-height: 44px; border-radius: 999px; }
.mode-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.mode-switch .chip { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.mode-switch .chip.note-chip.active { background: var(--note-bg); color: var(--note-label); border: 1.5px dashed var(--note-line); }

.contact-cell { display: flex; gap: 12px; align-items: center; min-width: 0; }
.contact-cell strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding-bottom: 72px; }
.campaign-card { display: flex; flex-direction: column; gap: 12px; color: var(--text); font-weight: 400; }
.campaign-card:hover { border-color: var(--brand); text-decoration: none; }
.campaign-card .cc-name { font-weight: 800; font-size: 16px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.campaign-card .cc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.campaign-card .cc-nums div { display: flex; flex-direction: column; }
.campaign-card .cc-nums b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.campaign-card .cc-nums span { font-size: 12px; font-weight: 700; color: var(--text-2); }
.campaign-card .cc-nums .bad b { color: var(--bad); }

.roles-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.roles-legend div { display: flex; flex-direction: column; }
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.hours { display: flex; flex-direction: column; gap: 6px; }
.hours-row { display: grid; grid-template-columns: 130px 110px 14px 110px; gap: 8px; align-items: center; }
.card.danger { border-color: var(--bad-line); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.check { align-items: flex-start; }
.checks .check { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: default; }
.checks .check:last-child { border-bottom: 0; }
.check-icon { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; font-size: 13px; }
.check-ok .check-icon { background: var(--ok-soft); color: var(--ok); }
.check-warn .check-icon { background: var(--warn-soft); color: var(--warn); }
.check-fail .check-icon { background: var(--bad-soft); color: var(--bad); }
.check-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.check-title { font-weight: 700; }
.fix { background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }

@media (max-width: 900px) {
  :root { --bottom-nav: 72px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 45; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(15, 23, 42, .25); }
  .nav-open .side { transform: none; }
  .nav-open .main::before { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 44; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-top)) calc(12px + var(--safe-right)) 10px calc(16px + var(--safe-left)); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; min-height: 64px; }
  .topbar .ws-pick { flex: 1; }
  .top-title { font-weight: 800; font-size: 18px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding: 8px calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left)); gap: 4px; justify-content: space-around; }
  .bottom-nav a, .bottom-nav button { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 700; background: none; border: 0; cursor: pointer; position: relative; min-height: 56px; justify-content: flex-start; line-height: 1.15; text-align: center; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .active { background: var(--accent); color: var(--accent-ink); }
  .bottom-nav .bn-count { position: absolute; top: 2px; right: calc(50% - 22px); background: var(--bad-strong); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 800; padding: 0 5px; line-height: 16px; min-width: 16px; text-align: center; }
  .bottom-nav svg.i { width: 24px; height: 24px; }
  .main { padding-bottom: calc(var(--bottom-nav) + var(--safe-bottom)); }
  .shell.in-thread .bottom-nav, .shell.in-thread .topbar { display: none; }
  .shell.in-thread .main { padding-bottom: 0; }
  .shell.in-thread { --bottom-nav: 0px; }
  .page { padding: 16px 16px 40px; }
  .split, .grid3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 64px - var(--safe-top) - var(--bottom-nav) - var(--safe-bottom)); }
  .shell.in-thread .inbox { height: 100vh; height: 100dvh; }
  .inbox-list { border-right: 0; }
  .inbox.has-conv .inbox-list { display: none; }
  .inbox:not(.has-conv) .thread { display: none; }
  .inbox-list-head { padding: 12px 16px; }
  .conv-list { padding: 14px 16px 96px; gap: 12px; }
  .back-link { display: inline-flex; }
  .thread-head { padding-left: 8px; }
  .thread-actions { width: 100%; }
  .thread-actions select { flex: 1; max-width: none; }
  .messages { padding: 14px 12px; }
  .msg .bubble { max-width: 86%; }
  .map-row { grid-template-columns: 1fr 1fr; }
  .page-head .hide-mobile { display: none; }
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody { display: block; }
  .table.responsive tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { display: block; padding: 0; border: 0; }
  .table.responsive td.r-full { grid-column: 1 / -1; }
  .table.responsive td.r-hide { display: none; }
  .table.responsive td.r-sub { grid-column: 1 / -1; padding-left: 48px; }
  .table.responsive td.r-end { grid-row: 1; grid-column: 2; justify-self: end; align-self: center; }
  .toasts { left: 16px; right: 16px; }
  .fab { right: calc(16px + var(--safe-right)); }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .hours-row { grid-template-columns: 1fr 1fr; }
  .hours-row span:nth-of-type(1) { display: none; }
  .campaign-list { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
select { max-width: 100%; text-overflow: ellipsis; }
.modal-body { overflow-x: hidden; }
.modal-body .stack > * { min-width: 0; }
.modal { min-width: 0; }
.modal-back > .modal { flex: 0 1 520px; }
.modal-back > .modal.wide { flex-basis: 920px; }
.audit .mono, .tpl-card .mono, .check-body .mono { white-space: normal; overflow-wrap: anywhere; }
