/* =========================================================================
   CRM — folha de estilo única.
   Organização: tokens → base → layout → componentes → telas → utilitários
   ========================================================================= */

/* ------------------------------------------------------------------ tokens */
:root {
  /* PRD-rebrand-sidebar.md §5.1 — verde quase-preto no lugar do
     azul-marinho antigo (19:1 de contraste com texto branco, folga
     grande sobre o mínimo AA). --sidebar-hover é um tom próprio (não
     reaproveita nenhum outro token): precisa ler como "mesma família
     verde-escura, um degrau mais claro" — 12.5:1 contra o texto quase
     branco do hover (#e2e8f0) e 4.9:1 contra --sidebar-text (o estado
     sem hover), os dois calculados por luminância relativa, não só
     inspeção visual. --sidebar-active existia sem nenhum uso antes
     deste PRD — removido; --sidebar-item-active-bg/--cta-bg (abaixo)
     assumem esse papel com cores diferentes uma da outra (§5.4). */
  --sidebar: #02130F;
  --sidebar-hover: #0B3B2E;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;

  /* PRD-rebrand-sidebar.md §5.4 — item ativo (verde-menta) e "Comece
     por aqui" (âmbar) usavam o mesmo token (--accent) antes deste PRD;
     agora são famílias de cor deliberadamente diferentes, os dois com
     texto escuro (não branco — os fundos são claros demais pra isso):
     13.6:1 (#61F2C2/#02130F) e 12.9:1 (#EAD637/#02130F). */
  --sidebar-item-active-bg: #61F2C2;
  --sidebar-item-active-text: #02130F;
  --sidebar-cta-bg: #EAD637;
  --sidebar-cta-text: #02130F;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  /* PRD-refinamento-hig.md §5.1 — variante mais escura de --text-muted,
     só pra texto que pode cair sobre a bolha de mensagem enviada
     (`.bubble--out`, fundo #dcf0ff, não branco): --text-muted sozinho dá
     4.76:1 em branco mas só 4.07:1 em #dcf0ff (abaixo do mínimo AA de
     4.5:1) — #dcf0ff é mais escuro que --surface, então o par que "só
     precisa passar em branco" não é garantia aqui. --text-muted-strong
     mede 6.31:1 em branco / 5.4:1 em #dcf0ff, com folga nos dois. */
  --text-muted-strong: #556077;

  --accent: #25D366;
  --accent-hover: #0F8F5F;
  --accent-soft: #e7faf0;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #0ea5e9;

  /* Cartão de destaque — Dashboard/Analytics (PRD-refinamento-visual.md
     §5.2). Fundo sólido por categoria + variante clara de texto pra cada
     um. --stat-green é um tom PRÓPRIO, mais escuro que --accent-hover
     (que a PRD original sugeria reaproveitar) — reaproveitar o valor
     literal só passava em contraste AA (WCAG) pro número grande (34px,
     "texto largo"), não pro rótulo/corpo em 12-13px, que exige 4.5:1; até
     o branco puro sobre --accent-hover fica em ~4.11:1. Mesma família de
     verde da marca, só um degrau mais escuro — não é reaproveitar sem
     medir, é a mesma decisão de "escurecer o suficiente pra funcionar como
     fundo cheio" que a PRD já aplicou em --stat-blue/--stat-amber.
  */
  --stat-green: #0b6944;
  --stat-green-text: #c9f2df;
  --stat-blue: #0c5a8f;
  --stat-blue-text: #cfe8fb;
  --stat-amber: #a34e0e;
  --stat-amber-text: #fde3cc;
  --stat-violet: #5b3fa0;
  --stat-violet-text: #e6ddf7;
  /* PRD-relatorios.md §5.5 — mesma faixa verde/âmbar/vermelho do
     indicador de SLA da Inbox (badge--success/warning/danger), agora
     como variante de .stat-card pro card "SLA médio do período". Não
     existia tom vermelho na família stat-card até aqui. */
  --stat-red: #9f1f1f;
  --stat-red-text: #fbd5d5;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 5px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.1), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);

  --sidebar-w: 216px;
  --topbar-h: 56px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* -------------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: content-box;
}

/* ------------------------------------------------------------------ layout */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* --- sidebar --- */
.sidebar {
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* PRD-marca-sidebar-logo.md v1.2 — a faixa de topo não é mais altura
   fixa (`--topbar-h`, 56px): o logo renderiza no tamanho intrínseco do
   SVG (100×45, os atributos `width`/`height` do próprio arquivo, sem
   `height`/`width` sobrepostos em `.sidebar__brand-logo`) e o container
   cresce pra acomodar — padding vertical no lugar de altura travada,
   corrigindo o achado de QA visual da v1.1 (24px fixo saiu pequeno
   demais comparado ao print de referência do usuário). */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.sidebar__brand-logo {
  display: block;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section {
  padding: 14px 8px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #4d5b78;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-item.is-active {
  background: var(--sidebar-item-active-bg);
  color: var(--sidebar-item-active-text);
  font-weight: 600;
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.9;
}

.nav-item__badge {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.nav-item.is-active .nav-item__badge {
  background: rgba(2, 19, 15, 0.22);
  color: var(--sidebar-item-active-text);
}

.nav-item--cta {
  background: var(--sidebar-cta-bg);
  color: var(--sidebar-cta-text);
  font-weight: 650;
  margin-bottom: 8px;
}

.nav-item--cta:hover {
  background: var(--sidebar-cta-bg);
  color: var(--sidebar-cta-text);
  filter: brightness(0.94);
}

.sidebar__footer {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
}

.sidebar__user:hover {
  background: var(--sidebar-hover);
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.25;
}

.sidebar__user-mail {
  font-size: 11px;
  color: #64748b;
}

/* --- área principal --- */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  flex-shrink: 0;
}

.topbar__title {
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
}

.topbar__spacer {
  flex: 1;
}

.content {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.content--scroll {
  overflow-y: auto;
  padding: 20px;
}

/* -------------------------------------------------------------- componentes */

/* --- botões --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.btn:hover {
  background: var(--surface-2);
  border-color: #94a3b8;
}

.btn:active {
  transform: translateY(0.5px);
}

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

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn--success:hover {
  filter: brightness(0.94);
}

/* PRD-marcar-venda.md §5.1 (v1.2) — fundo verde suave pro botão "Marcar
   venda", mesmos tokens de .badge--success e do cartão de aviso da §5.2
   (--success-soft/#a7f3d0/#047857), não a cor cheia de .btn--success
   (que é escura demais/alto contraste, feita pra CTA forte tipo
   "Aprovar"). Precisa se destacar de "Fechar conversa"/"Abrir lead"
   mesmo antes de marcado, por isso não é condicional a nenhum estado. */
.btn--success-soft {
  background: var(--success-soft);
  border-color: #a7f3d0;
  color: #047857;
}
.btn--success-soft:hover {
  filter: brightness(0.97);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn--danger:hover {
  filter: brightness(0.94);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn--icon {
  width: 34px;
  padding: 0;
}
.btn--icon.btn--sm {
  width: 28px;
}

.btn__icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* --- campos --- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.field__hint {
  font-size: 11.5px;
  /* PRD-refinamento-hig.md §5.1 — orientação de preenchimento às vezes
     carrega aviso real ("sem o número, não dá pra conversar pelo CRM"),
     não é rodapé decorativo — --text-muted, não --text-faint. */
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.13);
}

.textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
  padding-right: 30px;
}

.search {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search .input {
  padding-left: 33px;
}

.search__icon {
  /* PRD-refinamento-hig.md §5.1 — mantido: ícone decorativo, não texto
     lido; o placeholder ao lado já explica o campo de busca. */
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

/* --- avatar --- */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 15px;
}

.avatar--xl {
  width: 60px;
  height: 60px;
  font-size: 20px;
}

/* --- tag / badge --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.tag__remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 13px;
  line-height: 1;
}
.tag__remove:hover {
  opacity: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge--success { background: var(--success-soft); color: #047857; border-color: #a7f3d0; }
.badge--warning { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.badge--danger  { background: var(--danger-soft);  color: #b91c1c; border-color: #fecaca; }
.badge--accent  { background: var(--accent-soft);  color: #4338ca; border-color: #c7d2fe; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* --- card genérico --- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-size: 13.5px;
  font-weight: 650;
}

.panel__body {
  padding: 16px;
}

/* --- cartão de destaque (PRD-refinamento-visual.md §5.1) ---
   Dashboard/Analytics: fundo de cor cheia em vez de branco+borda, número
   grande, tons claros da mesma família pro resto do conteúdo — nunca
   texto escuro/neutro em cima de fundo colorido. */
.stat-card {
  border-radius: 16px;
  padding: 20px;
  color: var(--stat-text, #fff);
}

.stat-card--green  { background: var(--stat-green);  --stat-text: var(--stat-green-text); }
.stat-card--blue   { background: var(--stat-blue);   --stat-text: var(--stat-blue-text); }
.stat-card--amber  { background: var(--stat-amber);  --stat-text: var(--stat-amber-text); }
.stat-card--violet { background: var(--stat-violet); --stat-text: var(--stat-violet-text); }
.stat-card--red    { background: var(--stat-red);    --stat-text: var(--stat-red-text); }

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--stat-text);
}

.stat-card__icon {
  width: 18px;
  height: 18px;
  color: var(--stat-text);
  flex-shrink: 0;
}

.stat-card__number {
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  line-height: 1.15;
}

.stat-card__subtitle {
  font-size: 13px;
  color: var(--stat-text);
  margin-top: 2px;
}

.stat-card__body {
  margin-top: 16px;
  font-size: 13px;
  color: var(--stat-text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card__item {
  /* Escurecer (não clarear) o fundo do item, mesmo a PRD original
     propondo rgba(255,255,255,0.14): clarear o fundo aproxima a cor de
     fundo do tom claro do texto, e o contraste medido fica abaixo de
     4.5:1 (WCAG AA) nos 4 tons — escurecer preserva o "item destacado
     dentro do cartão" e passa em todas as combinações. */
  background: rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-card__item a {
  color: #fff;
}

/* Etapa do funil com valor concentrado (PRD-dashboard-cliente-v2.md
   §5.2) — barra horizontal proporcional ao valor da etapa, atrás do
   texto, mesmo escurecimento de fundo que `.stat-card__item` já usa
   (motivo idêntico: clarear aproxima demais do tom do texto e falha
   contraste AA). Largura em `style="width:X%"` inline, calculada no
   template a partir do maior valor entre as etapas. */
.stat-card__stage-row {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  padding: 4px 6px;
}

.stat-card__stage-bar {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  z-index: 0;
}

.stat-card__stage-row > * {
  position: relative;
  z-index: 1;
}

/* Mini-gráfico de barras (PRD §5.3) — sem SVG, sem biblioteca: um <div>
   por dia, altura proporcional ao valor. */
.stat-card__bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 44px;
  margin-top: 14px;
}

.stat-card__bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}

.stat-card__bar {
  width: 100%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
}

.stat-card__bar-label {
  font-size: 9.5px;
  color: var(--stat-text);
  opacity: 0.85;
}

/* --- tabela --- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  /* PRD-refinamento-hig.md §5.1 — cabeçalho de coluna é informação
     estrutural (nome do dado que a linha carrega), não decoração. */
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tbody tr {
  cursor: pointer;
}

/* --- linha de menção não lida (PRD-notas-mencao.md §5.3) --- */
.table tbody tr.is-unread {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* --- estado vazio --- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty__icon {
  width: 40px;
  height: 40px;
  color: var(--border-strong);
  stroke-width: 1.4;
}

.empty__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.empty__text {
  font-size: 13px;
  max-width: 340px;
}

/* --- modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 24px;
  animation: fade-in 0.12s ease-out;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.14s ease-out;
}

/* O único filho direto de `.modal` é o `<form>` — sem isto, o flex column
   de `.modal` só tem um item (o form, num bloco normal) e o `flex: 1` do
   `.modal__body` não tem efeito nenhum, porque o pai imediato dele não é
   um flex container. O form precisa repetir o mesmo layout pra header,
   body e footer se distribuírem certo dentro da altura do modal. */
.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal--wide { max-width: 760px; }

.modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: 15.5px;
  font-weight: 650;
  flex: 1;
}

.modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
}

/* --- toast --- */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 300;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: #1e293b;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out;
}

.toast--success { background: #047857; }
.toast--error { background: #b91c1c; }
.toast--warning { background: #b45309; }

.toast.is-leaving {
  animation: toast-out 0.18s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

/* ----------------------------------------------------------------- KANBAN */
.board {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board__columns {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
}

/* --- guia inicial (onboarding guiado) --- */

.onb-panel {
  flex-shrink: 0;
  margin: 16px 16px 0;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.onb-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.onb-panel__title {
  font-size: 14.5px;
  font-weight: 700;
}

.onb-panel__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.onb-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 16px;
}

.onb-progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.onb-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.onb-step {
  display: flex;
  gap: 12px;
}

.onb-step--bonus {
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.onb-step.is-locked {
  opacity: 0.5;
}

.onb-step__check {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
}

.onb-step.is-done .onb-step__check {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.onb-step__check-icon {
  width: 13px;
  height: 13px;
}

.onb-step__body {
  flex: 1;
  min-width: 0;
}

.onb-step__title {
  font-size: 13.5px;
  font-weight: 650;
  margin-bottom: 2px;
}

.onb-step.is-done .onb-step__title {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 600;
}

.onb-step__tag {
  font-size: 10.5px;
  font-weight: 600;
  /* PRD-refinamento-hig.md §5.1 — "opcional"/"bônus" é informação real
     (define se o passo pode ser pulado), tamanho pequeno agrava o risco
     de baixo contraste em vez de compensar. */
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-left: 4px;
}

.onb-step__text {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  max-width: 480px;
}

.onb-step__done-text {
  font-size: 12.5px;
  color: var(--success);
}

.onb-niche-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.onb-niche-btn {
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.onb-niche-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.onb-celebrate {
  text-align: center;
  padding: 10px 8px;
}

.onb-celebrate__icon {
  width: 30px;
  height: 30px;
  color: var(--success);
  margin: 0 auto 6px;
}

.onb-celebrate__title {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.onb-celebrate__text {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 460px;
  margin: 0 auto;
}

/* --- painel de marcos: escala de NPS (0-10) --- */
.nps-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.nps-scale__opt {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.nps-scale__opt input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.nps-scale__opt:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.onb-step__warning {
  font-size: 12.5px;
  color: var(--warning);
  background: var(--warning-soft);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 8px;
  max-width: 480px;
}

.onb-welcome__title {
  font-size: 15.5px;
  font-weight: 700;
}

.onb-welcome__text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  max-width: 480px;
}

.onb-welcome__question {
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 8px;
}

.onb-fonte-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onb-fonte-opcao {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.onb-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  cursor: pointer;
}

.lead-card__ad {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 5px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: help;
}

.column__empty {
  /* PRD-refinamento-hig.md §5.1 — mantido: estado vazio ("Nenhum lead
     aqui"), sem informação que a pessoa precise ler pra agir. */
  padding: 20px 10px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

.column {
  width: 296px;
  min-width: 296px;
  display: flex;
  flex-direction: column;
  background: #e4eaf2;
  border-radius: var(--radius-lg);
  max-height: 100%;
  transition: background 0.14s;
}

.column.is-dragover {
  background: #d6e0ee;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.column__header {
  padding: 11px 13px 9px;
  flex-shrink: 0;
}

.column__title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.column__color {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.column__name {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column__count {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 1px 7px;
}

.column__sum {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 650;
  color: #0f172a;
}

.column__cards {
  flex: 1;
  overflow-y: auto;
  padding: 3px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 60px;
}

.column__footer {
  padding: 0 8px 9px;
}

.column__add {
  width: 100%;
  height: 30px;
  border: 1px dashed #a8b6c9;
  border-radius: var(--radius);
  background: transparent;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.column__add:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent);
  border-color: var(--accent);
}

/* --- card do lead --- */
.lead-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 11px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  border-left: 3px solid transparent;
  transition: box-shadow 0.12s, transform 0.12s;
  position: relative;
}

.lead-card:hover {
  box-shadow: var(--shadow-md);
}

.lead-card.is-dragging {
  opacity: 0.42;
  cursor: grabbing;
}

.lead-card.is-saving {
  opacity: 0.65;
  pointer-events: none;
}

.lead-card.is-saving::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.lead-card.is-stale {
  border-left-color: var(--warning);
}

.lead-card.has-unread {
  border-left-color: var(--success);
}

.lead-card__title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-card__contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.lead-card__value {
  font-size: 13px;
  font-weight: 700;
  color: #047857;
}

.lead-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.lead-card__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--surface-2);
  font-size: 11.5px;
  /* PRD-refinamento-hig.md §5.1 — "há quanto tempo parado" é o sinal que
     a pessoa escaneia o board pra achar lead esquecido, não decoração. */
  color: var(--text-muted);
}

.lead-card__meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lead-card__meta--warn { color: var(--warning); font-weight: 600; }
.lead-card__meta--danger { color: var(--danger); font-weight: 600; }

.lead-card__unread {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.card-placeholder {
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  margin: 2px 0;
}

/* ------------------------------------------------------------------ INBOX */
.inbox {
  flex: 1;
  display: grid;
  grid-template-columns: 306px 1fr 316px;
  overflow: hidden;
  min-height: 0;
}

.inbox--no-aside {
  grid-template-columns: 306px 1fr;
}

/* --- lista de conversas --- */
.conv-list {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conv-list__search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.conv-list__items {
  flex: 1;
  overflow-y: auto;
}

.conv-item {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
  transition: background 0.1s;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item.is-active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.conv-item__body {
  flex: 1;
  min-width: 0;
}

.conv-item__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.conv-item__name {
  font-size: 13.5px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item__time {
  font-size: 11px;
  /* PRD-refinamento-hig.md §5.1 — horário da conversa, uso confirmado
     como estrutural na auditoria (2.56:1 falhava AA). */
  color: var(--text-muted);
  flex-shrink: 0;
}

.conv-item__preview {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.conv-item.is-unread .conv-item__name,
.conv-item.is-unread .conv-item__preview {
  font-weight: 650;
  color: var(--text);
}

.conv-item__badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  align-self: center;
}

/* --- painel de conversa --- */
.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5f7fb;
  min-width: 0;
}

.chat__header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 56px;
}

.chat__name {
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.2;
}

.chat__sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat__feed {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scroll-behavior: smooth;
}

.chat__day {
  align-self: center;
  margin: 14px 0 10px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.07);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.chat__load-more {
  align-self: center;
  margin-bottom: 8px;
  width: 100%;
}

/* --- bolhas --- */
.bubble-row {
  display: flex;
  margin-bottom: 4px;
}

.bubble-row--out {
  justify-content: flex-end;
}

.bubble {
  max-width: min(620px, 74%);
  padding: 8px 12px 6px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  position: relative;
}

.bubble--in {
  border-top-left-radius: 3px;
}

.bubble--out {
  background: #dcf0ff;
  border-top-right-radius: 3px;
}

.bubble__author {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.bubble__text {
  white-space: pre-wrap;
}

.bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
  font-size: 10.5px;
  /* PRD-refinamento-hig.md §5.1 — horário/status de entrega da mensagem é
     estrutural. --text-muted-strong, não --text-muted: esta legenda cai
     tanto sobre .bubble--in (fundo --surface, branco) quanto
     .bubble--out (fundo #dcf0ff) — --text-muted sozinho passa em branco
     mas fica abaixo de 4.5:1 em #dcf0ff. */
  color: var(--text-muted-strong);
  line-height: 1;
}

.bubble__status {
  font-size: 11px;
  letter-spacing: -1px;
}
.bubble__status.is-read { color: var(--info); }
.bubble__status.is-failed { color: var(--danger); letter-spacing: 0; }

.bubble__media img,
.bubble__media video {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 4px;
}

.bubble__audio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.bubble__audio audio {
  height: 32px;
  flex: 1;
}

.bubble__file {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
}

.bubble__file-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}

.bubble__transcript {
  margin-top: 6px;
  padding: 7px 9px;
  border-left: 2px solid var(--accent);
  background: rgba(79, 70, 229, 0.05);
  border-radius: 0 5px 5px 0;
  font-size: 12.5px;
  color: #334155;
  font-style: italic;
}

.bubble__transcript-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-style: normal;
  margin-bottom: 2px;
}

.bubble__unknown {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--warning-soft);
  color: #b45309;
  font-size: 12.5px;
  line-height: 1.45;
}

.bubble__unknown-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--warning);
}

/* --- nota interna e evento de sistema --- */
.note-row {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}

.note {
  max-width: min(620px, 80%);
  padding: 9px 13px;
  border-radius: 9px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 13px;
  color: #78350f;
}

.note__header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  margin-bottom: 3px;
}

/* --- dica (sugestão proativa do sistema) --- */
.tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 16px 0;
  padding: 10px 13px;
  border-radius: 9px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.tip__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--info);
}

.tip__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tip__text {
  font-size: 13px;
  line-height: 1.45;
  color: #1e3a8a;
}

/* --- aviso "venda marcada" no painel do lead (PRD-marcar-venda.md §5.2) —
   mesmas cores de .badge--success (já validadas), fundo verde suave,
   dentro de um .aside__section (lista agrupada, PRD-refinamento-hig.md),
   não por fora dela. */
.sale-flag-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sale-flag-banner__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #047857;
}

.sale-flag-banner__text {
  font-size: 13px;
  line-height: 1.45;
  color: #047857;
}

/* --- aviso de opt-out no composer (PRD-consentimento-lgpd.md §5.2) —
   mesma estrutura de .sale-flag-banner, cor de aviso (--warning family)
   em vez de sucesso; fica dentro do próprio composer, não de um
   .aside__section (não existe um painel lateral pra isto, o aviso
   precisa estar "na conversa" mesmo, junto de onde o envio acontece). */
.optout-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--warning-soft);
  border-bottom: 1px solid var(--border);
}

.optout-banner__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #b45309;
}

.optout-banner__text {
  font-size: 13px;
  line-height: 1.45;
  color: #b45309;
}

.system-row {
  display: flex;
  justify-content: center;
  margin: 7px 0;
}

.system-event {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.055);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* --- composer --- */
.composer {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.composer__tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px 0;
}

.composer__tab {
  padding: 6px 13px;
  border: none;
  background: transparent;
  border-radius: 7px 7px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.composer__tab.is-active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.composer__tab[data-tab="note"].is-active {
  box-shadow: inset 0 -2px 0 var(--warning);
}

.composer__body {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 9px 12px 11px;
}

.composer__input {
  flex: 1;
  min-height: 38px;
  max-height: 170px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  resize: none;
  font-size: 13.5px;
  line-height: 1.45;
  overflow-y: auto;
}

.composer__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.composer.is-note .composer__input:focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.composer.is-note .composer__input {
  background: #fffdf5;
}

.composer__send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.composer__send:hover { background: var(--accent-hover); }
.composer__send:disabled { opacity: 0.45; cursor: not-allowed; }

.composer.is-note .composer__send { background: var(--warning); }

.composer__hint {
  padding: 0 12px 8px;
  font-size: 11px;
  /* PRD-refinamento-hig.md §5.1 — não é sempre atalho de teclado: também
     mostra aviso operacional real ("canal desconectado", por qual canal
     está enviando) — carrega informação, não é rodapé decorativo. */
  color: var(--text-muted);
}

.composer__blocked {
  padding: 14px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--warning-soft);
  border-top: 1px solid #fde68a;
}

.composer__quickreply-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 15px;
}

.composer__quickreply-btn:hover { background: var(--surface-2); color: var(--text); }

/* --- respostas rápidas: lista filtrável (PRD-respostas-rapidas.md §5.3) --- */
.quickreply-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 100%;
  margin-bottom: 6px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  z-index: 20;
}

.quickreply-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.quickreply-menu__item:last-child { border-bottom: none; }
.quickreply-menu__item:hover,
.quickreply-menu__item.is-active { background: var(--surface-2); }

.quickreply-menu__shortcut {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}

.quickreply-menu__preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quickreply-menu__empty {
  /* PRD-refinamento-hig.md §5.1 — mantido: estado vazio de dropdown,
     mesmo critério de .column__empty. */
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* --- @menção em nota (PRD-notas-mencao.md §5.2) --- */
.mention-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 100%;
  margin-bottom: 6px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  z-index: 20;
}

.mention-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.mention-menu__item:last-child { border-bottom: none; }
.mention-menu__item:hover,
.mention-menu__item.is-active { background: var(--surface-2); }

.mention-menu__empty {
  /* PRD-refinamento-hig.md §5.1 — mantido: estado vazio de dropdown,
     mesmo critério de .column__empty. */
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.mention {
  color: var(--accent);
  font-weight: 600;
}

.note-add { position: relative; }

/* --- painel lateral do lead ---
   PRD-refinamento-hig.md §5.2: as 5+ seções (Contato/Campos/Tags/
   Tarefas/Notas, mais cabeçalho/valor/motivo de perda/IA/ações) estavam
   emendadas por uma borda de 1px só, mesmo fundo branco em todas — difícil
   escanear onde uma termina e a outra começa. Tratamento escolhido:
   lista agrupada (grouped list, padrão HIG) — `.aside` vira um fundo
   cinza-claro, cada `.aside__section` vira um cartão branco com raio e
   sombra própria, separados por `gap` real (espaço), não só uma linha. */
.aside {
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.aside__section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px;
}

/* PRD-marcar-venda.md §5.2 — o aviso de "venda marcada" é seu próprio
   cartão dentro da lista agrupada (mesmo raio/sombra/gap dos outros),
   só troca o fundo pra verde suave em vez de branco. */
.aside__section--sale-flag {
  background: var(--success-soft);
  box-shadow: none;
  border: 1px solid #a7f3d0;
}

.aside__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  /* PRD-refinamento-hig.md §5.1 — título de seção, uso confirmado como
     estrutural na auditoria (2.56:1 falhava AA); também ajuda §5.2 (o
     título mais escuro pesa mais como âncora de onde uma seção começa). */
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aside__title-action {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 6px 10px;
  font-size: 12.5px;
  align-items: baseline;
}

.kv__key {
  /* PRD-refinamento-hig.md §5.1 — rótulo de campo, uso confirmado como
     estrutural na auditoria (pode guardar dado de negócio importante). */
  color: var(--text-muted);
  font-weight: 500;
}

.kv__val {
  color: var(--text);
  font-weight: 550;
  overflow-wrap: anywhere;
}

.kv__val--empty {
  /* PRD-refinamento-hig.md §5.1 — mantido de propósito: indica ausência
     de dado ("não informado"), o tom mais claro + itálico é o sinal
     visual de "isto está vazio", não informação que precise ser lida —
     corrigir pra --text-muted igualaria visualmente com valor preenchido. */
  color: var(--text-faint);
  font-weight: 400;
  font-style: italic;
}

/* --- barra de etapas no painel --- */
.stage-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 10px;
}

.stage-pip {
  flex: 1;
  height: 5px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
  transition: transform 0.1s;
}

.stage-pip:hover { transform: scaleY(1.7); }
.stage-pip.is-done { background: var(--accent); }
.stage-pip.is-current { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* --- bloco de IA --- */
.ai-box {
  background: linear-gradient(180deg, #f5f3ff, #ffffff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  padding: 12px;
}

.ai-box__score {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.ai-box__score-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: #6d28d9;
}

.ai-box__label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7c3aed;
  margin: 9px 0 3px;
}

.ai-box__text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #334155;
}

.ai-box__list {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  color: #334155;
}

/* ------------------------------------------------------------- LEAD DETALHE */
/* PRD-padronizar-lado-painel-lead.md §5.1 — painel (`.lead-page__side`)
   sempre à direita, mesmo lado de `.inbox` (Conversas). `1fr` primeiro
   (chat, coluna larga) e `336px` depois (painel, coluna estreita) —
   invertido junto com a ordem dos elementos em `lead.html`. */
.lead-page {
  display: grid;
  grid-template-columns: 1fr 336px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.lead-page__side {
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}

.lead-page__main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5f7fb;
}

/* ------------------------------------------------------------------ TAREFAS */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.task-row:hover { background: var(--surface-2); }

.task-row.is-done { opacity: 0.55; }
.task-row.is-done .task-row__title { text-decoration: line-through; }

.task-row.is-overdue { background: var(--danger-soft); }
.task-row.is-overdue:hover { background: #fee2e2; }

.task-check {
  width: 19px;
  height: 19px;
  border: 1.8px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: background 0.12s, border-color 0.12s;
}

.task-check:hover { border-color: var(--success); }
.task-check.is-done { background: var(--success); border-color: var(--success); color: #fff; }

.task-row__title { font-size: 13.5px; font-weight: 550; }
.task-row__meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- CONEXÃO QR */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 22px;
  text-align: center;
}

/* Moldura com anel em gradiente (mesmo verde de marca, --accent) — o
   `::before` desenha o anel por baixo do cartão branco via mask-composite,
   sem precisar de um elemento extra só pra isso. */
.qr-box__code {
  position: relative;
  width: 272px;
  height: 272px;
  padding: 16px;
  background: #fff;
  border-radius: 22px;
  display: grid;
  place-items: center;
  box-shadow:
    0 20px 44px -22px color-mix(in srgb, var(--accent) 45%, transparent),
    0 2px 10px rgba(15, 23, 42, 0.06);
}

.qr-box__code::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 24px;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent), #a7f3d0 45%, var(--accent-hover));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Linha de varredura, sobe e desce por cima do QR — só reforço visual
   "tech", nunca esconde o código (opacidade baixa, para no topo/base). */
.qr-box__scan {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: qr-scan 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes qr-scan {
  0%   { top: 16px; opacity: 0; }
  8%   { opacity: .85; }
  50%  { top: calc(100% - 18px); opacity: .85; }
  92%  { opacity: 0; }
  100% { top: calc(100% - 18px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .qr-box__scan { animation: none; display: none; }
}

.qr-box__code img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.qr-box__steps {
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 330px;
  margin: 0;
  padding-left: 18px;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 11px;
}

.channel-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.channel-card__name { font-size: 14px; font-weight: 650; }
.channel-card__sub { font-size: 12.5px; color: var(--text-muted); }

/* ------------------------------------------------------------------- LOGIN */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  /* PRD-marca-em-todo-produto.md v1.1 — verde-escuro sólido do sidebar
     (#02130F), não mais o gradiente indigo antigo. Era um dos "4 pontos
     deixados de fora de propósito" na migração de paleta de
     PRD-polimento-operacional.md v1.8, revisitado agora. */
  background: #02130F;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  padding: 34px 32px 28px;
}

/* PRD-marca-em-todo-produto.md §5.1 — marca real (wordmark) no lugar
   do placeholder "C" em caixa com gradiente. Tamanho intrínseco do SVG
   (100×45, sem height/width sobrepostos) — mesmo cuidado já corrigido
   em `PRD-marca-sidebar-logo.md` v1.2/v1.3, não repete o erro de
   altura fixa pequena demais. Card é sempre fundo claro, por isso
   `parolilogo_b.svg` (versão escura), não a `_w` do sidebar. */
.login-card__logo {
  display: block;
  margin: 0 auto 16px;
}

.login-card__title {
  text-align: center;
  font-size: 19px;
  margin-bottom: 4px;
}

.login-card__sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-card__error {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

/* -------------------------------------------------------------- utilitários */
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 650; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.scroll-y { overflow-y: auto; }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Indicador de requisição HTMX em voo — `display:none` (não só opacity:0)
   é o que importa aqui: `.btn` é `display:flex` com `gap`, então um span
   invisível só por opacity continua ocupando a largura do spinner + o gap
   do flex, deixando o botão maior que o texto mesmo parado (achado em uso
   real, PRD-polimento-operacional.md, correção pós-ship #4). */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------- responsivo */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 272px 1fr 288px; }
}

@media (max-width: 1080px) {
  .inbox { grid-template-columns: 260px 1fr; }
  .inbox .aside { display: none; }
  /* PRD-padronizar-lado-painel-lead.md §5.1 — mesma inversão da regra
     base acima: painel (336px→300px nesta faixa) continua na 2ª
     coluna, não na 1ª. */
  .lead-page { grid-template-columns: 1fr 300px; }
}

@media (max-width: 820px) {
  :root { --sidebar-w: 60px; }
  .sidebar__brand span,
  .nav-item span,
  .sidebar__user div,
  .sidebar__section { display: none; }
  .nav-item { justify-content: center; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .conv-list { display: none; }
  /* Coluna única + esconder `.lead-page__side` por classe (não por
     posição) — não depende de qual lado o painel está, continua certo
     depois da inversão sem precisar mudar nada aqui. */
  .lead-page { grid-template-columns: 1fr; }
  .lead-page__side { display: none; }
}
