/* Outreach dashboard */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --sunken: #f1f3f6;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;
  --text: #0f1729;
  --text-2: #475467;
  --muted: #8a94a6;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: #eef0ff;
  --brand-text: #ffffff;
  --ok: #0f8a3e; --ok-soft: #e7f6ec;
  --warn: #b45309; --warn-soft: #fdf3e3;
  --danger: #c62828; --danger-soft: #fdecec;
  --info: #1d6fd8; --info-soft: #e8f1fd;
  --series-1: #2a78d6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 248px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d1017; --surface: #151922; --surface-2: #1a1f2a; --sunken: #11151d;
    --line: #252b37; --line-strong: #323a49;
    --text: #eef1f6; --text-2: #b4bccb; --muted: #7d8799;
    --brand: #7c74ff; --brand-hover: #8f88ff; --brand-soft: #1f1d3d; --brand-text: #ffffff;
    --ok: #3ccf74; --ok-soft: #11281b; --warn: #f0a63b; --warn-soft: #2d2212;
    --danger: #ff6b6b; --danger-soft: #2f1517; --info: #5aa2ff; --info-soft: #12223a;
    --series-1: #3987e5;
    --shadow-sm: none; --shadow: none; --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1017; --surface: #151922; --surface-2: #1a1f2a; --sunken: #11151d;
  --line: #252b37; --line-strong: #323a49;
  --text: #eef1f6; --text-2: #b4bccb; --muted: #7d8799;
  --brand: #7c74ff; --brand-hover: #8f88ff; --brand-soft: #1f1d3d; --brand-text: #ffffff;
  --ok: #3ccf74; --ok-soft: #11281b; --warn: #f0a63b; --warn-soft: #2d2212;
  --danger: #ff6b6b; --danger-soft: #2f1517; --info: #5aa2ff; --info-soft: #12223a;
  --series-1: #3987e5;
  --shadow-sm: none; --shadow: none; --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; font-weight: 650; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 13px; margin: 0; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
code { background: var(--sunken); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.brand .logo svg.i { width: 17px; height: 17px; stroke-width: 2.2; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--sunken); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .badge { margin-left: auto; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-foot button { justify-content: flex-start; width: 100%; border: 0; background: none; box-shadow: none; color: var(--text-2); }
.sidebar-foot button:hover { background: var(--sunken); color: var(--text); }

.main { min-width: 0; }
.topbar-mobile { display: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumb:hover { color: var(--text); text-decoration: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .topbar-mobile {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 700;
  }
  .page { padding: 20px 16px 48px; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 35; }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-2 > *, .grid-3 > *, .stack > * { min-width: 0; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 550; font-size: 13.5px; line-height: 1;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); white-space: nowrap; text-decoration: none;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
button svg.i, .btn svg.i { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: none; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--sunken); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
label.field .hint { font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; min-height: 36px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
textarea { resize: vertical; min-height: 160px; line-height: 1.55; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.search { position: relative; min-width: 220px; }
.search svg.i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 34px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550; background: var(--sunken); color: var(--text-2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.active, .pill.sent, .pill.completed, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.paused, .pill.in_progress, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.failed, .pill.bounced, .pill.unsubscribed, .pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.replied, .pill.info { background: var(--info-soft); color: var(--info); }
.pill.draft, .pill.pending { background: var(--sunken); color: var(--text-2); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550; background: var(--sunken); color: var(--text-2); border: 1px solid var(--line); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--muted); }

.empty { padding: 44px 20px; text-align: center; color: var(--text-2); }
.empty .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--brand-soft); color: var(--brand); }
.empty h3 { font-size: 15px; margin-bottom: 4px; color: var(--text); }
.empty p { margin-bottom: 14px; }

/* ---------- KPIs + meters ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.meter { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.progress-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.progress-cell .meter { flex: 1; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.seg { display: inline-flex; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { height: 28px; border: 0; background: none; box-shadow: none; color: var(--text-2); padding: 0 12px; font-size: 12.5px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- chart ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--series-1); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: default; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--text); color: var(--surface);
  padding: 7px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
  box-shadow: var(--shadow-lg);
}
.tooltip b { font-size: 14px; display: block; }
.chart-table { margin-top: 10px; }
.chart-table td, .chart-table th { padding: 6px 10px; font-size: 12.5px; }

/* ---------- sequence editor ---------- */
.seq { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .seq { grid-template-columns: 1fr; } }
.step-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.step-card.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.step-card .step-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.step-num { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.step-card .step-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.wait { display: flex; align-items: center; gap: 8px; padding: 8px 0 8px 26px; color: var(--text-2); font-size: 13px; position: relative; }
.wait::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: var(--line-strong); }
.wait input { width: 64px; min-height: 30px; padding: 4px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 26px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 550; font-family: ui-monospace, Consolas, monospace; background: var(--sunken); border: 1px solid var(--line); color: var(--text-2); box-shadow: none; }
.chip:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.preview { position: sticky; top: 20px; }
.mail { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.mail .mh { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; display: grid; gap: 3px; }
.mail .mh b { color: var(--text-2); font-weight: 550; display: inline-block; width: 58px; }
.mail .mb { padding: 14px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6; min-height: 120px; }

/* ---------- inbox cards ---------- */
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.inbox-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.inbox-card .who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 15px; }
.prov-google { background: linear-gradient(135deg, #4285f4, #34a853); }
.prov-microsoft { background: linear-gradient(135deg, #0078d4, #50a0e6); }
.prov-smtp { background: linear-gradient(135deg, #64748b, #94a3b8); }
.inbox-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inbox-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.inbox-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.inbox-stats span { font-size: 11.5px; color: var(--muted); }
.status-line { font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); }
.status-line.bad { color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-top: 5px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--danger); } .dot.off { background: var(--muted); }

/* ---------- replies ---------- */
.reply-list { display: flex; flex-direction: column; }
.reply { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: start; }
.reply:last-child { border-bottom: 0; }
.reply:hover { background: var(--surface-2); }
.reply.unread .r-from { font-weight: 700; }
.reply .r-from { display: flex; gap: 8px; align-items: center; min-width: 0; }
.reply .r-snippet { color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reply.open .r-snippet { -webkit-line-clamp: unset; display: block; white-space: pre-wrap; }
.reply .r-meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.unread-dot { width: 8px; height: 8px; background: var(--brand); border-radius: 50%; display: inline-block; }
.av-reply { background: linear-gradient(135deg, #6366f1, #a855f7); }
.av-bounce { background: linear-gradient(135deg, #ef4444, #f97316); }

/* ---------- feed ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.feed-item:last-child { border-bottom: 0; }
.feed-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); color: var(--text-2); }
.feed-ico svg.i { width: 15px; height: 15px; }
.feed-ico.ok { background: var(--ok-soft); color: var(--ok); }
.feed-ico.info { background: var(--info-soft); color: var(--info); }
.feed-ico.bad { background: var(--danger-soft); color: var(--danger); }
.feed-ico.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- automations ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tpl { padding: 16px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.tpl p { color: var(--text-2); font-size: 13px; flex: 1; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; align-items: center; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } }
.copybox { display: flex; gap: 8px; align-items: center; min-width: 0; }
.copybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 9px; }
.endpoint { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.endpoint:last-child { border-bottom: 0; }
.method { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; font-weight: 700; padding: 3px 0; border-radius: 5px; text-align: center; }
.method.post { background: var(--ok-soft); color: var(--ok); }
.method.get { background: var(--info-soft); color: var(--info); }
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }

/* ---------- modal, toast, savebar ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, .5); animation: fade .12s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 12px 20px 8px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .choice { grid-template-columns: 1fr; } }
.choice label { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.choice span { font-size: 12.5px; color: var(--text-2); }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast { background: var(--text); color: var(--surface); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 8px; align-items: center; animation: pop .15s; max-width: 420px; }
.toast.err { background: var(--danger); color: #fff; }
.savebar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 16px; background: var(--text); color: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); flex-wrap: wrap;
}
.savebar .btn-ghost { color: var(--surface); opacity: .8; }
.savebar .btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--surface); opacity: 1; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent), var(--bg); }
.login .card { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login .brand { padding: 0 0 4px; }
.error { color: var(--danger); font-size: 13px; min-height: 1em; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text); font-size: 13px; align-items: flex-start; }
.notice svg.i { color: var(--info); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); } .notice.warn svg.i { color: var(--warn); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.loading { padding: 80px 0; display: grid; place-items: center; color: var(--muted); }

/* ---------- template gallery ---------- */
mark.var { background: var(--brand-soft); color: var(--brand); border-radius: 4px; padding: 0 2px; font-weight: 550; }
.tpl-pick { display: grid; grid-template-columns: 220px 1fr; gap: 16px; min-height: 420px; }
@media (max-width: 700px) { .tpl-pick { grid-template-columns: 1fr; } }
.tpl-side { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 12px; max-height: 60vh; overflow: auto; }
@media (max-width: 700px) { .tpl-side { border-right: 0; padding-right: 0; max-height: none; } }
.tpl-item { justify-content: flex-start; flex-direction: column; align-items: flex-start; height: auto; padding: 9px 10px; gap: 2px; border: 0; box-shadow: none; background: none; text-align: left; white-space: normal; flex: none; }
.tpl-item span { font-size: 12px; color: var(--muted); font-weight: 400; }
.tpl-item:hover { background: var(--sunken); }
.tpl-item.on { background: var(--brand-soft); color: var(--brand); }
.tpl-main { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; padding-right: 4px; }
.tpl-main .mail .mb { min-height: 0; }

/* ---------- flow builder ---------- */
.flow { display: flex; align-items: center; overflow-x: auto; padding: 22px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background-color: var(--surface-2); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 16px 16px; }
.fnode { display: flex; align-items: center; gap: 10px; min-width: 190px; max-width: 260px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); flex: none; }
.fnode b { display: block; font-size: 13px; }
.fnode span:not(.fico) { display: block; font-size: 12px; color: var(--muted); max-width: 190px; }
.fnode.trigger { border-color: color-mix(in srgb, var(--warn) 55%, var(--line-strong)); }
.fnode.trigger .fico { background: var(--warn-soft); color: var(--warn); }
.fnode.ghost { border-style: dashed; box-shadow: none; }
.fico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.fico svg.i { width: 17px; height: 17px; }
.fconn { width: 44px; height: 2px; background: var(--line-strong); position: relative; flex: none; }
.fconn::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--line-strong); border-right: 0; }
.fconn::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.action-grid label { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-size: 13px; }
.action-grid label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.action-grid input { position: absolute; opacity: 0; width: 0; height: 0; }
.action-grid .fico { width: 28px; height: 28px; }
.flow-list { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; }
.flow-row { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.flow-row:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- campaign flow canvas ---------- */
.fl-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background-color: var(--surface-2); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 18px 18px; }
.fl-tools { position: absolute; z-index: 3; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fl-tools .btn-icon { width: 34px; height: 34px; background: var(--surface); }
.fl-sched { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.fl-scroll { overflow: auto; max-height: 78vh; min-height: 420px; }
.fl-canvas { position: relative; margin: 0 auto; }
.fl-lines { position: absolute; inset: 0; pointer-events: none; color: var(--muted); }
.fl-lines path { fill: none; stroke: currentColor; stroke-width: 2.5; opacity: .75; }
.fl-lines marker path { fill: currentColor; stroke: none; opacity: 1; }
.fl-node { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px 16px 10px; cursor: pointer; text-align: center; transition: box-shadow .12s, border-color .12s; }
.fl-node:hover { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.fl-tag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 16px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.fl-tag svg.i { width: 14px; height: 14px; }
.fl-tag.email { background: #dbeafe; color: #1e40af; }
.fl-tag.delay { background: #fef3c7; color: #92400e; }
:root[data-theme="dark"] .fl-tag.email { background: #1e3a5f; color: #bfdbfe; } :root[data-theme="dark"] .fl-tag.delay { background: #3f3112; color: #fde68a; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .fl-tag.email { background: #1e3a5f; color: #bfdbfe; } :root:where(:not([data-theme="light"])) .fl-tag.delay { background: #3f3112; color: #fde68a; } }
.fl-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fl-title.muted { color: var(--text-2); font-weight: 500; }
.fl-sub { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-node.delay .fl-title { font-weight: 500; color: var(--text-2); }
.fl-node.delay .fl-title b { color: var(--text); }
.fl-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border: 0; box-shadow: none; background: none; color: var(--muted); opacity: 0; }
.fl-node:hover .fl-del { opacity: 1; }
.fl-del:hover { color: var(--danger); background: var(--danger-soft); }
.fl-pill { position: absolute; display: grid; place-items: center; border-radius: 999px; font-weight: 650; font-size: 13px; }
.fl-pill.start { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.fl-pill.end { background: var(--sunken); color: var(--text-2); border: 1px solid var(--line); }
:root[data-theme="dark"] .fl-pill.start { background: #12301e; color: #86efac; border-color: #1c4a2e; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .fl-pill.start { background: #12301e; color: #86efac; border-color: #1c4a2e; } }
.fl-add { position: absolute; border-style: dashed; border-radius: 999px; color: var(--brand); background: var(--surface); }
.fl-stats { position: absolute; display: flex; flex-direction: column; gap: 6px; }
.fl-stats span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm); width: max-content; }
.fl-stats svg.i { width: 14px; height: 14px; color: var(--text-2); }
.em-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .em-grid { grid-template-columns: 1fr; } }

/* ---------- warm-up + verification ---------- */
.warm { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.warm b { display: inline-flex; align-items: center; gap: 6px; }
.warm svg.i { width: 15px; height: 15px; }
.warm.ok b svg.i { color: var(--ok); } .warm.warn b svg.i { color: var(--warn); } .warm.bad b svg.i { color: var(--danger); }
.warm-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.verify-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.verify-bar svg.i { width: 15px; height: 15px; color: var(--ok); }
.pill.invalid { background: var(--danger-soft); color: var(--danger); }

/* ---------- warm-up page ---------- */
.wu-row { overflow: hidden; }
.wu-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wu-head .who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.wu-body { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(260px, 1.3fr) minmax(220px, 1fr); }
@media (max-width: 1000px) { .wu-body { grid-template-columns: 1fr; } }
.wu-cell { padding: 18px; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 0; }
.wu-cell + .wu-cell { border-left: 1px solid var(--line); }
@media (max-width: 1000px) { .wu-cell + .wu-cell { border-left: 0; border-top: 1px solid var(--line); } }
.wu-health { flex-direction: row; align-items: center; gap: 16px; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 84px; height: 84px; }
.ring circle { fill: none; stroke-width: 8; }
.ring-bg { stroke: var(--sunken); }
.ring-fg { stroke-linecap: round; stroke: var(--muted); transition: stroke-dasharray .4s; }
.ring.ok .ring-fg { stroke: var(--ok); } .ring.warn .ring-fg { stroke: var(--warn); } .ring.bad .ring-fg { stroke: var(--danger); }
.ring-val { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; }
.ring-val b { font-size: 16px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ring-val span { font-size: 10.5px; color: var(--muted); font-weight: 550; }
.wc { position: relative; }
.wc svg { width: 100%; height: 84px; display: block; }
.wc-inbox { fill: var(--series-1); } .wc-spam { fill: #d03b3b; } .wc-pending { fill: var(--line-strong); } .wc-zero { fill: var(--line); }
.wc-hit { fill: transparent; } .wc-base { stroke: var(--line); }
.wc-day:hover .wc-hit { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.wc-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--text); color: var(--surface); font-size: 11.5px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
.wc-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--text-2); margin-top: 6px; }
.wc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-inbox { background: var(--series-1); } .lg-spam { background: #d03b3b; } .lg-pending { background: var(--line-strong); }
.wc-legend span:last-child { margin-left: auto; }
.ramp-num { display: flex; align-items: baseline; gap: 6px; }
.ramp-num b { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ramp-num span { color: var(--muted); font-size: 13px; }

.chip-link { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--sunken); color: var(--text-2); border: 1px solid var(--line); text-decoration: none; }
.chip-link:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.chip-link svg.i { width: 13px; height: 13px; }
.chip-link.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip-link.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-link.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip-link.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* settings modal */
.set-sec { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.set-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 16px 18px; background: var(--surface-2); }
.set-row h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 4px; }
.set-row h3 svg.i { width: 17px; height: 17px; color: var(--brand); }
.set-row p { font-size: 13px; color: var(--text-2); max-width: 520px; }
.set-row .switch { margin-top: 2px; }
.set-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--line); transition: opacity .15s; }
.set-body.off { opacity: .45; pointer-events: none; }
.slider-row { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.slider-row b { font-variant-numeric: tabular-nums; color: var(--brand); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; padding: 0; min-height: 0; border: 0; border-radius: 999px; background: var(--sunken); accent-color: var(--brand); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid var(--surface); cursor: pointer; }
.set-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); background: var(--info-soft); padding: 10px 12px; border-radius: 9px; }
.set-note svg.i { width: 15px; height: 15px; color: var(--info); flex: none; margin-top: 1px; }
.ramp-preview { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.rp-bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.rp-bars i { flex: 1; background: var(--series-1); border-radius: 3px 3px 0 0; min-width: 3px; opacity: .85; }
.set-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; background: var(--surface-2); }
.set-link:hover { border-color: var(--brand); text-decoration: none; }
.set-link > svg.i { color: var(--warn); width: 20px; height: 20px; }
.set-link span { flex: 1; font-size: 13.5px; }
.set-link-arrow { flex: none !important; transform: rotate(180deg); color: var(--muted); display: inline-flex; }

/* ---------- inboxes table ---------- */
.ib-table { display: flex; flex-direction: column; }
.ib-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) minmax(110px, 1fr) minmax(170px, 1.7fr) minmax(130px, 1.2fr) 70px max-content; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ib-row:last-child { border-bottom: 0; }
.ib-row:not(.ib-headrow):hover { background: var(--surface-2); }
.ib-row.paused { opacity: .62; }
.ib-headrow { font-size: 12px; color: var(--muted); font-weight: 550; padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); }
.ib-who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ib-today, .ib-health { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ib-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.ib-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.bad-text, .bad-text b { color: var(--danger) !important; }
.ib-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.ib-actions .switch { margin-right: 6px; }
.ellipsis-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dot.warn { background: var(--warn); }
.prov-badge { display: inline-flex; height: 18px; align-items: center; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 650; letter-spacing: .02em; background: var(--sunken); color: var(--text-2); }
.prov-badge.google { background: #e8f0fe; color: #1a56c8; } .prov-badge.microsoft { background: #e6f2fb; color: #0b5cad; }
:root[data-theme="dark"] .prov-badge.google, :root[data-theme="dark"] .prov-badge.microsoft { background: #15284a; color: #9cc3ff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .prov-badge.google, :root:where(:not([data-theme="light"])) .prov-badge.microsoft { background: #15284a; color: #9cc3ff; } }
@media (max-width: 1100px) {
  .ib-headrow { display: none; }
  .ib-row { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .ib-who { grid-column: 1 / -1; }
  .ib-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .ib-row [data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 550; margin-bottom: 2px; }
}
@media (max-width: 560px) { .ib-row { grid-template-columns: 1fr; } }

/* provider picker */
.prov-grid { display: flex; flex-direction: column; gap: 10px; }
.prov-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; text-align: left; height: auto; width: 100%; box-shadow: none; font-weight: 400; white-space: normal; justify-content: flex-start; }
.prov-card:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.prov-card.disabled { opacity: .6; cursor: not-allowed; }
.prov-card.disabled:hover { border-color: var(--line-strong); background: var(--surface); }
.prov-card > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.prov-card b { font-size: 14px; } .prov-card > div > span { font-size: 12.5px; color: var(--text-2); }
.prov-logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; flex: none; }
.prov-logo.google { background: linear-gradient(135deg, #4285f4, #34a853); } .prov-logo.microsoft { background: linear-gradient(135deg, #0078d4, #50a0e6); }
.prov-logo.smtp { background: linear-gradient(135deg, #64748b, #94a3b8); }
.prov-logo svg.i { width: 20px; height: 20px; }
.chip.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* user chip */
.me-btn { height: auto !important; padding: 8px 10px !important; gap: 10px !important; border-radius: 10px !important; margin-bottom: 4px; }
.me-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.25; }
.me-text b { font-size: 13px; color: var(--text); max-width: 150px; }
.me-text span { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.seg { max-width: 100%; overflow-x: auto; }
.seg button { flex: none; }

/* ---------- Unibox ---------- */
.ux { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - 170px); min-height: 520px; overflow: hidden; }
.ux-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ux-tools { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.ux-tools .search { min-width: 0; }
.ux-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.ux-filters button { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 999px; box-shadow: none; background: var(--sunken); border-color: transparent; color: var(--text-2); }
.ux-filters button.on { background: var(--brand); color: #fff; }
.ux-items { overflow-y: auto; flex: 1; }
.ux-item { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
.ux-item:hover { background: var(--surface-2); }
.ux-item.sel { background: var(--brand-soft); border-left-color: var(--brand); }
.ux-item .avatar { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; }
.ux-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ux-item b { font-size: 13.5px; font-weight: 550; }
.ux-item.unread b { font-weight: 750; }
.ux-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ux-sub { font-size: 12.5px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.ux-item.unread .ux-sub { font-weight: 650; }
.ux-snip { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ux-meta { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 3px; min-width: 0; }
.ux-meta .pill { height: 19px; font-size: 11px; padding: 0 7px; }
.ux-meta .tag { height: 19px; font-size: 11px; gap: 3px; } .ux-meta .tag svg.i { width: 11px; height: 11px; }
.ux-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ux-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ux-back { display: none; }
.ux-labels { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.lbl-btn { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 999px; box-shadow: none; gap: 5px; color: var(--text-2); }
.lbl-btn svg.i { width: 13px; height: 13px; }
.lbl-btn.on.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.lbl-btn.on.info { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.lbl-btn.on.bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.lbl-btn.on.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.lbl-btn.on.draft { background: var(--sunken); color: var(--text); border-color: var(--text-2); }
.ux-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.msg { max-width: 82%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.msg.out { align-self: flex-end; background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); border-bottom-right-radius: 4px; }
.msg.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.k-bounce { border-color: var(--danger); }
.msg-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-bottom: 4px; }
.msg-head b { font-size: 12.5px; }
.msg-subj { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; }
.msg-body.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; color: var(--text-2); }
.ux-compose { border-top: 1px solid var(--line); padding: 12px 18px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.ux-compose textarea { min-height: 90px; }
.ux-empty { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 30px; }
.ux-empty svg.i { width: 34px; height: 34px; }
@media (max-width: 900px) {
  .ux { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .ux-list { border-right: 0; }
  .ux-thread { display: none; }
  .ux.show-thread .ux-list { display: none; }
  .ux.show-thread .ux-thread { display: flex; }
  .ux-msgs { max-height: 60vh; }
  .ux-back { display: inline-flex; }
  .msg { max-width: 94%; }
}

/* ---------- Leads ---------- */
.lv-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lv-filters select { width: auto; max-width: 200px; }
.lv-filters .search { flex: 1; min-width: 220px; }
.lv td, .lv th { padding: 10px 12px; }
.lv .pill.lbl { height: 20px; font-size: 11.5px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.bulk-bar select { height: 30px; min-height: 30px; padding: 4px 8px; font-size: 12.5px; }
.ld-head { display: flex; gap: 14px; align-items: center; }
.ld-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
@media (max-width: 700px) { .ld-grid { grid-template-columns: 1fr; } }
.ld-h { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.ld-grid .kv { grid-template-columns: 110px 1fr; gap: 6px 10px; }
.tl { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }

/* ---------- Reports ---------- */
.rp-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; }
.rp-bar input[type=date] { width: auto; }

/* ---------- polish ---------- */
#view > * { animation: rise .18s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.nav a { position: relative; transition: background .12s, color .12s; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
button, .btn { transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.card { transition: box-shadow .15s, border-color .15s; }
.kpi .label svg.i { width: 26px; height: 26px; padding: 5px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.kpi .label { gap: 8px; }
.kpi .value { margin-top: 10px; }
.page-head h1 { font-size: 24px; }
tbody tr { transition: background .1s; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.toast { animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }

/* ---------- A/B, settings, blocked ---------- */
.fl-ab { position: absolute; top: 6px; left: 8px; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--warn-soft); color: var(--warn); }
.ab-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.ab-stats span { padding: 6px 10px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); }
.ab-stats span.win { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ab-row td { background: var(--surface-2); color: var(--text-2); padding-top: 6px; padding-bottom: 6px; }
.set-card { overflow: hidden; }
.set-card .set-row { border-bottom: 1px solid var(--line); }
.set-card .set-body { border-top: 0; }
.pill.blocked { background: var(--danger-soft); color: var(--danger); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.tb-menu { display: none; }
.tb-search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; }
.tb-search > svg.i { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); }
.tb-search input { padding-left: 34px; padding-right: 34px; height: 38px; background: var(--surface); border-radius: 10px; }
.tb-search kbd { position: absolute; right: 9px; font: 600 11px/1 ui-monospace, Consolas, monospace; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 6px; background: var(--sunken); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-pop { position: relative; }
.tb-bell { position: relative; width: 38px; height: 38px; }
.tb-bell svg.i { width: 19px; height: 19px; }
.tb-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg); }
.tb-user { height: 38px; padding: 0 8px 0 4px; gap: 8px; border-radius: 10px; background: none; border-color: transparent; box-shadow: none; }
.tb-user:hover { background: var(--sunken); }
.tb-user .avatar { width: 30px; height: 30px; font-size: 12px; border-radius: 9px; }
.tb-user svg.i { width: 15px; height: 15px; color: var(--muted); }
.tb-uname { font-weight: 600; font-size: 13.5px; }
.tb-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; overflow: hidden; animation: pop .14s; }
.tb-menu-panel { width: 260px; padding-bottom: 6px; }
.tb-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tb-list { max-height: 420px; overflow-y: auto; }
.tb-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; align-items: start; }
.tb-item:hover { background: var(--surface-2); text-decoration: none; }
.tb-item.unread { background: var(--brand-soft); }
.tb-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tb-item-meta { font-size: 11.5px; color: var(--muted); }
.tb-item .unread-dot { margin-top: 6px; }
.tb-panel-foot { display: block; text-align: center; padding: 10px; font-size: 12.5px; font-weight: 600; }
.tb-empty { padding: 26px 18px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.tb-empty svg.i { width: 26px; height: 26px; }
.tb-mi { display: flex; width: 100%; align-items: center; justify-content: flex-start; gap: 10px; height: 38px; padding: 0 14px; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--text); font-weight: 500; text-decoration: none; }
.tb-mi:hover { background: var(--sunken); text-decoration: none; }
.tb-mi svg.i { width: 16px; height: 16px; color: var(--text-2); }
.tb-mi.danger, .tb-mi.danger svg.i { color: var(--danger); }
.tb-drop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 50; padding: 6px 0; max-height: 420px; overflow-y: auto; }
.tb-sec { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 14px 4px; }
.tb-res { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 14px; height: auto; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--text);
  font-weight: 500; text-decoration: none; justify-content: flex-start; white-space: normal; }
.tb-res:hover { background: var(--sunken); text-decoration: none; }
.tb-res svg.i { width: 16px; height: 16px; color: var(--muted); }
.topbar-mobile { display: none !important; }
@media (max-width: 900px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .tb-menu { display: inline-flex; }
  .tb-search kbd, .tb-new, .tb-uname, .tb-user svg.i { display: none; }
}
.tpl-item b { line-height: 1.35; }
mark.var.pitch { background: var(--ok-soft, #e7f6ec); color: var(--ok, #16794a); }

/* ---- clean-up pass: template popup, sequence editor, Unibox ---- */
.tpl-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tpl-when { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--text-2); }
.tpl-when b { display: block; color: var(--text); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.tpl-wait { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 8px 0 8px 14px; margin-left: 14px; border-left: 2px dashed var(--line-strong); }
.tpl-wait svg.i { width: 13px; height: 13px; }
.tpl-mail .mh { gap: 4px; }
.tpl-mail .mh .small b { display: inline-block; width: 58px; font-weight: 550; color: var(--text-2); }
.tpl-mail .mb { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
mark.var.fill { font-weight: inherit; padding: 0 1px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: inherit; border-bottom: 1.5px solid color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 2px; }
mark.var.fill.pitch { background: color-mix(in srgb, var(--ok) 10%, transparent); border-bottom-color: color-mix(in srgb, var(--ok) 50%, transparent); }
mark.var.fill.ai { background: color-mix(in srgb, var(--warn) 12%, transparent); border-bottom-color: color-mix(in srgb, var(--warn) 55%, transparent); }

.step-card.closed { cursor: pointer; box-shadow: none; }
.step-card.closed:hover { border-color: var(--line-strong); background: var(--surface-2); }
.step-card.closed .step-top { border-bottom: 0; }
.step-card.closed .step-top > svg.i { color: var(--muted); width: 15px; height: 15px; }
.step-card .step-top .btn-sm { height: 28px; }
.var-pick { width: auto; max-width: 230px; height: 32px; min-height: 32px; font-size: 12.5px; padding: 0 28px 0 10px; }
.seq .preview { position: sticky; top: 74px; }

.ux { height: calc(100vh - 186px); min-height: 480px; }
.ux-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ux-selects select { height: 34px; min-height: 34px; font-size: 12.5px; min-width: 0; }
.lbl-select { width: auto; height: 32px; min-height: 32px; font-size: 12.5px; font-weight: 550; padding: 0 28px 0 10px; }
.lbl-select.ok { background-color: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.lbl-select.info { background-color: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.lbl-select.bad { background-color: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.lbl-select.warn { background-color: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.msg-more { background: none; border: 0; box-shadow: none; padding: 0; height: auto; min-height: 0; margin-top: 6px; color: var(--brand); font-size: 12px; font-weight: 550; }
.msg-more:hover { background: none; text-decoration: underline; }
.ux-compose textarea { min-height: 76px; }
