:root {
  --fondo: #f3f4f8;
  --tarjeta: #fff;
  --tinta: #12141c;
  --suave: #6a6f7d;
  --linea: #e4e6ee;
  --acento: #a4c804;        /* verde lima del logo */
  --acento-tinta: #4f6b00;  /* el mismo verde, oscurecido para texto sobre claro */
  --acento-suave: #f1f7d6;
  --acento-txt: #12141c;
  --wa: #1fb457;
  --radio: 18px;
  --ancho: 1680px;   /* ancho máximo en pantallas grandes */
  --sombra: 0 1px 2px rgba(18, 20, 28, .04), 0 6px 20px rgba(18, 20, 28, .06);
}

/* touch-action: en iPhone, dos toques rápidos (p. ej. en + y −) no deben ampliar la pantalla. */
* { box-sizing: border-box; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.bloqueado { overflow: hidden; }
body.con-pie main { padding-bottom: 104px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* Cabecera */
.barra {
  position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--linea);
}
.marca { min-width: 0; display: flex; align-items: center; text-decoration: none; color: inherit; font-weight: 800; font-size: 18px; letter-spacing: -.4px; }
.marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca img { height: 50px; width: auto; display: block; }
.btn-lista {
  flex: none; height: 40px; padding: 0 14px; display: flex; align-items: center; gap: 7px;
  border-radius: 20px; background: var(--tinta); color: #fff; font-size: 13.5px; font-weight: 700;
}
.btn-lista b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--acento); color: var(--acento-txt); font-size: 11.5px; line-height: 20px; text-align: center; }

/* Presentación */
.hero { background: radial-gradient(120% 90% at 100% 0%, rgba(164, 200, 4, .34) 0%, rgba(164, 200, 4, 0) 60%), linear-gradient(160deg, #14170f 0%, #1f2414 100%); color: #fff; }
.hero-in { max-width: var(--ancho); margin: 0 auto; padding: 26px 16px 24px; }
.sobre { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--acento); color: var(--acento-txt); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.hero h1 { margin: 12px 0 8px; max-width: 560px; font-size: clamp(24px, 6.4vw, 38px); line-height: 1.1; letter-spacing: -.8px; font-weight: 800; }
.hero p { margin: 0; max-width: 520px; font-size: 14.5px; line-height: 1.5; color: rgba(255, 255, 255, .8); }
.pasos { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 620px; }
.pasos li { padding: 12px 10px; border-radius: 14px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); font-size: 12px; line-height: 1.3; }
.pasos b { display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 8px; border-radius: 50%; background: var(--acento); color: var(--acento-txt); font-size: 12.5px; }
.pasos span { display: block; color: rgba(255, 255, 255, .92); }

.btn-lista-esc {
  width: 100%; max-width: 620px; margin-top: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  border-radius: 14px; background: var(--acento); color: var(--acento-txt); text-align: left; font-size: 12.5px; line-height: 1.3;
}
.btn-lista-esc svg { flex: none; }
.btn-lista-esc b { display: block; font-size: 14.5px; }

.btn-instalar { margin-top: 10px; height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border-radius: 22px; border: 1.5px solid rgba(255, 255, 255, .35); color: #fff; font-size: 13.5px; font-weight: 700; }

/* Buscador + acceso a categorías (fijo al bajar) */
.filtros { position: sticky; top: 64px; z-index: 15; background: var(--fondo); }
.filtros-in { max-width: var(--ancho); margin: 0 auto; padding: 12px 16px 10px; display: flex; gap: 8px; }
.buscador {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 10px;
  background: var(--tarjeta); border: 1.5px solid transparent; border-radius: 14px; color: var(--suave); box-shadow: var(--sombra);
}
.buscador:focus-within { border-color: var(--acento); }
.buscador input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--tinta); font-size: 16px; }
.btn-cats {
  flex: none; max-width: 46%; height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 8px;
  border-radius: 14px; background: var(--tarjeta); box-shadow: var(--sombra); font-size: 13.5px; font-weight: 700;
}
.btn-cats span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-cats svg { flex: none; color: var(--acento); }
.btn-cats.activa { background: var(--acento); color: var(--acento-txt); }
.btn-cats.activa svg { color: var(--acento-txt); }

main { max-width: var(--ancho); margin: 0 auto; padding: 8px 16px 40px; }

/* Categorías: todas a la vista, en varias filas */
.bloque-cats h2 { margin: 6px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--suave); }
.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 620px) { .cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .cats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.cat {
  min-height: 46px; padding: 6px 8px 6px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border-radius: 14px; background: var(--tarjeta); box-shadow: var(--sombra); font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: left;
}
.cat i { flex: none; min-width: 24px; padding: 2px 7px; border-radius: 10px; background: var(--fondo); color: var(--suave); font-style: normal; font-size: 11px; font-weight: 700; text-align: center; }
.cat.activa { background: var(--tinta); color: #fff; }
.cat.activa i { background: rgba(255, 255, 255, .18); color: #fff; }

.cat.nov { background: var(--acento-suave); color: var(--acento-tinta); }
.cat.nov.activa { background: var(--tinta); color: #fff; }
.bloque-dest { margin-top: 22px; padding: 14px; border-radius: 22px; background: var(--tinta); }
.bloque-dest h2 { margin: 2px 2px 12px; font-size: 16px; letter-spacing: -.2px; color: #fff; }
.bloque-dest h2::before { content: "★ "; color: var(--acento); }

.conteo { margin: 22px 0 12px; font-size: 13.5px; color: var(--suave); scroll-margin-top: 142px; }
.conteo b { color: var(--tinta); font-size: 16px; letter-spacing: -.2px; }

/* Cuadrícula */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; } }

.card { display: flex; flex-direction: column; background: var(--tarjeta); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); outline: 2.5px solid transparent; outline-offset: -2.5px; transition: background .15s, outline-color .15s; }
/* Producto ya en el carrito: toda la tarjeta queda marcada. */
.card.en-carrito { background: var(--acento-suave); outline-color: var(--acento); }
.card.en-carrito .foto { background: transparent; }
.card.en-carrito .cod { background: rgba(255, 255, 255, .8); }
.foto { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 8px; background: #fff; }
.sello { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; background: var(--acento); color: var(--acento-txt); font-size: 10.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.sello.gris { background: var(--tinta); color: #fff; }
.card.agotado .foto img { opacity: .45; filter: grayscale(1); }
.sin-stock { display: grid; place-items: center; min-height: 46px; border-radius: 12px; background: var(--fondo); color: var(--suave); font-size: 12.5px; font-weight: 700; }
.foto img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 10px; }
.sin-foto { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 10px; background: var(--fondo); color: var(--suave); font-size: 12px; }
.info { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 4px 10px 10px; }
.cod { align-self: flex-start; padding: 2px 7px; border-radius: 6px; background: var(--fondo); font-size: 10.5px; font-weight: 700; letter-spacing: .3px; color: var(--suave); }
.card h3 {
  margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.3; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.accion { margin-top: auto; padding-top: 8px; }

/* Añadir al presupuesto / cantidad */
.btn-add {
  width: 100%; min-height: 46px; padding: 0 8px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; background: var(--acento-suave); color: var(--acento-tinta); font-weight: 700; font-size: 12.5px; white-space: nowrap;
}
.btn-add i { font-style: normal; font-size: 17px; line-height: 1; }
/* El texto largo solo cuando cabe en la tarjeta. */
.accion { container-type: inline-size; }
.btn-add .largo { display: none; }
@container (min-width: 172px) { .btn-add .largo { display: inline; } .btn-add .corto { display: none; } }
.paso { display: flex; height: 48px; border-radius: 12px; background: var(--acento); color: var(--acento-txt); overflow: hidden; }
.paso button { flex: none; width: clamp(40px, 33%, 50px); font-size: 24px; font-weight: 700; user-select: none; -webkit-user-select: none; }
.paso button:active { background: rgba(18, 20, 28, .12); }
.paso input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; text-align: center; font-weight: 800; font-size: 16px;
  -moz-appearance: textfield; appearance: textfield;
}
.paso input::-webkit-outer-spin-button, .paso input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Antes de añadir: se elige la cantidad y luego se pulsa el botón. */
.paso.claro { margin-bottom: 6px; background: var(--fondo); color: var(--tinta); }
.en-lista { display: block; margin-top: 6px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--acento-tinta); }

.vacio { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; text-align: center; color: var(--suave); }
.vacio b { color: var(--tinta); font-size: 17px; }
.btn-sec { margin-top: 8px; height: 44px; padding: 0 20px; border-radius: 22px; background: var(--tinta); color: #fff; font-weight: 700; }

/* Barra inferior del presupuesto */
.pie-carrito {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; min-height: 62px; padding: 8px 8px 8px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 31px; background: var(--tinta); color: #fff; text-align: left;
  box-shadow: 0 10px 30px rgba(18, 20, 28, .32);
}
.pie-txt { min-width: 0; font-weight: 700; font-size: 14px; }
.pie-txt small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.pie-cta { flex: none; height: 46px; padding: 0 20px; display: grid; place-items: center; border-radius: 23px; background: var(--acento); color: var(--acento-txt); font-weight: 800; font-size: 15px; }

.toast {
  position: fixed; z-index: 26; left: 16px; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto; padding: 12px 16px; border-radius: 14px;
  background: #fff; color: var(--tinta); font-size: 13.5px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 28px rgba(18, 20, 28, .22); animation: subir .22s ease-out;
}

/* Hojas */
.capa { position: fixed; inset: 0; z-index: 30; background: rgba(18, 20, 28, .55); }
.hoja {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto;
  background: var(--tarjeta); border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom);
  animation: subir .22s ease-out;
}
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) {
  .hoja { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; max-height: 88vh; border-radius: 24px; transform: translate(-50%, -50%); animation: none; }
}
@media (prefers-reduced-motion: reduce) { .hoja, .toast { animation: none; } }
.cerrar {
  position: sticky; top: 10px; float: right; margin: 10px 10px -50px 0;   /* flota sin ocupar alto */
  z-index: 2; width: 40px; height: 40px; border-radius: 50%; background: var(--fondo); font-size: 24px; line-height: 1;
}
.hoja-titulo { margin: 0; padding: 20px 60px 12px 16px; font-size: 19px; letter-spacing: -.3px; }

.lista-cats { padding: 0 12px 16px; }
.lista-cats button { width: 100%; min-height: 52px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 12px; font-size: 15px; font-weight: 600; text-align: left; }
.lista-cats i { flex: none; padding: 3px 9px; border-radius: 11px; background: var(--fondo); color: var(--suave); font-style: normal; font-size: 12px; font-weight: 700; }
.lista-cats .activa { background: var(--acento-suave); color: var(--acento-tinta); }
.lista-cats .activa i { background: var(--acento); color: var(--acento-txt); }

/* Las fotos del catálogo son pequeñas: no se amplían más de lo que aguantan. */
.ficha-foto { height: min(78vw, 42dvh, 320px); padding: 12px; background: #fff; }
.ficha-foto img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ficha-cuerpo { padding: 16px 16px 20px; border-top: 1px solid var(--linea); }
.etq { font-size: 11.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--acento-tinta); }
.ficha-cuerpo h2 { margin: 6px 0 4px; font-size: 19px; line-height: 1.25; letter-spacing: -.3px; }
.meta { margin: 0 0 16px; color: var(--suave); font-size: 13.5px; }
.ficha-cuerpo .btn-add { min-height: 52px; background: var(--acento); color: var(--acento-txt); font-size: 15px; }
.ficha-cuerpo .btn-add .largo { display: inline; }
.ficha-cuerpo .btn-add .corto { display: none; }
.ficha-cuerpo .paso { height: 52px; }
.ficha-cuerpo .paso button { width: 60px; }

.btn-compartir { width: 100%; height: 46px; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 23px; background: var(--fondo); font-weight: 700; font-size: 14px; }

/* Lista escolar */
.lista-esc { padding: 0 16px 16px; }
.nota.izq { margin: 0 0 10px; text-align: left; }
.lista-esc textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--linea); border-radius: 14px; font: inherit; font-size: 16px; line-height: 1.45; outline: 0; resize: vertical; }
.lista-esc textarea:focus { border-color: var(--acento); }
.btn-oscuro { width: 100%; height: 50px; margin: 10px 0 14px; border-radius: 25px; background: var(--tinta); color: #fff; font-weight: 700; font-size: 15px; }
.lista-res { list-style: none; margin: 0; padding: 0; }
.lista-res li { padding: 12px 0; border-top: 1px solid var(--linea); }
.pedido { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--suave); }
.eleccion { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; }
.eleccion select, .eleccion input { height: 46px; padding: 0 10px; border: 1.5px solid var(--linea); border-radius: 12px; background: #fff; font: inherit; font-size: 15px; min-width: 0; }
.eleccion input { text-align: center; font-weight: 700; }
.lista-res .sin { font-size: 13px; color: #b3261e; }
.lista-pie { position: sticky; bottom: 0; padding: 12px 0 4px; background: var(--tarjeta); }
.btn-wa.verde { background: var(--acento); color: var(--acento-txt); }

.lineas { list-style: none; margin: 0; padding: 0 16px; }
.lineas li { display: grid; grid-template-columns: 52px 1fr 138px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--linea); }
.lineas img, .lineas .sin-foto { width: 52px; height: 52px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--linea); }
.l-txt { min-width: 0; }
.l-txt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.3; }
.l-txt span { font-size: 11.5px; color: var(--suave); }
.lineas .accion { margin: 0; padding: 0; }
.lineas .en-lista { display: none; }
.carrito-vacio { display: flex; flex-direction: column; gap: 6px; padding: 20px 24px 44px; text-align: center; color: var(--suave); font-size: 14px; }
.carrito-vacio b { color: var(--tinta); font-size: 16px; }
.carrito-pie { position: sticky; bottom: 0; padding: 14px 16px 16px; background: var(--tarjeta); border-top: 1px solid var(--linea); }
.campo { display: block; margin: 0 0 5px 2px; font-size: 12.5px; font-weight: 700; }
.carrito-pie input.falta { border-color: #d93025; background: #fff6f5; }
.falta-txt { margin: -4px 0 10px 2px; font-size: 12.5px; font-weight: 600; color: #b3261e; }
.btn-wa.ocupado { opacity: .6; pointer-events: none; }
.carrito-pie input { width: 100%; height: 48px; padding: 0 14px; margin-bottom: 10px; border: 1.5px solid var(--linea); border-radius: 14px; font-size: 16px; outline: 0; }
.carrito-pie input:focus { border-color: var(--acento); }
.btn-wa { width: 100%; height: 54px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 27px; background: var(--wa); color: #fff; font-weight: 800; font-size: 16px; }
.nota { margin: 10px 0 4px; text-align: center; font-size: 12.5px; line-height: 1.45; color: var(--suave); }
.btn-vaciar { width: 100%; height: 46px; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid #f0c9c5; border-radius: 23px; background: #fff; color: #b3261e; font-weight: 700; font-size: 14px; }

/* ---------- Tablet y escritorio: se aprovecha el ancho ---------- */
@media (min-width: 761px) {
  .barra, .hero-in, .filtros-in, main { padding-left: 28px; padding-right: 28px; }
  .barra { padding-left: max(28px, calc((100% - var(--ancho)) / 2 + 28px)); padding-right: max(28px, calc((100% - var(--ancho)) / 2 + 28px)); }
  .buscador { max-width: 560px; }
}
@media (min-width: 1100px) {
  .barra, .hero-in, .filtros-in, main { padding-left: 40px; padding-right: 40px; }
  .barra { padding-left: max(40px, calc((100% - var(--ancho)) / 2 + 40px)); padding-right: max(40px, calc((100% - var(--ancho)) / 2 + 40px)); }
  /* Presentación en dos columnas: texto a la izquierda, pasos y lista escolar a la derecha. */
  .hero-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 560px); gap: 12px 56px; align-items: center; padding-top: 44px; padding-bottom: 44px; }
  .hero-in > .sobre { grid-column: 1; justify-self: start; }
  .hero-in > h1 { grid-column: 1; margin: 0; font-size: 46px; max-width: 640px; }
  .hero-in > p { grid-column: 1; font-size: 17px; }
  .hero-in > .pasos { grid-column: 2; grid-row: 1 / span 2; margin: 0; align-self: end; }
  .hero-in > .btn-lista-esc { grid-column: 2; grid-row: 3; margin: 0; align-self: start; }
  .hero-in > .btn-instalar { grid-column: 1; justify-self: start; }
  .pasos li { padding: 16px 14px; font-size: 13.5px; }
}

.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Confirmación de solicitud guardada */
.hecho { padding: 30px 20px 22px; text-align: center; }
.hecho-ok { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--acento); color: var(--acento-txt); font-size: 32px; font-weight: 800; }
.hecho h2 { margin: 0 0 8px; font-size: 21px; letter-spacing: -.3px; }
.hecho p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.45; color: var(--suave); }
.hecho p b { color: var(--tinta); }
.hecho .btn-wa { text-decoration: none; height: 58px; font-size: 17px; }
.btn-enlace-gris { display: block; margin: 12px auto 0; padding: 10px; font-size: 14px; font-weight: 600; color: var(--suave); }
