/* ============================================================
   Stats Report Page (/cgi/stats/report)
   ============================================================ */

.stat-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--opx-surface);
  border: 1px solid var(--opx-line);
  border-radius: 16px;
  box-shadow: var(--opx-shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.stat-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--opx-blue);
}

.stat-kpi-ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.stat-kpi-ic.blue   { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.stat-kpi-ic.purple { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.stat-kpi-ic.green  { background: rgba(16, 185, 129, 0.12); color: #059669; }
.stat-kpi-ic.orange { background: rgba(245, 158, 11, 0.14); color: #d97706; }

html[data-theme="dark"] .stat-kpi-ic.blue   { color: #60a5fa; }
html[data-theme="dark"] .stat-kpi-ic.purple { color: #a78bfa; }
html[data-theme="dark"] .stat-kpi-ic.green  { color: #34d399; }
html[data-theme="dark"] .stat-kpi-ic.orange { color: #fbbf24; }

.stat-kpi-num {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--opx-ink);
  line-height: 1.1;
}
.stat-kpi-label {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--opx-muted);
}

.stat-block {
  background: var(--opx-surface);
  border: 1px solid var(--opx-line);
  border-radius: 18px;
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--opx-shadow-sm);
}
.stat-block-title {
  margin: 0 0 18px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--opx-ink);
}

.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.stat-bar-row {
  display: grid;
  grid-template-columns: 48px 1fr 56px;
  align-items: center;
  gap: 14px;
}
.stat-bar-year {
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--opx-ink);
}
.stat-bar-track {
  height: 12px;
  background: var(--opx-surface-muted);
  border-radius: 999px;
  overflow: hidden;
  display: block;
}
.stat-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 65%, #60a5fa 100%);
  transition: width 0.35s ease;
}
.stat-bar-val {
  text-align: right;
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--opx-muted);
}

.stat-latest {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-latest li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--opx-surface-soft);
  border: 1px solid var(--opx-line);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-latest li:nth-child(odd) {
  background: var(--opx-surface-soft);
}
.stat-latest li:hover {
  border-color: var(--opx-blue);
  transform: translateX(2px);
}
.stat-latest li a,
.stat-latest li a:link,
.stat-latest li a:visited,
.stat-latest li a:active {
  color: var(--opx-ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}
.stat-latest li a:hover { color: var(--opx-blue); }
html[data-theme="dark"] .stat-latest li a:hover { color: #60a5fa; }

.stat-latest-year {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--opx-badge-fg);
  background: var(--opx-badge-bg);
  padding: 3px 10px;
  border-radius: 999px;
}

@media (max-width: 960px) {
  .stat-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stat-kpis { grid-template-columns: 1fr; }
  .stat-block { padding: 16px; }
  .stat-bar-row { grid-template-columns: 40px 1fr 44px; gap: 10px; }
  .stat-latest li { flex-direction: column; gap: 6px; }
}
