:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #5f5f5f;
  --line: #dcdcdc;
  --accent: #d91e1e;
  --hazard: #d91e1e;
  --danger: #b3121b;
  --ok: #12703a;
  --display: "Archivo Black", "Arial Black", Impact, system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.45;
  padding-bottom: 96px;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.stripe { display: grid; grid-template-columns: 1fr 1fr 1fr; height: 6px; }
.stripe i:nth-child(1) { background: #ff3131; } .stripe i:nth-child(2) { background: #545454; } .stripe i:nth-child(3) { background: #111; }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 20px; background: #fff; color: var(--ink);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
}
.brand { display: block; line-height: 0; }
.brand img { height: 26px; width: auto; display: block; }
.tag { margin-right: auto; font-family: var(--display); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: 5px 9px; }
.who { display: flex; gap: 14px; align-items: center; font-size: 14px; color: var(--muted); }
.link { background: none; border: 0; color: var(--ink); text-decoration: underline; padding: 6px 2px; }

main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 0; }

/* pantallas de entrada */
.gate {
  max-width: 560px; margin: 8vh auto 0; background: var(--surface);
  padding: 36px 32px; border-left: 8px solid var(--hazard);
}
.gate h1 {
  font-family: var(--display); font-size: clamp(38px, 8vw, 54px); line-height: 1;
  margin: 0 0 14px; font-weight: 400;
}
.gate p { margin: 0 0 22px; color: var(--muted); max-width: 44ch; }
.gate form { display: grid; gap: 14px; }
label.f { display: grid; gap: 4px; font-weight: 500; font-size: 15px; }
input[type=text], input[type=tel], input[type=search], textarea {
  width: 100%; padding: 12px 12px; border: 2px solid var(--line); background: #fff; border-radius: 3px;
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
.btn {
  border: 0; padding: 13px 22px; font-weight: 600; border-radius: 3px; font-size: 16px;
  background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-dark { background: var(--ink); }
.btn-wa { background: #17a34a; display: inline-block; text-decoration: none; text-align: center; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.err { color: var(--danger); font-weight: 500; min-height: 1.4em; margin: 0; }

/* herramientas del catalogo */
.tools { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tools input { flex: 1 1 260px; }
.count { color: var(--muted); font-size: 14px; }

/* planilla de pedido */
.sheet { background: var(--surface); border-top: 4px solid var(--ink); }
.row {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.row.on { background: #fff1f0; }
.thumb {
  width: 76px; height: 76px; object-fit: contain; background: #f2f4f6;
  border: 0; padding: 0; display: block;
}
.info { min-width: 0; }
.title {
  font-weight: 600; margin: 0 0 2px; cursor: pointer; background: none; border: 0; padding: 0;
  text-align: left; display: block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.title:hover { color: var(--accent); }
.meta { font-size: 13px; color: var(--muted); }
.meta b { color: var(--ink); font-weight: 600; }
.buy { display: grid; justify-items: end; gap: 6px; }
.price { font-family: var(--display); font-size: 22px; font-weight: 400; line-height: 1; }
.price small { font-size: 14px; font-weight: 500; color: var(--muted); font-family: var(--body); }
.pp { display: grid; gap: 2px; justify-items: end; }
.price, .sub { white-space: nowrap; }
.sub { font-size: 13px; color: var(--ok); font-weight: 600; min-height: 1.2em; }

.stepper { display: inline-flex; width: max-content; justify-self: start; border: 2px solid var(--ink); background: #fff; }
.stepper button {
  width: 40px; height: 40px; border: 0; background: var(--ink); color: #fff; font-size: 22px; line-height: 1;
}
.stepper button:disabled { background: #9aa3ad; cursor: not-allowed; }
.stepper input {
  width: 56px; text-align: center; border: 0; font-weight: 600; font-size: 17px; padding: 0;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--surface); }

/* barra inferior */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--ink); color: #fff; padding: 12px 20px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; border-top: 4px solid var(--accent);
}
.bar-info { display: grid; }
.bar-count { font-size: 14px; font-weight: 500; }
.bar-total { font-family: var(--display); font-size: 26px; font-weight: 400; line-height: 1; }

/* dialogos */
dialog {
  border: 0; padding: 0; width: min(760px, 100vw); max-height: 92vh; background: var(--surface); color: var(--ink);
  border-top: 6px solid var(--ink);
}
dialog::backdrop { background: rgba(15, 27, 45, .6); }
.dlg { padding: 20px; display: grid; gap: 16px; }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.dlg h2 { font-family: var(--display); font-size: 30px; line-height: 1.05; margin: 0; font-weight: 400; }
.x { background: none; border: 2px solid var(--ink); width: 40px; height: 40px; font-size: 20px; flex: none; }
.gallery { display: grid; gap: 8px; }
.gallery .main { width: 100%; max-height: 360px; object-fit: contain; background: #f2f4f6; }
.gallery .strip { display: flex; gap: 6px; overflow-x: auto; }
.gallery .strip button { border: 2px solid transparent; padding: 0; background: #f2f4f6; flex: none; }
.gallery .strip button[aria-current=true] { border-color: var(--accent); }
.gallery .strip img { width: 62px; height: 62px; object-fit: contain; display: block; }
.attrs { border-collapse: collapse; width: 100%; font-size: 14px; }
.attrs td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.attrs td:first-child { color: var(--muted); width: 42%; }
.desc { white-space: pre-line; font-size: 15px; max-width: 70ch; }
.desc.short { max-height: 7.5em; overflow: hidden; }

.line { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line .t { font-weight: 600; }
.line .m { color: var(--muted); font-size: 13px; }
.line .r { text-align: right; font-family: var(--display); font-size: 22px; font-weight: 400; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: 34px; font-weight: 400; }

/* pago */
.pay { display: grid; gap: 14px; }
.pay .big { font-family: var(--display); font-size: 56px; font-weight: 400; line-height: 1; }
.copy { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; background: #f2f4f6; }
.copy small { display: block; color: var(--muted); }
.copy code { font-size: 18px; font-weight: 600; word-break: break-all; }
.copy button { border: 2px solid var(--ink); background: #fff; padding: 8px 12px; font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 3px; max-width: 90vw;
}

@media (max-width: 560px) {
  .row { grid-template-columns: 64px 1fr; }
  .thumb { width: 64px; height: 64px; }
  .buy { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: center; justify-items: stretch; }
  .pp { justify-items: start; }
  .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .brand img { height: 20px; }
  .tag { font-size: 10px; padding: 4px 7px; }
  .who { font-size: 13px; gap: 8px; }
  .gate { padding: 26px 20px; margin-top: 3vh; }
  .pay .big { font-size: 46px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.buy .stepper { justify-self: end; }

.btn-consultar { padding: 10px 18px; justify-self: end; }

.row.off .thumb, .row.off .title { opacity: .6; }
.badge-sin_stock, .badge-proximamente {
  justify-self: end; display: inline-block; padding: 8px 14px; font-weight: 600; font-size: 14px;
  border: 2px solid var(--muted); color: var(--muted); letter-spacing: .3px; text-transform: uppercase;
}
.badge-proximamente { border-color: var(--ink); color: var(--ink); }
