.harm-stats-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.75rem 2.5rem;
  background: var(--bg-card, rgba(255, 255, 255, 0.96));
  border-radius: var(--border-radius, 8px);
  border: 1px solid var(--border-color, #e5e5e5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.harm-stats-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.harm-stats-title {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary, #0f172a);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.harm-stats-title-badge {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(242, 27, 35, 0.08);
  color: var(--primary-color, #f21b23);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.harm-stats-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.harm-stats-intro {
  margin: 0 0 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary, #64748b);
  max-width: 640px;
}

.harm-stats-error {
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #b91c1c;
}

.harm-stats-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  color: var(--text-secondary, #64748b);
}

.harm-stats-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary-color, #f21b23);
  border-radius: 50%;
  animation: harm-stats-spin 0.8s linear infinite;
}

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

.harm-stats-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.harm-stats-summary-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  min-width: 180px;
  background: linear-gradient(145deg, #ffffff 0%, #fafafa 55%, #f3f4f6 100%);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e5e5e5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.harm-stats-summary-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.harm-stats-summary-label {
  font-size: 0.8125rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 0.35rem;
}

.harm-stats-summary-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  letter-spacing: -0.04em;
}

.harm-stats-tabs {
  margin-bottom: 1.25rem;
}

.harm-stats-tabs-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.8);
}

.harm-stats-tab {
  border: none;
  outline: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.13s ease;
}

.harm-stats-tab:hover {
  transform: translateY(-1px);
}

.harm-stats-tab--active {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #f9fafb;
  box-shadow:
    0 10px 20px rgba(37, 99, 235, 0.25),
    0 0 0 1px rgba(191, 219, 254, 0.9);
}

.harm-stats-tabs-heading {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.harm-stats-table-wrap {
  overflow-x: auto;
  border-radius: var(--border-radius, 8px);
  background: #ffffff;
  border: 1px solid var(--border-color, #e5e5e5);
}

.harm-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.harm-stats-table th,
.harm-stats-table td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.harm-stats-table th {
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  background: #f8fafc;
}

.harm-stats-table tbody tr:last-child td {
  border-bottom: none;
}

.harm-stats-row {
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.harm-stats-row:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.harm-stats-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.harm-stats-empty {
  text-align: center;
  color: var(--text-secondary, #64748b);
  padding: 2.25rem 1.5rem !important;
}

.harm-stats-bar-wrap {
  width: 100%;
  max-width: 180px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.harm-stats-bar {
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  transition: width 0.28s ease-out;
}

.harm-stats-audits-section {
  margin-top: 1.75rem;
}

.harm-stats-audits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.harm-stats-audits-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.harm-stats-audits-search-wrap {
  margin-bottom: 0.75rem;
  max-width: 420px;
}

.harm-stats-audits-search-input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.harm-stats-audits-search-input:focus {
  outline: none;
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.harm-stats-audits-search-input::placeholder {
  color: #94a3b8;
}

.harm-stats-audits-view-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.9rem;
}

.harm-stats-audits-tab {
  border: none;
  outline: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 150px;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.13s ease;
}

.harm-stats-audits-tab:hover {
  transform: translateY(-1px);
}

.harm-stats-audits-tab--active {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #e5edff;
  box-shadow:
    0 10px 20px rgba(37, 99, 235, 0.25),
    0 0 0 1px rgba(191, 219, 254, 0.9);
}

.harm-stats-audits-tab-label {
  font-size: 0.8rem;
}

.harm-stats-audits-tab-desc {
  font-size: 0.7rem;
  opacity: 0.9;
}

.harm-stats-audits-error {
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.875rem;
}

.harm-stats-audits-loading,
.harm-stats-audits-empty {
  padding: 1rem 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.harm-stats-audits-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.harm-stats-audits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.harm-stats-audits-table th,
.harm-stats-audits-table td {
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.harm-stats-audits-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
}

.harm-stats-audits-table tbody tr:last-child td {
  border-bottom: none;
}

.harm-stats-audits-table tbody tr:hover {
  background: #f8fafc;
}

.harm-stats-audits-table-actions {
  text-align: right;
  white-space: nowrap;
}

.harm-stats-audits-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.harm-stats-audit-card {
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 0.9rem 1rem 0.8rem;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.harm-stats-audit-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.harm-stats-audit-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.harm-stats-audit-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.harm-stats-audit-id {
  font-size: 0.75rem;
  color: #94a3b8;
}

.harm-stats-audit-severity {
  align-self: flex-start;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(248, 250, 252, 1);
  border: 1px solid #e2e8f0;
  font-size: 0.72rem;
  font-weight: 500;
  color: #475569;
}

.harm-stats-audit-meta {
  margin: 0.1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1rem;
}

.harm-stats-audit-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.harm-stats-audit-meta-row dt {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.harm-stats-audit-meta-row dd {
  margin: 0;
  font-size: 0.82rem;
  color: #0f172a;
}

.harm-stats-audit-footer {
  margin-top: 0.55rem;
  display: flex;
  justify-content: flex-end;
}

/* ========== Dark theme (night mode) – Detailed Statistics page ========== */
body.night-mode .harm-stats-container,
.night-mode .harm-stats-container {
  background: #3a3838;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

body.night-mode .harm-stats-title,
.night-mode .harm-stats-title {
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .harm-stats-title-badge,
.night-mode .harm-stats-title-badge {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

body.night-mode .harm-stats-intro,
.night-mode .harm-stats-intro {
  color: rgba(255, 255, 255, 0.8);
}

body.night-mode .harm-stats-error,
.night-mode .harm-stats-error {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

body.night-mode .harm-stats-loading,
.night-mode .harm-stats-loading {
  color: rgba(255, 255, 255, 0.75);
}

body.night-mode .harm-stats-spinner,
.night-mode .harm-stats-spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #f87171;
}

body.night-mode .harm-stats-summary-card,
.night-mode .harm-stats-summary-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.night-mode .harm-stats-summary-card::before,
.night-mode .harm-stats-summary-card::before {
  border-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .harm-stats-summary-label,
.night-mode .harm-stats-summary-label {
  color: rgba(255, 255, 255, 0.75);
}

body.night-mode .harm-stats-summary-value,
.night-mode .harm-stats-summary-value {
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .harm-stats-tabs-list,
.night-mode .harm-stats-tabs-list {
  background: rgba(255, 255, 255, 0.08);
}

body.night-mode .harm-stats-tab,
.night-mode .harm-stats-tab {
  color: rgba(255, 255, 255, 0.85);
}

body.night-mode .harm-stats-tab:hover,
.night-mode .harm-stats-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.night-mode .harm-stats-tab--active,
.night-mode .harm-stats-tab--active {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.35);
}

body.night-mode .harm-stats-tabs-heading,
.night-mode .harm-stats-tabs-heading {
  color: rgba(255, 255, 255, 0.75);
}

body.night-mode .harm-stats-table-wrap,
.night-mode .harm-stats-table-wrap {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

body.night-mode .harm-stats-table th,
body.night-mode .harm-stats-table td,
.night-mode .harm-stats-table th,
.night-mode .harm-stats-table td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .harm-stats-table th,
.night-mode .harm-stats-table th {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .harm-stats-row:hover,
.night-mode .harm-stats-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.night-mode .harm-stats-empty,
.night-mode .harm-stats-empty {
  color: rgba(255, 255, 255, 0.7);
}

body.night-mode .harm-stats-bar-wrap,
.night-mode .harm-stats-bar-wrap {
  background: rgba(255, 255, 255, 0.15);
}

body.night-mode .harm-stats-audits-title,
.night-mode .harm-stats-audits-title {
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .harm-stats-audits-search-input,
.night-mode .harm-stats-audits-search-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .harm-stats-audits-search-input::placeholder,
.night-mode .harm-stats-audits-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

body.night-mode .harm-stats-audits-search-input:focus,
.night-mode .harm-stats-audits-search-input:focus {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

body.night-mode .harm-stats-audits-tab,
.night-mode .harm-stats-audits-tab {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .harm-stats-audits-tab--active,
.night-mode .harm-stats-audits-tab--active {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.35);
}

body.night-mode .harm-stats-audits-tab-desc,
.night-mode .harm-stats-audits-tab-desc {
  color: inherit;
  opacity: 0.85;
}

body.night-mode .harm-stats-audits-error,
.night-mode .harm-stats-audits-error {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

body.night-mode .harm-stats-audits-loading,
body.night-mode .harm-stats-audits-empty,
.night-mode .harm-stats-audits-loading,
.night-mode .harm-stats-audits-empty {
  color: rgba(255, 255, 255, 0.75);
}

body.night-mode .harm-stats-audits-table-wrap,
.night-mode .harm-stats-audits-table-wrap {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

body.night-mode .harm-stats-audits-table th,
body.night-mode .harm-stats-audits-table td,
.night-mode .harm-stats-audits-table th,
.night-mode .harm-stats-audits-table td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .harm-stats-audits-table th,
.night-mode .harm-stats-audits-table th {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .harm-stats-audits-table tbody tr:hover,
.night-mode .harm-stats-audits-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.night-mode .harm-stats-audit-card,
.night-mode .harm-stats-audit-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.night-mode .harm-stats-audit-title,
.night-mode .harm-stats-audit-title {
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .harm-stats-audit-id,
.night-mode .harm-stats-audit-id {
  color: rgba(255, 255, 255, 0.6);
}

body.night-mode .harm-stats-audit-severity,
.night-mode .harm-stats-audit-severity {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .harm-stats-audit-meta-row dt,
.night-mode .harm-stats-audit-meta-row dt {
  color: rgba(255, 255, 255, 0.6);
}

body.night-mode .harm-stats-audit-meta-row dd,
.night-mode .harm-stats-audit-meta-row dd {
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 900px) {
  .harm-stats-container {
    margin: 0 0.5rem;
    padding: 1.5rem 1.25rem 2rem;
    border-radius: 18px;
  }

  .harm-stats-audits-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .harm-stats-container {
    padding: 1.25rem 1rem 1.75rem;
  }

  .harm-stats-header {
    flex-direction: column;
    align-items: stretch;
  }

  .harm-stats-summary {
    flex-direction: column;
  }
}
