/* Lucia v22 — production stylesheet (Alpine.js + FastAPI)
   Pure CSS custom properties, no Tailwind dependency.
   Editorial warm aesthetic + optional dark mode + 3 densities. */

:root {
  /* Editorial warm palette */
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --ink: #1a1714;
  --ink-2: #58524c;
  --ink-3: #8a8278;
  --line: #e9e5dc;
  --line-2: #d8d2c4;
  --accent: #1a1714;
  --accent-2: #c47b4a;
  --up: #1a7a3e;
  --down: #b8351c;
  --info: #4a5a8a;
  --warn: #b07816;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(20,18,15,.04), 0 1px 1px rgba(20,18,15,.03);
  --shadow: 0 8px 24px -8px rgba(20,18,15,.10), 0 2px 4px rgba(20,18,15,.04);
  --shadow-lg: 0 24px 60px -12px rgba(20,18,15,.18);

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Density (overridden by [data-density]) */
  --row-h: 36px;
  --pad-card: 18px;
  --gap-grid: 24px;
}

[data-theme="dark"] {
  --bg: #0f0e0c;
  --surface: #161412;
  --surface-2: #1f1c19;
  --ink: #f0ece5;
  --ink-2: #b8b0a4;
  --ink-3: #847d72;
  --line: #2a2622;
  --line-2: #3a342e;
  --accent: #f0ece5;
}

[data-density="compact"] { --row-h: 30px; --pad-card: 12px; --gap-grid: 16px; }
[data-density="comfy"]   { --row-h: 44px; --pad-card: 24px; --gap-grid: 32px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

/* APP SHELL */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.app[data-nav="collapsed"] { grid-template-columns: 60px 1fr; }

/* SIDEBAR */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.sidebar-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-style: italic;
}
.sidebar-name {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.sidebar-name-sub {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-top: 2px;
}
.app[data-nav="collapsed"] .sidebar-name,
.app[data-nav="collapsed"] .sidebar-name-sub,
.app[data-nav="collapsed"] .nav-label,
.app[data-nav="collapsed"] .nav-section,
.app[data-nav="collapsed"] .sidebar-user-info { display: none; }

/* FIX (sesión julio 2026): a 60px de ancho, los .nav-item quedaban
   pegados a la izquierda (heredaban text-align:left del estado
   expandido) y el footer con el avatar de usuario se salía del
   contenedor — es el bug de la captura en pantalla grande. */
.app[data-nav="collapsed"] .nav-item {
  justify-content: center; padding: 8px; gap: 0;
}
.app[data-nav="collapsed"] .sidebar { padding: 18px 8px; overflow-x: hidden; }
.app[data-nav="collapsed"] .sidebar-brand { justify-content: center; padding: 4px 0 18px; }
.app[data-nav="collapsed"] .sidebar-user { justify-content: center; padding: 8px 0; }

.nav-section {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  cursor: pointer;
  border: 0; background: transparent;
  width: 100%; text-align: left;
  font: inherit;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-on { background: var(--ink); color: var(--bg); }
.nav-icon { width: 18px; text-align: center; font-size: 14px; }
.nav-label { font-size: 13px; font-weight: 500; flex: 1; }
.nav-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 99px;
  background: var(--accent-2); color: white; font-weight: 600;
}
.nav-item.is-on .nav-badge { background: var(--bg); color: var(--ink); }

.sidebar-footer {
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line);
}
.sidebar-user-name {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* MAIN */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
}
.topbar-search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3); cursor: text;
}
.topbar-search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font: inherit; color: var(--ink);
}
.topbar-search kbd {
  font-family: var(--mono); font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
  color: var(--ink-3);
}
.topbar-spacer { flex: 1; }
.topbar-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.15s; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.icon-btn.is-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot-badge {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--down); border-radius: 50%;
}

.content { padding: 28px 28px 80px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* TYPOGRAPHY */
.page-title {
  font-family: var(--serif);
  font-size: 38px; line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 6px; font-weight: 400;
}
.page-title em { font-style: italic; color: var(--ink-3); }
.page-sub { color: var(--ink-3); font-size: 13px; }
.page-sub strong { color: var(--ink); font-weight: 600; }

/* BUTTONS / INPUTS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.input, .select {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; outline: 0;
}
.input:focus, .select:focus { border-color: var(--ink-2); }
.search-input {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-3);
}
.search-input input {
  flex: 1; border: 0; background: transparent; outline: 0;
  font: inherit; color: var(--ink);
}

/* CHIPS / PILLS */
.chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px; color: var(--ink-2);
  cursor: pointer; transition: all 0.15s;
  font: inherit;
}
.chip:hover { border-color: var(--line-2); }
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* CATALOG GRID */
.prod-grid {
  display: grid;
  gap: var(--gap-grid);
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-col-min, 220px), 1fr));
}
.prod-card { cursor: pointer; transition: transform 0.2s; }
.prod-card:hover { transform: translateY(-2px); }
.prod-card-img-wrap {
  position: relative; aspect-ratio: 3/4;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2);
}
.prod-img { position: absolute; inset: 0; object-fit: cover; width: 100%; height: 100%; transition: opacity 0.4s; }
.prod-img-hover { opacity: 0; }
.prod-card:hover .prod-img-hover { opacity: 1; }
.prod-skel {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--surface-2) 0%, #ebe7dd 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fadeIn { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: blur(0); } }
.prod-badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.prod-badge-new { background: rgba(26,23,20,.92); color: var(--bg); }
.prod-badge-sale { background: var(--down); color: white; left: auto; right: 10px; }
.prod-card-body { padding: 12px 2px 0; }
.prod-card-brand {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-3);
  font-weight: 600;
}
.prod-card-name {
  font-size: 13px; font-weight: 500; color: var(--ink);
  margin: 4px 0; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prod-card-rubro { font-size: 11px; color: var(--ink-3); margin-bottom: 6px; }
.prod-card-prices { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.prod-price, .prod-price-sale {
  font-size: 14px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.prod-price-sale { color: var(--down); }
.prod-price-old {
  font-size: 12px; color: var(--ink-3);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

/* CATALOG LAYOUT */
.catalog { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.filters {
  position: sticky; top: 80px;
  align-self: start; height: fit-content;
}
.filters-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 13px;
}
.filter-group { padding: 12px 0; border-bottom: 1px solid var(--line); }
.filter-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3);
  margin-bottom: 8px; font-weight: 600;
}
.catalog-main { min-width: 0; }
.catalog-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 24px;
}
.catalog-tools { display: flex; gap: 8px; align-items: center; }

/* ══ MARCA — Multi-select combobox (sesión julio 2026) ══════════════════
   Antes no tenía NINGÚN CSS — se veía con estilos default del navegador.
   Rediseño: lista limpia con nombre + contador, hover suave, chips
   discretos para lo ya seleccionado. */
.ms-combo { position: relative; }
.ms-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 38px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: text;
  transition: border-color .15s;
}
.ms-input:hover { border-color: var(--ink-3); }
.ms-input.active { border-color: var(--ink); box-shadow: 0 0 0 3px oklch(0 0 0 / 6%); }
.ms-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border-radius: 999px;
  padding: 3px 6px 3px 10px; font-size: 12px; font-weight: 500;
  color: var(--ink); line-height: 1.4;
}
.ms-chip-x {
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-3); font-size: 14px; line-height: 1;
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
}
.ms-chip-x:hover { background: var(--ink); color: var(--bg); }
.ms-search {
  flex: 1; min-width: 60px; border: 0; outline: 0;
  background: transparent; font-size: 13px; color: var(--ink);
  font-family: inherit;
}
.ms-search::placeholder { color: var(--ink-3); }
.ms-clear {
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-3); font-size: 16px; line-height: 1;
  align-self: center; padding: 0 4px;
}
.ms-clear:hover { color: var(--down); }
.ms-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto; z-index: 30;
  padding: 6px;
}
.ms-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; color: var(--ink);
  transition: background .1s;
}
.ms-option:hover { background: var(--surface-2); }
.ms-option.selected { background: oklch(0.94 0.03 60); font-weight: 600; }
.ms-check {
  width: 16px; text-align: center; color: var(--accent-2);
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.ms-opt-name { flex: 1; }
.ms-opt-count {
  font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ══ Tabla de Catálogo — CSS propio (antes heredaba solo .data-table
   genérico y quedaba desalineada) ══ */
.cat-table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.cat-table-wrap table { width: 100%; border-collapse: collapse; }
.cat-table-wrap thead th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); font-weight: 600;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.cat-table-wrap tbody td {
  padding: 10px 14px; font-size: 13px; color: var(--ink);
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.cat-table-wrap tbody tr:last-child td { border-bottom: 0; }
.cat-table-wrap tbody tr:hover { background: var(--surface-2); }
.cat-table-wrap .num-col { text-align: right; font-variant-numeric: tabular-nums; }

/* ══ Rubro — dropdown con íconos (sesión julio 2026) ══ */
.rd-combo { position: relative; }
.rd-input {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  transition: border-color .15s;
}
.rd-input:hover { border-color: var(--ink-3); }
.rd-input.active { border-color: var(--ink); box-shadow: 0 0 0 3px oklch(0 0 0 / 6%); }
.rd-icon { flex-shrink: 0; color: var(--ink-2); display: flex; }
.rd-current { flex: 1; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-chev { color: var(--ink-3); font-size: 11px; transition: transform .15s; }
.rd-chev.open { transform: rotate(180deg); }
.rd-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto; z-index: 30; padding: 6px;
}
.rd-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; color: var(--ink);
  transition: background .1s;
}
.rd-option:hover { background: var(--surface-2); }
.rd-option.selected { background: oklch(0.94 0.03 60); font-weight: 600; }
.rd-option .rd-icon { color: var(--accent-2); }

/* ══ Precio — slider doble (sesión julio 2026) ══ */
.price-slider { position: relative; height: 20px; margin: 14px 2px 4px; }
.price-slider-track {
  position: absolute; top: 50%; left: 0; right: 0; height: 3px;
  transform: translateY(-50%);
  background: var(--line); border-radius: 2px;
}
.price-slider-fill {
  position: absolute; top: 0; bottom: 0;
  background: var(--ink); border-radius: 2px;
}
.price-slider-input {
  position: absolute; top: 50%; left: 0; right: 0;
  width: 100%; margin: 0; transform: translateY(-50%);
  -webkit-appearance: none; appearance: none;
  background: transparent; pointer-events: none;
}
.price-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  pointer-events: auto;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  cursor: pointer;
}
.price-slider-input::-moz-range-thumb {
  pointer-events: auto;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  cursor: pointer;
}
.price-slider-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ══ Toggle de filtros — desktop + mobile (sesión julio 2026) ══ */
.filter-toggle-bar { grid-column: 1 / -1; margin-bottom: 4px; }
.filter-toggle-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  cursor: pointer; position: relative; transition: all .15s;
}
.filter-toggle-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-toggle-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2); margin-left: 2px;
}
.catalog.filters-hidden { grid-template-columns: 1fr; }
.catalog.filters-hidden .filters { display: none; }

/* ══ Vista Revista — masonry + hover overlay (sesión julio 2026) ══ */
.prod-magazine {
  column-width: var(--grid-col-min, 240px); column-gap: 16px;
}
@media (max-width: 1400px) { .prod-magazine { column-width: 220px; } }
@media (max-width: 900px)  { .prod-magazine { column-width: 160px; } }
.mag-card {
  position: relative; break-inside: avoid; margin-bottom: 16px;
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--surface-2);
}
.mag-img { display: block; width: 100%; height: auto; transition: transform .5s ease; }
.mag-card:hover .mag-img { transform: scale(1.06); }
.mag-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 22%, transparent 60%, rgba(0,0,0,.75) 100%);
  opacity: 0; transition: opacity .3s ease;
}
.mag-card:hover .mag-overlay { opacity: 1; }
.mag-overlay-top { display: flex; gap: 6px; }
.mag-overlay-bottom {
  color: #fff; transform: translateY(8px); transition: transform .3s ease;
}
.mag-card:hover .mag-overlay-bottom { transform: translateY(0); }
.mag-brand { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.mag-name { font-size: 13px; font-weight: 600; margin: 2px 0 4px; line-height: 1.25; }
.mag-prices { font-size: 13px; font-variant-numeric: tabular-nums; }
.mag-price-sale { font-weight: 700; }
.mag-price-old { text-decoration: line-through; opacity: .65; font-size: 11px; margin-left: 4px; }

/* ══ Franja "Actualización por marca" (sesión julio 2026) ══ */
.freshness-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px;
  margin-bottom: 4px;
}
.freshness-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 11.5px; font-weight: 500;
  color: var(--ink-2); white-space: nowrap; cursor: pointer; flex-shrink: 0;
  transition: border-color .15s;
}
.freshness-chip:hover { border-color: var(--ink-3); }
.freshness-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.freshness-chip.is-fresh .freshness-dot { background: var(--up); }
.freshness-chip.is-stale .freshness-dot { background: var(--down); }
.freshness-days { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.freshness-chip.is-stale .freshness-days { color: var(--down); }
.reclass-inline { display: flex; gap: 6px; align-items: center; }

/* ══ Export — dropdown estilo filtros (sesión julio 2026) ══ */
.export-combo { position: relative; }
.export-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 240px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 30; padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.export-dropdown button {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  border: 0; background: transparent; text-align: left;
  font-size: 13px; color: var(--ink); cursor: pointer; font-family: inherit;
  transition: background .1s;
}
.export-dropdown button:hover { background: var(--surface-2); }

/* ══ Botones de vista Catálogo — tamaño uniforme (sesión julio 2026) ══
   Antes sin CSS: cada botón medía el ancho natural de su glifo (⊞/◨/☰),
   que no es igual entre caracteres — de ahí la inconsistencia visual. */
.view-toggle {
  display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-toggle button {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: var(--surface); color: var(--ink-3);
  font-size: 15px; cursor: pointer; line-height: 1;
  border-right: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.view-toggle button:last-child { border-right: 0; }
.view-toggle button:hover { background: var(--surface-2); color: var(--ink); }
.view-toggle button.is-on { background: var(--ink); color: var(--bg); }










/* QUICK VIEW MODAL */
.qv-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,18,15,.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn 0.2s;
}
.qv-modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 880px; width: 100%; max-height: 90vh;
  overflow: auto; box-shadow: var(--shadow-lg);
  position: relative;
  animation: zoomIn 0.25s cubic-bezier(.2,.9,.3,1);
}
@keyframes zoomIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.qv-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  border: 0; background: var(--surface-2);
  border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; z-index: 2;
}
.qv-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 36px; padding: 36px;
}
.qv-imgwrap {
  position: relative; aspect-ratio: 3/4;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2);
}
.qv-imgwrap img { width: 100%; height: 100%; object-fit: cover; }
.qv-info { display: flex; flex-direction: column; gap: 10px; }
.qv-brand {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-3);
  font-weight: 600;
}
.qv-name {
  font-family: var(--serif);
  font-size: 32px; font-weight: 400;
  line-height: 1.1; margin: 0;
}
.qv-prices {
  display: flex; align-items: baseline; gap: 12px;
  margin: 8px 0; padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.qv-price, .qv-price-sale {
  font-size: 28px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.qv-price-sale { color: var(--down); }
.qv-price-old {
  font-size: 16px; color: var(--ink-3);
  text-decoration: line-through;
}

/* STAT GRID / CARDS */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  padding: var(--pad-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--line-2); }
.stat-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3);
  font-weight: 600;
}
.stat-value {
  font-family: var(--serif);
  font-size: 36px; line-height: 1.1;
  margin: 8px 0 6px; font-weight: 400;
  letter-spacing: -0.02em;
}
.stat-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.stat-delta {
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-delta.is-up { color: var(--up); }
.stat-delta.is-down { color: var(--down); }

/* CARD BLOCKS (analysis sections) */
.card-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 16px;
}
.block-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline;
}
.block-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.block-sub { font-size: 12px; color: var(--ink-3); }
.overview-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}

/* DATA TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: var(--surface-2); }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface-2);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table-dense td, .data-table-dense th { padding: 6px 12px; font-size: 12px; }
.cell-brand { color: var(--accent-2); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.num.old { color: var(--ink-3); text-decoration: line-through; }
.num.is-up { color: var(--up); font-weight: 600; }
.num.is-down { color: var(--down); font-weight: 600; }
.muted { color: var(--ink-3); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.cell-pill {
  font-size: 11px; padding: 2px 8px;
  border-radius: 4px; font-weight: 600;
}
.cell-pill.is-ok { background: rgba(26,122,62,.12); color: var(--up); }
.cell-pill.is-off { background: rgba(184,53,28,.12); color: var(--down); }
.cell-pill.is-info { background: rgba(74,90,138,.12); color: var(--info); }
.cell-pill.is-rubro { background: rgba(196,123,74,.14); color: var(--accent-2); }
.db-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto; max-height: 70vh;
  background: var(--surface);
}

/* GENERIC HEADERS */
.view-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.view-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* LOADING STATES */
.loading-row {
  padding: 40px; text-align: center;
  color: var(--ink-3); font-size: 13px;
}
.empty-state {
  padding: 60px 20px; text-align: center;
  color: var(--ink-3);
}
.empty-state h3 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 400;
  color: var(--ink); margin-bottom: 8px;
}

/* ALERTS PANEL */
.alerts-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,18,15,.3);
  z-index: 99; animation: fadeIn 0.2s;
}
.alerts-panel {
  position: fixed; top: 0; right: 0;
  width: 420px; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 100;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.25s cubic-bezier(.2,.9,.3,1);
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.alerts-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.alerts-head h2 {
  margin: 0; font-family: var(--serif);
  font-size: 24px; font-weight: 400;
}
.alerts-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.alerts-list { list-style: none; padding: 8px 0; margin: 0; flex: 1; overflow-y: auto; }
.alert-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 12px; align-items: start;
  padding: 14px 24px;
  border-left: 2px solid transparent;
  cursor: pointer; transition: all 0.15s;
}
.alert-row:hover { background: var(--surface-2); }
.alert-row.sev-high { border-left-color: var(--down); }
.alert-row.sev-med  { border-left-color: var(--warn); }
.alert-row.sev-low  { border-left-color: var(--line-2); }
.alert-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
}
.alert-row.typ-price-drop .alert-icon { background: rgba(26,122,62,.12); color: var(--up); }
.alert-row.typ-price-up   .alert-icon { background: rgba(176,120,22,.16); color: var(--warn); }
.alert-row.typ-sold-out   .alert-icon { background: rgba(184,53,28,.12); color: var(--down); }
.alert-row.typ-new        .alert-icon { background: rgba(74,90,138,.12); color: var(--info); }
.alert-text { font-size: 13px; line-height: 1.4; }
.alert-detail { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.alert-when { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* BOT LUCIA */
.bot-panel {
  position: fixed; right: 24px; bottom: 24px;
  width: 380px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: zoomIn 0.25s cubic-bezier(.2,.9,.3,1);
}
.bot-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--ink); color: var(--bg);
}
.bot-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg); color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-style: italic;
}
.bot-id { flex: 1; }
.bot-name {
  font-family: var(--serif); font-size: 18px; font-weight: 400;
  display: flex; align-items: center; gap: 8px;
}
.bot-tag {
  font-family: var(--sans); font-size: 9px;
  background: var(--accent-2); color: white;
  padding: 2px 6px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.05em;
}
.bot-msgs {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.bot-msg {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.45;
  max-width: 85%;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.bot-msg-bot  { background: var(--surface-2); align-self: flex-start; }
.bot-msg-user { background: var(--ink); color: var(--bg); align-self: flex-end; }
.bot-input-row {
  display: flex; gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.bot-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-2);
  font: inherit; font-size: 13px; outline: 0;
}
.bot-input:focus { background: var(--surface); border-color: var(--ink-2); }
.bot-send {
  width: 38px; height: 38px;
  border: 0; background: var(--ink); color: var(--bg);
  border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
}

/* RESPONSIVE */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0;
    height: 100vh; z-index: 200;
    transform: translateX(-100%);
    transition: 0.25s; width: 240px;
  }
  .sidebar.is-open { transform: translateX(0); }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; }
  .content { padding: 20px 16px 80px; }
  .topbar-search { display: none; }
  .alerts-panel { width: 100%; }
  .qv-body, .overview-row { grid-template-columns: 1fr; }
}

/* Seg buttons: count badge y disabled */
.seg button .seg-count { font-size: 10px; opacity: 0.6; margin-left: 2px; }
.seg button.is-disabled, .seg button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Multi-select dropdown ── */
.multi-sel-wrap { position: relative; }
.multi-sel-btn { cursor: pointer; gap: 6px; }
.multi-sel-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 180px; max-height: 260px;
  overflow-y: auto; padding: 8px;
}
.multi-sel-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 4px;
  cursor: pointer; font-size: 13px;
  white-space: nowrap; user-select: none;
}
.multi-sel-item:hover { background: var(--surface-2); }
.multi-sel-item input[type=checkbox] { accent-color: var(--accent-2); flex-shrink: 0; }

/* ── Config panel ── */
.config-panel { width: 320px; }
.config-body { padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.config-section { display: flex; flex-direction: column; gap: 8px; }
.config-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.config-row { display: flex; gap: 6px; flex-wrap: wrap; }
.config-opt {
  padding: 6px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink-2); font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.config-opt:hover { border-color: var(--ink-3); color: var(--ink); }
.config-opt.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.config-toggle-row { display: flex; align-items: center; justify-content: space-between; }

/* ── Alerts panel improvements ── */
.alert-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.alert-row:hover { background: var(--surface-2); }
.alert-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.sev-high .alert-icon  { background: #fee2e2; color: #dc2626; }
.sev-med .alert-icon   { background: #fef3c7; color: #d97706; }
.sev-low .alert-icon   { background: #dcfce7; color: #16a34a; }
.typ-price-drop .alert-icon { background: #fee2e2; color: #dc2626; }
.typ-new .alert-icon        { background: #dcfce7; color: #16a34a; }
.typ-sold-out .alert-icon   { background: #f3f4f6; color: #6b7280; }
.alert-text { font-size: 13px; line-height: 1.4; }
.alert-detail { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.alert-when { font-size: 11px; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }

/* ── Design improvements v24 ── */

/* Mejoras tipográficas generales */
.page-title { letter-spacing: -.02em; }
.block-head h3 { letter-spacing: -.01em; }

/* Mejor separación en tablas */
.data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  white-space: nowrap;
}
.data-table td { vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* num-col: siempre alineado a la derecha con padding mínimo de separación */
.num-col {
  text-align: right !important;
  padding-right: 16px !important;
  padding-left: 16px !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* KPI cards: más definición */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--line);
  opacity: 0;
  transition: opacity .2s;
}
.stat-card:hover::before { opacity: 1; }

/* Pills / chips más compactos */
.cell-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.cell-pill.is-ok   { background: #dcfce7; color: #166534; }
.cell-pill.is-warn { background: #fef3c7; color: #92400e; }
.cell-pill.is-info { background: #dbeafe; color: #1e40af; }

/* Role pills en tabla de usuarios */
.role-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
}
.role-pill.role-admin   { background: #fce7f3; color: #9d174d; }
.role-pill.role-analyst { background: #dbeafe; color: #1e40af; }
.role-pill.role-viewer  { background: #f3f4f6; color: #4b5563; }

/* Scrollbars más delgadas */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }


/* ═══════════════════════════════════════════
   MOBILE — breakpoints y ajustes generales
   ═══════════════════════════════════════════ */

/* Hamburger — solo mobile */
.mob-menu-btn { display: none !important; }

@media (max-width: 920px) {
  /* Mostrar hamburger */
  .mob-menu-btn { display: flex !important; }

  /* Overlay oscuro detrás del nav */
  .mob-overlay {
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,.45);
    display: block !important;
  }

  /* Sidebar: z-index por encima del overlay */
  .sidebar { z-index: 200; }

  /* Topbar: ajustar espacio */
  .topbar { gap: 8px; padding: 0 14px; }
  .topbar-search { display: none; }

  /* Ocultar secciones admin en mobile */
  .nav-section-sistema { display: none !important; }
  .nav-section-datos   { display: none !important; }

  /* Content sin padding excesivo */
  .content { padding: 12px 12px 80px; }
}

/* ═══════════════════════════════════════════
   CATALOG MOBILE
   ═══════════════════════════════════════════ */

/* Barra de filtros mobile */
.mob-filter-bar {
  display: none;
  gap: 8px; padding: 10px 0 4px;
  align-items: center;
}
.mob-filter-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; position: relative;
}
.mob-filter-btn:active { opacity: .7; }
.mob-filter-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); flex-shrink: 0;
}
.mob-search-input {
  flex: 1; padding: 8px 12px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .85rem; color: var(--ink); outline: none;
  min-width: 0;
}
.mob-search-input:focus { border-color: var(--accent); }

@media (max-width: 920px) {
  /* Mostrar barra mobile, ocultar search del topbar */
  .mob-filter-bar { display: flex; }

  /* Filtros: panel deslizable desde la izquierda */
  .filters {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh;
    background: var(--bg); z-index: 300;
    overflow-y: auto; padding: 20px 16px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .filters.mob-open { transform: translateX(0); }

  /* Grid: 2 columnas en mobile */
  .prod-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Cards más compactas */
  .prod-card-body { padding: 8px 2px 0; }
  .prod-card-brand { font-size: .68rem; }
  .prod-card-name  { font-size: .78rem; line-height: 1.3; -webkit-line-clamp: 2; }
  .prod-card-prices { font-size: .8rem; gap: 4px; }

  /* Quick view fullscreen */
  .quick-view {
    width: 100% !important; height: 100% !important;
    border-radius: 0 !important; top: 0 !important; left: 0 !important;
  }
  .qv-body { padding: 16px; gap: 16px; }
}

/* ═══════════════════════════════════════════
   ALERTS MOBILE
   ═══════════════════════════════════════════ */
@media (max-width: 920px) {
  /* Tablas con scroll horizontal */
  .signal-card .table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .al-table { min-width: 520px; }

  /* KPI chips: wrap en 2 columnas */
  .kpi-strip { flex-wrap: wrap; gap: 8px; }
  .kpi-chip  { flex: 1 1 45%; font-size: .78rem; padding: 8px 12px; }

  /* Drill-down modal: fullscreen */
  [x-show="drill.open"] > div {
    max-width: 100% !important;
    border-radius: 0 !important;
    height: 100vh !important;
    margin: 0 !important;
  }
  [x-show="drill.open"] {
    padding: 0 !important;
    align-items: flex-start !important;
  }
}


/* Faltantes del mockup Alertas — no existían en el sistema base */
.link-btn { background: 0; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.page-title-sub { color: var(--ink-3); font-style: italic; font-size: 26px; }

/* ── Acordeón de sitios en Config/Scrapers (sesión julio 2026) ──
   Reemplaza la tabla plana + el listado de campañas de 50 filas
   que crecía indefinidamente hacia abajo. Colapsado por defecto,
   una marca a la vez. */
.sites-accordion { display: flex; flex-direction: column; gap: 6px; }
.site-acc-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.site-acc-item.is-open { border-color: var(--accent-2); }
.site-acc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.site-acc-head:hover { background: var(--surface-2); }
.site-acc-body {
  padding: 4px 14px 14px 34px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.site-acc-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.site-acc-detect {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.acc-action-result {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
/* ── Borrado de categoría + loaders uniformes en Scrapers (sesión julio 2026) ── */
.chip-mini-x {
  background: 0; border: 0; margin-left: 4px; padding: 0 2px;
  cursor: pointer; color: var(--down); font-weight: 700; font-size: 13px;
  line-height: 1; vertical-align: middle;
}
.chip-mini-x:disabled { opacity: .5; cursor: default; }
.toggle.is-busy { opacity: .7; }
.scraper-spin { display: inline-block; animation: scraper-spin-anim .8s linear infinite; }
@keyframes scraper-spin-anim { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/* ── Píldora flotante de scraping minimizado (sesión julio 2026) ── */
.scraper-pill {
  position: fixed; bottom: 20px; right: 20px; z-index: 901;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  cursor: pointer; font-size: 12px;
}
.scraper-pill-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: var(--bg);
  animation: scraper-spin-anim .8s linear infinite;
}
.scraper-pill-text { display: flex; flex-direction: column; line-height: 1.3; }
.scraper-pill-pct { opacity: .7; font-size: 10.5px; }

/* ── Progreso inline de scrapers vía GitHub Action (sesión julio 2026) ── */
.site-acc-external { margin: 8px 0; padding: 8px 0; border-top: 1px dashed var(--line); }
.site-acc-ext-bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.site-acc-ext-fill { height: 100%; background: var(--accent-2); transition: width .3s ease; }


.set-builder {
  position: sticky; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 14px 20px; margin: 20px -20px 0; box-shadow: var(--shadow-lg);
}
.set-builder-head { display: flex; align-items: center; gap: 12px; }
.set-builder-slots { display: flex; gap: 20px; margin-top: 14px; overflow-x: auto; }
.set-slot-col { min-width: 100px; }
.set-slot-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.set-slot-item { position: relative; width: 90px; height: 90px; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 6px; }
.set-slot-item img { width: 100%; height: 100%; object-fit: cover; }
.set-slot-remove { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; }
.prod-card.is-in-set { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.saved-set-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.set-collage { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.set-collage-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--radius-sm); }
.set-collage-info { padding: 8px 2px; }
.set-collage-brand { font-size: 10px; text-transform: uppercase; color: var(--ink-3); }
.set-collage-name { font-size: 13px; font-weight: 500; margin: 2px 0; }
.set-collage-price { font-size: 13px; font-weight: 600; }

.suggested-set-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* ══════════════════════════════════════════════════════════════════
   CLOSET — feature nuevo (sesión julio 2026)
   Nota: .lucia-loader, .db-empty y .page-head pueden ya existir en
   views.css (no lo tuve disponible al armar esto) — si aparecen
   duplicados o con estilos en conflicto, avisame y los saco de acá.
   ══════════════════════════════════════════════════════════════════ */

.closet-view { padding-bottom: 60px; }

.closet-tools { display: flex; gap: 8px; }

.closet-tabs {
  display: flex; gap: 20px; border-bottom: 1px solid var(--line);
  margin: 20px 0 20px; overflow-x: auto;
}
.closet-tab {
  background: none; border: 0; cursor: pointer; font-family: var(--serif, serif);
  font-size: 14px; padding: 8px 2px 12px; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.closet-tab:hover { color: var(--ink); }
.closet-tab.is-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent-2); }

.closet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}
.closet-card { cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.closet-card-img {
  position: relative; aspect-ratio: 3/4; border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2, var(--surface));
  border: 2px solid transparent; transition: border-color .15s;
}
.closet-card:hover .closet-card-img { border-color: var(--accent-2); }
.closet-card-img img { width: 100%; height: 100%; object-fit: cover; }
.closet-mark {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: var(--accent-2); color: #fff; box-shadow: var(--shadow);
}
.closet-card-name { font-size: 13px; line-height: 1.25; }
.closet-card-price { display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 600; }
.closet-card-old { font-size: 11px; color: var(--ink-3); text-decoration: line-through; font-weight: 400; }

.closet-set-card { cursor: pointer; }
.closet-set-collage {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 3px; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2, var(--surface)); margin-bottom: 8px;
}
.closet-set-collage-cell img { width: 100%; height: 100%; object-fit: cover; }

.closet-fab {
  position: fixed; left: 28px; bottom: 28px; width: 56px; height: 56px;
  border-radius: 50%; border: 0; background: var(--ink); color: var(--bg);
  font-size: 26px; line-height: 1; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 40;
}

.closet-tray {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: var(--shadow-lg);
  padding: 16px 28px; z-index: 45;
}
.closet-tray-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.closet-tray-title { font-family: var(--serif, serif); font-size: 16px; font-weight: 600; }
.closet-tray-groups { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 4px; }
.closet-tray-group { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.closet-tray-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.closet-tray-item { position: relative; width: 56px; height: 74px; border-radius: var(--radius-sm); overflow: hidden; flex: none; }
.closet-tray-item img { width: 100%; height: 100%; object-fit: cover; }
.closet-tray-remove {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.75); color: #fff; font-size: 10px; line-height: 1; cursor: pointer;
}

.closet-backdrop { position: fixed; inset: 0; background: rgba(20,18,15,.45); z-index: 50; }
.closet-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  background: var(--bg); box-shadow: var(--shadow-lg); z-index: 51;
  overflow-y: auto; padding: 20px;
}
.closet-panel-close { float: right; background: none; border: 0; cursor: pointer; font-size: 20px; color: var(--ink-3); }
.closet-panel-img { aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; margin: 32px 0 16px; clear: both; }
.closet-panel-img img { width: 100%; height: 100%; object-fit: cover; }
.closet-field-label { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }

/* Clases genéricas que closet.html asume — agregadas acá por las dudas
   de que no vivan en views.css (no lo tuve disponible). */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.db-empty { padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 14px; }
.lucia-loader { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 0; color: var(--ink-3); }
.lucia-loader-arcs { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: lucia-spin .8s linear infinite; }
@keyframes lucia-spin { to { transform: rotate(360deg); } }
.lucia-loader-label { font-size: 13px; }

/* ══ Íconos de marca en el selector — sesión julio 2026 ══ */
.ms-chip-icon, .ms-opt-icon {
  width: 18px; height: 18px; object-fit: contain; border-radius: 3px;
  flex-shrink: 0; background: var(--surface-2, #fff);
}
.ms-chip-icon { margin-right: 2px; }
.ms-opt-icon { margin-right: 2px; }

/* ══ Usuarios — multiselect de marcas + checklist de permisos (sesión agosto 2026) ══ */
.brand-multiselect {
  max-height: 180px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px;
}
.brand-ms-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  font-size: 13px; cursor: pointer; border-radius: var(--radius-sm);
}
.brand-ms-item:hover { background: var(--surface-2, var(--surface)); }
.perms-checklist { display: flex; flex-direction: column; gap: 8px; }
.perms-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* ══ Closet — total de set + filtro de precio (sesión agosto 2026) ══ */
.closet-tray-total { font-weight: 700; color: var(--accent-2); }
.closet-price-filter {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}

/* ══ Spinner chico de búsqueda — Catálogo (sesión agosto 2026) ══ */
.cat-search-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line, #e0ddd6); border-top-color: var(--accent-2, #333);
  animation: cat-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes cat-spin { to { transform: rotate(360deg); } }
