:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #30a46c;
  --warning: #d97706;
  --danger: #d93b3b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-lg: 18px;
  --nav-h: 52px;
  --max-w: 1120px;
  --content-pad: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f5f5f7;
    --text-muted: #a1a1a6;
    --text-subtle: #6e6e73;
    --accent: #2997ff;
    --accent-hover: #4aa6ff;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01", "cv11";
}

/* ————— Navigation ————— */
.nav {
  position: sticky;
  top: 0;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--content-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  display: inline-block;
}
.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); font-weight: 500; }
.nav-meta {
  font-size: 12px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

/* ————— Layout ————— */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px var(--content-pad) 96px;
}
.page-head {
  margin-bottom: 48px;
}
.eyebrow {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 8px;
}
h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 12px;
  color: var(--text);
}
h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 6px;
}
.lede {
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 62ch;
  font-weight: 400;
}

/* ————— Cards ————— */
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
a.card {
  color: inherit;
  text-decoration: none;
  display: block;
}
.card-eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
  margin: 0 0 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.card-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}
.card-cta {
  margin-top: 20px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-cta::after { content: "›"; font-size: 16px; margin-left: 2px; transition: transform 0.15s ease; }
a.card:hover .card-cta::after { transform: translateX(3px); }

/* ————— Stats ————— */
.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 40px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat-value {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-delta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ————— Table ————— */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 12px 20px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface-2);
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

/* ————— Section ————— */
section { margin-bottom: 48px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-head p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ————— Footer ————— */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px var(--content-pad);
  color: var(--text-subtle);
  font-size: 12px;
  text-align: center;
}

/* ————— States ————— */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
  display: inline-block;
  min-width: 60px;
  height: 1em;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

/* ————— Chart ————— */
.chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 320px;
}

/* ————— Responsive ————— */
@media (max-width: 640px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 12px; }
  .container { padding-top: 32px; padding-bottom: 64px; }
  .stat { padding: 18px 20px; }
  .stat-value { font-size: 26px; }
  th, td { padding: 10px 14px; }
}
