/* WebChat público (WEBCHAT_ENABLED, docs/WEBCHAT.md) — linha visual do "Atendimento Digital". */
:root {
  --ink: #12251f; --ink-soft: #33453f; --ink-mute: #6b7c76;
  --canvas: #f4f7f5; --surface: #ffffff; --line: #e3e8e6;
  --accent: #0e7c63; --accent-dark: #0a5c49; --accent-soft: #e4f2ed;
  --danger: #96371f;
  /* fonte do SISTEMA, como o WhatsApp: nada de Google Fonts (o IP do visitante não sai daqui — LGPD) */
  --f-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-display: var(--f-body);
  --sombra: 0 1px 2px rgba(18,37,31,.06), 0 8px 24px rgba(18,37,31,.05);
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--f-body); color: var(--ink); background: var(--canvas);
       -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.wc { position: relative; display: flex; flex-direction: column; height: 100dvh; max-width: 1100px;
      margin: 0 auto; background: var(--canvas); overflow: hidden; }

/* ═══ TELA DE CARREGAMENTO ═══════════════════════════════════════════════ */
.wc-splash { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center;
             background: var(--canvas); overflow: hidden; transition: opacity .5s var(--ease), transform .6s var(--ease); }
.wc-splash.sai { opacity: 0; transform: scale(1.04); pointer-events: none; }
.wc-splash-textura { position: absolute; inset: -40px;
  background-image: radial-gradient(circle, var(--line) 1.2px, transparent 1.3px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 70%);
          mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 70%);
  animation: wc-deriva 18s linear infinite; }
.wc-splash-aura { position: absolute; width: 620px; height: 620px; left: 50%; top: 42%; translate: -50% -50%;
  background: radial-gradient(circle, rgba(14,124,99,.13) 0%, rgba(14,124,99,.04) 38%, transparent 66%);
  filter: blur(8px); animation: wc-respira 4.5s ease-in-out infinite; }
.wc-splash-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
                 max-width: 360px; padding: 24px; text-align: center; }
.wc-splash-box > * { opacity: 0; animation: wc-sobe .7s var(--ease) forwards; }
.wc-splash-box > :nth-child(2) { animation-delay: .18s; }
.wc-splash-box > :nth-child(3) { animation-delay: .3s; }
.wc-splash-box > :nth-child(4) { animation-delay: .42s; }
.wc-splash-box > :nth-child(5) { animation-delay: .54s; }
.wc-splash-box > :nth-child(6) { animation-delay: .62s; }
.wc-splash-logo { position: relative; display: grid; place-items: center; margin-bottom: 10px;
  min-width: 96px; height: 96px; padding: 14px 22px; border-radius: 22px; background: var(--surface);
  box-shadow: 0 2px 4px rgba(18,37,31,.05), 0 18px 40px rgba(18,37,31,.10);
  animation: wc-pousa .9s var(--ease) forwards !important; }
.wc-splash-logo img { max-width: 190px; max-height: 64px; object-fit: contain; position: relative; z-index: 1; }
.wc-splash-logo b { font: 600 40px var(--f-display); color: var(--accent); position: relative; z-index: 1; }
.wc-anel { position: absolute; inset: -2px; border-radius: 24px; border: 2px solid var(--accent);
           opacity: 0; animation: wc-onda 2.4s ease-out 1s infinite; }
.wc-anel.a2 { animation-delay: 2.2s; }
.wc-splash-tit { margin: 6px 0 0; font: 700 26px/1.22 var(--f-display); color: var(--ink); letter-spacing: -.025em; }
.wc-splash-sub { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); }
.wc-splash-sub strong { color: var(--accent-dark); font-weight: 600; }
.wc-confia { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.wc-confia li { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.wc-confia svg { width: 14px; height: 14px; color: #b08a2e; }
.wc-splash-load { margin-top: 16px; display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.wc-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-soft);
           border-top-color: var(--accent); animation: wc-gira .8s linear infinite; }
.wc-barra-prog { width: 180px; height: 3px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; margin-top: 4px; }
.wc-barra-prog span { display: block; width: 40%; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: wc-varre 1.3s ease-in-out infinite; }

@keyframes wc-sobe { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes wc-pousa { 0% { opacity: 0; transform: scale(.7) translateY(10px); } 60% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes wc-onda { 0% { opacity: .45; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes wc-respira { 50% { transform: scale(1.08); opacity: .75; } }
@keyframes wc-deriva { to { transform: translate(22px, 22px); } }
@keyframes wc-gira { to { transform: rotate(360deg); } }
@keyframes wc-varre { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ═══ TOPO ═══════════════════════════════════════════════════════════════ */
.wc-top { display: flex; align-items: center; gap: 13px; padding: 10px 18px; background: var(--surface);
          box-shadow: 0 1px 0 var(--line); position: relative; z-index: 2; animation: wc-desce .5s var(--ease); }
.wc-logo { height: 40px; width: auto; max-width: 130px; object-fit: contain; }
.wc-logo-letra { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  font: 600 17px var(--f-display); background: linear-gradient(155deg, var(--accent), var(--accent-dark)); }
.wc-nome { font-weight: 700; font-size: 16.5px; display: flex; align-items: center; gap: 5px; }
.wc-selo { width: 17px; height: 17px; color: #1d9bf0; flex: none; }
.wc-status { margin-top: 2px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.wc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); flex: none; }
.wc-dot.off { background: #c9962f; box-shadow: 0 0 0 3px #f5ead2; }
@keyframes wc-desce { from { opacity: 0; transform: translateY(-8px); } }

/* ═══ ENTRADA ════════════════════════════════════════════════════════════ */
.wc-entrada { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.wc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px 24px;
           width: 100%; max-width: 380px; box-shadow: var(--sombra); display: flex; flex-direction: column; gap: 14px;
           animation: wc-sobe .5s var(--ease); }
.wc-card h2 { margin: 0; font: 700 22px var(--f-display); letter-spacing: -.02em; text-align: center; }
.wc-sub { margin: 0; text-align: center; color: var(--ink-soft); font-size: 14px; }
.wc-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.wc-card small { color: var(--ink-mute); font-weight: 400; }
.wc-card input { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--canvas); }
.wc-card input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.wc-btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px; cursor: pointer;
          background: var(--accent); color: #fff; transition: background .15s; }
.wc-btn:hover { background: var(--accent-dark); }
.wc-btn:disabled { opacity: .6; cursor: default; }
.wc-btn-sec { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; }
.wc-erro { margin: 0; color: var(--danger); font-size: 13px; text-align: center; }

/* ═══ MENSAGENS ══════════════════════════════════════════════════════════ */
.wc-msgs { flex: 1; overflow-y: auto; padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(circle, var(--line) 1px, transparent 1.1px); background-size: 22px 22px; }
.wc-dia { align-self: center; background: var(--surface); color: var(--ink-soft); font-size: 12px; font-weight: 600;
          padding: 4px 12px; border-radius: 10px; margin: 8px 0; box-shadow: var(--sombra); }
.wc-m { max-width: min(620px, 84%); padding: 10px 14px 7px; border-radius: 16px; font-size: 15.5px; line-height: 1.45;
        word-wrap: break-word; white-space: pre-wrap; animation: wc-entra .28s var(--ease); }
.wc-m.eles { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sombra); border-bottom-left-radius: 4px; }
.wc-m.eu { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.wc-m a { color: var(--accent-dark); }
.wc-m code { font: 13.5px ui-monospace, Menlo, monospace; }
.wc-dica { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
           font-size: 13.5px; font-style: italic; color: var(--ink-soft); white-space: normal; }
.wc-hora { float: right; margin: 8px 0 -3px 12px; font-size: 11.5px; color: var(--ink-mute); white-space: nowrap; }
.wc-tique { color: var(--accent); margin-left: 3px; }
.wc-m img, .wc-m video { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 6px; cursor: zoom-in; }
.wc-m audio { display: block; width: 260px; max-width: 100%; margin-bottom: 2px; }
.wc-doc { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px;
          background: rgba(18,37,31,.05); text-decoration: none; color: inherit !important; margin-bottom: 6px; }
.wc-doc::before { content: "📄"; font-size: 20px; }
@keyframes wc-entra { from { opacity: 0; transform: translateY(6px) scale(.98); } }
/* "digitando…" — três pontos pulando, na bolha do atendente */
.wc-digitando { display: flex; gap: 5px; align-items: center; padding: 14px 16px; width: auto; }
.wc-digitando span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute);
                     animation: wc-pula 1.2s infinite ease-in-out; }
.wc-digitando span:nth-child(2) { animation-delay: .15s; }
.wc-digitando span:nth-child(3) { animation-delay: .3s; }
@keyframes wc-pula { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* botões de resposta (≤3 opções) e botão do menu */
.wc-botoes { align-self: flex-start; display: flex; flex-direction: column; gap: 4px; width: min(620px, 84%); margin-bottom: 4px;
             animation: wc-entra .32s var(--ease); }
.wc-botao { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px;
            border-radius: 16px; background: var(--surface); color: var(--accent-dark); font: inherit; font-weight: 600;
            font-size: 15px; border: 1px solid var(--line); box-shadow: var(--sombra); cursor: pointer; transition: background .15s, transform .1s; }
.wc-botao:hover:not(:disabled) { background: var(--accent-soft); }
.wc-botao:active:not(:disabled) { transform: scale(.985); }
.wc-botao:disabled { color: var(--ink-mute); background: var(--canvas); box-shadow: none; cursor: default; }
.wc-botao svg { width: 18px; height: 18px; flex: none; }
.wc-aviso { margin: 0; padding: 10px 16px; text-align: center; font-size: 13.5px; font-weight: 500;
            background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-soft); }

/* ═══ BARRA DE DIGITAÇÃO ═════════════════════════════════════════════════ */
.wc-barra, .wc-gravando { display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
                          background: var(--surface); border-top: 1px solid var(--line); }
.wc-gravando { align-items: center; }
.wc-ico { width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft);
          background: none; border: 0; padding: 0; flex: none; border-radius: 50%; }
.wc-ico:hover { background: var(--canvas); }
.wc-ico svg { width: 22px; height: 22px; }
#wc-texto { flex: 1; font: inherit; font-size: 15.5px; resize: none; border: 1px solid var(--line); outline: none; border-radius: 22px;
            padding: 10px 16px; max-height: 140px; background: var(--canvas); }
#wc-texto:focus { border-color: var(--accent); background: #fff; }
.wc-enviar { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
             background: var(--accent); color: #fff; display: grid; place-items: center; transition: background .15s, transform .1s; }
.wc-enviar:hover { background: var(--accent-dark); }
.wc-enviar:active { transform: scale(.94); }
.wc-enviar svg { width: 22px; height: 22px; }
.wc-enviar[data-modo="mic"] .i-env, .wc-enviar[data-modo="env"] .i-mic { display: none; }
.wc-rec { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: wc-pisca 1s infinite; }
#wc-grav-tempo { flex: 1; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 500; }
@keyframes wc-pisca { 50% { opacity: .2; } }

/* ═══ GAVETA DO MENU / PRÉVIA ════════════════════════════════════════════ */
.wc-fundo { position: fixed; inset: 0; z-index: 30; background: rgba(18,37,31,.35); display: flex;
            align-items: flex-end; justify-content: center; animation: wc-surge .2s ease-out; }
.wc-fundo.centro { align-items: center; padding: 20px; background: rgba(18,37,31,.55); }
.wc-fundo.sai { animation: wc-some .2s ease-in forwards; }
.wc-fundo.sai .wc-gaveta { animation: wc-desliza-sai .2s ease-in forwards; }
.wc-gaveta { width: 100%; max-width: 640px; max-height: 75vh; overflow-y: auto; background: var(--surface);
             border-radius: 20px 20px 0 0; padding: 0 0 calc(14px + env(safe-area-inset-bottom));
             box-shadow: 0 -10px 40px rgba(18,37,31,.18); animation: wc-desliza .32s var(--ease);
             user-select: none; -webkit-user-select: none; }
.wc-alca { display: flex; justify-content: center; padding: 10px 0 8px; cursor: grab; touch-action: none; }
.wc-alca span { width: 40px; height: 4px; border-radius: 4px; background: var(--line); }
.wc-gaveta-topo { display: flex; align-items: center; gap: 13px; padding: 4px 22px 16px; }
.wc-gaveta-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
                 background: var(--accent-soft); color: var(--accent-dark); }
.wc-gaveta-ico svg { width: 22px; height: 22px; }
.wc-gaveta-topo h3 { margin: 0; font-size: 17px; font-weight: 700; }
.wc-gaveta-topo p { margin: 2px 0 0; font-size: 14px; color: var(--ink-soft); }
.wc-op { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px;
         padding: 15px 22px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left;
         font: inherit; cursor: pointer; color: inherit; opacity: 0; animation: wc-sobe .35s var(--ease) forwards;
         transition: background .12s; }
.wc-op:first-child { border-top: 0; }
.wc-op:hover, .wc-op:focus-visible { background: var(--canvas); outline: none; }
.wc-op:active { background: var(--accent-soft); }
.wc-op b { display: block; font-weight: 600; font-size: 16px; color: var(--ink); }
.wc-op small { display: block; margin-top: 3px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.wc-op svg { width: 20px; height: 20px; color: var(--ink-soft); flex: none; transition: transform .15s; }
.wc-op:hover svg { transform: translateX(3px); color: var(--accent); }
@keyframes wc-surge { from { opacity: 0; } }
@keyframes wc-some { to { opacity: 0; } }
@keyframes wc-desliza { from { transform: translateY(100%); } }
@keyframes wc-desliza-sai { to { transform: translateY(100%); } }

.wc-previa-box { background: #fff; border-radius: 16px; padding: 16px; width: 100%; max-width: 420px;
                 display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sombra); animation: wc-sobe .25s var(--ease); }
.wc-previa-arq img { max-width: 100%; max-height: 300px; display: block; margin: 0 auto; border-radius: 10px; }
.wc-previa-arq p { margin: 0; word-break: break-all; }
#wc-legenda { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.wc-previa-acoes { display: flex; gap: 8px; justify-content: flex-end; }

@media (max-width: 600px) {
  .wc-top { padding: 8px 12px; gap: 10px; }
  .wc-logo { height: 34px; max-width: 96px; }
  .wc-msgs { padding: 12px 10px 6px; }
  .wc-m, .wc-botoes { max-width: 90%; width: auto; }
  .wc-botoes { width: 90%; }
  .wc-splash-tit { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .wc-splash-box > *, .wc-op { opacity: 1; }
}

/* ═══ LGPD / anti-robô / sistema ═════════════════════════════════════════ */
.wc-isca { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wc-card label.wc-aceite { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400;
  font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); cursor: pointer; }
.wc-card label.wc-aceite input { margin: 2px 0 0; padding: 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.wc-aceite a, .wc-privacidade a { color: var(--accent-dark); }
.wc-privacidade { align-self: center; max-width: 440px; margin: 4px 12px 6px; padding: 7px 12px; text-align: center;
  background: #fdf5d6; color: #5c4d14; border-radius: 8px; font-size: 12px; line-height: 1.4; }
.wc-sistema { align-self: center; background: var(--surface); color: var(--ink-soft); font-size: 12px;
  padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(18,37,31,.06); margin: 4px 0; }

/* ═══ atendimento finalizado ═════════════════════════════════════════════ */
.wc-fim { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 16px 20px;
  background: var(--surface); border-top: 1px solid var(--line); text-align: center;
  padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.wc-fim b { font-size: 15.5px; }
.wc-fim p { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-soft); }
.wc-fim .wc-btn, .wc-fim .wc-btn-sec { min-width: 270px; border-radius: 999px; text-decoration: none; text-align: center; }
.wc-fim .wc-btn { color: #fff; }
.wc-fim .wc-btn-sec { border: 1.5px solid var(--accent); color: var(--accent-dark); font-weight: 600; background: #fff; }
