:root {
  --principal: #D62828;
  --secundaria: #F77F00;
  --fundo: #FFF8F0;
  --texto: #1F1F1F;
  --cinza: #6b6b6b;
  --borda: #e8e1d9;
  --branco: #fff;
  --whats: #1FAF54;
  --raio: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 64px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.4;
  padding-bottom: 96px;
  -webkit-tap-highlight-color: transparent;
}
body.travado { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

/* ---------- Topo ---------- */
.topo { max-width: 720px; margin: 0 auto; }
.topo-faixa {
  height: 110px;
  background: linear-gradient(135deg, var(--principal), var(--secundaria));
}
.topo-info {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 16px; margin-top: -52px;
}
.logo {
  width: 96px; height: 96px; flex: none;
  border-radius: 50%; object-fit: cover;
  background: var(--branco); border: 4px solid var(--branco);
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.topo-info h1 { font-size: 1.5rem; margin-top: 8px; }
.slogan { margin: 2px 0 6px; color: var(--cinza); font-size: .92rem; }
.selos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.selo, .status {
  font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  background: var(--branco); border: 1px solid var(--borda);
}
.status.aberto { background: #e3f7e9; border-color: #b8e6c6; color: #17803d; }
.status.fechado { background: #fde8e8; border-color: #f5c2c2; color: #b42318; }
.aviso-fechado {
  margin: 12px 16px 0; padding: 10px 12px; border-radius: 10px;
  background: #fff4e5; border: 1px solid #ffd8a8; font-size: .88rem;
}

/* ---------- Abas de categoria ---------- */
.categorias {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px 16px; margin-top: 12px;
  background: var(--fundo); border-bottom: 1px solid var(--borda);
}
.categorias::-webkit-scrollbar { display: none; }
.categorias a {
  flex: none; text-decoration: none; color: var(--texto);
  padding: 7px 14px; border-radius: 99px; font-size: .9rem; font-weight: 600;
  background: var(--branco); border: 1px solid var(--borda);
}
.categorias a.ativa { background: var(--principal); border-color: var(--principal); color: var(--branco); }
@media (min-width: 752px) { .categorias { padding-left: calc(50% - 344px); padding-right: calc(50% - 344px); } }

/* ---------- Itens ---------- */
main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.secao h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.item {
  display: flex; gap: 12px; width: 100%; text-align: left;
  padding: 12px; margin-bottom: 10px;
  background: var(--branco); border: 1px solid var(--borda); border-radius: var(--raio);
  transition: transform .1s;
}
.item:active { transform: scale(.99); }
.item.esgotado { opacity: .55; cursor: not-allowed; }
.item-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-nome { font-weight: 700; font-size: 1rem; }
.item-desc {
  color: var(--cinza); font-size: .85rem; margin: 3px 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-preco { margin-top: auto; font-weight: 700; color: var(--principal); }
.item-preco small { color: var(--cinza); font-weight: 500; }
.item-foto {
  width: 96px; height: 96px; flex: none; border-radius: 10px; object-fit: cover;
  background: #f1ebe4;
}
.selo-item {
  align-self: flex-start; font-size: .7rem; font-weight: 700; color: var(--branco);
  background: var(--secundaria); padding: 2px 8px; border-radius: 99px; margin-bottom: 4px;
}
.selo-item.cinza { background: var(--cinza); }

.rodape { max-width: 720px; margin: 28px auto 0; padding: 0 16px; color: var(--cinza); font-size: .82rem; text-align: center; }
.rodape a { color: inherit; }
.rodape table { margin: 8px auto; border-collapse: collapse; }
.rodape td { padding: 1px 8px; text-align: left; }

/* ---------- Barra do carrinho ---------- */
.barra-carrinho {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: calc(100% - 32px); max-width: 688px;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border: 0; border-radius: var(--raio);
  background: var(--principal); color: var(--branco); font-weight: 600; font-size: 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.barra-carrinho strong { margin-left: auto; }
.barra-qtd {
  min-width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center;
  background: rgba(255,255,255,.25); font-size: .85rem;
}

/* ---------- Janelas ---------- */
.janela { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.janela[hidden] { display: none; }
.janela-fundo { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.janela-caixa {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--branco); border-radius: 20px 20px 0 0; overflow: hidden;
  animation: sobe .2s ease-out;
}
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) {
  .janela { align-items: center; }
  .janela-caixa { border-radius: 20px; }
}
.janela-corpo { overflow-y: auto; padding: 18px 18px 8px; }
.janela-corpo h2 { font-size: 1.25rem; }
.janela-corpo h3 { font-size: 1rem; margin: 20px 0 8px; }
.fechar {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.92); font-size: 1.5rem; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.item-foto-grande { width: 100%; height: 220px; object-fit: cover; background: #f1ebe4; flex: none; }
.descricao { color: var(--cinza); margin: 6px 0 0; }
.grupo { margin-top: 18px; }
.grupo-titulo { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 6px; }
.grupo-titulo small { color: var(--cinza); font-weight: 500; }
.escolha {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--borda); cursor: pointer;
}
.escolha input { width: 20px; height: 20px; accent-color: var(--principal); margin: 0; }
.escolha span { flex: 1; }
.escolha em { font-style: normal; color: var(--cinza); font-size: .9rem; }

.janela-acoes {
  display: flex; gap: 12px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--borda);
}
.contador { display: flex; align-items: center; border: 1px solid var(--borda); border-radius: 12px; }
.contador button { width: 40px; height: 44px; border: 0; background: none; font-size: 1.3rem; color: var(--principal); }
.contador span { min-width: 24px; text-align: center; font-weight: 700; }
.contador.pequeno button { width: 32px; height: 32px; font-size: 1.1rem; }

.botao {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border: 0; border-radius: 12px;
  background: var(--principal); color: var(--branco); font-weight: 700; font-size: 1rem;
}
.botao:disabled { opacity: .5; }
.botao-whats { width: 100%; background: var(--whats); margin: 14px 0 12px; padding: 15px; }

/* ---------- Carrinho ---------- */
.lista-carrinho { list-style: none; padding: 0; margin: 12px 0 0; }
.lista-carrinho li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borda); }
.lc-info { flex: 1; min-width: 0; }
.lc-nome { font-weight: 600; }
.lc-detalhe { color: var(--cinza); font-size: .82rem; }
.lc-preco { font-weight: 700; white-space: nowrap; }
.vazio { color: var(--cinza); text-align: center; padding: 24px 0; }

.campo { display: block; margin-bottom: 10px; }
.campo span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--borda); border-radius: 10px;
  background: var(--branco); font-size: 16px; /* evita zoom no iPhone */
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--principal); border-color: transparent; }
.campo.invalido input, .campo.invalido select { border-color: #d92d20; background: #fff5f5; }
.linha { display: flex; gap: 10px; }
.cresce { flex: 1; }
.curto { width: 100px; }

.opcoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.opcao {
  padding: 12px 8px; border: 2px solid var(--borda); border-radius: 12px; background: var(--branco);
  font-weight: 600; text-align: center; font-size: .92rem;
}
.opcao small { display: block; font-weight: 500; color: var(--cinza); font-size: .75rem; margin-top: 2px; }
.opcao.marcada { border-color: var(--principal); background: color-mix(in srgb, var(--principal) 8%, white); }
.caixa-pix {
  margin-top: 10px; padding: 12px; border-radius: 10px; background: #f3faf6; border: 1px dashed #8fd1a9; font-size: .9rem;
}
.caixa-pix code { font-size: 1rem; font-weight: 700; word-break: break-all; }
.caixa-pix button { margin-top: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid #8fd1a9; background: var(--branco); font-weight: 600; }

.resumo { margin-top: 16px; padding: 12px; border-radius: 12px; background: var(--fundo); }
.resumo div { display: flex; justify-content: space-between; padding: 2px 0; }
.resumo .total { font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--borda); margin-top: 6px; padding-top: 8px; }
.erro { color: #b42318; background: #fde8e8; padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin: 12px 0 0; }

.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom));
  background: #222; color: #fff; padding: 10px 16px; border-radius: 99px; font-size: .9rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
#bloco-endereco, #campo-troco { margin-top: 12px; }
.link-whats { display: block; text-align: center; margin: 0 0 16px; color: var(--whats); font-weight: 700; }
