/* SSMS AL-BAHRI — Theme Switcher & Unified Light / Dark / System Design System */

:root {
    --theme-surface: #ffffff;
    --theme-surface-subtle: #f6f9fe;
    --theme-surface-elevated: #eff5ff;
    --theme-border: #cbd7eb;
    --theme-text: #0f172a;
    --theme-muted: #475569;
    --theme-accent: #2563eb;
    --theme-accent-hover: #1d4ed8;
    --theme-accent-soft: #eaf2ff;
    --theme-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}

/* Smooth, bounded color transition triggered only on interactive theme changes. */
html.theme-transition body,
html.theme-transition .topbar,
html.theme-transition .sidebar,
html.theme-transition .mobile-bottom-nav,
html.theme-transition .panel,
html.theme-transition .summary-card,
html.theme-transition .login-card,
html.theme-transition .kiosk,
html.theme-transition .notice,
html.theme-transition .preview-notice,
html.theme-transition input,
html.theme-transition select,
html.theme-transition textarea,
html.theme-transition button,
html.theme-transition a {
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease !important;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-transition body,
    html.theme-transition .topbar,
    html.theme-transition .sidebar,
    html.theme-transition .mobile-bottom-nav,
    html.theme-transition .panel,
    html.theme-transition .summary-card,
    html.theme-transition .login-card,
    html.theme-transition .kiosk,
    html.theme-transition .notice,
    html.theme-transition .preview-notice,
    html.theme-transition input,
    html.theme-transition select,
    html.theme-transition textarea,
    html.theme-transition button,
    html.theme-transition a {
        transition: none !important;
    }
}

/* ==========================================================================
   1. Theme Switcher Component (Compact Topbar Pill + Mobile Popover + Labeled)
   ========================================================================== */

.topbar-utilities {
    order: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-utilities > .language-switch {
    order: 0;
}

.theme-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.theme-switch--compact .theme-switch-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid #cbd7eb;
    border-radius: 999px;
    background: #f6f9fe;
}

.theme-switch--compact .theme-switch-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch--compact .theme-switch-option .icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.theme-switch--compact .theme-switch-label {
    display: none;
}

.theme-switch--compact .theme-switch-option:hover {
    background: #e5effe;
    color: #1d4ed8;
}

.theme-switch--compact .theme-switch-option.is-active,
.theme-switch--compact .theme-switch-option[aria-pressed="true"] {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.theme-switch--compact .theme-switch-option:focus-visible,
.theme-switch-trigger:focus-visible,
.theme-switch--labeled .theme-switch-option:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.theme-switch-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #cbd7eb;
    border-radius: 999px;
    background: #f6f9fe;
    color: #1d4ed8;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch-trigger:hover {
    background: #eaf2ff;
    border-color: #93b4f5;
}

.theme-switch-trigger .icon {
    width: 18px;
    height: 18px;
}

.theme-trigger-icon {
    display: none;
    align-items: center;
    justify-content: center;
}

.theme-switch-trigger[data-theme-active="light"] .theme-trigger-icon[data-theme-icon="light"],
.theme-switch-trigger[data-theme-active="dark"] .theme-trigger-icon[data-theme-icon="dark"],
.theme-switch-trigger[data-theme-active="system"] .theme-trigger-icon[data-theme-icon="system"],
.theme-switch-trigger:not([data-theme-active]) .theme-trigger-icon[data-theme-icon="system"] {
    display: inline-flex;
}

/* Labeled 3-option segmented switcher (optional standalone usage). */
.theme-switch--labeled {
    display: block;
    width: 100%;
}

.theme-switch--labeled .theme-switch-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid #cbd7eb;
    border-radius: 12px;
    background: #eef4ff;
}

.theme-switch--labeled .theme-switch-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 40px;
    padding: 8px 6px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #475569;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch--labeled .theme-switch-option .icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.theme-switch--labeled .theme-switch-option:hover {
    background: rgba(255, 255, 255, 0.72);
    color: #0f172a;
}

.theme-switch--labeled .theme-switch-option.is-active,
.theme-switch--labeled .theme-switch-option[aria-pressed="true"] {
    background: #ffffff;
    color: #1d4ed8;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Touch sizing on tablets & mobile. */
@media (max-width: 1000px) {
    .theme-switch--compact .theme-switch-group {
        height: 40px;
        padding: 3px;
    }

    .theme-switch--compact .theme-switch-option {
        width: 34px;
        height: 32px;
    }

    .theme-switch--labeled .theme-switch-option {
        min-height: 44px;
    }
}

/* Narrow smartphone topbar: switch to compact active-icon trigger + clean popover menu. */
@media (max-width: 600px) {
    .topbar-utilities {
        gap: 6px;
    }

    .theme-switch--compact:not(.theme-switch--always-inline) .theme-switch-trigger {
        display: inline-flex;
        width: 38px;
        height: 38px;
    }

    .theme-switch--compact:not(.theme-switch--always-inline) .theme-switch-group {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 40;
        flex-direction: column;
        align-items: stretch;
        height: auto;
        min-width: 158px;
        padding: 6px;
        gap: 4px;
        border-radius: 14px;
        border: 1px solid #cbd7eb;
        background: #ffffff;
        box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
    }

    .theme-switch--compact:not(.theme-switch--always-inline).is-open .theme-switch-group {
        display: flex;
    }

    .theme-switch--compact:not(.theme-switch--always-inline) .theme-switch-option {
        width: 100%;
        height: auto;
        min-height: 44px;
        justify-content: flex-start;
        padding: 8px 12px;
        border-radius: 10px;
        font-size: 13px;
    }

    .theme-switch--compact:not(.theme-switch--always-inline) .theme-switch-label {
        display: inline;
    }

    .theme-switch--always-inline .theme-switch-group {
        height: 36px;
    }

    .theme-switch--always-inline .theme-switch-option {
        width: 32px;
        height: 28px;
    }
}

.ppdb-actions > .theme-switch {
    flex: 0 0 auto;
    width: max-content;
}

/* ==========================================================================
   2. Dark Mode Design System (html[data-theme="dark"])
   ========================================================================== */

html[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #0b1220;
    --white: #111b2e;
    --surface: #111b2e;
    --surface-subtle: #162238;
    --surface-hover: #1c2c47;
    --ink: #edf3fc;
    --muted: #9eb1cc;
    --line: #24344f;
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --soft: #172a4a;
    --text: #edf3fc;
    --text-muted: #9eb1cc;
    --border: #24344f;
    --ui-text: #edf3fc;
    --ui-supporting: #9eb1cc;
    --ui-border: #24344f;
    --ui-field-border: #354b6e;
    --ui-action: #60a5fa;
    --ui-error: #f87171;
    --report-brand: #3b82f6;
    --report-soft: #172a4a;
    --report-surface: #162238;
    --report-border: #24344f;
    --report-ink: #edf3fc;
    --report-muted: #9eb1cc;
    --excel-brand: #3b82f6;
    --excel-soft: #172640;
    --excel-border: #263957;
    --excel-ink: #edf3fc;
    --excel-muted: #9eb1cc;
}

html[data-theme="dark"] body {
    background-color: var(--canvas);
    color: var(--ink);
}

html[data-theme="dark"] .dashboard-page {
    background: var(--canvas);
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .input-help,
html[data-theme="dark"] .recap-footnote,
html[data-theme="dark"] .recap-student-nis,
html[data-theme="dark"] .table-sort-caption,
html[data-theme="dark"] .student-dashboard-intro,
html[data-theme="dark"] .server-environment-panel > p,
html[data-theme="dark"] .eskul-report-metrics dt,
html[data-theme="dark"] .eskul-report-details dt {
    color: var(--muted);
}

html[data-theme="dark"] .skip-link {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--primary);
}

/* --- Theme Switcher & Language Switch in Dark Mode --- */
html[data-theme="dark"] .theme-switch--compact .theme-switch-group,
html[data-theme="dark"] .theme-switch-trigger {
    border-color: #2c4060;
    background: #162238;
    color: #93c5fd;
}

html[data-theme="dark"] .theme-switch--compact .theme-switch-option {
    color: #9eb1cc;
}

html[data-theme="dark"] .theme-switch--compact .theme-switch-option:hover,
html[data-theme="dark"] .theme-switch-trigger:hover {
    background: #1f314f;
    color: #edf3fc;
}

html[data-theme="dark"] .theme-switch--compact .theme-switch-option.is-active,
html[data-theme="dark"] .theme-switch--compact .theme-switch-option[aria-pressed="true"] {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.36);
}

html[data-theme="dark"] .theme-switch--labeled .theme-switch-group {
    border-color: #293c5c;
    background: #0d1627;
}

html[data-theme="dark"] .theme-switch--labeled .theme-switch-option {
    color: #9eb1cc;
}

html[data-theme="dark"] .theme-switch--labeled .theme-switch-option:hover {
    background: #172640;
    color: #edf3fc;
}

html[data-theme="dark"] .theme-switch--labeled .theme-switch-option.is-active,
html[data-theme="dark"] .theme-switch--labeled .theme-switch-option[aria-pressed="true"] {
    background: #1d355e;
    color: #93c5fd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .language-switch {
    border-color: #3b82f6;
    background: #162238;
}

html[data-theme="dark"] .language-switch button {
    color: #93c5fd;
}

html[data-theme="dark"] .language-switch button:hover {
    background: #1f3354;
}

html[data-theme="dark"] .language-switch button.is-active {
    background: #3b82f6;
    color: #ffffff;
}

@media (max-width: 600px) {
    html[data-theme="dark"] .theme-switch--compact:not(.theme-switch--always-inline) .theme-switch-group {
        border-color: #2c4060;
        background: #111b2e;
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
    }
}

/* --- Navbar, Sidebar & Mobile Bottom Navigation --- */
html[data-theme="dark"] .topbar {
    background: #111b2e;
    border-bottom-color: #223350;
}

html[data-theme="dark"] .topbar-title,
html[data-theme="dark"] .breadcrumb-trail > a {
    color: #9eb1cc;
}

html[data-theme="dark"] .topbar-title strong,
html[data-theme="dark"] .breadcrumb-trail > a strong {
    color: #edf3fc;
}

html[data-theme="dark"] .breadcrumb-trail > a:hover,
html[data-theme="dark"] .breadcrumb-trail > a:focus-visible {
    background: #1a2a46;
    color: #93c5fd;
}

html[data-theme="dark"] .breadcrumb-trail > .breadcrumb-divider {
    color: #5c7394;
}

html[data-theme="dark"] .avatar {
    background: #172a4a;
    color: #60a5fa;
}

html[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0f182a 0%, #0b1323 100%);
    border-right-color: #1f304d;
}

html[data-theme="dark"] .sidebar .sidebar-brand {
    background: #142038;
    border-color: #253859;
    box-shadow: 0 2px 8px -2px rgba(2, 6, 23, .45);
}

html[data-theme="dark"] .sidebar .sidebar-brand-text strong,
html[data-theme="dark"] .sidebar-brand strong,
html[data-theme="dark"] .sidebar-note strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .sidebar .sidebar-brand-text small {
    color: #93c5fd;
}

html[data-theme="dark"] .sidebar .sidebar-brand .close-menu {
    background: #1e2d4a;
    border-color: #334a70;
    color: #e2e8f0;
}

html[data-theme="dark"] .nav-label,
html[data-theme="dark"] .sidebar-note,
html[data-theme="dark"] .sidebar-whatsapp-bar {
    color: #9eb1cc;
    border-top-color: #1f304d;
}

html[data-theme="dark"] .sidebar .sidebar-whatsapp-bar .sidebar-whatsapp-link {
    background: #132037;
    color: #cbd8ec;
}

html[data-theme="dark"] .sidebar .sidebar-whatsapp-bar .sidebar-whatsapp-link:hover {
    background: #1a2d4f;
    color: #ffffff;
}

html[data-theme="dark"] .sidebar .sidebar-whatsapp-bar .sidebar-whatsapp-link .icon {
    color: #4ade80;
}

html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .nav-group-heading {
    color: #cbd8ec;
}

html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .nav-group-heading:hover {
    background: #16233b;
    color: #ffffff;
}

html[data-theme="dark"] .nav-item.active {
    background: #1a2d4f;
    color: #93c5fd;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .nav-group.has-active > .nav-group-heading {
    color: #93c5fd;
}

html[data-theme="dark"] .nav-item.unavailable {
    color: #647a99;
}

html[data-theme="dark"] .sidebar-search-input {
    border-color: #2b3f61;
    background: #132037;
    color: #edf3fc;
}

html[data-theme="dark"] .sidebar-search-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

html[data-theme="dark"] .sidebar-search-clear {
    color: #9eb1cc;
}

html[data-theme="dark"] .sidebar-search-clear:hover {
    background: #1e3152;
    color: #93c5fd;
}

html[data-theme="dark"] .sidebar-search-empty {
    background: #132037;
    color: #9eb1cc;
}

html[data-theme="dark"] .sidebar-backdrop {
    background: rgba(2, 6, 15, 0.72);
}

html[data-theme="dark"] .exam-config-drawer,
html[data-theme="dark"] .exam-kpi-chip,
html[data-theme="dark"] .exam-filters {
    background: #111b2e;
    border-color: #24344f;
}

html[data-theme="dark"] .exam-config-drawer[open] .exam-config-summary,
html[data-theme="dark"] .exam-bulk-panel,
html[data-theme="dark"] .exam-verify-table th {
    background: #152238;
    border-color: #263a5c;
    color: #cbd8ec;
}

html[data-theme="dark"] .exam-kpi-chip.is-active {
    background: rgba(37, 99, 235, 0.18);
    border-color: #3b82f6;
}

html[data-theme="dark"] .exam-verify-table td {
    border-bottom-color: #1f304d;
}

html[data-theme="dark"] .exam-verify-row:hover td {
    background: #142035;
}

html[data-theme="dark"] .exam-inline-select,
html[data-theme="dark"] .exam-inline-date,
html[data-theme="dark"] .exam-inline-reason,
html[data-theme="dark"] .exam-filters input,
html[data-theme="dark"] .exam-filters select,
html[data-theme="dark"] .exam-bulk-form input,
html[data-theme="dark"] .exam-bulk-form select {
    background: #0f182a;
    border-color: #2b3f61;
    color: #edf3fc;
}

html[data-theme="dark"] .exam-preset-chip {
    background: #152238;
    border-color: #2b4470;
    color: #93c5fd;
}

html[data-theme="dark"] .exam-preset-chip:hover {
    background: #1d3257;
    border-color: #60a5fa;
}

html[data-theme="dark"] .bulk-counter-badge {
    background: #1e293b;
    color: #cbd8ec;
}

html[data-theme="dark"] .bulk-counter-badge.is-active {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme="dark"] .exam-pill.is-ok {
    background: rgba(22, 163, 74, 0.22);
    color: #86efac;
}

html[data-theme="dark"] .exam-pill.is-warn {
    background: rgba(217, 119, 6, 0.22);
    color: #fde68a;
}

html[data-theme="dark"] .exam-pill.is-muted {
    background: #1e293b;
    color: #9eb1cc;
}

html[data-theme="dark"] .mobile-bottom-nav {
    background: #0f182a;
    border-top-color: #223350;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .mobile-bottom-nav-item {
    color: #9eb1cc;
}

html[data-theme="dark"] .mobile-bottom-nav-item.is-active,
html[data-theme="dark"] .mobile-bottom-nav-item[aria-current="page"] {
    color: #93c5fd;
}

html[data-theme="dark"] .mobile-bottom-nav-item.is-active .mobile-bottom-nav-pill,
html[data-theme="dark"] .mobile-bottom-nav-item[aria-current="page"] .mobile-bottom-nav-pill {
    background: #1b3461;
    color: #93c5fd;
}

/* --- Cards, Panels, Dashboard Widgets & KPI Tiles --- */
html[data-theme="dark"] .panel,
html[data-theme="dark"] .dashboard-content form.list-filters,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .student-period-filter,
html[data-theme="dark"] .eskul-management-filters,
html[data-theme="dark"] .eskul-report-filters,
html[data-theme="dark"] .eskul-report-guide,
html[data-theme="dark"] .report-workspace .report-workspace-header,
html[data-theme="dark"] .report-workspace .panel,
html[data-theme="dark"] .report-workspace .report-hub-card,
html[data-theme="dark"] .report-workspace .report-workflow-steps li,
html[data-theme="dark"] .hubin .stats article,
html[data-theme="dark"] .school-rules-hero,
html[data-theme="dark"] .school-rules-summary article,
html[data-theme="dark"] .school-rules-categories,
html[data-theme="dark"] .excel-ended-card,
html[data-theme="dark"] .incoming-card {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .system-management-panel .summary-card,
html[data-theme="dark"] .metric-icon,
html[data-theme="dark"] .period-label,
html[data-theme="dark"] .attendance-metrics > div,
html[data-theme="dark"] .spp-metrics > div,
html[data-theme="dark"] .attendance-recap-kpi,
html[data-theme="dark"] .portal-split-metrics > div,
html[data-theme="dark"] .eskul-report-metrics > div,
html[data-theme="dark"] .eskul-management-counts > span,
html[data-theme="dark"] .teaching-period-list p,
html[data-theme="dark"] .teaching-period-item,
html[data-theme="dark"] .academic-import-form,
html[data-theme="dark"] .academic-table-actions,
html[data-theme="dark"] .bmw-card-meta div,
html[data-theme="dark"] .bmw-catalog-meta div,
html[data-theme="dark"] .bmw-detail-facts div,
html[data-theme="dark"] .bmw-card-link,
html[data-theme="dark"] .bmw-locked-value,
html[data-theme="dark"] .bmw-state-help,
html[data-theme="dark"] .hubin-student-status-help,
html[data-theme="dark"] .ppdb-flow-steps > li,
html[data-theme="dark"] .report-workspace .report-hub-pending,
html[data-theme="dark"] .report-workspace .report-grade-summary,
html[data-theme="dark"] .excel-save-bar,
html[data-theme="dark"] .excel-ended-panel,
html[data-theme="dark"] .school-rules-note,
html[data-theme="dark"] .school-uniform-row > span,
html[data-theme="dark"] .recap-meta-chip,
html[data-theme="dark"] .recap-mini-pill,
html[data-theme="dark"] .account-photo-preview,
html[data-theme="dark"] .student-review-notice .student-review-note {
    background: var(--surface-subtle);
    border-color: var(--line);
    color: var(--ink);
}

html[data-theme="dark"] .student-period-filter > summary {
    background: #162640;
    color: var(--ink);
}

html[data-theme="dark"] .student-filter-toggle {
    background: #111b2e;
    border-color: #2f4b78;
    color: #93c5fd;
}

html[data-theme="dark"] .dashboard-next-action[data-next-action="rejected"],
html[data-theme="dark"] .dashboard-next-action[data-next-action="period_unavailable"] {
    border-color: #6b4c14;
    background: #241b0b;
}

html[data-theme="dark"] .dashboard-next-action[data-next-action="placed"],
html[data-theme="dark"] .dashboard-next-action[data-next-action="approved"] {
    border-color: #1c5742;
    background: #0d241c;
}

html[data-theme="dark"] .school-rules-categories a {
    color: #9eb1cc;
}

html[data-theme="dark"] .school-rules-categories a[aria-current],
html[data-theme="dark"] .school-rule-number,
html[data-theme="dark"] .school-rules-tag {
    background: #172a4a;
    color: #93c5fd;
}

html[data-theme="dark"] .school-rules-categories small {
    background: #1a2942;
    color: #cbd8ec;
}

html[data-theme="dark"] .school-rules-source-note {
    background: #281f0e;
    border-left-color: #b45309;
    color: #fcd34d;
}

html[data-theme="dark"] .school-uniform-row,
html[data-theme="dark"] .school-rule-items li,
html[data-theme="dark"] .ppdb-document,
html[data-theme="dark"] .ppdb-period + .ppdb-period,
html[data-theme="dark"] .ppdb-flow-next,
html[data-theme="dark"] .quran-verse,
html[data-theme="dark"] .quran-reading-heading,
html[data-theme="dark"] .quran-surah-navigation {
    border-color: var(--line);
}

html[data-theme="dark"] .quran-verse:target,
html[data-theme="dark"] .quran-verse.is-selected {
    background: #162642;
    box-shadow: 0 0 0 12px #162642;
}

html[data-theme="dark"] .quran-verse-number {
    color: #fde68a;
    filter: brightness(1.15);
}

/* --- Tables, Excel Grids & Pagination --- */
html[data-theme="dark"] th,
html[data-theme="dark"] .student-review-list th,
html[data-theme="dark"] .teacher-list-panel th,
html[data-theme="dark"] .student-list-panel th,
html[data-theme="dark"] .family-list-panel th,
html[data-theme="dark"] .employee-list-panel th,
html[data-theme="dark"] .account-directory-panel th,
html[data-theme="dark"] .hubin th,
html[data-theme="dark"] .ppdb th,
html[data-theme="dark"] .homeroom-alert-table th {
    background: #16233a;
    border-color: var(--line);
    color: #cbd8ec;
}

html[data-theme="dark"] td,
html[data-theme="dark"] .hubin td,
html[data-theme="dark"] .ppdb td,
html[data-theme="dark"] .homeroom-alert-table td {
    border-color: var(--line);
    color: var(--ink);
}

html[data-theme="dark"] .table-sort-symbol,
html[data-theme="dark"] .student-review-sort-icon {
    background: #111b2e;
    border-color: #304566;
    color: #9eb1cc;
}

html[data-theme="dark"] th[aria-sort="ascending"] .table-sort-control,
html[data-theme="dark"] th[aria-sort="descending"] .table-sort-control,
html[data-theme="dark"] .student-review-sort.is-active,
html[data-theme="dark"] .student-review-sort:hover {
    color: #93c5fd;
}

html[data-theme="dark"] th[aria-sort="ascending"] .table-sort-symbol,
html[data-theme="dark"] th[aria-sort="descending"] .table-sort-symbol,
html[data-theme="dark"] .student-review-sort.is-active .student-review-sort-icon {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

html[data-theme="dark"] .teacher-sheet td:has([name=name]),
html[data-theme="dark"] .teacher-sheet th:nth-child(3),
html[data-theme="dark"] .teacher-sheet th:last-child,
html[data-theme="dark"] .teacher-sheet td:last-child {
    background: var(--surface);
}

html[data-theme="dark"] .sheet-dirty,
html[data-theme="dark"] .teacher-sheet .sheet-dirty td:has([name=name]),
html[data-theme="dark"] .teacher-sheet .sheet-dirty td:last-child {
    background: #2b220d;
}

html[data-theme="dark"] .excel-grade-scroll,
html[data-theme="dark"] .report-workspace .report-grade-scroll {
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] .excel-grade-table,
html[data-theme="dark"] .report-workspace .excel-grade-table,
html[data-theme="dark"] .report-workspace .report-grade-table {
    color: var(--ink);
}

html[data-theme="dark"] .excel-grade-table th,
html[data-theme="dark"] .excel-grade-table td,
html[data-theme="dark"] .report-workspace .excel-grade-table th,
html[data-theme="dark"] .report-workspace .excel-grade-table td,
html[data-theme="dark"] .report-workspace .report-grade-table th,
html[data-theme="dark"] .report-workspace .report-grade-table td {
    border-color: #253856;
}

html[data-theme="dark"] .excel-grade-table thead th,
html[data-theme="dark"] .report-workspace .excel-grade-table thead th,
html[data-theme="dark"] .report-workspace .report-grade-table th {
    background: #17253e;
    color: #dbe8fa;
}

html[data-theme="dark"] .report-workspace .report-grade-table td,
html[data-theme="dark"] .report-workspace .report-grade-table td:first-child:not([colspan]) {
    background: var(--surface);
}

html[data-theme="dark"] .excel-grade-table tbody tr:nth-child(even) td,
html[data-theme="dark"] .report-workspace .excel-grade-table tbody tr:nth-child(even) td {
    background: #142035;
}

html[data-theme="dark"] .excel-grade-table tbody tr:hover td,
html[data-theme="dark"] .report-workspace .excel-grade-table tbody tr:hover td {
    background: #1b2c49;
}

html[data-theme="dark"] .excel-grade-table tbody tr.excel-row-dirty td {
    background: #2b220d;
}

html[data-theme="dark"] .excel-grade-table tbody tr.excel-row-error td,
html[data-theme="dark"] .report-workspace .excel-grade-table tbody tr.excel-row-error td {
    background: #33161c;
}

html[data-theme="dark"] .excel-grade-table tbody tr.excel-row-excluded td,
html[data-theme="dark"] .report-workspace .excel-grade-table tbody tr.excel-row-excluded td {
    background: #0e1727;
    color: #7b90ad;
}

html[data-theme="dark"] .excel-grade-table .excel-col-avg,
html[data-theme="dark"] .report-workspace .excel-grade-table .excel-col-avg {
    background: #162947;
    color: #93c5fd;
}

html[data-theme="dark"] .excel-grade-table .excel-col-no,
html[data-theme="dark"] .excel-grade-table .excel-col-nis,
html[data-theme="dark"] .excel-grade-table .excel-col-student small,
html[data-theme="dark"] .excel-grade-table .excel-cell-meta {
    color: #9eb1cc;
}

html[data-theme="dark"] .excel-tip,
html[data-theme="dark"] .report-workspace .excel-tip {
    background: #13233d;
    border-color: #244475;
    border-left-color: #3b82f6;
    color: #bfdbfe;
}

html[data-theme="dark"] .excel-save-bar label {
    color: #dbe8fa;
}

html[data-theme="dark"] .excel-dirty-pill,
html[data-theme="dark"] .excel-grade-table .excel-flag,
html[data-theme="dark"] .report-workspace .excel-grade-table .excel-flag {
    color: #fde68a;
}

html[data-theme="dark"] .excel-grade-table .excel-flag,
html[data-theme="dark"] .report-workspace .excel-grade-table .excel-flag {
    background: #38280d;
}

html[data-theme="dark"] .excel-grade-table .excel-badge-ready {
    background: #0e2b21;
    color: #86efac;
}

html[data-theme="dark"] .excel-grade-table .excel-badge-pending {
    background: #33240c;
    color: #fde68a;
}

html[data-theme="dark"] .excel-grade-table .excel-badge-muted {
    background: #1a273d;
    color: #9eb1cc;
}

html[data-theme="dark"] .excel-grade-table .excel-inline-error,
html[data-theme="dark"] .report-workspace .excel-grade-table .excel-inline-error {
    color: #fca5a5;
}

html[data-theme="dark"] .list-pagination .pagination-button {
    background: #162238;
    border-color: #2f4569;
    color: #93c5fd;
}

html[data-theme="dark"] .list-pagination a.pagination-button:hover {
    background: #1d3254;
    border-color: #60a5fa;
}

html[data-theme="dark"] .list-pagination .pagination-button[aria-disabled="true"] {
    background: #0f1829;
    border-color: #20304b;
    color: #607594;
}

html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .table-link,
html[data-theme="dark"] .excel-grade-table .excel-col-link,
html[data-theme="dark"] .report-workspace .report-row-details > summary,
html[data-theme="dark"] .school-rules-original summary {
    color: #60a5fa;
}

/* --- Forms, Inputs, Selects, Textareas & Rich Text Editor --- */
html[data-theme="dark"] .dashboard-content :is(input, select, textarea):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
html[data-theme="dark"] .ppdb :is(input, select, textarea):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .input-wrap,
html[data-theme="dark"] .auth-standalone-card .account-password-wrap > input,
html[data-theme="dark"] .teacher-picker-control,
html[data-theme="dark"] .teacher-picker-popup,
html[data-theme="dark"] .student-attendance-reminder textarea {
    background: #0d1627;
    border-color: #32496d;
    color: #edf3fc;
}

html[data-theme="dark"] .input-wrap input,
html[data-theme="dark"] .teacher-picker-control > input {
    background: transparent;
    border-color: transparent;
    color: #edf3fc;
}

html[data-theme="dark"] .teacher-picker-toggle {
    border-left-color: #2c4060;
    color: #cbd8ec;
}

html[data-theme="dark"] .teacher-picker-option {
    border-bottom-color: #1f304d;
    color: #edf3fc;
}

html[data-theme="dark"] .teacher-picker-option:hover,
html[data-theme="dark"] .teacher-picker-option.is-active {
    background: #172a4a;
    color: #93c5fd;
}

html[data-theme="dark"] .password-toggle {
    color: #9eb1cc;
}

html[data-theme="dark"] .password-toggle:hover {
    background: #1b2e4d;
    color: #93c5fd;
}

html[data-theme="dark"] .application-author {
    color: #60a5fa;
}

html[data-theme="dark"] .input-wrap:focus-within,
html[data-theme="dark"] .auth-standalone-card .account-password-wrap > input:focus,
html[data-theme="dark"] .dashboard-content :is(input, select, textarea):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus {
    background: #122038;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

html[data-theme="dark"] .excel-grade-table .excel-cell-text.is-reason-needed {
    border-color: #f59e0b;
    background: #2b210d;
}

html[data-theme="dark"] option {
    background: #111b2e;
    color: #edf3fc;
}

html[data-theme="dark"] ::placeholder {
    color: #7c93b4;
    opacity: 1;
}

html[data-theme="dark"] :is(input, select, textarea):is([readonly], :disabled):not([type="checkbox"]):not([type="radio"]) {
    background: #0a111f;
    color: #7b90ad;
    border-color: #20304a;
}

html[data-theme="dark"] input::file-selector-button {
    background: #1a2d4f;
    color: #93c5fd;
}

html[data-theme="dark"] fieldset {
    border-color: var(--line);
}

html[data-theme="dark"] .rte-root {
    background: #0d1627;
    border-color: #32496d;
}

html[data-theme="dark"] .rte-root:focus-within {
    background: #0f1a2f;
    border-color: #60a5fa;
}

html[data-theme="dark"] .rte-root.is-disabled {
    background: #0a111f;
}

html[data-theme="dark"] .rte-toolbar {
    background: #152238;
    border-bottom-color: #253856;
}

html[data-theme="dark"] .rte-sep {
    background: #31476b;
}

html[data-theme="dark"] .rte-toolbar .rte-btn {
    color: #dbe8fa;
}

html[data-theme="dark"] .rte-toolbar .rte-btn:hover:not(:disabled),
html[data-theme="dark"] .rte-toolbar .rte-btn[aria-pressed="true"] {
    background: #1f365c;
    border-color: #3b82f6;
    color: #ffffff;
}

html[data-theme="dark"] .rte-surface {
    color: #edf3fc;
}

html[data-theme="dark"] .rte-surface:empty::before {
    color: #7c93b4;
}

html[data-theme="dark"] .rte-surface blockquote,
html[data-theme="dark"] .rich-text-content blockquote,
html[data-theme="dark"] .announcement-popup-body.is-rich blockquote {
    background: #162642;
    color: #dbe8fa;
}

html[data-theme="dark"] .rte-example {
    background: #132138;
    border-color: #274066;
    color: #cbd8ec;
}

html[data-theme="dark"] .rte-example-text {
    color: #9eb1cc;
}

html[data-theme="dark"] .rte-example-insert {
    background: #172a4a;
    border-color: #33578f;
    color: #93c5fd;
}

/* --- Modals, Popups & Dropdowns --- */
html[data-theme="dark"] dialog,
html[data-theme="dark"] .announcement-popup-dialog,
html[data-theme="dark"] .homeroom-attendance-dialog,
html[data-theme="dark"] .student-attendance-reminder,
html[data-theme="dark"] .spp-dialog,
html[data-theme="dark"] .lesson-alert-dialog {
    background: #111b2e;
    border-color: #2a3e5e;
    color: #edf3fc;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] dialog::backdrop {
    background: rgba(2, 6, 15, 0.78);
}

html[data-theme="dark"] .homeroom-alert-table,
html[data-theme="dark"] .lesson-alert-dialog li,
html[data-theme="dark"] .lesson-roster li,
html[data-theme="dark"] .lesson-history li {
    border-color: var(--line);
    background: #152238;
}

/* --- Buttons, Tabs & Navigation Controls --- */
html[data-theme="dark"] .primary-button {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

html[data-theme="dark"] .primary-button:hover {
    background: #3b82f6;
}

html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .role-guide-top,
html[data-theme="dark"] .dashboard-content form.list-filters > a.table-link,
html[data-theme="dark"] .lesson-report-page .lesson-inline-form > a {
    background: #162238;
    border-color: #2f4569;
    color: #edf3fc;
}

html[data-theme="dark"] .secondary-button:hover,
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .role-guide-top:hover,
html[data-theme="dark"] .dashboard-content form.list-filters > a.table-link:hover,
html[data-theme="dark"] .lesson-report-page .lesson-inline-form > a:hover {
    background: #1e3152;
    border-color: #60a5fa;
    color: #93c5fd;
}

html[data-theme="dark"] .table-action-danger,
html[data-theme="dark"] .bmw-danger-button,
html[data-theme="dark"] .data-management-actions .data-danger-action {
    background: #31141a;
    border-color: #742432;
    color: #fca5a5;
}

html[data-theme="dark"] .table-action-danger:hover,
html[data-theme="dark"] .bmw-danger-button:hover,
html[data-theme="dark"] .data-management-actions .data-danger-action:hover {
    background: #441922;
}

html[data-theme="dark"] .request-center-page .request-center-reject,
html[data-theme="dark"] .eskul-review-actions summary {
    border-color: #7f2936;
    color: #fca5a5;
}

html[data-theme="dark"] nav.master-tabs:has(> a + a),
html[data-theme="dark"] .recap-view-switch {
    background: #0e1729;
    border-color: #243654;
}

html[data-theme="dark"] nav.master-tabs:has(> a + a) > a,
html[data-theme="dark"] .recap-view-switch a {
    color: #9eb1cc;
}

html[data-theme="dark"] nav.master-tabs:has(> a + a) > a:hover,
html[data-theme="dark"] .recap-view-switch a:hover {
    background: #182742;
    color: #edf3fc;
}

html[data-theme="dark"] nav.master-tabs:has(> a + a) > a.selected-tab,
html[data-theme="dark"] nav.master-tabs:has(> a + a) > a[aria-current="page"],
html[data-theme="dark"] nav.master-tabs.attendance-tabs > a[aria-current="page"],
html[data-theme="dark"] .recap-view-switch a.is-active,
html[data-theme="dark"] .selected-tab,
html[data-theme="dark"] .master-tabs > a[aria-current="page"],
html[data-theme="dark"] .hubin nav a[aria-current="page"] {
    background: #1b3461;
    color: #93c5fd;
    border-color: #3b82f6;
}

html[data-theme="dark"] .recap-quick-chip {
    background: #162238;
    border-color: #2b3f61;
    color: #cbd8ec;
}

html[data-theme="dark"] .recap-quick-chip:hover {
    background: #1f3252;
    border-color: #60a5fa;
    color: #93c5fd;
}

html[data-theme="dark"] .recap-quick-chip.is-active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #ffffff;
}

html[data-theme="dark"] .recap-chip-count {
    background: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .attendance-recap-export-btn,
html[data-theme="dark"] .recap-action-link,
html[data-theme="dark"] .recap-scope-chip {
    background: #14284a;
    border-color: #2a4c82;
    color: #93c5fd;
}

html[data-theme="dark"] .attendance-recap-export-btn:hover,
html[data-theme="dark"] .recap-action-link:hover {
    background: #1b3663;
    border-color: #60a5fa;
    color: #dbeafe;
}

html[data-theme="dark"] .report-workspace .report-workspace-links a {
    color: #9eb1cc;
}

html[data-theme="dark"] .report-workspace .report-workspace-links a:hover {
    background: #16243d;
    border-color: #2a3f63;
    color: #edf3fc;
}

html[data-theme="dark"] .report-workspace .report-workspace-links a.is-active {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme="dark"] .report-workspace .report-workflow-steps li:before {
    background: #1c2c47;
    color: #cbd8ec;
}

html[data-theme="dark"] .report-workspace .report-workflow-steps .is-current {
    background: #172a4a;
    border-color: #2f5591;
    color: #93c5fd;
}

html[data-theme="dark"] .report-workspace .report-workflow-steps .is-complete {
    color: #86efac;
}

html[data-theme="dark"] .report-workspace .report-workflow-steps .is-complete:before {
    background: #0e2b21;
    color: #86efac;
}

/* --- Notifications, Alerts, Toasts, Badges & Status Pills --- */
html[data-theme="dark"] .notice,
html[data-theme="dark"] .preview-notice,
html[data-theme="dark"] .action-status,
html[data-theme="dark"] .attendance-recap-banner,
html[data-theme="dark"] .class-join-period {
    background: #13233d;
    border-color: #244475;
    color: #bfdbfe;
}

html[data-theme="dark"] .preview-notice strong,
html[data-theme="dark"] .attendance-recap-banner > div > strong {
    color: #edf3fc;
}

html[data-theme="dark"] .form-feedback,
html[data-theme="dark"] .connection-notice,
html[data-theme="dark"] .eskul-pending-summary,
html[data-theme="dark"] .account-recovery-resend,
html[data-theme="dark"] .bmw-decision-reason,
html[data-theme="dark"] .class-join-period[data-period-status="ambiguous"],
html[data-theme="dark"] .class-join-period[data-period-status="unavailable"],
html[data-theme="dark"] .class-join-period[data-period-status="sole_active"] {
    background: #2b200c;
    border-color: #6b4c14;
    color: #fde68a;
}

html[data-theme="dark"] .eskul-pending-summary h2,
html[data-theme="dark"] .account-recovery-resend .input-help {
    color: #fde68a;
}

html[data-theme="dark"] .field-error {
    color: #fca5a5;
}

html[data-theme="dark"] .database-status.is-connected,
html[data-theme="dark"] .lesson-started,
html[data-theme="dark"] .badge-verified,
html[data-theme="dark"] .class-join-status.approved,
html[data-theme="dark"] .recap-status-badge[data-tone="good"],
html[data-theme="dark"] .recap-mini-pill[data-tone="good"],
html[data-theme="dark"] .recap-count-good,
html[data-theme="dark"] .report-workspace .report-status[data-state="reviewed"],
html[data-theme="dark"] .report-workspace .report-status[data-state="ready"],
html[data-theme="dark"] .report-workspace .report-status[data-state="published"],
html[data-theme="dark"] .bmw-status[data-status="approved"],
html[data-theme="dark"] .bmw-status[data-status="active"],
html[data-theme="dark"] .hubin-student-status[data-status="ongoing"],
html[data-theme="dark"] .hubin-student-status[data-status="completed"] {
    background: #0e2b21;
    border-color: #1c5742;
    color: #86efac;
}

html[data-theme="dark"] .database-status.is-disconnected,
html[data-theme="dark"] .class-join-status.rejected,
html[data-theme="dark"] .attendance-recap-kpi[data-tone="danger"],
html[data-theme="dark"] .recap-status-badge[data-tone="danger"],
html[data-theme="dark"] .recap-mini-pill[data-tone="danger"],
html[data-theme="dark"] .recap-count-danger,
html[data-theme="dark"] .bmw-status[data-status="rejected"],
html[data-theme="dark"] .bmw-status[data-status="expired"],
html[data-theme="dark"] .hubin-student-status[data-status="cancelled"] {
    background: #31141a;
    border-color: #742432;
    color: #fca5a5;
}

html[data-theme="dark"] .attendance-recap-kpi[data-tone="danger"] dd {
    color: #fca5a5;
}

html[data-theme="dark"] .badge-pending,
html[data-theme="dark"] .class-join-status.pending,
html[data-theme="dark"] .eskul-management-counts .eskul-pending-count,
html[data-theme="dark"] .attendance-recap-kpi[data-tone="warn"],
html[data-theme="dark"] .recap-status-badge[data-tone="warn"],
html[data-theme="dark"] .recap-mini-pill[data-tone="warn"],
html[data-theme="dark"] .recap-count-warn,
html[data-theme="dark"] .report-workspace .report-status[data-state="revision_requested"],
html[data-theme="dark"] .report-workspace .report-status[data-state="incomplete"],
html[data-theme="dark"] .bmw-status,
html[data-theme="dark"] .bmw-status[data-status="soon"] {
    background: #2e220c;
    border-color: #6b4c14;
    color: #fde68a;
}

html[data-theme="dark"] .attendance-recap-kpi[data-tone="warn"] dd {
    color: #fde68a;
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .attendance-recap-kpi[data-tone="info"],
html[data-theme="dark"] .recap-status-badge[data-tone="info"],
html[data-theme="dark"] .recap-mini-pill[data-tone="info"],
html[data-theme="dark"] .recap-count-info,
html[data-theme="dark"] .report-workspace .report-role-badge,
html[data-theme="dark"] .report-workspace .report-status[data-state="submitted"],
html[data-theme="dark"] .hubin-student-status {
    background: #172a4a;
    border-color: #2b4e86;
    color: #93c5fd;
}

html[data-theme="dark"] .attendance-recap-kpi[data-tone="info"] dd {
    color: #93c5fd;
}

html[data-theme="dark"] .report-workspace .report-role-badge[data-role="homeroom"] {
    background: #0d2b2a;
    color: #5eead4;
}

html[data-theme="dark"] .neutral,
html[data-theme="dark"] .recap-status-badge,
html[data-theme="dark"] .report-workspace .report-status,
html[data-theme="dark"] .bmw-status[data-status="deactivated"],
html[data-theme="dark"] .bmw-status[data-status="closed"] {
    background: #1a273d;
    border-color: #2d3f5e;
    color: #cbd8ec;
}

html[data-theme="dark"] .lesson-alert-launcher[data-state="sending"] {
    background: #33240c;
    color: #fde68a;
}

/* --- Login, Auth Recovery & PPDB Public --- */
html[data-theme="dark"] .login-page {
    background: radial-gradient(ellipse at 0 0, #122446 0, transparent 48%), radial-gradient(ellipse at 100% 100%, #101f3d 0, transparent 46%), #0b1220;
}

@media (min-width: 901px) {
    html[data-theme="dark"] .login-page:has(.login-main) {
        background: #0b1220;
    }

    html[data-theme="dark"] .login-page:has(.login-main)::before {
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.52) 0%, rgba(23, 55, 130, 0.84) 55%, rgba(11, 24, 58, 0.95) 100%), url('images/campus-hero.webp') center/cover no-repeat;
    }

    html[data-theme="dark"] .login-page:has(.login-main) .login-header > .brand {
        background: #111b2e;
        border: 1px solid #24344f;
        border-top: 0;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    }

    html[data-theme="dark"] .login-page:has(.login-main) .login-card {
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    html[data-theme="dark"] .login-page:has(.login-main) .login-footer {
        border-top-color: #223350;
    }
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .auth-standalone-card {
    background: #111b2e;
    border-color: #24344f;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .login-card h2,
html[data-theme="dark"] .login-card label,
html[data-theme="dark"] .auth-standalone-card h1,
html[data-theme="dark"] .brand strong {
    color: #edf3fc;
}

html[data-theme="dark"] .login-forgot-link {
    color: #94a3b8;
}

html[data-theme="dark"] .login-forgot-link:hover,
html[data-theme="dark"] .login-forgot-link:focus-visible {
    color: #93c5fd;
    background: rgba(59, 130, 246, .14);
}

html[data-theme="dark"] .login-forgot-link:focus-visible {
    box-shadow: 0 0 0 2px rgba(96, 165, 250, .35);
}

html[data-theme="dark"] .login-card .login-footnote,
html[data-theme="dark"] .login-footer,
html[data-theme="dark"] .dashboard-footer {
    color: #9eb1cc;
    border-color: #223350;
}

html[data-theme="dark"] .login-card .login-footnote a,
html[data-theme="dark"] .demo-login-button,
html[data-theme="dark"] .login-features-list li,
html[data-theme="dark"] .intro-tags span {
    background: #162238;
    border-color: #2d4266;
    color: #edf3fc;
}

html[data-theme="dark"] .login-card .login-footnote a:hover,
html[data-theme="dark"] .demo-login-button:hover {
    background: #1d3154;
    border-color: #60a5fa;
    color: #93c5fd;
}

html[data-theme="dark"] .demo-login {
    border-top-color: #24344f;
}

html[data-theme="dark"] .demo-role-icon {
    background: #172a4a;
    color: #93c5fd;
}

html[data-theme="dark"] .demo-role-copy small {
    color: #9eb1cc;
}

/* --- Tap Dashboard RFID Kiosk --- */
html[data-theme="dark"] .kiosk-wrap {
    color: #edf3fc;
}

html[data-theme="dark"] .operator-bar {
    color: #9eb1cc;
}

html[data-theme="dark"] .operator-actions > button,
html[data-theme="dark"] .operator-actions > form button,
html[data-theme="dark"] .unarrived-pagination button {
    background: #162238;
    border-color: #2f4569;
    color: #edf3fc;
}

html[data-theme="dark"] .kiosk {
    background: #111b2e;
    border-color: #263a5c;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .kiosk-header {
    background: #111b2e;
    border-bottom-color: #24344f;
}

html[data-theme="dark"] .school-brand small,
html[data-theme="dark"] .school-brand em,
html[data-theme="dark"] .live-clock > span,
html[data-theme="dark"] .live-clock > small {
    color: #9eb1cc;
}

html[data-theme="dark"] .school-brand strong,
html[data-theme="dark"] .live-clock strong {
    color: #edf3fc;
}

html[data-theme="dark"] .device-status > div {
    background: #162238;
    border-color: #263a5c;
}

html[data-theme="dark"] .mode-bar,
html[data-theme="dark"] .kiosk-footer {
    background: #0e1729;
    border-color: #24344f;
}

html[data-theme="dark"] .mode-picker {
    background: #162238;
    border-color: #263a5c;
}

html[data-theme="dark"] .mode-picker button {
    color: #9eb1cc;
}

html[data-theme="dark"] .mode-picker button[aria-pressed="true"] {
    background: #10b981;
    color: #ffffff;
}

html[data-theme="dark"] .mode-picker button[data-mode="out"][aria-pressed="true"] {
    background: #3b82f6;
    color: #ffffff;
}

html[data-theme="dark"] .ready-screen {
    background: #0d1627;
}

html[data-theme="dark"] .ready-copy {
    color: #edf3fc;
}

html[data-theme="dark"] .tap-instruction {
    background: #162238;
    border: 1px solid #263a5c;
    color: #edf3fc;
}

html[data-theme="dark"] .tap-instruction small {
    color: #9eb1cc;
}

html[data-theme="dark"] .scan-bar,
html[data-theme="dark"] .unarrived-panel {
    background: #111b2e;
    border-color: #24344f;
}

html[data-theme="dark"] .scan-bar > label {
    color: #dbe8fa;
}

html[data-theme="dark"] .scan-bar input {
    background: #0d1627;
    border-color: #32496d;
    color: #edf3fc;
}

html[data-theme="dark"] .scan-bar > button {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme="dark"] .success-screen {
    background: linear-gradient(125deg, #0d281f, #111b2e 70%);
}

html[data-theme="dark"] .kiosk[data-state="out"] .success-screen {
    background: linear-gradient(125deg, #102445, #111b2e 70%);
}

html[data-theme="dark"] .error-screen {
    background: linear-gradient(125deg, #2c1218, #1a1019);
}

html[data-theme="dark"] .error-copy > p {
    color: #f4c6ce;
}

html[data-theme="dark"] .counter-present {
    background: #0e2b21;
    color: #86efac;
}

html[data-theme="dark"] .counter-late {
    background: #2e220c;
    color: #fde68a;
}

html[data-theme="dark"] .counter-not_arrived,
html[data-theme="dark"] .counter-departed {
    background: #172a4a;
    color: #93c5fd;
}

html[data-theme="dark"] .period-warning {
    background: #2e220c;
    color: #fde68a;
}

html[data-theme="dark"] .unarrived-empty {
    background: #0e2b21;
    color: #86efac;
}

html[data-theme="dark"] .unarrived-table {
    border-color: #24344f;
}

html[data-theme="dark"] .unarrived-table th {
    background: #16233a;
    color: #cbd8ec;
}

/* --- Loading & Empty States --- */
html[data-theme="dark"] .empty-state h2,
html[data-theme="dark"] .empty-state h3,
html[data-theme="dark"] .learning-empty h3,
html[data-theme="dark"] .request-center-empty h3,
html[data-theme="dark"] .hubin-student-empty h2 {
    color: #dbe8fa;
}

html[data-theme="dark"] .empty-state p,
html[data-theme="dark"] .learning-empty p,
html[data-theme="dark"] .request-center-empty p,
html[data-theme="dark"] .hubin-student-empty p,
html[data-theme="dark"] .student-home-empty,
html[data-theme="dark"] .finance-empty,
html[data-theme="dark"] .attendance-report-panel td[colspan],
html[data-theme="dark"] .self-attendance-history td[colspan] {
    color: #9eb1cc;
    background: transparent;
}

html[data-theme="dark"] .attendance-report-panel td[colspan],
html[data-theme="dark"] .self-attendance-history td[colspan] {
    background: #132037;
}

html[data-theme="dark"] .learning-empty {
    border-top-color: var(--line);
}

html[data-theme="dark"] [aria-busy="true"] {
    opacity: 0.72;
    cursor: progress;
}

/* ==========================================================================
   3. Print Safety (Always Crisp Light Mode for Printed School Documents)
   ========================================================================== */

@media print {
    html[data-theme="dark"] {
        color-scheme: light !important;
        --canvas: #ffffff;
        --white: #ffffff;
        --surface: #ffffff;
        --ink: #0f172a;
        --muted: #475569;
        --line: #cbd5e1;
    }

    html[data-theme="dark"] body,
    html[data-theme="dark"] .dashboard-page,
    html[data-theme="dark"] .panel,
    html[data-theme="dark"] td,
    html[data-theme="dark"] th {
        background: #ffffff !important;
        color: #0f172a !important;
    }

    .theme-switch {
        display: none !important;
    }
}
