:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --accent-2: #34d399;
  --table-border: #1f2937;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

header h1 { margin: 0 0 4px 0; font-weight: 700; }
.muted { color: var(--muted); }

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;           /* wrap on small screens */
}

button, select {
  background: var(--card);
  border: 1px solid var(--table-border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  margin-top: 12px;
}
.stats .label { color: var(--muted); margin-right: 6px; }

.error {
  margin-top: 10px;
  background: #1f2937;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
}
.hidden { display: none; }

main { padding-top: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--table-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.legend { margin-top: 8px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.swatch.index { background: var(--accent); }
.swatch.yoy { background: var(--accent-2); }

.table-controls { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--table-border); text-align: left; }
thead th { color: var(--muted); font-weight: 600; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

footer { padding-bottom: 32px; }

/* ---------- Charts layout (light cards on dark page) ---------- */
.charts-grid {
display: grid;
grid-template-columns: 1fr;   /* stack on mobile */
gap: 16px;
}
@media (min-width: 1024px) {
.charts-grid { grid-template-columns: 1fr 1fr; }  /* side-by-side on desktop */
}

.chart-card {
background: #ffffff;                 /* light background for charts */
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 12px;
}

.chart-title {
margin: 0 0 8px 0;
color: #0f172a;                      /* slate-900 */
font-size: 0.95rem;
font-weight: 600;
}

/* Canvases autosize correctly (no fixed heights) */
.chart-card canvas {
width: 100%;
height: auto;        /* let Chart.js compute height from aspectRatio */
display: block;
background: #ffffff;
border-radius: 8px;
}

/* Optional guard for ultra-wide screens to keep charts similar height */
@media (min-width: 1280px) {
.chart-card canvas { max-height: 420px; }
}

