*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f0f2f0;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: #1b4332;
  color: #fff;
  padding: 0 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  position: relative;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 1rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* ── Main layout ─────────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ── Section header ──────────────────────────────────────── */
.section-header {
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1b4332;
}

.section-header .subtitle {
  font-size: .85rem;
  color: #666;
  margin-top: .25rem;
}

/* ── Snapshot tiles ──────────────────────────────────────── */
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.tile {
  background: #fff;
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  border-left: 4px solid #2d6a4f;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.tile-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #555;
  font-weight: 600;
}

.tile-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #1b4332;
  line-height: 1.1;
}

.tile-yoy {
  font-size: .82rem;
  font-weight: 600;
  margin-top: .1rem;
}

.tile-yoy.up   { color: #2d6a4f; }
.tile-yoy.down { color: #c0392b; }
.tile-yoy.flat { color: #888; }

/* ── Card (generic) ──────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ── Card header (title + toggles row) ──────────────────── */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ── Metric toggle buttons ───────────────────────────────── */
.metric-toggles {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle {
  padding: .25rem .8rem;
  border-radius: 999px;
  border: 1.5px solid #2d6a4f;
  background: #fff;
  color: #2d6a4f;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
  line-height: 1.4;
}

.toggle:hover:not(.active) { background: #d8f3dc; }

.toggle.active {
  background: #2d6a4f;
  color: #fff;
  border-color: #2d6a4f;
}

.chart-wrap {
  position: relative;
  height: 320px;
}

.chart-wrap--bar {
  height: 500px;
}

/* ── Trends section ──────────────────────────────────────── */
.timeframe-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.timeframe-row label {
  font-size: .82rem;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.tf-btn {
  padding: .28rem .85rem;
  border-radius: 999px;
  border: 1.5px solid #2d6a4f;
  background: #fff;
  color: #2d6a4f;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.tf-btn:hover:not(.active) { background: #d8f3dc; }

.tf-btn.active {
  background: #2d6a4f;
  color: #fff;
}

.trends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.trend-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.trend-card h3 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #2d6a4f;
  margin-bottom: 1rem;
}

/* ── Footnotes ───────────────────────────────────────────── */
.footnotes {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.footnotes p {
  font-size: .78rem;
  color: #555;
  line-height: 1.55;
}

.footnotes strong {
  color: #333;
}

/* ── Loading / error states ──────────────────────────────── */
.error-msg {
  color: #c0392b;
  padding: 2rem;
  text-align: center;
  font-size: .95rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .trends-grid {
    grid-template-columns: 1fr;
  }
  .snapshot-grid {
    grid-template-columns: 1fr;
  }
  .header-inner {
    flex-direction: row;
  }
}

@media (max-width: 600px) {
  .snapshot-grid {
    grid-template-columns: 1fr 1fr;
  }
  main {
    padding: 0 1rem 3rem;
  }
}
