/* Scoped Dashboard Styles for Admin PWA */

.dash-app {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Barra Superior Global */
.dash-top-bar {
  background: #ffffff;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-top-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(239, 25, 35, 0.35));
  flex-shrink: 0;
}

.auth-box-dash .auth-brand-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(239, 25, 35, 0.4));
  margin-bottom: 12px;
}

.top-icon {
  font-size: 26px;
}

.dash-top-bar h1 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.top-sub {
  font-size: 12px;
  color: #64748b;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}


/* Chip Cartera */
.portfolio-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.portfolio-chip.positive {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.portfolio-chip.negative {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.portfolio-chip.neutral {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.chip-label {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

/* Layout 2 Columnas */
.dash-layout {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

/* Columna Izquierda: Sidebar */
.sidebar-panel {
  width: 330px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 90px);
  max-height: calc(100vh - 90px);
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.sidebar-tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 14px 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header-top h3 {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.badge-compare-count {
  font-size: 10px;
  font-weight: 700;
  background: #2563eb;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.select-sort {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.select-sort:focus {
  border-color: #2563eb;
}

.compare-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
}

.btn-text-action {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-text-action:hover {
  color: #1e40af;
  background: #eff6ff;
}

.search-wrap input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap input:focus {
  border-color: #2563eb;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-list::-webkit-scrollbar {
  width: 5px;
}

.sidebar-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Tarjeta individual en el Sidebar */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.sidebar-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
}

.sidebar-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sidebar-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sidebar-info {
  flex: 1;
  min-width: 0;
}

.sidebar-top-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.sidebar-top-row .badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 3px;
}

.sidebar-price {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.sidebar-savings {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.sidebar-savings.pos {
  background: #dcfce7;
  color: #15803d;
}

.sidebar-savings.neg {
  background: #fee2e2;
  color: #b91c1c;
}

.sidebar-savings.neu {
  background: #f1f5f9;
  color: #64748b;
}

/* Columna Derecha: Panel de Detalle */
.detail-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Botones genéricos */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-secondary.spinning .refresh-spinner-icon,
.btn-secondary.spinning span {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Ficha del Producto */
.product-banner {
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  gap: 18px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.product-img-box {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-info-box {
  flex: 1;
  min-width: 0;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}

.store-promart {
  background: #ffedd5;
  color: #c2410c;
}

.store-sodimac {
  background: #e0f2fe;
  color: #0369a1;
}

.store-falabella {
  background: #dcfce7;
  color: #15803d;
}

.store-ripley {
  background: #f3e8ff;
  color: #6d28d9;
}

.store-oechsle {
  background: #fee2e2;
  color: #b91c1c;
}

.store-plazavea {
  background: #ffe4e6;
  color: #be123c;
}

.store-platanitos {
  background: #fef3c7;
  color: #b45309;
}

.store-estilos {
  background: #e0e7ff;
  color: #4338ca;
}

.store-default {
  background: #f1f5f9;
  color: #475569;
}

.badge-location {
  background: #f1f5f9;
  color: #475569;
  text-transform: none;
  font-weight: 600;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-stock {
  background: #dcfce7;
  color: #15803d;
}

.badge-stock.out {
  background: #fee2e2;
  color: #b91c1c;
}

.text-muted {
  font-size: 11px;
  color: #64748b;
}

.product-info-box h2 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
  margin-bottom: 4px;
}

.sku-text {
  font-size: 11px;
  color: #94a3b8;
}

.product-actions-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* KPIs de Precios (3 Columnas con degradé elegante y sin marcos chillones) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kpi-card {
  position: relative;
  background: linear-gradient(150deg, #ffffff 0%, #f8fafc 100%);
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid #eef2f6;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 3px 8px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 96px;
  box-sizing: border-box;
}

/* Columna 1: Tarjeta Hero (Mejor Precio) con fondo amarillo.png */
.kpi-card-hero {
  background-image: url('icons/amarillo.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(234, 179, 8, 0.35);
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

.kpi-card-hero .kpi-label {
  color: #78350f;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.kpi-card-hero .kpi-value {
  color: #0f172a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.kpi-card-hero .kpi-sub {
  color: #451a03;
  font-weight: 600;
  opacity: 0.9;
}

/* Columna 2: Registro Inicial con degradé suave */
.kpi-card-initial {
  background: linear-gradient(150deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #f1f5f9;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 23px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 4px;
}

.text-champion {
  color: #0f172a;
}

.kpi-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* Columna 3: Rango Histórico (Máximo arriba con rojo.png, Mínimo abajo con verde.png) */
.kpi-card-range {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  background: linear-gradient(150deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #eef2f6;
  border-radius: 12px;
}

.kpi-range-row {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 9px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-range-row:hover {
  transform: translateY(-1px);
}

/* Fila 1 (Arriba): Máximo Histórico con fondo rojo.png */
.kpi-range-max {
  background-image: url('icons/rojo.png');
  border: 1px solid rgba(220, 38, 38, 0.25);
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.12);
}

.kpi-range-max .tag-max {
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.kpi-range-max .sub-max {
  color: rgba(255, 255, 255, 0.88);
  font-size: 9.5px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.kpi-range-max .text-max {
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Fila 2 (Abajo): Mínimo Histórico con fondo verde.png */
.kpi-range-min {
  background-image: url('icons/verde.png');
  border: 1px solid rgba(22, 101, 52, 0.25);
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.1);
}

.kpi-range-min .tag-min {
  color: #022c22;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
}

.kpi-range-min .sub-min {
  color: #064e3b;
  font-size: 9.5px;
  font-weight: 600;
  opacity: 0.9;
}

.kpi-range-min .text-min {
  color: #022c22;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.kpi-range-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.kpi-range-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.kpi-range-sub {
  font-size: 10px;
}

.kpi-range-value {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.text-min {
  color: #022c22;
}

.text-max {
  color: #ffffff;
}

.text-green {
  color: #15803d;
}

.text-red {
  color: #dc2626;
}

@media (max-width: 860px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Gráfico */
.chart-section {
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.chart-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.chart-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot-online {
  background: #2563eb;
}

.dot-card {
  background: #f59e0b;
}

.dot-initial {
  background: #8b5cf6;
}

.dot-min {
  background: #10b981;
}

.chart-container {
  width: 100%;
  position: relative;
  background: #fafafa;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 10px 8px 4px 8px;
}

canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translate(-50%, -100%);
  margin-top: -10px;
  white-space: nowrap;
}

.chart-tooltip.hidden {
  display: none;
}

/* Tabla */
.table-section {
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.history-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 2px solid #e2e8f0;
}

.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.history-table tr:hover {
  background: #f8fafc;
}

.table-badge-down {
  color: #15803d;
  font-weight: 700;
}

.table-badge-up {
  color: #dc2626;
  font-weight: 700;
}

.table-badge-eq {
  color: #94a3b8;
}

/* Checkbox en el Sidebar Item */
.sidebar-item-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.compare-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* Modo Comparador (VS) */
.compare-top-header {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.compare-top-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.compare-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* ==========================================
   RANKING VERTICAL DE COMPARATIVAS (1° al 8°)
   ========================================== */
.comparison-ranking-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comparison-rank-row {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.comparison-rank-row:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.comparison-rank-row.is-winner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.comparison-rank-row.is-out {
  background: #fafafa;
  border-color: #e2e8f0;
  opacity: 0.75;
}

.rank-left-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.rank-badge-wrap {
  width: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-medal {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.rank-medal-gold {
  color: #b45309;
}

.rank-medal-silver {
  color: #475569;
}

.rank-medal-bronze {
  color: #9a3412;
}

.rank-medal-default {
  color: #64748b;
  font-size: 14px;
}

.rank-medal-out {
  color: #dc2626;
  font-size: 11px;
}

.rank-thumb-wrap {
  width: 54px;
  height: 54px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.rank-thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.rank-info-wrap {
  flex: 1;
  min-width: 0;
}

.rank-tags-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.rank-title-link {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rank-title-link:hover {
  color: #2563eb;
}

.rank-sku-line {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.rank-center-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 170px;
  flex-shrink: 0;
}

.rank-price-display {
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.rank-price-note {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.rank-diff-wrap {
  margin-top: 4px;
}

.rank-diff-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  border: none;
}

.rank-diff-pill.best {
  background: #dcfce7;
  color: #15803d;
}

.rank-diff-pill.more {
  background: #fee2e2;
  color: #b91c1c;
}

.rank-diff-pill.tie {
  background: #f1f5f9;
  color: #475569;
}

.rank-diff-pill.out {
  background: #fffbeb;
  color: #b45309;
}

.rank-right-group {
  flex-shrink: 0;
}

.btn-rank-buy {
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.btn-rank-buy:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .comparison-rank-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .rank-left-group {
    width: 100%;
  }
  .rank-center-group {
    align-items: flex-start;
    width: 100%;
  }
  .rank-right-group {
    width: 100%;
  }
  .btn-rank-buy {
    width: 100%;
    justify-content: center;
  }
}

/* Grilla de Columnas Comparativas (2 o 3 productos) */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.compare-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.compare-card-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.compare-card-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.compare-card-img {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.compare-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.compare-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compare-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-price-box {
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.compare-price-val {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.compare-price-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.compare-card-savings {
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  width: fit-content;
}

/* Colores para las 3 líneas del comparador */
.color-p1 {
  background-color: #2563eb;
}
.color-p2 {
  background-color: #f59e0b;
}
.color-p3 {
  background-color: #10b981;
}

/* ==========================================
   PESTAÑAS DEL SIDEBAR (Productos / Duelos)
   ========================================== */
.sidebar-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
}

.sidebar-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-tab:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.sidebar-tab.active {
  color: #2563eb;
  background: #ffffff;
  border-bottom-color: #2563eb;
  font-weight: 700;
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.duels-header-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.duels-sub {
  font-size: 11px;
  color: #64748b;
  margin: 0;
}

/* Botón Danger Outline */
.btn-danger-outline {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

/* Barra de Acción con botón Guardar Duelo */
.compare-action-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.compare-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botón papelera en item del sidebar */
.sb-item-del {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
}

.sidebar-item:hover .sb-item-del {
  opacity: 1;
}

.sb-item-del:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ==========================================
   TARJETAS DUALES EN EL SIDEBAR
   ========================================== */
.sidebar-duel-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.sidebar-duel-item:hover {
  background: #f8fafc;
}

.sidebar-duel-item.active {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.duel-dual-thumbs {
  display: flex;
  align-items: center;
  position: relative;
  width: 50px;
  height: 38px;
  flex-shrink: 0;
}

.duel-thumb-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  object-fit: contain;
  position: absolute;
}

.duel-thumb-img.thumb-promart {
  left: 0;
  top: 0;
  z-index: 1;
  border-color: #fdba74;
}

.duel-thumb-img.thumb-sodimac {
  right: 0;
  bottom: 0;
  z-index: 2;
  border-color: #86efac;
}

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

.duel-item-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-item-sub {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.duel-pill-winner {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.duel-pill-winner.promart {
  background: #ffedd5;
  color: #ea580c;
}

.duel-pill-winner.sodimac {
  background: #e0f2fe;
  color: #0284c7;
}

.duel-pill-winner.falabella {
  background: #dcfce7;
  color: #16a34a;
}

.duel-pill-winner.ripley {
  background: #f3e8ff;
  color: #7c3aed;
}

.duel-pill-winner.oechsle {
  background: #fee2e2;
  color: #dc2626;
}

.duel-pill-winner.plazavea {
  background: #ffe4e6;
  color: #e11d48;
}

.duel-pill-winner.platanitos {
  background: #fef3c7;
  color: #d97706;
}

.duel-pill-winner.estilos {
  background: #e0e7ff;
  color: #4f46e5;
}

.duel-pill-winner.tie {
  background: #f1f5f9;
  color: #64748b;
}

.duel-right-col {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.duel-diff-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.duel-diff-badge.positive {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.duel-diff-badge.tie {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.duel-diff-badge.out-of-stock {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 10px;
}

.duel-diff-badge.single-stock {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 10px;
}

.duel-item-del-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-duel-item:hover .duel-item-del-btn {
  opacity: 1;
}

.duel-item-del-btn:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ==========================================
   CABECERA PRINCIPAL DE DUELO (Ring de Boxeo)
   ========================================== */
.duel-header-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.duel-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.duel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.duel-tag-pill {
  font-size: 10px;
  font-weight: 800;
  background: #fef3c7;
  color: #92400e;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.duel-clean-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.duel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================
   PODIO DEL GANADOR OFICIAL (Sin redundancia)
   ========================================== */
.duel-podium-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
  transition: all 0.2s ease;
}

.duel-podium-banner.tie {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-color: #cbd5e1;
  box-shadow: none;
}

.duel-podium-banner.out-of-stock {
  background: #fffbeb;
  border-color: #fde68a;
  box-shadow: none;
}

.podium-content-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.podium-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.podium-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.podium-crown {
  font-size: 18px;
  line-height: 1;
}

.podium-title-text {
  font-size: 13px;
  font-weight: 800;
  color: #15803d;
  letter-spacing: 0.5px;
}

.duel-podium-banner.tie .podium-title-text {
  color: #0369a1;
}

.duel-podium-banner.out-of-stock .podium-title-text {
  color: #b45309;
}

.podium-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.podium-price-val {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.podium-price-type {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.podium-savings-text {
  font-size: 13px;
  font-weight: 600;
  color: #166534;
}

.duel-podium-banner.tie .podium-savings-text {
  color: #475569;
}

.duel-podium-banner.out-of-stock .podium-savings-text {
  color: #92400e;
}

.podium-cta-col {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.podium-empty-msg {
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

.btn-podium-buy {
  background: #16a34a;
  color: #ffffff !important;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  white-space: nowrap;
}

.btn-podium-buy:hover {
  background: #15803d;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
  transform: translateY(-1px);
}

.btn-podium-buy.btn-buy-promart {
  background: #ea580c;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.btn-podium-buy.btn-buy-promart:hover {
  background: #c2410c;
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.35);
}

.btn-podium-buy.btn-buy-sodimac {
  background: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-podium-buy.btn-buy-sodimac:hover {
  background: #0369a1;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.btn-podium-buy.btn-buy-falabella {
  background: #16a34a;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.btn-podium-buy.btn-buy-falabella:hover {
  background: #15803d;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
}

.btn-podium-buy.btn-buy-ripley {
  background: #7c3aed;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
}

.btn-podium-buy.btn-buy-ripley:hover {
  background: #6d28d9;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
}

.btn-podium-buy.btn-buy-oechsle {
  background: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.btn-podium-buy.btn-buy-oechsle:hover {
  background: #b91c1c;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
}

.btn-podium-buy.btn-buy-plazavea {
  background: #e11d48;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.btn-podium-buy.btn-buy-plazavea:hover {
  background: #be123c;
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35);
}

.btn-podium-buy.btn-buy-platanitos {
  background: #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.btn-podium-buy.btn-buy-platanitos:hover {
  background: #b45309;
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.35);
}

.btn-podium-buy.btn-buy-estilos {
  background: #4f46e5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-podium-buy.btn-buy-estilos:hover {
  background: #4338ca;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

@media (max-width: 680px) {
  .podium-content-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .podium-cta-col {
    width: 100%;
  }
  .btn-podium-buy {
    width: 100%;
    justify-content: center;
  }
}

.hidden {
  display: none !important;
}

/* ==========================================
   INTEGRACIÓN CLOUD, ANUNCIOS Y CANDADO ADMIN
   ========================================== */
.admin-announcement-dash {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #93c5fd;
  border-bottom: 1px solid #334155;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-announcement-dash .ann-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  margin-left: auto;
  font-size: 16px;
}

.user-badge-header {
  font-size: 11px;
  font-weight: 700;
  color: #3b82f6;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.license-lock-overlay-dash {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lock-box-dash {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 440px;
  text-align: center;
  color: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lock-box-dash .lock-icon {
  font-size: 48px;
}

.lock-box-dash h2 {
  font-size: 20px;
  font-weight: 800;
  color: #f87171;
}

.lock-box-dash p {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Auth / Google Sign-In Modal (Dashboard) */
.auth-box-dash h2 {
  color: #ffffff;
}

.btn-google-auth-ext {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #ffffff;
  color: #1e293b;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.btn-google-auth-ext:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: 0 6px 10px -1px rgba(0, 0, 0, 0.3);
}

.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  text-align: center;
  margin: 12px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #334155;
}

.auth-divider span {
  padding: 0 10px;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-manual-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.input-auth {
  flex: 1;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 13px;
}

.input-auth:focus {
  outline: none;
  border-color: #38bdf8;
}

/* ==========================================
   MODAL IN-APP: GUARDAR / RENOMBRAR COMPARATIVA
   ========================================== */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.18s ease-out;
}

.custom-modal-overlay.hidden {
  display: none !important;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.custom-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: slideUpModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #e2e8f0;
}

@keyframes slideUpModal {
  from { transform: translateY(18px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.custom-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-modal-icon {
  font-size: 22px;
}

.custom-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.custom-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.custom-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.custom-modal-body {
  padding: 24px;
}

.custom-modal-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.custom-modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.custom-modal-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.custom-modal-hint {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.custom-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

/* Toast Flotante */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 14px 22px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #334155;
}

.toast-notification.hidden {
  display: none !important;
}

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

/* ==========================================
   ADMIN PWA - EXTENSIONES DEL DASHBOARD VIVO
   ========================================== */

.admin-feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.feed-toggle-group {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.feed-toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.feed-toggle-btn.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-mirror-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-mirror-text {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-exit-mirror {
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-exit-mirror:hover {
  background: #1d4ed8;
  color: #ffffff;
}

/* ===================================================
   OVERHAUL VISUAL ANTIDESBORDE Y ALINEACIÓN
   =================================================== */

/* 1. Layout Principal Admin: Grid fluido sin colisiones */
.dash-layout-admin {
  display: grid !important;
  grid-template-columns: 310px minmax(0, 1fr) !important;
  gap: 16px !important;
  align-items: start !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* 2. Barra Lateral (Sidebar) sin altura rígida ni sticky roto */
.dash-layout-admin .sidebar-panel {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  position: static !important;
  top: auto !important;
  overflow: visible !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .sidebar-list {
  max-height: 650px !important;
  overflow-y: auto !important;
  padding: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  box-sizing: border-box !important;
}

/* 3. Tarjeta de Producto en el Sidebar: Formato Vertical Ordenado */
.admin-sb-item {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  padding: 9px 11px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.admin-sb-item:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.admin-sb-item.active {
  background: #f0fdf4 !important;
  border-color: #10b981 !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.12) !important;
}

.admin-sb-item-top {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  min-width: 0 !important;
}

.admin-sb-thumb {
  width: 38px !important;
  height: 38px !important;
  object-fit: contain !important;
  border-radius: 6px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  flex-shrink: 0 !important;
}

.admin-sb-info {
  flex: 1 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.admin-sb-badges {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-wrap: wrap !important;
  margin-bottom: 2px !important;
}

.admin-sb-name {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
  width: 100% !important;
}

.admin-sb-price-line {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  margin-top: 3px !important;
}

.admin-sb-price {
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #047857 !important;
}

.admin-sb-delta {
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #047857 !important;
  background: #ecfdf5 !important;
  border: 1px solid #d1fae5 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  white-space: nowrap !important;
}

.admin-sb-delta.up {
  color: #be123c !important;
  background: #fff1f2 !important;
  border-color: #ffe4e6 !important;
}

.admin-sb-owner-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  padding-top: 5px !important;
  border-top: 1px dashed #f1f5f9 !important;
  width: 100% !important;
  min-width: 0 !important;
}

.owner-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  background: #f0fdf4 !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  max-width: 160px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* 4. Panel de Detalle Derecho: Adaptable a pantallas normales */
.dash-layout-admin .detail-panel {
  min-width: 0 !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  box-sizing: border-box !important;
}

/* 5. Banner de Producto: Cero desborde de etiquetas */
.dash-layout-admin .product-banner {
  background: #ffffff !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  display: flex !important;
  gap: 14px !important;
  align-items: center !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .product-info-box {
  flex: 1 !important;
  min-width: 0 !important;
}

.dash-layout-admin .badge-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  margin-bottom: 4px !important;
}

.dash-layout-admin .product-info-box h2 {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  line-height: 1.35 !important;
  margin-bottom: 4px !important;
  word-break: break-word !important;
}

/* 6. Las 3 Tarjetas KPI: Flexibles y proporcionales */
.dash-layout-admin .kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .kpi-card {
  padding: 12px 14px !important;
  border-radius: 12px !important;
  min-height: 88px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.dash-layout-admin .kpi-label {
  font-size: 9.5px !important;
  font-weight: 800 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  margin-bottom: 4px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dash-layout-admin .kpi-value {
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  line-height: 1.1 !important;
  margin-bottom: 3px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dash-layout-admin .kpi-sub {
  font-size: 10.5px !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Columna 3: Rango Histórico Apilado */
.dash-layout-admin .kpi-card-range {
  padding: 5px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  justify-content: space-between !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .kpi-range-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 6px 9px !important;
  border-radius: 7px !important;
  gap: 6px !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .kpi-range-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 1px !important;
  min-width: 0 !important;
  flex: 1 !important;
}

.dash-layout-admin .kpi-range-tag {
  font-size: 8.5px !important;
  font-weight: 800 !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dash-layout-admin .kpi-range-sub {
  font-size: 8.5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dash-layout-admin .kpi-range-value {
  font-size: 14px !important;
  font-weight: 800 !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* 7. Canvas y Tablas */
.dash-layout-admin .chart-section {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 14px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.dash-layout-admin .chart-container {
  position: relative !important;
  width: 100% !important;
  height: 280px !important;
  overflow: hidden !important;
}

.dash-layout-admin .chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

.dash-layout-admin .table-section {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 14px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.dash-layout-admin .history-table-wrap {
  max-height: 300px !important;
  overflow-y: auto !important;
  width: 100% !important;
}

/* 8. Toolbar Superior */
.admin-feed-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 10px 14px !important;
  margin-bottom: 14px !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.admin-feed-toolbar select,
.admin-feed-toolbar input {
  height: 36px !important;
  font-size: 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0 10px !important;
  background: #ffffff !important;
  color: #1e293b !important;
  outline: none !important;
  box-sizing: border-box !important;
}

.admin-feed-toolbar select:focus,
.admin-feed-toolbar input:focus {
  border-color: #3b82f6 !important;
}

/* Responsive para pantallas medianas o celulares */
@media (max-width: 980px) {
  .dash-layout-admin {
    grid-template-columns: 1fr !important;
  }
  .dash-layout-admin .kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

