:root {
  --blue: #123a63;
  --blue-2: #1c4f86;
  --cta: #e15a32;
  --cta-2: #c44722;
  --gold: #c8922a;
  --ok: #1e7a4a;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #5c6670;
  --line: #e4e8ec;
  --shadow: 0 10px 28px rgba(18, 32, 51, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.barra {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--blue);
  color: #f4f7fb;
}
.barra-fila {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
  padding: 10px 0;
}
.marca {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.marca strong { display: block; font-size: 1.05rem; letter-spacing: 0.01em; }
.marca small { display: none; opacity: 0.75; }
.sello {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
}
.nav-cats { display: none; }
.nav-cats a, .nav-cats button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 6px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
}
.nav-cats .activa { background: rgba(255, 255, 255, 0.16); }
.buscar { position: relative; }
.sugerencias {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.sugerencias button {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
  text-align: left;
  padding: 10px 14px;
  min-height: 42px;
}
.sugerencias button:hover { background: #f4f6f8; }
#productos { scroll-margin-top: 92px; }
.subcats {
  display: flex;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 12px;
}
.subcats button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
  min-height: 40px;
}
.subcats .activa { background: var(--blue); color: #fff; border-color: var(--blue); }
.buscar input, .campo input, .campo select, .orden select, .campo textarea {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  min-height: 46px;
}
.carrito-btn, .btn {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
}
.carrito-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--cta);
  color: #fff;
  font-weight: 700;
}
.carrito-btn span {
  min-width: 1.4rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff;
  color: var(--cta-2);
  text-align: center;
  font-size: 0.82rem;
}

.hero, .bloque { width: min(1320px, calc(100% - 24px)); margin: 0 auto; }
.hero {
  display: grid;
  gap: 18px;
  padding: 22px 0 8px;
}
.kicker {
  color: var(--cta);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(2.1rem, 8vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  max-width: 11ch;
}
.lead { color: var(--muted); max-width: 42ch; }
.hero-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.nota { color: var(--muted); font-size: 0.92rem; max-width: 46ch; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; text-decoration: none; font-weight: 700; }
.btn.cta { background: var(--cta); color: #fff; }
.btn.cta:hover { background: var(--cta-2); }
.btn.promo { background: #fff6e4; color: #8a5a10; border: 1px solid #efd7a2; }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.btn.wa { background: #128c7e; color: #fff; gap: 8px; }
.btn.wa:hover { background: #0e7468; }
.wa-flotante {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  background: #128c7e;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(18, 140, 126, 0.35);
}
.wa-flotante svg { width: 22px; height: 22px; fill: currentColor; }
.btn.ancho { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hero-mosaico {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-height: 360px;
}
.marco {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
  padding: 0;
}
.marco:first-child { grid-row: span 2; }
.marco .escenario {
  flex: 1;
  width: 100%;
  height: auto;
  min-height: 120px;
  aspect-ratio: auto;
}
.marco .escenario img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.marco figcaption, .marco .pie-marco { padding: 10px 12px 12px; }
.marco strong { display: block; }
.marco span { color: var(--muted); font-size: 0.85rem; }

.bloque { padding: 22px 0; }
.bloque-head { margin-bottom: 12px; }
.bloque-head h2 { font-size: 1.45rem; letter-spacing: -0.02em; }
.bloque-head p { color: var(--muted); }

.cat-rail, .carril {
  display: flex;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
}
.cat-tile, .carril .card { scroll-snap-align: start; }
.cat-tile {
  flex: 0 0 72%;
  min-height: 168px;
  border: 0;
  border-radius: 18px;
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.cat-tile:hover { transform: translateY(-3px); }
.cat-tile .escenario { height: 92px; margin-bottom: auto; background: transparent; }
.cat-tile .escenario svg { width: 64px; height: 64px; }
.cat-tile strong { font-size: 1.15rem; }
.cat-tile em { font-style: normal; color: var(--muted); font-size: 0.85rem; }
.cat-tile.activa { outline: 2px solid var(--blue); }

.carril .card { flex: 0 0 78%; }

.tienda {
  display: grid;
  gap: 16px;
}
.filtros {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filtros-cabeza { display: flex; justify-content: space-between; align-items: center; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.precio-rango { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-weight: 700; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; }
.cerrar {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eef2f6;
  font-size: 1.3rem;
}
.resultados-bar, .resultados-acciones, .cajon-cabeza, .linea, .total, .ficha-acciones {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.resultados-bar { margin-bottom: 12px; }
.resultados-acciones { flex: 1; justify-content: flex-end; }
.orden { min-width: 0; flex: 1; }
.orden select { min-width: 0; width: 100%; border: 1px solid var(--line); }
#resumen { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(18, 32, 51, 0.12); }
.escenario, .stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 1 / 1.15;
}
.stage { border: 0; width: 100%; padding: 0; background: transparent; }
.stage img, .escenario img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
  transition: transform 200ms ease;
}
.card:hover .stage img { transform: scale(1.04); }
.stage svg, .escenario svg { width: 58%; height: 58%; }
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 1; }
.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #fff;
}
.badge.oferta { background: var(--gold); color: #3d2a08; }
.badge.nuevo { background: var(--blue); color: #fff; }
.badge.agotado, .velo-agotado {
  background: var(--ink);
  color: #fff;
}
.velo-agotado {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}
.card.sin-stock .stage { filter: grayscale(0.4); }
.info { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.cat { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
.nombre {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}
.precios { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.precio { font-size: 1.2rem; font-weight: 800; }
.antes { color: var(--muted); text-decoration: line-through; font-size: 0.9rem; }
.pct { color: #8a5a10; font-size: 0.8rem; font-weight: 800; }
.stock-line { font-size: 0.84rem; color: var(--ok); min-height: 1.2em; }
.stock-line.pocas { color: #9a4d16; }
.stock-line.agotado { color: var(--muted); }
.info .btn { margin-top: 4px; white-space: normal; line-height: 1.2; text-align: center; }
.linkish {
  border: 0;
  background: none;
  color: var(--blue-2);
  padding: 4px 0 0;
  font-weight: 700;
  min-height: 36px;
}

.tono-plastico { background: #e5f2ec; color: #1d4a38; }
.tono-colchon { background: #e7eef8; color: #1a3f6e; }
.tono-cocina { background: #fde8df; color: #8a3418; }
.tono-olla { background: #f8efd8; color: #6d4e12; }
.tono-costal { background: #eef2df; color: #3f4a22; }
.tono-plato { background: #f6e4e0; color: #7a3b32; }
.tono-otro { background: #eef1f4; color: #31404f; }

.paginacion { display: flex; justify-content: center; padding: 16px 0 4px; }
.vacio { color: var(--muted); padding: 20px 0; }

.skeleton {
  height: 280px;
  border-radius: 18px;
  background: linear-gradient(90deg, #e8edf2 25%, #f7f9fb 37%, #e8edf2 63%);
  background-size: 400% 100%;
  animation: carga 1.2s ease infinite;
}
@keyframes carga { from { background-position: 100% 0; } to { background-position: 0 0; } }

.pie {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: min(1320px, calc(100% - 24px));
  margin: 8px auto 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.velo { position: fixed; inset: 0; background: rgba(16, 24, 34, 0.46); z-index: 8; }
.cajon, .filtros.movil {
  position: fixed;
  z-index: 9;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.cajon[hidden], .velo[hidden], [hidden] { display: none !important; }
.cajon { top: 0; right: 0; bottom: 0; width: min(420px, 100%); box-shadow: var(--shadow); }
.cajon-cabeza, .cajon-cuerpo { padding: 16px; }
.cajon-cuerpo { overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.linea { align-items: flex-start; }
.mini {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  flex: 0 0 auto;
}
.mini svg { width: 50%; height: 50%; margin: auto; }
.paso { display: flex; align-items: center; gap: 6px; }
.paso button, .quitar {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: #eef2f6;
}
.quitar { color: var(--cta-2); background: transparent; }
.meta { color: var(--muted); font-size: 0.86rem; }
.total { font-size: 1.15rem; }
.nota-pago {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 0.9rem;
}
.campo textarea { min-height: 72px; border: 1px solid var(--line); }
.exito h3 { font-size: 2rem; letter-spacing: -0.03em; margin: 6px 0; }
.exito ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }

dialog {
  width: min(880px, calc(100% - 20px));
  max-height: calc(100% - 24px);
  border: 0;
  border-radius: 20px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(16, 24, 34, 0.46); }
.ficha {
  display: grid;
  gap: 0;
}
.ficha-stage { min-height: 240px; aspect-ratio: 4 / 3; }
.ficha-stage svg { width: 52%; height: 52%; }
.ficha-cuerpo { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ficha-acciones { margin-top: 8px; flex-wrap: wrap; }
.ficha-acciones .btn { flex: 1 1 9rem; }
.relacionados { padding: 0 16px 16px; }
.relacionados h3 { margin-bottom: 10px; }
.relacionados .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.relacionados .stage { aspect-ratio: 5 / 3; }

.aviso {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 12;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 200ms ease;
  max-width: min(420px, calc(100% - 24px));
}
.aviso.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.aviso.ok { background: var(--ok); }

@media (max-width: 719px) {
  .barra-fila {
    grid-template-columns: 1fr auto;
    grid-template-areas: "marca carrito" "buscar buscar";
  }
  .marca { grid-area: marca; }
  .buscar { grid-area: buscar; }
  .carrito-btn { grid-area: carrito; }
  .filtros {
    position: fixed;
    z-index: 9;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    overflow: auto;
    border-radius: 18px 18px 0 0;
    transform: translateY(110%);
    transition: transform 200ms ease;
  }
  .filtros.abierto { transform: none; }
  .solo-escritorio { display: none; }
  .grid .stage, .carril .stage { aspect-ratio: 1 / 1.58; }
  .resultados-bar { flex-wrap: wrap; align-items: stretch; }
  .resultados-acciones { width: 100%; }
}
@media (min-width: 360px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .carril .card { flex-basis: 46%; }
  .cat-tile { flex-basis: 46%; }
}
@media (min-width: 720px) {
  .marca small { display: block; }
  .hero { grid-template-columns: 1.1fr 0.9fr; align-items: center; padding-top: 36px; }
  .cat-rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .cat-tile { flex: initial; }
  .carril { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .carril .card { flex: initial; }
  .tienda { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .filtros { position: sticky; top: 78px; }
  .solo-movil, #cerrar-filtros { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .barra-fila { grid-template-columns: auto auto minmax(240px, 1fr) auto; }
  .nav-cats { display: flex; gap: 2px; min-width: 0; overflow-x: auto; }
  .cat-rail, .grid, .carril { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ficha { grid-template-columns: 1.1fr 0.9fr; }
  .ficha-stage { aspect-ratio: auto; min-height: 100%; }
  .relacionados { grid-column: 1 / -1; }
}

@media (max-width: 359px) {
  .grid, .relacionados .grid { grid-template-columns: minmax(0, 1fr); }
  .hero-mosaico { grid-template-columns: 1fr; }
  .marco:first-child { grid-row: auto; }
}
