:root {
  --bg: #e4d3ab;
  --surface: #faf6ea;
  --surface-2: #f0e6cf;
  --border: #b8a67e;
  --text: #241c12;
  --text-muted: #5c4f3a;
  --text-faint: #544731;
  --accent: #4c3fc4;
  --accent-dark: #3f31a8;
  --accent-text: #ffffff;
  --quente: #a3271a;
  --morno: #7d5613;
  --frio: #25537d;
  --desqualificado: #5c5142;
  --reativacao: #5f4380;
  --danger: #8f2015;
  --success: #2b5c38;
  --radius: 3px;
  --radius-lg: 4px;
  --shadow: 2px 3px 0 rgba(36,28,18,.10), 3px 5px 10px rgba(36,28,18,.10);
  --shadow-hover: 3px 5px 0 rgba(36,28,18,.14), 5px 9px 18px rgba(36,28,18,.16);
  --font-sans: "Archivo", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Turno da noite no galpão de triagem — mesmo mundo, outra luz. */
    --bg: #1c1712;
    --surface: #2a231a;
    --surface-2: #352c20;
    --border: #4a3d2a;
    --text: #f2e9d6;
    --text-muted: #c9bda3;
    --text-faint: #a3937a;
    --accent: #7a6ffb;
    --accent-dark: #8a80ff;
    --accent-text: #1c1712;
    --quente: #ff7a5c;
    --morno: #e8ac4f;
    --frio: #7ab0e8;
    --desqualificado: #b0a184;
    --reativacao: #c4a3ec;
    --danger: #f47b6a;
    --success: #6bc084;
    --shadow: 2px 3px 0 rgba(0,0,0,.28), 3px 5px 12px rgba(0,0,0,.3);
    --shadow-hover: 3px 5px 0 rgba(0,0,0,.32), 5px 9px 20px rgba(0,0,0,.36);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
table { font-variant-numeric: tabular-nums; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 2px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 22px;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.01em;
  border: 1.5px dashed color-mix(in srgb, var(--accent-text) 40%, transparent);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  vertical-align: -3px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px 9px 13px;
  margin-left: -3px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--accent-dark); font-weight: 700; }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--accent);
}
.nav-icon { width: 17px; text-align: center; opacity: .85; flex-shrink: 0; }
.nav-link.active .nav-icon { opacity: 1; }
.btn .icon { margin-right: 1px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
}
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; }
.page-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
/* Canhoto de ticket: aba tracejada à esquerda, como se fosse destacável. */
.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px dashed var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--stat-color, var(--accent)) 14%, transparent);
  color: var(--stat-color, var(--accent));
}
.stat-icon .icon { width: 16px; height: 16px; }
.stat-card.c-quente { --stat-color: var(--quente); }
.stat-card.c-danger { --stat-color: var(--danger); }
.stat-card.c-neutral { --stat-color: var(--text-muted); }
.stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -0.01em; }
.stat-value.accent { color: var(--accent-dark); }
.stat-value.warn { color: var(--quente); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
select, .input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
}
select:focus, .input:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.password-field { position: relative; margin-bottom: 16px; }
.password-field .input { padding-right: 38px; }
.password-toggle {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-faint);
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle .icon { width: 17px; height: 17px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger); color: var(--surface); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Alvo de toque mínimo (WCAG 2.5.8) pra checkbox nu, sem rótulo visível ---- */
.checkbox-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

table.data { width: 100%; border-collapse: collapse; }
/* Tabela de leads tem colunas demais (13, incluindo texto livre) pra caber
   espremendo em telas normais — trava uma largura mínima pra forçar o
   overflow-x do .card pai a virar barra de rolagem em vez de espremer tudo. */
table.data[data-bulk-table] { width: max-content; min-width: 100%; }
table.data th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-mono);
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
table.data a.row-link { text-decoration: none; color: var(--text); font-weight: 650; }
table.data a.row-link:hover { color: var(--accent-dark); }

/* Carimbo de status: retângulo tracejado com leve rotação, tinta de selo — não pill. */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  border: 1.5px dashed currentColor;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font-mono);
  transform: rotate(-1.2deg);
}
.pill-quente { background: color-mix(in srgb, var(--quente) 10%, var(--surface)); color: var(--quente); }
.pill-morno { background: color-mix(in srgb, var(--morno) 10%, var(--surface)); color: var(--morno); }
.pill-frio { background: color-mix(in srgb, var(--frio) 10%, var(--surface)); color: var(--frio); }
.pill-desqualificado { background: color-mix(in srgb, var(--desqualificado) 12%, var(--surface)); color: var(--text-muted); }
.pill-reativacao { background: color-mix(in srgb, var(--reativacao) 10%, var(--surface)); color: var(--reativacao); }
.pill-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); transform: none; }
.pill-pendente { background: color-mix(in srgb, var(--morno) 8%, var(--surface)); color: var(--morno); }
.pill-aprovada { background: color-mix(in srgb, var(--success) 8%, var(--surface)); color: var(--success); }
.pill-reprovada { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
  font-size: 13.5px;
}

/* Banner de erro/aviso — antes reaproveitava .empty-state (centralizado,
   cinza-claro, pensado pra "lista vazia") só trocando a cor do texto, o que
   fazia a mensagem passar despercebida. Left-border + fundo tintado deixa
   claro que é um bloqueio que exige ação, não um estado neutro. */
.alert-danger {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-left: 3px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
}
.alert-danger svg { flex: 0 0 auto; margin-top: 1px; }

/* ---- Linha de rastreamento (era "funil") ---- */
.funnel { display: flex; flex-direction: column; gap: 2px; max-width: 640px; }
.funnel-row {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  gap: 14px;
}
.funnel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}
.funnel-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.funnel-bar-track {
  height: 26px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
  overflow: hidden;
}
.funnel-bar {
  height: 100%;
  width: 100%;
  min-width: 3px;
  background: var(--accent);
  transform-origin: left;
  transition: transform .4s ease;
}
.funnel-value { font-size: 13.5px; font-weight: 700; text-align: right; white-space: nowrap; font-family: var(--font-mono); }
.funnel-pct { font-size: 11px; font-weight: 500; color: var(--text-faint); }
.funnel-drop {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-faint);
  padding: 2px 0 2px 124px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; }

.msg-thread { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid var(--border); }
.msg-lead { align-self: flex-start; background: var(--surface-2); }
.msg-ia { align-self: flex-end; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.msg-sistema { align-self: center; font-size: 11.5px; color: var(--text-faint); font-style: italic; border: none; }
.msg-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }

.idea-card, .campaign-card {
  border: 1px solid var(--border);
  border-left: 3px dashed var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--surface);
}
.idea-card-head, .campaign-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.idea-title, .campaign-title { font-size: 14.5px; font-weight: 700; }
.field-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 10px 0 3px; font-family: var(--font-mono); }
.field-value { font-size: 13.5px; white-space: pre-wrap; }

.collapsible { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.collapsible summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--accent-dark); list-style: none; }
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before { content: "▸ "; }
.collapsible[open] summary::before { content: "▾ "; }
.collapsible .field-value { margin-top: 8px; }

.report-block + .report-block { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.report-meta { color: var(--text-faint); font-size: 12px; margin-bottom: 10px; }

.overflow-x { overflow-x: auto; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Busca global (⌘K) ---- */
.cmdk-trigger {
  display: flex; align-items: center; gap: 8px;
  margin: 0 14px 10px; padding: 8px 10px;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--text-muted); font-size: 12.5px; cursor: pointer; width: calc(100% - 28px);
}
.cmdk-trigger:hover { border-color: var(--accent); border-style: solid; color: var(--text); }
.cmdk-trigger .icon { width: 15px; height: 15px; }
.cmdk-trigger span { flex: 1; text-align: left; }
.cmdk-trigger kbd { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.cmdk-overlay {
  position: fixed; inset: 0; background: rgba(28,23,18,.55);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 200;
}
/* Author CSS sobrepõe a folha de estilos padrão do navegador — sem esta regra, o
   "display: flex" acima vale mesmo com o atributo [hidden] presente, deixando o
   overlay cobrindo a tela inteira (inclusive o login) o tempo todo. */
.cmdk-overlay[hidden] { display: none; }
.cmdk-modal {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); overflow: hidden;
}
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 2px solid var(--border); }
.cmdk-input-row .icon { width: 17px; height: 17px; color: var(--text-faint); flex-shrink: 0; }
.cmdk-input { flex: 1; border: none; background: transparent; font-size: 15px; outline: none; }
.cmdk-input-row kbd { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 5px; }
.cmdk-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-result { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.cmdk-result:hover { background: var(--surface-2); }
.cmdk-result-name { font-weight: 700; font-size: 13.5px; }
.cmdk-result-meta { font-size: 11.5px; color: var(--text-faint); }
.cmdk-empty { padding: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ---- Chips de filtro rápido ---- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 5px 12px; border-radius: var(--radius); border: 1px dashed var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-decoration: none; background: var(--surface);
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); border-style: solid; color: var(--accent-text); }

/* ---- Alternador Tabela/Kanban ---- */
.view-toggle { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; }
.view-toggle-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius); font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.view-toggle-btn .icon { width: 14px; height: 14px; }
.view-toggle-btn.active { background: var(--surface); color: var(--accent-dark); box-shadow: var(--shadow); }

/* ---- Kanban de leads (esteiras de triagem) ---- */
.kanban { display: flex; gap: 14px; padding-bottom: 6px; align-items: flex-start; }
.kanban-col { flex: 0 0 260px; background: var(--surface); border: 1px solid var(--border); border-top: 3px dashed var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 74vh; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px dashed var(--border); }
.kanban-col-count { font-size: 11.5px; color: var(--text-faint); font-weight: 700; font-family: var(--font-mono); }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.kanban-card { display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: var(--text); }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-name { font-size: 13px; font-weight: 700; }
.kanban-card-meta { font-size: 11.5px; color: var(--text-faint); margin: 3px 0 8px; }
.kanban-card-foot { display: flex; gap: 6px; flex-wrap: wrap; }
.kanban-empty { font-size: 12px; color: var(--text-faint); text-align: center; padding: 14px 0; font-style: italic; }

/* ---- Zonas de triagem por temperatura (Painel) ---- */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px dashed var(--zone-color, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.zone.z-quente { --zone-color: var(--quente); }
.zone.z-morno { --zone-color: var(--morno); }
.zone.z-frio { --zone-color: var(--frio); }
.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px dashed var(--border);
}
.zone-head-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--zone-color, var(--text));
}
.zone-head-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--zone-color, var(--text));
  flex-shrink: 0;
}
.zone-count {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--zone-color, var(--text));
}
.zone-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.zone-item {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  text-decoration: none;
  color: var(--text);
}
.zone-item:hover { border-color: var(--zone-color, var(--accent)); }
.zone-item-name { font-size: 13px; font-weight: 700; }
.zone-item-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.zone-empty { font-size: 12px; color: var(--text-faint); text-align: center; padding: 20px 12px; font-style: italic; }
@media (max-width: 980px) { .zone-grid { grid-template-columns: 1fr; } }

/* ---- Seleção em massa ---- */
.bulk-bar {
  position: sticky; bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1.5px dashed var(--accent); border-radius: var(--radius-lg);
  padding: 12px 16px; box-shadow: var(--shadow-hover); font-size: 13.5px; margin-top: 4px;
}
.bulk-bar[hidden] { display: none; }

/* ---- Barra de rolagem horizontal flutuante ----
   A barra nativa do .overflow-x fica no fim da tabela — se a lista for
   grande, precisa rolar a página inteira pra alcançar. Esta é uma barra
   "espelho" fixa no rodapé da viewport, sincronizada por JS com o scroll
   real da tabela (ver setupFloatingScrollbar em app.js). */
.floating-scrollbar {
  position: fixed; bottom: 0; height: 14px; overflow-x: auto; overflow-y: hidden;
  background: var(--accent); z-index: 20;
}
.floating-scrollbar > div { height: 1px; }
.floating-scrollbar[hidden] { display: none; }
.floating-scrollbar::-webkit-scrollbar-thumb { background: var(--accent-text); opacity: 0.6; }
.floating-scrollbar::-webkit-scrollbar-track { background: transparent; }

/* ---- Linha do tempo (detalhe do lead) — trilho de rastreio ---- */
.tl { display: flex; flex-direction: column; gap: 0; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--border); }
.tl-item:first-child::before { top: 14px; }
.tl-item:last-child::before { bottom: calc(100% - 14px); }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); margin-top: 5px; flex-shrink: 0; z-index: 1; }
.tl-venda .tl-dot { background: var(--success); }
.tl-perda .tl-dot { background: var(--danger); }
.tl-lead .tl-dot { background: var(--frio); }
.tl-ia .tl-dot { background: var(--accent); }
.tl-content { flex: 1; font-size: 13.5px; min-width: 0; }
.tl-content .msg { margin-bottom: 4px; max-width: 100%; }
.tl-meta { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; font-family: var(--font-mono); }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 100;
}

/* ---- Acessibilidade: texto só pra leitor de tela ---- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Navegação mobile (sidebar vira gaveta) ---- */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
.mobile-nav-toggle .icon { width: 18px; height: 18px; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,23,18,.55);
  z-index: 40;
}
@media (max-width: 767px) {
  .mobile-nav-toggle { display: flex; }
  .main { padding: 68px 16px 40px; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: 82vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; }
}

/* ---- Faixa de semáforo (/prospeccao) ---- */
.semaforo {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 22px;
  background: color-mix(in srgb, var(--semaforo-cor) 8%, var(--surface));
  border: 1px solid var(--border);
  border-left: 3px solid var(--semaforo-cor);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: var(--shadow);
}
.semaforo.s-verde { --semaforo-cor: var(--success); }
.semaforo.s-amarelo { --semaforo-cor: var(--morno); }
.semaforo.s-vermelho { --semaforo-cor: var(--danger); }
.semaforo.s-cinza { --semaforo-cor: var(--text-muted); }
.semaforo-luz {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--semaforo-cor);
}
.semaforo-titulo {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--semaforo-cor);
}
.semaforo-motivos { margin: 8px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 13.5px; }
