html[data-bs-theme="dark"] {
  --lms-dark-surface: var(--tblr-bg-surface, #1b2434);
  --lms-dark-surface-soft: var(--tblr-bg-surface-secondary, #232d3f);
  --lms-dark-surface-muted: rgba(148, 163, 184, 0.12);
  --lms-dark-border: var(--tblr-border-color, rgba(148, 163, 184, 0.35));
  --lms-dark-text: var(--tblr-body-color, #e5e7eb);
  --lms-dark-muted: var(--tblr-secondary-color, #9ca3af);
}

html[data-bs-theme="dark"] .global-page-loading-overlay {
  background: rgba(2, 6, 23, 0.82);
}

html[data-bs-theme="dark"] .global-page-loading-overlay .loader-card {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .instructor-class-card,
html[data-bs-theme="dark"] .class-header-card,
html[data-bs-theme="dark"] .class-header,
html[data-bs-theme="dark"] .info-badge,
html[data-bs-theme="dark"] .subtopic-preview,
html[data-bs-theme="dark"] .post-editor-container,
html[data-bs-theme="dark"] .instructor-profile-card,
html[data-bs-theme="dark"] .stat-item,
html[data-bs-theme="dark"] .btn-attachment-compact,
html[data-bs-theme="dark"] .footer,
html[data-bs-theme="dark"] .class-side-mobile-toggle,
html[data-bs-theme="dark"] .top-detail-shell .top-detail-mobile-toggle,
html[data-bs-theme="dark"] .student-top-detail-shell .student-top-detail-mobile-toggle,
html[data-bs-theme="dark"] #tabs-students #studentTable tr,
html[data-bs-theme="dark"] .class-page-loading-overlay .loader-card,
html[data-bs-theme="dark"] .class-tab-switch-overlay,
html[data-bs-theme="dark"] .class-tab-switch-overlay .overlay-pill {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .instructor-class-card .detail-row,
html[data-bs-theme="dark"] .instructor-class-card .card-footer,
html[data-bs-theme="dark"] #tabs-students #studentTable td .btn-list {
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .instructor-class-card .course-code,
html[data-bs-theme="dark"] .instructor-class-card .detail-value,
html[data-bs-theme="dark"] .preview-body {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .instructor-class-card .course-section,
html[data-bs-theme="dark"] .instructor-class-card .course-name,
html[data-bs-theme="dark"] .instructor-class-card .detail-label,
html[data-bs-theme="dark"] .instructor-class-card .copy-btn,
html[data-bs-theme="dark"] .empty-state,
html[data-bs-theme="dark"] .empty-state-icon,
html[data-bs-theme="dark"] .dashboard-title-icon,
html[data-bs-theme="dark"] .dashboard-stat-label,
html[data-bs-theme="dark"] .dashboard-stat-note,
html[data-bs-theme="dark"] .student-card-title-icon,
html[data-bs-theme="dark"] .student-stat-label-icon,
html[data-bs-theme="dark"] .student-dashboard-section-subtitle {
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .subtopic-preview {
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.3);
}

html[data-bs-theme="dark"] .subtopic-preview,
html[data-bs-theme="dark"] .post-box-collapsed:hover,
html[data-bs-theme="dark"] .note-toolbar,
html[data-bs-theme="dark"] .student-count-badge,
html[data-bs-theme="dark"] .stat-item:hover {
  background: var(--lms-dark-surface-soft);
}

html[data-bs-theme="dark"] .preview-resource,
html[data-bs-theme="dark"] .request-card {
  background: rgba(var(--tblr-primary-rgb), 0.16);
  border-color: rgba(var(--tblr-primary-rgb), 0.32);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .class-page-loading-overlay {
  background: rgba(2, 6, 23, 0.88);
}

html[data-bs-theme="dark"] .class-tab-switch-overlay {
  background: rgba(2, 6, 23, 0.6);
}

html[data-bs-theme="dark"] .student-dashboard-compact .card,
html[data-bs-theme="dark"] .class-performance-item,
html[data-bs-theme="dark"] .student-class-card,
html[data-bs-theme="dark"] .student-highlight-card,
html[data-bs-theme="dark"] .student-gauge-card,
html[data-bs-theme="dark"] .student-task-section,
html[data-bs-theme="dark"] .student-task-item,
html[data-bs-theme="dark"] .student-empty-note,
html[data-bs-theme="dark"] .student-analytics-card,
html[data-bs-theme="dark"] .student-analytics-pill,
html[data-bs-theme="dark"] .student-focus-pill,
html[data-bs-theme="dark"] .student-pending-list-card,
html[data-bs-theme="dark"] .cookie-banner {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .student-class-card .card-header {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.1) 0%, rgba(148, 163, 184, 0.05) 100%);
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .student-class-chip,
html[data-bs-theme="dark"] .student-task-status-pill {
  background: rgba(var(--tblr-primary-rgb), 0.16);
  border-color: rgba(var(--tblr-primary-rgb), 0.34);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .student-task-item.is-overdue,
html[data-bs-theme="dark"] .student-class-chip.is-danger,
html[data-bs-theme="dark"] .student-analytics-pill.is-danger {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

html[data-bs-theme="dark"] .student-class-chip.is-warning {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

html[data-bs-theme="dark"] .student-class-chip.is-primary {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

html[data-bs-theme="dark"] .student-class-chip.is-info {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.45);
  color: #7dd3fc;
}

html[data-bs-theme="dark"] .student-analytics-pill.is-success {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}

html[data-bs-theme="dark"] .student-gauge-ring {
  background: conic-gradient(var(--gauge-color, #94a3b8) calc(var(--progress) * 1%), rgba(148, 163, 184, 0.22) 0);
}

html[data-bs-theme="dark"] .student-gauge-ring::after {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .student-analytics-track {
  background: rgba(148, 163, 184, 0.25);
}

html[data-bs-theme="dark"] .class-performance-name,
html[data-bs-theme="dark"] .class-performance-value,
html[data-bs-theme="dark"] .student-class-title,
html[data-bs-theme="dark"] .student-highlight-value,
html[data-bs-theme="dark"] .student-gauge-title,
html[data-bs-theme="dark"] .student-gauge-value,
html[data-bs-theme="dark"] .student-task-section-title,
html[data-bs-theme="dark"] .student-task-item-title,
html[data-bs-theme="dark"] .student-dashboard-section-title,
html[data-bs-theme="dark"] .student-analytics-subject {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .class-performance-label,
html[data-bs-theme="dark"] .student-class-subtitle,
html[data-bs-theme="dark"] .student-highlight-label,
html[data-bs-theme="dark"] .student-highlight-meta,
html[data-bs-theme="dark"] .student-gauge-small,
html[data-bs-theme="dark"] .student-gauge-meta,
html[data-bs-theme="dark"] .student-task-meta,
html[data-bs-theme="dark"] .student-empty-note,
html[data-bs-theme="dark"] .student-analytics-health,
html[data-bs-theme="dark"] .student-focus-pill {
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .class-detail-mobile-tabs-shell {
  background: linear-gradient(to top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .class-detail-mobile-tabs .nav-link {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .class-detail-mobile-tabs .nav-link.active {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .student-class-mobile-tabs-shell {
  background: linear-gradient(to top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .student-class-mobile-tabs .nav-link {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .student-class-mobile-tabs .nav-link.active {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
  color: #bfdbfe;
}

/* Top detail dark mode support (instructor + student class headers) */
html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) :is(
  .class-info-card,
  .class-code-block,
  .exam-summary-block,
  .auto-accept-block,
  .exam-take-top-meta
) {
  background: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) :is(
  .bg-white,
  .bg-light,
  .bg-light-subtle
) {
  background-color: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .text-dark {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .vr {
  border-color: var(--lms-dark-border) !important;
  opacity: 1;
}

html[data-bs-theme="dark"] .top-detail-shell .top-corner-actions .btn.btn-light {
  background: var(--lms-dark-surface-soft);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) :is(
  .badge.bg-light-primary,
  .badge.bg-light-secondary,
  .badge.bg-light-info,
  .badge.bg-light-warning,
  .badge.bg-light.border.text-secondary
) {
  border: 1px solid var(--lms-dark-border);
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .badge.bg-light-primary {
  background: rgba(var(--tblr-primary-rgb), 0.2) !important;
  color: #bfdbfe !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.45) !important;
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .badge.bg-light-secondary,
html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .badge.bg-light.border.text-secondary {
  background: rgba(148, 163, 184, 0.18) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .badge.bg-light-info {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #7dd3fc !important;
  border-color: rgba(14, 165, 233, 0.45) !important;
}

html[data-bs-theme="dark"] :is(.top-detail-shell, .student-top-detail-shell, .student-class-top-detail-shell) .badge.bg-light-warning {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

html[data-bs-theme="dark"] :is(.student-top-detail-shell, .student-class-top-detail-shell) :is(
  .exam-take-top-type,
  .exam-timer-label,
  .exam-legend-title,
  .exam-legend-item
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] :is(.student-top-detail-shell, .student-class-top-detail-shell) .exam-legend-dot.pending {
  background: rgba(148, 163, 184, 0.35);
  border-color: rgba(148, 163, 184, 0.55);
}

/* Review work + student submit dark mode support */
html[data-bs-theme="dark"] :is(#classworkReviewPage, .student-classwork-submit-page) {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(#classworkReviewPage, .student-classwork-submit-page) :is(
  .bg-light,
  .bg-light-subtle,
  .bg-white
) {
  background-color: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] :is(#classworkReviewPage, .student-classwork-submit-page) :is(
  .card,
  .list-group-item,
  .review-summary-metric,
  .review-summary-actions-panel,
  .student-classwork-returned-box,
  .student-offline-record-summary,
  .student-group-submission-box,
  .student-group-submission-member,
  .student-offline-status-card,
  .student-offline-flow,
  .student-offline-flow-step,
  .student-upload-selected-preview,
  .student-classwork-points-box,
  .student-classwork-instructions-toggle
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] #classworkReviewPage :is(.review-summary-assigned-value, .review-summary-metric-value) {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(#classworkReviewPage, .student-classwork-submit-page) :is(
  .review-summary-assigned-label,
  .review-summary-actions-label,
  .review-summary-metric-label,
  .student-offline-record-item .label,
  .student-offline-flow-title,
  .student-offline-flow-step .hint,
  .student-classwork-returned-percent
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] #classworkReviewPage :is(.student-work-item.is-current-student, .group-work-item.is-current-student) {
  background: rgba(var(--tblr-primary-rgb), 0.22);
}

html[data-bs-theme="dark"] #classworkReviewPage :is(.student-actions-toggle, .student-actions-toggle .menu-dots) {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .student-classwork-submit-page .student-group-submission-member.is-you {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  color: #bfdbfe;
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
}

html[data-bs-theme="dark"] .student-classwork-submit-page .student-offline-flow-step .num {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  color: #bfdbfe;
}

/* Grading sheet + score sheet dark mode support */
html[data-bs-theme="dark"] :is(.grading-sheet-page, .classwork-score-sheet-page) {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .grading-sheet-page :is(
  .card,
  .grading-export-controls,
  .grading-status-panel,
  .grading-back-btn,
  .grading-tab-content
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-back-btn {
  background: var(--lms-dark-surface-soft);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-back-btn:hover,
html[data-bs-theme="dark"] .grading-sheet-page .grading-back-btn:focus {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet-tabs .nav-link {
  color: var(--lms-dark-muted);
  border-color: var(--lms-dark-border);
  background: var(--lms-dark-surface-soft);
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet-tabs .nav-link.active {
  color: #bfdbfe;
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
  background: rgba(var(--tblr-primary-rgb), 0.2);
}

html[data-bs-theme="dark"] .grading-sheet-page :is(
  .grading-sheet,
  .grading-sheet th,
  .grading-sheet td
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-header th,
html[data-bs-theme="dark"] .grading-sheet-page .grading-subheader th,
html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet .name-col,
html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet .grade-col,
html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet .remarks-col {
  background: var(--lms-dark-surface-soft) !important;
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet tbody tr:nth-child(odd) td {
  background: rgba(var(--tblr-primary-rgb), 0.16) !important;
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet tbody tr:nth-child(even) td {
  background: rgba(var(--tblr-primary-rgb), 0.1) !important;
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(var(--tblr-primary-rgb), 0.2);
}

html[data-bs-theme="dark"] .grading-sheet-page :is(
  .grading-sheet .student-row-number,
  .grading-sheet .student-gender-icon,
  .column-view-trigger,
  .column-color-trigger
) {
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet .cell-plain-value,
html[data-bs-theme="dark"] .grading-sheet-page .grading-sheet :is(th, td) .cell-plain-value {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .grading-sheet-page .column-view-trigger:hover,
html[data-bs-theme="dark"] .grading-sheet-page .column-color-trigger:hover {
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .grading-sheet-page .text-dark {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page :is(
  .classwork-summary-card,
  .classwork-table-card,
  .classwork-totals .total-box,
  .classwork-table-viewport.classwork-sheet-fullscreen
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-table-viewport.classwork-sheet-fullscreen {
  background: var(--lms-dark-surface) !important;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-filter-separator {
  background: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-score-table :is(th, td) {
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-score-table .sticky-col {
  background: var(--lms-dark-surface) !important;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-score-table thead .sticky-col {
  background: var(--lms-dark-surface-soft) !important;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-column-header .text-muted,
html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-score-meta,
html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-reorder-hint,
html[data-bs-theme="dark"] .classwork-score-sheet-page .criteria-btn-source {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-criteria-btn.btn-dark {
  background: rgba(var(--tblr-primary-rgb), 0.2);
  border-color: rgba(var(--tblr-primary-rgb), 0.45);
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .classwork-criteria-btn.btn-dark .criteria-btn-source {
  color: #bfdbfe;
}

html[data-bs-theme="dark"] .classwork-score-sheet-page .text-dark {
  color: var(--lms-dark-text) !important;
}

/* Class tabs dark mode support (instructor + student class pages) */
html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-stream,
  #tabs-students,
  #tabs-classworks,
  #tabs-exams,
  #tabs-attendance,
  #tabs-groups,
  #tabs-picker
) {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-stream,
  #tabs-students,
  #tabs-classworks,
  #tabs-exams,
  #tabs-attendance,
  #tabs-groups,
  #tabs-picker
) :is(.bg-white, .bg-light, .bg-light-subtle) {
  background-color: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-classworks,
  #tabs-exams,
  #tabs-attendance,
  #tabs-groups,
  #tabs-picker
) :is(
  .card,
  .accordion-item,
  .accordion-button,
  .student-attendance-summary-card,
  .student-course-materials-card,
  .student-course-item,
  .student-groupset-item,
  .student-group-card,
  .student-group-member-item,
  .student-group-note-item,
  .picker-card-surface,
  .picker-connect-surface,
  .picker-history-card,
  .picker-history-item,
  .classwork-review-summary,
  .classwork-review-stat,
  .classwork-list-stat,
  .student-classwork-status,
  .exam-student-status,
  .exam-open-control,
  .exam-metric,
  .exam-card-footer,
  .attendance-summary-card,
  .attendance-actions-card,
  .attendance-table-card,
  .attendance-table-scroll-top,
  .attendance-totals .total-box,
  #attendanceFormCard
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-classworks,
  #tabs-exams
) :is(
  .student-classwork-item:nth-child(even) .card,
  .student-classwork-row:nth-child(even),
  .student-classwork-row:hover,
  .exam-item .card,
  .exam-row td:first-child
) {
  background: var(--lms-dark-surface);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-classworks,
  #tabs-exams,
  #tabs-attendance,
  #tabs-groups,
  #tabs-picker
) :is(
  .classwork-review-summary-kicker,
  .classwork-review-summary-note,
  .classwork-review-stat-label,
  .classwork-list-stat,
  .student-classwork-status-note,
  .exam-meta-list,
  .exam-meta-list i,
  .exam-open-control .form-check-label,
  .exam-student-status-note,
  .student-group-role,
  .student-group-note-meta,
  .student-course-desc,
  .attendance-remarks,
  .attendance-total-slash
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-classworks,
  #tabs-exams,
  #tabs-attendance,
  #tabs-groups
) .text-dark {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-stream textarea::placeholder {
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  #tabs-attendance
) :is(
  .attendance-table-card .table-responsive,
  .attendance-grid-table thead th,
  .attendance-grid-table .sticky-col,
  .attendance-grid-table thead .sticky-col,
  .attendance-term-group,
  .attendance-session-header
) {
  background: var(--lms-dark-surface-soft) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-grid-table tbody td,
html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-grid-table tbody tr .sticky-col {
  background-color: var(--lms-dark-surface) !important;
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .status-dot-empty {
  border-color: rgba(148, 163, 184, 0.6);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-table-scroll-range::-webkit-slider-runnable-track,
html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-table-scroll-range::-moz-range-track {
  background: rgba(148, 163, 184, 0.45);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-table-scroll-range::-webkit-slider-thumb,
html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-attendance .attendance-table-scroll-range::-moz-range-thumb {
  background: var(--lms-dark-surface-soft);
  border-color: rgba(148, 163, 184, 0.7);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-students #studentTable tr {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) #tabs-students #studentTable td .btn-list {
  border-top-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  .class-side-mobile-toggle,
  .student-side-mobile-toggle,
  .student-class-top-mobile-toggle
) {
  background: var(--lms-dark-surface-soft);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] :is(.class-detail-page, .student-class-page) :is(
  .student-group-card.is-current,
  .student-group-member-item.is-current
) {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

/* Course reading (course_view) dark mode support */
html[data-bs-theme="dark"] .course-reader-page {
  --reader-soft-border: var(--lms-dark-border);
  --reader-text: var(--lms-dark-text);
  --reader-muted: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-outline,
  .course-reader-toolbar,
  .course-content-card,
  .course-content-card-header,
  .course-loading,
  .reader-support-card,
  .reader-resource-row,
  .reader-empty-state,
  .exam-card,
  .exam-callout,
  .module-exam-block,
  .reader-module-guide,
  .reader-module-guide[open]
) {
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-outline,
  .course-reader-toolbar,
  .course-content-card-header,
  .course-loading,
  .reader-empty-state,
  .exam-callout,
  .module-exam-block,
  .reader-module-guide
) {
  background: var(--lms-dark-surface-soft) !important;
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-content-card,
  .reader-support-card,
  .reader-resource-row,
  .exam-card,
  .reader-module-guide[open]
) {
  background: var(--lms-dark-surface) !important;
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-outline-title,
  .module-title,
  .course-topic-link,
  .course-content-current,
  .reader-panel-title,
  .reader-chip-value,
  .reader-module-guide-title,
  .reader-support-card-title,
  .reader-html-content,
  .reader-html-content :is(h1, h2, h3),
  .exam-callout-title,
  .reader-empty-state h3
) {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-outline-help,
  .course-content-label,
  .course-content-card-note,
  .course-reader-toolbar-note,
  .reader-progress-note,
  .reader-module-guide-body,
  .reader-support-card-subtitle,
  .exam-callout-text
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .course-outline-help,
  .course-content-card-note
) {
  background: rgba(var(--tblr-primary-rgb), 0.12) !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.34) !important;
}

html[data-bs-theme="dark"] .course-reader-page .course-content-card-note {
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .course-reader-page .module-header:hover,
html[data-bs-theme="dark"] .course-reader-page .course-topic-link:hover,
html[data-bs-theme="dark"] .course-reader-page .course-topic-link:focus {
  background: var(--lms-dark-surface-soft) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .course-reader-page .course-topic-link.active {
  background: rgba(var(--tblr-primary-rgb), 0.2) !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.45) !important;
  color: #bfdbfe !important;
  box-shadow: none;
}

html[data-bs-theme="dark"] .course-reader-page .course-topic-link.is-complete::before,
html[data-bs-theme="dark"] .course-reader-page .course-topic-link.active.is-complete::before {
  color: #86efac;
}

html[data-bs-theme="dark"] .course-reader-page :is(.course-nav .btn, .course-outline-toggle-btn) {
  background: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
  box-shadow: none;
}

html[data-bs-theme="dark"] .course-reader-page :is(.course-nav .btn, .course-outline-toggle-btn):hover {
  background: var(--lms-dark-surface-soft) !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.4) !important;
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .course-reader-page .course-nav .btn:disabled {
  background: var(--lms-dark-surface-soft) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .course-reader-page .course-outline .progress {
  background: rgba(148, 163, 184, 0.22) !important;
}

html[data-bs-theme="dark"] .course-reader-page .module-header {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .course-reader-page .module-toggle,
html[data-bs-theme="dark"] .course-reader-page .reader-module-guide-title::before {
  color: var(--lms-dark-muted);
}

html[data-bs-theme="dark"] .course-reader-page .reader-chip-label {
  background: rgba(var(--tblr-primary-rgb), 0.18) !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.4) !important;
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-content-type-label {
  background: rgba(var(--tblr-primary-rgb), 0.16) !important;
  border-color: rgba(var(--tblr-primary-rgb), 0.36) !important;
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-progress-note {
  background: rgba(34, 197, 94, 0.16) !important;
  border-color: rgba(34, 197, 94, 0.45) !important;
  color: #bbf7d0 !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content h1 {
  border-bottom-color: var(--lms-dark-border) !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content h2 {
  background: var(--lms-dark-surface-soft) !important;
  border-left-color: rgba(var(--tblr-primary-rgb), 0.65) !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content :not(pre) > code {
  background: rgba(148, 163, 184, 0.18) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content :is(th, td) {
  background: var(--lms-dark-surface) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content th {
  background: var(--lms-dark-surface-soft) !important;
}

html[data-bs-theme="dark"] .course-reader-page .reader-html-content blockquote {
  background: rgba(var(--tblr-primary-rgb), 0.12) !important;
  border-left-color: rgba(var(--tblr-primary-rgb), 0.55) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .course-reader-page :is(
  .text-muted,
  .module-progress-count,
  .module-progress-percent
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .navbar-brand-autodark .lms-brand-logo {
  filter: none !important;
}

/* Item analysis reports (summary, detailed, result, insights) dark mode support */
html[data-bs-theme="dark"] .item-analysis-report-page {
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .card,
  .report-card,
  .matrix-meta-card,
  .insight-card,
  .form-control,
  .form-select
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .item-analysis-report-page .card-header {
  background: var(--lms-dark-surface-soft);
  border-color: var(--lms-dark-border);
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .text-muted,
  .text-secondary,
  .report-card .label,
  .matrix-meta-label,
  .insight-card .label,
  .insight-section-title
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-card .value,
  .matrix-meta-value,
  .insight-card .value,
  .result-meta-title,
  .report-print-title
) {
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .table,
  .table th,
  .table td
) {
  background: var(--lms-dark-surface);
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-table thead th,
  .insight-table thead th,
  .matrix-legend-table thead th,
  .result-table thead th
) {
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .table-light,
  .table-light > th,
  .table-light > td,
  tr.table-light > th,
  tr.table-light > td
) {
  background: var(--lms-dark-surface-soft) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-text) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page .matrix-table :is(th.sticky-col, td.sticky-col) {
  border-color: var(--lms-dark-border);
  color: var(--lms-dark-text);
}

html[data-bs-theme="dark"] .item-analysis-report-page .matrix-table thead th.sticky-col {
  background: var(--lms-dark-surface-soft) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page .matrix-table tbody td.sticky-col {
  background: var(--lms-dark-surface) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page .matrix-table :is(tr.group-gap-row td, tr.group-divider-row td) {
  background: var(--lms-dark-surface-soft) !important;
  border-color: var(--lms-dark-border) !important;
  color: var(--lms-dark-muted) !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page .alert-warning {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-success-lt.text-success {
  background: rgba(34, 197, 94, 0.18) !important;
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #86efac !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-warning-lt.text-warning {
  background: rgba(245, 158, 11, 0.18) !important;
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-danger-lt.text-danger {
  background: rgba(239, 68, 68, 0.18) !important;
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-primary-lt.text-primary {
  background: rgba(var(--tblr-primary-rgb), 0.2) !important;
  border: 1px solid rgba(var(--tblr-primary-rgb), 0.45);
  color: #bfdbfe !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-info-lt.text-info {
  background: rgba(14, 165, 233, 0.18) !important;
  border: 1px solid rgba(14, 165, 233, 0.45);
  color: #7dd3fc !important;
}

html[data-bs-theme="dark"] .item-analysis-report-page :is(
  .report-badge,
  .summary-badge
).bg-secondary-lt.text-secondary {
  background: rgba(148, 163, 184, 0.18) !important;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #cbd5e1 !important;
}
