:root {
  /* Paleta base Modernizada */
  --bg: #090b10;
  /* Fondo más oscuro para contraste */
  --card-bg: rgba(22, 26, 34, 0.7);
  /* Transparencia para glassmorphism */
  --card-border: rgba(255, 255, 255, 0.08);
  --muted: #94a3b8;
  --text: #f1f5f9;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.15);

  /* Colores de datasets */
  --line-historic: #60a5fa;
  --line-realistic: #f87171;
  --line-neutral: #fbbf24;
  --line-optimistic: #34d399;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(248, 113, 113, 0.08), transparent 25%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px;
}

/* Glassmorphism Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin-bottom: 32px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--card-border);
}

h1,
h2 {
  margin: 0 0 8px 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 22px;
  color: #fff;
}

h2 {
  font-size: 18px;
  color: #e2e8f0;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.summary {
  padding: 20px 28px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.summary .emphasis {
  color: #f87171;
  font-weight: 700;
  background: rgba(248, 113, 113, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.chart-wrap {
  padding: 10px 20px 28px;
  position: relative;
}

.analysis {
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--card-border);
  padding: 20px 28px;
  border-radius: 0 0 16px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.analysis p {
  margin: 8px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

canvas {
  width: 100% !important;
  height: 450px !important;
}

/* Filtros Modernos (Chips) */
.filters {
  padding: 20px 28px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 100px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* Ocultar checkbox real */
.filter-chip input {
  display: none;
}

.filters-status {
  color: var(--muted);
  font-size: 13px;
  padding: 0 28px 20px;
  opacity: 0.8;
}

/* Loading State */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 11, 16, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(56, 189, 248, 0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

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

/* Error State */
.error-message {
  color: #f87171;
  text-align: center;
  padding: 40px;
  background: rgba(248, 113, 113, 0.1);
  border-radius: 8px;
  margin: 20px;
  border: 1px dashed rgba(248, 113, 113, 0.3);
}