:root {
  --brand: #B3261E;
  --ink: #1d1b1a;
  --muted: #6b6560;
  --line: #ebe6e0;
  --bg: #faf8f5;
  --card: #ffffff;
  --ok: #1e7a3c;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 16px; line-height: 1.4; }
button { font: inherit; color: inherit; }
.loading, .error { padding: 48px 24px; text-align: center; color: var(--muted); }

/* Testata */
.hero { background: var(--brand); color: #fff; padding: calc(28px + env(safe-area-inset-top)) 20px 22px; }
.hero.has-cover { background-size: cover; background-position: center; position: relative; }
.hero.has-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.65)); }
.hero > * { position: relative; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-logo { width: 56px; height: 56px; border-radius: 12px; background: #fff; object-fit: cover; flex: none; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.hero p { margin: 4px 0 0; opacity: .9; font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; background: rgba(255,255,255,.16); padding: 5px 10px; border-radius: 999px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7ee2a0; }
.status.closed::before { background: #ffb4a9; }

.wrap { max-width: 720px; margin: 0 auto; }

/* Consegna / ritiro */
.mode { display: flex; gap: 6px; margin: 16px 16px 0; background: #efebe6; padding: 4px; border-radius: 12px; }
.mode button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mode button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.mode-note { margin: 8px 18px 0; font-size: 13px; color: var(--muted); }

.loyalty { margin: 14px 16px 0; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.loyalty strong { color: var(--brand); }

/* Categorie */
.cats { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 10px; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: none; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.cats a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

section.category { padding: 8px 16px 4px; scroll-margin-top: 64px; }
section.category h2 { font-size: 20px; margin: 18px 2px 2px; }
section.category .cat-desc { margin: 0 2px 10px; color: var(--muted); font-size: 14px; }

.product { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; cursor: pointer; }
.product:active { transform: scale(.995); }
.product .info { flex: 1; min-width: 0; }
.product .name { font-weight: 650; font-size: 16px; }
.product .desc { color: var(--muted); font-size: 14px; margin-top: 3px; }
.product .price { margin-top: 8px; font-weight: 600; }
.product img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; }
.product.soldout { opacity: .55; cursor: default; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eee; color: var(--muted); margin-left: 6px; vertical-align: middle; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 16px 120px; }

/* Barra carrello */
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 696px; margin: 0 auto; z-index: 20; display: flex; justify-content: space-between; align-items: center; border: 0; background: var(--brand); color: #fff; padding: 15px 18px; border-radius: 14px; font-weight: 650; font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer; }
.cart-bar .count { background: rgba(255,255,255,.2); border-radius: 8px; padding: 2px 9px; margin-right: 10px; }

/* Pannello a scomparsa */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 92vh; max-width: 720px; margin: 0 auto; background: #fff; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { padding: 18px 20px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.sheet-head h3 { margin: 0; font-size: 20px; flex: 1; }
.sheet-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.close { border: 0; background: #f1eeea; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 20px 16px; }
.sheet-foot { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }

.group { margin-top: 18px; }
.group h4 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; }
.group h4 small { font-weight: 500; color: var(--muted); }
.choice { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f2efeb; cursor: pointer; }
.choice:last-child { border-bottom: 0; }
.choice input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin: 0; }
.choice span { flex: 1; }
.choice em { font-style: normal; color: var(--muted); font-size: 14px; }
.removed span { text-decoration: line-through; color: var(--muted); }
.extras-toggle { border: 1px dashed var(--line); background: #fff; width: 100%; padding: 11px; border-radius: 10px; font-weight: 600; color: var(--brand); cursor: pointer; margin-top: 6px; }
select { width: 100%; font: inherit; padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--line); resize: vertical; min-height: 60px; }

.qty { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; }
.qty button { width: 40px; height: 44px; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.qty b { min-width: 22px; text-align: center; }
.primary { flex: 1; border: 0; background: var(--brand); color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 650; font-size: 16px; cursor: pointer; display: flex; justify-content: space-between; }
.primary[disabled] { opacity: .5; cursor: default; }

/* Carrello */
.cart-item { padding: 14px 0; border-bottom: 1px solid #f2efeb; display: flex; gap: 12px; }
.cart-item .ci-info { flex: 1; }
.cart-item .ci-name { font-weight: 650; }
.cart-item .ci-det { color: var(--muted); font-size: 13px; margin-top: 3px; }
.cart-item .ci-price { font-weight: 600; white-space: nowrap; }
.cart-item .qty button { width: 34px; height: 34px; font-size: 18px; }
.totals { margin-top: 14px; font-size: 15px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.notice { background: #fff6e5; border: 1px solid #f3dfb5; color: #6b4b00; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 14px; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

@media (min-width: 720px) {
  .hero { padding-left: calc(50vw - 340px); padding-right: calc(50vw - 340px); }
}

/* Completamento ordine */
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .inline input { width: 100%; font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.field input:focus, .inline input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.row2 { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.inline { display: flex; gap: 8px; }
.secondary { border: 1px solid var(--line); background: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.secondary.wide { display: block; width: calc(100% - 32px); margin: 18px 16px 40px; }
.hint { font-size: 14px; margin: 6px 0 0; color: var(--muted); }
.hint.ok { color: var(--ok); }
.hint.err { color: #b3261e; }
.notice.err { background: #fdecea; border-color: #f5c2bd; color: #8c1d18; }

/* Pagina stato ordine */
.order-page { padding: 0 16px; }
.order-status { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.order-status .big { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: var(--ok); }
.order-status.bad .big { color: #b3261e; }
.steps { list-style: none; padding: 0; margin: 16px 0 0; }
.steps li { position: relative; padding: 8px 0 8px 30px; color: var(--muted); }
.steps li::before { content: ""; position: absolute; left: 6px; top: 13px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #cfc8c0; background: #fff; }
.steps li.done { color: var(--ink); font-weight: 600; }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.card { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h4 { margin: 0 0 8px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.line small { display: block; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.hero-btn { margin-top: 14px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.loyalty-card .pts { font-size: 15px; }
.loyalty-card .pts b { font-size: 34px; color: var(--brand); }
.bar { height: 10px; background: #efe9e3; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.small { font-size: 13px; }
.pushbox { margin: 14px 16px 0; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-size: 14px; }
.pushbox span { flex: 1; }
.pushbox button { border: 0; background: var(--brand); color: #fff; padding: 9px 12px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pushbox.on button { background: #f1eeea; color: var(--ink); }
