/* ============================================================
   Estilos públicos — cardápio, produto, carrinho, checkout
   Cores da marca vêm de assets/css/tema.php (--primary e derivados).
   Aqui ficam os tokens estruturais, iguais para todas as lojas.
   ============================================================ */

:root {
  /* Neutros */
  --bg:            #FFFFFF;
  --surface:       #F5F5F4;
  --surface-2:     #EEEDEB;
  --border:        #E7E5E4;
  --text:          #1C1917;
  --text-2:        #57534E;
  --text-3:        #8A8580;

  /* Semânticas */
  --promo:         #D9343A;
  --promo-soft:    #FDECEC;
  --success:       #15803D;
  --success-soft:  #E8F5EC;
  --error:         #C62828;
  --error-soft:    #FDECEC;
  --warning:       #B45309;
  --warning-soft:  #FEF5E7;
  --whatsapp:      #1FAF54;
  --whatsapp-hover:#19994A;

  /* Fallbacks da marca — sobrescritos por tema.php */
  --primary:       #3B82F6;
  --primary-hover: #3677E2;
  --primary-soft:  #EBF3FE;
  --primary-ink:   #3B82F6;
  --on-primary:    #FFFFFF;

  /* Forma */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-pill: 999px;
  --shadow-float: 0 4px 16px rgba(28, 25, 23, .10);
  --shadow-top:   0 -2px 12px rgba(28, 25, 23, .08);

  /* Layout */
  --header-h: 56px;
  --gutter:   16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: .15s ease;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 64px); }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; color: var(--text); }
p { color: var(--text-2); }
:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only, .sr-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: 640px; }
.page { padding-top: 20px; padding-bottom: 40px; }
.page-title { font-size: 1.375rem; margin-bottom: 4px; }
.page-subtitle { font-size: .9375rem; margin-bottom: 20px; }

/* ── Botões ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: var(--r-md); font-size: .9375rem; font-weight: 600; line-height: 1; white-space: nowrap; transition: background var(--ease), border-color var(--ease), transform var(--ease); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary, .btn-outline { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover, .btn-outline:hover { background: var(--surface); }
.btn-ghost { color: var(--text-2); padding: 0 12px; }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: var(--whatsapp-hover); }
.btn-sm { height: 36px; padding: 0 14px; font-size: .875rem; border-radius: var(--r-sm); }
.btn-lg { height: 52px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-danger-link { color: var(--error); font-size: .875rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-danger-link .icon { width: 16px; height: 16px; }

/* ── Badges e preço ───────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-promo { background: var(--promo-soft); color: var(--promo); }
.badge-neutral { background: var(--surface); color: var(--text-2); }
.badge-brand { background: var(--primary-soft); color: var(--primary-ink); }
.price { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.price-promo { color: var(--promo); }
.price-old { font-size: .8125rem; color: var(--text-3); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.price-from { font-size: .8125rem; color: var(--text-2); font-weight: 400; }

/* ── Header ───────────────────────────────────────────────── */
.app-header { position: sticky; top: 0; z-index: 100; height: var(--header-h); background: var(--bg); border-bottom: 1px solid var(--border); }
.app-header .container { height: 100%; display: flex; align-items: center; gap: 8px; }
.header-back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -12px; border-radius: var(--r-pill); color: var(--text); }
.header-back:hover { background: var(--surface); }
.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.header-brand { transition: opacity var(--ease); }
.app-header.brand-hidden .header-brand { opacity: 0; visibility: hidden; }
.header-brand-name { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-cart { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -6px; border-radius: var(--r-pill); color: var(--text); }
.header-cart:hover { background: var(--surface); }
.header-cart .icon { width: 24px; height: 24px; }
.cart-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); font-size: .6875rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); box-sizing: content-box; }
.cart-count.hidden { display: none; }

/* Logo (imagem ou inicial do nome) */
.logo { flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--r-pill); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .875rem; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.logo.has-img { background: var(--bg); border: 1px solid var(--border); }
.logo-lg { width: 56px; height: 56px; font-size: 1.375rem; }

/* ── Alertas (flash e avisos) ─────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: .875rem; font-weight: 500; margin-bottom: 16px; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error   { background: var(--error-soft);   color: var(--error); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.flash-wrap { padding-top: 12px; }
.flash-wrap .alert { margin-bottom: 0; }

/* ── Cartão da loja (compacto) ────────────────────────────── */
.store { padding: 16px 0 12px; display: flex; gap: 12px; align-items: center; }
.store-info { min-width: 0; }
.store-name { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.store-slogan { font-size: .875rem; color: var(--text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.store-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: .8125rem; color: var(--text-3); }
.store-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.store-meta .icon { width: 14px; height: 14px; }
.store-notice { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary-ink); font-size: .8125rem; font-weight: 500; }
.store-notice .icon { width: 16px; height: 16px; }

/* Aberto / fechado */
.store-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .8125rem; font-weight: 600; }
.store-status-dot { width: 8px; height: 8px; border-radius: var(--r-pill); background: currentColor; }
.store-status.is-aberta { color: var(--success); }
.store-status.is-fechada { color: var(--error); }
.store-notice-fechada { background: var(--surface); color: var(--text-2); }
.btn.is-desabilitado { opacity: .5; cursor: not-allowed; pointer-events: none; }
.summary-note-fechada { color: var(--text-2); }

/* ── Busca ────────────────────────────────────────────────── */
.search { position: relative; margin-bottom: 4px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 44px; padding: 0 16px 0 44px; border: 1px solid transparent; border-radius: var(--r-md); background: var(--surface); font-size: 1rem; outline: none; transition: border-color var(--ease), background var(--ease); -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--text-3); }
.search input:focus { background: var(--bg); border-color: var(--primary-ink); }
.search input::-webkit-search-cancel-button { display: none; }

/* ── Navegação de categorias (pills fixas) ────────────────── */
.cat-nav { position: sticky; top: var(--header-h); z-index: 90; background: var(--bg); border-bottom: 1px solid var(--border); }
.cat-nav-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 10px var(--gutter); max-width: 1040px; margin: 0 auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-nav-scroll::-webkit-scrollbar { display: none; }
.cat-pill { position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); font-size: .875rem; font-weight: 600; white-space: nowrap; transition: background var(--ease), color var(--ease); }
.cat-pill::before { content: ''; position: absolute; inset: -4px 0; }
.cat-pill:hover { background: var(--surface-2); color: var(--text); }
.cat-pill.active { background: var(--text); color: var(--bg); }
.cat-pill .icon { width: 16px; height: 16px; }

/* ── Trilhos horizontais (banners e promoções) ────────────── */
.rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); padding: 0 var(--gutter); margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex-shrink: 0; }
.banners { padding-top: 16px; }
.banner { width: 84%; max-width: 420px; border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.banner img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.banner-body { padding: 10px 12px 12px; }
.banner-title { font-size: .9375rem; font-weight: 600; color: var(--text); }
.banner-text { font-size: .8125rem; color: var(--text-2); margin-top: 2px; }
.banner.no-img { background: var(--primary-soft); display: flex; align-items: flex-end; min-height: 96px; }
.banner.no-img .banner-title { font-size: 1.0625rem; color: var(--primary-ink); }
.rail-only .banner { width: 100%; max-width: none; }

.mini-card { position: relative; width: 148px; }
.mini-card-media { aspect-ratio: 1 / 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.mini-card-media img { width: 100%; height: 100%; object-fit: cover; }
.mini-card .badge { position: absolute; top: 8px; left: 8px; }
.mini-card-name { font-size: .875rem; font-weight: 600; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card-price { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; font-size: .875rem; }

/* ── Cardápio ─────────────────────────────────────────────── */
.menu { padding-bottom: 32px; }
.menu-section { padding-top: 24px; }
.menu-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.menu-section-title { font-size: 1.125rem; }
.menu-section-count { font-size: .8125rem; color: var(--text-3); }
.menu-section .rail { padding-top: 8px; }
.product-list { display: grid; grid-template-columns: 1fr; }
.menu.is-searching [data-hide-on-search] { display: none; }

/* Card de produto (lista horizontal) */
.product-card { position: relative; display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.product-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.product-name { font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-name a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.product-desc { font-size: .875rem; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: auto; padding-top: 8px; }
.product-meta .price { font-size: 1rem; }
.product-card-media { position: relative; flex-shrink: 0; width: 104px; }
.product-thumb { width: 104px; height: 104px; border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .badge { margin-bottom: 6px; align-self: flex-start; }
.product-card:hover .product-name { color: var(--primary-ink); }
.product-card.no-img .product-card-media { width: auto; align-self: flex-end; }

/* Botão + (fica acima do link que cobre o card) */
.card-add-form { display: contents; }
.btn-add { position: absolute; right: -4px; bottom: -4px; z-index: 2; width: 36px; height: 36px; border-radius: var(--r-pill); background: var(--bg); color: var(--primary-ink); border: 1px solid var(--border); box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center; transition: background var(--ease), color var(--ease), transform var(--ease); }
.btn-add::before { content: ''; position: absolute; inset: -4px; }
.btn-add:hover { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-add:active { transform: scale(.94); }
.product-card.no-img .btn-add { position: relative; right: auto; bottom: auto; }

/* ── Estados vazios ───────────────────────────────────────── */
.empty { text-align: center; padding: 40px 16px; max-width: 360px; margin: 0 auto; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: var(--r-pill); background: var(--surface); color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.empty-text { font-size: .875rem; margin-top: 4px; }
.empty .btn { margin-top: 16px; }
.empty-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-top: 16px; border-radius: var(--r-md); background: var(--surface); font-size: .875rem; color: var(--text-2); }
.empty-inline a { font-weight: 600; color: var(--primary-ink); white-space: nowrap; }

/* Imagem ausente (página do produto, carrinho, mini-card) */
.img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 1.5rem; opacity: .85; user-select: none; }
.img-placeholder .icon { width: 28px; height: 28px; }

/* ── Rodapé ───────────────────────────────────────────────── */
.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0 32px; font-size: .8125rem; color: var(--text-2); }
.app-footer-name { font-size: .9375rem; font-weight: 600; color: var(--text); }
.app-footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.app-footer-links a, .app-footer-links span { display: inline-flex; align-items: center; gap: 6px; }
.app-footer-links a:hover { color: var(--text); }
.app-footer-links .icon { width: 16px; height: 16px; }
.app-footer-copy { margin-top: 14px; color: var(--text-3); font-size: .75rem; }

/* ── Toast ────────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 1000; max-width: calc(100% - 32px); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-float); transition: opacity .2s ease, transform .2s ease, bottom .2s ease; display: flex; align-items: center; gap: 16px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-action { color: var(--bg); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
body.has-cart-bar .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

/* ── Página do produto ────────────────────────────────────── */
.product-page { padding-bottom: 40px; }
.product-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
.gallery { margin: 0 calc(var(--gutter) * -1); }
.gallery-main { aspect-ratio: 4 / 3; background: var(--surface); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .img-placeholder { font-size: 3rem; }
.gallery-thumbs { display: flex; gap: 8px; padding: 8px var(--gutter) 0; overflow-x: auto; scrollbar-width: none; }
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb { flex-shrink: 0; width: 56px; height: 56px; border-radius: var(--r-sm); overflow: hidden; border: 2px solid transparent; opacity: .7; transition: opacity var(--ease), border-color var(--ease); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover, .gallery-thumb.active { opacity: 1; border-color: var(--primary-ink); }

.product-detail-name { font-size: 1.375rem; overflow-wrap: anywhere; }
.product-detail-desc { font-size: .9375rem; margin-top: 8px; }
.product-detail-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px; }
.product-detail-price .price { font-size: 1.25rem; }
.product-detail .badge { margin-bottom: 8px; }

.option-group { margin-top: 24px; border: 0; padding: 0; min-width: 0; }
.option-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% + var(--gutter) * 2); padding: 10px 14px; margin: 0 calc(var(--gutter) * -1) 4px; background: var(--surface); }
.option-group-title { font-size: .9375rem; font-weight: 600; }
.option-group-hint { font-size: .75rem; color: var(--text-3); }
.option-list { display: flex; flex-direction: column; }
.variacao-btn { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.variacao-btn:last-child { border-bottom: none; }
.variacao-radio { flex-shrink: 0; width: 20px; height: 20px; border-radius: var(--r-pill); border: 2px solid var(--border); transition: border var(--ease); }
.variacao-btn input, .color-dot input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.variacao-btn input:checked + .variacao-radio { border: 6px solid var(--primary-ink); }
.variacao-btn input:focus-visible + .variacao-radio { box-shadow: 0 0 0 3px var(--primary-soft); }
.variacao-nome { flex: 1; font-size: .9375rem; font-weight: 500; }
.variacao-preco { text-align: right; font-size: .9375rem; }
.variacao-preco .price-old { display: block; }

.color-list { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 12px; }
.color-dot { position: relative; width: 32px; height: 32px; border-radius: var(--r-pill); border: 1px solid var(--border); cursor: pointer; transition: box-shadow var(--ease); }
.color-dot:has(input:checked) { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-ink); }
.color-dot:has(input:focus-visible) { outline: 2px solid var(--primary-ink); outline-offset: 4px; }

.combo-box { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 14px; }
.combo-title { font-size: .875rem; font-weight: 600; padding: 10px 0 4px; }
.combo-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .875rem; color: var(--text-2); border-bottom: 1px solid var(--border); }
.combo-row:last-child { border-bottom: none; }
.combo-row.total { font-weight: 600; color: var(--text); }

.buy-bar { margin-top: 24px; display: flex; gap: 12px; align-items: center; }
.buy-bar .btn { flex: 1; }
.qty-control { display: inline-flex; align-items: center; height: 44px; border: 1px solid var(--border); border-radius: var(--r-md); flex-shrink: 0; }
.qty-control button { width: 40px; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--primary-ink); }
.qty-control button .icon { width: 18px; height: 18px; }
.qty-control input { width: 32px; height: 100%; text-align: center; border: none; background: transparent; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.qty-control input::-webkit-outer-spin-button, .qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product-help { font-size: .8125rem; color: var(--text-3); margin-top: 12px; }

/* ── Carrinho ─────────────────────────────────────────────── */
.cart-layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.cart-list { border-top: 1px solid var(--border); }
.cart-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-item-img { flex-shrink: 0; width: 56px; height: 56px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-img .icon { width: 22px; height: 22px; }
.cart-item-body { flex: 1; min-width: 0; }
.cart-item-name { font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; }
.cart-item-attrs { font-size: .8125rem; color: var(--text-3); }
.cart-item-unit { font-size: .8125rem; color: var(--text-2); margin-top: 2px; }
.cart-item-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.cart-item-qty { display: inline-flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-2); }
.cart-item-qty input { width: 56px; height: 36px; text-align: center; border: 1px solid var(--border); border-radius: var(--r-sm); font-weight: 600; background: var(--bg); }
.cart-item-subtotal { font-size: .9375rem; }
.cart-item-remove { margin-top: 6px; }
.cart-footer-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

.summary { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.summary-title { font-size: 1rem; margin-bottom: 12px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; font-size: .875rem; color: var(--text-2); padding: 4px 0; }
.summary-row .price { font-weight: 500; color: var(--text-2); }
.summary-total { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--border); font-size: 1.0625rem; font-weight: 700; }
.summary-total .price { font-weight: 700; }
.summary .btn { margin-top: 16px; }
.summary-note { font-size: .75rem; color: var(--text-3); text-align: center; margin-top: 10px; }

/* ── Checkout ─────────────────────────────────────────────── */
.checkout-block { margin-bottom: 24px; }
.checkout-block-title { font-size: 1rem; margin-bottom: 12px; }
.order-lines { border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 14px; }
.order-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: .875rem; border-bottom: 1px solid var(--border); }
.order-line:last-child { border-bottom: none; }
.order-line-qty { color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 4px; }
.order-line-attrs { display: block; font-size: .8125rem; color: var(--text-3); }
.order-line.total { font-size: 1rem; font-weight: 700; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.form-group .optional { font-weight: 400; color: var(--text-3); }
.form-control { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); font-size: 1rem; outline: none; transition: border-color var(--ease), box-shadow var(--ease); }
textarea.form-control { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.form-control:focus { border-color: var(--primary-ink); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-control::placeholder { color: var(--text-3); }
.checkout-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.checkout-note { display: flex; gap: 8px; font-size: .8125rem; color: var(--text-2); margin-top: 4px; }
.checkout-note .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }

/* ── Conta opcional (entrar, minha conta, checkout) ───────── */
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #A61F1F; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9375rem; cursor: pointer; margin-bottom: 8px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary-ink); flex-shrink: 0; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 20px; border-radius: var(--r-md); background: var(--surface); }
.auth-tabs a { flex: 1; text-align: center; padding: 10px 12px; border-radius: var(--r-sm); font-size: .9375rem; font-weight: 600; color: var(--text-2); }
.auth-tabs a.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(28, 25, 23, .12); }
.auth .btn-full { margin-top: 8px; }
.auth-sem-conta { font-size: .875rem; color: var(--text-2); text-align: center; }
.auth-sem-conta a, .conta-nota a, .checkout-note a { color: var(--primary-ink); font-weight: 600; }

.conta-oferta { margin: 4px 0 16px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--r-md); }
.conta-oferta .form-group { margin: 4px 0 8px; }
.conta-pedindo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--surface); font-size: .9375rem; }
.conta-pedindo .icon { color: var(--primary-ink); }
.conta-pedindo span { flex: 1; color: var(--text-2); }
.conta-pedindo strong { color: var(--text); }
.conta-pedindo a { font-size: .875rem; font-weight: 600; color: var(--primary-ink); }

.conta-bloco { padding: 20px 0; border-top: 1px solid var(--border); }
.conta-bloco:first-of-type { border-top: 0; padding-top: 4px; }
.conta-destaque { padding: 16px; margin-bottom: 8px; border: 2px solid var(--primary-ink); border-radius: var(--r-lg); }
.conta-texto { font-size: .9375rem; margin-bottom: 12px; }
.conta-nota { font-size: .8125rem; color: var(--text-3); margin-top: 8px; }
.conta-pedidos { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.conta-pedido { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.conta-pedido-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conta-pedido-codigo { font-weight: 600; font-variant-numeric: tabular-nums; }
.conta-pedido-info { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: .875rem; color: var(--text-2); }
.conta-pedido-acoes { display: flex; gap: 8px; margin-top: 10px; }
.conta-pedido-acoes > * { flex: 1; }
.conta-pedido-acoes .btn { width: 100%; }
.conta-pedido-acoes .icon { width: 16px; height: 16px; }
.conta-excluir { margin-top: 16px; }
.conta-excluir summary { cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--error); padding: 8px 0; }
.conta-excluir[open] summary { margin-bottom: 8px; }
.empty-compacto { padding: 20px 16px; }
.header-conta.is-logado { color: var(--primary-ink); }

/* ── Pedido enviado ───────────────────────────────────────── */
.success { text-align: center; padding-top: 32px; padding-bottom: 40px; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: var(--r-pill); background: var(--success-soft); color: var(--success); display: flex; align-items: center; justify-content: center; }
.success-icon .icon { width: 32px; height: 32px; }
.success-code { display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: var(--r-sm); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.steps { text-align: left; margin: 24px 0; border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 14px; }
.step { display: flex; gap: 12px; padding: 12px 0; font-size: .875rem; color: var(--text-2); border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step-n { flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary-ink); font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step strong { color: var(--text); font-weight: 600; }
.success .btn + .btn { margin-top: 10px; }
.success-foot { font-size: .75rem; color: var(--text-3); margin-top: 20px; }

/* ── Animações ────────────────────────────────────────────── */
@keyframes surgir { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes subir  { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pulsar { 50% { transform: scale(1.08); } }
.card-qty:not([hidden]) { animation: surgir .15s ease-out; }
.cart-bar:not([hidden]) { animation: subir .2s ease-out; }
.cart-bar-total.bump, .cart-bar-count.bump, .cart-count.bump { animation: pulsar .2s ease-out; }

/* ── Estado ocupado (requisição em andamento) ─────────────── */
.is-busy { opacity: .6; pointer-events: none; cursor: progress; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-primary) var(--on-primary) transparent transparent; animation: girar .6s linear infinite; }
.btn-whatsapp.is-busy::after { border-color: #fff #fff transparent transparent; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ── Seletor − 1 + no card ────────────────────────────────── */
.card-qty { position: absolute; right: -4px; bottom: -4px; z-index: 2; display: flex; align-items: center; height: 36px; border-radius: var(--r-pill); background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow-float); }
.card-qty button { position: relative; width: 36px; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--primary-ink); }
.card-qty button::before { content: ''; position: absolute; inset: -4px 0; }
.card-qty button .icon { width: 18px; height: 18px; }
.card-qty [data-qtd-label] { min-width: 18px; text-align: center; font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.product-card.no-img .card-qty { position: relative; right: auto; bottom: auto; }

/* ── Quantidade compacta (pedido) ─────────────────────────── */
.qty-control.qty-sm { height: 40px; border-radius: var(--r-sm); }
.qty-control.qty-sm button { position: relative; width: 40px; }
.qty-control.qty-sm button::before { content: ''; position: absolute; inset: -2px; }
.qty-control.qty-sm button:disabled { opacity: .35; cursor: not-allowed; }
.qty-value { min-width: 24px; text-align: center; font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Barra fixa do pedido ─────────────────────────────────── */
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--shadow-top); }
.cart-bar-btn { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-weight: 600; transition: background var(--ease); }
.cart-bar-btn:hover { background: var(--primary-hover); }
.cart-bar-count { min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .22); display: flex; align-items: center; justify-content: center; font-size: .875rem; font-variant-numeric: tabular-nums; }
.cart-bar-label { flex: 1; text-align: center; }
.cart-bar-total { font-variant-numeric: tabular-nums; }
body.has-cart-bar .app-footer { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }

/* ── Bottom sheet / drawer ────────────────────────────────── */
html.sheet-aberto { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 200; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 25, 23, .45); opacity: 0; transition: opacity .2s ease; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(100%); transition: transform .22s ease, opacity .2s ease; outline: none; }
.sheet.open .sheet-panel { transform: none; }
.sheet-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--gutter); border-bottom: 1px solid var(--border); }
.sheet-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-close { flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--r-pill); display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--text); }
.sheet-close:hover { background: var(--surface-2); }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter); }
.sheet-loading { padding: 48px 0; text-align: center; color: var(--text-3); font-size: .875rem; }

/* Produto no sheet: o X flutua sobre a foto */
.sheet[data-modo="produto"] .sheet-head { position: absolute; top: 0; right: 0; z-index: 3; border: 0; padding: 12px; }
.sheet[data-modo="produto"] .sheet-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sheet[data-modo="produto"] .sheet-close { background: var(--bg); box-shadow: var(--shadow-float); }
.product-sheet .product-layout { gap: 16px; }
.product-sheet .buy-bar { position: sticky; bottom: 0; z-index: 2; margin: 20px calc(var(--gutter) * -1) 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--shadow-top); }
.product-sheet .product-help { margin-bottom: 8px; }

/* Pedido no drawer */
.sheet[data-modo="pedido"] .sheet-body { padding-top: 12px; padding-bottom: 16px; }
.sheet .cart-layout { grid-template-columns: 1fr; gap: 16px; }
.sheet .summary { position: static; }

/* ── Checkout ─────────────────────────────────────────────── */
.order-summary summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; font-size: .9375rem; }
.order-summary summary::-webkit-details-marker { display: none; }
.order-summary-title { flex: 1; font-weight: 600; }
.order-summary-chevron { width: 18px; height: 18px; color: var(--text-3); transform: rotate(90deg); transition: transform var(--ease); }
.order-summary[open] summary { border-radius: var(--r-md) var(--r-md) 0 0; }
.order-summary[open] .order-summary-chevron { transform: rotate(-90deg); }
.order-summary .order-lines { border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
.checkout-submit-bar { margin-top: 16px; }
.success-status { margin-top: 8px; font-size: .875rem; font-weight: 600; color: var(--success); }
.success .order-lines { text-align: left; margin-bottom: 20px; }

/* ── Cartão "seu pedido" no cardápio ──────────────────────── */
.order-tracker { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); box-shadow: var(--shadow-float); transition: border-color var(--ease); }
.order-tracker:not([hidden]) { animation: surgir .2s ease-out; }
.order-tracker:hover { border-color: var(--primary-ink); }
.order-tracker-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; }
.order-tracker-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.order-tracker-label { font-size: .75rem; color: var(--text-3); }
.order-tracker-body strong { font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-tracker-cta { display: inline-flex; align-items: center; gap: 2px; font-size: .875rem; font-weight: 600; color: var(--primary-ink); white-space: nowrap; }
.order-tracker-cta .icon { width: 16px; height: 16px; }

/* ── Acompanhamento do pedido ─────────────────────────────── */
.track-code { font-size: .8125rem; color: var(--text-3); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.track-hero { display: flex; gap: 14px; align-items: flex-start; padding: 16px; margin-bottom: 20px; border-radius: var(--r-lg); background: var(--primary-soft); }
.track-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--r-pill); background: var(--bg); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; }
.track-icon .icon { width: 24px; height: 24px; }
.track-title { font-size: 1.25rem; }
.track-text { font-size: .9375rem; margin-top: 2px; color: var(--text-2); }
.track-updated { font-size: .75rem; margin-top: 6px; color: var(--text-3); }
.track-finalizado { background: var(--success-soft); }
.track-finalizado .track-icon { color: var(--success); }
.track-cancelado { background: var(--error-soft); }
.track-cancelado .track-icon { color: var(--error); }
.track-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.track-note { font-size: .75rem; color: var(--text-3); text-align: center; margin-top: 16px; }

.timeline { list-style: none; padding: 4px 0 0; }
.timeline-step { position: relative; display: flex; align-items: center; gap: 12px; padding: 0 0 20px; font-size: .9375rem; color: var(--text-3); }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before { content: ''; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--border); }
.timeline-step:last-child::before { display: none; }
.timeline-step.is-feito::before { background: var(--primary-ink); }
.timeline-dot { position: relative; z-index: 1; flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--r-pill); border: 2px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; }
.timeline-dot .icon { width: 16px; height: 16px; }
.timeline-step.is-feito { color: var(--text-2); }
.timeline-step.is-feito .timeline-dot { border-color: var(--primary-ink); background: var(--primary-ink); color: var(--bg); }
.timeline-step.is-atual { color: var(--text); font-weight: 600; }
.timeline-step.is-atual .timeline-dot { border: 7px solid var(--primary-ink); }
.timeline-step.is-atual .timeline-dot:has(.icon) { border-width: 2px; background: var(--primary-ink); color: var(--bg); }

/* ── Mobile: barra de compra fixa na página do produto ────── */
@media (max-width: 767px) {
  .product-page .buy-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; margin: 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--shadow-top); }
  .product-page { padding-bottom: 96px; }
  .product-page ~ .app-footer { padding-bottom: 104px; }
  .product-page ~ .cart-bar { display: none; }
  .product-sheet .gallery { margin: 0 calc(var(--gutter) * -1); }
  .product-sheet .gallery-main { border-radius: 0; }
  .checkout-submit-bar { position: sticky; bottom: 0; z-index: 5; margin: 16px calc(var(--gutter) * -1) 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--shadow-top); }
}

/* ── Telas pequenas ───────────────────────────────────────── */
@media (max-width: 374px) {
  :root { --gutter: 12px; }
  .product-card-media, .product-thumb { width: 88px; }
  .product-thumb { height: 88px; }
  .store-name { font-size: 1.125rem; }
  .logo-lg { width: 48px; height: 48px; font-size: 1.125rem; }
  .cart-bar-btn { gap: 8px; padding: 0 12px; }
  .buy-bar { gap: 8px; }
  .buy-bar .btn { padding: 0 12px; font-size: .9375rem; }
}

/* ── Tablet / desktop ─────────────────────────────────────── */
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .store { padding-top: 24px; }
  .logo-lg { width: 64px; height: 64px; }
  .store-name { font-size: 1.5rem; }
  .product-list { grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .banner { width: 360px; }
  .mini-card { width: 168px; }
  .product-layout { grid-template-columns: 1fr 1fr; gap: 40px; padding-top: 24px; }
  .gallery { margin: 0; }
  .gallery-main { border-radius: var(--r-lg); aspect-ratio: 1 / 1; }
  .gallery-thumbs { padding: 10px 0 0; }
  .option-group-head { width: 100%; margin: 0 0 4px; border-radius: var(--r-sm); }
  .cart-layout { grid-template-columns: 1fr 340px; gap: 32px; }
  .summary { position: sticky; top: calc(var(--header-h) + 16px); }
  .page { padding-top: 28px; }
  .cart-bar { left: auto; right: 24px; bottom: 24px; width: 380px; padding: 0; background: none; box-shadow: none; }
  .cart-bar-btn { box-shadow: var(--shadow-float); }
  body.has-cart-bar .app-footer { padding-bottom: 32px; }
  body.has-cart-bar .toast { bottom: 96px; }

  .sheet[data-modo="pedido"] .sheet-panel { left: auto; top: 0; width: 420px; max-height: none; border-radius: var(--r-lg) 0 0 var(--r-lg); transform: translateX(100%); }
  .sheet[data-modo="pedido"].open .sheet-panel { transform: none; }
  .sheet[data-modo="produto"] .sheet-panel { left: 50%; top: 50%; bottom: auto; width: min(860px, calc(100vw - 48px)); max-height: calc(100vh - 64px); border-radius: var(--r-lg); transform: translate(-50%, -46%); opacity: 0; }
  .sheet[data-modo="produto"].open .sheet-panel { transform: translate(-50%, -50%); opacity: 1; }
  .product-sheet { padding-bottom: 8px; }
  .product-sheet .product-layout { padding-top: 24px; }
  .product-sheet .buy-bar { position: static; margin: 24px 0 0; padding: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
