:root {
  --paper: #f5f7fa;
  --surface: #ffffff;
  --ink: #14213d;
  --ink-2: #4a5670;
  --ink-3: #7b869c;
  --line: #dde2ea;
  --line-2: #eef1f5;
  --blue: #1f5fbf;
  --blue-soft: #e6eefb;
  --red: #c92a33;
  --red-soft: #fbe9ea;
  --green: #18794e;
  --green-soft: #e3f4ec;
  --amber: #9a6200;
  --amber-soft: #fbf0d9;
  --side: #14213d;
  --side-ink: #c9d2e4;
  --radius: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1524; --surface: #172034; --ink: #e8ecf4; --ink-2: #b3bdd1; --ink-3: #8090ab;
    --line: #2a3650; --line-2: #1f2a42; --blue: #7fb0ff; --blue-soft: #1c2f52; --red: #ff8088; --red-soft: #45202a;
    --green: #5fd3a0; --green-soft: #173a2d; --amber: #f0c26a; --amber-soft: #3f321a; --side: #0a101d; --side-ink: #aab5cc;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 6px; font-weight: 650; }
p { margin: 0 0 12px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 12.5px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.boot { padding: 40px; color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 0 0 14px; }
/* airmail edge: the one decorative element */
.airmail { height: 6px; background: repeating-linear-gradient(135deg, #d6323a 0 10px, #fff 10px 20px, #1f5fbf 20px 30px, #fff 30px 40px); }
.brand-name { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0.01em; padding: 16px 18px 0; }
.side select { margin: 0 14px 10px; width: calc(100% - 28px); background: #1e2c4d; color: #fff; border-color: #2c3c63; }
.nav { display: flex; flex-direction: column; padding: 4px 8px; gap: 2px; flex: 1; }
.nav a { color: var(--side-ink); padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: #1e2c4d; text-decoration: none; color: #fff; }
.nav a.on { background: #24355c; color: #fff; font-weight: 600; }
.badge { background: #d6323a; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.side-foot { padding: 12px 18px 16px; font-size: 12.5px; border-top: 1px solid #24355c; }
.side-foot .who { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button { background: none; border: 0; color: var(--side-ink); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { padding: 26px 32px 60px; min-width: 0; max-width: 1280px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 0; }
.crumb { font-size: 12.5px; margin-bottom: 4px; }
.menu-btn { display: none; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--ink-3); text-decoration: none; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary { color: #0e1524; } }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--red); }
button.link { border: 0; background: none; color: var(--blue); padding: 0; font-weight: 500; }
button.sm { padding: 3px 9px; font-size: 12.5px; }
button:disabled { opacity: 0.55; cursor: default; }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; width: 100%; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--blue); }
input[type=file] { padding: 5px; }
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 14px; margin: 0 0 8px; cursor: pointer; }
label.check input { margin-top: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row.tight > * { flex: 0 0 auto; min-width: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.narrow { max-width: 680px; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 640px; }
.modal .table-wrap table { min-width: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--line-2); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 6px; }
tbody tr:hover td { background: color-mix(in srgb, var(--blue-soft) 35%, transparent); }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-2); }
.empty p { max-width: 460px; margin: 0 auto 12px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 10px; padding: 1px 9px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.err-text { color: var(--red); font-size: 12.5px; max-width: 340px; white-space: normal; }
.bar { height: 5px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 80px; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--blue); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; overflow: hidden; }
.stat { padding: 14px 16px; border-right: 1px solid var(--line-2); }
.stat b { display: block; font-size: 22px; font-weight: 650; line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.stat small { color: var(--ink-3); font-size: 12px; margin-left: 4px; font-weight: 500; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); }
.chart { width: 100%; height: 160px; display: block; }
.chart text { font-size: 10px; fill: var(--ink-3); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ---------- sequence editor ---------- */
.step { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 0; }
.step-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.step-head strong { font-size: 14px; }
.step-body { padding: 14px; }
.wait { display: flex; align-items: center; gap: 8px; padding: 10px 0 10px 22px; margin-left: 22px; border-left: 2px dashed var(--line); color: var(--ink-2); font-size: 13px; }
.wait input { width: 84px; }
.vtabs { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.vtabs button { padding: 2px 10px; font-size: 12.5px; }
.vtabs button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips button { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 12px; color: var(--ink-2); }

/* ---------- unibox ---------- */
.unibox { display: grid; grid-template-columns: 340px 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; height: calc(100vh - 150px); min-height: 420px; }
.threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread-item { padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; display: block; color: inherit; }
.thread-item:hover { background: var(--line-2); text-decoration: none; }
.thread-item.on { background: var(--blue-soft); }
.thread-item .top { display: flex; justify-content: space-between; gap: 8px; }
.thread-item .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item.unread .name { font-weight: 700; }
.thread-item.unread .name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 6px; }
.thread-item .snip { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item .meta { color: var(--ink-3); font-size: 12px; }
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.convo-head select { width: auto; }
.convo-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; background: var(--surface); }
.msg.out { align-self: flex-end; background: var(--blue-soft); border-color: transparent; }
.msg.in { align-self: flex-start; }
.msg.bounce { background: var(--red-soft); border-color: transparent; }
.msg .mhead { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.msg .msub { font-weight: 600; margin-bottom: 4px; }
.msg pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.mailframe { width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 8px; }
.convo-reply { border-top: 1px solid var(--line); padding: 12px 16px; }
.convo-reply textarea { min-height: 80px; margin-bottom: 8px; }

/* ---------- modal + toast + auth ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 18, 32, 0.55); display: grid; place-items: start center; padding: 6vh 16px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(8, 14, 30, 0.35); }
.modal.wide { max-width: 760px; }
.modal.xwide { max-width: 1080px; }
table.plain { width: 100%; border-collapse: collapse; }
table.plain td { padding: 5px 6px; border: 0; vertical-align: middle; }
table.plain tr + tr td { border-top: 1px solid var(--line-2); }
td code { font-size: 12px; background: var(--line-2); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.modal-head { padding: 16px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 20px; }
.modal-foot { padding: 0 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.x { border: 0; background: none; font-size: 20px; line-height: 1; padding: 2px 6px; color: var(--ink-3); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(8, 14, 30, 0.3); }
.toast.error { background: #a3212a; color: #fff; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.auth-card .inner { padding: 26px 26px 22px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card p { color: var(--ink-2); }
.note { background: var(--amber-soft); color: var(--ink); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.note.info { background: var(--blue-soft); }
.note.bad { background: var(--red-soft); }
ol.steps { padding-left: 20px; margin: 0 0 12px; }
ol.steps li { margin-bottom: 6px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: transform 0.18s ease; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .main { padding: 16px 14px 60px; }
  .unibox { grid-template-columns: 1fr; height: auto; }
  .threads { border-right: 0; border-bottom: 1px solid var(--line); max-height: 300px; }
  .convo-body { max-height: 60vh; }
  .msg { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- campaign options ---------- */
.options { max-width: 1040px; }
.setting { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.setting.stack { display: block; }
.setting.stack > * + * { margin-top: 14px; }
.setting-line { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.s-text { flex: 1 1 260px; min-width: 0; max-width: 440px; }
.s-text strong { display: block; font-size: 14.5px; }
.s-text span { color: var(--ink-2); font-size: 13px; }
.s-ctl { flex: 1 1 300px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.s-ctl select { width: auto; min-width: 200px; }
.numin { width: 120px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 8px 18px; background: var(--surface); color: var(--ink-2); }
.seg button.on.yes { background: var(--green); color: #fff; }
.seg button.on.no { background: var(--ink-2); color: var(--surface); }
label.check.inline { margin: 0; align-items: center; }
label.check.inline input { margin-top: 0; }
.s-ctl > div > label.check.inline + label.check.inline { margin-top: 8px; }
label.mini { font-weight: 500; color: var(--ink-2); margin: 0; }
.unit { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.group-title { font-size: 17px; margin: 28px 0 2px; }
.group-sub { color: var(--ink-2); margin-bottom: 12px; }
.adv-toggle { display: block; margin: 22px auto; border-radius: 22px; padding: 9px 22px; border-color: var(--blue); color: var(--blue); }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--line-2); color: var(--ink); border-radius: 6px; padding: 1px 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.tag { background: var(--blue-soft); color: var(--blue); }
.chip button { border: 0; background: none; padding: 0 2px; color: inherit; opacity: 0.6; font-size: 14px; line-height: 1; }
.chip button:hover { opacity: 1; }
button.chip { border: 0; cursor: pointer; font-family: inherit; line-height: inherit; margin-top: 3px; }
button.chip:hover { filter: brightness(0.94); }
.chipbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface); }
.chipbox input { border: 0; flex: 1; min-width: 160px; padding: 2px; margin: 0; }
.chipbox input:focus-visible { outline: none; }
.chipbox:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.picker { position: relative; }
.picker-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 34px 8px 10px; cursor: pointer; background: var(--surface); position: relative; }
.picker-box .caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.picker-panel { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; box-shadow: 0 12px 32px rgba(8, 14, 30, 0.18); }
.picker-list { max-height: 260px; overflow: auto; margin-top: 8px; border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; }
.picker-panel .picker-list { border: 0; padding: 0 2px; }
.picker-head { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 6px 0 4px; }
.picker-list label.check { margin-bottom: 6px; }
.rule-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.rule-row select { width: auto; }
.espset { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.espset button { border: 0; padding: 4px 10px; font-size: 12.5px; background: none; color: var(--ink-3); border-radius: 4px; }
.espset button.on { background: var(--blue-soft); color: var(--blue); }
.savebar { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); padding: 14px 0; margin-top: 20px; display: flex; gap: 10px; justify-content: center; z-index: 5; }
.savebar button { min-width: 120px; padding: 9px 18px; }
@media (max-width: 860px) { .s-ctl { justify-content: flex-start; } }

/* ---------- lead waterfall ---------- */
.btn { display: inline-block; }
a.btn.primary-link { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { a.btn.primary-link { color: #0e1524; } }
a.btn.sm { padding: 3px 9px; font-size: 12.5px; font-weight: 600; }
a.btn.dim { opacity: 0.55; }
a.btn.dl-main { border-color: var(--green); color: var(--green); }
.wf-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 18px; align-items: start; }
.wf-step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; margin-bottom: 10px; color: inherit; }
.wf-step:hover { text-decoration: none; border-color: var(--ink-3); }
.wf-step.blue { border-left-color: var(--blue); }
.wf-step.amber { border-left-color: var(--amber); }
.wf-num { width: 26px; height: 26px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: 0 0 26px; }
.wf-txt { flex: 1; min-width: 0; }
.wf-txt strong { display: block; }
.wf-txt span { color: var(--ink-2); font-size: 12.5px; }
.wf-cnt b { font-size: 20px; font-weight: 650; }
.wf-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin: 14px 0 10px; }
.wf-cell { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; color: inherit; border-top: 3px solid var(--line); }
.wf-cell:hover { text-decoration: none; border-color: var(--ink-3); }
.wf-cell b { display: block; font-size: 20px; font-weight: 650; line-height: 1.2; }
.wf-cell span { font-size: 12.5px; color: var(--ink-2); }
.wf-cell.green { border-top-color: var(--green); }
.wf-cell.red { border-top-color: var(--red); }
.wf-cell.amber { border-top-color: var(--amber); }
.stats.two { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.wf-list .bar { margin: 4px 0 0; }
.wf-lstats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0; font-size: 12.5px; color: var(--ink-2); }
.wf-lstat b { display: block; font-size: 18px; font-weight: 650; color: var(--ink); line-height: 1.2; }
.wf-lstat.green b { color: var(--green); }
.wf-lstat.red b { color: var(--red); }
.wf-lstat.amber b { color: var(--amber); }
.wf-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.wf-metric { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.wf-metric b { display: block; font-size: 20px; font-weight: 650; line-height: 1.2; }
.wf-metric span { font-size: 12.5px; color: var(--ink-2); }
.wf-metric.green { border-left-color: var(--green); }
.wf-metric.red { border-left-color: var(--red); }
.wf-metric.amber { border-left-color: var(--amber); }
tr.wf-total td { font-weight: 650; background: var(--line-2); }
details.small summary { cursor: pointer; }
@media (max-width: 980px) { .wf-grid { grid-template-columns: 1fr; } }

.field .numin { display: block; }

/* ---------- bounces ---------- */
.wf-metric.blue { border-left-color: var(--blue); }
.wf-metric.reason { border-left-width: 1px; }
.reason-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.reason-top b { font-size: 16px; }
pre.server-said { white-space: pre-wrap; word-break: break-word; background: var(--line-2); border-radius: 6px; padding: 10px 12px; font: 12.5px/1.5 Consolas, "Cascadia Mono", Menlo, monospace; max-height: 300px; overflow: auto; margin: 0 0 12px; }

/* ---------- analytics, activity, lead panel, editor, preview ---------- */
:root { --violet: #6d4fc4; --violet-soft: #ece7fa; --pink: #c0336d; }
@media (prefers-color-scheme: dark) { :root { --violet: #b5a0ff; --violet-soft: #2c2550; --pink: #ff8fbd; } }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pop-wrap { position: relative; display: inline-block; }
.pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 250px; max-width: min(440px, 90vw); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 12px 32px rgba(8, 14, 30, 0.18); text-align: left; font-weight: 400; }
.pop.right { left: auto; right: 0; }
.pop label.check { margin-bottom: 6px; white-space: nowrap; }
.pop .picker-head:first-child { margin-top: 0; }
.subtabs { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.subtabs a { padding: 5px 14px; border-radius: 16px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); font-weight: 600; font-size: 13px; }
.subtabs a:hover { text-decoration: none; border-color: var(--ink-3); }
.subtabs a.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.an-bar select { width: auto; }
.an-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.an-progress .bar { width: 120px; margin: 0; }
.range-custom { display: inline-flex; gap: 6px; align-items: center; }
.range-custom input { width: auto; }
.range-custom[hidden] { display: none; }
.chart.tall { height: 230px; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.legend { flex-wrap: wrap; gap: 6px 14px; }
.legend-btn { border: 0; background: none; padding: 2px 4px; font-weight: 500; font-size: 12.5px; color: var(--ink-2); display: inline-flex; align-items: center; }
.legend-btn.off { opacity: 0.45; text-decoration: line-through; }
tr.variant-row td { background: color-mix(in srgb, var(--line-2) 55%, transparent); font-size: 13px; }
tr.variant-row td:first-child { padding-left: 28px; }
.vletter { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; }
.feed-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px 120px; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.feed-row:last-child { border-bottom: 0; }
.feed-who { min-width: 0; overflow-wrap: anywhere; }
.feed-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-when { text-align: right; }
.diag-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.diag-row:last-child { border-bottom: 0; }
.diag-row .pill { flex: 0 0 68px; text-align: center; }

.leads-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.lead-filters { padding: 14px; position: sticky; top: 12px; }
.lead-filters .field { margin-bottom: 12px; }
.cond { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; display: grid; gap: 6px; justify-items: start; }
.cond select, .cond input { width: 100%; }
.count-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.count-chip { border-radius: 16px; padding: 4px 12px; font-weight: 500; font-size: 13px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: baseline; }
.count-chip b { color: var(--ink); }
.count-chip.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.count-chip.on b { color: var(--blue); }
table.rows-click tbody tr { cursor: pointer; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(12, 18, 32, 0.4); z-index: 45; display: flex; justify-content: flex-end; }
.drawer { width: min(540px, 100vw); height: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(8, 14, 30, 0.25); display: flex; flex-direction: column; }
.drawer-head { padding: 16px 20px 0; border-bottom: 1px solid var(--line); }
.drawer-head .tabs { border-bottom: 0; margin-bottom: 0; }
.drawer-title { display: flex; gap: 10px; align-items: flex-start; }
.drawer-title h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.drawer-head select { width: auto; max-width: 230px; }
.drawer-body { padding: 16px 20px 28px; overflow-y: auto; flex: 1; }
.kv { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line-2); overflow-wrap: anywhere; }
.kv.edit { border-bottom: 0; padding: 4px 0; }
.kv.edit > label, .kv.edit > .kv-name { flex: 0 0 38%; width: 38%; margin: 0; font-weight: 600; font-size: 12.5px; }
.kv.edit > input:not(.kv-name) { flex: 1; min-width: 0; }
.kv.edit.edited > input { border-color: var(--blue); background: var(--blue-soft); }
.timeline .tl-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.timeline .tl-row:last-child { border-bottom: 0; }
.tl-side { text-align: right; white-space: nowrap; }
.tl-main, .tl-info { overflow-wrap: anywhere; }

.ed-wrap { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.ed-wrap:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.ed-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.ed-bar .grow { flex: 1; }
.ed-bar .tb { padding: 3px 9px; font-size: 12.5px; min-width: 30px; }
.tb.b { font-weight: 800; }
.tb.i { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.tb.u { text-decoration: underline; }
.tb.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tb-size { width: auto; padding: 3px 6px; font-size: 12.5px; }
.editor { min-height: 190px; max-height: 520px; overflow-y: auto; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.editor:focus-visible, .editor-code:focus-visible { outline: none; }
.editor:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.editor ul, .editor ol { margin: 0; padding-left: 24px; }
.editor a { text-decoration: underline; }
.editor-code { border: 0; border-radius: 0 0 6px 6px; min-height: 190px; display: block; }
.editor[hidden], .editor-code[hidden] { display: none; }
.subject-row { display: flex; gap: 8px; align-items: center; }
.subject-row input { flex: 1; }

.modal.xl { max-width: 1080px; }
.pv-grid { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 20px; align-items: start; }
.pv-side .kv.edit > label { flex-basis: 44%; width: 44%; overflow-wrap: anywhere; }
.pv-pick select { width: auto; }
.pv-pick { margin-bottom: 12px; }
.pv-results { display: grid; gap: 4px; margin-top: 6px; max-height: 180px; overflow: auto; }
.pv-lead { text-align: left; font-weight: 500; font-size: 12.5px; white-space: normal; overflow-wrap: anywhere; }
.pv-meta { font-size: 13px; display: grid; gap: 2px; margin-bottom: 8px; overflow-wrap: anywhere; }
.pv-subject { border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 8px 0; margin-bottom: 10px; overflow-wrap: anywhere; }
.pv-frame { height: 340px; margin: 0 0 10px; }
.pv-check { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.pv-note { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 13px; }
.pv-note .pill { flex: 0 0 52px; text-align: center; }
@media (max-width: 980px) {
  .leads-layout, .pv-grid { grid-template-columns: 1fr; }
  .lead-filters { position: static; }
  .feed-row { grid-template-columns: 1fr; gap: 2px; }
  .feed-when { text-align: left; }
}

/* ---------- domains, import ---------- */
button.tile-btn { text-align: left; font: inherit; font-weight: 400; cursor: pointer; white-space: normal; }
button.tile-btn.on { outline: 2px solid var(--blue); outline-offset: 1px; }
a.pill:hover { text-decoration: none; filter: brightness(0.97); }
details.panel > summary { cursor: pointer; }
.import-camp { border-top: 1px solid var(--line-2); padding: 10px 0; display: grid; gap: 4px; }
.import-camp:first-of-type { border-top: 0; }
.warn-list { margin: 4px 0 0; padding-left: 18px; color: var(--amber); }
.warn-list li { margin-bottom: 2px; }

/* ---- dashboard ---- */
.health { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); padding: 14px 18px; margin-bottom: 18px; }
.health.good { border-left-color: var(--green); }
.health.attention { border-left-color: var(--amber); }
.health.problem { border-left-color: var(--red); }
.health-head { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.health ul { margin: 8px 0 0; padding-left: 20px; }
.health li { margin: 3px 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi > span { font-size: 12.5px; color: var(--ink-2); display: block; }
.kpi b { display: block; font-size: 26px; font-weight: 650; line-height: 1.25; }
.kpi small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.kpi .bar { margin-top: 6px; }
.small-kpis { margin-bottom: 0; }
.small-kpis .kpi { padding: 10px 12px; }
.small-kpis .kpi b { font-size: 20px; }
.delta { font-size: 12px; color: var(--ink-3); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.ov-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .ov-two { grid-template-columns: 1fr; gap: 0; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 10px; }
.panel-head h2 { margin: 0; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 70px; align-items: center; gap: 10px; margin: 8px 0; }
.funnel-row small { grid-column: 2 / 4; color: var(--ink-3); font-size: 12px; margin-top: -6px; }
.funnel-row b { text-align: right; }
.funnel-bar { height: 14px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.deliv { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.deliv .big { font-size: 30px; font-weight: 650; line-height: 1.1; display: block; }
.spark { width: 220px; height: 44px; }
.counts { margin-top: 12px; display: grid; gap: 4px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.chart .axis { font-size: 10.5px; fill: var(--ink-3); }
td.snippet { max-width: 360px; white-space: normal; }
td.next-step input { min-width: 160px; }
.changes > div { padding: 5px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.changes > div:last-child { border-bottom: 0; }
iframe.mail-preview { width: 100%; height: 330px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---- apps (launcher) ---- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 132px; }
.app-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-top strong { font-size: 15px; margin-right: 2px; }
.app-desc { flex: 1; overflow-wrap: anywhere; }
.app-err { overflow-wrap: anywhere; }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app-head { margin-bottom: 12px; }
.app-head h1 a { font-weight: 500; }
iframe.app-frame { display: block; width: 100%; height: calc(100vh - 118px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
pre.app-log { max-height: 60vh; overflow: auto; margin: 0; padding: 12px; background: var(--line-2); border-radius: 8px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.kind-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kind-pick:empty { display: none; }
.kind-pick button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 12px; height: 100%; white-space: normal; }
.kind-pick button.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
@media (max-width: 640px) { .kind-pick { grid-template-columns: 1fr; } iframe.app-frame { height: calc(100vh - 170px); } }
.main:has(iframe.app-frame) { max-width: none; padding-bottom: 20px; }

/* ---- registrars ---- */
.reg-accounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
button.reg-acc { font-weight: 400; background: var(--surface); white-space: normal; text-align: left; max-width: 100%; }
button.reg-acc.bad { border-color: var(--red); }
.reg-bulk { margin-bottom: 10px; }
.reg-job { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
th.chk, td.chk { width: 30px; padding-right: 0; }
td.nowrap { white-space: nowrap; }
.reg-preview { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.reg-preview tr.dim td { opacity: 0.65; }
.reg-rec { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.reg-rec select { width: 92px; flex: 0 0 auto; }
.reg-rec input.reg-name { flex: 0 1 170px; min-width: 90px; }
.reg-rec input.reg-val { flex: 1 1 260px; min-width: 120px; }
.reg-rec input.reg-num { flex: 0 0 84px; width: 84px; }
.reg-rec button.x { flex: 0 0 auto; }
@media (max-width: 640px) { .reg-rec { flex-wrap: wrap; } }
