/* ============================================================
   pi-buscador-productos · admin UI
   Estética consistente con pi-admin-design (tokens PI)
   ============================================================ */

:root {
  /* Colores PI */
  --pi-blue:   #2F80ED;
  --pi-teal:   #27AE60;
  --pi-orange: #E67E22;
  --pi-purple: #c00ed8;
  --pi-red:    #e75940;
  --pi-cyan:   #00BCD4;

  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-500: #64748B;
  --ink-300: #CBD5E1;
  --ink-100: #F1F5F9;
  --ink-50:  #F8FAFC;
  --paper:   #FFFFFF;

  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.15);

  --bar-height: 64px;
  --tabs-height: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-700);
  background: var(--ink-50);
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }

/* ============ HEADER ============ */
.brand-bar {
  background: var(--ink-900);
  height: var(--bar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand-bar-left {
  display: flex; align-items: center; gap: 14px;
}
.logo-square {
  width: 36px; height: 36px;
  background: var(--paper);
  color: var(--ink-900);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
}
.brand-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--paper);
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.brand-bar-right {
  display: flex; align-items: center; gap: 12px;
}
.pill {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink-100);
  padding: 0 20px;
  height: var(--tabs-height);
  position: sticky;
  top: var(--bar-height);
  z-index: 40;
}
.tab {
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  height: 100%;
  transition: all 0.15s;
}
.tab:hover { color: var(--ink-900); }
.tab.active {
  color: var(--pi-blue);
  border-bottom-color: var(--pi-blue);
}

/* ============ MAIN ============ */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
}
.panel { display: none; }
.panel.active { display: block; }

/* ============ BUSCADOR ============ */
.search-hero {
  margin-bottom: 20px;
}
.search-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--paper);
  border: 2px solid var(--ink-100);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--pi-blue);
  box-shadow: 0 0 0 3px rgba(47,128,237,0.08);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--ink-700);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--pi-blue); color: var(--pi-blue); }
.chip.active {
  background: var(--pi-blue);
  border-color: var(--pi-blue);
  color: var(--paper);
}
.chip-count {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.7;
}

.results-grid {
  display: grid;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-500);
  font-size: 14px;
  background: var(--paper);
  border-radius: var(--radius-md);
  border: 1px dashed var(--ink-300);
}

/* ============ TOOLBAR ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.toolbar-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  outline: none;
}
.toolbar-input:focus { border-color: var(--pi-blue); }
.toolbar-select {
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--paper);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}
.toolbar-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-500);
  white-space: nowrap;
}

/* ============ LISTA ============ */
.data-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.12s;
}
.row:hover {
  border-color: var(--pi-blue);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.row-icon {
  font-size: 22px;
}
.row-main { min-width: 0; }
.row-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 3px;
}
.row-price {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-900);
  text-align: right;
  white-space: nowrap;
}
.row-price-range {
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 400;
}
.row-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--ink-100);
  color: var(--ink-700);
}
.badge-available { background: #D1FAE5; color: #065F46; }
.badge-order { background: #FEF3C7; color: #92400E; }
.badge-out { background: #FEE2E2; color: #991B1B; }
.badge-preferente { background: var(--pi-blue); color: white; }

.stars {
  font-size: 12px;
  color: var(--pi-orange);
  letter-spacing: 1px;
}
.providers-inline {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--ink-500);
}

/* ============ BOTONES ============ */
.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary {
  background: var(--pi-blue);
  color: var(--paper);
}
.btn-primary:hover { background: #1f6fd8; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink-700);
  border-color: var(--ink-300);
}
.btn-ghost:hover { background: var(--ink-100); }
.btn-danger {
  background: transparent;
  color: var(--pi-red);
  border-color: var(--pi-red);
}
.btn-danger:hover { background: var(--pi-red); color: var(--paper); }
.btn-icon {
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--ink-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.btn-icon:hover { background: var(--ink-100); color: var(--ink-900); }

/* ============ DRAWER ============ */
.drawer {
  position: fixed; inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.drawer[aria-hidden="false"] {
  pointer-events: auto;
  opacity: 1;
}
.drawer-overlay {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
}
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(640px, 96vw);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s;
}
.drawer[aria-hidden="false"] .drawer-panel {
  transform: translateX(0);
}
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-header h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  gap: 10px;
  align-items: center;
}
.spacer { flex: 1; }

/* ============ FORMULARIO ============ */
.form-group {
  margin-bottom: 16px;
}
.form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--paper);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--pi-blue);
}
.form-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}
.form-hint {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 4px;
}
.form-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-100);
}
.form-section-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pi-blue);
  margin-bottom: 12px;
}

/* Checkbox grid para categorías */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}
.checkbox-item input { cursor: pointer; }
.checkbox-item:hover { border-color: var(--pi-blue); }
.checkbox-item.checked {
  background: rgba(47,128,237,0.08);
  border-color: var(--pi-blue);
}

/* Rating stars */
.rating-input {
  display: flex;
  gap: 2px;
  font-size: 22px;
}
.rating-star {
  cursor: pointer;
  color: var(--ink-300);
  transition: color 0.1s;
  user-select: none;
}
.rating-star.filled { color: var(--pi-orange); }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--pi-teal); }
.toast.error { background: var(--pi-red); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .brand-bar { padding: 0 12px; }
  .brand-sub { display: none; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .main { padding: 16px 12px; }
  .row { grid-template-columns: auto 1fr; }
  .row-price, .row-badge { grid-column: 2; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}

/* ============ BLOQUE AUTOCOMPLETAR IA ============ */
.ai-enrich-bar {
  margin: 16px 0 24px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(47,128,237,0.06), rgba(192,14,216,0.06));
  border: 1px solid rgba(47,128,237,0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-ai {
  background: var(--ink-900);
  color: var(--paper);
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-ai:hover {
  background: var(--pi-blue);
  transform: translateY(-1px);
}
.btn-ai:disabled {
  opacity: 0.6;
  cursor: wait;
  background: var(--ink-500);
}
.btn-ai .ai-icon {
  font-size: 16px;
  animation: sparkle 2s infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}
.ai-hint {
  flex: 1;
  font-size: 11px;
  color: var(--ink-500);
  line-height: 1.4;
  min-width: 200px;
}
.ai-result {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--ink-700);
}
.ai-result.working {
  color: var(--pi-blue);
  font-weight: 500;
}
.ai-result.success {
  color: var(--pi-teal);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ai-result.error {
  color: var(--pi-red);
}
.ai-result .ai-sources {
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-500);
  font-family: var(--font-mono);
}
.ai-confidence {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 6px;
}
.ai-confidence-alta { background: #D1FAE5; color: #065F46; }
.ai-confidence-media { background: #FEF3C7; color: #92400E; }
.ai-confidence-baja { background: #FEE2E2; color: #991B1B; }

/* Campos técnicos adicionales */
.specs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.specs-row .form-label { font-size: 10px; }


/* ==================== TAB ADMIN ==================== */
.admin-wrap {
  padding: 8px 4px;
}
.admin-header {
  margin-bottom: 24px;
}
.admin-subtitle {
  color: var(--ink-500);
  font-size: 14px;
  margin: 0;
}

.admin-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ink-100);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-subtabs::-webkit-scrollbar { display: none; }

.admin-subtab {
  background: none;
  border: none;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.admin-subtab:hover {
  color: var(--ink-700);
}
.admin-subtab.active {
  color: var(--pi-blue);
  border-bottom-color: var(--pi-blue);
}

.admin-content {
  padding: 16px 0;
  min-height: 300px;
}
.admin-placeholder {
  padding: 40px;
  text-align: center;
  background: var(--ink-50, #f9fafb);
  border: 1px dashed var(--ink-200, #e5e7eb);
  border-radius: 12px;
  color: var(--ink-600, #4b5563);
  font-size: 14px;
  line-height: 1.7;
}
.admin-placeholder strong {
  font-size: 16px;
  color: var(--ink-800, #1f2937);
}
.admin-placeholder small {
  display: inline-block;
  margin-top: 6px;
  color: var(--ink-500);
}


/* ==================== ADMIN · TABLAS Y FORMS ==================== */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.admin-toolbar h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-700, #374151);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--ink-100, #f3f4f6);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
.admin-table thead {
  background: var(--ink-50, #f9fafb);
}
.admin-table th {
  text-align: left;
  padding: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  font-weight: 600;
  border-bottom: 1px solid var(--ink-100);
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--ink-50, #f9fafb);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-table tbody tr:hover {
  background: var(--ink-50, #fafbfc);
}
.admin-icon-cell {
  font-size: 22px;
  text-align: center;
}
.admin-num {
  text-align: center;
  color: var(--ink-500);
  font-family: 'JetBrains Mono', monospace;
}
.admin-muted {
  color: var(--ink-500);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.admin-actions {
  text-align: right;
  white-space: nowrap;
}
.admin-actions .btn {
  margin-left: 4px;
}
.btn-sm {
  padding: 4px 10px !important;
  font-size: 12px !important;
}
.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
}


/* ==================== ADMIN · DASHBOARD IA ==================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.metric-card {
  background: white;
  border: 1px solid var(--ink-100, #f3f4f6);
  border-radius: 12px;
  padding: 18px;
}
.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 8px;
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-800, #1f2937);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.1;
}
.metric-sub {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.admin-card {
  background: white;
  border: 1px solid var(--ink-100, #f3f4f6);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.admin-card h4 {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  font-weight: 600;
}
.admin-card .admin-table {
  border: none;
}

.modo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modo-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
}
.modo-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700, #374151);
  text-transform: capitalize;
}
.modo-bar-wrap {
  height: 8px;
  background: var(--ink-100, #f3f4f6);
  border-radius: 999px;
  overflow: hidden;
}
.modo-bar {
  height: 100%;
  background: var(--pi-blue, #2F80ED);
  border-radius: 999px;
  transition: width 0.3s;
}
.modo-stats {
  font-size: 12px;
  color: var(--ink-500);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.ok-badge {
  color: #16a34a;
  font-weight: 700;
}
.err-badge {
  color: #dc2626;
  font-weight: 700;
}


/* Spinner para botones de IA */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--pi-blue, #2F80ED);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}


/* Espacio al final de la página para que el panel no tape contenido */
body {
  padding-bottom: 50px;
}

.dev-log-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: 350px;
  background: #111827;
  color: #e5e7eb;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.25s;
  border-top: 1px solid #1f2937;
}
.dev-log-panel.dev-log-collapsed {
  max-height: 40px;
}

.dev-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #1f2937;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
  height: 40px;
  box-sizing: border-box;
}

.dev-log-badge {
  display: inline-block;
  background: #2F80ED;
  color: white;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
}

.dev-log-controls {
  display: flex;
  gap: 6px;
}
.dev-log-controls button {
  background: transparent;
  border: 1px solid #374151;
  color: #9ca3af;
  cursor: pointer;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: inherit;
}
.dev-log-controls button:hover {
  background: #374151;
  color: white;
}

.dev-log-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 4px 12px;
  align-content: start;
}

.dev-log-entry {
  padding: 6px 12px;
  border-left: 3px solid #374151;
  background: rgba(255,255,255,0.02);
  border-radius: 0 4px 4px 0;
  margin: 0 6px;
}
.dev-log-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}
.dev-log-head small {
  color: #6b7280;
  font-size: 10px;
}
.dev-log-msg {
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d1d5db;
  line-height: 1.4;
  font-size: 11px;
}

/* Drawer también respeta el espacio del panel */
.drawer-panel {
  bottom: 50px !important;
}

/* ==================== DEV LOG PANEL (footer mejorado) ==================== */

body {
  padding-bottom: 50px;
}

.dev-log-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: 400px;
  background: #0f172a;
  color: #e5e7eb;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.25s;
  border-top: 1px solid #1e293b;
}
.dev-log-panel.dev-log-collapsed {
  max-height: 40px;
}

.dev-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #1e293b;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
  height: 40px;
  box-sizing: border-box;
}

.dev-log-badge {
  display: inline-block;
  background: #3b82f6;
  color: white;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}

.dev-log-controls {
  display: flex;
  gap: 6px;
}
.dev-log-controls button {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: inherit;
  transition: all 0.15s;
}
.dev-log-controls button:hover {
  background: #334155;
  color: white;
  border-color: #475569;
}

.dev-log-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dev-log-empty {
  padding: 30px;
  color: #64748b;
  font-size: 11px;
  text-align: center;
  font-style: italic;
}

.dev-log-entry {
  padding: 8px 12px;
  border-left: 3px solid #334155;
  border-radius: 0 4px 4px 0;
  transition: background 0.15s;
}
.dev-log-entry:hover {
  background: rgba(255,255,255,0.04) !important;
}

.dev-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  margin-bottom: 2px;
}
.dev-log-type {
  font-weight: 700;
  letter-spacing: 0.03em;
}
.dev-log-time {
  color: #64748b;
  font-size: 10px;
  font-family: inherit;
}

.dev-log-msg {
  color: #e2e8f0;
  line-height: 1.5;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.dev-log-data {
  margin: 6px 0 0;
  padding: 6px 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.4;
  white-space: pre;
  overflow-x: auto;
  font-family: inherit;
  max-height: 150px;
  overflow-y: auto;
}

/* Drawer no se tapa con el panel */
.drawer-panel {
  bottom: 50px !important;
}


/* ==================== INDICADORES DE CONFIANZA (IA proveedor) ==================== */
.form-input.conf-alta {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 1px rgba(22,163,74,0.2);
}
.form-input.conf-media {
  border-color: #eab308 !important;
  box-shadow: 0 0 0 1px rgba(234,179,8,0.2);
}
.form-input.conf-baja {
  border-color: #f97316 !important;
  box-shadow: 0 0 0 1px rgba(249,115,22,0.25);
}
.form-input.conf-null {
  border-color: #e5e7eb !important;
}

/* Hover tooltip mejorado */
.form-input[title] {
  cursor: help;
}

/* LOGIN SCREEN */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #2F80ED 0%, #8E44AD 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: -apple-system, sans-serif;
  z-index: 100000;
}
.login-card {
  background: white;
  padding: 56px 48px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  max-width: 420px;
  width: 90%;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #2F80ED, #8E44AD);
  color: white;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900;
  margin: 0 auto 20px;
}
.login-card h1 {
  font-size: 22px; margin: 0 0 6px; color: #111;
}
.login-card > p {
  color: #6b7280; font-size: 14px; margin: 0 0 28px;
}
.login-error {
  background: #fee2e2; color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 0 0 20px;
  font-size: 13px; text-align: left;
}
.btn-google {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 13px 28px;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 8px;
  color: #3c4043;
  text-decoration: none;
  font-weight: 500; font-size: 15px;
  margin-bottom: 20px;
  cursor: pointer;
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 4px rgba(60,64,67,0.15);
}
.login-card small {
  display: block;
  color: #9ca3af;
  font-size: 11px;
}

/* USER MENU */
.user-menu {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  padding: 6px 14px 6px 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 24px;
  color: white;
  font-size: 13px;
}
.user-menu img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
}
.user-avatar-placeholder {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: white;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  cursor: pointer;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.2);
}

/* ==================== ARCHIVOS ==================== */
.archivos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.archivo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: transform 0.15s, border-color 0.15s;
}
.archivo-item:hover {
  transform: scale(1.03);
  border-color: #2F80ED;
}
.archivo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archivo-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}
.archivo-pdf-icon { font-size: 32px; }
.archivo-pdf-name {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111;
}
.archivo-pdf-size { font-size: 10px; color: #6b7280; margin-top: 2px; }

.archivo-star {
  position: absolute; top: 4px; left: 4px;
  background: #fbbf24; color: white;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.archivo-delete {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(220,38,38,0.9); color: white;
  border: none; border-radius: 50%;
  cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity 0.15s;
}
.archivo-item:hover .archivo-delete { opacity: 1; }
.archivo-delete:hover { background: #dc2626; }

.archivos-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 10px;
}
.archivos-dropzone:hover, .archivos-dropzone.drag-over {
  border-color: #2F80ED;
  background: rgba(47,128,237,0.05);
}
.archivos-dropzone-inner { pointer-events: none; }


/* ==================== MODAL APROBACION IA ==================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100002;
  padding: 20px;
}
.modal-content.modal-aprobacion {
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-close {
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: #6b7280; padding: 0 8px;
  line-height: 1;
}
.modal-subheader {
  padding: 10px 20px;
  background: #f9fafb;
  font-size: 12px;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}
.modal-toolbar {
  padding: 10px 20px;
  display: flex; gap: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end; gap: 10px;
  background: #f9fafb;
}

.ia-cards-grid {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.ia-card {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ia-card:has(input:checked) {
  border-color: #2F80ED;
  background: rgba(47,128,237,0.05);
  box-shadow: 0 0 0 2px rgba(47,128,237,0.2);
}
.ia-card-check {
  position: absolute; top: 8px; right: 8px;
  width: 18px; height: 18px;
  cursor: pointer;
  z-index: 2;
}
.ia-card-preview {
  aspect-ratio: 4/3;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ia-card-preview img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.ia-card-pdf {
  font-size: 44px;
  display: flex; flex-direction: column; align-items: center;
}
.ia-card-tipo {
  font-size: 10px;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
}
.ia-card-nombre {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ia-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ia-card-fuente {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== COPY BUTTON ==================== */
.btn-copy-field {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.5;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
  vertical-align: middle;
}
.btn-copy-field:hover {
  opacity: 1;
  background: rgba(47, 128, 237, 0.1);
}
.btn-copy-field:active {
  background: rgba(47, 128, 237, 0.2);
}

/* Copy button en labels */
.btn-copy-field {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.5;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
  vertical-align: middle;
}
.btn-copy-field:hover {
  opacity: 1;
  background: rgba(47, 128, 237, 0.1);
}

/* ==================== LIGHTBOX V2 RESPONSIVE ==================== */
.archivo-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
  z-index: 100001;
}
.archivo-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  gap: 10px;
  flex-shrink: 0;
}
.archivo-lightbox-title {
  color: white;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.archivo-lightbox-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.archivo-lightbox-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.archivo-lightbox-btn:hover {
  background: rgba(255,255,255,0.25);
}
.archivo-lightbox-close {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.archivo-lightbox-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
  min-height: 0;
}
.archivo-lightbox-inner img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.archivo-lightbox-inner iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  background: white;
}
.archivo-ios-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

@media (max-width: 640px) {
  .archivo-lightbox-bar { padding: 10px 12px; }
  .archivo-lightbox-title { font-size: 12px; }
  .archivo-lightbox-btn { padding: 8px 10px; font-size: 12px; }
  .archivo-lightbox-actions { gap: 6px; }
  .archivo-lightbox-inner { padding: 10px; }
}

/* ==================== LISTADO PRODUCTOS V2 ==================== */

/* Toolbar superior */
.prod-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-panel, white);
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border, #e5e7eb);
}
.prod-toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.prod-search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-input, #f9fafb);
  transition: border-color 0.15s;
}
.prod-search-input:focus {
  outline: none;
  border-color: var(--pi-blue, #2F80ED);
  background: white;
}
.prod-select,
.prod-select-small {
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  color: var(--ink-900, #111);
  min-width: 160px;
}
.prod-select:hover,
.prod-select-small:hover {
  border-color: var(--pi-blue, #2F80ED);
}
.prod-select-small {
  min-width: 140px;
  font-size: 12px;
}
.prod-toolbar-meta {
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border, #f3f4f6);
}
.prod-count {
  font-size: 13px;
  color: var(--ink-600, #6b7280);
  font-weight: 500;
}
.prod-sort-vista {
  display: flex;
  gap: 10px;
  align-items: center;
}
.prod-vista-toggle {
  display: flex;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  overflow: hidden;
}
.prod-vista-btn {
  background: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-500, #9ca3af);
  transition: all 0.15s;
}
.prod-vista-btn:hover {
  background: #f3f4f6;
}
.prod-vista-btn.active {
  background: var(--pi-blue, #2F80ED);
  color: white;
}

/* Chips de filtros activos */
.prod-toolbar-chips {
  gap: 6px;
  display: none;
  flex-wrap: wrap;
}
.prod-chips-label {
  font-size: 12px;
  color: var(--ink-600, #6b7280);
  font-weight: 500;
  padding: 4px 0;
  margin-right: 4px;
}
.prod-chip-activo {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.prod-chip-activo:hover {
  background: #bfdbfe;
}
.prod-chip-x {
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
  margin-left: 2px;
}
.prod-chip-limpiar {
  background: transparent;
  color: var(--pi-red, #E74C3C);
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-left: auto;
}
.prod-chip-limpiar:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* Tabla (vista lista) */
.prod-tabla {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
}
.prod-header {
  display: grid;
  grid-template-columns: 50px 140px 1fr 120px 80px 60px;
  gap: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-600, #6b7280);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.prod-row {
  display: grid;
  grid-template-columns: 50px 140px 1fr 120px 80px 60px;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.1s;
  align-items: center;
}
.prod-row:hover {
  background: #f9fafb;
}
.prod-row:last-child {
  border-bottom: none;
}
.prod-cell {
  overflow: hidden;
}
.prod-cell.prod-img {
  display: flex;
  align-items: center;
  justify-content: center;
}
.prod-cell.prod-img img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}
.prod-img-placeholder {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 22px;
}
.prod-cell.prod-marca {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-900, #111);
  line-height: 1.3;
}
.prod-modelo {
  font-size: 11px;
  color: var(--ink-600, #6b7280);
  font-weight: 400;
  font-family: var(--font-mono, monospace);
}
.prod-cell.prod-nombre {
  font-size: 13px;
  color: var(--ink-800, #1f2937);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.prod-cell.prod-precio {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900, #111);
  line-height: 1.3;
  text-align: right;
}
.prod-precio-cotizar {
  color: var(--pi-orange, #E67E22);
  font-weight: 500;
  font-size: 12px;
}
.prod-precio-vacio {
  color: var(--ink-500, #9ca3af);
}
.prod-cell.prod-stock {
  font-size: 18px;
  text-align: center;
}
.prod-cell.prod-badges {
  font-size: 14px;
  text-align: center;
  color: var(--ink-600);
}

/* Grid (vista tarjetas) */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.prod-card {
  background: white;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.prod-card:hover {
  border-color: var(--pi-blue, #2F80ED);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}
.prod-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prod-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.prod-card-img-placeholder {
  font-size: 40px;
  color: var(--ink-400, #d1d5db);
}
.prod-card-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.prod-card-marca {
  font-size: 11px;
  font-weight: 600;
  color: var(--pi-blue, #2F80ED);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.prod-card-nombre {
  font-size: 13px;
  color: var(--ink-900, #111);
  line-height: 1.3;
  flex: 1;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}
.prod-card-precio {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900, #111);
}
.prod-card-stock {
  font-size: 16px;
}

/* Mobile */
@media (max-width: 768px) {
  .prod-toolbar {
    padding: 12px;
  }
  .prod-toolbar-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .prod-select {
    min-width: 140px;
    flex-shrink: 0;
  }
  .prod-toolbar-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .prod-vista-toggle {
    display: none; /* Mobile: solo vista lista */
  }
  .prod-header {
    display: none;
  }
  .prod-row {
    grid-template-columns: 50px 1fr auto;
    grid-template-areas:
      "img info precio"
      "img info stock";
    gap: 8px;
    padding: 10px;
  }
  .prod-row .prod-img { grid-area: img; }
  .prod-row .prod-marca,
  .prod-row .prod-nombre { grid-column: info; }
  .prod-row .prod-marca { grid-row: 1; }
  .prod-row .prod-nombre {
    grid-row: 2;
    font-size: 12px;
    -webkit-line-clamp: 1;
  }
  .prod-row .prod-precio {
    grid-area: precio;
    text-align: right;
    font-size: 12px;
  }
  .prod-row .prod-stock {
    grid-area: stock;
    text-align: right;
    align-self: end;
  }
  .prod-row .prod-badges {
    display: none;
  }
}


/* Fix: uniformar todos los titulos del header de la tabla */
.prod-header .prod-cell {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--ink-600, #6b7280) !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  text-align: left;
  background: transparent;
}
.prod-header .prod-cell.prod-img,
.prod-header .prod-cell.prod-stock,
.prod-header .prod-cell.prod-badges {
  text-align: center;
}
.prod-header .prod-cell.prod-precio {
  text-align: right;
}

/* ==================== HEADERS ORDENABLES ==================== */
.prod-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.prod-sortable:hover {
  color: var(--pi-blue, #2F80ED);
}
.prod-sortable:active {
  background: rgba(47, 128, 237, 0.08);
}

/* ==================== TOGGLE NETO / +IVA ==================== */
.precio-campo {
  display: flex;
  flex-direction: column;
}

.iva-toggle {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: #666;
}

.iva-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  user-select: none;
}

.iva-toggle label:has(input:checked) {
  background: rgba(47, 128, 237, 0.08);
  color: #2F80ED;
  font-weight: 600;
}

.iva-toggle input[type="radio"] {
  margin: 0;
  width: 12px;
  height: 12px;
}

/* Texto secundario "c/IVA" en listados - display block para 2 lineas */
.precio-iva-info {
  display: block;
  font-size: 10px;
  color: #999;
  font-weight: normal;
  margin-top: 2px;
}

