:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e6e8ec;
  --accent: #4f46e5;
  --accent-d: #4338ca;
  --wpp: #25d366;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800; font-size: 1.15rem; line-height: 1.2;
  display: inline-block;              /* el lema va en su propia línea, debajo */
}
.brand .lema {
  display: block; margin-top: 1px;
  font-size: .72rem; font-weight: 500; color: var(--muted);
}
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); font-weight: 600; }
.cart-link { position: relative; font-size: 1.2rem; }
.badge {
  background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; vertical-align: top;
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* Hero */
.hero { padding: 8px 0 20px; }
.hero h1 { font-size: 1.8rem; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0 0 16px; }

/* Buscador */
.buscador { display: flex; gap: 8px; max-width: 560px; }
.buscador input {
  flex: 1; padding: 11px 16px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1rem; background: #fff; outline: none;
}
.buscador input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.buscador button {
  padding: 11px 20px; border: 0; border-radius: 10px; background: var(--accent);
  color: #fff; font-weight: 700; cursor: pointer;
}
.buscador button:hover { background: var(--accent-d); }
.resultados { color: var(--muted); margin: 0 0 14px; }
.chip-n { opacity: .6; font-size: .78rem; margin-left: 2px; }
.paginacion {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 34px 0 10px; color: var(--muted); font-weight: 600;
}
.paginacion .btn { margin-top: 0; text-decoration: none; }
.resultados a { color: var(--accent); font-weight: 600; }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.chip {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: .9rem; font-weight: 600;
}
.chip.activo { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Grid de productos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.10); }
.card-img { aspect-ratio: 1/1; background: #fafafa; display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.noimg { color: #b9bec7; font-size: .85rem; }
.noimg.grande { font-size: 1rem; padding: 40px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-weight: 700; font-size: .95rem; line-height: 1.25; }
.card-cat { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.precio { font-size: 1.15rem; font-weight: 800; color: var(--accent); margin-top: 4px; }
.precio.consultar { color: var(--muted); font-size: 1rem; font-weight: 700; }
.precio.agotado { color: #b91c1c; font-size: 1rem; font-weight: 800; }
.stock-nota { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.disp.confirmar { color: #b45309; }
.disp.sin-stock { color: #b91c1c; }
.precio.grande { font-size: 2rem; }

/* Botones */
.btn {
  margin-top: 8px; padding: 9px 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem;
  text-align: center; transition: background .12s ease;
}
.btn:hover { background: var(--accent-d); }
.btn-out { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-wpp { background: var(--wpp); }
.btn-wpp:hover { background: #1eb757; }

/* Ficha de producto */
.volver { color: var(--muted); font-weight: 600; display: inline-block; margin-bottom: 16px; }
.ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.ficha-img {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.ficha-img img { width: 100%; height: 100%; object-fit: contain; padding: 24px; }
.ficha-info h1 { margin: 6px 0 12px; font-size: 1.5rem; }
.disp { color: #15803d; font-weight: 600; margin: 6px 0 16px; }
.nota { color: var(--muted); font-size: .82rem; margin-top: 14px; }

/* Descripción del producto */
.descripcion {
  margin-top: 34px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 22px 26px; box-shadow: var(--shadow);
}
.descripcion h2 { margin: 0 0 10px; font-size: 1.1rem; }
.descripcion p { margin: 0; color: #3b4252; line-height: 1.65; }

/* Carrito */
.page-title { font-size: 1.5rem; }
.vacio { text-align: center; padding: 60px 0; color: var(--muted); }
.vacio .btn { display: inline-block; margin-top: 10px; }
.cart-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.cart-row {
  display: grid; grid-template-columns: 56px 1fr auto auto 32px; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.cart-row img { width: 56px; height: 56px; object-fit: contain; }
.cr-name { font-weight: 600; font-size: .92rem; }
.cr-price { color: var(--muted); font-size: .8rem; font-weight: 500; }
.cr-qty { display: flex; align-items: center; gap: 8px; }
.cr-qty button {
  width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.cr-sub { font-weight: 700; min-width: 72px; text-align: right; }
.cr-del { border: 0; background: none; color: #c0392b; cursor: pointer; font-size: 1rem; }
.resumen {
  margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; text-align: right; box-shadow: var(--shadow);
}
.total { font-size: 1.3rem; font-weight: 800; margin-bottom: 12px; }
.resumen .btn-wpp { font-size: 1rem; padding: 12px 20px; }

/* Avisos de envío en el carrito */
.aviso-envio { margin: 10px 0 14px; padding: 10px 14px; border-radius: 10px; font-size: .92rem; text-align: left; }
.aviso-envio.falta   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.aviso-envio.cerca   { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.aviso-envio.logrado { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.aviso-envio .mini { font-size: .82rem; opacity: .85; }
.btn-off { opacity: .5; cursor: not-allowed; }
/* Pedido bajo el mínimo: se avisa con color, pero se deja enviar igual. */
.btn-aviso { background: #f59e0b; }
.btn-aviso:hover { background: #d97706; }
.politica { list-style: none; padding: 0; margin: 10px 0; text-align: left; }
.politica li { padding: 3px 0; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: .9rem; box-shadow: var(--shadow); z-index: 50; animation: fade .3s ease;
}
@keyframes fade { from { opacity: 0; transform: translate(-50%, 8px); } }

.footer { border-top: 1px solid var(--line); color: var(--muted); text-align: center; padding: 22px; font-size: .85rem; }

@media (max-width: 640px) {
  .ficha { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
  .cart-row { grid-template-columns: 44px 1fr auto; grid-row-gap: 6px; }
  .cart-row img { width: 44px; height: 44px; }
  .cr-sub { grid-column: 2 / 4; text-align: left; }
  .cr-del { position: absolute; }
}
