/* Visual inspirado no WhatsApp */
:root {
  --verde-escuro: #008069;
  --verde: #00a884;
  --fundo: #efeae2;
  --balao-eu: #d9fdd3;
  --claro: #e7f8f3;
  --clarinho: #f0faf7;
  --borda-clara: #cfe9e1;
  --balao-outro: #ffffff;
  --texto: #111b21;
  --cinza: #667781;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: "Segoe UI", Helvetica, Arial, sans-serif; color: var(--texto); }
.app { display: flex; flex-direction: column; height: 100%; width: 100%; background: var(--fundo); }

/* topo */
.topo { display: flex; align-items: center; gap: 12px; background: var(--verde-escuro); color: #fff; padding: 10px 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #dfe5e7; display: grid; place-items: center; font-size: 20px; flex: none; }
.info { flex: 1; min-width: 0; }
.titulo { font-weight: 600; font-size: 16px; }
.sub { font-size: 13px; opacity: .85; }
.btn-topo { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }

/* fundo com padrão sutil */
.mensagens, .inicio {
  flex: 1; overflow-y: auto; padding: 16px max(16px, calc((100% - 980px) / 2));
  background-color: var(--fundo);
  background-image: radial-gradient(rgba(0,0,0,.04) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* aviso de posição na fila */
.aviso-fila { background: #fff8c5; color: #5c4a00; text-align: center; font-size: 14px; padding: 8px 12px; border-bottom: 1px solid #f0e2a0; }

/* identificação */
.inicio { display: grid; place-items: center; }
.cartao { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 360px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.cartao h2 { margin: 0 0 4px; }
.cartao p { margin: 0 0 16px; color: var(--cinza); }
.cartao input { width: 100%; padding: 11px 12px; margin-bottom: 10px; border: 1px solid #d1d7db; border-radius: 8px; font-size: 15px; }
.cartao input:focus { outline: none; border-color: var(--verde); }
.btn-verde { width: 100%; padding: 12px; background: var(--verde); color: #fff; border: 0; border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-verde:disabled { opacity: .6; }
.erro { color: #d93025; font-size: 14px; margin-top: 8px; min-height: 18px; }

/* balões */
.balao { position: relative; max-width: min(75%, 640px); width: fit-content; padding: 6px 9px 8px; margin: 2px 0 6px; border-radius: 8px;
         font-size: 14.5px; line-height: 1.35; box-shadow: 0 1px .5px rgba(0,0,0,.13); word-wrap: break-word; }
.balao.outro { background: var(--balao-outro); border-top-left-radius: 0; }
.balao.eu { background: var(--balao-eu); margin-left: auto; border-top-right-radius: 0; }
.balao .autor { font-size: 13px; font-weight: 600; color: var(--verde-escuro); margin-bottom: 2px; }
.balao .hora { font-size: 11px; color: var(--cinza); text-align: right; margin-top: 2px; }
.balao .tick { color: #53bdeb; }
.balao a { color: #027eb5; }

/* botões do menu (estilo "lista" do WhatsApp Business) */
.botoes { display: flex; flex-direction: column; gap: 4px; max-width: 75%; width: 320px; margin: -2px 0 10px; }
.botoes button { display: flex; align-items: center; gap: 10px; background: #fff; border: 0; border-radius: 8px; padding: 10px 12px;
                 color: #027eb5; font-size: 14.5px; text-align: left; cursor: pointer; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
.botoes button:hover:not(:disabled) { background: #f5f6f6; }
.botoes .num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--claro); color: var(--verde-escuro);
               font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.botoes.inativo { opacity: .55; }
.botoes.inativo button { cursor: default; }

/* rodapé */
.rodape { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: #f0f2f5; }
.rodape textarea { flex: 1; resize: none; border: 0; border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; max-height: 120px; }
.rodape textarea:focus { outline: none; }
.btn-enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--verde); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }

@media (max-width: 600px) { .mensagens { padding: 12px 10px; } .balao, .botoes { max-width: 88%; } }

/* ---------- v2: LGPD, anexos, gravação ---------- */
.lgpd { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--cinza); margin: 4px 0 14px; line-height: 1.4; cursor: pointer; }
.lgpd input { margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--verde); }
.lgpd a { color: #027eb5; margin-left: 4px; }
.btn-icone { width: 44px; height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer; border-radius: 50%; flex: none; }
.btn-icone:hover { background: rgba(0,0,0,.06); }
.btn-enviar { font-size: 20px; }
.balao.com-anexo { padding: 4px 4px 8px; }
.balao.com-anexo .texto, .balao.com-anexo .autor, .balao.com-anexo .hora { padding: 0 5px; }
.anexo-img { display: block; max-width: 260px; max-height: 300px; width: 100%; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.anexo-audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.anexo-arq { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,.05); border-radius: 6px; color: var(--texto) !important; text-decoration: none; min-width: 200px; }
.anexo-arq span { font-size: 26px; }
.gravando { align-items: center; }
.grav-info { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--texto); }
.ponto { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: piscar 1s infinite; }
@keyframes piscar { 50% { opacity: .2; } }
.erro-envio { background: #fdecea; color: #b71c1c; font-size: 13.5px; padding: 8px 12px; text-align: center; }
.balao .autor:empty { display: none; }
@supports (padding: env(safe-area-inset-bottom)) { .rodape { padding-bottom: calc(8px + env(safe-area-inset-bottom)); } }

/* aviso de privacidade no topo da conversa (estilo aviso de criptografia do WhatsApp) */
.aviso-lgpd { margin: 0 auto 12px; max-width: 520px; background: #fff5c4; color: #54470f; font-size: 12.5px; line-height: 1.45;
              text-align: center; padding: 7px 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(0,0,0,.1); }
.aviso-lgpd a { color: #027eb5; }
.carregando { text-align: center; color: var(--cinza); margin-top: 40px; }

/* ---------- v4: avisos em destaque ---------- */
.aviso-sistema { margin: 14px auto; max-width: 460px; background: #fff; border: 2px solid var(--verde); border-radius: 12px;
                 padding: 12px 16px 6px; text-align: center; font-size: 14.5px; line-height: 1.5; box-shadow: 0 2px 8px rgba(0,128,105,.15); }
.aviso-sistema > :first-child { font-size: 15.5px; }
.aviso-sistema.noite { border-color: #5b5fc7; box-shadow: 0 2px 8px rgba(91,95,199,.18); background: #f7f7ff; }
.aviso-sistema .hora { font-size: 11px; color: var(--cinza); margin-top: 4px; }
.faixa-fila { display: flex; align-items: center; gap: 14px; padding: 12px max(16px, calc((100% - 980px) / 2)); background: var(--claro);
              border-bottom: 2px solid var(--verde); position: relative; overflow: hidden; }
.faixa-fila.noite { background: #eef0ff; border-bottom-color: #5b5fc7; }
.ff-num { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--verde); color: #fff; font-size: 22px; font-weight: 700;
          display: grid; place-items: center; }
.faixa-fila.noite .ff-num { background: #5b5fc7; font-size: 24px; }
.ff-txt { display: flex; flex-direction: column; line-height: 1.35; }
.ff-txt b { font-size: 16px; color: var(--texto); }
.ff-txt span { font-size: 13.5px; color: #3b4a54; }
.ff-pulso { position: absolute; left: max(16px, calc((100% - 980px) / 2)); top: 50%; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
            border: 2px solid var(--verde); animation: pulso 1.8s ease-out infinite; pointer-events: none; }
@keyframes pulso { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ff-pulso { display: none; } }

/* ---------- v9: identificação opcional (dentro da saudação) ---------- */
.ident { margin: 10px 0 4px; padding: 10px 12px; background: var(--clarinho); border: 1px solid var(--borda-clara); border-radius: 8px; min-width: 250px; }
.ident .id-tit { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.ident .id-tit span { font-weight: 400; color: var(--cinza); }
.ident label { display: block; font-size: 11.5px; font-weight: 700; color: #3b4a54; letter-spacing: .3px; margin-bottom: 8px; }
.ident input { display: block; width: 100%; margin-top: 3px; padding: 9px 10px; border: 1px solid #c8d3d7; border-radius: 7px; font: inherit; font-size: 14.5px; font-weight: 400; background: #fff; }
.ident input:focus { outline: none; border-color: var(--verde); }
.id-bts { display: flex; gap: 8px; }
.id-bts button { flex: 1; padding: 8px; border-radius: 18px; font-size: 14px; cursor: pointer; }
#ciSalvar { background: var(--verde); color: #fff; border: 0; font-weight: 600; }
#ciPular { background: #fff; color: var(--cinza); border: 1px solid #d1d7db; }
.ci-erro { color: #c62828; font-size: 12.5px; margin-top: 6px; }
.botoes.centro { margin: -4px auto 12px; }
/* vídeo */
.anexo-video { display: block; width: 300px; max-width: 100%; max-height: 360px; border-radius: 6px; background: #000; }
.anexo-baixar { display: inline-block; margin-top: 4px; font-size: 12.5px; color: #027eb5; text-decoration: none; }
.anexo-expirado { font-size: 13px; color: #667781; font-style: italic; padding: 6px 2px; }
.prog-envio { background: #fff; border-top: 1px solid #e9edef; padding: 8px 14px; font-size: 13px; color: #3b4a54; }
.pe-barra { height: 6px; background: #e9edef; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.pe-barra i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s; }

/* logo no topo (Aparência) */
.topo .avatar[data-tema] { overflow: hidden; }
.topo .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ident.obrig { border-color: var(--verde); }
.ident .id-tit b { color: var(--verde-escuro); }

/* aviso temporário (⚙️ → Horário) */
.aviso-temp { position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,.08); margin: 0 auto 10px; max-width: 520px; background: #fde8d7; color: #6b3410; border: 1px solid #f5c9a5;
  font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: 8px; text-align: center; font-weight: 500; }

/* pedido de contato dentro do cartão da fila */
.aviso-sistema .ident.contato { text-align: left; margin-top: 10px; }
