/* UNIVERSAL THEME — change brand colors only in this file.
   Semantic colors may reference a brand token or a different HEX value.
   Keep primitive colors in six-digit HEX format for server-rendered email. */
:root {
  /* Brand palette: SITI World / SITI Aegis */
  --theme-primary: #185FA2;
  --theme-secondary: #C9E0E4;
  --theme-ink: #1D1D1B;
  --theme-gray: #CCCCCC;
  --theme-white: #FFFFFF;

  /* Meaning and interaction states */
  --theme-surface: var(--theme-white);
  --theme-text: var(--theme-ink);
  /* Language selector on authentication screens. */
  --theme-language-switcher-bg: var(--theme-primary);
  --theme-language-switcher-text: var(--theme-on-primary);
  --theme-language-switcher-border: var(--theme-primary);
  --theme-language-switcher-hover-bg: var(--theme-secondary);
  --theme-language-switcher-hover-border: var(--theme-primary);
  --theme-border: var(--theme-gray);
  /* Neutral status labels, such as a normally closed session. */
  --theme-neutral-soft: color-mix(in srgb, var(--theme-gray) 35%, var(--theme-white));
  /* Neutral recovery-email notice surface and readable text. */
  --theme-email-notice-bg: #F1F3F5;
  --theme-email-notice-text: #46515C;
  --theme-on-neutral-soft: color-mix(in srgb, var(--theme-ink) 75%, var(--theme-white));
  --theme-text-muted: color-mix(in srgb, var(--theme-ink) 65%, var(--theme-white));
  --theme-page: color-mix(in srgb, var(--theme-gray) 12%, var(--theme-white));
  --theme-surface-muted: color-mix(in srgb, var(--theme-gray) 22%, var(--theme-white));
  /* Shared loading state for all Bootstrap Table record lists. */
  --theme-table-loading-overlay: color-mix(in srgb, var(--theme-surface) 94%, transparent);
  --theme-table-loading-track: var(--theme-surface-muted);
  --theme-table-loading-indicator: var(--theme-primary);
  --theme-table-loading-text: var(--theme-text-muted);
  /* Universal page-size menu states for Bootstrap Table record lists. */
  --theme-table-option-hover-bg: var(--theme-secondary);
  --theme-table-option-hover-text: var(--theme-primary);
  --theme-table-option-selected-bg: var(--theme-secondary);
  --theme-table-option-selected-text: var(--theme-primary);
  --theme-table-option-selected-border: var(--theme-primary);
  /* Current page-size control in every Bootstrap Table footer. */
  --theme-table-page-size-bg: var(--theme-primary-soft);
  --theme-table-page-size-text: var(--theme-primary);
  --theme-table-page-size-border: var(--theme-secondary);
  --theme-table-page-size-hover-bg: var(--theme-secondary);
  --theme-table-page-size-hover-text: var(--theme-primary);
  --theme-table-page-size-hover-border: var(--theme-primary);
  --theme-primary-hover: color-mix(in srgb, var(--theme-primary) 86%, var(--theme-ink));
  --theme-primary-active: color-mix(in srgb, var(--theme-primary) 75%, var(--theme-ink));
  --theme-primary-soft: var(--theme-secondary);
  --theme-on-primary: var(--theme-white);
  --theme-disabled: var(--theme-primary);
  --theme-cancel: var(--theme-surface-muted);
  --theme-cancel-hover: var(--theme-gray);
  --theme-on-cancel: var(--theme-text);
  /* Cancel buttons in confirmation popups and modal dialogs. */
  --theme-popup-cancel-bg: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-white));
  --theme-popup-cancel-text: var(--theme-primary);
  --theme-popup-cancel-border: var(--theme-secondary);
  --theme-popup-cancel-hover-bg: var(--theme-secondary);
  --theme-popup-cancel-hover-text: var(--theme-primary);
  --theme-popup-cancel-hover-border: var(--theme-primary);
  --theme-success: var(--theme-primary);
  --theme-success-soft: var(--theme-secondary);
  --theme-on-success: var(--theme-white);
  --theme-on-success-soft: var(--theme-ink);
  /* Active status labels in tables and detail views. */
  --theme-active-soft: #E6F4EA;
  --theme-on-active-soft: #1E6B35;
  /* Field validation only: independent from brand colors and other alerts. */
  --theme-field-error: #D93025;
  /* Error badges and notices: pastel surface with readable red text. */
  --theme-error-soft: #FCE8E6;
  --theme-on-error-soft: #A50E0E;
  --theme-field-error-focus: color-mix(in srgb, var(--theme-field-error) 20%, transparent);
  --theme-danger: var(--theme-ink);
  --theme-danger-soft: var(--theme-surface-muted);
  --theme-on-danger: var(--theme-white);
  /* Destructive actions use the error palette, separate from neutral controls. */
  --theme-delete-bg: var(--theme-error-soft);
  --theme-delete-text: var(--theme-on-error-soft);
  --theme-delete-border: color-mix(in srgb, var(--theme-field-error) 35%, var(--theme-error-soft));
  --theme-delete-hover-bg: transparent;
  --theme-delete-hover-text: var(--theme-on-error-soft);
  --theme-delete-hover-border: var(--theme-field-error);
  --theme-warning: var(--theme-secondary);
  --theme-warning-soft: var(--theme-secondary);
  --theme-on-warning: var(--theme-ink);
  /* Expired sessions: distinct from active, failed, and other warning states. */
  --theme-expired-soft: #FFF3CD;
  --theme-on-expired-soft: #664D03;
  --theme-info: var(--theme-primary);
  --theme-info-soft: var(--theme-secondary);
  --theme-on-info: var(--theme-white);
  --theme-on-info-soft: var(--theme-ink);
  --theme-nav: var(--theme-primary);
  --theme-on-nav: var(--theme-white);
  --theme-focus: color-mix(in srgb, var(--theme-primary) 25%, transparent);
  --theme-overlay: color-mix(in srgb, var(--theme-ink) 55%, transparent);
  --theme-shadow: color-mix(in srgb, var(--theme-ink) 16%, transparent);
}

/* Compatibility with the existing layout and third-party widgets. */
:root,[data-bs-theme=light] {
  --color-primary:var(--theme-primary);
  --color-1:var(--theme-primary);--color-2:var(--theme-primary);--color-3:var(--theme-nav);--color-4:var(--theme-primary);
  --color-5:var(--theme-primary);--color-6:var(--theme-primary-soft);--color-7:var(--theme-border);--color-8:var(--theme-cancel);
  --color-9:var(--theme-surface-muted);--color-10:var(--theme-text);--color-11:var(--theme-page);--color-12:var(--theme-primary);
  --color-white-light:var(--theme-surface);--color-gray-dark:var(--theme-text-muted);
  --bs-primary:var(--theme-primary);--ct-primary:var(--theme-primary);
  --bs-secondary:var(--theme-cancel);--ct-secondary:var(--theme-cancel);
  --bs-success:var(--theme-success);--ct-success:var(--theme-success);
  --bs-danger:var(--theme-danger);--ct-danger:var(--theme-danger);
  --bs-warning:var(--theme-warning);--ct-warning:var(--theme-warning);
  --bs-info:var(--theme-info);--ct-info:var(--theme-info);
  --bs-light:var(--theme-surface-muted);--ct-light:var(--theme-surface-muted);
  --bs-dark:var(--theme-ink);--ct-dark:var(--theme-ink);
  --bs-body-color:var(--theme-text);--ct-body-color:var(--theme-text);
  --bs-body-bg:var(--theme-page);--ct-body-bg:var(--theme-page);
  --bs-border-color:var(--theme-border);--ct-border-color:var(--theme-border);
  --bs-link-color:var(--theme-primary);--ct-link-color:var(--theme-primary);
  --bs-link-hover-color:var(--theme-primary-hover);--ct-link-hover-color:var(--theme-primary-hover);
}


.navbar-custom,.bg-color-3{background:var(--theme-nav)!important}.navbar-custom .nav-link{color: var(--theme-surface)!important}
.btn.btn-primary,.btn.btn-save,.bg-primary,.btn.btn-success,.btn.btn-info{background:var(--theme-primary)!important;border-color:var(--theme-primary)!important;color:var(--theme-surface)!important}
.btn.btn-primary:hover,.btn.btn-primary:focus-visible{background:var(--theme-primary)!important;filter:brightness(.9);box-shadow:0 0 0 .2rem var(--theme-secondary)!important}
.btn.btn-outline-primary{color:var(--theme-primary)!important;border-color:var(--theme-primary)!important}.btn.btn-outline-primary:hover{color:var(--theme-surface)!important;background:var(--theme-primary)!important}
.btn.btn-light,.btn.btn-cancel,.btn.btn-secondary{background:var(--theme-page)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}.btn.btn-light:hover,.btn.btn-cancel:hover,.btn.btn-secondary:hover{background:var(--theme-border)!important;color:var(--theme-ink)!important}
.btn.btn-danger{background:var(--theme-ink)!important;border-color:var(--theme-ink)!important}.btn.btn-outline-danger{color:var(--theme-ink)!important;border-color:var(--theme-ink)!important}.btn.btn-outline-danger:hover{color:var(--theme-surface)!important;background:var(--theme-ink)!important}
.text-primary,.text-info,.text-success,.text-danger,.text-warning{color:var(--theme-primary)!important}
.alert-info,.alert-success,.alert-warning,.badge.bg-success,.badge.bg-info,.badge.bg-warning{background:var(--theme-secondary)!important;color:var(--theme-ink)!important;border-color:var(--theme-primary)!important}
.alert-danger,.badge.bg-danger{background:var(--theme-page)!important;color:var(--theme-ink)!important;border-color:var(--theme-ink)!important}
.form-control:focus,.form-select:focus{border-color:var(--theme-primary)!important;box-shadow:0 0 0 .2rem var(--theme-secondary)!important}.form-check-input:checked{background-color:var(--theme-primary)!important;border-color:var(--theme-primary)!important}
.invalid-feedback,.campo-error{color:var(--theme-ink)!important}.is-invalid{border-color:var(--theme-ink)!important}
.swal2-icon.swal2-success,.swal2-icon.swal2-warning,.swal2-icon.swal2-info,.swal2-icon.swal2-error{border-color:var(--theme-primary)!important;color:var(--theme-primary)!important}
.brand-logo-nav{width:165px!important;height:auto!important;max-height:100px;object-fit:contain}.logo-box{height:110px!important;display:flex;align-items:center;justify-content:center}
.browser-pair-heading img{width:200px;height:auto}.brand-logo-full{max-width:260px;height:auto}

body .login-lang-switcher .btn-lang{color:var(--theme-language-switcher-text)!important;background:var(--theme-language-switcher-bg)!important;border:1px solid var(--theme-language-switcher-border)!important}
.login-lang-switcher .btn-lang:hover{color:var(--theme-language-switcher-text)!important;background:var(--theme-language-switcher-hover-bg)!important;border-color:var(--theme-language-switcher-hover-border)!important}
.login-page .form-control,.login-page .form-select,.form-control,.form-select{border-color:var(--theme-border)!important;color:var(--theme-ink)!important}
.navbar-custom #topbar-module-search-input{background:var(--theme-surface)!important;color:var(--theme-ink)!important}
.navbar-custom #topbar-module-search-input::placeholder{color:var(--theme-ink)!important;opacity:.65}
.menu-title{color:var(--theme-ink)!important;opacity:.7}

/* Global states. No component stores its own palette. */
.btn.btn-primary,.btn.btn-save,.btn.btn-color-4,.btn.btn-color-gray,.btn.btn-export{
 --bs-btn-color:var(--theme-on-primary);--bs-btn-bg:var(--theme-primary);--bs-btn-border-color:var(--theme-primary);
 --bs-btn-hover-bg:var(--theme-primary-hover);--bs-btn-hover-border-color:var(--theme-primary-hover);
 --bs-btn-active-bg:var(--theme-primary-active);--bs-btn-active-border-color:var(--theme-primary-active);
 --bs-btn-disabled-bg:var(--theme-disabled);--bs-btn-disabled-border-color:var(--theme-disabled);
}
.btn.btn-primary,button.btn-primary,a.btn-primary,.btn.btn-save,.btn.btn-export{background:var(--theme-primary)!important;border-color:var(--theme-primary)!important;color:var(--theme-on-primary)!important}
.btn.btn-primary:hover,.btn.btn-primary:focus-visible,.btn.btn-save:hover,.btn.btn-export:hover{background:var(--theme-primary-hover)!important;border-color:var(--theme-primary-hover)!important;color:var(--theme-on-primary)!important;filter:none}
.btn.btn-primary:active,.btn.btn-primary.active{background:var(--theme-primary-active)!important;border-color:var(--theme-primary-active)!important}
.btn.btn-primary:disabled,.btn.btn-primary.disabled,.btn.btn-save:disabled,.btn.btn-export:disabled,.btn.btn-primary[aria-busy=true],.btn.btn-primary.is-loading{background:var(--theme-disabled)!important;border-color:var(--theme-disabled)!important;color:var(--theme-on-primary)!important;opacity:.72;filter:none}
.btn.btn-light,.btn.btn-cancel,.btn.btn-secondary,.swal2-cancel{background:var(--theme-cancel)!important;border-color:var(--theme-border)!important;color:var(--theme-on-cancel)!important}
.btn.btn-light:hover,.btn.btn-cancel:hover,.btn.btn-secondary:hover{background:var(--theme-cancel-hover)!important;color:var(--theme-on-cancel)!important}
.btn.btn-outline-primary{background:var(--theme-surface)!important;color:var(--theme-primary)!important;border-color:var(--theme-primary)!important}
.btn.btn-outline-primary:hover{background:var(--theme-primary)!important;color:var(--theme-on-primary)!important}
.btn.btn-danger,.swal-delete-confirm{background:var(--theme-danger)!important;border-color:var(--theme-danger)!important;color:var(--theme-on-danger)!important}
.text-success{color:var(--theme-success)!important}.text-danger,.invalid-feedback,.campo-error{color:var(--theme-danger)!important}
.text-warning{color:var(--theme-on-warning)!important}.text-info{color:var(--theme-info)!important}
.alert-success,.badge.bg-success{background:var(--theme-success-soft)!important;color:var(--theme-on-success-soft)!important;border-color:var(--theme-success)!important}
.alert-danger,.badge.bg-danger{background:var(--theme-danger-soft)!important;color:var(--theme-danger)!important;border-color:var(--theme-danger)!important}
.alert-warning,.badge.bg-warning{background:var(--theme-warning-soft)!important;color:var(--theme-on-warning)!important;border-color:var(--theme-warning)!important}
.alert-info,.badge.bg-info{background:var(--theme-info-soft)!important;color:var(--theme-on-info-soft)!important;border-color:var(--theme-info)!important}
.form-control:focus,.form-select:focus{border-color:var(--theme-primary)!important;box-shadow:0 0 0 .2rem var(--theme-focus)!important}
.is-invalid{border-color:var(--theme-danger)!important}.menu .menu-title{color:var(--theme-text-muted)!important}
.navbar-custom .nav-link,.navbar-custom .topbar-menu .nav-link{color:var(--theme-on-nav)!important}
.switchery{border-color:var(--theme-border)}
.swal2-popup{background:var(--theme-surface)!important;color:var(--theme-text)!important}
.swal2-confirm{background:var(--theme-primary)!important;color:var(--theme-on-primary)!important}
.swal2-icon.swal2-success [class^=swal2-success-line]{background-color:var(--theme-success)!important}
.swal2-icon.swal2-success .swal2-success-ring{border-color:var(--theme-success)!important}
.swal2-icon.swal2-error [class^=swal2-x-mark-line]{background-color:var(--theme-danger)!important}
.swal2-icon.swal2-error{border-color:var(--theme-danger)!important}
.badge-level-1,.badge-level-2,.badge-level-3,.badge-level-4,.badge-level-5{background:var(--theme-primary-soft)!important;color:var(--theme-text)!important}

/* Third-party controls used by the Core: inherit the same semantic tokens. */
.select2-container--default .select2-selection--single,.select2-container--default .select2-selection--multiple,.select2-dropdown{background:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
.select2-container--default .select2-selection--single .select2-selection__rendered{color:var(--theme-text)}
.select2-container--default .select2-results__option--highlighted[aria-selected],.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable{background:var(--theme-primary)!important;color:var(--theme-on-primary)!important}
.flatpickr-calendar{background:var(--theme-surface);color:var(--theme-text);box-shadow:0 .25rem 1.5rem var(--theme-shadow)}
.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover{background:var(--theme-primary)!important;border-color:var(--theme-primary)!important;color:var(--theme-on-primary)!important}
.flatpickr-day.today{border-color:var(--theme-primary)}.flatpickr-day:hover{background:var(--theme-primary-soft);border-color:var(--theme-secondary)}
.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:var(--theme-primary)}
.cropper-point,.cropper-line{background-color:var(--theme-primary)}.cropper-view-box{outline:1px solid var(--theme-primary)}.cropper-modal{background-color:var(--theme-ink)}
.mfp-bg{background:var(--theme-ink)}.progress-bar{background-color:var(--theme-primary)}
input[type=checkbox],input[type=radio]{accent-color:var(--theme-primary)}

.btn.btn-success{background:var(--theme-success)!important;border-color:var(--theme-success)!important;color:var(--theme-on-success)!important}
.btn.btn-info{background:var(--theme-info)!important;border-color:var(--theme-info)!important;color:var(--theme-on-info)!important}
.btn.btn-warning{background:var(--theme-warning)!important;border-color:var(--theme-warning)!important;color:var(--theme-on-warning)!important}
.btn.btn-outline-success{background:transparent!important;border-color:var(--theme-success)!important;color:var(--theme-success)!important}
.btn.btn-outline-success:hover{background:var(--theme-success)!important;color:var(--theme-on-success)!important}
.btn.btn-outline-info{background:transparent!important;border-color:var(--theme-info)!important;color:var(--theme-info)!important}
.btn.btn-outline-info:hover{background:var(--theme-info)!important;color:var(--theme-on-info)!important}
.btn.btn-outline-warning{background:transparent!important;border-color:var(--theme-warning)!important;color:var(--theme-on-warning)!important}
.btn.btn-outline-warning:hover{background:var(--theme-warning)!important;color:var(--theme-on-warning)!important}
.btn.btn-outline-danger{background:transparent!important;border-color:var(--theme-danger)!important;color:var(--theme-danger)!important}
.btn.btn-outline-danger:hover{background:var(--theme-danger)!important;color:var(--theme-on-danger)!important}
.btn.btn-color-4:disabled,.btn.btn-color-4.disabled,.btn.btn-color-gray:disabled,.btn.btn-color-gray.disabled{background:var(--theme-disabled)!important;border-color:var(--theme-disabled)!important;color:var(--theme-on-primary)!important;opacity:.72}
.btn.btn-outline-secondary{background:var(--theme-surface)!important;border-color:var(--theme-border)!important;color:var(--theme-on-cancel)!important}
.btn.btn-outline-secondary:hover{background:var(--theme-cancel-hover)!important;border-color:var(--theme-border)!important;color:var(--theme-on-cancel)!important}


/* Universal inline field validation. Do not apply to notifications or warnings.
   .error is set/removed by validarFormulario; aria-invalid is used by auth.
   Keep these rules after the normal and focused field styles. */
:root body :is(.form-control,.form-select,input,select,textarea):is(.error,.is-invalid,[aria-invalid="true"]),
:root body .input-group:has(:is(input,select,textarea):is(.error,.is-invalid,[aria-invalid="true"])) .input-group-text,
:root body select:is(.error,.is-invalid,[aria-invalid="true"]) + .select2 .select2-selection,
:root body :is(input,select).error + .flatpickr-input,
:root body #mfa_code:has(~ :is(#mfaLoginError,#mfa-code-error):not(:empty):not([hidden]):not([style*="display:none"]):not([style*="display: none"])) {
  border-color: var(--theme-field-error) !important;
  transition: none !important;
}
:root body :is(.form-control,.form-select,input,select,textarea):is(.error,.is-invalid,[aria-invalid="true"]):focus,
:root body #mfa_code:has(~ :is(#mfaLoginError,#mfa-code-error):not(:empty):not([hidden]):not([style*="display:none"]):not([style*="display: none"])):focus {
  box-shadow: 0 0 0 .2rem var(--theme-field-error-focus) !important;
}
:root body :is(.error-message,.invalid-feedback,.campo-error,#email-not-found-error,#password-error,#recovery-email-error,#mfaLoginError,#mfa-code-error):not(.text-warning) {
  color: var(--theme-field-error) !important;
  text-align: start !important;
  font-weight: 400 !important;
}
/* A decorative circular exclamation mark; empty or hidden messages stay empty.
   A CSS mask keeps the icon red even when the surrounding background changes. */
:root body :is(.error-message,.invalid-feedback,.campo-error,#email-not-found-error,#password-error,#recovery-email-error,#mfaLoginError,#mfa-code-error):not(.text-warning):not(:empty)::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-end: .45em;
  vertical-align: -.12em;
  background-color: var(--theme-field-error);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2zm0-4h-2V7h2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2zm0-4h-2V7h2z'/%3E%3C/svg%3E") center / contain no-repeat;
}


/* Error status labels and notices throughout the Core (including Failed).
   Separate from destructive action buttons and from success/neutral states. */
:root body :is(.badge.bg-danger-subtle,.badge.bg-danger,.badge.text-bg-danger,.badge-soft-danger,.badge.badge-danger,.alert-danger) {
  background-color: var(--theme-error-soft) !important;
  color: var(--theme-on-error-soft) !important;
  border-color: var(--theme-error-soft) !important;
}
:root body :is(.badge.bg-danger-subtle,.badge.bg-danger,.badge.text-bg-danger,.badge-soft-danger,.badge.badge-danger,.alert-danger) :is(.text-danger,.alert-link) {
  color: var(--theme-on-error-soft) !important;
}


/* Neutral status labels: Closed, in tables and detail dialogs. */
:root body :is(.badge.bg-secondary-subtle,.badge-soft-secondary) {
  background-color: var(--theme-neutral-soft) !important;
  color: var(--theme-on-neutral-soft) !important;
  border-color: var(--theme-neutral-soft) !important;
}
:root body :is(.badge.bg-secondary-subtle,.badge-soft-secondary) :is(.text-muted,.text-secondary) {
  color: var(--theme-on-neutral-soft) !important;
}

/* Module permission counts: maintain contrast inside accordion headers. */
.accordion-button .badge {
  background-color: var(--theme-primary) !important;
  color: var(--theme-on-primary) !important;
  border-color: var(--theme-primary) !important;
}

/* Expired session labels: warm pastel background with readable amber text. */
:root body :is(.badge-session-expired,.badge-soft-expired) {
  background-color: var(--theme-expired-soft) !important;
  color: var(--theme-on-expired-soft) !important;
  border-color: var(--theme-expired-soft) !important;
}

/* Delete confirmation popup: pastel red, outlined red on hover. */
:root body .swal2-actions .swal-delete-confirm {
  background-color: var(--theme-delete-bg) !important;
  border: 1px solid var(--theme-delete-border) !important;
  color: var(--theme-delete-text) !important;
  box-shadow: none !important;
}
:root body .swal2-actions .swal-delete-confirm:hover,
:root body .swal2-actions .swal-delete-confirm:focus-visible {
  background-color: var(--theme-delete-hover-bg) !important;
  border-color: var(--theme-delete-hover-border) !important;
  color: var(--theme-delete-hover-text) !important;
  box-shadow: none !important;
}

/* Active status labels: green pastel across tables and detail views. */
:root body :is(
  .badge.bg-success,
  .badge.text-bg-success,
  .badge.bg-success-subtle,
  .badge.badge-soft-success,
  .badge-soft-success,
  .badge-active,
  .badge.bg-info-subtle.text-info
) {
  background-color: var(--theme-active-soft) !important;
  color: var(--theme-on-active-soft) !important;
  border-color: var(--theme-active-soft) !important;
}
:root body :is(
  .badge.bg-success,
  .badge.text-bg-success,
  .badge.bg-success-subtle,
  .badge.badge-soft-success,
  .badge-soft-success,
  .badge-active,
  .badge.bg-info-subtle.text-info
) :is(.text-success,.text-info) {
  color: var(--theme-on-active-soft) !important;
}

/* Popup and modal cancel buttons: pale brand blue with clear contrast against delete. */
:root body :is(
  .swal2-actions .swal2-cancel,
  .swal2-actions .swal-cancel-neutral,
  .modal .btn-cancel,
  .modal .btn-light[data-bs-dismiss="modal"],
  .modal .btn-secondary[data-bs-dismiss="modal"]
) {
  background-color: var(--theme-popup-cancel-bg) !important;
  border: 1px solid var(--theme-popup-cancel-border) !important;
  color: var(--theme-popup-cancel-text) !important;
  box-shadow: none !important;
}
:root body :is(
  .swal2-actions .swal2-cancel,
  .swal2-actions .swal-cancel-neutral,
  .modal .btn-cancel,
  .modal .btn-light[data-bs-dismiss="modal"],
  .modal .btn-secondary[data-bs-dismiss="modal"]
):hover,
:root body :is(
  .swal2-actions .swal2-cancel,
  .swal2-actions .swal-cancel-neutral,
  .modal .btn-cancel,
  .modal .btn-light[data-bs-dismiss="modal"],
  .modal .btn-secondary[data-bs-dismiss="modal"]
):focus-visible {
  background-color: var(--theme-popup-cancel-hover-bg) !important;
  border-color: var(--theme-popup-cancel-hover-border) !important;
  color: var(--theme-popup-cancel-hover-text) !important;
  box-shadow: none !important;
}


/* Universal, table-scoped loading state. The indicator is attached to the
   Bootstrap Table overlay itself so it remains visible across all table templates. */
.bootstrap-table .fixed-table-container .fixed-table-body {
  position: relative;
  isolation: isolate;
  /* Let the outer .table-responsive own horizontal scrolling and the page
     own vertical scrolling; Bootstrap Table's default 100% body creates a
     second, clipped scroll area. */
  height: auto !important;
  overflow: visible !important;
}
.bootstrap-table .fixed-table-container .fixed-table-body:has(.fixed-table-loading.open) {
  min-height: 132px;
}
.bootstrap-table,
.bootstrap-table .fixed-table-container,
.bootstrap-table .fixed-table-container .fixed-table-body {
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}
.bootstrap-table .fixed-table-container .fixed-table-body {
  overflow-x: visible !important;
}
/* The responsive wrapper is the only horizontal scroll owner. Keep its height
   natural so rows flow vertically and it never creates a nested y scrollbar. */
.table-responsive {
  height: auto !important;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading {
  inset: 0;
  width: auto;
  max-width: none;
  box-sizing: border-box;
  min-height: 132px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: var(--theme-table-loading-overlay);
  color: var(--theme-table-loading-text);
  padding: 1rem;
}
.bootstrap-table .fixed-table-container .fixed-table-body:has(.fixed-table-loading.open) .no-records-found {
  visibility: hidden;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open::before,
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open::after {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  content: "";
  pointer-events: none;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open::before {
  right: 0;
  background: var(--theme-table-loading-track);
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open::after {
  width: 32%;
  background: var(--theme-table-loading-indicator);
  animation: aegis-table-loading-sweep 1.35s ease-in-out infinite;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  color: var(--theme-table-loading-text);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text {
  margin: 0;
}
.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap {
  display: none;
}
@keyframes aegis-table-loading-sweep {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(210%); }
}
@media (prefers-reduced-motion: reduce) {
  .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open::after {
    left: 34%;
    width: 32%;
    animation: none;
  }
}


/* Universal page-size dropdown contrast for every Bootstrap Table instance. */
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item) {
  background-color: var(--theme-surface);
  color: var(--theme-text);
  border-inline-start: 3px solid transparent;
}
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item):hover,
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item):focus-visible,
:root body .bootstrap-table .page-list .dropdown-menu :is(li.active, li.selected) > a,
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item).active,
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item)[aria-selected="true"] {
  background-color: var(--theme-table-option-hover-bg);
  color: var(--theme-table-option-hover-text);
  border-inline-start-color: var(--theme-table-option-selected-border);
}
:root body .bootstrap-table .page-list .dropdown-menu :is(a, button, .dropdown-item):focus-visible {
  outline: 2px solid var(--theme-primary);
  outline-offset: -2px;
}


/* Keep the current page-size value readable at rest and during interaction. */
:root body .bootstrap-table .page-list > .btn,
:root body .bootstrap-table .page-list > .dropdown-toggle,
:root body .bootstrap-table .pagination-detail .page-list .btn {
  background-color: var(--theme-table-page-size-bg) !important;
  border-color: var(--theme-table-page-size-border) !important;
  color: var(--theme-table-page-size-text) !important;
  box-shadow: none !important;
}
:root body .bootstrap-table .page-list > .btn:hover,
:root body .bootstrap-table .page-list > .btn:focus-visible,
:root body .bootstrap-table .page-list > .dropdown-toggle:hover,
:root body .bootstrap-table .page-list > .dropdown-toggle:focus-visible,
:root body .bootstrap-table .pagination-detail .page-list .btn:hover,
:root body .bootstrap-table .pagination-detail .page-list .btn:focus-visible {
  background-color: var(--theme-table-page-size-hover-bg) !important;
  border-color: var(--theme-table-page-size-hover-border) !important;
  color: var(--theme-table-page-size-hover-text) !important;
  box-shadow: none !important;
}
