/* Estilos solo de la tienda */
body { padding-bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); }
.pre { white-space: pre-line; }

.barra-sup {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11, 14, 19, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}
.barra-sup-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.marca { display: flex; align-items: center; gap: 10px; color: var(--texto); text-decoration: none; font-weight: 800; min-width: 0; }
.marca-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  background: color-mix(in srgb, var(--acento) 22%, var(--card)); border: 1px solid var(--borde);
  display: grid; place-items: center; font-size: 18px;
}
.marca-logo { overflow: hidden; }
.marca-logo img { width: 100%; height: 100%; object-fit: cover; }
.marca-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-carrito-sup { display: none; }

.offline { background: #3a2a0c; color: #fde68a; text-align: center; padding: 8px 14px; font-size: 13px; font-weight: 600; }

/* ---------- Perfil del negocio ---------- */
.perfil { position: relative; margin-top: 14px; }
.portada-foto {
  aspect-ratio: 16 / 9; margin: -14px -14px 0; overflow: hidden; background: var(--campo);
  border-bottom: 1px solid var(--borde);
}
.portada-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portada-botones { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: space-between; pointer-events: none; z-index: 2; }
.portada-botones .boton-redondo { pointer-events: auto; }
.perfil:not(.con-portada) .portada-botones { display: none; }
.boton-redondo {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(11, 14, 19, .72); backdrop-filter: blur(6px); color: #fff;
  font-size: 19px; font-weight: 700; cursor: pointer; display: grid; place-items: center;
}
.perfil-cuerpo {
  position: relative; padding: 18px 16px 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--acento) 22%, transparent) 0%, transparent 55%),
    var(--card);
}
.perfil.con-portada .perfil-cuerpo { margin-top: -26px; padding-top: 48px; }
.perfil-logo {
  width: 72px; height: 72px; border-radius: 18px; overflow: hidden; display: grid; place-items: center;
  background: color-mix(in srgb, var(--acento) 25%, var(--campo)); border: 3px solid var(--bg);
  font-size: 34px; font-weight: 800; color: #fff; margin-bottom: 10px; box-shadow: var(--sombra);
}
.perfil.con-portada .perfil-logo { position: absolute; top: -40px; left: 16px; margin: 0; }
.perfil-logo img { width: 100%; height: 100%; object-fit: cover; }
.perfil-tipo { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--acento); }
.perfil-nombre { margin: 2px 0 0; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; }
.perfil-lema { margin: 4px 0 0; }
.perfil-lema:empty { display: none; }
.perfil-dir { margin: 8px 0 0; color: var(--muted); }
.estado-ahora { margin: 6px 0 0; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.estado-ahora .punto { width: 9px; height: 9px; border-radius: 50%; background: var(--error); flex: 0 0 auto; }
.estado-ahora.abierto { color: #86efac; }
.estado-ahora.abierto .punto { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.estado-ahora.cerrado { color: #fca5a5; }
.estado-ahora a { font-weight: 600; }
.tasa-chip {
  display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--acento) 18%, var(--campo)); border: 1px solid color-mix(in srgb, var(--acento) 45%, var(--borde));
}
.acciones-perfil { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.acciones-perfil .btn { padding-left: 6px; padding-right: 6px; font-size: 14px; white-space: nowrap; }
.acciones-perfil .btn[hidden] { display: none; }
.acciones-perfil:has(.btn[hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Redes sociales y web: botones con ícono y nombre (solo los que tienen enlace) */
.redes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.redes[hidden] { display: none; }
.redes .btn-red { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 999px; gap: 6px; border-left-width: 3px; }
.redes .red-ico { font-size: 16px; line-height: 1; }
.red-instagram { border-left-color: #e1306c; }
.red-facebook { border-left-color: #1877f2; }
.red-tiktok { border-left-color: #25f4ee; }
.red-youtube { border-left-color: #ff0000; }
.red-telegram { border-left-color: #29a9eb; }
.red-web { border-left-color: var(--acento); }
.info .redes .btn { margin-top: 0; }
.accesos { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.accesos .chip[hidden] { display: none; }

/* Galería */
.seccion-fotos { margin-top: 14px; }
.galeria { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: thin; }
.galeria button {
  flex: 0 0 auto; width: 150px; aspect-ratio: 4 / 3; border-radius: var(--r-s); overflow: hidden; padding: 0;
  border: 1px solid var(--borde); background: var(--campo); cursor: zoom-in; scroll-snap-align: start;
}
.galeria img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visor { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, .94); color: #fff; }
.visor[open] { display: grid; place-items: center; }
.visor::backdrop { background: rgba(0, 0, 0, .8); }
.visor img { max-width: 100%; max-height: 86vh; object-fit: contain; }
.visor .boton-redondo { position: fixed; }
.visor-cerrar { top: 14px; right: 14px; }
.visor-ant { left: 10px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.visor-sig { right: 10px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.visor-n { position: fixed; bottom: 18px; left: 0; right: 0; text-align: center; font-weight: 700; font-size: 14px; opacity: .85; }

/* Banner domicilio */
.banner-domicilio {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 14px 16px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--acento) 26%, var(--card)), var(--card));
}
.banner-domicilio div { display: grid; gap: 2px; }
.banner-domicilio strong { font-size: 16px; }

/* Especiales */
#sec-especiales { margin-top: 16px; }
.especiales { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 6px; }
.especiales .producto { flex: 0 0 min(78%, 300px); scroll-snap-align: start; }
.especiales .producto-img { aspect-ratio: 16 / 10; }
.especiales .producto-nombre { font-size: 16.5px; }
.tag-especial { position: absolute; top: 8px; right: 8px; background: #3a2a0c; border-color: #7a5512; color: #fde68a; }

/* Información */
.info h3 { font-size: 15px; margin: 16px 0 6px; }
.info h3:first-of-type { margin-top: 8px; }
.tabla-horario { border-collapse: collapse; width: 100%; max-width: 360px; font-size: 14.5px; }
.tabla-horario td { padding: 4px 0; border-bottom: 1px solid var(--borde); }
.tabla-horario td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-horario tr.hoy td { font-weight: 800; color: var(--texto); }
.tabla-horario tr.cerrado td:last-child { color: var(--muted); }
.mt-s { margin-top: 12px; }
.arriba-flotante { position: fixed; right: 14px; bottom: calc(var(--nav-h) + 76px + env(safe-area-inset-bottom)); z-index: 45; }
@media (min-width: 760px) {
  .portada-foto { margin: 0; border-radius: var(--r); border: 1px solid var(--borde); }
  .arriba-flotante { bottom: 90px; }
  .galeria button { width: 200px; }
}

.filtros {
  position: sticky; top: 56px; z-index: 20;
  background: var(--bg); padding: 12px 0 10px; margin: 0 -14px; padding-left: 14px; padding-right: 14px;
  display: grid; gap: 10px;
}
.buscador { position: relative; display: block; }
.buscador .lupa { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .7; }
.buscador .input { padding-left: 40px; border-radius: 999px; }

.seccion-cab { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 10px; }
.seccion-cab h2 { margin: 0; font-size: 18px; }

.grid-productos { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid-productos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 960px) { .grid-productos { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.producto {
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.producto.en-pedido { border-color: var(--acento); box-shadow: 0 0 0 1px var(--acento) inset; }
.producto.agotado .producto-img > img,
.producto.agotado .producto-img > .emoji { filter: grayscale(1); opacity: .45; }
.producto-img {
  position: relative; aspect-ratio: 4 / 3; background: linear-gradient(145deg, #1b2230, #121722);
  display: grid; place-items: center; overflow: hidden;
}
.producto-img img { width: 100%; height: 100%; object-fit: cover; }
.producto-img .emoji { font-size: clamp(44px, 14vw, 64px); line-height: 1; }
.producto-img .tag-agotado { position: absolute; top: 8px; left: 8px; }
.producto-cuerpo { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.producto-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.producto-nombre { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.producto-desc { margin: 0; font-size: 12.5px; color: var(--muted); }
.producto-precio { margin-top: auto; padding-top: 6px; }
.producto-precio .usd { font-size: 17px; font-weight: 800; }
.producto-precio .cup { display: block; font-size: 12.5px; color: var(--muted); }
.quedan { align-self: flex-start; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #3a2a0c; border: 1px solid #7a5512; color: #fde68a; }
.producto .stepper { margin-top: 8px; width: 100%; grid-template-columns: 44px 1fr 44px; }
.etiqueta-agotado-pie { margin-top: 8px; text-align: center; font-weight: 700; color: #fca5a5; font-size: 13px; min-height: 38px; display: grid; place-items: center; border: 1px dashed #5b2a2a; border-radius: 999px; }

.info { margin-top: 18px; }
.info p { margin: 6px 0; }
.info .btn { margin-top: 8px; }
.pie { text-align: center; margin: 18px 0; }

.resumen-flotante {
  position: fixed; z-index: 35; left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 54px; padding: 0 16px; border-radius: 16px; border: 0;
  background: var(--acento); color: #fff; font-size: 15px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: entra .2s ease-out;
}

/* Carrito */
.linea { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.linea-img { width: 48px; height: 48px; border-radius: 10px; background: var(--campo); display: grid; place-items: center; overflow: hidden; font-size: 24px; }
.linea-img img { width: 100%; height: 100%; object-fit: cover; }
.linea-nombre { font-weight: 700; font-size: 14px; line-height: 1.2; }
.linea-precio { font-size: 12.5px; color: var(--muted); }
.linea-der { display: grid; justify-items: end; gap: 6px; }
.linea .stepper { grid-template-columns: 34px 30px 34px; }
.linea .stepper button { height: 32px; font-size: 18px; }
.linea.agotado .linea-nombre { text-decoration: line-through; color: var(--muted); }
.quitar { border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }

.totales { margin: 14px 0; padding: 12px 14px; }
.fila-total { display: flex; justify-content: space-between; align-items: baseline; }
.fila-total strong { font-size: 18px; }
.fila-total.muted strong { font-size: 15px; }

fieldset.entrega { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
fieldset.entrega legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; padding: 0; }
.opcion { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--borde); border-radius: var(--r-s); background: var(--campo); cursor: pointer; }
.opcion input { width: 20px; height: 20px; accent-color: var(--acento); flex: 0 0 auto; }
.opcion span { display: grid; }
.opcion small { color: var(--muted); }
.opcion:has(input:checked) { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 12%, var(--campo)); }
.recogida { margin-bottom: 12px; padding: 12px 14px; }
.recogida p { margin: 4px 0; }

/* Subtotal / envío */
.fila-total.sub { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.fila-total .gratis { color: #86efac; font-weight: 700; }
.fila-total .tachado { text-decoration: line-through; margin-right: 6px; }
.aviso-envio { margin: -4px 0 12px; padding: 8px 12px; border-radius: var(--r-s); border: 1px solid var(--borde); background: var(--campo); }
.aviso-envio.alerta { border-color: #7a5512; background: #2a200c; color: #fde68a; }
.aviso-envio.ok { border-color: #1c6b3c; background: #0f2e1c; color: #bbf7d0; }

/* Casilla de aceptación del sorteo */
.acepta-sorteo { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 10px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.acepta-sorteo input { width: 20px; height: 20px; flex: 0 0 auto; margin: 0; accent-color: var(--acento); }
.acepta-sorteo a { color: var(--texto); }
.sorteo-legal { margin-top: 10px; }
.pie-legal { margin-bottom: 8px; }

/* Aviso de carrito ajustado y botón «Vaciar carrito» */
.aviso-carrito {
  display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; padding: 10px 12px;
  border-radius: var(--r-s); border: 1px solid #7a5512; background: #2a200c; color: #fde68a; font-size: 14px; line-height: 1.35;
}
.aviso-carrito[hidden] { display: none; }
.aviso-carrito span { flex: 1; }
.aviso-carrito-cerrar { background: none; border: 0; color: inherit; font-size: 16px; padding: 0 2px; cursor: pointer; }
.btn-vaciar { display: block; margin: 10px 0 14px auto; min-height: 36px; font-size: 13px; color: #fca5a5; border-color: #5b2323; }
.btn-vaciar[hidden] { display: none; }
.btn-vaciar.confirmar { background: #3a1212; border-color: var(--error); color: #fff; }

/* Formas de pago */
.opciones-pago { display: grid; gap: 8px; }
.instrucciones-pago { margin: -4px 0 12px; padding: 12px 14px; }
.instrucciones-pago p { margin: 3px 0; }
.instrucciones-pago .dato { font-weight: 700; user-select: all; }

.exito { text-align: center; padding: 20px 4px; display: grid; gap: 10px; }
.exito .grande { font-size: 52px; }
.exito h3 { margin: 0; font-size: 20px; }

@media (min-width: 760px) {
  body { padding-bottom: 100px; }
  .nav-inf { display: none; }
  .btn-carrito-sup { display: inline-flex; }
  .resumen-flotante { bottom: 18px; }
  .toast-zona { bottom: 90px; }
  .portada { padding: 28px; }
  .portada-nombre { font-size: 32px; }
}

/* ---------- Sorteo ---------- */
.sorteo {
  margin-top: 14px; padding: 16px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(245, 158, 11, .22) 0%, transparent 55%),
    var(--card);
  border-color: rgba(245, 158, 11, .45);
}
.sorteo-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sorteo-etq { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #fcd34d; }
.sorteo-cuenta { font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: #3a2a0c; color: #fde68a; border: 1px solid #7a5512; }
.sorteo h2 { margin: 8px 0 4px; font-size: 20px; }
.sorteo-premio { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.sorteo-datos { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; color: var(--muted); font-size: 14.5px; }
.sorteo-ya, .sorteo-ganador, .sorteo-cerrado {
  margin: 0 0 12px; padding: 12px; border-radius: var(--r-s); font-weight: 700;
  background: var(--campo); border: 1px solid var(--borde);
}
.sorteo-ya { background: #0f2e1c; border-color: #1c6b3c; color: #bbf7d0; }
.sorteo-ganador { background: #3a2a0c; border-color: #7a5512; color: #fde68a; display: grid; gap: 2px; }
.sorteo-ganador strong { font-size: 18px; }
.sorteo-ganador span { font-weight: 600; color: var(--texto); }
.sorteo-privacidad { margin: 8px 0 0; }
.sorteo-reglas { margin: 10px 0; }
.sorteo-reglas summary { cursor: pointer; color: var(--acento); font-weight: 700; text-decoration: underline; }
.sorteo-reglas p { margin: 8px 0 0; color: var(--muted); }

/* ---------- Productos con opciones (sabor, peso, tamaño…) ---------- */
.producto.con-opciones { cursor: pointer; }
.n-opciones { align-self: flex-start; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.btn-opciones { margin-top: 8px; width: 100%; min-height: 40px; font-size: 13.5px; padding: 0 8px; border-radius: 999px; border-color: var(--acento); color: var(--texto); }
.producto.en-pedido .btn-opciones { background: color-mix(in srgb, var(--acento) 18%, var(--campo)); }

/* Panel (hoja inferior en el móvil, ventana centrada en pantallas grandes) */
.hoja-opciones {
  width: 100%; max-width: 100%; margin: auto 0 0; padding: 0; border: 1px solid var(--borde); border-bottom: 0;
  border-radius: 20px 20px 0 0; background: var(--bg); color: var(--texto); max-height: 88vh;
}
.hoja-opciones[open] { animation: sube .22s ease-out; }
.hoja-opciones::backdrop { background: rgba(0, 0, 0, .6); }
.hoja-in { display: flex; flex-direction: column; max-height: 88vh; }
.hoja-cab { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--borde); }
.hoja-img { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--campo); display: grid; place-items: center; font-size: 28px; }
.hoja-img img { width: 100%; height: 100%; object-fit: cover; }
.hoja-tit { min-width: 0; }
.hoja-tit h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.hoja-tit p { margin: 2px 0 0; }
.hoja-sub { margin: 10px 16px 4px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--acento); }
.hoja-lista { overflow-y: auto; padding: 0 16px 8px; flex: 1; }
.op-fila { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.op-fila:not(:has(.op-foto)) { grid-template-columns: 1fr auto; }
.op-foto { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--campo); display: grid; place-items: center; font-size: 22px; }
.op-foto img { width: 100%; height: 100%; object-fit: cover; }
.op-info { display: grid; gap: 2px; min-width: 0; }
.op-nombre { font-weight: 700; font-size: 15px; }
.op-precio { font-size: 13px; color: var(--muted); }
.op-precio strong { color: var(--texto); font-size: 14.5px; }
.op-info .quedan { margin-top: 2px; }
.op-estado.agotada { font-size: 12.5px; font-weight: 700; color: #fca5a5; }
.op-fila.agotada .op-nombre, .op-fila.agotada .op-precio, .op-fila.agotada .op-foto { opacity: .45; }
.op-fila.agotada .op-nombre { text-decoration: line-through; }
.op-fila.en-pedido .op-nombre { color: var(--acento); }
.op-fila .stepper { grid-template-columns: 38px 30px 38px; }
.op-fila .stepper button { height: 36px; font-size: 18px; }
.op-no { color: var(--muted); padding: 0 14px; }
.hoja-pie { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); background: var(--card); }
.hoja-pie .btn { min-height: 46px; font-size: 14px; padding: 0 10px; }
@media (min-width: 760px) {
  .hoja-opciones { width: min(94vw, 480px); margin: auto; border-radius: var(--r); border-bottom: 1px solid var(--borde); }
  .hoja-pie { border-radius: 0 0 var(--r) var(--r); }
}

/* =====================================================================
   Etapa 2: catálogo y página de producto (móvil primero)
   ===================================================================== */
.barra-sup-acciones { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.btn-categorias-sup { gap: 6px; }
.btn-categorias-sup .txt { display: none; }
@media (min-width: 420px) { .btn-categorias-sup .txt { display: inline; } }
.enlace-boton { background: none; border: 0; padding: 0; color: var(--acento); font-weight: 700; cursor: pointer; text-decoration: underline; }

/* Etiquetas de producto */
.tag-descuento { background: #b91c1c; border-color: #dc2626; color: #fff; }
.tag-oferta { background: #3a1518; border-color: #b91c1c; color: #fecaca; }
.tag-mas_vendido { background: #3a2a0c; border-color: #b7791f; color: #fde68a; }
.marcas-foto { position: absolute; left: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 16px); pointer-events: none; }

/* Tarjetas del catálogo */
.producto-enlace { display: block; color: inherit; text-decoration: none; }
.producto-img:has(> img) { background: #fff; }
.producto-img img { object-fit: contain; }
.producto-nombre a { color: inherit; text-decoration: none; }
.producto-nombre a:hover { text-decoration: underline; }
.producto-nombre a:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 4px; }
.producto-datos { font-size: 12.5px; color: var(--muted); }
.producto-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.producto-precio .antes, .mini-precio s { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.producto.con-opciones { cursor: default; }

/* Secciones de la portada: carruseles horizontales */
.fila-seccion { margin-top: 18px; }
.carrusel {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  margin: 0 -14px; padding: 2px 14px 8px; scrollbar-width: thin;
}
.mini {
  flex: 0 0 clamp(132px, 38vw, 176px); scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--r); overflow: hidden;
  color: var(--texto); text-decoration: none; padding-bottom: 10px;
}
.mini:hover { border-color: #3a4558; }
.mini-img { position: relative; aspect-ratio: 1; background: var(--campo); display: grid; place-items: center; overflow: hidden; }
.mini-img img { width: 100%; height: 100%; object-fit: contain; }
.mini-img .emoji { font-size: 44px; }
.mini-img .tag-agotado { position: absolute; top: 6px; left: 6px; }
.mini.agotado .mini-img img { filter: grayscale(1); opacity: .5; }
.mini-nombre { padding: 6px 10px 0; font-weight: 700; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-datos { padding: 0 10px; font-size: 12px; color: var(--muted); }
.mini-precio { padding: 0 10px; margin-top: auto; }
.mini-precio strong { font-size: 15px; }
.mini-precio s { display: block; margin: 0; }
.cats-foto .cat-foto {
  flex: 0 0 clamp(112px, 30vw, 150px); scroll-snap-align: start; display: flex; flex-direction: column; gap: 2px; padding: 0 0 10px;
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--r); overflow: hidden; cursor: pointer; text-align: left; color: var(--texto);
}
.cat-foto:hover { border-color: var(--acento); }
.cat-foto-img { aspect-ratio: 4 / 3; background: var(--campo); display: grid; place-items: center; overflow: hidden; }
.cat-foto-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-foto-img .emoji { font-size: 36px; }
.cat-foto-nombre { padding: 6px 10px 0; font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.cat-foto-n { padding: 0 10px; font-size: 12px; color: var(--muted); }

/* Buscador con sugerencias, filtros y orden */
.buscador { position: relative; }
.sugerencias {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--r-s); box-shadow: var(--sombra);
  max-height: min(60vh, 420px); overflow-y: auto;
}
.sug { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.sug-cat { grid-template-columns: 44px 1fr; }
.sug[aria-selected="true"], .sug:hover { background: var(--campo); }
.sug-img, .sug-ico { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--campo); display: grid; place-items: center; font-size: 22px; }
.sug-ico { background: var(--campo); color: var(--acento); }
.sug-img img { width: 100%; height: 100%; object-fit: contain; }
.sug-txt { display: grid; min-width: 0; }
.sug-txt strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-precio { font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.sug.agotado .sug-precio { color: #fca5a5; font-weight: 700; }
.sug-vacia { padding: 10px; color: var(--muted); font-size: 14px; }
.filtros-fila { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.btn-filtros .n { background: #fff; color: var(--acento); opacity: 1; border-radius: 999px; padding: 0 6px; font-weight: 800; }
.orden { flex: 1; min-width: 0; }
.orden .input { min-height: 36px; padding: 4px 10px; border-radius: 999px; font-size: 14px; }
.panel-filtros { display: grid; gap: 10px; padding: 12px; margin: 0 0 12px; }
.panel-filtros .rango { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.panel-filtros legend { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; padding: 0; }
.check-disp { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check-disp input { width: 20px; height: 20px; accent-color: var(--acento); }
.panel-filtros .btn { justify-self: start; }
.vacio .btn { margin-top: 12px; }

/* Menú de categorías (hoja inferior en el móvil) */
.hoja-cab-simple { grid-template-columns: 1fr auto; }
.hoja-cab-simple h2 { margin: 0; font-size: 18px; }
.lista-categorias { list-style: none; margin: 0; padding: 6px 10px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto; }
.cat-item {
  width: 100%; display: grid; grid-template-columns: 44px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 6px;
  background: none; border: 0; border-bottom: 1px solid var(--borde); color: var(--texto); text-align: left; cursor: pointer; font-size: 15px;
}
.cat-item:hover, .cat-item:focus-visible { background: var(--campo); }
.cat-item[aria-current="true"] .cat-item-nombre { color: var(--acento); }
.cat-item-img { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--campo); display: grid; place-items: center; font-size: 22px; }
.cat-item-img.todos { background: var(--campo); }
.cat-item-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-item-nombre { font-weight: 700; }
.cat-item-n { color: var(--muted); font-size: 13px; }
.cat-item-flecha { color: var(--muted); font-size: 20px; }

/* ---------- Página de producto ---------- */
.ficha { padding-top: 6px; }
.migas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 44px; font-size: 14px; color: var(--muted); }
.migas a { color: var(--muted); text-decoration: none; font-weight: 600; }
.migas a:hover { color: var(--texto); text-decoration: underline; }
.migas .volver { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--borde); background: var(--card); color: var(--texto); font-size: 22px; line-height: 1; cursor: pointer; }
.ficha-cargando { padding: 40px 0; text-align: center; }
.ficha-grid { display: grid; gap: 16px; }
.ficha-galeria { display: grid; gap: 8px; min-width: 0; }
.ficha-principal-caja { position: relative; }
.ficha-principal {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: 1; background: #fff; border-radius: var(--r); border: 1px solid var(--borde);
}
.ficha-principal::-webkit-scrollbar { display: none; }
.ficha-foto { flex: 0 0 100%; scroll-snap-align: center; border: 0; padding: 0; background: #fff; cursor: zoom-in; overflow: hidden; display: grid; place-items: center; }
.ficha-foto img { width: 100%; height: 100%; object-fit: contain; transition: transform .12s ease-out; }
@media (hover: hover) { .ficha-foto.lupa img { transform: scale(2); } }
.ficha-sin-foto { flex: 1; display: grid; place-items: center; font-size: 96px; background: var(--campo); }
.ficha-principal-caja .marcas-foto { left: 10px; bottom: 10px; }
.ficha-n { position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(11, 14, 19, .72); color: #fff; font-size: 12px; font-weight: 700; }
.ficha-miniaturas { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.ficha-mini { flex: 0 0 64px; height: 64px; padding: 0; border-radius: 10px; border: 2px solid var(--borde); background: #fff; overflow: hidden; cursor: pointer; }
.ficha-mini img { width: 100%; height: 100%; object-fit: contain; }
.ficha-mini[aria-current="true"] { border-color: var(--acento); }
.ficha-info { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ficha-etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }
.ficha-nombre { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.ficha-marca { margin: 0; color: var(--muted); }
.ficha-marca strong { color: var(--texto); }
.ficha-precio { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ficha-precio .usd { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.ficha-precio .antes { color: var(--muted); font-size: 16px; }
.ficha-precio .tag-descuento { font-size: 13px; }
.ficha-precio .cup { flex-basis: 100%; color: var(--muted); font-size: 14px; }
.ficha-disp { margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ficha-disp::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.ficha-disp.si { color: #86efac; }
.ficha-disp.pocas { color: #fcd34d; }
.ficha-disp.agotado { color: #fca5a5; }
.ficha-opciones { border: 0; margin: 4px 0 0; padding: 0; }
.ficha-opciones legend { padding: 0; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.ficha-opciones legend strong { color: var(--texto); }
.ficha-ops { display: flex; flex-wrap: wrap; gap: 8px; }
.op-chip {
  display: grid; gap: 1px; min-width: 88px; padding: 8px 12px; border-radius: var(--r-s); cursor: pointer;
  background: var(--campo); border: 1px solid var(--borde);
}
.op-chip:has(input:focus-visible) { outline: 2px solid var(--acento); outline-offset: 2px; }
.op-chip.elegida { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 16%, var(--campo)); box-shadow: 0 0 0 1px var(--acento) inset; }
.op-chip-nombre { font-weight: 700; font-size: 14px; }
.op-chip-precio { font-size: 12.5px; color: var(--muted); }
.op-chip.agotada .op-chip-nombre { text-decoration: line-through; opacity: .6; }
.op-chip.agotada .op-chip-precio { color: #fca5a5; }
/* Barra de compra: fija abajo en el móvil (encima de la navegación) */
.ficha-compra {
  position: fixed; z-index: 34; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center;
  padding: 8px 12px; background: rgba(20, 25, 34, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--borde);
}
.ficha-compra-precio { display: grid; line-height: 1.15; }
.ficha-compra-precio strong { font-size: 15px; }
.ficha-compra-precio small { color: var(--muted); font-size: 11.5px; }
.ficha-cant { grid-template-columns: 36px 30px 36px; }
.ficha-cant button { height: 40px; }
.ficha-anadir { min-height: 46px; padding: 0 10px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficha-en-carrito { margin: 0; padding: 8px 12px; border-radius: var(--r-s); background: #0f2e1c; border: 1px solid #1c6b3c; color: #bbf7d0; font-weight: 600; font-size: 14px; }
.ficha-en-carrito .enlace-boton { color: #fff; }
.ficha-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.ficha-bloque { margin-top: 22px; }
.ficha-bloque h2 { font-size: 18px; margin: 0 0 10px; }
.ficha-bloque > .pre { margin: 0; color: #cfd7e3; }
.ficha-tabla { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--card); border: 1px solid var(--borde); border-radius: var(--r-s); overflow: hidden; }
.ficha-tabla th, .ficha-tabla td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.ficha-tabla tr:last-child th, .ficha-tabla tr:last-child td { border-bottom: 0; }
.ficha-tabla th { width: 38%; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--campo) 60%, transparent); }
.ficha-puntos { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.ficha-entrega { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ficha-entrega li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; padding: 10px 12px; background: var(--card); border: 1px solid var(--borde); border-radius: var(--r-s); }
.ficha-entrega .ent-ico { font-size: 20px; line-height: 1.3; }
.ficha-entrega li > span:last-child { display: grid; gap: 2px; }
.ficha-entrega small { color: var(--muted); font-size: 13px; }
.ficha-no-existe p { margin: 6px 0 0; }
body.en-ficha { padding-bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom)); }
body.en-ficha .arriba-flotante { display: none; }

/* Visor con zoom */
.visor img { transition: transform .15s ease-out; }
.visor.con-zoom img { cursor: zoom-in; }
.visor.con-zoom img.zoom { transform: scale(2.5); cursor: zoom-out; touch-action: none; }
.visor { overflow: hidden; }
.visor-ayuda { position: fixed; top: 22px; left: 0; right: 0; text-align: center; font-size: 13px; opacity: .75; pointer-events: none; }

@media (min-width: 760px) {
  .ficha-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .ficha-galeria { position: sticky; top: 70px; }
  .ficha-nombre { font-size: 28px; }
  .ficha-compra { position: static; padding: 0; background: none; border: 0; backdrop-filter: none; grid-template-columns: auto 1fr; margin-top: 6px; }
  .ficha-compra-precio { display: none; }
  body.en-ficha { padding-bottom: 60px; }
  .mini { flex-basis: 190px; }
}
@media (max-width: 359px) {
  .ficha-compra { grid-template-columns: auto 1fr; }
  .ficha-compra-precio { display: none; }
}
/* Fondo blanco solo detrás de las fotos (los productos suelen fotografiarse sobre blanco); el emoji va sobre el fondo oscuro */
.mini-img:has(> img), .cat-foto-img:has(> img), .sug-img:has(> img), .cat-item-img:has(> img) { background: #fff; }

/* ================================================================== Conexión lenta (etapa 3) */
.aviso-red {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 8px auto 0; width: min(100% - 24px, 1100px); padding: 10px 12px;
  border: 1px solid #a16207; border-radius: 12px; background: #2a1f05; color: #fde68a; font-size: .95rem;
}
.aviso-red[data-modo="guardados"], .aviso-red[data-modo="parcial"] { border-color: #1d4ed8; background: #0b1b3a; color: #bfdbfe; }
.aviso-red[hidden] { display: none; }
.aviso-red-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.aviso-red-botones .btn[hidden] { display: none; }
/* Antes de que arranque el JavaScript: flotando abajo y solo si a los 8 s sigue sin cargar */
.aviso-red.arranque {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h, 64px) + 12px + env(safe-area-inset-bottom));
  width: auto; margin: 0; z-index: 95; visibility: hidden; animation: aviso-red-tarde 0s linear 8s forwards;
}
@keyframes aviso-red-tarde { to { visibility: visible; } }

/* Lista de la instantánea (la pone el servidor; app.js la cambia por las tarjetas al arrancar) */
#productos:has(> .lista-instantanea) { display: block; }
.lista-instantanea { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lista-instantanea a {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid var(--borde, #232a36); border-radius: 12px; color: inherit; text-decoration: none; background: var(--panel, #121720);
}
.lista-instantanea img, .lista-instantanea .li-emoji {
  width: 56px; height: 56px; border-radius: 8px; object-fit: contain; background: #fff; display: grid; place-items: center; font-size: 30px;
}
.lista-instantanea .li-emoji { background: var(--campo, #1a2130); }
.lista-instantanea .li-nombre { font-weight: 600; }
.lista-instantanea .li-precio { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.lista-instantanea .agotado { opacity: .55; }