:root {
  --ink: #0f1720;
  --ink-2: #3b4552;
  --muted: #6b7684;
  --line: #e4e7eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --accent: #16a34a;
  --accent-ink: #ffffff;
  --accent-soft: #e8f6ee;
  --hot: #e11d48;
  --top: #0f1720;
  --top-ink: #f5f7fa;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 32, .06), 0 4px 16px rgba(15, 23, 32, .06);
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef1f4; --ink-2: #c3cad3; --muted: #8d97a3; --line: #27303a; --bg: #0d1117;
    --card: #161b22; --accent-soft: #11301f; --top: #0a0d12; --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #eef1f4; --ink-2: #c3cad3; --muted: #8d97a3; --line: #27303a; --bg: #0d1117;
  --card: #161b22; --accent-soft: #11301f; --top: #0a0d12; --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--top); color: var(--top-ink); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand-mark { font-size: 22px; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: .5px; text-transform: uppercase; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 0 14px; min-width: 0; }
.search svg { width: 18px; height: 18px; fill: currentColor; opacity: .7; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; outline: none; color: var(--top-ink); }
.search input::placeholder { color: rgba(245,247,250,.6); }
.search:focus-within { background: rgba(255,255,255,.18); box-shadow: 0 0 0 2px var(--accent); }
.cart-btn { position: relative; display: flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 600; flex-shrink: 0; }
.cart-btn svg { width: 18px; height: 18px; fill: currentColor; }
.cart-btn .badge { background: #fff; color: var(--accent); border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.cart-btn.bump { animation: bump .4s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }

.hero { background: linear-gradient(135deg, #0f1720 0%, #14532d 100%); color: #fff; }
.hero-inner { max-width: 1280px; margin: 0 auto; padding: 22px 16px 24px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 5vw, 44px); line-height: 1; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }

.shared-banner { max-width: 1280px; margin: 16px auto 0; padding: 0 16px; }
.shared-card { background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.shared-card h2 { font-family: var(--display); font-size: 28px; margin: 0 0 4px; text-transform: uppercase; }
.shared-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.shared-items { display: grid; gap: 10px; margin-top: 12px; }

/* Filtros */
.filters { position: sticky; top: 58px; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.chips-row { max-width: 1280px; margin: 0 auto; padding: 10px 16px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row.teams { padding-top: 8px; }
.chips-row.teams:empty { display: none; }
.chip { flex-shrink: 0; scroll-snap-align: start; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip:hover { border-color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .55; font-weight: 500; margin-left: 4px; font-size: 12px; }
.chips-row.teams .chip { padding: 5px 12px; font-size: 13px; }
.chips-row.teams .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips-row.small .chip { padding: 5px 11px; font-size: 13px; font-weight: 500; }
.chips-row.small .chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.filter-bar { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; }
.filter-bar .chips-row { flex: 1; min-width: 0; margin: 0; }
.selects { display: flex; gap: 8px; padding: 10px 16px 0 0; flex-shrink: 0; }
select { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 10px; font-size: 13px; }

/* Resultados */
.content { max-width: 1280px; margin: 0 auto; padding: 14px 16px 40px; }
.results-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card { position: relative; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; border: 0; padding: 0; text-align: left; transition: transform .15s ease; }
.card:hover { transform: translateY(-2px); }
.card .thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .team { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .4px; }
.card .name { font-size: 13px; font-weight: 500; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { font-weight: 700; font-size: 14px; margin-top: auto; }
.card .added { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 3px 8px; }
.card .tagline { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-2); background: var(--bg); border-radius: 4px; padding: 2px 6px; }
.sentinel { height: 40px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; }
.link-btn.danger { color: var(--hot); }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 40px; }

/* Botones */
.btn { text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: transparent; border: 0; width: 38px; height: 38px; border-radius: 999px; font-size: 18px; display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--bg); }

/* Diálogos */
.dlg { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); max-width: min(960px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(10, 13, 18, .6); }
.dlg-close-form { position: absolute; top: 8px; right: 8px; z-index: 2; margin: 0; }
.dlg .close { background: var(--card); box-shadow: var(--shadow); }
.small-dlg { max-width: 460px; padding: 22px 20px 20px; }
.small-dlg h3 { font-family: var(--display); font-size: 26px; text-transform: uppercase; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
@media (max-width: 640px) {
  .dlg { max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .small-dlg { height: auto; max-height: 90dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
}

.pd { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; }
@media (min-width: 761px) {
  .product-dlg { overflow: hidden; }
  .pd { height: min(720px, calc(100dvh - 24px)); }
  .pd-gallery, .pd-info { overflow-y: auto; }
}
@media (max-width: 760px) { .pd { grid-template-columns: 1fr; } }
.pd-gallery { background: #fff; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pd-main { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 12px; }
.pd-main img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.pd-thumbs button { flex-shrink: 0; width: 62px; height: 62px; border: 2px solid transparent; border-radius: 10px; padding: 0; background: #fff; overflow: hidden; }
.pd-thumbs button.on { border-color: var(--accent); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.pd-info .team { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.pd-info h2 { font-family: var(--display); font-size: 28px; line-height: 1.05; margin: 2px 40px 0 0; text-transform: uppercase; }
.pd-price { font-size: 20px; font-weight: 700; }
.opt-group h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); display: flex; justify-content: space-between; }
.opt-group h4 .sel { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.opt-vals { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 500; text-align: left; }
.opt:hover { border-color: var(--ink-2); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.opt .add { color: var(--muted); font-size: 11px; margin-left: 4px; }
.opt-vals.size .opt { min-width: 52px; text-align: center; font-weight: 600; }
.opt-vals.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.opt.pic { padding: 6px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.opt.pic img { aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 6px; width: 100%; }
.opt.pic span { font-size: 11px; line-height: 1.25; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .drawer-who input { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; font-weight: 400; color: var(--ink); outline: none; width: 100%; }
.field input:focus, .field textarea:focus, .drawer-who input:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { border: 0; background: transparent; width: 36px; height: 36px; font-size: 18px; }
.qty span { min-width: 30px; text-align: center; font-weight: 700; }
.pd-actions { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0; background: var(--card); padding-top: 8px; }
.pd-actions .btn.primary { flex: 1; padding: 13px; }
.warn { color: var(--hot); font-size: 13px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10,13,18,.5); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--card); z-index: 41; display: flex; flex-direction: column; transform: translateX(105%); transition: transform .25s ease; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.drawer-head h2 { font-family: var(--display); font-size: 28px; margin: 0; text-transform: uppercase; }
.drawer-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
.drawer-who label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.drawer-list { flex: 1; overflow-y: auto; padding: 8px 16px; }
.drawer-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.line img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; }
.line .t { font-size: 13px; font-weight: 600; line-height: 1.3; }
.line .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.line .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line .qty button { width: 28px; height: 28px; font-size: 15px; }
.line .qty span { min-width: 22px; font-size: 13px; }
.line .mini { display: flex; gap: 8px; }
.line .mini button { background: none; border: 0; font-size: 12px; color: var(--muted); padding: 0; text-decoration: underline; }
.drawer-total { padding: 10px 16px 0; font-weight: 700; display: flex; justify-content: space-between; }
.drawer-total:empty { display: none; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 6px; }
.drawer > .link-btn { margin: 0 16px 14px; align-self: flex-start; font-size: 13px; }

/* Compartir */
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.share-grid .btn { justify-content: flex-start; font-size: 14px; padding: 10px 12px; }
.share-grid .btn .ico { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.share-grid .btn.wide { grid-column: 1 / -1; justify-content: center; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 12px; background: var(--bg); color: var(--ink-2); }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.saved-item div { flex: 1; min-width: 0; }
.saved-item b { display: block; font-size: 14px; }
.saved-item small { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; transition: transform .25s ease; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .topbar-inner { gap: 8px; padding: 8px 12px; }
  .brand-name, .cart-label { display: none; }
  .cart-btn { padding: 8px 12px; }
  .filters { position: static; }
  .hero-inner { padding: 16px 16px 18px; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 0; }
  .selects { padding: 8px 16px 0; }
  .selects select { flex: 1; }
}

/* Productos retirados u opciones que cambiaron en la tienda */
.line .d.alert { color: var(--hot); font-weight: 600; }
.line.gone img { opacity: .45; filter: grayscale(1); }
.line.gone .t { text-decoration: line-through; color: var(--muted); }

/* Totales del catálogo */
.drawer-total { flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 500; }
.tot-row { display: flex; justify-content: space-between; font-size: 14px; }
.tot-row.sub { color: var(--muted); }
.tot-row.promo { color: var(--accent); font-weight: 600; }
.tot-row.grand { font-size: 19px; font-weight: 800; }
.tot-hint { font-size: 12.5px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 10px; font-weight: 600; }
.btn.whatsapp { background: #25D366; border-color: #25D366; color: #fff; font-size: 16px; padding: 13px; }
.btn.whatsapp svg { width: 20px; height: 20px; fill: currentColor; }
.drawer-actions .wide { grid-column: 1 / -1; }
.pd-price small { font-size: 13px; font-weight: 500; }
