/* Assistente de atendimento. Cores e letra da página: papel, areia, tinta e samambaia.
   Curvas: uma saída suave para o que aparece e uma mola leve para as mensagens. */
.assistente {
  --ast-tinta: #1C1612;
  --ast-tinta-2: #6A5F56;
  --ast-papel: #FAF8F4;
  --ast-areia: #EEE7DB;
  --ast-verde: #2E4A36;
  --ast-verde-claro: #3b5d45;
  --ast-linha: #e2d8c8;
  --ast-borda: #d5c7b3;
  --ast-curva: cubic-bezier(.2, .72, .18, 1);
  --ast-mola: cubic-bezier(.34, 1.3, .64, 1);
  --ast-origem: calc(100% - 2rem) calc(100% - 2rem);
  position: fixed;
  z-index: 70;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  font-family: "Host Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: normal;
  color: var(--ast-tinta);
}
.assistente *, .assistente *::before, .assistente *::after { box-sizing: border-box; }
.assistente [hidden] { display: none !important; }
.assistente button { font: inherit; letter-spacing: inherit; }
.assistente :focus-visible { outline: 2px solid var(--ast-verde); outline-offset: 3px; }
.assistente .ast-topo :focus-visible { outline-color: var(--ast-papel); }
.assistente .ast-painel:focus { outline: none; }
html.menu-aberto .assistente { display: none; }

/* ---------- botão: o rosto dele; o rótulo desliza para fora no computador ---------- */
.assistente .ast-botao {
  position: relative;
  display: flex;
  align-items: center;
  padding: .28rem;
  border: 0;
  border-radius: 999px;
  background: var(--ast-tinta);
  color: var(--ast-papel);
  font-weight: 500;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 16px 36px -14px rgba(28, 22, 18, .6);
  opacity: 0;
  translate: 0 1.4rem;
  pointer-events: none;
  transition: opacity .4s var(--ast-curva), translate .55s var(--ast-curva), background-color .2s;
}
.assistente.is-visivel .ast-botao { opacity: 1; translate: 0 0; pointer-events: auto; }
.assistente .ast-botao-rosto { position: relative; display: block; width: 3.25rem; height: 3.25rem; border-radius: 50%; box-shadow: 0 0 0 2px var(--ast-papel); }
.assistente .ast-botao-rosto img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.assistente .ast-botao-texto { max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .4s var(--ast-curva), opacity .25s, padding .4s var(--ast-curva); }
@media (hover: hover) and (min-width: 40.01rem) {
  .assistente .ast-botao:hover { background: #2b241e; }
  .assistente .ast-botao:hover .ast-botao-texto,
  .assistente .ast-botao:focus-visible .ast-botao-texto { max-width: 12rem; opacity: 1; padding: 0 1rem 0 .8rem; }
}
.assistente .ast-ativo { position: absolute; right: .02rem; bottom: .02rem; width: .78rem; height: .78rem; border: 2px solid var(--ast-tinta); border-radius: 50%; background: #7fb08a; }
.assistente .ast-topo .ast-ativo { border-color: var(--ast-verde); }
.assistente.is-aberto .ast-botao,
.assistente.is-fechando .ast-botao { opacity: 0; scale: .8; pointer-events: none; transition-duration: .2s; }

/* ---------- aviso (uma vez por sessão) ---------- */
.assistente .ast-aviso {
  position: absolute; right: 0; bottom: calc(100% + .8rem);
  display: flex; align-items: flex-start;
  width: max-content; max-width: min(17.5rem, calc(100vw - 2.5rem));
  border: 1px solid var(--ast-borda);
  border-radius: 1rem 1rem .3rem 1rem;
  background: var(--ast-papel);
  box-shadow: 0 18px 40px -20px rgba(28, 22, 18, .5);
  transform-origin: 100% 100%;
  animation: ast-surgir .45s var(--ast-curva) both;
}
@keyframes ast-surgir { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
.assistente .ast-aviso-corpo { display: grid; gap: .2rem; padding: .8rem .3rem .8rem .95rem; border: 0; background: none; color: var(--ast-tinta); text-align: left; cursor: pointer; }
.assistente .ast-aviso-corpo strong { font-size: .95rem; font-weight: 600; }
.assistente .ast-aviso-corpo span { font-size: .84rem; line-height: 1.4; color: var(--ast-tinta-2); }
.assistente .ast-aviso-x { flex: 0 0 auto; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; margin: .25rem .25rem 0 0; border: 0; border-radius: 50%; background: none; color: var(--ast-tinta-2); cursor: pointer; }
.assistente .ast-aviso-x svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- painel: cresce a partir do botão e volta para ele ---------- */
.assistente .ast-painel {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  width: min(24.5rem, calc(100vw - 2.5rem));
  height: min(39rem, calc(100dvh - 2.5rem));
  border: 1px solid var(--ast-borda);
  border-radius: 20px;
  background: var(--ast-papel);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(28, 22, 18, .16);
  animation: ast-abrir .5s var(--ast-curva) both;
}
.assistente.is-fechando .ast-painel { animation: ast-fechar .32s cubic-bezier(.5, 0, .75, .2) both; }
@keyframes ast-abrir { from { clip-path: circle(1.7rem at var(--ast-origem)); } to { clip-path: circle(150% at var(--ast-origem)); } }
@keyframes ast-fechar { from { clip-path: circle(150% at var(--ast-origem)); } to { clip-path: circle(1.7rem at var(--ast-origem)); opacity: .4; } }
.assistente .ast-painel > * { animation: ast-subir .45s var(--ast-curva) both; }
.assistente .ast-topo { animation-delay: .06s; }
.assistente .ast-lista { animation-delay: .12s; }
.assistente .ast-form { animation-delay: .18s; }
@keyframes ast-subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.assistente .ast-topo { display: flex; align-items: center; gap: .8rem; padding: .95rem .9rem .95rem 1.05rem; background: var(--ast-verde); color: var(--ast-papel); }
.assistente .ast-topo-rosto { position: relative; flex: 0 0 auto; width: 2.75rem; height: 2.75rem; }
.assistente .ast-topo-rosto img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(250, 248, 244, .85); }
.assistente .ast-topo div { display: grid; gap: .12rem; min-width: 0; flex: 1; }
.assistente .ast-topo strong { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.assistente .ast-topo div span { font-size: .8rem; color: rgba(250, 248, 244, .78); }
.assistente .ast-fechar { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(250, 248, 244, .1); color: var(--ast-papel); cursor: pointer; transition: background-color .2s; }
.assistente .ast-fechar:hover { background: rgba(250, 248, 244, .2); }
.assistente .ast-fechar svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- conversa ---------- */
.assistente .ast-lista { flex: 1; display: flex; flex-direction: column; gap: .55rem; padding: 1.15rem 1rem 1rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cfc3b1 transparent; }

.assistente .ast-boas-vindas { display: grid; justify-items: start; gap: .35rem; padding: .15rem .15rem .3rem; }
.assistente .ast-boas-rosto { width: 4.5rem; height: 4.5rem; margin-bottom: .5rem; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--ast-papel), 0 0 0 4px var(--ast-borda); animation: ast-surgir .5s var(--ast-curva) .16s both; }
.assistente .ast-boas-ola { margin: 0; font-size: 1.2rem; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; animation: ast-subir .45s var(--ast-curva) .22s both; }
.assistente .ast-boas-texto { margin: 0 0 .65rem; font-size: .92rem; line-height: 1.45; color: var(--ast-tinta-2); animation: ast-subir .45s var(--ast-curva) .27s both; }
.assistente .ast-assuntos { width: 100%; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ast-linha); }
.assistente .ast-assuntos li { border-bottom: 1px solid var(--ast-linha); animation: ast-subir .4s var(--ast-curva) both; animation-delay: calc(.32s + var(--k) * .04s); }
.assistente .ast-assuntos button { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; min-height: 3.4rem; padding: .7rem .15rem; border: 0; background: none; color: var(--ast-tinta); text-align: left; cursor: pointer; transition: background-color .2s, padding .3s var(--ast-curva); }
.assistente .ast-assuntos button > span { display: grid; gap: .1rem; }
.assistente .ast-assuntos strong { font-size: .97rem; font-weight: 550; }
.assistente .ast-assuntos small { font-size: .82rem; color: var(--ast-tinta-2); }
.assistente .ast-assuntos svg { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--ast-tinta-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: translate .3s var(--ast-curva); }
@media (hover: hover) {
  .assistente .ast-assuntos button:hover { padding-left: .5rem; background: var(--ast-areia); }
  .assistente .ast-assuntos button:hover svg { translate: 3px 0; }
}
.assistente .ast-urgencia { margin-top: .75rem; padding: .35rem 0; border: 0; background: none; color: var(--ast-tinta); font-size: .86rem; font-weight: 500; text-decoration: underline; text-decoration-color: rgba(28, 22, 18, .3); text-underline-offset: 4px; cursor: pointer; }
.assistente .ast-limite { margin: .35rem 0 0; font-size: .78rem; color: var(--ast-tinta-2); }

.assistente .ast-msg { display: flex; align-items: flex-end; gap: .5rem; max-width: 92%; }
.assistente .ast-msg--bot { align-self: flex-start; padding-left: 2.1rem; animation: ast-bot .38s var(--ast-mola) both; transform-origin: 0 100%; }
.assistente .ast-msg--bot.is-primeira { padding-left: 0; }
.assistente .ast-msg--eu { align-self: flex-end; justify-content: flex-end; animation: ast-eu .34s var(--ast-mola) both; transform-origin: 100% 100%; }
@keyframes ast-bot { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ast-eu { from { opacity: 0; transform: translateX(8px) scale(.96); } to { opacity: 1; transform: none; } }
.assistente .ast-msg-rosto { flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%; object-fit: cover; }
.assistente .ast-msg p { margin: 0; padding: .7rem .95rem; border-radius: 1.1rem; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.assistente .ast-msg--bot p { border-bottom-left-radius: .3rem; background: #fff; box-shadow: 0 0 0 1px var(--ast-linha); }
.assistente .ast-msg--eu p { border-bottom-right-radius: .3rem; background: var(--ast-tinta); color: var(--ast-papel); }
.assistente .ast-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.assistente .ast-links a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: .5rem 1.05rem; border-radius: 999px; background: var(--ast-verde); color: var(--ast-papel); font-size: .9rem; font-weight: 500; text-decoration: none; transition: background-color .15s; }
.assistente .ast-links a:hover { background: var(--ast-verde-claro); }
.assistente .ast-digitando { display: inline-flex; gap: .3rem; padding: .9rem 1rem; border-radius: 1.1rem; border-bottom-left-radius: .3rem; background: #fff; box-shadow: 0 0 0 1px var(--ast-linha); }
.assistente .ast-digitando i { width: .4rem; height: .4rem; border-radius: 50%; background: #9a8f82; animation: ast-ponto 1.1s ease-in-out infinite; }
.assistente .ast-digitando i:nth-child(2) { animation-delay: .14s; }
.assistente .ast-digitando i:nth-child(3) { animation-delay: .28s; }
@keyframes ast-ponto { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.assistente .ast-opcoes { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .25rem; padding-left: 2.1rem; }
.assistente .ast-opcoes button { min-height: 2.75rem; padding: .5rem 1rem; border: 1px solid rgba(28, 22, 18, .5); border-radius: 999px; background: transparent; color: var(--ast-tinta); font-size: .9rem; font-weight: 500; text-align: left; cursor: pointer; animation: ast-bot .36s var(--ast-mola) both; animation-delay: calc(var(--k) * .04s); transition: background-color .15s, border-color .15s; }
.assistente .ast-opcoes button:hover { background: var(--ast-areia); }
.assistente .ast-opcoes button.is-principal { border-color: var(--ast-verde); background: var(--ast-verde); color: var(--ast-papel); }
.assistente .ast-opcoes button.is-principal:hover { background: var(--ast-verde-claro); }

/* ---------- campo ---------- */
.assistente .ast-form { display: flex; gap: .5rem; padding: .7rem .85rem .85rem; border-top: 1px solid var(--ast-linha); background: var(--ast-papel); }
.assistente .ast-form input { flex: 1; min-width: 0; height: 2.75rem; padding: 0 1rem; border: 1px solid var(--ast-borda); border-radius: 999px; background: #fff; color: var(--ast-tinta); font: 400 1rem/1.2 "Host Grotesk", ui-sans-serif, system-ui, sans-serif; outline: none; transition: border-color .2s, box-shadow .2s; }
.assistente .ast-form input::placeholder { color: #8d8378; }
.assistente .ast-form input:focus { border-color: var(--ast-verde); box-shadow: 0 0 0 3px rgba(46, 74, 54, .16); }
.assistente .ast-form input:focus-visible { outline: none; }
.assistente .ast-enviar { display: grid; place-items: center; flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--ast-verde); color: var(--ast-papel); cursor: pointer; transition: background-color .15s; }
.assistente .ast-enviar:hover { background: var(--ast-verde-claro); }
.assistente .ast-enviar svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.assistente .ast-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- telefone: o painel é uma folha que sobe do botão ---------- */
@media (max-width: 40rem) {
  .assistente { right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); --ast-origem: calc(100% - 2.6rem) calc(100% - 2.6rem); }
  .assistente .ast-painel { right: 0; bottom: 0; width: 100%; height: min(88dvh, 46rem); border-width: 1px 0 0; border-radius: 20px 20px 0 0; }
  .assistente .ast-form { padding-bottom: max(.85rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .assistente *, .assistente *::after { animation: none !important; transition: none !important; }
}
@media print { .assistente { display: none; } }
