:root {
  --navy: #0f4c9c;
  --navy-700: #0d3f82;
  --navy-900: #0a2a57;
  --teal: #1fb2c8;
  --teal-50: #e8f8fb;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f5f7fb;
  --card: #ffffff;
  --green: #15803d;
  --green-50: #ecfdf3;
  --amber: #b45309;
  --amber-50: #fff7e6;
  --red: #b91c1c;
  --red-50: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-wa { background: #16a34a; color: #fff; }
.btn-wa:hover { background: #15803d; }
.btn-wa:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-light { background: #fff; color: var(--navy-900); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-outline-light:hover { background: rgba(255,255,255,.08); }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; color: var(--muted); }
.icon-btn:hover { color: var(--ink); border-color: #cbd5e1; }
.badge { background: var(--teal); color: #fff; font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: inline-grid; place-items: center; padding: 0 6px; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); background: var(--teal-50); border: 1px solid #c6eef5; padding: 4px 8px; border-radius: 6px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.vigencia { font-size: 13px; color: var(--muted); margin-right: 6px; }

/* ---------- Hero ---------- */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(31,178,200,.35), transparent 60%), linear-gradient(135deg, var(--navy-900), var(--navy)); color: #fff; }
.hero-in { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; padding: 56px 24px 64px; }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9fe6f1; }
.hero h1 { margin: 0 0 14px; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -.02em; color: #fff; font-weight: 800; text-wrap: balance; }
.lead { margin: 0 0 24px; font-size: 17px; color: #d6e4f7; max-width: 560px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-cta .ok { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #c9f3d9; background: rgba(22,163,74,.18); border: 1px solid rgba(134,239,172,.35); padding: 8px 12px; border-radius: 10px; }
.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpis li { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 18px; }
.kpis b { display: block; font-size: 26px; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.kpis span { font-size: 13px; color: #c3d6ef; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-top: -26px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); position: relative; z-index: 2; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 10px; background: var(--bg); border: 1px solid transparent; }
.search:focus-within { border-color: var(--teal); background: #fff; }
.search svg { color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.toolbar select { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 34px 0 12px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; appearance: none; cursor: pointer; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { width: 42px; height: 40px; border: 0; background: #fff; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.seg button.on { background: var(--navy); color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.chip { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); }
.chip:hover { border-color: #cbd5e1; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip small { opacity: .6; margin-left: 4px; }

/* ---------- Catalog ---------- */
.catalog { padding-bottom: 24px; }
.cat-section { margin-top: 28px; }
.cat-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; }
.cat-head h2 { margin: 0; font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.cat-head span { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, border-color .2s; }
.card:hover { box-shadow: var(--shadow); border-color: #d5dde8; }
.card.in-cart { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.media { position: relative; aspect-ratio: 4 / 3; background: #fff; border-bottom: 1px solid var(--line-2); display: grid; place-items: center; padding: 14px; }
.media img { max-height: 100%; width: auto; object-fit: contain; }
.tags { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: 6px; background: var(--teal-50); color: #0b7285; border: 1px solid #c6eef5; }
.tag.zigbee { background: #f3efff; color: #6d28d9; border-color: #e4dafe; }
.tag.rf { background: #fff4ec; color: #c2410c; border-color: #fde0c8; }
.stock { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.stock.ok { background: var(--green-50); color: var(--green); }
.stock.low { background: var(--amber-50); color: var(--amber); }
.stock.ask { background: #f1f5f9; color: var(--muted); }
.stock.out { background: var(--red-50); color: var(--red); }

.body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.name { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.name a { color: inherit; text-decoration: none; }
.name a:hover { color: var(--navy); }
.desc { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pricebox { margin-top: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbfcfe; }
.p-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.p-main small { font-size: 11.5px; color: var(--muted); font-weight: 500; display: block; }
.p-main strong { font-size: 22px; color: var(--navy); font-weight: 800; letter-spacing: -.01em; }
.p-min { font-size: 12px; font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; white-space: nowrap; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.tier { background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; text-align: center; }
.tier small { display: block; font-size: 11px; color: var(--muted); }
.tier b { font-size: 13px; color: var(--ink); }
.tier.active { border-color: var(--teal); background: var(--teal-50); }
.pvp { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.pvp b { color: var(--text); }
.margin { font-weight: 700; color: var(--green); background: var(--green-50); padding: 2px 7px; border-radius: 6px; }

.locked { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.locked .ph { font-size: 22px; font-weight: 800; color: #cbd5e1; letter-spacing: .1em; filter: blur(.5px); }
.link-btn { border: 0; background: none; color: var(--navy); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.link-btn svg { width: 15px; height: 15px; }

.buy { display: flex; gap: 8px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 40px; background: #fff; }
.stepper button { width: 34px; height: 100%; border: 0; background: #fff; cursor: pointer; font-size: 18px; color: var(--text); }
.stepper button:hover:not(:disabled) { background: var(--bg); }
.stepper button:disabled { color: #cbd5e1; cursor: not-allowed; }
.stepper input { width: 52px; height: 100%; border: 0; text-align: center; font-weight: 700; outline: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.buy .btn { flex: 1; }

/* List view */
.list .grid { grid-template-columns: 1fr; gap: 10px; }
.list .card { flex-direction: row; align-items: stretch; }
.list .media { aspect-ratio: auto; width: 140px; border-bottom: 0; border-right: 1px solid var(--line-2); padding: 10px; }
.list .tags { display: none; }
.list .body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto; align-items: center; gap: 18px; }
.list .pricebox { margin: 0; }
.list .buy { flex-direction: column; min-width: 150px; }
.list .stepper { justify-content: space-between; }
.list .stepper input { flex: 1; }

/* ---------- Conditions ---------- */
.conditions { margin: 48px 0 56px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.conditions h2 { margin: 0 0 20px; color: var(--ink); font-size: 22px; letter-spacing: -.01em; }
.cond-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cond { border: 1px solid var(--line-2); background: var(--bg); border-radius: 12px; padding: 14px 16px; }
.cond b { display: block; color: var(--navy); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.cond p { margin: 0; font-size: 14px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.steps li { counter-increment: s; position: relative; padding: 14px 14px 14px 52px; border-radius: 12px; border: 1px dashed #cbd5e1; font-size: 14px; }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.steps b { color: var(--ink); }

.footer { background: var(--navy-900); color: #b8c8e2; }
.footer-in { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 24px; flex-wrap: wrap; }
.footer img { filter: brightness(0) invert(1); opacity: .9; }
.footer p { margin: 0; font-size: 14px; }
.footer a { color: #fff; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(480px, 100%); background: #fff; z-index: 61; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; color: var(--ink); font-size: 18px; }
.drawer-body { flex: 1; overflow: auto; padding: 8px 20px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; background: #fbfcfe; }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.line img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.line h4 { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.3; }
.line .meta { font-size: 12px; color: var(--muted); }
.line .ctrl { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.line .stepper { height: 32px; }
.line .stepper button { width: 28px; }
.line .stepper input { width: 44px; }
.line .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.line .amt { text-align: right; font-weight: 700; color: var(--ink); white-space: nowrap; }
.line .amt small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.hint { font-size: 12px; color: var(--teal); font-weight: 600; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.form h5 { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; color: var(--ink); text-transform: uppercase; letter-spacing: .05em; }
.form input, .form textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: 0; background: #fff; }
.form input:focus, .form textarea:focus { border-color: var(--teal); }
.form .full { grid-column: 1 / -1; }
.totals { display: grid; gap: 4px; font-size: 14px; margin-bottom: 12px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 18px; font-weight: 800; color: var(--ink); padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 4px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.progress i { display: block; height: 100%; background: var(--teal); }
.warn { font-size: 12.5px; color: var(--amber); background: var(--amber-50); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.foot-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.drawer-empty { text-align: center; padding: 60px 10px; color: var(--muted); }

/* ---------- Modal ---------- */
[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 16px; }
.modal-card { position: relative; background: #fff; border-radius: 18px; padding: 28px; width: min(400px, 100%); text-align: center; box-shadow: var(--shadow-lg); display: grid; gap: 10px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.lock-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--teal-50); color: var(--navy); display: grid; place-items: center; margin: 0 auto 4px; }
.lock-ico svg { width: 24px; height: 24px; }
.modal-card h3 { margin: 0; color: var(--ink); font-size: 20px; }
.modal-card p { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.modal-card input { height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; text-align: center; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; outline: 0; }
.modal-card input:focus { border-color: var(--teal); }
.err { color: var(--red) !important; font-size: 13px !important; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 90; transition: transform .25s; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); }

.mobilebar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-in { grid-template-columns: 1fr; gap: 28px; padding: 40px 24px 56px; }
  .list .body { grid-template-columns: 1fr; }
  .list .buy { flex-direction: row; }
  .steps { grid-template-columns: 1fr 1fr; }
  .vigencia { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .topbar-in { height: 60px; }
  .brand img { height: 26px; }
  .brand-tag { display: none; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: 0 12px; }
  .hero-in { padding: 32px 16px 52px; }
  .kpis b { font-size: 21px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .toolbar select { flex: 1; min-width: 0; }
  .seg { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
  .list .card { flex-direction: column; }
  .list .media { width: 100%; aspect-ratio: 4/3; border-right: 0; }
  .conditions { padding: 22px 18px; }
  .steps { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .mobilebar:not([hidden]) { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px; align-items: center; justify-content: space-between; box-shadow: var(--shadow-lg); }
  .mobilebar small { display: block; font-size: 11px; color: #94a3b8; }
  .mobilebar b { font-size: 17px; }
  .footer { padding-bottom: 80px; }
}
