/* Default GoAppsFW theme profile. Mostly inherits Bootstrap defaults. */
:root, [data-bs-theme="light"] {
  --go-sidebar-bg: #ffffff;
  --go-navbar-bg: #212529;
}
[data-bs-theme="dark"] {
  --go-sidebar-bg: #1b1f24;
  --go-navbar-bg: #111827;
}
.navbar.bg-dark { background-color: var(--go-navbar-bg) !important; }

/* ==========================================================
   GoAppsFW theme-safe module normalization
   Added for restored/generated modules that still use Bootstrap
   light utilities or local hardcoded white panels. This stays in
   theme CSS so module CFM files do not need cosmetic edits.
   ========================================================== */
html[data-bs-theme="dark"],
html[data-go-theme-mode="dark"] {
  --go-module-surface: var(--bs-body-bg);
  --go-module-surface-soft: var(--bs-tertiary-bg);
  --go-module-text: var(--bs-body-color);
  --go-module-muted: var(--bs-secondary-color);
  --go-module-border: var(--bs-border-color);
}

html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .card-body,
html[data-bs-theme="dark"] .list-group-item,
html[data-bs-theme="dark"] .accordion-item,
html[data-bs-theme="dark"] .accordion-button,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .table-responsive,
html[data-go-theme-mode="dark"] .card,
html[data-go-theme-mode="dark"] .card-body,
html[data-go-theme-mode="dark"] .list-group-item,
html[data-go-theme-mode="dark"] .accordion-item,
html[data-go-theme-mode="dark"] .accordion-button,
html[data-go-theme-mode="dark"] .modal-content,
html[data-go-theme-mode="dark"] .dropdown-menu,
html[data-go-theme-mode="dark"] .table-responsive {
  background-color: var(--go-module-surface) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .card-footer,
html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer,
html[data-bs-theme="dark"] .accordion-button:not(.collapsed),
html[data-go-theme-mode="dark"] .card-header,
html[data-go-theme-mode="dark"] .card-footer,
html[data-go-theme-mode="dark"] .modal-header,
html[data-go-theme-mode="dark"] .modal-footer,
html[data-go-theme-mode="dark"] .accordion-button:not(.collapsed) {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .bg-light,
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .alert-light,
html[data-bs-theme="dark"] .table-light,
html[data-bs-theme="dark"] .text-bg-light,
html[data-go-theme-mode="dark"] .bg-light,
html[data-go-theme-mode="dark"] .bg-white,
html[data-go-theme-mode="dark"] .alert-light,
html[data-go-theme-mode="dark"] .table-light,
html[data-go-theme-mode="dark"] .text-bg-light {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .link-dark,
html[data-go-theme-mode="dark"] .text-dark,
html[data-go-theme-mode="dark"] .link-dark {
  color: var(--go-module-text) !important;
}

html[data-bs-theme="dark"] .text-muted,
html[data-go-theme-mode="dark"] .text-muted {
  color: var(--go-module-muted) !important;
}

html[data-bs-theme="dark"] .btn-outline-dark,
html[data-go-theme-mode="dark"] .btn-outline-dark {
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .btn-outline-dark:hover,
html[data-bs-theme="dark"] .btn-outline-dark:focus,
html[data-go-theme-mode="dark"] .btn-outline-dark:hover,
html[data-go-theme-mode="dark"] .btn-outline-dark:focus {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .table,
html[data-go-theme-mode="dark"] .table {
  --bs-table-bg: transparent !important;
  --bs-table-color: var(--go-module-text) !important;
  --bs-table-border-color: var(--go-module-border) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .table > :not(caption) > * > *,
html[data-go-theme-mode="dark"] .table > :not(caption) > * > * {
  background-color: transparent !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .table thead th,
html[data-bs-theme="dark"] .table-light th,
html[data-go-theme-mode="dark"] .table thead th,
html[data-go-theme-mode="dark"] .table-light th {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] .input-group-text,
html[data-go-theme-mode="dark"] .form-control,
html[data-go-theme-mode="dark"] .form-select,
html[data-go-theme-mode="dark"] .input-group-text {
  background-color: var(--go-module-surface) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .form-control:disabled,
html[data-bs-theme="dark"] .form-select:disabled,
html[data-bs-theme="dark"] .form-control[readonly],
html[data-go-theme-mode="dark"] .form-control:disabled,
html[data-go-theme-mode="dark"] .form-select:disabled,
html[data-go-theme-mode="dark"] .form-control[readonly] {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-muted) !important;
}

/* Compatibility styling */
html[data-bs-theme="dark"] [style*="background:#fff"],
html[data-bs-theme="dark"] [style*="background: #fff"],
html[data-bs-theme="dark"] [style*="background-color:#fff"],
html[data-bs-theme="dark"] [style*="background-color: #fff"],
html[data-bs-theme="dark"] [style*="background:#ffffff"],
html[data-bs-theme="dark"] [style*="background: #ffffff"],
html[data-bs-theme="dark"] [style*="background-color:#ffffff"],
html[data-bs-theme="dark"] [style*="background-color: #ffffff"],
html[data-bs-theme="dark"] [style*="background:#f8f9fa"],
html[data-bs-theme="dark"] [style*="background: #f8f9fa"],
html[data-bs-theme="dark"] [style*="background-color:#f8f9fa"],
html[data-bs-theme="dark"] [style*="background-color: #f8f9fa"],
html[data-go-theme-mode="dark"] [style*="background:#fff"],
html[data-go-theme-mode="dark"] [style*="background: #fff"],
html[data-go-theme-mode="dark"] [style*="background-color:#fff"],
html[data-go-theme-mode="dark"] [style*="background-color: #fff"],
html[data-go-theme-mode="dark"] [style*="background:#ffffff"],
html[data-go-theme-mode="dark"] [style*="background: #ffffff"],
html[data-go-theme-mode="dark"] [style*="background-color:#ffffff"],
html[data-go-theme-mode="dark"] [style*="background-color: #ffffff"],
html[data-go-theme-mode="dark"] [style*="background:#f8f9fa"],
html[data-go-theme-mode="dark"] [style*="background: #f8f9fa"],
html[data-go-theme-mode="dark"] [style*="background-color:#f8f9fa"],
html[data-go-theme-mode="dark"] [style*="background-color: #f8f9fa"] {
  background-color: var(--go-module-surface-soft) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

/* Compatibility styling
   that is loaded after the theme. These high-specificity rules override it. */
html[data-bs-theme="dark"] .mb-overlay,
html[data-go-theme-mode="dark"] .mb-overlay {
  background: rgba(0,0,0,.72) !important;
}

html[data-bs-theme="dark"] .mb-modal,
html[data-bs-theme="dark"] .mb-modal .modal-content,
html[data-bs-theme="dark"] .mb-modal .modal-header,
html[data-bs-theme="dark"] .mb-modal .modal-body,
html[data-bs-theme="dark"] .mb-modal .modal-footer,
html[data-go-theme-mode="dark"] .mb-modal,
html[data-go-theme-mode="dark"] .mb-modal .modal-content,
html[data-go-theme-mode="dark"] .mb-modal .modal-header,
html[data-go-theme-mode="dark"] .mb-modal .modal-body,
html[data-go-theme-mode="dark"] .mb-modal .modal-footer {
  --bs-modal-bg: var(--go-module-surface) !important;
  --bs-modal-color: var(--go-module-text) !important;
  --bs-modal-border-color: var(--go-module-border) !important;
  --bs-modal-header-border-color: var(--go-module-border) !important;
  --bs-modal-footer-border-color: var(--go-module-border) !important;
  background: var(--go-module-surface) !important;
  background-color: var(--go-module-surface) !important;
  color: var(--go-module-text) !important;
  border-color: var(--go-module-border) !important;
}

html[data-bs-theme="dark"] .mb-modal .modal-header,
html[data-bs-theme="dark"] .mb-modal .modal-footer,
html[data-go-theme-mode="dark"] .mb-modal .modal-header,
html[data-go-theme-mode="dark"] .mb-modal .modal-footer {
  background: var(--go-module-surface-soft) !important;
  background-color: var(--go-module-surface-soft) !important;
}

html[data-bs-theme="dark"] .mb-modal label,
html[data-bs-theme="dark"] .mb-modal .form-label,
html[data-bs-theme="dark"] .mb-modal .modal-title,
html[data-go-theme-mode="dark"] .mb-modal label,
html[data-go-theme-mode="dark"] .mb-modal .form-label,
html[data-go-theme-mode="dark"] .mb-modal .modal-title {
  color: var(--go-module-text) !important;
}

html[data-bs-theme="dark"] .mb-modal .form-text,
html[data-bs-theme="dark"] .mb-modal .text-muted,
html[data-go-theme-mode="dark"] .mb-modal .form-text,
html[data-go-theme-mode="dark"] .mb-modal .text-muted {
  color: var(--go-module-muted) !important;
}

html[data-bs-theme="dark"] .mb-modal .btn-close,
html[data-go-theme-mode="dark"] .mb-modal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%) !important;
  opacity: .85 !important;
}

@media (prefers-color-scheme: dark) {
  html[data-go-theme-mode="auto"] .card,
  html[data-go-theme-mode="auto"] .card-body,
  html[data-go-theme-mode="auto"] .card-header,
  html[data-go-theme-mode="auto"] .card-footer,
  html[data-go-theme-mode="auto"] .bg-light,
  html[data-go-theme-mode="auto"] .bg-white,
  html[data-go-theme-mode="auto"] .table-light,
  html[data-go-theme-mode="auto"] .text-bg-light,
  html[data-go-theme-mode="auto"] .list-group-item,
  html[data-go-theme-mode="auto"] .accordion-item,
  html[data-go-theme-mode="auto"] .accordion-button,
  html[data-go-theme-mode="auto"] .modal-content,
  html[data-go-theme-mode="auto"] .mb-modal .modal-content,
  html[data-go-theme-mode="auto"] .mb-modal .modal-header,
  html[data-go-theme-mode="auto"] .mb-modal .modal-body,
  html[data-go-theme-mode="auto"] .mb-modal .modal-footer {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
  }
  html[data-go-theme-mode="auto"] .text-dark,
  html[data-go-theme-mode="auto"] .link-dark {
    color: var(--bs-body-color) !important;
  }
}

