html[data-portal-theme="light"] {
  color-scheme: light;
  --portal-bg: #f7faf8;
  --portal-panel: #ffffff;
  --portal-panel-soft: #edf6f0;
  --portal-text: #111827;
  --portal-muted: #58645d;
  --portal-line: #d7e5dc;
  --portal-accent: #023e26;
  --portal-accent-soft: #023e26;
  --bg: #f7faf8;
  --light-bg: #f7faf8;
  --light-card: #ffffff;
  --card: #ffffff;
  --dark: #edf6f0;
  --dark-card: #ffffff;
  --gold: #023e26;
  --gold-soft: #023e26;
  --ink: #111827;
  --text: #111827;
  --muted: #58645d;
  --line: #d7e5dc;
  --border: #d7e5dc;
}
html[data-portal-theme="dark"] {
  color-scheme: dark;
  --portal-bg: #090b0d;
  --portal-panel: #14181b;
  --portal-panel-soft: #111416;
  --portal-text: #f3f6f4;
  --portal-muted: #b9c2bd;
  --portal-line: #30383d;
  --portal-accent: #e5a800;
  --portal-accent-soft: #f2bd39;
  --bg: #090b0d;
  --light-bg: #090b0d;
  --light-card: #14181b;
  --card: #14181b;
  --dark: #090b0d;
  --dark-card: #14181b;
  --gold: #e5a800;
  --gold-soft: #f2bd39;
  --ink: #f3f6f4;
  --text: #f3f6f4;
  --muted: #b9c2bd;
  --line: #30383d;
  --border: #30383d;
}
html[data-portal-theme] body {
  background: var(--portal-bg) !important;
  color: var(--portal-text) !important;
  color-scheme: inherit;
}
html[data-portal-theme] :is(.topbar, .top, .navbar, .app-header, .toolbar, .filters, .filter-bar, .section-heading, .panel-head, .card-head, .detail-head, .hero, .bottom-nav, .sidebar, .main-panel) {
  background-color: var(--portal-panel-soft) !important;
  border-color: var(--portal-line) !important;
  color: var(--portal-text) !important;
}
html[data-portal-theme] :is(.panel, .card, .content, .nav, .login, .form-section, .dash-card, .detail-panel, .summary-card, .stat-card, .table-wrap, .table-responsive, .table-container, .empty, .filters, .toolbar, .report-card, .info-card, .data-card, .schedule-card, .prayer-card, .mobile-schedule, .meta, .menu-link, .menu, .curriculum-card, .unavailable, .stat, .table, .select, .hint, .day-row, .break-row, .schedule-board, .schedule-board-head, .student-modal, .assessment-table, .assessment-legger, .sum, .avg, .assessment-report, .report-group, .report-total, .task, .task-details, .pagination, .field, .page-link, .reference-tile, .reference-card, .assignment-record, .assignment-input, .record, .details-grid, .warning, .tile, .workbook-sheet, .workbook-notes, .workbook-table, .spp-card-info, .student-summary, .source-note, .bill-student-search, .bill-month-picker, .bill-view-tabs, .bill-level-title, .bill-summary-table, .bill-modal-head, .bill-modal-item, .bill-modal-months, .page-shell, .teacher-app, .avatar, .summary, .info-row, .back-title, .schedule-day, .attendance-suggestions, .attendance-chips, .box, .setting-link, .row-remove, .row-add, .savebar, .preview-light, .preview-light-card, .reference-card, .group-card, .group-head, .roster, .kpi, .period-line, .dash-head, .report-summary, .report-tools, .report-wrap, .report-table, .detail-grid, .entry-box, .sim-table-wrap, .sim-table, .logo-upload-preview, .callout, .markaz-card, .markaz-form, .notice, .mobile-shortcuts, .mobile-finance-card, .student-card, .service-card, .widget, .data-card, .stat-card, .info-card) {
  background-color: var(--portal-panel) !important;
  border-color: var(--portal-line) !important;
  color: var(--portal-text) !important;
}
html[data-portal-theme] :is(h1, h2, h3, h4, h5, h6, p, label, small, .muted, .note, .description, .subtitle, .children-note, .summary-label, .field-label, .lesson-info, .lesson-time, .table, .table td, .table th) {
  color: var(--portal-text) !important;
}
html[data-portal-theme] :is(.muted, small, .note, .description, .subtitle, .children-note, .help-text) {
  color: var(--portal-muted) !important;
}
html[data-portal-theme] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  background-color: var(--portal-panel) !important;
  border-color: var(--portal-line) !important;
  color: var(--portal-text) !important;
  color-scheme: inherit;
}
html[data-portal-theme] :is(table, .table) { color: var(--portal-text) !important; }
html[data-portal-theme] :is(th, .table th) {
  background-color: var(--portal-panel-soft) !important;
  border-color: var(--portal-line) !important;
  color: var(--portal-accent) !important;
}
html[data-portal-theme] :is(td, .table td, tr) {
  border-color: var(--portal-line) !important;
}
html[data-portal-theme] :is(td, .table td) {
  background-color: var(--portal-panel) !important;
}
html[data-portal-theme="light"] :is(.topbar, .top, .navbar, .app-header) {
  background: #023e26 !important;
  border-color: #023e26 !important;
  color: #ffffff !important;
}
html[data-portal-theme="light"] :is(.topbar, .top, .navbar, .app-header) :is(h1, h2, h3, h4, h5, h6, p, small, a, span, i, strong) {
  color: #ffffff !important;
}
html[data-portal-theme="dark"] :is(.topbar, .top, .navbar, .app-header) {
  background: linear-gradient(135deg, #111416, #090b0d) !important;
  color: #f3f6f4 !important;
}
html[data-portal-theme="light"] :is(.active, .selected, .nav a.active, .tab.active) {
  color: #023e26 !important;
}
html[data-portal-theme="light"] .btn-gold {
  color: #ffffff !important;
}
html[data-portal-theme="dark"] :is(.active, .selected, .nav a.active, .tab.active) {
  color: #ffd24a !important;
}

/* Match light-mode data headers to the shared deep-green module header. */
html[data-portal-theme="light"] :is(table thead th, .table thead th, .list-group-item.active, .list-header, .list-head, .group-head, .roster-head) {
  background-color: #023e26 !important;
  border-color: #023e26 !important;
  color: #ffffff !important;
}
html[data-portal-theme="light"] :is(table thead th, .table thead th, .list-group-item.active, .list-header, .list-head, .group-head, .roster-head) :is(a, span, strong, i, small) {
  color: #ffffff !important;
}

/* Keep sidebar section headers aligned with the light-mode module header. */
html[data-portal-theme="light"] :is(.sidebar, .sidebar-panel, .sidebar-menu, .nav-sidebar) :is(.panel-head, .sidebar-head, .menu-head, .list-header, .list-head, .group-head) {
  background-color: #023e26 !important;
  border-color: #023e26 !important;
  color: #ffffff !important;
}
html[data-portal-theme="light"] :is(.sidebar, .sidebar-panel, .sidebar-menu, .nav-sidebar) :is(.panel-head, .sidebar-head, .menu-head, .list-header, .list-head, .group-head) :is(a, span, strong, i, small, b) {
  color: #ffffff !important;
}

/* Keep academic year and semester chips readable in both themes. */
html[data-portal-theme] .meta span {
  background-color: var(--portal-panel) !important;
  border-color: var(--portal-line) !important;
  color: var(--portal-text) !important;
}
html[data-portal-theme] .meta span :is(i, b, strong) {
  color: var(--portal-text) !important;
}
