:root {
  --primary: #2f6f4f;
  --primary-dark: #234f38;
  --danger: #c0392b;
  --muted: #6b7280;
  --bg: #f4f6f8;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #1f2937;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13.5px; margin-top: 8px; }

/* ---------------- topbar ---------------- */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.cliente-info { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.btn-link {
  background: none; border: none; color: inherit; text-decoration: underline;
  cursor: pointer; font-size: 13.5px; padding: 0;
}

/* ---------------- login ---------------- */
.vista { min-height: calc(100vh - 54px); }
#vistaLogin {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiIHZpZXdCb3g9IjAgMCAxNjAwIDkwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ic2t5IiB4MT0iMCIgeTE9IjAiIHgyPSIwIiB5Mj0iMSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNlYWY1ZWMiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSI1MCUiIHN0b3AtY29sb3I9IiNjN2U2Y2MiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjOGZjZjllIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8cmVjdCB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjc2t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gPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTA4MCw3MDApIiBvcGFjaXR5PSIwLjQ1IiBmaWxsPSIjMmM1ZjQwIj4KICAgIDxwYXRoIGQ9Ik0wLDY0IEw0Niw0IEw5Miw2NCBaIi8+CiAgICA8cmVjdCB4PSIxNiIgeT0iNjQiIHdpZHRoPSI2MCIgaGVpZ2h0PSI0MCIvPgogICAgPHJlY3QgeD0iMzgiIHk9IjgyIiB3aWR0aD0iMTYiIGhlaWdodD0iMjIiLz4KICAgIDxwYXRoIGQ9Ik0tOCw2NCBMMTAwLDY0IEw5Miw1MiBMOCw1MiBaIiBmaWxsPSIjMjA0ZTMzIi8+CiAgPC9nPgo8L3N2Zz4K");
  background-size: cover;
  background-position: center;
}
.login-logo {
  width: 76px; height: 76px; object-fit: contain; display: block; margin: 0 auto 12px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.15));
}
.login-box {
  background: rgba(255,255,255,.32);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 18px; padding: 34px 28px; width: 100%; max-width: 380px;
  box-shadow: 0 12px 36px rgba(35,79,56,.22); text-align: center;
}
.login-box h1 { margin: 0 0 8px; font-size: 22px; color: #1f3d2b; }
.login-box p { margin: 0 0 20px; font-size: 14px; }
#formLogin { display: flex; flex-direction: column; gap: 10px; }
#formLogin input {
  padding: 12px 14px; border: 1px solid rgba(255,255,255,.7); border-radius: 8px; font-size: 15px;
  text-align: center; letter-spacing: 1px; background: rgba(255,255,255,.55);
}
#formLogin input::placeholder { color: #4b5f52; }
#formLogin button, .btn-primario {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 12px 14px; font-size: 15px; font-weight: 600; cursor: pointer;
}
#formLogin button:hover, .btn-primario:hover { background: var(--primary-dark); }

/* ---------------- catalogo ---------------- */
.catalogo-layout { display: flex; gap: 0; align-items: flex-start; }
.filtros {
  width: 220px; flex-shrink: 0; background: #fff; padding: 20px 16px;
  min-height: calc(100vh - 54px); border-right: 1px solid var(--border);
}
.filtros h2 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.lista-rubros { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lista-rubros li {
  padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; color: #374151;
}
.lista-rubros li:hover { background: #f0f2f4; }
.lista-rubros li.activo { background: var(--primary); color: #fff; }

.productos-panel { flex: 1; padding: 20px 24px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.toolbar input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.btn-carrito {
  background: #fff; border: 1px solid var(--primary); color: var(--primary);
  border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-carrito:hover { background: #eaf3ee; }
#carritoCount {
  display: inline-block; background: var(--primary); color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: 12px; margin-left: 4px;
}

.lista-productos { display: flex; flex-direction: column; gap: 8px; }
.producto-fila {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 18px;
}
.producto-fila:hover { border-color: #d6dbe1; }
.producto-fila { cursor: pointer; }
.producto-img {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border); background: #f4f5f6;
}
.producto-img-vacia { }
.producto-info { flex: 1; min-width: 0; }
.producto-nombre { font-weight: 600; font-size: 14.5px; }
.producto-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sin-stock-aviso { font-size: 11.5px; color: var(--danger); margin-top: 3px; font-weight: 600; }
.producto-precio-row {
  display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; width: 140px; justify-content: flex-end;
}
.precio-tachado { text-decoration: line-through; color: #9aa3ad; font-size: 12.5px; }
.precio-actual { font-weight: 700; color: var(--primary); font-size: 16px; white-space: nowrap; }
.producto-footer { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.qty-control { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 7px; }
.qty-control button {
  background: none; border: none; width: 30px; height: 30px; cursor: pointer; font-size: 16px;
}
.qty-control input {
  width: 36px; border: none; text-align: center; font-size: 14px;
}
.btn-agregar {
  background: var(--primary); color: #fff; border: none; border-radius: 7px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-agregar:hover { background: var(--primary-dark); }
.sin-stock { opacity: .75; }
.badge-sin-stock {
  font-size: 11px; color: var(--danger); font-weight: 600; white-space: nowrap;
}

/* Semaforo de stock: verde = en stock, amarillo = stock limitado,
   rojo = agotado (se pide consultar). */
.stock-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 3px 8px; border-radius: 999px;
}
.stock-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.stock-verde { color: #1e7e42; background: #e4f6ea; }
.stock-verde::before { background: #2fa84f; }
.stock-amarillo { color: #93650a; background: #fff3d6; }
.stock-amarillo::before { background: #e8a838; }
.stock-rojo { color: var(--danger); background: #fbe7e4; }
.stock-rojo::before { background: var(--danger); }

/* Circulito de semaforo adelante del nombre del producto. */
.stock-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 7px; flex-shrink: 0; vertical-align: middle;
}
.dot-verde { background: #2fa84f; }
.dot-amarillo { background: #e8a838; }
.dot-rojo { background: var(--danger); }

/* ---------------- modal de detalle de producto ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 20, .55); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 14px; max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto; position: relative; padding: 20px;
}
.modal-cerrar {
  position: absolute; top: 10px; right: 12px; font-size: 14px; color: var(--muted);
}
.modal-producto-img-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.modal-producto-img {
  width: 100%; max-width: 320px; height: 220px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); background: #f4f5f6;
}
.modal-producto-nombre { font-weight: 700; font-size: 18px; display: flex; align-items: center; }
.modal-producto-desc { font-size: 13.5px; color: #374151; line-height: 1.5; margin: 12px 0; white-space: pre-line; }
.modal-precio-row { width: auto; justify-content: flex-start; margin: 8px 0; }
.modal-footer { flex-wrap: wrap; gap: 10px; margin-top: 10px; }

@media (max-width: 560px) {
  .modal-producto-img { height: 180px; }
}

/* ---------------- carrito panel ---------------- */
.panel-carrito {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw;
  background: #fff; box-shadow: -2px 0 12px rgba(0,0,0,.15); z-index: 50;
}
.panel-carrito-inner { display: flex; flex-direction: column; height: 100%; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-header h2 { margin: 0; font-size: 17px; }
.carrito-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.carrito-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f0f2f4; font-size: 13.5px;
}
.carrito-item .nombre { font-weight: 600; }
.carrito-item .detalle { color: var(--muted); font-size: 12px; }
.carrito-item .quitar { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; }
.carrito-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.carrito-footer textarea {
  width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font-family: inherit; font-size: 13.5px; resize: vertical;
}
.carrito-total { font-size: 15px; text-align: right; }

/* ---------------- confirmacion ---------------- */
#vistaConfirmacion { display: flex; align-items: center; justify-content: center; padding: 24px; }
.confirmacion-box {
  background: #fff; border-radius: 12px; padding: 34px 28px; width: 100%; max-width: 460px;
  text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.check {
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 14px;
}
.conf-items { text-align: left; margin: 18px 0; border-top: 1px solid var(--border); padding-top: 12px; }
.conf-item-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
.conf-total { font-size: 16px; margin-bottom: 18px; }
.conf-botones { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.conf-botones .btn-primario { width: 100%; }

/* ---------------- mis pedidos ---------------- */
#vistaMisPedidos { padding: 24px; }
.mis-pedidos-layout { max-width: 640px; margin: 0 auto; }
.mis-pedidos-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.mis-pedidos-header h1 { margin: 0; font-size: 20px; }

.lista-mis-pedidos { display: flex; flex-direction: column; gap: 12px; }
.pedido-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.pedido-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px;
}
.pedido-card-id { font-weight: 600; font-size: 14.5px; }
.pedido-card-fecha { font-size: 12.5px; color: var(--muted); }
.pedido-items { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.pedido-item-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: #374151; }
.pedido-notas { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.pedido-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
}
.pedido-card-total { font-size: 14px; }

.estado-badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
}
.estado-badge.estado-nuevo { background: #fdf1de; color: #9a6b13; }
.estado-badge.estado-visto { background: #eaf1fb; color: #2a5fa8; }
.estado-badge.estado-preparando { background: #eaf1fb; color: #2a5fa8; }
.estado-badge.estado-completado { background: #e5f3ea; color: #1f7a45; }
.estado-badge.estado-cancelado { background: #fbe6e4; color: #b3261e; }

/* ---------------- responsive (tablet y celular) ---------------- */
body { overflow-x: hidden; }

@media (max-width: 960px) {
  .catalogo-layout { flex-direction: column; align-items: stretch; }
  .filtros {
    width: 100%; min-height: auto; padding: 10px 12px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .filtros h2 { display: none; }
  /* Rubros en una sola fila deslizable (antes se apilaban todos y ocupaban
     media pantalla). */
  .lista-rubros {
    flex-direction: row; flex-wrap: nowrap; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 2px;
  }
  .lista-rubros::-webkit-scrollbar { display: none; }
  .lista-rubros li {
    flex-shrink: 0; white-space: nowrap; border: 1px solid var(--border);
    border-radius: 999px; padding: 7px 14px; font-size: 13px;
  }
  .lista-rubros li.activo { border-color: var(--primary); }

  .productos-panel { padding: 12px; min-width: 0; }
  .toolbar {
    position: sticky; top: 0; z-index: 10; background: var(--bg);
    padding: 4px 0 10px; margin-bottom: 4px;
  }

  /* Fila de producto en grilla: foto + datos arriba, precio y botones abajo. */
  .producto-fila {
    display: grid; grid-template-columns: 56px 1fr;
    grid-template-areas: "img info" "precio precio" "footer footer";
    column-gap: 12px; row-gap: 0; align-items: start; padding: 12px;
  }
  .producto-img { grid-area: img; width: 56px; height: 56px; }
  .producto-info { grid-area: info; }
  .producto-nombre { font-size: 14px; line-height: 1.3; word-break: break-word; }
  .producto-precio-row {
    grid-area: precio; width: auto; justify-content: flex-start; margin-top: 8px;
  }
  .producto-footer {
    grid-area: footer; flex-wrap: wrap; justify-content: space-between;
    gap: 8px; margin-top: 10px;
  }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: 16px; }
  .cliente-info { gap: 10px; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
  #clienteNombre { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 16px evita que iPhone haga zoom automatico al tocar un campo. */
  .toolbar input, .carrito-footer textarea, #formLogin input { font-size: 16px; }
  .btn-carrito { padding: 10px 12px; }

  .qty-control button { width: 36px; height: 36px; }
  .qty-control input { width: 34px; }
  .btn-agregar { padding: 9px 16px; font-size: 14px; }
  .producto-footer .btn-agregar { flex: 1; text-align: center; }

  #vistaLogin { padding: 16px; }
  .login-box { padding: 26px 20px; }

  /* El carrito ocupa toda la pantalla en vez de un panel angosto. */
  .panel-carrito { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; }
  .panel-header, .carrito-items, .carrito-footer { padding-left: 14px; padding-right: 14px; }
  .carrito-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal-box { padding: 16px; max-height: 92vh; border-radius: 14px 14px 10px 10px; }
  .modal-producto-img { height: 190px; max-width: 100%; }
  .modal-producto-nombre { font-size: 16.5px; padding-right: 54px; }
  .modal-footer .btn-agregar { flex: 1; text-align: center; }

  #vistaConfirmacion, #vistaMisPedidos { padding: 12px; }
  .confirmacion-box { padding: 26px 18px; }
  .mis-pedidos-header { flex-wrap: wrap; gap: 6px; }
  .pedido-card { padding: 14px 12px; }
  .pedido-card-footer { flex-wrap: wrap; gap: 8px; }
}

/* Promo y QR de pago */

/* Limites e invitado */
.max-aviso { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; }
.login-sep { text-align: center; margin: 14px 0 10px; color: #9ca3af; font-size: 13px; }
.btn-secundario { width: 100%; padding: 11px 14px; border: 1px solid var(--border, #d1d5db); background: #fff; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-secundario:hover { background: #f3f4f6; }
.contacto-invitado { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.contacto-invitado input { padding: 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999; max-width: 90vw; text-align: center; }
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 560px) { .contacto-invitado input { font-size: 16px; } }


/* Ofertas */
.ofertas { margin: 0 0 18px; }
.ofertas-titulo { font-size: 18px; margin: 0 0 10px; color: #14532d; }
.ofertas-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.oferta-card { padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: #e5e7eb; aspect-ratio: 2 / 3; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.oferta-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.oferta-card:hover img { transform: scale(1.03); }
.modal-oferta-box { max-width: min(92vw, 520px); padding: 12px; background: #fff; }
.modal-oferta-img { display: block; width: 100%; max-height: 82vh; object-fit: contain; border-radius: 8px; }
@media (max-width: 960px) { .ofertas-grid { grid-template-columns: repeat(2, 1fr); } }


/* =====================================================================
   Look de tienda online (tarjetas, ofertas en carrusel, barra superior)
   ===================================================================== */
:root { --accent: #f0b400; --shadow: 0 2px 10px rgba(16, 24, 40, .08); --shadow-hover: 0 10px 26px rgba(16, 24, 40, .16); }

.topbar { background: linear-gradient(120deg, #1f5a3d 0%, #2f6f4f 55%, #3b8660 100%); box-shadow: 0 2px 12px rgba(0,0,0,.18); position: sticky; top: 0; z-index: 50; }
.brand { font-size: 21px; font-weight: 800; letter-spacing: .6px; }
.brand::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }

.filtros { background: #fff; }
.lista-rubros li { border-radius: 9px; transition: background .15s, color .15s; }
.lista-rubros li:hover { background: #eaf4ee; }

.toolbar { gap: 12px; }
.toolbar input { border-radius: 999px; padding: 12px 18px; box-shadow: var(--shadow); border-color: transparent; background: #fff; }
.toolbar input:focus { outline: 2px solid var(--primary); }
.btn-carrito { border-radius: 999px; padding: 11px 20px; background: var(--primary); color: #fff; border: none; font-weight: 700; box-shadow: var(--shadow); }
.btn-carrito:hover { background: var(--primary-dark); }
.btn-carrito #carritoCount { background: var(--accent); color: #1f2937; }

/* ---- Ofertas: carrusel ---- */
.ofertas { margin: 4px 0 26px; padding: 18px 18px 20px; border-radius: 18px; background: linear-gradient(135deg, #eaf4ee 0%, #ffffff 60%); border: 1px solid #d7e8dd; box-shadow: var(--shadow); }
.ofertas-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.ofertas-titulo { margin: 0; font-size: 26px; font-weight: 800; color: #14532d; letter-spacing: .3px; display: flex; align-items: center; }
.ofertas-titulo::before { content: ""; width: 6px; height: 26px; border-radius: 3px; background: var(--accent); margin-right: 10px; }
.ofertas-sub { margin: 4px 0 0 16px; font-size: 13.5px; color: var(--muted); }
.ofertas-flechas { display: flex; gap: 8px; }
.oferta-flecha { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #cfd8d2; background: #fff; font-size: 24px; line-height: 1; cursor: pointer; color: var(--primary); box-shadow: var(--shadow); }
.oferta-flecha:hover { background: var(--primary); color: #fff; }
.ofertas-grid { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: thin; }
.oferta-card { flex: 0 0 230px; scroll-snap-align: start; border-radius: 14px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.oferta-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.oferta-card:hover img { transform: none; }

/* ---- Productos: tarjetas ---- */
.lista-productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 18px; }
.producto-fila { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; border-radius: 16px; border: 1px solid #edf0f2; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; grid-template-areas: none; }
.producto-fila:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: #dfe5e9; }
.producto-img { width: 100% !important; height: 175px !important; object-fit: contain; background: #fff; border: 0; border-bottom: 1px solid #f0f2f4; border-radius: 0; padding: 10px; box-sizing: border-box; }
.producto-img-vacia { background: linear-gradient(135deg, #f3f5f7, #e9edf0); }
.producto-info { padding: 12px 14px 0; flex: 0 0 auto; }
.producto-nombre { font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.producto-precio-row { width: auto !important; justify-content: flex-start !important; padding: 8px 14px 0; margin: 0 !important; }
.precio-actual { font-size: 21px; font-weight: 800; color: var(--primary); }
.precio-tachado { font-size: 13px; }
.producto-footer { flex-wrap: wrap !important; padding: 10px 14px 14px; margin: auto 0 0 !important; gap: 8px; justify-content: flex-start !important; }
.producto-footer .stock-badge { flex: 1 0 100%; }
.producto-footer .qty-control { flex: 0 0 auto; }
.producto-footer .btn-agregar { flex: 1 1 auto; border-radius: 9px; padding: 9px 12px; font-weight: 700; }
.producto-fila.sin-stock { background: #fff; }

@media (max-width: 960px) {
  .lista-productos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ofertas { padding: 14px 12px 16px; border-radius: 14px; }
  .ofertas-titulo { font-size: 21px; }
  .oferta-card { flex-basis: 62%; }
  .ofertas-flechas { display: none; }
}
@media (min-width: 640px) and (max-width: 960px) { .lista-productos { grid-template-columns: repeat(3, minmax(0, 1fr)); } .oferta-card { flex-basis: 34%; } }
@media (max-width: 560px) {
  .producto-img { height: 130px !important; }
  .precio-actual { font-size: 18px; }
  .producto-nombre { font-size: 13.5px; }
  .producto-footer .btn-agregar { flex: 1 0 100%; }
}

.producto-precio-row { justify-content: flex-start; }
