/* Pulse · Leads — internal lead inbox.
   Brevibot brand system (branding/BRAND.md): near-black canvas, ONE saturated
   accent which is always the cyan #08c9e8 -> blue #0066FF gradient, Inter with a
   system fallback. Dark only: this is an internal tool that lives at night.
   Same design family as brevibot-hq-demo (cards, chips, micro-labels, stat grid)
   but retinted from that build's cyan-violet to the canonical cyan-blue.

   Semantic colours (ok / warn / danger) are UI signals, not brand accents, so
   they stay desaturated and are only used where meaning depends on them
   (won, junk, delete). The rule of one accent still holds visually. */

/* ---------------------------------------------------------------- tokens -- */
:root {
  --canvas: #05070d;
  --canvas-2: #070a12;
  --card: #0c111c;
  --card-2: #111726;
  --card-3: #172033;
  --border: rgba(255, 255, 255, 0.065);
  --border-strong: rgba(255, 255, 255, 0.12);

  --text: #e9eef6;
  --text-muted: #8b95aa;
  --text-dim: #5b6579;

  --accent: #08c9e8;              /* Brevi Cyan */
  --accent-2: #0066ff;            /* Brevi Blue */
  --accent-grad: linear-gradient(135deg, #08c9e8, #0066ff);
  --accent-soft: rgba(8, 201, 232, 0.12);
  --accent-line: rgba(8, 201, 232, 0.34);
  --glow: 0 0 26px rgba(8, 201, 232, 0.18);
  --glow-btn: 0 6px 22px rgba(0, 102, 255, 0.32);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.13);
  --danger: #f87171;
  --danger-strong: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.13);

  /* Source-chip tints. Deliberately confined to the brand's cyan -> blue ->
     violet arc so a dozen sources still read as one system, never a rainbow. */
  --t-cyan: #22d3ee;    --t-cyan-soft: rgba(34, 211, 238, 0.13);
  --t-blue: #4d90ff;    --t-blue-soft: rgba(77, 144, 255, 0.13);
  --t-sky: #38bdf8;     --t-sky-soft: rgba(56, 189, 248, 0.13);
  --t-indigo: #8b9cf8;  --t-indigo-soft: rgba(139, 156, 248, 0.13);
  --t-violet: #a78bfa;  --t-violet-soft: rgba(167, 139, 250, 0.13);
  --t-teal: #2dd4bf;    --t-teal-soft: rgba(45, 212, 191, 0.13);

  --radius: 12px;
  --radius-lg: 18px;
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------------ base -- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 640px at 88% -12%, rgba(0, 102, 255, 0.10), transparent 62%),
    radial-gradient(820px 520px at -8% 108%, rgba(8, 201, 232, 0.06), transparent 58%),
    var(--canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
::selection { background: rgba(0, 102, 255, 0.35); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.dot-sep { color: var(--text-dim); font-weight: 400; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.micro-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--text-dim);
}

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

@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -420px 0; } 100% { background-position: 420px 0; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--card-3); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ boot -- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--canvas);
}
.boot[hidden] { display: none; }
.boot-spin {
  width: 26px; height: 26px; border-radius: 99px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}
.boot-txt { font-size: 13px; color: var(--text-dim); }

/* ----------------------------------------------------------------- brand -- */
.brand-wave { width: 56px; height: 28px; flex: none; }
.brand-wave.sm { width: 44px; height: 22px; }
.brand-word { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.brand-word b { color: var(--accent); font-weight: 800; }

/* ----------------------------------------------------------------- login -- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 32px 20px;
}
.login[hidden] { display: none; }

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 30px 28px 26px;
  animation: fade-up 320ms ease;
  position: relative; overflow: hidden;
}
/* Hairline of the signature gradient across the top of the card. */
.login-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--accent-grad);
}
.login-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }
.login-title { font-size: 23px; margin-bottom: 5px; }
.login-sub { font-size: 13.2px; color: var(--text-muted); line-height: 1.55; margin-bottom: 22px; }
.login-foot { font-size: 11.5px; color: var(--text-dim); }

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 620; margin-bottom: 6px; color: var(--text-muted); }

.input {
  width: 100%;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.input::placeholder { color: var(--text-dim); }
.input:hover { border-color: rgba(255, 255, 255, 0.18); }
.input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled { opacity: 0.6; }

.form-error {
  font-size: 12.8px; color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 10px; padding: 9px 11px;
  margin: 2px 0 12px;
  animation: fade-up 200ms ease;
}
.form-error[hidden] { display: none; }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--card-2); color: var(--text);
  font-size: 13px; font-weight: 620;
  padding: 8px 14px; border-radius: 10px;
  cursor: pointer; white-space: nowrap;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease,
              box-shadow 140ms ease, filter 140ms ease, opacity 140ms ease;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { border-color: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; transform: none; }

.btn.primary {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  box-shadow: var(--glow-btn);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.28); color: var(--danger); }
.btn.danger.solid { background: var(--danger-strong); border-color: transparent; color: #fff; }
.btn.sm { padding: 5.5px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { padding: 11px 18px; font-size: 14.5px; border-radius: 11px; }
.btn.block { width: 100%; }

.btn-spin {
  width: 14px; height: 14px; border-radius: 99px; flex: none;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 640ms linear infinite;
  display: none;
}
.btn.loading .btn-spin { display: block; }
.btn.loading { pointer-events: none; opacity: 0.8; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--card-2);
  color: var(--text-muted); cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.24); }

/* ----------------------------------------------------------------- shell -- */
.app[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 30px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--canvas-2) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-stack { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 16.5px; font-weight: 800; letter-spacing: -0.025em; }
.brand-kicker { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.brand-rule { width: 1px; height: 26px; background: var(--border-strong); margin: 0 3px; }
.page-title { font-size: 17px; font-weight: 650; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.who {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px 4px 5px;
  font-size: 12.8px; font-weight: 600; color: var(--text-muted);
  max-width: 210px;
}
.who-avatar {
  width: 24px; height: 24px; border-radius: 99px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-grad); color: #fff;
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
}
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { max-width: 1340px; margin: 0 auto; padding: 24px 30px 70px; }

/* ----------------------------------------------------------------- stats -- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px;
  padding: 17px 19px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.stat-label { font-size: 12px; font-weight: 620; color: var(--text-muted); }
.stat-value { font-size: 33px; font-weight: 760; letter-spacing: -0.03em; line-height: 1.12; }
.stat-value.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-note { font-size: 11.8px; color: var(--text-dim); }

/* The one tile that answers "how many emails can we send". */
.stat.hero {
  border-color: var(--accent-line);
  background: linear-gradient(150deg, rgba(8, 201, 232, 0.10), transparent 58%), var(--card);
  box-shadow: var(--glow);
}
.stat.hero .stat-label { color: var(--accent); }
.stat.hero .stat-value { font-size: 37px; }

/* ------------------------------------------------------------------ tabs -- */
.tabs {
  display: flex; gap: 7px; flex-wrap: wrap;
  margin-bottom: 15px;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.8px; font-weight: 620; font-family: inherit;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 13px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.tab:hover { color: var(--text); border-color: var(--border-strong); }
.tab .tab-count {
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: var(--card-2); border-radius: 99px; padding: 0 7px;
}
.tab.on {
  color: var(--text);
  border-color: var(--accent-line);
  background: linear-gradient(120deg, rgba(8, 201, 232, 0.14), rgba(0, 102, 255, 0.10));
}
.tab.on .tab-count { color: var(--accent); background: rgba(8, 201, 232, 0.14); }
.tab .tab-new {
  font-size: 10.5px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 99px; padding: 0 6px;
}
/* Per-source dot, tinted by the same hash the table chips use. */
.tab-dot { width: 6px; height: 6px; border-radius: 99px; flex: none; background: var(--text-dim); }
.tab-dot[data-tint="cyan"]   { background: var(--t-cyan); }
.tab-dot[data-tint="blue"]   { background: var(--t-blue); }
.tab-dot[data-tint="sky"]    { background: var(--t-sky); }
.tab-dot[data-tint="indigo"] { background: var(--t-indigo); }
.tab-dot[data-tint="violet"] { background: var(--t-violet); }
.tab-dot[data-tint="teal"]   { background: var(--t-teal); }
.tabs-empty { font-size: 12.8px; color: var(--text-dim); padding: 2px 0 4px; }

/* --------------------------------------------------------------- toolbar -- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 300px; min-width: 220px; }
.search-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-dim); pointer-events: none;
}
.search-input { padding-left: 34px; }
.search-input::-webkit-search-cancel-button { filter: invert(0.6); }
.tool-right { display: flex; align-items: center; gap: 9px; flex: none; }
.select {
  width: auto; padding: 9px 12px; font-size: 13px; cursor: pointer;
  background-image: none; /* keep the native arrow, no external asset */
}

/* ----------------------------------------------------------------- table -- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }

.leads { width: 100%; border-collapse: collapse; }
.leads thead th {
  text-align: left;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--canvas-2);
  white-space: nowrap;
}
.leads .th-name { padding-left: 20px; }
.leads .th-when { padding-right: 20px; }
.leads .th-subs { text-align: center; }

.leads tbody tr {
  cursor: pointer;
  transition: background 130ms ease;
}
.leads tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.leads tbody tr.busy { opacity: 0.6; }
.leads tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.4px;
  vertical-align: middle;
}
.leads tbody tr:last-child td { border-bottom: 0; }
.leads td.c-name { padding-left: 20px; max-width: 230px; }
.leads td.c-when { padding-right: 20px; white-space: nowrap; color: var(--text-muted); font-size: 12.8px; }
.leads td.c-subs { text-align: center; }
.leads td.c-contact { max-width: 280px; }

.name-btn {
  font-family: inherit; font-size: 13.6px; font-weight: 620;
  color: var(--text); background: none; border: 0; padding: 0;
  cursor: pointer; text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.name-btn:hover { color: var(--accent); }
.name-btn.anon { color: var(--text-dim); font-style: italic; font-weight: 550; }

.contact { display: flex; align-items: center; gap: 6px; min-width: 0; }
.contact-link {
  color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}
.contact-link:hover { color: var(--accent); border-bottom-color: var(--accent-line); }
.contact-none { color: var(--text-dim); }
.copy-btn {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  border: 1px solid transparent; background: transparent;
  color: var(--text-dim); cursor: pointer;
  opacity: 0; transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}
.copy-btn svg { width: 13px; height: 13px; }
tr:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.done { opacity: 1; }
.copy-btn:hover { color: var(--text); background: var(--card-2); }
.copy-btn.done { color: var(--ok); }

/* Chips (source, channel, country). */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.6px; font-weight: 640;
  padding: 3px 9px; border-radius: 99px;
  background: var(--card-2); color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.chip .chip-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: none; }
.chip.tint-cyan   { background: var(--t-cyan-soft);   color: var(--t-cyan); }
.chip.tint-blue   { background: var(--t-blue-soft);   color: var(--t-blue); }
.chip.tint-sky    { background: var(--t-sky-soft);    color: var(--t-sky); }
.chip.tint-indigo { background: var(--t-indigo-soft); color: var(--t-indigo); }
.chip.tint-violet { background: var(--t-violet-soft); color: var(--t-violet); }
.chip.tint-teal   { background: var(--t-teal-soft);   color: var(--t-teal); }

.channel { font-size: 12.6px; color: var(--text-muted); text-transform: capitalize; }
.channel.none { color: var(--text-dim); }

/* Repeat submissions: a quiet badge that only shows up when it means something. */
.subs-badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums;
  color: var(--warn); background: var(--warn-soft);
  border-radius: 99px; padding: 1.5px 8px;
}
.subs-none { color: var(--text-dim); font-size: 12.5px; }

/* Status cell: a real <select> so it is keyboard operable and PATCHes on change. */
.status-cell { display: flex; align-items: center; gap: 6px; }
.status-select {
  font-family: inherit; font-size: 12.3px; font-weight: 650;
  border-radius: 99px; padding: 4px 8px;
  border: 1px solid transparent;
  background: var(--card-2); color: var(--text-muted);
  cursor: pointer; appearance: none; -webkit-appearance: none;
  padding-right: 24px;
  /* Caret drawn in CSS so there is no image request. The [data-status] rules
     below must set background-COLOR only, or the shorthand wipes this out. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) calc(50% + 1px), calc(100% - 9px) calc(50% + 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: filter 140ms ease, opacity 140ms ease;
}
.status-select:hover { filter: brightness(1.15); }
.status-select:disabled { opacity: 0.6; cursor: progress; }
.status-select option { background: var(--card-2); color: var(--text); }
.status-select[data-status="new"]       { background-color: var(--accent-soft); color: var(--accent); }
.status-select[data-status="delivered"] { background-color: var(--t-blue-soft); color: var(--t-blue); }
.status-select[data-status="contacted"] { background-color: var(--t-violet-soft); color: var(--t-violet); }
.status-select[data-status="won"]       { background-color: var(--ok-soft); color: var(--ok); }
.status-select[data-status="junk"]      { background-color: rgba(255, 255, 255, 0.05); color: var(--text-dim); }

.save-dot {
  width: 15px; height: 15px; flex: none;
  color: var(--ok);
  opacity: 0; transition: opacity 180ms ease;
}
.save-dot svg { width: 15px; height: 15px; display: block; }
.save-dot.show { opacity: 1; }

/* Table states: skeleton, empty, error. */
.table-state { padding: 42px 22px; text-align: center; }
.table-state[hidden] { display: none; }
.state-ico { font-size: 24px; opacity: 0.8; margin-bottom: 10px; }
.state-title { font-size: 15px; font-weight: 650; margin-bottom: 6px; }
.state-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 460px; margin: 0 auto 14px; }

.skeleton { padding: 8px 20px 14px; }
.skel-row {
  height: 42px; border-radius: 9px; margin-top: 8px;
  background: linear-gradient(90deg, var(--card-2) 25%, var(--card-3) 50%, var(--card-2) 75%);
  background-size: 420px 100%;
  animation: shimmer 1.25s linear infinite;
}

/* ---------------------------------------------------------------- pager -- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--canvas-2);
}
.pager[hidden] { display: none; }
.pager-info { font-size: 12.5px; color: var(--text-muted); }
.pager-btns { display: flex; gap: 8px; }

/* --------------------------------------------------------------- drawer -- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 5, 10, 0.62);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 200ms ease;
}
.overlay[hidden] { display: none; }
.overlay.open { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  transform: translateX(102%);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer[hidden] { display: none; }
.drawer.open { transform: none; }

.drawer-hd {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--border);
}
.drawer-hd-txt { flex: 1; min-width: 0; }
.drawer-title {
  font-size: 18px; margin-top: 3px;
  overflow-wrap: anywhere;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 26px; scrollbar-width: thin; }
.drawer-ft {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--canvas-2);
}
.drawer-ft-note { font-size: 11.5px; color: var(--text-dim); }

.d-section { margin-bottom: 18px; }
.d-section > .micro-label { display: block; margin-bottom: 9px; }
.d-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.2px;
}
.d-row:last-child { border-bottom: 0; }
.d-key { flex: 0 0 108px; color: var(--text-dim); font-size: 12.4px; padding-top: 1px; }
.d-val { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.d-val a { color: var(--accent); }
.d-val a:hover { text-decoration: underline; }
.d-val .empty-val { color: var(--text-dim); }
.d-val-row { display: flex; align-items: center; gap: 6px; }
/* No row-hover to reveal it in the drawer, so the copy button is always there. */
.d-val-row .copy-btn { opacity: 0.7; }
.d-val-row .copy-btn:hover, .d-val-row .copy-btn.done { opacity: 1; }

.d-hero {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 16px;
}

.notes-area {
  width: 100%; min-height: 96px; resize: vertical;
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 13.4px; line-height: 1.55; padding: 10px 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.notes-area::placeholder { color: var(--text-dim); }
.notes-area:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.notes-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.notes-hint { font-size: 11.5px; color: var(--text-dim); }

.meta-pre {
  margin: 0; padding: 11px 13px;
  background: var(--canvas-2); border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono); font-size: 11.8px; line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 260px; overflow: auto; scrollbar-width: thin;
}

/* ------------------------------------------------------- confirm dialog -- */
.confirm {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  padding: 24px 24px 20px;
  width: min(400px, 92vw);
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0;
}
.confirm[open] { animation: pop-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.confirm::backdrop { background: rgba(3, 5, 10, 0.68); backdrop-filter: blur(4px); }
.confirm-title { font-size: 17px; margin-bottom: 8px; }
.confirm-text { font-size: 13.2px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* --------------------------------------------------------------- toasts -- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 90;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13.2px; font-weight: 600;
  max-width: 100%;
  animation: fade-up 220ms ease;
  pointer-events: auto;
  overflow-wrap: anywhere;
}
.toast::before {
  content: ""; width: 7px; height: 7px; border-radius: 99px; flex: none;
  background: var(--accent);
}
.toast.ok::before { background: var(--ok); }
.toast.error::before { background: var(--danger-strong); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity 200ms ease, transform 200ms ease; }

/* Off-screen textarea used by the clipboard fallback on non-secure origins. */
.copy-fallback { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

/* ----------------------------------------------------------- responsive -- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px 20px 70px; }
  .topbar { padding: 12px 20px; }
}

/* Below this width the table stops being a table and becomes a stack of
   cards. Never a horizontal scrollbar full of leads. */
@media (max-width: 900px) {
  .table-card { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .table-scroll { overflow-x: visible; }
  .leads thead { display: none; }
  .leads, .leads tbody, .leads tr, .leads td { display: block; width: 100%; }

  .leads tbody tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 15px 9px;
    margin-bottom: 10px;
  }
  .leads tbody tr:hover { background: var(--card-2); }
  .leads tbody td,
  .leads tbody tr:last-child td {
    border: 0;
    padding: 5px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    font-size: 13.2px;
    max-width: none;
  }
  .leads tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim);
  }
  /* Name is the card heading, so no label and full width. */
  .leads tbody td.c-name {
    display: block; padding: 0 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
  }
  .leads tbody td.c-name::before { content: none; }
  .name-btn { font-size: 15px; white-space: normal; }
  .leads tbody td.c-when { padding-right: 0; }
  .leads tbody td.c-subs { text-align: left; }
  .contact { justify-content: flex-end; min-width: 0; }
  .copy-btn { opacity: 1; }

  .table-state { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .pager {
    background: transparent; border-top: 0; padding: 4px 2px 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  /* At phone width the header only needs the product name. */
  .brand-rule, .page-title, .brand-kicker { display: none; }
  .main { padding: 16px 14px 80px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 14px 15px; }
  .stat-value { font-size: 26px; }
  .stat.hero .stat-value { font-size: 29px; }
  .who { max-width: 132px; }
  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; }
  .tool-right { flex: 1 1 100%; }
  .select { flex: 1; }
  .drawer { width: 100vw; }
  .toasts { bottom: 14px; }
}
