/* KU Plans shared light/dark appearance layer.
   Page styles keep ownership of spacing and layout; this file only remaps
   colour, elevation and native-control appearance. */

:root {
    --gray-400: #9ca3af;
    --gray-800: #1f2937;
    --indigo-200: #bfdbfe;
    --indigo-300: #93c5fd;
    --indigo-400: #60a5fa;
    --indigo-700: #003e87;
    --indigo-800: #1e3a8a;
    --amber-50: #fffbeb;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --emerald-50: #ecfdf5;
    --emerald-200: #a7f3d0;
    --emerald-700: #047857;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --violet-100: #ede9fe;
    --violet-500: #8b5cf6;
    --theme-page: #f8fafc;
    --theme-surface: #ffffff;
    --theme-surface-raised: #ffffff;
    --theme-header: rgba(255, 255, 255, 0.92);
    --theme-border: #e5e7eb;
    --theme-text: #1f2937;
    --theme-muted: #6b7280;
    --theme-link: #0057b8;
    --theme-shadow: 0 10px 30px rgba(15, 40, 80, 0.10);
}

/* A few older shells provide the skip link markup without its shared style. */
.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 100001;
    padding: .65rem 1rem;
    border-radius: .5rem;
    background: #111827;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

html[data-theme="dark"] {
    color-scheme: dark;
    --gray-50: #111a28;
    --gray-100: #1b2737;
    --gray-150: #243246;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #94a3b8;
    --gray-500: #a8b4c5;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f8fafc;
    --slate-100: #1b2737;
    --indigo-50: rgba(74, 156, 246, 0.12);
    --indigo-100: rgba(74, 156, 246, 0.20);
    --indigo-200: rgba(96, 165, 250, 0.35);
    --indigo-300: #60a5fa;
    --indigo-400: #7db9f4;
    --indigo-700: #8ac5ff;
    --indigo-800: #b9dcff;
    --amber-50: rgba(245, 158, 11, 0.08);
    --amber-100: rgba(245, 158, 11, 0.16);
    --amber-700: #fcd34d;
    --emerald-50: rgba(16, 185, 129, 0.08);
    --emerald-100: rgba(16, 185, 129, 0.16);
    --emerald-200: rgba(52, 211, 153, 0.34);
    --emerald-700: #6ee7b7;
    --green-100: rgba(34, 197, 94, 0.16);
    --red-100: rgba(239, 68, 68, 0.16);
    --red-200: rgba(248, 113, 113, 0.38);
    --violet-100: rgba(139, 92, 246, 0.18);
    --surface: rgba(18, 28, 43, 0.92);
    --theme-page: #0b1220;
    --theme-surface: #121c2b;
    --theme-surface-raised: #182437;
    --theme-header: rgba(11, 18, 32, 0.92);
    --theme-border: #334155;
    --theme-text: #e5edf7;
    --theme-muted: #a8b4c5;
    --theme-link: #8ac5ff;
    --theme-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.36);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: var(--theme-page) !important;
    color: var(--theme-text);
}

html[data-theme="dark"] body {
    background-image:
        radial-gradient(900px 520px at 85% -12%, rgba(32, 108, 193, 0.16), transparent 64%),
        radial-gradient(760px 460px at -10% 30%, rgba(0, 87, 184, 0.10), transparent 62%) !important;
    background-attachment: fixed !important;
}

html[data-theme="dark"] ::selection {
    background: rgba(96, 165, 250, 0.38);
    color: #fff;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8290a5 !important;
    opacity: 1;
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--theme-text);
    -webkit-box-shadow: 0 0 0 1000px var(--theme-surface-raised) inset;
    caret-color: var(--theme-text);
}

html[data-theme="dark"] option,
html[data-theme="dark"] optgroup {
    background: var(--theme-surface-raised);
    color: var(--theme-text);
}

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

html[data-theme="dark"] a:not([class*="btn"]):not([class*="button"]) {
    text-decoration-color: rgba(138, 197, 255, 0.55);
}

html[data-theme="dark"] {
    scrollbar-color: rgba(96, 165, 250, 0.55) transparent;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: rgba(96, 165, 250, 0.48);
}

/* ── Shared theme control ─────────────────────────────────── */
.ku-theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(32, 108, 193, 0.20);
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.82);
    color: #374151;
    box-shadow: 0 3px 12px rgba(15, 40, 80, 0.10);
    cursor: pointer;
    pointer-events: auto;
    flex: 0 0 auto;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    transition: color .16s ease, background .16s ease, border-color .16s ease,
                box-shadow .16s ease, transform .16s ease;
}

.ku-theme-toggle:hover {
    color: #0057b8;
    border-color: rgba(32, 108, 193, 0.55);
    transform: translateY(-1px);
}

.ku-theme-toggle:active { transform: scale(0.94); }
.ku-theme-toggle:focus-visible {
    outline: 3px solid #f59e0b !important;
    outline-offset: 3px !important;
}
.ku-theme-toggle svg {
    width: 21px;
    height: 21px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ku-theme-toggle__moon svg { fill: currentColor; stroke: none; }
.ku-theme-toggle__sun { display: none; }
.ku-theme-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.ku-theme-toggle--inline { position: relative; z-index: 1; }
html[data-theme="dark"] .ku-theme-toggle {
    background: rgba(24, 36, 55, 0.92);
    border-color: #3f526c;
    color: #fbbf24;
    box-shadow: 0 7px 22px rgba(0, 0, 0, 0.32);
}
html[data-theme="dark"] .ku-theme-toggle:hover {
    background: #223149;
    border-color: #5d7595;
    color: #fde68a;
}
html[data-theme="dark"] .ku-theme-toggle__moon { display: none; }
html[data-theme="dark"] .ku-theme-toggle__sun { display: block; }

/* ── Shared headers, cards, menus and dialogs ─────────────── */
html[data-theme="dark"] :is(
    .page-header, .top-bar, .dashboard-header, .cat-header, .t-nav,
    .nav-bar, .header-bar, .sticky, .syllabus-current-grade-sticky
) {
    background: var(--theme-header) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(
    .card, .glass-card, .modal-content, .modal-container, .modal-box,
    .login-container, .content-section, .tab-content, .admin-stat,
    .section, .admin-card, .t-card, .t-modal
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    box-shadow: var(--theme-shadow);
}

html[data-theme="dark"] :is(
    .modal-header, .modal-head, .modal-footer, .modal-foot,
    .ca-modal-head, .inventory-header, .card-header
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(
    .header-title, .title, .cat-title, .t-page-header h1,
    .section-title, .card-title, .modal-title, .modal-head h3
) {
    color: var(--theme-text);
}

html[data-theme="dark"] :is(
    .header-title, .title, .cat-title, .welcome-title,
    .t-page-header h1, .t-login-title .brand
) {
    background: linear-gradient(135deg, #9ccfff, #60a5fa) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

html[data-theme="dark"] :is(
    .home-btn, .back-link, .back-btn, .home-button, .home-btn-admin,
    .header-action-btn, .settings-icon-btn
) {
    background: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] :is(
    .home-btn, .back-link, .back-btn, .home-button, .home-btn-admin,
    .header-action-btn, .settings-icon-btn
):hover {
    background: #223149 !important;
    color: var(--theme-link) !important;
}

/* ── Home ────────────────────────────────────────────────── */
html[data-theme="dark"] .particles { opacity: .42; }
html[data-theme="dark"] :is(
    .category-tab, .mode-tab, .service-button, .major-button,
    .contact-section, .contact-error-card, .leaderboard-item
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .20);
}
html[data-theme="dark"] :is(.category-tab, .mode-tab):hover,
html[data-theme="dark"] :is(.service-button, .major-button):hover {
    background: var(--theme-surface-raised) !important;
    border-color: #4d6f96 !important;
}
html[data-theme="dark"] :is(.category-tab.active, .mode-tab.active) {
    background: #206cc1 !important;
    border-color: #408bd9 !important;
    color: #fff !important;
}
html[data-theme="dark"] :is(.subtitle, .contact-subtitle, .legal-text, .footer) {
    color: var(--theme-muted) !important;
}
html[data-theme="dark"] .contact-field :is(input, textarea) {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] .modal-content .modal-header {
    color: var(--theme-text);
}

/* ── Account ─────────────────────────────────────────────── */
html[data-theme="dark"] .identity .avatar {
    background: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] :is(.advanced-details, .login-wall) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] .advanced-summary:hover {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] :is(.secondary-btn, .signout-btn) {
    background: transparent !important;
}

/* ── Legal and 404 ───────────────────────────────────────── */
html[data-theme="dark"] .legal-content,
html[data-theme="dark"] body.error-page > main {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
    box-shadow: var(--theme-shadow);
}
html[data-theme="dark"] .legal-content strong,
html[data-theme="dark"] body.error-page > main h1 { color: var(--theme-text) !important; }
html[data-theme="dark"] :is(.last-updated, body.error-page > main p) { color: var(--theme-muted) !important; }
html[data-theme="dark"] body.error-page > main .code { color: var(--theme-link) !important; }

/* ── Degree planner ──────────────────────────────────────── */
html[data-theme="dark"] :is(
    .legend-item, .plan-slot-chip, #add-plan-slot-btn, #smart-plan-btn,
    .sp-sem-chip, .year-wrapper, .grade-dropdown, .syllabus-modal-content,
    .syllabus-added-item, .course-card, .instructor-card,
    .rating-modal-content, .comments-modal-content, .files-modal-content-new,
    .inventory-modal-content, .inventory-course, .dropdown-options,
    .inventory-search-container input[type="text"], .timetable-modal-content,
    .semester-card, .course-entry, .day-pill, .fullscreen-modal,
    .view-toggle-btn, .flow-stats, .ci-action-btn, .flow-year,
    .ci-report-btn, .report-issue-modal, .ri-btn-cancel, .cs-bar,
    .cs-card, .community-service-modal, .cs-input, .cs-btn-cancel
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}

html[data-theme="dark"] .no-inventory-message {
    background: var(--theme-surface-raised);
    border-color: var(--theme-border);
    color: var(--theme-muted);
}

html[data-theme="dark"] #plan-slots-bar .plan-slot-chip.active,
html[data-theme="dark"] #plan-slots-bar .view-toggle-btn.active {
    background: #206cc1 !important;
    border-color: #408bd9 !important;
    color: #fff !important;
}

html[data-theme="dark"] :is(
    .course-code, .inventory-course-code, .flow-card-code,
    .legend-item .total-credits-count, .legend-item .cgpa-count,
    .term-credits, .term-gpa, .grade-button.has-grade,
    .ci-meta-grade, .dropdown-option.active
) {
    color: var(--theme-link) !important;
}

html[data-theme="dark"] :is(
    .year-header, .term-header, .inventory-tabs, .timetable-preview-header,
    .cs-table th, .settings-day-pill label, .checkbox-item
) {
    background-color: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] :is(
    .grade-button:hover, .files-button:hover, .remove-button:hover,
    .dropdown-option.active .option-icon
) {
    background: var(--theme-surface-raised) !important;
}

html[data-theme="dark"] :is(
    .comments-sort-select, .comment-name-input, .instructor-search-input,
    .ri-input, .ri-textarea
) {
    background: var(--theme-surface-raised) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .syllabus-group-dropdown,
html[data-theme="dark"] .syllabus-group-items {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .course-card.highlight-current,
html[data-theme="dark"] #flowchart-view .course-card.flow-card.highlight-current {
    background: rgba(32, 108, 193, .24) !important;
}
html[data-theme="dark"] .course-card.highlight-prereq,
html[data-theme="dark"] #flowchart-view .course-card.flow-card.highlight-prereq {
    background: rgba(245, 158, 11, .18) !important;
}
html[data-theme="dark"] .course-card.highlight-corereq,
html[data-theme="dark"] #flowchart-view .course-card.flow-card.highlight-corereq {
    background: rgba(139, 92, 246, .20) !important;
}
html[data-theme="dark"] .course-card.highlight-unlock,
html[data-theme="dark"] #flowchart-view .course-card.flow-card.highlight-unlock {
    background: rgba(16, 185, 129, .18) !important;
}
html[data-theme="dark"] :is(.ci-chip-prereq, .ci-warnings, .ri-detected) {
    color: #fcd34d !important;
}
html[data-theme="dark"] .ci-chip-coreq { background: rgba(139,92,246,.20); color: #c4b5fd; }
html[data-theme="dark"] .ci-chip-unlock { color: #6ee7b7; }
html[data-theme="dark"] :is(.course-card:active, .inventory-course:hover, .semester-card:hover, .cs-card:hover) {
    background-color: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] :is(.update-notification, .success-notification, .notification-success) {
    background: #12352e !important;
    color: #9af0d1 !important;
}
html[data-theme="dark"] :is(.notification-error, .error-notification) {
    background: #3d1f29 !important;
    color: #fecaca !important;
}
html[data-theme="dark"] .fc-theme-standard :is(td, th, .fc-scrollgrid) {
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] .fc :is(.fc-scrollgrid, .fc-col-header-cell, .fc-timegrid-axis, .fc-timegrid-slot) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
}

/* ── Community service ───────────────────────────────────── */
html[data-theme="dark"] .cs-note {
    background: var(--theme-surface-raised);
    border-color: #4d6f96;
    color: var(--theme-text);
}
html[data-theme="dark"] :is(
    .cs-title, .cs-bar-title, .cs-total b, .cs-note-ico,
    .cs-card.cs-experience .cs-card-hours b, .cs-cat-pill.cs-experience,
    .cs-row-btn.cs-edit:hover
) {
    color: var(--theme-link);
}
html[data-theme="dark"] :is(
    .cs-card.cs-volunteering .cs-card-hours b, .cs-cat-pill.cs-volunteering
) {
    color: var(--emerald-700);
}
html[data-theme="dark"] :is(
    .cs-card.cs-training .cs-card-hours b, .cs-cat-pill.cs-training
) {
    color: var(--amber-700);
}

/* ── AI advisor ──────────────────────────────────────────── */
html[data-theme="dark"] :is(
    .suggestion-chip, .message.assistant .message-bubble, .composer,
    .login-wall-msg, .spc-term
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}
html[data-theme="dark"] .composer-wrap {
    background: linear-gradient(to top, rgba(11, 18, 32, .99) 62%, rgba(11, 18, 32, 0)) !important;
}
html[data-theme="dark"] .composer-input {
    background: transparent !important;
}
html[data-theme="dark"] .composer {
    box-shadow: 0 -12px 30px rgba(11, 18, 32, .78) !important;
}
html[data-theme="dark"] .message.user .message-bubble {
    background: #206cc1 !important;
    color: #fff !important;
}
html[data-theme="dark"] :is(.welcome-sub, .message-meta, .login-wall-msg p) {
    color: var(--theme-muted) !important;
}

/* ── Course difficulty ───────────────────────────────────── */
html[data-theme="dark"] :is(
    .rate-major-card, .form-toolbar, .course-row, .submit-card,
    .done-card, .res-major, .fp-card, .fp-chip, .fp-btn,
    .cr-reset, .cr-skip, .done-home
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}
html[data-theme="dark"] :is(.rate-major-card:hover, .course-row:hover, .fp-chip:hover, .fp-btn:hover) {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] .tbm-btn.active {
    background: #206cc1 !important;
    color: #fff !important;
}

/* ── Course exchange ─────────────────────────────────────── */
html[data-theme="dark"] :is(
    .notif-bell-btn, .notif-panel, .semester-select, .tab-btn,
    .search-input, .filter-select, .offer-card, .act-card, .create-form,
    .section-pick-card, .modal-box, .sub-tab, .ex-confirm-box,
    .btn-secondary, .btn-danger
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}
html[data-theme="dark"] .notif-item:hover,
html[data-theme="dark"] :is(.offer-card:hover, .act-card:hover, .section-pick-card:hover) {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] .notif-item.unread {
    background: rgba(32, 108, 193, .18) !important;
}
html[data-theme="dark"] :is(.tab-btn.active, .sub-tab.active) {
    background: #206cc1 !important;
    border-color: #408bd9 !important;
    color: #fff !important;
}
html[data-theme="dark"] .section-pick-card.selected .section-pick-crn {
    background: rgba(255,255,255,.10) !important;
}

/* ── Instructor reviews ──────────────────────────────────── */
html[data-theme="dark"] :is(
    .search-bar-wrap input, .instructor-card, .comments-modal-content,
    .comments-sort-select, .comment-name-input, .confirm-box,
    .dept-dropdown-btn, .dept-dropdown-panel, .filter-select
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}
html[data-theme="dark"] :is(.dept-dropdown-option:hover, .instructor-card:hover) {
    background: var(--theme-surface-raised) !important;
}

/* ── Schedule builder ────────────────────────────────────── */
html[data-theme="dark"] :is(
    .sidebar, .glass-card, .course-card, .day-pill, .filter-select,
    .section-pick-card, .nav-controls, .nav-btn, .btn-save-img,
    .timetable-wrap, .tt-header-cell, .modal-box, .type-pill,
    .btn-cancel, .btn-sm
) {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}
html[data-theme="dark"] :is(.sidebar-pane-left, .tt-time-cell, .tt-grid-cell) {
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] :is(.day-pill.active, .type-pill.active, .nav-btn.active) {
    background: #206cc1 !important;
    border-color: #408bd9 !important;
    color: #fff !important;
}
html[data-theme="dark"] .section-pick-card.selected .section-pick-crn {
    background: rgba(255,255,255,.10) !important;
}

/* ── GPA Calculator compatibility ────────────────────────── */
html[data-theme="dark"] #app,
html[data-theme="dark"] #content-area {
    background: var(--theme-page) !important;
}
html[data-theme="dark"] .cgpa-empty {
    background: var(--theme-surface) !important;
    color: var(--theme-muted) !important;
    box-shadow: none !important;
}

/* ── Team workspace ──────────────────────────────────────── */
html[data-theme="dark"] :is(
    .t-input, .t-select, .t-textarea, .t-bulk-dropdown,
    .t-d3-sidebar, .t-notes-conflict, .t-login-box
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}
html[data-theme="dark"] .t-login-wrap {
    background: var(--theme-page) !important;
    background-image:
        radial-gradient(800px 460px at 82% 0%, rgba(32,108,193,.17), transparent 64%),
        radial-gradient(680px 420px at 0% 100%, rgba(0,87,184,.10), transparent 62%) !important;
}
html[data-theme="dark"] :is(.t-nav-link:hover, .t-btn-ghost:hover, .t-table tbody tr:hover) {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] .t-nav-link.active {
    background: rgba(32,108,193,.25) !important;
    color: var(--theme-link) !important;
}
html[data-theme="dark"] .t-table :is(th, td) { border-color: var(--theme-border); }

/* ── Admin surfaces ──────────────────────────────────────── */
html[data-theme="dark"] :is(
    .plan-selector select, .admin-nav-btn, .dashboard-tabs .tab-btn,
    .course-table, .inventory-tabs, .inventory-tab-content,
    .btn-small.btn-secondary, .btn-small.btn-danger,
    .btn-secondary, .btn-danger, .delete-btn, .ca-btn-secondary,
    .ca-btn-danger, .ca-chip, .cu-major-card, .ca-modal,
    .ca-fi, .ca-fs, .cmt-card, .resource-card, .issue-card,
    .fb-card, .afaq-card, .ctrl-card, .search-input, .dept-chip,
    .cat-tabs, .major-grid .major-card, .back-to-majors, .form-input,
    .form-select, .form-textarea, .course-form, .plan-selector,
    .logs-table
) {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}
html[data-theme="dark"] :is(.ca-modal-head, .modal-head) {
    background: var(--theme-surface) !important;
}
html[data-theme="dark"] :is(
    .admin-nav-btn:hover:not(.active), .dashboard-tabs .tab-btn:hover:not(.active),
    .dept-chip:hover, .major-grid .major-card:hover, tbody tr:hover
) {
    background: var(--theme-surface-raised) !important;
}
html[data-theme="dark"] :is(
    .admin-nav-btn.active, .dashboard-tabs .tab-btn.active,
    .dept-chip.active, .cat-tabs .tab-btn.active
) {
    background: #206cc1 !important;
    border-color: #408bd9 !important;
    color: #fff !important;
}
html[data-theme="dark"] :is(thead th, .cat-tabs, .modal-foot, .prereq-section) {
    background: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] :is(.success-message, .notification-success) {
    background: #12352e !important;
    color: #9af0d1 !important;
    border-color: #1f6b58 !important;
}
html[data-theme="dark"] :is(.error-message, .notification-error, .error) {
    background: #3d1f29 !important;
    color: #fecaca !important;
    border-color: #8d3c50 !important;
}
html[data-theme="dark"] .message {
    background: rgba(245,158,11,.14) !important;
    color: #fcd34d !important;
}
html[data-theme="dark"] :is(.resource-card, .issue-card, .fb-card, .afaq-card, .cmt-card)[style] {
    background: var(--theme-surface) !important;
}
html[data-theme="dark"] :is(.cron-cmd, .sync-progress-log, pre, code) {
    background: #08101c !important;
    color: #d8e7f8 !important;
    border-color: var(--theme-border) !important;
}

/* ── Guided tour ─────────────────────────────────────────── */
html[data-theme="dark"] .kutour-root {
    --kt-text: #e5edf7;
    --kt-muted: #a8b4c5;
    --kt-border: #334155;
    --kt-dim: rgba(2, 6, 15, .70);
    --kt-ring: rgba(96, 165, 250, .96);
}
html[data-theme="dark"] :is(.kutour-popover, .kutour-popover__arrow) {
    background: var(--theme-surface-raised) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme="dark"] :is(.kutour-popover__title, .kutour-popover__body) {
    color: var(--theme-text) !important;
}
html[data-theme="dark"] .kutour-btn--ghost {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}
html[data-theme="dark"] .kutour-help-btn {
    background: var(--theme-surface-raised) !important;
    border-color: #4b6482 !important;
    color: var(--theme-link) !important;
}

/* Only theme changes use these temporary classes. Settled themes and normal
   hover/focus effects retain their existing appearance and timing. */
html:is(.ku-theme-transition, .ku-theme-instant),
html:is(.ku-theme-transition, .ku-theme-instant) *,
html:is(.ku-theme-transition, .ku-theme-instant) *::before,
html:is(.ku-theme-transition, .ku-theme-instant) *::after {
    transition: none !important;
}

html.ku-theme-transition::view-transition {
    pointer-events: none;
}

/* The snapshots already contain the page surface. Avoid repeatedly blurring
   that surface beneath the moving material; normal glass returns at cleanup. */
html.ku-theme-transition * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.ku-theme-transition::view-transition-group(*) {
    animation: none;
    z-index: 3;
}

html.ku-theme-transition::view-transition-old(*),
html.ku-theme-transition::view-transition-new(*) {
    animation: none;
    mix-blend-mode: normal;
    opacity: 1;
}

html.ku-theme-transition::view-transition-group(root) { z-index: 0; }

html.ku-theme-colors,
html.ku-theme-colors *,
html.ku-theme-colors *::before,
html.ku-theme-colors *::after {
    transition-property: color, background-color, border-color, box-shadow,
                         fill, stroke, text-decoration-color !important;
    transition-duration: 320ms !important;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1) !important;
    transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
    html.ku-theme-transition::view-transition-group(*),
    html.ku-theme-transition::view-transition-old(*),
    html.ku-theme-transition::view-transition-new(*) {
        animation-duration: 0s;
    }
    html.ku-theme-colors,
    html.ku-theme-colors *,
    html.ku-theme-colors *::before,
    html.ku-theme-colors *::after {
        transition: none !important;
    }
    .ku-theme-toggle { transition: none; }
}

@media print {
    .ku-theme-toggle { display: none !important; }
}

/* Aurora transition layers. Settled colors are defined above. */
html[data-theme-design="aurora"].ku-theme-transition::view-transition-old(root) {
    z-index: 1;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-new(root) {
    z-index: 2;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-group(ku-aurora-effects) {
    z-index: 6;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-old(ku-aurora-effects) {
    display: none;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-new(ku-aurora-effects) {
    clip-path: none;
    opacity: 1;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-group(ku-aurora-toggle) {
    z-index: 7;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-old(ku-aurora-toggle) {
    z-index: 1;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-new(ku-aurora-toggle) {
    z-index: 2;
}

html[data-theme-design="aurora"].ku-theme-transition::view-transition-old(ku-aurora-toggle),
html[data-theme-design="aurora"].ku-theme-transition::view-transition-new(ku-aurora-toggle) {
    transform-origin: center;
    clip-path: none;
}

@media print {
    [data-ku-aurora] { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    [data-ku-aurora] { display: none !important; }
}
