#mbi-chat-wrap{
  --wa-fundo:#0B141A; --wa-header:#1F2C34; --wa-recebida:#1F2C34; --wa-enviada:#005C4B;
  --wa-texto:#E9EDEF; --wa-texto-sub:#8696A0; --wa-accent:#00A884;
  --wa-input:#2A3942; --wa-borda:rgba(255,255,255,0.08); --wa-bolha-sombra:0 1px 0.5px rgba(0,0,0,0.3);
  position:fixed; right:22px; bottom:22px; z-index:400;
  display:flex; align-items:center; gap:10px;
}
#mbi-chat-painel{
  --wa-fundo:#0B141A; --wa-header:#1F2C34; --wa-recebida:#1F2C34; --wa-enviada:#005C4B;
  --wa-texto:#E9EDEF; --wa-texto-sub:#8696A0; --wa-accent:#00A884;
  --wa-input:#2A3942; --wa-borda:rgba(255,255,255,0.08); --wa-bolha-sombra:0 1px 0.5px rgba(0,0,0,0.3);
}
@media (prefers-color-scheme: light){
  #mbi-chat-wrap, #mbi-chat-painel{
    --wa-fundo:#EFEAE2; --wa-header:#F0F2F5; --wa-recebida:#FFFFFF; --wa-enviada:#D9FDD3;
    --wa-texto:#111B21; --wa-texto-sub:#667781; --wa-accent:#00A884;
    --wa-input:#FFFFFF; --wa-borda:rgba(0,0,0,0.08); --wa-bolha-sombra:0 1px 0.5px rgba(0,0,0,0.13);
  }
}
#mbi-chat-label{
  background:var(--wa-header); color:var(--wa-texto); font-family:'Inter', sans-serif;
  font-size:13px; font-weight:600; padding:10px 16px; border-radius:999px;
  box-shadow:0 8px 20px -6px rgba(20,45,90,0.35);
  white-space:nowrap;
  animation:mbiLabelIn 0.4s ease 1s both;
}
#mbi-chat-label small{ display:block; font-weight:400; font-size:11px; color:var(--wa-texto-sub); margin-top:1px; }
@keyframes mbiLabelIn{
  from{ opacity:0; transform:translateX(8px); }
  to{ opacity:1; transform:translateX(0); }
}
#mbi-chat-botao{
  position:relative;
  width:60px; height:60px; border-radius:50%; border:none;
  background:#0B1220; padding:0; overflow:hidden;
  box-shadow:0 10px 26px -6px rgba(37,211,102,0.6);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:transform 0.2s ease;
  flex:0 0 60px;
  animation:mbiPulseGlow 2.2s ease-in-out infinite;
}
#mbi-chat-botao::before{
  content:''; position:absolute; inset:0; border-radius:50%;
  background:#25D366; z-index:-1;
  animation:mbiPulseRing 2.2s ease-out infinite;
}
.mbi-chat-botao-avatar{
  width:100%; height:100%; border-radius:50%; object-fit:cover; display:block;
}
@keyframes mbiPulseGlow{
  0%, 100%{ box-shadow:0 10px 26px -6px rgba(37,211,102,0.6); }
  50%{ box-shadow:0 10px 34px -4px rgba(37,211,102,0.95); }
}
@keyframes mbiPulseRing{
  0%{ transform:scale(1); opacity:0.55; }
  100%{ transform:scale(1.9); opacity:0; }
}
@media (prefers-reduced-motion: reduce){
  #mbi-chat-botao, #mbi-chat-botao::before, #mbi-chat-label{ animation:none; }
}
#mbi-chat-botao:hover{ transform:translateY(-3px) scale(1.03); }
#mbi-chat-botao svg{ width:26px; height:26px; color:#fff; }
#mbi-chat-botao .mbi-chat-ponto{
  position:absolute; top:6px; right:6px; width:12px; height:12px; border-radius:50%;
  background:#FF5A5A; border:2px solid #ffffff; display:none;
}
#mbi-chat-botao.tem-novidade .mbi-chat-ponto{ display:block; }

#mbi-chat-painel{
  position:fixed; right:22px; bottom:94px; z-index:400;
  width:344px; max-width:calc(100vw - 32px); height:480px; max-height:calc(100vh - 140px);
  background:var(--wa-fundo); border:1px solid var(--wa-borda); border-radius:16px;
  display:none; flex-direction:column; overflow:hidden;
  box-shadow:0 24px 60px -12px rgba(0,0,0,0.6);
  font-family:'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color:var(--wa-texto);
}
#mbi-chat-painel.aberto{ display:flex; }

#mbi-chat-conteudo{ flex:1; display:flex; flex-direction:column; min-height:0; overflow:hidden; }

.mbi-chat-topo{
  background:var(--wa-header);
  padding:14px 18px; display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--wa-borda);
  flex:0 0 auto;
}
.mbi-chat-topo-esq{ display:flex; align-items:center; gap:10px; min-width:0; }
.mbi-chat-topo-avatar{
  width:36px; height:36px; border-radius:50%; object-fit:cover; flex:none;
  box-shadow:0 0 0 2px var(--wa-header), 0 0 0 3px var(--wa-accent);
}
.mbi-chat-topo-info{ display:flex; flex-direction:column; min-width:0; }
.mbi-chat-topo-info strong{ font-size:14.5px; color:var(--wa-texto); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mbi-chat-topo-info span{ font-size:11.5px; color:var(--wa-accent); }
.mbi-chat-fechar{ background:none; border:none; color:var(--wa-texto-sub); cursor:pointer; padding:4px; }
.mbi-chat-fechar svg{ width:18px; height:18px; }

.mbi-chat-corpo{ flex:1 1 auto; min-height:0; overflow-y:auto; padding:16px 6%; background:var(--wa-fundo); display:flex; flex-direction:column; gap:6px; }
#mbi-chat-rodape-wrap{ flex:0 0 auto; }
.mbi-chat-linha{ display:flex; align-items:flex-end; gap:6px; width:100%; }
.mbi-chat-linha.visitante{ justify-content:flex-end; }
.mbi-chat-linha.admin{ justify-content:flex-start; }
.mbi-chat-avatar-mini{
  width:24px; height:24px; border-radius:50%; object-fit:cover; flex:none; margin-bottom:2px;
}
.mbi-chat-msg{
  max-width:78%; padding:7px 12px 8px; border-radius:8px; font-size:13.5px; line-height:1.45;
  box-shadow:var(--wa-bolha-sombra); color:var(--wa-texto);
}
.mbi-chat-msg.visitante{ background:var(--wa-enviada); border-top-right-radius:0; }
.mbi-chat-msg.admin{ background:var(--wa-recebida); border-top-left-radius:0; }
.mbi-chat-autor{ display:block; font-size:11px; font-weight:700; color:var(--wa-accent); margin-bottom:2px; }
.mbi-chat-msg-hora{ display:block; text-align:right; font-size:10px; color:var(--wa-texto-sub); margin-top:3px; }
.mbi-chat-anexo-imagem{ display:block; max-width:100%; max-height:200px; border-radius:8px; margin-top:4px; }
.mbi-chat-anexo-arquivo{
  display:flex; align-items:center; gap:8px; margin-top:4px; padding:8px 10px; border-radius:8px;
  background:rgba(127,127,127,0.15); color:inherit; text-decoration:none; font-size:12px;
}
.mbi-chat-anexo-arquivo svg{ width:18px; height:18px; flex:none; opacity:0.8; }
.mbi-chat-anexo-arquivo span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mbi-chat-anexar{
  width:34px; height:34px; border-radius:50%; border:none; background:transparent; color:var(--wa-texto-sub);
  display:flex; align-items:center; justify-content:center; flex:none; cursor:pointer;
}
.mbi-chat-anexar svg{ width:19px; height:19px; }
.mbi-chat-anexo-preview{
  display:flex; align-items:center; gap:8px; padding:6px 10px; margin:0 12px 6px; border-radius:8px;
  background:var(--wa-input); font-size:11.5px; color:var(--wa-texto-sub);
}
.mbi-chat-anexo-preview button{ border:none; background:none; color:var(--wa-texto-sub); font-size:15px; line-height:1; cursor:pointer; margin-left:auto; }
.mbi-chat-anexo-audio{ display:block; margin-top:4px; max-width:210px; height:34px; }
.mbi-chat-gravando{ display:none; align-items:center; gap:8px; flex:1; padding:0 4px; color:var(--wa-texto); }
.mbi-chat-grav-ponto{ width:9px; height:9px; border-radius:50%; background:#E2564F; flex:none; animation:mbiChatPiscar 1s ease-in-out infinite; }
@keyframes mbiChatPiscar{ 0%,100%{ opacity:1; } 50%{ opacity:0.25; } }
.mbi-chat-grav-tempo{ font-variant-numeric:tabular-nums; font-size:12.5px; font-weight:600; }
.mbi-chat-grav-dica{ font-size:11.5px; color:var(--wa-texto-sub); flex:1; }
.mbi-chat-grav-cancelar, .mbi-chat-grav-enviar{
  width:32px; height:32px; border-radius:50%; border:none; display:flex; align-items:center; justify-content:center; flex:none; cursor:pointer;
}
.mbi-chat-grav-cancelar{ background:transparent; color:var(--wa-texto-sub); }
.mbi-chat-grav-cancelar svg{ width:16px; height:16px; }
.mbi-chat-grav-enviar{ background:var(--wa-accent); color:#fff; }
.mbi-chat-grav-enviar svg{ width:16px; height:16px; margin-left:1px; }

.mbi-chat-prechat{
  flex:1 1 auto; min-height:0; overflow-y:auto; padding:16px; background:var(--wa-fundo);
  display:flex; flex-direction:column; gap:10px;
}
.mbi-chat-prechat .mbi-chat-msg{ max-width:88%; }

/* "Mia está digitando…" - três pontos com brilho pulsando, estilo tech */
.mbi-chat-digitando{ display:flex; align-items:center; gap:5px; padding:12px 16px; }
.mbi-chat-dot{
  width:7px; height:7px; border-radius:50%;
  background:var(--wa-accent); box-shadow:0 0 6px 1px var(--wa-accent);
  animation:mbiDigitandoPonto 1.1s ease-in-out infinite;
}
.mbi-chat-dot:nth-child(2){ animation-delay:0.15s; }
.mbi-chat-dot:nth-child(3){ animation-delay:0.3s; }
@keyframes mbiDigitandoPonto{
  0%, 60%, 100%{ transform:translateY(0); opacity:0.35; box-shadow:0 0 3px 0 var(--wa-accent); }
  30%{ transform:translateY(-4px); opacity:1; box-shadow:0 0 8px 2px var(--wa-accent); }
}

/* Revelação em cascata (mensagem, depois opções) */
.mbi-chat-fade-in{ animation:mbiFadeIn 0.4s cubic-bezier(.2,.7,.3,1) both; }
@keyframes mbiFadeIn{
  from{ opacity:0; transform:translateY(6px); }
  to{ opacity:1; transform:translateY(0); }
}
@media (prefers-reduced-motion: reduce){
  .mbi-chat-dot, .mbi-chat-fade-in{ animation:none; opacity:1; transform:none; }
}
.mbi-chat-form-inicial{ display:flex; flex-direction:column; gap:10px; }
.mbi-chat-form-inicial p{ font-size:12.5px; color:var(--wa-texto-sub); margin:0 0 4px; }
.mbi-chat-setores{ display:flex; flex-direction:column; gap:8px; }
.mbi-chat-setores p{ font-size:12.5px; color:var(--wa-texto-sub); margin:0 0 2px; }
.mbi-chat-setor-btn{
  text-align:left; padding:12px 14px; border-radius:10px; border:1px solid var(--wa-borda);
  background:var(--wa-input); color:var(--wa-texto); cursor:pointer; font-family:inherit;
}
.mbi-chat-setor-btn{ transition:opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease; }
.mbi-chat-setor-btn:hover{ border-color:var(--wa-accent); background:rgba(0,168,132,0.08); }
.mbi-chat-setor-btn:disabled{ opacity:0.45; cursor:default; }
.mbi-chat-setor-btn:disabled:hover{ border-color:var(--wa-borda); background:var(--wa-input); }
.mbi-chat-setor-btn.selecionado{ opacity:1; border-color:var(--wa-accent); background:rgba(0,168,132,0.14); }
.mbi-chat-setor-btn strong{ display:block; font-size:13.5px; }
.mbi-chat-setor-btn span{ display:block; font-size:11.5px; color:var(--wa-texto-sub); margin-top:2px; }
.mbi-chat-form-inicial input, .mbi-chat-form-inicial select, .mbi-chat-form-inicial textarea{
  width:100%; box-sizing:border-box; background:var(--wa-input); border:1px solid var(--wa-borda);
  border-radius:8px; padding:10px 12px; color:var(--wa-texto); font-family:inherit; font-size:13px;
}
/* O menu suspenso do <select> é renderizado pelo navegador/SO, não pelo CSS do widget -
   forçamos texto escuro em fundo claro nas opções para não ficarem "brancas sobre brancas". */
.mbi-chat-form-inicial select option{ color:#101827; background:#ffffff; }
.mbi-chat-form-inicial textarea{ min-height:70px; resize:none; }
.mbi-chat-form-inicial input::placeholder, .mbi-chat-form-inicial textarea::placeholder{ color:var(--wa-texto-sub); }
.mbi-chat-form-inicial input:disabled, .mbi-chat-form-inicial select:disabled, .mbi-chat-form-inicial textarea:disabled{ opacity:0.5; }
.mbi-chat-honeypot{ position:absolute; left:-9999px; opacity:0; }

.mbi-chat-rodape{ background:var(--wa-header); border-top:1px solid var(--wa-borda); padding:10px 12px; display:flex; gap:8px; align-items:flex-end; flex:0 0 auto; }
.mbi-chat-rodape textarea{
  flex:1; resize:none; max-height:90px; min-height:38px; background:var(--wa-input);
  border:1px solid var(--wa-borda); border-radius:20px; color:var(--wa-texto); padding:9px 14px;
  font-family:inherit; font-size:13.5px;
}
.mbi-chat-rodape textarea::placeholder{ color:var(--wa-texto-sub); }
.mbi-chat-enviar{
  width:38px; height:38px; border-radius:50%; border:none; flex:0 0 38px;
  background:var(--wa-accent); color:#fff; display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.mbi-chat-enviar svg{ width:16px; height:16px; margin-left:1px; }
.mbi-chat-btn{
  padding:11px; border-radius:9px; border:none; background:var(--wa-accent);
  color:#fff; font-weight:600; font-size:13.5px; cursor:pointer;
}
.mbi-chat-btn:disabled{ opacity:0.6; cursor:default; }
.mbi-chat-status{ text-align:center; font-size:11.5px; color:var(--wa-texto-sub); padding:6px 0 0; }

@media (max-width: 460px){
  #mbi-chat-painel{ right:16px; left:16px; width:auto; bottom:88px; }
  #mbi-chat-botao{ right:16px; bottom:16px; }
}
