:root {
  --bg: #fff8ec;
  --surface: #ffffff;
  --surface-2: #fbeed7;
  --line: #ecdcc2;
  --text: #231f20;
  --muted: #6f655c;
  --accent: #d71e1e;
  --accent-ink: #ffffff;
  --accent-2: #ffc72c;
  --ok: #1e8e3e;
  --danger: #c62828;
  --whats: #25d366;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 118px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 96px;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Banner */
.banner { position: relative; width: 100%; aspect-ratio: 3 / 1; overflow: hidden; background: var(--surface); }
.banner img#banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner:not([hidden]) + .topo { margin-top: -28px; padding-top: 0; align-items: flex-start; }
.banner:not([hidden]) + .topo .topo-info { padding-top: 32px; }
.banner:not([hidden]) + .topo .logo { box-shadow: 0 2px 10px rgba(35, 31, 32, .3); }

.banner-compartilhar {
  position: absolute; right: 18px; top: 62%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(35, 31, 32, .45); color: rgba(255, 255, 255, .9);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(1px);
}

/* Topo */
.topo {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 16px; padding-top: max(16px, env(safe-area-inset-top));
}
.logo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-2); background: var(--surface); }
.topo h1 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.status { margin: 2px 0 0; font-size: .875rem; color: var(--muted); }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--danger); }
.status.aberto::before { background: var(--ok); }

.faixa {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  padding: 0 16px 12px; font-size: .8125rem; color: var(--muted);
}

.busca-wrap { position: sticky; top: 0; z-index: 11; background: var(--bg); padding: 10px 16px 12px; }
#busca {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
}
#busca::placeholder { color: var(--muted); }
#busca:focus, .form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* Abas de categoria */
.abas {
  position: sticky; top: 71px; z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 16px; background: var(--bg); border-bottom: 2px solid var(--accent-2);
}
.abas::-webkit-scrollbar { display: none; }
.aba {
  flex: none; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .875rem;
}
.aba.ativa { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Lista */
.lista { padding: 0 16px; max-width: 760px; margin: 0 auto; }
.categoria h2 { margin: 24px 0 12px; font-size: 1.125rem; }
.vazio { text-align: center; color: var(--muted); padding: 32px 16px; }

.card {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 12px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(35, 31, 32, .06);
}
.card.sem-estoque { opacity: .55; }
.card-texto { min-width: 0; }
.card-nome { margin: 0; font-size: 1rem; font-weight: 600; }
.card-desc {
  margin: 4px 0 0; font-size: .8125rem; color: var(--muted); white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foto { grid-column: 2; grid-row: 1 / span 2; width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.card-rodape { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.card:has(.card-foto) .card-rodape { grid-column: 1; }
.preco { font-weight: 700; font-size: 1.0625rem; }
.card.sem-estoque .preco { text-decoration: line-through; color: var(--muted); }
.esgotado { font-size: .75rem; color: var(--danger); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.btn-add {
  padding: 8px 18px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.stepper { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 10px; }
.stepper button {
  width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.25rem; font-weight: 700; color: var(--accent);
}
.stepper span { min-width: 24px; text-align: center; font-weight: 700; }

/* Rodapé */
.rodape { max-width: 760px; margin: 32px auto 0; padding: 16px; text-align: center; font-size: .8125rem; color: var(--muted); }
.rodape p { margin: 0 0 6px; }
.rodape-powered { margin: 16px 0 0 !important; padding-top: 12px; border-top: 1px solid var(--line); font-size: .75rem; letter-spacing: .04em; }
.rodape-powered a { color: var(--accent); font-weight: 700; text-decoration: none; }

/* Barra do carrinho */
.barra-carrinho {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 40%);
}
.barra-carrinho button {
  width: 100%; max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.barra-carrinho button span:nth-child(2) { flex: 1; text-align: left; }
.barra-qtd { background: var(--accent-ink); color: var(--accent); min-width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .875rem; font-weight: 700; }

/* Dialogs */
dialog { color: var(--text); border: 0; padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0;
  background: var(--bg); border-radius: 20px 20px 0 0; overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet-topo { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); margin: 0; }
.sheet-topo h2 { margin: 0; font-size: 1.125rem; }
.fechar { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface); font-size: 1.5rem; line-height: 1; }
.sheet-corpo { overflow-y: auto; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }

.itens-carrinho { list-style: none; margin: 0 0 16px; padding: 0; }
.itens-carrinho li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item-info { flex: 1; min-width: 0; }
.item-info b { display: block; font-weight: 600; font-size: .9375rem; }
.item-info small { color: var(--muted); }

.totais { margin-bottom: 20px; }
.totais > div { display: flex; justify-content: space-between; font-size: 1.0625rem; }
.nota { margin: 6px 0 0; font-size: .8125rem; color: var(--muted); }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .875rem; color: var(--muted); }
.form input:not([type=radio]), .form select, .form textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 1rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.opcoes { border: 0; margin: 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.opcoes legend { font-size: .875rem; color: var(--muted); margin-bottom: 8px; padding: 0; }
.opcoes label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; }
.opcoes input { accent-color: var(--accent); width: 20px; height: 20px; }
#campos-entrega { display: grid; gap: 14px; }
.erro { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(198, 40, 40, .1); color: var(--danger); font-size: .875rem; }

.btn-whats {
  padding: 14px 16px; border: 0; border-radius: var(--radius);
  background: var(--whats); color: #04210f; font-weight: 700; font-size: 1rem;
}
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px; }


:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
