/* ===================================================================
   Reusalia — ESCAPARATE (tablet de tienda) · identidad 2026 «Bosque»
   Kiosco táctil, orientado a cliente. Solo lectura.
   Paleta: bosque #105038 · lima #78B828 · papel #F5F2E9
   Tipografía: Figtree (fallback system-ui)
   =================================================================== */
:root {
  --bg: #F5F2E9;
  --bg-soft: #DCE6CF;
  --surface: #FFFFFF;
  --text: #1C241F;
  --text-muted: #4B5347;
  --ink: #181818;
  --brand: #105038;
  --brand-700: #0C3A29;
  --brand-dark: #10281C;
  --accent: #78B828;
  --accent-hover: #63A31C;
  --on-accent: #14290A;
  --warn: #C77A12;
  --warn-bg: #FBEBD2;
  --piezas: #8A6D3B;
  --border: #E3DECB;
  --shadow: 0 14px 34px rgba(20, 30, 20, 0.10);
  --shadow-sm: 0 2px 8px rgba(20, 30, 20, 0.10);
  --r-card: 18px;
  --r-btn: 999px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, monospace;
  --top-h: 84px;
}

*, *::before, *::after { box-sizing: border-box; }
/* ⚠️ IMPRESCINDIBLE: un `display` de autor ANULA el atributo [hidden] del HTML. Como .ficha,
   .panel-lista y .atraccion llevan display:flex, sin esta regla se quedan SIEMPRE visibles y
   el overlay de la pantalla de espera (z-index 80) tapa toda la app con un rectángulo verde. */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;          /* sin "pull to refresh" ni rebote */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;                   /* kiosco: nada de seleccionar texto… */
}
input, textarea { -webkit-user-select: text; user-select: text; } /* …salvo en campos */
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd3c0; border-radius: 999px; }

.cargando, .vacio, .pl-vacia { color: var(--text-muted); text-align: center; padding: 28px; font-size: 18px; }
.vacio { padding: 60px 20px; font-size: 20px; line-height: 1.5; }

/* ===================== CABECERA ===================== */
.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.marca { background: none; border: 0; padding: 4px 6px; display: flex; align-items: center; }
.marca-logo { height: 40px; width: auto; display: block; }

.buscador {
  flex: 1; min-width: 0; position: relative;
  display: flex; align-items: center;
  background: #fff; border: 2px solid var(--border);
  border-radius: var(--r-btn);
  padding: 0 8px 0 16px; height: 60px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.buscador:focus-within { border-color: var(--accent); }
.buscador-lupa { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }
.buscador-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font-size: 21px; color: var(--text); padding: 0 10px; height: 100%;
}
.buscador-input::placeholder { color: #9aa392; }
.buscador-input::-webkit-search-cancel-button { display: none; }
.buscador-x {
  border: 0; background: #eef0e8; color: var(--text-muted);
  width: 38px; height: 38px; border-radius: 999px; font-size: 24px; line-height: 1; flex: none; margin-right: 4px;
}
.buscador-cam {
  border: 0; background: var(--brand); color: #fff;
  width: 48px; height: 48px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.buscador-cam svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.buscador-cam:active { background: var(--brand-700); }

.btn-lista {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 9px;
  height: 56px; padding: 0 20px;
  background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: var(--r-btn); font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.btn-lista:active { background: var(--accent-hover); }
.btn-lista svg { width: 22px; height: 22px; fill: none; stroke: var(--on-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-lista-txt { white-space: nowrap; }
.lista-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 26px; height: 26px; padding: 0 6px;
  background: var(--brand); color: #fff; border: 2px solid #fff;
  border-radius: 999px; font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* ===================== VISTA ===================== */
.vista { max-width: 1400px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---- Home: hero ---- */
.hero { text-align: center; padding: 20px 10px 8px; }
.hero-t { font-size: clamp(30px, 4.5vw, 46px); font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 10px; color: var(--ink); }
.hero-s { font-size: clamp(16px, 2vw, 20px); color: var(--text-muted); max-width: 720px; margin: 0 auto; line-height: 1.5; }

/* ---- Tipos (categorías) ---- */
.tipos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 26px 0 34px; }
.tipo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 152px; padding: 18px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); text-align: center; transition: transform .08s, box-shadow .15s, border-color .15s;
}
.tipo:active { transform: scale(.97); border-color: var(--accent); box-shadow: var(--shadow); }
.tipo-ic { font-size: 46px; line-height: 1; }
.tipo-n { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.15; }
.tipo-c { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }

/* ---- Rail de novedades ---- */
.rail-wrap { margin: 8px 0 30px; }
.bloque-t { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 14px; }
.rail { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.rail .card { flex: 0 0 210px; scroll-snap-align: start; }

/* ===================== TARJETAS ===================== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-top: 6px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform .08s, box-shadow .15s;
}
.card:active { transform: scale(.98); box-shadow: var(--shadow); }
.card-media { position: relative; aspect-ratio: 1 / 1; background: #fff; display: flex; align-items: center; justify-content: center; }
.card-img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.card-media.sinfoto::after, .card-img.vacia, .card-media .vacia { content: "📦"; }
.card-media .vacia, .card-img.vacia { font-size: 54px; color: #cfd6c6; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.card-media.sinfoto img { display: none; }
.card-media.sinfoto::after { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 54px; color: #cfd6c6; }
.card-body { padding: 10px 13px 14px; display: flex; flex-direction: column; gap: 4px; }
.card-tit { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-precio { font-size: 22px; font-weight: 800; color: var(--brand); letter-spacing: -0.01em; }

.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: #eaf3dc; color: var(--brand-700);
}
.badge.ok { background: #e2f2d3; color: #2f6a1f; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.piezas { background: #efe7d6; color: var(--piezas); }

.card-add {
  position: absolute; bottom: 10px; right: 10px; z-index: 2;
  width: 44px; height: 44px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
}
.card-add svg { width: 24px; height: 24px; fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.card-add .check { display: none; }
.card-add.marcado { background: var(--accent); }
.card-add.marcado svg { stroke: var(--on-accent); }
.card-add.marcado .check { display: block; }
.card-add.marcado > svg:first-child { display: none; }

/* ===================== RESULTADOS ===================== */
.res-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.volver { background: #fff; border: 1px solid var(--border); border-radius: var(--r-btn); padding: 10px 18px; font-size: 16px; font-weight: 700; color: var(--brand); }
.res-tit { flex: 1; min-width: 0; font-size: clamp(20px, 2.6vw, 28px); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.orden { border: 1px solid var(--border); background: #fff; border-radius: var(--r-btn); padding: 10px 16px; font-size: 15px; font-weight: 600; color: var(--text); }
.res-info { color: var(--text-muted); font-size: 15px; font-family: var(--font-mono); margin: 2px 0 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chip { flex: none; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 15px; font-weight: 600; color: var(--text); display: flex; gap: 7px; align-items: center; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-n { font-size: 12px; opacity: .7; font-family: var(--font-mono); }
.chip.on .chip-n { opacity: .85; }

.mas-wrap { text-align: center; margin-top: 26px; }
.mas { background: var(--brand); color: #fff; border: 0; border-radius: var(--r-btn); padding: 15px 40px; font-size: 17px; font-weight: 700; box-shadow: var(--shadow-sm); }
.mas:disabled { opacity: .5; }

/* ===================== FICHA (modal) ===================== */
body.modal-abierto { overflow: hidden; }
.ficha {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 40, 28, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.ficha-box {
  position: relative; background: var(--surface); border-radius: 22px;
  width: min(960px, 100%); max-height: 92vh; overflow: hidden;
  display: grid; grid-template-columns: 1.1fr 1fr; box-shadow: var(--shadow);
}
.ficha-x {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 46px; height: 46px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm);
  font-size: 22px; color: var(--text);
}
.ficha-media { background: #fff; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ficha-foto { width: 100%; height: 360px; object-fit: contain; touch-action: pinch-zoom; }
.ficha-foto.vacia { display: flex; align-items: center; justify-content: center; font-size: 80px; color: #cfd6c6; background: #f6f7f2; border-radius: 12px; }
.ficha-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.ficha-thumb { flex: none; width: 62px; height: 62px; border-radius: 10px; border: 2px solid var(--border); overflow: hidden; padding: 0; background: #fff; }
.ficha-thumb.on { border-color: var(--accent); }
.ficha-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ficha-info { padding: 26px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ficha-marca { font-size: 14px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ficha-tit { font-size: 26px; font-weight: 800; line-height: 1.2; margin: 2px 0; letter-spacing: -0.01em; }
.ficha-precio { font-size: 38px; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }
.ficha-tara { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.4; }
.ficha-desc { font-size: 16px; line-height: 1.55; color: var(--text-muted); margin: 4px 0; }
.aviso-nodispo { background: #fde8e8; color: #b42318; border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.ficha-add { margin-top: auto; background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--r-btn); padding: 17px; font-size: 19px; font-weight: 800; box-shadow: var(--shadow-sm); }
.ficha-add.marcado { background: var(--brand); color: #fff; }
.ficha-ref { font-size: 12px; color: #b3bba9; font-family: var(--font-mono); text-align: right; }

/* ===================== PANEL "MI LISTA" ===================== */
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(16, 40, 28, 0.5); }
.panel-lista {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 56;
  width: min(440px, 92vw); background: var(--bg);
  box-shadow: -20px 0 48px rgba(0, 0, 0, 0.22);
  display: flex; flex-direction: column;
}
.pl-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 14px; border-bottom: 1px solid var(--border); }
.pl-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.pl-cerrar { width: 44px; height: 44px; border-radius: 999px; border: 0; background: #eef0e8; font-size: 20px; }
.pl-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pl-item { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.pl-item img, .pl-img { width: 62px; height: 62px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.pl-img.vacia { display: flex; align-items: center; justify-content: center; font-size: 30px; color: #cfd6c6; }
.pl-info { flex: 1; min-width: 0; }
.pl-tit { font-size: 15px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-precio { font-size: 17px; font-weight: 800; color: var(--brand); margin-top: 2px; }
.pl-quitar { width: 40px; height: 40px; border-radius: 999px; border: 0; background: #f3ece6; color: #9b5b5b; font-size: 17px; flex: none; }
.pl-vacia { margin: auto; }
.pl-vacia small { color: var(--text-muted); font-size: 14px; display: block; margin-top: 8px; line-height: 1.5; }
.pl-foot { border-top: 1px solid var(--border); padding: 16px 20px 22px; background: #fff; }
.pl-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.pl-total b { font-size: 26px; font-weight: 800; color: var(--brand); }
.pl-nota { font-size: 13px; color: var(--text-muted); margin: 8px 0 12px; line-height: 1.45; }
.pl-vaciar { width: 100%; background: #fff; border: 1px solid var(--border); color: var(--text-muted); border-radius: var(--r-btn); padding: 12px; font-size: 15px; font-weight: 700; }

/* ===================== FOOTER (QR + tienda) ===================== */
.pie { margin-top: 30px; border-top: 1px solid var(--border); padding-top: 26px; display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: center; }
.pie-qrs { display: flex; gap: 16px; flex-wrap: wrap; }
.qr-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px; text-align: center; width: 168px; box-shadow: var(--shadow-sm); }
.qr-img { width: 130px; height: 130px; display: block; margin: 0 auto 8px; background: #fff; border-radius: 8px; }
.qr-tit { font-size: 15px; font-weight: 700; color: var(--text); }
.qr-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }
.qr-whatsapp { outline: 2px solid var(--accent); outline-offset: -2px; }
.pie-tienda { background: var(--brand-dark); color: #EDEFE6; border-radius: 18px; padding: 22px 24px; }
.pie-marca { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.pie-linea { font-size: 15px; line-height: 1.7; color: #d7ddcd; }
.pie-wa b { color: #A7D26E; }

/* ===================== PANTALLA DE ESPERA / PUBLICIDAD ===================== */
.atraccion { position: fixed; inset: 0; z-index: 80; background: var(--brand-dark); overflow: hidden; display: flex; flex-direction: column; }
.at-bg { position: absolute; inset: 0; opacity: 0.28; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.at-fila { overflow: hidden; }
.at-track { display: flex; gap: 16px; width: max-content; animation: desliza 60s linear infinite; }
.at-fila:nth-child(2) .at-track { animation-direction: reverse; animation-duration: 75s; }
.at-cel { position: relative; width: 180px; height: 180px; background: #fff; border-radius: 14px; flex: none; }
.at-cel img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.at-precio { position: absolute; bottom: 6px; right: 6px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
@keyframes desliza { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.at-panel { position: relative; z-index: 2; margin: auto; text-align: center; padding: 30px; max-width: 900px; }
.at-logo { height: 54px; margin-bottom: 22px; }
.at-t { font-size: clamp(38px, 6vw, 68px); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; color: #F4F1E7; margin: 0 0 14px; }
.at-t b { color: var(--accent); }
.at-s { font-size: clamp(18px, 2.6vw, 26px); color: #cdd6c3; margin: 0 0 30px; }
.at-qrs { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.at-qr { background: #fff; border-radius: 16px; padding: 14px; width: 168px; }
.at-qr img { width: 140px; height: 140px; display: block; margin: 0 auto 8px; }
.at-qr span { font-size: 14px; font-weight: 700; color: var(--brand-dark); }
.at-toca { display: inline-block; font-size: 20px; font-weight: 700; color: var(--brand-dark); background: var(--accent); padding: 14px 32px; border-radius: 999px; animation: latido 2s ease-in-out infinite; }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ===================== ESCÁNER (cámara) ===================== */
.esc-scan { position: fixed; inset: 0; z-index: 100000; background: #000; display: flex; flex-direction: column; color: #fff; }
.esc-scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.esc-scan-guia { position: absolute; left: 0; right: 0; top: 27.5%; height: 45%; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); border-top: 3px solid rgba(255, 255, 255, .9); border-bottom: 3px solid rgba(255, 255, 255, .9); }
.esc-scan-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: linear-gradient(rgba(0, 0, 0, .8), transparent); }
.esc-scan-tit { font-weight: 700; font-size: 19px; flex: 1; }
.esc-scan-x { background: rgba(255, 255, 255, .18); border: 0; color: #fff; border-radius: 12px; padding: 12px 18px; font-size: 16px; font-weight: 700; }
.esc-scan-pie { position: relative; z-index: 2; margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 20px 34px; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.esc-scan-msg { font-size: 17px; text-align: center; line-height: 1.4; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); min-height: 22px; }
.esc-scan-msg b { color: #fca5a5; }
.esc-scan-foto { background: #fff; color: #1b2430; border: 0; border-radius: 14px; padding: 15px 26px; font-size: 17px; font-weight: 700; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  :root { --top-h: 76px; }
  .btn-lista-txt { display: none; }
  .btn-lista { padding: 0 16px; }
  .ficha-box { grid-template-columns: 1fr; max-height: 94vh; overflow-y: auto; }
  .ficha-foto { height: 260px; }
  .pie { grid-template-columns: 1fr; }
  .tipos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 460px) {
  .buscador-input { font-size: 17px; }
  .hero-t { font-size: 26px; }
}
