/* Outreach dashboard. Quiet, dense, Linear-like. Light/dark via prefers-color-scheme. */

:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --bg-subtle: #f7f7f8;
  --bg-hover: #f1f1f3;
  --bg-active: #ebebef;
  --border: #e6e6ea;
  --border-strong: #d4d4da;
  --fg: #1b1b1f;
  --fg-muted: #6b6b76;
  --fg-faint: #9a9aa4;
  --accent: #5e6ad2;
  --accent-hover: #4f5bc4;
  --accent-fg: #ffffff;
  --accent-soft: #eef0fc;
  --danger: #c93c37;
  --danger-soft: #fdeeee;
  --warn: #a15c07;
  --warn-soft: #fdf4e3;
  --ok: #1f7a4d;
  --ok-soft: #e6f5ed;
  --purple: #7a4bc9;
  --purple-soft: #f3edfc;
  --blue: #2f6bd8;
  --blue-soft: #eaf1fd;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.18);
  --radius: 8px;
  --sidebar-w: 208px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --bg-subtle: #17171b;
    --bg-hover: #1e1e23;
    --bg-active: #26262c;
    --border: #2a2a31;
    --border-strong: #3a3a43;
    --fg: #ececf1;
    --fg-muted: #9d9daa;
    --fg-faint: #6c6c78;
    --accent: #7c86e8;
    --accent-hover: #8f98ee;
    --accent-fg: #0d0d12;
    --accent-soft: #23253d;
    --danger: #f07873;
    --danger-soft: #3a1d1c;
    --warn: #e8a94a;
    --warn-soft: #362a14;
    --ok: #5cc98f;
    --ok-soft: #15301f;
    --purple: #b08cf0;
    --purple-soft: #2a2140;
    --blue: #7aa7f5;
    --blue-soft: #1a2640;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--bg); padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
.skip-link:focus { left: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; }
.sidebar { border-right: 1px solid var(--border); background: var(--bg-subtle); display: flex; flex-direction: column; padding: 14px 10px; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 2px 8px; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 6px; color: var(--fg-muted); font-weight: 500; }
.nav a:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--bg-active); color: var(--fg); }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-fg); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { margin-top: auto; padding: 0 8px; font-size: 12px; }
.muted-link { color: var(--fg-muted); }

.main-col { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
#main { flex: 1; overflow: auto; min-height: 0; }
#main.fill { overflow: hidden; display: flex; flex-direction: column; }

.page { padding: 20px 28px 48px; max-width: 1280px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.page-head .sub { color: var(--fg-muted); }

/* ---------- Banners ---------- */
#banners:empty { display: none; }
.banner { display: block; padding: 8px 28px; font-size: 13px; border-bottom: 1px solid var(--border); }
.banner strong { font-weight: 600; }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-info { background: var(--accent-soft); color: var(--fg); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Cards, stats ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { color: var(--fg-muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat-sub { color: var(--fg-muted); font-size: 12px; }

.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.small { font-size: 12px; }
.err { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.empty { color: var(--fg-muted); padding: 18px 4px; text-align: center; }
.empty p + p { margin-top: 6px; }
.callout { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--bg-subtle); font-size: 13px; }
.callout-warn { background: var(--warn-soft); border-color: transparent; color: var(--fg); }
.callout-warn strong { color: var(--warn); }
.callout-danger { background: var(--danger-soft); border-color: transparent; }
.error-box { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 10px 12px; }
.loading-line { color: var(--fg-muted); padding: 24px 4px; }

/* ---------- Buttons, inputs ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 36px; padding: 0 16px; font-size: 14px; }
.icon-btn { font: inherit; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--fg-muted); cursor: pointer; font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--fg); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.strong { font-weight: 600; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--fg-muted); background: var(--bg-subtle); }
.btn kbd { margin-left: 2px; }
.btn-primary kbd { color: inherit; background: transparent; border-color: rgba(255, 255, 255, 0.45); }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], textarea, select {
  font: inherit; font-size: 13px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 5px 8px; min-height: 30px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
label { font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .field > .label { font-weight: 500; }
.field .hint { font-size: 12px; color: var(--fg-muted); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-weight: 500; font-size: 13px; padding: 0; margin-bottom: 4px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; }

/* Switch: a styled checkbox with role="switch" */
input.switch { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(14px); }
input.switch:disabled { opacity: 0.5; cursor: wait; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; padding: 4px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--border); padding-top: 12px; }
.switch-row label { font-weight: 500; font-size: 14px; }
.switch-row p { color: var(--fg-muted); font-size: 13px; margin-top: 2px; max-width: 640px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--bg-active); color: var(--fg-muted); vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; flex: none; }
.pill.no-dot::before { display: none; }
.pill-neutral { background: var(--bg-active); color: var(--fg-muted); }
.pill-muted { background: transparent; color: var(--fg-faint); border: 1px dashed var(--border-strong); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-amber { background: var(--warn-soft); color: var(--warn); }
.pill-green { background: var(--ok-soft); color: var(--ok); }
.pill-red { background: var(--danger-soft); color: var(--danger); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; min-height: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 500; color: var(--fg-muted); font-size: 12px; white-space: nowrap; background: var(--bg); }
thead th { position: sticky; top: 0; z-index: 2; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.tbl-compact th, .tbl-compact td { padding: 6px 8px; }
.tbl-total td { font-weight: 600; background: var(--bg-subtle); }
.rate { display: block; font-size: 11px; color: var(--fg-faint); font-weight: 400; }

.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.th-sort:hover { color: var(--fg); background: var(--bg-hover); }
.sort-ind { font-size: 10px; width: 8px; color: var(--fg); }

/* Lead table */
.leads-table td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.leads-table tbody tr { cursor: pointer; }
.leads-table tbody tr:hover td { background: var(--bg-hover); }
.leads-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.leads-table tbody tr.selected td { background: var(--accent-soft); }
.leads-table th:first-child, .leads-table td:first-child { padding-left: 28px; }
.cell-name { display: flex; flex-direction: column; line-height: 1.25; }
.cell-name .name { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; }
.cell-name .sub, .cell-sub { font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; }
.table-wrap.loading { opacity: 0.55; transition: opacity 0.1s 0.15s; }

/* ---------- Leads toolbar ---------- */
.leads-head { padding: 16px 28px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { width: 300px; max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-group { display: inline-flex; align-items: center; border: 1px dashed var(--border-strong); border-radius: 999px; height: 26px; }
.chip-group.active { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.chip { font: inherit; font-size: 12px; background: none; border: 0; color: var(--fg-muted); height: 24px; padding: 0 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { color: var(--fg); }
.chip-group.active .chip { color: var(--fg); padding-right: 4px; }
.chip-group.active .chip b { font-weight: 600; }
.chip-x { font: inherit; border: 0; background: none; color: var(--fg-muted); cursor: pointer; height: 24px; width: 22px; border-radius: 999px; font-size: 14px; line-height: 1; }
.chip-x:hover { color: var(--fg); background: var(--bg-hover); }
.count { color: var(--fg-muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 8px; padding: 8px 28px; border-top: 1px solid var(--border); font-size: 12px; color: var(--fg-muted); }
.pager .spacer { flex: 1; }

/* Facet popover */
.popover { position: absolute; z-index: 40; width: 300px; max-height: 420px; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.popover-head { padding: 8px; border-bottom: 1px solid var(--border); }
.popover-head input { width: 100%; }
.popover-list { overflow: auto; padding: 4px; flex: 1; }
.popover-list label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.popover-list label:hover { background: var(--bg-hover); }
.popover-list label .v { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover-list label .n { color: var(--fg-faint); font-size: 12px; }
.popover-list input { margin: 0; accent-color: var(--accent); }
.popover-foot { display: flex; justify-content: space-between; padding: 6px 8px; border-top: 1px solid var(--border); }

/* ---------- Drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 30; overflow: auto; display: flex; flex-direction: column; }
.drawer-head { position: sticky; top: 0; background: var(--bg); z-index: 1; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.drawer-head .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drawer-head h2 { font-size: 16px; }
.drawer-head .sub { color: var(--fg-muted); font-size: 13px; overflow-wrap: anywhere; }
.drawer-body { padding: 14px 18px 40px; display: flex; flex-direction: column; gap: 18px; }
.drawer-body section { display: flex; flex-direction: column; gap: 8px; }
.drawer-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.note-form { display: flex; flex-direction: column; gap: 6px; }
.note-form .row { display: flex; gap: 6px; justify-content: flex-end; }

.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--fg-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--bg-active); color: var(--fg-muted); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 14px 22px; }
.tl-dot { position: absolute; left: 1px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border-strong); }
.tl-item.tone-blue .tl-dot { border-color: var(--blue); }
.tl-item.tone-green .tl-dot { border-color: var(--ok); background: var(--ok); }
.tl-item.tone-red .tl-dot { border-color: var(--danger); }
.tl-item.tone-purple .tl-dot { border-color: var(--purple); background: var(--purple); }
.tl-item.tone-amber .tl-dot { border-color: var(--warn); }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.tl-head time { color: var(--fg-faint); font-size: 12px; margin-left: auto; }
.tl-detail { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.tl-detail blockquote, .tl-detail .note, .tl-detail details { flex-basis: 100%; }
blockquote { margin: 4px 0 0; padding: 6px 10px; border-left: 2px solid var(--border-strong); color: var(--fg); background: var(--bg-subtle); border-radius: 0 6px 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.note { color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--fg); font-size: 13px; }
details > summary:hover { color: var(--accent); }
details[open] > summary { margin-bottom: 6px; }

/* ---------- Email rendering ---------- */
.email { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.email-meta { padding: 10px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 3px 8px; font-size: 13px; }
.email-meta dt { color: var(--fg-muted); }
.email-meta dd { margin: 0; overflow-wrap: anywhere; }
.email-body { padding: 14px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.email-body p { margin: 0 0 12px; }
.email-body p:last-child { margin-bottom: 0; }
.email-body ul { margin: 0 0 12px; padding-left: 20px; }
.email-body a { text-decoration: underline; }
.tl-detail .email-body { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--fg); background: var(--bg-subtle); font-size: 13px; }

/* ---------- Review ---------- */
.review-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .review-grid { grid-template-columns: 1fr; } }
.review-left { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.review-side { display: flex; flex-direction: column; gap: 12px; }
.review-side section { display: flex; flex-direction: column; gap: 6px; }
.review-side h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.review-side p { font-size: 13px; overflow-wrap: anywhere; }
.lint-list { margin: 0; padding-left: 18px; color: var(--danger); font-size: 13px; }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.points li { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.points li .src { font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shortcuts { color: var(--fg-muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.edit-area { min-height: 320px; font-size: 14px; }

/* ---------- Overview bits ---------- */
.reply-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.reply { padding: 10px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.reply:first-child { border-top: 0; padding-top: 0; }
.reply-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reply-main time { margin-left: auto; color: var(--fg-faint); font-size: 12px; }
.snippet { color: var(--fg-muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.reply-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.reply-actions .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; border-radius: 3px; background: var(--bg-active); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.full > span { background: var(--ok); }
.status-bars { display: flex; flex-direction: column; gap: 6px; }
.status-bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-block { display: flex; flex-direction: column; gap: 6px; }
.funnel-block + .funnel-block { border-top: 1px solid var(--border); padding-top: 12px; }
.funnel-block h3 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.funnel-block h3 .muted { font-weight: 400; font-size: 12px; }
.activity { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.activity li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); align-items: baseline; }
.activity li:first-child { border-top: 0; }
.activity time { color: var(--fg-faint); font-size: 12px; text-align: right; }
.activity .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sending ---------- */
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input[type="number"] { width: 72px; }
.ramp { display: flex; gap: 8px; flex-wrap: wrap; }
.ramp .step { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px; }
.ramp .step b { font-size: 14px; display: block; color: var(--fg); }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--border-strong); border-radius: 12px; padding: 0; width: min(820px, 94vw); max-height: 90vh; background: var(--bg); color: var(--fg); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 10, 15, 0.4); }
.dialog-form { display: flex; flex-direction: column; max-height: 90vh; }
.dialog-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.dialog-head h2 { flex: 1; font-size: 15px; }
.dialog-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.dialog-foot .left { margin-right: auto; color: var(--fg-muted); font-size: 12px; }
.form-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.preview-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.preview-stats .stat { padding: 8px 10px; }
.preview-stats .stat-value { font-size: 18px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, 90vw); }
.toast { background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); transition: opacity 0.2s, transform 0.2s; overflow-wrap: anywhere; }
.toast-error { background: var(--danger); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) { .toast-ok, .toast-error { color: #0d0d12; } }
.toast.leaving { opacity: 0; transform: translateY(6px); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; }
  .sidebar-foot { display: none; }
  .main-col { height: auto; min-height: 0; }
  .page { padding: 16px; }
  .leads-head, .pager { padding-left: 16px; padding-right: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
