:root {
  color-scheme: dark;
  --bg: #07090c;
  --bg-2: #0b0e13;
  --panel: #10141a;
  --panel-2: #141a22;
  --panel-3: #1a212b;
  --line: #1e2630;
  --line-2: #2a3442;
  --ink: #e9eef4;
  --ink-2: #c3ccd7;
  --muted: #8a96a5;
  --faint: #5d6877;
  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-ink: #04140e;
  --grad: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(52, 211, 153, .16), rgba(34, 211, 238, .10));
  --glow: 0 0 0 1px rgba(52, 211, 153, .35), 0 8px 30px -8px rgba(52, 211, 153, .45);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .12);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .12);
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .12);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
  --chat: #0b1016;
  --in: #182029; --out: #0f3a30; --bot: #172440; --cast: #33280f;
  --link: #67e8f9;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 40px -24px rgba(0, 0, 0, .8);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
::selection { background: rgba(52, 211, 153, .3); }
a { color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232c37; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #303b49; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.boot .spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* ---------------------------------------------------------------- animation */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }
@keyframes dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes glowShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.page { animation: fadeUp .45s var(--ease) both; }
.stagger > * { animation: fadeUp .45s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; } .stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; } .stagger > *:nth-child(6) { animation-delay: .17s; }
.stagger > *:nth-child(7) { animation-delay: .2s; } .stagger > *:nth-child(8) { animation-delay: .23s; }
.stagger > *:nth-child(n+9) { animation-delay: .26s; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, #121821 0%, #1b232e 50%, #121821 100%); background-size: 800px 100%; animation: shimmer 1.3s linear infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
nav.side {
  background: linear-gradient(180deg, #0a0d12 0%, #080a0e 100%); border-right: 1px solid var(--line);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden;
}
nav.side::before { content: ""; position: absolute; inset: -120px -80px auto auto; width: 260px; height: 260px; background: radial-gradient(circle, rgba(52, 211, 153, .12), transparent 65%); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: var(--accent-ink); box-shadow: var(--glow); }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--faint); font-size: 11px; letter-spacing: .02em; }
.side .cta { margin: 0 2px 14px; justify-content: center; }
.side .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 14px 12px 6px; }
.side a.nav {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-decoration: none;
  color: var(--ink-2); position: relative; transition: background .2s var(--ease), color .2s var(--ease);
}
.side a.nav:hover { background: rgba(255, 255, 255, .04); color: var(--ink); }
.side a.nav.active { background: linear-gradient(90deg, rgba(52, 211, 153, .14), rgba(52, 211, 153, .02)); color: #fff; }
.side a.nav.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 12px rgba(52, 211, 153, .7); }
.side a.nav.active .ic { color: var(--accent); }
.side .badge { margin-left: auto; background: var(--grad); color: var(--accent-ink); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 8px; animation: pop .3s var(--ease); }
.side .spacer { flex: 1; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.me-card .who { flex: 1; min-width: 0; }
.me-card b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card span { color: var(--faint); font-size: 11.5px; text-transform: capitalize; }
main { padding: 30px 36px 70px; min-width: 0; overflow-y: auto; background: radial-gradient(1200px 500px at 70% -10%, rgba(34, 211, 238, .05), transparent 60%), var(--bg); }
main.full { padding: 0; overflow: hidden; }

/* ---------------------------------------------------------------- type + layout */
h1 { font-size: 24px; margin: 0; letter-spacing: -.025em; font-weight: 650; }
h2 { font-size: 15.5px; margin: 0 0 4px; letter-spacing: -.01em; font-weight: 620; }
h3 { font-size: 13.5px; margin: 0 0 8px; font-weight: 600; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.panel { background: linear-gradient(180deg, var(--panel) 0%, #0e1218 100%); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; color: var(--faint); margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- controls */
button, .btn {
  font: inherit; font-weight: 550; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
button:hover, .btn:hover { border-color: #3a4656; background: var(--panel-3); }
button:active, .btn:active { transform: scale(.97); }
button.primary, .btn.primary { background: var(--grad); border-color: transparent; color: var(--accent-ink); font-weight: 650; box-shadow: 0 6px 20px -8px rgba(52, 211, 153, .6); }
button.primary:hover, .btn.primary:hover { box-shadow: var(--glow); filter: brightness(1.05); }
button.danger { color: var(--danger); border-color: rgba(248, 113, 113, .3); background: transparent; }
button.danger:hover { background: var(--danger-soft); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
button.link { border: 0; background: none; padding: 0; color: var(--link); font-weight: 500; }
button.icon { padding: 8px; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #0b0f14; color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; line-height: 1.55; }
select option, select optgroup { background: #121820; color: var(--ink); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(52, 211, 153, .6); box-shadow: 0 0 0 4px rgba(52, 211, 153, .12); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 560; margin-bottom: 6px; color: var(--ink-2); font-size: 13px; }
.hint { display: block; color: var(--faint); font-size: 12px; margin-top: 6px; font-weight: 400; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #26303c; transition: background .25s var(--ease); cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #c9d2dc; transition: transform .25s var(--ease), background .25s; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.toggle-row .grow b { display: block; font-weight: 560; }
.seg { display: inline-flex; padding: 3px; background: #0b0f14; border: 1px solid var(--line-2); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.seg button.on { background: var(--panel-3); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }

/* ---------------------------------------------------------------- pills, chips, tables */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: rgba(255, 255, 255, .06); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.pill.ok, .pill.completed, .pill.read, .pill.APPROVED, .pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.info, .pill.sending, .pill.sent, .pill.delivered, .pill.training { background: var(--info-soft); color: var(--info); }
.pill.warn, .pill.scheduled, .pill.paused, .pill.PENDING, .pill.not_trained { background: var(--warn-soft); color: var(--warn); }
.pill.bad, .pill.failed, .pill.cancelled, .pill.REJECTED, .pill.error { background: var(--danger-soft); color: var(--danger); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { background: var(--accent); animation: pulse 2s infinite; }
.lbl { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600; border: 1px solid; }
.lbl.blue { color: #93c5fd; border-color: rgba(147, 197, 253, .3); background: rgba(147, 197, 253, .08); }
.lbl.green { color: #6ee7b7; border-color: rgba(110, 231, 183, .3); background: rgba(110, 231, 183, .08); }
.lbl.amber { color: #fcd34d; border-color: rgba(252, 211, 77, .3); background: rgba(252, 211, 77, .08); }
.lbl.red { color: #fca5a5; border-color: rgba(252, 165, 165, .3); background: rgba(252, 165, 165, .08); }
.lbl.violet { color: #c4b5fd; border-color: rgba(196, 181, 253, .3); background: rgba(196, 181, 253, .08); }
.lbl.pink { color: #f9a8d4; border-color: rgba(249, 168, 212, .3); background: rgba(249, 168, 212, .08); }
.lbl.teal { color: #5eead4; border-color: rgba(94, 234, 212, .3); background: rgba(94, 234, 212, .08); }
.lbl.slate { color: #cbd5e1; border-color: rgba(203, 213, 225, .25); background: rgba(203, 213, 225, .06); }
.lbl.chan::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.blue { --c: #93c5fd; } .green { --c: #6ee7b7; } .amber { --c: #fcd34d; } .red { --c: #fca5a5; }
.violet { --c: #c4b5fd; } .pink { --c: #f9a8d4; } .teal { --c: #5eead4; } .slate { --c: #cbd5e1; }
.chan-list { display: grid; gap: 8px; }
.chan-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #0d1116; transition: border-color .2s var(--ease); }
.chan-row:hover { border-color: #3a4656; }
.chan-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); flex: none; }
.chan-swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid transparent; transition: transform .15s var(--ease); }
.chan-swatch:hover { transform: scale(1.1); background: var(--c); }
.chan-swatch.on { border-color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent); }
.lbl button { border: 0; background: none; padding: 0; color: inherit; opacity: .6; }
.lbl button:hover { opacity: 1; background: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: transparent; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; cursor: pointer; white-space: nowrap; color: var(--ink-2); transition: all .2s var(--ease); }
.chip:hover { border-color: #3a4656; color: var(--ink); }
.chip.on { background: var(--ink); color: #0a0d12; border-color: var(--ink); font-weight: 600; }
.chip.col { background: var(--ok-soft); border-color: rgba(52, 211, 153, .3); color: var(--accent); }
.chip .n { opacity: .65; margin-left: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
tbody tr { transition: background .15s; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, .025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.banner { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; border: 1px solid; }
.banner.error { background: var(--danger-soft); color: #fecaca; border-color: rgba(248, 113, 113, .25); }
.banner.warn { background: var(--warn-soft); color: #fde68a; border-color: rgba(251, 191, 36, .25); }
.banner.ok { background: var(--ok-soft); color: #a7f3d0; border-color: rgba(52, 211, 153, .25); }
.banner.info { background: var(--info-soft); color: #bfdbfe; border-color: rgba(96, 165, 250, .25); }
.banner .grow a, .banner a { color: inherit; font-weight: 600; }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: linear-gradient(180deg, var(--panel) 0%, #0e1218 100%); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto -30px -40px auto; width: 120px; height: 120px; background: radial-gradient(circle, rgba(52, 211, 153, .08), transparent 70%); }
.stat span { color: var(--muted); font-size: 12px; display: block; margin-bottom: 6px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; font-weight: 650; }
.stat small { color: var(--faint); font-size: 12px; }
.progress { height: 6px; background: #161d26; border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress div { height: 100%; background: var(--grad); transition: width .6s var(--ease); box-shadow: 0 0 12px rgba(52, 211, 153, .5); }

/* ---------------------------------------------------------------- tabs + sub nav */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; transition: color .2s; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-image: var(--grad) 1; border-bottom: 2px solid; font-weight: 600; }
.agent-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); transition: background .2s, color .2s; }
.subnav a:hover { background: rgba(255, 255, 255, .04); color: var(--ink); }
.subnav a.on { background: var(--panel-2); color: #fff; box-shadow: 0 0 0 1px var(--line-2) inset; }
.subnav a.on .ic { color: var(--accent); }
.subnav .count { margin-left: auto; font-size: 11px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 7px; font-weight: 700; }

/* ---------------------------------------------------------------- list editors */
.item { border: 1px solid var(--line); background: #0d1116; border-radius: 12px; padding: 14px; margin-bottom: 10px; transition: border-color .2s; animation: fadeUp .3s var(--ease) both; }
.item:hover { border-color: var(--line-2); }
.item-row { display: grid; gap: 10px; align-items: center; }
.doc { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #0d1116; margin-bottom: 10px; transition: border-color .2s, transform .2s var(--ease); }
.doc:hover { border-color: var(--line-2); transform: translateY(-1px); }
.doc .icon-wrap { width: 40px; height: 40px; border-radius: 10px; background: var(--grad-soft); display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.doc b { display: block; }
.choice { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: all .2s var(--ease); background: #0d1116; display: block; }
.choice:hover { border-color: #3a4656; }
.choice.on { border-color: rgba(52, 211, 153, .6); box-shadow: 0 0 0 4px rgba(52, 211, 153, .1); background: linear-gradient(180deg, rgba(52, 211, 153, .06), transparent); }
.choice b { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color .2s, background .2s; }
.check-item:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .02); }
.check-item .tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--faint); flex-shrink: 0; }
.check-item.done .tick { background: var(--grad); border-color: transparent; color: var(--accent-ink); }
.check-item .ic.arrow { margin-left: auto; color: var(--faint); }
.hero { border-radius: 18px; padding: 1px; background: linear-gradient(135deg, rgba(52, 211, 153, .55), rgba(34, 211, 238, .25), rgba(255, 255, 255, .04)); margin-bottom: 18px; }
.hero > div { border-radius: 17px; background: radial-gradient(600px 220px at 85% -30%, rgba(34, 211, 238, .12), transparent 60%), linear-gradient(180deg, #10161c, #0c1015); padding: 22px; }

/* ---------------------------------------------------------------- compose + preview */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.preview-wrap { position: sticky; top: 16px; }
.step-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-title i { font-style: normal; width: 26px; height: 26px; border-radius: 8px; background: var(--grad-soft); border: 1px solid rgba(52, 211, 153, .35); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.step-title h2 { margin: 0; }
.var-row { display: grid; grid-template-columns: 72px 1fr 160px; gap: 8px; align-items: center; margin-bottom: 8px; }
.var-row code { background: #0b0f14; border: 1px solid var(--line); padding: 4px 6px; border-radius: 7px; font-size: 12px; text-align: center; color: var(--accent); }
.group { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.group h3 { font-size: 13px; margin: 0 0 10px; }
.media-slot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.media-slot img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); }
.media-slot input[type=url] { flex: 1; min-width: 180px; }
.sample { overflow: auto; max-height: 190px; border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; }
.sample table td, .sample table th { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
.phone { background: var(--chat); border-radius: 26px; border: 1px solid var(--line-2); box-shadow: 0 0 0 8px #0b0e12, 0 0 0 9px var(--line), 0 30px 60px -30px rgba(0, 0, 0, .9); padding: 16px 12px; min-height: 440px; max-height: 660px; overflow: auto; }
.phone-head { font-size: 11.5px; color: var(--faint); text-align: center; margin-bottom: 10px; letter-spacing: .02em; }
.bubble { background: var(--in); border-radius: 4px 14px 14px 14px; padding: 7px 10px 8px; max-width: 92%; font-size: 13.5px; white-space: pre-wrap; word-wrap: break-word; animation: pop .35s var(--ease); }
.bubble .hdr-text { font-weight: 700; margin-bottom: 4px; }
.bubble .media, .card .media { background: #1c252f; border-radius: 8px; height: 140px; display: grid; place-items: center; color: var(--faint); font-size: 12px; margin-bottom: 6px; overflow: hidden; }
.bubble .media img, .card .media img { width: 100%; height: 100%; object-fit: cover; }
.bubble .footer { color: var(--faint); font-size: 12px; margin-top: 4px; }
.bubble .time { text-align: right; color: var(--faint); font-size: 11px; }
.wa-btn { border-top: 1px solid rgba(255, 255, 255, .06); text-align: center; color: var(--link); padding: 8px 4px 2px; font-size: 13px; font-weight: 500; }
.carousel { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scroll-snap-type: x mandatory; }
.card { flex: 0 0 82%; background: var(--in); border-radius: 12px; overflow: hidden; scroll-snap-align: start; font-size: 13px; white-space: pre-wrap; animation: pop .4s var(--ease) both; }
.card .media { border-radius: 0; height: 130px; margin: 0; }
.card .txt { padding: 8px 10px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.tpl-card { background: linear-gradient(180deg, var(--panel) 0%, #0e1218 100%); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: transform .25s var(--ease), border-color .25s; }
.tpl-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tpl-card .phone { min-height: 0; max-height: 360px; box-shadow: none; border-radius: 12px; }

/* ---------------------------------------------------------------- modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 5, 8, .7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 10; padding: 16px; animation: fadeIn .2s ease both; }
.modal { background: linear-gradient(180deg, #12171e, #0e1218); border: 1px solid var(--line-2); border-radius: 18px; padding: 24px; max-width: 460px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9); animation: scaleIn .28s var(--ease) both; }
.modal.wide { max-width: 1000px; }
.modal.mid { max-width: 680px; }
.modal h2 { font-size: 18px; margin-bottom: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #18202a; border: 1px solid var(--line-2); color: var(--ink); padding: 11px 16px; border-radius: 12px; z-index: 20; max-width: 90vw; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .9); animation: toastIn .3s var(--ease) both; display: flex; gap: 10px; align-items: center; }
.toast .ic { color: var(--accent); }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(800px 400px at 50% -10%, rgba(52, 211, 153, .14), transparent 60%), radial-gradient(600px 300px at 90% 110%, rgba(34, 211, 238, .08), transparent 60%), var(--bg); }
.auth .card-auth { width: 100%; max-width: 400px; animation: scaleIn .5s var(--ease) both; }
.auth .brand { justify-content: center; padding-bottom: 22px; }
.auth .panel { padding: 28px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- inbox */
.inbox { display: grid; grid-template-columns: 350px minmax(0, 1fr); height: 100vh; }
.inbox.details-open { grid-template-columns: 350px minmax(0, 1fr) 300px; }
.convs { border-right: 1px solid var(--line); background: #090c10; display: flex; flex-direction: column; min-height: 0; }
.conv-tools { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.conv-tools h1 { font-size: 20px; }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { padding-left: 34px; }
.conv-list { overflow-y: auto; flex: 1; padding: 6px; }
.conv { display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; padding: 11px 10px; border-radius: 12px; cursor: pointer; align-items: center; transition: background .15s; margin-bottom: 2px; }
.conv:hover { background: rgba(255, 255, 255, .03); }
.conv.on { background: linear-gradient(90deg, rgba(52, 211, 153, .12), rgba(52, 211, 153, .03)); box-shadow: 0 0 0 1px rgba(52, 211, 153, .2) inset; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; color: #dfe6ee; flex-shrink: 0; font-size: 14px; background: linear-gradient(135deg, #263241, #1a222d); border: 1px solid var(--line-2); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.conv .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .prev { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .meta { text-align: right; font-size: 11px; color: var(--faint); display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.conv .unread { background: var(--grad); color: var(--accent-ink); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; animation: pop .3s var(--ease); }
.conv .tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.conv .tags .pill, .conv .tags .lbl { font-size: 10.5px; padding: 0 7px; }
.thread { display: flex; flex-direction: column; min-height: 0; position: relative;
  background:
    radial-gradient(700px 380px at 12% 8%, rgba(52, 211, 153, .07), transparent 65%),
    radial-gradient(700px 420px at 92% 96%, rgba(34, 211, 238, .06), transparent 65%),
    radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--chat); }
.thread-head { position: relative; z-index: 1; background: linear-gradient(180deg, rgba(16, 21, 28, .92), rgba(11, 15, 20, .86)); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .9); }
.thread-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(52, 211, 153, .45), rgba(34, 211, 238, .35), transparent); }
.thread-head .avatar { width: 44px; height: 44px; position: relative; background: linear-gradient(135deg, #1f3a35, #16222e); border: 0; box-shadow: 0 0 0 2px var(--chat), 0 0 0 3.5px rgba(52, 211, 153, .55), 0 8px 20px -8px rgba(52, 211, 153, .5); }
.thread-head .who { flex: 1; min-width: 160px; }
.thread-head .who b { display: block; font-size: 16px; letter-spacing: -.01em; margin-bottom: 3px; }
.thread-head .who .lbl.chan { font-size: 11px; padding: 1px 8px; }
.head-actions { display: flex; gap: 6px; align-items: center; padding: 4px; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(8, 11, 15, .6); box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset; }
.head-actions > button, .head-actions > select { border-color: transparent; background: transparent; border-radius: 10px; }
.head-actions > button:hover, .head-actions > select:hover { background: rgba(255, 255, 255, .06); border-color: transparent; }
.head-actions > .ai-toggle.on, .head-actions > .ai-toggle.off { border-color: transparent; }
.win { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 8px 1px 6px; border-radius: 99px; font-size: 11px; font-weight: 600;
  color: #6ee7b7; background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .22); white-space: nowrap; }
.win .ic { width: 12px; height: 12px; }
.win.soon { color: #fcd34d; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); }
.win.urgent { color: #fca5a5; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); animation: pulse 2s infinite; }
.win.closed { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line-2); }
.conv .tags .win { margin-left: 0; font-size: 10.5px; padding: 0 7px 0 5px; }
/* ---------------- dashboard */
.dash { max-width: 1320px; margin: 0 auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.dcard, .kpi { animation: dashIn .7s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes dashIn { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

.dash-hero { position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--line-2); margin-bottom: 18px; isolation: isolate;
  background: linear-gradient(135deg, #0d151b 0%, #0b1016 60%, #0f1320 100%); animation: dashIn .8s var(--ease) both; }
.dash-hero-in { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 30px 30px 28px; }
.dash-hero h1 { font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -.03em; margin: 10px 0 6px; }
.dash-hero .sub { margin: 0; font-size: 14.5px; }
.dash-hero .sub b { color: var(--ink); }
.aurora { position: absolute; inset: 0; z-index: 0; filter: blur(48px); opacity: .9; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.aurora i:nth-child(1) { width: 420px; height: 260px; left: -60px; top: -120px; background: radial-gradient(circle, rgba(52, 211, 153, .38), transparent 65%); animation: drift1 16s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 460px; height: 300px; right: -80px; top: -140px; background: radial-gradient(circle, rgba(34, 211, 238, .30), transparent 65%); animation: drift2 19s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 380px; height: 240px; left: 40%; bottom: -170px; background: radial-gradient(circle, rgba(139, 92, 246, .28), transparent 65%); animation: drift3 22s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(140px, 70px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-160px, 60px) scale(.9); } }
@keyframes drift3 { to { transform: translate(-120px, -40px) scale(1.2); } }
.hero-grid { position: absolute; inset: 0; z-index: 1; background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(ellipse 70% 90% at 70% 0%, #000 20%, transparent 75%); animation: gridPan 30s linear infinite; }
@keyframes gridPan { to { background-position: 34px 34px; } }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); padding: 16px 18px 14px; color: var(--accent);
  background: linear-gradient(180deg, var(--panel) 0%, #0e1218 100%); box-shadow: var(--shadow); transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease); }
.kpi:hover { transform: translateY(-3px); border-color: rgba(52, 211, 153, .35); box-shadow: 0 18px 40px -22px rgba(52, 211, 153, .45); }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(52, 211, 153, .6), transparent); opacity: .7; }
.kpi.warn { color: var(--warn); }
.kpi.warn::before { background: linear-gradient(90deg, transparent, rgba(251, 191, 36, .7), transparent); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; }
.kpi-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, currentColor 12%, transparent); color: inherit; }
.kpi:not(.warn) .kpi-ic { color: var(--accent); }
.kpi-ic .ic { width: 16px; height: 16px; }
.kpi-val { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; }
.kpi-val b { font-size: 34px; font-weight: 700; letter-spacing: -.04em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-val small { color: var(--muted); font-size: 14px; font-weight: 600; }
.kpi-sub { color: var(--faint); font-size: 12px; margin-top: 2px; position: relative; z-index: 1; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38px; opacity: .9; }
.spark-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s var(--ease) .4s forwards; }
.spark-area { opacity: 0; animation: fadeIn 1s ease 1.1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeInKey { to { opacity: 1; } }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid.wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid > .panel { margin-bottom: 16px; }
.dash .panel { transition: border-color .3s var(--ease); }
.dash .panel:hover { border-color: var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.chart-box { position: relative; }
.activity .grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.activity .axis { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.activity .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.activity .cross { stroke: rgba(255, 255, 255, .25); stroke-width: 1; stroke-dasharray: 3 3; }
.activity .hover-dot, .activity .end { stroke: var(--panel); stroke-width: 2; }
.activity.anim .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s var(--ease) forwards; animation-delay: calc(.35s + var(--i) * .25s); }
.activity.anim .area { opacity: 0; animation: fadeInKey 1.2s ease 1.3s forwards; }
.activity.anim .end { opacity: 0; transform-box: fill-box; transform-origin: center; animation: popDot .5s var(--ease) 2.1s forwards; }
@keyframes popDot { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.tip { position: absolute; top: 8px; min-width: 180px; padding: 10px 12px; border-radius: 12px; background: rgba(18, 23, 31, .96); border: 1px solid var(--line-2);
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, .9); font-size: 12.5px; pointer-events: none; backdrop-filter: blur(8px); }
.tip b { display: block; margin-bottom: 6px; }
.tip div { display: flex; align-items: center; gap: 8px; color: var(--ink-2); margin-top: 3px; }
.tip div i { width: 9px; height: 9px; border-radius: 3px; }
.tip div span { margin-left: auto; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

.big-num { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.big-num b { font-size: 40px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.big-num span { color: var(--muted); }
.hbar { margin-bottom: 12px; animation: dashIn .6s var(--ease) both; animation-delay: var(--d, 0s); }
.hbar-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.hbar-top span { display: inline-flex; align-items: center; gap: 7px; }
.hbar-top .ic { width: 14px; height: 14px; color: var(--muted); }
.hbar-top b { font-variant-numeric: tabular-nums; }
.track, .ftrack, .mini-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.fill, .ffill, .mini-track > div { height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width 1.2s var(--ease); box-shadow: 0 0 12px rgba(52, 211, 153, .45); }
.hbar.warn .fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 12px rgba(251, 191, 36, .4); }
.hbar.warn .hbar-top .ic { color: var(--warn); }

.wait-list { display: grid; gap: 6px; }
.wait-row, .mini-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; text-decoration: none; color: inherit;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease); }
.wait-row { animation: dashIn .55s var(--ease) both; animation-delay: var(--d, 0s); }
.wait-row:hover, a.mini-row:hover { background: rgba(255, 255, 255, .035); border-color: var(--line-2); transform: translateX(3px); }
.wait-row .arrow, .wait-row > .ic:last-child { width: 15px; height: 15px; color: var(--faint); }
.wait-row .win { margin-left: 0; }
.calm { display: grid; place-items: center; text-align: center; gap: 4px; padding: 26px 10px; color: var(--muted); }
.calm .ic { width: 34px; height: 34px; padding: 8px; border-radius: 50%; color: var(--accent); background: var(--ok-soft); margin-bottom: 6px; animation: pop .5s var(--ease) both; }
.calm b { color: var(--ink); }

.funnel { display: grid; gap: 10px; margin-bottom: 14px; }
.fstep { display: grid; grid-template-columns: 78px 1fr 44px 40px; align-items: center; gap: 10px; font-size: 13px; animation: dashIn .6s var(--ease) both; animation-delay: var(--d, 0s); }
.fstep .fl { color: var(--ink-2); }
.fstep b { text-align: right; font-variant-numeric: tabular-nums; }
.fstep .fp { color: var(--faint); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.ftrack { height: 10px; }
.mini-list { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.mini-row.static { padding: 9px 4px; }
.ring { --p: 0; width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-2);
  background: radial-gradient(closest-side, var(--panel) 72%, transparent 74%), conic-gradient(#059669 calc(var(--p) * 1%), rgba(255, 255, 255, .07) 0); }
.team-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 70px 22px; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px; }
.team-row b { text-align: right; font-variant-numeric: tabular-nums; }
.mini-track { height: 6px; }
.ai-state { display: flex; gap: 12px; align-items: center; }
.orb-sm { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .05); color: var(--muted); }
.ai-state.on .orb-sm { background: var(--grad-soft); color: var(--accent); animation: pulse 2.4s infinite; }
.ai-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ai-nums div { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.ai-nums b { display: block; font-size: 24px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ai-nums span { color: var(--faint); font-size: 12px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid.wide, .dash-grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-hero-in { padding: 22px 18px; } }
@media (prefers-reduced-motion: reduce) {
  .aurora i, .hero-grid, .dcard, .kpi, .hbar, .wait-row, .fstep, .dash-hero { animation: none !important; }
  .spark-line, .activity .line { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .spark-area, .activity .area, .activity .end { opacity: 1; animation: none; }
  .fill, .ffill { transition: none; }
}
/* ---------------- AI agents (one per number) */
.agent-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 18px; padding: 8px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 21, 28, .9), rgba(11, 15, 20, .9)); }
.ab-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 0 6px 0 8px; }
.ab-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 12px; border: 1px solid var(--line-2); background: #0d1116; text-align: left; white-space: normal; max-width: 280px; }
.ab-chip:hover { border-color: #3a4656; }
.ab-chip.on { border-color: rgba(52, 211, 153, .6); background: linear-gradient(180deg, rgba(52, 211, 153, .1), rgba(52, 211, 153, .02)); box-shadow: 0 0 0 3px rgba(52, 211, 153, .08); }
.ab-av { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 750; background: rgba(255, 255, 255, .06); color: var(--ink-2); }
.ab-chip.on .ab-av { background: var(--grad); color: var(--accent-ink); }
.ab-txt { min-width: 0; }
.ab-txt b { display: block; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-txt small { display: block; font-size: 11.5px; color: var(--faint); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-add { padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(52, 211, 153, .45); background: transparent; color: var(--accent); font-size: 13px; }
.ab-add:hover { background: rgba(52, 211, 153, .08); border-style: solid; }
.chan-row.mine { border-color: rgba(52, 211, 153, .35); }
.ag-pick { width: auto; max-width: 200px; }
.chan-slot { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-2); background: transparent; text-align: left; white-space: normal; transition: all .2s var(--ease); }
.chan-slot:hover { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .04); }
.chan-slot b { display: block; color: var(--ink); font-size: 14px; }
.chan-slot small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }
.chan-slot-ic { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px dashed rgba(52, 211, 153, .5); color: var(--accent); }
.add-steps { display: grid; gap: 14px; margin-top: 16px; }
.add-step { display: flex; gap: 12px; }
.add-step > div > b:first-child { display: block; margin-bottom: 2px; }
.add-step .faint b { color: var(--ink-2); }
.add-n { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--grad-soft); border: 1px solid rgba(52, 211, 153, .35); color: var(--accent); }

/* ---------------- customer source + automation trigger filters */
.src-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 10px; border-radius: 99px; font-size: 12px; color: var(--ink-2);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); max-width: 100%; }
.src-pill .ic { width: 13px; height: 13px; color: var(--accent); flex: none; }
.src-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl .ic { width: 12px; height: 12px; }
.fi-section { margin-top: 18px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .015); }
.fi-sec-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; margin-bottom: 12px; }
.fi-sec-title .ic { width: 15px; height: 15px; color: #c4b5fd; }
.fi-section .field { margin-bottom: 12px; }
.cond { flex-wrap: wrap; }
.cond > select:first-child { flex: 1 1 170px; }
.cond > select:not(:first-child), .cond > input { flex: 1 1 120px; }
.time-range { display: flex; align-items: center; gap: 6px; flex: 1 1 200px; }
.time-range input { min-width: 0; }

/* ---------------- campaign labels */
.auto-labels { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.auto-labels .ic { width: 15px; height: 15px; color: var(--accent); }
.auto-labels > span { display: inline-flex; align-items: center; gap: 6px; }
.grp-list { display: grid; gap: 6px; }
.grp { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; font-size: 13.5px; transition: border-color .15s, background .15s; }
.grp:hover { border-color: #3a4656; }
.grp:has(input:checked) { border-color: rgba(52, 211, 153, .6); background: rgba(52, 211, 153, .06); }
.grp b { font-variant-numeric: tabular-nums; }
.grp.empty { opacity: .45; cursor: default; }

/* ---------------- campaign audience type */
.aud-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.aud-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; border-radius: 14px; border: 1px solid var(--line-2); background: #0d1116;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.aud-opt:hover { border-color: #3a4656; transform: translateY(-1px); background: #0f141a; }
.aud-opt.on { border-color: rgba(52, 211, 153, .6); background: linear-gradient(180deg, rgba(52, 211, 153, .08), rgba(52, 211, 153, .02)); box-shadow: 0 0 0 4px rgba(52, 211, 153, .08); }
.aud-opt b { display: block; font-size: 14px; color: var(--ink); }
.aud-opt small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; margin-top: 1px; }
.aud-ic { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .05); color: var(--muted); transition: all .2s var(--ease); }
.aud-opt.on .aud-ic { background: var(--grad); color: var(--accent-ink); box-shadow: 0 6px 16px -6px rgba(52, 211, 153, .7); }
.aud-ic .ic { width: 17px; height: 17px; }
#aud-label, #aud-csv { animation: fadeUp .3s var(--ease) both; }
.aud-count { font-size: 18px; }
@media (max-width: 560px) { .aud-choice { grid-template-columns: 1fr; } }
/* ---------------- contacts */
.ct-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ct-tools .search { min-width: 240px; }
.ct-tools select { width: auto; min-width: 150px; }
.ct-panel { padding: 6px 10px; overflow-x: auto; }
.ct-table { width: 100%; }
.ct-table th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.ct-table td { padding: 10px; }
.ct-table td b.ellipsis { max-width: 240px; }
.ct-table td .faint.ellipsis { max-width: 240px; }
.ct-table th.ck, .ct-table td.ck { width: 34px; padding-right: 0; }
.ct-table tbody tr { cursor: pointer; transition: background .15s var(--ease); }
.ct-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.ct-table tbody tr.sel { background: rgba(52, 211, 153, .06); }
.ct-table tbody tr.open { background: rgba(52, 211, 153, .09); box-shadow: inset 3px 0 0 var(--accent); }
.ct-table td.go { width: 28px; color: var(--faint); }
.ct-table td.go .ic { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.ct-table tbody tr:hover td.go .ic { transform: translateX(3px); color: var(--accent); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; color: var(--ink-2); }
.avatar.live { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px rgba(52, 211, 153, .6); }
.avatar.xl { width: 76px; height: 76px; font-size: 24px; margin: 0 auto 12px; }
.bulk-bar { position: sticky; top: -30px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 14px;
  border: 1px solid rgba(52, 211, 153, .35); background: linear-gradient(180deg, rgba(20, 34, 30, .96), rgba(13, 22, 20, .96)); backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px -18px rgba(0, 0, 0, .9); animation: scaleIn .25s var(--ease) both; }
.bulk-bar select { width: auto; }
.bulk-bar[hidden] { display: none; }
.lbl.pick { cursor: pointer; opacity: .45; background: transparent; padding: 4px 10px; font-size: 12px; transition: opacity .15s, transform .15s var(--ease); }
.lbl.pick:hover { opacity: .8; transform: translateY(-1px); }
.lbl.pick.on { opacity: 1; background: color-mix(in srgb, var(--c) 14%, transparent); }
.lbl.pick.on::before { content: "✓"; font-size: 10px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 15; border-left: 1px solid var(--line-2);
  background: linear-gradient(180deg, #11161d, #0c1015); box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .9); transform: translateX(100%); transition: transform .3s var(--ease); overflow-y: auto; }
.drawer.show { transform: none; }
.drawer-in { padding: 20px 22px 30px; }
.cd-hero { text-align: center; padding: 16px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.cd-hero h2 { margin: 0 0 4px; font-size: 19px; }
.cd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.cd-stats div { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); text-align: center; }
.cd-stats b { display: block; font-size: 14px; }
.cd-stats span { color: var(--faint); font-size: 11px; }
.menu-wrap { position: relative; }
.assign-btn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; border-color: transparent; background: transparent; border-radius: 10px; color: var(--ink-2); }
.assign-btn:hover { background: rgba(255, 255, 255, .06); border-color: transparent; color: var(--ink); }
.assign-btn .ic { width: 15px; height: 15px; }
.assign-btn .caret { opacity: .6; margin-left: 2px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; font-weight: 700; background: var(--grad); color: var(--accent-ink); border: 0; }
.avatar.xs.ghosted { background: var(--panel-3); color: var(--muted); border: 1px dashed var(--line-2); }
.avatar.xs .ic { width: 12px; height: 12px; }
.menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 230px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(22, 28, 37, .97), rgba(14, 18, 24, .97)); backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 50px -18px rgba(0, 0, 0, .95), 0 0 0 1px rgba(0, 0, 0, .4); animation: scaleIn .18s var(--ease) both; transform-origin: top right; }
.menu-title { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 6px 10px 6px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 13.5px; text-align: left; }
.menu-item:hover { background: rgba(255, 255, 255, .06); color: var(--ink); border: 0; }
.menu-item.on { background: var(--grad-soft); color: var(--ink); }
.menu-item .mark { width: 15px; height: 15px; color: var(--accent); }
.head-actions > #ib-info.on { color: var(--accent); background: rgba(52, 211, 153, .1); }
.head-actions .sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line-2); }
.thread-head select { width: auto; padding: 6px 30px 6px 10px; font-size: 13px; }
.ai-toggle { border-radius: 99px; padding: 6px 12px 6px 10px; font-size: 12.5px; }
.ai-toggle.on { border-color: rgba(52, 211, 153, .4); color: var(--accent); background: var(--ok-soft); }
.ai-toggle.off { border-color: rgba(251, 191, 36, .4); color: var(--warn); background: var(--warn-soft); }
.thread-banner { padding: 10px 18px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; animation: fadeIn .3s ease; }
.thread-banner.warn { background: var(--warn-soft); color: #fde68a; border-bottom: 1px solid rgba(251, 191, 36, .2); }
.thread-banner.info { background: var(--info-soft); color: #bfdbfe; border-bottom: 1px solid rgba(96, 165, 250, .2); }
.msgs { flex: 1; overflow-y: auto; padding: 22px 7% 28px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; background: rgba(16, 21, 28, .75); backdrop-filter: blur(6px); color: var(--ink-2); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 14px; border-radius: 99px; margin: 14px 0 10px; border: 1px solid var(--line-2); box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .9); }
.msg { position: relative; max-width: min(72%, 560px); padding: 9px 13px 6px; border-radius: 16px; word-wrap: break-word; font-size: 14px; line-height: 1.45; animation: pop .3s var(--ease) both;
  border: 1px solid rgba(255, 255, 255, .05); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 10px 24px -16px rgba(0, 0, 0, .95); }
.msg .text { white-space: pre-wrap; }
.msg.in { background: linear-gradient(180deg, #1c2530, #161d26); align-self: flex-start; border-top-left-radius: 5px; }
.msg.out { background: linear-gradient(160deg, #124a3c 0%, #0d3a30 100%); border-color: rgba(52, 211, 153, .18); align-self: flex-end; border-top-right-radius: 5px; }
.msg.out.bot { background: linear-gradient(160deg, #1b2c4d 0%, #152340 100%); border-color: rgba(96, 165, 250, .2); }
.msg.out.broadcast { background: linear-gradient(160deg, #3d2f10 0%, #2c220c 100%); border-color: rgba(251, 191, 36, .22); }
.msg.out.broadcast::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.msg .who { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--accent); margin-bottom: 3px; display: flex; gap: 5px; align-items: center; }
.msg .who .ic { width: 13px; height: 13px; }
.msg.bot .who { color: #93c5fd; }
.msg.broadcast .who { color: var(--warn); }
.msg .foot { font-size: 11px; color: rgba(233, 238, 244, .45); text-align: right; margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.msg .tick.read { color: #53bdeb; }
.msg .tick.failed { color: var(--danger); font-weight: 700; }
.msg .err { color: #fca5a5; font-size: 12px; margin-top: 3px; }
.msg img.media { max-width: 300px; max-height: 340px; border-radius: 10px; display: block; cursor: zoom-in; margin-bottom: 4px; }
.msg video { max-width: 300px; border-radius: 10px; display: block; margin-bottom: 4px; }
.msg audio { width: 260px; display: block; }
.msg.out.automation { background: linear-gradient(160deg, #2a1f47 0%, #1f1838 100%); border-color: rgba(167, 139, 250, .25); }
.msg.automation .who { color: #c4b5fd; }

/* ---------------- automations: list */
.au-conn { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 18px; }
.conn-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), #0e1218); }
.au-h { font-size: 15px; margin: 26px 0 12px; color: var(--ink-2); }
.au-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.au-card { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), #0e1218); transition: transform .25s var(--ease), border-color .25s; }
.au-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.au-card.on { border-color: rgba(52, 211, 153, .35); box-shadow: 0 16px 40px -26px rgba(52, 211, 153, .5); }
.au-name { font-weight: 650; font-size: 15px; color: var(--ink); text-decoration: none; }
.mini-flow { display: flex; align-items: center; margin: 14px 0 10px; overflow: hidden; }
.mini-node { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--tone-bg, rgba(255, 255, 255, .06)); color: var(--tone, var(--ink-2)); border: 1px solid color-mix(in srgb, var(--tone, #fff) 35%, transparent); }
.mini-node .ic { width: 15px; height: 15px; }
.mini-node.trig { --tone: #c4b5fd; --tone-bg: rgba(139, 92, 246, .16); }
.mini-edge { flex: 0 1 22px; min-width: 8px; height: 2px; background: linear-gradient(90deg, var(--line-2), rgba(52, 211, 153, .5)); }
.au-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.au-meta .dot { margin-right: 5px; }
.bad-text { color: var(--danger); }
.au-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.au-tpl { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 16px; border: 1px dashed var(--line-2); text-decoration: none; color: inherit; background: rgba(255, 255, 255, .015); transition: all .25s var(--ease); }
.au-tpl:hover { border-style: solid; border-color: rgba(52, 211, 153, .45); transform: translateY(-3px); background: linear-gradient(180deg, rgba(52, 211, 153, .06), transparent); }
.au-tpl small { color: var(--faint); font-size: 12.5px; }
.au-tpl-go { margin-top: auto; padding-top: 8px; color: var(--accent); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.au-tpl-go .ic { width: 14px; height: 14px; }
.au-tpl-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--tone-bg); color: var(--tone); margin-bottom: 4px; }
.au-tpl-ic .ic { width: 18px; height: 18px; }
.tone-green { --tone: #34d399; --tone-bg: rgba(52, 211, 153, .14); }
.tone-sky { --tone: #38bdf8; --tone-bg: rgba(56, 189, 248, .14); }
.tone-amber { --tone: #fbbf24; --tone-bg: rgba(251, 191, 36, .14); }
.tone-slate { --tone: #cbd5e1; --tone-bg: rgba(203, 213, 225, .1); }
.tone-pink { --tone: #f472b6; --tone-bg: rgba(244, 114, 182, .14); }
.tone-violet { --tone: #a78bfa; --tone-bg: rgba(167, 139, 250, .16); }
.tone-orange { --tone: #fb923c; --tone-bg: rgba(251, 146, 60, .14); }
.trig { --tone: #c4b5fd; --tone-bg: rgba(139, 92, 246, .18); }

/* ---------------- automations: flow canvas */
.flow-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.flow-bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(16, 21, 28, .95), rgba(11, 15, 20, .9)); position: relative; z-index: 2; flex-wrap: wrap; }
.flow-name { width: auto; min-width: 200px; max-width: 360px; font-size: 16px; font-weight: 650; border-color: transparent; background: transparent; }
.flow-name:hover, .flow-name:focus { border-color: var(--line-2); background: #0b0f14; }
.fe-live { gap: 8px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 99px; }
.flow-page.live .fe-live { border-color: rgba(52, 211, 153, .45); color: var(--accent); }
.flow-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.flow-canvas { position: relative; overflow: auto; cursor: grab; min-height: 0;
  background: radial-gradient(800px 400px at 30% 30%, rgba(139, 92, 246, .06), transparent 60%), radial-gradient(700px 400px at 80% 80%, rgba(52, 211, 153, .05), transparent 60%),
    radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.3px) 0 0 / 24px 24px, #080b10; }
.flow-canvas.panning { cursor: grabbing; }
.flow-zoom { transform-origin: 0 50%; transition: transform .2s var(--ease); min-height: 100%; display: flex; align-items: center; }
.flow-chain { display: flex; align-items: flex-start; padding: 120px 80px 140px 70px; gap: 0; }
.fnode { width: 132px; flex: none; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; user-select: none; }
.fnode.enter { animation: nodeIn .55s var(--ease) both; animation-delay: var(--d); }
@keyframes nodeIn { from { opacity: 0; transform: translateY(14px) scale(.8); } to { opacity: 1; transform: none; } }
.fbubble { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: var(--tone, #fff);
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--tone) 35%, #1a2230), #121821 70%); border: 2px solid color-mix(in srgb, var(--tone) 55%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 8%, transparent), 0 18px 34px -16px color-mix(in srgb, var(--tone) 70%, transparent);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.fbubble > .ic { width: 32px; height: 32px; }
.fnode.trig .fbubble { width: 96px; height: 96px; border-width: 3px; }
.fnode.trig .fbubble > .ic { width: 36px; height: 36px; }
.fnode.is-filter .fbubble { border-radius: 26px; transform: rotate(45deg); width: 74px; height: 74px; margin: 5px 0; }
.fnode.is-filter .fbubble > .ic, .fnode.is-filter .fbubble > span { transform: rotate(-45deg); }
.fnode:hover .fbubble { transform: translateY(-3px) scale(1.04); }
.fnode.is-filter:hover .fbubble { transform: rotate(45deg) scale(1.06); }
.fnode.sel .fbubble { box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 22%, transparent), 0 0 0 9px color-mix(in srgb, var(--tone) 40%, transparent), 0 22px 40px -14px color-mix(in srgb, var(--tone) 80%, transparent); }
.flow-page.live .fnode.trig .fbubble { animation: trigPulse 2.4s infinite; }
@keyframes trigPulse { 0%, 100% { box-shadow: 0 0 0 6px rgba(139, 92, 246, .12), 0 18px 34px -16px rgba(139, 92, 246, .7); } 50% { box-shadow: 0 0 0 14px rgba(139, 92, 246, 0), 0 18px 34px -16px rgba(139, 92, 246, .7); } }
.fnum, .fbadge { position: absolute; top: -4px; left: -4px; min-width: 24px; height: 24px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; font-weight: 750;
  background: #0d1218; color: var(--ink); border: 1px solid var(--line-2); }
.fbadge { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; border: 0; }
.fbadge .ic { width: 13px; height: 13px; }
.fres { position: absolute; bottom: -2px; right: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  border: 2px solid #080b10; animation: pop .35s var(--ease) both; color: #04140e; }
.fres .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.fnode.is-filter .fres, .fnode.is-filter .fnum { animation: none; transform: rotate(-45deg); }
.fres.ok { background: #34d399; } .fres.failed { background: #f87171; color: #fff; } .fres.stopped, .fres.waiting { background: #fbbf24; } .fres.warn { background: #fbbf24; }
.flabel { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; max-width: 150px; }
.fkind { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; }
.flabel b { font-size: 13.5px; }
.flabel span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.fedge { position: relative; width: 74px; flex: none; height: 2px; margin-top: 47px; }
.fnode.trig + .fedge { margin-top: 48px; }
.fedge i { position: absolute; inset: 0; background-image: linear-gradient(90deg, rgba(52, 211, 153, .75) 50%, transparent 50%); background-size: 12px 2px; animation: flowDash .9s linear infinite; opacity: .55; border-radius: 2px; }
.flow-page.live .fedge i { opacity: 1; }
@keyframes flowDash { to { background-position: 12px 0; } }
.fedge.end { width: 40px; }
.fplus { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.85); width: 26px; height: 26px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; font-weight: 700; color: var(--ink-2); background: #10161e; border: 1px solid var(--line-2); opacity: .0; transition: all .2s var(--ease); }
.fedge:hover .fplus, .fplus:focus { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fplus:hover { background: var(--grad); color: var(--accent-ink); border-color: transparent; }
.fadd { width: 84px; height: 84px; flex: none; border-radius: 50%; margin-top: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .04); color: var(--accent); font-size: 11px; font-weight: 650; transition: all .25s var(--ease); }
.fadd .ic { width: 24px; height: 24px; }
.fadd:hover { background: rgba(52, 211, 153, .1); transform: scale(1.06); border-style: solid; }
.flow-tools { position: sticky; left: 16px; bottom: 16px; float: left; display: flex; gap: 2px; padding: 4px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(13, 17, 23, .9); margin: -60px 0 0 16px; }
.flow-tools button { min-width: 34px; height: 30px; padding: 0 8px; font-size: 13px; justify-content: center; }
.flow-hint { position: sticky; left: 100%; bottom: 22px; float: right; margin: -50px 20px 0 0; display: inline-flex; align-items: center; gap: 6px; pointer-events: none; }
.flow-hint .ic { width: 14px; height: 14px; }
.add-menu { position: fixed; z-index: 40; width: 290px; max-height: 420px; overflow-y: auto; padding: 8px; border-radius: 16px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(22, 28, 37, .98), rgba(14, 18, 24, .98)); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .95); animation: scaleIn .2s var(--ease) both; }
.am-search { margin-bottom: 6px; }
.am-title { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 8px 8px 4px; }
.am-item { width: 100%; display: flex; gap: 10px; align-items: center; padding: 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.am-item:hover { background: rgba(255, 255, 255, .06); border: 0; }
.am-item b { display: block; font-size: 13.5px; color: var(--ink); }
.am-item small { display: block; font-size: 11.5px; color: var(--faint); font-weight: 400; }
.am-ic { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--tone-bg); color: var(--tone); }
.am-ic .ic { width: 16px; height: 16px; }
.flow-inspector { border-left: 1px solid var(--line); background: linear-gradient(180deg, #0f141a, #0b0f14); padding: 18px 18px 40px; overflow-y: auto; overflow-x: hidden; min-width: 0; }
.flow-inspector .row, .flow-inspector .grid2 { min-width: 0; }
.flow-inspector select, .flow-inspector input, .flow-inspector textarea { min-width: 0; max-width: 100%; }
.am-item, .tr-row { white-space: normal; }
.flow-inspector.show { animation: fadeUp .3s var(--ease) both; }
.fi-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.fi-head small { display: block; color: var(--faint); font-size: 11.5px; }
.fi-head b { font-size: 15px; }
.fi-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--tone-bg); color: var(--tone); }
.fi-ic .ic { width: 19px; height: 19px; }
.trig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.trig-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px; text-align: left; border-radius: 12px; border: 1px solid var(--line-2); background: #0d1116;
  min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.trig-opt .ic { color: #c4b5fd; width: 18px; height: 18px; margin-bottom: 2px; }
.trig-opt b { font-size: 13px; }
.trig-opt small { font-size: 11.5px; color: var(--faint); font-weight: 400; line-height: 1.3; }
.trig-opt.on { border-color: rgba(139, 92, 246, .7); background: linear-gradient(180deg, rgba(139, 92, 246, .14), transparent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .12); }
.var-chips { margin: -6px 0 14px; }
.var-chips .chip { font-size: 11.5px; padding: 2px 8px; }
.fi-more { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fi-more summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.fi-more[open] summary { margin-bottom: 10px; }
.cond-list { display: grid; gap: 8px; margin-bottom: 12px; }
.cond { display: flex; gap: 6px; align-items: center; }
.cond select, .cond input { min-width: 0; }
.tr-list { display: grid; gap: 4px; margin-top: 10px; max-height: 340px; overflow-y: auto; }
.tr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left; border-radius: 12px; border: 1px solid transparent; background: transparent; }
.tr-row:hover { background: rgba(255, 255, 255, .04); border-color: var(--line-2); }
.tr-row b { display: block; }
.runs { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; margin-top: 12px; }
.run { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.run summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.run ol { margin: 10px 0 4px; padding-left: 22px; font-size: 13px; line-height: 1.7; }
.run-dots { display: flex; gap: 3px; }
.run-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.run-dots i.ok { background: #34d399; } .run-dots i.failed { background: #f87171; } .run-dots i.waiting, .run-dots i.stopped { background: #fbbf24; }
@media (max-width: 980px) { .flow-body { grid-template-columns: 1fr; grid-template-rows: minmax(320px, 1fr) auto; } .flow-inspector { border-left: 0; border-top: 1px solid var(--line); max-height: 55vh; } }
@media (prefers-reduced-motion: reduce) { .fedge i, .flow-page.live .fnode.trig .fbubble, .fnode.enter { animation: none !important; } }

/* template messages */
.msg.tpl { max-width: min(78%, 420px); padding: 6px 6px 6px; }
.msg.tpl.has-cards { max-width: min(92%, 640px); }
.msg.tpl .who, .msg.tpl > .text, .msg.tpl .tpl-title, .msg.tpl .tpl-footer, .msg.tpl .foot, .msg.tpl .err { padding-left: 7px; padding-right: 7px; }
.msg.tpl.broadcast .who, .msg.tpl.broadcast > .text { padding-left: 9px; }
.msg.tpl > .text { margin: 2px 0 4px; }
.tpl-media { border-radius: 11px; overflow: hidden; margin-bottom: 6px; background: rgba(0, 0, 0, .25); }
.tpl-media img { width: 100%; max-height: 280px; object-fit: cover; display: block; cursor: zoom-in; transition: transform .4s var(--ease); }
.tpl-media img:hover { transform: scale(1.02); }
.tpl-media video { width: 100%; display: block; }
.tpl-media.doc { display: flex; align-items: center; gap: 8px; padding: 12px; font-size: 13px; }
.tpl-media .media-missing { padding: 26px 12px; text-align: center; }
.tpl-title { font-weight: 700; margin-top: 2px; }
.tpl-footer { font-size: 12px; color: rgba(233, 238, 244, .5); margin-bottom: 2px; }
.tpl-btns { display: grid; margin-top: 6px; border-top: 1px solid rgba(255, 255, 255, .08); }
.tpl-btn { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 8px; font-size: 13.5px; font-weight: 600; color: #67e8f9; text-decoration: none; }
.tpl-btn + .tpl-btn { border-top: 1px solid rgba(255, 255, 255, .08); }
.tpl-btn .ic { width: 15px; height: 15px; }
a.tpl-btn:hover { background: rgba(255, 255, 255, .04); }
.msg .tpl-btn { color: #67e8f9; }
.tpl-cards { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 1px 6px; margin-top: 4px; scrollbar-width: thin; }
.tpl-card { flex: 0 0 min(230px, 70%); scroll-snap-align: start; border-radius: 13px; overflow: hidden; background: rgba(8, 11, 15, .55); border: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; animation: pop .35s var(--ease) both; }
.tpl-card:nth-child(2) { animation-delay: .06s; } .tpl-card:nth-child(3) { animation-delay: .12s; } .tpl-card:nth-child(n+4) { animation-delay: .18s; }
.tpl-card .tpl-media { border-radius: 0; margin: 0; }
.tpl-card .tpl-media img { height: 150px; max-height: none; }
.tpl-card-text { padding: 8px 10px 4px; font-size: 13.5px; white-space: pre-wrap; flex: 1; }
.tpl-card .tpl-btns { margin-top: 4px; }
/* voice note player */
.vn { display: flex; align-items: center; gap: 12px; width: min(330px, 62vw); padding: 4px 2px 2px; }
.vn-play { width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink);
  box-shadow: 0 8px 20px -8px rgba(52, 211, 153, .75), 0 0 0 1px rgba(255, 255, 255, .08) inset; transition: transform .2s var(--ease); }
.vn-play:hover { background: var(--grad); transform: scale(1.06); }
.vn-play svg { width: 18px; height: 18px; fill: currentColor; }
.vn-play .i-pause, .vn.playing .vn-play .i-play { display: none; }
.vn.playing .vn-play .i-pause { display: block; }
.vn.in .vn-play { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; box-shadow: 0 8px 20px -8px rgba(139, 92, 246, .8), 0 0 0 1px rgba(255, 255, 255, .1) inset; }
.vn-body { flex: 1; min-width: 0; }
.vn-wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.vn-wave i { flex: 1; min-width: 2px; height: 100%; border-radius: 2px; background: rgba(255, 255, 255, .28); transform: scaleY(.12); transition: background .15s linear; }
.vn.loaded .vn-wave i { transform: scaleY(var(--h, .2)); animation: vnGrow .5s var(--ease) both; }
.vn-wave i.on { background: #6ee7b7; }
.vn.in .vn-wave i.on { background: #c4b5fd; }
@keyframes vnGrow { from { transform: scaleY(.08); } }
.vn-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 11px; color: rgba(233, 238, 244, .55); font-variant-numeric: tabular-nums; }
.vn-speed { padding: 1px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 700; border: 1px solid rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .2); color: var(--ink-2); }
.vn-speed:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); }
.vn-face { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: linear-gradient(135deg, #263241, #1a222d); color: #dfe6ee; border: 1px solid rgba(255, 255, 255, .1); }
.vn-face i { position: absolute; right: -4px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--chat); color: #6ee7b7; }
.vn.in .vn-face i { color: #c4b5fd; }
.vn-face i .ic { width: 12px; height: 12px; }
.vn.playing .vn-face { box-shadow: 0 0 0 2px rgba(52, 211, 153, .5); animation: pulse 1.8s infinite; }
.vn.missing .vn-play { opacity: .4; pointer-events: none; }
.msg .doc-link { display: flex; gap: 8px; align-items: center; background: rgba(0, 0, 0, .2); padding: 9px; border-radius: 10px; margin-bottom: 4px; text-decoration: none; }
.msg .media-missing { color: var(--muted); font-size: 13px; }
.msg.reaction { font-size: 22px; background: transparent; box-shadow: none; padding: 0; }
.msg a { color: var(--link); }
.note { align-self: center; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 6px 12px; border-radius: 10px; margin: 6px 0; max-width: 82%; white-space: pre-wrap; animation: fadeIn .3s ease both; }
.note.ai { border-color: rgba(96, 165, 250, .25); color: #bfdbfe; background: rgba(96, 165, 250, .06); }
.note.handoff { border-color: rgba(251, 191, 36, .3); color: #fde68a; background: rgba(251, 191, 36, .06); text-align: left; }
.composer { margin: 0 16px 16px; padding: 8px; display: flex; gap: 6px; align-items: flex-end; border: 1px solid var(--line-2); border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 26, 34, .92), rgba(13, 17, 23, .92)); backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -20px rgba(0, 0, 0, .95); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.composer:focus-within { border-color: rgba(52, 211, 153, .45); box-shadow: 0 0 0 4px rgba(52, 211, 153, .08), 0 18px 40px -20px rgba(0, 0, 0, .95); }
.composer > .btn.icon, .composer > button.icon { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; color: var(--muted); border-color: transparent; background: transparent; }
.composer > .btn.icon:hover, .composer > button.icon:hover { color: var(--accent); background: rgba(52, 211, 153, .08); }
.composer textarea { min-height: 40px; max-height: 160px; resize: none; border: 0; background: transparent; padding: 10px 6px; font-size: 14px; box-shadow: none; }
.composer textarea:focus { outline: none; box-shadow: none; border: 0; }
.composer #ib-send { height: 40px; border-radius: 12px; padding: 0 18px; box-shadow: 0 8px 22px -8px rgba(52, 211, 153, .7); }
.composer #ib-send:hover { transform: translateY(-1px); }
.composer [hidden] { display: none !important; }
.mic-btn { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; border: 0; background: var(--grad); color: var(--accent-ink); flex: none;
  box-shadow: 0 8px 22px -8px rgba(52, 211, 153, .7); animation: pop .25s var(--ease) both; }
.mic-btn:hover { background: var(--grad); transform: translateY(-1px) scale(1.04); }
.mic-btn .ic { width: 19px; height: 19px; }
.composer.recording { border-color: rgba(248, 113, 113, .45); box-shadow: 0 0 0 4px rgba(248, 113, 113, .08), 0 18px 40px -20px rgba(0, 0, 0, .95); align-items: center; }
.composer.recording #vr-cancel:hover { color: var(--danger); background: var(--danger-soft); }
.composer.recording #vr-send { height: 40px; border-radius: 12px; padding: 0 18px; }
.rec-live { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 6px; height: 40px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; box-shadow: 0 0 0 0 rgba(248, 113, 113, .6); animation: recPulse 1.4s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); min-width: 38px; }
.rec-bars { flex: 1; display: flex; align-items: center; gap: 3px; height: 28px; overflow: hidden; }
.rec-bars i { flex: 1 0 2px; max-width: 5px; height: 100%; border-radius: 2px; background: linear-gradient(180deg, #34d399, #22d3ee); transform: scaleY(.08); transition: transform .09s linear; opacity: .9; }
@keyframes recPulse { 0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .6); } 70% { box-shadow: 0 0 0 9px rgba(248, 113, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); } }
.composer .closed { flex: 1; color: var(--muted); font-size: 13px; }
.details { border-left: 1px solid var(--line); background: #090c10; padding: 18px; overflow-y: auto; animation: fadeIn .25s ease; }
.details h3 { font-size: 11px; margin: 20px 0 8px; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; display: flex; justify-content: space-between; align-items: center; }
.details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.details dt { color: var(--faint); }
.details dd { margin: 0; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.thread-empty .orb { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; background: var(--grad-soft); display: grid; place-items: center; color: var(--accent); box-shadow: 0 0 60px -10px rgba(52, 211, 153, .4); }
.thread-empty .orb .ic { width: 30px; height: 30px; }
.back-btn { display: none; }

/* ---------------------------------------------------------------- playground */
.playground { border: 1px solid var(--line); border-radius: 14px; background: var(--chat); padding: 14px; height: 440px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.typing { align-self: flex-start; background: var(--bot); border-radius: 14px; padding: 10px 14px; display: flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #93c5fd; animation: dots 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.action { align-self: center; display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); animation: pop .3s var(--ease) both; }
.action .ic { width: 13px; height: 13px; }
.action.ok { color: var(--accent); border-color: rgba(52, 211, 153, .3); }
.action.warn { color: var(--warn); border-color: rgba(251, 191, 36, .3); }
.action.info { color: var(--info); border-color: rgba(96, 165, 250, .3); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .agent-layout { grid-template-columns: 1fr; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .subnav a { white-space: nowrap; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  nav.side { flex-direction: row; overflow-x: auto; padding: 10px 12px; align-items: center; gap: 4px; }
  nav.side > * { flex-shrink: 0; white-space: nowrap; }
  .brand { padding: 0 8px 0 0; } .brand small { display: none; }
  .side .section, .side .spacer, .me-card, .side .cta { display: none; }
  .side a.nav.active::before { display: none; }
  main { padding: 18px 16px 60px; }
  main.full { height: calc(100vh - 60px); }
  .compose { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .var-row { grid-template-columns: 60px 1fr; }
  .var-row input.fb { grid-column: 2; }
  .hide-sm { display: none; }
  .inbox, .inbox.details-open { grid-template-columns: 1fr; height: 100%; }
  .inbox .thread, .inbox .details { display: none; }
  .inbox.show-thread .convs { display: none; }
  .inbox.show-thread .thread { display: flex; }
  .inbox.show-thread.details-open .thread { display: none; }
  .inbox.show-thread.details-open .details { display: block; }
  .back-btn { display: inline-flex; }
  .msgs { padding: 14px 12px; }
  .msg { max-width: 86%; }
  .thread-head { padding: 10px 12px; gap: 8px; }
}
