.metrics-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Chart sizing */
.chart-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
}

/* Table scroll */
.table-wrapper {
  overflow-y: auto;
  max-height: 260px;
}

/* ── Chart chrome ───────────────────────────────────────────────────────── */

.chart-card {
  padding: 1rem 1.125rem 1.25rem;
  margin-bottom: 1rem;
}

/* Range filters sit in one row above the charts. */
.chart-filters {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* The legend is HTML rather than canvas so it survives images-off and
   forced-colours, and so identity is never carried by colour alone. */
.chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.75rem;
}

.chart-key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  /* Text keeps text ink; the swatch beside it carries the series identity. */
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}

.empty-note {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0.5rem 0 0;
}

/* Tablet and up */
@media (min-width: 768px) {
  .metrics-layout {
    grid-template-columns: 2fr 1fr; /* chart gets priority */
  }

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

/* Large screens */
@media (min-width: 1024px) {
  .metrics-layout {
    grid-template-columns: 3fr 1fr; /* even stronger bias to chart */
  }

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