/* ── Catálogo en tarjetas ── */
.tabla-header { display: none !important; }

main .tabla-body {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 20px 16px 160px;
  max-width: 1200px;
  margin: 0 auto;
}

main .tabla-body .producto-fila {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 14px !important;
  background: #fff;
  border: 1px solid #e8e8ee;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

main .tabla-body .col-foto {
  display: block !important;
  width: 100% !important;
  aspect-ratio: 1 / 1;
  background: #f5f5f8;
}
main .tabla-body .prod-img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

main .tabla-body .col-info,
main .tabla-body .col-precio,
main .tabla-body .col-meta,
main .tabla-body .col-cantidad,
main .tabla-body .col-subtotal {
  display: flex !important;
  padding: 0 14px !important;
  width: auto !important;
}
main .tabla-body .col-info { flex-direction: column; gap: 2px; }
main .tabla-body .prod-nombre { font-size: 14px; font-weight: 700; line-height: 1.25; }
main .tabla-body .prod-codigo { font-size: 11px; opacity: .55; }
main .tabla-body .col-precio { font-size: 20px; font-weight: 800; }
main .tabla-body .col-meta { gap: 8px; flex-wrap: wrap; font-size: 12px; opacity: .7; }
main .tabla-body .col-unidad,
main .tabla-body .col-cxb { display: inline !important; padding: 0 !important; }
main .tabla-body .col-cantidad { justify-content: center; align-items: center; gap: 8px; }
main .tabla-body .col-subtotal { justify-content: flex-end; font-size: 13px; opacity: .6; }
main .tabla-body .col-subtotal.activo { opacity: 1; font-weight: 700; }

/* ── Ventana de detalle ── */
.lb-box { overflow-y: auto; max-height: 92vh; }
.lb-desc {
  padding: 12px 18px 18px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
}

/* ── Celular: 2 columnas ── */
@media (max-width: 640px) {
  main .tabla-body {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 10px 170px;
  }
  main .tabla-body .col-precio { font-size: 17px; }
  main .tabla-body .prod-nombre { font-size: 12.5px; }
}

/* ── Barra superior compacta ── */
header { display: none !important; }

.toolbar {
  top: 0 !important;
  padding: 10px 0 8px !important;
}
.toolbar-inner {
  gap: 10px !important;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.logo-top { flex: 0 0 auto; display: flex; align-items: center; }
.logo-top img {
  height: 52px !important;
  width: auto !important;
  max-width: 170px !important;
  object-fit: contain;
  display: block;
}

.top-row .moneda-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  flex: 0 1 auto;
}
.top-row .moneda-selector select { max-width: 200px; }

/* ── Celular ── */
@media (max-width: 640px) {
  .logo-top img { height: 40px !important; max-width: 120px !important; }
  .top-row .moneda-selector label { display: none; }
  .top-row .moneda-selector select { max-width: 170px; font-size: 14px; }

  /* Categorías en una sola fila, se deslizan con el dedo */
  .categorias {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 2px;
  }
  .categorias::-webkit-scrollbar { display: none; }
  .categorias .cat-btn { flex: 0 0 auto; white-space: nowrap; }
}
/* ── Fotos completas y más chicas ── */
main .tabla-body {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
  gap: 14px !important;
}
main .tabla-body .col-foto {
  aspect-ratio: 4 / 3 !important;
  background: #fff !important;
  padding: 8px;
  box-sizing: border-box;
}
main .tabla-body .prod-img {
  object-fit: contain !important;
  width: 100% !important;
  height: 100% !important;
}

/* Ventana de detalle: foto entera y no gigante */
.lb-img-wrap {
  max-height: 42vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.lb-img {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 42vh !important;
  object-fit: contain !important;
}

/* Celular: 2 columnas */
@media (max-width: 640px) {
  main .tabla-body {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}

/* ── Ventana de detalle: foto ENTERA + descripción corta con "Leer más" ── */
.lb-overlay .lb-box .lb-img-wrap {
  flex: 0 0 auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #fff !important;
  padding: 10px !important;
  box-sizing: border-box !important;
}
.lb-overlay .lb-box .lb-img {
  flex: 0 0 auto !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 50vh !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

.lb-desc.lb-desc-corta {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lb-leer-mas {
  display: none;
  margin: 0 18px 18px;
  padding: 0;
  background: none;
  border: 0;
  color: #1a73e8;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Buscador: botón ✕, resultados y modo "buscando" ── */
.search-box { position: relative; }
.search-box input { padding-right: 46px !important; }
.search-clear {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #e6e6ea;
  color: #333;
  font-size: 14px;
  cursor: pointer;
}
.search-clear.visible { display: flex; align-items: center; justify-content: center; }

/* Saca la "x" que el navegador pone sola, para que no se vea doble */
#buscador::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

.resultados-info {
  max-width: 1200px;
  margin: 8px auto 0;
  padding: 0 16px;
  font-size: 13px;
  opacity: .7;
}
.resultados-info:empty { display: none; }

#catalogo { scroll-margin-top: 150px; }

/* Celular: mientras escribís, se esconden las barras que tapan los productos */
@media (max-width: 640px) {
  body.buscando .footer-carrito,
  body.buscando .banner-inicio,
  body.buscando .wa-flotante,
  body.buscando .categorias { display: none !important; }
}