:root {
  --brand: #5b1f8a;
  --brand-soft: #f3ebfa;
  --bg: #f6f4f8;
  --card: #fff;
  --text: #1e1b24;
  --muted: #6d6676;
  --line: #e8e3ee;
  --ok: #1f8a4c;
  --ok-soft: #e7f6ed;
  --bad: #c0392b;
  --bad-soft: #fdecea;
  --warn: #8a5a0c;
  --warn-soft: #fdf3e1;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 16px; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.loading { padding: 80px 20px; text-align: center; color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; }

/* topo: capa, foto de perfil e dados da loja */
.cover { height: 180px; background: var(--brand); position: relative; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-head { position: relative; padding: 0 16px 6px; }
.store-head .logo { position: absolute; top: -46px; left: 16px; }
.logo { width: 92px; height: 92px; border-radius: 50%; flex: none; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 34px; font-weight: 800; overflow: hidden; border: 4px solid #fff; box-shadow: 0 2px 10px rgba(20, 10, 40, .15); }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.store-title { padding: 54px 0 0; }
.store-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.about { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; white-space: pre-line; }
.facts { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; }
.facts::-webkit-scrollbar { display: none; }
.fact { flex: none; display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 13px; }
.fact .fi { font-size: 20px; }
.fact b { display: block; font-size: 13px; }
.fact span span { color: var(--muted); }
.area-line { margin-top: 10px; font-size: 13px; color: var(--muted); }
.area-line b { color: var(--text); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pill.open { background: var(--ok-soft); color: var(--ok); }
.pill.closed { background: var(--bad-soft); color: var(--bad); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.notice { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 14px; }
.notice.closed { background: var(--bad-soft); color: var(--bad); }
.wrap.notice { margin: 12px auto 0; width: calc(100% - 32px); }
.my-orders { padding: 10px 16px 0; display: flex; flex-direction: column; gap: 2px; }

/* banners em carrossel */
.banners-wrap { padding: 16px 16px 0; }
.banners { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 14px; scrollbar-width: none; }
.banners::-webkit-scrollbar { display: none; }
.banner { flex: 0 0 100%; scroll-snap-align: start; border: 0; padding: 0; background: var(--brand-soft); aspect-ratio: 3 / 1; cursor: pointer; }
.banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots span { width: 7px; height: 7px; border-radius: 999px; background: #d6cde0; transition: width .2s; }
.dots span.on { width: 18px; background: var(--brand); }

/* categorias e busca */
.cats { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0 0; margin-top: 8px; border-bottom: 1px solid var(--line); }
.search { margin: 0 16px 8px; position: relative; }
.search span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px 11px 38px; background: #fff; font-size: 16px; }
.cats-row { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px; scrollbar-width: none; }
.cats-row::-webkit-scrollbar { display: none; }
.cat-btn { flex: none; border: 0; border-bottom: 3px solid transparent; background: none; padding: 10px 10px 9px; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.cat-btn.on { color: var(--brand); border-bottom-color: var(--brand); }

/* produtos */
section.cat { padding: 8px 16px 4px; scroll-margin-top: 112px; }
section.cat h2 { font-size: 19px; margin: 16px 0 10px; }
.items { display: grid; gap: 10px; }
.item { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 14px; align-items: center; cursor: pointer; min-height: 96px; }
.item:hover { border-color: #d6cde0; box-shadow: 0 2px 10px rgba(20, 10, 40, .06); }
.item:active { background: var(--brand-soft); }
.item-body { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; }
.item-name { font-weight: 700; font-size: 16px; }
.item-desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-price { font-weight: 800; color: var(--text); margin-top: auto; padding-top: 8px; }
.item-price span { font-weight: 500; font-size: 13px; color: var(--muted); }
.item-img { width: 104px; height: 104px; border-radius: 12px; object-fit: cover; flex: none; background: var(--brand-soft); }
.item.has-img { padding: 12px 12px 12px 14px; }
.item-plus { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; }
.footer { text-align: center; font-size: 13px; color: var(--muted); padding: 28px 16px 120px; display: flex; flex-direction: column; gap: 4px; }
.footer b { color: var(--text); }
.footer a { color: var(--brand); font-weight: 600; text-decoration: none; }

/* produto aberto: foto grande no topo */
.x.float { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
.pp-img { width: calc(100% + 32px); margin: -14px -16px 0; aspect-ratio: 4 / 3; max-height: 46vh; object-fit: cover; display: block; border-radius: 20px 20px 0 0; }
.pp-title h2 { font-size: 21px; padding-right: 40px; }
.pp-title p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; white-space: pre-line; }
.pp-price { margin-top: 8px; font-weight: 800; font-size: 18px; color: var(--brand); }
.pp-title.no-img { padding-top: 4px; }

/* mais informações */
.info-body .hour.today { font-weight: 800; color: var(--text); }
.info-body .row2 { display: flex; justify-content: space-between; padding: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
a.btn { text-decoration: none; color: var(--text); text-align: center; }
.btn.center { display: block; text-align: center; }

/* computador: produtos em duas colunas */
@media (min-width: 900px) {
  .wrap { max-width: 1040px; }
  .cover { height: 260px; }
  .store-head .logo { top: -60px; width: 120px; height: 120px; }
  .store-title { padding-top: 70px; }
  .items { grid-template-columns: 1fr 1fr; }
}

/* sacola flutuante */
.bagbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(246, 244, 248, .95) 30%); z-index: 10; }
.bagbar button { max-width: 688px; margin: 0 auto; width: 100%; display: flex; justify-content: space-between; align-items: center; border: 0; border-radius: 14px; padding: 15px 18px; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.bagbar .count { background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 2px 9px; margin-right: 8px; }

/* painel inferior (produto, sacola, checkout) */
#sheet { position: fixed; inset: 0; z-index: 20; }
.backdrop { position: absolute; inset: 0; background: rgba(15, 5, 30, .5); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow: hidden; background: #fff; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.panel-head { padding: 16px 16px 10px; display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 19px; flex: 1; }
.x { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none; }
.panel-body { overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }

.group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.group-head { background: var(--bg); padding: 10px 14px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.group-head h3 { font-size: 15px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #ece8f1; color: var(--muted); white-space: nowrap; }
.tag.req { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.opt { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; user-select: none; }
.opt.on { background: var(--brand-soft); }
.opt.on .opt-name { font-weight: 700; }
.opt-price { font-size: 14px; color: var(--muted); }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c4b8d0; }
.opt.on .radio { border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 45%, #fff 50%); }
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qb { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--brand); }
.qb:disabled { opacity: .35; }
.qty b { min-width: 18px; text-align: center; }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=tel], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: #fff; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; min-height: 64px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-addr { display: grid; grid-template-columns: 1fr 100px; gap: 10px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 16px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; flex: 1; display: flex; justify-content: space-between; }
.btn.primary.center { justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--brand); font-weight: 700; cursor: pointer; padding: 4px 0; }
.link.danger { color: var(--bad); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 11px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: pointer; font-weight: 600; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice input { accent-color: var(--brand); width: 18px; height: 18px; }

.bag-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bag-item:last-child { border-bottom: 0; }
.bag-item .sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.bag-item .acts { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 15px; }
.sum .total { font-size: 20px; font-weight: 800; }
.section-title { font-size: 15px; font-weight: 800; margin-bottom: -4px; }

/* acompanhamento */
.track { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 6px rgba(20, 10, 40, .06); }
.big-status { text-align: center; }
.big-status .emoji { font-size: 46px; }
.big-status h1 { font-size: 22px; margin-top: 6px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding-bottom: 14px; position: relative; color: var(--muted); }
.steps li::before { content: ''; position: absolute; left: 13px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps .b { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; font-size: 14px; z-index: 1; }
.steps li.done { color: var(--text); }
.steps li.done .b { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps li.done::before { background: var(--brand); }
.steps li.now { color: var(--text); font-weight: 700; }
.steps li.now .b { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 30; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.t { background: #231431; color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); text-align: center; }
.t.err { background: var(--bad); }

/* Itens do painel não encolhem: o painel rola em vez de espremer os grupos. */
.panel-body > * { flex-shrink: 0; }

/* Elementos escondidos continuam escondidos mesmo com display definido acima. */
[hidden] { display: none !important; }

/* ---------- endereço no mapa, cupom e Pix ---------- */
.map { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #eef0f3; z-index: 0; }
.km-box { font-size: 14px; font-weight: 700; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); margin-top: -6px; }
.km-box.ok { background: var(--ok-soft); color: var(--ok); }
.km-box.bad { background: var(--bad-soft); color: var(--bad); }
.row-cep { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.row-cep .btn { padding: 12px 12px; white-space: nowrap; }
.choice span { flex: 1; }
.pix-box { text-align: center; }
.pix-box .qr { display: grid; place-items: center; margin: 4px 0 10px; }
.pix-box textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin-bottom: 10px; word-break: break-all; }
.gps-btn { width: 100%; text-align: center; color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
