/* ============================================================
   Groot CRM — Sistema de design
   Layout alinhado ao Sistema Groot (sistema.grootassessoria.com.br):
   fonte DM Sans / DM Mono, fundo azul-acinzentado #eceef8, azul
   #2563eb, menu lateral branco que recolhe numa barra azul fina,
   cartões com cantos de 18px, botões em pílula.

   As cores SEMÂNTICAS (admin/positive/alert/amber) seguem o mesmo
   padrão do Sistema Groot: verde = sucesso/qualificado, vermelho =
   alerta/desqualificado, âmbar = atenção. O roxo (--admin) fica só
   como detalhe do modo "agência".
   ============================================================ */

:root {
  --ink: #1a1d2e;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --muted: #6b7280;
  --bg: #eceef8;
  --bg3: #f1f3f7;
  --bg4: #e4e8f0;
  --gray-bg: #f9fafb;
  --surface: #FFFFFF;
  --border: rgba(0, 0, 0, 0.08);
  --border2: rgba(0, 0, 0, 0.13);

  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;

  --admin: #534AB7;
  --admin-soft: #EDEAFA;

  --positive: #16a34a;
  --positive-ink: #15803d;
  --positive-soft: #f0fdf4;

  --alert: #dc2626;
  --alert-ink: #b91c1c;
  --alert-soft: #fef2f2;

  --amber: #d97706;
  --amber-ink: #b45309;
  --amber-soft: #fffbeb;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 6px 16px -6px rgba(30, 41, 59, 0.10), 0 2px 6px rgba(30, 41, 59, 0.03);
  --shadow-metric: 0 14px 32px -10px rgba(30, 41, 59, 0.12), 0 4px 10px rgba(30, 41, 59, 0.04);

  --sidebar-w: 220px;
  --sidebar-w-mini: 56px;

  --font-wordmark: 'DM Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'DM Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

h1, h2, h3, .navbar-brand, .btn, .btn-primary, button, .stat-value {
  font-family: var(--font-display);
}

h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.2px; }

a { color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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

/* ============================================================
   Auth (login)
   ============================================================ */
.auth-body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; box-sizing: border-box; padding: 24px 16px;
  background: var(--bg);
}
.auth-body .auth-card { margin: auto; }
.auth-card {
  background: var(--surface); padding: 40px; border-radius: var(--radius); width: 360px; max-width: 100%;
  box-shadow: 0 4px 24px rgba(30, 41, 59, 0.12);
}
.auth-card h1 { color: var(--brand); font-size: 28px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--font-wordmark); }
.auth-card .subtitle { margin: 4px 0 20px; color: var(--ink-soft); font-size: 14px; font-family: var(--font-body); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-family: var(--font-body); }
.alert-dismissible { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alert-close {
  background: none; border: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px;
  color: inherit; opacity: 0.5; flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }
.alert-error { background: var(--alert-soft); color: var(--alert-ink); }
.alert-success { background: var(--positive-soft); color: var(--positive-ink); }

/* ============================================================
   Forms
   ============================================================ */
label { display: block; font-size: 12.5px; font-weight: 500; margin: 12px 0 5px; color: var(--ink-soft); font-family: var(--font-body); }
input, select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border2); border-radius: var(--radius-sm);
  font-size: 13px; font-family: var(--font-body); background: var(--bg3); color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
input[readonly] { background: var(--bg3); color: var(--ink-soft); font-family: var(--font-mono); font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border2);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; font-size: 13px;
  font-weight: 500; transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--bg3); }
.btn-primary { background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -6px rgba(37, 99, 235, 0.4); }
.btn-primary:hover { background: var(--brand-ink); box-shadow: 0 10px 22px -6px rgba(37, 99, 235, 0.5); }
.btn-block { width: 100%; margin-top: 16px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 13px; padding: 0; font-family: var(--font-body); }
.link-btn.danger { color: var(--alert); }
.btn-danger { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.btn-danger:hover { background: var(--alert); color: #fff; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  font-family: var(--font-body); white-space: nowrap;
}
.badge-blue { background: var(--brand-soft); color: var(--brand-ink); }
.badge-teal { background: var(--positive-soft); color: var(--positive-ink); }
.workspace-chip {
  display: inline-block; vertical-align: middle; margin-left: 10px; padding: 3px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 12.5px; font-weight: 600; font-family: var(--font-body);
  letter-spacing: 0;
}

/* ============================================================
   Layout: sidebar + main content (padrão do Sistema Groot)
   - Desktop: menu branco de 220px que recolhe numa barra azul de 56px
   - Celular/tablet (≤ 900px): barra superior + menu em gaveta
   ============================================================ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); color: var(--ink);
  border-right: 1px solid var(--border); box-shadow: var(--shadow);
  position: relative; z-index: 100; overflow: hidden;
  transition: width 0.22s ease, background 0.22s ease, transform 0.25s ease;
}
.sidebar-inner { display: flex; flex-direction: column; height: 100%; width: 100%; }
.mobile-nav-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Topbar e overlay: só existem no celular/tablet */
.topbar { display: none; }
.sidebar-overlay { display: none; }

/* Dica flutuante do menu recolhido (position: fixed, pra não ser cortada) */
#sidebar-tooltip {
  position: fixed; left: 0; top: 0; z-index: 99999;
  background: #1e293b; color: #fff; font-size: 12px; font-weight: 500; font-family: var(--font-body);
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.12s; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* --- Marca --- */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden;
}
.brand-logo-img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #fff; }
.brand-logo-letter {
  width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.sidebar.is-admin .brand-sub { color: var(--admin); font-weight: 600; }

/* --- Espaços de trabalho (lado do cliente) --- */
.workspace-scope {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 14px 10px 8px;
}
.workspace-block { margin: 0 0 4px; }
.workspace-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 8px 12px; margin-bottom: 4px; border-radius: 999px;
  background: none; border: none; cursor: pointer; text-align: left;
  color: var(--ink-soft); font-size: 13px; font-weight: 500; font-family: var(--font-body);
  transition: background 0.15s ease, color 0.15s ease;
}
.workspace-header:hover { background: var(--bg3); color: var(--ink); }
.workspace-header.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.workspace-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.15s ease; }
.workspace-block.open .workspace-chevron { transform: rotate(-180deg); }

.workspace-submenu { display: none; padding: 2px 0 6px; }
.workspace-block.open .workspace-submenu { display: block; }

/* Itens de navegação (pílulas) — submenu dos espaços, menu do admin e rodapé */
.workspace-submenu a, .sidebar-nav a, .nav-btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 12px; margin-bottom: 8px; border-radius: 999px; border: none; background: none;
  color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 400; font-family: var(--font-body);
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.workspace-submenu a:hover, .sidebar-nav a:hover, .nav-btn:hover { background: var(--bg3); color: var(--ink); }
.workspace-submenu a.active, .sidebar-nav a.active {
  background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}
.workspace-submenu svg, .sidebar-nav svg, .nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-nav { flex: 1; padding: 14px 10px 0; overflow-y: auto; overflow-x: hidden; }

/* --- Rodapé (Voltar pra Clientes / Sair) --- */
.sidebar-footer { flex-shrink: 0; padding: 10px 10px 2px; border-top: 1px solid var(--border); }
.sidebar-footer form { display: block; margin: 0; }
.sidebar-footer .nav-btn { margin-bottom: 4px; }
.sidebar-footer .sair-btn:hover { background: var(--alert-soft); color: var(--alert); }

/* --- Botão "Recolher menu" --- */
.sidebar-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; flex-shrink: 0;
  padding: 12px 18px; cursor: pointer; background: var(--surface);
  border: none; border-top: 1px solid var(--border);
  color: var(--ink-soft); font-size: 13px; font-weight: 400; font-family: var(--font-body);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-toggle:hover { background: var(--bg3); color: var(--brand); }
.sidebar-toggle svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform 0.22s ease; }

/* --- Recolhido (somente desktop): barra azul fina com ícones brancos --- */
@media (min-width: 901px) {
  .sidebar.collapsed { width: var(--sidebar-w-mini); background: var(--brand); border-right-color: transparent; }

  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .label,
  .sidebar.collapsed .workspace-header { display: none; }

  .sidebar.collapsed .sidebar-brand { justify-content: center; padding: 12px 0; border-bottom-color: rgba(255, 255, 255, 0.15); }
  .sidebar.collapsed .brand-logo-letter { background: rgba(255, 255, 255, 0.25); }

  .sidebar.collapsed .workspace-scope { padding: 12px 0 0; overflow-y: auto; }
  .sidebar.collapsed .workspace-block { display: none; margin: 0; }
  .sidebar.collapsed .workspace-block.current { display: block; }
  .sidebar.collapsed .workspace-submenu { display: block !important; padding: 0; }
  .sidebar.collapsed .sidebar-nav { padding: 12px 0 0; }

  .sidebar.collapsed .workspace-submenu a,
  .sidebar.collapsed .sidebar-nav a,
  .sidebar.collapsed .nav-btn {
    justify-content: center; width: 36px; height: 36px; padding: 0; margin: 0 auto 8px;
    border-radius: 50%; color: #fff;
  }
  .sidebar.collapsed .workspace-submenu a:hover,
  .sidebar.collapsed .sidebar-nav a:hover,
  .sidebar.collapsed .nav-btn:hover,
  .sidebar.collapsed .sidebar-footer .sair-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
  .sidebar.collapsed .workspace-submenu a.active,
  .sidebar.collapsed .sidebar-nav a.active {
    background: #fff; color: var(--brand); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  }
  .sidebar.collapsed .workspace-submenu svg,
  .sidebar.collapsed .sidebar-nav svg,
  .sidebar.collapsed .nav-btn svg { width: 18px; height: 18px; }

  .sidebar.collapsed .sidebar-footer { padding: 10px 0 2px; border-top-color: rgba(255, 255, 255, 0.15); }
  .sidebar.collapsed .sidebar-toggle {
    justify-content: center; padding: 12px 0; background: transparent; border-top-color: rgba(255, 255, 255, 0.15);
  }
  .sidebar.collapsed .sidebar-toggle:hover { background: rgba(255, 255, 255, 0.15); }
  .sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); stroke: #fff; }
}

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
.main-area > main { flex: 1; }
.container { max-width: none; margin: 0; padding: 22px 28px 40px; overflow-x: auto; }
.container-narrow { max-width: 640px; margin: 0 auto; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { margin: 0; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }

/* ============================================================
   Cards / stats
   ============================================================ */
.cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid transparent; border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-metric);
}

.chart-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-card); margin-bottom: 24px; height: 300px;
  display: flex; flex-direction: column;
}
.chart-title {
  display: block; font-family: var(--font-display); font-weight: 600; font-size: 11px;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 14px;
}
.chart-card canvas { flex: 1; width: 100% !important; height: 100% !important; }
.stat-label {
  display: block; font-size: 10.5px; color: var(--ink-faint); margin-bottom: 8px; font-family: var(--font-body);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card.positive { background: var(--positive-soft); border-color: #bbf7d0; }
.stat-card.positive .stat-value { color: var(--positive); }
.stat-card.negative { background: var(--alert-soft); border-color: #fecaca; }
.stat-card.negative .stat-value { color: var(--alert); }

/* ============================================================
   Abas de status (filtro rápido de leads no topo da lista)
   ============================================================ */
.status-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; overflow-x: auto; flex-wrap: nowrap; padding: 2px 2px 6px; }
.leads-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.leads-toolbar .qual-pill, .leads-toolbar .btn { flex-shrink: 0; }
.status-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap; border-radius: 999px;
  font-family: var(--font-body); transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.status-tab:hover { color: var(--ink); background: var(--surface); }
.status-tab.active {
  color: #fff; background: var(--brand); font-weight: 600; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}
.status-tab-count {
  background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600;
}
.status-tab.active .status-tab-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ============================================================
   Tables
   Cabeçalho na cor azul do menu (texto branco); só linhas horizontais.
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table-scroll {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; max-width: 100%;
  border-radius: var(--radius); box-shadow: var(--shadow-card); border: 1px solid var(--border); background: var(--surface);
}
.table-scroll .data-table { box-shadow: none; }
.data-table th, .data-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table th {
  background: var(--brand); font-weight: 600; color: #fff; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.5px; font-family: var(--font-body); white-space: nowrap; border-bottom: none;
}
.data-table tbody tr:not(.row-desqualificado):hover td { background: #f8faff; }
.data-table td.positive { color: var(--positive); font-weight: 600; }
.data-table td.negative { color: var(--alert); font-weight: 600; }
.empty-state { text-align: center; color: var(--ink-faint); padding: 32px !important; font-size: 14px; }
.row-desqualificado { background: var(--alert-soft); }
.row-desqualificado:hover { background: #fde8e8; }
.row-actions { white-space: nowrap; min-width: 70px; padding-left: 4px; }
.cell-notas { padding-right: 4px; }
.row-actions a, .row-actions form { display: inline-flex; vertical-align: middle; margin-left: 8px; }
.row-actions a:first-child, .row-actions form:first-child { margin-left: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 999px; border: none; background: none;
  color: var(--brand); transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-ink); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn-danger:hover { background: var(--alert-soft); color: var(--alert); }
.ad-spend-input { width: 78px; display: inline-block; padding: 4px 6px; font-size: 12.5px; }

.cell-notas { width: 40px; text-align: center; }
.notes-btn-filled { color: var(--positive); }
.notes-btn-filled:hover { background: var(--positive-soft); color: var(--positive); }

.cell-answers { white-space: nowrap; }
.answers-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 999px; border: none; background: none;
  color: var(--ink-soft); cursor: pointer; padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.answers-btn:hover { background: var(--brand-soft); color: var(--brand); }
.answers-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.answers-btn-filled { color: var(--brand); }

.respostas-popover-lista { max-height: 320px; overflow-y: auto; padding: 6px 0; }
.resposta-item { padding: 8px 14px; border-bottom: 1px solid var(--border); }
.resposta-item:last-child { border-bottom: none; }
.resposta-pergunta { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 2px; }
.resposta-valor { font-size: 13.5px; color: var(--ink); }

/* Painel de Respostas do Formulário: tema escuro, diferente do de Observações */
#respostas-popover { background: #1e293b; border-color: #1e293b; }
#respostas-popover .notas-popover-header { border-bottom-color: rgba(255, 255, 255, 0.12); color: #fff; }
#respostas-popover .notas-popover-close { color: rgba(255, 255, 255, 0.6); }
#respostas-popover .notas-popover-close:hover { color: #fff; }
#respostas-popover .resposta-item { border-bottom-color: rgba(255, 255, 255, 0.12); }
#respostas-popover .resposta-pergunta { color: rgba(255, 255, 255, 0.55); }
#respostas-popover .resposta-valor { color: #fff; }

.notas-popover {
  position: absolute; z-index: 200; width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(15, 22, 56, 0.18); overflow: hidden;
}
.notas-popover-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--ink);
}
.notas-popover-status { font-weight: 400; font-size: 12px; color: var(--muted); flex: 1; }
.notas-popover-close {
  border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); padding: 0 2px;
}
.notas-popover-close:hover { color: var(--ink); }
.notas-popover textarea {
  display: block; width: 100%; min-height: 120px; border: none; padding: 10px 12px; background: #fff;
  font-family: inherit; font-size: 13.5px; resize: vertical; box-sizing: border-box; border-radius: 0;
}
.notas-popover textarea:focus { outline: none; box-shadow: none; }

.data-table td a:not(.btn):not(.icon-btn) {
  color: var(--brand); text-decoration: none; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  display: inline-block; transition: background 0.15s ease;
}
.data-table td a:not(.btn):not(.icon-btn):hover { background: var(--brand-soft); }

.month-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.month-link:hover { text-decoration: underline; }

.table-zebra tbody tr:nth-child(even) td { background: var(--gray-bg); }
.table-zebra tbody tr:hover td { background: #f8faff; }
.table-zebra th, .table-zebra td { padding: 6px 12px; }
.table-zebra th, .table-zebra td { text-align: center; }
.table-zebra th:first-child, .table-zebra td:first-child { text-align: left; }
.table-zebra th:last-child, .table-zebra td:last-child { text-align: right; }

/* ============================================================
   Status — funil de estágio (elemento de assinatura)
   Cada status vira uma sequência de pontos conectados, mostrando
   o quanto o lead já andou no funil. Desqualificado quebra a
   sequência com um X, em vez de tentar encaixar numa progressão.
   ============================================================ */
.funnel-track { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; flex-shrink: 0; }
.funnel-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg4); flex-shrink: 0; }
.funnel-dot.filled { background: var(--positive); }
.funnel-dot.current { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.funnel-line { width: 10px; height: 1.5px; background: var(--bg4); flex-shrink: 0; }
.funnel-line.filled { background: var(--positive); }
.funnel-x { width: 7px; height: 7px; border-radius: 50%; background: var(--alert); position: relative; flex-shrink: 0; }

.status-pill-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.status-select {
  padding: 5px 9px; font-size: 11.5px; border-radius: 999px; border: none; font-weight: 600;
  font-family: var(--font-body); cursor: pointer; min-width: max-content; width: auto; flex-shrink: 0;
  -webkit-appearance: menulist; appearance: menulist;
}
.status-Em-contato { background: var(--brand-soft); color: var(--brand-ink); }
.status-Qualificado { background: var(--positive-soft); color: var(--positive-ink); }
.status-Desqualificado { background: var(--gray-bg); color: var(--ink-soft); }
.status-Agendado { background: var(--amber-soft); color: var(--amber-ink); }
.status-Em-negociação { background: var(--admin-soft); color: var(--admin); }
.status-Fechado { background: var(--positive-soft); color: var(--positive-ink); }

/* ============================================================
   Criativos
   ============================================================ */
.objective-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; font-family: var(--font-body); }
.objective-lead { background: var(--brand-soft); color: var(--brand-ink); }
.objective-mensagem { background: var(--admin-soft); color: var(--admin); }
.objective-venda { background: var(--positive-soft); color: var(--positive-ink); }
.objective-outro { background: var(--gray-bg); color: var(--ink-soft); }
.qualificacao-bar-track { background: var(--bg3); border-radius: 6px; height: 8px; width: 100%; overflow: hidden; }
.qualificacao-bar-fill { background: var(--positive); height: 100%; }
.creative-name { font-weight: 400; font-family: var(--font-display); }
.creative-campaign { font-size: 12px; color: var(--ink-soft); }

/* Prévia do anúncio de origem (coluna "Anúncio") — mesma imagem/headline/
   texto que o lead viu no WhatsApp antes de mandar a 1ª mensagem. */
.data-table td.cell-anuncio { text-align: left; }
.ad-preview {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 260px; text-align: left;
  background: var(--brand-soft); border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm); padding: 6px 8px;
}
.ad-preview-img {
  width: 36px; height: 36px; flex-shrink: 0; object-fit: cover;
  border-radius: 8px; background: var(--bg3);
}
.ad-preview-text { min-width: 0; }
.ad-preview-headline {
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px;
  color: var(--brand-ink); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ad-preview-body {
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.3; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============================================================
   Forms grid / Settings
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; background: var(--surface); padding: 22px; border-radius: var(--radius); box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.form-group-full { grid-column: 1 / -1; }
.page-subtitle { color: var(--ink-soft); font-size: 13px; margin: 8px 0 20px; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0 20px; }
.status-row { margin-bottom: 8px; }
.status-row input { width: 100%; }
.field-hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.cell-answers { max-width: 260px; }
.answer-line { font-size: 12px; line-height: 1.5; }
.answer-key { color: var(--ink-soft); font-weight: 600; }
.cell-message { max-width: 280px; font-size: 12.5px; white-space: normal; word-break: break-word; }
.qual-select.qual-Qualificado { color: var(--positive); font-weight: 600; }
.qual-select.qual-Desqualificado { color: var(--alert); font-weight: 600; }

.drag-handle { cursor: grab; color: var(--ink-soft); width: 34px; }
.drag-handle svg { width: 16px; height: 16px; display: block; }
#funil-body tr.dragging { opacity: 0.45; background: var(--brand-soft, #eff6ff); }
.status-edit-form { align-items: center; gap: 6px; }

.lead-star { color: #E8A400; margin-left: 6px; vertical-align: -1px; }
.lead-star svg { width: 14px; height: 14px; }

.qual-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 14px; flex-wrap: wrap; gap: 10px; }
.qual-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.qual-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border2); background: var(--surface); color: var(--ink-soft);
  text-decoration: none; font-size: 12.5px; font-weight: 500; transition: all 0.15s ease;
}
.qual-pill:hover { border-color: var(--brand); color: var(--brand); }
.qual-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3); }
.qual-pill-pos.active { background: var(--positive); border-color: var(--positive); box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3); }
.qual-pill-neg.active { background: var(--alert); border-color: var(--alert); box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3); }

.lead-locked { display: inline-flex; color: var(--ink-soft); opacity: 0.6; }
.lead-locked svg { width: 15px; height: 15px; }

.cell-valor { min-width: 150px; }
.valor-form { display: inline-flex; align-items: center; gap: 4px; }
.valor-prefix { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.valor-input {
  width: 90px; padding: 5px 8px; font-size: 12.5px; border: none; border-radius: 8px;
  background: var(--bg3);
}
.cell-valor-destaque .valor-input { border-color: var(--positive); background: var(--positive-soft); font-weight: 600; }
.valor-form .link-btn { font-size: 13px; opacity: 0.6; }
.valor-form .link-btn:hover { opacity: 1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-block { background: var(--surface); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.editable-list { list-style: none; padding: 0; margin: 0 0 12px; }
.editable-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

/* Tokens/IDs técnicos exibidos pro usuário copiar */
.token-value { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg3); padding: 8px 10px; border-radius: var(--radius-sm); display: block; word-break: break-all; }

/* ============================================================
   Celular / tablet (≤ 900px): barra superior + menu em gaveta
   ============================================================ */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; padding-top: 54px; }
  .main-area { height: auto; overflow-y: visible; }

  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 98;
    padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .topbar-menu {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; padding: 4px; color: var(--ink);
  }
  .topbar-menu svg { width: 22px; height: 22px; }
  .topbar-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .sidebar-overlay.active { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 99; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: 280px; max-width: 85vw;
    transform: translateX(-100%); z-index: 100;
  }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, 0.25); }
  .sidebar-inner { height: 100%; }

  .container { padding: 16px 14px 28px; }
  .page-header { margin-bottom: 18px; }
}

@media (max-width: 700px) {
  .cards-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 20px; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
}

.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; margin-top: 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--ink-soft); opacity: 0.75; min-height: 38px; box-sizing: border-box;
  text-align: center;
}
.site-footer-company { line-height: 1.4; }
.site-footer-privacy { color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.site-footer-privacy:hover { color: var(--brand); text-decoration: underline; }
.auth-body .site-footer {
  border-top: none; justify-content: center; text-align: center;
  margin-top: auto; width: 100%; opacity: 0.9;
  color: var(--ink-soft);
}
.auth-body .site-footer-company { color: var(--ink-soft); }
.auth-body .site-footer-privacy { color: var(--ink-soft); }
.auth-body .site-footer-privacy:hover { color: var(--brand); text-decoration: underline; }
