:root {
  --papel: #EFEAE2;
  --ponto: rgba(17, 27, 33, 0.05);
  --balao-bot: #FFFFFF;
  --balao-cliente: #D9FDD3;
  --tinta: #111B21;
  --tinta-suave: #54656F;
  --linha: #D1D7DB;
  --verde: #008069;
  --verde-forte: #006B58;
  --sobre-verde: #FFFFFF;
  --tique: #53BDEB;
  --barra: #F0F2F5;
  --campo: #FFFFFF;
  --marinho: #0A2754;
  --sobre-marinho: #FFFFFF;
  --sobre-marinho-suave: #C5DBF5;
  --trilho: #24427A;
  --espuma: #FFFFFF;
  --amarelo: #FFD200;
  --erro: #B3261E;
  --perigo: #B3261E;
  --sombra: 0 1px 1px rgba(11, 20, 26, 0.16);
  /* margem lateral: no desktop o conteúdo fica numa coluna central de 44rem */
  --lado: max(12px, calc((100% - 44rem) / 2));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0B141A;
    --ponto: rgba(255, 255, 255, 0.04);
    --balao-bot: #202C33;
    --balao-cliente: #005C4B;
    --tinta: #E9EDEF;
    --tinta-suave: #C0CBD1;
    --linha: #2A3942;
    --verde: #00A884;
    --verde-forte: #00C49A;
    --sobre-verde: #0B141A;
    --barra: #1F2C34;
    --campo: #2A3942;
    --marinho: #081C3D;
    --erro: #FFB4AB;
    --sombra: 0 1px 1px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--papel);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }

a { color: var(--verde); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }
.topo :focus-visible { outline-color: var(--amarelo); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.num, .valor, .qtd, .preco, td { font-variant-numeric: tabular-nums; }
.nb { white-space: nowrap; }

/* ---------- estrutura ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.painel { display: none; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; background: var(--papel); container: chat / size; } /* a altura do chat decide o modo compacto (abaixo) */

/* ---------- topo (cabeçalho de conversa) ---------- */
.topo { background: var(--marinho); color: var(--sobre-marinho); padding-top: calc(8px + env(safe-area-inset-top)); }
.topo-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-inline: 12px; }
.avatar {
  flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--amarelo); color: var(--marinho); font-size: 22px; font-weight: 700; /* em px: o círculo é fixo, a letra não pode crescer com o zoom */
}
.quem { flex: 1 1 4.5rem; min-width: 0; } /* com texto muito ampliado os botões descem para a linha de baixo */
.nome-topo { font-size: 1.125rem; font-weight: 700; }
.status-topo { margin: 0; font-size: 0.8125rem; line-height: 1.25; color: var(--sobre-marinho-suave); }
.topo-botoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.btn-topo {
  min-height: 44px; padding: 0 12px; border: 1.5px solid var(--sobre-marinho-suave); border-radius: 8px;
  background: transparent; color: var(--sobre-marinho); font-size: 0.9375rem; font-weight: 600;
}
.btn-topo.armado { background: var(--perigo); border-color: var(--perigo); color: var(--sobre-marinho); }
#btn-recomecar { width: calc(5rem + 27px); line-height: 1.15; } /* largura fixa (texto em rem + padding e borda em px): "Apagar pedido?" quebra em 2 linhas e o botão não se mexe ao armar */
.rotulo-progresso { margin: 6px 0 8px; padding-inline: 12px; font-size: 0.8125rem; color: var(--sobre-marinho-suave); }

/* o chopp sendo servido: enchimento amarelo com espuma na ponta */
.trilho { --p: 0; position: relative; height: 6px; background: var(--trilho); container-type: inline-size; }
.enchimento {
  position: absolute; inset: 0; background: var(--amarelo);
  transform: scaleX(var(--p)); transform-origin: left center;
  transition: transform 400ms ease-out;
}
.espuma {
  position: absolute; left: 0; top: -2px; width: 14px; height: 10px; border-radius: 999px; background: var(--espuma);
  transform: translateX(calc(var(--p) * (100cqw - 14px)));
  transition: transform 400ms ease-out, opacity 200ms;
}
.espuma-topo {
  position: absolute; left: 0; right: 0; top: -2px; height: 4px; border-radius: 999px; background: var(--espuma);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 400ms ease-out;
}
.trilho[data-p="0"] .espuma, .trilho[data-p="1"] .espuma { opacity: 0; }
.trilho[data-p="1"] .espuma-topo { transform: scaleX(1); }

/* ---------- conversa ---------- */
.conversa {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 4px; padding: 12px var(--lado) 16px;
  background-color: var(--papel);
  background-image: radial-gradient(var(--ponto) 1.2px, transparent 1.7px);
  background-size: 20px 20px;
}
.chip-data {
  align-self: center; margin: 0 0 8px; padding: 4px 12px; border-radius: 8px;
  background: var(--balao-bot); color: var(--tinta-suave); box-shadow: var(--sombra); font-size: 0.8125rem;
}

.msg, .opcoes { animation: entrar 150ms ease-out; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } }

.msg {
  position: relative; max-width: min(34rem, 85%); padding: 8px 12px 6px; border-radius: 8px;
  box-shadow: var(--sombra); font-size: 1.125rem; line-height: 1.45; overflow-wrap: break-word;
}
.msg.bot { align-self: flex-start; background: var(--balao-bot); }
.msg.eu { align-self: flex-end; background: var(--balao-cliente); }
.msg.cauda { margin-top: 8px; }
.msg.cauda::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.bot.cauda { border-top-left-radius: 0; }
.msg.bot.cauda::before { left: -8px; background: var(--balao-bot); clip-path: polygon(100% 0, 100% 100%, 0 0); }
.msg.eu.cauda { border-top-right-radius: 0; }
.msg.eu.cauda::before { right: -8px; background: var(--balao-cliente); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg p { margin: 0; }
.msg.final { font-weight: 600; }

.hora { display: block; margin-top: 2px; text-align: right; font-size: 0.8125rem; line-height: 1.2; color: var(--tinta-suave); user-select: none; }
.hora svg { width: 1.25rem; height: 0.8125rem; margin-left: 4px; vertical-align: -1px; color: var(--tique); }

.msg.digitando { display: flex; gap: 5px; align-items: center; padding: 14px 14px; }
.digitando span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--tinta-suave);
  animation: ponto 1s ease-in-out infinite;
}
.digitando span:nth-child(2) { animation-delay: 0.15s; }
.digitando span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ponto { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ---------- botões de resposta (dentro da conversa) ---------- */
.opcoes { align-self: flex-start; width: 100%; max-width: 34rem; display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.opcoes.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dica-grupo { grid-column: 1 / -1; margin: 0; font-size: 0.875rem; color: var(--tinta-suave); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 8px 16px; border: 0; border-radius: 8px;
  background: var(--balao-bot); color: var(--verde); box-shadow: var(--sombra);
  font-size: 1.125rem; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none; overflow-wrap: break-word;
}
.btn:hover:not(:disabled), .btn:active:not(:disabled) { background: var(--barra); color: var(--verde-forte); }
.btn.primario { background: var(--verde); color: var(--sobre-verde); }
.btn.primario:hover:not(:disabled), .btn.primario:active:not(:disabled) { background: var(--verde-forte); color: var(--sobre-verde); }
.btn:disabled { background: var(--barra); color: var(--tinta-suave); box-shadow: inset 0 0 0 1px var(--linha); cursor: not-allowed; }
.btn svg { width: 24px; height: 24px; flex-shrink: 0; }
.cartao .btn:not(.primario):not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--verde); }

.btn.fixo { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 4px 0 12px var(--papel); } /* faixa opaca (cobre também o respiro de 16px da conversa): nenhuma linha aparece cortada ao redor */

.link {
  min-height: 48px; white-space: nowrap; padding: 0 8px; border: 0; background: none; color: var(--verde);
  font-size: 1.125rem; font-weight: 600; text-decoration: underline;
}
.remover { color: var(--erro); }

/* sabores: lista de marcação */
.sabor {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 12px;
  min-height: 56px; padding: 8px 12px; border-radius: 8px; background: var(--balao-bot); box-shadow: var(--sombra);
  font-size: 1.125rem; cursor: pointer;
}
.caixa { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--tinta-suave); border-radius: 6px; color: var(--sobre-verde); }
.caixa svg { width: 18px; height: 18px; visibility: hidden; }
.sabor input:checked + .caixa { background: var(--verde); border-color: var(--verde); }
.sabor input:checked + .caixa svg { visibility: visible; }
.sabor input:focus-visible + .caixa { outline: 3px solid var(--verde); outline-offset: 2px; }
.preco { grid-column: 2; font-size: 0.8125rem; line-height: 1.25; color: var(--tinta-suave); }

/* ---------- compositor ---------- */
.compositor { background: var(--barra); border-top: 1px solid var(--linha); padding: 8px var(--lado) calc(6px + env(safe-area-inset-bottom)); }
.campo { display: flex; align-items: center; gap: 8px; }
.campo input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 18px; border: 0; border-radius: 26px;
  background: var(--campo); box-shadow: inset 0 0 0 1px var(--tinta-suave); font-size: 1.125rem;
}
.campo input[readonly] { opacity: 0.6; }
.campo input::placeholder { color: var(--tinta-suave); opacity: 1; }
.enviar {
  flex-shrink: 0; display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 0; border-radius: 50%; background: var(--verde); color: var(--sobre-verde);
}
.enviar:hover, .enviar:active { background: var(--verde-forte); }
.enviar svg { width: 24px; height: 24px; }
.so-botoes { margin: 0; padding: 14px 0; text-align: center; color: var(--tinta-suave); }

/* ---------- campo de data ---------- */
.sel, .campo-data {
  width: 100%; min-height: 52px; padding: 0 12px; border: 1.5px solid var(--tinta-suave); border-radius: 8px;
  background: var(--campo); color: var(--tinta); font-size: 1.125rem;
}
.campo-data { min-height: 56px; }
.rotulo-data { font-weight: 600; }
.erro-campo { margin: 0; color: var(--erro); font-weight: 600; }
.erro-campo:empty { display: none; }

/* ---------- cartões na conversa (balões largos) ---------- */
.cartao { width: 100%; max-width: 34rem; padding: 12px 14px 6px; }
.cartao ul { list-style: none; margin: 0; padding: 0; }
.cartao li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--linha); }
.cartao li:first-child { border-top: 0; }
.valor { margin-left: auto; font-weight: 700; text-align: right; white-space: nowrap; }
.totais { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--linha); font-size: 1.25rem; font-weight: 700; }

/* carrinho editável */
.titulo-linha { font-weight: 700; }
.carrinho .linha { display: flex; flex-direction: column; gap: 12px; padding: 14px 0; border-top: 1px solid var(--linha); }
.carrinho .linha:first-child { border-top: 0; padding-top: 4px; }
.campo-linha { display: flex; flex-direction: column; gap: 4px; }
.campo-linha > label, .rot { font-size: 1rem; font-weight: 600; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; }
.passo { width: 52px; min-height: 52px; padding: 0; }
.qtd { min-width: 3rem; text-align: center; font-size: 1.75rem; font-weight: 700; }
.rodape-linha { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rodape-linha .valor { font-size: 1.25rem; }
.vazio, .faltam { margin: 4px 0 8px; color: var(--tinta-suave); }
.faltam:empty { display: none; }
.carrinho .adicionar { margin: 4px 0 12px; }
.carrinho .confirmar { margin: 12px 0 8px; }

/* resumo */
.resumo h2 { font-size: 1.25rem; }
.resumo.antigo { opacity: 0.55; }
.secao { padding: 10px 0; border-top: 1px solid var(--linha); }
.secao-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.secao h3 { font-size: 1.125rem; font-weight: 700; }
.secao p { margin: 0; }
.secao .total { font-weight: 700; }
.acoes { position: sticky; bottom: -16px; z-index: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 0 8px; border-top: 1px solid var(--linha); background: var(--balao-bot); box-shadow: 0 8px 0 var(--balao-bot); } /* o envio fica sempre à vista (-16px anula o respiro da conversa; a sombra opaca tapa o resto) */
.acoes .primario { min-height: 60px; padding-inline: 8px; }
.acoes .primario svg { display: inline-block; vertical-align: -6px; margin-right: 8px; } /* glifo e texto juntos, mesmo se quebrar em 2 linhas */
.status-copia { margin: 0; font-weight: 600; }
.status-copia:empty { display: none; }
.copia-texto { width: 100%; min-height: 9rem; padding: 10px; border: 1.5px solid var(--tinta-suave); border-radius: 8px; background: var(--campo); font-size: 1rem; }
.dica { margin: 4px 0 0; font-size: 0.875rem; color: var(--tinta-suave); }
.cartao .rodape-card { margin: 12px 0 0; font-size: 0.875rem; color: var(--tinta-suave); }

/* ---------- painel de preços ---------- */
.painel-conteudo { display: flex; flex-direction: column; gap: 36px; }
.painel-conteudo section { display: flex; flex-direction: column; gap: 14px; }
.painel-conteudo h2 { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.01em; }
.painel-conteudo p, .painel-conteudo dl, .painel-conteudo dd, .painel-conteudo ul { margin: 0; }
/* Bloco de um sabor: a barra amarela marca onde começa cada tabela. */
.bloco-preco h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; padding: 2px 0 2px 12px; border-left: 5px solid var(--amarelo); margin: 6px 0 4px; }
.linhas > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 16px; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.linhas dt { font-size: 1.0625rem; }
.linhas dd { font-size: 1.125rem; font-weight: 700; margin-left: auto; }
.cidades { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 100%), 1fr)); gap: 0 16px; font-size: 1.0625rem; }
.cidades li { padding: 8px 0; border-bottom: 1px solid var(--linha); }
.nota { font-size: 0.9375rem; color: var(--tinta-suave); }

.dialogo {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0 16px 24px;
  border: 0; background: var(--balao-bot); color: var(--tinta);
}
.dialogo::backdrop { background: var(--papel); }
.dialogo-topo {
  position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; background: var(--balao-bot);
}
.dialogo-topo h2 { font-size: 1.25rem; }
.dialogo-topo .btn { width: auto; box-shadow: inset 0 0 0 1.5px var(--verde); }

.falha { max-width: 34rem; margin: 0 auto; padding: 32px 16px; font-size: 1.125rem; }
.falha h1 { margin-bottom: 12px; }
.falha a { color: var(--verde-forte); } /* --verde sobre --papel dá 4,09:1 no tema claro */

/* Pouco espaço (teclado aberto, celular deitado ou texto muito ampliado: 36rem cresce com o zoom do texto): compacta cabeçalho e barra inferior para a pergunta do Atlas caber. */
@container chat (max-height: 36rem) {
  .topo { padding-top: calc(4px + env(safe-area-inset-top)); }
  .avatar { width: 36px; height: 36px; font-size: 18px; }
  .status-topo { display: none; }
  .rotulo-progresso { margin: 2px 0 4px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .compositor { padding-top: 4px; }
  .so-botoes { padding: 6px 0; line-height: 1.25; }
  .acoes { position: static; }
}

@media (max-width: 399px) {
  .topo-linha { gap: 8px; }
  .avatar { width: 40px; height: 40px; }
  .btn-topo { padding: 0 9px; font-size: 0.875rem; }
  #btn-recomecar { width: calc(4.6rem + 21px); }
}

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  .app { grid-template-columns: 360px minmax(0, 1fr); }
  .painel {
    display: block; position: sticky; top: 0; height: 100%; overflow-y: auto;
    padding: 24px 20px; background: var(--balao-bot); border-right: 1px solid var(--linha);
  }
  #btn-precos { display: none; }
  .topo-linha, .rotulo-progresso { padding-inline: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
