
@font-face { font-family: "Outfit"; src: url("/painel/assets/fonts/outfit-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("/painel/assets/fonts/outfit-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("/painel/assets/fonts/outfit-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/painel/assets/fonts/barlow-condensed-latin-700-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

/* ==========================================================================
   Cores e medidas do painel: TODAS ficam aqui (o teste assets.test.ts confere que não há cor fixa fora do :root).
   Marca (brandbook): amarelo #FFD25C, laranja #EC6608, preto #030304. Contraste conferido (AA, 4,5:1) nos pares
   de texto: ver o comentário ao lado de cada grupo.
   ========================================================================== */
:root {
  /* Marca */
  --kivos-yellow: #FFD25C;
  --kivos-orange: #EC6608;
  --kivos-black: #030304;
  --kivos-white: #FFFFFF;

  /* Base: texto #141416 sobre o fundo 16,9:1; secundário #5E5E66 5,9:1 (6,4:1 no branco) */
  --bg: #F6F5F3;
  --surface: #FFFFFF;
  --surface-alt: #FAF9F7;        /* campos */
  --surface-muted: #F1EFEC;      /* abas, selos neutros */
  --surface-sunken: #ECEAE6;     /* separadores e notas no meio da conversa (texto secundário 5,3:1) */
  --border: #E7E4DF;
  --border-strong: #D9D5CF;
  --text: #141416;
  --text-2: #5E5E66;
  --text-3: #3A3A40;             /* prévia da conversa aberta */
  --link: #B34A05;               /* 5,4:1 no branco, 4,9:1 no fundo */
  --link-hover: #8A3904;
  --focus: #B34A05;
  --shadow: rgba(20, 20, 22, .08);
  --shadow-strong: rgba(20, 20, 22, .14);

  /* Menu lateral: texto 11,7:1; rótulos 5,6:1; "Consultoria online" 7,5:1; contador 14,4:1 */
  --nav-bg: #0E0E10;
  --nav-active-bg: #1C1C20;
  --nav-text: #C9C9CF;
  --nav-text-active: #FFFFFF;
  --nav-label: #8A8A93;
  --nav-tag: #A1A1AA;
  --nav-divider: #26262B;
  --nav-avatar-bg: #26262B;
  --nav-badge-bg: var(--kivos-yellow);
  --nav-badge-text: var(--kivos-black);
  --nav-icon-active: var(--kivos-yellow);

  /* Faixa da marca (3 px) */
  --stripe-1: var(--kivos-white);
  --stripe-2: var(--kivos-yellow);
  --stripe-3: var(--kivos-orange);
  --stripe-head-1: var(--kivos-black);

  /* Botões: principal 18,4:1; enviar (ícone preto no laranja) 6,4:1, nunca texto branco no laranja */
  --btn-primary-bg: #141416;
  --btn-primary-text: #FFFFFF;
  --btn-primary-hover: #2A2A2E;
  --btn-primary-icon: var(--kivos-yellow);
  --btn-secondary-bg: #FFFFFF;
  --btn-secondary-border: #141416;
  --btn-secondary-text: #141416;
  --btn-secondary-hover: #F1EFEC;
  --btn-tertiary-text: #5E5E66;
  --btn-send-bg: var(--kivos-orange);
  --btn-send-icon: var(--kivos-black);
  --btn-send-hover: #D45A06;
  --control-accent: #141416;     /* caixas de marcação e rádios */

  /* Selos: equipe 5,9:1; link 6,1:1; neutro 5,6:1. Lead esperando resposta: a hora fica em laranja-escuro na lista */
  --badge-team-bg: #FDEBDD;
  --badge-team-text: #9A3F04;
  --badge-link-bg: #FFF4D6;
  --badge-link-text: #7A5600;
  --badge-neutral-bg: #F1EFEC;
  --badge-neutral-text: #5E5E66;
  --stage-bg: #141416;
  --stage-text: #FFFFFF;

  /* Lista de conversas: hora de quem espera resposta 5,1:1 no fundo da conversa aberta */
  --row-open-bg: #FFF6EF;
  --row-hover-bg: #FAF9F7;
  --time-urgent: #B34A05;
  --avatar-bg: #F1EFEC;
  --avatar-text: #141416;
  --avatar-open-bg: var(--kivos-yellow);
  --avatar-open-text: var(--kivos-black);

  /* Balões: Letícia 18:1 (rótulo 12,6:1, hora 7:1); equipe 15:1 (rótulo 4,96:1, hora 5,5:1) */
  --chat-bg: #F6F5F3;
  --bubble-lead-bg: #FFFFFF;
  --bubble-lead-text: #141416;
  --bubble-lead-border: #E7E4DF;
  --bubble-lead-meta: #5E5E66;
  --bubble-bot-bg: #16161A;
  --bubble-bot-text: #FFFFFF;
  --bubble-bot-label: var(--kivos-yellow);
  --bubble-bot-meta: #A1A1AA;
  --bubble-bot-border: #3A3A40;
  --bubble-bot-card: #232328;
  --bubble-bot-link: var(--kivos-yellow);
  --bubble-team-bg: #FDEBDD;
  --bubble-team-text: #1A1A1E;
  --bubble-team-label: #A84A06;
  --bubble-team-meta: #5E5E66;
  --file-badge-bg: var(--kivos-orange);
  --file-badge-text: var(--kivos-black);

  /* Faixas de modo da conversa: equipe 5,9:1; Letícia atendendo 15,9:1 */
  --mode-team-bg: #FDEBDD;
  --mode-team-text: #9A3F04;
  --mode-bot-bg: #F1EFEC;
  --mode-bot-text: #141416;

  /* Janela de 24h */
  --window-open-dot: #1F8A4C;
  --window-soon-dot: var(--kivos-orange);

  /* Estados: faixa vermelha 6,6:1; erro suave 5,8:1 (texto principal no erro suave 16:1); ok 5,9:1; aviso 6,1:1 */
  --danger: #B42318;
  --danger-text: #FFFFFF;
  --danger-soft: #FDECEA;
  --danger-hover: #FBDCD8;
  --ok: #0F6B45;
  --ok-soft: #E7F6EF;
  --warn: #7A5600;
  --warn-soft: #FFF4D6;
  --switch-off: #C9C5BE;
  --switch-on: var(--kivos-orange);
  --switch-knob: #FFFFFF;

  /* Agente de IA: diff da publicação e aviso de "isto desfaz" (laranja da marca na borda) */
  --diff-in-bg: #E7F6EF;
  --diff-in-mark: #0F6B45;
  --diff-out-bg: #FDECEA;
  --diff-out-mark: #B42318;
  --undo-border: var(--kivos-orange);
  --step-active-number-bg: var(--kivos-yellow);
  --step-active-number-text: var(--kivos-black);

  /* Follow-up: faixa escura do resumo (texto 18,9:1; detalhe 7,5:1; link 13,4:1), coluna do link a conferir
     (selo 6,1:1), balão do follow-up com borda tracejada amarela e nota neutra na conversa (5,3:1) */
  --fu-strip-bg: var(--nav-bg);
  --fu-strip-text: var(--nav-text-active);
  --fu-strip-meta: var(--nav-tag);
  --fu-strip-link: var(--kivos-yellow);
  --fu-strip-accent: var(--kivos-orange);
  --fu-col-bg: var(--surface-alt);
  --fu-link-col-border: var(--kivos-yellow);
  --fu-due: var(--ok);
  --bubble-followup-border: var(--kivos-yellow);
  --note-info-bg: var(--surface-sunken);
  --note-info-text: var(--text-2);

  /* Painel (Fase 5): faixa escura da conversão (número amarelo 15,4:1; detalhe 7,5:1; variação no escuro 11:1 e 9:1),
     funil nas cores da marca (preto, grafite, laranja, amarelo; os números ficam fora das barras), variação boa/ruim
     (5,9:1 e 6,6:1), aviso de falta de dados (6,1:1) e indicador "Letícia no ar" (verde 5,9:1; cinza 5,6:1) */
  --db-hero-bg: var(--nav-bg);
  --db-hero-text: var(--nav-text-active);
  --db-hero-meta: var(--nav-tag);
  --db-hero-number: var(--kivos-yellow);
  --db-hero-accent: var(--kivos-orange);
  --db-hero-chip-bg: var(--nav-active-bg);
  --db-funnel-leads: var(--kivos-black);
  --db-funnel-engajados: var(--text-3);
  --db-funnel-link: var(--kivos-orange);
  --db-funnel-alunos: var(--kivos-yellow);
  --db-bar-track: var(--surface-muted);
  --db-mini-fill: var(--kivos-orange);
  --db-good: var(--ok);
  --db-bad: var(--danger);
  --db-flat: var(--text-2);
  --db-good-on-dark: #6EE7A8;
  --db-bad-on-dark: #FCA5A0;
  --db-air-on: var(--window-open-dot);
  --db-air-on-bg: var(--ok-soft);
  --db-air-on-text: var(--ok);
  --db-air-off: var(--switch-off);
  --db-air-off-bg: var(--surface-muted);
  --db-air-off-text: var(--text-2);
  --db-small-bg: var(--warn-soft);
  --db-small-text: var(--warn);
  --db-segment-active-bg: var(--btn-primary-bg);
  --db-segment-active-text: var(--btn-primary-text);
  --panel-filter-bg: var(--badge-link-bg);
  --panel-filter-text: var(--badge-link-text);

  /* Forma e tipografia */
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --tap: 44px;
  --sidebar-width: 232px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 1280px; font: 400 15px/1.5 var(--font-body); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1 { margin: 0 0 8px; font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 34px; line-height: 1.05; letter-spacing: .01em; text-transform: uppercase; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; }
code { font-size: .88em; padding: 1px 5px; border-radius: 6px; background: var(--surface-muted); }
.muted, .hint { color: var(--text-2); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { flex: none; display: block; }

/* ==========================================================================
   Estrutura: menu lateral fixo + conteúdo
   ========================================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; gap: 24px; padding: 28px 16px 20px; background: var(--nav-bg); color: var(--nav-text); overflow-y: auto; }
.brand-link { display: block; padding: 0 8px; text-decoration: none; border-radius: var(--radius-sm); }
.brand { display: flex; flex-direction: column; gap: 14px; }
.brand-logo { display: block; width: 132px; height: auto; }
.brand-stripe { display: flex; width: 132px; height: 3px; border-radius: 2px; overflow: hidden; }
.brand-stripe span { flex: 1; }
.brand-stripe span:nth-child(1) { background: var(--stripe-1); }
.brand-stripe span:nth-child(2) { background: var(--stripe-2); }
.brand-stripe span:nth-child(3) { background: var(--stripe-3); }
.brand-tag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-tag); white-space: nowrap; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-group { margin: 0; padding: 0 12px 6px; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-label); }
.menu a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; border-radius: var(--radius-sm); color: var(--nav-text); text-decoration: none; }
.menu a:hover { background: var(--nav-active-bg); color: var(--nav-text-active); }
.menu a.active { background: var(--nav-active-bg); color: var(--nav-text-active); font-weight: 500; }
.menu a.active .icon { color: var(--nav-icon-active); }
.menu-label { flex: 1; }
.menu-soon { font-size: 11px; color: var(--nav-label); }
.nav-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--nav-badge-bg); color: var(--nav-badge-text); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-user { margin: auto 0 0; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--nav-divider); color: var(--nav-text-active); }
.sidebar-user-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user button.link { color: var(--nav-text); min-height: var(--tap); padding: 0 6px; }
.sidebar-user button.link:hover { color: var(--nav-text-active); }
.avatar.small { width: 36px; height: 36px; font-size: 13px; background: var(--nav-avatar-bg); color: var(--nav-text-active); }

main.page { margin-left: var(--sidebar-width); flex: 1; min-width: 0; padding: 32px 40px 64px; }
main.page > * { max-width: 1080px; }
main.full { margin-left: var(--sidebar-width); flex: 1; min-width: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

/* Faixa vermelha: erro de configuração nos envios para a Meta */
.send-banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; background: var(--danger); color: var(--danger-text); font-size: 14px; line-height: 1.45; border-radius: var(--radius); margin: 0 0 24px; }
.send-banner .icon { margin-top: 1px; }
.send-banner-body { flex: 1; min-width: 0; }
main.full .send-banner { border-radius: 0; margin: 0; }
.send-banner a { color: var(--danger-text); font-weight: 600; }
.send-banner-meta { display: block; margin-top: 2px; font-size: 13px; }

.coming-soon { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; margin-top: 16px; text-align: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.coming-soon p { margin: 0; font-size: 1.05rem; }
.coming-soon strong { color: var(--text); font-weight: 600; }
.coming-soon .brand-stripe { width: 96px; }
.coming-soon .brand-stripe span:nth-child(1) { background: var(--stripe-head-1); }

/* ==========================================================================
   Login
   ========================================================================== */
main.auth { min-height: 100vh; display: flex; }
.auth-shell { flex: 1; display: grid; grid-template-columns: minmax(360px, 40%) minmax(0, 1fr); min-height: 100vh; }
.auth-brand { background: var(--nav-bg); display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth-brand .brand { gap: 18px; }
.auth-brand .brand-logo, .auth-brand .brand-stripe { width: 200px; }
.auth-brand .brand-tag { font-size: 13px; }
.auth-card { align-self: center; justify-self: center; width: 100%; max-width: 420px; padding: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.auth-card button.primary { width: 100%; }

/* ==========================================================================
   Formulários e componentes gerais
   ========================================================================== */
.card, fieldset { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin: 0 0 16px; min-width: 0; }
fieldset legend { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-size: 1.05rem; font-weight: 600; }
fieldset legend + * { clear: both; }
fieldset > :last-child { margin-bottom: 0; }
fieldset > :not(legend) + :not(legend) { margin-top: 14px; }
/* Formulário de uma seção só (Ajustes): o formulário inteiro é o cartão, com o botão dentro dele */
form.stack:has(> fieldset:only-of-type) { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin: 0 0 16px; }
form.stack:has(> fieldset:only-of-type) > fieldset { border: 0; border-radius: 0; padding: 0; margin: 0; background: none; }
.card > .section-title:first-child { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); margin-bottom: 14px; }
fieldset fieldset { border-radius: var(--radius); background: var(--surface-alt); }
.section-title { margin: 0 0 10px; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.row .field { max-width: 120px; }
.push { margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 6px; max-width: 720px; }
main.page .grid-2, main.page form .actions, fieldset > p.muted, .card > p.muted { max-width: 720px; }
.field > span { font-weight: 500; font-size: 14px; }
.hint { font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=tel], input[type=number], input:not([type]), textarea, select {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-height: var(--tap);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--control-accent); flex: none; }
input[type=file] { font: inherit; font-size: 14px; min-height: var(--tap); }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
.error { color: var(--danger); font-size: 13px; }
.checkbox { display: inline-flex; gap: 10px; align-items: center; min-height: var(--tap); cursor: pointer; }
[role=radiogroup] { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 20px; row-gap: 0; }
[role=radiogroup] > span, [role=radiogroup] > small { flex-basis: 100%; }

button, .button { font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid var(--btn-secondary-border); background: var(--btn-secondary-bg); color: var(--btn-secondary-text); text-decoration: none; white-space: nowrap; }
button:hover, .button:hover { background: var(--btn-secondary-hover); color: var(--btn-secondary-text); }
button.primary, .button.primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); color: var(--btn-primary-text); }
button.primary .icon, .button.primary .icon { color: var(--btn-primary-icon); }
button.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
button.danger:hover { background: var(--danger-soft); color: var(--danger); }
button.link { border: 0; background: none; padding: 0 4px; color: var(--btn-tertiary-text); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
button.link:hover { background: none; color: var(--text); }
button[disabled], textarea[disabled] { opacity: .5; cursor: not-allowed; }
.button.small, button.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.button.tertiary, button.tertiary { border-color: transparent; background: none; color: var(--btn-tertiary-text); }
.button.tertiary:hover, button.tertiary:hover { background: var(--surface-muted); color: var(--text); }
.actions { display: flex; justify-content: flex-end; gap: 12px; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 16px; font-size: 14px; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert a { color: inherit; font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.back { margin: 0 0 4px; }
.back a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text-2); text-decoration: none; font-weight: 500; }
.back a:hover { color: var(--text); }
main.page > h1 + p.muted, main.page > .page-head + p.muted { margin-top: 0; }
main.page > p.muted:has(+ form), main.page > p.muted:has(+ section), main.page > p.muted:has(+ details) { margin-bottom: 20px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: 0; }
td a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; }
td.right { text-align: right; }
.tag { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 8px; background: var(--badge-neutral-bg); color: var(--badge-neutral-text); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.empty { color: var(--text-2); font-style: italic; }
.inactive { opacity: .7; }
details > summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; gap: 8px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; flex: none; }
details[open] > summary::before { transform: rotate(45deg); }
/* Confirmações (excluir, remover o PDF): cartão com borda, botão vermelho de contorno */
.delete-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.danger-zone .delete-form { margin-top: 0; }
.login { max-width: 380px; margin: 10vh auto; }
.team-list { margin: 0; padding-left: 20px; }
.team-list li { padding: 4px 0; }

/* Simulador: mesmos balões das Conversas (lead à esquerda em branco, Letícia à direita em escuro) */
.simulator { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; }
.simulator .chat { display: flex; flex-direction: column-reverse; gap: 12px; background: var(--chat-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; height: 55vh; overflow-y: auto; margin-bottom: 16px; }
.simulator .bubble { max-width: min(74%, 620px); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.simulator .bubble.lead { align-self: flex-start; background: var(--bubble-lead-bg); color: var(--bubble-lead-text); border: 1px solid var(--bubble-lead-border); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px; }
.simulator .bubble.bot { align-self: flex-end; background: var(--bubble-bot-bg); color: var(--bubble-bot-text); border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg); }
.simulator .bubble .label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bubble-bot-label); }
.simulator .bubble.bot.is-fallback .label { color: var(--danger); }
.simulator .bubble.bot .meta { color: var(--bubble-bot-meta); }
.simulator .bubble.bot .meta strong { color: var(--bubble-bot-label); font-weight: 600; }
.simulator .bubble.bot code { background: var(--bubble-bot-card); color: var(--bubble-bot-text); }
.simulator .bubble.bot.is-fallback { background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger); }
.simulator .bubble.bot.is-fallback .meta { color: var(--text-2); }
.simulator .bubble.bot.is-fallback .meta strong { color: var(--text); }
.simulator .bubble.bot.is-fallback .meta.fallback { color: var(--danger); }
.simulator .bubble.bot.is-fallback code { background: var(--surface); color: var(--text); }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta { display: block; font-size: 12px; line-height: 1.4; color: var(--bubble-lead-meta); }
.note { align-self: center; max-width: 80%; padding: 4px 12px; border-radius: var(--radius); background: var(--surface-sunken); color: var(--text-2); font-size: 12px; text-align: center; }
.composer { display: flex; flex-direction: column; gap: 14px; }
.composer .row { align-items: center; }
.sim-referral { margin: 0; }
.sim-referral > small { display: block; margin-top: 6px; }
.sim-referral > .checkbox { margin-right: 16px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* ==========================================================================
   Conversas: 3 colunas (lista | conversa | ficha)
   ========================================================================== */
.conversas { display: grid; grid-template-columns: 320px minmax(0, 1fr) 288px; flex: 1; min-height: 0; }
.col-list { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.col-list header { padding: 24px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.col-list h1 { margin: 0; font-size: 30px; line-height: 1; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-muted); border-radius: var(--radius); }
.tabs a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); border-radius: var(--radius-sm); text-decoration: none; color: var(--text-2); font-size: 14px; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.tab-count { color: var(--text-2); font-weight: 500; }
.search { display: flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 12px 0 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.search .icon { color: var(--text-2); }
.search input[type=search] { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; min-height: 42px; font-size: 14px; }
.search input[type=search]:focus-visible { outline: none; }
.search button { order: -1; flex: none; width: 38px; min-height: 42px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-2); }
.search button:hover { color: var(--text); background: var(--surface-muted); }
.clear-search { align-self: flex-start; display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 12px 6px; }
.chip { position: relative; display: inline-flex; align-items: center; min-height: 32px; padding: 0 7px; border-radius: 16px; font-size: 11px; white-space: nowrap; text-decoration: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.chip::after { content: ""; position: absolute; inset: -7px -1px; }
.chip:hover { border-color: var(--text); color: var(--text); }
.chip.active { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 500; }
#itens { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.items li a { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.items li a:hover { background: var(--row-hover-bg); color: var(--text); }
.items li.open a { background: var(--row-open-bg); }
.items li.open .preview { color: var(--text-3); }
.items li.open .avatar { background: var(--avatar-open-bg); color: var(--avatar-open-text); }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-text); font-weight: 600; font-size: 13px; }
.avatar.big { width: 72px; height: 72px; font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 28px; background: var(--avatar-open-bg); color: var(--avatar-open-text); }
.item-top { display: flex; justify-content: space-between; gap: 8px; }
.item-top strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-top time { color: var(--text-2); font-size: 12px; flex: none; }
.item-top time.urgent { color: var(--time-urgent); font-weight: 600; }
.preview { display: block; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.badge.team, .badge.waiting { background: var(--badge-team-bg); color: var(--badge-team-text); }
.badge.link { background: var(--badge-link-bg); color: var(--badge-link-text); }
.badge.neutral { background: var(--badge-neutral-bg); color: var(--badge-neutral-text); font-weight: 500; }
.stage { font-size: 12px; padding: 4px 10px; border-radius: 8px; background: var(--stage-bg); color: var(--stage-text); font-weight: 600; white-space: nowrap; }
.list-empty { padding: 24px 12px; color: var(--text-2); }

.col-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); }
.chat-head { background: var(--surface); padding: 18px 24px 0; display: flex; flex-direction: column; gap: 14px; }
.chat-head-row { display: flex; align-items: center; gap: 14px; }
.chat-head-row .avatar { background: var(--avatar-open-bg); color: var(--avatar-open-text); }
.chat-head-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head-title strong { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-title small { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-stripe { display: flex; height: 3px; margin: 0 -24px; }
.head-stripe span { flex: 1; }
.head-stripe span:nth-child(1) { background: var(--stripe-head-1); }
.head-stripe span:nth-child(2) { background: var(--stripe-2); }
.head-stripe span:nth-child(3) { background: var(--stripe-3); }
.banner { display: flex; align-items: center; gap: 14px; margin: 16px 24px 8px; padding: 12px 16px; border-radius: var(--radius); font-size: 13px; }
.banner > span { flex: 1 1 220px; }
.banner strong { font-weight: 600; }
.banner form { margin: 0; flex: none; }
.banner.bot { background: var(--mode-bot-bg); color: var(--mode-bot-text); }
.banner.team { background: var(--mode-team-bg); color: var(--mode-team-text); }
.messages { flex: 1; overflow-y: auto; padding: 20px 24px; }
#mensagens-lista { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: min(74%, 640px); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.msg .time { align-self: flex-end; font-size: 11px; }
.msg.lead { align-self: flex-start; background: var(--bubble-lead-bg); color: var(--bubble-lead-text); border: 1px solid var(--bubble-lead-border); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px; }
.msg.lead .time { color: var(--bubble-lead-meta); }
.msg.bot { align-self: flex-end; background: var(--bubble-bot-bg); color: var(--bubble-bot-text); border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg); }
.msg.bot .label { color: var(--bubble-bot-label); }
.msg.bot .time { color: var(--bubble-bot-meta); }
.msg.bot a { color: var(--bubble-bot-link); }
.msg.team { align-self: flex-end; background: var(--bubble-team-bg); color: var(--bubble-team-text); border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg); }
.msg.team .label { color: var(--bubble-team-label); }
.msg.team .time { color: var(--bubble-team-meta); }
.msg.failed { background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger); }
.msg.failed .label { color: var(--danger); }
.msg.failed .time { color: var(--text-2); }
.msg .send-error { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--danger); font-size: 13px; }
.msg .send-error form { display: inline; margin: 0; }
.msg .send-error button.link { color: var(--danger); min-height: var(--tap); }
.pre-wrap { white-space: pre-wrap; }
.msg-note { align-self: center; max-width: 80%; padding: 6px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 12px; text-align: center; }
.msg-note .time { display: block; font-size: 11px; color: var(--text-2); }
/* Cartão do arquivo (PDF do material) */
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-alt); border: 1px solid var(--border); }
.msg.bot .file-card { background: var(--bubble-bot-card); border-color: var(--bubble-bot-card); }
.file-badge { flex: 0 0 36px; height: 42px; border-radius: 6px; background: var(--file-badge-bg); color: var(--file-badge-text); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.file-info { min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.file-size { font-size: 12px; color: var(--bubble-lead-meta); }
.msg.bot .file-size { color: var(--bubble-bot-meta); }

.composer-box { padding: 12px 24px 18px; background: var(--surface); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.composer-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; font-size: 12px; color: var(--text-2); }
.composer-top strong { color: var(--text); font-weight: 600; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer-row textarea { min-height: 48px; max-height: 200px; border-radius: var(--radius); padding: 12px 14px; }
.composer-hint { font-size: 12px; color: var(--text-2); }
button.send { flex: 0 0 48px; width: 48px; height: 48px; padding: 0; border: 0; border-radius: var(--radius); background: var(--btn-send-bg); color: var(--btn-send-icon); }
button.send:hover { background: var(--btn-send-hover); color: var(--btn-send-icon); }
button.send .icon { width: 20px; height: 20px; }
.window-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.window-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--window-open-dot); flex: none; }
.window-note.soon { color: var(--warn); font-weight: 500; }
.window-note.soon::before { background: var(--window-soon-dot); }
.window-note.closed { flex-basis: 100%; display: block; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.window-note.closed::before { display: none; }
.chat-empty { display: flex; align-items: center; justify-content: center; color: var(--text-2); grid-column: 2 / 4; }

.col-profile { overflow-y: auto; padding: 28px 22px 22px; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 22px; }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.profile-head strong { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.profile-head small { color: var(--text-2); font-size: 13px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; font-size: 13px; }
.facts dt { color: var(--text-2); font-size: 12px; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.toggle form { margin: 0; }
.toggle strong { font-weight: 600; }
.toggle small { display: block; color: var(--text-2); font-size: 12px; }
.switch { position: relative; flex: none; width: 48px; min-height: 28px; height: 28px; padding: 0; border: 0; border-radius: 14px; background: var(--switch-off); }
.switch::before { content: ""; position: absolute; inset: -8px -2px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--switch-knob); box-shadow: 0 1px 2px var(--shadow-strong); transition: left .15s; }
.switch:hover { background: var(--switch-off); }
.switch[aria-checked=true], .switch[aria-checked=true]:hover { background: var(--switch-on); }
.switch[aria-checked=true]::after { left: 23px; }
.profile-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.profile-actions form { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.profile-actions button { width: 100%; }
.profile-actions button.primary { min-height: 48px; border-radius: var(--radius); }
.profile-actions small { color: var(--text-2); font-size: 12px; }
.profile-actions .checkbox { font-size: 13px; }
/* Confirmações da ficha (marcar como perdido, zerar conversa de teste): terciário fechado, cartão aberto */
.profile-actions details > summary { justify-content: center; color: var(--btn-tertiary-text); font-weight: 500; border-radius: var(--radius-sm); }
.profile-actions details > summary:hover { color: var(--text); }
.profile-actions details[open] { padding: 4px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.profile-actions details[open] > summary { justify-content: flex-start; color: var(--text); font-weight: 600; }
.profile-actions details .muted { font-size: 12px; margin: 0; }
.toast-area { position: fixed; top: 16px; right: 16px; z-index: 10; width: 380px; }
.toast-area .alert { box-shadow: 0 4px 16px var(--shadow-strong); }

/* ==========================================================================
   Agente de IA: etapas, rascunho, prévia ao vivo, publicar e histórico
   ========================================================================== */
main.page > .agent-shell { max-width: 1320px; }
main.page > .agent-shell.narrow { max-width: 920px; }
.agent-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.agent-head h1 { margin: 0; }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.agent-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draft-status { font-size: 13px; color: var(--text-2); margin-right: 6px; }
.draft-status.is-error { color: var(--danger); font-weight: 500; }
.draft-banner { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 500; }
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 20px; }
.step { justify-content: flex-start; gap: 10px; min-height: 52px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; white-space: normal; text-align: left; line-height: 1.25; }
.step:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-muted); color: var(--text); font-size: 13px; font-weight: 600; }
.step.active { border: 2px solid var(--text); padding: 0 11px; color: var(--text); font-weight: 600; }
.step.active .step-n { background: var(--step-active-number-bg); color: var(--step-active-number-text); }
.agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.agent-edit { min-width: 0; }
.agent-edit .card > h2, .fixed-rules > h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.agent-edit .card > h2 + p.muted { margin: 0 0 14px; font-size: 14px; }
.agent-edit .card > .field + .field { margin-top: 14px; }
.agent-preview { position: sticky; top: 24px; min-width: 0; }
.step-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.field-with-info { position: relative; }
.field-with-info > .info-tip { position: absolute; top: 0; right: 0; }
.agent-edit .card > h2.with-info { position: relative; }
.agent-edit .card > h2.with-info .info-tip { margin-left: auto; }
.agent-edit .card > h2.with-info .info-pop { font-weight: 400; }
.info-tip { display: inline-flex; }
.info-tip-btn { min-height: 0; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-size: 16px; line-height: 1; cursor: help; }
.info-tip-btn:hover, .info-tip-btn:focus-visible { color: var(--text); background: var(--surface-muted); }
.info-pop { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: 320px; padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow-strong); font-size: 13px; line-height: 1.45; }
.info-tip:hover .info-pop, .info-tip:focus-within .info-pop { display: block; }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); padding: 0 14px; }
.item[open] { padding-bottom: 14px; background: var(--surface); }
.item > summary { gap: 10px; font-weight: 500; }
.item[open] > summary { font-weight: 600; }
.item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .delete-form { margin-top: 12px; }
.item.inactive { opacity: 1; }
.item.inactive .item-title { color: var(--text-2); }
.new-item { background: var(--surface); border-style: dashed; }
.new-item > summary { color: var(--link); }
.status-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.status-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.status-list li.ok strong { color: var(--ok); font-weight: 600; }
.status-list li.off strong { color: var(--text-2); font-weight: 500; }
.readonly-card, .fixed-rules { background: var(--surface-alt); }
.readonly-card > p.muted:last-child { margin: 0; font-size: 14px; }
.fixed-rules { border-style: dashed; }
.fixed-rules ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* Prévia: o simulador fixo na coluna da direita */
/* Altura: cabe na tela já na abertura (o cabeçalho e as etapas ocupam ~180 px acima). */
.simulator.agent-sim { padding: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); min-height: 560px; }
.simulator.agent-sim .bubble .meta { overflow-wrap: anywhere; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.preview-head .section-title { margin: 0; }
.tag.draft { background: var(--warn-soft); color: var(--warn); }
.simulator.agent-sim .chat { flex: 1 1 auto; height: auto; min-height: 200px; padding: 12px; margin-bottom: 10px; gap: 10px; }
.simulator.agent-sim .bubble { max-width: 90%; padding: 10px 12px; font-size: 14px; gap: 4px; }
.simulator.agent-sim .composer { flex: none; gap: 8px; }
.simulator.agent-sim .composer .row { flex-wrap: nowrap; gap: 8px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; }
.shortcuts .shortcut { min-height: 30px; padding: 0 10px; border-radius: 15px; border-color: var(--border-strong); font-size: 12px; font-weight: 500; }
.scenario { border-top: 1px solid var(--border); }
.scenario > summary { font-size: 14px; min-height: 40px; }
.scenario[open] > :not(summary) { margin-top: 10px; }
.scenario .sim-referral { padding: 12px; }
.preview-total { margin: 0; font-size: 12px; }
.preview-cost { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--text-2); }

/* Publicar e histórico */
.changes { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; }
.change { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; }
.change.has-undo { border: 2px solid var(--undo-border); padding: 15px 19px; }
.change header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.change h3 { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.tag.added { background: var(--ok-soft); color: var(--ok); }
.tag.removed { background: var(--danger-soft); color: var(--danger); }
.tag.changed { background: var(--badge-link-bg); color: var(--badge-link-text); }
.change-field + .change-field { margin-top: 12px; }
.change-field-label { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.undo-warning { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--badge-team-bg); color: var(--badge-team-text); font-size: 13px; font-weight: 600; }
.diff { font-size: 13px; line-height: 1.5; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 420px; overflow-y: auto; background: var(--surface); }
.diff > span { display: block; position: relative; padding: 2px 10px 2px 28px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-mark { position: absolute; left: 10px; font-weight: 700; }
.diff-same { color: var(--text-2); }
.diff-gap { color: var(--text-2); font-style: italic; }
.diff-in { background: var(--diff-in-bg); }
.diff-in .diff-mark { color: var(--diff-in-mark); }
.diff-out { background: var(--diff-out-bg); }
.diff-out .diff-mark { color: var(--diff-out-mark); }
.publish-form { display: flex; flex-direction: column; gap: 12px; }
main.page .publish-form .actions { max-width: none; }
.change-summary { margin: 0 0 16px; padding-left: 20px; }
.versions { list-style: none; margin: 0; padding: 0; }
.version header { display: flex; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; }
.version h2 { margin: 0; }
.version > p { margin: 8px 0; }
.version details[open] .changes { margin-top: 8px; }

/* ==========================================================================
   Follow-up: chave geral, resumo, contagens e colunas por tentativa
   ========================================================================== */
main.page > .fu-shell { max-width: 1320px; }
.fu-toggle { background: var(--surface); min-width: 320px; }
.fu-strip { display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; margin: 0 0 16px; padding: 16px 20px; border-radius: var(--radius-lg); background: var(--fu-strip-bg); color: var(--fu-strip-text); border-left: 4px solid var(--fu-strip-accent); }
.fu-strip p { margin: 0; }
.fu-strip strong { font-weight: 600; }
.fu-strip-meta { font-size: 13px; color: var(--fu-strip-meta); }
.fu-strip a { color: var(--fu-strip-link); }
.fu-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.fu-col { display: flex; flex-direction: column; min-width: 0; background: var(--fu-col-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fu-col.link { border: 2px solid var(--fu-link-col-border); }
.fu-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.fu-col-head strong { display: block; font-weight: 600; font-size: 14px; }
.fu-col-head small { display: block; font-size: 12px; color: var(--text-2); }
.fu-count { flex: none; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-muted); font-weight: 600; font-size: 13px; }
.fu-cards { display: flex; flex-direction: column; gap: 8px; padding: 8px; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.fu-empty { margin: 4px 2px; font-size: 13px; color: var(--text-2); font-style: italic; }
.fu-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: default; }
.fu-card:hover, .fu-card:focus-visible { border-color: var(--border-strong); }
.fu-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.fu-card.paused { background: var(--surface-muted); }
.fu-card header { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fu-card header .tag { margin-left: auto; }
.fu-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fu-error-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.fu-meta, .fu-next { margin: 0; font-size: 13px; color: var(--text-2); }
.fu-next strong { color: var(--text); font-weight: 600; }
/* Detalhes do card: sem JavaScript, abrem dentro do card ao passar o mouse ou focar; com o follow-up.js, num balão
   flutuante (.fu-balloon), que não é cortado pela rolagem da coluna. */
.fu-pop { display: none; flex-direction: column; gap: 2px; }
.fu-card:hover .fu-pop, .fu-card:focus-within .fu-pop { display: flex; }
.fu-js .fu-card .fu-pop { display: none; }
.fu-pop-name { margin: 0 0 2px; font-weight: 600; }
.fu-pop-error { margin: 4px 0 0; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 12px; }
.fu-balloon { position: fixed; z-index: 50; display: flex; flex-direction: column; gap: 2px; width: 280px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 4px 16px var(--shadow-strong); pointer-events: none; }
.fu-balloon[hidden] { display: none; }
.fu-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.fu-actions form { margin: 0; }
.fu-actions .button.small, .fu-actions button.small { min-height: 32px; padding: 0 8px; font-size: 12px; }
.fu-foot { margin-top: 16px; font-size: 13px; max-width: 900px; }
.fu-confirm { margin: 0 0 16px; padding: 16px 20px; background: var(--surface); border: 2px solid var(--fu-strip-accent); border-radius: var(--radius-lg); }
.fu-confirm h2 { margin: 0 0 6px; font-size: 18px; }
.fu-confirm p { margin: 0 0 6px; }
.fu-confirm .fu-confirm-meta { font-size: 13px; color: var(--text-2); }
.fu-confirm-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.fu-confirm-actions form { margin: 0; }

/* Ajustes → Follow-up e ficha da conversa ("Retomar em") */
.day-picks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
input[type=time], input[type=date] { font: inherit; font-size: 15px; color: var(--text); background: var(--surface-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; min-height: var(--tap); }
.row .field:has(input[type=time]) { max-width: 160px; }
.reason-pair { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.reason-pair:last-child { border-bottom: 0; }
.reason-pair .field:has(input) > span { font-size: 13px; color: var(--text-2); }
.reason-pair input::placeholder { color: var(--text-2); opacity: .75; }
.reason-fixed { margin: 0; font-size: 14px; }
.cad-table th, .cad-table td { padding: 8px 14px; vertical-align: middle; }
.cad-table tbody th { font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); background: none; white-space: nowrap; }
.cad-table td.muted { font-size: 13px; }
.cad-table tr:last-child th, .cad-table tr:last-child td { border-bottom: 0; }
.cad-interval { display: flex; align-items: center; gap: 8px; }
.cad-interval input[type=number] { width: 90px; }
.cad-interval select { width: auto; }
.cad-table small.error { display: block; margin-top: 4px; }
.cad-table tr.has-error input { border-color: var(--danger); }
/* Tentativa desligada: a linha fica apagada (sem JavaScript: segue a chave na hora). */
.cad-table tr:has(th input[type=checkbox]:not(:checked)) td { opacity: .5; }
.return-form { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.return-form .field > span { font-size: 13px; }
.return-form .hint { font-size: 12px; }
.return-actions { display: flex; align-items: center; gap: 8px; }
.return-actions button { min-height: 36px; padding: 0 12px; font-size: 13px; }

/* Painel (Fase 5) */
main.page > .db-shell { max-width: 1320px; }
.db-head-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.db-air { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13px; font-weight: 600; }
.db-air .dot { width: 9px; height: 9px; border-radius: 50%; }
.db-air.on { background: var(--db-air-on-bg); color: var(--db-air-on-text); }
.db-air.on .dot { background: var(--db-air-on); }
.db-air.off { background: var(--db-air-off-bg); color: var(--db-air-off-text); font-weight: 500; }
.db-air.off .dot { background: var(--db-air-off); }
.db-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 12px; margin: 0; }
.db-period { display: inline-flex; margin: 0; padding: 3px; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface); }
.db-period > label { margin-top: 0; }
.db-period label { position: relative; display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 16px; font-size: 13px; font-weight: 500; cursor: pointer; }
.db-period input { position: absolute; opacity: 0; pointer-events: none; }
.db-period label:has(input:checked) { background: var(--db-segment-active-bg); color: var(--db-segment-active-text); }
.db-period label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.db-test { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.db-test input { accent-color: var(--control-accent); width: 16px; height: 16px; }
.db-range { margin: 0 0 14px; font-size: 14px; color: var(--text-2); }
.db-range strong { color: var(--text); font-weight: 600; }
.db-custom { display: none; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.db-controls:has(input[value="personalizado"]:checked) .db-custom { display: inline-flex; }
.db-custom label { display: inline-flex; align-items: center; gap: 6px; }
.db-custom input[type="date"] { min-height: 32px; padding: 0 8px; font-size: 13px; }
.db-period-error { margin: 0 0 14px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.db-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; margin: 0 0 16px; padding: 20px 24px; border-radius: var(--radius-lg); background: var(--db-hero-bg); color: var(--db-hero-text); border-left: 4px solid var(--db-hero-accent); }
.db-hero p { margin: 0; }
.db-hero-label { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--db-hero-meta); }
.db-hero .db-hero-n { font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 64px; line-height: 1; color: var(--db-hero-number); margin: 6px 0; }
.db-hero-meta { font-size: 14px; color: var(--db-hero-meta); }
.db-hero-side { text-align: right; }
.db-hero .db-hero-cost { font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 32px; line-height: 1.1; margin: 6px 0 4px; }
.db-hero .db-var { background: var(--db-hero-chip-bg); margin-left: 8px; }
.db-hero .db-var.good { color: var(--db-good-on-dark); }
.db-hero .db-var.bad { color: var(--db-bad-on-dark); }
.db-hero .db-var.flat { color: var(--db-hero-meta); }
.db-var { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--surface-muted); }
.db-var.good { color: var(--db-good); }
.db-var.bad { color: var(--db-bad); }
.db-var.flat { color: var(--db-flat); font-weight: 500; }
.db-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.db-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.db-card-label { font-size: 13px; font-weight: 600; }
.db-card-n { font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 38px; line-height: 1.05; }
.db-card-n a, .db-bar-n a, .db-list a, .db-table a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.db-card-n a:hover, .db-bar-n a:hover, .db-list a:hover, .db-table a:hover { color: var(--link); text-decoration-color: currentColor; }
.db-card small { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.db-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.db-grid.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.db-grid > .card { margin: 0 0 16px; }
.db-grid h2 { font-size: 1.05rem; margin: 0 0 12px; }
.db-grid h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.db-funnel ol { list-style: none; margin: 0; padding: 0; }
.db-step { margin: 2px 0 4px 120px; font-size: 12px; color: var(--text-2); }
.db-bar-line { display: grid; grid-template-columns: 108px minmax(0, 1fr) 56px; align-items: center; gap: 12px; }
.db-bar-label { font-size: 14px; font-weight: 500; }
.db-svgbar { display: block; width: 100%; border-radius: 6px; overflow: hidden; }
.db-svgbar .track { fill: var(--db-bar-track); }
.db-bar-track { height: 30px; }
.db-bar-track.leads .fill { fill: var(--db-funnel-leads); }
.db-bar-track.engajados .fill { fill: var(--db-funnel-engajados); }
.db-bar-track.link .fill { fill: var(--db-funnel-link); }
.db-bar-track.alunos .fill { fill: var(--db-funnel-alunos); }
.db-bar-n { font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 24px; text-align: right; }
.db-foot { margin: 12px 0 0; font-size: 12px; }
.db-table { width: 100%; border-collapse: collapse; border: 0; border-radius: 0; font-size: 14px; }
.db-table th, .db-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--border); background: none; font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--text); }
.db-table th:first-child { text-align: left; font-weight: 500; }
.db-table thead th { font-size: 12px; font-weight: 500; color: var(--text-2); }
.db-table td a { display: inline; min-height: 0; font-weight: 500; }
.db-table tr.group th, .db-table tr.group td { font-weight: 600; }
.db-table tr.sub th { padding-left: 24px; color: var(--text-2); font-weight: 400; }
.db-table tr:last-child th, .db-table tr:last-child td { border-bottom: 0; }
.db-table tr.off th, .db-table tr.off td { color: var(--text-2); background: var(--surface-muted); }
.db-off { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-2); font-size: 11px; font-weight: 500; }
.db-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.db-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.db-kpi-n { font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 30px; line-height: 1.05; }
.db-kpi-label { font-size: 13px; font-weight: 600; }
.db-kpi small { font-size: 12px; color: var(--text-2); }
.db-kpi small strong { color: var(--db-bad); font-weight: 600; }
.db-team-split { margin: -4px 0 8px; font-size: 12px; color: var(--text-2); }
.db-team-split strong { color: var(--db-bad); font-weight: 600; }
.db-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.db-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.db-list li:last-child { border-bottom: 0; }
.db-list li > :last-child { font-weight: 600; min-width: 28px; text-align: right; }
.db-list.bars li { display: grid; grid-template-columns: 190px minmax(0, 1fr) 36px; }
.db-mini { height: 8px; }
.db-mini .fill { fill: var(--db-mini-fill); }
.db-nodata { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--db-small-bg); color: var(--db-small-text); font-size: 12px; }
.db-cost-total { margin: 0; font-family: var(--font-title); font-style: italic; font-weight: 700; font-size: 34px; line-height: 1.1; }
.db-cost-detail { margin: 2px 0 12px; font-size: 13px; color: var(--text-2); }
.db-cost-lines { margin: 0; font-size: 14px; }
.db-cost-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.db-cost-lines dt { font-weight: 500; }
.db-cost-lines dd { margin: 0; font-weight: 600; white-space: nowrap; }
.db-cost-lines .sub dt { padding-left: 16px; color: var(--text-2); font-weight: 400; }
.db-cost-lines .sub dd { color: var(--text-2); font-weight: 400; }
.db-cost-lines .total { border-bottom: 0; padding-top: 8px; }
.panel-filter { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel-filter-bg); color: var(--panel-filter-text); font-size: 13px; }
.panel-filter a { color: inherit; font-weight: 600; white-space: nowrap; }

/* Conversa: balão do follow-up e nota do opt-out */
.msg.bot.followup { border: 1px dashed var(--bubble-followup-border); }
.msg-note.info { background: var(--note-info-bg); color: var(--note-info-text); }
