:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f172a;
  --brand-2: #1e293b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 20px;
  --theme-primary: #0f172a;
  --theme-accent: #2563eb;
  --theme-accent-contrast: #ffffff;
}

/* Personalização: valores padrão preservam o visual original. */
.category-chip.active { border-color: var(--theme-primary); color: var(--theme-primary); }
.product:hover { border-color: var(--theme-accent); }
body[data-store-theme="food"] .group-card,
body[data-store-theme="fashion"] .group-card,
body[data-store-theme="artisan"] .group-card { border-top: 3px solid var(--theme-accent); }
body[data-store-theme="food"] .price,
body[data-store-theme="fashion"] .price,
body[data-store-theme="artisan"] .price { color: var(--theme-primary); }
body[data-store-theme="food"] .category-chip:hover,
body[data-store-theme="fashion"] .category-chip:hover,
body[data-store-theme="artisan"] .category-chip:hover { border-color: var(--theme-accent); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
img { display: block; max-width: 100%; }
.container { width: min(1400px, calc(100% - 32px)); margin: 0 auto; padding: 12px 0 96px; }
.card { background: var(--card); border: 1px solid rgba(229, 231, 235, 0.85); border-radius: var(--radius); box-shadow: var(--shadow); }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 16px; margin-bottom: 16px; }
.title { margin: 0; font-size: 1.5rem; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }
.row { display: flex; gap: 8px; }
.grow { flex: 1; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: white;
  color: var(--text);
  outline: none;
}
.textarea { min-height: 88px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: .2s ease;
  font-weight: 600;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-contrast, #fff); }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); }
.btn-secondary { background: white; border: 1px solid var(--line); color: var(--text); }
.btn-secondary.active { background: var(--brand); color: var(--brand-contrast, white); border-color: var(--brand); }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; background: #f1f5f9; color: #334155; font-size: .8rem; font-weight: 700; }
.status-banner { margin-top: 12px; padding: 10px 14px; border-radius: 14px; font-size: .95rem; font-weight: 700; line-height: 1.35; }
.status-banner.open { background: #ecfdf5; color: #065f46; }
.status-banner.closed { background: #fef2f2; color: #991b1b; }
.hero { overflow: hidden; margin-bottom: 20px; border-radius: 26px; }
.hero-banner {
  height: 260px;
  background: linear-gradient(135deg, #0f172a, #334155);
  background-size: cover;
  background-position: center;
  position: relative;
}
.hero-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,23,42,.28), transparent 58%);
  pointer-events: none;
}
.hero-body { padding: 22px 24px 20px; position: relative; }
.store-logo-wrap { width:96px; height:96px; margin-top:-70px; margin-bottom:14px; position:relative; z-index:2; border-radius:22px; border:4px solid #fff; background:#fff; box-shadow:0 8px 24px rgba(15,23,42,.16); overflow:hidden; }
.store-logo-wrap img { width:100%; height:100%; object-fit:contain; background:#fff; }
.hero-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.hero-name { margin: 0; font-size: clamp(1.65rem, 4vw, 2.25rem); line-height: 1.08; letter-spacing: -.025em; }
.hero-desc { margin: 9px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.5; max-width: 720px; }
.hero-status-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.hero-status-row .status-banner { margin-top: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.meta-item { display: flex; gap: 6px; align-items: center; }
.meta-item strong { color: #475569; font-weight: 700; }
.category-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 4px; scrollbar-width: thin; }
.category-chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; background: white; color: #334155; font-weight: 700; cursor: pointer; }
.category-chip:hover { border-color: #94a3b8; background: #f8fafc; }
.layout { display: grid; gap: 18px; grid-template-columns: 1fr; }
.group-card { padding: 18px; margin-bottom: 18px; scroll-margin-top: 16px; }
.group-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.thumb, .product-image, .modal-image { background: #f1f5f9; overflow: hidden; }
.thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 16px; }
.thumb.empty, .product-image.empty, .modal-image.empty { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: .8rem; }
.group-title { margin: 0; font-size: 1.3rem; }
.group-desc { margin: 5px 0 0; color: var(--muted); }
.product-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: white; cursor: pointer; overflow: hidden; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.product:hover { border-color: #cbd5e1; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.product-image { width: 100%; aspect-ratio: 4 / 3; border-radius: 0; order: -1; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-content { display: flex; flex-direction: column; flex: 1; padding: 14px; }
.product-name { margin: 0 0 6px; font-size: 1rem; line-height: 1.3; }
.product-desc { margin: 0 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; }
.price { font-weight: 800; }
.cart-panel { padding: 16px; position: sticky; top: 12px; }
.cart-list { display: grid; gap: 10px; margin: 14px 0; }
.cart-item { border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.cart-item-top { display: flex; gap: 10px; justify-content: space-between; }
.cart-item-name { font-weight: 700; }
.muted { color: var(--muted); }
.mini { font-size: .84rem; }
.danger-link { border: 0; background: transparent; color: var(--danger); cursor: pointer; padding: 0; font-weight: 600; }
.summary { background: #f8fafc; border-radius: 16px; padding: 12px; margin: 16px 0; }
.summary-line { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.summary-line:last-child { margin-bottom: 0; }
.checkout-box { display: grid; gap: 10px; margin-top: 16px; }
.service-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status { margin-top: 14px; padding: 12px; border-radius: 16px; font-size: .95rem; }
.status.ok { background: #ecfdf5; color: #065f46; }
.status.err { background: #fef2f2; color: #991b1b; }
.floating-cart {
  position: fixed; bottom: 12px; left: 12px; right: 12px; z-index: 40;
  display: flex; justify-content: center;
}
.floating-cart button { width: min(520px, 100%); box-shadow: var(--shadow); }
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; z-index: 60; }
.overlay.open { display: block; }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(680px, calc(100% - 24px)); max-height: calc(100vh - 24px);
  overflow: auto; background: white; border-radius: 24px; padding: 18px; z-index: 70;
  display: none; box-shadow: 0 30px 80px rgba(15, 23, 42, .22);
}
.modal.open { display: block; }
.modal-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 14px; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: white; cursor: pointer; }
.modal-image { width: 100%; height: 320px; border-radius: 20px; margin-bottom: 10px; position: relative; }
.modal-image img { width: 100%; height: 100%; object-fit: contain; background: #f8fafc; }
.product-gallery { margin-bottom: 14px; }
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.gallery-thumb {
  flex: 0 0 72px; width: 72px; height: 72px; border-radius: 14px; border: 2px solid transparent;
  padding: 0; background: #f8fafc; cursor: pointer; overflow: hidden;
}
.gallery-thumb.active { border-color: var(--brand); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-counter { margin-top: 6px; text-align: center; color: var(--muted); font-size: .82rem; }
.options { display: grid; gap: 10px; margin: 14px 0; }
.grades { display: grid; gap: 16px; margin: 16px 0; }
.grade-group { display: grid; gap: 8px; }
.grade-title { font-weight: 700; }
.grade-values { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-value {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px;
  background: white; color: var(--text); cursor: pointer; font-weight: 600;
}
.grade-value:hover { border-color: #94a3b8; }
.grade-value.selected { background: var(--brand); color: white; border-color: var(--brand); }
.variation-status { margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; font-size: .9rem; }
.variation-status.pending { background: #f8fafc; color: var(--muted); }
.variation-status.unavailable { background: #fef2f2; color: #991b1b; }
.option {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 16px; padding: 12px;
}
.qty-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: #f8fafc; border-radius: 16px; padding: 12px; margin: 14px 0; }
.qty-box { display: flex; gap: 10px; align-items: center; }
.qty-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: white; cursor: pointer; font-size: 1.2rem; }
.empty-state, .loading, .error-box { padding: 22px; }
.hidden { display: none !important; }

/* Etapa 01-A: cabecalho compacto e banner responsivo */
.hero { margin-bottom: 14px; }
.hero-banner { height: clamp(180px, 19vw, 240px); }
.hero-body { padding: 18px 22px 16px; }
.store-logo-wrap { width: 82px; height: 82px; margin-top: -57px; margin-bottom: 10px; border-radius: 19px; }
.hero-desc { margin-top: 5px; font-size: .94rem; }
.hero-status-row { margin-top: 9px; }
.hero-status-row .status-banner { padding: 7px 11px; font-size: .85rem; }
.meta { margin-top: 12px; padding-top: 12px; gap: 7px 16px; font-size: .82rem; line-height: 1.4; }
.meta-item { min-width: 0; }
.meta-item span { overflow-wrap: anywhere; }
@media (max-width: 859px) {
  .hero-banner { height: clamp(145px, 38vw, 205px); }
  .hero-body { padding: 14px 16px 15px; }
  .store-logo-wrap { width: 76px; height: 76px; margin-top: -51px; margin-bottom: 9px; border-width: 3px; }
  .hero-name { font-size: clamp(1.4rem, 5vw, 1.7rem); }
  .hero-desc { font-size: .9rem; line-height: 1.35; }
  .meta { display: grid; gap: 7px; margin-top: 11px; padding-top: 11px; }
  .meta-item { align-items: baseline; }
  .hero { border-radius: 20px; }
}
@media (max-width: 560px) {
  .hero-banner { height: clamp(138px, 37vw, 180px); }
  .hero-body { padding: 12px 14px 14px; }
  .store-logo-wrap { width: 70px; height: 70px; margin-top: -46px; margin-bottom: 8px; }
  .hero-head { align-items: flex-start; }
  .hero-name { font-size: 1.42rem; }
  .hero-head #cartCountBadge { font-size: .72rem; padding: 5px 8px; white-space: nowrap; }
  .meta { font-size: .79rem; }
}

@media (min-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .meta { grid-template-columns: repeat(3, 1fr); }
  .floating-cart { display: none; }
  #desktopCart { display: block; }
}

@media (max-width: 1100px) and (min-width: 860px) {
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 859px) {
  #desktopCart { display: none; }
  .container { width: min(100% - 24px, 720px); }
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-body { padding: 18px; }
  .hero-head { gap: 10px; }
  .hero-name { font-size: 1.65rem; }
  .meta { display: grid; gap: 9px; }
}

@media (max-width: 560px) {
  .product-list { grid-template-columns: 1fr; }
  .group-card { padding: 14px; }
}
/* Etapa 01-A.1: recupera enquadramento do banner no celular. */
@media (max-width: 859px) {
  .hero-banner {
    height: auto;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
  }
}

/* Etapa 01-B: grupos e cards de produto */
.group-card { padding: 20px; margin-bottom: 16px; }
.group-head { gap: 12px; margin-bottom: 18px; }
.group-title { font-size: 1.22rem; letter-spacing: -.02em; }
.group-desc { font-size: .9rem; line-height: 1.4; }
.thumb { flex-basis: 48px; width: 48px; height: 48px; border-radius: 13px; }
.product-list { gap: 12px; }
.product { border-radius: 15px; }
.product:focus-within { outline: 2px solid var(--theme-primary); outline-offset: 2px; }
.product-image { aspect-ratio: 1 / 1; }
.product-content { padding: 12px; gap: 5px; }
.product-name { font-size: .96rem; line-height: 1.35; margin: 0; }
.product-desc { font-size: .82rem; margin: 0 0 7px; min-height: 0; }
.product-desc:empty { display: none; }
.product-bottom { flex-wrap: wrap; gap: 8px; }
.product-bottom .price { color: var(--theme-primary); font-size: 1.03rem; }
.product-action { font: inherit; font-size: .78rem; font-weight: 750; color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 9%, white); border: 1px solid color-mix(in srgb, var(--theme-primary) 18%, white); padding: 7px 10px; border-radius: 10px; white-space: nowrap; cursor: pointer; }
.product-action:hover { background: color-mix(in srgb, var(--theme-primary) 16%, white); }
@media (max-width: 560px) {
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .group-card { padding: 12px; }
  .group-head { margin-bottom: 13px; }
  .product-content { padding: 10px; }
  .product-name { font-size: .88rem; }
  .product-bottom .price { font-size: .93rem; }
  .product-action { padding: 6px 8px; font-size: .73rem; }
}
@media (max-width: 340px) { .product-list { grid-template-columns: 1fr; } }
