/* ==========================================================================
   ColEstadísticas - Mobile-First Architecture (DataViz Pro & Modern Aesthetics)
   Inspirado en interfaces financieras y analíticas (Dark Luxury / Obsidian)
   Estructura:
   1. Variables & Reset Mobile-First
   2. Base Styles (Mobile < 640px)
   3. Breakpoint Tablet (>= 640px)
   4. Breakpoint Desktop (>= 1024px)
   ========================================================================== */

:root {
  --bg-primary: #070a12;
  --bg-surface: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: #1e293b;
  --border-color: #334155;
  --border-subtle: rgba(71, 85, 105, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 28px -4px rgba(0, 0, 0, 0.55);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   1. RESET & BASE (MOBILE DEFAULT)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(59, 130, 246, 0.16) 0%, transparent 65%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 0% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(16, 185, 129, 0.06) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 0.75rem 0.75rem 2rem 0.75rem;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* Custom Scrollbar Global */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.75);
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.7);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.9);
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* ==========================================================================
   2. HEADER & BRANDING (MOBILE DEFAULT)
   ========================================================================== */
.header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  flex: 1;
  min-width: 220px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fbbf24 0%, #3b82f6 50%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.775rem;
  margin-top: 0.15rem;
  line-height: 1.35;
}

.badge-stack {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #93c5fd;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.725rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.badge-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.badge-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.4);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.0); opacity: 0; }
}

/* ==========================================================================
   3. NAVEGACIÓN: DESKTOP NAVBAR & MENÚ HAMBURGUESA MÓVIL
   ========================================================================== */
.navbar {
  margin-bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.navbar::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.35rem;
  min-width: max-content;
}

.nav-item {
  flex-shrink: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  min-height: 42px;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link:active {
  transform: scale(0.97);
}

.nav-link.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

.nav-icon {
  font-size: 1rem;
}

/* -------------------------------------------------------------------------
   BOTÓN MENÚ HAMBURGUESA (MÓVIL)
   ------------------------------------------------------------------------- */
.nav-hamburger-btn {
  display: none; /* Oculto por defecto en Desktop */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1001;
}

.nav-hamburger-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 15px rgba(59, 130, 246, 0.2);
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* Animación a 'X' cuando el menú está abierto */
.nav-hamburger-btn.is-active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-hamburger-btn.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-hamburger-btn.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* -------------------------------------------------------------------------
   DRAWER MÓVIL Y BACKDROP
   ------------------------------------------------------------------------- */
.mobile-nav-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 12, 24, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85vw, 340px);
  height: 100%;
  background: rgba(15, 23, 42, 0.98);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
  z-index: 999;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

body.nav-drawer-open {
  overflow: hidden !important;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
}

.mobile-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mobile-drawer-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.mobile-drawer-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fbbf24 0%, #3b82f6 50%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mobile-nav-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-nav-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: rotate(90deg);
}

.mobile-drawer-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  padding: 1.15rem 1rem;
}

.mobile-drawer-nav {
  flex: 1;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mobile-nav-item {
  width: 100%;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.925rem;
  font-weight: 600;
  min-height: 48px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.mobile-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}

.mobile-nav-link.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.mobile-nav-icon {
  font-size: 1.15rem;
  line-height: 1;
  width: 24px;
  text-align: center;
}

.mobile-nav-label {
  flex: 1;
}

.mobile-nav-active-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.mobile-drawer-footer {
  margin-top: 2rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-subtle);
}

.mobile-drawer-trust-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.mobile-trust-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-trust-link:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.mobile-drawer-copy {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}

/* -------------------------------------------------------------------------
   RESPONSIVE SWITCH: DESKTOP VS MÓVIL
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* En pantallas móviles (<=768px): ocultar navbar horizontal, mostrar hamburguesa */
  .navbar {
    display: none !important;
  }

  .nav-hamburger-btn {
    display: inline-flex;
  }

  .mobile-nav-backdrop,
  .mobile-nav-drawer {
    display: flex;
  }
}

@media (max-width: 480px) {
  /* En pantallas muy estrechas, ocultar texto de tema para ajuste perfecto */
  .theme-toggle-label {
    display: none;
  }
  .theme-toggle-btn {
    padding: 0.35rem 0.45rem;
  }
}

/* ==========================================================================
   4. DATA STORYTELLING CALLOUTS (MOBILE DEFAULT)
   ========================================================================== */
.story-callout {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.story-callout.purple { border-left-color: var(--accent-purple); }
.story-callout.amber { border-left-color: var(--accent-amber); }
.story-callout.emerald { border-left-color: var(--accent-emerald); }
.story-callout.rose { border-left-color: var(--accent-rose); }

.callout-icon {
  font-size: 1.3rem;
  line-height: 1;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.callout-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.callout-body {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Page Intro */
.page-intro {
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.25;
}

.page-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   5. KPIS GRID (MOBILE: 2 COLUMNAS COMPACTAS)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.15);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.kpi-card.blue::before { background: var(--accent-blue); }
.kpi-card.amber::before { background: var(--accent-amber); }
.kpi-card.emerald::before { background: var(--accent-emerald); }
.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-card.rose::before { background: var(--accent-rose); }

.kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}

.kpi-subtext {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   5.1. PANEL DE FILTROS ANALÍTICOS AVANZADOS (MULTI-DIMENSIONAL)
   ========================================================================== */
.advanced-filter-panel {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  margin-bottom: 1.75rem;
}

.filter-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.filter-header-title strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.filter-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.filter-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  color: #6ee7b7;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-filter-reset:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.filter-controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .filter-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .filter-controls-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .filter-controls-grid {
    grid-template-columns: 1.4fr 1.1fr 1fr 1fr 1fr 1fr;
  }
}

.filter-control-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.filter-select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: #111a2e;
}

.filter-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.filter-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-range-separator {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-group-sm .btn-filter {
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
}

/* ==========================================================================
   6. PANELES DE GRÁFICOS Y NARRATIVAS (MOBILE FIRST)
   ========================================================================== */
.chart-panel, .narrative-panel {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 1rem 0.85rem;
  box-shadow: 0 6px 20px -3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  margin-bottom: 1.5rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.panel-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.3;
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.btn-group {
  display: flex;
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-filter {
  flex: 1;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 0.35rem;
  font-size: 0.725rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
}

.btn-filter.active, .btn-filter:hover {
  background: var(--accent-blue);
  color: #fff;
}

/* Alturas de Gráficos Mobile-Friendly (evita atrapar el scroll vertical) */
.chart-wrapper {
  position: relative;
  height: 270px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.chart-wrapper-compact {
  position: relative;
  height: 230px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Grids 1 Columna en Mobile con contención estricta de ancho */
.grid-chart-narrative, .grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.grid-chart-narrative > *, .grid-2col > * {
  min-width: 0;
  max-width: 100%;
}

/* Panel Narrativo */
.narrative-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.narrative-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.narrative-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.narrative-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.4);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-blue);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.narrative-item > div {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.narrative-item.emerald { border-left-color: var(--accent-emerald); }
.narrative-item.rose { border-left-color: var(--accent-rose); }
.narrative-item.amber { border-left-color: var(--accent-amber); }
.narrative-item.purple { border-left-color: var(--accent-purple); }
.narrative-item.cyan { border-left-color: var(--accent-cyan, #06b6d4); }
.narrative-item.blue { border-left-color: var(--accent-blue); }

.narrative-tip {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.narrative-tip strong {
  color: var(--text-main);
}

.item-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ==========================================================================
   7. DASHBOARD SUMMARY CARDS (MOBILE 1 COL)
   ========================================================================== */
.dashboard-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-summary-card {
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dash-summary-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.dash-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.dash-card-link {
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 600;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   8. CALCULADORA INTERACTIVA (MOBILE FIRST)
   ========================================================================== */
.calculator-box {
  background: linear-gradient(145deg, #111827 0%, #1a2234 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  margin-bottom: 2rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
}

.calc-input-group label {
  display: block;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.calc-input, .calc-select {
  width: 100%;
  background: #1f2937;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 16px; /* Evita auto-zoom en iOS Safari */
  outline: none;
  min-height: 46px; /* Touch target */
  transition: var(--transition);
}

.calc-input:focus, .calc-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.calc-result-box {
  background: rgba(30, 41, 59, 0.8);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

/* ==========================================================================
   9. MATRIZ DE CORRELACIONES (MOBILE FIRST)
   ========================================================================== */
.correlations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.corr-card {
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.corr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  gap: 0.5rem;
}

.corr-pair {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
}

.corr-strength-badge {
  font-size: 0.675rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.corr-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: rgba(30, 41, 59, 0.6);
  border-radius: var(--radius-sm);
}

.corr-metric-item {
  display: flex;
  flex-direction: column;
}

.corr-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.corr-metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.corr-explanation {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   10. REPOSITORIO DE DATOS: TABLA AISLADA & VISTA DE TARJETAS MÓVILES
   ========================================================================== */
.table-panel {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 0; /* Sin padding global para que la tabla llegue a los bordes */
  box-shadow: var(--shadow-sm);
  overflow: hidden; /* La tabla hace scroll en su propio contenedor */
  margin-bottom: 2rem;
}

.table-panel .panel-header {
  padding: 1.15rem 1rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* Barra de Controles de Datos (Mobile-First) */
.data-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.search-input-wrapper {
  width: 100%;
}

.data-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

/* Selector de Vista: Tarjetas vs Tabla */
.view-toggle-group {
  display: inline-flex;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
}

.view-toggle-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Barra de Herramientas de Desplazamiento de Tabla */
.table-scroll-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 640px) {
  .table-scroll-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
  }
}

.table-scroll-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: #94a3b8;
  min-width: 0;
}

.scroll-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.7rem;
  white-space: nowrap;
}

.scroll-info-text {
  color: var(--text-muted);
  min-width: 0;
}

.table-nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 640px) {
  .table-nav-buttons {
    width: auto;
  }
}

.btn-table-nav {
  padding: 0.35rem 0.65rem;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
  user-select: none;
}

.btn-table-nav:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-table-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
}

.btn-table-nav.btn-toggle-height {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}

.btn-table-nav.btn-toggle-height:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #ffffff;
}

/* Barra de Desplazamiento Superior Sincronizada */
.table-top-scrollbar {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  background: #090e17;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: auto;
  scrollbar-color: #3b82f6 #090e17;
}

.table-top-scrollbar-inner {
  height: 14px;
}

/* Contenedor Responsivo Aislado para la Tabla (Viewport con Alto Contenido en Desktop) */
.table-responsive {
  width: 100%;
  max-height: 68vh;
  min-height: 380px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin: 0;
  padding: 0;
  background: #0d1527;
  scrollbar-width: auto;
  scrollbar-color: #3b82f6 #090e17;
}

.table-responsive.expanded-height {
  max-height: none;
}

/* Barras de Desplazamiento de Alto Contraste (Top y Bottom) */
.table-responsive::-webkit-scrollbar,
.table-top-scrollbar::-webkit-scrollbar {
  height: 14px;
  width: 10px;
}

.table-responsive::-webkit-scrollbar-track,
.table-top-scrollbar::-webkit-scrollbar-track {
  background: #090e17;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-responsive::-webkit-scrollbar-thumb,
.table-top-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 7px;
  border: 3px solid #090e17;
  cursor: grab;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-top-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.table-responsive::-webkit-scrollbar-thumb:active,
.table-top-scrollbar::-webkit-scrollbar-thumb:active {
  cursor: grabbing;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.775rem;
  min-width: 1050px;
}

/* Encabezados Fijos (Sticky Header) */
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #111a2e !important;
  color: #cbd5e1;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.675rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  color: var(--text-main);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Celda de Esquina Fija (Año): Sticky Top Y Sticky Left */
.data-table thead th:first-child {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 35 !important;
  background: #090f1d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.6);
  min-width: 65px;
  text-align: center;
}

/* Columna de Año Fija (Sticky Left) en Filas */
.data-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #0d1527 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.45);
  min-width: 65px;
  text-align: center;
}

.data-table tbody tr:hover td {
  background: rgba(51, 65, 85, 0.25);
}

.data-table tbody tr:hover td:first-child {
  background: #1a253c !important;
}

/* ==========================================================================
   TABLA ESPECÍFICA DE LA CANASTA POPULAR (chocorramo.php)
   ========================================================================== */
.data-table.table-chocorramo {
  min-width: 960px;
}

.data-table.table-chocorramo thead th:first-child,
.data-table.table-chocorramo thead th.col-producto {
  min-width: 200px !important;
  max-width: 240px !important;
  text-align: left !important;
  left: 0;
  position: sticky;
  background: #111a2e !important;
  z-index: 35 !important;
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.6);
}

.data-table.table-chocorramo tbody td:first-child,
.data-table.table-chocorramo tbody td.col-producto {
  min-width: 200px !important;
  max-width: 240px !important;
  text-align: left !important;
  left: 0;
  position: sticky;
  background: #0d1527 !important;
  z-index: 15;
  white-space: normal !important;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.45);
}

.data-table.table-chocorramo tbody tr:hover td.col-producto,
.data-table.table-chocorramo tbody tr:hover td:first-child {
  background: #1a253c !important;
}

.data-table.table-chocorramo th.col-anecdota,
.data-table.table-chocorramo td.col-anecdota {
  white-space: normal !important;
  min-width: 280px !important;
  max-width: 380px !important;
  line-height: 1.45;
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* ==========================================================================
   VISTA MÓVIL DE TARJETAS (CARDS VIEW)
   ========================================================================== */
.mobile-cards-view {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 0.85rem;
}

.data-record-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.data-record-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(30, 41, 59, 0.75);
}

.record-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.record-year-badge {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.record-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.record-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.record-metric-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.record-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.record-metric-val {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.record-metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge-cyan { background: rgba(6, 182, 212, 0.15); color: #67e8f9; }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.badge-rose { background: rgba(244, 63, 94, 0.15); color: #fda4af; }

.badge-featured {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.article-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.38;
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
  transition: color 0.2s ease;
}

.article-card-title a {
  color: inherit;
  text-decoration: none;
}

.article-card-title a:hover {
  color: var(--accent-blue);
}

.btn-read-article {
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 0.825rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap 0.2s ease, color 0.2s ease;
}

.btn-read-article:hover {
  color: var(--accent-cyan);
  gap: 0.5rem;
}

.btn-read-article .read-arrow {
  transition: transform 0.2s ease;
}

.btn-read-article:hover .read-arrow {
  transform: translateX(3px);
}

/* ==========================================================================
   11. FOOTER (MOBILE FIRST)
   ========================================================================== */
.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.775rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.source-tags {
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.source-tag {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.copyright {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ==========================================================================
   12. MEDIA QUERIES (PROGRESSIVE ENHANCEMENT)
   ========================================================================== */

/* TABLET (>= 640px) */
@media (min-width: 640px) {
  body {
    padding: 1.25rem 1.25rem 2.5rem 1.25rem;
  }

  .header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .header-brand {
    width: auto;
  }

  .brand-title {
    font-size: 1.55rem;
  }

  .brand-subtitle {
    font-size: 0.85rem;
  }

  .page-title {
    font-size: 1.45rem;
  }

  .panel-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .btn-group {
    width: auto;
  }

  .chart-wrapper {
    height: 320px;
  }

  .chart-wrapper-compact {
    height: 260px;
  }

  .calc-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calc-result-box {
    grid-column: span 2;
    text-align: left;
  }

  .source-tags {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* DESKTOP (>= 1024px) */
@media (min-width: 1024px) {
  body {
    padding: 1.75rem 2rem 3rem 2rem;
  }

  .nav-list {
    min-width: 0;
    width: 100%;
    justify-content: space-between;
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.5rem 0.65rem;
    font-size: 0.775rem;
  }

  .brand-title {
    font-size: 1.75rem;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }

  .kpi-card {
    padding: 1.25rem;
  }

  .kpi-value {
    font-size: 1.85rem;
  }

  .kpi-label {
    font-size: 0.75rem;
  }

  .kpi-subtext {
    font-size: 0.78rem;
  }

  .chart-wrapper {
    height: 380px;
  }

  .chart-wrapper-compact {
    height: 300px;
  }

  .grid-chart-narrative {
    grid-template-columns: 1.8fr 1.2fr;
    gap: 1.5rem;
  }

  .grid-2col {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .dashboard-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .correlations-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
  }

  .calc-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .calc-result-box {
    grid-column: auto;
  }
}

/* ==========================================================================
   11. ÍNDICE CHOCORRAMO & CANASTA POPULAR CRIOLLA
   ========================================================================== */
.snack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
  width: 100%;
}

@media (max-width: 420px) {
  .snack-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}

@media (min-width: 640px) {
  .snack-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .snack-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem;
  }
}

@media (min-width: 1280px) {
  .snack-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.snack-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  transition: var(--transition);
}

.snack-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.15);
}

.snack-card.highlight {
  border-color: rgba(245, 158, 11, 0.6);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(245, 158, 11, 0.08) 100%);
}

.snack-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.snack-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
  word-break: break-word;
}

.snack-brand {
  font-size: 0.725rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.snack-price-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.75rem;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.snack-qty-box {
  margin-top: auto;
  width: 100%;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  min-width: 0;
}

.snack-qty-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1.1;
  word-break: break-word;
}

.snack-qty-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.snack-delta-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  margin-top: 0.35rem;
  display: inline-block;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.snack-delta-badge.negative {
  color: var(--accent-rose);
}

.snack-delta-badge.positive {
  color: var(--accent-emerald);
}

.product-pill-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .product-pill-selector {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
  .product-pill-selector::-webkit-scrollbar {
    display: none;
  }
}

.product-pill {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.product-pill:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(51, 65, 85, 0.8);
}

.product-pill.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  border-color: #f59e0b;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.chocorramo-header-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(139, 92, 246, 0.1) 50%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}

.chocorramo-header-banner::after {
  content: '🍫';
  position: absolute;
  right: -15px;
  bottom: -25px;
  font-size: 8rem;
  opacity: 0.08;
  pointer-events: none;
}

.chocorramo-subtitle {
  color: #fcd34d;
}

/* ==========================================================================
   12. EXPLORADOR MULTISERIES Y CONSTRUCTOR DE REPORTES A MEDIDA (datos.php)
   ========================================================================== */
.series-nav-container {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 0.75rem 0.25rem;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.series-nav-container::-webkit-scrollbar {
  height: 4px;
}

.series-tab-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.series-tab-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.series-tab-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
  border-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
  font-weight: 700;
}

.series-tab-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  font-family: 'JetBrains Mono', monospace;
}

.series-tab-btn.active .series-tab-badge {
  background: var(--accent-blue);
  color: #ffffff;
}

/* Caja de Contexto de la Serie Activa */
.series-context-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.series-context-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.series-context-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.series-context-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.series-stat-pill {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.series-stat-pill strong {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

/* Panel Constructor de Reportes a Medida (Selector de Columnas) */
.report-builder-panel {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.7) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.builder-presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-preset {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-preset:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: var(--accent-blue);
}

.builder-groups-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .builder-groups-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .builder-groups-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.builder-group-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.builder-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.builder-pills-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.col-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  user-select: none;
}

.col-checkbox-label:hover {
  background: rgba(51, 65, 85, 0.4);
  color: var(--text-main);
}

.col-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.col-checkbox-label.checked {
  color: #f8fafc;
  background: rgba(59, 130, 246, 0.12);
}

/* ==========================================================================
   14. ESTILOS EDITORIALES Y LECTOR DE ARTÍCULOS (.article-reader-container)
   ========================================================================== */
.article-reader-container {
  max-width: 840px;
  font-size: 1.075rem;
  line-height: 1.85;
  color: var(--text-muted);
}

.article-reader-container h2 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.article-reader-container h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  scroll-margin-top: 2rem;
}

.article-reader-container h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.article-reader-container p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  line-height: 1.85;
}

.article-reader-container strong {
  color: var(--text-main);
  font-weight: 700;
}

.article-reader-container em {
  font-style: italic;
  color: var(--text-main);
}

.article-reader-container a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.article-reader-container a:hover {
  color: var(--accent-cyan);
}

.article-reader-container ul,
.article-reader-container ol {
  margin-bottom: 1.5rem;
  padding-left: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text-muted);
}

.article-reader-container li {
  line-height: 1.75;
  color: var(--text-muted);
}

.article-reader-container li strong {
  color: var(--text-main);
}

.article-reader-container blockquote {
  border-left: 4px solid var(--accent-blue);
  padding: 0.85rem 1.25rem;
  margin: 1.75rem 0;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-main);
}

.formula-box {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  padding: 1rem 1.25rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  margin: 1.75rem 0;
  letter-spacing: 0.02em;
}

.article-reader-container img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.75rem 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.article-reader-container code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  background: rgba(30, 41, 59, 0.8);
  padding: 0.2em 0.45em;
  border-radius: 4px;
  color: #38bdf8;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.article-reader-container pre {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-reader-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.9rem;
}

.article-reader-container th,
.article-reader-container td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.article-reader-container th {
  background: rgba(30, 41, 59, 0.8);
  color: #f8fafc;
  font-weight: 700;
}

.article-reader-container tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.4);
}

/* ==========================================================================
   SISTEMA DE PUBLICIDAD & MONETIZACIÓN (ADSENSE & PAUTA INTERNA)
   Cumplimiento estricto con políticas de Google AdSense y diseño Dark Luxury
   ========================================================================== */
.ad-placement {
  width: 100%;
  max-width: 1140px;
  margin: 1.75rem auto;
  position: relative;
  clear: both;
}

.ad-slot-top {
  margin-top: 0.5rem;
  margin-bottom: 1.75rem;
}

.ad-slot-middle {
  margin-top: 2.25rem;
  margin-bottom: 2.25rem;
}

.ad-slot-bottom {
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

/* Micro-rótulo reglamentario Google AdSense */
.ad-disclosure {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.45rem;
}

.ad-disclosure span {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  background: rgba(15, 23, 42, 0.65);
  padding: 0.15rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  user-select: none;
}

/* Contenedor Base de Anuncios */
.ad-box {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

/* 1. Google AdSense Box con reserva de altura anti-CLS */
.ad-box-adsense {
  background: rgba(15, 23, 42, 0.5);
  border: 1px dashed rgba(148, 163, 184, 0.22);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* 2. Código Custom Box */
.ad-box-custom {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.75rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.ad-box-custom img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* 3. Pauta Interna (Dark Luxury Fintech Card) */
.ad-box-internal {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(26, 35, 58, 0.88) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-top: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 1.25rem 1.6rem;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.ad-box-internal:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
  border-top-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.18);
}

.ad-internal-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .ad-internal-layout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
}

.ad-internal-meta {
  flex: 1;
}

.ad-internal-badge-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.ad-sponsor-badge {
  font-size: 0.675rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  padding: 0.22rem 0.7rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ad-stat-pill {
  font-size: 0.725rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 0.22rem 0.7rem;
  border-radius: 9999px;
}

.ad-internal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  letter-spacing: -0.015em;
}

.ad-internal-desc {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin: 0;
}

.ad-internal-cta {
  flex-shrink: 0;
}

.btn-ad-internal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
}

.btn-ad-internal:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
  box-shadow: 0 8px 22px rgba(2, 132, 199, 0.55), 0 0 15px rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

.btn-ad-arrow {
  transition: transform 0.2s ease;
}

.btn-ad-internal:hover .btn-ad-arrow {
  transform: translateX(4px);
}

/* 4. Placeholder Box en Admin o sin configurar */
.ad-box-placeholder {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.25);
  padding: 1.25rem;
  text-align: center;
}

.ad-placeholder-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  max-width: 650px;
  margin: 0 auto;
}

.ad-placeholder-icon {
  font-size: 1.75rem;
}

.ad-placeholder-text {
  text-align: left;
}

.ad-placeholder-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.2rem;
}

.ad-placeholder-desc {
  font-size: 0.775rem;
  color: #94a3b8;
  line-height: 1.4;
}

.ad-preview-container {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

/* ==========================================================================
   REFUERZO VISUAL DATA-VIZ & FINTECH (FRENTE AL ASPECTO PLANO)
   ========================================================================== */
.chart-panel,
.admin-card,
.dash-summary-card,
.advanced-filter-panel {
  background: linear-gradient(165deg, rgba(17, 24, 39, 0.85) 0%, rgba(15, 23, 42, 0.92) 100%) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.12) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.28s ease;
}

.chart-panel:hover,
.dash-summary-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.35) !important;
  border-top-color: rgba(56, 189, 248, 0.6) !important;
  box-shadow: 0 18px 36px -10px rgba(0, 0, 0, 0.65), 0 0 24px rgba(56, 189, 248, 0.12);
}

/* Tarjetas de artículos con mayor riqueza visual */
.dash-summary-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.dash-summary-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dash-summary-card:hover::after {
  opacity: 1;
}

/* Micro-pulso cinético en badges activos */
.badge-pulse {
  animation: subtle-pulse 3s infinite ease-in-out;
}

@keyframes subtle-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
}

/* ==========================================================================
   BOTÓN TOGGLE DE TEMA (SOL Y LUNA)
   ========================================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  color: var(--text-main);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 15px rgba(59, 130, 246, 0.2);
}

.theme-toggle-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 46px;
  height: 24px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 9999px;
  padding: 0 5px;
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: background 0.3s ease;
}

.theme-toggle-thumb {
  position: absolute;
  left: 3px;
  top: 2px;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.theme-icon {
  font-size: 0.725rem;
  line-height: 1;
  z-index: 1;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

.icon-sun {
  opacity: 0.35;
}

.icon-moon {
  opacity: 1;
}

.theme-toggle-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   MODO CLARO (LIGHT THEME)
   ========================================================================== */
html[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --border-subtle: rgba(203, 213, 225, 0.8);

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] body {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(59, 130, 246, 0.09) 0%, transparent 65%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 0% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(16, 185, 129, 0.05) 0%, transparent 55%);
  color: #0f172a;
}

html[data-theme="light"] .theme-toggle-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  border-top-color: #f1f5f9;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .theme-toggle-track {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

html[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(21px);
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

html[data-theme="light"] .icon-sun {
  opacity: 1;
}

html[data-theme="light"] .icon-moon {
  opacity: 0.35;
}

html[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.92);
  border-color: #cbd5e1;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .nav-link {
  color: #475569;
}

html[data-theme="light"] .nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .nav-link.active {
  background: var(--accent-blue);
  color: #ffffff;
}

/* Modo Claro: Botón Hamburguesa & Drawer Móvil */
html[data-theme="light"] .nav-hamburger-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  border-top-color: #f1f5f9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .hamburger-line {
  background-color: #0f172a;
}

html[data-theme="light"] .mobile-nav-backdrop {
  background: rgba(15, 23, 42, 0.45);
}

html[data-theme="light"] .mobile-nav-drawer {
  background: rgba(255, 255, 255, 0.98);
  border-left-color: #e2e8f0;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .mobile-drawer-header {
  border-bottom-color: #e2e8f0;
  background: rgba(248, 250, 252, 0.8);
}

html[data-theme="light"] .mobile-drawer-title {
  background: linear-gradient(135deg, #d97706 0%, #2563eb 50%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .mobile-nav-close-btn {
  color: #334155;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

html[data-theme="light"] .mobile-nav-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

html[data-theme="light"] .mobile-nav-link {
  color: #334155;
}

html[data-theme="light"] .mobile-nav-link:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}

html[data-theme="light"] .mobile-nav-link.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

html[data-theme="light"] .mobile-drawer-footer {
  border-top-color: #e2e8f0;
}

html[data-theme="light"] .mobile-trust-link {
  color: #64748b;
}

html[data-theme="light"] .mobile-trust-link:hover {
  color: var(--accent-blue);
}

html[data-theme="light"] .mobile-drawer-copy {
  color: #94a3b8;
}

html[data-theme="light"] .chart-panel,
html[data-theme="light"] .narrative-panel,
html[data-theme="light"] .admin-card,
html[data-theme="light"] .dash-summary-card,
html[data-theme="light"] .advanced-filter-panel,
html[data-theme="light"] .story-callout,
html[data-theme="light"] .article-sidebar-card,
html[data-theme="light"] .article-author-card,
html[data-theme="light"] .article-data-callout,
html[data-theme="light"] .table-panel,
html[data-theme="light"] .corr-card,
html[data-theme="light"] .calculator-box,
html[data-theme="light"] .snack-card,
html[data-theme="light"] .series-context-box,
html[data-theme="light"] .report-builder-panel {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-top-color: #f1f5f9 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .kpi-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-top-color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] .kpi-value {
  color: #0f172a;
}

html[data-theme="light"] .btn-filter {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

html[data-theme="light"] .btn-filter:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

html[data-theme="light"] .btn-filter.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
}

html[data-theme="light"] .calc-input,
html[data-theme="light"] .calc-select,
html[data-theme="light"] .form-textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

html[data-theme="light"] .calc-input:focus,
html[data-theme="light"] .calc-select:focus,
html[data-theme="light"] .form-textarea:focus {
  border-color: var(--accent-blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

html[data-theme="light"] .footer {
  border-top-color: #e2e8f0;
  color: #475569;
}

html[data-theme="light"] .source-tag {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #334155;
}

html[data-theme="light"] .ad-box-internal {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  border-top-color: rgba(56, 189, 248, 0.7) !important;
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .ad-internal-title {
  color: #0f172a;
}

html[data-theme="light"] .ad-internal-desc {
  color: #475569;
}

html[data-theme="light"] .ad-disclosure span {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

/* ==========================================================================
   OPTIMIZACIONES EXCLUSIVAS DE LECTURA Y EDITORIAL EN MODO CLARO
   ========================================================================== */
html[data-theme="light"] .article-reader-container {
  color: #334155 !important;
}

html[data-theme="light"] .article-reader-container p,
html[data-theme="light"] .article-reader-container li {
  color: #334155 !important;
}

html[data-theme="light"] .article-reader-container h1,
html[data-theme="light"] .article-reader-container h2,
html[data-theme="light"] .article-reader-container h3,
html[data-theme="light"] .article-reader-container h4,
html[data-theme="light"] .article-reader-container strong {
  color: #0f172a !important;
  font-weight: 700;
}

html[data-theme="light"] .article-reader-container em {
  color: #1e293b !important;
}

html[data-theme="light"] .article-reader-container blockquote {
  background: rgba(59, 130, 246, 0.05) !important;
  border-left-color: #2563eb !important;
  color: #1e293b !important;
}

html[data-theme="light"] .article-reader-container code {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .formula-box {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0369a1 !important;
}

/* Callouts Editoriales en Modo Claro (Contraste Perfecto y Tintes Suaves) */
html[data-theme="light"] .story-callout {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 4px !important;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] .story-callout .callout-title {
  color: #0f172a !important;
  font-weight: 700;
}

html[data-theme="light"] .story-callout .callout-body {
  color: #334155 !important;
}

html[data-theme="light"] .story-callout.blue,
html[data-theme="light"] .story-callout:not([class*="amber"]):not([class*="emerald"]):not([class*="purple"]):not([class*="rose"]):not([class*="cyan"]) {
  background: linear-gradient(135deg, #ffffff 0%, rgba(59, 130, 246, 0.05) 100%) !important;
  border-left-color: #2563eb !important;
}
html[data-theme="light"] .story-callout.blue .callout-title {
  color: #1d4ed8 !important;
}

html[data-theme="light"] .story-callout.amber {
  background: linear-gradient(135deg, #ffffff 0%, rgba(245, 158, 11, 0.06) 100%) !important;
  border-left-color: #d97706 !important;
}
html[data-theme="light"] .story-callout.amber .callout-title {
  color: #92400e !important;
}

html[data-theme="light"] .story-callout.emerald {
  background: linear-gradient(135deg, #ffffff 0%, rgba(16, 185, 129, 0.06) 100%) !important;
  border-left-color: #059669 !important;
}
html[data-theme="light"] .story-callout.emerald .callout-title {
  color: #065f46 !important;
}

html[data-theme="light"] .story-callout.purple {
  background: linear-gradient(135deg, #ffffff 0%, rgba(139, 92, 246, 0.06) 100%) !important;
  border-left-color: #7c3aed !important;
}
html[data-theme="light"] .story-callout.purple .callout-title {
  color: #5b21b6 !important;
}

html[data-theme="light"] .story-callout.cyan {
  background: linear-gradient(135deg, #ffffff 0%, rgba(6, 182, 212, 0.06) 100%) !important;
  border-left-color: #0891b2 !important;
}
html[data-theme="light"] .story-callout.cyan .callout-title {
  color: #0e7490 !important;
}

html[data-theme="light"] .story-callout.rose {
  background: linear-gradient(135deg, #ffffff 0%, rgba(244, 63, 94, 0.06) 100%) !important;
  border-left-color: #e11d48 !important;
}
html[data-theme="light"] .story-callout.rose .callout-title {
  color: #9f1239 !important;
}

/* Insignias de Categorías y Destacados en Modo Claro */
html[data-theme="light"] .badge-blue {
  background: rgba(37, 99, 235, 0.1) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
}

html[data-theme="light"] .badge-cyan {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0369a1 !important;
  border: 1px solid rgba(2, 132, 199, 0.25) !important;
}

html[data-theme="light"] .badge-amber {
  background: rgba(217, 119, 6, 0.1) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.25) !important;
}

html[data-theme="light"] .badge-emerald {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
}

html[data-theme="light"] .badge-purple {
  background: rgba(124, 58, 237, 0.1) !important;
  color: #6d28d9 !important;
  border: 1px solid rgba(124, 58, 237, 0.25) !important;
}

html[data-theme="light"] .badge-featured {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0284c7 !important;
  border: 1px solid rgba(2, 132, 199, 0.3) !important;
}

/* Tarjetas del Catálogo y Títulos en Modo Claro */
html[data-theme="light"] .article-card-title {
  color: #0f172a !important;
}

html[data-theme="light"] .dash-summary-card:hover .article-card-title {
  color: var(--accent-blue) !important;
}

html[data-theme="light"] .article-author-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .article-data-callout {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06) !important;
}

/* Sidebar y Tabla de Contenidos (TOC) en Modo Claro */
html[data-theme="light"] .article-sidebar-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] .sidebar-card-title {
  color: #0f172a !important;
  border-bottom-color: #e2e8f0 !important;
}

html[data-theme="light"] .toc-link {
  color: #475569 !important;
}

html[data-theme="light"] .toc-link:hover,
html[data-theme="light"] .toc-link.active {
  color: var(--accent-blue) !important;
  background: rgba(59, 130, 246, 0.08) !important;
}

html[data-theme="light"] .sidebar-link-row {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .sidebar-link-row:hover {
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}

html[data-theme="light"] .sidebar-link-name {
  color: #0f172a !important;
}

html[data-theme="light"] .sidebar-link-sub {
  color: #64748b !important;
}

/* ==========================================================================
   OPTIMIZACIONES MODO CLARO: PANELES NARRATIVOS, FILTROS Y OBSERVATORIOS
   ========================================================================== */
html[data-theme="light"] .narrative-panel {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-top-color: #f1f5f9 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .narrative-title {
  color: #0f172a !important;
}

html[data-theme="light"] .narrative-text {
  color: #334155 !important;
}

html[data-theme="light"] .narrative-item {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 4px !important;
  color: #334155 !important;
}

html[data-theme="light"] .narrative-item strong {
  color: #0f172a !important;
}

html[data-theme="light"] .narrative-item.emerald { border-left-color: #059669 !important; }
html[data-theme="light"] .narrative-item.rose { border-left-color: #e11d48 !important; }
html[data-theme="light"] .narrative-item.amber { border-left-color: #d97706 !important; }
html[data-theme="light"] .narrative-item.purple { border-left-color: #7c3aed !important; }
html[data-theme="light"] .narrative-item.cyan { border-left-color: #0891b2 !important; }
html[data-theme="light"] .narrative-item.blue { border-left-color: #2563eb !important; }

html[data-theme="light"] .narrative-tip,
html[data-theme="light"] .narrative-panel div[style*="rgba(30, 41, 59"] {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

html[data-theme="light"] .narrative-tip strong,
html[data-theme="light"] .narrative-panel div[style*="rgba(30, 41, 59"] strong {
  color: #0f172a !important;
}

/* Filtros Analíticos Multidimensionales en Modo Claro */
html[data-theme="light"] .advanced-filter-panel {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .filter-panel-header {
  border-bottom-color: #e2e8f0 !important;
}

html[data-theme="light"] .filter-header-title strong {
  color: #0f172a !important;
}

html[data-theme="light"] .filter-subtitle {
  color: #64748b !important;
}

html[data-theme="light"] .filter-label {
  color: #475569 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .filter-select {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .filter-select:hover {
  background: #f8fafc !important;
  border-color: var(--accent-blue) !important;
}

html[data-theme="light"] .filter-select:focus {
  background: #ffffff !important;
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="light"] .filter-range-separator {
  color: #64748b !important;
}

html[data-theme="light"] .btn-group {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .btn-filter-reset {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

html[data-theme="light"] .btn-filter-reset:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}

html[data-theme="light"] .filter-count-badge {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #047857 !important;
}

/* Calculadora Interactiva en Modo Claro */
html[data-theme="light"] .calculator-box {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .calc-result-box {
  background: #f8fafc !important;
  border: 1px dashed #cbd5e1 !important;
}

html[data-theme="light"] .badge-stack {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1d4ed8 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
}

/* Índice Chocorramo & Canasta Popular en Modo Claro */
html[data-theme="light"] .chocorramo-header-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.09) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .chocorramo-subtitle {
  color: #b45309 !important;
}

html[data-theme="light"] .snack-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] .snack-card.highlight {
  background: linear-gradient(145deg, #ffffff 0%, rgba(245, 158, 11, 0.06) 100%) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

html[data-theme="light"] .snack-icon-wrapper {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .snack-qty-box {
  border-top-color: #e2e8f0 !important;
}

html[data-theme="light"] .snack-qty-val {
  color: #0284c7 !important;
}

html[data-theme="light"] .product-pill {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

html[data-theme="light"] .product-pill:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] .product-pill.active {
  background: var(--accent-amber) !important;
  border-color: var(--accent-amber) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

/* Tablas y Repositorio de Datos en Modo Claro */
html[data-theme="light"] .table-panel {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .table-responsive {
  background: #ffffff !important;
}

html[data-theme="light"] .view-toggle-group {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .view-toggle-btn {
  color: #475569 !important;
}

html[data-theme="light"] .view-toggle-btn.active {
  background: var(--accent-blue) !important;
  color: #ffffff !important;
}

html[data-theme="light"] .table-scroll-toolbar {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}

html[data-theme="light"] .table-scroll-info {
  color: #475569 !important;
}

html[data-theme="light"] .btn-table-nav {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html[data-theme="light"] .btn-table-nav:hover:not(:disabled) {
  background: #f1f5f9 !important;
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
}

html[data-theme="light"] .data-table thead th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom-color: #cbd5e1 !important;
}

html[data-theme="light"] .data-table thead th:first-child {
  background: #e2e8f0 !important;
  border-right-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .data-table tbody td {
  border-bottom-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .data-table tbody td:first-child {
  background: #f8fafc !important;
  border-right-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .data-table tbody tr:hover td {
  background: #f1f5f9 !important;
}

html[data-theme="light"] .data-table tbody tr:hover td:first-child {
  background: #e2e8f0 !important;
}

html[data-theme="light"] .data-table.table-chocorramo thead th:first-child,
html[data-theme="light"] .data-table.table-chocorramo thead th.col-producto {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .data-table.table-chocorramo tbody td:first-child,
html[data-theme="light"] .data-table.table-chocorramo tbody td.col-producto {
  background: #f8fafc !important;
  color: #0f172a !important;
}

/* Matriz de Correlaciones en Modo Claro */
html[data-theme="light"] .corr-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .corr-metrics {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .corr-metric-value {
  color: #0284c7 !important;
}

/* Módulo Dólar (dolar.php) en Modo Claro */
html[data-theme="light"] .series-tab-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

html[data-theme="light"] .series-tab-btn:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] .series-tab-btn.active {
  background: var(--accent-blue) !important;
  border-color: var(--accent-blue) !important;
  color: #ffffff !important;
}

html[data-theme="light"] .series-tab-badge {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

html[data-theme="light"] .series-stat-pill {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

html[data-theme="light"] .series-stat-pill strong {
  color: #0f172a !important;
}

html[data-theme="light"] .builder-group-box {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .builder-group-title {
  color: #0f172a !important;
}

html[data-theme="light"] .btn-preset {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

html[data-theme="light"] .btn-preset:hover {
  background: #f8fafc !important;
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
}

html[data-theme="light"] .col-checkbox-label {
  color: #334155 !important;
}

html[data-theme="light"] .col-checkbox-label:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* ==========================================================================
   BOTÓN FLOTANTE VOLVER ARRIBA (BACK TO TOP)
   ========================================================================== */
.btn-back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.6), 0 0 15px rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.btn-back-to-top:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: var(--accent-blue);
  box-shadow: 0 16px 32px -6px rgba(0, 0, 0, 0.7), 0 0 24px rgba(59, 130, 246, 0.35);
  color: #ffffff;
}

.btn-back-to-top svg {
  transition: transform 0.2s ease;
}

.btn-back-to-top:hover svg {
  transform: translateY(-2px);
}

html[data-theme="light"] .btn-back-to-top {
  background: #ffffff;
  border-color: #cbd5e1;
  border-top-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .btn-back-to-top:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   LAYOUT EDITORIAL DE ARTÍCULOS (CUADRÍCULA DE 2 COLUMNAS + STICKY SIDEBAR)
   ========================================================================== */
.article-editorial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3.5rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .article-editorial-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 3rem;
    align-items: start;
  }
}

.article-main-column {
  min-width: 0;
}

.article-header {
  margin-bottom: 2rem;
}

.article-headline {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

@media (min-width: 768px) {
  .article-headline {
    font-size: 2.35rem;
  }
}

.article-lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.35rem;
}

.article-author-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.article-reader-container {
  font-size: 1.075rem;
  line-height: 1.85;
  color: var(--text-muted);
  margin-bottom: 3rem;
}

.article-reader-container p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.article-reader-container h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
  scroll-margin-top: 2rem;
}

.article-reader-container ul,
.article-reader-container ol {
  margin: 1.25rem 0 1.75rem 1.5rem;
  color: var(--text-muted);
}

.article-reader-container li {
  margin-bottom: 0.75rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.article-data-callout {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.9) 0%, rgba(30, 41, 59, 0.85) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-md);
}

/* Sidebar Editorial Sticky */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .article-sidebar {
    position: sticky;
    top: 1.5rem;
  }
}

.article-sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-card-title {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.65rem;
}

.sidebar-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.825rem;
}

.sidebar-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-meta-item .meta-label {
  color: var(--text-dim);
  font-weight: 600;
}

/* Tabla de Contenidos (TOC) */
.article-toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 280px;
  overflow-y: auto;
}

.toc-link {
  font-size: 0.825rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.35;
}

.toc-link:hover,
.toc-link.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--accent-blue);
}

/* Enlaces de Observatorios */
.sidebar-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-link-row:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateX(2px);
}

.sidebar-link-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-link-name {
  color: var(--text-main);
  font-size: 0.825rem;
  display: block;
}

.sidebar-link-sub {
  color: var(--text-dim);
  font-size: 0.725rem;
  display: block;
}

.article-related-section {
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2.25rem;
}

/* =============================================================================
   BANNER DE CONSENTIMIENTO DE COOKIES (CMP) - GOOGLE ADSENSE & PRIVACIDAD
   ============================================================================= */
.cookie-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  max-width: 820px;
  margin: 0 auto;
  z-index: 9999;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideUpFade 0.35s ease forwards;
}

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

.cookie-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cookie-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1 1 420px;
}

.cookie-banner-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.cookie-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.cookie-banner-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.cookie-link {
  color: var(--accent-blue);
  text-decoration: underline;
  font-weight: 600;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-cookie-btn {
  padding: 0.55rem 1rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-cookie-accept {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-cookie-accept:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-cookie-reject {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-cookie-reject:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

@media (max-width: 640px) {
  .cookie-banner {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 1rem;
  }
  .cookie-banner-actions {
    width: 100%;
    justify-content: stretch;
  }
  .btn-cookie-btn {
    flex: 1;
    text-align: center;
  }
}

