/**
 * Wspólne kafelki metryczne (KPI) — ten sam układ na pulpicie i ewentualnie innych widokach.
 * Wymaga zmiennych jak w dashboard.html: --card, --card-hover, --border, --text-primary,
 * --text-secondary, --text-tertiary, --orange, --success, --error (opcjonalnie).
 */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
  align-items: stretch;
}
.stats-row:not(.stats-row--expanded) .stat-card--extra {
  display: none !important;
}
.stat-card,
.stat-card:visited {
  background: var(--card, #252b3a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  transition: border-color 0.18s, background 0.18s;
  box-sizing: border-box;
}
a.stat-card {
  text-decoration: none;
  color: inherit;
}
a.stat-card:focus-visible {
  outline: 2px solid var(--orange, #ff9c09);
  outline-offset: 2px;
}
.stat-card:hover {
  border-color: rgba(255, 156, 9, 0.3);
  background: var(--card-hover, #2c3344);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.35));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  flex-shrink: 0;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, rgba(255, 255, 255, 0.92));
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.12;
  flex-shrink: 0;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.55));
  margin-top: 6px;
  padding-top: 0;
  line-height: 1.4;
  display: block;
}
.stats-kpi-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 22px;
  min-height: 32px;
}
.stats-kpi-footer[hidden] {
  display: none !important;
}
.btn-kpi-all {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--orange, #ff9c09);
  background: rgba(255, 156, 9, 0.08);
  border: 1px solid rgba(255, 156, 9, 0.35);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.btn-kpi-all:hover {
  background: rgba(255, 156, 9, 0.14);
}
.btn-kpi-all:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-kpi-all:disabled:hover {
  background: rgba(255, 156, 9, 0.08);
}
.stat-up {
  color: var(--success, #22c55e);
}
.stat-down {
  color: var(--error, #ef4444);
}

@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
