/* Mining Forum Analytics — Full Design System
   Aligned with the polished sample page aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Section key colors */
  --color-dgg: #8B6914;
  --color-dgg-dark: #6B5010;
  --color-mfe: #1B5E20;
  --color-mfe-dark: #0D3B13;
  --color-mfa: #1A237E;
  --color-mfa-dark: #0D1252;

  /* Mineral accent colors */
  --color-gold: #D4A017;
  --color-silver: #7F8C8D;
  --color-pgm: #8E44AD;
  --color-copper: #CA6F1E;
  --color-other: #27AE60;

  /* Status colors */
  --color-producer: #27AE60;
  --color-royalty: #2980B9;
  --color-dev-cf: #E67E22;
  --color-dev-pea: #F39C12;
  --color-exp-adv: #9B59B6;
  --color-exp-early: #1ABC9C;
  --color-bullion: #95A5A6;

  /* Common palette */
  --bg-body: #F0F2F5;
  --bg-card: #fff;
  --text-primary: #2D3436;
  --text-secondary: #7F8C8D;
  --header-dark: #1B2631;
  --header-mid: #2C3E50;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

/* =========================================================
   PAGE HEADER — polished gradient with gold accent border
   ========================================================= */
.page-header {
  background: linear-gradient(135deg, var(--header-dark), var(--header-mid));
  color: #fff;
  padding: 24px 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  border-bottom: 4px solid var(--color-gold);
  transition: background 0.4s ease;
}

.page-header.dgg-theme { background: linear-gradient(135deg, #1B2631, #3E2F0F); }
.page-header.mfe-theme { background: linear-gradient(135deg, #0D3B13, #1B5E20); }
.page-header.mfa-theme { background: linear-gradient(135deg, #0D1252, #1A237E); }

.page-header .logo {
  height: 56px;
  width: auto;
  flex-shrink: 0;
}

.page-header .header-text {
  flex: 0 1 auto;
  text-align: center;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.3px;
}

.page-header h1 a {
  color: #fff;
  text-decoration: none;
}

.page-header h1 a:hover { opacity: 0.9; }

.page-header .subtitle {
  font-size: 13px;
  color: #ABB2B9;
  margin-top: 4px;
  font-weight: 400;
}

.page-header .tagline {
  font-size: 11px;
  color: #95A5A6;
  margin-top: 4px;
}

/* =========================================================
   SECTION TABS (DGG / MFE / MFA)
   ========================================================= */
.section-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--header-dark);
  padding: 0 24px;
}

.section-tabs a {
  color: #BDC3C7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 24px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.section-tabs a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.section-tabs a.active-dgg { color: #D4A017; border-bottom-color: #D4A017; background: rgba(212,160,23,0.08); }
.section-tabs a.active-mfe { color: #4CAF50; border-bottom-color: #4CAF50; background: rgba(76,175,80,0.08); }
.section-tabs a.active-mfa { color: #5C6BC0; border-bottom-color: #5C6BC0; background: rgba(92,107,192,0.08); }

/* =========================================================
   SUB-NAVIGATION (views)
   ========================================================= */
.nav-bar {
  background: var(--header-mid);
  padding: 0 24px;
  display: flex;
  justify-content: center;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-bar a {
  color: #BDC3C7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 10px 18px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-bar a:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.nav-bar a.active {
  color: var(--color-gold);
  border-bottom-color: var(--color-gold);
}

/* =========================================================
   CONTENT AREA
   ========================================================= */
.content {
  width: 95%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

/* =========================================================
   STICKY FILTER BAR (legend + filters)
   ========================================================= */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-body);
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #E5E8EB;
}

.filter-bar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-bar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-right: 4px;
}

/* =========================================================
   LEGEND PILLS (mineral groups)
   ========================================================= */
.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  align-items: center;
  border: 1px solid #E5E8EB;
}

.legend-bar .legend-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.legend-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  border: 2px solid transparent;
}

.legend-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.legend-pill.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
}

.legend-pill.dimmed {
  opacity: 0.35;
}

.legend-pill .pill-count {
  font-size: 10px;
  background: rgba(255,255,255,0.25);
  padding: 1px 6px;
  border-radius: 10px;
}

/* =========================================================
   STATUS FILTER CHIPS
   ========================================================= */
.status-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px 18px;
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  align-items: center;
  border: 1px solid #E5E8EB;
}

.status-filter-bar .filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.status-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid transparent;
}

.status-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.status-chip.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
}

.status-chip.dimmed {
  opacity: 0.35;
}

.status-chip .chip-count {
  font-size: 9px;
  background: rgba(255,255,255,0.25);
  padding: 1px 6px;
  border-radius: 8px;
}

/* =========================================================
   COUNTRY FILTER BAR
   ========================================================= */
.country-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
  padding: 12px 18px;
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  align-items: center;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid #E5E8EB;
}

.country-filter-bar .filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-right: 4px;
  flex-shrink: 0;
}

.country-pill {
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  background: #E8EAF0;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid transparent;
}

.country-pill:hover {
  background: #D0D4DE;
}

.country-pill.active {
  background: var(--header-mid);
  color: #fff;
  border-color: var(--color-gold);
}

.country-pill .country-flag {
  font-size: 12px;
}

/* Filter reset button */
.filter-reset {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: #E74C3C;
  color: #fff;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: none;
}

.filter-reset.visible {
  display: inline-flex;
}

.filter-reset:hover {
  background: #C0392B;
}

/* =========================================================
   SECTION TITLES — sample-style divider
   ========================================================= */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--header-mid);
  margin: 30px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid #D5D8DC;
}

/* =========================================================
   STATS SUMMARY ROW
   ========================================================= */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  align-items: center;
  border: 1px solid #E5E8EB;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-item .stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-item .stat-value {
  font-size: 20px;
  font-weight: 800;
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: #E0E0E0;
}

/* =========================================================
   SUMMARY BOXES (overview dashboard) — sample-matched
   ========================================================= */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.summary-box {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border-top: 3px solid var(--header-mid);
  transition: transform 0.2s, box-shadow 0.2s;
}

.summary-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.summary-box .label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-box .value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 4px;
}

.summary-box .pct {
  font-size: 11px;
  color: #AEB6BF;
  margin-top: 1px;
  font-weight: 500;
}

/* =========================================================
   CHART CONTAINERS — sample-matched
   ========================================================= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chart-card h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--header-mid);
  text-align: center;
}

.chart-card canvas {
  max-height: 320px;
}

/* =========================================================
   SOLITAIRE CARD LAYOUT
   ========================================================= */
.solitaire-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.solitaire-group {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #E5E8EB;
}

.solitaire-group h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.solitaire-group h3 .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
}

.solitaire-group h3 .group-stats {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-secondary);
}

.lane {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.col {
  min-width: 220px;
  max-width: 320px;
  flex: 1;
}

.col-header {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px 8px 0 0;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.col-header .count {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid #EAECEF;
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* =========================================================
   COMPANY CARDS
   ========================================================= */
.company-card {
  background: var(--bg-card);
  padding: 6px 12px;
  border-left: 3px solid transparent;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  cursor: pointer;
  position: relative;
}

.company-card:hover {
  background: #EBF5FB;
}

.company-card.filtered-out {
  display: none;
}

.company-card .rank {
  font-size: 10px;
  color: #B0B0B0;
  min-width: 20px;
  text-align: right;
  font-weight: 700;
}

.company-card .flag {
  font-size: 12px;
}

.company-card .name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.company-card .name a {
  color: inherit;
  text-decoration: none;
}

.company-card .name a:hover {
  color: var(--color-gold);
  text-decoration: underline;
}

.company-card .mcap {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.company-card .badges {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.company-card .prod-badge,
.company-card .res-badge,
.company-card .rsrc-badge {
  font-size: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.company-card .prod-badge { background: #27AE60; }
.company-card .res-badge { background: #2980B9; }
.company-card .rsrc-badge { background: #8E44AD; }

/* Card tooltip — matches sample tooltip style */
.company-card[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 14px;
  background: #2D3436;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.company-card[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 24px;
  border: 5px solid transparent;
  border-top-color: #2D3436;
  z-index: 9999;
  pointer-events: none;
}

/* =========================================================
   PRODUCTION / RESERVES TAB VIEW
   ========================================================= */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #E5E8EB;
}

.tab-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  background: #F0F2F5;
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--header-mid);
  color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========================================================
   DATA TABLE — sample-matched
   ========================================================= */
.data-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.data-table thead th {
  background: var(--header-mid);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
}

.data-table thead th:hover {
  background: #34495E;
}

.data-table thead th .sort-arrow {
  font-size: 9px;
  margin-left: 3px;
  opacity: 0.5;
}

.data-table thead th .sort-arrow.active {
  opacity: 1;
}

.data-table thead th.r { text-align: right; }

.data-table tbody tr {
  border-bottom: 1px solid #F0F2F5;
  transition: background 0.15s;
}

.data-table tbody tr:nth-child(even) { background: #FAFBFC; }
.data-table tbody tr:hover { background: #EBF5FB; }

.data-table tbody td {
  padding: 6px 12px;
  white-space: nowrap;
}

.data-table tbody td.r { text-align: right; font-variant-numeric: tabular-nums; }

.data-table tbody td.company-name {
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tbody td .mini-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

/* Color dots (sample-style, for tables) */
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

/* =========================================================
   FLAT RANK VIEW — sample-matched
   ========================================================= */
.flat-rank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #E5E8EB;
}

.flat-rank-item {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 8px;
  border-left: 4px solid transparent;
  transition: background 0.15s;
  border-bottom: 1px solid #F2F3F4;
}

.flat-rank-item:last-child { border-bottom: none; }

.flat-rank-item:hover {
  background: #EBF5FB;
}

.flat-rank-item .rank {
  font-size: 11px;
  font-weight: 700;
  color: #B0B0B0;
  min-width: 32px;
  text-align: right;
}

.flat-rank-item .flag {
  font-size: 16px;
}

.flat-rank-item .company-info {
  flex: 1;
  min-width: 0;
}

.flat-rank-item .company-info .name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.flat-rank-item .company-info .name a {
  color: inherit;
  text-decoration: none;
}

.flat-rank-item .company-info .name a:hover {
  color: var(--color-gold);
}

.flat-rank-item .company-info .meta {
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.flat-rank-item .mcap-bar-wrap {
  width: 200px;
  flex-shrink: 0;
}

.flat-rank-item .mcap-bar {
  height: 12px;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.flat-rank-item .mcap-value {
  font-size: 12px;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.flat-rank-item .badges {
  display: flex;
  gap: 3px;
}

/* =========================================================
   STATUS CHIPS (non-interactive, for display)
   ========================================================= */
.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

/* =========================================================
   FLAT RANK — COLUMNAR LAYOUT (sample-matched)
   ========================================================= */
.columns-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.status-col {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #E5E8EB;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: visible;
}

.status-col-header {
  padding: 12px 14px;
  border-bottom: 2px solid #E5E8EB;
  background: #FAFAFA;
  border-radius: 10px 10px 0 0;
}

.status-col-title {
  font-size: 13px;
  font-weight: 800;
  color: #2D3436;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.status-col-sub {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 11px;
  color: #888;
  font-weight: 500;
}

.status-col-body {
  padding: 6px 0;
}

.co-row {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  border-bottom: 1px solid #F2F3F4;
  font-size: 12.5px;
  line-height: 1.5;
  position: relative;
  overflow: visible;
  transition: background 0.1s;
}

.co-row:last-child { border-bottom: none; }
.co-row:hover { background: #FAFAFA; }

.co-rank {
  min-width: 26px;
  font-size: 10px;
  font-weight: 700;
  color: #B0B0B0;
  text-align: right;
  padding-right: 6px;
}

.co-mineral-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 6px;
}

.co-name {
  flex: 1;
  font-weight: 600;
  color: #2D3436;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
  cursor: default;
  position: relative;
}

.co-name:hover { color: #000; overflow: visible; }

.co-name a {
  color: inherit;
  text-decoration: none;
}

.co-name a:hover {
  color: #D4A017;
  text-decoration: underline;
}

.co-country {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
  margin-right: 8px;
  flex-shrink: 0;
}

.co-mcap {
  font-size: 11px;
  color: #7F8C8D;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex-shrink: 0;
}

/* Tooltip on co-name */
.co-name[data-tooltip] { position: relative; }
.co-name[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #2D3436;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.co-name[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 14px;
  border: 5px solid transparent;
  border-top-color: #2D3436;
  z-index: 9999;
}

/* Stats area between legend and columns */
.stats-area {
  background: #FAFAFA;
  border-bottom: 1px solid #eee;
  padding: 14px 24px 16px;
  text-align: center;
  margin: 0 -24px 20px;
}

.stats-headline {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

.summary-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 8px;
}

.summary-row-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  width: 100%;
  margin-bottom: 2px;
}

.summary-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #E0E0E0;
  color: #444;
  white-space: nowrap;
}

.summary-chip .chip-val {
  font-weight: 400;
  color: #888;
  margin-left: 3px;
}

/* Legend bar alternate style (simple, sample-matched) */
.legend-bar-simple {
  background: #fff;
  border-bottom: 1px solid #E5E8EB;
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  margin: 0 -24px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  transition: opacity 0.2s;
}

.legend-item.active { font-weight: 800; }
.legend-item.dimmed { opacity: 0.3; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-mcap {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  margin-left: 2px;
}

/* =========================================================
   LOADING STATE
   ========================================================= */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  font-size: 14px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #E0E0E0;
  border-top: 3px solid var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

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

/* =========================================================
   DISCLAIMER — full sample-matched styling
   ========================================================= */
.disclaimer {
  max-width: 1200px;
  margin: 40px auto 20px;
  padding: 24px 28px;
  background: #FAFBFC;
  border: 1px solid #E5E8EB;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.7;
  color: #666;
}

.disclaimer p { margin-bottom: 12px; }
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer strong { color: #2C3E50; font-weight: 700; }

.disclaimer-estimates {
  color: #8B6914;
  background: #FFF9E6;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid #D4A017;
  margin-bottom: 16px;
}

.disclaimer-copyright {
  font-size: 10px;
  color: #999;
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #E5E8EB;
}

/* =========================================================
   FOOTER — sample-matched
   ========================================================= */
.page-footer {
  text-align: center;
  padding: 24px;
  font-size: 11px;
  color: #aaa;
  border-top: 1px solid #eee;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .page-header { padding: 16px; }
  .page-header .logo { height: 40px; }
  .page-header h1 { font-size: 18px; }
  .content { padding: 16px 12px; }
  .chart-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .col { min-width: 200px; }
  .flat-rank-item .mcap-bar-wrap { width: 100px; }
  .legend-bar, .status-filter-bar, .country-filter-bar { padding: 10px 14px; }
  .stats-row { padding: 10px 12px; gap: 10px; }
  .stat-item .stat-value { font-size: 16px; }
  .section-tabs a { padding: 10px 14px; font-size: 12px; }
  .nav-bar a { padding: 8px 12px; font-size: 11px; }
  .columns-wrap { flex-direction: column; }
  .status-col { min-width: 100%; }
}
