/* ════════════════════════════════════════════════════
   EL ÁNGULO · CENTRO DE CONTROL WEB
   Paleta: carbón profundo + lima industrial + blanco técnico
   Tipografía: Inter (UI) + JetBrains Mono (datos)
════════════════════════════════════════════════════ */

:root {
  --bg-base:      #0f1014;
  --bg-surface:   #181b20;
  --bg-elevated:  #1e2229;
  --bg-hover:     #252a33;
  --bg-active:    #2a3040;

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.1);
  --border-strong:  rgba(255,255,255,0.18);

  --text-primary:   #e8eaf0;
  --text-secondary: #8a92a0;
  --text-tertiary:  #545c6b;
  --text-data:      #c4cad6;

  --accent:         #a3e635;
  --accent-dim:     rgba(163,230,53,0.12);
  --accent-border:  rgba(163,230,53,0.3);

  --red:    #f87171;
  --amber:  #fbbf24;
  --green:  #4ade80;
  --blue:   #60a5fa;

  --red-dim:   rgba(248,113,113,0.1);
  --amber-dim: rgba(251,191,36,0.1);
  --green-dim: rgba(74,222,128,0.1);

  --sidebar-w: 220px;
  --topbar-h:  52px;
  --radius:    6px;
  --radius-lg: 10px;

  --font-ui:   'Inter', system-ui, sans-serif;
  --font-data: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT SHELL ── */
body { display: flex; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── SIDEBAR BRAND ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── NAV ── */
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 14px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-right: 2px solid var(--accent);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-data);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}

.nav-badge.pending { background: var(--amber-dim); color: var(--amber); border-color: rgba(251,191,36,0.2); }
.nav-badge.ready   { background: var(--green-dim);  color: var(--green);  border-color: rgba(74,222,128,0.2); }

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.status-dot.ok      { background: var(--green); box-shadow: 0 0 0 2px var(--green-dim); }
.status-dot.error   { background: var(--red); }
.status-dot.loading { background: var(--amber); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

.app-version { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-data); }

.health-countdown {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-data);
  text-align: center;
  letter-spacing: 0.03em;
  min-height: 14px;
  margin-bottom: 2px;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.health-countdown.running { opacity: 1; color: var(--amber); }

/* ── SEMÁFORO DE SISTEMA (sidebar footer) ── */
.sys-semaphore {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.sem-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.sem-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-default);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.sem-label { color: var(--text-tertiary); flex: 1; }
.sem-status {
  font-size: 10px; font-weight: 600;
  font-family: var(--font-data);
  letter-spacing: .04em;
}
/* States */
.sem-on  .sem-dot { background: #a3e635; box-shadow: 0 0 6px rgba(163,230,53,.6); }
.sem-on  .sem-label  { color: var(--text-secondary); }
.sem-on  .sem-status { color: #a3e635; }
.sem-off .sem-dot { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.4); }
.sem-off .sem-label  { color: var(--text-tertiary); }
.sem-off .sem-status { color: var(--red); }
.sem-warn .sem-dot { background: var(--amber); box-shadow: 0 0 6px rgba(251,191,36,.4); }
.sem-warn .sem-label  { color: var(--text-secondary); }
.sem-warn .sem-status { color: var(--amber); }

/* ── TIRA DE ESTADO EN TOPBAR ── */
.topbar-status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 12px;
}
.ts-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-data);
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  cursor: default;
  transition: all .25s;
  letter-spacing: .04em;
}
.ts-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-default);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.ts-on  { border-color: rgba(163,230,53,.4); color: #a3e635; background: rgba(163,230,53,.08); }
.ts-on  .ts-dot { background: #a3e635; box-shadow: 0 0 5px rgba(163,230,53,.7); }
.ts-off { border-color: rgba(239,68,68,.4); color: var(--red); background: rgba(239,68,68,.08); }
.ts-off .ts-dot { background: var(--red); box-shadow: 0 0 5px rgba(239,68,68,.5); }
.ts-warn { border-color: rgba(251,191,36,.4); color: var(--amber); background: rgba(251,191,36,.08); }
.ts-warn .ts-dot { background: var(--amber); }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-breadcrumb {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── VIEWS ── */
.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  flex-direction: column;
  gap: 20px;
}

.view.active { display: flex; }

.view-header { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.view-header-actions { display: flex; gap: 8px; margin-top: 2px; }
.view-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
.view-subtitle { font-size: 13px; color: var(--text-secondary); max-width: 640px; }
.force-enrich-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-tertiary); cursor: pointer;
  margin-left: auto; padding: 6px 10px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius);
  background: var(--bg-elevated); transition: border-color .15s, color .15s;
  white-space: nowrap; user-select: none;
}
.force-enrich-label:has(input:checked) {
  border-color: #f59e0b; color: #f59e0b;
  background: rgba(245,158,11,.08);
}
.force-enrich-label input { accent-color: #f59e0b; width: 14px; height: 14px; }

/* ── KPI BAR ── */
.kpi-bar {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.kpi-card {
  flex: 1;
  min-width: 130px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.kpi-card.accent { border-color: rgba(251,191,36,0.15); background: rgba(251,191,36,0.04); }
.kpi-card.ok     { border-color: rgba(74,222,128,0.2);  background: var(--green-dim); }

.kpi-value {
  font-size: 26px;
  font-weight: 600;
  font-family: var(--font-data);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-card.accent .kpi-value { color: var(--amber); }
.kpi-card.ok     .kpi-value { color: var(--green); }

.kpi-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── TABLE TOOLBAR ── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-left  { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.overwrite-toggle {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  font-size: 11px; color: var(--text-muted);
}
.overwrite-toggle:has(input:checked) {
  background: rgba(255,160,0,0.12);
  border-color: var(--amber, #f59e0b);
  color: var(--amber, #f59e0b);
  font-weight: 600;
}
.overwrite-toggle input { display: none; }

.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 6px 12px;
  width: 240px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.search-input::placeholder { color: var(--text-tertiary); }

.filter-group { display: flex; gap: 4px; }

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-ui);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn:hover  { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-border); }

.selection-count { font-size: 12px; color: var(--accent); font-weight: 500; }

/* ── COLUMN TOGGLE ── */
.col-toggle-wrapper { position: relative; }

.col-toggle-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.col-toggle-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
}

.col-toggle-dropdown label:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Columnas ocultables */
.col-hidden { display: none !important; }

/* ── DATA TABLE ── */
.table-container {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elevated);
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text-secondary); }
.data-table th.sorted-asc  .sort-icon::after { content: '↑'; }
.data-table th.sorted-desc .sort-icon::after { content: '↓'; }
.sort-icon { opacity: 0.5; margin-left: 4px; }

.th-check  { width: 36px; }
.th-actions { width: 80px; text-align: right; }

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-data);
  vertical-align: middle;
}

.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table tbody tr.selected td { background: var(--accent-dim); }
.data-table tbody tr.selected { --border-subtle: rgba(163,230,53,0.15); }

.data-table tbody tr:last-child td { border-bottom: none; }

/* Tipos de celda */
.cell-sku    { font-family: var(--font-data); font-size: 12px; color: var(--text-secondary); }
.cell-title  { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cell-brand  { font-size: 12px; }
.cell-ean    { font-family: var(--font-data); font-size: 11px; color: var(--text-secondary); }
.cell-price  { font-family: var(--font-data); font-weight: 500; text-align: right; }
.cell-stock  { font-family: var(--font-data); font-size: 12px; text-align: center; color: var(--text-secondary); }
.cell-cat    { font-size: 12px; color: var(--text-secondary); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-ok      { background: var(--green-dim);  color: var(--green);  }
.badge-warn    { background: var(--amber-dim);  color: var(--amber);  }
.badge-error   { background: var(--red-dim);    color: var(--red);    }
.badge-neutral { background: var(--bg-elevated); color: var(--text-tertiary); }

/* Row actions */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity var(--transition); }
tr:hover .row-actions { opacity: 1; }

.action-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }

/* Botones luminosos — encendido / apagado */
.action-btn.btn-on {
  border-color: currentColor;
  box-shadow: 0 0 4px currentColor;
  opacity: 1;
}
.action-btn.btn-dim {
  opacity: 0.22;
  cursor: default;
  box-shadow: none;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.action-btn.btn-dim:hover {
  background: none;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}
.btn-wo-enrich.btn-on  { color: #4ade80; }
.btn-dux-fetch.btn-on  { color: #7dd3fc; }
.btn-dev-json.btn-on   { color: #fbbf24; }
.btn-desc-preview.btn-on  { color: #a78bfa; }

.btn-dux-fetch { color: #7dd3fc; border-color: #1e4d6b; }
.btn-dux-fetch:hover { background: rgba(125,211,252,0.1); color: #7dd3fc; border-color: #7dd3fc; }

/* Inline edit — URL / EAN */
.btn-inline-edit { cursor: pointer; }
.btn-inline-edit:hover { opacity: 0.8; }
.inline-edit-wrap {
  display: inline-flex; align-items: center; gap: 4px;
  animation: fadeIn 0.15s ease;
}
.inline-edit-input {
  background: var(--surface-2, #2a2a3a);
  border: 1px solid var(--accent, #6c63ff);
  border-radius: 4px; color: var(--text, #eee);
  font-size: 11px; padding: 2px 6px;
  width: 180px; outline: none;
}
.inline-edit-input:focus { border-color: var(--accent-light, #9d97ff); }
.inline-edit-ok, .inline-edit-cancel {
  background: none; border: none; cursor: pointer;
  font-size: 13px; padding: 0 3px; line-height: 1;
}
.inline-edit-ok     { color: var(--green, #4ade80); }
.inline-edit-cancel { color: var(--red,   #f87171); }
.inline-edit-ok:hover     { opacity: 0.8; }
.inline-edit-cancel:hover { opacity: 0.8; }

/* ── SKU como link al Worker Test ───────────────────── */
.sku-link {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; font-weight: 600; font-size: .8rem;
  color: var(--accent-light, #9d97ff);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}
.sku-link:hover { color: var(--accent, #7c78d8); text-decoration: underline; }

/* ── Missing detail popover ─────────────────────────── */
.btn-missing-detail { cursor: pointer; border: none; font: inherit; padding: 2px 7px; border-radius: 4px; }
.missing-popover {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 220px;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: fadeIn .12s ease;
}
.missing-pop-title {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  margin-bottom: 8px;
}
.missing-pop-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border, #2a2a3e);
}
.missing-pop-row:last-child { border-bottom: none; }
.missing-pop-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.missing-pop-label { font-size: .82rem; font-weight: 500; color: var(--text, #e2e2f0); }
.missing-pop-hint  { font-size: .72rem; color: var(--text-muted, #888); margin-top: 1px; }

/* Cat picker popup */
.cat-picker-popup {
  position: absolute; z-index: 9999;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 8px; width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
  display: flex; flex-direction: column;
  animation: fadeIn .1s ease; overflow: hidden;
}
.cat-picker-header { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
.cat-picker-header .input-sm { flex: 1; }
.cat-picker-list { max-height: 280px; overflow-y: auto; }
.cat-picker-item {
  padding: 6px 10px; font-size: 12px; cursor: pointer;
  color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle,#2a2a3e);
  transition: background .1s;
}
.cat-picker-item:hover  { background: var(--bg-elevated); color: var(--text-primary); }
.cat-picker-item.active { color: var(--accent); font-weight: 600; }

/* Shipping cost popup */
.shipping-cost-popup {
  position: absolute; z-index: 9999;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 8px; min-width: 210px;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
  padding: 8px 0; animation: fadeIn .1s ease;
}
.scp-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); padding: 4px 12px 8px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.scp-row   { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: 12px; }
.scp-prov  { flex: 1; color: var(--text-secondary); }
.scp-cost  { font-weight: 600; color: var(--text-primary); font-family: var(--font-data); }
.scp-vol   { font-size: 10px; color: var(--warn); background: var(--warn)22; padding: 1px 4px; border-radius: 3px; }
.scp-note  { font-size: 10px; color: var(--text-muted); padding: 6px 12px 2px; border-top: 1px solid var(--border-subtle); margin-top: 4px; }

/* Ship icons junto al badge de peso */
.ship-icon { font-size: 12px; line-height: 1; cursor: default; margin-left: 2px; }
.ship-free  { filter: hue-rotate(0deg); }   /* moto verde nativa del emoji */
.ship-paid  { filter: grayscale(1) brightness(0.7) sepia(1) saturate(5) hue-rotate(330deg); }

/* Empty state */
.empty-row td { padding: 60px 24px; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-tertiary);
  text-align: center;
}
.empty-state p { margin: 0; }
.empty-hint { font-size: 12px; max-width: 420px; line-height: 1.6; }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.page-info { font-size: 12px; color: var(--text-secondary); font-family: var(--font-data); flex: 1; text-align: center; }
.page-size { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius); color: var(--text-secondary); font-size: 12px; padding: 4px 8px; cursor: pointer; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #111;
  border-color: transparent;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) { background: #b5f23d; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-danger {
  background: rgba(248,113,113,.12);
  color: #f87171;
  border: 1px solid rgba(248,113,113,.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.22); border-color: #f87171; }
.btn-danger:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.select-sm {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

/* ── IMPORT VIEW ── */
.import-drop-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.import-drop-zone:hover, .import-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}

.drop-label { font-size: 15px; font-weight: 500; }
.drop-hint  { font-size: 12px; color: var(--text-tertiary); }

.import-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.import-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.template-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.section-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.section-desc  { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }

/* ── ENRICH SCOPE BAR ── */
.enrich-scope-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
}
.enrich-scope-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: var(--text-tertiary); text-transform: uppercase; white-space: nowrap;
}
.enrich-scope-select {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 12px; padding: 5px 10px; cursor: pointer; min-width: 160px;
}
.enrich-scope-select:focus { outline: none; border-color: var(--accent); }
.enrich-scope-input {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 12px; padding: 5px 10px; flex: 1; min-width: 160px;
}
.enrich-scope-input:focus { outline: none; border-color: var(--accent); }
.enrich-scope-input::placeholder { color: var(--text-muted); }
.enrich-scope-count {
  margin-left: auto; font-size: 11px; color: var(--accent); font-weight: 600;
  white-space: nowrap; min-width: 80px; text-align: right;
}

/* ── VARIANTS CONFIG PANEL ── */
.variants-config-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px 20px 12px;
  margin-bottom: 16px;
}
.vcfg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 24px;
}
.vcfg-full { grid-column: 1 / -1; }
.vcfg-field { display: flex; flex-direction: column; gap: 6px; }
.vcfg-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .04em;
}
.vcfg-hint { font-weight: 400; color: var(--text-muted); text-transform: none; margin-left: 6px; }
.vcfg-row { display: flex; align-items: center; gap: 10px; }
.vcfg-slider { flex: 1; accent-color: var(--accent); }
.vcfg-val { font-size: 12px; color: var(--accent); font-family: var(--font-data); min-width: 60px; }
.vcfg-checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.vcfg-check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.vcfg-check-row em { color: var(--text-muted); font-style: normal; }
.vcfg-check-row input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.vcfg-footer {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* ── VARIANTS LOG ── */
#variants-log {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 12px;
  font-family: var(--font-data);
}

/* ── VARIANT GROUP CARDS ── */
.vgroup-list {
  display: flex; flex-direction: column; gap: 10px;
}
.vgroup-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .15s;
}
.vgroup-card.conf-high  { border-left: 3px solid var(--ok); }
.vgroup-card.conf-medium { border-left: 3px solid #f59e0b; }
.vgroup-card.conf-low   { border-left: 3px solid var(--text-muted); }
.vgroup-card.dismissed  { opacity: .4; }
.vgroup-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: default;
}
.vgroup-header .vgroup-conf-badge,
.vgroup-header .vgroup-meta { cursor: pointer; }
.vgroup-title-input {
  background: transparent; border: none; border-bottom: 1px dashed transparent;
  color: var(--text-primary); font-size: 13px; font-weight: 600;
  font-family: inherit; flex: 1; padding: 0 4px; min-width: 0;
  cursor: text;
}
.vgroup-title-input:hover { border-bottom-color: var(--border-subtle); }
.vgroup-title-input:focus {
  outline: none; border-bottom-color: var(--accent);
  background: var(--bg-elevated); border-radius: 3px 3px 0 0; padding: 0 6px;
}
.vgroup-select-check {
  width: 15px; height: 15px; cursor: pointer; flex-shrink: 0;
  accent-color: var(--accent);
}
.vgroup-merge-toolbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 10px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 200;
  font-size: 13px; color: var(--text-primary);
}
.vgroup-conf-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 10px; text-transform: uppercase;
}
.vgroup-conf-badge.high   { background: rgba(163,230,53,.15); color: var(--ok); }
.vgroup-conf-badge.medium { background: rgba(245,158,11,.15); color: #f59e0b; }
.vgroup-conf-badge.low    { background: rgba(120,120,120,.15); color: var(--text-muted); }
.vgroup-title {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vgroup-meta {
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.vgroup-body {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 14px;
}
.vgroup-property-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.vgroup-property-label {
  font-size: 11px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase;
}
.vgroup-property-input {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 12px; padding: 4px 8px; width: 120px;
}
.vgroup-property-unit {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); color: var(--text-secondary);
  font-size: 12px; padding: 4px 8px; width: 60px;
}
.vgroup-property-input:focus,
.vgroup-property-unit:focus { outline: none; border-color: var(--accent); }
.vgroup-sources {
  font-size: 10px; color: var(--text-muted); margin-left: auto;
}
.vgroup-source-chip {
  display: inline-block; background: var(--bg-elevated);
  border-radius: 4px; padding: 1px 5px; margin: 0 2px;
  font-size: 10px; color: var(--text-tertiary);
}
.vgroup-members-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
  font-family: var(--font-data); margin-bottom: 10px;
}
.vgroup-members-table th {
  background: var(--bg-elevated); color: var(--text-muted);
  padding: 4px 8px; text-align: left; font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border-subtle);
}
.vgroup-members-table td {
  padding: 4px 8px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.vgroup-members-table tr:last-child td { border-bottom: none; }
.vgroup-row-excluded td { opacity: .4; text-decoration: line-through; }
.vgroup-row-excluded td:first-child { text-decoration: none; opacity: 1; }
.vgroup-cell-sku { font-family: var(--font-data); font-size: 11px; white-space: nowrap; }
.vgroup-url-link {
  color: var(--accent); font-size: 11px; text-decoration: none;
  padding: 1px 5px; border: 1px solid var(--accent); border-radius: 3px;
  white-space: nowrap;
}
.vgroup-url-link:hover { background: var(--accent); color: #000; }
.vgroup-exclude-check { cursor: pointer; width: 14px; height: 14px; }
.vgroup-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.vgbtn-alt {
  background: rgba(96,165,250,.12); color: #60a5fa;
  border: 1px solid rgba(96,165,250,.35);
}
.vgbtn-alt:hover { background: rgba(96,165,250,.25); }
.vgbtn-comp {
  background: rgba(167,139,250,.12); color: #a78bfa;
  border: 1px solid rgba(167,139,250,.35);
}
.vgbtn-comp:hover { background: rgba(167,139,250,.25); }
.vgbtn-reject { opacity: .7; }
.vgbtn-reject:hover { opacity: 1; }
.vgbtn-split {
  background: rgba(251,191,36,.1); color: #fbbf24;
  border: 1px solid rgba(251,191,36,.35);
}
.vgbtn-split:hover { background: rgba(251,191,36,.25); }

/* ── STATUS TABS (Pendientes / Variantes / Alternativos / Complementarios) ── */
.vgroup-status-bar {
  display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap;
}
.vstab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.vstab:hover { border-color: var(--accent); color: var(--text-primary); }
.vstab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.vstab-count {
  background: rgba(255,255,255,.15); border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
}
.vstab.active .vstab-count { background: rgba(0,0,0,.2); }

/* Badge de tipo dentro de card confirmada */
.vstab-badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.vstab-badge-variant     { background: rgba(163,230,53,.15); color: var(--accent); border: 1px solid rgba(163,230,53,.3); }
.vstab-badge-alternative { background: rgba(96,165,250,.15);  color: #60a5fa;      border: 1px solid rgba(96,165,250,.3); }
.vstab-badge-complementary { background: rgba(192,132,252,.15); color: #c084fc;    border: 1px solid rgba(192,132,252,.3); }

/* Cards confirmadas (readonly) */
.vgroup-card-confirmed { opacity: .95; }
.vgroup-card-confirmed .vgroup-header { cursor: pointer; }
.vgroup-title-confirmed {
  font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1;
}
.vconf-prop {
  font-size: 11px; color: var(--text-secondary);
  background: var(--bg-elevated); border-radius: 6px; padding: 2px 8px;
}
.vgbtn-reopen {
  border-color: var(--border-subtle); font-size: 11px; padding: 3px 10px; opacity: .7;
}
.vgbtn-reopen:hover { opacity: 1; border-color: var(--accent); }
.vgbtn-preview {
  border-color: var(--border-subtle); font-size: 11px; padding: 3px 10px;
  color: var(--text-secondary);
}
.vgbtn-preview:hover { border-color: #60a5fa; color: #60a5fa; }

/* ── MODAL TN PREVIEW (fullscreen) ── */
#modal-tn-preview { align-items: stretch; justify-content: stretch; padding: 0; }
.tn-preview-box {
  width: 100%; height: 100%; max-height: 100vh; border-radius: 0;
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
}
.tn-preview-box .modal-header {
  padding: 14px 24px; border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: var(--bg-surface);
}
.tn-preview-layout {
  display: grid; grid-template-columns: 300px 1fr;
  flex: 1; overflow: hidden;
}

/* Columna imagen */
.tn-img-col {
  padding: 24px 20px; border-right: 1px solid var(--border-subtle);
  background: var(--bg-elevated); overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.tn-img-placeholder {
  width: 100%; aspect-ratio: 1; border-radius: 10px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tn-img-placeholder img { width: 100%; height: 100%; object-fit: contain; }
.tn-no-img { font-size: 13px; color: var(--text-muted); }
.tn-img-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.tn-thumb {
  width: 48px; height: 48px; border-radius: 7px; border: 2px solid var(--border-subtle);
  background: var(--bg-surface); overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color .15s;
}
.tn-thumb img { width: 100%; height: 100%; object-fit: contain; }
.tn-thumb.active { border-color: var(--accent); }
.tn-thumb:hover { border-color: var(--text-secondary); }
.tn-thumb-label { font-size: 9px; color: var(--text-muted); text-align: center; padding: 2px; line-height: 1.2; }
.tn-thumb-more { color: var(--text-muted); font-size: 11px; }

/* Panel de completitud */
.tn-completeness {
  background: var(--bg-surface); border-radius: 8px; padding: 14px;
  border: 1px solid var(--border-subtle);
}
.tn-comp-title { font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.tn-comp-row { display: flex; align-items: center; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle); }
.tn-comp-row:last-child { border-bottom: none; }
.tn-comp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tn-comp-dot.ok   { background: var(--accent); }
.tn-comp-dot.miss { background: #fbbf24; }
.tn-comp-label { font-size: 12px; color: var(--text-primary); flex: 1; }
.tn-comp-fix { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* Columna info */
.tn-info-col {
  padding: 32px 36px 24px; display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
.tn-product-brand { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.tn-product-title { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.3; margin: 0; }
.tn-product-price { font-size: 30px; font-weight: 800; color: var(--accent); }
.tn-product-price.tn-miss { font-size: 14px; color: #fbbf24; font-weight: 500; }
.tn-section-sep { height: 1px; background: var(--border-subtle); }

.tn-prop-label { font-size: 12px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; }
.tn-prop-unit { font-weight: 400; color: var(--text-muted); }
.tn-options-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tn-opt-btn {
  padding: 8px 16px; border-radius: 7px; border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-primary); font-size: 13px;
  cursor: pointer; transition: all .12s; font-family: inherit; font-weight: 500;
}
.tn-opt-btn:hover  { border-color: var(--accent); color: var(--accent); }
.tn-opt-btn.selected {
  border-color: var(--accent); background: rgba(163,230,53,.12);
  color: var(--accent); font-weight: 700;
}

.tn-variant-detail {
  background: var(--bg-elevated); border-radius: 8px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border-subtle);
}
.tn-detail-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.tn-detail-row > span:first-child { color: var(--text-muted); min-width: 80px; }
.tn-detail-row strong { color: var(--text-primary); font-weight: 600; }
.tn-chip-warn {
  font-size: 11px; padding: 2px 10px; border-radius: 10px;
  background: rgba(251,191,36,.15); color: #fbbf24; border: 1px solid rgba(251,191,36,.3);
}

/* Descripción */
.tn-desc-label { font-size: 12px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; }
.tn-description {
  font-size: 13px; color: var(--text-primary); line-height: 1.65;
  max-height: 180px; overflow-y: auto; padding: 12px 14px;
  background: var(--bg-elevated); border-radius: 8px; border: 1px solid var(--border-subtle);
}
.tn-desc-missing {
  font-size: 13px; color: var(--text-muted); padding: 12px 14px;
  background: var(--bg-elevated); border-radius: 8px; border: 1px dashed var(--border-subtle);
  display: flex; align-items: center; gap: 10px;
}

/* Footer */
.tn-preview-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-subtle);
}
.tn-ready-badge {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 10px;
}
.tn-ready-badge.ready    { background: rgba(163,230,53,.15); color: var(--accent); border: 1px solid rgba(163,230,53,.3); }
.tn-ready-badge.notready { background: rgba(251,191,36,.12); color: #fbbf24;       border: 1px solid rgba(251,191,36,.3); }

/* ── PIPELINE CARD ── */
.pipeline-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(163,230,53,.05) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 4px;
  display: flex; flex-direction: column; gap: 14px;
}
.pipeline-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pipeline-title { font-size: 15px; font-weight: 700; color: var(--accent); }
.pipeline-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.pipeline-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.pipeline-steps {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pipeline-step {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px;
  color: var(--text-primary); transition: border-color .15s;
  user-select: none;
}
.pipeline-step:has(.pipe-check:checked) { border-color: var(--accent); }
.pipeline-step .pipe-check { accent-color: var(--accent); }
.pipe-label { display: flex; flex-direction: column; }
.pipe-sub { font-size: 10px; color: var(--text-muted); }
.pipe-arrow { color: var(--text-muted); font-size: 16px; }
.pipe-status { font-size: 11px; font-weight: 600; margin-left: 4px; }
.pipe-status.running { color: var(--warn); }
.pipe-status.done    { color: var(--accent); }
.pipe-status.error   { color: var(--error); }
.pipeline-progress { display: flex; flex-direction: column; gap: 4px; padding: 10px 0 6px; }
.pipe-prog-step { font-size: 12px; color: var(--text-secondary); min-width: 140px; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── DETAIL ENRICH PROGRESS ── */
.detail-enrich-progress {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
  padding: 8px; background: var(--bg-elevated); border-radius: 6px;
}
.dep-step {
  font-size: 11px; padding: 2px 8px;
  background: var(--bg-base); border-radius: 10px;
  color: var(--text-muted); white-space: nowrap;
}
.dep-step.running { color: var(--warn); }
.dep-step.done    { color: var(--accent); background: rgba(163,230,53,.1); }
.dep-step.skip    { color: var(--text-muted); opacity: .5; }
.dep-step.error   { color: var(--error); }

/* ── ENRICH DIFF MODAL ── */
.enrich-diff-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.enrich-diff-overlay.open { opacity: 1; pointer-events: all; }
.enrich-diff-dialog {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: 16px; width: min(900px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.enrich-diff-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
  background: linear-gradient(135deg, color-mix(in srgb, #4facfe 6%, transparent), transparent);
}
.enrich-diff-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  background: linear-gradient(90deg, #4facfe, #c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.enrich-diff-sku {
  font-size: 11px; font-family: monospace; color: var(--text-secondary);
  margin-top: 3px; max-width: 600px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Chips de resumen de campos */
.enrich-diff-summary-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated); flex-shrink: 0;
}
.diff-summary-chip {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, #4facfe 20%, transparent), color-mix(in srgb, #c084fc 20%, transparent));
  border: 1px solid color-mix(in srgb, #4facfe 30%, transparent);
  color: #4facfe;
}

.enrich-diff-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.enrich-diff-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--border-subtle); flex-shrink: 0;
}

/* Bloque de campo */
.diff-field-block {
  border: 1px solid var(--border-subtle); border-radius: 10px; overflow: hidden;
}
.diff-field-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle);
}
.diff-check      { accent-color: #4facfe; flex-shrink: 0; }
.diff-field-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-primary); }
.diff-field-meta { font-size: 10px; color: var(--text-tertiary); margin-left: auto; }
.diff-field-source { font-size: 10px; color: var(--text-tertiary); margin-left: auto;
  background: var(--bg-hover); padding: 1px 6px; border-radius: 4px; }

/* Grid simple (EAN, título, etc.) */
.diff-simple-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 0;
  padding: 12px;
}
.diff-arrow { font-size: 16px; color: var(--text-tertiary); padding: 20px 10px 0; align-self: start; }

/* Grid descripción */
.diff-desc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.diff-desc-col { padding: 12px; }
.diff-desc-col:first-child { border-right: 1px solid var(--border-subtle); }

.diff-col-label   { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.diff-label-before { color: #ef4444; }
.diff-label-after  { color: #4facfe; }

.diff-before {
  font-size: 12px; color: var(--text-tertiary);
  background: color-mix(in srgb, #ef4444 6%, transparent);
  border-radius: 6px; padding: 8px 10px;
  white-space: pre-wrap; line-height: 1.5;
}
.diff-after {
  font-size: 12px; color: var(--text-primary);
  background: color-mix(in srgb, #4facfe 6%, transparent);
  border-radius: 6px; padding: 8px 10px;
  white-space: pre-wrap; line-height: 1.5;
}

/* Preview de descripción HTML */
.diff-desc-before { max-height: 120px; overflow-y: auto; font-style: italic; }
.diff-desc-preview {
  max-height: 380px; overflow-y: auto;
  font-size: 12px; line-height: 1.7; color: var(--text-primary);
  background: color-mix(in srgb, #4facfe 5%, transparent);
  border-radius: 6px; padding: 10px 12px;
}
.diff-desc-preview h1,.diff-desc-preview h2,.diff-desc-preview h3 {
  font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 8px 0 4px;
}
.diff-desc-preview p  { margin: 4px 0; }
.diff-desc-preview ul,.diff-desc-preview ol { margin: 4px 0; padding-left: 18px; }
.diff-desc-preview li { margin: 2px 0; }
.diff-desc-preview strong { color: #4facfe; font-weight: 600; }

/* ── ENRICH VIEW ── */
.enrich-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  flex-shrink: 0;
}

.enrich-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enrich-icon svg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.enrich-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.enrich-count { font-size: 12px; color: var(--text-secondary); }
.enrich-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.enrich-option { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }

.progress-bar-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.progress-label { font-family: var(--font-data); font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* Worker card */
.enrich-card-worker { border-color: var(--accent-alt, #7c6eff); }

/* Drag handle */
.enrich-drag-handle {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 16px;
  color: var(--text-muted, #555);
  cursor: grab;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
}
.enrich-card { position: relative; }
.enrich-card:hover .enrich-drag-handle { opacity: 1; }
.enrich-card[draggable="true"] { cursor: default; }
.enrich-card[draggable="true"].drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent)44;
  transform: scale(1.01);
}
.enrich-card[draggable="true"].dragging {
  opacity: 0.4;
}

/* Test Worker card */
.enrich-card-wtest {
  border-color: #f59e0b55;
  background: linear-gradient(135deg, var(--bg-surface) 0%, #1a1608 100%);
}
.enrich-icon-wtest svg { stroke: #f59e0b; }
.btn-wtest {
  background: #78350f;
  border: 1px solid #f59e0b;
  color: #fcd34d;
  display: flex; align-items: center; gap: 5px;
  font-weight: 600;
}
.btn-wtest:hover { background: #92400e; }
.enrich-controls-wtest { flex-wrap: nowrap; }

/* Worker Test Trigger */
.worker-test-trigger { flex-shrink: 0; }

/* modal-overlay base (compartido por varios modales) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
}
#modal-worker-test { padding: 0; align-items: stretch; justify-content: stretch; }

/* Worker Test Modal fullscreen */
/* ── Test Worker /enrich — layout ── */
.wtp-modal {
  width: 100%; height: 100%;
  background: var(--bg-surface);
  display: flex; flex-direction: column;
  border-radius: 0;
}

/* Barra de título */
.wtp-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.wtp-title { font-size: 13px; font-weight: 700; color: var(--text-primary); letter-spacing: .02em; }
.wtp-close { flex-shrink: 0; }

/* Barra de inputs */
.wtp-inputbar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: nowrap;
  padding: 10px 20px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.wtp-field { display: flex; flex-direction: column; gap: 3px; }
.wtp-field label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.wtp-field-url { flex: 1; min-width: 0; }
.wtp-field-url input { width: 100% !important; }
.wtp-field-inline { justify-content: flex-end; padding-bottom: 4px; }
.wtp-run-btn { align-self: flex-end; flex-shrink: 0; }

/* Body — 3 columnas */
.wtp-body {
  display: grid;
  grid-template-columns: 200px 280px 1fr;
  flex: 1; overflow: hidden; min-height: 0;
}

/* Col imagen */
.wtp-col-img {
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; overflow-y: auto;
  background: var(--bg-base);
  position: relative;
}
.wtp-img-area { overflow-y: auto; }
.wtp-img-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); font-size: 12px;
}
.wtp-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; font-size: 12px; color: var(--text-secondary);
  background: var(--bg-base);
}

/* Col info producto */
.wtp-col-info {
  border-right: 1px solid var(--border-subtle);
  padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.wtp-info-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-tertiary); text-align: center; padding: 20px;
}
.wtp-product-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  line-height: 1.4; padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Chips de campos */
.wtp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wtp-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
}
.wtp-chip-ok   { background: #0d2b1a; border-color: #22c55e33; color: #4ade80; }
.wtp-chip-miss { background: var(--bg-elevated); border-color: var(--border-subtle); color: var(--text-tertiary); }
.wtp-chip-dot  { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.wtp-chip-ok   .wtp-chip-dot { background: #4ade80; }
.wtp-chip-miss .wtp-chip-dot { background: #444; }

/* KPIs */
.wtp-kpis {
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 0; border-top: 1px solid var(--border-subtle);
}
.wtp-kpi-row {
  display: flex; align-items: baseline; gap: 8px; font-size: 12px;
}
.wtp-kpi-label { color: var(--text-secondary); min-width: 70px; flex-shrink: 0; }
.wtp-kpi-val   { color: var(--text-primary); font-family: var(--font-data); font-weight: 500; }
.wtp-kpi-nil   { color: var(--text-tertiary); }

/* Col tabs */
.wtp-col-tabs { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wtp-tabs-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* Footer */
.wtp-modal-footer {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

/* Shared */
.wtp-check-label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* Tabs */
.wtp-result-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-subtle); padding: 0 16px; flex-shrink: 0; }
.wtp-rtab {
  padding: 5px 14px; font-size: 12px; border: none; background: none;
  color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.wtp-rtab:hover  { color: var(--text-primary); }
.wtp-rtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.wtp-tab-content { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }

/* Semáforo precio vs ML */
.wtest-price-semaforo-wrap { margin: 0; }
.wtest-semaforo {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-md);
  font-size: 12px; border: 1px solid transparent;
}
.wtest-semaforo-green  { background: #0d2b1a; border-color: #22c55e44; }
.wtest-semaforo-yellow { background: #2a2400; border-color: #eab30844; }
.wtest-semaforo-red    { background: #2b0d0d; border-color: #ef444444; }
.wtest-semaforo-blue   { background: #0d1f2b; border-color: #3b82f644; }
.wtest-sem-icon  { font-size: 18px; flex-shrink: 0; }
.wtest-sem-detail { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.wtest-sem-label  { color: var(--text-primary); font-weight: 600; }
.wtest-sem-prices { color: var(--text-secondary); font-family: var(--font-data); }
.wtest-rep   { background: var(--bg-elevated); border-radius: 3px; padding: 1px 5px; margin-left: 4px; font-size: 10px; color: var(--accent); }
.wtest-ml-link { color: var(--accent); text-decoration: none; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.wtest-ml-link:hover { text-decoration: underline; }

/* Imagen grid */
.wtest-img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.wtest-img-wrap { width: 80px; height: 80px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.wtest-img      { width: 100%; height: 100%; object-fit: contain; }

/* Logger del Test Worker */
.wtest-logger-wrap     { margin-top: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-base); overflow: hidden; }
.wtest-logger-header   { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); }
.wtest-logger-title    { font-size: 11px; font-weight: 600; color: var(--text-secondary); letter-spacing: .04em; }
.wtest-log-output      { font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.5; padding: 8px 10px; min-height: 60px; max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.wlog-row              { display: flex; gap: 6px; padding: 1px 0; }
.wlog-ts               { color: var(--text-muted, #555); white-space: nowrap; flex-shrink: 0; }
.wlog-msg              { color: var(--text-primary); word-break: break-all; }
.wlog-row.info  .wlog-msg { color: var(--text-primary); }
.wlog-row.ok    .wlog-msg { color: #4ade80; }
.wlog-row.warn  .wlog-msg { color: #fbbf24; }
.wlog-row.error .wlog-msg { color: #f87171; }
.wlog-row.dim   .wlog-msg { color: var(--text-secondary); font-style: italic; }
.wlog-row.tokens .wlog-msg { color: #a78bfa; }

/* Botón IA dimensiones */
.btn-ai-dims-styled {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d1b69 100%);
  border: 1px solid #6366f1;
  color: #c4b5fd;
  font-weight: 600;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; gap: 5px;
}
.btn-ai-dims-styled:hover   { border-color: #818cf8; color: #e0d9ff; box-shadow: 0 0 8px #6366f155; }
.btn-ai-dims-styled:active  { transform: scale(.97); }
.btn-ai-dims-styled:disabled { opacity: .5; cursor: not-allowed; }

/* Panel de dimensiones manual */
.wtest-dims-panel { padding: 8px 2px; }
.wtest-dims-info  { font-size: 11px; color: var(--text-secondary); margin-bottom: 10px; }
.wtest-dims-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.wtest-dims-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-secondary); }
.wtest-dims-grid input { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 13px; width: 100%; }
.wtest-dims-grid input:focus { outline: none; border-color: var(--accent); }
.wtest-dims-calc  { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; color: var(--text-secondary); min-height: 36px; }
.wtest-tab-btn-warn::after { content: ' ⚠'; color: #f59e0b; font-size: 10px; }

/* Estimación de envío en dims tab */
.wtest-shipping-wrap    { margin-top: 12px; border: 1px solid #1e3a1e; border-radius: var(--radius-md); overflow: hidden; }
.wtest-shipping-title   { background: #0d1f0d; padding: 6px 10px; font-size: 11px; font-weight: 600; color: #86efac; letter-spacing: .4px; display: flex; align-items: center; gap: 8px; }
.wtest-prov-sel         { margin-left: auto; background: #0a1a0a; border: 1px solid #22c55e44; border-radius: 4px; color: #86efac; font-size: 11px; padding: 2px 6px; cursor: pointer; }
.wtest-prov-sel:focus   { outline: none; border-color: #22c55e; }
.wtest-shipping-estimate{ padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.wtest-ship-row         { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.wtest-ship-label       { color: var(--text-secondary); min-width: 130px; }
.wtest-ship-val         { color: var(--text-primary); font-weight: 600; }
.wtest-ship-val.warn    { color: #fbbf24; }
.wtest-ship-note        { font-size: 10px; color: var(--text-tertiary); }
.wtest-ship-highlight   { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.wtest-ship-highlight .wtest-ship-label { color: #86efac; }
.wtest-ship-highlight .wtest-ship-val   { color: #4ade80; font-size: 15px; }

/* Config subsección logística */
.config-subsection        { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.config-subsection-title  { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.config-hint              { font-size: 11px; color: var(--text-tertiary); margin: 0 0 10px; line-height: 1.5; }
.field-hint               { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.field-hint-warn          { color: #fb923c; font-weight: 600; }

/* Cálculo de umbral envío gratis */
.config-calc-box   { background: #0d1f0d; border: 1px solid #22c55e33; border-radius: var(--radius-md); padding: 10px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 5px; min-width: 280px; }
.cfg-fc-conditions  { background: #0d1a2d; border: 1px solid #3b82f633; border-radius: 4px; padding: 6px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.cfg-fc-cond-title  { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .4px; }
.cfg-fc-cond-val    { font-size: 12px; color: #93c5fd; font-weight: 600; }
.cfg-fc-header      { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4; }
.cfg-fc-header b    { color: #86efac; }
.cfg-fc-ok          { color: #4ade80; font-weight: 600; }
.cfg-fc-no          { color: #f87171; font-size: 10px; }
.cfg-fc-row-warn td { opacity: .5; }

/* Editor de provincias */
.cfg-prov-table            { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.cfg-prov-table thead th   { text-align: left; color: var(--text-tertiary); font-weight: 500; padding: 3px 6px; border-bottom: 1px solid var(--border); font-size: 10px; text-transform: uppercase; }
.cfg-prov-table tbody tr   { border-bottom: 1px solid #ffffff08; }
.cfg-prov-table tbody tr:hover { background: #ffffff05; }
.cfg-prov-table td         { padding: 3px 6px; vertical-align: middle; }
.cfg-prov-table .field-input { padding: 3px 7px; font-size: 12px; }
.btn-prov-del              { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 3px; }
.btn-prov-del:hover        { background: #ef444422; color: #f87171; }

.cfg-fc-table      { width: 100%; border-collapse: collapse; font-size: 12px; }
.cfg-fc-table th   { color: var(--text-tertiary); font-weight: 600; text-align: left; padding: 3px 6px 5px; border-bottom: 1px solid #22c55e22; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.cfg-fc-table td   { padding: 4px 6px; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.cfg-fc-table tr:last-child td { border-bottom: none; }
.cfg-fc-highlight  { color: #4ade80 !important; font-weight: 700; }
.cfg-fc-note       { font-size: 10px; color: var(--text-tertiary); border-top: 1px solid #22c55e22; padding-top: 6px; margin-top: 6px; line-height: 1.4; }

/* Specs table */
.wtest-specs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.wtest-specs-table tr:nth-child(even) { background: var(--bg-elevated); }
.wtest-spec-key { color: var(--text-secondary); padding: 3px 10px 3px 4px; width: 40%; vertical-align: top; }
.wtest-spec-val { color: var(--text-primary);   padding: 3px 4px; font-family: var(--font-data); }

/* Raw JSON */
.wtest-raw {
  background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 10px; font-size: 11px; font-family: var(--font-data); color: var(--text-secondary);
  max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* Actions */
.wtp-actions { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.wtp-save-label { font-size: 11px; color: var(--text-secondary); flex: 1; }

/* Imagen wrap con URL */
.wtest-img-wrap { display: flex; flex-direction: column; gap: 3px; }
.wtest-img-url  { font-size: 9px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px; }

/* Descripción */
.wtest-desc      { overflow-y: auto; }
.wtest-desc-text { font-size: 13px; line-height: 1.6; color: var(--text-primary); white-space: pre-wrap; }
.wtest-desc-rendered { font-size: 13px; line-height: 1.7; color: var(--text-primary); }
.wtest-desc-rendered p { margin: 0 0 8px; }
.wtest-desc-rendered br { display: block; content: ''; margin: 2px 0; }
.wtest-desc-rendered strong, .wtest-desc-rendered b { color: #f1f5f9; }
.wtest-tn-preview { font-size: 12px; line-height: 1.6; color: var(--text-primary); padding: 8px 0; border-bottom: 1px solid var(--border-color); margin-bottom: 8px; max-height: 220px; overflow-y: auto; }
.wtest-tn-html { width: 100%; height: 140px; font-size: 11px; font-family: monospace; background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 6px; resize: vertical; }
/* Carousel de imágenes */
.wtest-carousel    { display: flex; flex-direction: column; gap: 8px; padding: 10px; box-sizing: border-box; }
.wtest-car-main    { width: 100%; min-height: 200px; max-height: 340px; background: var(--bg-elevated); border-radius: var(--radius-md); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.wtest-car-img     { max-width: 100%; max-height: 100%; object-fit: contain; }
.wtest-car-nav     { display: flex; align-items: center; justify-content: center; gap: 12px; flex-shrink: 0; }
.wtest-car-counter { font-size: 12px; color: var(--text-secondary); min-width: 40px; text-align: center; }
.wtest-car-thumbs  { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.wtest-car-thumb   { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; opacity: .7; transition: all .15s; }
.wtest-car-thumb:hover { opacity: 1; }
.wtest-car-thumb.active { border-color: var(--accent); opacity: 1; }
.enrich-worker-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.wleg { font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--bg-elevated); color: var(--text-secondary); }
.worker-last-result { padding: 8px; background: var(--bg-elevated); border-radius: var(--radius-md); }
.worker-result-summary { display: flex; gap: 12px; font-size: 12px; font-family: var(--font-data); }
.wr-ok  { color: var(--ok,  #4ade80); }
.wr-err { color: var(--error, #f87171); }
.wr-img { color: var(--text-secondary); }

.enrich-log-section { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }

.enrich-log {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-data);
  font-size: 12px;
  overflow-y: auto;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── LOG ENTRIES ── */
.log-entry { padding: 2px 0; line-height: 1.6; }
.log-debug   { color: var(--text-tertiary); font-size: 11px; }
.log-info    { color: var(--text-secondary); }
.log-success { color: var(--green); }
.log-warn    { color: var(--amber); }
.log-error   { color: var(--red); }

.log-viewer {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-data);
  font-size: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── CATEGORIES VIEW ── */
.categories-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ── Recategorización IA ── */
.recat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.recat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.recat-kpis {
  display: flex;
  gap: 20px;
}
.recat-kpi { text-align: center; }
.recat-kpi-val { font-size: 22px; font-weight: 700; font-family: var(--font-data); color: var(--accent); }
.recat-kpi-lbl { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
.recat-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.recat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.recat-log {
  max-height: 320px;
  overflow-y: auto;
  padding: 10px 16px;
  font-size: 12px;
  font-family: var(--font-data);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.recat-row { display: flex; gap: 8px; align-items: baseline; }
.recat-row .recat-sku { color: var(--text-secondary); min-width: 180px; flex-shrink: 0; }
.recat-row .recat-cats { color: var(--accent); }
.recat-row .recat-skip { color: var(--text-tertiary); font-style: italic; }
.recat-row .recat-warn { color: var(--warn); }
.recat-row .recat-conf { font-size: 10px; color: var(--text-tertiary); }

.cat-tree-panel, .cat-products-panel {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.panel-badge {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: var(--font-data);
  padding: 1px 7px;
  border-radius: 99px;
}

.cat-tree, .cat-products-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.empty-state-small {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 20px;
  text-align: center;
}

/* ── APPLY VIEW ── */
.apply-plan { flex: 1; }
.empty-state-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  text-align: center;
}
.empty-state-card p { margin: 0; font-size: 14px; }

/* ── CONFIG VIEW ── */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.config-grid-2col { grid-template-columns: 1fr 1fr; align-items: start; }
.config-col { display: flex; flex-direction: column; gap: 16px; }
.config-col-full { grid-column: 1 / -1; }
@media (max-width: 860px) { .config-grid-2col { grid-template-columns: 1fr; } }

.config-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; position: relative; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.field-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.field-input::placeholder { color: var(--text-tertiary); }

.field-toggle-vis {
  position: absolute;
  right: 10px;
  bottom: 8px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px;
}

.field-toggle-vis svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

.connection-test-result {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-top: -4px;
}

.connection-test-result.ok    { background: var(--green-dim); color: var(--green); }
.connection-test-result.error { background: var(--red-dim);   color: var(--red); }

/* ── DETAIL PANEL (slideover) ── */
.detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.detail-panel.open { right: 0; }
.detail-panel.fullscreen { right: 0; width: 100vw; max-width: 100vw; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.detail-sku { font-family: var(--font-data); font-size: 12px; color: var(--accent); }

.detail-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
}

.detail-close svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.detail-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.detail-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.detail-title { font-size: 16px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }

.detail-fields { display: flex; flex-direction: column; gap: 10px; }

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-field-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); }
.detail-field-value { font-size: 13px; color: var(--text-data); font-family: var(--font-data); }

/* ── Slug editor ── */
.detail-field-full { margin-top: 10px; }
.detail-slug-wrap {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-base); border: 1px solid var(--border-default);
  border-radius: 6px; overflow: hidden; margin-top: 4px;
}
.detail-slug-prefix {
  font-size: 11px; color: var(--text-muted); padding: 6px 8px;
  white-space: nowrap; background: var(--bg-elevated);
  border-right: 1px solid var(--border-default);
  flex-shrink: 0;
}
.detail-slug-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--accent); font-size: 12px; font-family: monospace;
  padding: 6px 8px; min-width: 0;
}
.detail-slug-auto { border-radius: 0; border-left: 1px solid var(--border-default); flex-shrink: 0; }
.detail-slug-hint { font-size: 11px; margin-top: 3px; height: 14px; }

/* ── PESO & DIMENSIONES ────────────────────────────────────── */
.detail-dim-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 8px 0;
}
.dim-item { display: flex; flex-direction: column; gap: 2px; }
.dim-label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .05em; }
.dim-val   { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.dim-warn  { font-size: 12px; color: var(--warn); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dim-ok    { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.dim-fetch-status {
  font-size: 12px; padding: 5px 8px; border-radius: 4px; margin-top: 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.dim-fetch-status.running { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.dim-fetch-status.done    { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.dim-fetch-status.skip    { background: color-mix(in srgb, var(--text-muted) 10%, transparent); color: var(--text-muted); }
.dim-fetch-status.error   { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }

/* ── BADGE DE PESO EN GRILLA ───────────────────────────────── */
.w-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  white-space: nowrap;
}
.w-badge-ok      { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.w-badge-warn    { background: color-mix(in srgb, #f5c518 18%, transparent); color: #f5c518; }
.w-badge-heavy   { background: color-mix(in srgb, #ff8c00 18%, transparent); color: #ff8c00; }
.w-badge-crit    { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.w-badge-unknown { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

.detail-description-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  min-height: 180px;
  max-height: 340px;
  overflow-y: auto;
  margin-top: 8px;
}
.detail-description-preview .tn-section-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin: 10px 0 4px;
}
.detail-description-preview .tn-spec-row {
  display: flex; gap: 8px; font-size: 12px; padding: 2px 0;
}
.detail-description-preview .tn-spec-key { color: var(--text-tertiary); min-width: 120px; }
.detail-description-preview .tn-spec-val { color: var(--text-primary); }
.detail-description-preview .tn-bullet { font-size: 12px; padding: 1px 0 1px 10px; }
.detail-desc-toolbar {
  display: flex; gap: 6px; align-items: center; margin-top: 6px;
}

/* ── VARIANTES EN PANEL VER ── */
.detail-variants-panel {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: 4px;
}
.detail-variants-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.detail-variants-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-tertiary);
}
.detail-variants-badge {
  background: var(--accent); color: #000;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  font-family: var(--font-data);
}
.detail-variants-property {
  font-size: 11px; color: var(--text-secondary); margin-bottom: 6px;
}
.detail-variants-property strong { color: var(--accent); }
.detail-variants-table-wrap {
  overflow-x: auto; border: 1px solid var(--border-subtle);
  border-radius: var(--radius); background: var(--bg-surface);
}
.detail-variants-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
  font-family: var(--font-data);
}
.detail-variants-table th {
  background: var(--bg-elevated); color: var(--text-tertiary);
  padding: 5px 8px; text-align: left; font-weight: 600;
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border-subtle);
}
.detail-variants-table td {
  padding: 5px 8px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.detail-variants-table tr:last-child td { border-bottom: none; }
.detail-variants-table tr.is-default td { color: var(--text-primary); }
.detail-variants-table td.vt-sku { color: var(--text-primary); font-weight: 600; }
.detail-variants-table td.vt-prop { color: var(--accent); font-weight: 700; }
.detail-variants-table td.vt-price::before { content: '$'; color: var(--text-muted); }
.detail-variants-table td.vt-stock { color: var(--text-muted); }
.detail-variants-table td.vt-ean { color: var(--text-muted); font-size: 10px; }

/* ── RELACIONES DE PRODUCTO ── */
.detail-relations { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.relations-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.rel-tab { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 4px 12px; font-size: 11px; color: var(--text-secondary); cursor: pointer; }
.rel-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.relations-loading { font-size: 12px; color: var(--text-muted); padding: 8px 0; }
.relations-body { display: flex; flex-direction: column; gap: 8px; }
.rel-item { display: flex; gap: 10px; align-items: center; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 8px; }
.rel-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.rel-thumb-empty { width: 40px; height: 40px; background: var(--bg-surface); border-radius: 4px; flex-shrink: 0; }
.rel-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rel-sku { font-size: 10px; font-family: var(--font-data); color: var(--text-muted); }
.rel-title { font-size: 12px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-meta { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rel-price { font-size: 11px; font-family: var(--font-data); color: var(--accent); margin-left: auto; }

/* ── OVERLAY ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 250;
  backdrop-filter: blur(2px);
}

/* ── TOASTS ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideIn 0.2s ease;
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.toast.ok    { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red);   }
.toast.warn  { border-left: 3px solid var(--amber); }

.smoke-tokens {
  position: fixed;
  bottom: 72px;
  right: 24px;
  background: rgba(30,30,40,0.82);
  color: var(--text-muted, #aaa);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 9999;
}

@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Alerta peso > límite envío */
#peso-alert-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}
.peso-alert-box {
  background: var(--surface, #1e1e2e);
  border: 1px solid var(--amber, #f59e0b);
  border-radius: 12px;
  padding: 28px 32px;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.peso-alert-icon { font-size: 40px; margin-bottom: 10px; }
.peso-alert-title {
  font-size: 16px; font-weight: 700;
  color: var(--amber, #f59e0b);
  margin-bottom: 10px;
}
.peso-alert-body {
  font-size: 13px; color: var(--text, #ccc);
  line-height: 1.6; margin-bottom: 20px;
}
.peso-alert-close {
  background: var(--amber, #f59e0b);
  color: #111; border: none;
  padding: 7px 24px; border-radius: 6px;
  font-weight: 600; cursor: pointer;
}
.peso-alert-close:hover { opacity: 0.85; }
.peso-alert-tag {
  display: inline-block;
  font-size: 11px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted, #aaa);
  border: 1px solid rgba(255,255,255,0.1);
}
.peso-alert-tag--warn {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-color: rgba(239,68,68,0.3);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── MARKET ── */
.market-placeholder, .placeholder-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ── CHECKBOXES ── */
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── CAT TREE NODES ── */
.cat-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.cat-node:hover { background: var(--bg-hover); color: var(--text-primary); }
.cat-node.active { background: var(--accent-dim); color: var(--accent); }
.cat-node-children { margin-left: 18px; }
.cat-count { font-size: 10px; font-family: var(--font-data); background: var(--bg-elevated); color: var(--text-tertiary); padding: 1px 5px; border-radius: 99px; margin-left: auto; }

/* ── APPLY TABLE ── */
.apply-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.apply-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); border-bottom: 1px solid var(--border-subtle); }
.apply-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-data); }
.apply-table tr:hover td { background: var(--bg-hover); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 400; }
  .sidebar.collapsed { transform: translateX(-100%); }
  .kpi-bar { flex-wrap: wrap; }
  .kpi-card { min-width: calc(50% - 5px); }
  .enrich-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; right: -100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── IMPORT / ENRIQUECIMIENTO DESDE PLANILLAS ── */
.imp-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.imp-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.imp-step {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #111;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.imp-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.imp-step-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 2px;
}

.imp-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  margin-left: 6px;
  vertical-align: middle;
}

.imp-suffix-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.imp-suffix-info {
  font-size: 13px;
  color: var(--text-secondary);
  padding-bottom: 8px;
}

.imp-suffix-info code {
  font-family: var(--font-data);
  font-size: 12px;
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: var(--radius);
  color: var(--accent);
}

.imp-drop-zone {
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.imp-drop-zone:hover,
.imp-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}

.imp-drop-zone .drop-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.imp-file-loaded {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.imp-file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-data);
}

.imp-col-map {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.imp-col-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: var(--font-data);
}

.imp-col-tag.mapped   { background: var(--green-dim);  color: var(--green); }
.imp-col-tag.unmapped { background: var(--amber-dim);  color: var(--amber); }
.imp-col-tag.ignored  { background: var(--bg-elevated); color: var(--text-tertiary); border: 1px solid var(--border-subtle); }

.imp-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px;
}

.imp-rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.imp-rule-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
}

.imp-rule-sel {
  font-size: 12px;
  padding: 4px 8px;
  min-width: 180px;
}

.imp-match-summary {
  font-size: 13px;
  color: var(--text-secondary);
}

.imp-match-summary strong { color: var(--accent); }

.imp-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-wrap: wrap;
}

/* Celdas de cambios en la preview */
.change-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  font-family: var(--font-data);
  background: var(--green-dim);
  color: var(--green);
  margin: 1px;
  white-space: nowrap;
}

.change-pill.new  { background: var(--green-dim);  color: var(--green); }
.change-pill.upd  { background: var(--amber-dim);  color: var(--amber); }
.change-pill.skip { background: var(--bg-elevated); color: var(--text-tertiary); border: 1px solid var(--border-subtle); }

.imp-origin-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

.no-match-row td { opacity: 0.5; }

/* ── WIZARD MODAL ── */
.wizard-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wizard-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.wizard-modal-wide { max-width: 960px; }

.wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.wizard-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.wizard-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.wizard-step-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 12px 20px 6px;
  flex-shrink: 0;
}

.wizard-hint {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 20px 10px;
  line-height: 1.5;
  flex-shrink: 0;
}

/* Hoja cards */
.wizard-sheet-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px 20px;
  overflow-y: auto;
}

.wizard-sheet-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wizard-sheet-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.wizard-sheet-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.wizard-sheet-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-data);
}

.wizard-sheet-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

/* Body 2-col para mapeo */
.wizard-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.wizard-col {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

.wizard-col-left  { flex: 0 0 400px; border-right: 1px solid var(--border-subtle); }
.wizard-col-right { flex: 1; }

/* Preview table en wizard */
.wizard-preview-table {
  font-size: 11px;
  width: 100%;
  margin: 0 20px;
  width: calc(100% - 40px);
}

.wizard-preview-table td {
  padding: 5px 7px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.wizard-preview-table tr:hover td { background: var(--bg-hover); }

.preview-header-row td,
.preview-header-cell {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
  border-bottom: 2px solid var(--accent) !important;
}

/* Mapeo de campos */
.wizard-fields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 20px 20px;
  overflow-y: auto;
}

.wizard-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.wizard-field-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wizard-field-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.req-star { color: var(--accent); margin-right: 2px; }

.wizard-field-hint {
  font-size: 11px;
  color: var(--text-tertiary);
}

.wizard-auto-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.wizard-auto-badge.detected { background: var(--green-dim); color: var(--green); }
.wizard-auto-badge.notdet   { background: var(--amber-dim); color: var(--amber); }

/* Footer del wizard */
.wizard-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

/* Responsive wizard */
@media (max-width: 800px) {
  .wizard-body { flex-direction: column; }
  .wizard-col-left { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .wizard-modal-wide { max-width: 100%; }
}

/* ── APPLY PANEL ── */
.apply-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.apply-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.apply-kpi-card {
  flex: 1;
  min-width: 90px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  text-align: center;
}

.apply-kpi-card.kpi-has {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.apply-kpi-val {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-data);
  color: var(--text-primary);
  line-height: 1;
}

.apply-kpi-card.kpi-has .apply-kpi-val { color: var(--accent); }

.apply-kpi-lbl {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.apply-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Botón cancelar batch — siempre visible en el header de log */
#btn-cancel-batch {
  transition: opacity var(--transition);
}

#btn-cancel-batch[style*="none"] {
  pointer-events: none;
}

/* Worker diag link en config */
.worker-diag-link {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.worker-diag-link:hover { color: var(--accent); }

/* ── PROVIDERS CONFIG ── */
.config-section-wide {
  grid-column: 1 / -1;
}

.providers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.providers-loading {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 12px 0;
}

.provider-row {
  display: grid;
  grid-template-columns: 28px 1fr 110px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}

.provider-row:hover { border-color: var(--border-default); }
.provider-row.inactive { opacity: 0.5; }

.provider-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  cursor: pointer;
}

.provider-name-input,
.provider-suffix-input,
.provider-notes-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 6px 10px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}

.provider-suffix-input {
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.provider-name-input:focus,
.provider-suffix-input:focus,
.provider-notes-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.provider-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.provider-del-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 7px;
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition);
}

.provider-del-btn:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
}

.providers-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.providers-footer .active-summary {
  font-size: 12px;
  color: var(--text-tertiary);
  flex: 1;
}
/* Intro text config */
.prov-intro-section  { grid-column: 1 / -1; border-top: 1px solid var(--border-subtle); padding-top: 6px; margin-top: 4px; }
.prov-intro-toggle   { background: none; border: none; color: var(--text-secondary); font-size: 11px; cursor: pointer; padding: 2px 0; display: flex; align-items: center; gap: 4px; }
.prov-intro-toggle:hover { color: var(--text-primary); }
.prov-intro-count    { color: var(--accent); }
.prov-intro-panel    { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.prov-intro-default-wrap { display: flex; flex-direction: column; gap: 4px; }
.prov-intro-label    { font-size: 11px; color: var(--text-tertiary); }
.prov-intro-lines    { display: flex; flex-direction: column; gap: 6px; }
.prov-intro-line     { display: grid; grid-template-columns: 160px 1fr auto; gap: 6px; align-items: start; }
.prov-intro-key      { font-size: 12px; }
.prov-intro-val      { font-size: 12px; font-family: var(--font-data); resize: vertical; }
.prov-intro-del      { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 13px; padding: 4px; margin-top: 2px; }
.prov-intro-del:hover { color: var(--danger); }
.field-input-sm      { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); padding: 4px 8px; width: 100%; }

/* Color picker inline */
.color-picker-wrap {
  position: relative;
  display: inline-block;
}

.color-picker-wrap input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: var(--font-data);
  letter-spacing: 0.03em;
  border: 1px solid rgba(255,255,255,0.15);
}

/* ── DB-GRID: badges ML y tintes de fila ─────────── */
.ml-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-data);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.ml-badge-good {
  background: rgba(163, 230, 53, 0.15);
  color: var(--green);
  border: 1px solid rgba(163, 230, 53, 0.3);
}
.ml-badge-bad {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.row-beats-ml {
  background: rgba(163, 230, 53, 0.04) !important;
}
.row-loses-ml {
  background: rgba(239, 68, 68, 0.04) !important;
}

/* Score de completitud en grilla DB */
.completeness-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-data);
  color: var(--text-secondary);
}
.completeness-track {
  width: 40px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}
.completeness-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.3s;
}
.completeness-fill.low  { background: var(--red); }
.completeness-fill.mid  { background: var(--amber); }
.completeness-fill.high { background: var(--green); }

/* ═══════════════════════════════════════════════════════════
   THUMBNAILS EN GRILLA
═══════════════════════════════════════════════════════════ */
.cell-thumb-wrap {
  width: 56px;
  padding: 4px 6px !important;
}
.cell-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.cell-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 2;
}
.cell-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cell-thumb.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;
}
.thumb-no-img { font-size: 20px; }
.thumb-count {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.4;
}
tr.row-has-img td { padding-top: 4px; padding-bottom: 4px; }

.btn-desc-preview {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.3);
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-desc-preview:hover { background: rgba(99,102,241,0.3); color: #c7d2fe; }
.btn-desc-empty { opacity: 0.35; }
.btn-desc-empty:hover { opacity: 0.6; }

.btn-wo-enrich {
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16,185,129,0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.04em;
  transition: background 0.15s, opacity 0.15s;
}
.btn-wo-enrich:hover  { background: rgba(16,185,129,0.25); color: #a7f3d0; }
.btn-wo-enrich:disabled { opacity: 0.5; cursor: default; }

/* ── Panel filtros avanzados ───────────────────────── */
.col-filters-panel {
  background: var(--bg-surface, #1e293b);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 12px 16px;
}
.col-filters-grid {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.cf-group { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.cf-label { font-size: 10px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.cf-input {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: #f1f5f9; font-size: 12px; padding: 5px 8px;
  outline: none; transition: border-color .15s;
}
.cf-input:focus { border-color: var(--accent, #a3e635); }
.cf-input option { background: #1e293b; }
.cf-actions { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
.cf-count { font-size: 11px; color: #facc15; font-weight: 600; }
#btn-col-filters.active,
#btn-col-filters.filter-active { color: #facc15; border-color: rgba(234,179,8,0.4); }
#btn-col-filters.filter-active::after { content: ' ●'; color: #facc15; }

/* ── Botón Dev JSON ────────────────────────────────── */
.btn-dev-json {
  font-family: monospace; font-size: 11px; font-weight: 700;
  background: rgba(234,179,8,0.15); color: #facc15;
  border: 1px solid rgba(234,179,8,0.3); border-radius: 5px;
  padding: 3px 7px; cursor: pointer; transition: background .15s;
}
.btn-dev-json:hover { background: rgba(234,179,8,0.3); }

/* ── Modal Dev JSON ────────────────────────────────── */
.dev-json-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 9999;
  align-items: center; justify-content: center;
}
.dev-json-modal {
  background: #0f172a; border: 1px solid rgba(139,92,246,0.4);
  border-radius: 12px; width: 720px; max-width: 95vw;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.dev-json-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid rgba(139,92,246,0.2);
  flex-shrink: 0;
}
.dev-json-title { font-size: 14px; font-weight: 700; color: #a78bfa; }
.dev-json-actions { display: flex; gap: 8px; }
.dev-json-copy {
  font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer;
  background: rgba(139,92,246,0.2); color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
}
.dev-json-copy:hover { background: rgba(139,92,246,0.35); }
.dev-json-close {
  font-size: 14px; padding: 4px 10px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,0.05); color: #94a3b8; border: 1px solid rgba(255,255,255,0.1);
}
.dev-json-close:hover { background: rgba(255,255,255,0.12); color: #f1f5f9; }
.dev-json-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  font-family: 'Courier New', monospace; font-size: 12px;
  line-height: 1.6; color: #e2e8f0; white-space: pre; margin: 0;
}

/* ── Badges de margen ──────────────────────────────── */
.mprice-margin {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; margin-top: 2px;
}
.margin-ok  { background: rgba(74,222,128,0.15); color: #4ade80; }
.margin-mid { background: rgba(234,179,8,0.15);  color: #facc15; }
.margin-low { background: rgba(239,68,68,0.15);  color: #f87171; }

/* ── Badge competitivo ─────────────────────────────── */
.mprice-comp {
  display: block; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; margin-top: 3px;
  cursor: default; white-space: nowrap;
}
.comp-win    { background: rgba(74,222,128,0.15); color: #4ade80; }
.comp-ok     { background: rgba(74,222,128,0.10); color: #86efac; }
.comp-warn   { background: rgba(234,179,8,0.15);  color: #facc15; }
.comp-out    { background: rgba(239,68,68,0.15);  color: #f87171; }
.comp-nodata { background: rgba(148,163,184,0.1); color: #64748b; }

/* ── Tooltip de precios ────────────────────────────── */
.price-tip-wrap { position: relative; }
.price-tip-wrap:hover .price-tooltip { display: block; }

.price-tooltip {
  display: none;
  position: absolute;
  left: 0; top: calc(100% + 4px);
  z-index: 999;
  min-width: 280px;
  background: #1e293b;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  pointer-events: none;
}
.ptt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 12px;
}
.ptt-row:last-of-type { border-bottom: none; }
.ptt-lbl { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.ptt-val { font-size: 12px; font-weight: 700; color: #f1f5f9; }
.ptt-green { color: #4ade80; }
.ptt-yellow { color: #facc15; }
.ptt-red    { color: #f87171; }
/* Flip hacia arriba cuando desborda viewport inferior */
.price-tip-wrap.tt-up .price-tooltip { top: auto; bottom: calc(100% + 4px); }
/* Flip hacia izquierda cuando desborda viewport derecho */
.price-tip-wrap.tt-right .price-tooltip { left: auto; right: 0; }
.ptt-analysis {
  margin-top: 8px; padding: 7px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; line-height: 1.4;
}
.ptt-analysis.comp-win  { background: rgba(74,222,128,0.12); color: #4ade80; }
.ptt-analysis.comp-ok   { background: rgba(74,222,128,0.08); color: #86efac; }
.ptt-analysis.comp-warn { background: rgba(234,179,8,0.12);  color: #facc15; }
.ptt-analysis.comp-out  { background: rgba(239,68,68,0.12);  color: #f87171; }
.ptt-analysis.comp-nodata { background: rgba(148,163,184,0.08); color: #94a3b8; }

.stock-badge {
  display: inline-block;
  min-width: 32px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
}
.stock-zero { background: rgba(239,68,68,0.18); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.stock-low  { background: rgba(234,179,8,0.18);  color: #facc15; border: 1px solid rgba(234,179,8,0.3); }
.stock-ok   { background: rgba(74,222,128,0.18); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }

.cell-url-link {
  font-size: 11px;
  font-weight: 600;
  color: #4ade80;
  text-decoration: none;
  padding: 2px 7px;
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: 4px;
  white-space: nowrap;
}
.cell-url-link:hover { background: rgba(74,222,128,0.12); }

tr.row-wo-busy { opacity: 0.45; pointer-events: none; }

.wo-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wo-spin .7s linear infinite;
  margin-right: 5px;
  vertical-align: middle;
}
@keyframes wo-spin { to { transform: rotate(360deg); } }

/* ── DUX Catalog Sync Block ────────────────────────────────── */
.dux-sync-block {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dux-sync-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.dux-sync-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.dux-sync-stats { font-size: 11px; color: var(--text-muted, #6b7280); }
.dux-sync-progress { margin-top: 8px; }
.dux-sync-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
}
.dux-sync-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent, #6366f1), #a78bfa);
  border-radius: 2px;
  transition: width .4s ease;
}
.dux-sync-msg { font-size: 11px; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════
   GALERIA EN DETAIL PANEL
═══════════════════════════════════════════════════════════ */
.detail-gallery { margin: 0 0 16px; }
.detail-no-img {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 12px;
  background: var(--bg-elevated);
  border-radius: 10px;
  border: 1px dashed var(--border);
}
.detail-gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 8px;
}
.detail-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s;
}
.gallery-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.detail-gallery-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.gallery-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg-elevated);
  transition: border-color 0.15s, transform 0.15s;
}
.gallery-thumb:hover { transform: scale(1.05); }
.gallery-thumb.active { border-color: var(--accent); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════════════════════════════════
   MODAL PREVIEW DESCRIPCION
═══════════════════════════════════════════════════════════ */
.desc-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1100;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.desc-preview-overlay.open { opacity: 1; pointer-events: all; }
.desc-preview-dialog {
  background: #ffffff;
  color: #1a1a1a;
  border-radius: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.desc-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #111;
  color: #fff;
  flex-shrink: 0;
}
.desc-preview-label {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.desc-preview-sku { font-family: monospace; font-size: 13px; color: #a3e635; }
.desc-preview-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.desc-preview-close:hover { background: rgba(255,255,255,0.2); }
.desc-preview-store {
  overflow-y: auto;
  flex: 1;
  padding: 32px max(32px, calc(50vw - 520px));
  background: #f8f8f8;
}

.tn-product-preview {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 32px;
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.tn-product-img-col { display: flex; flex-direction: column; gap: 8px; }
.tn-preview-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  border-radius: 10px;
  background: #f3f3f3;
  border: 1px solid #e5e5e5;
}
.tn-preview-no-img {
  width: 100%;
  aspect-ratio: 1/1;
  background: #f3f3f3;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 13px;
  border: 1px dashed #ddd;
}
.tn-product-info-col { display: flex; flex-direction: column; gap: 8px; }
.tn-brand { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: #888; font-weight: 600; }
.tn-product-title { font-size: 20px; font-weight: 700; color: #111; line-height: 1.3; margin: 0; }
.tn-product-price { font-size: 26px; font-weight: 800; color: #1a1a1a; }

.tn-desc-body { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.tn-desc-name {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}
.tn-desc-intro { font-size: 13px; color: #444; line-height: 1.6; margin: 0; }
.tn-series-badge {
  display: inline-block;
  background: #111;
  color: #a3e635;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 4px;
  align-self: flex-start;
}
.tn-section { display: flex; flex-direction: column; gap: 8px; }
.tn-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tn-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e5e5;
  margin-left: 6px;
}
.tn-specs-grid { display: flex; flex-direction: column; gap: 2px; }
.tn-spec-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-radius: 5px;
  overflow: hidden;
}
.tn-spec-row:nth-child(odd) { background: #f3f3f3; }
.tn-spec-row:nth-child(even) { background: #f9f9f9; }
.tn-spec-key { padding: 6px 10px; font-size: 12px; font-weight: 600; color: #444; background: #eaeaea; }
.tn-spec-val { padding: 6px 10px; font-size: 12px; color: #222; }
.tn-checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.tn-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #333;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}
.tn-checklist li:last-child { border-bottom: none; }
.tn-check-icon { color: #22c55e; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.tn-includes .tn-check-icon { color: #6366f1; }
.tn-warranty {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
}
.tn-warranty-icon { font-size: 20px; }
.tn-warranty-text { font-size: 13px; font-weight: 600; }
.tn-link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tn-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f3f3f3;
  color: #222;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #e0e0e0;
  transition: background 0.15s;
}
.tn-link-btn:hover { background: #e5e5e5; }
.tn-link-pdf { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.tn-link-pdf:hover { background: #fde68a; }
.tn-video-wrap { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #000; }
.tn-video-wrap iframe { width: 100%; height: 100%; border: none; }
.tn-ean { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; }
.tn-ean-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #999; letter-spacing: 0.08em; }
.tn-ean-val { font-family: monospace; font-size: 12px; color: #555; }

.no-data-hint { color: var(--text-tertiary); font-size: 12px; font-style: italic; }

@media (max-width: 640px) {
  .tn-product-preview { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════ */

/* KPI Cards */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.dash-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-kpi-green  { border-color: rgba(163,230,53,.35); background: rgba(163,230,53,.06); }
.dash-kpi-amber  { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.06); }
.dash-kpi-blue   { border-color: rgba(96,165,250,.35); background: rgba(96,165,250,.06); }
.dash-kpi-purple { border-color: rgba(167,139,250,.35); background: rgba(167,139,250,.06); }
.dkpi-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; }
.dkpi-value { font-size: 28px; font-weight: 700; color: var(--text-primary); font-family: var(--font-data); line-height: 1.1; }
.dkpi-sub   { font-size: 11px; color: var(--text-tertiary); }
.dash-kpi-green  .dkpi-value { color: #a3e635; }
.dash-kpi-amber  .dkpi-value { color: var(--amber); }
.dash-kpi-blue   .dkpi-value { color: #60a5fa; }
.dash-kpi-purple .dkpi-value { color: #a78bfa; }

/* Mid row */
.dash-mid {
  display: grid;
  grid-template-columns: 1fr 260px 260px;
  gap: 12px;
  margin-bottom: 16px;
  align-items: start;
}
.dash-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 16px;
}
.dash-dupes-panel { border-color: var(--warn); }
.dash-dupes-count { font-size: 11px; background: var(--warn); color: #000;
  border-radius: 10px; padding: 1px 7px; margin-left: 8px; font-weight: 700; }
.dash-dupes-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 12px; }
.dupe-tn-id { font-family: monospace; font-size: 11px; }
.dupe-discard { color: var(--text-muted); text-decoration: line-through; font-size: 11px; font-family: monospace; }
.dash-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-rules-hint {
  width: 16px; height: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; cursor: help; color: var(--text-tertiary);
}

/* Bars */
.dash-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 70px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  padding: 3px 4px;
  border-radius: 4px;
}
.dash-bar-row.dash-bar-required { background: rgba(255,255,255,.03); }
.dash-bar-label {
  font-size: 12px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.dash-req-dot { color: #a3e635; font-size: 8px; }
.dash-bar-track {
  background: var(--bg-elevated);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s ease;
}
.dash-bar-stat { font-size: 11px; color: var(--text-tertiary); text-align: right; font-family: var(--font-data); }
.dash-bar-pct  { font-weight: 600; color: var(--text-secondary); }

/* Providers */
.dash-prov-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.dash-prov-row:last-child { border-bottom: none; }
.dash-prov-name {
  font-size: 13px; font-weight: 600; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.dash-prov-suffix { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-data); }
.dash-prov-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-tertiary);
}
.dash-empty-small { font-size: 12px; color: var(--text-tertiary); text-align: center; padding: 12px 0; }

/* Rules */
.dash-rules-provider { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.dash-rules-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.dash-rule-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  padding: 4px 6px; border-radius: 4px;
}
.dash-rule-row:hover { background: var(--bg-elevated); }
.dash-rule-row input[type=checkbox] { accent-color: #a3e635; width: 14px; height: 14px; }
.dash-rules-footer { border-top: 1px solid var(--border-subtle); padding-top: 10px; }

/* Table */
.dash-table-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  overflow: hidden;
}
.dash-table-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-elevated);
}
.dash-table-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.dash-filter-btn {
  font-size: 11px; padding: 3px 10px;
  border: 1px solid var(--border-default);
  border-radius: 99px; background: transparent;
  color: var(--text-secondary); cursor: pointer;
  transition: all .15s;
}
.dash-filter-btn:hover  { border-color: var(--accent); color: var(--accent); }
.dash-filter-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }
.dash-search {
  margin-left: auto;
  font-size: 12px; padding: 4px 10px;
  background: var(--bg-base); border: 1px solid var(--border-default);
  border-radius: 6px; color: var(--text-primary); width: 200px;
}
.dash-table-wrap { overflow-x: auto; max-height: 600px; overflow-y: auto; }

/* ── DASHBOARD FULLSCREEN ── */
.dash-fullscreen-btn { padding: 4px 8px; flex-shrink: 0; }
.dash-table-panel.is-fullscreen {
  position: fixed; inset: 0; z-index: 900;
  border-radius: 0; margin: 0;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
}
.dash-table-panel.is-fullscreen .dash-table-wrap {
  flex: 1; max-height: none;
}
.dash-table-panel.is-fullscreen .dash-fullscreen-btn svg {
  /* ícono compress cuando está expandido */
  transform: rotate(45deg);
}
.dash-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.dash-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elevated);
  padding: 8px 10px; text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer; white-space: nowrap;
}
.dash-table thead th.dt-field { text-align: center; cursor: default; padding: 8px 5px; }
.dash-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background .1s;
}
.dash-table tbody tr:hover { background: var(--bg-elevated); }
.dash-table tbody tr.dt-row-ok { background: rgba(163,230,53,.04); }
.dash-table td { padding: 7px 10px; vertical-align: middle; }
.dash-table td:nth-child(n+5):nth-child(-n+12) { text-align: center; padding: 7px 4px; }

.dt-thumb { width: 44px; padding: 4px 6px !important; }
.dt-img    { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; display: block; }
.dt-no-img { width: 36px; height: 36px; background: var(--bg-elevated); border-radius: 4px; border: 1px solid var(--border-subtle); }
.dt-sku     { max-width: 160px; }
.dt-sku-text { font-family: var(--font-data); font-size: 11px; color: var(--text-secondary); }
.dt-title   { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-price   { font-family: var(--font-data); white-space: nowrap; }
.dt-status  { white-space: nowrap; }

/* Dots */
.dt-dot { font-size: 10px; }
.dt-ok   { color: #a3e635; }
.dt-fail { color: var(--red); }
.dt-na   { color: var(--border-default); }

/* Badges */
.dash-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  font-family: var(--font-data); letter-spacing: .04em;
}
.dash-badge-ready    { background: rgba(163,230,53,.15); color: #a3e635; border: 1px solid rgba(163,230,53,.35); }
.dash-badge-fails    { background: rgba(239,68,68,.15);  color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.dash-badge-injected { background: rgba(96,165,250,.15); color: #60a5fa; border: 1px solid rgba(96,165,250,.3); }
.dash-badge-enriched { background: rgba(167,139,250,.15); color: #a78bfa; border: 1px solid rgba(167,139,250,.35); }
.dash-table tbody tr.dt-row-injected { background: rgba(96,165,250,.04); }
.dash-table tbody tr.dt-row-enriched { background: rgba(167,139,250,.04); }
.dt-dot-th { text-align: center; font-size: 10px; color: var(--text-tertiary); min-width: 32px; }
.dash-filter-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

.dash-table-foot {
  padding: 8px 16px;
  font-size: 11px; color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

/* Empty state */
.dash-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px;
  text-align: center;
  font-size: 14px; color: var(--text-tertiary);
  line-height: 1.7;
}
.dash-empty a { color: var(--accent); }

/* ════════════════════════════════════════════════════
   AUTH — Login overlay y chips de usuario
════════════════════════════════════════════════════ */

#auth-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(10, 11, 14, 0.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
#auth-overlay.auth-visible  { opacity: 1; pointer-events: all; }
#auth-overlay.auth-fade-out { opacity: 0; pointer-events: none; }

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 40px 36px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  transform: translateY(24px) scale(.97);
  opacity: 0;
  transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .3s ease;
}
.auth-card.auth-card-in { transform: translateY(0) scale(1); opacity: 1; }

@keyframes auth-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-6px); }
  80%     { transform: translateX(6px); }
}
.auth-shake { animation: auth-shake .4s ease; }

.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.auth-brand {
  font-size: 20px; font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.auth-title {
  font-size: 15px; font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 24px;
}
.auth-field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.auth-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.auth-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px; padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--text-tertiary); }

.auth-error {
  font-size: 12px; color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
  border-radius: 6px; padding: 8px 12px;
  margin-bottom: 12px;
}
.auth-btn {
  width: 100%;
  background: var(--accent); color: #0f1014;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  padding: 11px 0; cursor: pointer;
  transition: background .15s, opacity .15s;
  margin-top: 4px;
}
.auth-btn:hover  { background: color-mix(in srgb, var(--accent) 85%, white); }
.auth-btn:disabled { opacity: .5; cursor: default; }
.auth-btn.auth-btn-ok { background: var(--green); }

.auth-footer {
  font-size: 11px; color: var(--text-tertiary);
  text-align: center; margin: 20px 0 0;
}

/* ── Chip de usuario en sidebar ─────────────────────── */
.auth-chip {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.auth-chip-developer { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.auth-chip-client    { border-color: color-mix(in srgb, var(--info) 25%, transparent); }

.auth-chip-info {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.auth-chip-name {
  font-size: 12px; font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-chip-role {
  font-size: 10px; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .05em;
}
.auth-chip-developer .auth-chip-role { color: var(--accent); }
.auth-chip-client    .auth-chip-role { color: var(--info); }

.auth-chip-logout {
  flex-shrink: 0;
  background: none; border: none;
  color: var(--text-tertiary); cursor: pointer;
  padding: 4px; border-radius: 4px;
  display: flex; align-items: center;
  transition: color .15s, background .15s;
}
.auth-chip-logout:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

/* ════════════════════════════════════════════════════
   BRAND — CEO Suite 360 TN
════════════════════════════════════════════════════ */

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}
.brand-icon { flex-shrink: 0; display: flex; }
.brand-text-wrap { display: flex; flex-direction: column; gap: 0; }
.brand-text {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary); letter-spacing: -.02em;
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  background: linear-gradient(90deg, #4facfe 0%, #c084fc 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
}

/* Barra de contexto de cliente activo */
.client-context-bar {
  margin: 0 10px 10px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
}
.client-ctx-logo {
  width: 28px; height: 28px; border-radius: 6px;
  object-fit: contain; background: var(--bg-surface);
  flex-shrink: 0;
}
.client-ctx-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.client-ctx-name {
  font-size: 12px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.client-ctx-label {
  font-size: 10px; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
}

/* ════════════════════════════════════════════════════
   LOGO UPLOAD — Modal de cliente
════════════════════════════════════════════════════ */

.logo-upload-row {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
}
.logo-preview-wrap {
  width: 80px; height: 80px; flex-shrink: 0;
  border-radius: 10px;
  border: 1.5px dashed var(--border-default);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  overflow: hidden;
}
.logo-preview-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-tertiary); font-size: 10px; text-align: center;
}
.logo-upload-actions {
  display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.logo-upload-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }

/* Logo en tarjeta cliente */
.client-card-logo-wrap {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.client-card-logo {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: contain; background: var(--bg-base);
}
.client-card-logo-placeholder {
  width: 36px; height: 36px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: var(--accent);
}

/* ════════════════════════════════════════════════════
   MGMT — Panel de Clientes y Usuarios (Configuración)
════════════════════════════════════════════════════ */

.mgmt-panel { margin-top: 16px; }

.mgmt-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}

.mgmt-list {
  display: flex; flex-direction: column; gap: 8px;
}
.mgmt-empty {
  font-size: 13px; color: var(--text-tertiary);
  padding: 20px 0; text-align: center;
}

/* Tarjeta de cliente */
.client-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px 16px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color .15s;
}
.client-card:hover { border-color: var(--border-default); }
.client-card.client-inactive { opacity: .55; }

.client-card-main { display: flex; flex-direction: column; gap: 4px; }
.client-card-name {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.client-card-meta {
  font-size: 12px; color: var(--text-tertiary);
  display: flex; gap: 14px; flex-wrap: wrap;
}
.client-card-meta span { display: flex; align-items: center; gap: 4px; }

.client-plan-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); letter-spacing: .04em;
}
.client-plan-badge.plan-pro        { background: color-mix(in srgb,#a78bfa 12%,transparent); color:#a78bfa; }
.client-plan-badge.plan-enterprise { background: color-mix(in srgb,#f59e0b 12%,transparent); color:#f59e0b; }

.client-card-actions {
  display: flex; gap: 6px;
}

/* Tarjeta de usuario */
.user-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 8px 12px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s;
}
.user-card:hover { border-color: var(--border-default); }
.user-card.user-inactive { opacity: .5; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  flex-shrink: 0;
}
.user-avatar.role-developer { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.user-avatar.role-admin      { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }
.user-avatar.role-viewer     { background: color-mix(in srgb, var(--text-tertiary) 20%, transparent); color: var(--text-tertiary); }

.user-card-info { display: flex; flex-direction: column; gap: 3px; }
.user-card-name {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.user-role-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; letter-spacing: .04em;
}
.user-role-badge.role-developer { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.user-role-badge.role-admin      { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.user-role-badge.role-viewer     { background: color-mix(in srgb, var(--text-tertiary) 15%, transparent); color: var(--text-tertiary); }

.user-card-meta {
  font-size: 11px; color: var(--text-tertiary);
  display: flex; gap: 10px;
}

.user-card-actions { display: flex; gap: 6px; align-items: center; }

/* Modal de cliente — más ancho */
.modal-box-lg { max-width: 640px; }

.mgmt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) { .mgmt-form-grid { grid-template-columns: 1fr; } }

.mgmt-subsection-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-secondary);
  margin: 16px 0 8px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px;
}

.field-hint {
  font-size: 11px; color: var(--text-tertiary); margin-top: 3px; display: block;
}

/* Inline status en las tarjetas */
.client-tn-status {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
}
.client-tn-status.no-token {
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--warn);
}

/* ════════════════════════════════════════════════════
   ANALÍTICA 360°
════════════════════════════════════════════════════ */

/* KPI row */
.an-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.an-kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 16px 14px;
}
.an-kpi-accent { border-color: color-mix(in srgb, #4facfe 20%, transparent); }
.an-kpi-green  { border-color: color-mix(in srgb, #22c55e 25%, transparent); }
.an-kpi-blue   { border-color: color-mix(in srgb, #4facfe 30%, transparent); }

.an-kpi-value {
  font-size: 26px; font-weight: 700; color: var(--text-primary);
  line-height: 1; margin-bottom: 4px;
}
.an-kpi-green  .an-kpi-value { color: #22c55e; }
.an-kpi-blue   .an-kpi-value { color: #4facfe; }
.an-kpi-label  { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; }

.an-kpi-bar { height: 3px; background: var(--border-subtle); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.an-kpi-bar-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }

/* Grid de cards */
.an-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.an-card-wide { grid-column: span 2; }
.an-card-full { grid-column: span 2; }
@media (max-width: 900px) {
  .an-grid { grid-template-columns: 1fr; }
  .an-card-wide, .an-card-full { grid-column: span 1; }
}

.an-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 16px;
}
.an-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.an-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.an-card-sub   { font-size: 11px; color: var(--text-tertiary); }

/* Gráfico de barras */
.an-chart-wrap { min-height: 80px; }
.an-bars {
  display: flex; align-items: flex-end; gap: 6px; height: 80px; padding-bottom: 20px; position: relative;
}
.an-bar-col {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  flex: 1; position: relative;
}
.an-bar {
  width: 100%; min-height: 4px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #4facfe 0%, #7c3aed 100%);
  transition: height .4s ease;
}
.an-bar-val   { font-size: 10px; color: var(--text-secondary); font-weight: 600; }
.an-bar-label { font-size: 10px; color: var(--text-tertiary); position: absolute; bottom: -18px; }

/* Caché */
.an-cache-list  { display: flex; flex-direction: column; gap: 8px; }
.an-cache-row   { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.an-cache-type  { flex: 1; color: var(--text-secondary); }
.an-cache-count { color: #4facfe; font-weight: 600; min-width: 60px; text-align: right; }
.an-cache-hits  { color: var(--text-tertiary); min-width: 60px; text-align: right; }

/* R2 Stats */
.an-r2-stats    { display: flex; flex-direction: column; gap: 0; }
.an-r2-kpis     { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.an-r2-kpi      { background: var(--bg-tertiary); border-radius: 6px; padding: 8px 10px; }
.an-r2-val      { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.an-r2-lbl      { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.an-r2-bar-wrap { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.an-r2-bar-fill { height: 100%; background: linear-gradient(90deg, #4facfe, #00f2fe); border-radius: 3px; transition: width .4s; }
.an-cache-key   { flex: 1; color: var(--text-secondary); }
.an-cache-val   { color: #4facfe; font-weight: 600; }

/* Por proveedor */
.an-prov-list { display: flex; flex-direction: column; gap: 12px; }
.an-prov-row  { display: flex; align-items: center; gap: 10px; }
.an-prov-name { font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 90px; }
.an-prov-bars { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.an-prov-bar-row   { display: flex; align-items: center; gap: 6px; }
.an-prov-bar-lbl   { font-size: 10px; color: var(--text-tertiary); width: 30px; }
.an-prov-bar-track { flex: 1; height: 5px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; }
.an-prov-bar-fill  { height: 100%; border-radius: 3px; transition: width .5s ease; }
.an-prov-bar-pct   { font-size: 10px; color: var(--text-tertiary); width: 30px; text-align: right; }
.an-prov-total     { font-size: 11px; color: var(--text-tertiary); min-width: 40px; text-align: right; }

/* Tabla de oportunidades */
.an-opp-table-wrap { overflow-x: auto; }
.an-opp-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.an-opp-table th {
  text-align: left; padding: 6px 10px;
  color: var(--text-tertiary); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border-subtle);
}
.an-opp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.an-opp-table tr:last-child td { border-bottom: none; }
.an-opp-table tr:hover td { background: var(--bg-hover); }

.an-diff-green { color: #22c55e !important; font-weight: 600; }
.an-diff-red   { color: #ef4444 !important; font-weight: 600; }

/* Badges */
.an-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  background: var(--bg-hover); color: var(--text-secondary);
  margin-right: 4px;
}
.an-badge-green { background: color-mix(in srgb, #22c55e 15%, transparent); color: #22c55e; }
.an-badge-red   { background: color-mix(in srgb, #ef4444 15%, transparent); color: #ef4444; }

.an-loading { color: var(--text-tertiary); font-size: 12px; padding: 8px 0; }

.an-pricing-summary { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── CELDA MULTI-PRECIO (grilla productos) ─────────────── */
.mprice-td { padding: 4px 8px !important; min-width: 160px; }
.mprice-cell { display: flex; flex-direction: column; gap: 2px; }
.mprice-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; }
.mprice-lbl { color: var(--text-tertiary); font-size: 10px; white-space: nowrap; }
.mprice-lbl em { color: var(--text-tertiary); font-style: normal; font-size: 9px; opacity: .8; }
.mprice-val { font-family: var(--font-data); font-weight: 600; white-space: nowrap; }
.mprice-cost .mprice-val { color: #94a3b8; }
.mprice-pvp  .mprice-val { color: #67e8f9; font-size: 10px; }
.mprice-tn   .mprice-val { color: #a3e635; font-size: 12px; }
.mprice-ml   .mprice-val { color: #fb923c; }
.mprice-empty { color: var(--text-tertiary); font-size: 12px; }
.mprice-comp-pilot { background: rgba(251,146,60,.08); border-radius: 4px; padding: 1px 4px; margin-top: 2px; cursor: default; }
.mprice-comp-pilot .mprice-val { color: #fb923c; }
.mprice-comp-pilot.comp-approved .mprice-val { color: #4ade80; }
.mprice-comp-mgn { font-size: 9px; font-family: var(--font-data); padding: 1px 4px; border-radius: 3px; margin-left: 2px; }
.mgn-ok  { color: #4ade80; background: rgba(74,222,128,.15); }
.mgn-mid { color: #facc15; background: rgba(250,204,21,.15); }
.mgn-low { color: #f87171; background: rgba(248,113,113,.15); }
.btn-comp-approve, .btn-comp-clear {
  cursor: pointer; font-size: 9px; padding: 1px 4px; border-radius: 3px; border: none;
  background: rgba(255,255,255,.1); color: var(--text-secondary); line-height: 1;
}
.btn-comp-approve:hover { background: rgba(74,222,128,.25); color: #4ade80; }
.btn-comp-clear:hover   { background: rgba(248,113,113,.25); color: #f87171; }

/* ── PANEL PRECIOS EN MODAL PREVIEW ────────────────────── */
.tn-preview-prices { margin: 12px 0 16px; }
.pvp-panel { display: flex; flex-direction: column; gap: 6px; background: #1e2229; border-radius: 10px; padding: 14px 16px; }
.pvp-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,.05); padding-bottom: 6px; }
.pvp-row:last-child { border-bottom: none; padding-bottom: 0; }
.pvp-lbl { font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.pvp-lbl small { font-size: 10px; color: #64748b; }
.pvp-val { font-family: var(--font-data); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pvp-val em { font-style: normal; font-size: 11px; font-weight: 400; color: #64748b; }
.pvp-cost { color: #94a3b8; font-size: 13px !important; }
.pvp-tn   { color: #a3e635; }
.pvp-ml   { color: #fb923c; }
.pvp-beats { font-size: 10px; font-weight: 600; color: #22c55e; background: rgba(34,197,94,.15); padding: 1px 6px; border-radius: 4px; }
.pvp-loses { font-size: 10px; font-weight: 600; color: #f87171; background: rgba(248,113,113,.15); padding: 1px 6px; border-radius: 4px; }

/* ── WORKER HTML PREVIEW (renderiza description_html del Worker directamente) ── */
.worker-html-preview {
  font-size: 14px;
  line-height: 1.7;
  color: #cbd5e1;
}
.worker-html-preview p   { margin: 0 0 10px; }
.worker-html-preview br  { display: block; margin-bottom: 4px; content: ""; }
.worker-html-preview ul  { margin: 6px 0 12px 0; padding-left: 20px; }
.worker-html-preview li  { margin-bottom: 4px; }
.worker-html-preview strong, .worker-html-preview b { color: #f1f5f9; font-weight: 600; }
.worker-html-preview h2, .worker-html-preview h3 { color: #f1f5f9; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.08); }
.worker-html-preview a   { color: #60a5fa; text-decoration: none; }
.worker-html-preview a:hover { text-decoration: underline; }
.worker-html-preview table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.worker-html-preview table td, .worker-html-preview table th { padding: 6px 10px; border: 1px solid rgba(255,255,255,.1); }
.worker-html-preview table tr:nth-child(even) td { background: rgba(255,255,255,.03); }
.worker-html-preview iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 8px; margin: 10px 0; }

/* Ajuste margen en modal precio */
.mprice-val em { font-style: normal; font-size: 10px; font-weight: 500; color: #64748b; margin-left: 4px; }

/* ══════════════════════════════════════════════════════════════════
   MODAL HISTORIAL DE COSTOS
   ══════════════════════════════════════════════════════════════════ */
.ch-modal {
  background: var(--surface-2, #1e293b);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  width: 860px; max-width: 96vw;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

/* Header */
.ch-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.ch-header-left { display: flex; align-items: center; gap: 14px; }
.ch-icon { font-size: 28px; }
.ch-title { font-size: 17px; font-weight: 700; color: #f1f5f9; }
.ch-subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }
.ch-header-right { display: flex; gap: 10px; align-items: center; }

.ch-btn {
  border: none; border-radius: 8px; padding: 7px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.ch-btn-export {
  background: rgba(34,197,94,.15); color: #4ade80;
  border: 1px solid rgba(34,197,94,.25);
}
.ch-btn-export:hover { background: rgba(34,197,94,.25); }
.ch-btn-close {
  background: rgba(255,255,255,.06); color: #94a3b8;
  border: 1px solid rgba(255,255,255,.1); width: 32px; height: 32px;
  padding: 0; display: grid; place-items: center; border-radius: 8px;
}
.ch-btn-close:hover { background: rgba(255,255,255,.12); color: #f1f5f9; }

/* Stats bar */
.ch-stats {
  display: flex; gap: 0; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ch-stat {
  flex: 1; padding: 12px 20px; border-right: 1px solid rgba(255,255,255,.06);
}
.ch-stat:last-child { border-right: none; }
.ch-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #475569; font-weight: 600; }
.ch-stat-value { font-size: 18px; font-weight: 700; color: #f1f5f9; margin-top: 3px; }
.ch-stat-sub   { font-size: 11px; color: #64748b; margin-top: 1px; }
.ch-stat-value.pos { color: #4ade80; }
.ch-stat-value.neg { color: #f87171; }
.ch-stat-value.neu { color: #94a3b8; }

/* Chart */
.ch-chart-wrap {
  padding: 20px 24px 12px;
  flex-shrink: 0;
  height: 240px;
  position: relative;
}
.ch-chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* Tabla */
.ch-table-wrap {
  overflow-y: auto; flex: 1;
  padding: 0 24px 20px;
}
.ch-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.ch-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2, #1e293b);
  color: #475569; font-weight: 600; text-transform: uppercase;
  font-size: 10px; letter-spacing: .05em;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.ch-table tbody td {
  padding: 9px 12px; color: #cbd5e1;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.ch-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.ch-td-cost   { font-weight: 700; color: #f1f5f9; font-size: 13px; }
.ch-td-var    { font-weight: 600; font-size: 12px; }
.ch-td-var.pos { color: #f87171; }  /* subió → más caro para nosotros */
.ch-td-var.neg { color: #4ade80; }  /* bajó → mejor margen */
.ch-td-var.neu { color: #64748b; }
.ch-td-source {
  font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: rgba(255,255,255,.06); color: #94a3b8; white-space: nowrap;
}
.ch-td-source.src-baseline { background: rgba(99,102,241,.15); color: #a5b4fc; }
.ch-td-source.src-dux_api  { background: rgba(34,197,94,.12);  color: #86efac; }
.ch-td-source.src-excel    { background: rgba(59,130,246,.12);  color: #93c5fd; }
.ch-td-source.src-manual   { background: rgba(234,179,8,.12);   color: #fde68a; }

/* Botón 📈 en celda de precio */
.btn-cost-history {
  display: inline-block; cursor: pointer; font-size: 12px;
  padding: 1px 5px; border-radius: 4px; margin-top: 4px;
  background: rgba(99,102,241,.12); color: #a5b4fc;
  border: 1px solid rgba(99,102,241,.2);
  transition: all .15s; vertical-align: middle;
  font-weight: 500; white-space: nowrap;
}
.btn-cost-history:hover { background: rgba(99,102,241,.25); border-color: rgba(99,102,241,.4); }

/* Estado inactivo */
.ch-inactive {
  text-align: center; padding: 48px 32px; color: #475569;
}
.ch-inactive-icon { font-size: 40px; margin-bottom: 12px; }
.ch-inactive-title { font-size: 16px; font-weight: 600; color: #64748b; margin-bottom: 8px; }
.ch-inactive-desc  { font-size: 12px; line-height: 1.7; }
.ch-inactive-desc code {
  display: inline-block; margin-top: 10px; padding: 8px 14px;
  background: rgba(0,0,0,.3); border-radius: 6px; color: #93c5fd;
  font-family: monospace; font-size: 11px; text-align: left;
}

/* ══════════════════════════════════════════════════════════════════
   MONITOR DE LOGS FLOTANTE
   ══════════════════════════════════════════════════════════════════ */

/* Botón en sidebar */
.float-log-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; margin-bottom: 8px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px; color: #a5b4fc; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s;
  position: relative;
}
.float-log-toggle:hover { background: rgba(99,102,241,.2); border-color: rgba(99,102,241,.4); }
.float-log-toggle.active { background: rgba(99,102,241,.25); border-color: #818cf8; color: #e0e7ff; }
.flt-icon  { font-size: 14px; }
.flt-label { flex: 1; text-align: left; }
.flt-badge {
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 18px; text-align: center;
}

/* Panel flotante */
.float-log-panel {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 560px; height: 340px;
  min-width: 320px; min-height: 180px;
  background: #0b1120;
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04);
  display: flex; flex-direction: column;
  z-index: 9000;
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  resize: both;
}

/* Header estilo macOS terminal */
.flp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; gap: 10px;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,.07);
  cursor: move; user-select: none; flex-shrink: 0;
}
.flp-header-left { display: flex; align-items: center; gap: 8px; }
.flp-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
}
.flp-dot-red    { background: #ff5f57; }
.flp-dot-yellow { background: #febc2e; }
.flp-dot-green  { background: #28c840; }
.flp-title {
  font-size: 11px; font-weight: 600; color: #64748b;
  letter-spacing: .03em; margin-left: 4px;
}
.flp-header-right { display: flex; align-items: center; gap: 6px; }
.flp-btn {
  background: transparent; border: none; color: #475569;
  cursor: pointer; font-size: 13px; padding: 2px 6px;
  border-radius: 4px; transition: all .12s; line-height: 1;
}
.flp-btn:hover { background: rgba(255,255,255,.08); color: #94a3b8; }
.flp-btn-close:hover { color: #f87171; }
.flp-search {
  background: #1e293b; border: 1px solid rgba(255,255,255,.1);
  color: #e2e8f0; font-size: 10px; border-radius: 4px;
  padding: 2px 8px; width: 120px; outline: none;
}
.flp-search::placeholder { color: #475569; }
.flp-search:focus { border-color: rgba(99,102,241,.5); }
.flp-filter {
  background: #1e293b; border: 1px solid rgba(255,255,255,.1);
  color: #94a3b8; font-size: 10px; border-radius: 4px;
  padding: 2px 6px; cursor: pointer;
}

/* Cuerpo — el stream de logs */
.flp-body {
  flex: 1; overflow-y: auto; padding: 6px 0;
  scrollbar-width: thin; scrollbar-color: #1e293b transparent;
}
.flp-body::-webkit-scrollbar { width: 4px; }
.flp-body::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }

.flp-entry {
  display: flex; gap: 0; align-items: flex-start;
  padding: 2px 12px; font-size: 11px; line-height: 1.55;
  border-left: 2px solid transparent;
  transition: background .1s;
}
.flp-entry:hover { background: rgba(255,255,255,.03); }
.flp-entry.log-error   { border-left-color: #ef4444; background: rgba(239,68,68,.05); }
.flp-entry.log-warn    { border-left-color: #f59e0b; background: rgba(245,158,11,.04); }
.flp-entry.log-success { border-left-color: #22c55e; }
.flp-entry.log-info    { border-left-color: transparent; }

.flp-ts   { color: #1e3a5f; font-size: 10px; min-width: 64px; padding-top: 1px; flex-shrink: 0; }
.flp-lvl  { font-size: 10px; font-weight: 700; min-width: 52px; flex-shrink: 0; padding-top: 1px; }
.flp-entry.log-error   .flp-lvl { color: #f87171; }
.flp-entry.log-warn    .flp-lvl { color: #fbbf24; }
.flp-entry.log-success .flp-lvl { color: #4ade80; }
.flp-entry.log-info    .flp-lvl { color: #475569; }
.flp-msg  { color: #94a3b8; word-break: break-word; flex: 1; }
.flp-entry.log-error   .flp-msg { color: #fca5a5; }
.flp-entry.log-warn    .flp-msg { color: #fde68a; }
.flp-entry.log-success .flp-msg { color: #86efac; }

/* Footer */
.flp-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px; background: #111827;
  border-top: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}
.flp-footer, .flp-footer * { font-size: 10px; color: #334155; }
.flp-resize-hint { font-style: italic; }

/* Handle de resize en la esquina */
.flp-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 16px; height: 16px; cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(99,102,241,.3) 50%);
}

/* ══════════════════════════════════════════════════════════════════
   CATÁLOGO PROPIO — Organización de artículos
   ══════════════════════════════════════════════════════════════════ */

.catalog-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  height: calc(100vh - 120px);
  overflow: hidden;
  position: relative;
}
.catalog-layout.panel-open {
  grid-template-columns: 200px 1fr 320px;
}
.catalog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  padding-right: 4px;
}
.catalog-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4b5563;
  padding: 0 2px;
}
.cat-brand-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid #2d333b;
  background: #161b22;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.cat-brand-card:hover { border-color: #5865f2; background: #1c2128; }
.cat-brand-card.active { border-color: #5865f2; background: #1c2435; }
.cat-brand-badge {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.cat-brand-badge img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.cat-brand-name { font-size: 11px; font-weight: 600; color: #e2e2f0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-brand-count { font-size: 9px; color: #6b7280; font-weight: 600; }
.cat-brand-card.special { background: linear-gradient(135deg, #1a1200, #231b00); border-color: #f59e0b55; }
.cat-brand-card.special .cat-brand-name { color: #f59e0b; }
.cat-brand-card.special:hover { border-color: #f59e0b; }
.cat-brand-card.special.active { border-color: #f59e0b; background: #2a1e00; }
.catalog-active-filter { display: flex; flex-direction: column; gap: 4px; }
.cat-no-filter { font-size: 10px; color: #4b5563; font-style: italic; }
.cat-filter-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 5px;
  background: #1c2435; border: 1px solid #5865f244;
  font-size: 10px; color: #a5b4fc;
}
.cat-filter-clear { background: none; border: none; color: #6b7280; cursor: pointer; font-size: 11px; margin-left: auto; padding: 0; }
.cat-filter-clear:hover { color: #ef4444; }
.cat-unassigned-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 5px;
  background: #2a1e00; border: 1px solid #f59e0b44;
  font-size: 11px; color: #f59e0b; font-weight: 600;
}
.catalog-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid #2d333b;
  margin-bottom: 14px;
}
.catalog-tab {
  background: none; border: none;
  padding: 7px 14px;
  font-size: 12px; font-weight: 600;
  color: #6b7280; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.catalog-tab:hover { color: #a5b4fc; }
.catalog-tab.active { color: #818cf8; border-bottom-color: #818cf8; }
.ctab-count {
  font-size: 9px; font-weight: 700;
  background: #f59e0b22; color: #f59e0b;
  border: 1px solid #f59e0b33;
  border-radius: 4px; padding: 0 5px;
  min-width: 18px; text-align: center;
}
.catalog-main { display: flex; flex-direction: column; overflow: hidden; }
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 210px);
  padding-bottom: 16px;
}
.catalog-cat-card {
  background: #161b22;
  border: 1px solid #2d333b;
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  position: relative;
}
.catalog-cat-card:hover { border-color: #5865f2; background: #1c2128; transform: translateY(-1px); }
.catalog-cat-card.active { border-color: #818cf8; background: #1c2435; }
.catalog-cat-card .ccc-icon { font-size: 24px; line-height: 1; }
.catalog-cat-card .ccc-name { font-size: 12px; font-weight: 700; color: #e2e2f0; line-height: 1.3; }
.catalog-cat-card .ccc-desc { font-size: 10px; color: #6b7280; line-height: 1.3; }
.catalog-cat-card .ccc-count {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 700;
  background: #818cf822; color: #818cf8;
  border: 1px solid #818cf833; border-radius: 4px; padding: 1px 5px;
}
.catalog-cat-card .ccc-star { position: absolute; bottom: 8px; right: 8px; font-size: 10px; }
.catalog-products-panel {
  background: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cpp-header {
  padding: 12px 14px;
  border-bottom: 1px solid #1e2430;
  flex-shrink: 0;
}
.cpp-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cpp-icon { font-size: 18px; }
.cpp-name { font-size: 14px; font-weight: 700; color: #e2e2f0; flex: 1; }
.cpp-close { background: none; border: none; color: #6b7280; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.cpp-close:hover { color: #e2e2f0; }
.cpp-sub { font-size: 10px; color: #6b7280; margin-bottom: 8px; }
.cpp-subcats { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.cpp-subcat-chip {
  font-size: 10px; font-weight: 600;
  background: #1e2430; border: 1px solid #2d333b;
  border-radius: 4px; padding: 2px 8px;
  cursor: pointer; color: #9ca3af;
  transition: border-color .12s, color .12s;
}
.cpp-subcat-chip:hover { border-color: #818cf8; color: #a5b4fc; }
.cpp-subcat-chip.active { border-color: #818cf8; background: #1c2435; color: #818cf8; }
.cat-search-input {
  width: 100%; padding: 6px 10px;
  background: #0d1117; border: 1px solid #2d333b;
  border-radius: 6px; color: #e2e2f0; font-size: 11px;
  outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.cat-search-input:focus { border-color: #5865f2; }
.cpp-list { flex: 1; overflow-y: auto; padding: 8px; }
.cpp-product-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  transition: background .1s;
}
.cpp-product-row:hover { background: #161b22; }
.cpp-prod-img {
  width: 32px; height: 32px; border-radius: 6px;
  background: #1c2128; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cpp-prod-img img { width: 100%; height: 100%; object-fit: contain; }
.cpp-prod-info { flex: 1; min-width: 0; }
.cpp-prod-sku { font-size: 10px; font-weight: 700; color: #6b7280; }
.cpp-prod-title { font-size: 11px; color: #e2e2f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpp-prod-by { font-size: 9px; color: #374151; font-style: italic; }
.cpp-prod-price { font-size: 11px; font-weight: 600; color: #4ade80; flex-shrink: 0; }
.cpp-prod-unassign {
  background: none; border: none; color: #374151;
  cursor: pointer; font-size: 12px; padding: 2px 5px;
  border-radius: 4px; transition: color .1s, background .1s;
  flex-shrink: 0;
}
.cpp-prod-unassign:hover { color: #ef4444; background: #2a1010; }
.cpp-footer {
  padding: 8px 14px; border-top: 1px solid #1e2430;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; color: #6b7280;
}
.catalog-unassigned-header { padding-bottom: 8px; }
.catalog-unassigned-list {
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; max-height: calc(100vh - 250px);
}
.cat-unasgn-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: 7px;
  background: #161b22; border: 1px solid #2d333b;
  transition: border-color .12s;
}
.cat-unasgn-row:hover { border-color: #5865f2; }
.cat-unasgn-sku { font-size: 10px; font-weight: 700; color: #6b7280; width: 80px; flex-shrink: 0; }
.cat-unasgn-title { font-size: 11px; color: #e2e2f0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-unasgn-assign {
  font-size: 10px; font-weight: 600;
  background: #1c2435; border: 1px solid #5865f244;
  color: #a5b4fc; border-radius: 4px;
  padding: 2px 8px; cursor: pointer; transition: background .12s;
  flex-shrink: 0;
}
.cat-unasgn-assign:hover { background: #2d3a5a; }
.catalog-loader {
  position: absolute; inset: 0;
  background: rgba(10,12,16,.8);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; z-index: 10; border-radius: 12px;
}
.cat-spinner {
  width: 32px; height: 32px;
  border: 3px solid #2d333b;
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: cat-spin .7s linear infinite;
}
@keyframes cat-spin { to { transform: rotate(360deg); } }
.cat-assign-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1200;
}
.cat-assign-dialog {
  background: #161b22; border: 1px solid #2d333b;
  border-radius: 14px; width: 380px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.cat-assign-header {
  padding: 14px 16px; border-bottom: 1px solid #2d333b;
  display: flex; align-items: center; gap: 8px;
}
.cat-assign-header .cam-title { font-size: 13px; font-weight: 700; color: #e2e2f0; flex: 1; }
.cat-assign-close { background: none; border: none; color: #6b7280; cursor: pointer; font-size: 16px; }
.cat-assign-search { padding: 10px 16px; border-bottom: 1px solid #1e2430; }
.cat-assign-list { flex: 1; overflow-y: auto; padding: 8px; }
.cam-group { margin-bottom: 4px; }
.cam-group-label { font-size: 9px; font-weight: 700; text-transform: uppercase; color: #4b5563; padding: 4px 6px; letter-spacing: .07em; }
.cam-cat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.cam-cat-item:hover { background: #1c2128; }
.cam-cat-item input[type=checkbox] { accent-color: #818cf8; flex-shrink: 0; }
.cam-cat-icon { font-size: 14px; }
.cam-cat-name { font-size: 12px; color: #e2e2f0; flex: 1; }
.cam-cat-count { font-size: 9px; color: #6b7280; }
.cam-subcat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 24px; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.cam-subcat-item:hover { background: #1c2128; }
.cam-subcat-item input[type=checkbox] { accent-color: #a78bfa; flex-shrink: 0; }
.cam-subcat-name { font-size: 11px; color: #9ca3af; flex: 1; }
.cat-assign-footer {
  padding: 10px 16px; border-top: 1px solid #1e2430;
  display: flex; gap: 8px; justify-content: flex-end;
}
.logo-upload-btn {
  font-size: 9px; background: none; border: 1px dashed #374151;
  color: #6b7280; border-radius: 4px; padding: 1px 5px;
  cursor: pointer; transition: border-color .12s, color .12s;
}
.logo-upload-btn:hover { border-color: #5865f2; color: #a5b4fc; }


/* Modal nueva categoría */
.ncat-field { display: flex; flex-direction: column; gap: 4px; }
.ncat-label { font-size: 10px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .05em; }

/* Botón + en cards de categoría */
.ccc-add-sub {
  display: none;
  position: absolute; bottom: 6px; left: 8px;
  background: none; border: 1px solid #374151;
  color: #4b5563; font-size: 13px; line-height: 1;
  width: 20px; height: 20px; border-radius: 4px;
  cursor: pointer; padding: 0; transition: border-color .12s, color .12s;
}
.catalog-cat-card:hover .ccc-add-sub { display: flex; align-items: center; justify-content: center; }
.ccc-add-sub:hover { border-color: #818cf8; color: #818cf8; }

/* ── Botones Lote WO / Lote DUX ─────────────────────────────────────────── */
.btn-lote { gap: 5px; font-size: 11px; transition: background .15s, color .15s; }
.btn-lote.lote-active { background: #1e2a1e; color: #4ade80; border-color: #166534; }
.btn-lote.lote-active:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

/* Filas en cola de lote */
tr.lote-pending td { opacity: .35; }
tr.lote-running td { opacity: 1; background: rgba(250,204,21,.06) !important; }
tr.lote-running td:first-child::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #facc15; margin-right: 4px;
  animation: lote-pulse .8s ease-in-out infinite alternate;
  vertical-align: middle;
}
tr.lote-done   td { opacity: .6; }
tr.lote-error  td { background: rgba(239,68,68,.08) !important; }
tr.lote-error  td:first-child::before {
  content: '⚠'; font-size: 10px; margin-right: 4px; color: #f87171;
}
@keyframes lote-pulse { from { opacity: .3; } to { opacity: 1; } }

/* Barra de progreso Lote (se inyecta bajo la toolbar) */
#lote-progress-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; font-size: 11px;
  background: #111827; border-bottom: 1px solid #374151;
}
#lote-progress-bar .lote-pb-track {
  flex: 1; height: 4px; background: #374151; border-radius: 2px; overflow: hidden;
}
#lote-progress-bar .lote-pb-fill {
  height: 100%; background: #818cf8; border-radius: 2px;
  transition: width .3s ease;
}
#lote-progress-bar .lote-pb-label { color: #9ca3af; white-space: nowrap; min-width: 120px; }
#lote-progress-bar .lote-pb-errors { color: #f87171; }
#lote-progress-bar .lote-pb-cancel {
  background: none; border: 1px solid #374151; color: #9ca3af;
  border-radius: 4px; padding: 2px 8px; font-size: 10px; cursor: pointer;
}
#lote-progress-bar .lote-pb-cancel:hover { border-color: #dc2626; color: #f87171; }
