/* Atendente Velox: bolinha no canto e conversa com a IA da Velox. */
.atd { --atd-base: 20px; --atd-lado: 20px; --atd-noite: #0E0C0A; --atd-ok: #3BD37A; font: 400 15px/1.5 var(--f-texto); color: var(--tinta); }
.atd *, .atd *::before, .atd *::after { box-sizing: border-box; }
.atd__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; }

/* ---------- a bolinha ---------- */
.atd__bolinha {
  position: fixed; z-index: 60; right: var(--atd-lado); bottom: var(--atd-base);
  display: grid; place-items: center; width: 62px; height: 62px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(70% 70% at 50% 30%, #2A231C 0%, #15120F 70%);
  /* anel claro de 1 px e brilho laranja: aparece no papel e no fechamento escuro */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 1px rgba(255, 255, 255, .14), 0 2px 6px rgba(23, 20, 15, .18), 0 8px 24px -6px rgba(255, 107, 26, .45);
  /* nasce escondida: entra só quando o script põe .atd--chegou (depois do topo) */
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: transform .5s var(--curva), box-shadow .25s var(--curva-ui), opacity .5s var(--curva-ui), bottom .3s var(--curva-ui), visibility 0s linear .5s;
}
.atd--chegou .atd__bolinha { opacity: 1; visibility: visible; transform: none; transition: transform .5s var(--curva), box-shadow .25s var(--curva-ui), opacity .5s var(--curva-ui), bottom .3s var(--curva-ui), visibility 0s; }
.atd--chegou .atd__bolinha:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 1px rgba(255, 255, 255, .18), 0 4px 10px rgba(23, 20, 15, .2), 0 12px 30px -8px rgba(255, 107, 26, .6); }
.atd__bolinha:focus-visible { outline: 2px solid var(--marca-funda); outline-offset: 4px; border-radius: 50%; }
.atd__bolinha img { width: 36px; height: auto; transition: transform .3s var(--curva), opacity .2s; }
.atd__bolinha-x { position: absolute; width: 26px; height: 26px; color: #fff; opacity: 0; transform: rotate(-60deg) scale(.6); transition: transform .3s var(--curva), opacity .2s; }
.atd__online { position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--atd-ok); box-shadow: 0 0 0 2.5px #15120F, 0 0 10px rgba(59, 211, 122, .6); }
.atd--aberto .atd__bolinha img { opacity: 0; transform: scale(.6) rotate(30deg); }
.atd--aberto .atd__bolinha-x { opacity: 1; transform: none; }
.atd--aberto .atd__online { opacity: 0; }

/* anel que chama atenção uma vez quando a bolinha chega */
.atd__bolinha::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 0 rgba(255, 107, 26, .45); }
.atd--chegou .atd__bolinha::after { animation: atd-anel 2.2s var(--curva-ui) .2s 2; }
@keyframes atd-anel { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 26, .45); } 70%, 100% { box-shadow: 0 0 0 16px rgba(255, 107, 26, 0); } }

/* ---------- o balão curto: escuro, no material da bolinha, em cima dela e alinhado à direita (fica na calha do canto) ---------- */
.atd__balao {
  position: fixed; z-index: 60; right: var(--atd-lado); bottom: calc(var(--atd-base) + 74px);
  display: flex; align-items: center; gap: 4px; max-width: 260px; padding: 6px 6px 6px 16px; border-radius: 16px 16px 6px 16px;
  background: #14110F; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .1), 0 4px 10px rgba(0, 0, 0, .22), 0 22px 46px -14px rgba(0, 0, 0, .55);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.96); transform-origin: right bottom; pointer-events: none;
  transition: opacity .35s var(--curva-ui), transform .45s var(--curva), visibility 0s linear .45s;
}
.atd__balao[hidden] { display: none; }
.atd__balao--visivel { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity .35s var(--curva-ui), transform .45s var(--curva), visibility 0s; }
.atd__balao-abrir { all: unset; cursor: pointer; padding: 6px 0; font: 500 14.5px/1.35 var(--f-texto); color: #fff; }
.atd__balao-abrir b { display: block; font-weight: 600; color: #FFB27A; }
.atd__balao-abrir:focus-visible { outline: 2px solid #FFB27A; outline-offset: 3px; border-radius: 6px; }
.atd__cel { display: none; }
.atd__balao-fechar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, .6); cursor: pointer; }
.atd__balao-fechar:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.atd__balao-fechar:focus-visible { outline: 2px solid #FFB27A; outline-offset: 1px; }
.atd__balao-fechar svg { width: 15px; height: 15px; }

/* ---------- o painel de conversa ---------- */
.atd__painel {
  position: fixed; z-index: 61; right: var(--atd-lado); bottom: calc(var(--atd-base) + 76px);
  display: flex; flex-direction: column; width: 392px; height: min(640px, calc(100vh - var(--atd-base) - 112px)); height: min(640px, calc(100dvh - var(--atd-base) - 112px));
  overflow: hidden; border-radius: 22px; background: var(--papel);
  box-shadow: 0 0 0 1px rgba(23, 20, 15, .07), 0 2px 6px rgba(23, 20, 15, .06), 0 24px 60px -18px rgba(60, 25, 0, .40), 0 60px 120px -40px rgba(23, 20, 15, .35);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.97); transform-origin: right bottom;
  transition: opacity .25s var(--curva-ui), transform .4s var(--curva), visibility 0s linear .4s;
}
.atd--aberto .atd__painel { opacity: 1; visibility: visible; transform: none; transition: opacity .25s var(--curva-ui), transform .45s var(--curva), visibility 0s; }

.atd__cab {
  position: relative; isolation: isolate; flex: none; display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; color: #fff;
  background: radial-gradient(260px 120px at 18% 0, rgba(255, 107, 26, .26), rgba(255, 107, 26, 0) 70%), var(--atd-noite);
}
.atd__cab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, rgba(255, 107, 26, 0), rgba(255, 140, 50, .55) 30%, rgba(255, 181, 71, .7) 50%, rgba(255, 140, 50, .55) 70%, rgba(255, 107, 26, 0)); }
.atd__selo { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(180deg, #241E18, #15120F); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), inset 0 0 0 1px rgba(255, 255, 255, .07); }
.atd__selo img { width: 28px; height: auto; }
.atd__selo .atd__online { top: -3px; right: -3px; width: 12px; height: 12px; box-shadow: 0 0 0 2.5px var(--atd-noite), 0 0 10px rgba(59, 211, 122, .6); }
.atd__quem { min-width: 0; flex: 1 1 auto; }
.atd__nome { margin: 0; font: 600 17px/1.2 var(--f-titulo); letter-spacing: -.01em; }
.atd__estado { margin: 3px 0 0; font-size: 13px; line-height: 1.3; color: rgba(255, 255, 255, .62); }
.atd__fechar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .07); color: rgba(255, 255, 255, .85); cursor: pointer; transition: background-color .2s; }
.atd__fechar:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.atd__fechar:focus-visible { outline: 2px solid var(--ambar); outline-offset: 2px; border-radius: 50%; }
.atd__fechar svg { width: 18px; height: 18px; }

.atd__rolo { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 8px; scroll-behavior: smooth; }
.atd__aviso { margin: 0 auto 16px; max-width: 300px; text-align: center; font-size: 12.5px; line-height: 1.45; color: var(--tinta-3-txt); }
.atd__aviso a { color: var(--tinta-2); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--linha-2); white-space: nowrap; }
.atd__aviso a:hover { color: var(--tinta); border-color: var(--tinta); }
.atd__aviso svg { display: inline-block; width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; color: #1FA855; }

.atd__log { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.atd__msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 88%; animation: atd-entra .35s var(--curva) both; }
.atd__msg--cliente { align-self: flex-end; align-items: flex-end; }
.atd__fala { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--branco); box-shadow: var(--sh-cartao); font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.atd__msg--cliente .atd__fala { border-radius: 18px 18px 6px 18px; background: var(--botao); color: #fff; box-shadow: 0 1px 2px rgba(120, 40, 0, .2); }
.atd__msg--erro .atd__fala { background: #FFF6EF; box-shadow: 0 0 0 1px rgba(200, 70, 13, .18); }
.atd__acao.btn { height: 42px; padding: 0 18px; font-size: 15px; white-space: normal; text-align: center; line-height: 1.2; }
.atd__acao--humano { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 13px; border-radius: 999px; background: var(--branco); color: var(--tinta); font: 600 14.5px/1 var(--f-texto); text-decoration: none; box-shadow: inset 0 0 0 1px var(--linha-2); }
.atd__acao--humano:hover { box-shadow: inset 0 0 0 1px rgba(23, 20, 15, .25), 0 4px 12px -4px rgba(23, 20, 15, .12); }
.atd__acao--humano svg { width: 17px; height: 17px; color: #1FA855; }
@keyframes atd-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.atd__digitando .atd__fala { display: inline-flex; align-items: center; gap: 8px; color: var(--tinta-3-txt); font-size: 13.5px; }
.atd__pontos { display: inline-flex; gap: 4px; }
.atd__pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--marca); opacity: .35; animation: atd-ponto 1.1s infinite ease-in-out; }
.atd__pontos i:nth-child(2) { animation-delay: .15s; }
.atd__pontos i:nth-child(3) { animation-delay: .3s; }
@keyframes atd-ponto { 0%, 70%, 100% { opacity: .3; transform: none; } 35% { opacity: 1; transform: translateY(-3px); } }

.atd__sugestoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 14px 0 4px; }
.atd__sugestao { padding: 8px 14px; border: 0; border-radius: 999px; cursor: pointer; background: var(--branco); color: var(--tinta); font: 500 14px/1.25 var(--f-texto); text-align: left; box-shadow: 0 0 0 1px var(--linha-2), 0 1px 2px rgba(23, 20, 15, .04); transition: box-shadow .2s var(--curva-ui), color .2s, transform .2s var(--curva-ui); }
.atd__sugestao:hover { color: var(--marca-texto); box-shadow: 0 0 0 1.5px rgba(255, 107, 26, .55), 0 6px 14px -6px rgba(200, 70, 13, .3); }
.atd__sugestao:active { transform: scale(.97); }

.atd__pe { flex: none; padding: 10px 12px 12px; background: var(--papel); border-top: 1px solid var(--linha); }
.atd__form { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 18px; background: var(--branco); box-shadow: 0 0 0 1px var(--linha-2), 0 1px 2px rgba(23, 20, 15, .04); transition: box-shadow .2s var(--curva-ui); }
.atd__form:focus-within { box-shadow: 0 0 0 1.5px var(--marca), 0 0 0 5px rgba(255, 107, 26, .14); }
.atd__campo { flex: 1 1 auto; min-width: 0; max-height: 120px; margin: 0; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--tinta); font: 400 15.5px/1.4 var(--f-texto); }
.atd__campo::placeholder { color: var(--tinta-3-txt); }
.atd__enviar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: var(--botao); color: #fff; transition: background-color .2s, opacity .2s, transform .2s var(--curva-ui); }
.atd__enviar:hover { background: #B53D09; }
.atd__enviar:active { transform: scale(.94); }
.atd__enviar:disabled { opacity: .4; cursor: default; }
.atd__enviar:focus-visible { outline: 2px solid var(--marca-funda); outline-offset: 2px; border-radius: 50%; }
.atd__enviar svg { width: 18px; height: 18px; }
.atd__rodape { margin: 8px 0 0; text-align: center; font-size: 11.5px; color: var(--tinta-3-txt); }

/* ---------- celular ---------- */
@media (max-width: 560px) {
  .atd { --atd-base: 16px; --atd-lado: 16px; }
  .atd__bolinha { width: 56px; height: 56px; }
  .atd__bolinha img { width: 32px; }
  .atd__balao { bottom: calc(var(--atd-base) + 66px); max-width: 180px; padding: 4px 4px 4px 14px; }
  .atd__balao-abrir { font-size: 14px; }
  .atd__balao-abrir b { display: inline; }
  .atd__pc { display: none; }
  .atd__cel { display: inline; }
  .atd__painel { top: 8px; left: 8px; right: 8px; bottom: 8px; width: auto; height: auto; border-radius: 20px; transform-origin: center bottom; }
  .atd--aberto .atd__bolinha, .atd--chegou.atd--aberto .atd__bolinha { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.8); }
  .atd__campo { font-size: 16px; }
  .atd__msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .atd__bolinha, .atd__balao, .atd__painel, .atd__msg { transition: none !important; animation: none !important; }
  .atd__bolinha { transform: none; }
  .atd--chegou .atd__bolinha::after { animation: none; }
  .atd__pontos i { animation: none; opacity: .7; }
  .atd__rolo { scroll-behavior: auto; }
}
@media print { .atd { display: none; } }

/* rodada 3: no celular a bolinha some com o rodapé à vista (ele já tem o Falar com a Velox) e fica mais leve enquanto a tela rola */
@media (max-width: 760px) {
  .atd--chegou.atd--rolando:not(.atd--aberto) .atd__bolinha { opacity: .72; }
  .atd--chegou.atd--longe:not(.atd--aberto) .atd__bolinha { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px) scale(.9); transition: transform .3s var(--curva), opacity .25s var(--curva-ui), visibility 0s .3s; }
  .atd--longe .atd__balao { display: none; }
}
/* painel em tela cheia no celular: a página de trás não rola */
html.atd-modal, html.atd-modal body { overflow: hidden; }
