:root {
  --ink: #15171b;
  --ink-2: #3a3f47;
  --muted: #6b717b;
  --line: #e3e1dc;
  --bg: #f4f2ee;
  --card: #ffffff;
  --brand: #ff5b14;
  --brand-dark: #e04608;
  --brand-soft: #fff0e8;
  --night: #14161a;
  --night-2: #1f2228;
  --ok: #0f8a4b;
  --ok-soft: #e6f5ec;
  --warn: #b26a00;
  --warn-soft: #fff4dd;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --blue: #2557d6;
  --r: 12px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 16px rgba(20, 22, 26, .06);
  --display: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --body: 'Inter', 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: 15px/1.5 var(--body); overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.lucide { width: 1.1em; height: 1.1em; stroke-width: 2; vertical-align: -.18em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── encabezado ── */
.top { background: var(--night); color: #fff; }
.top-row { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; flex: none; }
.logo svg { width: 34px; height: 34px; }
.logo b { font: 800 25px/1 var(--display); letter-spacing: -.02em; }
.logo b i { font-style: normal; color: var(--brand); }
.search { flex: 1; display: flex; background: #fff; border-radius: 10px; overflow: hidden; min-width: 0; }
.search input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; color: var(--ink); outline: none; }
.search button { border: 0; background: var(--brand); color: #fff; padding: 0 18px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.search button:hover { background: var(--brand-dark); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.top-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: #e9eaec; font-weight: 500; font-size: 14px; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.top-link:hover { background: var(--night-2); color: #fff; }
.top-link.sell { border: 1.5px solid var(--brand); color: #fff; }
.top-link.sell:hover { background: var(--brand); }
.top-sub { border-top: 1px solid #2a2e35; }
.top-sub .wrap { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 6px; }
.top-sub .wrap::-webkit-scrollbar { display: none; }
.mi-auto { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--night-2); border: 1px solid #343842; color: #fff; cursor: pointer; font-size: 13.5px; font-weight: 600; white-space: nowrap; margin-right: 8px; }
.mi-auto.set { border-color: var(--brand); }
.mi-auto small { color: #9aa0a9; font-weight: 500; }
.top-sub a.cat { color: #b9bdc4; text-decoration: none; font-size: 13.5px; padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.top-sub a.cat:hover { color: #fff; background: var(--night-2); }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); min-width: 210px; padding: 6px; z-index: 50; }
.menu-pop a, .menu-pop button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; text-decoration: none; border: 0; background: none; cursor: pointer; font-size: 14px; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

@media (max-width: 760px) {
  .top-row { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 12px; }
  .search { order: 3; flex-basis: 100%; border-radius: 12px; }
  .search input { padding: 13px 14px; }
  .search button { padding: 0 16px; }
  .top-actions { margin-left: auto; }
  .top-link .t { display: none; }
  .top-link.sell { display: none; }          /* en celular "Vender" vive en la barra de abajo */
  .logo b { font-size: 23px; }
  .logo svg { width: 30px; height: 30px; }
}

/* ── botones y formularios ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 10px; border: 1.5px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 15px; line-height: 1.2; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover:not(:disabled) { background: var(--brand-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-line { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-line:hover:not(:disabled) { border-color: var(--ink-2); }
.btn-ghost { background: none; color: var(--ink-2); padding: 8px 12px; }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { padding: 15px 24px; font-size: 16.5px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.in { width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; outline: none; min-width: 0; }
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.in { resize: vertical; min-height: 96px; }
select.in { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b717b' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.hint { font-size: 13px; color: var(--muted); }
.err { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 9px; font-size: 14px; }

/* ── tarjetas ── */
.box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr 1fr; gap: 10px; } }
.card { background: #fff; border-radius: var(--r); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20, 22, 26, .06), 0 10px 28px rgba(20, 22, 26, .1); }
.card-img { aspect-ratio: 4 / 3; background: #ebe8e2; position: relative; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .badge { position: absolute; left: 8px; top: 8px; }
.card-b { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-t { font-size: 14.5px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-fit { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font: 700 24px/1.1 var(--display); letter-spacing: -.01em; margin-top: 4px; }
.price sup { font-size: .55em; vertical-align: .55em; margin-left: 1px; }
.ship { font-size: 13px; font-weight: 600; color: var(--ok); display: flex; align-items: center; gap: 5px; }
.ship.paid { color: var(--ink-2); font-weight: 500; }
.loc { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 6px; }
@media (max-width: 520px) { .card-b { padding: 10px; } .price { font-size: 20px; } .card-t { font-size: 13.5px; } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #fff; color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.b-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.b-dark { background: var(--ink); color: #fff; border-color: transparent; }

.sec { padding: 36px 0; }
.sec-h { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sec-h h2 { font-size: 28px; }
.sec-h a { color: var(--blue); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .lucide { width: 40px; height: 40px; color: #c3c0b8; margin-bottom: 8px; }
.empty h3 { color: var(--ink); font-size: 22px; margin-bottom: 6px; }

/* ── modal y toast ── */
.modal { position: fixed; inset: 0; background: rgba(15, 17, 20, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal-c { background: #fff; border-radius: 16px; width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-h h3 { font-size: 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 200; pointer-events: none; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--bad); }

.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #ebe8e2 25%, #f3f1ec 50%, #ebe8e2 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }

/* ── pie ── */
.foot { background: var(--night); color: #9aa0a9; margin-top: 48px; padding: 36px 0 28px; font-size: 14px; }
.foot-g { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.foot h4 { color: #fff; margin: 0 0 10px; font: 700 16px var(--display); letter-spacing: .02em; text-transform: uppercase; }
.foot a { color: #c9cdd3; text-decoration: none; display: block; padding: 3px 0; }
.foot a:hover { color: #fff; }
.foot .logo { margin-bottom: 10px; }
.foot-b { border-top: 1px solid #2a2e35; margin-top: 26px; padding-top: 18px; font-size: 13px; }
@media (max-width: 700px) { .foot-g { grid-template-columns: 1fr; } }

/* ── estrellas ── */
.stars { display: inline-flex; gap: 1px; font-size: var(--t, 15px); line-height: 1; vertical-align: -1px; }
.stars i { font-style: normal; color: #d9d5cc; }
.stars i.on { color: #f5a400; }
.stars i.half { background: linear-gradient(90deg, #f5a400 50%, #d9d5cc 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rate { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate label { font-size: 36px; line-height: 1; color: #d9d5cc; cursor: pointer; padding: 2px; }
.rate input:checked ~ label, .rate label:hover, .rate label:hover ~ label { color: #f5a400; }
.rate input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 6px; }

/* ── pestañas ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2.5px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.tab.on { color: var(--ink); border-bottom-color: var(--brand); }
.tab .n { background: var(--brand); color: #fff; font-size: 11.5px; border-radius: 999px; padding: 1px 7px; }

/* ════════════ CELULAR: se comporta como app ════════════ */
html { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; }
.card:active, .btn:active:not(:disabled), .cat-t:active, .tabbar a:active { transform: scale(.97); }
.card, .btn, .cat-t { transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; }

/* barra de navegación inferior (fixed, nunca sticky: con sticky el toque cae en otro lado) */
.tabbar { display: none; }
@media (max-width: 760px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  body[data-tabbar="no"] { padding-bottom: 0; }
  body[data-tabbar="no"] .tabbar { display: none !important; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: rgba(255, 255, 255, .97); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-height: 50px;
    font-size: 11px; font-weight: 600; color: #7d838c; text-decoration: none; letter-spacing: .01em; }
  .tabbar a .lucide { width: 23px; height: 23px; stroke-width: 1.9; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on .lucide { color: var(--brand); stroke-width: 2.3; }
  .tabbar .fab { width: 50px; height: 50px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center;
    margin-top: -24px; box-shadow: 0 8px 18px rgba(255, 91, 20, .38); border: 4px solid #fff; }
  .tabbar .fab .lucide { color: #fff !important; width: 24px; height: 24px; stroke-width: 2.4; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body[data-tabbar="no"] .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* iPhone hace zoom si el texto del campo mide menos de 16px */
  .in, .search input, select.in, textarea.in { font-size: 16px; }

  /* ventanas como hoja que sube desde abajo */
  .modal { align-items: end; padding: 0; }
  .modal-c { max-width: none; border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); animation: sube .22s ease-out; }
  .modal-c::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: #d9d6cf; margin: 0 auto 12px; }
  @keyframes sube { from { transform: translateY(40px); opacity: .4; } }

  .sec { padding: 26px 0; }
  .sec-h { margin-bottom: 12px; }
  .sec-h h2 { font-size: 23px; }
  .pad, .box.pad { padding: 16px; }

  /* pie compacto */
  .foot { margin-top: 28px; padding: 26px 0 22px; }
  .foot-g { gap: 18px; }
  .foot-g > div:not(:first-child) { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .foot-g h4 { flex-basis: 100%; margin-bottom: 2px; font-size: 14px; }
  .foot a { padding: 2px 0; font-size: 13.5px; }
  .foot-b { margin-top: 18px; padding-top: 14px; font-size: 12px; }
}

/* carrusel horizontal que se desliza con el dedo (categorías, pasos…) */
.rail { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 10px; scroll-padding: 0 16px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: none; }

/* selector de dos opciones grandes (Estándar / Automática), como en Lord Colisión */
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg2 label { position: relative; cursor: pointer; }
.seg2 input { position: absolute; opacity: 0; pointer-events: none; }
.seg2 span { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 10px; border: 1.5px solid var(--line); border-radius: 11px; font-weight: 600; font-size: 15px; background: #fff; transition: border-color .15s, background .15s; }
.seg2 input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.seg2 input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }

/* ════════════ nivel marketplace: tarjetas, favoritos, carrito, sugerencias ════════════ */
.card { position: relative; }
.card-a { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; }
.fav { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15); display: grid; place-items: center; cursor: pointer; color: #5c616a; z-index: 2; transition: transform .12s, color .15s; }
.fav:hover { color: #e0245e; }
.fav:active { transform: scale(.88); }
.fav .lucide { width: 19px; height: 19px; }
.fav.on { color: #e0245e; }
.fav.on .lucide { fill: currentColor; }
.antes { font-size: 12.5px; color: var(--muted); text-decoration: line-through; margin-top: 4px; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-row .price { margin-top: 0; }
.card-b .antes + .price-row .price { margin-top: 0; }
.card-b > .price-row:first-of-type { margin-top: 4px; }
.off { color: var(--ok); font-weight: 700; font-size: 13.5px; }
.verif { display: inline-flex; align-items: center; gap: 3px; color: var(--blue); font-size: 13px; font-weight: 600; white-space: nowrap; }
.verif .lucide { width: 16px; height: 16px; }

.search-w { position: relative; flex: 1; min-width: 0; display: flex; }
.search-w .search { flex: 1; }
.sug { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .22); padding: 6px; z-index: 60; max-height: 70vh; overflow-y: auto; }
.sug a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-size: 14.5px; }
.sug a .lucide { color: var(--muted); }
.sug a em { font-style: normal; color: var(--muted); font-size: 13px; }
.sug a:hover, .sug a.on { background: var(--bg); }

.top-link.ico-only { padding: 9px 10px; position: relative; }
.top-link.ico-only .lucide { width: 21px; height: 21px; }
.dot-n { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff;
  font: 700 11px/18px var(--body); text-align: center; border: 2px solid var(--night); box-sizing: content-box; }
.ico-n { position: relative; display: inline-flex; }
.tabbar .dot-n { top: -6px; right: -10px; border-color: #fff; }
.menu-h { padding: 10px 12px 8px; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-h small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.menu-s { display: block; padding: 8px 12px 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.menu-pop { min-width: 240px; max-height: 80vh; overflow-y: auto; }
.top-sub a.cat.hot { color: #ffb38f; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 13px; color: #c9cdd3; }
.trust span { display: inline-flex; gap: 6px; align-items: center; }
.trust .lucide { color: var(--brand); }

/* carrusel de tarjetas (similares, ofertas, vistos…) */
.cards-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 220px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; padding-bottom: 8px; }
.cards-rail > * { scroll-snap-align: start; }
@media (max-width: 760px) {
  .search-w { order: 3; flex-basis: 100%; }
  .top-link.ico-only { display: none; }          /* en celular el carrito está en la barra de abajo */
  .cards-rail { grid-auto-columns: 46%; gap: 10px; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; scrollbar-width: none; }
  .cards-rail::-webkit-scrollbar { display: none; }
  .fav { width: 32px; height: 32px; top: 6px; right: 6px; }
}
#top-cats { display: flex; gap: 4px; align-items: center; flex: none; }
