/* Outreach Agent, styled after the Visibility.AI dashboard (apps/visibilityai).
   Tokens come from that app's src/ui/theme.js (C, SB, S), Sidebar.jsx, AppShell.jsx, Logo.jsx,
   SampleBanner.jsx, InlineNotice.jsx, DataTable.jsx and the Overview pages. It is light only,
   like the reference. */

/* Fonts: self-hosted variable woff2 (SIL OFL 1.1, licenses next to the files). */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations"),
       url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2-variations"),
       url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2");
}

:root {
  /* theme.js C */
  --bg: #f4f6f9; --surface: #ffffff; --s2: #f8f9fc; --s3: #edf0f5; --s4: #e4e7ed;
  --border: #dde1ea; --text: #1c2437; --t2: #374151; --t3: #566072; --t4: #c4cdd6;
  --accent: #7c3aed; --accent-l: #a78bfa; --accent-d: #5b21b6;
  --accent-08: #7c3aed14; --accent-06: #7c3aed0f; --accent-40: #7c3aed66; --accent-10: #7c3aed18;
  --success: #1aab6d; --danger: #d94040;
  --gradient: linear-gradient(135deg, #7A5AF8 0%, #6B21A8 100%);
  /* theme.js SB (sidebar) */
  --sb-bg: #fbfbfa; --sb-border: #ececeb; --sb-nav: #1f2937; --sb-t2: #6b7280; --sb-t3: #9ca3af;
  /* pills and notices (InlineNotice.jsx tones, SimpleDashboard Badge) */
  --ok-bg: #dcfce7; --ok-text: #15803d;
  --warn-bg: #fef3c7; --warn-text: #92400e;
  --bad-bg: #fee2e2; --bad-text: #b91c1c;
  --neutral-bg: #edf0f5; --neutral-text: #374151;
  --err-bg: #fef2f2; --err-border: #fecaca;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-logo: "Figtree", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --r-card: 12px; --r-notice: 10px; --r-input: 8px; --r-nav: 7px; --r-btn: 5px;
  --sidebar-w: 228px; --rail-w: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); line-height: 1.5;
  font-family: var(--font-body); font-size: 14px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; line-height: 1.2; margin: 0 0 18px; }
h2 { font-size: 17px; font-weight: 700; margin: 28px 0 12px; }
h3 { font-size: 15px; font-weight: 700; }
code { font-size: .9em; background: var(--s3); border-radius: 4px; padding: .05em .35em; }
.muted { color: var(--t3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
svg.icon { flex-shrink: 0; display: block; }

/* ---------- App shell: sidebar + title bar + page (Sidebar.jsx, AppShell.jsx) ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--sb-bg);
  border-right: 1px solid var(--sb-border); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; transition: width .15s;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 14px 8px; }
.sb-logo, .sb-logo:hover { text-decoration: none; min-width: 0; }
.icon-btn {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 0; background: transparent; color: var(--sb-t2); border-radius: 6px; padding: 0;
  cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: #f0f0ee; color: var(--sb-nav); }
.sb-menu { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sb-menu[open] { display: flex; }
.sb-toggle { display: none; }
.sb-toggle::-webkit-details-marker { display: none; }
.sb-toggle::marker { content: ""; }

.sb-product { padding: 4px 10px 10px; }
.sb-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--sb-t3); padding: 0 2px 5px;
}
.sb-product-box {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--sb-border);
  border-radius: 8px; padding: 7px 9px; background: #fff;
}
.sb-avatar {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent-08); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.sb-avatar-img { background: none; }
.sb-product-text { min-width: 0; }
.sb-product-name, .sb-product-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-product-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.sb-product-sub { font-size: 11px; color: var(--sb-t3); }

.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 10px; }
.sb-group { display: flex; flex-direction: column; gap: 2px; }
.sb-group-label { padding: 0 10px 3px; }
.sb-link {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-nav);
  font-family: var(--font-head); font-size: 15px; font-weight: 500; color: var(--sb-nav);
  background: transparent; text-decoration: none; border: 0; width: 100%; text-align: left;
  justify-content: flex-start;
  cursor: pointer; line-height: 1.4;
}
.sb-link:hover { background: #f0f0ee; text-decoration: none; }
.sb-link.active, .sb-link.active:hover { background: var(--accent-08); color: var(--accent); }
.sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-foot { border-top: 1px solid var(--sb-border); padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; margin: 0; }
.who { display: block; font-size: 12px; color: var(--sb-t2); padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-signout { font-size: 14px; color: var(--sb-t2); font-weight: 500; }
.sb-signout:hover { color: var(--sb-nav); }

/* Collapsed rail (wide screens only; toggled by app.js) */
@media (min-width: 901px) {
  .sb-collapsed .sidebar { width: var(--rail-w); }
  .sb-collapsed .sb-head { flex-direction: column; padding: 16px 0 8px; }
  .sb-collapsed .wordmark, .sb-collapsed .sb-label, .sb-collapsed .sb-product,
  .sb-collapsed .who { display: none; }
  .sb-collapsed .sb-link { justify-content: center; padding: 7px 0; }
  .sb-collapsed .sb-group-label { display: none; }
  /* The nav sits in <details>, whose content box doesn't shrink: a short window scrolls the
     whole sidebar instead, so Sign out stays reachable. */
  .sidebar { overflow-y: auto; }
  .sb-collapsed .sb-group + .sb-group { border-top: 1px solid var(--sb-border); padding-top: 8px; margin-top: 6px; }
}

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.titlebar {
  height: 56px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.titlebar-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page { padding: 40px 48px 64px; max-width: 1440px; width: 100%; }

/* ---------- Logo (Logo.jsx) ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { display: block; flex-shrink: 0; }
.wordmark {
  font-family: var(--font-logo); font-weight: 800; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text); white-space: nowrap;
}
.wordmark-ai { color: var(--accent); }

/* ---------- Signed-out pages: centered card with the logo ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-logo { margin-bottom: 22px; }
.auth-logo:hover { text-decoration: none; }
.auth-logo .wordmark { font-size: 21px; }
.auth-page > .notice, .auth-page > .alert { width: 100%; max-width: 420px; }

/* ---------- Cards (Overview.jsx / SimpleDashboard.jsx CARD + SECTION) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 20px; margin-bottom: 16px;
}
.card > h2, .card-head > h2, .card-title {
  font-family: var(--font-body); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--t3); margin: 0 0 12px; line-height: 1.4;
}
.card > h2 .muted, .card > h2 .small, .card-head > h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.card-head > h2 { margin: 0; }
.card-sub { color: var(--t3); font-size: 12.5px; margin: 0 0 14px; }
.more, a.more { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.card.narrow { width: 100%; max-width: 420px; margin: 0 auto; padding: 28px; box-shadow: 0 1px 2px rgba(28, 36, 55, .04), 0 8px 24px rgba(28, 36, 55, .06); }
.card.narrow h1 { font-size: 22px; margin-bottom: 6px; }
.card.narrow > .muted:last-child { margin-bottom: 0; font-size: 13px; }
.form-card { max-width: 560px; margin-top: 24px; }
.form-card > h2 { margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Stat tiles (Overview.jsx Stat) */
.tile {
  display: flex; flex-direction: column; gap: 2px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px;
}
a.tile:hover { border-color: var(--accent-l); text-decoration: none; box-shadow: 0 2px 10px rgba(124, 58, 237, .08); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); }
.stat { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--t3); }

/* ---------- Pills (SampleBanner.jsx pill; SimpleDashboard Badge colors) ---------- */
.chip, .pill {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; line-height: 1.5; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-text); vertical-align: middle;
  font-family: var(--font-body);
}
.chip-ok, .chip-qa_passed, .chip-interested, .chip-submitted, .chip-ready { background: var(--ok-bg); color: var(--ok-text); }
.chip-warn, .chip-held, .chip-captcha, .chip-manual, .chip-unconfirmed, .chip-question { background: var(--warn-bg); color: var(--warn-text); }
.chip-bad, .chip-error, .chip-failed, .chip-opt_out { background: var(--bad-bg); color: var(--bad-text); }
.chip-primary, .chip-pushed, .chip-form_task { background: var(--accent); color: #fff; }
.chip-neutral, .chip-found, .chip-enriched, .chip-verified, .chip-skipped, .chip-dry_run,
.chip-not_interested, .chip-other { background: var(--neutral-bg); color: var(--neutral-text); }
h1 .chip { font-size: 11px; position: relative; top: -3px; margin-left: 4px; }

/* ---------- Notices (SampleBanner.jsx notice, InlineNotice.jsx tones) ---------- */
.notice, .banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 11px 14px;
  border-radius: var(--r-notice); background: var(--accent-06); border: 1px dashed var(--accent-40);
  color: var(--t2); font-size: 13px; margin: 0 0 16px;
}
.notice { display: block; }
.notice p { margin: 0 0 8px; }
.notice pre.text { margin: 0; background: #fff; }
.banner > .pill { flex-shrink: 0; }
.banner-text { flex: 1; min-width: 200px; }
.banner-text strong { color: var(--text); }
.banner-live .pill { background: var(--ok-text); color: #fff; }
.banner-dry .pill { background: var(--accent); color: #fff; }
.banner-off .pill { background: var(--t3); color: #fff; }
/* PAUSED stays alarming: solid red border, red tint, red pill, bold red text. */
.banner-paused {
  background: var(--err-bg); border: 2px solid var(--danger); color: var(--bad-text);
  font-size: 14px; font-weight: 600; box-shadow: 0 0 0 3px rgba(217, 64, 64, .12);
}
.banner-paused .pill { background: var(--danger); color: #fff; font-size: 12px; padding: 3px 10px; }
.banner-paused strong, .banner-paused .banner-text strong { color: var(--bad-text); }
.banner-paused a { color: inherit; text-decoration: underline; }
.alert {
  background: var(--err-bg); border: 1px solid var(--err-border); color: var(--bad-text);
  padding: 11px 13px; border-radius: var(--r-notice); font-size: 13px; margin: 0 0 16px;
}
.alert ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.status-line { color: var(--t3); font-size: 12.5px; margin: 0 0 20px; }

/* ---------- Forms (theme.js S.input, S.label, S.btn, S.btnGhost) ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 600; color: var(--t2); }
label .small { font-weight: 400; color: var(--t3); }
input, select, textarea {
  font: inherit; font-size: 14px; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: var(--r-input); padding: 10px 12px; width: 100%;
}
input[readonly] { background: var(--s2); color: var(--t3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-08); }
textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
button, .button {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border);
  border-radius: var(--r-btn); padding: 9px 15px; background: #fff; color: var(--text);
  line-height: 1.3; text-decoration: none;
}
button:hover, .button:hover { border-color: var(--accent-l); color: var(--accent); text-decoration: none; }
button:focus-visible, .button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, .button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-size: 14px;
  font-weight: 700; padding: 10px 18px;
}
button.primary:hover, .button.primary:hover { background: var(--accent-d); border-color: var(--accent-d); color: #fff; }
button.danger { color: var(--bad-text); border-color: var(--err-border); }
button.danger:hover { background: var(--err-bg); border-color: var(--danger); color: var(--bad-text); }
button.sm { padding: 4px 10px; font-size: 12px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; padding: 6px 8px; font-size: 13px; }
.inline-form button { padding: 6px 12px; font-size: 12px; }

/* ---------- Tables (DataTable.jsx) inside a card ---------- */
.table-wrap {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.table-wrap.spaced { margin-top: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; vertical-align: top; }
td { border-top: 1px solid var(--border); color: var(--text); }
th {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--t3); white-space: nowrap; background: var(--s2); padding-top: 10px; padding-bottom: 10px;
}
tbody tr:hover td { background: #fcfcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.email { white-space: nowrap; }
td.reason { max-width: 18rem; color: var(--t2); }
td a { font-weight: 600; }
.status-cell { white-space: nowrap; }
.status-cell .inline-form { margin-left: 8px; }

/* ---------- Dashboard ---------- */
.panel-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Prospects ---------- */
.filters {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 16px; margin-bottom: 12px;
}
.filters .actions { gap: 12px; }
.filters .actions a { font-size: 13px; font-weight: 600; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 18px; font-size: 13px; }
.pager a { font-weight: 700; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--t3); font-size: 12px; font-weight: 600; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
pre.text {
  white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13.5px; line-height: 1.55;
  background: var(--s2); border: 1px solid var(--border); border-radius: var(--r-input);
  padding: 12px 14px; margin: 6px 0 16px; color: var(--t2);
}
.email h3 { font-size: 14px; margin: 16px 0 4px; }
.email:first-of-type h3 { margin-top: 4px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
.back { font-size: 13px; font-weight: 600; margin: 0 0 10px; }

/* ---------- Review / leads ---------- */
.review-item h3 { margin: 0 0 10px; font-size: 16px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.review-item h3 .muted { font-family: var(--font-body); font-weight: 500; }
.reasons { margin: 0 0 12px; padding: 10px 14px 10px 30px; color: var(--warn-text); background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r-notice); font-size: 13px; }
.review-item textarea { min-height: 6rem; }
.count { font-family: var(--font-body); font-weight: 500; color: var(--t3); font-size: 14px; }

/* ---------- Public report (/r/{slug}) ---------- */
.report-page { background: var(--bg); }
.report-header {
  background: var(--surface); border-bottom: 1px solid var(--border); height: 60px;
  display: flex; align-items: center; padding: 0 24px;
}
.report-header .wordmark { font-size: 18px; }
.report { max-width: 780px; margin: 0 auto; padding: 40px 20px 64px; }
.report-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; font-size: 12.5px; color: var(--t3); }
.report h1 { font-size: 30px; margin-bottom: 12px; }
.report .lead { font-size: 15.5px; color: var(--t2); line-height: 1.6; margin: 0 0 24px; }
.score { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; }
.score-num { font-family: var(--font-head); font-size: 36px; font-weight: 800; color: var(--accent); line-height: 1; }
.score-of { font-size: 14px; color: var(--t2); }
.questions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.questions li { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--s3); font-size: 13.5px; }
.questions li:first-child { border-top: 0; }
.questions .chip { flex-shrink: 0; min-width: 84px; text-align: center; }
.report .card ul:not(.questions) { margin: 0; padding-left: 1.15rem; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.report .card > p:last-child { margin-bottom: 0; }
.next-step { background: var(--accent-06); border: 1px dashed var(--accent-40); }
.next-step p { font-size: 14px; color: var(--t2); }
.report-foot { text-align: center; color: var(--t3); font-size: 12px; margin-top: 28px; }

/* ---------- Phone width: sidebar becomes a top bar with a menu toggle ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 20; border-right: 0;
    border-bottom: 1px solid var(--sb-border); background: var(--sb-bg);
  }
  .sb-head { padding: 12px 56px 12px 16px; min-height: 56px; }
  .sb-collapse { display: none; }
  .sb-toggle { display: flex; position: absolute; top: 13px; right: 12px; list-style: none; }
  .sb-menu[open] .sb-toggle { background: var(--accent-08); color: var(--accent); }
  .sb-menu[open] { border-top: 1px solid var(--sb-border); padding-top: 10px; box-shadow: 0 12px 24px rgba(28, 36, 55, .08); }
  .sb-nav { overflow: visible; }
  .titlebar { display: none; }
  .page { padding: 24px 16px 48px; }
}
@media (max-width: 480px) {
  /* iOS zooms in on focused fields under 16px (as in the reference index.html). */
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 23px; }
  .card { padding: 16px; }
  .card.narrow { padding: 22px 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { font-size: 21px; }
  th, td { padding: 9px 10px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dt { margin-top: 8px; }
  .review-item .actions button { flex: 1 1 auto; }
  .report h1 { font-size: 25px; }
  .report { padding-top: 28px; }
  .questions li { flex-direction: column; gap: 4px; }
}

/* The sidebar is sticky at viewport height; paint its column down the whole page as well, so a
   long page never shows the content background under it. */
@media (min-width: 901px) {
  .app { background: linear-gradient(to right, var(--sb-bg) calc(var(--sidebar-w) - 1px), var(--sb-border) calc(var(--sidebar-w) - 1px), var(--sb-border) var(--sidebar-w), transparent var(--sidebar-w)); }
  .sb-collapsed .app { background: linear-gradient(to right, var(--sb-bg) calc(var(--rail-w) - 1px), var(--sb-border) calc(var(--rail-w) - 1px), var(--sb-border) var(--rail-w), transparent var(--rail-w)); }
}
/* Narrow screens: tables keep readable columns and scroll sideways inside their card. */
@media (max-width: 900px) {
  .table-wrap table { min-width: 680px; }
}
td.wrap { overflow-wrap: break-word; }

/* ---------- Niches ---------- */
.actions.spaced-below { margin-bottom: 14px; }

/* ---------- Campaign setup form ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.setup .card { max-width: 980px; }
.check-grid {
  display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-height: 320px; overflow-y: auto; padding: 4px 2px; margin-bottom: 14px;
}
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; font-size: 13.5px; color: var(--text); }
label.check input { width: auto; margin-top: 3px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.row-form label { flex: 1 1 240px; }
.row-form button { padding-block: 12px; }   /* as tall as the text box beside it */
.row-form + .card-sub { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.city-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--s2); font-size: 13px;
}
button.chip-x { padding: 0 7px; border: 0; background: transparent; color: var(--t3); font-size: 16px; line-height: 1.2; border-radius: 999px; }
button.chip-x:hover { background: var(--s4); color: var(--bad-text); }
button.link.small { font-size: 12px; }
.city-add { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; margin-bottom: 14px; }
.city-add .stack { justify-content: space-between; }   /* the three Add buttons line up */
.city-add textarea { min-height: 5rem; }
label.min-pop { max-width: 320px; }
.options-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 14px; }
@media (min-width: 900px) { .options-grid > label:first-child { grid-column: span 2; } }
.preview-count { font-size: 15px; margin: 0 0 12px; }
.chip-active { background: var(--ok-bg); color: var(--ok-text); }
.chip-exhausted { background: var(--warn-bg); color: var(--warn-text); }
.chip-paused { background: var(--neutral-bg); color: var(--neutral-text); }

/* ---------- Campaign page grid (scrolls sideways inside its card) ---------- */
.actions.spaced-top { margin-top: 16px; }
.actions.spaced-top .inline-form button { padding: 9px 15px; font-size: 13px; }
.grid-wrap table { width: auto; min-width: 100%; }
.target-grid th, .target-grid td { white-space: nowrap; }
.target-grid th.grid-corner, .target-grid th.grid-niche { position: sticky; left: 0; z-index: 1; }
.target-grid th.grid-niche {
  background: var(--surface); text-transform: none; letter-spacing: 0; font-size: 13.5px;
  color: var(--text); border-top: 1px solid var(--border);
}
.target-grid td.cell { min-width: 128px; font-size: 12.5px; }
.cell-counts { display: flex; flex-direction: column; gap: 1px; color: var(--t2); }
.cell-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.cell-foot .inline-form { flex-basis: 100%; }   /* the button always on its own line */
.target-grid td.cell-exhausted, .target-grid tbody tr:hover td.cell-exhausted { background: var(--warn-bg); }
.target-grid td.cell-paused, .target-grid tbody tr:hover td.cell-paused { background: var(--neutral-bg); }
.target-grid td.cell-paused .cell-counts { color: var(--t3); }
.target-grid td.cell-expanded { box-shadow: inset 3px 0 0 var(--accent-l); }
.cell-mark { font-size: 10.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Forms report ---------- */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0 0 16px;
  background: var(--s3); border-radius: var(--r-input);
}
.seg-item { padding: 6px 12px; border-radius: var(--r-nav); font-size: 13px; font-weight: 600; color: var(--t2); }
.seg-item:hover { color: var(--accent); text-decoration: none; }
.seg-item.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(28, 36, 55, .08); }
a.tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-08); }
.forms-table td.business { min-width: 9rem; }
.forms-table td.campaign { min-width: 9rem; }
.forms-table td.form-url { max-width: 10rem; }
.forms-table td.form-url a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forms-table td.reason { min-width: 12rem; max-width: 18rem; }
.form-msg { margin-top: 6px; }
.form-msg summary { font-size: 12px; }
.form-msg pre.text { margin: 6px 0 0; font-size: 12.5px; }
@media (max-width: 900px) {
  .table-wrap table.forms-table { min-width: 900px; }
}

/* ---------- Campaign list: grouped columns ---------- */
.campaign-table .group-row th { padding-top: 8px; padding-bottom: 0; }
.campaign-table th.group { text-align: left; color: var(--accent); border-left: 1px solid var(--border); }
.campaign-table .group-start { border-left: 1px solid var(--border); }
.campaign-table th.legend { text-transform: none; letter-spacing: 0; font-weight: 600; }
.campaign-table td.trio { font-variant-numeric: tabular-nums; }
.footnote { color: var(--t3); font-size: 12px; margin: 10px 2px 0; }
.chip-ch-email { background: var(--accent-08); color: var(--accent-d); }
.chip-ch-form { background: #e0f2fe; color: #075985; }
.chip-ch-both { background: var(--ok-bg); color: var(--ok-text); }

/* ---------- Campaign page: results and grid cells ---------- */
.results { display: grid; gap: 18px; }
.result-block h3 { font-size: 13px; margin: 0 0 8px; }
.result-block h3 .muted { font-weight: 500; }
.ch {
  display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 4px; padding: 0 5px;
  line-height: 1.6; background: var(--neutral-bg); color: var(--neutral-text); font-variant-numeric: tabular-nums;
}
.ch-email { background: var(--accent-08); color: var(--accent-d); }
.ch-form { background: #e0f2fe; color: #075985; }
.ch-both { background: var(--ok-bg); color: var(--ok-text); }
.cell-found { font-weight: 700; color: var(--text); }
.cell-split { display: flex; gap: 4px; margin: 3px 0 6px; }
.cell-stats { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; margin: 0; color: var(--t2); }
.cell-stats dt { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--t3); padding-top: 2px; }
.cell-stats dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0 8px; white-space: normal; max-width: 15rem; }
.cell-stats dd span { white-space: nowrap; }
.target-grid tfoot th, .target-grid tfoot td { border-top: 2px solid var(--border); background: var(--s2); }
.cell-total { white-space: normal; font-size: 12.5px; color: var(--t2); }
.cell-total span { display: inline-block; margin-right: 14px; white-space: nowrap; }
sup { font-size: .7em; line-height: 0; }

/* ---------- Prospect page: GHL timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item {
  display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 4px 14px; align-items: baseline;
  padding: 9px 0 9px 14px; border-top: 1px solid var(--border); position: relative; font-size: 13.5px;
}
.tl-item:first-child { border-top: 0; }
.tl-item::before { content: ""; position: absolute; left: 0; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-l); }
.tl-reply::before { background: var(--success); }
.tl-when { color: var(--t3); font-size: 12.5px; white-space: nowrap; }
.tl-subject { color: var(--t2); overflow-wrap: anywhere; }
.chip-d-sent { background: var(--neutral-bg); color: var(--neutral-text); }
.chip-d-delivered { background: var(--accent-08); color: var(--accent-d); }
.chip-d-opened, .chip-d-clicked { background: var(--ok-bg); color: var(--ok-text); }
.chip-d-bounced, .chip-d-failed { background: var(--bad-bg); color: var(--bad-text); }
.card-head .button.sm { padding: 6px 12px; font-size: 12.5px; }
@media (max-width: 480px) {
  .tl-item { grid-template-columns: 1fr auto; }
  .tl-when { grid-column: 1 / -1; }
}
.panel-sub { font-size: 12px; font-weight: 700; color: var(--t2); margin: 14px 0 8px; }
.panel-sub:first-of-type { margin-top: 4px; }
.chip-muted { background: transparent; color: var(--t3); border: 1px solid var(--border); }
.campaign-table th, .campaign-table td { padding-left: 10px; padding-right: 10px; }
.campaign-table td:first-child { white-space: nowrap; }
.campaign-table td:nth-child(2) { min-width: 11rem; }
.campaign-table th.legend { white-space: normal; min-width: 7rem; }
.target-grid td.cell { min-width: 15rem; }
@media (max-width: 480px) {
  .campaign-table td:nth-child(2) { min-width: 8rem; }
  .target-grid td.cell { min-width: 13.5rem; }
}
.prow td:first-child { min-width: 9rem; }

/* ---------- Tags, lists, views and the bulk bar (Plan 6) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-text); border: 1px solid transparent;
}
.tag-purple { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.tag-blue   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.tag-teal   { background: #ccfbf1; color: #115e59; border-color: #99f6e4; }
.tag-green  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.tag-amber  { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.tag-orange { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.tag-red    { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.tag-pink   { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.tag-gray   { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.tags-cell { min-width: 7rem; }
.tags-cell .tag { margin: 0 4px 4px 0; }
.bad-text { color: var(--bad-text); }
.warn-text { color: var(--warn-text); font-weight: 600; }

/* Filter: "Tags" multi-select built from <details> + checkboxes (works without JS) */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--t2); }
.field-label .small { font-weight: 400; color: var(--t3); }
.multi { position: relative; }
.multi > summary {
  list-style: none; color: var(--text); font-weight: 400; font-size: 14px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--r-input); padding: 10px 32px 10px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--t3); border-bottom: 2px solid var(--t3); transform: rotate(45deg);
}
.multi[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-08); }
.multi-panel, .menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: 0 12px 32px rgba(28, 36, 55, .14); padding: 10px;
}
.multi-panel { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }

/* Toolbar above the table: count + Views menu */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 10px; }
.toolbar .card-sub { margin: 0; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary.button.sm, .row-actions .button.sm { padding: 6px 12px; font-size: 12.5px; }
.menu[open] > summary { border-color: var(--accent); color: var(--accent); }
.menu-panel { left: auto; right: 0; width: 300px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 2px; }
.menu-section { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--t3); padding: 6px 8px 2px; }
.menu-link { display: block; padding: 6px 8px; border-radius: var(--r-nav); color: var(--text); font-size: 13.5px; font-weight: 500; }
.menu-link:hover { background: var(--accent-08); color: var(--accent); text-decoration: none; }
.menu-empty { margin: 2px 8px 6px; }
.menu-form { border-top: 1px solid var(--border); margin-top: 8px; padding: 10px 2px 2px; gap: 10px; }
.menu-form input:not([type=checkbox]):not([type=radio]) { padding: 8px 10px; }
.menu-form .actions a { font-weight: 600; }

/* Bulk bar */
.bulk {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px 16px; margin: 0 0 12px;
}
.bulk-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; border: 0; padding: 0; margin: 0; }
.bulk-scope legend { float: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); margin-right: 4px; padding: 0; }
.bulk-scope label.check { font-size: 13px; align-items: center; }
.bulk-scope label.check input { margin-top: 0; }
.bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bulk-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); margin-right: 2px; }
.bulk-row select, .bulk-row input { width: auto; padding: 6px 8px; font-size: 13px; }
.bulk-row input { width: 9.5rem; }
.bulk-row button.sm, .add-form button.sm { padding: 6px 11px; }
.select-cell { width: 34px; padding-right: 0; }
.select-cell input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.prospect-table tr:has(.select-cell input:checked) td { background: var(--accent-06); }
button.danger-fill { background: var(--danger); border-color: var(--danger); }
button.danger-fill:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Lists and Tags pages */
.table-wrap.flush { border: 0; border-radius: 0; margin: 0 -20px -20px; border-top: 1px solid var(--border); }
.card > .table-wrap.flush { border-bottom-left-radius: var(--r-card); border-bottom-right-radius: var(--r-card); }
.row-actions { text-align: right; width: 1%; white-space: nowrap; }
.row-actions .menu-panel { text-align: left; white-space: normal; }
.row-actions .menu-form:first-child { border-top: 0; margin-top: 0; padding-top: 2px; }
.sync-note { margin-top: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.swatches legend { font-size: 12px; font-weight: 600; color: var(--t2); padding: 0; margin-bottom: 7px; }
.swatch-pick { flex-direction: row; align-items: center; gap: 4px; font-weight: 500; }
.swatch-pick input { width: auto; accent-color: var(--accent); }
.tags-table td { vertical-align: middle; }

/* Prospect page / drawer: tags and lists */
.tl-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: 8px 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--s3); }
.tl-row:first-of-type { border-top: 0; padding-top: 4px; }
.tl-label { font-size: 12px; font-weight: 600; color: var(--t3); padding-top: 4px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 26px; }
.tag-remove { display: inline-flex; margin: 0; }
.tag-remove .tag { padding-right: 3px; }
button.tag-x {
  border: 0; background: transparent; color: inherit; opacity: .6; padding: 0 4px; font-size: 14px;
  line-height: 1; border-radius: 999px; font-weight: 700;
}
button.tag-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); color: inherit; }
.list-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 3px 1px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--s2); font-size: 12.5px; line-height: 1.6;
}
.list-chip a { font-weight: 600; }
.add-form { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.add-form select, .add-form input { width: auto; flex: 1 1 9rem; min-width: 0; padding: 6px 8px; font-size: 13px; }
details.fold { border-top: 1px solid var(--s3); padding: 8px 0; }
details.fold:first-of-type { border-top: 0; }
details.fold summary { color: var(--text); font-weight: 600; }
details.fold pre.text { margin-bottom: 4px; }
.drawer-more { margin: 12px 0 0; font-size: 13px; font-weight: 600; }

@media (max-width: 480px) {
  .bulk { padding: 12px; }
  .bulk-row input { width: 8rem; }
  .tl-row { grid-template-columns: 1fr; }
  .add-form { grid-column: 1; }
  .table-wrap.flush { margin: 0 -16px -16px; }
}

/* ---------- Prospect drawer (Visibility.AI src/components/Drawer.jsx) ---------- */
@keyframes vaDrawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes vaDrawerFade { from { opacity: 0; } to { opacity: 1; } }
body.drawer-open { overflow: hidden; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 340;
  animation: vaDrawerFade .18s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 350; width: 560px; max-width: 100vw;
  background: #fff; border-left: 1px solid var(--border); box-shadow: -8px 0 32px rgba(0, 0, 0, .16);
  display: flex; flex-direction: column; animation: vaDrawerIn .22s ease;
}
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
.drawer-heading { min-width: 0; }
.drawer-title {
  font-family: var(--font-head); font-size: 18px; font-weight: 800; color: var(--text);
  margin: 0 0 6px; line-height: 1.3; overflow-wrap: anywhere; text-transform: none; letter-spacing: -0.01em;
}
.drawer-title:focus { outline: none; }
.drawer-title:focus-visible { outline: none; }   /* a heading takes focus only so the dialog is announced */
.drawer-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin: -4px -6px 0 0; }
.drawer-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 6px; font-size: 22px; line-height: 1; color: var(--t2); padding: 4px;
}
span.drawer-btn { color: var(--t4); }
a.drawer-btn:hover { background: var(--s3); color: var(--text); text-decoration: none; }
.drawer-body {
  flex: 1; overflow-y: auto; padding: 20px; background: var(--bg);
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.drawer-body .card { padding: 16px; margin-bottom: 12px; }
.drawer-body .card:last-child { margin-bottom: 0; }
.drawer-body .tl-item { grid-template-columns: 8rem 1fr auto; }
.drawer-status { margin: 0 0 12px; }
@media (max-width: 600px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding-left: 16px; padding-right: 16px; }
  .drawer-body { padding: 16px; }
  .drawer-body .tl-item { grid-template-columns: 1fr auto; }
  .drawer-body .tl-when { grid-column: 1 / -1; }
}
/* The checkbox column replaced the business as the first cell. */
.prospect-table td.select-cell, .prospect-table th.select-cell { min-width: 0; width: 36px; padding-left: 14px; padding-right: 4px; }
.prospect-table td.select-cell + td { min-width: 9rem; }
.tags-cell { min-width: 8rem; max-width: 12rem; }
.prospect-table td.reason { max-width: 14rem; }
.add-form { max-width: 34rem; }

/* ---------- Forms to do: one card per form a person must send ---------- */
.sb-link .sb-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-family: var(--font-body); font-size: 11px;
  font-weight: 700; line-height: 20px; text-align: center; flex-shrink: 0;
}
.sb-collapsed .sb-link { position: relative; }
.sb-collapsed .sb-link .sb-badge { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
.tile-todo { border-color: var(--accent-40); background: var(--accent-06); }
.todo-card { display: flex; flex-direction: column; gap: 14px; }
.todo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.todo-title { min-width: 0; flex: 1 1 260px; }
.card > .todo-head h2.todo-name, h2.todo-name {
  font-family: var(--font-head); font-size: 17px; font-weight: 700; text-transform: none;
  letter-spacing: -0.01em; color: var(--text); margin: 0 0 2px; overflow-wrap: anywhere;
}
.todo-name a { color: var(--text); }
.todo-name a:hover { color: var(--accent); }
.todo-meta { font-size: 12.5px; color: var(--t3); overflow-wrap: anywhere; }
.todo-open { white-space: nowrap; }
.todo-reason { margin: 0; font-size: 13.5px; color: var(--t2); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; }
.todo-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.todo-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.todo-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); }
.copy-btn { padding: 4px 12px; font-size: 12px; }
.copy-btn.copied { color: var(--ok-text); border-color: var(--ok-text); }
.todo-text { width: 100%; resize: vertical; background: var(--s2); font-size: 13.5px; line-height: 1.55; min-height: 8.5rem; cursor: text; }
.todo-values { background: var(--s2); border: 1px solid var(--s3); border-radius: var(--r-input); padding: 12px 14px; }
.todo-values dd { font-weight: 600; color: var(--text); }
.todo-values dd .muted { font-weight: 400; }
.todo-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; border-top: 1px solid var(--s3); padding-top: 14px; }
.todo-fail input { width: 240px; padding: 6px 10px; font-size: 13px; }
@media (max-width: 720px) {
  .todo-body { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .todo-open { width: 100%; text-align: center; }
  .todo-actions .inline-form { width: 100%; }
  .todo-actions .inline-form button { flex: 1 1 auto; }
  .todo-fail { flex-wrap: wrap; }
  .todo-fail input { flex: 1 1 100%; width: auto; }
}

/* ---------- Emails report ---------- */
.stat-row { display: flex; align-items: baseline; gap: 8px; }
.stat-pct { font-size: 13px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.approx { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--warn-text); }
.step-table td, .step-table th { padding: 8px 12px; }
.step-table td.num { white-space: nowrap; }
.due-list { list-style: none; margin: 0; padding: 0; }
.due-item { border-top: 1px solid var(--border); padding: 9px 0; font-size: 13.5px; }
.due-item:first-child { border-top: 0; padding-top: 0; }
.due-item summary { cursor: pointer; color: var(--t2); }
.due-when { font-weight: 700; color: var(--text); }
.due-overdue .due-when { color: var(--warn-text); }
.due-names { margin: 8px 0 2px; line-height: 1.7; color: var(--t2); }
.due-names a { font-weight: 600; }
.emails-table th, .emails-table td { padding-left: 10px; padding-right: 10px; }
.emails-table td.business { min-width: 8rem; }
.emails-table td.email { white-space: normal; max-width: 14rem; }
.emails-table td.subject { min-width: 10rem; max-width: 16rem; color: var(--t2); overflow-wrap: anywhere; }
.emails-table td.campaign { min-width: 8rem; }
.emails-table .step-name { font-weight: 600; }
.th-sub { text-transform: none; letter-spacing: 0; font-weight: 500; }
@media (max-width: 900px) {
  .table-wrap table.emails-table { min-width: 1000px; }
  .emails-table td.email { white-space: nowrap; max-width: none; }
  .table-wrap table.step-table { min-width: 560px; }
}

/* ---------- Autopilot ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.page-head h1 { margin: 0; }
.lead { color: var(--t2); font-size: 13.5px; max-width: 72ch; margin: 0 0 20px; line-height: 1.6; }
.section-title { font-size: 15px; margin: 26px 0 12px; }
.proposals { display: flex; flex-direction: column; gap: 12px; }
.proposal { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-notice); padding: 14px 16px; background: var(--s2); }
.proposal-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.proposal-plan { font-weight: 700; font-size: 13.5px; color: var(--text); }
.proposal-reason { margin: 0 0 10px; color: var(--t2); font-size: 13.5px; }
.proposal-facts { margin-bottom: 10px; }
.estimate { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; font-size: 12.5px; color: var(--t2); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r-input); padding: 8px 12px; margin-bottom: 10px; }
.estimate-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--warn-text); background: var(--warn-bg); border-radius: 4px; padding: 1px 6px; }
.estimate strong { color: var(--text); font-size: 13.5px; }
.chip-kind-start_campaign { background: var(--accent-10); color: var(--accent-d); }
.chip-kind-shift_volume { background: var(--warn-bg); color: var(--warn-text); }
.chip-kind-expand_area, .chip-kind-complete_plan { background: var(--ok-bg); color: var(--ok-text); }
.chip-event-pause_campaign, .chip-event-pause_target, .chip-event-pause_niche { background: var(--bad-bg); color: var(--bad-text); }
.chip-event-goal_reached, .chip-event-approved, .chip-event-auto_approved, .chip-event-resumed { background: var(--ok-bg); color: var(--ok-text); }
.chip-event-forms_alert { background: var(--warn-bg); color: var(--warn-text); }
.chip-event-proposed { background: var(--accent-10); color: var(--accent-d); }
.plan-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.plan-grid .card { margin-bottom: 0; }
.plan-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.plan-name { margin: 0; font-size: 16px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.progress-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--t2); margin-bottom: 4px; }
.progress-label .muted { font-weight: 500; white-space: nowrap; }
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--s3); overflow: hidden; color: var(--accent); }
progress::-webkit-progress-bar { background: var(--s3); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--gradient); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--gradient); border-radius: 99px; }
.plan-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--s3); }
.plan-actions .button, .plan-actions button { padding: 6px 12px; font-size: 12px; }
.paused-list { list-style: none; margin: 0; padding: 0; }
.paused-item { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; border-top: 1px solid var(--s3); padding: 10px 0; font-size: 13.5px; }
.paused-item:first-child { border-top: 0; padding-top: 0; }
.paused-reason { flex: 1 1 260px; color: var(--t2); }
.event-table td.event-reason { color: var(--t2); min-width: 16rem; overflow-wrap: anywhere; }
.event-table td.event-reason a { margin-left: 4px; }
.autopilot-banner { border: 1px solid var(--warn-bg); background: #fffbeb; border-radius: var(--r-notice); padding: 12px 14px; margin-bottom: 16px; }
.autopilot-banner > strong { display: block; margin-bottom: 4px; color: var(--warn-text); font-size: 13px; }
.ap-list { margin: 14px 0 0; padding-left: 1.1rem; color: var(--t2); font-size: 13px; }
.ap-list li { margin: 2px 0; }
@media (max-width: 900px) {
  .table-wrap table.event-table { min-width: 720px; }
}
@media (max-width: 480px) {
  .page-head .button { width: 100%; }
  .proposal .actions .inline-form { flex: 1 1 auto; }
  .proposal .actions button { width: 100%; }
}
.card-sub.spaced-top { margin-top: 14px; }

/* ---------- Niche picker (campaign and plan forms) and Niches page filters ---------- */
[hidden] { display: none !important; }
.np-selected-box { margin-bottom: 14px; }
.np-selected-box .panel-sub .small { font-weight: 500; }
.np-selected { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.np-sel {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; max-width: 100%;
  border: 1px solid var(--accent-40); border-radius: 999px; background: var(--accent-06);
  font-size: 13px; font-weight: 600; color: var(--accent-d);
}
.np-sel-name { overflow-wrap: anywhere; margin-right: 4px; }
.np-ordered { counter-reset: np; }
.np-ordered .np-sel { counter-increment: np; }
.np-ordered .np-sel::before {
  content: counter(np); display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; margin: 0 6px 0 -4px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
}
button.np-move { padding: 0 6px; border: 0; background: transparent; color: var(--accent-d); font-size: 14px; line-height: 1.3; border-radius: 999px; }
button.np-move:hover { background: var(--accent-10); color: var(--accent); }
.np-ordered .np-sel:first-child .np-up, .np-ordered .np-sel:last-child .np-down { display: none; }
.np-toolbar {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; margin-bottom: 12px;
  background: var(--s2); border: 1px solid var(--s3); border-radius: var(--r-notice);
}
.np-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.np-search-label { flex: 1 1 240px; }
.np-search button { padding-block: 10px; }
.np-search button.link { padding-block: 10px; }
.np-clear-link { font-size: 12px; font-weight: 600; padding-bottom: 12px; }
.np-chips { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.np-chips legend { float: left; font-size: 11px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .05em; margin-right: 4px; padding: 0; }
label.np-chip { display: inline-flex; flex-direction: row; position: relative; font-size: 12.5px; font-weight: 600; color: var(--t2); cursor: pointer; }
label.np-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
label.np-chip > span {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; white-space: nowrap;
}
label.np-chip:hover > span { border-color: var(--accent-l); color: var(--accent); }
label.np-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
label.np-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.np-chip-n { font-size: 11px; font-weight: 500; opacity: .75; }
.np-chip-toggle { margin-left: auto; }
.np-count { margin: 0; font-size: 12.5px; color: var(--t3); }
.np-list { max-height: 420px; overflow-y: auto; padding: 0 2px; margin-bottom: 14px; border-bottom: 1px solid var(--s3); }
.np-group-head {
  position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 0 6px; background: var(--surface);
  font-size: 11px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .05em;
}
.np-grid { display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); padding-bottom: 10px; }
.np-no-match { margin: 10px 0; }
.np-page-filter .np-toolbar { margin-bottom: 16px; }
@media (max-width: 480px) {
  .np-toolbar { padding: 10px; }
  .np-chip-toggle { margin-left: 0; }
  label.np-chip > span { white-space: normal; }
  .np-list { max-height: 60vh; }
  .np-search > button { flex: 1 1 auto; }
}
/* ---------- Runs ---------- */
.run-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 8px; }
.run-cards .card { margin: 0; display: flex; flex-direction: column; }
.run-card .card-sub { margin-bottom: 12px; }
.run-card .run-start { margin-top: auto; padding-top: 14px; }
.preflight { font-size: 13px; color: var(--t2); }
.preflight-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pill-ok { background: var(--ok-text); color: #fff; }
.pill-dry { background: var(--accent); color: #fff; }
.pill-bad { background: var(--danger); color: #fff; }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.preflight-line { margin: 0 0 6px; }
.preflight-reps { margin: 4px 0 6px; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 3px; }
.preflight-warn { margin: 6px 0 0; color: var(--warn-text); background: var(--warn-bg); border-radius: var(--r-input); padding: 6px 10px; }
.run-confirm .preflight { margin-bottom: 16px; }
.banner-running .pill { background: var(--accent); color: #fff; }
button[disabled], button[disabled]:hover { opacity: .55; cursor: not-allowed; }
button.primary[disabled]:hover { background: var(--accent); border-color: var(--accent); }
.runs-table td.run-summary { min-width: 16rem; }
.runs-table details summary { font-weight: 500; color: var(--text); }
.runs-table details[open] summary { color: var(--accent); }
pre.run-log { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; max-height: 24rem; overflow: auto; white-space: pre-wrap; margin: 8px 0 0; }
.last-runs { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--t3); }
.last-runs strong { color: var(--t2); font-weight: 600; }

/* ---------- Autopilot: tabs, schedule, the combined history ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 22px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; font-family: var(--font-head); font-size: 14px;
  font-weight: 600; color: var(--t2); white-space: nowrap;
}
.tab:hover { color: var(--accent); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent);
  color: #fff; font-family: var(--font-body); font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center;
}
.schedule { margin: 0; display: grid; gap: 0; }
.schedule-row {
  display: grid; grid-template-columns: minmax(8rem, 11rem) minmax(10rem, 1fr) minmax(12rem, 1.3fr);
  gap: 4px 16px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--s3); font-size: 13.5px;
}
.schedule-row:first-child { border-top: 0; padding-top: 0; }
.schedule-row dt { font-weight: 600; color: var(--text); }
.schedule-row dd { margin: 0; }
.schedule-when { color: var(--t2); }
.schedule-last { color: var(--t3); font-size: 12.5px; }
.schedule-last .last-run-failed { color: var(--bad-text); }
.chip-run { background: var(--accent-08); color: var(--accent); }
.history-table td.run-summary, .history-table td.event-reason { min-width: 16rem; color: var(--t2); overflow-wrap: anywhere; }
.history-table td.event-reason a { margin-left: 4px; }
.history-table details summary { font-weight: 500; color: var(--text); cursor: pointer; }
.history-table details[open] summary { color: var(--accent); }
.history-table td .chip + .chip { margin-left: 4px; }
@media (max-width: 900px) {
  .table-wrap table.history-table { min-width: 760px; }
}
@media (max-width: 640px) {
  .schedule-row { grid-template-columns: 1fr; gap: 2px; }
}
