/* conversas.css — Chat de WhatsApp (padrão Ruah CRM) no design do Froteli.
 *
 * Só tokens do Froteli (css/styles.css): a mesma tela funciona no tema
 * claro e no escuro. Tudo com prefixo .cv- para não pegar no chat antigo,
 * que continua no HTML (escondido) enquanto outras telas usam funções dele.
 */

:root{
  --cv-verde: var(--accent);
  --cv-verde-escuro: var(--accent2);
  --cv-minha: #019478;            /* bolha de quem atende: contraste AA com texto branco */
  --cv-minha-txt: #FFFFFF;
  --cv-dele: var(--card);
  --cv-fundo: var(--bg2);
  --cv-lido: #34B7F1;             /* o azul do "lido" do WhatsApp */
  --cv-linha: var(--border2);
  --cv-suave: var(--bg3);
  --cv-ease: cubic-bezier(.22,1,.36,1);
}
:root[data-theme="dark"]{
  --cv-minha: #017a63;
  --cv-dele: #1F232C;
  --cv-fundo: #0F1115;
  --cv-suave: #262B35;
}

/* ══ PEÇAS COMUNS ══ */

.cv-avatar{
  position:relative; flex-shrink:0; overflow:hidden;
  width:var(--cv-av,40px); height:var(--cv-av,40px); border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:calc(var(--cv-av,40px) * .36);
  font-family:var(--font-body); letter-spacing:.02em; user-select:none;
}
.cv-avatar img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }

.cv-girando{
  display:inline-block; width:12px; height:12px; border-radius:50%;
  border:2px solid currentColor; border-right-color:transparent;
  animation:cvGira .7s linear infinite; vertical-align:-2px;
}
@keyframes cvGira{ to{ transform:rotate(360deg); } }

.cv-pulso{
  display:inline-block; width:6px; height:6px; border-radius:50%;
  background:currentColor; animation:cvPulso 1.2s ease-in-out infinite;
}
@keyframes cvPulso{ 0%,100%{opacity:1} 50%{opacity:.25} }

.cv-esqueleto{
  border-radius:12px;
  background:linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size:200% 100%; animation:cvEsqueleto 1.3s ease-in-out infinite;
}
@keyframes cvEsqueleto{ to{ background-position:-200% 0; } }

.cv-campo{ display:flex; flex-direction:column; gap:5px; }
.cv-campo > span{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--muted2); }
.cv-campo input, .cv-campo select{
  width:100%; padding:9px 12px; border-radius:8px; font-size:13px;
  background:var(--bg); color:var(--text); border:1.5px solid var(--border2);
  font-family:var(--font-body); outline:none; transition:border-color .15s;
}
.cv-campo input:focus, .cv-campo select:focus{ border-color:var(--accent); }
.cv-campo small{ font-size:11px; color:var(--muted2); }

.btn.cv-perigo{ color:var(--red); border-color:var(--red-border); }
.btn.cv-perigo:hover{ background:var(--red-bg); color:var(--red); border-color:var(--red-border); }

@media (prefers-reduced-motion: reduce){
  .cv-girando, .cv-pulso, .cv-esqueleto{ animation:none; }
}

/* ══ CONECTAR WHATSAPP (modal) ══ */

.cv-modal-conexao{ width:min(480px, calc(100vw - 32px)); padding:22px; }
#cv-conexao-corpo{ display:flex; flex-direction:column; gap:12px; }

.cv-cx-estado{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px;
  border:1px solid var(--border2); background:var(--card);
}
.cv-cx-icone{
  width:34px; height:34px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg3); color:var(--muted);
}
.cv-cx-icone svg{ width:18px; height:18px; }
.cv-cx-icone.ligado{ background:var(--accent-light); color:var(--accent2); }
.cv-cx-estado-txt{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.cv-cx-estado-txt strong{ font-size:13px; color:var(--text); }
.cv-cx-estado-txt code{ font-size:11px; color:var(--muted2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.cv-cx-aviso{
  padding:10px 12px; border-radius:10px; font-size:13px; line-height:1.5;
  background:var(--yellow-bg); border:1px solid var(--yellow-border); color:var(--badge-yellow-fg);
  display:flex; flex-direction:column; gap:8px; align-items:flex-start;
}
.cv-cx-nota{ font-size:12px; color:var(--muted); line-height:1.5; }

.cv-cx-qr{
  display:flex; flex-direction:column; align-items:center; gap:8px; text-align:center;
  padding:16px; border-radius:12px; border:1px solid var(--border2); background:var(--card);
}
.cv-cx-qr strong{ font-size:14px; color:var(--text); }
.cv-cx-qr p{ font-size:12.5px; color:var(--muted); line-height:1.5; }
.cv-cx-qr img{ width:224px; height:224px; border-radius:10px; border:1px solid var(--border2); background:#fff; image-rendering:pixelated; }
.cv-cx-qr small{ font-size:11px; color:var(--muted2); }
.cv-cx-esperando{ display:flex; align-items:center; gap:6px; }
.cv-cx-esperando .cv-pulso{ color:var(--accent); }

.cv-cx-botoes{ display:flex; flex-wrap:wrap; gap:8px; }

/* ══ TELA DE CONVERSAS ══ */

.page.cv-pagina{ overflow:hidden; }
/* `hidden` tem que valer mesmo onde a classe define display. */
.cv-pagina [hidden], .cv-menu-msg[hidden], .cv-emoji[hidden], .cv-imagem[hidden]{ display:none !important; }
.cv-raiz{ flex:1; min-height:0; display:flex; flex-direction:column; gap:10px; }

.cv-aviso{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; flex-shrink:0;
  padding:10px 14px; border-radius:12px; font-size:13px; line-height:1.5;
  background:var(--yellow-bg); border:1px solid var(--yellow-border); color:var(--badge-yellow-fg);
}
.cv-aviso p{ flex:1; min-width:220px; }
.cv-aviso code{ font-size:12px; }
.cv-aviso .btn{ padding:6px 12px; font-size:12px; }

.cv-caixa{
  flex:1; min-height:28rem; display:flex; overflow:hidden;
  background:var(--card); border:1px solid var(--border2); border-radius:14px; box-shadow:var(--shadow-sm);
}

/* ── Lista ── */
.cv-lista{ width:340px; flex-shrink:0; display:flex; flex-direction:column; min-width:0; border-right:1px solid var(--border2); }
.cv-lista-topo{ padding:12px 12px 10px; display:flex; flex-direction:column; gap:8px; border-bottom:1px solid var(--border); }
.cv-lista-cab{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.cv-lista-cab h2{ font-family:var(--font-body); font-size:17px; font-weight:700; color:var(--text); }
.cv-btn-conexao{
  width:34px; height:34px; border-radius:10px; border:1px solid var(--border2); background:var(--bg);
  color:var(--accent2); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:background .15s;
}
.cv-btn-conexao:hover{ background:var(--accent-light); }
.cv-btn-conexao svg{ width:18px; height:18px; }
.cv-busca{
  width:100%; height:38px; padding:0 12px; border-radius:10px; font-size:14px; font-family:var(--font-body);
  background:var(--bg2); color:var(--text); border:1.5px solid transparent; outline:none; transition:border-color .15s, background .15s;
}
.cv-busca:focus{ border-color:var(--accent); background:var(--bg); }
.cv-busca::placeholder{ color:var(--muted2); }

.cv-seg{ position:relative; display:grid; grid-template-columns:1fr 1fr; padding:2px; border-radius:9px; background:var(--bg3); }
.cv-seg-bloco{
  position:absolute; top:2px; bottom:2px; left:2px; width:calc(50% - 2px); border-radius:7px;
  background:var(--card); box-shadow:0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04);
  transition:transform .25s var(--cv-ease);
}
.cv-seg.direita .cv-seg-bloco{ transform:translateX(100%); }
.cv-seg button{
  position:relative; height:28px; border:none; background:none; cursor:pointer; border-radius:7px;
  font-family:var(--font-body); font-size:13px; font-weight:500; color:var(--text);
  display:flex; align-items:center; justify-content:center; gap:5px;
}
.cv-seg button[aria-pressed="true"]{ font-weight:700; }
.cv-seg-n{ color:var(--muted2); font-weight:500; font-variant-numeric:tabular-nums; }

.cv-pasta{
  width:100%; display:flex; align-items:center; gap:12px; padding:10px 14px; border:none; border-bottom:1px solid var(--border);
  background:none; cursor:pointer; text-align:left; font-family:var(--font-body); font-size:14px; color:var(--text);
}
.cv-pasta:hover{ background:var(--bg2); }
.cv-pasta.voltar{ gap:8px; font-weight:600; }
.cv-pasta.voltar svg{ width:16px; height:16px; color:var(--muted); }
.cv-pasta-ico{ width:38px; height:38px; border-radius:50%; background:var(--bg3); color:var(--muted); display:flex; align-items:center; justify-content:center; }
.cv-pasta-ico svg{ width:18px; height:18px; }
.cv-pasta-nome{ flex:1; font-weight:600; }
.cv-pasta-n{ font-size:12px; color:var(--muted2); }

.cv-itens{ list-style:none; margin:0; padding:0; flex:1; overflow-y:auto; overscroll-behavior-y:contain; }
.cv-vazio{ flex:1; display:flex; align-items:center; justify-content:center; padding:24px; text-align:center; font-size:13.5px; line-height:1.55; color:var(--muted); }
.cv-linha-esqueleto{ display:flex; flex-direction:column; gap:6px; padding:14px 16px; }
.cv-linha-esqueleto span{ height:12px; }
.cv-linha-esqueleto span:first-child{ width:60%; }
.cv-linha-esqueleto span:last-child{ width:85%; }

.cv-linha{ position:relative; overflow:hidden; touch-action:pan-y; border-bottom:1px solid var(--border); }
.cv-linha-fundo{
  position:absolute; inset:0; display:flex; align-items:center; gap:8px; padding:0 20px; opacity:0;
  color:#fff; font-size:13px; font-weight:600;
}
.cv-linha-fundo svg{ width:20px; height:20px; transition:scale .12s; }
.cv-linha-fundo.esquerda{ background:var(--accent2); }
.cv-linha-fundo.direita{ background:var(--yellow); flex-direction:row-reverse; }
.cv-linha-conteudo{ position:relative; background:var(--card); }
.cv-linha-botao{
  width:100%; display:flex; align-items:center; gap:12px; padding:10px 14px; border:none; background:none;
  cursor:pointer; text-align:left; font-family:var(--font-body); color:var(--text); transition:background .12s;
}
.cv-linha-botao:hover{ background:var(--bg2); }
.cv-linha-botao.ativa{ background:var(--accent-light); }
.cv-linha-txt{ flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.cv-linha-topo, .cv-linha-baixo{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.cv-linha-nome-wrap{ display:flex; align-items:baseline; gap:6px; min-width:0; }
.cv-linha-nome{ font-size:14.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cv-selo{ flex-shrink:0; font-size:10px; line-height:15px; padding:0 6px; border-radius:99px; background:var(--accent-light); color:var(--accent2); font-weight:600; }
.cv-linha-hora{ flex-shrink:0; font-size:11.5px; color:var(--muted2); font-variant-numeric:tabular-nums; }
.cv-linha-hora.nova{ color:var(--accent2); font-weight:600; }
.cv-linha-previa{ min-width:0; font-size:13px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cv-linha-previa.forte{ color:var(--text); font-weight:500; }
.cv-voce{ color:var(--muted2); font-weight:400; }
.cv-nao-lidas{
  flex-shrink:0; min-width:20px; height:20px; padding:0 6px; border-radius:10px; background:var(--accent2); color:#fff;
  font-size:11px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; font-variant-numeric:tabular-nums;
}
.cv-linha-hover{
  position:absolute; right:10px; top:50%; transform:translateY(-50%); display:none; gap:2px; padding:2px;
  border-radius:9px; background:var(--card); box-shadow:var(--shadow-md);
}
.cv-linha-hover button{
  width:30px; height:30px; border:none; border-radius:7px; background:none; color:var(--muted); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.cv-linha-hover button:hover{ background:var(--bg2); color:var(--text); }
.cv-linha-hover svg{ width:17px; height:17px; }
@media (hover:hover) and (pointer:fine){
  .cv-linha:hover .cv-linha-hover, .cv-linha:focus-within .cv-linha-hover{ display:flex; }
}

/* ── Conversa ── */
.cv-chat{ flex:1; min-width:0; display:flex; flex-direction:column; background:var(--card); }
.cv-chat-vazio{ flex:1; display:flex; align-items:center; justify-content:center; padding:24px; text-align:center; font-size:14px; color:var(--muted); }
.cv-chat-topo{ display:flex; align-items:center; gap:8px; padding:9px 12px; border-bottom:1px solid var(--border2); flex-shrink:0; }
.cv-voltar{
  display:none; width:36px; height:36px; flex-shrink:0; border:none; border-radius:10px; background:none; cursor:pointer;
  color:var(--muted); align-items:center; justify-content:center;
}
.cv-voltar svg{ width:18px; height:18px; }
.cv-voltar:active{ background:var(--bg2); }
.cv-chat-quem{
  flex:1; min-width:0; display:flex; align-items:center; gap:10px; border:none; background:none; cursor:pointer;
  text-align:left; color:var(--text); font-family:var(--font-body); padding:2px; border-radius:10px;
}
.cv-chat-quem:hover strong{ color:var(--accent2); }
.cv-chat-quem-txt{ min-width:0; display:flex; flex-direction:column; gap:1px; }
.cv-chat-quem-txt strong{ font-size:15px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; transition:color .15s; }
.cv-chat-quem-txt span{ font-size:12px; color:var(--muted2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-variant-numeric:tabular-nums; }
.cv-ver-funil{
  flex-shrink:0; display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 10px; border-radius:9px;
  border:1px solid var(--border2); background:none; color:var(--muted); font-size:12.5px; font-weight:600; cursor:pointer; font-family:var(--font-body);
}
.cv-ver-funil:hover{ color:var(--accent2); border-color:var(--accent); }
.cv-ver-funil svg{ width:16px; height:16px; }

/* Barra de atalhos da locadora */
.cv-acoes{
  display:flex; align-items:center; gap:6px; padding:7px 12px; border-bottom:1px solid var(--border);
  overflow-x:auto; scrollbar-width:none; flex-shrink:0; background:var(--card);
}
.cv-acoes::-webkit-scrollbar{ display:none; }
.cv-acao{
  flex-shrink:0; display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 12px; border-radius:99px;
  border:1px solid var(--border2); background:var(--bg); color:var(--text); cursor:pointer;
  font-family:var(--font-body); font-size:12.5px; font-weight:600; white-space:nowrap; transition:background .15s, border-color .15s, scale .15s;
}
.cv-acao:hover{ border-color:var(--accent); background:var(--accent-light); }
.cv-acao:active{ scale:.97; }
.cv-acao svg{ width:16px; height:16px; color:var(--accent2); flex-shrink:0; }
.cv-acao[disabled], .cv-acao:has(select:disabled){ opacity:.5; cursor:not-allowed; }
.cv-acao-resp select{
  border:none; background:transparent; color:inherit; font:inherit; outline:none; cursor:pointer; max-width:170px;
}
.cv-acao-destaque{ background:var(--accent); border-color:var(--accent); color:#fff; }
.cv-acao-destaque svg{ color:#fff; }
.cv-acao-destaque:hover{ background:var(--accent2); border-color:var(--accent2); }

/* Mensagens */
.cv-msgs{
  flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior-y:contain;
  background:var(--cv-fundo); padding:10px 12px 14px;
  /* Só rola na vertical: o dedo de lado é o gesto de responder da bolha;
     pinch-zoom mantém o zoom de pinça (acessibilidade). */
  touch-action:pan-y pinch-zoom;
}
.cv-msgs-conteudo{ display:flex; flex-direction:column; gap:2px; }
.cv-msgs-vazio{ padding:32px 16px; text-align:center; font-size:13.5px; line-height:1.55; color:var(--muted); }
.cv-dia{ display:flex; justify-content:center; padding:10px 0 6px; }
.cv-dia span{
  font-size:11.5px; font-weight:600; color:var(--muted); background:var(--card); padding:3px 10px; border-radius:8px;
  box-shadow:0 1px 1px rgba(0,0,0,.05);
}

.cv-msg{ position:relative; display:flex; transition:margin .15s; }
.cv-msg.com-reacao{ margin-bottom:14px; }
.cv-msg-linha{ position:relative; width:100%; display:flex; align-items:center; gap:2px; }
.cv-msg.minha .cv-msg-linha{ justify-content:flex-end; }
.cv-msg.dele .cv-msg-linha{ justify-content:flex-start; }

.cv-bolha{
  position:relative; max-width:min(85%, 620px); padding:6px 10px 5px; border-radius:16px;
  font-size:14px; line-height:1.45; overflow-wrap:anywhere; transition:opacity .2s;
  box-shadow:0 1px 1px rgba(0,0,0,.07);
}
.cv-msg.minha .cv-bolha{ background:var(--cv-minha); color:var(--cv-minha-txt); border-bottom-right-radius:6px; }
.cv-msg.dele .cv-bolha{ background:var(--cv-dele); color:var(--text); border:1px solid var(--border); border-bottom-left-radius:6px; }
.cv-bolha.pendente{ opacity:.6; }
.cv-texto{ margin:0; white-space:pre-wrap; }
.cv-sem-suporte{ font-style:italic; opacity:.8; }
.cv-emoji-grande{ line-height:1.15; font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.cv-emoji-1{ font-size:40px; } .cv-emoji-2{ font-size:34px; } .cv-emoji-3{ font-size:28px; }
.cv-meta{
  display:flex; align-items:center; justify-content:flex-end; gap:4px; margin:1px 0 0 12px; float:none;
  font-size:11px; line-height:15px; font-variant-numeric:tabular-nums; white-space:nowrap;
}
.cv-msg.minha .cv-meta{ color:rgba(255,255,255,.78); }
.cv-msg.dele .cv-meta{ color:var(--muted2); }
.cv-por-ia{ font-weight:600; }
.cv-recibo{ display:inline-flex; }
.cv-recibo-ico{ display:inline-flex; color:inherit; }
.cv-recibo-ico svg{ width:16px; height:11px; }
.cv-recibo-ico.lido{ color:var(--cv-lido); }
.cv-msg.minha .cv-recibo-ico.lido{ color:#9BE3FF; }

.cv-apagada{ background:transparent !important; border:1px dashed var(--border2) !important; box-shadow:none !important; color:var(--muted) !important; }
.cv-apagada p{ font-style:italic; font-size:13.5px; display:flex; gap:8px; align-items:baseline; }
.cv-hora{ font-style:normal; font-size:11px; color:var(--muted2); font-variant-numeric:tabular-nums; }

.cv-citacao{
  display:block; width:100%; margin:2px 0 5px; padding:4px 8px; border:none; border-left:3px solid; border-radius:8px;
  text-align:left; font-family:var(--font-body); cursor:pointer;
}
.cv-citacao[disabled]{ cursor:default; }
.cv-msg.minha .cv-citacao{ background:rgba(255,255,255,.15); border-left-color:rgba(255,255,255,.65); color:#fff; }
.cv-msg.dele .cv-citacao{ background:var(--bg2); border-left-color:var(--accent); color:var(--text); }
.cv-citacao-de{ display:block; font-size:12px; font-weight:700; }
.cv-msg.dele .cv-citacao-de{ color:var(--accent2); }
.cv-citacao-txt{
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  font-size:12.5px; opacity:.85; white-space:pre-wrap;
}

.cv-reacoes{ position:absolute; bottom:-14px; z-index:1; }
.cv-reacoes.direita{ right:8px; }
.cv-reacoes.esquerda{ left:8px; }
.cv-reacoes-corpo{
  display:inline-flex; align-items:center; gap:2px; height:24px; padding:0 6px; border-radius:99px;
  background:var(--card); border:1px solid var(--border2); box-shadow:var(--shadow-sm); font-size:14px; line-height:1;
  animation:cvReacaoEntra .2s var(--cv-ease);
}
.cv-reacoes-n{ font-size:11px; font-weight:600; color:var(--muted); margin-left:2px; font-family:var(--font-body); }
@keyframes cvReacaoEntra{ from{ opacity:0; scale:.9; } }

.cv-msg-acoes{
  flex-shrink:0; width:28px; height:28px; border:none; border-radius:50%; background:none; cursor:pointer;
  color:var(--muted2); display:flex; align-items:center; justify-content:center; transition:opacity .15s, background .15s;
}
.cv-msg-acoes svg{ width:16px; height:16px; }
.cv-msg-acoes:hover, .cv-msg-acoes.aberto{ background:var(--bg3); color:var(--text); }
/* No mouse os três pontos aparecem ao passar sobre a mensagem; no toque
   ficam sempre (não existe passar o cursor pra revelar). */
@media (hover:hover) and (pointer:fine){
  .cv-msg-acoes{ opacity:0; }
  .cv-msg:hover .cv-msg-acoes, .cv-msg-acoes.aberto, .cv-msg-acoes:focus-visible{ opacity:1; }
}

.cv-realce .cv-bolha{ outline:2px solid var(--accent); outline-offset:2px; transition:outline-color 1.2s; }

/* Gestos na bolha (celular): segurar afunda; arrastar à direita responde.
   Solta, ela volta com a curva do sistema; durante o arraste segue o dedo. */
.cv-msg-linha{ transition:translate .2s var(--cv-ease), scale .2s var(--cv-ease); }
.cv-msg-linha.pressionada{ scale:.98; }
@media (pointer:coarse){
  .cv-msgs-conteudo{ -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
}
.cv-resp-ico{
  position:absolute; left:4px; top:50%; translate:0 -50%; width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; pointer-events:none; opacity:0;
  background:var(--card); color:var(--muted); box-shadow:var(--shadow-md);
}
.cv-resp-ico svg{ width:16px; height:16px; }

/* Mídia dentro da bolha (detalhe em conversas-midia) */
.cv-bolha-midia{ padding:3px; width:min(72vw, 18rem); }
.cv-bolha-midia .cv-legenda{ padding:5px 7px 0; }
.cv-bolha-midia .cv-meta{ padding:0 7px 3px; }
.cv-meta-sobre{
  position:absolute; right:8px; bottom:8px; margin:0; padding:1px 6px; border-radius:99px;
  background:rgba(0,0,0,.45); color:#fff !important; font-size:10.5px;
}
.cv-figurinha{ background:transparent !important; border:none !important; box-shadow:none !important; padding:0 !important; }
.cv-meta-etiqueta{ position:absolute; right:4px; bottom:4px; margin:0; padding:0 6px; border-radius:99px; background:rgba(255,255,255,.92); color:var(--badge-gray-fg) !important; box-shadow:var(--shadow-sm); }
.cv-midia-aviso{ font-style:italic; opacity:.85; }

/* Campo de mensagem */
.cv-compor{ flex-shrink:0; padding:6px 8px; border-top:1px solid var(--border2); background:var(--card); }
.cv-respondendo{
  display:flex; align-items:flex-start; gap:8px; margin:0 4px 6px; padding:6px 10px; border-radius:10px;
  border-left:3px solid var(--accent); background:var(--bg2);
}
.cv-respondendo-txt{ flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.cv-respondendo-txt strong{ font-size:12px; color:var(--accent2); }
.cv-respondendo-txt span{ font-size:13px; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.cv-respondendo button{ width:26px; height:26px; border:none; border-radius:8px; background:none; color:var(--muted); cursor:pointer; display:flex; align-items:center; justify-content:center; }
.cv-respondendo button:hover{ background:var(--bg3); color:var(--text); }
.cv-respondendo svg{ width:14px; height:14px; }

.cv-compor-linha{ display:flex; align-items:flex-end; gap:6px; }
.cv-anexo-slot:empty{ display:none; }
.cv-pilula{
  flex:1; min-width:0; display:flex; align-items:flex-end; gap:4px; padding:4px 4px 4px 14px;
  border-radius:20px; background:var(--bg2); border:1.5px solid transparent; transition:border-color .15s;
}
.cv-pilula:focus-within{ border-color:var(--border2); }
.cv-pilula textarea{
  flex:1; min-width:0; min-height:28px; max-height:120px; padding:4px 0; align-self:center;
  border:none; outline:none; resize:none; background:transparent; color:var(--text);
  font-family:var(--font-body); font-size:14.5px; line-height:1.4;
}
.cv-pilula textarea::placeholder{ color:var(--muted2); }
.cv-pilula textarea:disabled{ cursor:not-allowed; }
.cv-btn-emoji{
  width:30px; height:30px; flex-shrink:0; border:none; border-radius:50%; background:none; color:var(--muted);
  cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .15s, color .15s, scale .15s;
}
.cv-btn-emoji:hover, .cv-btn-emoji[aria-expanded="true"]{ background:var(--bg3); color:var(--text); }
.cv-btn-emoji:active{ scale:.95; }
.cv-btn-emoji:disabled{ opacity:.5; cursor:not-allowed; }
.cv-btn-emoji svg{ width:19px; height:19px; }
.cv-acao-slot{ flex-shrink:0; display:flex; }
.cv-btn-enviar{
  width:40px; height:40px; border:none; border-radius:50%; background:var(--accent2); color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow-sm); transition:background .15s, scale .15s;
}
.cv-btn-enviar:hover{ background:var(--accent); }
.cv-btn-enviar:active{ scale:.94; }
.cv-btn-enviar:disabled{ opacity:.45; cursor:not-allowed; }
.cv-btn-enviar svg{ width:20px; height:20px; }

/* ── Mídia ── */
.cv-midia-estado{ display:flex; align-items:center; gap:6px; font-size:13px; font-style:italic; opacity:.85; padding:2px 0; }
.cv-msg.minha .cv-midia-estado .cv-pulso{ color:#fff; }
.cv-bolha-midia .cv-midia-estado{ padding:8px 10px; }
.cv-midia-imagem{ display:block; width:100%; padding:0; border:none; border-radius:13px; overflow:hidden; cursor:zoom-in; background:var(--bg3); }
.cv-midia-imagem img{ display:block; width:100%; max-height:22rem; object-fit:cover; }
.cv-midia-video{ display:block; width:100%; max-height:22rem; border-radius:13px; background:#000; }
.cv-figurinha-img{ display:block; width:8rem; height:8rem; object-fit:contain; user-select:none; }
.cv-midia-doc{
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; text-decoration:none; min-width:12rem;
}
.cv-msg.minha .cv-midia-doc{ background:rgba(255,255,255,.15); color:#fff; }
.cv-msg.dele .cv-midia-doc{ background:var(--bg2); color:var(--text); }
.cv-midia-doc svg{ width:26px; height:26px; flex-shrink:0; }
.cv-midia-doc span{ min-width:0; display:flex; flex-direction:column; }
.cv-midia-doc strong{ font-size:13.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cv-midia-doc small{ font-size:11.5px; opacity:.75; }

/* Player de áudio */
/* 13rem como no Ruah, mas cabendo na bolha em celular estreito (320px). */
.cv-player{ display:flex; align-items:center; gap:10px; min-width:min(13rem, 58vw); }
.cv-player.compacto{ flex:1; min-width:0; gap:8px; }
.cv-player audio{ display:none; }
.cv-player-tocar{
  width:36px; height:36px; flex-shrink:0; border:none; border-radius:50%; cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:background .15s, scale .15s;
}
.cv-player-tocar:active{ scale:.96; }
.cv-player-tocar svg{ width:16px; height:16px; }
.cv-player.minha .cv-player-tocar{ background:rgba(255,255,255,.2); color:#fff; }
.cv-player.minha .cv-player-tocar:hover{ background:rgba(255,255,255,.3); }
.cv-player.dele .cv-player-tocar{ background:var(--accent2); color:#fff; }
.cv-player.dele .cv-player-tocar:hover{ background:var(--accent); }
.cv-player.compacto .cv-player-tocar{ width:28px; height:28px; }
.cv-player-meio{ flex:1; min-width:0; }
.cv-player-trilha{ position:relative; display:flex; align-items:center; gap:2px; height:32px; cursor:pointer; touch-action:none; outline:none; }
.cv-player.compacto .cv-player-trilha{ height:24px; }
.cv-player-trilha:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }
.cv-player-carregando{ width:100%; height:4px; border-radius:2px; animation:cvPulso 1.2s ease-in-out infinite; }
.cv-player-barra{ flex:1; min-width:1.5px; border-radius:2px; transition:background .1s; }
.cv-player.minha .cv-player-barra, .cv-player.minha .cv-player-carregando, .cv-player.minha .cv-player-lisa{ background:rgba(255,255,255,.35); }
.cv-player.minha .cv-player-barra.cheia{ background:#fff; }
.cv-player.dele .cv-player-barra, .cv-player.dele .cv-player-carregando, .cv-player.dele .cv-player-lisa{ background:var(--border2); }
.cv-player.dele .cv-player-barra.cheia{ background:var(--accent2); }
.cv-player-lisa{ width:100%; height:6px; border-radius:3px; overflow:hidden; }
.cv-player-lisa > div{ height:100%; }
.cv-player.minha .cv-player-lisa > div{ background:#fff; }
.cv-player.dele .cv-player-lisa > div{ background:var(--accent2); }
.cv-player-marcador{ position:absolute; top:50%; width:11px; height:11px; border-radius:50%; translate:-50% -50%; pointer-events:none; }
.cv-player.minha .cv-player-marcador{ background:#fff; }
.cv-player.dele .cv-player-marcador{ background:var(--accent2); }
.cv-player-rodape{ display:flex; align-items:center; gap:8px; font-size:11px; font-variant-numeric:tabular-nums; }
.cv-player.minha .cv-player-rodape, .cv-player.minha > .cv-player-tempo{ color:rgba(255,255,255,.8); }
.cv-player.dele .cv-player-rodape, .cv-player.dele > .cv-player-tempo{ color:var(--muted); }
.cv-player > .cv-player-tempo{ font-size:11.5px; font-variant-numeric:tabular-nums; flex-shrink:0; }
.cv-player-vel{
  margin-left:auto; padding:0 4px; border:none; background:none; border-radius:4px; cursor:pointer;
  font-family:var(--font-body); font-size:11px; font-weight:700; color:inherit;
}
.cv-player-vel:hover{ opacity:.7; }

/* Microfone e gravador */
.cv-btn-mic{
  width:40px; height:40px; border:none; border-radius:50%; background:var(--bg2); color:var(--muted); cursor:pointer;
  display:flex; align-items:center; justify-content:center; touch-action:none; transition:background .15s, color .15s, scale .15s;
}
.cv-btn-mic:hover{ background:var(--accent-light); color:var(--accent2); }
.cv-btn-mic:active{ scale:.96; }
.cv-btn-mic:disabled{ opacity:.45; cursor:not-allowed; }
.cv-btn-mic svg{ width:19px; height:19px; }
.cv-compor-linha.gravando .cv-pilula, .cv-compor-linha.gravando .cv-anexo-slot{ display:none; }
.cv-compor-linha.gravando .cv-acao-slot{ flex:1; min-width:0; }
.cv-grav{ flex:1; min-width:0; display:flex; align-items:center; gap:8px; animation:cvGravEntra .2s var(--cv-ease); }
@keyframes cvGravEntra{ from{ clip-path:inset(0 0 0 100%); } to{ clip-path:inset(-200px -40px -40px 0); } }
.cv-grav-caixa{
  flex:1; min-width:0; height:40px; display:flex; align-items:center; gap:10px; padding:0 4px 0 12px; overflow:hidden;
  border-radius:12px; border:1px solid var(--border2); background:var(--card);
}
.cv-grav-rec{ width:8px; height:8px; flex-shrink:0; border-radius:50%; background:var(--red); animation:cvPulso 1.2s ease-in-out infinite; }
.cv-grav-tempo{ width:36px; flex-shrink:0; font-size:13.5px; font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; }
.cv-grav-onda{ flex:1; min-width:0; height:24px; display:flex; align-items:center; justify-content:flex-end; gap:2px; overflow:hidden; }
.cv-grav-onda span{ width:3px; flex-shrink:0; border-radius:2px; background:var(--muted2); }
.cv-grav-pausa{
  width:32px; height:32px; flex-shrink:0; border:none; border-radius:9px; background:none; color:var(--red); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.cv-grav-pausa:hover{ background:var(--red-bg); }
.cv-grav-pausa svg{ width:16px; height:16px; }
.cv-grav-previa{ flex:1; min-width:0; display:flex; }
.cv-grav-preparando{ font-size:13px; color:var(--muted); }
.cv-grav-lixo, .cv-grav-enviar{
  width:40px; height:40px; flex-shrink:0; border:none; border-radius:12px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:background .15s, scale .15s;
}
.cv-grav-lixo{ background:none; color:var(--muted); }
.cv-grav-lixo:hover{ background:var(--red-bg); color:var(--red); }
.cv-grav-enviar{ background:var(--accent2); color:#fff; box-shadow:var(--shadow-sm); }
.cv-grav-enviar:hover{ background:var(--accent); }
.cv-grav-lixo:active, .cv-grav-enviar:active{ scale:.97; }
.cv-grav-lixo svg, .cv-grav-enviar svg{ width:18px; height:18px; }
.cv-grav-cancelar{ flex:1; min-width:0; display:flex; align-items:center; justify-content:center; gap:4px; font-size:13px; color:var(--muted); white-space:nowrap; }
.cv-grav-cancelar svg{ width:16px; height:16px; }
.cv-grav-dedo{ position:relative; width:40px; height:40px; flex-shrink:0; }
.cv-grav-cadeado{
  position:absolute; left:50%; bottom:100%; margin-bottom:16px; width:40px; height:64px; padding-top:10px;
  display:flex; flex-direction:column; align-items:center; gap:4px; translate:-50% 0;
  border-radius:99px; border:1px solid var(--border2); background:var(--card); color:var(--muted); box-shadow:var(--shadow-md);
}
.cv-grav-cadeado svg{ width:16px; height:16px; }
.cv-grav-mic-grande{
  position:absolute; left:50%; top:50%; width:56px; height:56px; translate:-50% -50%;
  display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--red); color:#fff; box-shadow:var(--shadow-md);
}
.cv-grav-mic-grande svg{ width:20px; height:20px; }

/* Anexos */
.cv-anexo-slot{ position:relative; flex-shrink:0; }
.cv-btn-anexo{
  width:40px; height:40px; border:none; border-radius:50%; background:none; color:var(--muted); cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:background .15s, color .15s, rotate .15s, scale .15s;
}
.cv-btn-anexo:hover, .cv-btn-anexo.aberto{ background:var(--bg2); color:var(--text); }
.cv-btn-anexo.aberto{ rotate:45deg; }
.cv-btn-anexo:active{ scale:.96; }
.cv-btn-anexo:disabled{ opacity:.45; cursor:not-allowed; }
.cv-btn-anexo svg{ width:20px; height:20px; }
.cv-anexo-menu{
  position:absolute; left:0; bottom:calc(100% + 8px); z-index:20; width:208px; padding:4px; border-radius:12px;
  background:var(--card); border:1px solid var(--border2); box-shadow:var(--shadow-lg); transform-origin:bottom left;
  animation:cvMenuEntra .15s var(--cv-ease);
}
.cv-anexo-menu button{
  width:100%; display:flex; align-items:center; gap:12px; padding:10px 12px; border:none; border-radius:8px; background:none;
  cursor:pointer; text-align:left; font-family:var(--font-body); font-size:13.5px; font-weight:600; color:var(--text);
}
.cv-anexo-menu button:hover{ background:var(--bg2); }
.cv-anexo-menu svg{ width:20px; height:20px; flex-shrink:0; }
.cv-anexo-menu .azul{ color:var(--brand); }
:root[data-theme="dark"] .cv-anexo-menu .azul{ color:var(--blue); }
.cv-anexo-menu .verde{ color:var(--green); }
.cv-anexo-menu .amarelo{ color:var(--yellow); }
@media (min-width:1024px){ .cv-anexo-menu .so-celular{ display:none; } }

/* ── Menu da mensagem, seletor de emoji, imagem ── */
.cv-menu-msg{
  position:fixed; z-index:230; width:168px; padding:4px 0; border-radius:12px;
  background:var(--card); border:1px solid var(--border2); box-shadow:var(--shadow-lg);
  animation:cvMenuEntra .15s var(--cv-ease);
}
.cv-menu-msg.largo{ width:272px; }
@keyframes cvMenuEntra{ from{ opacity:0; scale:.97; } }
.cv-menu-msg > button{
  display:block; width:100%; padding:9px 14px; border:none; background:none; cursor:pointer; text-align:left;
  font-family:var(--font-body); font-size:13.5px; color:var(--text);
}
.cv-menu-msg > button:hover, .cv-menu-msg > button:focus-visible{ background:var(--bg2); outline:none; }
.cv-menu-msg > button.perigo{ color:var(--red); }
.cv-menu-msg > button.perigo:hover{ background:var(--red-bg); }
.cv-menu-reacoes{ display:flex; align-items:center; padding:2px 6px 4px; margin-bottom:2px; border-bottom:1px solid var(--border); }
.cv-menu-reacoes button{
  width:36px; height:36px; border:none; border-radius:9px; background:none; cursor:pointer; font-size:20px; line-height:1;
  display:flex; align-items:center; justify-content:center; transition:background .15s, scale .15s;
}
.cv-menu-reacoes button:hover{ background:var(--bg2); }
.cv-menu-reacoes button:active{ scale:.95; }
.cv-menu-reacoes button.atual{ background:var(--bg3); }
.cv-menu-mais{ color:var(--muted); }
.cv-menu-mais svg{ width:16px; height:16px; }

.cv-emoji{
  position:fixed; z-index:240; display:flex; flex-direction:column; overflow:hidden; border-radius:12px;
  background:var(--card); border:1px solid var(--border2); box-shadow:var(--shadow-lg);
  animation:cvMenuEntra .18s var(--cv-ease);
}
.cv-emoji-rolagem{ flex:1; min-height:0; overflow-y:auto; padding-bottom:6px; }
.cv-emoji-cat{ padding:8px 12px 3px; font-size:11.5px; font-weight:600; color:var(--muted); }
.cv-emoji-grade{ display:grid; grid-template-columns:repeat(8, 36px); justify-content:center; }
.cv-emoji-grade button{
  width:36px; height:36px; border:none; border-radius:8px; background:none; cursor:pointer; font-size:22px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.cv-emoji-grade button:hover{ background:var(--bg2); }

.cv-imagem{
  position:fixed; inset:0; z-index:250; display:flex; align-items:center; justify-content:center; padding:16px;
  background:rgba(0,0,0,.88); animation:cvImagemEntra .18s ease;
}
.cv-imagem[hidden]{ display:none; }
.cv-imagem img{ max-width:100%; max-height:100%; border-radius:10px; object-fit:contain; }
.cv-imagem button{
  position:absolute; top:16px; right:16px; width:42px; height:42px; border:none; border-radius:50%;
  background:rgba(255,255,255,.12); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.cv-imagem button:hover{ background:rgba(255,255,255,.22); }
.cv-imagem button svg{ width:20px; height:20px; }
@keyframes cvImagemEntra{ from{ opacity:0; } }

/* Contador de não lidas no item do menu lateral */
.nav-item{ position:relative; }
.cv-badge-menu{
  margin-left:auto; min-width:19px; height:19px; padding:0 5px; border-radius:10px;
  background:var(--accent); color:#fff; font-size:11px; font-weight:700; font-family:var(--font-body);
  display:inline-flex; align-items:center; justify-content:center; font-variant-numeric:tabular-nums;
}
.sidebar.collapsed .cv-badge-menu{ position:absolute; top:4px; right:6px; margin:0; min-width:16px; height:16px; font-size:10px; padding:0 4px; }

/* ── Pergunta com três saídas (apagar) ── */
.cv-modal-escolha{ width:min(440px, calc(100vw - 32px)); display:flex; flex-direction:column; gap:12px; }
.cv-modal-escolha p{ font-size:13.5px; line-height:1.55; color:var(--muted); }
.cv-escolha-botoes{ display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.btn.cv-btn-perigo-cheio{ background:var(--red); color:#fff; }
.btn.cv-btn-perigo-cheio:hover{ filter:brightness(1.08); transform:translateY(-1px); }

/* ── Modal de reserva (atalho do chat) ── */
.cv-modal-reserva{ width:min(500px, calc(100vw - 32px)); }
.cv-form{ display:flex; flex-direction:column; gap:12px; }
.cv-form-2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.cv-campo textarea{
  width:100%; padding:9px 12px; border-radius:8px; font-size:13px; resize:vertical; min-height:62px;
  background:var(--bg); color:var(--text); border:1.5px solid var(--border2); font-family:var(--font-body); outline:none;
}
.cv-campo textarea:focus{ border-color:var(--accent); }
.cv-campo-fixo{ padding:9px 12px; border-radius:8px; background:var(--bg2); font-size:13px; color:var(--text); }
.cv-plano{ display:flex; flex-direction:column; gap:1px; padding:8px 10px; border:2px solid var(--border2); border-radius:10px; cursor:pointer; }
.cv-plano strong{ font-size:11.5px; color:var(--accent2); }
.cv-plano b{ font-size:16px; color:var(--text); }
.cv-plano small{ font-size:10.5px; color:var(--muted2); }
.cv-plano:has(input:checked){ border-color:var(--accent); background:var(--accent-light); }
.cv-form-botoes{ display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:4px; }

/* ── Celular: a conversa aberta é uma camada de tela cheia ── */
.cv-veu{ display:none; }
@media (max-width:1023px){
  /* No celular não há caixa: a lista é a página e rola com ela, como no
     WhatsApp. */
  #page-chat.cv-pagina{ height:auto !important; overflow:visible; }
  .cv-itens{ flex:none; overflow:visible; }
  .cv-raiz{ gap:0; }
  .cv-aviso{ border-radius:0; border-left:none; border-right:none; }
  .cv-caixa{ min-height:0; border:none; border-radius:0; box-shadow:none; }
  .cv-lista{ width:100%; border-right:none; }
  .cv-chat{ display:none; }
  .cv-voltar{ display:flex; }
  /* O teclado do celular já tem emoji. */
  .cv-btn-emoji{ display:none; }
  .cv-linha-botao{ padding:11px 16px; }
  .cv-linha-botao:hover{ background:none; }
  .cv-linha-botao:active{ background:var(--bg2); }

  /* Do tamanho do que sobra acima do teclado (--altura-visivel, escrito
     por cvAcompanharAreaVisivel): no iPhone o teclado não encolhe a
     página. Sem transform parado aqui — ele viraria referência dos fixed
     de dentro. */
  .cv-com-aberta .cv-chat{
    display:flex; position:fixed; left:0; right:0; z-index:150;
    top:var(--topo-visivel, 0px); height:var(--altura-visivel, 100dvh);
    touch-action:pinch-zoom;
  }
  .cv-com-aberta .cv-veu{
    display:block; position:fixed; inset:0; z-index:145; background:rgba(0,0,0,.3); opacity:0; touch-action:none;
  }
  /* Conversa parada aberta: a lista sai de baixo dela (com a lista ali a
     página fica alta e o iPhone a rola ao abrir o teclado, deixando uma
     fresta). Enquanto a conversa entra ou sai, a lista volta. */
  .cv-com-aberta.cv-assentada .cv-lista, .cv-com-aberta.cv-assentada .cv-aviso{ display:none; }
  .cv-chat-topo{ padding-top:calc(9px + env(safe-area-inset-top, 0px)); }
  .cv-compor{ padding-bottom:calc(6px + env(safe-area-inset-bottom, 0px)); }
  .cv-ver-funil span{ display:none; }
  .cv-ver-funil{ width:36px; padding:0; justify-content:center; }
}
@media (max-width:768px){
  /* Tela cheia: anula o padding do .content (era do chat antigo, em
     styles.css, e o chat novo foi desenhado com ela). */
  #page-chat.cv-pagina{ margin:-14px -12px; }
}
@media (max-width:480px){
  .cv-form-2{ grid-template-columns:1fr; }
}
@media (prefers-reduced-motion: reduce){
  .cv-seg-bloco, .cv-reacoes-corpo, .cv-menu-msg, .cv-emoji, .cv-imagem{ transition:none; animation:none; }
}

/* Situação da locação no topo da conversa */
.cv-loc{ font-weight:600; }
.cv-loc.ok{ color:#15803D; }
.cv-loc.alerta{ color:#B45309; }

/* Janela do CRM */
.cv-modal-crm{ max-width:520px; }
.cv-crm-quem{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.cv-crm-loc{ font-size:12.5px; font-weight:600; color:var(--muted); }
.cv-crm-loc.ok{ color:#15803D; }
.cv-crm-loc.alerta{ color:#B45309; }
.cv-crm-perfil{ margin-left:auto; border:none; background:none; padding:0; font:inherit; font-size:12.5px; font-weight:600; color:var(--accent2); cursor:pointer; }
.cv-crm-perfil:hover{ text-decoration:underline; }
.cv-crm-sec{ padding:12px 0; border-top:1px solid var(--border); }
.cv-crm-tit{ font-size:13px; font-weight:600; color:var(--text); margin-bottom:8px; }
.cv-crm-etapas{ display:flex; flex-wrap:wrap; gap:6px; }
.cv-crm-etapa{ border:1px solid var(--border2); background:var(--bg2); color:var(--muted); border-radius:999px; padding:6px 12px; font:inherit; font-size:12.5px; font-weight:500; cursor:pointer; transition:background .15s,color .15s; }
.cv-crm-etapa:hover{ color:var(--text); }
.cv-crm-etapa.sel{ background:var(--accent-light); color:var(--accent2); border-color:var(--accent); font-weight:600; }
.cv-crm-linha{ display:flex; gap:12px; flex-wrap:wrap; }
.cv-crm-linha > div{ flex:1 1 180px; display:flex; flex-direction:column; gap:5px; }
.cv-crm-linha label{ margin:0; font-size:12px; font-weight:600; color:var(--muted2); }
.cv-crm-sec textarea{ width:100%; margin-bottom:8px; resize:vertical; }
.cv-crm-nota{ font-size:12.5px; color:var(--muted2); }
.cv-crm-notas{ margin-top:10px; display:flex; flex-direction:column; gap:6px; }
.cv-crm-notaitem{ background:var(--bg2); border-radius:10px; padding:8px 10px; font-size:12.5px; color:var(--text2); white-space:pre-wrap; }
.cv-crm-notaitem small{ display:block; margin-top:3px; font-size:11px; color:var(--muted2); }

/* Botão da SARA na conversa e na lista */
.cv-btn-conexao[hidden]{ display:none; }
.cv-lista-cab{ justify-content:flex-start; }
.cv-lista-cab h2{ margin-right:auto; }
.cv-ia{ color:var(--muted); }
.cv-ia.ligada{ color:var(--accent2); border-color:var(--accent); background:var(--accent-light); }
.cv-ia:not(.ligada) svg{ color:var(--muted2); }

/* Tela da SARA */
.cv-modal-sara{ width:760px; max-width:calc(100vw - 24px); padding:22px 24px 18px; }
.cv-modal-sara .modal-header{ margin-bottom:12px; }
.sara-estado{ display:flex; align-items:center; flex-wrap:wrap; gap:8px 10px; padding:10px 12px; border-radius:10px; background:var(--bg2); font-size:12.5px; color:var(--muted); }
.sara-estado em{ margin-left:auto; font-style:normal; font-weight:600; color:var(--accent2); }
.sara-abas{ display:flex; gap:4px; margin:12px 0 4px; overflow-x:auto; scrollbar-width:none; border-bottom:1px solid var(--border); }
.sara-abas::-webkit-scrollbar{ display:none; }
.sara-aba{ flex-shrink:0; padding:9px 12px; border:none; background:none; font:inherit; font-size:13px; font-weight:500; color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s, border-color .15s; }
.sara-aba:hover{ color:var(--text); }
.sara-aba.sel{ color:var(--text); font-weight:700; border-bottom-color:var(--accent); }
.sara-painel{ max-height:min(58vh, 560px); overflow-y:auto; overscroll-behavior-y:contain; padding:6px 2px 4px; }
.sara-sec{ padding:14px 0; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:14px; }
.sara-sec:last-child{ border-bottom:none; }
.sara-campo{ display:flex; flex-direction:column; gap:6px; }
.sara-campo input[type="text"], .sara-campo textarea, .sara-campo select{ width:100%; }
.sara-campo input[type="number"]{ width:84px; }
.sara-campo textarea, .sara-item textarea{ resize:vertical; line-height:1.45; }
.sara-rot{ font-size:13px; font-weight:600; color:var(--text); }
.sara-nota{ font-size:12.5px; line-height:1.45; color:var(--muted2); margin:0; }
.sara-aviso{ font-size:12.5px; line-height:1.45; color:var(--text2); background:var(--bg2); border-radius:10px; padding:10px 12px; margin:0; }
.sara-vazio{ font-size:13px; color:var(--muted2); text-align:center; padding:18px 0; margin:0; }
.sara-erro{ font-size:12.5px; color:var(--red); margin:0; }
.sara-sufixo{ font-size:12.5px; color:var(--muted2); margin-left:6px; }
.sara-opcoes{ display:inline-flex; padding:2px; border-radius:9px; background:var(--bg3); align-self:flex-start; }
.sara-opcoes button{ height:30px; padding:0 18px; border:none; background:none; border-radius:7px; font:inherit; font-size:13px; font-weight:500; color:var(--text); cursor:pointer; transition:background .15s; }
.sara-opcoes button[aria-pressed="true"]{ background:var(--card); font-weight:700; box-shadow:0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.sara-int{ display:flex; align-items:flex-start; gap:12px; cursor:pointer; }
.sara-int input{ position:absolute; opacity:0; pointer-events:none; }
.sara-trilho{ position:relative; flex-shrink:0; width:40px; height:24px; border-radius:99px; background:var(--bg3); border:1px solid var(--border2); transition:background .2s, border-color .2s; margin-top:1px; }
.sara-trilho::after{ content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .25s var(--cv-ease); }
.sara-int input:checked + .sara-trilho{ background:var(--accent); border-color:var(--accent); }
.sara-int input:checked + .sara-trilho::after{ transform:translateX(16px); }
.sara-int input:focus-visible + .sara-trilho{ outline:2px solid var(--accent); outline-offset:2px; }
.sara-int-txt{ display:flex; flex-direction:column; gap:2px; font-size:13.5px; color:var(--text); }
.sara-int-txt small{ font-size:12.5px; color:var(--muted2); }
.sara-lista{ display:flex; flex-direction:column; gap:10px; }
.sara-item{ display:flex; flex-direction:column; gap:8px; padding:12px; border:1px solid var(--border2); border-radius:12px; background:var(--bg); }
.sara-item input[type="text"], .sara-item textarea{ width:100%; }
.sara-item-acoes{ display:flex; align-items:center; flex-wrap:wrap; gap:4px 14px; }
.sara-espaco{ flex:1; }
.sara-modelo-linha{ display:flex; gap:8px; } .sara-modelo-linha input{ flex:1; min-width:0; } .sara-modelo-linha select{ width:auto; flex-shrink:0; }
/* Perguntas de qualificação: um cartão por pergunta, título editável no topo */
.sara-qlista{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.sara-q{ border:1px solid var(--border2); border-radius:14px; background:var(--card); transition:opacity .2s; }
.sara-q.off{ opacity:.55; }
.sara-q.off:focus-within{ opacity:1; }
.sara-q-topo{ display:flex; align-items:center; gap:10px; padding:10px 10px 10px 14px; border-bottom:1px solid var(--border); }
.sara-q-num{ flex-shrink:0; width:22px; height:22px; border-radius:50%; background:var(--bg3); color:var(--muted2); font-size:11.5px; font-weight:700; display:grid; place-items:center; font-variant-numeric:tabular-nums; }
.sara-q-tit{ flex:1; min-width:0; border:none !important; background:none !important; box-shadow:none !important; padding:4px 2px !important; height:auto !important; font-size:14px !important; font-weight:600; letter-spacing:-.01em; color:var(--text); border-radius:6px; }
.sara-q-tit:focus{ outline:2px solid var(--accent); outline-offset:2px; }
.sara-q-ordem{ display:flex; align-items:center; gap:2px; flex-shrink:0; }
.sara-ico{ width:28px; height:28px; display:grid; place-items:center; border:none; background:none; border-radius:8px; color:var(--muted2); cursor:pointer; transition:background .15s, color .15s, transform .1s; }
.sara-ico:hover{ background:var(--bg3); color:var(--text); }
.sara-ico:active{ transform:scale(.94); }
.sara-ico.perigo:hover{ background:rgba(220,38,38,.08); color:var(--red); }
.sara-ico[disabled]{ opacity:.3; cursor:default; background:none; transform:none; }
.sara-q-corpo{ display:flex; flex-direction:column; gap:12px; padding:12px 14px; }
.sara-q-campo{ display:flex; flex-direction:column; gap:5px; }
.sara-q-campo > span{ font-size:12px; font-weight:500; color:var(--muted2); }
.sara-q-campo input{ width:100%; }
.sara-q-pe{ display:flex; align-items:center; gap:22px; padding:10px 14px; border-top:1px solid var(--border); }
.sara-q-pe .sara-int{ align-items:center; } .sara-q-pe .sara-int-txt b{ font-size:13px; font-weight:500; }
.sara-cond-add{ align-self:flex-start; }
.sara-fotos{ display:flex; flex-wrap:wrap; gap:8px; }
.sara-foto{ position:relative; width:72px; height:72px; border-radius:10px; overflow:hidden; background:var(--bg3); border:1px solid var(--border); }
.sara-foto img{ width:100%; height:100%; object-fit:cover; display:block; }
.sara-foto.quebrada::after{ content:'Sem prévia'; position:absolute; inset:0; display:grid; place-items:center; font-size:11px; color:var(--muted2); }
.sara-foto-x{ position:absolute; top:4px; right:4px; width:20px; height:20px; border-radius:50%; border:none; display:grid; place-items:center; background:rgba(0,0,0,.55); color:#fff; cursor:pointer; }
.sara-foto-x:hover{ background:rgba(0,0,0,.75); }
.sara-foto-add{ width:72px; height:72px; border-radius:10px; border:1px dashed var(--border2); display:grid; place-items:center; text-align:center; padding:6px; font-size:11.5px; font-weight:500; color:var(--accent2); cursor:pointer; transition:background .15s; }
.sara-foto-add:hover{ background:var(--bg); }
.sara-foto-add.subindo{ color:var(--muted2); cursor:default; }
.sara-foto-add input{ position:absolute; opacity:0; pointer-events:none; width:1px; height:1px; }
.sara-conds{ display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:10px 12px; border-radius:10px; background:var(--bg); border:1px solid var(--border); }
.sara-conds-tit{ font-size:12px; font-weight:600; color:var(--text); }
.sara-cond{ display:flex; align-items:center; flex-wrap:wrap; gap:6px 8px; font-size:12.5px; color:var(--muted2); }
.sara-cond-e{ min-width:42px; }
.sara-cond select{ width:auto; max-width:220px; height:32px; padding:0 10px; line-height:30px; font-size:12.5px; }
.sara-check{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text); cursor:pointer; }
.sara-link{ border:none; background:none; padding:2px 0; font:inherit; font-size:12.5px; font-weight:600; color:var(--accent2); cursor:pointer; }
.sara-link:hover{ text-decoration:underline; }
.sara-link[disabled]{ color:var(--muted2); cursor:default; text-decoration:none; opacity:.6; }
.sara-link.perigo{ color:var(--red); }
.sara-horas{ display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-size:13px; color:var(--text); }
.sara-horas input{ width:72px; }
.sara-rodape{ display:flex; justify-content:flex-end; padding-top:12px; border-top:1px solid var(--border); margin-top:6px; }

.sara-sim{ display:flex; flex-direction:column; gap:8px; min-height:200px; max-height:340px; overflow-y:auto; padding:12px; border-radius:12px; background:var(--cv-fundo); }
.sara-bolha{ max-width:82%; padding:8px 12px; border-radius:14px; font-size:13.5px; line-height:1.4; white-space:pre-wrap; word-break:break-word; }
.sara-bolha.cliente{ align-self:flex-end; background:var(--cv-minha); color:var(--cv-minha-txt); border-bottom-right-radius:4px; }
.sara-bolha.ela{ align-self:flex-start; background:var(--cv-dele); color:var(--text); border-bottom-left-radius:4px; box-shadow:0 1px 1px rgba(0,0,0,.06); }
.sara-bolha small{ display:block; margin-top:6px; font-size:11.5px; color:var(--muted2); white-space:normal; }
.sara-bolha.digitando{ display:flex; gap:4px; align-items:center; padding:12px 14px; }
.sara-bolha.digitando span{ width:6px; height:6px; border-radius:50%; background:var(--muted2); animation:saraPonto 1.1s infinite ease-in-out; }
.sara-bolha.digitando span:nth-child(2){ animation-delay:.15s; }
.sara-bolha.digitando span:nth-child(3){ animation-delay:.3s; }
@keyframes saraPonto{ 0%,80%,100%{ opacity:.3; transform:translateY(0); } 40%{ opacity:1; transform:translateY(-3px); } }
.sara-sim-form{ display:flex; gap:8px; }
.sara-sim-form input{ flex:1; min-width:0; }
.sara-anotado{ display:flex; flex-direction:column; gap:4px; padding:10px 12px; border-radius:10px; background:var(--bg2); font-size:12.5px; }
.sara-anotado > div:not(.sara-rot){ display:flex; gap:8px; }
.sara-anotado span{ color:var(--muted2); min-width:120px; }
.sara-anotado b{ font-weight:600; color:var(--text); }
.sara-reg{ gap:6px; }
.sara-reg-topo{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:13px; }
.sara-reg-topo span{ color:var(--muted2); font-size:12px; margin-right:auto; }
.sara-reg p{ margin:0; font-size:12.5px; line-height:1.45; color:var(--text2); white-space:pre-wrap; word-break:break-word; }
.sara-reg p > span{ display:inline-block; min-width:66px; color:var(--muted2); font-weight:600; }
.sara-reg p.erro{ color:var(--red); }

@media (max-width:640px){
  .cv-modal-sara{ padding:18px 14px 14px; }
  .sara-painel{ max-height:62vh; }
  .sara-bolha{ max-width:92%; }
}
@media (prefers-reduced-motion:reduce){
  .sara-trilho::after, .sara-bolha.digitando span{ transition:none; animation:none; }
}

/* Aviso de lead potencial (sobe no canto) e bloco no sino */
.cv-avisos{ position:fixed; right:20px; top:72px; z-index:10000; display:flex; flex-direction:column; gap:10px; width:min(340px, calc(100vw - 24px)); pointer-events:none; }
.sara-toast{
  pointer-events:auto; padding:14px 16px; border-radius:14px; background:var(--card); border:1px solid var(--border2);
  box-shadow:0 8px 32px rgba(0,0,0,.18); display:flex; flex-direction:column; gap:4px;
  animation:saraSobe .35s var(--cv-ease);
}
.sara-toast.saindo{ opacity:0; transform:translateY(-8px); transition:opacity .18s, transform .18s; }
.sara-toast-topo{ display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; color:var(--accent2); }
.sara-toast-x{ border:none; background:none; color:var(--muted2); font-size:14px; cursor:pointer; width:24px; height:24px; border-radius:50%; }
.sara-toast-x:hover{ background:var(--bg2); color:var(--text); }
.sara-toast-nome{ font-size:15px; font-weight:700; color:var(--text); }
.sara-toast-txt{ font-size:12.5px; line-height:1.4; color:var(--muted); }
.sara-toast-acoes{ display:flex; gap:8px; margin-top:8px; }
@keyframes saraSobe{ from{ opacity:0; transform:translateY(-14px); } to{ opacity:1; transform:none; } }
.sara-sino-cab{ display:flex; align-items:center; justify-content:space-between; padding:8px 16px 4px; font-size:11.5px; font-weight:600; color:var(--muted2); }
.sara-sino-item{ display:flex; align-items:center; gap:10px; padding:10px 16px; cursor:pointer; border-bottom:1px solid var(--border2); }
.sara-sino-item:hover{ background:var(--bg2); }
.sara-sino-ico{ width:34px; height:34px; border-radius:50%; background:var(--accent-light); color:var(--accent2); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.sara-sino-ico svg{ width:16px; height:16px; }
.sara-sino-txt{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.sara-sino-txt b{ font-size:12px; color:var(--text); }
.sara-sino-txt span{ font-size:11.5px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.sara-sino-txt small{ font-size:10.5px; color:var(--muted2); }
@media (prefers-reduced-motion:reduce){ .sara-toast{ animation:none; } .sara-toast.saindo{ transition:none; } }

/* Transcrição de áudio */
.cv-transcrever{ border:none; background:none; padding:4px 0 0; font:inherit; font-size:12px; font-weight:600; color:var(--accent2); cursor:pointer; text-align:left; }
.cv-msg.minha .cv-transcrever{ color:inherit; text-decoration:underline; text-underline-offset:2px; }
.cv-transcrever:hover{ text-decoration:underline; }
.cv-transcricao{ margin:6px 0 0; padding-left:8px; border-left:2px solid currentColor; font-size:13px; line-height:1.4; white-space:pre-wrap; word-break:break-word; opacity:.92; }
.cv-transcricao.carregando{ opacity:.6; font-style:italic; }

/* Aviso de mensagem nova */
.cv-aviso-msg{
  pointer-events:auto; display:flex; align-items:center; gap:12px; padding:12px 10px 12px 12px; border-radius:14px;
  background:var(--card); border:1px solid var(--border2); box-shadow:0 8px 32px rgba(0,0,0,.18); cursor:pointer;
  animation:saraSobe .35s var(--cv-ease); transition:border-color .15s;
}
.cv-aviso-msg:hover, .cv-aviso-msg:focus-visible{ border-color:var(--accent); outline:none; }
.cv-aviso-msg.saindo{ opacity:0; transform:translateY(-8px); transition:opacity .18s, transform .18s; }
.cv-aviso-corpo{ display:flex; flex-direction:column; gap:1px; min-width:0; flex:1; }
.cv-aviso-corpo b{ font-size:13.5px; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cv-aviso-texto{ font-size:12.5px; line-height:1.35; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; word-break:break-word; }
@media (prefers-reduced-motion:reduce){ .cv-aviso-msg{ animation:none; } .cv-aviso-msg.saindo{ transition:none; } }

/* SARA em pausa: motivo, tempo e o botão de ativar */
.cv-ia.pausa{ color:var(--text); border-color:var(--yellow-border, var(--border2)); background:var(--yellow-bg, var(--bg)); }
.cv-ia.pausa svg{ color:#B45309; }
.cv-ia.pausa b{ color:var(--accent2); font-weight:700; padding-left:8px; border-left:1px solid var(--border2); }

/* Contato compartilhado */
.cv-contato{ display:flex; flex-direction:column; gap:6px; min-width:210px; }
.cv-contato + .cv-contato{ margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.cv-contato-quem{ display:flex; align-items:center; gap:10px; font-size:14px; }
.cv-contato-tel{ display:flex; align-items:center; flex-wrap:wrap; gap:4px 12px; font-size:13px; font-variant-numeric:tabular-nums; }
.cv-contato-tel span{ margin-right:auto; }
.cv-contato-tel button{ border:none; background:none; padding:2px 0; font:inherit; font-size:12.5px; font-weight:600; color:var(--accent2); cursor:pointer; }
.cv-contato-tel button:hover{ text-decoration:underline; }
.cv-msg.minha .cv-contato-tel button{ color:inherit; text-decoration:underline; text-underline-offset:2px; }

/* Balão ao passar o mouse (data-balao) */
.cv-balao{
  position:fixed; z-index:10001; max-width:280px; padding:9px 12px; border-radius:10px;
  background:var(--card); border:1px solid var(--border2); box-shadow:0 8px 32px rgba(0,0,0,.18);
  font-size:12.5px; line-height:1.45; color:var(--text); white-space:pre-line; pointer-events:none;
  opacity:0; transform:translateY(-3px); transition:opacity .15s, transform .15s var(--cv-ease);
}
.cv-balao.visivel{ opacity:1; transform:none; }
@media (prefers-reduced-motion:reduce){ .cv-balao{ transition:opacity .01s; transform:none; } }
/* Barra de atalhos: em tela larga quebra em duas linhas em vez de cortar o que sobra */
@media (min-width:900px){
  .cv-acoes{ flex-wrap:wrap; overflow:visible; }
}
