/* ──────────────────────────────────────────────────────
   upstat / outreach — operations terminal × editorial
   ────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* palette — near-black, grayscale ramp, one acidic accent */
  --bg:           #0a0a0a;
  --surface:      #111111;
  --surface-2:   #161616;
  --surface-3:   #1d1d1d;
  --border:       #232323;
  --border-bright:#3a3a3a;

  --text:         #f5f5f4;
  --text-dim:     #a3a3a3;
  --text-faint:   #525252;
  --text-ghost:   #2e2e2e;

  --accent:       #d4ff00;   /* electric lime — used sparingly */
  --accent-glow:  rgba(212, 255, 0, 0.18);
  --accent-deep:  #6a8000;

  --success:      #84cc16;
  --danger:       #ef4444;
  --warn:         #f59e0b;

  /* type */
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans:  'Geist', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
}

/* ──────── reset ──────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 255, 0, 0.04), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg));
}

/* faint dot grid in the background — barely there */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--text-ghost) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* film-grain veil via SVG noise — extremely subtle */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.6'/></svg>");
}

main {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-6) var(--s-9);
}

/* ──────── typography ──────── */
h1, h2, h3 { font-weight: 400; letter-spacing: -0.01em; margin: 0; }

.display {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--text-faint);
}

.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); font-style: italic; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.hidden { display: none !important; }

a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--text-faint); transition: border-color 120ms; }
a:hover { border-color: var(--accent); }
a.bare { border: 0; }

/* ──────── topbar ──────── */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
}

.brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
  border: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.brand::after {
  content: 'outreach.v1';
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transform: translateY(-2px);
}

.topbar nav {
  display: flex;
  gap: var(--s-1);
  margin-left: var(--s-5);
}
.topbar nav a {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  position: relative;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--text); }
.topbar nav a.active::before {
  content: '';
  position: absolute;
  left: 12px; right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.topbar .logout { margin-left: auto; }
.topbar .logout button {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 140ms;
}
.topbar .logout button:hover {
  color: var(--text);
  border-color: var(--border-bright);
}

/* ──────── page header ──────── */
.page-head {
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-7);
  animation: fade-rise 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.page-head h1 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 56px;
  line-height: 1;
  margin-top: var(--s-3);
}
.page-head p {
  margin: var(--s-4) 0 0;
  color: var(--text-dim);
  max-width: 56ch;
}

/* ──────── section header ──────── */
.section {
  margin-top: var(--s-8);
  animation: fade-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.section + .section { margin-top: var(--s-7); }
.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.section-head .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}
.section-head h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
}
.section-head .meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}

/* ──────── hero stat (dashboard) ──────── */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--s-6);
  padding: var(--s-7) 0 var(--s-5);
  border-bottom: 1px solid var(--border);
  animation: fade-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero .stat-big {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(120px, 18vw, 200px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  color: var(--text);
  position: relative;
}
.hero .stat-big.empty { color: var(--text-faint); }
.hero .stat-big .unit {
  font-family: var(--mono);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: var(--s-3);
  display: inline-block;
  vertical-align: 14%;
}
.hero .stat-context {
  text-align: right;
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  line-height: 1.2;
  color: var(--text-dim);
  max-width: 22ch;
}

/* mini stats row */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: var(--s-5) 0 var(--s-3);
  border-top: 1px solid var(--border);
}
.mini-stats .item {
  padding: var(--s-4) 0;
  border-right: 1px solid var(--border);
  padding-left: var(--s-4);
}
.mini-stats .item:first-child { padding-left: 0; }
.mini-stats .item:last-child { border-right: 0; }
.mini-stats .k {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.mini-stats .v {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.mini-stats .v.dim { color: var(--text-dim); }

/* ──────── action list (dashboard) ──────── */
.action-list { display: flex; flex-direction: column; }
.action-list .row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-3);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  transition: background 160ms, border-color 160ms, padding 160ms;
  border-bottom-style: solid;
  border-radius: 0;
}
.action-list .row:first-child { border-top: 1px solid var(--border); }
.action-list .row:hover {
  background: var(--surface);
  padding-left: var(--s-5);
  border-left-color: var(--accent);
}
.action-list .row .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
.action-list .row .body h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.action-list .row .body p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13.5px;
}
.action-list .row .arrow {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--text-faint);
  transition: transform 160ms, color 160ms;
}
.action-list .row:hover .arrow { transform: translateX(6px); color: var(--accent); }

/* ──────── form ──────── */
.form-grid { display: grid; gap: var(--s-4); }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}
.field .hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

input[type=text], input[type=email], input[type=password], input[type=number], textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 4px;
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  transition: border-color 140ms, background 140ms;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ──────── buttons ──────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid var(--border-bright);
  color: var(--text);
  background: var(--surface);
  border-radius: 4px;
  transition: all 140ms;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text); background: var(--surface-2); }

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
  background: #e5ff33;
  border-color: #e5ff33;
  color: #0a0a0a;
}
.btn-primary::after {
  content: '↵';
  font-style: normal;
  font-weight: 700;
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text-dim);
  background: transparent;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); }

.btn-danger {
  border-color: var(--border);
  color: var(--danger);
}
.btn-danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ──────── login ──────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  position: relative;
  z-index: 2;
}
.login-card {
  width: 100%;
  max-width: 440px;
}
.login-card .brand-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 88px;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: var(--s-2);
}
.login-card .tagline {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-faint);
  margin-bottom: var(--s-7);
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-card .tagline::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.login-card .prompt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.login-card .prompt::before {
  content: '$';
  color: var(--accent);
}
.login-card form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-2);
}
.login-card .footer-note {
  margin-top: var(--s-5);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.login-card .err {
  margin-top: var(--s-3);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-card .err::before { content: '!'; color: var(--danger); }

/* ──────── progress / terminal log ──────── */
.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.terminal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}
.terminal-head .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-ghost);
}
.terminal-head .dot.live {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.terminal-body {
  padding: var(--s-4);
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}
.terminal-body:empty::before {
  content: '// awaiting input';
  color: var(--text-ghost);
  font-style: italic;
}
.terminal-body .log-line { color: var(--text); margin-bottom: 4px; }
.terminal-body .log-line::before { content: '› '; color: var(--text-faint); }
.terminal-body .item {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 2px;
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 10px;
}
.terminal-body .item .idx { color: var(--text-faint); }
.terminal-body .item .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terminal-body .item .status.ok { color: var(--accent); }
.terminal-body .item .status.fail { color: var(--danger); }
.terminal-body .done {
  color: var(--accent);
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--border);
}
.terminal-body .done::before { content: '✓ '; }
.terminal-body .fatal {
  color: var(--danger);
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--border);
}
.terminal-body .fatal::before { content: '✗ '; }
.summary { margin-top: var(--s-3); font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* ──────── split layout (scrape) ──────── */
.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-5);
}
.panel-head {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.panel-tag {
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 6px;
  letter-spacing: 0.16em;
}

/* ──────── scrape form ──────── */
.scrape-panel {
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(212, 255, 0, 0.035), transparent 34%),
    var(--surface);
}
.scrape-panel .panel-head {
  margin: 0;
  padding: var(--s-4) var(--s-5);
  background: var(--surface-2);
}
.scrape-form-grid {
  gap: var(--s-5);
  padding: var(--s-5);
}
.scrape-field {
  gap: var(--s-2);
}
.scrape-field label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scrape-field label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-ghost);
}
.input-shell {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
}
.input-shell:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-shell.compact {
  max-width: 180px;
}
.input-prefix {
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.input-shell input {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 14px;
  min-height: 48px;
}
.input-shell input:focus {
  box-shadow: none;
  background: transparent;
}
.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-picks button,
.preset-panel button {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-faint);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: border-color 120ms, color 120ms, background 120ms;
}
.quick-picks button:hover,
.preset-panel button:hover {
  color: var(--text);
  border-color: var(--border-bright);
  background: var(--surface-2);
}
.search-presets {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3);
  border-bottom: 1px solid var(--border);
}
.preset-head .k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.preset-head .v {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}
.preset-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.preset-tabs button {
  min-height: 34px;
  padding: 8px 6px;
  border-right: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  transition: background 120ms, color 120ms;
}
.preset-tabs button:last-child { border-right: 0; }
.preset-tabs button:hover {
  color: var(--text);
  background: var(--surface);
}
.preset-tabs button.active {
  color: #0a0a0a;
  background: var(--accent);
  font-weight: 600;
}
.preset-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: var(--s-3);
}
.preset-panel.active {
  display: grid;
}
.preset-panel button {
  min-height: 30px;
  text-align: left;
  overflow-wrap: anywhere;
}
@media (max-width: 520px) {
  .preset-tabs { grid-template-columns: repeat(2, 1fr); }
  .preset-tabs button:nth-child(2) { border-right: 0; }
  .preset-tabs button:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .preset-panel { grid-template-columns: 1fr; }
}
.scrape-summary-card {
  display: grid;
  gap: 4px;
  padding: var(--s-3);
  border: 1px dashed var(--border-bright);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-dim);
  font-size: 12px;
}
.scrape-summary-card .k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.scrape-summary-card strong {
  color: var(--text);
  font-weight: 500;
}
.scrape-submit {
  justify-content: center;
  min-height: 46px;
}

/* ──────── send: dual panels ──────── */
.dispatch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
@media (max-width: 720px) { .dispatch-grid { grid-template-columns: 1fr; } }

.dispatch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.dispatch-card .head h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  font-weight: 400;
}
.dispatch-card .head .sub {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 13px;
}
.dispatch-card.primary {
  border-color: var(--accent-deep);
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, var(--accent-glow), transparent 60%),
    var(--surface);
}

/* queue counter */
.queue-counter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-5);
  align-items: end;
  padding: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: var(--s-6);
  position: relative;
  overflow: hidden;
}
.queue-counter::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 30% 80% at 0% 50%, var(--accent-glow), transparent 60%);
  pointer-events: none;
}
.queue-counter .n {
  font-family: var(--serif);
  font-style: italic;
  font-size: 88px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--text);
  position: relative;
  z-index: 1;
}
.queue-counter .label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}
.queue-counter .pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

/* ──────── review table ──────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.bulk-bar .count {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.bulk-bar .count strong { color: var(--accent); font-weight: 500; }
.bulk-bar .spacer { flex: 1; min-width: 20px; }
.kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  color: var(--text-dim);
  margin-left: 6px;
}

.leads-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 13px;
}
.leads-table thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--text-faint);
}
.leads-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.leads-table tbody tr:last-child td { border-bottom: 0; }
.leads-table tbody tr {
  transition: background 140ms, transform 200ms, opacity 250ms;
  border-left: 2px solid transparent;
}
.leads-table tbody tr:hover {
  background: var(--surface-2);
}
.leads-table tbody tr.removed {
  opacity: 0;
  transform: translateX(20px);
}
.leads-table .name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--text);
  line-height: 1.2;
}
.leads-table .meta {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 11px;
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.leads-table .email-input {
  font-family: var(--mono);
  font-size: 12.5px;
  min-width: 200px;
  background: var(--bg);
}
.leads-table .site-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 0;
}
.leads-table .site-link:hover { color: var(--accent); }
.leads-table .actions-col { width: 136px; text-align: right; }
.leads-table .row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.leads-table .row-actions button {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  transition: all 120ms;
}
.leads-table .row-actions button[data-action=approve]:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.leads-table .row-actions button[data-action=preview]:hover {
  border-color: var(--border-bright);
  color: var(--text);
  background: var(--surface-3);
}
.leads-table .row-actions button[data-action=reject]:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* selection highlight */
.leads-table tr.selected {
  background: var(--surface-2);
  border-left-color: var(--accent);
}

/* ──────── empty state ──────── */
.empty {
  padding: var(--s-9) var(--s-6);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.empty .ascii {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-ghost);
  white-space: pre;
  margin-bottom: var(--s-4);
}
.empty h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--text-dim);
  margin-bottom: var(--s-2);
}
.empty p { color: var(--text-faint); }

/* ──────── checkbox ──────── */
input[type=checkbox] {
  appearance: none;
  width: 16px; height: 16px;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: all 120ms;
}
input[type=checkbox]:hover { border-color: var(--text-dim); }
input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 4px; height: 8px;
  border: 2px solid #0a0a0a;
  border-top: 0; border-left: 0;
  transform: rotate(45deg);
}

/* ──────── scrollbar ──────── */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ──────── animations ──────── */
@keyframes fade-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.9); }
}
@keyframes typeon {
  from { width: 0; }
  to   { width: 100%; }
}

/* stagger animation delays for sections */
.section:nth-of-type(1) { animation-delay: 80ms; }
.section:nth-of-type(2) { animation-delay: 160ms; }
.section:nth-of-type(3) { animation-delay: 240ms; }

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

/* ──────── personalized fields in review ──────── */
.leads-table tbody tr.pers-row td {
  padding: 0 12px 14px;
  border-bottom: 1px solid var(--border);
  border-top: 0;
  background: var(--surface);
}
.leads-table tbody tr.pers-row:hover { background: var(--surface); }
.pers-fields {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 6px 12px;
  align-items: start;
}
.pers-label {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  padding-top: 8px;
}
.pers-subject, .pers-hook {
  font-family: var(--mono);
  font-size: 12.5px;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 9px;
  resize: vertical;
}
.pers-subject:focus, .pers-hook:focus {
  outline: none;
  border-color: var(--accent);
}
.pers-status.ok { color: var(--success); }
.pers-status.missing { color: var(--warn); }
.leads-table tbody tr.removed + tr.pers-row {
  opacity: 0;
  transform: translateX(20px);
}

/* ──────── template editor / email preview ──────── */
.template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 980px) { .template-grid { grid-template-columns: 1fr; } }

.template-editor textarea {
  min-height: 460px;
  background: var(--bg);
}
.template-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.form-status {
  min-height: 18px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.form-status.ok { color: var(--accent); }
.form-status.fail { color: var(--danger); }

.email-preview-panel {
  position: sticky;
  top: var(--s-5);
}
.email-preview-meta {
  display: grid;
  gap: 6px;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  margin-bottom: var(--s-3);
}
.email-preview-meta .k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
.email-preview-meta strong {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}
.email-preview-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: var(--s-3);
}
.email-preview-tabs button {
  padding: 5px 9px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}
.email-preview-tabs button.active {
  background: var(--surface-3);
  color: var(--text);
}
.email-preview-html, .email-preview-text {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  padding: var(--s-4);
  background: #ffffff;
  color: #111111;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.email-preview-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--s-5);
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  padding: var(--s-5);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.modal-head h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  margin-top: var(--s-2);
}
.modal-close {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 22px;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--border-bright);
}

/* ──────── lead detail ──────── */
.lead-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-6);
  align-items: end;
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-6);
}
.lead-hero h1 {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(44px, 8vw, 86px);
  line-height: 0.95;
  margin-top: var(--s-3);
  max-width: 920px;
}
.lead-hero p {
  color: var(--text-dim);
  margin: var(--s-3) 0 0;
}
.back-link {
  display: inline-flex;
  margin-bottom: var(--s-4);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 0;
}
.back-link:hover { color: var(--accent); }
.lead-status {
  min-width: 150px;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.lead-status .k,
.lead-data-grid .k,
.insight-summary .k {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.lead-status strong {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
}
.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--s-6);
  align-items: start;
}
.lead-main,
.lead-side {
  display: grid;
  gap: var(--s-6);
}
.lead-side {
  position: sticky;
  top: var(--s-5);
}
.lead-section {
  border-top: 1px solid var(--border);
  padding-top: var(--s-5);
}
.section-head.compact {
  margin-bottom: var(--s-4);
}
.section-head.compact .btn {
  margin-left: auto;
}
.lead-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.lead-data-grid > div,
.insight-summary > div {
  min-height: 72px;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.lead-data-grid strong,
.lead-data-grid a,
.insight-summary strong {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.lead-detail-link {
  display: inline-block;
  border: 0;
}
.lead-detail-link:hover {
  color: var(--accent);
}
.site-preview-frame {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.empty.small {
  padding: var(--s-7) var(--s-5);
}
.insight-empty {
  padding: var(--s-5);
  border: 1px dashed var(--border-bright);
  border-radius: 6px;
  background: var(--surface);
}
.insight-empty p {
  color: var(--text-dim);
  margin: var(--s-2) 0 0;
}
.insight-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.chip-block,
.pain-list,
.crawl-table {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-5);
}
.block-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chips span {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}
.pain-item {
  display: grid;
  gap: 3px;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 4px;
  background: var(--surface);
}
.pain-item.high { border-left-color: var(--danger); }
.pain-item.medium { border-left-color: var(--warn); }
.pain-item.low { border-left-color: var(--accent-deep); }
.pain-item strong {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.pain-item span {
  color: var(--text-dim);
  font-size: 12.5px;
}
.crawl-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px;
  gap: var(--s-3);
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}
.crawl-row span { color: var(--text); }
.crawl-row strong {
  color: var(--accent);
  font-weight: 500;
}
.crawl-row em {
  color: var(--text-faint);
  font-style: normal;
  text-align: right;
}
.timeline {
  display: grid;
  gap: var(--s-3);
}
.timeline div {
  display: grid;
  gap: 4px;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
}
.timeline span {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}
.timeline strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.email-preview-html.compact {
  min-height: 220px;
  max-height: 420px;
}
@media (max-width: 1040px) {
  .lead-layout { grid-template-columns: 1fr; }
  .lead-side { position: static; }
}
@media (max-width: 720px) {
  .lead-hero,
  .lead-data-grid,
  .insight-summary {
    grid-template-columns: 1fr;
  }
}

/* ---- lead pain score chip (added by Python migration) ---- */
.score-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.score-chip.score-hot {
  color: var(--danger);
  border-color: var(--danger);
}
.score-chip.score-warm {
  color: var(--warn);
  border-color: var(--warn);
}
.score-chip.score-cold {
  color: var(--text-dim);
}
