/* ========================================
   Metric Cards
   ======================================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.2rem 1.3rem;
  transition: border-color 0.2s, background 0.2s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.metric-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
}
.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.metric-value .unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 0.15em;
}
.metric-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* Hero metric */
.metric-hero {
  text-align: center;
  padding: 1.5rem 0 2rem;
}
.metric-hero .metric-value {
  font-size: clamp(3.5rem, 10vw, 6rem);
  color: var(--gold);
  line-height: 1.1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.metric-hero .metric-label {
  font-size: 1.05rem;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
  margin-top: 0.5rem;
  margin-bottom: 0;
}
.metric-hero .metric-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ========================================
   Bloat Distribution Bar
   ======================================== */
.bloat-bar-wrap { margin: 1.5rem 0; }
.bloat-bar {
  display: flex;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid rgba(191,160,104,0.25);
}
.bloat-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(0,0,0,0.75);
  min-width: 2px;
  transition: width 1s cubic-bezier(0.22,1,0.36,1);
}
.bloat-seg.green { background: var(--green); }
.bloat-seg.yellow { background: var(--yellow); }
.bloat-seg.red { background: var(--red); }
.bloat-seg.wash-1 { background: var(--wash-1); color: var(--text-primary); }
.bloat-seg.wash-2 { background: var(--wash-2); color: var(--text-primary); }
.bloat-seg.wash-3 { background: var(--wash-3); color: #F0EDE8; }
.bloat-seg.wash-4 { background: var(--wash-4); color: #F0EDE8; }
.bloat-seg.wash-5 { background: var(--wash-5); color: #1B2838; }

.bloat-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}
.bloat-legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot.green { background: var(--green); }
.legend-dot.yellow { background: var(--yellow); }
.legend-dot.red { background: var(--red); }
.legend-dot.wash-1 { background: var(--wash-1); }
.legend-dot.wash-2 { background: var(--wash-2); }
.legend-dot.wash-3 { background: var(--wash-3); }
.legend-dot.wash-4 { background: var(--wash-4); }
.legend-dot.wash-5 { background: var(--wash-5); }

/* ========================================
   Tax Breakdown Bar
   ======================================== */
.tax-bar-wrap { margin: 1.5rem 0; }
.tax-bar {
  display: flex;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-surface);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(191,160,104,0.25);
}
.tax-bar-seg {
  height: 100%;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  min-width: 2px;
}
.tax-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-size: 0.8rem;
}
.tax-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}
.tax-legend-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========================================
   Data Tables
   ======================================== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.data-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
}
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}
.data-table tbody tr {
  transition: background 0.15s;
}
.data-table tbody tr:hover td {
  background: var(--bg-card);
}
.data-table .num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table .title-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

/* Inline bloat meter */
.bloat-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bloat-meter-track {
  flex: 1;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
  max-width: 120px;
}
.bloat-meter-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.bloat-meter-fill.green { background: var(--green); }
.bloat-meter-fill.yellow { background: var(--yellow); }
.bloat-meter-fill.red { background: var(--red); }
.bloat-meter-fill.wash-1 { background: var(--wash-1); }
.bloat-meter-fill.wash-2 { background: var(--wash-2); }
.bloat-meter-fill.wash-3 { background: var(--wash-3); }
.bloat-meter-fill.wash-4 { background: var(--wash-4); }
.bloat-meter-fill.wash-5 { background: var(--wash-5); }
.bloat-meter-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  min-width: 44px;
  text-align: right;
}

/* ========================================
   Stats Row
   ======================================== */
.stats-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

/* ========================================
   Content Type Badges
   ======================================== */
.content-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  line-height: 1.3;
}
.content-badge.text { background: rgba(240,232,224,0.08); color: var(--text-muted); }
.content-badge.code { background: rgba(34,211,238,0.12); color: var(--cyan); }
.content-badge.image { background: rgba(192,132,252,0.12); color: var(--purple); }
.content-badge.table { background: rgba(251,191,36,0.12); color: var(--yellow); }

/* ========================================
   Bloat Delta Label
   ======================================== */
.bloat-delta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--red);
  opacity: 0.85;
  margin-top: 0.15rem;
  cursor: help;
}

/* ========================================
   Raw Data Toggle
   ======================================== */
.raw-toggle {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.raw-toggle summary {
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.raw-toggle summary:hover { color: var(--accent); }
.raw-json {
  width: 100%;
  min-height: 200px;
  max-height: 600px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.75rem;
  white-space: pre;
  tab-size: 2;
}
