:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e4e4e0;
  --accent: #1c1c1c;
  --wa: #25d366;
  --wa-dark: #1da851;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --card: #1e1e1e;
    --text: #f0f0f0;
    --muted: #a0a0a0;
    --line: #2e2e2e;
    --accent: #f0f0f0;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.top-inner, .wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca-tienda { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { line-height: 0; flex-shrink: 0; }
.logo img { display: block; width: 130px; height: auto; }
.top p { margin: 2px 0 0; font-size: .9rem; }
@media (min-width: 700px) {
  .logo img { width: 200px; }
}
@media (max-width: 420px) {
  #tienda-desc { display: none; }
}

.cart-btn {
  position: relative; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); border-radius: 999px; padding: 10px 16px; font-size: 1.1rem; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.badge {
  display: inline-block; min-width: 22px; padding: 2px 6px; margin-left: 4px;
  border-radius: 999px; background: var(--accent); color: var(--bg);
  font-size: .8rem; font-weight: 600; text-align: center;
}

.filtros { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.filtros input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1rem;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem;
}
.chip.activa { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.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: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line); display: block; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 1rem; }
.card .desc { font-size: .85rem; margin: 0; flex: 1; }
.card .precio { font-weight: 700; font-size: 1.05rem; }
.card .marca { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ver-mas {
  margin: 24px 0; padding: 12px 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: .95rem;
}
.add-btn {
  margin-top: 6px; padding: 10px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--bg); font-weight: 600; font-size: .95rem;
}
.add-btn:active { transform: scale(.98); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(400px, 100%);
  background: var(--card); z-index: 30; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.drawer.abierto { transform: translateX(0); }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--line);
}
.icon-btn { background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 16px; }
.cart-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-item .nombre { font-weight: 600; }
.cart-item .sub { font-size: .85rem; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); cursor: pointer; font-size: 1rem;
}
.drawer-foot { padding: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.drawer-foot input, .drawer-foot textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; resize: vertical;
}
.total-row { display: flex; justify-content: space-between; font-size: 1.1rem; }
.wa-btn {
  padding: 14px; border: none; border-radius: 10px; background: var(--wa); color: #fff;
  font-weight: 700; font-size: 1rem; cursor: pointer;
}
.wa-btn:hover { background: var(--wa-dark); }
.wa-btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; text-decoration: underline; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; z-index: 40; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.visible { opacity: 1; }
