:root {
  --fundo: #0b141a;
  --painel: #111b21;
  --painel-2: #202c33;
  --hover: #202c33;
  --ativo: #2a3942;
  --borda: #2a3942;
  --texto: #e9edef;
  --texto-2: #8696a0;
  --verde: #00a884;
  --verde-claro: #25d366;
  --bolha-in: #202c33;
  --bolha-humano: #005c4b;
  --bolha-bot: #1f3a54;
  --amarelo: #f0b232;
  --vermelho: #ea4e4e;
  /* Escala única de raio de borda — evita número solto a cada regra nova. */
  --raio-sm: 8px;
  --raio-md: 12px;
  --raio-lg: 18px;
  /* Elevação em 2 níveis só: flutuante (dropdown/toast) e modal (janela grande) — em vez de
     cada um ter um valor de sombra levemente diferente sem motivo. */
  --sombra-flutuante: 0 4px 16px rgba(0, 0, 0, .4);
  --sombra-modal: 0 12px 32px rgba(0, 0, 0, .5);
  /* Barra de rolagem fina, na cor do tema (Firefox + navegadores baseados em Chromium). */
  --scroll-thumb: #4a5962;
  color-scheme: dark;
  /* Padrão de fundo da conversa (folha, xícara, flor, espiral, pontos, losango), estilo
     WhatsApp — traço branco bem claro no escuro, preto bem claro no claro (ver [data-tema]). */
  --padrao-fundo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='white' stroke-opacity='0.07' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(28,34) rotate(-18)'%3E%3Cpath d='M0 12C0 5 6 0 12 0s12 5 12 12-6 16-12 16S0 19 0 12z'/%3E%3Cpath d='M2 12h20'/%3E%3C/g%3E%3Cg transform='translate(150,30)'%3E%3Cpath d='M0 4h18v11a9 9 0 0 1-9 9a9 9 0 0 1-9-9V4z'/%3E%3Cpath d='M18 7c4 0 6 2 6 5s-2 5-6 5'/%3E%3Cpath d='M4 -6c-2 2 2 4 0 6'/%3E%3Cpath d='M12 -6c-2 2 2 4 0 6'/%3E%3C/g%3E%3Cg transform='translate(70,130)'%3E%3Ccircle cx='8' cy='0' r='4.5'/%3E%3Ccircle cx='-8' cy='0' r='4.5'/%3E%3Ccircle cx='0' cy='8' r='4.5'/%3E%3Ccircle cx='0' cy='-8' r='4.5'/%3E%3Ccircle cx='0' cy='0' r='3.2'/%3E%3C/g%3E%3Cg transform='translate(176,120)'%3E%3Cpath d='M0 0q12 -12 22 0q-10 12 -22 0q-10 -12 0 -22'/%3E%3C/g%3E%3Cg transform='translate(30,172)'%3E%3Ccircle cx='0' cy='0' r='2.4'/%3E%3Ccircle cx='10' cy='4' r='2.4'/%3E%3Ccircle cx='4' cy='13' r='2.4'/%3E%3C/g%3E%3Cg transform='translate(186,186) rotate(45)'%3E%3Crect x='-7' y='-7' width='14' height='14'/%3E%3C/g%3E%3Cg transform='translate(112,72) rotate(25)'%3E%3Cpath d='M0 10C0 4 5 0 10 0s10 4 10 10-5 13-10 13S0 16 0 10z'/%3E%3Cpath d='M2 10h16'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

:root[data-tema="claro"] {
  --fundo: #f0f2f5;
  --painel: #ffffff;
  --painel-2: #f7f8fa;
  --hover: #f5f6f6;
  --ativo: #e9edef;
  --borda: #d1d7db;
  --texto: #111b21;
  --texto-2: #667781;
  --verde: #008069;
  --bolha-in: #ffffff;
  --bolha-humano: #d9fdd3;
  --bolha-bot: #c5e2fb;
  color-scheme: light;
  --sombra-flutuante: 0 4px 16px rgba(0, 0, 0, .12);
  --sombra-modal: 0 12px 32px rgba(0, 0, 0, .18);
  --scroll-thumb: #c3c9cf;
  --padrao-fundo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='black' stroke-opacity='0.055' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(28,34) rotate(-18)'%3E%3Cpath d='M0 12C0 5 6 0 12 0s12 5 12 12-6 16-12 16S0 19 0 12z'/%3E%3Cpath d='M2 12h20'/%3E%3C/g%3E%3Cg transform='translate(150,30)'%3E%3Cpath d='M0 4h18v11a9 9 0 0 1-9 9a9 9 0 0 1-9-9V4z'/%3E%3Cpath d='M18 7c4 0 6 2 6 5s-2 5-6 5'/%3E%3Cpath d='M4 -6c-2 2 2 4 0 6'/%3E%3Cpath d='M12 -6c-2 2 2 4 0 6'/%3E%3C/g%3E%3Cg transform='translate(70,130)'%3E%3Ccircle cx='8' cy='0' r='4.5'/%3E%3Ccircle cx='-8' cy='0' r='4.5'/%3E%3Ccircle cx='0' cy='8' r='4.5'/%3E%3Ccircle cx='0' cy='-8' r='4.5'/%3E%3Ccircle cx='0' cy='0' r='3.2'/%3E%3C/g%3E%3Cg transform='translate(176,120)'%3E%3Cpath d='M0 0q12 -12 22 0q-10 12 -22 0q-10 -12 0 -22'/%3E%3C/g%3E%3Cg transform='translate(30,172)'%3E%3Ccircle cx='0' cy='0' r='2.4'/%3E%3Ccircle cx='10' cy='4' r='2.4'/%3E%3Ccircle cx='4' cy='13' r='2.4'/%3E%3C/g%3E%3Cg transform='translate(186,186) rotate(45)'%3E%3Crect x='-7' y='-7' width='14' height='14'/%3E%3C/g%3E%3Cg transform='translate(112,72) rotate(25)'%3E%3Cpath d='M0 10C0 4 5 0 10 0s10 4 10 10-5 13-10 13S0 16 0 10z'/%3E%3Cpath d='M2 10h16'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
/* Cores com fundo próprio fixo (badges, avisos) continuam iguais nos dois temas —
   só estas aqui dependem do fundo do painel ao redor e precisam de ajuste no claro. */
:root[data-tema="claro"] .chat-status.pausa { color: #9c6b00; }
:root[data-tema="claro"] .msg.bot .msg-autor { color: #1f6fb2; }
:root[data-tema="claro"] .tabela td.erro { color: #c0392b; }
:root[data-tema="claro"] .msg-tick.falhou { color: #c0392b; }
:root[data-tema="claro"] .chat-msgs { background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); }
:root[data-tema="claro"] .chat-escrevendo { background: var(--fundo); color: #1f6fb2; }
:root[data-tema="claro"] .msg-citando { background: rgba(0,0,0,.05); }
:root[data-tema="claro"] .msg-menu-btn:hover { background: rgba(0,0,0,.08); }
:root[data-tema="claro"] .msg.cliente .msg-hora, :root[data-tema="claro"] .msg.bot .msg-hora, :root[data-tema="claro"] .msg.humano .msg-hora,
:root[data-tema="claro"] .msg.cliente .msg-tick:not(.lido):not(.falhou),
:root[data-tema="claro"] .msg.bot .msg-tick:not(.lido):not(.falhou),
:root[data-tema="claro"] .msg.humano .msg-tick:not(.lido):not(.falhou) {
  color: rgba(17,27,33,.45);
}
:root[data-tema="claro"] .msg.cliente .msg-menu-btn, :root[data-tema="claro"] .msg.bot .msg-menu-btn, :root[data-tema="claro"] .msg.humano .msg-menu-btn {
  color: rgba(17,27,33,.55);
}
:root[data-tema="claro"] .lista-painel { background: #eef0f2; }
:root[data-tema="claro"] .aviso, :root[data-tema="claro"] .chat-aviso, :root[data-tema="claro"] .msg.sistema {
  background: #fdf0d5; color: #8a5a00;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fundo);
  color: var(--texto);
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}
[hidden] { display: none !important; }
/* Fonte de destaque só pros títulos de seção e nomes — o corpo do texto continua na fonte do
   sistema (mais rápida/familiar pra ler mensagem), mas os títulos ganham uma "assinatura". */
h1, h2, h3, .item-nome, .chat-nome, .vazio-titulo { font-family: "Manrope", "Segoe UI", system-ui, sans-serif; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

::selection { background: color-mix(in srgb, var(--verde-claro) 35%, transparent); color: var(--texto); }

button:focus { outline: none; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--verde-claro); outline-offset: 2px;
}

/* Barra de rolagem fina e na cor do tema, em vez da padrão (grossa/cinza) do navegador. */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--scroll-thumb) 70%, var(--texto)); }

/* ---------- Botões e campos ---------- */
.btn {
  background: var(--painel-2); border: 1px solid var(--borda); border-radius: 20px;
  padding: 7px 16px; white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.btn:hover { background: var(--ativo); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-verde { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.btn-verde:hover { background: #06cf9c; }
/* Terceiro nível, pra ação de apoio/utilidade (ex.: "Atualizar") que não deve competir em peso
   visual com a ação principal (verde) nem com a secundária (contorno, .btn puro). */
.btn.ghost { background: none; border-color: transparent; color: var(--texto-2); font-weight: 500; }
.btn.ghost:hover { background: var(--ativo); color: var(--texto); }
.btn-redondo {
  width: 40px; height: 40px; border-radius: 50%; border: 0; flex: none;
  background: transparent; color: var(--texto-2); font-size: 20px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
}
.btn-redondo:hover { background: var(--ativo); color: var(--texto); }
#btn-nova { padding-bottom: 2px; }
.btn-redondo.verde { background: var(--verde); color: #fff; font-size: 18px; }
.btn-redondo.verde:hover { background: #06cf9c; }
.btn-redondo:disabled { opacity: .5; }
.btn-icone { background: none; border: 0; font-size: 18px; padding: 6px; border-radius: 50%; color: var(--texto-2); }
.btn-icone:hover { background: var(--ativo); }

input, select, textarea {
  background: var(--painel-2); border: 1px solid var(--borda); border-radius: var(--raio-sm);
  padding: 8px 10px; outline: none; width: 100%; transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--verde-claro);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde-claro) 25%, transparent);
}
textarea { resize: vertical; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }

/* Interruptor (switch) */
.switch {
  appearance: none; width: 38px; height: 22px; border-radius: 11px; padding: 0;
  background: #3b4a54; border: 0; position: relative; cursor: pointer; flex: none; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--verde); }
.switch:checked::after { transform: translateX(16px); }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-caixa {
  width: min(360px, 100%); background: var(--painel); padding: 32px; border-radius: var(--raio-lg);
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.login-caixa h1 { margin: 0; font-size: 22px; }
.login-caixa p { margin: 0 0 8px; color: var(--texto-2); }
.login-logo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; align-self: center; }
@keyframes login-entrar { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.login-caixa { animation: login-entrar 1.3s cubic-bezier(.2,.8,.3,1) both; }
.login-erro { color: var(--vermelho); min-height: 20px; }

/* ---------- Estrutura ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topo {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--fundo); border-bottom: 1px solid var(--painel-2);
}
.funil { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.chip {
  --cor: var(--verde);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--cor); border-radius: 16px; padding: 4px 6px 4px 12px;
  background: transparent; font-weight: 600; font-size: 13px; color: var(--cor);
}
.chip:hover { background: var(--painel-2); }
.chip.ativo { background: var(--cor); color: #fff; }
.chip .n { background: var(--cor); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.chip.ativo .n { background: #fff; color: var(--cor); }
.interruptor-geral {
  display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 600;
  padding: 5px 10px; border-radius: 20px; background: var(--painel-2);
}
.interruptor-geral.off { background: #4a1f1f; color: #ffb4b4; }

.corpo { flex: 1; display: flex; min-height: 0; }
.trilho {
  width: 60px; flex: none; background: var(--painel-2); display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 10px 0;
}
.trilho-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: none; color: var(--texto-2); display: grid; place-items: center;
}
.trilho-btn:hover { background: var(--ativo); }
.trilho-btn.ativo { background: var(--ativo); color: var(--texto); }
.trilho-espaco { flex: 1; }
.trilho-sep { width: 24px; height: 1px; background: var(--borda); margin: 4px 0; flex: none; }
.badge {
  position: absolute; top: 0; right: 0; background: var(--verde-claro); color: #111;
  font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 5px; min-width: 18px;
}

.view { flex: 1; min-width: 0; display: flex; }

/* ---------- Lista de conversas ---------- */
.lista-painel {
  width: 400px; flex: none; background: var(--painel); display: flex; flex-direction: column;
  min-height: 0;
}
.resizer-lista {
  width: 5px; flex: none; cursor: col-resize; background: var(--painel-2);
  position: relative;
}
.resizer-lista::after { content: ""; position: absolute; inset: 0 -3px; }
.resizer-lista:hover, .resizer-lista.arrastando { background: var(--verde); }
.lista-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.lista-cab h2 { margin: 0; color: var(--verde-claro); font-size: 22px; }
.busca {
  margin: 6px 12px 10px; display: flex; align-items: center; gap: 10px;
  background: var(--painel-2); border-radius: 24px; padding: 0 16px; color: var(--texto-2);
}
.busca svg { width: 18px; height: 18px; flex: none; }
.busca input { background: none; border: 0; padding: 13px 0; font-size: 14.5px; }
.abas { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.abas button {
  border: 1px solid var(--borda); background: none; border-radius: 16px; padding: 4px 12px;
  color: var(--texto-2); white-space: nowrap; font-size: 13px;
}
.abas button.ativo { background: #0a332c; border-color: #0a332c; color: var(--verde-claro); }
.lista { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 4px 8px; }
.lista-vazia { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 40px 20px; }
.vazio-icone {
  width: 48px; height: 48px; border-radius: 50%; background: var(--ativo); color: var(--texto-2);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.vazio-icone svg { width: 22px; height: 22px; }
.vazio-titulo { font-weight: 700; font-size: 14.5px; color: var(--texto); }
.vazio-texto { font-size: 12.5px; color: var(--texto-2); max-width: 220px; }

.item {
  display: flex; gap: 12px; padding: 10px 14px; cursor: pointer; align-items: center;
  border-radius: var(--raio-md); background: var(--painel-2); transition: background .15s ease;
}
.item:hover { background: var(--ativo); }
.item.ativo { background: var(--ativo); outline: 1px solid var(--verde-claro); outline-offset: -1px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #fff; position: relative;
}
.avatar .ponto {
  position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid var(--painel);
}
.ponto.on { background: var(--verde-claro); }
.ponto.pausa { background: var(--amarelo); }
.ponto.off { background: #6b7a83; }
.item-meio { flex: 1; min-width: 0; }
.item-linha { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item-nome { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-hora { font-size: 12px; color: var(--texto-2); flex: none; }
.item-hora.nova { color: var(--verde-claro); font-weight: 600; }
.item-prev { color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.item-tags { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 8px; background: var(--painel-2); color: var(--texto-2); }
.tag.etapa { background: color-mix(in srgb, var(--cor, var(--verde-claro)) 22%, var(--fundo)); color: var(--cor, var(--verde-claro)); }
.tag.humano { background: #4a3a12; color: var(--amarelo); }
.nao-lidas {
  background: var(--verde-claro); color: #111; border-radius: 10px; font-size: 12px; font-weight: 700;
  padding: 0 6px; min-width: 20px; text-align: center; flex: none;
}

/* ---------- Chat ---------- */
.chat-painel { flex: 1; min-width: 0; display: flex; background: var(--fundo); }
.chat-vazio {
  margin: auto; text-align: center; color: var(--texto-2); max-width: 460px; padding: 24px;
}
.chat-vazio h3 { color: var(--texto); font-weight: 700; font-size: 24px; margin: 8px 0; }
.chat-vazio-icone {
  width: 72px; height: 72px; border-radius: 50%; background: var(--painel-2); color: var(--texto-2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.chat-vazio-icone svg { width: 32px; height: 32px; }
.avisos-config { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.aviso { background: #3d2f0d; color: #ffd27a; padding: 10px 14px; border-radius: var(--raio-sm); }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.chat-cab {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--painel-2);
  flex-wrap: wrap; border-radius: var(--raio-md); margin: 8px 8px 0;
}
.chat-cab .avatar { width: 40px; height: 40px; font-size: 16px; }
.chat-cab-info { flex: 1; min-width: 140px; }
.chat-nome { font-size: 16px; font-weight: 700; }
.chat-status { font-size: 12.5px; color: var(--texto-2); }
.chat-status.on { color: var(--verde-claro); }
.chat-status.pausa { color: var(--amarelo); }
.select-etapa { width: auto; max-width: 220px; padding: 6px 8px; }
.voltar { display: none; }
.toggle-ia { display: flex; align-items: center; gap: 6px; font-weight: 700; flex: none; }

.menu-chat-kebab { display: none; }
.rotulo-mobile { display: none; }
.menu-chat { display: flex; align-items: center; gap: 10px; }
.menu-chat-item { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.menu-chat-item.botao-texto {
  width: 32px; height: 32px; border-radius: 50%; justify-content: center; padding: 0;
  background: none; border: 0; color: var(--texto-2); font-size: 0;
}
.menu-chat-item.botao-texto:hover { background: var(--ativo); }
#btn-limpar-memoria.botao-texto::before { content: "🧹"; font-size: 15px; line-height: 1; }
#btn-bloquear.botao-texto::before { content: "🚫"; font-size: 15px; line-height: 1; }

.chat-aviso { background: #3d2f0d; color: #ffd27a; padding: 8px 16px; font-size: 13px; border-radius: var(--raio-sm); margin: 6px 8px 0; }
.chat-msgs {
  flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 3px;
  background-color: var(--fundo);
  background-image: var(--padrao-fundo);
  background-size: 220px 220px;
}
.dia {
  align-self: center; background: var(--painel-2); color: var(--texto-2); font-size: 12px;
  padding: 4px 12px; border-radius: 8px; margin: 10px 0 6px;
}
.msg {
  max-width: min(65%, 560px); padding: 6px 9px 8px; border-radius: 8px; position: relative;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px .5px rgba(0,0,0,.13);
}
.msg a { color: #53bdeb; word-break: break-all; }
.msg.cliente { align-self: flex-start; background: var(--bolha-in); border-top-left-radius: 0; }
.msg.bot { align-self: flex-end; background: var(--bolha-bot); border-top-right-radius: 0; }
.msg.humano { align-self: flex-end; background: var(--bolha-humano); border-top-right-radius: 0; }
.msg.sistema {
  align-self: center; background: #182229; color: #ffd27a; font-size: 12.5px; text-align: center;
  max-width: 80%; border-radius: 8px;
}
.msg-autor { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.msg.bot .msg-autor { color: #7cc4ff; }
.msg.humano .msg-autor { color: var(--verde-claro); }
.msg-midia { font-style: italic; color: #b5c2ca; }
.msg-hora { float: right; font-size: 11px; color: rgba(233,237,239,.6); margin: 6px 0 -4px 10px; }
.msg + .msg.cliente, .msg + .msg.bot, .msg + .msg.humano { margin-top: 2px; }
.msg-tick { font-size: 13px; color: rgba(233,237,239,.6); margin-left: 3px; }
.msg-tick.lido { color: #53bdeb; }
.msg-tick.falhou { color: #ff9b9b; }
.msg-audio { display: block; max-width: 260px; height: 36px; }
.msg-audio.carregando { font-size: 13px; color: #b5c2ca; font-style: italic; }
.msg-imagem { display: block; max-width: 280px; max-height: 320px; border-radius: var(--raio-sm); object-fit: cover; }
.msg-legenda { margin-top: 4px; }
#btn-imagem { border-radius: 50%; width: 40px; height: 40px; flex: none; background: transparent; border-color: transparent; font-size: 18px; }
#btn-imagem:hover { background: var(--ativo); }

#btn-bloquear.bloqueado { background: #c0392b; border-color: #c0392b; }
.compositor button:disabled, .compositor textarea:disabled { opacity: .5; cursor: not-allowed; }
.tag.bloqueado { background: #c0392b; color: #fff; }
.tag.agendado { background: #1f7a9c; color: #fff; }

.menu-anexar-wrap { position: relative; }
.menu-anexar {
  position: absolute; bottom: 48px; left: 0; background: #233138; border-radius: var(--raio-md);
  box-shadow: var(--sombra-flutuante); display: flex; flex-direction: column; overflow: hidden;
  min-width: 190px; z-index: 20;
}
.menu-anexar button {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: none; border: 0;
  color: var(--texto); font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap;
  transition: background .15s ease;
}
.menu-anexar button:hover { background: var(--ativo); }
.menu-pix { position: absolute; bottom: 48px; left: 0; background: var(--painel-2); border-radius: var(--raio-md);
  box-shadow: var(--sombra-flutuante); min-width: 220px; z-index: 20; overflow: hidden; }
.menu-pix button { display: block; width: 100%; padding: 10px 14px; background: none; border: 0;
  color: var(--texto); font-size: 14px; text-align: left; cursor: pointer; transition: background .15s ease; }
.menu-pix button:hover { background: var(--ativo); }

.abas-tipo { display: flex; gap: 8px; margin: -6px 0 4px; }
.aba-tipo { background: none; border: 1px solid #3a4a52; color: var(--texto-2); border-radius: 16px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.aba-tipo.ativo { background: var(--verde); border-color: var(--verde); color: #fff; }
.linha-dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.msg-documento, .msg-contato { display: flex; align-items: center; gap: 8px; }
.msg-video { display: block; max-width: 280px; max-height: 320px; border-radius: var(--raio-sm); }
.msg-figurinha { display: block; width: 140px; height: 140px; object-fit: contain; }
/* Figurinha mostra sem a "bolha" ao redor, igual no WhatsApp de verdade. */
.msg.figurinha { background: none; box-shadow: none; padding: 0; }
.msg.figurinha .msg-hora { position: absolute; right: 4px; bottom: 2px; background: rgba(0,0,0,.45); border-radius: 4px; padding: 0 4px; color: #fff; }
.linha-pix { display: flex; gap: 8px; margin-bottom: 8px; }
.linha-pix input { flex: 1; }

.linha-automacao-funil { margin-bottom: 10px; }
.linha-automacao-funil label { display: block; font-weight: 600; }
.linha-automacao-funil textarea { font-weight: normal; margin-top: 4px; resize: vertical; }

.msg { position: relative; }
.msg-menu-btn {
  position: absolute; top: 2px; right: 4px; background: none; border: 0; color: rgba(233,237,239,.65);
  font-size: 13px; cursor: pointer; opacity: 0; padding: 2px 5px; border-radius: 4px; line-height: 1;
}
.msg:hover .msg-menu-btn { opacity: 1; }
.msg-menu-btn:hover { background: rgba(255,255,255,.12); }
.msg-dropdown {
  position: fixed; background: var(--painel-2); border-radius: var(--raio-md); box-shadow: var(--sombra-flutuante);
  overflow: hidden; z-index: 30; min-width: 150px;
}
.msg-dropdown button {
  display: block; width: 100%; padding: 9px 14px; background: none; border: 0; color: var(--texto);
  font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap; transition: background .15s ease;
}
.msg-dropdown button:hover { background: var(--ativo); }
.msg-emoji-picker {
  position: fixed; background: var(--painel-2); border-radius: 20px; box-shadow: var(--sombra-flutuante);
  padding: 6px 8px; display: flex; gap: 4px; z-index: 30;
}
.msg-emoji-picker button { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 2px; border-radius: 50%; }
.msg-emoji-picker button:hover { background: var(--ativo); }

.msg-citando {
  border-left: 3px solid #53bdeb; background: rgba(255,255,255,.06); border-radius: 6px;
  padding: 4px 8px; margin-bottom: 4px; font-size: 13px; color: var(--texto-2);
}
.msg-citando b { display: block; color: #53bdeb; font-size: 12px; }
.msg-reacao {
  position: absolute; bottom: -10px; right: 6px; background: var(--painel-2); border-radius: 10px;
  font-size: 13px; padding: 1px 5px; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.compositor-citando {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--painel-2);
  border-left: 3px solid #53bdeb; margin: 0 10px; border-radius: 6px 6px 0 0;
}
.compositor-citando .texto { flex: 1; font-size: 13px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compositor-citando button { background: none; border: 0; color: var(--texto-2); cursor: pointer; font-size: 16px; }

#chat-cab-info { cursor: pointer; border-radius: 6px; padding: 2px 6px; }
#chat-cab-info:hover { background: var(--ativo); }

.painel-contato {
  position: absolute; top: 0; right: 0; bottom: 0; width: 320px; max-width: 85vw;
  background: var(--painel-2); border-left: 1px solid var(--borda); display: flex; flex-direction: column;
  z-index: 15; box-shadow: -4px 0 16px rgba(0,0,0,.3);
}
.painel-contato-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--borda); }
.painel-contato-cab h3 { margin: 0; font-size: 16px; }
.painel-contato-corpo { flex: 1; overflow-y: auto; padding: 16px; }
.painel-contato-avatar { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 18px; }
.avatar.grande { width: 72px; height: 72px; font-size: 28px; }
.pc-numero { font-weight: 600; font-size: 15px; }
.pc-nome { color: var(--texto-2); font-size: 13px; }
.pc-notas-label { display: flex; flex-direction: column; gap: 5px; color: var(--texto-2); font-size: 13px; margin-bottom: 18px; }
.pc-midia-cab { display: flex; justify-content: space-between; align-items: center; color: var(--texto-2); font-size: 13px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--borda); }
.pc-midia-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pc-midia-item { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--ativo); display: flex; align-items: center; justify-content: center; position: relative; }
.pc-midia-item img, .pc-midia-item video { width: 100%; height: 100%; object-fit: cover; }
.pc-midia-item.documento { flex-direction: column; font-size: 11px; padding: 6px; text-align: center; gap: 4px; word-break: break-all; }
.pc-midia-vazio { grid-column: 1 / -1; color: var(--texto-2); font-size: 13px; text-align: center; padding: 20px 0; }

.btn-mic { border-radius: 50%; width: 40px; height: 40px; flex: none; background: transparent; border-color: transparent; font-size: 18px; }
.btn-mic:hover { background: var(--ativo); }
.btn-mic.gravando { background: #c0392b; border-color: #c0392b; animation: pulsar 1.2s infinite; }
@keyframes pulsar { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.compositor-gravando { display: flex; align-items: center; gap: 8px; flex: 1; color: #ff9b9b; font-size: 14px; padding: 0 6px; }
.btn-cancelar-audio {
  background: none; border: 0; color: #ff9b9b; font-size: 18px; cursor: pointer; padding: 4px 6px;
  line-height: 1; border-radius: 6px; flex-shrink: 0; margin-left: auto; /* cola no botão do mic, à direita */
}
.btn-cancelar-audio:hover { background: rgba(255,155,155,.15); }

.chat-escrevendo { padding: 4px 16px; color: #7cc4ff; font-size: 13px; background: var(--fundo); text-align: center; }
.compositor {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 14px; background: var(--painel-2);
  margin: 0 10px 10px; border-radius: 26px; box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.compositor textarea {
  flex: 1; resize: none; border-radius: 20px; padding: 10px 14px;
  background: var(--ativo); border: 0;
  /* 160px fixo tomava a tela inteira no celular quando o teclado já ocupa boa parte da altura
     visível — dvh acompanha a altura de verdade disponível (encolhe com o teclado aberto), então
     o campo nunca cresce além de ~1/3 do espaço que sobrou. O 160px continua de reserva pra
     navegadores sem suporte a dvh. */
  max-height: 160px;
  max-height: min(160px, 32dvh);
}
.btn-sugerir { border-radius: 20px; height: 40px; background: #1f3a54; border-color: #1f3a54; color: #cfe8ff; }
.btn-sugerir:hover { background: #29496a; }

/* ---------- Testar ---------- */
.view-testar, .view-config { justify-content: center; overflow-y: auto; background: var(--painel); }
.testar-caixa { width: min(820px, 100%); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.testar-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; }
.testar-cab h2, .config-cab h2 { margin: 0; }
.testar-cab p { margin: 4px 0 0; color: var(--texto-2); }
.teste-msgs { border-radius: 10px 10px 0 0; }

/* ---------- Configurações ---------- */
.config { width: min(980px, 100%); padding: 16px; display: flex; flex-direction: column; gap: 14px; align-self: flex-start; }
.config-cab {
  display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0;
  background: var(--painel); padding: 8px 0; z-index: 2;
}
.cartao { background: var(--painel-2); border-radius: var(--raio-md); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.resc-cab { display: flex; justify-content: space-between; align-items: center; }
#lista-repescagens { display: flex; flex-direction: column; gap: 12px; }

.sessoes-sub { color: var(--texto-2); font-size: 13px; margin: -6px 0 2px; max-width: 760px; }
.sessoes-lista { padding: 6px; gap: 2px; }
.sessoes-vazio { color: var(--texto-2); padding: 10px; }
.sessao-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 10px; border-radius: var(--raio-sm); transition: background .15s ease;
}
.sessao-item:hover { background: var(--ativo); }
.sessao-topo { display: flex; align-items: center; gap: 8px; }
.sessao-detalhe { font-size: 12.5px; color: var(--texto-2); margin-top: 2px; }
.sessao-voce { background: #0a4a3e; color: var(--verde-claro); }
.btn-sair-sessao { flex: none; background: #5c1f1f; border-color: #5c1f1f; color: #ffb4b4; }
.btn-sair-sessao:hover { background: #712525; }
.cartao h3 { margin: 0; font-size: 16px; }
.cartao textarea, .cartao input, .cartao select { background: var(--painel); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.grade label, .modal-caixa label { display: flex; flex-direction: column; gap: 5px; color: var(--texto-2); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--verde); }
.dica { margin: 0; color: var(--texto-2); font-size: 13px; }

/* ---------- Agenda (compromissos) ---------- */
.tabela-agenda { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela-agenda th { text-align: left; color: var(--texto-2); font-weight: 500; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--borda); }
.tabela-agenda td { padding: 10px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela-agenda tbody tr[data-abrir] { cursor: pointer; }
.tabela-agenda tbody tr[data-abrir]:hover { background: var(--ativo); }

.agenda-cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0; }
.agenda-cal-nav b { font-size: 15px; min-width: 160px; text-align: center; }
.agenda-calendario {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--borda); border: 1px solid var(--borda); border-radius: var(--raio-sm); overflow: hidden; margin-bottom: 14px;
}
.agenda-cal-cab { background: var(--painel); color: var(--texto-2); font-size: 11.5px; text-align: center; padding: 6px 2px; }
.agenda-cal-dia { background: var(--painel-2); min-height: 76px; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.agenda-cal-dia.fora-mes { opacity: 0.35; }
.agenda-cal-numero { font-size: 11.5px; color: var(--texto-2); padding: 0 2px; }
.agenda-cal-dia.hoje .agenda-cal-numero { color: var(--verde-claro); font-weight: 600; }
.agenda-cal-item {
  background: var(--verde); color: #fff; font-size: 11px; line-height: 1.3;
  padding: 2px 5px; border-radius: 4px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agenda-cal-item:hover { filter: brightness(1.15); }
@media (max-width: 700px) {
  .agenda-cal-dia { min-height: 48px; }
  .agenda-cal-item { font-size: 10px; }
}

/* ---------- Som de notificação ---------- */
.som-lista { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.som-opcao {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer;
}
.som-opcao:hover { background: var(--ativo); }
.som-opcao.ativo { border-color: var(--verde); background: var(--ativo); }
.som-opcao input { width: 18px; height: 18px; accent-color: var(--verde); flex: none; }
.som-opcao span { flex: 1; }
.som-opcao .btn { flex: none; }

/* ---------- Funil (quadro) ---------- */
.view-funil { flex-direction: column; min-width: 0; }
.funil-cab { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; flex-wrap: wrap; }
.funil-cab h2 { margin: 0; flex: none; }
.busca-funil { flex: 1; min-width: 200px; max-width: 360px; margin: 0; }
.funil-dica { padding: 0 16px 10px; }
.kanban {
  flex: 1; display: flex; gap: 12px; padding: 0 16px 16px; overflow-x: auto; overflow-y: hidden;
  align-items: flex-start; min-height: 0;
}
.kanban-col {
  --cor-col: var(--verde);
  width: 290px; flex: none; background: var(--painel); border-radius: var(--raio-md);
  display: flex; flex-direction: column; max-height: 100%; border-top: 3px solid var(--cor-col);
  transition: background .12s, outline .12s;
}
.kanban-col.sobre { outline: 2px dashed var(--cor-col); outline-offset: -2px; background: var(--ativo); }
.kanban-col.arrastando-col { opacity: .4; }
.kanban-col-cab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; font-weight: 700; position: sticky; top: 0; background: var(--painel); border-radius: 10px 10px 0 0;
}
.kanban-col-cab[draggable="true"] { cursor: grab; }
.kanban-col-cab[draggable="true"]:active { cursor: grabbing; }
.kanban-col-handle { flex: none; color: var(--texto-2); font-size: 13px; user-select: none; }
.kanban-col-nome {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 5px; padding: 2px 5px; margin: -2px -5px; cursor: text;
}
.kanban-col-nome:hover { background: var(--ativo); }
.kanban-col-nome:focus {
  outline: 1px solid var(--verde); background: var(--painel-2); white-space: normal;
  overflow: visible; cursor: text;
}
.kanban-col-cab .n {
  background: var(--cor-col); color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 12px; flex: none;
}
.kanban-col-corpo { overflow-y: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kanban-vazia, .kanban-mais { color: var(--texto-2); font-size: 12.5px; text-align: center; padding: 10px 4px; }

.kcard {
  background: var(--painel-2); border-radius: var(--raio-sm); padding: 9px 10px; cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); border: 1px solid transparent; transition: border-color .15s ease;
}
.kcard:hover { border-color: var(--borda); }
.kcard:active { cursor: grabbing; }
.kcard.arrastando { opacity: .35; }
.kcard-topo { display: flex; align-items: center; gap: 8px; }
.avatar.mini { width: 30px; height: 30px; font-size: 12px; flex: none; }
.kcard-info { flex: 1; min-width: 0; }
.kcard-nome { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-hora { font-size: 11px; color: var(--texto-2); }
.kcard-prev { font-size: 12.5px; color: var(--texto-2); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-mover {
  width: 100%; margin-top: 8px; font-size: 11.5px; padding: 4px 6px; background: var(--painel);
  border-color: var(--borda);
}

@media (max-width: 820px) {
  .kanban-col { width: 78vw; }
}

/* ---------- Disparos ---------- */
.view-disparos { overflow-y: auto; background: var(--painel); }
.disparos { display: flex; gap: 16px; padding: 16px; width: 100%; max-width: 1400px; margin: 0 auto; align-items: flex-start; flex-wrap: wrap; }
.disparo-novo { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.disparo-hist { flex: 0 1 380px; min-width: 0; position: sticky; top: 0; }
.disparo-hist h2 { margin: 8px 0 12px; }
.campo { display: flex; flex-direction: column; gap: 5px; color: var(--texto-2); font-size: 13px; }
.modo { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.modo .check { align-items: flex-start; }
.modo .check input { margin-top: 2px; }
.linha-modelo { display: flex; gap: 8px; align-items: flex-end; }
.linha-modelo .campo { flex: 1; }
.linha-modelo .btn { height: 38px; }
.vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.leads-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.leads-acoes select { width: auto; }
.leads-acoes label.btn { cursor: pointer; }
code { background: var(--painel); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.dica a { color: var(--verde-claro); }
.previa-fundo { background: #0b141a; border-radius: var(--raio-sm); padding: 14px; display: flex; }
.msg.disparo { align-self: flex-end; background: #3a2e5c; color: #e9edef; border-top-right-radius: 0; }
.msg.disparo .msg-autor { color: #c9b6ff; }
.previa { max-width: 100%; margin-left: auto; }
.previa:empty::before { content: "A prévia aparece aqui"; color: var(--texto-2); font-style: italic; }
.btn-grande { padding: 12px; font-size: 16px; border-radius: 10px; }

.disp-item { background: var(--painel-2); border-radius: var(--raio-md); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: background .15s ease; }
.disp-item:hover { background: var(--ativo); }
.disp-topo { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.disp-nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disp-status { font-size: 12px; font-weight: 600; border-radius: 99px; padding: 1px 8px; flex: none; }
.st-rodando { background: #0a4a3e; color: var(--verde-claro); }
.st-pausado { background: #4a3a12; color: var(--amarelo); }
.st-concluido { background: var(--ativo); color: var(--texto); }
.st-cancelado { background: #4a1f1f; color: #ffb4b4; }
.barra { height: 6px; background: var(--painel); border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.barra div { height: 100%; background: var(--verde); transition: width .3s; }
.disp-nums { font-size: 12px; color: var(--texto-2); display: flex; gap: 10px; flex-wrap: wrap; }

.modal-largo { width: min(900px, 100%); max-height: 90vh; overflow: hidden; }

.lista-cores-etapa { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.linha-cor-etapa { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nome-etapa { font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatches { display: flex; align-items: center; gap: 6px; flex: none; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; padding: 0;
}
.swatch.selecionada { border-color: #fff; }
.swatch-custom-input {
  width: 22px; height: 22px; padding: 0; border: 1px dashed var(--texto-2); border-radius: 50%;
  background: none; cursor: pointer; overflow: hidden;
}
.swatch-custom-input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-custom-input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.det-cab { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.det-cab h3 { margin: 0 0 4px; }
.det-numeros { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.det-num { background: var(--painel-2); border-radius: var(--raio-sm); padding: 8px 10px; }
.det-num b { display: block; font-size: 20px; }
.det-num span { font-size: 12px; color: var(--texto-2); }
.det-filtro select { width: auto; }
.tabela-rolagem { overflow: auto; min-height: 120px; flex: 1; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; color: var(--texto-2); font-weight: 600; position: sticky; top: 0; background: var(--painel); }
.tabela th, .tabela td { padding: 7px 8px; border-bottom: 1px solid var(--painel-2); white-space: nowrap; }
.tabela td.erro { color: #ff9b9b; white-space: normal; min-width: 200px; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover { background: var(--painel-2); }

/* ---------- Modal e toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-caixa {
  width: min(440px, 100%); background: var(--painel); border-radius: var(--raio-lg); padding: 20px;
  box-shadow: var(--sombra-modal);
  display: flex; flex-direction: column; gap: 12px;
}
.modal-caixa h3 { margin: 0; }
.modal-botoes { display: flex; justify-content: flex-end; gap: 8px; }

.modal-midia { z-index: 30; }
.modal-midia-caixa { position: relative; width: min(1400px, 96vw); max-height: 94vh; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.modal-midia-caixa img { max-width: 100%; max-height: 86vh; border-radius: 8px; object-fit: contain; }
.modal-midia-caixa iframe { width: 100%; height: 88vh; border: 0; border-radius: 8px; background: #fff; }
/* Sem isso, essa div (filha de um flex com align-items:center) encolhe pro conteúdo —
   e o iframe, sem um pai com largura de verdade pra calcular "100%", cai no padrão do
   navegador (300px), preso numa moldura pequena mesmo com a caixa de fora já larga. */
#modal-midia-conteudo { width: 100%; }
.modal-midia-fechar {
  position: absolute; top: -40px; right: 0; background: none; border: 0; color: #fff;
  font-size: 22px; cursor: pointer; padding: 6px 10px; line-height: 1;
}
.modal-midia-fechar:hover { opacity: .8; }
#modal-midia-baixar { align-self: center; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; width: min(480px, calc(100% - 32px)); }
.toast { background: var(--ativo); color: var(--texto); padding: 10px 16px; border-radius: var(--raio-sm); box-shadow: var(--sombra-flutuante); animation: entra .2s; }
.toast.erro { background: #5c1f1f; color: #fff; }
.toast.ok { background: #0a4a3e; color: #fff; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Celular ---------- */
@media (max-width: 820px) {
  .trilho { width: 52px; }
  .lista-painel { width: 100%; border-right: 0; }
  .resizer-lista { display: none; }
  .chat-painel { display: none; }
  body.chat-aberto .lista-painel { display: none; }
  body.chat-aberto .chat-painel { display: flex; }
  .voltar { display: block; font-size: 24px; padding: 4px 8px 4px 2px; }
  .chat-msgs { padding: 12px 10px; }
  .msg { max-width: 85%; }
  /* No celular o teclado já come boa parte da tela — um limite mais apertado garante que sempre
     sobre espaço pra ver as últimas mensagens, mesmo escrevendo um texto longo. */
  .compositor textarea { max-height: min(110px, 26dvh); }
  .interruptor-geral span { display: none; }
  .btn-sugerir { padding: 0 10px; }

  .chat-cab { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; }
  .chat-cab .avatar { width: 38px; height: 38px; }
  .chat-nome { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .toggle-ia { gap: 4px; font-size: 11px; }
  .toggle-ia .switch { width: 32px; height: 19px; }
  .toggle-ia .switch::after { width: 13px; height: 13px; }
  .toggle-ia .switch:checked::after { transform: translateX(13px); }

  .menu-chat-kebab { display: block; font-size: 20px; }
  .rotulo-mobile { display: inline; }
  .menu-chat {
    display: none; position: absolute; top: 54px; right: 8px; z-index: 5;
    flex-direction: column; align-items: stretch; gap: 0; width: 230px;
    background: var(--painel-2); border-radius: var(--raio-md); box-shadow: var(--sombra-flutuante);
    border: 1px solid var(--ativo); overflow: hidden;
  }
  .menu-chat.aberto { display: flex; padding: 8px 0; }
  .menu-chat-item {
    justify-content: space-between; font-weight: 400; font-size: 16px; padding: 14px 16px;
    border-radius: 0; line-height: 1.3;
  }
  .menu-chat-item.botao-texto {
    width: auto; height: auto; display: block; text-align: left; justify-content: initial;
    font-size: 16px; color: var(--texto); background: none;
  }
  .menu-chat-item.botao-texto:hover { background: var(--ativo); }
  #btn-limpar-memoria.botao-texto::before, #btn-bloquear.botao-texto::before { content: none; }
  .item-etapa {
    flex-direction: column; align-items: stretch; gap: 8px;
    border-bottom: 1px solid var(--ativo); margin-bottom: 6px; padding-bottom: 16px;
  }
  .item-etapa .select-etapa { max-width: none; width: 100%; }
}
