/* Light mode deliberately keeps the existing dashboard styles and colours. */
[data-rps-appearance-menu] { display: flex; flex-shrink: 0; align-items: center; justify-content: center; padding: 0 2px; }
.rps-appearance-trigger {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  padding: 0; border: 0; border-radius: 4px; font: inherit; color: inherit; background: transparent; cursor: pointer;
}
.rps-appearance-icon { display: block; flex: none; width: 1em; height: 1em; fill: currentColor; }
.rps-appearance-trigger:focus-visible,
.rps-appearance-options button:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
/* The top layer keeps the menu outside the shared header's paint containment. */
.rps-appearance-options {
  position: fixed; inset: auto; box-sizing: border-box; min-width: 11rem; max-width: calc(100vw - 8px);
  margin: 0; padding: 4px; border: 1px solid var(--rps-border, #e1e6ec); border-radius: 8px;
  font: inherit; color: var(--rps-text, #243247); background: var(--rps-surface, #fff); box-shadow: 0 8px 24px #00000024;
}
.rps-appearance-options button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 0; border-radius: 6px; font: inherit; color: inherit; text-align: start;
  background: transparent; cursor: pointer; white-space: nowrap;
}
.rps-appearance-options button:hover,
.rps-appearance-options button[aria-pressed="true"] { background: var(--rps-raised, #f0f4f8); }
.rps-appearance-options button[aria-pressed="true"] { font-weight: 600; }
@media print { [data-rps-appearance-menu] { display: none !important; } }

.rps-appearance-select {
  max-width: 9rem;
  margin: 0 .5rem;
  padding: .2rem;
  font: inherit;
  font-size: .875rem;
  color: inherit;
  background: transparent;
  border: 1px solid #ced4da;
  border-radius: .2rem;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --date-picker-foreground: #e3e8ef;
  --date-picker-background: #252c35;
  --date-picker-highlight-border: #8abbff;
  --date-picker-selected-background: #354458;
  --date-picker-selected-color: #e3e8ef;
  --date-picker-today-border: #b2bcc9;
  --rps-bg: #1b2027;
  --rps-surface: #252c35;
  --rps-raised: #303945;
  --rps-text: #e3e8ef;
  --rps-muted: #b2bcc9;
  --rps-border: #536071;
  --rps-primary: #8abbff;
  --rps-hover: #354458;
  --rps-danger: #ffabb5;
  --rps-success: #8bd5ab;
  --rps-warning: #f3cd86;
  --rps-error-bg: #442b33;
  --rps-success-bg: #243e33;
  --rps-warning-bg: #413724;
  background: var(--rps-bg);
  color: var(--rps-text);
}
html[data-theme="dark"] body { background: var(--rps-bg); color: var(--rps-text); }
html[data-theme="dark"] .rps-appearance-select { border-color: var(--rps-border); background: var(--rps-surface); }
/* AdminLTE 3.0 pages. Scope every override to dark mode. */
html[data-theme="dark"] :is(.content-wrapper, .wrapper, .login-page, .register-page, .error-wrapper) { background: var(--rps-bg); color: var(--rps-text); }
html[data-theme="dark"] :is(.main-header, .main-footer, .card, .modal-content, .dropdown-menu, .list-group-item, .login-box-body, .register-box-body, .info-box, .popover, .toast) {
  background-color: var(--rps-surface); color: var(--rps-text); border-color: var(--rps-border);
}
html[data-theme="dark"] :is(.card-header, .card-footer, .modal-header, .modal-footer, .dropdown-divider, .list-group-item, hr) { border-color: var(--rps-border); }
html[data-theme="dark"] :is(.breadcrumb, .input-group-text, .card-footer, .popover-header) { background-color: var(--rps-raised); color: var(--rps-text); }
html[data-theme="dark"] :is(.navbar-light .navbar-nav .nav-link, .dropdown-item, .close, .btn-tool, .editor-workspace-back) { color: var(--rps-text); }
html[data-theme="dark"] :is(.dropdown-item:hover, .dropdown-item:focus, .list-group-item-action:hover, .nav-tabs .nav-link.active) { background-color: var(--rps-hover); color: var(--rps-text); }
html[data-theme="dark"] a:not(.btn):not(.badge):not(.nav-link):not(.dropdown-item) { color: var(--rps-primary); }
html[data-theme="dark"] :is(.form-control, .custom-select, .custom-file-label, .select2-selection, .select2-dropdown, .multiselect-container, .page-link) { background-color: var(--rps-surface); color: var(--rps-text); border-color: var(--rps-border); }
html[data-theme="dark"] :is(.form-control:disabled, .form-control[readonly], .input-group-text) { background-color: var(--rps-raised); color: var(--rps-muted); }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--rps-muted); opacity: 1; }
html[data-theme="dark"] :is(.form-control:focus, .custom-select:focus) { border-color: var(--rps-primary); }
html[data-theme="dark"] :is(.btn-default, .btn-light, .btn-outline-secondary) { background: var(--rps-raised); color: var(--rps-text); border-color: var(--rps-border); }
html[data-theme="dark"] :is(.btn-default:hover, .btn-light:hover, .btn-outline-secondary:hover) { background: var(--rps-hover); }
html[data-theme="dark"] .table { color: var(--rps-text); }
html[data-theme="dark"] :is(.table td, .table th, .table thead th, .table-bordered) { border-color: var(--rps-border); }
html[data-theme="dark"] :is(.table .thead-light th, .table-active, .table-active > td, .table-active > th) { background: var(--rps-raised); color: var(--rps-text); }
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: #ffffff06; }
html[data-theme="dark"] .table-hover tbody tr:hover { background: var(--rps-hover); color: var(--rps-text); }
html[data-theme="dark"] :is(.text-muted, .text-secondary, .description-text) { color: var(--rps-muted) !important; }
html[data-theme="dark"] :is(.text-dark, .text-body, .text-black-50) { color: var(--rps-text) !important; }
html[data-theme="dark"] :is(.bg-white, .bg-light) { background-color: var(--rps-surface) !important; color: var(--rps-text) !important; }
html[data-theme="dark"] .text-primary { color: var(--rps-primary) !important; }
html[data-theme="dark"] :is(.text-danger, .invalid-feedback) { color: var(--rps-danger) !important; }
html[data-theme="dark"] .text-success { color: var(--rps-success) !important; }
html[data-theme="dark"] .alert-danger { background: var(--rps-error-bg); color: var(--rps-danger); border-color: var(--rps-danger); }
html[data-theme="dark"] .alert-success { background: var(--rps-success-bg); color: var(--rps-success); border-color: var(--rps-success); }
html[data-theme="dark"] .alert-warning { background: var(--rps-warning-bg); color: var(--rps-warning); border-color: var(--rps-warning); }
html[data-theme="dark"] .alert-info { background: #24384d; color: #b7d6ff; border-color: #7199c7; }
html[data-theme="dark"] [class*="job-status-"] { background: var(--rps-surface); }
html[data-theme="dark"] .job-status-queued { color: var(--rps-muted); border-color: currentColor; }
html[data-theme="dark"] .job-status-running { color: var(--rps-primary); border-color: currentColor; }
html[data-theme="dark"] .job-status-success { color: var(--rps-success); border-color: currentColor; }
html[data-theme="dark"] .job-status-failure { color: var(--rps-danger); border-color: currentColor; }
html[data-theme="dark"] .job-status-unavailable { color: var(--rps-warning); border-color: currentColor; }
html[data-theme="dark"] :is(pre, code) { color: var(--rps-text); }
html[data-theme="dark"] :is(.daterangepicker, .daterangepicker .calendar-table, .bootstrap-datetimepicker-widget.dropdown-menu, .note-editor .note-editing-area .note-editable, .ui-widget-content) { background: var(--rps-surface); color: var(--rps-text); border-color: var(--rps-border); }
html[data-theme="dark"] :is(.daterangepicker td.off, .daterangepicker td.off.in-range) { background: var(--rps-bg); color: var(--rps-muted); }
html[data-theme="dark"] :is(.daterangepicker td.available:hover, .daterangepicker th.available:hover, .daterangepicker td.in-range) { background: var(--rps-hover); color: var(--rps-text); }
html[data-theme="dark"] .daterangepicker .calendar-table :is(.prev span, .next span) { border-color: var(--rps-text); }
html[data-theme="dark"] .page-item.disabled .page-link { background: var(--rps-bg); border-color: var(--rps-border); color: var(--rps-muted); }
html[data-theme="dark"] .page-item.active .page-link { background: #245da8; color: #fff; }
/* Search highlights contain dark text even when embedded in a dark row. */
html[data-theme="dark"] :is([style*="background-color:yellow"], [style*="background: LightSkyBlue"]) { color: #20252b; }

html[data-theme="dark"] :is(.border, .border-top, .border-bottom, .border-left, .border-right) { border-color: var(--rps-border) !important; }
