/* ==========================================================================
   Badge contrast (WCAG AA 4.5:1 in BOTH themes)
   Measured 2026-09-29 by rendering every badge colour pairing the templates use
   and computing contrast against the composited background:
   - .bg-secondary is #e2e8f0 in this theme (both modes), so Bootstrap's white
     badge text measured 1.23:1: invisible. .bg-warning/.bg-info/.bg-light are
     light fills too (white text 1.6-2.0:1), and .text-dark resolves to #dee2e6
     in dark mode, so "bg-warning text-dark" measured 1.25:1 there.
   - A subtle/soft fill with no text class kept the white badge text (~1.1:1),
     and .text-{variant} on its own subtle fill was 3.6-4.3:1; Bootstrap's
     pairing for that fill is the -emphasis colour.
   - Dark mode's --bs-primary-bg-subtle (#862021) is bright enough that even its
     emphasis text reached only 3.71:1.
   The default is set through --bs-badge-color, so a badge that names a text
   colour on purpose (e.g. bg-warning-subtle text-success) keeps it. Only the
   pairings measured as broken are overridden outright.
   ========================================================================== */
.badge.bg-secondary,
.badge.bg-warning,
.badge.bg-info,
.badge.bg-light,
.badge.bg-white {
  --bs-badge-color: #0f172a;
}

.badge.bg-secondary.text-white,
.badge.bg-warning.text-white,
.badge.bg-info.text-white,
.badge.bg-warning.text-dark,
.badge.bg-info.text-dark,
.badge.bg-light.text-dark,
.badge.bg-white.text-dark {
  color: #0f172a !important;
}

.badge.bg-body-tertiary,
.badge.bg-body-tertiary.text-body {
  --bs-badge-color: var(--bs-emphasis-color);
  color: var(--bs-emphasis-color) !important;
}

.badge.bg-primary-subtle, .badge.bg-soft-primary { --bs-badge-color: var(--bs-primary-text-emphasis); }
.badge.bg-secondary-subtle, .badge.bg-soft-secondary { --bs-badge-color: var(--bs-secondary-text-emphasis); }
.badge.bg-success-subtle, .badge.bg-soft-success { --bs-badge-color: var(--bs-success-text-emphasis); }
.badge.bg-danger-subtle, .badge.bg-soft-danger { --bs-badge-color: var(--bs-danger-text-emphasis); }
.badge.bg-warning-subtle, .badge.bg-soft-warning { --bs-badge-color: var(--bs-warning-text-emphasis); }
.badge.bg-info-subtle, .badge.bg-soft-info { --bs-badge-color: var(--bs-info-text-emphasis); }
.badge.bg-dark-subtle, .badge.bg-soft-dark { --bs-badge-color: var(--bs-emphasis-color); }

.badge.bg-primary-subtle.text-primary, .badge.bg-soft-primary.text-primary { color: var(--bs-primary-text-emphasis) !important; }
.badge.bg-success-subtle.text-success, .badge.bg-soft-success.text-success { color: var(--bs-success-text-emphasis) !important; }
.badge.bg-danger-subtle.text-danger, .badge.bg-soft-danger.text-danger { color: var(--bs-danger-text-emphasis) !important; }
.badge.bg-warning-subtle.text-warning, .badge.bg-soft-warning.text-warning { color: var(--bs-warning-text-emphasis) !important; }
.badge.bg-info-subtle.text-info, .badge.bg-soft-info.text-info { color: var(--bs-info-text-emphasis) !important; }
.badge.bg-secondary-subtle.text-secondary, .badge.bg-soft-secondary.text-secondary { color: var(--bs-secondary-text-emphasis) !important; }

[data-bs-theme="dark"] .badge.bg-primary-subtle {
  background-color: #4c1415 !important;
}

/* Dark soft-success (#2f4944) is too light for the success emphasis colour
   (#66b36b, 3.8:1): the account/profile "Enabled"/verified badges. */
[data-bs-theme="dark"] .badge.bg-soft-success {
  --bs-badge-color: #86d98a;
}

[data-bs-theme="dark"] .badge.bg-soft-success.text-success {
  color: #86d98a !important;
}
