/* Bzap: base das telas (chat do visitante, entrar, equipe).
   A cor de destaque NUNCA é fixa: vem de /api/marca e o bz-nucleo.js grava estas 4 variáveis na página:
   --marca (fundo de botão e balão), --marca-selo (letra do selo "Ligado" sobre o tom suave), --marca-txt (letra que lê bem sobre ela), --marca-tinta (a mesma cor
   escurecida até dar 4,5:1 sobre o papel, para texto, ícone e foco) e --marca-fundo (tom suave).
   Os valores abaixo valem só até a marca chegar.
   Sora (bz-sora.woff2, licença aberta OFL) só nos títulos. Corpo em fonte do sistema.
   Compatível com Safari iOS 13+ e Chrome/WebView 80+: sem :has, sem inset, sem gap em flex, sem dvh, sem aspect-ratio.
   Movimento só de opacidade e posição (120 a 250 ms) e desligado com "reduzir movimento". */

@font-face {
  font-family: 'Sora';
  src: url('/web/bz-sora.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --marca: #165b49;
  --marca-txt: #ffffff;
  --marca-tinta: #165b49;
  --marca-selo: #165b49;
  --marca-fundo: rgba(22, 91, 73, 0.12);
  --papel: #fbf6f0;
  --superficie: #ffffff;
  --afundo: #f3ebe1;
  --afundo-2: #eadfd1;
  --linha: #e7dccf;
  --linha-forte: #cdbfae;
  --texto: #261d15;
  --suave: #675849;
  --erro: #b3261e;
  --erro-fundo: #fdeceb;
  --ok: #1f7a4d;
  --nota-fundo: #fdf0cf;
  --nota-texto: #5a4100;
  --nota-linha: #dcc377;
  --curva: cubic-bezier(0.22, 1, 0.36, 1);
  --fonte: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fonte-titulo: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  height: 100%;
  margin: 0;
  background: var(--papel);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-appearance: none; appearance: none; }
[hidden] { display: none !important; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--fonte-titulo); letter-spacing: -0.01em; line-height: 1.2; }
::selection { background: var(--marca-fundo); color: var(--texto); }
input, textarea { caret-color: var(--marca-tinta); }
* { scrollbar-width: thin; scrollbar-color: var(--linha-forte) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--linha-forte); border-radius: 8px; }

/* foco sempre visível (navegador antigo usa :focus; o novo some o contorno no clique do mouse) */
:focus { outline: 3px solid var(--marca-tinta); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
input:focus, textarea:focus { outline-offset: 0; }

.bz-so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.bz-ic { display: block; width: 22px; height: 22px; flex: none; }

/* ---------- botões ---------- */
.bz-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: 999px;
  background: var(--marca); color: var(--marca-txt); font-weight: 700; font-size: 1rem; line-height: 1.2; text-align: center; text-decoration: none;
  transition: transform 0.12s var(--curva), opacity 0.15s ease-out, background-color 0.15s ease-out;
}
.bz-btn .bz-ic { width: 20px; height: 20px; margin-right: 8px; }
.bz-btn:active { transform: scale(0.97); }
.bz-btn.suave { background: var(--afundo); color: var(--texto); }
.bz-btn.suave:active { background: var(--afundo-2); }
.bz-btn.contorno { background: transparent; border-color: var(--linha-forte); color: var(--texto); }
.bz-btn.perigo { background: var(--erro); color: #ffffff; }
.bz-btn.largo { width: 100%; }
.bz-btn:disabled, .bz-btn[aria-busy="true"] { opacity: 0.55; cursor: default; }
.bz-btn:disabled:active { transform: none; }

.bz-btn-mini {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--linha-forte); border-radius: 999px;
  background: var(--superficie); color: var(--texto); font-size: 0.875rem; font-weight: 700; transition: transform 0.12s var(--curva);
}
.bz-btn-mini .bz-ic { width: 16px; height: 16px; margin-right: 6px; }
.bz-btn-mini:active { transform: scale(0.97); }
.bz-btn-mini.suave { border-color: transparent; background: transparent; color: var(--suave); }

.bz-btn-icone {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--suave); transition: background-color 0.15s ease-out, transform 0.12s var(--curva);
}
.bz-btn-icone:active { transform: scale(0.94); background: var(--afundo); }
@media (hover: hover) { .bz-btn-icone:hover { background: var(--afundo); color: var(--texto); } }

/* ---------- campos ---------- */
.bz-campo { display: block; margin: 0 0 16px; }
.bz-campo > span { display: block; margin: 0 0 6px; font-size: 0.875rem; font-weight: 600; }
.bz-campo > span small { font-weight: 400; color: var(--suave); }
.bz-campo input {
  display: block; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--linha-forte); border-radius: 14px;
  background: var(--superficie); font-size: 1rem; transition: border-color 0.15s ease-out;
}
.bz-campo input:focus { border-color: var(--marca-tinta); }
.bz-campo input::placeholder { color: var(--suave); opacity: 0.8; }
.bz-campo.com-botao { position: relative; }
.bz-campo.com-botao input { padding-right: 52px; }
.bz-campo.com-botao .bz-btn-icone { position: absolute; right: 2px; bottom: 2px; }
.bz-ajuda { margin: 6px 0 0; color: var(--suave); font-size: 0.8125rem; }
.bz-erro-texto { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--erro-fundo); color: var(--erro); font-size: 0.9375rem; font-weight: 600; }
.bz-erro-texto:empty { display: none; }

/* ---------- marca ---------- */
.bz-marca-av {
  display: flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--marca); color: var(--marca-txt); font-family: var(--fonte-titulo); font-size: 1rem; font-weight: 700;
}
.bz-marca-av.grande { width: 56px; height: 56px; font-size: 1.375rem; }

/* ---------- mensagens ---------- */
.bz-lista { display: flex; flex-direction: column; }
.bz-msg {
  flex: none; position: relative; align-self: flex-start; max-width: 82%; margin: 0 0 6px; padding: 9px 13px 6px;
  border-radius: 18px 18px 18px 6px; background: var(--superficie); border: 1px solid var(--linha); color: var(--texto);
  font-size: 1rem; line-height: 1.4;
}
.bz-msg.minha { align-self: flex-end; border-radius: 18px 18px 6px 18px; border-color: transparent; background: var(--marca); color: var(--marca-txt); }
.bz-msg.interna {
  align-self: stretch; max-width: none; margin: 4px 0 10px; border: 1px dashed var(--nota-linha); border-radius: 14px;
  background: var(--nota-fundo); color: var(--nota-texto);
}
.bz-msg.nova { animation: bz-sobe 0.2s var(--curva) both; }
.bz-msg-texto { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bz-msg-rotulo { display: flex; align-items: center; margin: 0 0 4px; font-size: 0.8125rem; font-weight: 700; }
.bz-msg-rotulo .bz-ic { width: 15px; height: 15px; margin-right: 6px; }
.bz-msg-meta { display: flex; align-items: center; justify-content: flex-end; margin: 2px 0 0; font-size: 0.6875rem; line-height: 1.2; color: var(--suave); font-variant-numeric: tabular-nums; }
.bz-msg.minha .bz-msg-meta { color: inherit; }
.bz-msg.interna .bz-msg-meta { color: inherit; }
.bz-tick { display: inline-flex; margin-left: 5px; }
.bz-tick .bz-ic { width: 15px; height: 15px; }
.bz-tick.enviando .bz-ic { opacity: 0.8; }
.bz-tick.enviada .bz-ic { opacity: 0.75; }
.bz-tick.lida .bz-ic { opacity: 1; }
.bz-tick.falhou { color: var(--erro); }
.bz-msg.minha .bz-tick.falhou { color: inherit; }

.bz-msg.minha.falhou { border-color: var(--erro); background: var(--superficie); color: var(--texto); }
.bz-msg.minha.falhou .bz-msg-meta { color: var(--suave); opacity: 1; }
.bz-msg.minha.falhou .bz-prog { background: rgba(0, 0, 0, 0.12); }
.bz-msg-falha { margin: 6px 0 2px; padding: 8px 10px; border-radius: 12px; background: var(--erro-fundo); color: var(--erro); font-size: 0.8125rem; font-weight: 600; }
.bz-msg-falha-acoes { display: flex; flex-wrap: wrap; margin: 6px 0 0; }
.bz-msg-falha-acoes .bz-btn-mini { margin: 0 6px 0 0; }

/* ---------- robô (assistente automático) ---------- */
.bz-msg.robo { min-width: 220px; max-width: 88%; border-color: var(--linha-forte); background: var(--afundo); }
.bz-msg-rotulo-robo { color: var(--suave); }
.bz-msg.robo .bz-msg-texto { margin: 0 0 2px; }
/* foco no texto do aviso (vai para ele depois de "Falar com atendente"): o contorno aparece SEMPRE com :focus (Safari iOS 13 e WebView 80 não conhecem
   :focus-visible); onde o navegador conhece, a regra de baixo tira o contorno só do foco que veio do mouse ou do toque. */
.bz-msg.robo .bz-msg-texto:focus { outline: 2px solid var(--marca-tinta); outline-offset: 3px; border-radius: 6px; }
.bz-msg.robo .bz-msg-texto:focus:not(:focus-visible) { outline: none; }
.bz-robo-botoes { display: flex; flex-direction: column; margin: 10px 0 4px; }
.bz-robo-botao {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 0 0 8px; padding: 10px 16px;
  border: 1.5px solid var(--marca-tinta); border-radius: 24px; background: var(--superficie); color: var(--marca-tinta);
  font-size: 1rem; font-weight: 700; line-height: 1.25; text-align: center; word-break: break-word; overflow-wrap: anywhere;
  transition: transform 0.12s var(--curva), background-color 0.15s ease-out, color 0.15s ease-out;
}
.bz-robo-botao:last-child { margin-bottom: 0; }
.bz-robo-botao:active { transform: scale(0.97); background: var(--marca-fundo); }
@media (hover: hover) { .bz-robo-botao:not(:disabled):hover { background: var(--marca-fundo); } }
.bz-robo-botao .bz-ic { width: 18px; height: 18px; margin-right: 8px; }
.bz-robo-botao:disabled { cursor: default; }
.bz-robo-botao:disabled:active { transform: none; background: var(--superficie); }
.bz-robo-botao.escolhido, .bz-robo-botao.escolhido:disabled { border-color: var(--marca); background: var(--marca); color: var(--marca-txt); }
.bz-robo-botao.velho, .bz-robo-botao.velho:disabled:active { border-color: var(--linha-forte); border-style: dashed; background: transparent; color: var(--suave); font-weight: 600; }
.bz-robo-botao:disabled:not(.escolhido):not(.velho) { border-color: var(--linha-forte); background: transparent; color: var(--suave); }
.bz-robo-opcoes { margin: 8px 0 2px; }
.bz-robo-opcoes-rotulo { display: block; margin: 0 0 4px; color: var(--suave); font-size: 0.75rem; font-weight: 700; }
.bz-robo-opcoes ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.bz-robo-opcoes li { margin: 0 6px 6px 0; padding: 3px 10px; border: 1px solid var(--linha-forte); border-radius: 999px; background: var(--superficie); color: var(--texto); font-size: 0.8125rem; font-weight: 600; }

/* cartão "Seu teste está pronto" (L4): dentro do balão do robô; a senha NUNCA está aqui, só o botão que abre a folha "Ver meu acesso" */
.bz-teste-titulo { font-weight: 700; }
.bz-teste-caixa { margin: 8px 0 4px; }
.bz-teste { display: flex; align-items: flex-start; margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie); }
.bz-teste-caixa .bz-teste { margin: 0 0 8px; }
.bz-teste-ic { display: flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; margin: 0 10px 0 0; border-radius: 50%; background: var(--marca-fundo); color: var(--marca-tinta); }
.bz-teste-ic .bz-ic { width: 18px; height: 18px; }
.bz-teste-txt { min-width: 0; color: var(--suave); font-size: 0.875rem; line-height: 1.4; }
.bz-teste-botao { width: 100%; min-height: 48px; margin: 0 0 4px; }

.bz-sistema { align-self: center; max-width: 92%; margin: 8px 0 10px; text-align: center; }
.bz-sistema span { display: inline-block; padding: 6px 12px; border-radius: 12px; background: var(--afundo); color: var(--suave); font-size: 0.8125rem; font-weight: 600; }
.bz-sistema.nova { animation: bz-sobe 0.2s var(--curva) both; }
.bz-dia { align-self: center; margin: 14px 0 10px; }
.bz-dia span { display: block; padding: 4px 12px; border-radius: 999px; background: var(--afundo); color: var(--suave); font-size: 0.75rem; font-weight: 600; }

.bz-anexo-fora { margin: 0 0 4px; color: var(--suave); font-size: 0.875rem; font-style: italic; }
.bz-foto { display: block; width: 240px; height: 180px; max-width: 100%; margin: 0 0 6px; border-radius: 12px; overflow: hidden; background: var(--afundo); }
.bz-foto img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bz-audio-caixa { display: flex; align-items: center; width: 250px; max-width: 100%; margin: 0 0 4px; }
.bz-audio { display: block; flex: 1 1 auto; min-width: 0; height: 40px; }
.bz-video-caixa { width: 260px; height: 146px; max-width: 100%; margin: 0 0 6px; border-radius: 12px; overflow: hidden; background: #1d1510; }
.bz-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #1d1510; }
.bz-arquivo {
  display: flex; align-items: center; min-width: 220px; max-width: 100%; margin: 0 0 6px; padding: 8px 10px; border-radius: 12px;
  background: var(--afundo); color: var(--texto); text-decoration: none; cursor: pointer;
}
.bz-msg.minha .bz-arquivo { background: rgba(255, 255, 255, 0.92); }
.bz-arquivo .bz-ic { width: 26px; height: 26px; margin-right: 10px; color: var(--marca-tinta); }
.bz-arquivo-txt { display: block; min-width: 0; }
.bz-arquivo-txt b { display: block; overflow-wrap: anywhere; font-size: 0.9375rem; line-height: 1.3; }
.bz-arquivo-txt small { display: block; color: var(--suave); font-size: 0.75rem; }

.bz-prog { width: 100%; height: 4px; margin: 2px 0 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.12); overflow: hidden; }
.bz-msg.minha .bz-prog { background: rgba(255, 255, 255, 0.35); }
.bz-prog-barra { display: block; width: 100%; height: 100%; border-radius: 4px; background: var(--marca-tinta); transform: scaleX(var(--p, 0)); transform-origin: left center; transition: transform 0.2s ease-out; }
.bz-msg.minha .bz-prog-barra { background: var(--marca-txt); }

/* ---------- aviso que sobe (toast) ---------- */
.bz-aviso {
  position: fixed; left: 0; right: 0; bottom: 96px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: max-content; max-width: calc(100% - 32px); margin: 0 auto; padding: 12px 18px; border-radius: 14px;
  background: var(--texto); color: #ffffff; font-size: 0.9375rem; font-weight: 600; text-align: center;
  box-shadow: 0 10px 24px -10px rgba(38, 29, 21, 0.45), 0 3px 8px -4px rgba(38, 29, 21, 0.3);
  opacity: 0; transform: translateY(12px); pointer-events: none;
}
.bz-aviso.erro { background: var(--erro); }
.bz-aviso.entrou { opacity: 1; transform: none; transition: opacity 0.25s var(--curva), transform 0.25s var(--curva); }
.bz-aviso.saindo { opacity: 0; transform: translateY(-4px); transition: opacity 0.15s ease-out, transform 0.15s ease-out; }

/* ---------- carregando ---------- */
.bz-esq { display: block; border-radius: 12px; background: var(--afundo-2); animation: bz-pulsa 1.4s ease-in-out infinite; }

@keyframes bz-sobe { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bz-pulsa { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes bz-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bz-treme { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-4px); } 90% { transform: translateX(2px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
