/* Nelson Leads — design system leve (sem framework, sem fontes externas: CSP style-src 'self').
   Paleta Neosix (site.neosix.online). Padrao escuro; claro via botao (data-theme="light", salvo em localStorage). */

/* ============================== Fontes (self-hosted: CSP) ============================== */
@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");
}
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
}

/* ============================== Tokens — paleta Neosix / Nelson IA ==============================
   Padrao: escuro (identidade do site.neosix.online). Claro: data-theme="light". */
:root {
  --bg: #0e1311;
  --surface: #151c19;
  --surface-2: #1a221f;
  --surface-3: #212b27;
  --border: #26312c;
  --border-strong: #33413a;
  --text: #e7ede9;
  --text-2: #b9c4bd;
  --muted: #8a968f;

  --accent: #10b981;
  --accent-strong: #34d399;
  --accent-2: #22d3ee;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-text: #34d399;
  --accent-ink: #03140d;
  --grad: linear-gradient(135deg, #10b981 0%, #22d3ee 100%);
  --wa: #10b981;
  --wa-strong: #0e9f6e;

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --info: #22d3ee;
  --info-soft: rgba(34, 211, 238, 0.12);

  --t-cert: #10b981;
  --t-morno: #f59e0b;
  --t-frio: #475569;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(16, 185, 129, 0.4);
  --glow: none;
  --sidebar-w: 240px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f8f9f7;
  --surface-3: #eef0ec;
  --border: #e3e6e0;
  --border-strong: #cfd4cc;
  --text: #17201b;
  --text-2: #49554e;
  --muted: #76817a;
  --accent: #047857;
  --accent-strong: #065f46;
  --accent-soft: #e3f5ed;
  --accent-text: #047857;
  --accent-ink: #ffffff;
  --wa: #0e9f6e;
  --wa-strong: #0b875d;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --info: #0891b2;
  --info-soft: #e3f8fc;
  --t-cert: #059669;
  --t-morno: #d97706;
  --t-frio: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.04), 0 4px 16px rgba(6, 78, 59, 0.06);
  --shadow-lg: 0 16px 48px rgba(15, 23, 41, 0.18);
  --ring: 0 0 0 3px rgba(4, 120, 87, 0.25);
  --glow: none;
  color-scheme: light;
}

/* ============================== Base ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, .brand-text, .kpi-num, .login-side h1, .panel-title, .sec > summary { font-family: "Space Grotesk", "Inter", sans-serif; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
code, kbd, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85em; }
code { background: var(--surface-3); border-radius: 5px; padding: 0.1rem 0.35rem; }
kbd {
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.05rem 0.35rem; font-size: 0.78rem;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ico { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.15em; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.inline { display: inline; margin: 0; }
.spacer { flex: 1 1 auto; }
.sep { color: var(--border-strong); margin: 0 0.35rem; }
::selection { background: rgba(16, 185, 129, 0.35); }

/* ============================== Layout ============================== */
body.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.main { min-width: 0; }
.container { max-width: 1160px; margin: 0 auto; padding: 1.75rem 2rem 4rem; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.1rem 0.85rem;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.35)); }
.brand-logo-lg { width: 92px; height: 92px; filter: drop-shadow(0 0 24px rgba(34, 211, 238, 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: 1.08rem; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { font-family: "Inter", sans-serif; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 42px; padding: 0.5rem 0.75rem; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 0.93rem;
  transition: background 0.12s, color 0.12s;
}
.nav-link .ico { width: 18px; height: 18px; color: var(--muted); }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-link.active .ico { color: var(--accent-text); }

.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 0.25rem;
  padding-top: 0.9rem; border-top: 1px solid var(--border);
}
.me { display: flex; align-items: center; gap: 0.55rem; min-width: 0; flex: 1; padding-left: 0.35rem; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.me-text strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 0.74rem; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn .ico { width: 18px; height: 18px; }
.ico-moon { display: none; }
:root[data-theme="light"] .ico-moon { display: block; }
:root[data-theme="light"] .ico-sun { display: none; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.4rem;
}
.page-head p { margin-top: 0.3rem; max-width: 62ch; }

/* ============================== Botoes ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 40px; padding: 0.5rem 0.95rem;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--surface-3); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -8px rgba(16, 185, 129, 0.6); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-quiet, .btn-ghost { background: transparent; color: var(--text-2); }
.btn-quiet:hover, .btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; border-color: var(--danger-soft); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-danger-text { color: var(--muted); }
.btn-danger-text:hover { color: var(--danger); background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: 0.3rem 0.65rem; font-size: 0.82rem; border-radius: 8px; }
.btn-lg { min-height: 46px; padding: 0.65rem 1.2rem; font-size: 0.97rem; }
.btn-block { width: 100%; }
.copied { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: transparent !important; }
.htmx-request .btn[type="submit"], .btn.htmx-request { opacity: 0.6; pointer-events: none; }

/* ============================== Pills / badges ============================== */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.18rem 0.6rem; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 0.74rem; font-weight: 650; white-space: nowrap; line-height: 1.4;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok, .badge-ok { background: rgba(16, 185, 129, 0.14); color: var(--t-cert); }
.pill-warn, .badge-warn { background: var(--warn-soft); color: var(--warn); }
.pill-accent, .badge-scenario { background: var(--info-soft); color: var(--info); }

.stage-novo { background: var(--surface-3); color: var(--text-2); }
.stage-teste_enviado { background: var(--warn-soft); color: var(--warn); }
.stage-teste_respondido, .stage-respondeu { background: var(--info-soft); color: var(--info); }
.stage-apresentacao_enviada { background: var(--accent-soft); color: var(--accent-text); }
.stage-interessado_demo { background: var(--accent); color: var(--accent-ink); }
.stage-ganho { background: var(--t-cert); color: #fff; }
.stage-perdido { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.stage-opt_out { background: var(--danger-soft); color: var(--danger); }

/* Score: barra + numero */
.score { display: inline-flex; align-items: center; gap: 0.45rem; font-variant-numeric: tabular-nums; }
.meter { position: relative; width: 56px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--t-frio); }
.score-certeiro .meter-fill { background: var(--t-cert); }
.score-morno .meter-fill { background: var(--t-morno); }
.score-num { font-weight: 750; font-size: 0.85rem; min-width: 1.6em; }
.score-certeiro .score-num { color: var(--t-cert); }
.score-morno .score-num { color: var(--t-morno); }
.score-frio .score-num { color: var(--muted); }
.tier-label { font-size: 0.78rem; font-weight: 650; }
.tier-label.tier-certeiro { color: var(--t-cert); }
.tier-label.tier-morno { color: var(--t-morno); }
.tier-label.tier-frio { color: var(--muted); }
.badge.tier-certeiro { background: rgba(16, 185, 129, 0.14); color: var(--t-cert); }
.badge.tier-morno { background: var(--warn-soft); color: var(--warn); }
.badge.tier-frio { background: var(--surface-3); color: var(--muted); }

/* Larguras sem style inline (CSP) */
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; }
.w-100 { width: 100%; }

/* ============================== Alertas ============================== */
.alert {
  display: flex; gap: 0.5rem; align-items: flex-start;
  padding: 0.75rem 1rem; margin: 0 0 1rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; border: 1px solid transparent;
}
.alert .ico { margin-top: 0.15rem; }
.alert-ok { background: rgba(16, 185, 129, 0.12); color: var(--t-cert); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.hint {
  display: flex; gap: 0.45rem; align-items: flex-start;
  color: var(--text-2); font-size: 0.85rem; margin: 0.6rem 0 0;
}
.hint .ico { color: var(--accent-text); margin-top: 0.18rem; }

/* ============================== Panels / cards ============================== */
.panel, .card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card, .panel-pad { padding: 1.25rem 1.35rem; }
.panel-pad-x { padding: 1.1rem 1.35rem 0.4rem; }
.panel-title { display: flex; align-items: center; gap: 0.6rem; font-size: 1.02rem; margin-bottom: 1rem; }
.sec-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-text);
  font-size: 0.78rem; font-weight: 800;
}

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center;
  padding: 3rem 1rem; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty strong { color: var(--text); font-size: 1rem; }
.empty-ico { width: 34px; height: 34px; color: var(--accent-2, var(--accent)); margin-bottom: 0.35rem; }
.empty-flat { border: 0; background: transparent; padding: 1.5rem 1rem 2rem; }

/* ============================== Formularios ============================== */
label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--text-2); }
label .opt { font-weight: 500; color: var(--muted); font-size: 0.76rem; margin-left: 0.2rem; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="datetime-local"], input[type="file"], select, textarea {
  display: block; width: 100%; min-height: 40px; margin-top: 0.35rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.92rem; font-weight: 450;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="file"] { padding: 0.4rem; }
textarea { resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select {
  appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; margin-top: 0.9rem; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; margin-top: 0.9rem; }
.span-2 { grid-column: 1 / -1; }
.stack-form { display: grid; gap: 0.6rem; margin-top: 1rem; justify-items: start; }
.stack-form label { width: 100%; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.9rem; }
.inline-form input { margin-top: 0; flex: 1 1 220px; max-width: 320px; }

/* Chips (radio) */
.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.choice legend { font-size: 0.83rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.45rem; padding: 0; width: 100%; }
.chip { position: relative; margin: 0; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0.3rem 0.8rem;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  font-size: 0.84rem; font-weight: 550; color: var(--text-2); cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip span:hover { border-color: var(--muted); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip input:focus-visible + span { box-shadow: var(--ring); }
.chip-quiet input:checked + span { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-2); }

/* Switch */
.switch { display: flex; align-items: center; gap: 0.6rem; align-self: end; min-height: 40px; cursor: pointer; font-weight: 550; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
  position: relative; width: 38px; height: 22px; flex: none; border-radius: 99px;
  background: var(--border-strong); transition: background 0.15s;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--ring); }
.check { display: flex; align-items: center; gap: 0.5rem; }

/* Fold (details) */
.fold { margin-top: 0.75rem; }
.fold > summary {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; list-style: none;
  color: var(--text-2); font-size: 0.86rem; font-weight: 600; padding: 0.3rem 0;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "›"; display: inline-block; font-size: 1.1rem; line-height: 1; transition: transform 0.15s; color: var(--muted); }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary:hover { color: var(--text); }
.fold > *:not(summary) { margin-top: 0.6rem; }

/* ============================== Fila do Dia ============================== */
.antiban {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem;
  padding: 0.7rem 1.1rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.antiban-danger { border-color: var(--danger); background: var(--danger-soft); }
.antiban-title { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.85rem; color: var(--text-2); }
.antiban-title .ico { color: var(--accent-text); }
.antiban-alert { color: var(--danger); font-size: 0.85rem; flex-basis: 100%; }
.counter { display: flex; align-items: baseline; gap: 0.4rem; }
.counter-num { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.counter-num small, .counter-max { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.counter-label { font-size: 0.8rem; color: var(--muted); }
.counter-danger .counter-num { color: var(--danger); }

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 1.25rem; }
.step {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem;
  min-height: 64px; padding: 0.7rem 0.8rem; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.step:hover { border-color: var(--border-strong); }
.step:focus-visible { outline: none; box-shadow: var(--ring); }
.step-ico {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface-3); color: var(--muted);
}
.step-ico .ico { width: 17px; height: 17px; }
.step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.step-text strong { font-size: 0.86rem; font-weight: 650; }
.step-text small { font-size: 0.74rem; color: var(--muted); line-height: 1.25; }
.step-count {
  min-width: 26px; padding: 0.1rem 0.45rem; border-radius: 99px; text-align: center;
  background: var(--surface-3); color: var(--muted); font-size: 0.8rem; font-weight: 750;
}
.step.has-items .step-count { background: var(--surface-3); color: var(--text); }
.step.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.step.active .step-ico { background: var(--grad); color: var(--accent-ink); }
.step.active .step-count { background: var(--accent); color: var(--accent-ink); }

.lead-list { display: grid; gap: 0.9rem; }
.lead-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
}
.lead-head { display: flex; align-items: center; gap: 0.85rem; }
.lead-id { min-width: 0; flex: 1; }
.lead-id h2, .lead-id h3 { font-size: 1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-id p { display: flex; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.84rem; margin-top: 0.1rem; }
.lead-id p .ico { margin-right: 0.25rem; }
.lead-right { flex: none; }
.avatar {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 1rem;
  font-family: "Space Grotesk", sans-serif; border: 1px solid var(--border);
}
.avatar-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 0.85rem; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; color: var(--text-2); font-size: 0.85rem; margin-top: 0.75rem; }
.meta-line .ico { margin-right: 0.3rem; color: var(--muted); }

.bubble {
  position: relative; margin-top: 0.85rem; padding: 0.75rem 0.95rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  color: var(--text); font-size: 0.9rem; word-break: break-word;
}
.bubble-label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.3rem; }
.bubble-quiet { color: var(--text-2); font-size: 0.85rem; }
.tpl { margin: 0.5rem 0; padding: 0.7rem 0.95rem; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 6px; font-size: 0.9rem; white-space: pre-wrap; }

.lead-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.lead-actions-end { justify-content: flex-end; margin-top: 0.4rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.8rem; }

.alt-list { display: grid; gap: 0.5rem; }
.alt {
  display: flex; gap: 0.75rem; align-items: flex-start; justify-content: space-between;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.alt-text p { font-size: 0.85rem; color: var(--text-2); margin-top: 0.2rem; }
.alt-text strong { font-size: 0.85rem; display: inline-flex; gap: 0.3rem; align-items: center; }

.followups { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.85rem; }
.fu { padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.fu p { font-size: 0.86rem; color: var(--text-2); margin: 0.35rem 0 0.7rem; }
.fu-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.88rem; }
.fu-done { opacity: 0.55; }

/* ============================== Pipeline ============================== */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  margin-bottom: 1rem;
}
.search { position: relative; flex: 1 1 260px; margin: 0; }
.search .ico { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { margin: 0; padding-left: 2.3rem; }
.select-sm { margin: 0; }
.select-sm select { margin: 0; min-width: 160px; }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: 11px;
}
.seg { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0.3rem 0.8rem;
  border-radius: 8px; font-size: 0.84rem; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg input:focus-visible + span { box-shadow: var(--ring); }
.more-filters { position: relative; }
.more-filters > summary { list-style: none; }
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters[open] > summary { background: var(--surface-3); color: var(--text); }
.more-grid {
  display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 0.8rem; align-items: end;
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(560px, 90vw);
  padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.89rem; }
.table th {
  text-align: left; padding: 0.7rem 1rem; white-space: nowrap;
  color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; transition: background 0.1s; }
.row-link:hover, .row-link:focus-visible { background: var(--surface-2); outline: none; }
.row-chev { color: var(--border-strong); width: 1%; }
.row-link:hover .row-chev { color: var(--muted); }
.cell-lead { display: flex; align-items: center; gap: 0.7rem; min-width: 220px; }
.cell-lead .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 0.85rem; }
.cell-lead > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cell-lead strong { font-weight: 650; }
.pagination { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); }

/* Drawer */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  display: flex; justify-content: flex-end;
  background: rgba(10, 16, 13, 0.38); backdrop-filter: blur(2px);
  animation: fade 0.15s ease;
}
.drawer:empty { display: none; }
.drawer-card {
  width: min(560px, 100vw); height: 100%; overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: slide 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0.6; } }
.drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 1.1rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 1.1rem; }
.head-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.55rem; }
.drawer-body { padding: 1rem 1.25rem 2rem; display: grid; gap: 0.75rem; }
.drawer-body > .alert { margin: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.sec > summary {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem;
  cursor: pointer; list-style: none; font-weight: 700; font-size: 0.95rem;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "›"; margin-left: 0.25rem; color: var(--muted); font-size: 1.2rem; transition: transform 0.15s; }
.sec[open] > summary::after { transform: rotate(90deg); }
.sec-hint { margin-left: auto; font-size: 0.78rem; font-weight: 550; color: var(--muted); }
.sec-body { padding: 0 1rem 1rem; }
.sub { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 1.1rem 0 0.5rem; }

.reasons { list-style: none; margin: 0 0 0.25rem; padding: 0; display: grid; gap: 0.3rem; }
.reasons li { display: flex; gap: 0.5rem; font-size: 0.86rem; color: var(--text-2); }
.reasons li::before { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; }
.r-plus::before { content: "+"; background: var(--accent-soft); color: var(--accent-text); }
.r-minus::before { content: "−"; background: var(--danger-soft); color: var(--danger); }

.msg, .arg { padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 0.6rem; }
.msg .bubble { margin-top: 0.5rem; background: var(--surface); }
.msg-rec { border-color: var(--accent); background: var(--accent-soft); }
.msg-rec .bubble { border-color: transparent; }
.msg-off { opacity: 0.6; }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.88rem; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.6rem; }
.arg p { font-size: 0.86rem; color: var(--text-2); margin-top: 0.4rem; }
.arg-on { border-left: 3px solid var(--accent); }
.evidence { color: var(--accent-text) !important; font-weight: 600; font-size: 0.8rem !important; }
.question { font-style: italic; }
.question::before { content: "Pergunte: "; font-style: normal; font-weight: 700; color: var(--text); }

.kv { margin: 0; display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 0.84rem; }
.kv dd { margin: 0; text-align: right; font-size: 0.86rem; font-weight: 550; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 0.75rem; padding: 0.4rem 0 0.4rem 0.9rem; border-left: 2px solid var(--border); font-size: 0.86rem; }
.tl-when { color: var(--muted); min-width: 110px; font-variant-numeric: tabular-nums; }
.tl-what { text-transform: capitalize; }

.danger-zone {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.objection { padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.6rem; }

/* ============================== Coletor ============================== */
.collector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.collector-grid .panel { margin-bottom: 0; }
.collector-grid + .panel { margin-top: 1.25rem; }
.why {
  margin: -0.2rem 0 0; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  background: var(--info-soft); color: var(--text-2); border-left: 3px solid var(--accent-2, var(--info)); font-size: 0.82rem; font-weight: 500;
}
.why[hidden] { display: none; }
.cta-row { display: flex; gap: 0.6rem; }
.cta-row .btn { flex: 1; }
.api-box { border-top: 1px solid var(--border); padding-top: 0.6rem; }
.howto { margin: -0.3rem 0 0; padding-left: 1.2rem; color: var(--text-2); font-size: 0.87rem; display: grid; gap: 0.25rem; }
.paste-area textarea { min-height: 170px; font-size: 0.85rem; background: var(--surface-2); }
#collector-result:not(:empty) { margin-top: 1rem; }
#collector-result .alert { margin-bottom: 0.5rem; }
.quota { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; padding: 0.6rem 0.8rem; margin: 0.6rem 0 0.2rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.quota-item { display: flex; align-items: baseline; gap: 0.35rem; }
.quota .alert { flex-basis: 100%; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ============================== Metricas ============================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 650; color: var(--muted); }
.kpi-num { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { font-size: 0.8rem; color: var(--muted); }
.kpi-accent { background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(34, 211, 238, 0.10)); border-color: var(--border); }
.kpi-accent .kpi-num { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.funnel { display: grid; gap: 0.55rem; }
.funnel-row { display: grid; grid-template-columns: 180px 1fr 80px; align-items: center; gap: 0.9rem; font-size: 0.88rem; }
.funnel-label { color: var(--text-2); }
.funnel-track { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.funnel-bar { display: block; height: 100%; border-radius: 99px; background: var(--grad); min-width: 2px; }
.funnel-row:last-child .funnel-bar { background: var(--t-cert); }
.funnel-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }

/* ============================== Login ============================== */
body.auth { display: block; }
body.auth .container { max-width: none; padding: 0; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side {
  display: flex; flex-direction: column; justify-content: center; gap: 1.1rem;
  padding: 3rem clamp(2rem, 6vw, 5rem);
  background: radial-gradient(ellipse 900px 700px at 15% 15%, rgba(16, 185, 129, 0.18), transparent 60%),
              radial-gradient(ellipse 800px 650px at 85% 10%, rgba(34, 211, 238, 0.10), transparent 60%), #0e1311;
  color: #e2e8f0;
}
.login-side h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.12; color: #fff; }
.login-side p { color: #94a3b8; max-width: 44ch; font-size: 1rem; }
.login-side .grad-text { background: linear-gradient(90deg, #34d399, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card { align-self: center; justify-self: center; width: min(400px, 100% - 3rem); display: grid; gap: 1rem; }
.login-card h2 { font-size: 1.5rem; }
.login-card .muted { margin-top: -0.6rem; }

/* ============================== Responsivo ============================== */
@media (max-width: 1100px) {
  .steps { grid-template-columns: repeat(5, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
  .step { scroll-snap-align: start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 50; height: auto;
    flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand-text { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .nav-link { min-height: 38px; padding: 0.4rem 0.65rem; white-space: nowrap; font-size: 0.86rem; }
  .sidebar-foot { margin: 0; padding: 0; border: 0; }
  .me { display: none; }
  .container { padding: 1.25rem 1rem 3rem; }
  .collector-grid, .two-col, .login-wrap { grid-template-columns: 1fr; }
  .login-side { padding: 2.5rem 1.5rem; }
  .hide-sm { display: none; }
}
@media (max-width: 640px) {
  .nav-link span { display: none; }
  .nav-link .ico { width: 20px; height: 20px; }
  .form-grid, .grid-form, .followups, .row2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .funnel-row { grid-template-columns: 110px 1fr 56px; }
  .lead-card { padding: 1rem; }
  .lead-actions .btn { flex: 1 1 auto; }
  .lead-actions .spacer { display: none; }
  .alt { flex-direction: column; }
  .more-grid { position: static; width: 100%; grid-template-columns: 1fr 1fr; box-shadow: none; margin-top: 0.5rem; }
  .segmented { width: 100%; overflow-x: auto; }
  h1 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Fila: filtros */
#queue-filters { margin-bottom: 1.1rem; }
#queue-filters .select-sm select { min-width: 150px; }
.filter-note { display: flex; align-items: center; gap: 0.4rem; margin: -0.2rem 0 0.8rem; }
.filter-note .ico { width: 14px; height: 14px; }
