/* Inter alojada en la propia web (sin conexiones a Google). Fuente variable: 100–900. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2-variations'), url(/fonts/inter-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations'), url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Paleta Salvia con el naranja y el verde casi negro del logo. */
:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #26322a;
  --muted: #66756a;
  --line: #dbe3d7;
  --sage: #7d9a83;
  --sage-soft: #e4ebe1;
  --accent: #f47b08;
  --accent-dark: #df6c00;
  --on-accent: #13190f;
  --accent-text: #b35400;
  --accent-soft: #fdebd6;
  --hero-bg: #e4ebe1;
  --hero-text: #2f3e33;
  --hero-muted: #5b6b5f;
  --hero-line: #c9d5c5;
  --ok: #3f7a52;
  --warn: #b45309;
  --chart-line: #df6c00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(47, 62, 51, 0.05), 0 4px 16px rgba(47, 62, 51, 0.06);
  --max: 1240px;
  color-scheme: light;
}

/* Modo oscuro: el elegido con el botón (data-theme="dark") o, si no se ha elegido,
   el del sistema. Los dos bloques llevan los mismos valores. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #141a16;
  --surface: #1c241f;
  --surface-2: #222c25;
  --text: #e6ece4;
  --muted: #9aa99e;
  --line: #2b362e;
  --sage: #8fae95;
  --sage-soft: #26332a;
  --accent: #f47b08;
  --accent-dark: #ff8d24;
  --on-accent: #13190f;
  --accent-text: #ff9a3d;
  --accent-soft: #3b2814;
  --hero-bg: #1f2a22;
  --hero-text: #e6ece4;
  --hero-muted: #a6b4a9;
  --hero-line: #34433a;
  --ok: #7fbf8e;
  --warn: #f59e0b;
  --chart-line: #e27000;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #141a16;
    --surface: #1c241f;
    --surface-2: #222c25;
    --text: #e6ece4;
    --muted: #9aa99e;
    --line: #2b362e;
    --sage: #8fae95;
    --sage-soft: #26332a;
    --accent: #f47b08;
    --accent-dark: #ff8d24;
    --on-accent: #13190f;
    --accent-text: #ff9a3d;
    --accent-soft: #3b2814;
    --hero-bg: #1f2a22;
    --hero-text: #e6ece4;
    --hero-muted: #a6b4a9;
    --hero-line: #34433a;
    --ok: #7fbf8e;
    --warn: #f59e0b;
    --chart-line: #e27000;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-text); }
h1, h2, h3 { letter-spacing: -0.02em; }

/* Iconos (SVG de Tabler usados como máscara: toman el color del texto). */
.i {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.i.accent { color: var(--accent); }

/* ---------- Cabecera y menú ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo { display: inline-flex; align-items: center; flex: none; }
.logo img { display: block; height: 56px; width: auto; transition: transform 0.2s; }
.logo:hover img { transform: rotate(-3deg) scale(1.04); }
.header-right { display: flex; align-items: center; gap: 10px; }
.site-nav { display: flex; gap: 4px; }

/* Botón de modo claro/oscuro: luna en modo claro, sol en modo oscuro. */
.theme-toggle {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-text); transform: rotate(-15deg); }
.theme-toggle .i { width: 20px; height: 20px; grid-area: 1 / 1; }
.theme-sun { display: none; }
:root[data-theme='dark'] .theme-moon { display: none; }
:root[data-theme='dark'] .theme-sun { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-moon { display: none; }
  :root:not([data-theme='light']) .theme-sun { display: inline-block; }
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current='page'] { color: var(--hero-text); background: var(--sage-soft); }

/* ---------- Portada: buscador ---------- */
/* Abajo, dos sierras de montañas y un sol naranja (como en el logo) que se funden con la página. */
.hero {
  --ridge-far: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120V70L120 40L210 62L330 18L450 58L560 34L690 70L800 26L930 60L1040 36L1170 66L1290 28L1440 56V120Z'/%3E%3C/svg%3E");
  --ridge-near: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120V96L140 72L260 92L400 58L520 88L650 70L780 98L920 64L1060 90L1200 72L1320 94L1440 80V120Z'/%3E%3C/svg%3E");
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% calc(100% - 52px), color-mix(in srgb, var(--accent) 75%, var(--hero-bg)) 0 46px, transparent 47px),
    var(--hero-bg);
  color: var(--hero-text);
  padding: 44px 16px 120px;
}
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  pointer-events: none;
  -webkit-mask: var(--ridge-far) bottom / 100% 100% no-repeat;
  mask: var(--ridge-far) bottom / 100% 100% no-repeat;
  background: var(--hero-line);
}
.hero::after {
  height: 80px;
  -webkit-mask-image: var(--ridge-near);
  mask-image: var(--ridge-near);
  background: var(--bg);
}
.hero.compact { padding: 16px 16px 18px; background: var(--hero-bg); border-bottom: 1px solid var(--hero-line); }
.hero.compact::before,
.hero.compact::after,
.hero.compact .hero-title,
.hero.compact .hero-sub,
.hero.compact .suggestions { display: none; }
.hero.compact .search { margin-top: 0; }

.hero-inner { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; text-align: center; }
.hero-title {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  font-weight: 800;
}
.hero-sub { margin: 0; color: var(--hero-muted); font-size: 17px; }

.search {
  margin-top: 28px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--hero-line);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 8px 24px rgba(47, 62, 51, 0.12);
}
.search:focus-within { border-color: var(--sage); }
.search-icon { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 17px;
  padding: 12px;
  background: transparent;
  color: var(--text);
}
.search button, .btn-primary {
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.search button:hover, .btn-primary:hover { background: var(--accent-dark); }
.search button:disabled, .btn-primary:disabled { opacity: 0.7; cursor: progress; }

.suggestions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; font-size: 14px; }
.suggestions span { color: var(--hero-muted); }
.suggestions button {
  border: 1px solid var(--hero-line);
  background: var(--surface);
  color: var(--hero-text);
  font: inherit;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.suggestions button:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---------- Estructura de página ---------- */
.page { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 28px 16px 48px; }
.page-narrow { max-width: 860px; }

.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 22px; display: inline-flex; align-items: center; gap: 8px; }
.section-note { color: var(--muted); font-size: 13px; }
.more { font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.more:hover { text-decoration: underline; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

.page-title { font-size: clamp(26px, 4vw, 34px); margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- Categorías ---------- */
.categories { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.15s, transform 0.15s;
}
.cat .i {
  width: 48px;
  height: 48px;
  padding: 11px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--hero-text);
  -webkit-mask: none;
  mask: none;
  position: relative;
}
.cat .i::after {
  content: '';
  position: absolute;
  inset: 12px;
  background: var(--hero-text);
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.cat:hover { border-color: var(--sage); transform: translateY(-2px); }
.cat:hover .i { background: var(--accent-soft); }
.cat:hover .i::after { background: var(--accent-text); }

/* ---------- Búsqueda: estado, filtros y resultados ---------- */
.status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.status-summary { font-weight: 700; font-size: 18px; margin-right: 8px; width: 100%; }
.status-summary small { font-weight: 500; color: var(--muted); font-size: 14px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.error .dot { background: var(--warn); }

.search-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }

.filters {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.filter { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 12px 0 0; min-width: 0; }
.filter legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.filter legend + * { clear: both; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; padding: 3px 0; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.check-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check .n { color: var(--muted); font-size: 12px; }
.check-list .link-btn { margin-top: 6px; }
.price-range { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.price-range input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button, .chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button[aria-pressed='true'] { background: var(--hero-text); color: var(--bg); border-color: var(--hero-text); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.filters-done { display: none; width: 100%; margin-top: 16px; }

.results-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.result-count { color: var(--muted); font-size: 14px; margin-right: auto; }
.filters-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.badge-count { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: 11px; padding: 1px 7px; }
select {
  font: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.active-filters:empty { display: none; }
.active-filters .chip { background: var(--sage-soft); border-color: transparent; display: inline-flex; gap: 6px; }
.active-filters .chip span { color: var(--muted); font-size: 15px; line-height: 1; }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
/* 12 descuentos: filas completas de 6, 4 o 2. */
#deals { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { #deals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Tarjeta de producto (todas con la misma estructura y altura) ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--sage); box-shadow: 0 8px 24px rgba(47, 62, 51, 0.1); }
.card-img { position: relative; flex: none; aspect-ratio: 1; background: #fff; display: grid; place-items: center; }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.card-noimg { width: 40%; height: 40%; color: var(--line); }
.badge-discount {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.badge-discount:empty { display: none; }
.badge-best {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.card.best { border-color: var(--ok); }
.card.best .badge-best { display: block; }

.card-body { padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; border-top: 1px solid var(--line); }
.card-meta { display: flex; justify-content: space-between; gap: 8px; min-height: 16px; }
.card-brand { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-gender { font-size: 11px; font-weight: 600; color: var(--hero-text); background: var(--sage-soft); padding: 1px 7px; border-radius: 999px; flex: none; }
.card-gender:empty { display: none; }
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-variant { margin: 0; font-size: 12px; color: var(--muted); min-height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-prices { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.old-price { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; margin-top: 6px; border-top: 1px dashed var(--line); }
.card-store { font-size: 12px; font-weight: 700; color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-stock { font-size: 12px; color: var(--warn); flex: none; }
.card.out .card-img img { opacity: 0.5; }

/* Tarjeta de modelo (agrupa varias ofertas): es un botón que abre la comparativa. */
.card.group { font: inherit; text-align: left; padding: 0; width: 100%; cursor: pointer; }
/* "Hasta -X%" en negativo (oscuro con naranja), como el contorno del logo. */
.card.group .badge-discount { background: var(--on-accent); color: var(--accent); }
.card.group .card-variant { color: var(--hero-text); font-weight: 600; }
.card-prices .from { font-size: 12px; color: var(--muted); align-self: center; }
.card.group .card-foot { justify-content: flex-start; gap: 4px; color: var(--accent-text); }
.card.group .compare { font-size: 13px; font-weight: 700; }
.card.group:hover .card-foot .i { transform: translateX(2px); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Ventana de comparativa */
.offers-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.offers-dialog[open] { display: flex; flex-direction: column; }
.offers-dialog::backdrop { background: rgba(20, 26, 22, 0.55); }
.offers-head { display: flex; gap: 14px; align-items: center; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--line); }
.offers-img { width: 72px; height: 72px; flex: none; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.offers-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.offers-img:empty { display: none; }
.offers-info { flex: 1; min-width: 0; }
.offers-info h2 { margin: 2px 0; font-size: 20px; line-height: 1.2; }
.offers-info p { margin: 0; color: var(--muted); font-size: 14px; }
.icon-btn { border: 0; background: var(--surface-2); color: var(--text); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; align-self: flex-start; }
.icon-btn:hover { background: var(--sage-soft); }
.offers-body { overflow-y: auto; padding: 14px 18px 18px; }
.offers-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 4px 0 10px; }
.offer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.offer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.offer.best { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.offer.out { opacity: 0.6; }
.offer-store { display: grid; gap: 2px; min-width: 0; }
.offer-store strong { font-size: 15px; }
.offer-store span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-store .offer-out { color: var(--warn); }
.offer-price { display: grid; justify-items: end; gap: 1px; }
.offer-price strong { font-size: 18px; letter-spacing: -0.02em; }
.offer-price s { font-size: 12px; color: var(--muted); }
.offer-discount { font-size: 11px; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 5px; padding: 1px 6px; }
.offer-go { padding: 8px 16px; font-size: 14px; text-decoration: none; }
.offers-all { margin-top: 16px; }
.offers-all summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent-text); margin-bottom: 10px; }

.view-mode button { padding: 6px 12px; }

/* Miniaturas de colores en la tarjeta de modelo */
.card-colors { display: flex; gap: 5px; padding: 8px 10px 0; border-top: 1px solid var(--line); }
.card-colors:empty { display: none; }
/* En la vista de modelos todas las tarjetas guardan el hueco, para que queden alineadas. */
.results.models .card-colors:empty { display: flex; min-height: 44px; }
.results.models .card-colors + .card-body,
.card-colors:not(:empty) + .card-body { border-top: 0; }
.swatch {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, transform 0.15s;
}
.swatch img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.swatch:hover { transform: translateY(-1px); border-color: var(--sage); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.swatch-more { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); }

/* Colores en la comparativa */
#offers-colors-box { margin-bottom: 18px; }
.offers-colors { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.color-option {
  flex: none;
  width: 76px;
  display: grid;
  gap: 4px;
  padding: 4px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.color-option img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 7px; padding: 3px; }
.color-option:hover { border-color: var(--sage); }
.color-option[aria-pressed='true'] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
#offers-best-title .link-btn { font-size: 12px; text-transform: none; letter-spacing: 0; }

.offers-page-link { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.offers-page-link:hover { text-decoration: underline; }
.offers-page-link .i { width: 16px; height: 16px; }

/* Páginas de modelo y de categoría */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }
.model-page { max-width: 820px; }
.model-hero { display: flex; gap: 22px; align-items: center; margin-bottom: 26px; }
.model-img { width: 200px; aspect-ratio: 1; flex: none; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.model-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.model-img:empty { display: none; }
.model-info { min-width: 0; }
.model-info h1 { margin: 4px 0 8px; font-size: clamp(26px, 4vw, 36px); line-height: 1.1; letter-spacing: -0.02em; }
.model-price { margin: 0 0 6px; font-size: 17px; }
.model-price strong { font-size: 26px; letter-spacing: -0.02em; color: var(--text); }
.model-meta { margin: 0; font-size: 13px; color: var(--muted); }
.model-section { margin-bottom: 30px; }
.model-section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 10px; }
.model-page .history { margin-top: 0; }
.model-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.model-links { display: flex; flex-wrap: wrap; gap: 10px; }
.model-links .btn-secondary { text-decoration: none; }
.category-head { margin-bottom: 22px; max-width: 760px; }
.category-head h1 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.02em; }
.category-head h1 .i { width: 32px; height: 32px; }
.category-head p { margin: 0 0 6px; color: var(--muted); }
.category-count a { color: var(--accent-text); font-weight: 600; }
.category-page .results { margin-bottom: 40px; }
.category-others h2 { font-size: 18px; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.chips .chip .i { width: 16px; height: 16px; color: var(--muted); }
.chips .chip:hover { border-color: var(--sage); }
@media (max-width: 600px) {
  .model-hero { flex-direction: column; align-items: stretch; gap: 14px; }
  .model-img { width: 100%; max-width: 260px; margin: 0 auto; }
}

/* Tallas en la comparativa */
.offers-best-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.offers-best-head h3 { margin: 0; }
.my-size { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.my-size select { font: inherit; font-weight: 600; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.offer-sizes { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; }
.offer-sizes[hidden] { display: none; }
.size {
  min-width: 34px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: var(--surface);
}
.size.low { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.size.off { color: var(--muted); text-decoration: line-through; background: var(--surface-2); border-color: transparent; font-weight: 400; }
.size.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sizes-note { font-size: 12px; color: var(--muted); align-self: center; }
.offer-store .offer-mysize { font-weight: 600; color: var(--warn); white-space: normal; }
.offer-store .offer-mysize.ok { color: var(--ok); }
.offer.size-no { opacity: 0.65; }

/* Historial de precios */
.history { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.history-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.history-summary strong { color: var(--text); }
.history-summary .muted { margin-left: auto; }
.verdict { font-weight: 700; color: var(--text); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.verdict.good { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.verdict.high { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.history-chart { position: relative; }
.history-chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.history-chart .axis text { font-size: 11px; fill: var(--muted); }
.history-chart .grid { stroke: var(--line); stroke-width: 1; }
.history-chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.history-chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.history-chart .label { font-size: 11px; font-weight: 600; fill: var(--text); }
.history-chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.history-chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute;
  top: -6px;
  transform: translate(-50%, -100%);
  display: grid;
  justify-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
.chart-tip strong { font-size: 14px; color: var(--text); }
.history-table { margin-top: 8px; font-size: 13px; }
.history-table summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
.history-table table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.history-table th, .history-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.history-table th { font-size: 12px; color: var(--muted); font-weight: 600; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

.skeleton { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); height: 360px; position: relative; overflow: hidden; }
.skeleton.short { height: 84px; }
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(127, 127, 127, 0.08), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Noticias ---------- */
.news-list, .thread-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.news-list a, .thread-list a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.news-list a:hover, .thread-list a:hover { border-color: var(--sage); }
.news-title, .thread-title { font-weight: 600; line-height: 1.3; }
.news-meta, .thread-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.news-summary { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.news-list .empty, .thread-list .empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.news-list .empty a, .thread-list .empty a { display: inline; padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 600; }
.news-list:not(.compact) a { padding: 18px 20px; }
.news-list:not(.compact) .news-title { font-size: 17px; }
.source-tag, .tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--sage-soft); color: var(--hero-text); }
.source-tag { background: var(--accent-soft); color: var(--accent-text); }
.toolbar-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.toolbar-chips .chip[aria-pressed='true'] { background: var(--hero-text); color: var(--bg); border-color: var(--hero-text); }
.note { color: var(--muted); font-size: 13px; margin-top: 18px; }

/* Tarjetas de noticia */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.news-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.news-card:hover { transform: translateY(-2px); border-color: var(--sage); }
.news-card-img { aspect-ratio: 16 / 9; background: var(--sage-soft); display: grid; place-items: center; overflow: hidden; }
.news-card-img img { width: 100%; height: 100%; object-fit: cover; }
.news-card-img .i { width: 56px; height: 56px; color: var(--sage); }
.news-card-body { padding: 16px 18px 18px; display: grid; gap: 8px; }
.news-card-body h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.news-card-body p { margin: 0; color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Página de una noticia */
.article-page { max-width: 820px; }
.article-head { margin-bottom: 22px; }
.article-head h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.12; letter-spacing: -0.03em; margin: 10px 0 12px; }
.article-summary { font-size: 19px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.article-summary:empty { display: none; }
.article-meta { font-size: 14px; color: var(--muted); margin: 0; }
.article-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); margin-bottom: 26px; display: block; }
.article-body { font-size: 18px; line-height: 1.7; overflow-wrap: anywhere; }
.article-body h2 { font-size: 26px; margin: 34px 0 10px; line-height: 1.25; }
.article-body h3 { font-size: 21px; margin: 26px 0 8px; }
.article-body p, .article-body ul, .article-body ol { margin: 0 0 18px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote { margin: 0 0 18px; padding: 6px 0 6px 18px; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.article-body figure { margin: 26px 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
.article-body a { color: var(--accent-text); font-weight: 600; }
.article-body.preview { margin-top: 20px; padding: 20px; border: 1px dashed var(--sage); border-radius: var(--radius); }

/* Panel de administración */
.login-panel { max-width: 420px; margin: 20px auto; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.admin-head .page-title { margin: 0; }
.admin-actions { display: flex; align-items: center; gap: 16px; }
.admin-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-list { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.admin-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.admin-list button {
  width: 100%;
  text-align: left;
  font: inherit;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.admin-list button:hover { border-color: var(--sage); }
.admin-list button.active { border-color: var(--accent); background: var(--accent-soft); }
.admin-item-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.admin-item-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.admin-list .empty { color: var(--muted); font-size: 14px; }
.tag-ok { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.tag-draft { background: var(--surface-2); color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.cover-box { aspect-ratio: 16 / 9; max-width: 360px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: var(--bg); color: var(--muted); font-size: 14px; }
.cover-box img { width: 100%; height: 100%; object-fit: cover; }
.cover-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--sage); }
.form label.btn-secondary { display: inline-flex; color: var(--text); font-size: 14px; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.md-toolbar button, .md-toolbar .md-image {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-block;
}
.form .md-toolbar .md-image { display: inline-block; color: var(--text); font-weight: 400; }
.md-toolbar button:hover, .md-toolbar .md-image:hover { border-color: var(--sage); }
#body { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 14px; line-height: 1.6; min-height: 320px; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.link-btn.danger { color: var(--warn); margin-left: auto; }

/* ---------- Foro ---------- */
.forum-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form input, .form select, .form textarea {
  font: inherit;
  font-size: 15px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.form textarea { min-height: 140px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--sage); outline-offset: -1px; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { font-size: 14px; margin: 0; }
.form-msg.error { color: var(--warn); }
.form-msg.ok { color: var(--ok); }
.form-help { font-size: 12px; color: var(--muted); margin: 0; }

.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: 14px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.post.first { border-color: var(--sage); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--sage-soft); color: var(--hero-text); flex: none; }
.post-author { font-weight: 700; }
.post-date { color: var(--muted); font-size: 13px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; line-height: 1.55; }
.thread-heading { margin: 0 0 6px; font-size: clamp(22px, 3.5vw, 28px); }
.replies-title { font-size: 16px; margin: 24px 0 12px; color: var(--muted); }

/* ---------- Páginas legales ---------- */
.legal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px clamp(18px, 4vw, 40px); }
.legal h1 { margin-top: 0; font-size: clamp(26px, 4vw, 32px); }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal p, .legal li { line-height: 1.65; }
.legal .updated { color: var(--muted); font-size: 14px; }
.legal mark { background: var(--accent-soft); color: var(--accent-text); padding: 0 4px; border-radius: 4px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal th, .legal td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ---------- Pie ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer-inner { max-width: var(--max); margin: 0 auto; padding: 28px 16px 32px; display: grid; gap: 10px; justify-items: start; }
.site-footer p { margin: 0; max-width: 640px; }
.logo-footer img { height: 64px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: var(--text); text-decoration: none; font-weight: 500; }
.footer-links a:hover { text-decoration: underline; }
.copy { font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .categories { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .forum-layout { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-list { position: static; max-height: 260px; }
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .article-body { font-size: 17px; }
}

@media (max-width: 860px) {
  /* En el móvil el panel de filtros se abre justo debajo del botón "Filtros". */
  .search-layout { grid-template-columns: 1fr; gap: 0; }
  .results-area { display: contents; }
  .results-bar { order: 1; }
  .filters { order: 2; margin-bottom: 16px; }
  .active-filters { order: 3; }
  #results { order: 4; }
  .filters { display: none; position: static; max-height: none; }
  .filters.open { display: block; }
  .filters-done { display: block; }
  .filters-toggle { display: inline-flex; }
  .split { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 600px) {
  .site-header-inner { height: 60px; gap: 8px; }
  .logo img { height: 48px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 7px 8px; font-size: 14px; }
  .site-nav a .i { display: none; }
  .header-right { gap: 4px; }
  .theme-toggle { width: 36px; height: 36px; }
  .hero { padding: 28px 16px 92px; background-image: radial-gradient(circle at 80% calc(100% - 40px), color-mix(in srgb, var(--accent) 75%, var(--hero-bg)) 0 32px, transparent 33px); }
  .hero-title br { display: none; }
  .hero::before { height: 80px; }
  .hero::after { height: 56px; }
  .search { padding-left: 14px; }
  .search input { font-size: 16px; padding: 10px 8px; }
  .search button { padding: 11px 16px; }
  .categories { gap: 8px; }
  .cat { padding: 12px 4px 10px; font-size: 12px; gap: 6px; }
  .cat .i { width: 40px; height: 40px; }
  .cat .i::after { inset: 10px; }
  .results, #deals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 10px; }
  .card-colors { padding: 8px 8px 0; gap: 4px; }
  .swatch { width: 32px; height: 32px; }
  .results.models .card-colors:empty { min-height: 40px; }
  .card-title { font-size: 14px; }
  .price { font-size: 17px; }
  .results-bar { flex-wrap: wrap; }
  .results-bar select { flex: 1; }
  .result-count { order: 3; width: 100%; }
  .view-mode { order: 4; width: 100%; }
  .view-mode button { flex: 1; }
  /* En el móvil la comparativa sale como panel desde abajo. */
  .offers-dialog { width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .offer { gap: 10px; padding: 10px; }
  .offer-go { padding: 8px 12px; }
}
