/**
 * OrbPanel theme safety net — GitHub Primer–inspired product dark / soft light.
 * Research refs: GitHub dark canvas #0d1117, Linear/Vercel product neutrals,
 * Cloudflare dashboard grays. No neon purple “AI template” indigo.
 */

html { color-scheme: light dark; }
html, body, .fx-app, .fx-sidebar, .fx-main, .fx-content, .card, .modal-content,
.table, .form-control, .form-select, .btn, .badge, .alert {
  transition: background-color .2s ease, color .18s ease, border-color .18s ease, box-shadow .2s ease;
}

/* ═══════════════ LIGHT ═══════════════ */
[data-bs-theme="light"] {
  --bs-body-bg: #f6f8fa;
  --bs-body-color: #1f2328;
  --bs-secondary-color: #656d76;
  --bs-border-color: #d0d7de;
  --bs-primary: #0969da;
  --bs-primary-rgb: 9, 105, 218;
  --bs-success: #1a7f37;
  --bs-danger: #cf222e;
  --bs-warning: #9a6700;
  --bs-info: #0969da;
  color-scheme: light;
}
[data-bs-theme="light"] body { background: #f6f8fa !important; color: #1f2328 !important; }
[data-bs-theme="light"] .card,
[data-bs-theme="light"] .modal-content,
[data-bs-theme="light"] .list-group-item,
[data-bs-theme="light"] .dropdown-menu,
[data-bs-theme="light"] .offcanvas {
  background: #ffffff !important; color: #1f2328 !important; border-color: #d0d7de !important;
}
[data-bs-theme="light"] .card-header,
[data-bs-theme="light"] .modal-header { background: #f6f8fa !important; color: #1f2328 !important; border-color: #d0d7de !important; }
[data-bs-theme="light"] .table {
  --bs-table-bg: #fff; --bs-table-color: #1f2328; --bs-table-striped-bg: #f6f8fa;
  --bs-table-hover-bg: #ddf4ff; --bs-table-border-color: #d0d7de; color: #1f2328 !important;
}
[data-bs-theme="light"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg) !important; color: #1f2328 !important; border-bottom-color: #d0d7de !important;
}
[data-bs-theme="light"] .table-light, [data-bs-theme="light"] thead.table-light, [data-bs-theme="light"] .table thead th {
  background: #f6f8fa !important; color: #424a53 !important;
}
[data-bs-theme="light"] .form-control, [data-bs-theme="light"] .form-select {
  background: #fff !important; color: #1f2328 !important; border-color: #d0d7de !important;
}
[data-bs-theme="light"] .form-control:focus, [data-bs-theme="light"] .form-select:focus {
  border-color: #0969da !important; box-shadow: 0 0 0 3px rgba(9,105,218,.18) !important;
}
[data-bs-theme="light"] .text-muted { color: #656d76 !important; }
[data-bs-theme="light"] .btn-primary {
  background: #0969da !important; border-color: #0969da !important; color: #fff !important;
  box-shadow: 0 1px 0 rgba(27,31,36,.04);
}
[data-bs-theme="light"] .btn-primary:hover { background: #0550ae !important; border-color: #0550ae !important; color: #fff !important; }
[data-bs-theme="light"] .btn-outline-secondary {
  color: #424a53 !important; border-color: #d0d7de !important; background: #fff !important;
}
[data-bs-theme="light"] .btn-outline-secondary:hover { background: #f6f8fa !important; color: #1f2328 !important; }
[data-bs-theme="light"] .btn-danger { background: #cf222e !important; border-color: #cf222e !important; color: #fff !important; }
[data-bs-theme="light"] .btn-success { background: #1a7f37 !important; border-color: #1a7f37 !important; color: #fff !important; }
[data-bs-theme="light"] .badge.bg-success, [data-bs-theme="light"] .badge.text-bg-success { background: #dafbe1 !important; color: #116329 !important; }
[data-bs-theme="light"] .badge.bg-secondary, [data-bs-theme="light"] .badge.text-bg-secondary { background: #eaeef2 !important; color: #424a53 !important; }
[data-bs-theme="light"] .badge.bg-primary, [data-bs-theme="light"] .badge.text-bg-primary { background: #ddf4ff !important; color: #0550ae !important; }
[data-bs-theme="light"] .badge.bg-danger, [data-bs-theme="light"] .badge.text-bg-danger { background: #ffebe9 !important; color: #a40e26 !important; }
[data-bs-theme="light"] .badge.bg-warning, [data-bs-theme="light"] .badge.text-bg-warning { background: #fff8c5 !important; color: #7d4e00 !important; }
[data-bs-theme="light"] a:not(.btn):not(.fx-topbar-icon):not(.fx-mobile-nav-link):hover { color: #0550ae; }
[data-bs-theme="light"] code:not(.sd-code):not(.ftp-path):not(.domain-docroot-code):not(.fx-rb-code) { color: #cf222e !important; background: #fff !important; border: 1px solid #d0d7de; border-radius: 4px; padding: .1em .35em; }
[data-bs-theme="light"] [data-theme-toggle] { background: #ddf4ff !important; color: #0550ae !important; border: 1px solid #b6e3ff !important; border-radius: 8px !important; }

/* ═══════════════ DARK (GitHub Primer canvas) ═══════════════ */
[data-bs-theme="dark"] {
  --bs-body-bg: #0d1117;
  --bs-body-color: #e6edf3;
  --bs-secondary-color: #8b949e;
  --bs-border-color: #30363d;
  --bs-primary: #58a6ff;
  --bs-primary-rgb: 88, 166, 255;
  --bs-success: #3fb950;
  --bs-danger: #f85149;
  --bs-warning: #d29922;
  --bs-info: #58a6ff;
  --bs-tertiary-bg: #21262d;
  color-scheme: dark;
}
[data-bs-theme="dark"] body { background: #0d1117 !important; color: #e6edf3 !important; }

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-overlay .modal-content,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .popover,
[data-bs-theme="dark"] .toast,
[data-bs-theme="dark"] .accordion-item {
  background: #161b22 !important; color: #e6edf3 !important; border-color: #30363d !important;
}
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .accordion-button {
  background: #21262d !important; color: #e6edf3 !important; border-color: #30363d !important;
}
[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
  background: rgba(56,139,253,.12) !important; color: #79c0ff !important; box-shadow: none !important;
}

/* Tables — never white in dark */
[data-bs-theme="dark"] .table {
  --bs-table-bg: #161b22;
  --bs-table-color: #e6edf3;
  --bs-table-striped-bg: #21262d;
  --bs-table-striped-color: #e6edf3;
  --bs-table-hover-bg: #30363d;
  --bs-table-hover-color: #f0f6fc;
  --bs-table-border-color: #30363d;
  color: #e6edf3 !important; border-color: #30363d !important;
}
[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg) !important; color: #e6edf3 !important;
  border-bottom-color: #30363d !important; box-shadow: none !important;
}
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] thead.table-light,
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] .table > thead {
  --bs-table-bg: #21262d !important;
  background: #21262d !important; color: #8b949e !important; border-color: #30363d !important;
}
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background: #21262d !important; color: #e6edf3 !important;
}
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="dark"] .bg-body-tertiary,
[data-bs-theme="dark"] .bg-body-secondary {
  background: #21262d !important; color: #e6edf3 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background: #0d1117 !important; color: #e6edf3 !important; border-color: #30363d !important;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background: #161b22 !important; border-color: #58a6ff !important; color: #f0f6fc !important;
  box-shadow: 0 0 0 3px rgba(56,139,253,.25) !important;
}
[data-bs-theme="dark"] .form-control::placeholder { color: #6e7681 !important; }
[data-bs-theme="dark"] .text-muted, [data-bs-theme="dark"] .form-text { color: #8b949e !important; }
[data-bs-theme="dark"] .text-dark, [data-bs-theme="dark"] .text-black { color: #e6edf3 !important; }
[data-bs-theme="dark"] .border, [data-bs-theme="dark"] .border-bottom, [data-bs-theme="dark"] .border-top { border-color: #30363d !important; }

[data-bs-theme="dark"] .btn-primary {
  background: #238636 !important; /* GitHub green primary CTA alternative: use blue */
  background: #1f6feb !important;
  border-color: #1f6feb !important; color: #ffffff !important;
}
[data-bs-theme="dark"] .btn-primary:hover { background: #388bfd !important; border-color: #388bfd !important; color: #fff !important; }
[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-light {
  background: #21262d !important; border-color: #30363d !important; color: #e6edf3 !important;
}
[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-primary:hover {
  background: #30363d !important; border-color: #8b949e !important; color: #f0f6fc !important;
}
[data-bs-theme="dark"] .btn-danger { background: #da3633 !important; border-color: #da3633 !important; color: #fff !important; }
[data-bs-theme="dark"] .btn-success { background: #238636 !important; border-color: #238636 !important; color: #fff !important; }

[data-bs-theme="dark"] .badge.bg-success, [data-bs-theme="dark"] .badge.text-bg-success {
  background: rgba(46,160,67,.2) !important; color: #3fb950 !important;
}
[data-bs-theme="dark"] .badge.bg-secondary, [data-bs-theme="dark"] .badge.text-bg-secondary {
  background: rgba(110,118,129,.25) !important; color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .badge.bg-primary, [data-bs-theme="dark"] .badge.text-bg-primary {
  background: rgba(56,139,253,.2) !important; color: #79c0ff !important;
}
[data-bs-theme="dark"] .badge.bg-danger, [data-bs-theme="dark"] .badge.text-bg-danger {
  background: rgba(248,81,73,.2) !important; color: #ff7b72 !important;
}
[data-bs-theme="dark"] .badge.bg-warning, [data-bs-theme="dark"] .badge.text-bg-warning {
  background: rgba(187,128,9,.2) !important; color: #e3b341 !important;
}
[data-bs-theme="dark"] .badge.bg-info, [data-bs-theme="dark"] .badge.text-bg-info {
  background: rgba(56,139,253,.15) !important; color: #79c0ff !important;
}

[data-bs-theme="dark"] a:not(.btn):not(.dropdown-item):not(.fx-sidebar-link):not(.fx-topbar-icon):not(.fx-mobile-nav-link) { color: #58a6ff; }
[data-bs-theme="dark"] a:not(.btn):not(.fx-topbar-icon):not(.fx-mobile-nav-link):hover { color: #79c0ff; }
[data-bs-theme="dark"] .fx-sidebar-brand, [data-bs-theme="dark"] .navbar-brand { color: #f0f6fc !important; }

[data-bs-theme="dark"] code:not(.sd-code):not(.ftp-path):not(.domain-docroot-code):not(.fx-rb-code) {
  color: #ff7b72 !important; background: rgba(110,118,129,.2) !important;
  border-radius: 4px; padding: .1em .35em;
}
[data-bs-theme="dark"] .alert-success { background: rgba(46,160,67,.15) !important; color: #3fb950 !important; border-color: rgba(46,160,67,.35) !important; }
[data-bs-theme="dark"] .alert-danger { background: rgba(248,81,73,.15) !important; color: #ff7b72 !important; border-color: rgba(248,81,73,.35) !important; }
[data-bs-theme="dark"] .alert-warning { background: rgba(187,128,9,.15) !important; color: #e3b341 !important; border-color: rgba(187,128,9,.35) !important; }
[data-bs-theme="dark"] .alert-info { background: rgba(56,139,253,.12) !important; color: #79c0ff !important; border-color: rgba(56,139,253,.3) !important; }

[data-bs-theme="dark"] .dropdown-item { color: #e6edf3 !important; }
[data-bs-theme="dark"] .dropdown-item:hover { background: #30363d !important; color: #f0f6fc !important; }
[data-bs-theme="dark"] .page-link { background: #161b22 !important; color: #58a6ff !important; border-color: #30363d !important; }
[data-bs-theme="dark"] .page-link:hover { background: #21262d !important; color: #79c0ff !important; }
[data-bs-theme="dark"] .progress { background: #21262d !important; }

[data-bs-theme="dark"] .fm-cpanel-toolbar,
[data-bs-theme="dark"] .fm-utilitybar,
[data-bs-theme="dark"] .fm-selectionbar,
[data-bs-theme="dark"] .fm-commandbar {
  background: #161b22 !important; border-color: #30363d !important; color: #e6edf3 !important;
}

[data-bs-theme="dark"] [data-theme-toggle] {
  background: #21262d !important; color: #e6edf3 !important; border: 1px solid #30363d !important; border-radius: 8px !important;
}
[data-bs-theme="dark"] [data-theme-toggle]:hover { background: #30363d !important; }

/* Live metric widgets */
.live-metric-card .live-value { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -0.02em; }
.live-metric-card .live-bar {
  height: 6px; border-radius: 999px; background: var(--fx-surface-3, #30363d); overflow: hidden; margin-top: .5rem;
}
.live-metric-card .live-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #238636, #3fb950);
  width: 0%; transition: width .6s ease;
}
.live-metric-card.warn .live-bar > i { background: linear-gradient(90deg, #9a6700, #d29922); }
.live-metric-card.crit .live-bar > i { background: linear-gradient(90deg, #cf222e, #f85149); }
.live-pulse {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--fx-text-muted);
}
.live-pulse::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3fb950;
  box-shadow: 0 0 0 0 rgba(63,185,80,.5); animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(63,185,80,.45); }
  70% { box-shadow: 0 0 0 8px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}

/* ===== ORBPANEL-PALETTE-BRIDGE-V1 =====
   This file previously hardcoded Primer hex values with !important, which
   prevented the design tokens in orbpanel-ui.css from taking effect.
   The rules below re-point the same selectors at the --fx-* tokens so the
   palette has a single source of truth. Colours now follow the theme.
   Remove this block to restore the previous hardcoded behaviour.
   ====================================== */

[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-bg: var(--fx-bg);
  --bs-body-color: var(--fx-text);
  --bs-secondary-color: var(--fx-text-muted);
  --bs-border-color: var(--fx-border);
  --bs-primary: var(--fx-primary);
  --bs-success: var(--fx-success);
  --bs-danger: var(--fx-danger);
  --bs-warning: var(--fx-warning);
  --bs-info: var(--fx-info);
  --bs-tertiary-bg: var(--fx-surface-2);
}

[data-bs-theme="light"] body,
[data-bs-theme="dark"] body {
  background: var(--fx-bg) !important;
  color: var(--fx-text) !important;
}

/* Headings and the topbar title were still resolving to the light-palette ink in
   dark mode, which made a page's own <h1> the dimmest text on the screen. Bind
   them to the active theme's text token explicitly. */
[data-bs-theme="light"] h1, [data-bs-theme="light"] h2, [data-bs-theme="light"] h3,
[data-bs-theme="light"] h4, [data-bs-theme="light"] h5, [data-bs-theme="light"] h6,
[data-bs-theme="light"] .fx-topbar-title,
[data-bs-theme="light"] .fx-topbar .fx-name {
  color: #0f172a !important;
}
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .fx-topbar-title,
[data-bs-theme="dark"] .fx-topbar .fx-name,
body.dark-mode .fx-topbar-title,
body.dark-mode .fx-topbar .fx-name {
  color: #f1f5f9 !important;
}
/* Utility text colours must still win over the heading rule above. */
[data-bs-theme="light"] h1.text-muted, [data-bs-theme="light"] h2.text-muted,
[data-bs-theme="light"] h3.text-muted, [data-bs-theme="light"] h4.text-muted,
[data-bs-theme="light"] h5.text-muted, [data-bs-theme="light"] h6.text-muted,
[data-bs-theme="dark"] h1.text-muted, [data-bs-theme="dark"] h2.text-muted,
[data-bs-theme="dark"] h3.text-muted, [data-bs-theme="dark"] h4.text-muted,
[data-bs-theme="dark"] h5.text-muted, [data-bs-theme="dark"] h6.text-muted {
  color: var(--fx-text-muted) !important;
}

/* bg-secondary-subtle badges only had a light-mode ink override, so "Unlimited"
   style chips lost their surface entirely in dark mode. */
[data-bs-theme="light"] .badge.bg-secondary-subtle {
  background: var(--fx-surface-2) !important; color: var(--fx-text) !important;
  border: 1px solid var(--fx-border) !important;
}
[data-bs-theme="dark"] .badge.bg-secondary-subtle {
  background: rgba(255,255,255,.08) !important; color: #e6edf3 !important;
  border: 1px solid rgba(255,255,255,.14) !important;
}

[data-bs-theme="light"] .card,
[data-bs-theme="light"] .modal-content,
[data-bs-theme="light"] .list-group-item,
[data-bs-theme="light"] .dropdown-menu,
[data-bs-theme="light"] .offcanvas,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-overlay .modal-content,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .popover,
[data-bs-theme="dark"] .toast,
[data-bs-theme="dark"] .accordion-item {
  background: var(--fx-surface) !important;
  color: var(--fx-text) !important;
  border-color: var(--fx-border) !important;
}

[data-bs-theme="light"] .card-header,
[data-bs-theme="light"] .modal-header,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .modal-header {
  background: var(--fx-surface-2) !important;
  color: var(--fx-text) !important;
  border-color: var(--fx-border) !important;
}

[data-bs-theme="light"] .table,
[data-bs-theme="dark"] .table {
  --bs-table-bg: var(--fx-surface);
  --bs-table-color: var(--fx-text);
  --bs-table-striped-bg: var(--fx-surface-2);
  --bs-table-striped-color: var(--fx-text);
  --bs-table-hover-bg: var(--fx-primary-50);
  --bs-table-border-color: var(--fx-border);
  color: var(--fx-text) !important;
}

[data-bs-theme="light"] .table > :not(caption) > * > *,
[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg) !important;
  color: var(--fx-text) !important;
  border-bottom-color: var(--fx-border) !important;
}

[data-bs-theme="light"] .table-light,
[data-bs-theme="light"] thead.table-light,
[data-bs-theme="light"] .table thead th,
[data-bs-theme="dark"] .table thead th {
  background: var(--fx-surface-2) !important;
  color: var(--fx-text-muted) !important;
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background: var(--fx-surface) !important;
  color: var(--fx-text) !important;
  border-color: var(--fx-border) !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  border-color: var(--fx-primary) !important;
  box-shadow: 0 0 0 3px var(--fx-primary-100) !important;
}

[data-bs-theme="light"] .text-muted,
[data-bs-theme="dark"] .text-muted { color: var(--fx-text-muted) !important; }

[data-bs-theme="light"] .btn-primary,
[data-bs-theme="dark"] .btn-primary {
  background: var(--fx-primary) !important;
  border-color: var(--fx-primary) !important;
}
[data-bs-theme="light"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-primary:hover {
  background: var(--fx-primary-600) !important;
  border-color: var(--fx-primary-600) !important;
}
[data-bs-theme="light"] .btn-danger,
[data-bs-theme="dark"] .btn-danger {
  background: var(--fx-danger) !important; border-color: var(--fx-danger) !important;
}
[data-bs-theme="light"] .btn-success,
[data-bs-theme="dark"] .btn-success {
  background: var(--fx-success) !important; border-color: var(--fx-success) !important;
}

[data-bs-theme="light"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-secondary {
  color: var(--fx-text-muted) !important;
  border-color: var(--fx-border) !important;
  background: var(--fx-surface) !important;
}
[data-bs-theme="light"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background: var(--fx-surface-2) !important; color: var(--fx-text) !important;
}

[data-bs-theme="light"] a:not(.btn):not(.dropdown-item):not(.fx-sidebar-link):not(.fx-topbar-icon):not(.fx-mobile-nav-link) { color: var(--fx-primary); }
[data-bs-theme="dark"] a:not(.btn):not(.dropdown-item):not(.fx-sidebar-link):not(.fx-topbar-icon):not(.fx-mobile-nav-link) { color: #58a6ff; }
[data-bs-theme="light"] a:not(.btn):not(.fx-topbar-icon):not(.fx-mobile-nav-link):hover { color: var(--fx-primary-600); }
[data-bs-theme="dark"] a:not(.btn):not(.fx-topbar-icon):not(.fx-mobile-nav-link):hover { color: #93c5fd; }

[data-bs-theme="light"] code:not(.sd-code):not(.ftp-path):not(.domain-docroot-code):not(.fx-rb-code) {
  color: #991b1b !important;
  background: var(--fx-surface-2) !important;
  border: 1px solid var(--fx-border);
}
[data-bs-theme="dark"] code:not(.sd-code):not(.ftp-path):not(.domain-docroot-code):not(.fx-rb-code) {
  color: #f87171 !important;
  background: var(--fx-surface-2) !important;
  border: 1px solid var(--fx-border);
}

[data-bs-theme="light"] .badge.bg-primary,
[data-bs-theme="light"] .badge.text-bg-primary {
  background: var(--fx-primary-50) !important; color: var(--fx-primary) !important;
}
[data-bs-theme="light"] .badge.bg-success,
[data-bs-theme="light"] .badge.text-bg-success {
  background: var(--fx-success-50) !important; color: var(--fx-success) !important;
}
[data-bs-theme="light"] .badge.bg-danger,
[data-bs-theme="light"] .badge.text-bg-danger {
  background: var(--fx-danger-50) !important; color: var(--fx-danger) !important;
}
[data-bs-theme="light"] .badge.bg-warning,
[data-bs-theme="light"] .badge.text-bg-warning {
  background: var(--fx-warning-50) !important; color: var(--fx-warning) !important;
}

[data-bs-theme="light"] [data-theme-toggle] {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}
[data-bs-theme="dark"] [data-theme-toggle] {
  background: #27272a !important;
  color: #f4f4f5 !important;
  border: 1px solid #3f3f46 !important;
}
[data-bs-theme="dark"] .text-primary {
  color: #58a6ff !important;
}
/* ===== END ORBPANEL-PALETTE-BRIDGE-V1 ===== */

/* ===== DARK CONTRAST SWEEP V2 (site-wide audit fixes) ===== */
/* Muted / hint text: readable slate instead of dark navy inline leftovers */
[data-bs-theme="dark"] .fx-main small,
[data-bs-theme="dark"] .fx-main .small,
[data-bs-theme="dark"] .fx-main .form-text { color: #9aa7b4 !important; }

/* Semantic text colors: brighten for dark canvas */
[data-bs-theme="dark"] .fx-main .text-danger { color: #ff7b72 !important; }
[data-bs-theme="dark"] .fx-main .text-success { color: #56d364 !important; }
[data-bs-theme="dark"] .fx-main .text-warning { color: #e3b341 !important; }
[data-bs-theme="dark"] .fx-main .text-secondary { color: #8b949e !important; }
[data-bs-theme="dark"] .fx-main .text-primary { color: #58a6ff !important; }

/* Subtle badges */
[data-bs-theme="dark"] .badge.bg-primary-subtle {
  color: #79b8ff !important;
  background: rgba(56, 139, 253, 0.16) !important;
}
[data-bs-theme="dark"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.text-bg-warning { color: #14181f !important; }
[data-bs-theme="dark"] .badge.bg-info,
[data-bs-theme="dark"] .badge.text-bg-info { color: #14181f !important; }

/* Outline buttons */
[data-bs-theme="dark"] .fx-main .btn-outline-primary {
  color: #79b8ff !important;
  border-color: rgba(88, 166, 255, 0.55) !important;
}
[data-bs-theme="dark"] .fx-main .btn-outline-primary:hover {
  background: rgba(88, 166, 255, 0.15) !important;
  color: #a5cfff !important;
}
[data-bs-theme="dark"] .fx-main .btn-outline-danger {
  color: #ff8b84 !important;
  border-color: rgba(248, 81, 73, 0.5) !important;
}
[data-bs-theme="dark"] .fx-main .btn-outline-secondary {
  color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .fx-main .btn-outline-secondary:hover {
  background: rgba(201, 209, 217, 0.12) !important;
  color: #e6edf3 !important;
}

/* Plain text links (keep .btn, sidebar nav and action tiles untouched) */
[data-bs-theme="dark"] .fx-main a:not(.btn):not(.admin-action):not(.nav-link):not(.dropdown-item) { color: #6cb2ff; }
[data-bs-theme="dark"] .fx-main a:not(.btn):not(.admin-action):not(.nav-link):not(.dropdown-item):hover { color: #8fc4ff; }

/* Alerts on dark */
[data-bs-theme="dark"] .alert-danger {
  color: #ffc1bc !important;
  border-color: rgba(248, 81, 73, 0.4) !important;
}
[data-bs-theme="dark"] .alert-danger .alert-link { color: #ff8f86 !important; }

/* Active nav tabs (exclude solid bg-primary pills so they stay white-on-blue) */
[data-bs-theme="dark"] .nav-link.active:not(.bg-primary):not(.btn) { color: #58a6ff !important; }
/* ===== END DARK CONTRAST SWEEP V2 ===== */

/* ===== LIGHT CONTRAST SWEEP V1 (subtle badges pair with emphasis text) ===== */
[data-bs-theme="light"] .badge.bg-primary-subtle { color: #0550ae !important; }
[data-bs-theme="light"] .badge.bg-success-subtle { color: #0a5c36 !important; }
[data-bs-theme="light"] .badge.bg-danger-subtle { color: #842029 !important; }
[data-bs-theme="light"] .badge.bg-warning-subtle { color: #664d03 !important; }
[data-bs-theme="light"] .badge.bg-info-subtle { color: #055160 !important; }
[data-bs-theme="light"] .badge.bg-secondary-subtle { color: #414952 !important; }
/* ===== END LIGHT CONTRAST SWEEP V1 ===== */
