/* ============================================================
   TIENDA EN LÍNEA — Mobile-First Design System
   Rappi-inspired · Blue Brand · Las Sombrillas
   ============================================================ */

:root {
  /* CTA ámbar (evoca sombrillas al sol) */
  --primary:        #F59E0B;
  --primary-hover:  #D97706;
  --primary-light:  #FEF3C7;

  /* Oscuro de marca (del logo) */
  --dark:       #0F172A;
  --dark-2:     #1E293B;
  --dark-soft:  #334155;

  /* Acento coral (promos, urgencia) */
  --coral:       #EF4444;
  --coral-light: #FEE2E2;

  /* Acento tropical (envíos, frescura) */
  --mint:       #10B981;
  --mint-light: #D1FAE5;

  /* Acento cielo (info) */
  --sky:        #0EA5E9;
  --sky-light:  #E0F2FE;

  --bg:        #FAFAF9;
  --surface:   #FFFFFF;
  --surface-2: #F8FAFC;

  --text:           #0F172A;
  --text-secondary: #475569;
  --muted:          #94A3B8;

  --border:       #E2E8F0;
  --border-light: #F1F5F9;

  --success:    #10B981;
  --success-bg: #D1FAE5;
  --danger:     #EF4444;

  --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow:    0 4px 6px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.04);
  --shadow-md: 0 10px 15px rgba(15,23,42,.08), 0 4px 6px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 25px rgba(15,23,42,.10), 0 8px 10px rgba(15,23,42,.04);
  --shadow-xl: 0 25px 50px rgba(15,23,42,.22);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 24px;

  --transition: .18s ease;

  --topbar-h: 60px;
  --cart-w:   360px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.25; }

img { display: block; max-width: 100%; }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input {
  font: inherit;
  border: none;
  outline: none;
  background: none;
}

.hidden { display: none !important; }

/* Prevent scroll when cart drawer is open on mobile */
body.cart-open { overflow: hidden; }

/* ============================================================
   SCREENS
   ============================================================ */

.screen { min-height: 100dvh; }

/* ============================================================
   REGISTER SCREEN
   ============================================================ */

#screen-register {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #1E3A8A 0%, #2563EB 55%, #3B82F6 100%);
  padding: 24px 20px;
  min-height: 100dvh;
}

.reg-wrap {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.reg-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.reg-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--r-lg);
}

.reg-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.reg-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.reg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reg-disclaimer {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* ── Field label ── */
.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.field-label input {
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 16px; /* prevent iOS auto-zoom */
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field-label input::placeholder { color: var(--muted); }

.field-label input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,.14);
  outline: none;
}

/* Cumpleaños — wheel picker scroll día/mes/año (estilo tarjeta tip-wheel) */
:root { --bday-item-h: 32px; }

.bday-wheels {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.bday-wheel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bday-wheel-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.bday-wheel-wrap {
  position: relative;
  width: 100%;
  height: calc(var(--bday-item-h) * 3);
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  user-select: none;
}

.bday-wheel-track {
  position: absolute;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: var(--bday-item-h) 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}
.bday-wheel-track::-webkit-scrollbar { display: none; }

.bday-wheel-item {
  height: var(--bday-item-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: #94a3b8;
  scroll-snap-align: center;
  cursor: pointer;
  transition: color .15s, font-size .15s, font-weight .15s;
}
.bday-wheel-item.selected {
  color: #0f172a;
  font-weight: 700;
  font-size: 1.05rem;
}

.bday-wheel-overlay {
  position: absolute;
  left: 0; right: 0;
  height: var(--bday-item-h);
  pointer-events: none;
  z-index: 2;
}
.bday-wheel-overlay-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 100%);
}
.bday-wheel-overlay-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 100%);
}

.bday-wheel-center-line {
  position: absolute;
  left: 4px; right: 4px;
  top: var(--bday-item-h);
  height: var(--bday-item-h);
  border-top: 1px solid var(--primary, #f59e0b);
  border-bottom: 1px solid var(--primary, #f59e0b);
  background: rgba(245, 158, 11, 0.08);
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 14px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: 0 2px 10px rgba(245,158,11,.35);
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(245,158,11,.45);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-full { width: 100%; }

.btn-ghost {
  background: transparent;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--r-sm);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.close-btn {
  font-size: 1rem;
  color: var(--muted);
}
.close-btn:hover { background: var(--bg); color: var(--text); }

/* ── Add to cart / Qty controls ── */
.btn-add {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 6px rgba(245,158,11,.30);
  white-space: nowrap;
}

.btn-add:hover { background: var(--primary-hover); transform: scale(1.04); }
.btn-add:active { transform: scale(.98); }

.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  transition: background var(--transition), color var(--transition);
}

.qty-btn:hover { background: var(--primary); color: #fff; }

.qty-num {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

/* ============================================================
   STORE SCREEN
   ============================================================ */

#screen-store {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Content row: catalog | cart sidebar */
.store-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.store-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}
.topbar::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #F59E0B 0%, #EF4444 50%, #F59E0B 100%);
  opacity: .9;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.topbar-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.topbar-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  overflow: hidden;
  flex-shrink: 0;
}

#topbar-user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.topbar-caret {
  font-size: 0.68rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Scrollable store body ── */
.store-body {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── Hero ── */
.store-hero {
  position: relative;
  background: radial-gradient(120% 120% at 100% 0%, #1E293B 0%, #0F172A 45%, #000 100%);
  padding: 22px 20px 26px;
  color: #fff;
  overflow: hidden;
}
.store-hero::after {
  content: '';
  position: absolute;
  right: -40px; bottom: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(245,158,11,.35) 0%, transparent 70%);
  pointer-events: none;
}

.hero-text h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.hero-text p {
  font-size: 0.82rem;
  color: rgba(255,255,255,.72);
}

/* Stats/chips del hero */
.hero-stats {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  position: relative;
  z-index: 2;
}
.hero-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 12px;
  padding: 8px 10px;
}
.hero-stat-val {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.hero-stat-lbl {
  font-size: 0.66rem;
  color: rgba(255,255,255,.72);
  font-weight: 500;
  letter-spacing: .01em;
}
.hero-stat.amber .hero-stat-val { color: #FCD34D; }
.hero-stat.mint  .hero-stat-val { color: #6EE7B7; }
.hero-stat.coral .hero-stat-val { color: #FCA5A5; }

/* Tira de promos bajo el hero (tipo Rappi) */
.promo-strip {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.promo-strip::-webkit-scrollbar { display: none; }
.promo-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.promo-badge.amber { background: var(--primary-light); color: #92400E; border-color: #FDE68A; }
.promo-badge.mint  { background: var(--mint-light);    color: #065F46; border-color: #A7F3D0; }
.promo-badge.coral { background: var(--coral-light);   color: #991B1B; border-color: #FCA5A5; }
.promo-badge.sky   { background: var(--sky-light);     color: #075985; border-color: #BAE6FD; }
.promo-badge.dark  { background: var(--dark); color: #F59E0B; border-color: var(--dark-2); }
.promo-badge-ico { font-size: 0.92rem; line-height: 1; }

/* ── Delivery option buttons (cart only) ── */
.del-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-2);
  transition: all var(--transition);
}

.del-opt-icon { font-size: 1.4rem; line-height: 1; }
.del-opt-label { font-size: 0.78rem; font-weight: 600; }

.del-opt.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(245,158,11,.18);
}

.del-opt:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg);
}

/* ── Search ── */
.search-wrap {
  padding: 12px 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: .6;
}

.search-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border-light);
  border-radius: 24px;
  padding: 11px 18px 11px 40px;
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-wrap input::placeholder { color: var(--muted); }

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

/* ── Category chips ── */
.cat-scroll {
  display: flex;
  gap: 10px;
  padding: 14px 16px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  /* Fade edges hint scroll */
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
}

.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 6px;
  border-radius: var(--r-lg);
  border: none;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition);
  white-space: nowrap;
  min-width: 68px;
}

.cat-chip-icon {
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15,23,42,.08);
  transition: transform var(--transition), box-shadow var(--transition);
}

.cat-chip.active {
  color: var(--dark);
  font-weight: 800;
}
.cat-chip.active .cat-chip-icon {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  filter: drop-shadow(0 4px 12px rgba(245,158,11,.35));
  transform: translateY(-2px);
  border-color: #F59E0B;
}

.cat-chip:hover:not(.active) .cat-chip-icon {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(15,23,42,.14);
}

/* ── Top del momento (ranking) ── */
.store-ranking {
  margin: 12px 14px 4px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid rgba(234, 88, 12, 0.22);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.08);
}
.store-ranking.hidden { display: none; }

.sr-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sr-title {
  font-size: 1rem;
  font-weight: 700;
  color: #9a3412;
  letter-spacing: -0.01em;
}
.sr-sub {
  font-size: 0.7rem;
  color: #c2410c;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(234, 88, 12, 0.12);
  padding: 4px 9px;
  border-radius: 999px;
}

.sr-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(128px, 1fr);
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.sr-scroller::-webkit-scrollbar { display: none; }

/* Cuando hay pocos items no queremos que queden comprimidos: columnas fijas 128px */
.sr-scroller-few {
  grid-auto-columns: 130px;
  justify-content: start;
}

.sr-card {
  all: unset;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  min-width: 0;
}
.sr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.sr-card:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

.sr-pos {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(234,88,12,0.3);
}

.sr-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: #f1f5f9;
  display: block;
}
.sr-img-ph {
  display: grid;
  place-content: center;
  font-size: 2rem;
  color: #94a3b8;
}

.sr-name {
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  min-height: 2.4em;
  word-break: break-word;
}

.sr-meta {
  margin-top: 2px;
  font-size: 0.72rem;
  color: #c2410c;
  font-weight: 700;
}

/* Highlight breve al hacer click en un rank card */
@keyframes sr-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234,88,12,0); }
  50%      { box-shadow: 0 0 0 6px rgba(234,88,12,0.35); }
}
.prod-card.sr-highlight {
  animation: sr-pulse 1.2s ease-out 1;
  border-color: #ea580c !important;
}

@media (max-width: 680px) {
  .store-ranking {
    margin: 10px 10px 4px;
    padding: 12px 12px;
  }
  .sr-scroller {
    grid-auto-columns: 118px;
  }
  .sr-scroller-few {
    grid-auto-columns: 118px;
  }
  .sr-title { font-size: 0.95rem; }
  .sr-sub { font-size: 0.65rem; padding: 3px 7px; }
}

/* ── Acciones rápidas (pills coloridas bajo el buscador) ── */
.quick-actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--surface);
}
.quick-actions::-webkit-scrollbar { display: none; }
.qa-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1.5px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}
.qa-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.qa-pill.active {
  outline: 2.5px solid var(--dark);
  outline-offset: 2px;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,23,42,.2);
}
.qa-pill.amber { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); color: #fff; }
.qa-pill.dark  { background: var(--dark); color: #F59E0B; }
.qa-pill.coral { background: var(--coral-light); color: #991B1B; border-color: #FCA5A5; }
.qa-pill.mint  { background: var(--mint-light); color: #065F46; border-color: #A7F3D0; }
.qa-pill.sky   { background: var(--sky-light); color: #075985; border-color: #BAE6FD; }
.qa-pill-ico { font-size: 0.95rem; line-height: 1; }

/* ── Encabezado de sección sobre el grid ── */
.grid-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
  background: var(--bg);
}
.grid-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.grid-section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, #F59E0B 0%, #EF4444 100%);
  border-radius: 2px;
  display: inline-block;
}
.grid-section-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 8px 12px 14px;
}

.prod-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.prod-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: #FDE68A;
}

/* Badge opcional sobre la imagen del producto */
.prod-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: var(--dark);
  color: #F59E0B;
  box-shadow: 0 2px 6px rgba(15,23,42,.25);
}
.prod-badge.hot    { background: var(--coral); color: #fff; }
.prod-badge.new    { background: var(--mint);  color: #fff; }
.prod-badge.promo  { background: var(--primary); color: var(--dark); }

/* Chip de tiempo de entrega arriba a la derecha */
.prod-time {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(15,23,42,.78);
  color: #fff;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.66rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.prod-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  overflow: hidden;
  flex-shrink: 0;
}

.prod-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .32s ease;
}

.prod-card:hover .prod-img { transform: scale(1.05); }

.prod-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--muted);
}

.prod-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.prod-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prod-desc {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.prod-price {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -.02em;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.prod-price::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
  margin-right: 6px;
  transform: translateY(1px);
}

.prod-action { flex-shrink: 0; }

.prod-price-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.prod-price-orig {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: line-through;
  font-weight: 600;
  margin-top: 2px;
  padding-left: 10px;
}

/* ── Empty / loading state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ── Spacer for FAB ── */
.fab-spacer { height: 90px; }

/* ── Floating Cart FAB ── */
.cart-fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 32px;
  padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(15,23,42,.44);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  transition: transform var(--transition), box-shadow var(--transition);
}

.cart-fab:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 12px 32px rgba(15,23,42,.55);
}

.cart-fab-count {
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.cart-fab-text { flex: 1; }

.cart-fab-total {
  font-weight: 800;
  font-size: 0.92rem;
}

/* iOS safe area for FAB */
@supports (bottom: env(safe-area-inset-bottom)) {
  .cart-fab {
    bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   CART DRAWER (mobile: bottom sheet / desktop: right sidebar)
   ============================================================ */

/* Mobile overlay */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.52);
  z-index: 300;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: overlayIn .2s ease;
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* Drawer — mobile: bottom sheet */
.cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
  transform: translateY(100%);
  transition: transform .30s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}

.cart-drawer.open {
  transform: translateY(0);
}

/* Cart structure */
.cart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.cart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.cart-customer-name {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.cart-body {
  flex: 1 1 auto;
  min-height: 38dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.cart-items { padding: 4px 0; }

.cart-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
}

.cart-empty small { font-size: 0.78rem; color: var(--border); }

/* Cart items */
.cart-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-light);
}

.cart-item:last-child { border-bottom: none; }

.cart-item-img-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
}

.cart-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-img-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-qty-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Price moved inline next to qty controls */
.cart-item-price-inline {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--primary);
  margin-left: auto;
  white-space: nowrap;
}

/* Keep old class in case referenced elsewhere */
.cart-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Per-item note input ── */
.cart-item-note {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  background: var(--bg);
  transition: border-color var(--transition);
  outline: none;
}

.cart-item-note::placeholder { color: var(--muted); font-style: italic; }

.cart-item-note:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(245,158,11,.12);
  color: var(--text);
  background: var(--surface);
}

/* Cart footer */
.cart-footer {
  border-top: 1px solid var(--border-light);
  padding: 14px 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  flex: 0 1 auto;
  min-height: 0;
  max-height: 46dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-footer > .order-btn {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  z-index: 2;
  background: var(--primary, #f59e0b);
  box-shadow: 0 -10px 18px -12px rgba(0,0,0,0.22);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.cart-total-row strong {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.cart-total-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

.cart-total-count {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .01em;
}

/* Delivery selector inside cart */
.cart-delivery-sel {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
}

/* Fields inside cart */
.cart-field-wrap .field-label { font-size: 0.8rem; }

.cart-field-wrap .field-label input {
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
}

.cart-field-wrap .field-label input::placeholder { color: var(--muted); }

.cart-field-wrap .field-label input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

.order-btn {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--r);
}

/* ─── Payment info (informativo antes del botón de orden) ───────── */
.cart-payment-info {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef9c3 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.cpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.cpi-header:hover { background: rgba(255,255,255,0.5); }

.cpi-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cpi-header-ico {
  font-size: 1.4rem;
  line-height: 1;
}

.cpi-header-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cpi-header-txt b {
  font-size: 0.9rem;
  color: #1f2937;
}

.cpi-header-txt small {
  font-size: 0.72rem;
  color: #78350f;
  font-weight: 600;
}

.cpi-caret {
  font-size: 0.9rem;
  color: #78350f;
  transition: transform 0.2s ease;
}

.cpi-body {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cpi-opt {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #fde68a;
}

.cpi-ico {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

.cpi-txt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.cpi-txt b {
  font-size: 0.88rem;
  color: #1f2937;
}

.cpi-txt small {
  font-size: 0.76rem;
  color: #6b7280;
  line-height: 1.45;
}

.cpi-accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.cpi-acct {
  background: #fafafa;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cpi-acct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.cpi-acct-lbl {
  color: #6b7280;
  font-weight: 500;
  flex-shrink: 0;
}

.cpi-acct-val {
  color: #1f2937;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-all;
}

.cpi-copy-target {
  cursor: pointer;
  user-select: all;
}

.cpi-copy-target:hover {
  color: #b45309;
}

.cpi-copy {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-left: 2px;
}

.cpi-acct-note {
  font-size: 0.72rem;
  color: #78350f;
  margin-top: 2px;
}

.cpi-acct-empty {
  font-size: 0.78rem;
  color: #6b7280;
  padding: 8px 10px;
  background: #fafafa;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
}

.cpi-foot {
  font-size: 0.72rem !important;
  color: #92400e !important;
  font-weight: 600 !important;
  margin-top: 4px;
}

.cpi-final {
  margin: 0;
  font-size: 0.74rem;
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.4;
}

/* Order success */
.order-success {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
}

.success-icon { font-size: 2.4rem; line-height: 1; }

.order-success p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  animation: toastUp .22s ease;
}

.toast.toast-error { background: var(--danger); }

@keyframes toastUp {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ============================================================
   RESPONSIVE — TABLET ≥ 640px
   ============================================================ */

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .store-hero { padding: 32px 24px 28px; }
  .hero-text h2 { font-size: 1.5rem; }
  .delivery-bar, .search-wrap, .cat-scroll { padding-left: 20px; padding-right: 20px; }
}

/* ============================================================
   RESPONSIVE — DESKTOP ≥ 768px: sidebar cart
   ============================================================ */

@media (min-width: 768px) {
  #screen-store {
    height: 100dvh;
    overflow: hidden;
  }

  /* Cart overlay hidden on desktop */
  .cart-overlay { display: none !important; }

  /* FAB hidden on desktop */
  .cart-fab { display: none !important; }

  /* FAB spacer not needed */
  .fab-spacer { display: none; }

  /* Cart as permanent right sidebar */
  .cart-drawer {
    position: relative;
    width: var(--cart-w);
    flex-shrink: 0;
    transform: none !important;
    transition: none !important;
    border-radius: 0;
    border-left: 1px solid var(--border-light);
    box-shadow: none;
    max-height: none;
    height: 100%;
    overflow: hidden;
  }

  /* Hide close button on desktop */
  #close-cart-btn { display: none; }

  /* Cart header without rounded corners on desktop */
  .cart-header {
    border-radius: 0;
    padding: 18px 20px 14px;
  }

  /* Cart footer with more padding */
  .cart-footer {
    padding: 16px 20px;
    padding-bottom: 20px;
  }

  /* Cart items body fills remaining height */
  .cart-body {
    overflow-y: auto;
  }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .store-hero { padding: 32px 28px 26px; }
  .delivery-bar, .search-wrap, .cat-scroll { padding-left: 24px; padding-right: 24px; }
  .product-grid { padding: 16px 20px; }
  .topbar { padding: 0 24px; }
}

/* ============================================================
   RESPONSIVE — LARGE DESKTOP ≥ 1024px
   ============================================================ */

@media (min-width: 1024px) {
  :root { --cart-w: 400px; }

  .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 18px 24px;
  }

  .topbar { padding: 0 32px; }
  .store-hero { padding: 36px 32px 28px; }
  .delivery-bar, .search-wrap, .cat-scroll { padding-left: 28px; padding-right: 28px; }
  .hero-text h2 { font-size: 1.6rem; }
}

/* ============================================================
   RESPONSIVE — VERY SMALL ≤ 360px
   ============================================================ */

@media (max-width: 360px) {
  .product-grid { grid-template-columns: 1fr; }
  .cart-fab { min-width: 190px; padding: 12px 16px; }
}

/* ============================================================
   ADDRESS GPS + MAP BUTTONS
   ============================================================ */

.addr-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.addr-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-addr-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px 9px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  transition: all var(--transition);
}

.addr-action-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.btn-addr-gps {
  border-color: #16a34a30;
  background: #f0fdf4;
  color: #15803d;
}
.btn-addr-gps:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #16a34a;
}

.btn-addr-map {
  border-color: #2563eb30;
  background: var(--primary-light);
  color: var(--primary);
}
.btn-addr-map:hover:not(:disabled) {
  background: #dbeafe;
  border-color: var(--primary);
}

.btn-addr-action:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Pickup info ── */
.cart-pickup-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--r);
  padding: 12px 14px;
}

.pickup-icon { font-size: 1.8rem; flex-shrink: 0; }
.pickup-title { font-size: 0.88rem; font-weight: 700; color: #15803d; }
.pickup-addr  { font-size: 0.76rem; color: #166534; margin-top: 2px; }

/* ============================================================
   DISTANCE BADGE
   ============================================================ */

.dist-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  text-align: center;
  line-height: 1.4;
}

.dist-badge.dist-ok {
  background: var(--success-bg);
  color: var(--success);
}

.dist-badge.dist-err {
  background: #FEF2F2;
  color: var(--danger);
}

.dist-badge.dist-neutral {
  background: var(--bg);
  color: var(--muted);
}

/* ============================================================
   AUTH BOTTOM SHEET
   ============================================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.60);
  z-index: 500;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  animation: overlayIn .22s ease;
}

.auth-sheet {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheetUp .28s cubic-bezier(.32,.72,0,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.auth-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 14px auto 0;
  flex-shrink: 0;
}

.auth-sheet-body {
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-sheet-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.auth-sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-sheet-title .wa-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(37, 211, 102, 0.25));
}

.auth-sheet-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-disclaimer {
  font-size: 0.71rem;
  color: var(--muted);
  text-align: center;
}

.auth-cancel-btn {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: -4px;
}

body.auth-open { overflow: hidden; }

@media (min-width: 640px) {
  .auth-overlay {
    align-items: center;
    justify-content: center;
  }

  .auth-sheet {
    border-radius: var(--r-xl);
    max-width: 440px;
    animation: sheetFade .22s ease;
  }
}

/* ============================================================
   MAP MODAL
   ============================================================ */

.map-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(15,23,42,.65);
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlayIn .2s ease;
}

.map-modal-inner {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  height: 92dvh;        /* fixed height — Leaflet needs a concrete size */
  display: flex;
  flex-direction: column;
  animation: sheetUp .28s cubic-bezier(.32,.72,0,1);
  /* NO overflow:hidden — it breaks Leaflet tile rendering */
}

.map-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.map-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.map-modal-hint {
  font-size: 0.74rem;
  color: var(--text-secondary);
  padding: 6px 18px 4px;
  flex-shrink: 0;
}

.delivery-map-el {
  flex: 1 1 auto;
  width: 100%;
  /* Explicit height — Leaflet needs a concrete size, not just flex */
  height: 60vh;
  min-height: 320px;
  z-index: 1;
  position: relative;
  background: #e5e7eb; /* gris claro visible mientras cargan los tiles */
}

.map-modal-foot {
  padding: 12px 18px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* Leaflet emoji marker overrides */
.map-rest-marker,
.map-pin-marker {
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.30));
  user-select: none;
}

.map-pin-marker { font-size: 28px; }

body.map-open { overflow: hidden; }

@media (min-width: 640px) {
  .map-modal-wrap {
    align-items: center;
    justify-content: center;
  }

  .map-modal-inner {
    border-radius: var(--r-xl);
    max-width: 580px;
    max-height: 85dvh;
    animation: sheetFade .22s ease;
  }

  .delivery-map-el { height: 420px; }
}

/* shared keyframes */
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes sheetFade {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Preview de producto (imagen grande + info) ── */
.tienda-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tpFadeIn .2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.tienda-preview-overlay.hidden { display: none; }
@keyframes tpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.tienda-preview-card {
  background: var(--surface, #fff);
  border-radius: 16px;
  max-width: 400px;
  width: 92%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  position: relative;
  animation: tpCardIn .25s cubic-bezier(.32,.72,0,1);
}
@keyframes tpCardIn {
  from { transform: scale(.92) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0);     opacity: 1; }
}
.tienda-preview-card img {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  background: #f8fafc;
  display: block;
}
.tienda-preview-info {
  padding: 16px 18px 20px;
}
.tienda-preview-info h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text, #0f172a);
  margin: 0 0 6px;
}
.tienda-preview-info p {
  font-size: .85rem;
  color: var(--text-secondary, #64748b);
  margin: 0 0 10px;
  line-height: 1.4;
}
.tienda-preview-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary, #2563EB);
}
.tienda-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: 0;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  backdrop-filter: blur(4px);
}
.tienda-preview-close:hover { background: rgba(0,0,0,.7); }

.prod-img { cursor: pointer; }

/* Auth tabs removed — unified flow */

/* ═══ Carrusel de publicidad ═══════════════════════════════════════ */
.ads-carousel { position: relative; width: 100%; margin: 10px 0 16px; border-radius: 14px; overflow: hidden; background: #0f172a; aspect-ratio: 16/6; min-height: 120px; }
.ads-carousel.hidden { display: none; }
.ads-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; pointer-events: none; color: #fff; cursor: default; }
.ads-slide.active { opacity: 1; pointer-events: auto; }
.ads-slide.has-link { cursor: pointer; }
.ads-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ads-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0)); }
.ads-caption h4 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.ads-caption p { margin: 2px 0 0; font-size: .9rem; opacity: .95; }
.ads-dots { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 2; }
.ads-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; border: 0; padding: 0; }
.ads-dot.active { background: #fff; }

/* ══ CHAT IA FLOTANTE (tienda pública) ═════════════════════════════════════ */
.chat-fab {
  position: fixed;
  left: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f2937, #000);
  border: 0;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0, 0, 0, .5); }
.chat-fab.hidden { display: none; }
.chat-fab-icon { font-size: 1.5rem; }
.chat-fab-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
}
.chat-fab-dot.hidden { display: none; }

.chat-panel {
  position: fixed;
  left: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0));
  width: min(360px, calc(100vw - 36px));
  height: min(520px, calc(100vh - 80px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: chat-slide-up .2s ease-out;
}
@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-panel.hidden { display: none; }

.chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1f2937, #000);
  color: #fff;
}
.chat-panel-head-info { display: flex; align-items: center; gap: 10px; }
.chat-panel-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.chat-panel-head-info strong { font-size: .98rem; display: block; }
.chat-panel-sub { margin: 0; font-size: .72rem; opacity: .9; }
.chat-close-btn {
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px 8px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-bubble-ia {
  align-self: flex-start;
  background: #e2e8f0;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}
.chat-bubble-op {
  align-self: flex-start;
  background: #dbeafe;
  color: #0c4a6e;
  border-bottom-left-radius: 4px;
  border-left: 3px solid #2563eb;
}
.chat-bubble-user {
  align-self: flex-end;
  background: #1f2937;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-text { font-size: .9rem; }
.chat-bubble-time { font-size: .64rem; opacity: .75; margin-top: 2px; text-align: right; }
.chat-bubble-user .chat-bubble-time { color: #fff; }

.chat-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
.chat-form input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: .92rem;
  outline: none;
}
.chat-form input:focus { border-color: #000; }
.chat-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  border: 0;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background .15s;
}
.chat-send-btn:hover { background: #1f2937; }

@media (max-width: 480px) {
  .chat-panel {
    left: 8px; right: 8px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0));
    width: auto;
    height: min(75vh, 520px);
  }
  /* En móvil la cart-fab vive en bottom-center, así que el chat queda en bottom-left esquina */
  .chat-fab { left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0)); }
}

/* ============================================================
   PROFILE DRAWER (Rappi-style)
   ============================================================ */
.topbar-user-avatar {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0 center/cover no-repeat;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  line-height: 26px;
  text-align: center;
  overflow: hidden;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.profile-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  justify-content: flex-end;
}
.profile-drawer {
  width: min(380px, 92vw);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: slideInRight .24s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.profile-hdr {
  position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 2;
}
.profile-title { font-weight: 700; font-size: 1rem; color: var(--text); }
.profile-close {
  background: #f1f5f9; border: 0; width: 32px; height: 32px;
  border-radius: 50%; font-size: 0.95rem; cursor: pointer;
}

.profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 18px;
  background: linear-gradient(135deg, #fef3c7 0%, #fff 100%);
}
.profile-avatar-wrap {
  position: relative; flex-shrink: 0;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #fff center/cover no-repeat;
  border: 3px solid #f59e0b;
  box-shadow: 0 2px 8px rgba(245,158,11,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: #b45309;
  overflow: hidden;
}
.profile-avatar-edit {
  position: absolute; right: -4px; bottom: -4px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #f59e0b; color: #fff; border: 2px solid #fff;
  font-size: 0.82rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.profile-ident { min-width: 0; flex: 1; }
.profile-name {
  font-weight: 700; font-size: 1.05rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-phone {
  font-size: 0.85rem; color: var(--text-secondary);
  margin-top: 2px;
}

.profile-menu {
  display: flex; flex-direction: column;
  padding: 10px 0 20px;
}
.profile-menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: transparent; border: 0;
  text-align: left; cursor: pointer;
  font-size: 0.95rem; font-weight: 500; color: var(--text);
  transition: background .15s;
}
.profile-menu-item:hover { background: #f8fafc; }
.profile-menu-item:active { background: #f1f5f9; }
.pmi-ico { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.pmi-label { flex: 1; }
.pmi-chev { color: var(--muted); font-size: 1.2rem; font-weight: 300; }
.profile-logout {
  color: #dc2626; font-weight: 600;
  margin-top: 8px;
  border-top: 1px solid #e2e8f0;
}

/* ============================================================
   MIS PEDIDOS MODAL
   ============================================================ */
.orders-modal, .edit-profile-modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.orders-modal-inner, .edit-profile-inner {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.orders-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}
.orders-title { font-weight: 700; color: var(--text); font-size: 1rem; }

.orders-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.orders-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}
.orders-tab:hover { background: #fff; }
.orders-tab.active {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(245,158,11,.2);
}

.orders-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.orders-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.order-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.order-card-hdr {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.order-card-type {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
}
.order-card-type.dom { background: #fef3c7; color: #92400e; }
.order-card-type.pick { background: #dcfce7; color: #166534; }
.order-card-date {
  font-size: 0.76rem; color: var(--text-secondary);
}
.order-card-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}
.order-card-status.done    { background: #dcfce7; color: #166534; }
.order-card-status.pending { background: #fef9c3; color: #854d0e; }
.order-card-status.cancel  { background: #fee2e2; color: #991b1b; }
.order-card-items {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  margin: 6px 0;
}
.order-card-items li {
  list-style: none;
  padding: 2px 0;
}
.order-card-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}
.order-card-total-label { font-size: 0.78rem; color: var(--text-secondary); }
.order-card-total-val {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

/* ============================================================
   EDIT PROFILE MODAL
   ============================================================ */
.edit-profile-form {
  padding: 16px 18px 20px;
  overflow-y: auto;
}

/* ============================================================
   VIEW-ONLY MODE — catálogo visible pero sin ordenar
   (tienda encendida sin delivery, o solo_restaurante)
   ============================================================ */
.store-view-only-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid #F59E0B;
  color: #78350F;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
}
.store-view-only-banner .svob-ico {
  font-size: 1.8rem;
  flex: 0 0 auto;
}
.store-view-only-banner .svob-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.35;
}
.store-view-only-banner .svob-text strong {
  font-weight: 800;
  font-size: 0.95rem;
  color: #7C2D12;
}
.store-view-only-banner .svob-text span {
  font-size: 0.85rem;
  color: #92400E;
}

.prod-view-only {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #78350F;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid #FCD34D;
}

@media (max-width: 560px) {
  .store-view-only-banner { padding: 12px 14px; gap: 10px; }
  .store-view-only-banner .svob-ico { font-size: 1.5rem; }
  .store-view-only-banner .svob-text strong { font-size: 0.9rem; }
  .store-view-only-banner .svob-text span { font-size: 0.78rem; }
  .prod-view-only { font-size: 0.68rem; padding: 5px 8px; }
}
