:root {
  --primary: #e4572e;
  --primary-ink: #fff;
  --primary-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f1eeea;
  --text: #1f1b17;
  --muted: #6f675f;
  --border: #e6e0d9;
  --success: #1f9d55;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --surface: #1f1b17;
    --surface-2: #2a251f;
    --text: #f3eee8;
    --muted: #a99f94;
    --border: #3a332b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 15px;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strike { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; font-weight: 600;
  text-decoration: none; transition: transform .08s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 20px; font-size: 16px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; font-size: 18px;
}

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { resize: vertical; min-height: 70px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-2.keep { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.pin-input { letter-spacing: 14px; font-size: 26px; text-align: center; font-weight: 700; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.green { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge.red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.orange { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.badge.blue { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 10, 5, .55); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 20px; } }
.modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: hidden;
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: slideUp .2s ease-out;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) { .modal { border-radius: 20px; } }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }

/* ---------- toast ---------- */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; animation: slideUp .2s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 8px; }

/* ====================== CARDÁPIO (cliente) ====================== */
.app-header {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.app-header .inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.user-btn { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
@media (max-width: 520px) { .user-btn .label { display: none; } }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.hero { position: relative; height: 210px; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,.05)); }
.store-card { position: relative; z-index: 2; margin-top: -70px; }
.store-card .card { display: flex; flex-direction: column; gap: 10px; }
.store-card h1 { font-size: 24px; }
.store-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; color: var(--muted); }

.mode-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.mode-switch button { border: 0; background: transparent; padding: 10px 8px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.mode-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.table-banner { background: var(--primary); color: var(--primary-ink); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-banner .btn { background: rgba(255,255,255,.18); border-color: transparent; color: inherit; }

.menu-toolbar { position: sticky; top: 58px; z-index: 40; background: var(--bg); padding: 12px 0 10px; }
.search { position: relative; }
.search input { padding-left: 40px; }
.search::before { content: '🔍'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .6; }
.cat-nav-wrap { position: relative; margin-top: 10px; }
.cat-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-behavior: smooth; cursor: grab; -webkit-overflow-scrolling: touch; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav.dragging { cursor: grabbing; scroll-behavior: auto; user-select: none; }
.cat-nav.dragging .chip { pointer-events: none; }
/* setas + esmaecido nas bordas, só quando há mais categorias naquele lado */
.cat-arrow {
  position: absolute; top: 0; bottom: 2px; z-index: 2; width: 44px; border: 0; padding: 0;
  font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); cursor: pointer;
  display: none; align-items: center;
}
.cat-arrow.left { left: 0; justify-content: flex-start; background: linear-gradient(to right, var(--bg) 55%, transparent); }
.cat-arrow.right { right: 0; justify-content: flex-end; background: linear-gradient(to left, var(--bg) 55%, transparent); }
.cat-arrow:hover { color: var(--primary); }
.cat-nav-wrap.can-left .cat-arrow.left, .cat-nav-wrap.can-right .cat-arrow.right { display: flex; }

.section-title { font-size: 20px; font-weight: 800; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; scroll-margin-top: 150px; }
.featured-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 260px); gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.feat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); }
.feat-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--surface-2); }
.feat-card .body { padding: 10px 12px; }
.feat-card .name { font-weight: 700; }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
@media (max-width: 400px) { .products { grid-template-columns: 1fr; } }
.product {
  display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; cursor: pointer; transition: transform .1s, box-shadow .15s; position: relative;
}
.product:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.product .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product .name { font-weight: 700; font-size: 16px; }
.product .desc { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .price { margin-top: auto; font-weight: 800; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.product .price .promo { color: var(--success); }
.product .thumb { width: 112px; height: 112px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.product.unavailable { opacity: .55; cursor: not-allowed; }
.product .qty-badge { position: absolute; top: 8px; right: 8px; background: var(--primary); color: #fff; font-weight: 800; border-radius: 999px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; padding: 0 7px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* produto - modal */
.product-modal .modal-body { padding: 0; }
.pm-image { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--surface-2); }
.pm-content { padding: 18px; }
.pm-content h2 { font-size: 22px; margin-bottom: 6px; }
.opt-group { margin-top: 18px; }
.opt-head { display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; margin-bottom: 4px; }
.opt-head .title { font-weight: 700; }
.opt-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); cursor: pointer; }
.opt-item:last-child { border-bottom: 0; }
.opt-item input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
.opt-item .price { margin-left: auto; color: var(--muted); font-weight: 600; white-space: nowrap; }
.opt-item.disabled { opacity: .45; cursor: not-allowed; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button { width: 40px; height: 42px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--primary); font-weight: 700; }
.stepper button:disabled { color: var(--muted); cursor: default; }
.stepper span { min-width: 30px; text-align: center; font-weight: 800; }
.stepper.sm button { width: 32px; height: 32px; font-size: 17px; }

/* barra do carrinho */
.cart-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60;
  width: min(calc(100% - 24px), 560px); background: var(--primary); color: var(--primary-ink);
  border: 0; border-radius: 16px; padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: var(--shadow-lg); animation: slideUp .2s;
}
.cart-bar .count { background: rgba(255,255,255,.22); border-radius: 8px; padding: 2px 9px; }
.cart-bar .total { margin-left: auto; }
body.has-cart-bar main { padding-bottom: 100px; }

/* páginas */
.page { max-width: 720px; margin: 0 auto; padding: 18px 16px 120px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.cart-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: 0; }
.cart-item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.cart-item .opts { font-size: 13px; color: var(--muted); }
.totals .line { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .line.total { font-size: 18px; font-weight: 800; padding-top: 10px; margin-top: 6px; border-top: 1px dashed var(--border); }
.totals .line.discount { color: var(--success); }

.select-list { display: flex; flex-direction: column; gap: 8px; }
.select-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; cursor: pointer; background: var(--surface); text-align: left; width: 100%;
}
.select-card.active { border-color: var(--primary); background: var(--primary-soft); }
.select-card .ico { font-size: 22px; line-height: 1; }
.select-card .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; margin-top: 2px; }
.select-card.active .radio { border: 6px solid var(--primary); }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay-grid .select-card { align-items: center; }

.address-card { display: flex; gap: 12px; align-items: flex-start; }
.address-card .actions { display: flex; gap: 4px; margin-left: auto; }

/* acompanhamento do pedido */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; font-size: 15px; z-index: 1; }
.timeline li.done .dot { background: var(--success); color: #fff; }
.timeline li.done::before { background: var(--success); }
.timeline li.current .dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 6px var(--primary-soft); animation: pulse 1.6s infinite; }
.timeline li .t { font-weight: 700; }
.timeline li:not(.done):not(.current) .t { color: var(--muted); font-weight: 500; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px transparent; } }
.status-hero { text-align: center; padding: 10px 0 4px; }
.status-hero .emoji { font-size: 54px; }
.status-hero h2 { font-size: 22px; margin-top: 6px; }
.order-code { font-family: ui-monospace, monospace; font-weight: 800; letter-spacing: 1px; }

.order-list-item { display: flex; gap: 12px; align-items: center; padding: 14px; cursor: pointer; }
.order-list-item + .order-list-item { border-top: 1px solid var(--border); }

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