:root {
  --brand: #0e7c86;
  --brand-ink: #ffffff;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #142028;
  --ink-2: #4a5864;
  --ink-3: #8593a0;
  --line: #e3e8ed;
  --line-2: #eef2f5;
  --soft: #f7f9fb;
  --sms: #2563eb;
  --whatsapp: #16a34a;
  --email: #9333ea;
  --voice: #ea580c;
  --danger: #dc2626;
  --ai: #7c3aed;
  --ai-bg: #f5f0ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 360px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.app.no-list { grid-template-columns: 232px 1fr; }
.app.no-list .list { display: none; }

.rail { background: #0f1b22; color: #c9d4dc; display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 18px; flex: none; }
.brand .name { font-family: var(--display); font-size: 16px; color: #fff; line-height: 1.15; font-weight: 600; }
.brand .sub { font-size: 11px; color: #7f909c; letter-spacing: .02em; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #61727e; padding: 14px 10px 6px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #c9d4dc; background: none; border: 0; width: 100%; text-align: left; }
.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav.active { background: rgba(255,255,255,.1); color: #fff; }
.nav .ico { width: 20px; text-align: center; opacity: .95; }
.nav .badge { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.rail .spacer { flex: 1; }
.rail .who { font-size: 12px; color: #8ea0ad; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; }
.rail .who b { color: #fff; font-weight: 500; }
.powered { font-size: 11px; color: #5d6e7a; padding: 6px 10px; }

.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.list-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line-2); }
.list-head h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.list-head .row { display: flex; gap: 8px; }
.search { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: var(--soft); outline: none; }
.search:focus { border-color: var(--brand); background: #fff; }
.convs { overflow-y: auto; flex: 1; }
.conv { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; align-items: start; }
.conv:hover { background: var(--soft); }
.conv.active { background: #eef7f8; box-shadow: inset 3px 0 0 var(--brand); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 14px; flex: none; }
.conv .top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .nm::after { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-left: 6px; vertical-align: middle; }
.conv .pv { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.conv .meta { font-size: 11.5px; color: var(--ink-3); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.chips { display: inline-flex; gap: 3px; }
.ch { font-size: 10px; font-weight: 700; border-radius: 5px; padding: 1px 5px; color: #fff; letter-spacing: .02em; }
.ch.sms { background: var(--sms); } .ch.whatsapp { background: var(--whatsapp); } .ch.email { background: var(--email); } .ch.voice { background: var(--voice); }
.ai-chip { font-size: 10.5px; color: var(--ai); background: var(--ai-bg); border-radius: 6px; padding: 1px 6px; font-weight: 600; white-space: nowrap; }
.empty { padding: 40px 24px; text-align: center; color: var(--ink-3); }

/* ---------- thread ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.banner { background: linear-gradient(90deg, #0f1b22, #17323b); color: #dbe7ee; padding: 10px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.banner b { color: #fff; }
.banner .btn { padding: 6px 11px; font-size: 12.5px; }
.banner .live { display: inline-flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.thread-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; gap: 12px; min-height: 66px; }
.thread-head .title { font-weight: 650; font-size: 16px; }
.thread-head .ids { font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.thread-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.timeline { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 10px; display: flex; flex-direction: column; gap: 14px; }
.day { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 6px 0; }
.msg { max-width: min(640px, 78%); display: flex; flex-direction: column; gap: 4px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 13px; border-radius: 14px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.02); }
.msg.out .bubble { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.msg.out.whatsapp .bubble { background: #dcf8c6; color: #111b21; }
.msg.out.email .bubble { background: #fff; color: var(--ink); border-color: var(--line); }
.msg.email .bubble { border-radius: 10px; }
.msg .subj { font-weight: 650; margin-bottom: 6px; }
.msg .info { font-size: 11px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.msg .fail { color: var(--danger); }
.trans { font-size: 12.5px; color: var(--ink-2); background: #fffbea; border: 1px solid #f6e7a8; border-radius: 10px; padding: 7px 10px; white-space: pre-wrap; }
.trans .lbl { font-size: 10.5px; font-weight: 700; color: #a07a00; text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 2px; }
.call { align-self: stretch; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--voice); border-radius: 12px; padding: 12px 14px; max-width: 760px; }
.call .h { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.call .sum { margin-top: 6px; color: var(--ink-2); }
.call details { margin-top: 8px; }
.call summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
.tx { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tx .t { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.tx .r { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; padding-top: 2px; }
.pill { font-size: 11px; border-radius: 999px; padding: 2px 8px; background: var(--line-2); color: var(--ink-2); }
.pill.ok { background: #e7f8ee; color: #137a3d; }

/* ---------- composer ---------- */
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 12px 20px 16px; }
.draft { border: 1px solid #e4d8ff; background: var(--ai-bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.draft .h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ai); font-weight: 650; }
.draft .body { white-space: pre-wrap; margin-top: 6px; max-height: 180px; overflow-y: auto; }
.draft .tr { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap; border-top: 1px dashed #d9c9ff; padding-top: 6px; }
.draft .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.compose-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.compose-row .via { font-size: 12px; color: var(--ink-3); }
.input, textarea.input, select.input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; outline: none; width: 100%; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
textarea.input { resize: vertical; min-height: 74px; }
.send-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.send-row .grow { flex: 1; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 13px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #c9d3dc; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ai { background: var(--ai); color: #fff; border-color: var(--ai); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }
.btn.light:hover { background: rgba(255,255,255,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }
.chan-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chan-btn.on.sms { background: var(--sms); color: #fff; border-color: var(--sms); }
.chan-btn.on.whatsapp { background: var(--whatsapp); color: #fff; border-color: var(--whatsapp); }
.chan-btn.on.email { background: var(--email); color: #fff; border-color: var(--email); }
.chan-btn:disabled { opacity: .4; }

/* ---------- settings ---------- */
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px 60px; }
.page h1 { font-family: var(--display); font-size: 26px; margin: 0 0 4px; font-weight: 600; }
.page .lead { color: var(--ink-2); margin: 0 0 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); max-width: 900px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.toggle { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv div:nth-child(odd) { color: var(--ink-3); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 27, 34, .55); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; width: min(440px, 100%); padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 6px; font-family: var(--display); font-size: 22px; font-weight: 600; }
.modal p { margin: 0 0 16px; color: var(--ink-2); }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0f1b22; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- welcome / thread empty ---------- */
.welcome { margin: auto; text-align: center; max-width: 520px; padding: 30px; color: var(--ink-2); }
.welcome h2 { font-family: var(--display); font-weight: 600; font-size: 26px; color: var(--ink); margin: 0 0 8px; }
.stats { display: flex; gap: 12px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; min-width: 110px; }
.stat b { display: block; font-size: 22px; color: var(--ink); }

.back { display: none; }
@media (max-width: 1080px) {
  .app { grid-template-columns: 72px 320px 1fr; }
  .app.no-list { grid-template-columns: 72px 1fr; }
  .rail .brand .name, .rail .brand .sub, .nav .txt, .nav-label, .rail .who, .powered { display: none; }
  .nav { justify-content: center; position: relative; }
  .nav .badge { position: absolute; top: 2px; right: 4px; font-size: 10px; padding: 0 5px; }
}
@media (max-width: 760px) {
  .app, .app.no-list { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; padding: 8px; overflow-x: auto; gap: 2px; }
  .rail .brand { padding: 0 6px 0 0; }
  .rail .spacer { display: none; }
  .nav { width: auto; padding: 8px 10px; }
  .app .list, .app .main { grid-row: 2; grid-column: 1; }
  .app.thread-open .list { display: none; }
  .app:not(.thread-open):not(.no-list) .main { display: none; }
  .back { display: inline-flex; }
  .app.thread-open .banner { display: none; }
  .draft .body { max-height: 110px; }
  .grid2 { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 60px; }
  .msg { max-width: 92%; }
  .timeline { padding: 16px 12px; }
  .composer { padding: 10px 12px 12px; }
  .banner .live { margin-left: 0; }
}

/* ---------- lead intelligence ---------- */
.score-chip { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.score-chip.hot { background: #fff1e6; color: #c2410c; }
.score-chip.warm { background: #fef9c3; color: #854d0e; }
.score-chip.cold { background: #e0f2fe; color: #075985; }
.score-chip.nolead { background: #f1f5f9; color: #64748b; }
.who-btn { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px 6px; margin: -4px -6px; border-radius: 10px; min-width: 0; cursor: pointer; }
.who-btn:hover { background: var(--line-2); }
.profile { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(16,24,40,.12); z-index: 40; overflow-y: auto; padding: 18px 20px 40px; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.phead { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.pname { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.2; }
.pscore { display: flex; align-items: center; gap: 16px; margin: 18px 0 12px; }
.ring { --p: 0; --c: #94a3b8; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; flex: none; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line-2) 0); }
.ring span { width: 60px; height: 60px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.ring.hot { --c: #ea580c; } .ring.warm { --c: #ca8a04; } .ring.cold { --c: #0284c7; } .ring.nolead { --c: #94a3b8; }
.status-pill { display: inline-block; font-weight: 700; font-size: 13px; border-radius: 999px; padding: 3px 11px; background: var(--line-2); }
.status-pill.hot { background: #fff1e6; color: #c2410c; } .status-pill.warm { background: #fef9c3; color: #854d0e; } .status-pill.cold { background: #e0f2fe; color: #075985; } .status-pill.nolead { background: #f1f5f9; color: #64748b; }
.pactions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pblock { margin-top: 16px; }
.pblock h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.pblock p { margin: 0; color: var(--ink); }
.pblock ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.pblock ul.good li::marker { content: '✓  '; color: #16a34a; }
.pblock ul.bad li::marker { content: '!  '; color: var(--danger); font-weight: 700; }
.pblock ul.src { padding-left: 16px; font-size: 13px; word-break: break-word; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.fact { display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.fact span { font-size: 11px; color: var(--ink-3); }
.fact b, .fact a { font-weight: 550; overflow-wrap: anywhere; }
.nba { margin-top: 14px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
@media (max-width: 760px) { .profile { width: 100vw; } .facts { grid-template-columns: 1fr; } }

/* ---------- automations / campaigns / insights ---------- */
.pagehead { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; max-width: 900px; margin-bottom: 8px; }
.acard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); max-width: 900px; }
.acard.off { opacity: .6; }
.ahead { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.aname { font-weight: 650; font-size: 15px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 10px; }
.when { background: #fff7ed; color: #9a3412; border-radius: 8px; padding: 4px 9px; font-size: 12.5px; font-weight: 600; }
.arrow { color: var(--ink-3); }
.stepchip { background: var(--line-2); border-radius: 8px; padding: 4px 9px; font-size: 12.5px; }
.astats { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; color: var(--ink-2); }
.astats .fail { color: var(--danger); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.jst, .cst { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--line-2); text-transform: capitalize; white-space: nowrap; }
.jst.done, .cst.completed { background: #e7f8ee; color: #137a3d; }
.jst.pending, .cst.scheduled { background: #e0f2fe; color: #075985; }
.jst.running, .cst.sending { background: #fef9c3; color: #854d0e; }
.jst.failed { background: #fee2e2; color: #b91c1c; }
.jst.skipped, .jst.cancelled, .cst.paused, .cst.cancelled { background: #f1f5f9; color: #64748b; }
.cst.draft { background: #f5f0ff; color: var(--ai); }
.modal.wide { width: min(720px, 100%); max-height: 90vh; overflow-y: auto; }
.steps { display: flex; flex-direction: column; gap: 10px; }
.stepbox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--soft); }
.stepbox .send-row { margin-top: 0; flex-wrap: wrap; }
.stepbox select.input { width: auto; }
.tpl { background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 11px; font-size: 13px; margin: 10px 0; white-space: pre-wrap; }
.audcount { margin: 8px 0 4px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 8px 11px; font-size: 13px; }
.insights { text-align: left; margin: 18px auto; max-width: 560px; }
.insights h4, .pblock h4 { margin: 0 0 8px; }
.insight { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ai); border-radius: 10px; padding: 8px 11px; margin-bottom: 8px; }
.insight.alert { border-left-color: var(--danger); } .insight.recommendation { border-left-color: #16a34a; } .insight.forecast { border-left-color: #0284c7; }
.ih { display: flex; align-items: center; gap: 4px; }
.seg.stages { flex-wrap: wrap; }
.line { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.line .num { font-family: var(--display); font-size: 26px; font-weight: 600; }
.chanrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chanbox { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink-3); }
.chanbox.on { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
@media (max-width: 760px) { .chanrow { grid-template-columns: 1fr 1fr; } .pagehead { flex-direction: column; } }
.input.code { font: 700 24px ui-monospace, Menlo, monospace; letter-spacing: 8px; text-align: center; }

/* ---------- reseller: admin console, pricing, plan & billing ---------- */
.console { min-height: 100vh; overflow-y: auto; height: 100vh; }
.console-top { position: sticky; top: 0; z-index: 5; background: #0f1b22; color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 24px; height: 56px; }
.console-top .brand-x { font-family: var(--display); font-size: 18px; font-weight: 600; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs button { background: none; border: 0; color: #b8c6d0; padding: 18px 12px 16px; font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: #fff; border-bottom-color: #3ec7cf; }
.tabs .dot { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.console-body { max-width: 1180px; margin: 0 auto; padding: 26px 24px 80px; }
.console-body .card { max-width: none; }
.console-body h2 { font-family: var(--display); font-weight: 600; font-size: 24px; margin: 0 0 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 600; margin-top: 4px; }
.kpi .s { font-size: 12px; color: var(--ink-2); }
.kpi.warn { border-color: #f5c26b; background: #fff8eb; }
.kpi.bad { border-color: #f3a4a4; background: #fff1f1; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl input.input { padding: 5px 8px; width: 90px; }
.svc { display: inline-block; font-size: 11px; border-radius: 6px; padding: 2px 7px; margin: 1px 2px 1px 0; background: var(--line-2); color: var(--ink-2); font-weight: 600; }
.svc.active { background: #e7f8ee; color: #137a3d; }
.svc.requested { background: #fff4d6; color: #8a5a00; }
.svc.paused { background: #f1f1f1; color: #888; text-decoration: line-through; }
.pos { color: #137a3d; } .neg { color: var(--danger); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; }
.hint { font-size: 12.5px; color: var(--ink-2); background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.svc-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.svc-card.on { border-color: #9fdcb6; background: #f4fcf7; }
.svc-card .t { font-weight: 700; }
.svc-card .p { font-size: 12.5px; color: var(--ink-2); }
.price-sec h3 { margin-top: 0; }
.big-bal { font-family: var(--display); font-size: 34px; font-weight: 600; }
.pricing-hero { background: #0f1b22; color: #fff; padding: 56px 24px 46px; text-align: center; }
.pricing-hero h1 { font-family: var(--display); font-size: clamp(30px, 5vw, 46px); margin: 0 0 10px; font-weight: 600; }
.pricing-hero p { color: #c3d0d8; max-width: 640px; margin: 0 auto; font-size: 16px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; background: #fff; font-weight: 600; font-size: 13px; }
.pick label:has(input:checked) { border-color: var(--brand); background: #e8f6f7; color: var(--brand); }
@media (max-width: 760px) {
  .console-top { padding: 0 12px; gap: 10px; }
  .console-top .brand-x { display: none; }
  .console-body { padding: 18px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
}
.num-results { margin-top: 12px; }
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.num-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.num-card:hover { border-color: var(--brand); }
.num-card .nn { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: .01em; }
.num-card .np b { font-size: 15px; }

/* ---------- analytics ---------- */
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: #137a3d; } .delta.down { color: var(--danger); } .delta.flat { color: var(--ink-3); }
.viz-host { position: relative; }
svg.viz { width: 100%; height: auto; display: block; overflow: visible; }
svg.viz .grid { stroke: var(--line-2); stroke-width: 1; }
svg.viz .axis { fill: var(--ink-3); font-size: 11px; }
svg.viz .hit { cursor: crosshair; }
svg.viz .hit:hover { fill: rgba(16, 24, 40, .04); }
.viz-tip { display: none; position: absolute; pointer-events: none; background: #0f1b22; color: #fff; font-size: 12px; line-height: 1.5; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow); white-space: nowrap; z-index: 3; }
.viz-tip .muted { color: #b8c6d0; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 900px; }
.an-grid .card { margin-bottom: 0; }
.an-grid + .card, .an-grid + .an-grid { margin-top: 18px; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-kpis div { display: flex; flex-direction: column; font-size: 11.5px; color: var(--ink-3); }
.mini-kpis b { font-family: var(--display); font-size: 20px; color: var(--ink); font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-size: 12.5px; }
.hbar .hl { color: var(--ink-2); text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { background: var(--line-2); border-radius: 4px; height: 10px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }
.page .kpis { max-width: 900px; }
.dst { font-size: 11.5px; } .st-q { color: var(--ink-3); } .st-d, .st-r { color: #137a3d; }
@media (max-width: 760px) { .an-grid { grid-template-columns: 1fr; } .mini-kpis { grid-template-columns: repeat(2, 1fr); } }
.draft .checks { margin-top: 10px; background: #fff8eb; border: 1px solid #f5d79e; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: #6b4a00; }
.draft .checks ul { margin: 4px 0 4px 18px; padding: 0; }

/* ---------- human approval ---------- */
.approval-chip { margin-top: 8px; width: 100%; border: 1px solid var(--line); background: #f3fbf6; color: #137a3d; border-radius: 9px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; text-align: left; }
.approval-chip.auto { background: #fff8eb; color: #8a5a00; border-color: #f5d79e; }
.appr-list { display: flex; flex-direction: column; gap: 8px; }
.appr-row { display: grid; grid-template-columns: 1fr auto 86px; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.appr-row.auto { background: #fffaf0; border-color: #f5d79e; }
.appr-tag { font-size: 11.5px; font-weight: 700; text-align: center; border-radius: 999px; padding: 3px 8px; }
.appr-tag.on { background: #e7f8ee; color: #137a3d; } .appr-tag.off { background: #fff1d6; color: #8a5a00; }
.appr-guards { margin-top: 12px; padding: 10px 12px; background: var(--soft); border-radius: 12px; }
.draft .held { background: #fff1d6; color: #6b4a00; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
/* ---------- campaign editor ---------- */
.ctabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; overflow-x: auto; }
.ctabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.ctabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.modes label { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-2); }
.modes label b { color: var(--ink); font-size: 13.5px; }
.modes label:has(input:checked) { border-color: var(--brand); background: #eef8f8; }
.modes input { display: none; }
.kbcount { font-size: 11.5px; color: var(--ink-3); text-align: right; }
.cstats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.cstats b { color: var(--ink); }
.credit-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.credit-pack { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.credit-pack .c { font-family: var(--display); font-size: 22px; font-weight: 600; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } .appr-row { grid-template-columns: 1fr auto; } .appr-tag { display: none; } }

/* ---------- import, wizard, keywords, contacts ---------- */
.import-modal { width: min(980px, 100%); }
.dropzone { border: 2px dashed #b9c6d0; border-radius: 16px; padding: 38px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; cursor: pointer; background: var(--soft); transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: #eef8f8; }
.hint.err { background: #fff1f1; border-color: #f3a4a4; color: #8a1c1c; }
.imp-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.imp-grid select.input { padding: 5px 8px; }
.imp-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.imp-stat { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; }
.imp-stat b { font-size: 20px; color: var(--ink); font-family: var(--display); }
.imp-stat.ok { background: #f3fbf6; border-color: #9fdcb6; } .imp-stat.warn { background: #fff8eb; border-color: #f5d79e; }
.consent { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; align-items: flex-start; }
.progress { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress span { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.modal.wizard { width: min(1000px, 100%); max-height: 92vh; overflow-y: auto; padding: 0; }
.wiz-head { display: flex; align-items: center; gap: 10px; padding: 16px 22px 0; }
.wiz-name { flex: 1; font-family: var(--display); font-size: 22px; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; background: none; }
.wiz-name:hover, .wiz-name:focus { border-color: var(--line); outline: none; }
.wiz-steps { display: flex; gap: 4px; padding: 10px 22px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.wiz-steps button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.wiz-steps button.on { color: var(--ink); border-bottom-color: var(--brand); }
.wizard.whatsapp .wiz-steps button.on { border-bottom-color: var(--whatsapp); }
.wizard.sms .wiz-steps button.on { border-bottom-color: var(--sms); }
.wiz-body { padding: 18px 22px 20px; }
.card.flat { box-shadow: none; background: var(--soft); max-width: none; }
.acts.wrap { flex-wrap: wrap; }
.msg-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-family: ui-monospace, monospace; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.phone-prev { border: 10px solid #1d2b34; border-radius: 30px; min-height: 420px; background: #f2f2f7; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.phone-prev.wa { background: #efe7dd; }
.pp-head { text-align: center; font-size: 12px; color: #6b7280; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid rgba(0,0,0,.06); }
.pp-bubble { align-self: flex-start; max-width: 88%; background: #e9e9eb; color: #111; border-radius: 18px; padding: 9px 12px; font-size: 14px; line-height: 1.38; white-space: pre-wrap; word-break: break-word; }
.phone-prev.wa .pp-bubble { background: #fff; border-radius: 0 12px 12px 12px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.pp-img { max-width: 70%; border-radius: 14px; }
.bubble-mini { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 13px; white-space: pre-wrap; margin-top: 8px; max-height: 80px; overflow: hidden; }
.bubble-mini.whatsapp { background: #f0faf3; }
.ccard.sms { border-left: 3px solid var(--sms); } .ccard.whatsapp { border-left: 3px solid var(--whatsapp); }
.empty-state { text-align: center; padding: 34px 20px; }
.variant { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; font-size: 14px; }
.qr-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; max-width: 900px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: center; max-width: 260px; }
.qr-card img { width: 180px; } .qr-card code { word-break: break-all; text-align: center; }
.bulkbar { position: sticky; top: 0; z-index: 3; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #0f1b22; color: #fff; border-radius: 12px; padding: 8px 14px; margin-bottom: 10px; max-width: 900px; }
.bulkbar .input { background: #fff; color: var(--ink); }
.bulkbar .btn.ghost { color: #cbd5e1; }
.tagchip { display: inline-flex; align-items: center; gap: 3px; background: #eef3f7; border-radius: 999px; padding: 2px 4px 2px 9px; font-size: 11.5px; margin: 1px 3px 1px 0; }
.tagchip button { border: 0; background: none; color: var(--ink-3); padding: 0 4px; font-size: 13px; line-height: 1; }
.tagchip button:hover { color: var(--danger); }
.tagadd { border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--ink-3); }
.muted-row td { opacity: .55; }
@media (max-width: 860px) { .imp-grid, .msg-grid { grid-template-columns: 1fr; } .phone-prev { min-height: 260px; } .imp-summary { grid-template-columns: repeat(2, 1fr); } }
