/* ────────────────────────────────────────
       VARIABLES & RESET 2dbb54 69b749
    ──────────────────────────────────────── */
    :root {
      --accent:      #059669;
      --accent-2:    #059669;
      --lime:        #cddc39;
      --danger:      #ff4757;
      --warning:     #ff9800;
      --info:        #3a9bdc;
      --bg:          #f2f2f7;
      --surface:     #ffffff;
      --surface-2:   #f8f8fb;
      --surface-3:   #2dbb54;  
      --text:        #1C1C1E;
      --subtext:     #636366;
      --input-bg:    #E5E5EA;
      --border:      #D1D1D6;
      --card-left:   #2dbb54;
      --shadow:      0 2px 16px rgba(0,0,0,.09);
      --radius:      18px;
      --radius-sm:   10px;
      --font:        'Nunito', sans-serif;
      --header-h-mobile: 50px;
      --desktop-nav-h: 48px;
      --header-h-desktop: 64px;
    }
    [data-theme="dark"] {
      --accent:      #cddc39;
      --accent-2:    #cddc39;
      --lime:        #cddc39;
      --bg:          #121212;
      --surface:     #1e1e1e;
      --surface-2:   #2a2a2a;
      --surface-3:   #cddc39;     
      --text:        #ffffff;
      --subtext:     #aaaaaa;
      --input-bg:    #2d2d2d;
      --border:      #333333;
      --shadow:      0 2px 20px rgba(0,0,0,.4);
    }
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { font-size: 16px; }
    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      min-height: 100dvh;
      max-width: none;
      position: relative;
      transition: background .25s, color .25s;
    }
    img { display: block; }
    button { font-family: var(--font); cursor: pointer; border: none; background: none; }
    input { font-family: var(--font); }
    a { color: var(--accent); }
    ::-webkit-scrollbar { height: 4px; width: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    /* ────────────────────────────────────────
       ACCESIBILIDAD — anillo de foco de marca
       Solo aparece con navegación por teclado
       (:focus-visible), no al hacer click/tap.
       Los inputs/selects del modal de bienvenida
       ya tienen su propio estilo de foco (box-shadow)
       y quedan excluidos aquí para no duplicarlo.
    ──────────────────────────────────────── */
    button:focus-visible,
    a:focus-visible,
    select:focus-visible,
    input:focus-visible,
    [tabindex]:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
      border-radius: 4px;
    }
    .wm-input:focus-visible, .wm-select:focus-visible { outline: none; }
 
    /* ────────────────────────────────────────
       HEADER / TOP BAR padding: 14px 20px 12px;
    ──────────────────────────────────────── */
    #app-header {
      background: linear-gradient(135deg, #059669 0%, #10B981 100%);
      padding: 10px 20px;
      min-height: var(--header-h-mobile);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 12px rgba(45,187,84,.35);
    }
 
    .logo-container {
  display: flex;
  align-items: center;
}
 
.logo-img {
  height: 50px; /* Ajusta este valor según el tamaño que quieras */
  width: auto;  /* Mantiene la proporción original */
  display: block;
  /* Si el logo es blanco o necesita resaltar, puedes añadirle sombra: 
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.8));*/
}

    /* ────────────────────────────────────────
       SEARCH AREA (sticky under header)
    ──────────────────────────────────────── */
    #search-area {
      background: var(--surface);
      padding: 10px 16px 12px;
      border-bottom: 1px solid var(--border);
      transition: background .25s;
    }
    .location-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 8px;
    }
    .location-bar svg { flex-shrink: 0; }
    #location-text {
      font-size: 12px;
      font-weight: 700;
      color: var(--accent);
      flex: 1;/**/
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }
    #theme-btn {
      background: var(--input-bg);
      border-radius: 50%;
      width: 32px; height: 32px;
      display: flex; align-items: center; justify-content: center;
      transition: background .2s, transform .15s;
      flex-shrink: 0;
    }
    #theme-btn:hover { transform: rotate(20deg); }
    .search-bar {
      display: flex;
      align-items: center;
      background: var(--input-bg);
      border-radius: 14px;
      padding: 0 12px;
      height: 44px;
      gap: 8px;
      transition: background .25s;
    }
    .search-bar svg.search-icon { flex-shrink: 0; color: var(--subtext); }
    #search-input {
      flex: 1;
      background: none;
      border: none;
      outline: none;
      font-size: 16px;
      color: var(--text);
      font-weight: 600;
      min-width: 0;
    }
    #search-input::placeholder { color: var(--subtext); font-weight: 500; }
    #clear-btn {
      /*display: none;*/
      display: flex;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      flex-shrink: 0;
      background: var(--border);
      border-radius: 50%;
      width: 22px; height: 22px;
      align-items: center; justify-content: center;
      font-size: 12px;
      color: var(--subtext);
      transition: background .15s, opacity .2s, visibility .2s;
    }
    #clear-btn:hover { background: var(--danger); color: #fff; }
    #clear-btn.visible { 
      /*display: flex;*/ 
      opacity: 1; 
      visibility: visible;
      pointer-events: auto; }
    #scan-btn {
      background: none;
      color: var(--accent);
      display: flex; align-items: center;
      transition: transform .15s;
    }
    #scan-btn:hover { transform: scale(1.1); }
 
    /* ────────────────────────────────────────
       MAIN SCROLLABLE CONTENT
    ──────────────────────────────────────── */
    #main-content {
      padding-bottom: 100px;
      min-height: calc(100dvh - 160px); /* mobile: header ~60px + search ~100px */
    }
    /* ── TAB TRANSITIONS ──────────────────────── */
    .tab-content {
      display: none;
      will-change: opacity, transform;
    }
    .tab-content.active {
      display: block;
      animation: tabIn .28s cubic-bezier(.4,0,.2,1) both;
    }
    .tab-content.tab-exit {
      display: block;
      animation: tabOut .18s cubic-bezier(.4,0,.2,1) both;
      pointer-events: none;
    }
    @keyframes tabIn {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    @keyframes tabOut {
      from { opacity: 1; transform: translateY(0); }
      to   { opacity: 0; transform: translateY(-6px); }
    }
    /* ── SUCURSAL LABEL ───────────────────────── */
    .sucursal-label {
      font-size: 11px;
      font-weight: 800;
      color: var(--info);
      background: rgba(58,155,220,.1);
      border-radius: 6px;
      padding: 3px 8px;
      margin-bottom: 6px;
      display: inline-block;
      letter-spacing: .02em;
    }
    /* ── TRENDING EMPTY STATES ────────────────── */
    .trending-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      padding: 28px 20px;
      text-align: center;
      color: var(--subtext);
      font-size: 13px;
    }
    .trending-state .ts-icon { font-size: 28px; }
    .trending-state .ts-text { font-weight: 600; line-height: 1.4; }
    /* ── 3-DOT MENU ───────────────────────────── */
    #menu-btn {
      position: fixed;
      top: 14px; right: 14px;
      z-index: 600;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      width: auto;
      height: 38px;
      padding: 0 10px;
      display: flex; align-items: center; justify-content: center;
      gap: 4px;
      cursor: pointer;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .3px;
      color: var(--subtext);
      box-shadow: 0 2px 10px rgba(0,0,0,.15);
      transition: background .2s, transform .15s;
    }
    #menu-btn:active { transform: scale(.92); }
    #menu-btn .menu-btn-label {
      font-size: 11px; font-weight: 800;
      letter-spacing: .3px; color: var(--subtext);
    }
    #app-menu {
      position: fixed;
      top: 62px; right: 14px;
      z-index: 599;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      min-width: 230px;
      box-shadow: 0 8px 32px rgba(0,0,0,.22);
      padding: 6px 0 0;
      transform-origin: top right;
      transform: scale(.85) translateY(-8px);
      opacity: 0;
      pointer-events: none;
      transition: transform .2s cubic-bezier(.34,1.56,.64,1), opacity .18s;
    }
    #app-menu.open {
      transform: scale(1) translateY(0);
      opacity: 1;
      pointer-events: all;
    }
    .menu-item {
      display: flex; align-items: center; gap: 10px;
      padding: 12px 18px;
      font-size: 13px; font-weight: 700;
      color: var(--text);
      cursor: pointer;
      border-bottom: 1px solid var(--border);
      transition: background .15s;
    }
    .menu-item:last-of-type { border-bottom: none; }
    .menu-item:hover { background: var(--surface-2); }
    .menu-item:active { background: var(--border); }
    .menu-footer-text {
      font-size: 10px; color: var(--subtext);
      text-align: center;
      padding: 10px 14px;
      line-height: 1.4;
    }
    /* ── LEGAL MODALS ─────────────────────────── */
    .legal-modal-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,.7);
      z-index: 800;
      display: flex; align-items: flex-end; justify-content: center;
      opacity: 0; pointer-events: none;
      transition: opacity .25s;
    }
    .legal-modal-overlay.open { opacity: 1; pointer-events: all; }
    .legal-modal {
      background: var(--surface);
      border-radius: 20px 20px 0 0;
      width: 100%; max-width: 540px;
      max-height: 80vh;
      padding: 20px 22px 40px;
      overflow-y: auto;
      transform: translateY(40px);
      transition: transform .3s cubic-bezier(.4,0,.2,1);
    }
    .legal-modal-overlay.open .legal-modal { transform: translateY(0); }
    .legal-modal-title {
      font-size: 16px; font-weight: 900;
      margin-bottom: 16px;
      display: flex; justify-content: space-between; align-items: center;
    }
    .legal-modal-close {
      background: none; border: none;
      font-size: 20px; color: var(--subtext); cursor: pointer;
      padding: 4px 8px;
    }
    .legal-modal-body {
      font-size: 13px; line-height: 1.7;
      color: var(--subtext);
    }
    .legal-modal-body h3 { color: var(--text); font-size: 13px; margin: 14px 0 4px; }
    /* ── BOTTOM NAV BIGGER TAP TARGET ─────────── */
 
    /* ─── Responsive visibility helpers ──────── */
    .desktop-only { display: none !important; }
    .mobile-only  { display: flex; }
 
 
    /* ────────────────────────────────────────
       SLOGAN SECTION
    ──────────────────────────────────────── */
    #slogan-section {
      text-align: center;
      padding: 20px 20px 5px;
    }
    .slogan-busca {
      font-size: 1.25rem;
      font-weight: 800;
      color: var(--text);
      letter-spacing: 1px;
    }
    .slogan-main {
  font-family: "Montserrat", sans-serif;
  font-optical-sizing: auto;
  font-weight: 900;          /* El peso más grueso (Black) */
  font-style: italic;        /* Inclinación para dar dinamismo */
  font-size: 1.875rem;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;      /* Reducido para que las letras estén pegaditas como en el logo */
  text-transform: uppercase; /* Asegura que siempre esté en mayúsculas */
}
    [data-theme="dark"] .slogan-main { color: #cddc39; }
    .slogan-sub {
      font-size: 11px;
      color: var(--subtext);
      margin-top: 4px;
      letter-spacing: 2px;
      text-transform: uppercase;
    }
 
    /* ────────────────────────────────────────
       SECTION TITLES
    ──────────────────────────────────────── */
    .section-title {
      font-size: 1.0625rem; /* 17px → rem */
      font-weight: 800;
      color: var(--text);
      padding: 0 16px;
      margin-top: 20px;
      margin-bottom: 10px;
    }
 
    /* ────────────────────────────────────────
       PROMOCIONES BANNERS
    ──────────────────────────────────────── */
    #promo-section { margin-bottom: 4px; }
    .promo-scroll {
      display: flex;
      gap: 14px;
      overflow-x: auto;
      padding: 2px 16px 10px;
      scrollbar-width: none;
    }
    .promo-scroll::-webkit-scrollbar { display: none; }
    .promo-banner {
      flex-shrink: 0;
      width: 300px;
      height: 140px;
      border-radius: 16px;
      overflow: hidden;
      cursor: pointer;
      box-shadow: 0 4px 20px rgba(0,0,0,.15);
      transition: transform .2s, box-shadow .2s;
      background: var(--surface-2);
    }
    .promo-banner:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
    .promo-banner:active { transform: scale(.98); }
    .promo-banner picture { display: block; width: 100%; height: 100%; }
    .promo-banner img { width: 100%; height: 100%; object-fit: cover; }
 
    /* ────────────────────────────────────────
       DETAIL BANNER + LOGO DEL COMERCIO (compartido)
       Usado en Promo Detail y en Perfil de Comercio.
       El logo se superpone sobre el borde inferior
       del banner (patrón portada + avatar).
    ──────────────────────────────────────── */
    .detail-banner-wrap {
      position: relative;
         
      margin: 10px 16px 0;
    }
    .detail-banner-wrap:empty { display: none; }
    .detail-banner-wrap picture { display: block; width: 100%; }
    .promo-detail-banner-img {
      display: block;
      width: 100%;
      aspect-ratio: 12 / 5; /* proporción fija: no se "achata" ni recorta al crecer el ancho en pc/tablet */
      object-fit: contain;  /* muestra el banner completo, nunca corta bordes */
      border-radius: var(--radius);
      background: var(--surface);
      /*background: radial-gradient(circle at center, var(--surface-3) 80%, var(--surface-1, #121212) 100%);   */
      box-shadow: var(--shadow);
    }
    .promo-detail-logo {
      display: block;
      width: 56px;
      height: 56px;
      border-radius: 14px;
      object-fit: contain;
      background: var(--surface);
      border: 3px solid var(--surface);
      box-shadow: 0 2px 10px rgba(0,0,0,.18);
    }
    /* Con banner: el logo "flota" superpuesto en la esquina inferior izq. */
    .detail-banner-wrap.has-banner .promo-detail-logo {
      position: absolute;
      left: 14px;
      bottom: -20px;
    }
    /* Sin banner (solo logo): centrado y en flujo normal */
    .detail-banner-wrap.has-logo:not(.has-banner) .promo-detail-logo {
      margin: 4px auto 0;
    }
    /* Avatar por defecto cuando el comercio no tiene logo_url */
    .perfil-logo-fallback {
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
      background: var(--surface-2);
    }
    /* Deja espacio para que el logo superpuesto no tape el texto */
    .detail-banner-wrap.has-banner + #promo-detail-header,
    .detail-banner-wrap.has-banner + #perfil-comercio-info {
      padding-top: 30px;
    }
 
    /* ────────────────────────────────────────
       PROMO DETAIL HEADER
    ──────────────────────────────────────── */
    #promo-detail-header {
      display: flex;
      align-items: center;
      padding: 12px 16px;
      gap: 10px;
    }
    #promo-detail-header .promo-store-name {
      flex: 1;
      font-size: 17px;
      font-weight: 800;
      color: var(--text);
    }
    #close-promo-btn {
      background: var(--accent);
      color: #fff;
      border-radius: 50%;
      width: 34px; height: 34px;
      display: flex; align-items: center; justify-content: center;
      font-size: 18px;
      transition: background .15s, transform .15s;
    }
    #close-promo-btn:hover { background: var(--danger); transform: rotate(90deg); }
 
    /* ────────────────────────────────────────
       PRODUCT CARD
    ──────────────────────────────────────── */
    .product-card {
      background: var(--surface);
      border-radius: var(--radius);
      margin: 8px 12px;
      padding: 14px;
      border-left: 4px solid var(--accent);
      box-shadow: var(--shadow);
      transition: background .25s, box-shadow .2s;
    }
    .product-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.13); }
    /* En modo oscuro la sombra casi no se percibe sobre --surface/--bg
       ya oscuros; un borde sutil devuelve la sensación de elevación.
       Se usa border-top/right/bottom para no pisar el border-left de acento. */
    [data-theme="dark"] .product-card {
      border-top: 1px solid rgba(255,255,255,.08);
      border-right: 1px solid rgba(255,255,255,.08);
      border-bottom: 1px solid rgba(255,255,255,.08);
    }
    .product-card-top {
      display: flex;
      gap: 12px;
    }
    .product-img-wrap {
      position: relative;
      flex-shrink: 0;
    }
    .product-img-wrap img {
      width: 72px; height: 72px;
      border-radius: 12px;
      object-fit: contain;
      background: #fff;
      border: 1px solid var(--border);
    }
    .offer-badge {
      position: absolute;
      top: -5px; left: -5px;
      background: var(--danger);
      color: #fff;
      font-size: 8px;
      font-weight: 900;
      padding: 2px 5px;
      border-radius: 6px;
      letter-spacing: .5px;
      box-shadow: 0 2px 6px rgba(255,71,87,.4);
    }
    .product-info { flex: 1; min-width: 0; }
    .product-name {
      font-size: 1rem;
      font-weight: 800;
      color: var(--text);
      line-height: 1.2;
      margin-bottom: 2px;

      overflow-wrap: break-word;
      word-wrap: break-word;
      word-break: break-word;  
    }
    .product-detail {
      font-size: 12px;
      color: var(--subtext);
      margin-bottom: 8px;

      overflow-wrap: break-word;
      word-wrap: break-word;
      word-break: break-word;  
    }
 
    /* Price list inside card */
    .price-list {
      margin-top: 12px; /* la lista ya no vive dentro de .product-info: ocupa todo el ancho de la tarjeta */
      border-top: 1px solid var(--border);
      padding-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .price-item { }
    .price-row {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 4px 0;
      transition: opacity .15s;
    }
    .price-row:hover { opacity: .85; }
    .price-row:active { opacity: .7; }
    .store-logo-mini {
      width: 36px; height: 22px;
      border-radius: 5px;
      object-fit: contain;
      background: #fff;
      border: 1px solid var(--border);
      flex-shrink: 0;
    }
    .store-info { flex: 1; min-width: 0; }
    .verified-dot {
 
      display: inline-flex; align-items: center; justify-content: center;
 
      width: 14px; height: 14px; background: #67ac46; border-radius: 50%;
 
      color: #fff; font-size: 9px; font-weight: 900;
 
      margin-left: 3px; flex-shrink: 0; vertical-align: middle;
 
    }
 
    .store-name {
 
      font-size: 13px;
 
      font-weight: 700;
 
      color: var(--text);
 
      white-space: nowrap;
 
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .store-location-row {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: 0;      /* permite que los hijos se recorten en vez de desbordar sobre el precio */
      overflow: hidden;
    }
    .store-municipio {
      font-size: 10px;
      color: var(--subtext);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 0 0 auto;   /* no se encoge: cede antes el texto de "Actualizado hace…" */
      max-width: 9em;   /* …salvo que el municipio sea larguísimo (entonces sí lleva "…") */
    }
    .chevron-icon { color: var(--subtext); transition: transform .2s; flex-shrink: 0; }
    .chevron-icon.open { transform: rotate(180deg); }
    .price-col { text-align: right; flex-shrink: 0; }
    .price-usd {
      font-size: 1.125rem;
      font-weight: 900;
      color: var(--accent);
      line-height: 1;
    }
    [data-theme="dark"] .price-usd { color: #cddc39; }
    .price-bs {
      font-size: 11px;
      color: var(--subtext);
    }
    /* ── INSIGNIA "MEJOR PRECIO" ───────────────────────────────────
       Pill en menta suave con relieve (brillo interior + sombra tenue)
       sobre el precio más bajo de la tarjeta. Los tonos van como variables
       locales para poder retocarlos en un solo lugar; en tema oscuro se
       reutiliza el lima que ya usa .price-usd.
       Va apilada en dos líneas ("Mejor Precio:" sobre "$1.09") en TODOS los
       anchos: en una sola línea medía ~140px y le quitaba espacio al nombre
       del comercio justo en la fila más importante (y en escritorio las
       tarjetas van en 3 columnas, así que su ancho es el de un móvil). */
    .price-best {
      --best-bg-top:  #ECFDF5;
      --best-bg-bot:  #D1FAE5;
      --best-border:  #A7F3D0;
      --best-fg:      #047857;
      --best-glow:    rgba(5,150,105,.20);
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      padding: 4px 11px 5px;
      border-radius: 16px;
      border: 1px solid var(--best-border);
      background: linear-gradient(180deg, var(--best-bg-top) 0%, var(--best-bg-bot) 100%);
      color: var(--best-fg);
      box-shadow: 0 1px 0 rgba(255,255,255,.95) inset, 0 2px 6px var(--best-glow);
      white-space: nowrap;
      line-height: 1.1;
      text-align: center;
    }
    .price-best-label { font-size: 9.5px; font-weight: 800; letter-spacing: .2px; }
    .price-best-value { font-size: 1.0625rem; font-weight: 900; }
    [data-theme="dark"] .price-best {
      --best-bg-top:  rgba(205,220,57,.20);
      --best-bg-bot:  rgba(205,220,57,.11);
      --best-border:  rgba(205,220,57,.38);
      --best-fg:      #cddc39;
      --best-glow:    rgba(0,0,0,.35);
      box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 2px 6px var(--best-glow);
    }
    .address-box {
      background: var(--input-bg);
      border-left: 3px solid var(--accent);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      padding: 8px 10px;
      margin-top: 6px;
      display: none;
    }
    .address-box.open { display: block; }
    .address-text {
      font-size: 11px;
      font-style: italic;
      color: var(--subtext);
    }
    .horario-text {
      font-size: 11px;
      font-weight: 700;
      color: var(--accent);
      margin-top: 3px;
    }
 
    /* Card buttons */
    .card-buttons {
      display: flex;
      gap: 10px;
      margin-top: 12px;
      align-items: center;
    }
    .btn-fav {
      background: var(--input-bg);
      border-radius: 12px;
      width: 44px; height: 44px;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      transition: background .15s, transform .15s;
    }
    .btn-fav:hover { transform: scale(1.1); }
    .btn-fav svg { transition: fill .2s; }
    .btn-mercado {
      flex: 1;
      /*background: linear-gradient(135deg, var(--accent), var(--accent-2)); #0F172A*/
      background: var(--input-bg);     
      color: var(--text);
      border-radius: 12px;
      height: 44px;
      display: flex; align-items: center; justify-content: center;
      gap: 8px;
      font-size: 14px;
      font-weight: 800;
      letter-spacing: .3px;
      transition: transform .15s, box-shadow .15s;
      /*box-shadow: 0 4px 14px rgba(45,187,84,.35);*/
    }
    .btn-mercado:hover { transform: translateY(-1px); 
                        /*box-shadow: 0 6px 20px rgba(45,187,84,.45);*/ }
    .btn-mercado:active { transform: translateY(0); }
 
    /* ────────────────────────────────────────
       LOADING SPINNER
    ──────────────────────────────────────── */
    #loading-indicator {
      display: none;
      padding: 20px 0;
    }
    #loading-indicator.active { display: block; }
    .spinner {
      width: 40px; height: 40px;
      margin: 20px auto;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ────────────────────────────────────────
       SKELETON LOADER (resultados de búsqueda)
       Misma silueta que .product-card (imagen 72x72,
       botones 44px) para que no haya salto de layout
       cuando llegan los datos reales. El shimmer se
       neutraliza automáticamente con la regla global
       de prefers-reduced-motion.
    ──────────────────────────────────────── */
    #skeleton-list { display: none; }
    #skeleton-list.active { display: block; }
    .skeleton-card {
      background: var(--surface);
      border-radius: var(--radius);
      margin: 8px 12px;
      padding: 14px;
      border-left: 4px solid var(--border);
      box-shadow: var(--shadow);
    }
    .skeleton-top { display: flex; gap: 12px; }
    .skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
    .skeleton-price-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
    .skeleton-price-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
    .skeleton-buttons { display: flex; gap: 10px; margin-top: 12px; }

    .skeleton-img,
    .skeleton-line,
    .skeleton-logo,
    .skeleton-price,
    .skeleton-btn-fav,
    .skeleton-btn-mercado {
      background: linear-gradient(90deg, var(--input-bg) 25%, var(--border) 37%, var(--input-bg) 63%);
      background-size: 400px 100%;
      animation: skeletonShimmer 1.4s ease-in-out infinite;
    }
    .skeleton-img         { width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0; }
    .skeleton-line         { height: 12px; border-radius: 6px; }
    .skeleton-line.name    { width: 70%; height: 15px; }
    .skeleton-line.detail  { width: 45%; }
    .skeleton-logo         { width: 32px; height: 22px; border-radius: 5px; flex-shrink: 0; }
    .skeleton-price        { width: 54px; height: 12px; border-radius: 6px; margin-left: auto; }
    .skeleton-btn-fav      { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
    .skeleton-btn-mercado  { flex: 1; height: 44px; border-radius: 12px; }
    @keyframes skeletonShimmer {
      0%   { background-position: -400px 0; }
      100% { background-position: 400px 0; }
    }
 
    /* Empty state */
    .empty-state {
      text-align: center;
      padding: 40px 20px;
      color: var(--subtext);
      font-size: 14px;
      font-weight: 600;
    }
    .empty-state .empty-icon { font-size: 40px; margin-bottom: 10px; }
 
    /* ────────────────────────────────────────
       MI MERCADO TAB
    ──────────────────────────────────────── */
    .mercado-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 16px 8px;
    }
    .mercado-title {
      font-family: "Montserrat", sans-serif;
      font-size: 1.5rem;
      font-weight: 800;
      font-style: italic;
      letter-spacing: -.3px;
      color: var(--text);
    }
    .mercado-actions {
      display: flex;
      gap: 8px;
    }
    .btn-action {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      width: 42px; height: 42px;
      display: flex; align-items: center; justify-content: center;
      color: var(--accent);
      transition: background .15s, transform .15s;
      box-shadow: var(--shadow);
    }
    .btn-action:hover { transform: scale(1.08); background: var(--input-bg); }
 
    /* Comparativa */
    .comp-section { margin-bottom: 8px; }
    .comp-title {
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--accent);
      padding: 0 16px;
      margin-bottom: 8px;
    }
    /* Fila horizontal deslizable: las tarjetas de comercio van una al lado
       de la otra (nunca apiladas) y el conjunto se desliza horizontalmente
       (swipe) para revelar más comercios — funciona igual en móvil (touch)
       y en escritorio (scroll-btn / trackpad / shift+rueda). */
    .comp-list {
      display: flex;
      align-items: stretch;
      gap: 10px;
      overflow-x: auto;
      overflow-y: visible;
      padding: 4px 16px 16px;
      scroll-snap-type: x proximity;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .comp-list::-webkit-scrollbar { display: none; }
    .comp-card {
      position: relative;
      flex: 0 0 172px;
      width: 172px;
      scroll-snap-align: start;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 16px;
      padding: 12px;
      transition: border-color .2s, box-shadow .2s;
      box-shadow: var(--shadow);
    }
    .comp-card.winner {
      border-color: var(--accent);
      background: var(--surface-2);
      box-shadow: 0 4px 20px rgba(45,187,84,.2);
    }
    [data-theme="dark"] .comp-card.winner { background: #1a2e1d; }
    /* Tarjeta del comercio elegido por el usuario ("Planear mi visita") */
    .comp-card.selected {
      border-color: var(--accent);
      border-width: 2px;
      box-shadow: 0 0 0 3px rgba(45,187,84,.16), var(--shadow);
    }
    .comp-selected-flag {
      position: absolute;
      top: -9px;
      right: 10px;
      width: 22px; height: 22px;
      background: var(--accent);
      color: #fff;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 6px rgba(0,0,0,.25);
    }
    .winner-badge {
      background: var(--accent);
      color: #1a1a1a;
      font-size: 8px;
      font-weight: 900;
      padding: 2px 7px;
      border-radius: 5px;
      display: inline-block;
      margin-bottom: 6px;
      letter-spacing: .5px;
    }
    .comp-card-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 4px;
    }
    .comp-store-name {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px;
      font-size: 13px;
      font-weight: 800;
      color: var(--text);
      flex: 1;
      line-height: 1.3;
    }
    .coverage-text {
      font-size: 10.5px;
      font-weight: 700;
      margin-top: 4px;
    }
    .coverage-full { color: var(--accent); }
    .coverage-partial { color: var(--warning); }
    .comp-total-usd {
      font-size: 1.4rem;
      font-weight: 900;
      color: var(--accent);
      margin-top: 6px;
      line-height: 1;
    }
    .comp-total-bs {
      font-size: 11px;
      color: var(--subtext);
      margin-top: 2px;
    }

    /* ── Dirección y horario: acordeón independiente por tarjeta ─────
       Optimiza el espacio de la tarjeta; cada comercio abre/cierra su
       propio desplegable sin afectar a los demás (ver toggleCompDetails). */
    .comp-details-toggle {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      width: 100%;
      background: none;
      border: none;
      border-top: 1px dashed var(--border);
      padding: 7px 2px 2px;
      margin-top: 10px;
      font-family: var(--font);
      font-size: 10px;
      font-weight: 700;
      color: var(--subtext);
      cursor: pointer;
    }
    .comp-details-toggle:hover { color: var(--accent); }
    .comp-details-chevron { flex-shrink: 0; transition: transform .2s; }
    .comp-details-toggle[aria-expanded="true"] .comp-details-chevron { transform: rotate(180deg); }
    .comp-details-row {
      max-height: 0;
      overflow: hidden;
      background: var(--input-bg);
      border-left: 3px solid var(--accent);
      border-radius: 0 8px 8px 0;
      padding: 0 9px;
      margin-top: 0;
      transition: max-height .25s ease, padding .25s ease, margin-top .25s ease;
    }
    .comp-details-row.open {
      max-height: 130px;
      padding: 8px 9px;
      margin-top: 8px;
    }
    .comp-address-text { font-size: 10.5px; font-style: italic; color: var(--subtext); line-height: 1.4; }
    .comp-horario { font-size: 10.5px; font-weight: 700; color: var(--accent); margin-top: 4px; }

    /* ── Barra de CTAs permanentes ("Planear mi visita" / "Solicitar
       Delivery") — siempre lado a lado (2 columnas), incluso en móvil,
       para optimizar el espacio vertical de la tarjeta. ────────────── */
    .comp-cta-bar {
      display: flex;
      gap: 6px;
      margin-top: 10px;
    }
    .comp-cta-bar > button {
      flex: 1 1 0;
      min-width: 0;
    }
    .btn-buy-here,
    .btn-delivery {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      width: 100%;
      border-radius: 10px;
      padding: 9px 4px;
      font-family: var(--font);
      font-size: 10px;
      font-weight: 800;
      line-height: 1.2;
      cursor: pointer;
      white-space: normal;
      text-align: center;
      transition: transform .15s, box-shadow .15s, background .15s;
    }
    .btn-buy-here {
      border: none;
      background: var(--accent);
      color: #fff;
      box-shadow: 0 4px 14px rgba(45,187,84,.3);
    }
    .btn-buy-here:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(45,187,84,.4); }
    .btn-buy-here:active { transform: scale(.97); }
    /* Secundario/distintivo: outline en el verde de WhatsApp, para
       diferenciarse claramente del botón primario sólido. */
    .btn-delivery {
      border: 1.5px solid #25D366;
      background: rgba(37,211,102,.12);
      color: #1a9e4e;
    }
    [data-theme="dark"] .btn-delivery { background: rgba(37,211,102,.18); color: #3ddc84; }
    .btn-delivery:hover { background: rgba(37,211,102,.22); transform: translateY(-1px); }
    .btn-delivery:active { transform: scale(.97); }
    /* Sin delivery disponible: desactivado con etiqueta descriptiva en vez
       de fallar silenciosamente al hacer clic. */
    .btn-delivery.disabled,
    .btn-delivery:disabled {
      border-color: var(--border);
      background: var(--input-bg);
      color: var(--subtext);
      cursor: not-allowed;
      opacity: .85;
    }
    .btn-delivery.disabled:hover,
    .btn-delivery:disabled:hover { background: var(--input-bg); transform: none; }
 
    /* Ahorro banner */
    #ahorro-section {
      margin: 0 12px 10px;
      background: var(--surface);
      border: 1.5px dashed var(--accent);
      border-radius: 16px;
      padding: 14px;
      display: none;
    }
    #ahorro-section.visible { display: block; }
    [data-theme="dark"] #ahorro-section { background: #1e2d1f; }
    .ahorro-inner {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .ahorro-emoji { font-size: 24px; flex-shrink: 0; }
    .ahorro-texts { flex: 1; }
    .ahorro-title { font-size: 14px; font-weight: 800; color: var(--text); }
    .ahorro-sub { font-size: 11px; color: var(--subtext); }
    .ahorro-amounts { text-align: right; }
    .ahorro-usd { font-size: 18px; font-weight: 900; color: var(--accent); }
    .ahorro-bs { font-size: 11px; font-weight: 600; color: var(--subtext); }
 
    /* Mercado item cards */
    .mercado-item {
      background: var(--surface);
      border-radius: 14px;
      margin: 6px 12px;
      padding: 12px;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      box-shadow: var(--shadow);
      transition: background .25s;
    }
    [data-theme="dark"] .mercado-item {
      border: 1px solid rgba(255,255,255,.08);
    }
    .mercado-item img {
      width: 52px; height: 52px;
      border-radius: 10px;
      object-fit: contain;
      background: #fff;
      border: 1px solid var(--border);
      flex-shrink: 0;
    }
    .mercado-info { flex: 1; min-width: 0; }
    .mercado-prod-name {
      font-size: 15px;
      font-weight: 800;
      color: var(--text);
      line-height: 1.2;
    }
    .mercado-prod-detail {
      font-size: 12px;
      color: var(--subtext);
      margin-bottom: 4px;
    }
    .mercado-price-store {
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
      color: var(--accent);
      letter-spacing: .5px;
    }
    .mercado-price-total {
      font-size: 15px;
      font-weight: 900;
      color: var(--text);
    }
    .mercado-price-unit {
      font-size: 12px;
      color: var(--subtext);
    }
    .mercado-price-bs {
      font-size: 11px;
      color: var(--subtext);
    }
    .qty-controls {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 6px;
    }
    .qty-btn {
      background: #444;
      color: #fff;
      border-radius: 6px;
      width: 26px; height: 26px;
      display: flex; align-items: center; justify-content: center;
      font-size: 16px;
      font-weight: 900;
      line-height: 1;
      transition: background .15s;
    }
    .qty-btn:hover { background: var(--accent); }
    .qty-text {
      font-size: 16px;
      font-weight: 800;
      color: var(--accent);
      min-width: 20px;
      text-align: center;
    }
    .btn-delete {
      flex-shrink: 0;
      color: var(--danger);
      background: none;
      padding: 6px;
      border-radius: 8px;
      transition: background .15s, transform .15s;
      display: flex; align-items: center;
    }
    .btn-delete:hover { background: rgba(255,71,87,.12); transform: scale(1.1); }
 
    /* Vaciar btn */
    #btn-vaciar {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      background: #2a1212;
      border: 1.5px solid var(--danger);
      color: var(--danger);
      border-radius: 14px;
      padding: 14px;
      margin: 16px 12px 0;
      font-size: 13px;
      font-weight: 800;
      letter-spacing: .5px;
      transition: background .15s;
    }
    #btn-vaciar:hover { background: rgba(255,71,87,.15); }
 
    /* ────────────────────────────────────────
       BOTTOM NAV
    ──────────────────────────────────────── */
    #bottom-nav {
      position: fixed;
      bottom: 0; left: 0;
      width: 100%;
      background: var(--surface);
      border-top: 1px solid var(--border);
      display: flex;
      height: 76px;
      padding-bottom: 8px;
      z-index: 200;
      box-shadow: 0 -4px 24px rgba(0,0,0,.08);
      transition: background .25s;
    }
    .nav-tab-btn {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      color: var(--subtext);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .3px;
      position: relative;
      transition: color .2s;
      /* Bigger tap target */
      padding: 0;
      height: 100%;
      min-height: 68px;
      -webkit-tap-highlight-color: transparent;
    }
    .nav-tab-btn:active .nav-icon { transform: scale(.88) translateY(-2px) !important; }
    .nav-tab-btn.active { color: var(--accent); }
    .nav-tab-btn .nav-icon { transition: transform .2s; }
    .nav-tab-btn.active .nav-icon { transform: translateY(-2px); }
    .nav-badge {
      position: absolute;
      top: 8px;
      right: calc(50% - 18px);
      background: var(--danger);
      color: #fff;
      font-size: 9px;
      font-weight: 900;
      min-width: 16px;
      height: 16px;
      border-radius: 8px;
      display: flex; align-items: center; justify-content: center;
      padding: 0 3px;
    }
 
    /* ────────────────────────────────────────
       SCANNER OVERLAY
    ──────────────────────────────────────── */
    #scanner-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.92);
      z-index: 999;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 20px;
    }
    #scanner-overlay.active { display: flex; }
    #scanner-container {
      width: 300px;
      max-width: 90vw;
      border-radius: 16px;
      overflow: hidden;
    }
    .scanner-hint {
      color: #fff;
      font-size: 14px;
      font-weight: 600;
      text-align: center;
      padding: 0 20px;
      opacity: .8;
    }
    #cancel-scan-btn {
      background: var(--danger);
      color: #fff;
      border-radius: 14px;
      padding: 14px 36px;
      font-size: 15px;
      font-weight: 800;
      letter-spacing: .5px;
      transition: background .15s, transform .15s;
    }
    #cancel-scan-btn:hover { background: #e03047; transform: scale(1.04); }
 
    /* ────────────────────────────────────────
       TOAST NOTIFICATION
    ──────────────────────────────────────── */
    #toast {
      position: fixed;
      bottom: 90px;
      left: 50%; transform: translateX(-50%) translateY(20px);
      background: #1e1e1e;
      color: #fff;
      padding: 12px 22px;
      border-radius: 24px;
      font-size: 0.8125rem; /* 13px → rem */
      font-weight: 700;
      z-index: 1100;
      opacity: 0;
      transition: opacity .3s, transform .3s;
      white-space: nowrap;
      max-width: min(90vw, 420px);
      box-shadow: 0 8px 30px rgba(0,0,0,.35);
      pointer-events: none;
    }
    #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
    [data-theme="light"] #toast { background: #1C1C1E; }
 
    /* ────────────────────────────────────────
       RESPONSIVE DESKTOP TWEAKS
    ──────────────────────────────────────── */
    /* 541px rule replaced by full desktop media query below */
 
    /* ────────────────────────────────────────
       ACCESIBILIDAD — prefiere movimiento reducido
       Neutraliza animaciones/transiciones para quienes
       activaron esa preferencia en su sistema operativo.
       Se usa una duración casi nula (en vez de "none")
       para no romper flujos que dependan de eventos
       animationend/transitionend.
    ──────────────────────────────────────── */
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
      }
    }

    /* ────────────────────────────────────────
       ANIMATIONS
    ──────────────────────────────────────── */
    .fade-in {
      animation: fadeIn .3s ease forwards;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .slide-in {
      animation: slideIn .35s ease forwards;
    }
    @keyframes slideIn {
      from { opacity: 0; transform: scale(.95); }
      to   { opacity: 1; transform: scale(1); }
    }
    /* ────────────────────────────────────────
       PWA INSTALL BANNER
    ──────────────────────────────────────── */
    #install-banner {
      position: fixed;
      bottom: 84px;
      left: 50%;
      transform: translateX(-50%) translateY(120%);
      width: calc(100% - 24px);
      max-width: 516px;
      background: var(--surface);
      border: 1.5px solid var(--accent);
      border-radius: 20px;
      padding: 16px;
      z-index: 300;
      box-shadow: 0 8px 32px rgba(0,0,0,.18);
      display: flex;
      gap: 12px;
      align-items: flex-start;
      transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s;
      opacity: 0;
    }
    #install-banner.show {
      transform: translateX(-50%) translateY(0);
      opacity: 1;
    }
    .install-icon {
      width: 48px; height: 48px;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      border-radius: 12px;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      font-size: 24px;
      box-shadow: 0 4px 12px rgba(45,187,84,.35);
    }
    .install-body { flex: 1; min-width: 0; }
    .install-title {
      font-size: 15px;
      font-weight: 800;
      color: var(--text);
      margin-bottom: 2px;
    }
    .install-sub {
      font-size: 12px;
      color: var(--subtext);
      line-height: 1.4;
    }
    /* iOS step hint */
    .install-ios-steps {
      margin-top: 8px;
      background: var(--input-bg);
      border-radius: 10px;
      padding: 8px 10px;
      font-size: 12px;
      color: var(--text);
      line-height: 1.6;
      display: none;
    }
    .install-ios-steps.visible { display: block; }
    .install-actions {
      display: flex;
      gap: 8px;
      margin-top: 10px;
    }
    .btn-install {
      flex: 1;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      color: #fff;
      border-radius: 10px;
      padding: 9px 14px;
      font-size: 13px;
      font-weight: 800;
      border: none;
      cursor: pointer;
      transition: transform .15s, box-shadow .15s;
      box-shadow: 0 3px 10px rgba(45,187,84,.35);
    }
    .btn-install:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(45,187,84,.45); }
    .btn-install-dismiss {
      background: var(--input-bg);
      color: var(--subtext);
      border-radius: 10px;
      padding: 9px 14px;
      font-size: 13px;
      font-weight: 700;
      border: none;
      cursor: pointer;
    }
    .btn-install-dismiss:hover { background: var(--border); }
 
 
    /* ── Scroll-section wrapper (shared mobile+desktop) ──── */
    .scroll-wrapper { position: relative; }
    .scroll-btn { display: none; }
 
    /* ── Images always fluid ──────────────────────────────── */
    img { max-width: 100%; height: auto; }
 
    /* ═══════════════════════════════════════════════════════
       MOBILE  (≤ 767px) — sticky header + search area
    ═══════════════════════════════════════════════════════ */
    @media (max-width: 767px) {
      #top-wrapper {
        position: sticky;
        top: 0;
        z-index: 200;
      }
      #app-header {
        position: static; /* top-wrapper handles stickiness */
        z-index: auto;
      }
      #search-area {
        position: static; /* inside sticky top-wrapper */
        z-index: auto;
        border-bottom: 1px solid var(--border);
      }
      /* FIX 12 — PWA banner above mobile nav */
      #install-banner { bottom: 84px; }
    }
 
    /* ═══════════════════════════════════════════════════════
       DESKTOP  (≥ 768px) — full layout
    ═══════════════════════════════════════════════════════ */
    @media (min-width: 768px) {
 
      /* ── FIX 3: show desktop-only elements ────────────── */
      .desktop-only { display: flex !important; }
      .mobile-only  { display: none !important; }
 
      /* ── Sticky top-wrapper ────────────────────────────── */
      #top-wrapper {
        position: sticky;
        top: 0;
        z-index: 200;
      }
      #app-header { position: static; z-index: auto; }
      #search-area { position: static; z-index: auto; }
 
      /* ── App header: logo + search + controls ─────────── */
      #app-header {
        justify-content: space-between;
        padding: 0 32px;
        min-height: var(--header-h-desktop); /* FIX 4: use variable */
        gap: 20px;
      }
 
      /* Desktop search slot */
      #header-search-desktop {
        flex: 1;
        max-width: 860px;
        align-items: center;
      }
      #header-search-desktop .search-bar {
        width: 100%;
        background: rgba(255,255,255,0.22);
        border: 1.5px solid rgba(255,255,255,0.45);
        height: 40px;
        border-radius: 12px;
      }
      #header-search-desktop .search-bar svg.search-icon { color: rgba(255,255,255,0.85); }
      #header-search-desktop #search-input-d {
        flex: 1;
        background: none;
        border: none;
        outline: none; width: 100%;
        /*color: #fff;*/
        font-size: 0.875rem;
      }
      #header-search-desktop #search-input-d::placeholder { color: rgba(255,255,255,0.75); }
      #header-search-desktop #clear-btn-d {
        background: rgba(255,255,255,0.25);
        color: #fff;
      }
      #header-search-desktop #scan-btn-d { color: rgba(255,255,255,0.9); }
      /* Tipo chip adaptado al header desktop (glass style) */
      #header-search-desktop .search-bar-wrap { display: flex; align-items: stretch; width: 100%; }
      #header-search-desktop .tipo-chip-d {
        background: rgba(255,255,255,0.18);
        border: 1.5px solid rgba(255,255,255,0.45);
        border-right: 1px solid rgba(255,255,255,0.3);
        border-radius: 12px 0 0 12px;
        height: 40px;
        padding: 0 6px 0 10px;
      }
      #header-search-desktop .tipo-chip-d select {
        color: #fff;
        font-size: 11px;
        max-width: 96px;
      }
      #header-search-desktop .tipo-chip-d::after { border-top-color: rgba(255,255,255,0.7); }
      #header-search-desktop .tipo-chip-d .tipo-emoji { font-size: 14px; }
      #header-search-desktop .search-bar {
        border-radius: 0 12px 12px 0;
        border-left: none;
        flex: 1;
        min-width: 0;
      }

 
      /* Header right controls */
      .header-right-desktop {
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
      }
      .header-right-desktop #theme-btn {
        background: rgba(255,255,255,0.22);
        border: 1px solid rgba(255,255,255,0.35);
      }
      .header-right-desktop #theme-btn svg { stroke: #fff; }
      .header-right-desktop #menu-btn-desktop {
        background: rgba(255,255,255,0.22);
        border: 1px solid rgba(255,255,255,0.35);
        border-radius: 50%;
        width: 38px; height: 38px;
        display: flex; align-items: center; justify-content: center;
        cursor: pointer;
        color: #fff;
        transition: background .2s;
      }
      .header-right-desktop #menu-btn-desktop:hover { background: rgba(255,255,255,0.35); }
 
      /* Hide floating mobile menu btn */
      #menu-btn { display: none !important; }
 
      /* FIX 10: dropdown top = header height + 2px gutter */
      #app-menu {
        top: calc(var(--header-h-desktop) + 2px);
        right: 32px;
      }
 
      /* FIX 1: Mobile search area hidden — nav is OUTSIDE it now */
      #search-area { display: none !important; }
 
      /* ── Desktop horizontal nav ────────────────────────── */
      #desktop-nav {
        background: var(--surface);
        border-bottom: 2px solid var(--border);
        box-shadow: 0 2px 8px rgba(0,0,0,.06);
      }
      .desktop-nav-inner {
        display: flex;
        align-items: center;
        max-width: 1200px;
        width: 100%;
        margin: 0 auto;
        padding: 0 24px;
        gap: 4px;
      }
      .desktop-nav-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 20px;
        height: var(--desktop-nav-h);
        font-size: 0.875rem;
        font-weight: 700;
        color: var(--subtext);
        border-bottom: 3px solid transparent;
        margin-bottom: -2px;
        border-radius: 0;
        transition: color .2s, border-color .2s;
        white-space: nowrap;
        position: relative;
      }
      .desktop-nav-btn:hover { color: var(--accent); }
      .desktop-nav-btn.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
      }
      .desktop-nav-badge {
        background: var(--danger);
        color: #fff;
        font-size: 0.5625rem;
        font-weight: 900;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
        padding: 0 3px;
      }
 
      /* Hide mobile bottom nav */
      #bottom-nav { display: none !important; }
 
      /* ── Content area: centered max-width ──────────────── */
      #main-content {
        max-width: 1200px;
        margin: 0 auto;
        padding-left: 24px;
        padding-right: 24px;
        padding-bottom: 60px;
        /* FIX 5: recalculate min-height for desktop chrome */
        min-height: calc(100dvh - var(--header-h-desktop) - var(--desktop-nav-h));
      }
 
      /* Slogan */
      #slogan-section { padding: 28px 0 16px; }
      .slogan-busca { font-size: 1.4rem; }
      .slogan-main  { font-size: 2.4rem; }
 
      /* Section titles */
      .section-title { padding: 0; font-size: 1.1rem; margin-top: 28px; }
 
      /* FIX 6: empty/state elements span full grid width */
      .trending-state,
      .empty-state,
      #no-results {
        grid-column: 1 / -1;
      }
 
      /* ── Scroll buttons ────────────────────────────────── */
      #promo-section .scroll-wrapper,
      .comp-section .scroll-wrapper {
        display: flex;
        align-items: center;
        gap: 0;
      }
      .scroll-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 38px; height: 38px;
        border-radius: 50%;
        background: var(--surface);
        border: 1.5px solid var(--border);
        color: var(--text);
        font-size: 18px;
        font-weight: 900;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,.1);
        transition: background .15s, transform .15s;
        z-index: 2;
        line-height: 1;
      }
      .scroll-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }
      .scroll-btn.prev { margin-right: 6px; }
      .scroll-btn.next { margin-left: 6px; }
 
      .promo-scroll { padding: 4px 0 10px; }
 
      /* Comparativa en escritorio: misma fila horizontal deslizable que en
         móvil, con tarjetas más anchas y los botones prev/next visibles
         arriba para quienes no usan trackpad. */
      .comp-list {
        gap: 16px;
        padding: 4px 8px 16px;
      }
      .comp-card {
        flex-basis: 250px;
        width: 250px;
      }
 
      .promo-banner { width: 380px; height: 160px; }

      /* ── Detail banner: banner + logo más grandes en escritorio
         (compartido por Promo Detail y Perfil de Comercio) ────────── */
      .detail-banner-wrap { max-width: 640px; margin: 14px 16px 0; }
      .promo-detail-banner-img { height: 220px; }
      .promo-detail-logo { width: 72px; height: 72px; border-radius: 18px; }
      .detail-banner-wrap.has-banner .promo-detail-logo { left: 18px; bottom: -26px; }
      .detail-banner-wrap.has-banner + #promo-detail-header,
      .detail-banner-wrap.has-banner + #perfil-comercio-info { padding-top: 36px; }
 
      /* ── Results grid ──────────────────────────────────── */
      #results-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 0 16px;
        align-items: start;
      }
      .product-card { margin: 8px 0; }
 
      /* ── Trending grid ─────────────────────────────────── */
      #trending-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 0 16px;
        align-items: start;
      }
 
      /* ── Mercado tab ───────────────────────────────────── */
      #mercado-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 0 16px;
        align-items: start;
      }
      .mercado-item { margin: 6px 0; }
      #ahorro-section { margin: 0 0 14px; }
      #btn-vaciar { margin: 16px 0 0; }
 
      /* Legal modal */
      .legal-modal { max-width: 680px; border-radius: 20px; margin: auto; }
      .legal-modal-overlay { align-items: center; }
 
      /* FIX 9: Toast — no bottom nav, allow wrapping */
      #toast {
        bottom: 32px;
        white-space: normal;
        text-align: center;
      }
 
      /* FIX 12: PWA install banner */
      #install-banner { bottom: 32px; max-width: 520px; }
 
    } /* end @media 768px */
 
    @media (min-width: 1024px) {
      #results-list  { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
      #trending-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
      #mercado-list  { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
    }
 
    @media (min-width: 1400px) {
      #main-content        { max-width: 1400px; }
      .desktop-nav-inner   { max-width: 1400px; }
    }

    /* ────────────────────────────────────────
       WELCOME / LOCATION MODAL
    ──────────────────────────────────────── */
    #welcome-modal-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,.65);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 1000;
      display: flex; align-items: center; justify-content: center;
      padding: 16px;
      opacity: 0; pointer-events: none;
      transition: opacity .3s;
    }
    #welcome-modal-overlay.open {
      opacity: 1; pointer-events: all;
    }
    #welcome-modal {
      background: var(--surface);
      border-radius: 24px;
      width: 100%; max-width: 420px;
      padding: 28px 24px 24px;
      box-shadow: 0 24px 64px rgba(0,0,0,.35);
      transform: scale(.93) translateY(12px);
      transition: transform .32s cubic-bezier(.34,1.56,.64,1);
      position: relative;
    }
    #welcome-modal-overlay.open #welcome-modal {
      transform: scale(1) translateY(0);
    }
    .wm-icon {
      width: 60px; height: 60px;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      border-radius: 18px;
      display: flex; align-items: center; justify-content: center;
      margin: 0 auto 16px;
      box-shadow: 0 8px 24px rgba(45,187,84,.4);
      font-size: 28px;
    }
    .wm-title {
      font-size: 20px; font-weight: 900;
      text-align: center;
      color: var(--text);
      margin-bottom: 6px;
    }
    .wm-subtitle {
      font-size: 13px; color: var(--subtext);
      text-align: center; line-height: 1.5;
      margin-bottom: 22px;
    }
    .wm-subtitle strong { color: var(--accent); }
    .wm-field { margin-bottom: 14px; }
    .wm-label {
      display: block;
      font-size: 12px; font-weight: 800;
      color: var(--subtext);
      text-transform: uppercase; letter-spacing: .8px;
      margin-bottom: 6px;
    }
    .wm-input, .wm-select {
      width: 100%;
      background: var(--input-bg);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      padding: 0 14px;
      height: 48px;
      font-family: var(--font);
      font-size: 16px; font-weight: 600;
      color: var(--text);
      outline: none;
      appearance: none;
      -webkit-appearance: none;
      transition: border-color .2s, box-shadow .2s;
    }
    .wm-select {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 14px center;
      padding-right: 38px;
      cursor: pointer;
    }
    .wm-input:focus, .wm-select:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(45,187,84,.15);
    }
    .wm-select:disabled { opacity: .45; cursor: default; }
    .wm-btn-save {
      width: 100%;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      color: #fff;
      border-radius: 14px;
      height: 52px;
      font-size: 16px; font-weight: 800;
      letter-spacing: .3px;
      border: none; cursor: pointer;
      transition: transform .15s, box-shadow .15s;
      box-shadow: 0 6px 20px rgba(45,187,84,.4);
      margin-top: 6px;
    }
    .wm-btn-save:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(45,187,84,.5); }
    .wm-btn-save:active { transform: scale(.98); }
    .wm-btn-save:disabled { opacity: .5; transform: none; cursor: not-allowed; }
    .wm-close-btn {
      position: absolute; top: 14px; right: 14px;
      background: var(--input-bg);
      border: none; border-radius: 50%;
      width: 32px; height: 32px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; color: var(--subtext);
      font-size: 14px;
      transition: background .15s;
    }
    .wm-close-btn:hover { background: var(--border); }

    /* ────────────────────────────────────────
       ONBOARDING (carrusel de primera visita)
       Mismo look que el modal de bienvenida (reutiliza .wm-icon,
       .wm-title, .wm-subtitle y .wm-btn-save). z-index por encima del
       modal de ubicación (1000) y de las vistas de pantalla completa.
    ──────────────────────────────────────── */
    #onboarding-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,.65);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 1050;
      display: flex; align-items: center; justify-content: center;
      padding: 16px;
      opacity: 0; pointer-events: none;
      transition: opacity .3s;
    }
    #onboarding-overlay.open { opacity: 1; pointer-events: all; }
    #onboarding-card {
      background: var(--surface);
      border-radius: 24px;
      width: 100%; max-width: 420px;
      padding: 30px 24px 20px;
      box-shadow: 0 24px 64px rgba(0,0,0,.35);
      transform: scale(.93) translateY(12px);
      transition: transform .32s cubic-bezier(.34,1.56,.64,1);
    }
    #onboarding-overlay.open #onboarding-card { transform: scale(1) translateY(0); }
    /* Altura mínima fija para que la tarjeta no "salte" entre pasos de distinto largo */
    #ob-slide { min-height: 252px; }
    .ob-slide-in { animation: obSlideIn .28s ease both; }
    @keyframes obSlideIn {
      from { opacity: 0; transform: translateX(18px); }
      to   { opacity: 1; transform: none; }
    }
    .ob-icon {
      width: 76px; height: 76px;
      border-radius: 22px;
      margin-bottom: 18px;
      color: #fff;
    }
    /* En tema oscuro --accent es lima: un icono blanco perdería contraste */
    [data-theme="dark"] .ob-icon { color: #14391a; }
    .ob-dots {
      display: flex; justify-content: center; gap: 7px;
      margin: 2px 0 18px;
    }
    .ob-dot {
      width: 8px; height: 8px;
      border-radius: 4px;
      border: none; padding: 0;
      background: var(--border);
      cursor: pointer;
      transition: width .25s, background .25s;
    }
    .ob-dot.active { width: 22px; background: var(--accent); }
    .ob-actions { display: flex; align-items: center; gap: 10px; }
    .ob-skip {
      background: none; border: none;
      color: var(--subtext);
      font-family: var(--font);
      font-size: 14px; font-weight: 800;
      padding: 14px 12px;
      cursor: pointer;
    }
    .ob-skip:hover { color: var(--text); }
    .ob-next { flex: 1; width: auto; margin-top: 0; }
    @media (prefers-reduced-motion: reduce) {
      .ob-slide-in { animation: none; }
      #onboarding-card { transition: none; }
    }

    /* ────────────────────────────────────────
       NO-LOCATION MESSAGE
    ──────────────────────────────────────── */
    .no-location-msg {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      padding: 36px 24px;
      text-align: center;
    }
    .no-location-msg .nlm-icon { font-size: 38px; }
    .no-location-msg .nlm-title {
      font-size: 15px; font-weight: 800;
      color: var(--text);
    }
    .no-location-msg .nlm-text {
      font-size: 13px; color: var(--subtext);
      line-height: 1.5;
    }
    .nlm-btn {
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      color: #fff; border: none; cursor: pointer;
      border-radius: 12px;
      padding: 11px 22px;
      font-size: 14px; font-weight: 800;
      font-family: var(--font);
      transition: transform .15s, box-shadow .15s;
      box-shadow: 0 4px 14px rgba(45,187,84,.35);
    }
    .nlm-btn:hover { transform: translateY(-1px); }

    /* ────────────────────────────────────────
       PROFILE / GREETING
    ──────────────────────────────────────── */
    #greeting-bar {
      display: none;
      align-items: center;
      gap: 8px;
      padding: 8px 16px 2px;
    }
    #greeting-bar .greeting-avatar {
      width: 28px; height: 28px;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 900; color: #fff;
      flex-shrink: 0;
    }
    #greeting-bar .greeting-text {
      font-size: 13px; font-weight: 700;
      color: var(--text);
    }
    #greeting-bar .greeting-text span { color: var(--accent); }

    /* Desktop nav location chip */
    #desktop-location-chip {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 5px 12px 5px 8px;
      cursor: pointer;
      transition: background .15s, border-color .15s;
      max-width: 260px;
    }
    #desktop-location-chip:hover {
      background: var(--input-bg);
      border-color: var(--accent);
    }
    #desktop-location-chip svg { flex-shrink: 0; color: var(--accent); }
    #desktop-location-chip .chip-loc-text {
      font-size: 12px; font-weight: 700;
      color: var(--text);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    #desktop-location-chip .chip-edit {
      font-size: 10px; color: var(--subtext);
      white-space: nowrap; flex-shrink: 0;
    }
    #desktop-greeting-text {
      font-size: 13px; font-weight: 700;
      color: var(--subtext);
      white-space: nowrap;
      flex-shrink: 0;
    }
    #desktop-greeting-text span { color: var(--accent); }

    /* Profile menu item styles */
    .menu-item-profile {
      background: linear-gradient(135deg, rgba(45,187,84,.08), rgba(105,183,73,.08));
      border-bottom: 1px solid var(--border);
    }
    .profile-info-mini {
      flex-direction: column;
      align-items: flex-start !important;
      gap: 2px !important;
    }
    .profile-info-mini .pm-name {
      font-size: 14px; font-weight: 800; color: var(--text);
    }
    .profile-info-mini .pm-loc {
      font-size: 11px; color: var(--subtext);
    }

    /* Menu button pill label — ver definición consolidada de #menu-btn arriba */

    /* ────────────────────────────────────────
       PROMO DETAIL — GRID ON DESKTOP
    ──────────────────────────────────────── */
    @media (min-width: 768px) {
      #promo-products-list .slide-in {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 0 16px;
        align-items: start;
      }
      #promo-products-list .slide-in .product-card {
        margin: 8px 0;
      }
      #greeting-bar { display: none !important; }
    }
    @media (min-width: 1024px) {
      #promo-products-list .slide-in {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
      }
    }
  
    /* ── TASA CHIP ────────────────────────────── */
    .tasa-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: rgba(205,220,57,.1);
      border: 1px solid rgba(170,170,170,.8);
      border-radius: 20px;
      padding: 3px 9px;
      font-size: 11px;
      font-weight: 800;
      color: #AAAAAA;
      white-space: nowrap;
      flex-shrink: 0;
      letter-spacing: .2px;
    }
    .tasa-chip .tasa-label {
      font-size: 9px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: .5px;
      color: rgba(170,170,170,.8);
      margin-right: 2px;
    }
    /* ── TIEMPO DE ACTUALIZACIÓN ─────────────── */
    .price-updated {
      font-size: 10px;
      color: var(--subtext);
      opacity: .8;
      white-space: nowrap;
      /* es info secundaria: si falta espacio, se recorta ella primero (con "…") */
      flex: 0 4 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .price-updated::before { content: '·'; margin: 0 3px; }

    /* ── TIPO SELECTOR ────────────────────────────── */
    .search-bar-wrap {
      display: flex;
      align-items: stretch;
    }
    .tipo-chip {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--input-bg);
      border-radius: 14px 0 0 14px;
      border-right: 1.5px solid var(--border);
      padding: 0 8px 0 10px;
      height: 44px;
      flex-shrink: 0;
      cursor: pointer;
      position: relative;
      user-select: none;
    }
    .tipo-chip .tipo-emoji { font-size: 15px; line-height: 1; }
    .tipo-chip select {
      background: transparent;
      border: none;
      outline: none;
      font-family: var(--font);
      font-size: 11.5px;
      font-weight: 800;
      color: var(--text);
      cursor: pointer;
      padding-right: 14px;
      -webkit-appearance: none;
      appearance: none;
      max-width: 100px;
    }
    .tipo-chip select option {
    color: var(--text) !important;
    background-color: var(--surface) !important;
    }
    @media (max-width: 600px) {
  .tipo-chip {
    padding: 0 15px 0 10px;
  }
  .tipo-chip select {
    width: 12px;
    color: transparent;
    padding-right: 0;
    margin-left: -5px;
  }
  .tipo-emoji {
    font-size: 18px;
  }
}    
    .tipo-chip::after {
      content: '';
      width: 0; height: 0;
      border-left: 4px solid transparent;
      border-right: 4px solid transparent;
      border-top: 5px solid var(--subtext);
      position: absolute;
      right: 5px;
      top: 50%;
      transform: translateY(-50%);
      pointer-events: none;
    }
    /* flatten left radius on search-bar when tipo chip is present */
    .search-bar-wrap .search-bar {
      border-radius: 0 14px 14px 0;
      flex: 1;
    }
    /* BETA badge */
    .beta-tag {
      font-size: 8px;
      font-weight: 900;
      background: var(--warning);
      color: #fff;
      border-radius: 3px;
      padding: 1px 4px;
      letter-spacing: .3px;
      vertical-align: super;
      margin-left: 2px;
      line-height: 1;
    }
    @media (max-width: 380px) {
  
  #search-area { 
    padding: 10px 12px 12px; 
  }
  
  
  .search-bar { 
    padding: 0 8px; 
    gap: 4px; 
  }
  
  
  .tipo-chip { 
    padding: 0 8px 0 6px; 
  }
  
  
  #search-input { 
    font-size: 13.5px; 
  }
  
  
  #scan-btn svg { 
    width: 22px; 
    height: 22px; 
  }
}
.comp-toggle-wrapper {
  display: flex;
  background: var(--input-bg);
  border-radius: 12px;
  margin: 0 16px 12px;
  padding: 4px;
}
.comp-toggle-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--subtext);
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.comp-toggle-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}
[data-theme="dark"] .comp-toggle-btn.active {
  background: #2a2a2a;
}
.missing-products {
  font-size: 10px;
  color: var(--subtext);
  margin-top: 6px;
  line-height: 1.3;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Máximo 2 líneas */
  -webkit-box-orient: vertical;
  overflow: hidden;
}    
.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}

/* Ajustes menores para que el icono herede el color del texto activo */
.icon-wrap svg {
  color: inherit;
  stroke: currentColor;
}

.svg-icon { display: inline-flex; align-items: center; }

/* Este modal se reutiliza también para "Renombrar", que se abre DESDE
   dentro de la vista de pantalla completa "Mis Listas Guardadas"
   (z-index 900) — necesita quedar por encima de ella. */
#modal-guardar-lista { z-index: 950; }

/* ════════════════════════════════════════════════════════
   VISTAS DE PANTALLA COMPLETA (Mis Favoritos / Mis Listas)
   Reestructuración: ambas secciones ahora viven dentro del
   Perfil/menú de usuario en vez del feed principal, y se
   presentan como una vista de pantalla completa que se desliza
   sobre la app sin perder el estado de la búsqueda/mercado
   subyacente (basta con cerrarla para "volver").
════════════════════════════════════════════════════════ */
.fullview-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 900;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(16px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.fullview-overlay.open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}
.fullview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fullview-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 6px 8px 0;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.fullview-back:hover { opacity: .8; }
.fullview-back:active { transform: scale(.97); }
.fullview-title {
  flex: 1;
  font-family: "Montserrat", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  font-style: italic;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 76px; /* compensa el ancho del botón volver para centrar el título */
}
.fullview-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 40px;
}
@media (min-width: 768px) {
  .fullview-body { max-width: 900px; margin: 0 auto; width: 100%; }
  .fullview-header { padding: 16px 24px; }
  #favoritos-view-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0 16px;
    padding: 0 8px;
  }
  #favoritos-view-list .product-card { margin: 8px 0; }
}

/* ── Toolbar "Añadir todos a Mi Mercado" ─────────────────── */
.fav-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px 6px;
}
.fav-toolbar-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--subtext);
}
.btn-add-all {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(45,187,84,.35);
  transition: transform .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-add-all:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(45,187,84,.45); }
.btn-add-all:active { transform: scale(.98); }

/* ── Favorito sin precio disponible en la zona actual ────── */
.fav-no-price {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--warning);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}

/* ── Alerta pasiva de bajada/subida de precio (Mis Favoritos) ──
   Solo se pinta al abrir la vista si el mejor precio cambió respecto a
   la última vez. Colores propios en tema oscuro para conservar contraste. */
.fav-price-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.fav-price-alert.down { color: #1c8a3d; background: rgba(45,187,84,.12); }
.fav-price-alert.up   { color: #d42a3a; background: rgba(255,71,87,.10); }
[data-theme="dark"] .fav-price-alert.down { color: #6fe08e; background: rgba(45,187,84,.16); }
[data-theme="dark"] .fav-price-alert.up   { color: #ff8a95; background: rgba(255,71,87,.16); }
.fav-price-alert-prev {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--subtext);
}
.fav-alert-note {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--subtext);
  opacity: .85;
  text-align: center;
  padding: 10px 28px 0;
}

/* ── Tarjetas de Mis Listas Guardadas ─────────────────────── */
.lista-card {
  background: var(--surface);
  border-radius: 14px;
  margin: 8px 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] .lista-card {
  border-top: 1px solid rgba(255,255,255,.08);
  border-right: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.lista-card-main { flex: 1; min-width: 0; cursor: pointer; }
.lista-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lista-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--subtext);
  margin-top: 3px;
}
.lista-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.lista-action-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.lista-action-btn:hover { transform: scale(1.08); }
.lista-action-btn.danger { color: var(--danger); }

/* ── Badge de estado del horario: "Abierto ahora" / "Cierra en X min" / "Cerrado" ──
   Solo se renderiza si getEstadoHorario() pudo interpretar el texto libre.
   Verde/naranja/rojo con variantes propias en tema oscuro para mantener contraste. */
.horario-badge {
  --hb-dot: #2dbb54; --hb-fg: #1c8a3d; --hb-bg: rgba(45,187,84,.14);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 8px 4px 7px;
  border-radius: 20px;
  white-space: nowrap;
  vertical-align: middle;
  margin-left: 6px;
  background: var(--hb-bg);
  color: var(--hb-fg);
}
.horario-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--hb-dot);
  flex-shrink: 0;
}
.horario-badge.is-cierra-pronto { --hb-dot: var(--warning); --hb-fg: #b86e00; --hb-bg: rgba(255,152,0,.16); }
.horario-badge.is-cerrado       { --hb-dot: var(--danger);  --hb-fg: #d42a3a; --hb-bg: rgba(255,71,87,.12); }
[data-theme="dark"] .horario-badge.is-abierto       { --hb-fg: #6fe08e; --hb-bg: rgba(45,187,84,.18); }
[data-theme="dark"] .horario-badge.is-cierra-pronto { --hb-fg: #ffb74d; --hb-bg: rgba(255,152,0,.18); }
[data-theme="dark"] .horario-badge.is-cerrado       { --hb-fg: #ff8a95; --hb-bg: rgba(255,71,87,.18); }
/* En la tarjeta de comparativa el badge va solo en su fila (sin margen izquierdo) */
.comp-horario-badge-row { margin: 2px 0 6px; }
.comp-horario-badge-row .horario-badge { margin-left: 0; }

/* ── Badge de conteo en items del menú (Favoritos / Listas) ─ */
.menu-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: auto;
}
/* Variante para montos ($) en "Mi Ahorro": acento de marca con texto oscuro,
   que conserva contraste tanto con el verde (claro) como con el lima (oscuro). */
.menu-badge.ahorro { background: var(--accent); color: #14391a; padding: 0 7px; }

/* El menú ganó ítems (Mi Ahorro, Ver introducción): que haga scroll en pantallas bajas
   (p.ej. móvil en horizontal) en vez de salirse de la ventana. */
#app-menu { max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); overflow-y: auto; }

/* ── Vista "Mi Ahorro" (dentro de .legal-modal) ───────────── */
.ahorro-hero { text-align: center; padding: 4px 0 14px; }
.ahorro-hero-label { font-size: 12px; font-weight: 800; color: var(--subtext); }
.ahorro-hero-monto {
  font-family: "Montserrat", sans-serif;
  font-size: 44px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--accent);
  margin-top: 4px;
}
.ahorro-hero-bs { font-size: 12px; color: var(--subtext); margin-top: 2px; }
.ahorro-mes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--input-bg);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.ahorro-mes strong { font-size: 16px; font-weight: 900; color: var(--accent); }
.ahorro-progreso-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--input-bg);
  overflow: hidden;
}
.ahorro-progreso-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: width .4s ease;
}
.ahorro-progreso-txt { font-size: 12px; color: var(--subtext); text-align: center; margin-top: 7px; }
.ahorro-nota {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--subtext);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ahorro-nota strong, .ahorro-vacio strong { color: var(--text); }
.ahorro-vacio { text-align: center; padding: 18px 6px 8px; font-size: 13px; line-height: 1.6; }
.ahorro-vacio-icon { color: var(--accent); margin-bottom: 10px; display: flex; justify-content: center; }

/* ════════════════════════════════════════════════════════
   PERFIL DE COMERCIO
   Vista de pantalla completa con la info pública del comercio
   (banner/logo, dirección, horario, WhatsApp, compartir) y su
   catálogo navegable por categorías con paginación manual.
════════════════════════════════════════════════════════ */
/* Por encima de Favoritos/Listas (900): se puede abrir un perfil
   desde el precio de un producto mostrado dentro de esas vistas. */
#modal-perfil-comercio { z-index: 920; }

/* ── Header: nombre, badge de tipo, dirección, horario, CTAs ── */
#perfil-comercio-info { padding: 14px 16px 4px; }
.perfil-comercio-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.perfil-comercio-nombre {
  display: flex;
  align-items: center;
  font-size: 19px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.25;
}
.perfil-tipo-badge {
  font-size: 11px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.perfil-comercio-direccion,
.perfil-comercio-horario {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  color: var(--subtext);
  margin-top: 7px;
  line-height: 1.4;
}
.perfil-comercio-ubicacion {
  font-size: 11.5px;
  color: var(--subtext);
  margin-top: 2px;
  margin-left: 20px;
}
/* Sello discreto de antigüedad — a propósito pequeño y con opacidad baja
   para no competir con el nombre ni el horario. */
.perfil-comercio-desde {
  font-size: 10.5px;
  color: var(--subtext);
  opacity: .75;
  margin-top: 6px;
}
/* Horario + badge de estado: pueden saltar de línea en pantallas angostas.
   (va DESPUÉS de la regla base .perfil-comercio-horario para ganar en cascada) */
.perfil-comercio-horario { flex-wrap: wrap; align-items: center; }
.perfil-comercio-horario .horario-badge { margin-left: 2px; }
.perfil-action-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.perfil-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 10px;
  border-radius: 12px;
  border: none;
  font-family: var(--font);
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.perfil-action-btn:hover { transform: translateY(-1px); }
.perfil-action-btn:active { transform: scale(.97); }
.perfil-action-btn.whatsapp {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,211,102,.3);
}
.perfil-action-btn.share {
  background: var(--input-bg);
  color: var(--text);
}

/* ── Otras sucursales de esta cadena ──────────────────────────
   Fila horizontal deslizable entre la cabecera y las categorías.
   Si no hay hermanas el contenedor queda vacío y se oculta (:empty). */
#perfil-comercio-sucursales {
  margin-top: 6px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
}
#perfil-comercio-sucursales:empty { display: none; }
.perfil-sucursales-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--subtext);
}
.perfil-sucursales-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 16px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.perfil-sucursales-row::-webkit-scrollbar { display: none; }
.perfil-sucursal-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 230px;
  padding: 8px 14px 8px 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.perfil-sucursal-chip:hover { border-color: var(--accent); }
.perfil-sucursal-chip:active { transform: scale(.97); }
.perfil-sucursal-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}
.perfil-sucursal-logo.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  color: var(--accent);
}
.perfil-sucursal-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.perfil-sucursal-nombre {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.perfil-sucursal-mun {
  font-size: 11px;
  color: var(--subtext);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Chips de categorías activas (Paso 1) ─────────────────── */
#perfil-comercio-categorias {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px 10px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  scrollbar-width: none;
}
#perfil-comercio-categorias::-webkit-scrollbar { display: none; }
#perfil-comercio-categorias:empty { display: none; }
.perfil-cat-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--subtext);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.perfil-cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.perfil-cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Grid de productos compactos (Paso 2/3) ───────────────── */
.perfil-prod-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 6px 16px 4px;
}
@media (min-width: 480px) {
  .perfil-prod-grid { grid-template-columns: repeat(3, 1fr); }
}
.perfil-prod-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
[data-theme="dark"] .perfil-prod-card { border-color: rgba(255,255,255,.08); }
.perfil-prod-card:active { transform: scale(.97); }
.perfil-prod-fav {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  cursor: pointer;
}
[data-theme="dark"] .perfil-prod-fav { background: rgba(30,30,30,.85); }
.perfil-prod-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 6px;
  cursor: pointer;
}
.perfil-prod-img { width: 100%; height: 100%; object-fit: contain; }
.perfil-prod-info { cursor: pointer; }
.perfil-prod-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.perfil-prod-detail {
  font-size: 10px;
  color: var(--subtext);
  margin-top: 2px;
       line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
       display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
       min-height: 2.6em;
  
}
/* Precio destacado en Bs. (moneda de referencia diaria); USD queda como
   dato secundario más pequeño — orden inverso al resto de la app, tal
   como se pidió específicamente para estas tarjetas compactas. */
.perfil-prod-price-row {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}
.perfil-prod-bs {
  font-size: 15px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.15;
}
[data-theme="dark"] .perfil-prod-bs { color: #cddc39; }
.perfil-prod-usd {
  font-size: 10.5px;
  color: var(--subtext);
  margin-top: 1px;
}

/* ── Cargar más (Paso 3) ───────────────────────────────────── */
.perfil-cargar-mas-btn {
  display: block;
  margin: 6px auto 18px;
  padding: 10px 26px;
  border-radius: 12px;
  border: 1.5px solid var(--accent);
  background: none;
  color: var(--accent);
  font-family: var(--font);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.perfil-cargar-mas-btn:hover { background: var(--accent); color: #fff; }
.perfil-cargar-mas-btn:disabled { opacity: .6; cursor: default; }
.perfil-fin-lista {
  text-align: center;
  font-size: 11px;
  color: var(--subtext);
  padding: 10px 0 20px;
}

@media (min-width: 768px) {
  .perfil-prod-grid { grid-template-columns: repeat(4, 1fr); padding: 6px 24px 4px; }
  #perfil-comercio-categorias { padding: 14px 24px 10px; }
  #perfil-comercio-info { padding: 14px 24px 4px; }
  .perfil-sucursales-title { padding: 0 24px 8px; }
  .perfil-sucursales-row { padding: 2px 24px 8px; }
  .perfil-action-row { max-width: 420px; }
}
