/* Shared appearance for every system page; brand fills retain their official colors. */
.hrms-theme-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .65rem 1rem; white-space: nowrap; font-weight: 700;
    background: #002A30; color: #FFFFFF; border: 1px solid #A48954;
}
.hrms-theme-toggle:hover, .hrms-theme-toggle:focus-visible {
    background: #136044; color: #FFFFFF; border-color: #A48954;
}
.hrms-theme-toggle:focus-visible { outline: 3px solid #A48954; outline-offset: 3px; }
.hrms-public-theme { position: absolute; inset-block-start: 1rem; inset-inline-end: 1rem; z-index: 1040; }
@media (max-width: 575px) {
    .hrms-navbar .hrms-theme-toggle { padding: .65rem; }
    .hrms-navbar .hrms-theme-toggle span { display: none; }
    .hrms-public-theme { position: relative; inset: auto; display: flex; justify-content: flex-end; padding: .75rem; background: var(--hrms-bg-light); }
}
html[data-bs-theme="dark"] {
    color-scheme: dark;
    --hrms-bg-light: #0D1C1E;
    --hrms-card-bg: #002A30;
    --hrms-text-dark: #E8F5F0;
    --hrms-text-muted: #BED8EE;
    --hrms-border: #5A6E71;
    --hrms-green-light: #0D1C1E;
    --hrms-blue-light: #002A30;
    --hrms-blue-border: #5A6E71;
    --hrms-accent-gold-light: #0D1C1E;
    --hrms-accent-gold-border: #A48954;
    --bs-body-bg: var(--hrms-bg-light);
    --bs-body-color: var(--hrms-text-dark);
    --bs-secondary-color: var(--hrms-text-muted);
    --bs-border-color: var(--hrms-border);
    --bs-tertiary-bg: var(--hrms-card-bg);
    --bs-emphasis-color: var(--hrms-text-dark);
    --bs-link-color: #BED8EE;
    --bs-link-hover-color: #E8F5F0;
}
html[data-bs-theme="dark"] body { background-color: var(--hrms-bg-light) !important; color: var(--hrms-text-dark); }
html[data-bs-theme="dark"] :is(.card, .card-header, .card-footer, .hrms-card, .hrms-card-header,
    .hrms-sidebar, .royal-form-panel, .royal-split-container, .dropdown-menu, .modal-content,
    .list-group-item, .accordion-item, .accordion-button, .offcanvas, .toast, .bg-white) {
    background-color: var(--hrms-card-bg) !important;
    color: var(--hrms-text-dark);
    border-color: var(--hrms-border) !important;
}
html[data-bs-theme="dark"] :is(.bg-light, .table-light, .input-group-text, .form-control,
    .form-select, .hrms-input, .search-input, .btn-light) {
    background-color: var(--hrms-bg-light) !important;
    color: var(--hrms-text-dark) !important;
    border-color: var(--hrms-border) !important;
}
html[data-bs-theme="dark"] :is(.form-control, .hrms-input, .search-input)::placeholder { color: var(--hrms-text-muted); opacity: .85; }
html[data-bs-theme="dark"] :is(.form-control, .form-select, .hrms-input):focus {
    border-color: #A48954 !important; box-shadow: 0 0 0 .2rem rgba(164,137,84,.25);
}
html[data-bs-theme="dark"] :is(.form-control:disabled, .form-control[readonly], .form-select:disabled) { opacity: .7; }
html[data-bs-theme="dark"] .form-select option { background: var(--hrms-card-bg); color: var(--hrms-text-dark); }
html[data-bs-theme="dark"] :is(.text-dark, .text-navy, .text-primary, .text-emerald, .text-success,
    .text-info, .text-blue, .text-secondary, .text-black, .link-dark, .hrms-input-label,
    .form-header-title, .navigation-section summary, .security-management .page-header h4,
    .hrms-next-step h2, .hrms-card-title, .hrms-card-header h5, .hrms-card-header h6,
    .text-navy-blue, .text-info-emphasis, .text-blue-emphasis, .text-warning-emphasis,
    .text-success-emphasis, .text-primary-emphasis) { color: #E8F5F0 !important; }
html[data-bs-theme="dark"] :is(.text-muted, .breadcrumb-item, .breadcrumb-item.active, .form-text) { color: var(--hrms-text-muted) !important; }
html[data-bs-theme="dark"] :is(.text-gold, .text-warning) { color: #A48954 !important; }
html[data-bs-theme="dark"] :is(.btn-outline-primary, .btn-outline-success, .btn-outline-secondary, .btn-outline-info) { color: #E8F5F0 !important; border-color: #5A6E71 !important; }
html[data-bs-theme="dark"] :is(.dropdown-item, .hrms-nav-link, .page-link) { color: var(--hrms-text-dark); }
html[data-bs-theme="dark"] :is(.dropdown-item:hover, .dropdown-item:focus, .page-link, .nav-tabs .nav-link.active) { background: var(--hrms-bg-light); }
html[data-bs-theme="dark"] .page-item.active .page-link { background: #197A56; border-color: #197A56; color: #FFFFFF; }
html[data-bs-theme="dark"] :is(.bg-success-subtle, .bg-info-subtle, .bg-primary-subtle, .bg-blue-subtle,
    .badge-hrms-blue, .badge-hrms-navy, .badge-hrms-emerald, .hrms-card-blue, .modal-header-blue,
    .bg-warning-subtle, .bg-gold-subtle, .badge-hrms-gold, .btn-tab-teacher, .btn-tab-school, .btn-tab-dept) {
    background: var(--hrms-bg-light) !important; color: #E8F5F0 !important; border-color: var(--hrms-border) !important;
}
html[data-bs-theme="dark"] :is(.badge.bg-primary, .badge.bg-info, .badge.bg-success,
    .badge-hrms-blue i, .badge-hrms-navy i, .badge-hrms-emerald i, .modal-header-blue .modal-title, .modal-header-blue i) {
    color: #E8F5F0 !important; background-color: var(--hrms-card-bg) !important;
}
html[data-bs-theme="dark"] :is(.alert-info, .alert-primary, .alert-success, .alert-warning) {
    background: var(--hrms-card-bg) !important; color: #E8F5F0 !important; border-color: var(--hrms-border) !important;
}
html[data-bs-theme="dark"] .table .badge:is(.bg-info, .bg-primary, .bg-success, .bg-light, .badge-hrms-blue) {
    background: var(--hrms-bg-light) !important; color: #E8F5F0 !important; border-color: var(--hrms-border) !important;
}
html[data-bs-theme="dark"] .nav-pills .nav-link:not(.active) { background: var(--hrms-card-bg) !important; color: var(--hrms-text-muted) !important; }
html[data-bs-theme="dark"] .hrms-nav-link:hover { color: #E8F5F0; }
html[data-bs-theme="dark"] .hrms-nav-link i { color: #BED8EE; }
html[data-bs-theme="dark"] .permission-switch .btn[data-access="deny"][aria-pressed="true"] { color: #0D1C1E; }
html[data-bs-theme="dark"] .table {
    --bs-table-bg: var(--hrms-card-bg); --bs-table-color: var(--hrms-text-dark);
    --bs-table-border-color: var(--hrms-border); --bs-table-striped-bg: rgba(190,216,238,.05);
    --bs-table-striped-color: var(--hrms-text-dark); --bs-table-hover-bg: rgba(164,137,84,.12);
    --bs-table-hover-color: var(--hrms-text-dark); --bs-table-active-bg: rgba(164,137,84,.18);
    --bs-table-active-color: var(--hrms-text-dark); color: var(--hrms-text-dark);
}
html[data-bs-theme="dark"] .table:not(.table-dark) :is(th, td) { background-color: var(--hrms-card-bg); color: var(--hrms-text-dark); border-color: var(--hrms-border); }
html[data-bs-theme="dark"] .table:not(.table-dark) :is(thead, tbody) > tr > th,
html[data-bs-theme="dark"] .table thead.bg-white th { background-color: var(--hrms-card-bg) !important; color: var(--hrms-text-dark) !important; }
/* Legacy inline light surfaces also appear in schedules, status cards and statistics. */
html[data-bs-theme="dark"] :is([style*="background" i][style*="#fff" i],
    [style*="background" i][style*="#f8" i], [style*="background" i][style*="#f4" i],
    [style*="background" i][style*="#ebf3fa" i], [style*="background" i][style*="#e8f5f0" i]) {
    background-color: var(--hrms-card-bg) !important;
}
html[data-bs-theme="dark"] :is([style*="color: #002a30" i], [style*="color:#002a30" i],
    [style*="color: #034e7b" i], [style*="color: #0d1c1e" i], [style*="color: var(--hrms-primary"],
    [style*="color: var(--hrms-navy"]) { color: var(--hrms-text-dark) !important; }
html[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
html[data-bs-theme="dark"] .btn-close-white { filter: var(--bs-btn-close-white-filter); }
@media print { .hrms-theme-toggle, .hrms-public-theme { display: none !important; } }
