/*
 * IEHES Modo Noche Global
 * The palette follows the existing Mi Cuaderno dark theme so movement between
 * the notebook, courses and the rest of the site feels continuous.
 */

html.iehes-theme-dark {
  color-scheme: dark;
  --iehes-night-page: #07121c;
  --iehes-night-surface: #0b1722;
  --iehes-night-surface-raised: #101f2b;
  --iehes-night-surface-soft: #142632;
  --iehes-night-border: #304955;
  --iehes-night-border-strong: #3b5967;
  --iehes-night-text: #e8f1f5;
  --iehes-night-muted: #a9bdc8;
  --iehes-night-link: #83dce8;
  --iehes-night-accent: #5bc5d4;
  --iehes-night-success: #8be4bd;
  --iehes-night-warning: #f5d884;
  --iehes-night-danger: #ffb4b4;

  --ast-global-color-0: #5bc5d4;
  --ast-global-color-1: #2f9eb8;
  --ast-global-color-2: #071c2d;
  --ast-global-color-3: #e8f1f5;
  --ast-global-color-4: #07121c;
  --ast-global-color-5: #0f1f2b;
  --ast-global-color-6: #122633;
  --ast-global-color-7: #172d3a;
  --ast-global-color-8: #f4fbfd;
  --ast-code-block-background: #0b1722;
  --ast-comment-inputs-background: #0b1722;
  --ast-bg-style-guide: #07121c;
  --ast-widget-bg-color: #101f2b;
  --ast-wc-container-head-bg-color: #142632;
  --ast-title-layout-bg: #101f2b;
  --ast-search-border-color: #304955;
  --ast-lifter-hover-bg: #172d3a;
  --ast-gallery-block-color: #e8f1f5;

  --wp--preset--color--white: #101f2b;
  --wp--preset--color--black: #e8f1f5;

  --ieh-avm-drop-bg: #101f2b;
  --ieh-avm-drop-border: #304955;
  --ieh-avm-drop-text: #e8f1f5;
  --ieh-avm-drop-muted: #a9bdc8;
  --ieh-avm-drop-hover: #172d3a;
  --ieh-avm-drop-active: #173845;
  --ieh-avm-drop-danger: #ffb4b4;
  --ieh-avm-drop-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

html.iehes-theme-dark body,
html.iehes-theme-dark #page,
html.iehes-theme-dark .site-content,
html.iehes-theme-dark.ast-separate-container,
html.iehes-theme-dark body.ast-separate-container {
  background-color: var(--iehes-night-page) !important;
  color: var(--iehes-night-text);
}

html.iehes-theme-dark :where(
  body,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .entry-title,
  .entry-title a,
  .page-title,
  .widget-title,
  .entry-content
) {
  color: var(--iehes-night-text);
}

html.iehes-theme-dark :where(p, li, dd, dt, figcaption, .entry-meta) {
  border-color: var(--iehes-night-border);
}

html.iehes-theme-dark .site-content a:not(.wp-element-button):not(.button):not([class*="btn"]),
html.iehes-theme-dark .site-content a:not(.wp-element-button):not(.button):not([class*="btn"]):visited {
  color: var(--iehes-night-link);
}

html.iehes-theme-dark .site-content a:not(.wp-element-button):not(.button):not([class*="btn"]):hover,
html.iehes-theme-dark .site-content a:not(.wp-element-button):not(.button):not([class*="btn"]):focus-visible {
  color: #b8f3f8;
}

/* Astra and WordPress surfaces. */
html.iehes-theme-dark .ast-separate-container .ast-article-post,
html.iehes-theme-dark .ast-separate-container .ast-article-single:not(.ast-related-post),
html.iehes-theme-dark .ast-separate-container .error-404,
html.iehes-theme-dark .ast-separate-container .no-results,
html.iehes-theme-dark .ast-separate-container .ast-author-meta,
html.iehes-theme-dark .ast-separate-container .related-posts-title-wrapper,
html.iehes-theme-dark .ast-separate-container .comments-count-wrapper,
html.iehes-theme-dark .ast-separate-container .ast-archive-description,
html.iehes-theme-dark .ast-separate-container .comments-area .comment-respond,
html.iehes-theme-dark .ast-separate-container .comments-area .ast-comment-list li,
html.iehes-theme-dark .ast-separate-container.ast-two-container #secondary .widget,
html.iehes-theme-dark .widget,
html.iehes-theme-dark .wp-block-group.has-background,
html.iehes-theme-dark .has-white-background-color,
html.iehes-theme-dark .has-ast-global-color-5-background-color {
  border-color: var(--iehes-night-border) !important;
  background-color: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text);
}

html.iehes-theme-dark :where(hr, .wp-block-separator) {
  border-color: var(--iehes-night-border);
  color: var(--iehes-night-border);
}

html.iehes-theme-dark :where(blockquote, pre, code, .wp-block-code) {
  border-color: var(--iehes-night-border);
  background: var(--iehes-night-surface) !important;
  color: #dceaff;
}

/* Inputs keep native semantics and visible focus states. */
html.iehes-theme-dark :where(
  input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea
) {
  border-color: var(--iehes-night-border-strong) !important;
  background-color: var(--iehes-night-surface) !important;
  color: var(--iehes-night-text) !important;
  caret-color: var(--iehes-night-accent);
}

html.iehes-theme-dark :where(input, select, textarea)::placeholder {
  color: #829aa6 !important;
  opacity: 1;
}

html.iehes-theme-dark :where(input, select, textarea):focus {
  border-color: #61c9d7 !important;
  outline: 2px solid rgba(91, 197, 212, 0.34) !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(91, 197, 212, 0.16) !important;
}

html.iehes-theme-dark input[readonly],
html.iehes-theme-dark input:disabled,
html.iehes-theme-dark select:disabled,
html.iehes-theme-dark textarea:disabled {
  background-color: #14232d !important;
  color: #94aab4 !important;
  opacity: 1;
}

/* Tables, lists and common status messages. */
html.iehes-theme-dark :where(table, th, td) {
  border-color: var(--iehes-night-border) !important;
}

html.iehes-theme-dark :where(table, tbody, tr) {
  background-color: transparent;
  color: var(--iehes-night-text);
}

html.iehes-theme-dark :where(thead, tfoot, th) {
  background-color: var(--iehes-night-surface-soft) !important;
  color: #edf5f7 !important;
}

html.iehes-theme-dark tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.025);
}

html.iehes-theme-dark :where(.notice, .alert, [role="alert"], .woocommerce-message, .woocommerce-info) {
  border-color: var(--iehes-night-border-strong);
  background-color: var(--iehes-night-surface-soft);
  color: var(--iehes-night-text);
}

/* Header menu and the theme control. */
#masthead .main-header-menu .iehes-theme-menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

#masthead .main-header-menu .iehes-theme-toggle,
.iehes-theme-fallback .iehes-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 !important;
  border: 1px solid rgba(181, 223, 235, 0.2) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  color: #b8d6df !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  line-height: 1 !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

#masthead .main-header-menu .iehes-theme-toggle:hover,
#masthead .main-header-menu .iehes-theme-toggle:focus-visible,
.iehes-theme-fallback .iehes-theme-toggle:hover,
.iehes-theme-fallback .iehes-theme-toggle:focus-visible {
  border-color: rgba(113, 224, 232, 0.52) !important;
  background: rgba(67, 201, 216, 0.15) !important;
  color: #f5fbfd !important;
  transform: translateY(-1px);
}

#masthead .main-header-menu .iehes-theme-toggle:focus-visible,
.iehes-theme-fallback .iehes-theme-toggle:focus-visible {
  outline: 2px solid #77dae4 !important;
  outline-offset: 3px;
}

.iehes-theme-toggle__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.iehes-theme-toggle__sun,
html.iehes-theme-dark .iehes-theme-toggle__moon {
  display: none;
}

html.iehes-theme-dark .iehes-theme-toggle__sun {
  display: block;
}

.iehes-theme-toggle__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

html.iehes-theme-dark #masthead .ast-mobile-header-content,
html.iehes-theme-dark #masthead .ast-desktop-header-content,
html.iehes-theme-dark #masthead .ast-mobile-popup-inner {
  background-color: var(--iehes-night-surface-raised) !important;
}

.iehes-theme-fallback {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  z-index: 9988;
}

.iehes-theme-fallback[hidden] {
  display: none !important;
}

.iehes-theme-fallback .iehes-theme-toggle {
  border-color: rgba(125, 210, 221, 0.36) !important;
  background: rgba(7, 28, 45, 0.92) !important;
  color: #e8f5f7 !important;
  box-shadow: 0 12px 30px rgba(2, 12, 20, 0.28) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Global loading screen follows the chosen theme before first paint. */
html.iehes-theme-dark #ihes-loader-overlay {
  background: var(--iehes-night-page) !important;
}

html.iehes-theme-dark #ihes-loader-overlay .ihes-loader {
  --text: var(--iehes-night-text);
  --muted: var(--iehes-night-muted);
}

html.iehes-theme-dark #ihes-loader-overlay .ihes-i {
  background: #29414d;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

/* Aula home and logged-in dashboard. */
html.iehes-theme-dark #aula-home {
  --bg: var(--iehes-night-page);
  --light: var(--iehes-night-surface-raised);
  --dark: var(--iehes-night-text);
  --muted: var(--iehes-night-muted);
  --border: var(--iehes-night-border);
  --shade: var(--iehes-night-border-strong);
  --ring: #61c9d7;
  color: var(--iehes-night-text);
}

html.iehes-theme-dark #aula-home :where(
  .ah-lostpass,
  .ah-info,
  .ah-feature,
  .ah-updates,
  .ah-updates[open],
  .ah-version-pill,
  .ah-quick-card,
  .ah-tip,
  .ah-modal__panel,
  .ah-modal__head,
  .ah-admin-list,
  .ah-admin-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

html.iehes-theme-dark #aula-home :where(
  #loginform-aula label,
  .pw-label,
  .ah-card-title,
  .ah-lostpass-title,
  .ah-feature h4,
  .ah-updates__title,
  .ah-update-item__text strong,
  .ah-welcome h2,
  .ah-q-title,
  .ah-modal__title,
  .ah-user-name,
  .ah-admin-h
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #aula-home :where(
  .ah-lostpass-sub,
  .pw-hint,
  .pw-fallback,
  .ah-feature p,
  .ah-updates__hint,
  .ah-update-item,
  .ah-update-item__meta,
  .ah-modal__sub,
  .ah-admin-meta,
  .ah-user-sub,
  .ah-admin-muted
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #aula-home :where(.ah-showpass, .pw-btn-ghost, .ah-modal__close, .ah-rolebadge) {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #aula-home .ah-userrow:hover,
html.iehes-theme-dark #aula-home .ah-userrow.is-active {
  background: #173845 !important;
}

html.iehes-theme-dark #aula-home .ah-update-item + .ah-update-item {
  border-color: var(--iehes-night-border) !important;
}

html.iehes-theme-dark #aula-home .ah-admin-code {
  border-color: #3f6b59;
  background: #143128;
  color: var(--iehes-night-success);
}

html.iehes-theme-dark #aula-home .ah-admin-code small {
  color: #9ed9bd;
}

/* Student registration. */
html.iehes-theme-dark #registro-aula {
  --bg: var(--iehes-night-page);
  --light: var(--iehes-night-surface-raised);
  --dark: var(--iehes-night-text);
  --muted: var(--iehes-night-muted);
  --border: var(--iehes-night-border);
  --ring: #61c9d7;
  background: var(--iehes-night-page);
  color: var(--iehes-night-text);
}

html.iehes-theme-dark #registro-aula :where(.reg-title, .reg-label) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #registro-aula :where(.reg-sub, .reg-hint) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #registro-aula .reg-btn-ghost {
  border-color: var(--iehes-night-border-strong);
  background: var(--iehes-night-surface-soft);
  color: var(--iehes-night-text);
}

html.iehes-theme-dark #registro-aula .reg-alert-success,
html.iehes-theme-dark #aula-home :where(.ah-alert-success, .pw-done) {
  border-color: #3e715d;
  background: #123028;
  color: #a9edcf;
}

html.iehes-theme-dark #registro-aula .reg-alert-error,
html.iehes-theme-dark #aula-home .ah-alert-error {
  border-color: #75434a;
  background: #301d22;
  color: #ffc0c0;
}

html.iehes-theme-dark #aula-home .ah-alert-info {
  border-color: #385575;
  background: #162a43;
  color: #b9d2ff;
}

/* Main Aula templates: profiles, courses, classes, grades and LearnBook. */
html.iehes-theme-dark #profile-page,
html.iehes-theme-dark #teacher-page,
html.iehes-theme-dark #virtual-course,
html.iehes-theme-dark #virtual-classroom,
html.iehes-theme-dark #teacher-grades-page,
html.iehes-theme-dark #learnbook-rcp,
html.iehes-theme-dark #lb-notas-page,
html.iehes-theme-dark #lb-course-editor-page,
html.iehes-theme-dark #lb-exam-editor-page {
  --bg: var(--iehes-night-page);
  --light: var(--iehes-night-surface-raised);
  --dark: var(--iehes-night-text);
  background-color: var(--iehes-night-page) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark {
  --lb-bg: var(--iehes-night-page);
  --lb-light: var(--iehes-night-surface-raised);
  --lb-dark: var(--iehes-night-text);
}

html.iehes-theme-dark :where(
  .pf-route-loader__card,
  .pf-btn.pf-outline,
  .pf-search-inner,
  .pf-filter-card,
  .pf-class-role.is-coauthor,
  .pf-class-delete,
  .pf-letter-btn,
  .pf-asig,
  .pf-course-card,
  .pf-table,
  .pf-pagination a,
  .pf-pagination span,
  .pf-code-row,
  .cr-archived-panel,
  .cr-restore-item,
  .cr-section-row,
  .cr-class-section-empty,
  .code-value,
  .vc-course-nav-section,
  .vc-summary-card .cw-ai-summary > .cw-ai-summary__objectives,
  .vc-summary-card .cw-ai-summary__section,
  .vc-summary-card .cw-ai-summary__recap,
  .vc-summary-card .cw-ai-summary__self-check,
  .vc-summary-card .cw-ai-summary__table-wrap,
  .vc-im-history-table-wrap,
  .vc-im-poll__option,
  .vc-im-notes-sheet__dialog,
  .vc-im-sticky-sheet__dialog,
  .vc-chat-msg,
  .vc-chat-image-preview,
  .vc-chat-pdf-preview,
  .vc-forum-modal__dialog,
  .vc-acc,
  .vc-live-card,
  .vc-note,
  .vc-notes-drawer,
  #vc-quiz fieldset,
  .tg-select,
  .tg-table,
  .tg-modal__panel,
  .tg-modal__top,
  .lb-card,
  .lb-box,
  .lb-final-grade,
  .lb-input,
  .lb-editor,
  .lb-subtab,
  .lb-chip,
  .lb-chip-lite,
  .lb-coauthors__picker,
  .lb-drive-card,
  .lb-drive-cancel,
  .lb-quickbar,
  .lb-qbtn,
  .lb-preview,
  .lb-preview__hide,
  .lb-modal__card,
  .lb-modal__foot,
  .lb-ai-card,
  .lb-ai-size,
  .lb-color,
  .lb-gridpick__cell,
  .lb-qcard
) {
  border-color: var(--iehes-night-border) !important;
  background-color: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

html.iehes-theme-dark :where(
  .pf-badge.pf-draft,
  .lb-tab:not(.active):not(.is-active),
  .lb-tabbtn:not(.active):not(.is-active),
  .lb-mini-btn,
  .lb-modal__x,
  .lb-ai-spark,
  .vc-im-sticky__action,
  .vc-im-sticky__move,
  #vc-quiz select
) {
  border-color: var(--iehes-night-border-strong) !important;
  background-color: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(
  .cr-sec-assign select,
  #cr-section-name,
  .vc-im-notes-sheet__textarea,
  .cw-class-ai-field input,
  .cw-class-ai-field textarea,
  .cw-class-ai-field select,
  .cw-bibliography-modal__grid input,
  .cw-bibliography-modal__grid textarea,
  .cw-bibliography-modal__grid select
) {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(#cr-tour-tip, #vc-tour-tip, .cw-tour-tooltip) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.42) !important;
}

html.iehes-theme-dark #learnbook-rcp :where(
  .lb-exam-player .iehes-exam,
  .lb-exam-player .iehes-exam .meta div,
  .lb-exam-player .iehes-exam .q,
  .lb-exam-player .opt-letter,
  .lb-exam-player .iehes-exam .btn.secondary
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-exam-player .iehes-exam .opt:hover {
  background: var(--iehes-night-surface-soft) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-exam-player .iehes-exam .result.is-warning,
html.iehes-theme-dark :where(.lb-drive-warning, .cw-drive-warning, .cw-warning) {
  border-color: #6f5c2f !important;
  background: #302817 !important;
  color: var(--iehes-night-warning) !important;
}

/*
 * Template-specific corrections.
 *
 * Several Aula templates ship their styles inline after the global stylesheet
 * and use selectors such as `#virtual-classroom .component`.  Keep these
 * rules scoped to the real page root so the dark palette wins without
 * changing the light theme or unrelated WordPress screens.
 */

/* Teacher panel: filters, bulk tools, course cards and metrics. */
html.iehes-theme-dark #teacher-page .pf-panel,
html.iehes-theme-dark #teacher-page .pf-search-inner,
html.iehes-theme-dark #teacher-page .pf-filter-card,
html.iehes-theme-dark #teacher-page .pf-asig,
html.iehes-theme-dark #teacher-page .pf-course-card,
html.iehes-theme-dark #teacher-page .pf-class-item,
html.iehes-theme-dark #teacher-page .pf-table,
html.iehes-theme-dark #teacher-page .pf-expand-box,
html.iehes-theme-dark #teacher-page .pf-search-empty {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-page .pf-filter-card:hover,
html.iehes-theme-dark #teacher-page .pf-filter-card:focus,
html.iehes-theme-dark #teacher-page .pf-filter-card:active,
html.iehes-theme-dark #teacher-page .pf-filter-card.active,
html.iehes-theme-dark #teacher-page .pf-filter-card.active:hover,
html.iehes-theme-dark #teacher-page .pf-filter-card.active:focus-visible {
  border-color: #4a7180 !important;
  background: linear-gradient(180deg, #173845, #101f2b) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-page .pf-bulk-archive-bar {
  border-color: #385575 !important;
  background: linear-gradient(180deg, #162a43, #101f2b) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-page .pf-metrics li,
html.iehes-theme-dark #teacher-page .pf-class-course,
html.iehes-theme-dark #teacher-page .pf-archive-check,
html.iehes-theme-dark #teacher-page .pf-letter-btn,
html.iehes-theme-dark #teacher-page .pf-fc-count,
html.iehes-theme-dark #teacher-page .pf-copy,
html.iehes-theme-dark #teacher-page .pf-pagination a,
html.iehes-theme-dark #teacher-page .pf-pagination span {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-page .pf-filter-card :where(.pf-fc-label, .pf-fc-sub, .pf-fc-count),
html.iehes-theme-dark #teacher-page :where(
  .pf-title,
  .pf-course-title,
  .pf-course-meta b,
  .pf-class-title a,
  .pf-class-course strong,
  .pf-classes-count,
  .pf-classes-count strong,
  .pf-bulk-count-label,
  .pf-letterbar-label,
  .pf-classes-count span
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-page :where(
  .pf-course-meta,
  .pf-muted,
  .pf-class-course,
  .pf-class-course-label,
  .pf-asig-sub,
  .pf-classes-help,
  .pf-bulk-note,
  .pf-search-global-meta
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #teacher-page .pf-btn.pf-outline {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

/* Course view: content blocks, recovery/section tools and class assignment. */
html.iehes-theme-dark #virtual-course .cr-panel,
html.iehes-theme-dark #virtual-course .cr-restore-box,
html.iehes-theme-dark #virtual-course .cr-sections-box,
html.iehes-theme-dark #virtual-course .cr-restore-item,
html.iehes-theme-dark #virtual-course .cr-section-row,
html.iehes-theme-dark #virtual-course .cr-class-section-empty,
html.iehes-theme-dark #virtual-course .acs-meet {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-course .cr-sec-assign,
html.iehes-theme-dark #virtual-course .cr-sections-empty,
html.iehes-theme-dark #virtual-course .cr-restore-count,
html.iehes-theme-dark #virtual-course .cr-class-section {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-course :where(
  .cr-section-title,
  .cr-restore-title,
  .cr-sections-title,
  .cr-class-section-title h3,
  .cr-class-title,
  .cr-class-date,
  .cr-class-go,
  .cr-sec-assign span,
  .cr-restore-meta strong,
  .acs-meet h1,
  .acs-meet h2,
  .acs-meet h3,
  .acs-meet p
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-course :where(
  .cr-meta,
  .cr-sections-sub,
  .cr-restore-meta,
  .cr-restore-meta span,
  .cr-restore-empty,
  .cr-class-section-title .count
) {
  color: var(--iehes-night-muted) !important;
}

/* Classroom: live session, study guide, forum, evaluation and drawers. */
html.iehes-theme-dark #virtual-classroom .vc-panel,
html.iehes-theme-dark #virtual-classroom .vc-live-wrapper,
html.iehes-theme-dark #virtual-classroom .vc-summary-card,
html.iehes-theme-dark #virtual-classroom .vc-chat-msg,
html.iehes-theme-dark #virtual-classroom .vc-acc,
html.iehes-theme-dark #virtual-classroom .vc-note,
html.iehes-theme-dark #virtual-classroom .vc-forum-modal__dialog,
html.iehes-theme-dark #virtual-classroom .vc-notes-drawer,
html.iehes-theme-dark #virtual-classroom .vc-course-nav-drawer {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .vc-live-card,
  .vc-chat-grade-form,
  .vc-chat-attachment-card,
  .vc-task-view,
  .vc-eval-item,
  .vc-forum-replying,
  .vc-forum-attachments li,
  .vc-course-nav-section,
  .vc-course-nav-link,
  .vc-react-btn,
  .vc-btn-light
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .vc-summary-title,
  .vc-live-status,
  .vc-live-card h4,
  .vc-chat-author,
  .vc-chat-content,
  .vc-chat-grade-form__grid label,
  .vc-grade-form label,
  .vc-acc-head,
  .vc-forum-upload-status,
  .vc-forum-grade-count,
  .vc-course-nav-head__copy h2,
  .vc-course-nav-section summary,
  .vc-course-nav-link,
  .vc-notes-head h3
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .vc-summary-sub,
  .vc-live-card .muted,
  .vc-chat-meta,
  .vc-forum-tools-note,
  .vc-forum-grade-help,
  .vc-eval-meta,
  .vc-course-nav-head__copy p,
  .vc-course-nav-link__meta,
  .vc-note-date,
  .vc-classcode-note
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary > .cw-ai-summary__objectives,
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary__section,
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary__recap,
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary__self-check,
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary__table-wrap,
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary__callout {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary > :not(.cw-ai-summary__hero),
html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary > :not(.cw-ai-summary__hero) :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  strong,
  em,
  span,
  th,
  td
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-summary-card .cw-ai-summary th {
  border-color: var(--iehes-night-border) !important;
  background: #173845 !important;
}

/* LearnBook/RCP dashboard, navigation and lesson reading surfaces. */
html.iehes-theme-dark #learnbook-rcp .lb-nav,
html.iehes-theme-dark #learnbook-rcp .lb-card,
html.iehes-theme-dark #learnbook-rcp .lb-box,
html.iehes-theme-dark #learnbook-rcp .lb-box-soft,
html.iehes-theme-dark #learnbook-rcp .lb-final-grade,
html.iehes-theme-dark #learnbook-rcp .lb-empty,
html.iehes-theme-dark #learnbook-rcp .lb-lessonbar,
html.iehes-theme-dark #learnbook-rcp .lb-tocwrap {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp :where(
  .lb-tabbtn,
  .lb-row,
  .lb-section-heading,
  .lb-mini-btn,
  .lb-chip,
  .lb-toc-item,
  .lb-reading-pill,
  .lb-toc-toggle
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp :where(
  .lb-card-title,
  .lb-row,
  .lb-row-title,
  .lb-section-heading,
  .lb-final-grade__num,
  .lb-check,
  .lb-exam-title,
  .lb-toc-title,
  .lb-rich,
  .lb-rich h1,
  .lb-rich h2,
  .lb-rich h3,
  .lb-rich h4,
  .lb-rich p,
  .lb-rich li,
  .lb-rich strong
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp :where(.lb-muted, .lb-toc-sub) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-rich :where(
  [style*="background:#fff" i],
  [style*="background: #fff" i],
  [style*="background-color:#fff" i],
  [style*="background-color: #fff" i],
  [style*="background:white" i],
  [style*="background: white" i]
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-row-pill.ok {
  border-color: #3e715d !important;
  background: #123028 !important;
  color: var(--iehes-night-success) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-row-pill.no {
  border-color: #75434a !important;
  background: #301d22 !important;
  color: var(--iehes-night-danger) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-empty[style*="234,179,8"] :where(strong, .lb-muted) {
  color: var(--iehes-night-warning) !important;
}

/* Shared course/class creation flow. */
html.iehes-theme-dark .cw.cw-creation {
  --flow-ink: var(--iehes-night-text);
  --flow-muted: var(--iehes-night-muted);
  --flow-line: var(--iehes-night-border);
  --flow-soft: var(--iehes-night-surface-soft);
  --flow-tint: #173845;
  color: var(--iehes-night-text);
}

html.iehes-theme-dark .cw-creation :where(
  .cw-roadmap,
  .cw-workspace,
  .cw-field-card,
  .cw-process-steps li,
  .cw-guided-advanced,
  .cw-builder-panel,
  .cw-enable-card,
  .q-option-row,
  .q-pair,
  .cw-final-review__grid button,
  .cw-review-grid button,
  .cw-command-bar,
  .cw-card,
  .cw-file,
  .cw-modal .box,
  .cw-co-item,
  .cw-class-ai-dialog,
  .cw-class-ai-tabs,
  .cw-class-ai-drop,
  .cw-class-ai-check,
  .cw-class-ai-style-grid label > span,
  .cw-class-ai-depth,
  .cw-class-ai-block-grid > button,
  .cw-class-ai-preview,
  .cw-class-ai-foot,
  .cw-existing-material,
  .cw-material-loader__card,
  .cw-bibliography-modal__dialog,
  .cw-summary-route > div,
  .cw-summary-editor-card,
  .cw-track-item,
  .cw-drive-card
) {
  border-color: var(--iehes-night-border) !important;
  background-color: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

html.iehes-theme-dark :where(
  .cw-class-ai-dialog,
  .cw-class-ai-tabs,
  .cw-class-ai-drop,
  .cw-class-ai-check,
  .cw-class-ai-style-grid label > span,
  .cw-class-ai-depth,
  .cw-class-ai-block-grid > button,
  .cw-class-ai-preview,
  .cw-class-ai-foot,
  .cw-material-loader__card,
  .cw-bibliography-modal__dialog,
  .cw-bibliography-modal__missing,
  .cw-summary-editor-card,
  .cw-modal .box
) {
  border-color: var(--iehes-night-border) !important;
  background-color: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

html.iehes-theme-dark .cw-creation :where(
  .cw-progress-ring::before,
  .cw-tabs button > span:first-child,
  .cw-tabs button.active em,
  .cw-builder-route span,
  .cw-quick-deadline__presets button,
  .cw-quick-deadline__preview
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation :where(
  .cw-stage-header__copy h2,
  .cw-info-heading h2,
  .cw-guide-card h3,
  .cw-field-card > span,
  .cw-builder-panel > header h3,
  .cw-question__header div strong,
  .cw-guided-advanced summary
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation :where(
  .cw-stage-header__copy p,
  .cw-stage-header__meta small,
  .cw-command-bar__status small,
  .cw-final-review p,
  .cw-field-card > small,
  .cw-builder-panel > header p,
  .cw-process-steps small,
  .cw-input-feedback,
  .cw-question-help
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .cw-creation :where(
  .cw-info-heading,
  .cw-guide-card,
  .cw-guide-card--video,
  .cw-guide-card--activity,
  .cw-guide-card--exam,
  .cw-guide-card--forum,
  .cw-friendly-note,
  .cw-builder-route,
  .cw-final-review,
  .cw-guided-advanced__body,
  .cw-question
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation .cw-command {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation .cw-command--next,
html.iehes-theme-dark .cw-creation .cw-command-bar .cw-submit {
  background: linear-gradient(135deg, #0876a8, #155e75) !important;
  color: #fff !important;
}

/* -------------------------------------------------------------------------
 * Full front-end component audit (v1.0.4)
 *
 * These rules cover the remaining Aula templates and separately loaded
 * plugins. Selectors include the page/module root because many source files
 * print inline CSS after WordPress enqueues this stylesheet.
 * ---------------------------------------------------------------------- */

/* Student profile: pending work, grades and personal data. */
html.iehes-theme-dark #profile-page :where(
  .pf-panel,
  .pf-pend,
  .pf-code-row,
  .pf-grades-wrap,
  .pf-grades,
  .pf-profile-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #profile-page .pf-pend:hover,
html.iehes-theme-dark #profile-page .pf-pend:focus-visible {
  border-color: #5bc5d4 !important;
  background: #173845 !important;
}

html.iehes-theme-dark #profile-page :where(
  .pf-pend-course,
  .pf-pend-class,
  .pf-pend-go,
  .pf-grades th,
  .pf-grades td,
  .pf-label,
  .pf-code-value
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #profile-page :where(.pf-muted, .pf-help, .pf-meta) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #profile-page :where(.pf-chip, .pf-grades tbody tr:hover) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

/* Course creation roadmap and WordPress/TinyMCE editor chrome. */
html.iehes-theme-dark .cw-creation :where(
  .cw-tabs button,
  .cw-roadmap__summary,
  .cw-roadmap-phase,
  .cw-roadmap-phase__title,
  .cw-roadmap-phase__items,
  .cw-ai-toolbar,
  .cw-co-list,
  .cw-co-selected,
  .cw-msg,
  .cw-dropzone,
  .cw-material-row,
  .cw-review-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation .cw-tabs button.active,
html.iehes-theme-dark .cw-creation .cw-tabs button[aria-current="step"] {
  border-color: #2b91b0 !important;
  background: #173845 !important;
}

html.iehes-theme-dark .cw-creation .cw-tabs button :where(strong, span, b),
html.iehes-theme-dark .cw-creation :where(
  .cw-roadmap-phase,
  .cw-roadmap-phase strong,
  .cw-roadmap-phase__title,
  .cw-ai-toolbar strong,
  .cw-field-card label,
  .cw-field-card legend
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation .cw-tabs button :where(small, .cw-tab-description),
html.iehes-theme-dark .cw-creation :where(
  .cw-roadmap__summary,
  .cw-roadmap-phase small,
  .cw-ai-toolbar__hint,
  .cw-ai-toolbar p
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .cw-creation .cw-tabs button em {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(.cw-creation, #virtual-classroom, .lbf-wrap) :where(
  .wp-editor-wrap,
  .wp-editor-container,
  .mce-container,
  .mce-container-body,
  .mce-panel,
  .mce-toolbar-grp,
  .quicktags-toolbar
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(.cw-creation, #virtual-classroom, .lbf-wrap) :where(
  .mce-btn,
  .mce-menubtn,
  .wp-switch-editor
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark :where(.cw-creation, #virtual-classroom, .lbf-wrap) :where(
  .mce-btn button,
  .mce-btn .mce-txt,
  .mce-ico,
  .wp-switch-editor
) {
  color: var(--iehes-night-text) !important;
  text-shadow: none !important;
}

html.iehes-theme-dark :where(.cw-creation, #virtual-classroom, .lbf-wrap) iframe[id$="_ifr"],
html.iehes-theme-dark :where(.cw-creation, #virtual-classroom, .lbf-wrap) .wp-editor-area {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface) !important;
  color: var(--iehes-night-text) !important;
}

/* Course grading weights and class administration tables. */
html.iehes-theme-dark #virtual-course :where(
  .weights-table,
  .weights-table tbody td,
  .weights-table tfoot td,
  .weights-help,
  .cr-section-editor,
  .cr-restore-box,
  .cr-sections-box
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-course .weights-table tfoot td {
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-success) !important;
}

/* Classroom rich content, bibliographies, tasks and immersive sessions. */
html.iehes-theme-dark #virtual-classroom :where(
  .iehes-material-bibliography,
  .vc-im-history-card,
  .vc-im-history-table-wrap,
  .vc-im-history-table th,
  .vc-im-history-table td,
  .vc-im-live-card,
  .vc-im-qr-card,
  .vc-im-video-scope,
  .vc-im-empty,
  .vc-task-modal__dialog,
  .vc-task-resubmit,
  .vc-task-review-form,
  .vc-task-thread__event,
  .vc-task-attachments li,
  .vc-deadline,
  .vc-deadline-note
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .iehes-material-bibliography h2,
  .iehes-material-bibliography h3,
  .iehes-material-bibliography li,
  .vc-im-history-last,
  .vc-im-history-last span,
  .vc-im-history-admin h3,
  .vc-im-live-copy h3,
  .vc-im-live-copy p,
  .vc-im-qr-note,
  #vc-im-counter,
  .vc-task-thread__content,
  .vc-task-thread__content p,
  .vc-task-review-form label,
  .vc-deadline strong
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .vc-im-history-empty,
  .vc-task-tools-note,
  .vc-task-thread__head span
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-im-history-table th {
  background: var(--iehes-night-surface-soft) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-im-live-pill {
  border: 1px solid #385575 !important;
  background: #162a43 !important;
  color: #b9d2ff !important;
}

html.iehes-theme-dark #virtual-classroom .vc-im-live-pill.is-active {
  border-color: #3e715d !important;
  background: #123028 !important;
  color: var(--iehes-night-success) !important;
}

/* QR pixels require a white quiet zone to remain reliably scannable. */
html.iehes-theme-dark #virtual-classroom .vc-im-qr-card img {
  border: 1px solid #d8e3e8 !important;
  background: #fff !important;
}

html.iehes-theme-dark #virtual-classroom .iehes-material-bibliography a {
  color: var(--iehes-night-link) !important;
}

html.iehes-theme-dark #virtual-classroom #tasks :where(
  [style*="background:#fff" i],
  [style*="background: #fff" i],
  [style*="background-color:#fff" i],
  [style*="background-color: #fff" i],
  [style*="background:white" i],
  [style*="background: white" i],
  [style*="background:#e" i],
  [style*="background: #e" i],
  [style*="background:#f8" i],
  [style*="background: #f8" i],
  [style*="background:#ef" i],
  [style*="background: #ef" i],
  [style*="background-color:#e" i],
  [style*="background-color: #e" i],
  [style*="linear-gradient" i][style*="#fff" i]
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom #tasks :where(
  [style*="color:#0f" i],
  [style*="color: #0f" i],
  [style*="color:#0" i],
  [style*="color: #0" i],
  [style*="color:#1e" i],
  [style*="color: #1e" i],
  [style*="color:#1" i],
  [style*="color: #1" i],
  [style*="color:#2" i],
  [style*="color: #2" i],
  [style*="color:#33" i],
  [style*="color: #33" i],
  [style*="color:#3" i],
  [style*="color: #3" i],
  [style*="color:#47" i],
  [style*="color: #47" i],
  [style*="color:#4" i],
  [style*="color: #4" i],
  [style*="color:#5" i],
  [style*="color: #5" i],
  [style*="color:#6" i],
  [style*="color: #6" i]
) {
  color: var(--iehes-night-text) !important;
}

/* The saved assignment is one rich HTML document immediately after the
 * deadline. Database content may carry arbitrary light-theme colors, so the
 * document establishes its own dark inheritance boundary. */
html.iehes-theme-dark #virtual-classroom #tasks > .vc-deadline + :where(div, article, section) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom #tasks > .vc-deadline + :where(div, article, section) :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  dt,
  dd,
  strong,
  em,
  span
) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

/* Production tasks are also stored as a max-width rich document without a
 * semantic class or a deadline sibling. Use its authored wrapper as the
 * inheritance boundary so headings, lists, rubrics and table cells agree. */
html.iehes-theme-dark #virtual-classroom #tasks > :where(div, article, section)[style*="max-width" i][style*="background" i] {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom #tasks > :where(div, article, section)[style*="max-width" i][style*="background" i] :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  dt,
  dd,
  th,
  td,
  strong,
  em,
  span
) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .vc-task-thread__event.is-teacher,
  .vc-task-review-note,
  .vc-task-lock-note,
  .vc-forum-replying
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

/* LearnBook forum and its grading/reaction tools. */
html.iehes-theme-dark #learnbook-rcp .lbf-wrap :where(
  .lbf-intro,
  .lbf-deadline,
  .lbf-empty,
  .lbf-msg,
  .lbf-grade-form,
  .lbf-attachment-card,
  .lbf-replying,
  .lbf-attachment-list li,
  .lbf-modal-dialog
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #learnbook-rcp .lbf-wrap :where(
  .lbf-author,
  .lbf-content,
  .lbf-content p,
  .lbf-grade-grid label,
  .lbf-upload-status,
  .lbf-grade-count,
  .lbf-grade-help
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .lbf-wrap :where(.lbf-meta, .lbf-tools span) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #learnbook-rcp .lbf-wrap :where(
  .lbf-btn-light,
  .lbf-react-btn,
  .lbf-open-file
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .lbf-children {
  border-color: var(--iehes-night-border) !important;
}

/* LearnBook task manager, student submissions and grading. */
html.iehes-theme-dark #learnbook-rcp :where(
  .lbt-manager,
  .lbt-info-pill,
  .lbt-table-wrap,
  .lbt-admin-card,
  .lbt-new-card,
  .lbt-panel,
  .lbt-card,
  .lbt-check-card,
  .lbt-submission-card,
  .lbt-grading-module,
  .lbt-intro,
  .lbt-deadline,
  .lbt-student-panel,
  .lbt-teacher-panel,
  .lbt-thread,
  .lbt-thread > article,
  .lbt-resubmit,
  .lbt-review-note,
  .lbt-lock-note,
  .lbt-empty,
  .lbt-notice
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #learnbook-rcp :where(
  .lbt-content,
  .lbt-content p,
  .lbt-thread-head strong,
  .lbt-field label,
  .lbt-meta,
  .lbt-upload-help
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp :where(.iehes-lb-pdf, .iehes-lb-video-status) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #learnbook-rcp .iehes-class-ai-content {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .iehes-class-ai-content :where(
  [style*="background:#fff" i],
  [style*="background: #fff" i],
  [style*="background-color:#fff" i],
  [style*="background-color: #fff" i]
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

/* Lesson HTML is authored and stored outside the plugin stylesheet. Turn any
 * authored callout surface into a dark surface first, then make its textual
 * descendants inherit a guaranteed readable color. */
html.iehes-theme-dark #learnbook-rcp .lb-rich :where(
  div,
  section,
  article,
  aside,
  blockquote
)[style*="background" i] {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-rich :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  dt,
  dd,
  strong,
  em
) {
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #teacher-grades-page :where(label, .tg-muted) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

/* Current LearnBook exam engine (.ieh-exam2) plus the legacy engine above. */
html.iehes-theme-dark #learnbook-rcp .ieh-exam2,
html.iehes-theme-dark #learnbook-rcp .ieh-exam2 :where(
  .ieh-exam2-head,
  .ieh-exam2-question,
  .ieh-exam2-meta div,
  .ieh-exam2-match-row,
  .ieh-exam2-option,
  .ieh-exam2-letter,
  .ieh-exam2-feedback,
  .ieh-exam2-btn.secondary,
  .ieh-exam2-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 :where(
  h3,
  .ieh-exam2-stem,
  .ieh-exam2-text,
  .ieh-exam2-match-left,
  .ieh-exam2-cloze,
  .ieh-exam2-desc,
  .ieh-exam2-intro
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 :where(
  .ieh-exam2-progress-row,
  .ieh-exam2-answered,
  .ieh-exam2-meta div
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-option:hover,
html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-option.is-selected {
  border-color: #4e7ea4 !important;
  background: #162a43 !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-option.is-correct,
html.iehes-theme-dark #learnbook-rcp .ieh-exam2 :where(.ieh-exam2-saved, .ieh-exam2-card.is-ok) {
  border-color: #3e715d !important;
  background: #123028 !important;
  color: var(--iehes-night-success) !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-option.is-incorrect,
html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-card.is-error {
  border-color: #75434a !important;
  background: #301d22 !important;
  color: var(--iehes-night-danger) !important;
}

html.iehes-theme-dark #learnbook-rcp .ieh-exam2 .ieh-exam2-card.is-warning {
  border-color: #6f5c2f !important;
  background: #302817 !important;
  color: var(--iehes-night-warning) !important;
}

/* Gamification hub and creator. Branded live boards and the blue hero remain. */
html.iehes-theme-dark .iehes-gm {
  --gm-ink: var(--iehes-night-text);
  --gm-muted: var(--iehes-night-muted);
  --gm-line: var(--iehes-night-border);
  --gm-surface: var(--iehes-night-surface-raised);
  --gm-soft: var(--iehes-night-surface-soft);
  --gm-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-gm :where(
  .iehes-gm-card,
  .iehes-gm-notice,
  .iehes-gm-controller-card:not(.iehes-gm-controller-card--live):not(.iehes-gm-controller-card--results),
  .iehes-gm-shortcut-card,
  .iehes-gm-question,
  .iehes-gm-session-card,
  .iehes-gm-card-block,
  .iehes-gm-table-wrap,
  .iehes-gm-builder-settings,
  .iehes-gm-builder-summary,
  .iehes-gm-builder-summary strong,
  .iehes-gm-builder-summary span,
  .iehes-gm-creator,
  .iehes-gm-mode-card,
  .iehes-gm-ai-context,
  .iehes-gm-reference-drop,
  .iehes-gm-reference-file,
  .iehes-gm-experience-settings,
  .iehes-gm-final-review__hero,
  .iehes-gm-final-review__questions li,
  .iehes-gm-final-review__check,
  .iehes-gm-full-loader__card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark .iehes-gm :where(
  .iehes-gm-field input,
  .iehes-gm-field textarea,
  .iehes-gm-field select,
  .iehes-gm-mini-btn,
  .iehes-gm-btn--ghost,
  .iehes-gm-creator-step,
  .iehes-gm-final-review__metrics span
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-gm :where(
  .iehes-gm-card__head h3,
  .iehes-gm-card-block__head h4,
  .iehes-gm-shortcut-card strong,
  .iehes-gm-field span,
  .iehes-gm-question strong
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-gm :where(
  .iehes-gm-card__head p,
  .iehes-gm-card-block__head p,
  .iehes-gm-shortcut-card span:last-child,
  .iehes-gm-field small
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .iehes-gm :where(
  .iehes-gm-empty,
  .iehes-gm-note,
  .iehes-gm-project-foot span
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

/* Some classroom views render gamification cards directly inside the tab,
 * without the optional .iehes-gm wrapper used by the standalone screen. */
html.iehes-theme-dark :where(.iehes-gm-empty, .iehes-gm-note) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark :where(
  .iehes-gm-shortcut-card strong,
  .iehes-gm-shortcut-card h3,
  .iehes-gm-shortcut-card h4
) {
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

/* Classroom gamification launcher cards (.vc-gm-card) are separate from the
 * standalone plugin hub and originally use an opaque white gradient. */
html.iehes-theme-dark #virtual-classroom .vc-gm-card {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark #virtual-classroom .vc-gm-card > strong {
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-gm-card > span:not(.vc-gm-card__icon) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-gm-card__icon {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
}

/* Crossword, live exams and front-end authoring utilities. */
html.iehes-theme-dark .iehes-cw {
  --cw-ink: var(--iehes-night-text);
  --cw-muted: var(--iehes-night-muted);
  --cw-line: var(--iehes-night-border);
  --cw-surface: var(--iehes-night-surface-raised);
  --cw-soft: var(--iehes-night-surface-soft);
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-cw :where(
  .iehes-cw-card,
  .iehes-cw-panel,
  .iehes-cw-board-panel,
  .iehes-cw-clue-rail,
  .iehes-cw-notice,
  .iehes-cw-entry,
  .iehes-cw-list-card,
  .iehes-cw-line-editor,
  .iehes-cw-clue-nav-item,
  .iehes-cw-kpi,
  .iehes-cw-preview-note,
  .iehes-cw-clue-item,
  .iehes-cw-modal__dialog,
  .iehes-cw-reference-upload,
  .iehes-cw-reference-file,
  .iehes-cw-rule-card,
  .iehes-cw-builder-review,
  .iehes-cw-review-summary
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark .ile-page :where(
  .ile-live-shell,
  .ile-card,
  .ile-exam-card,
  .ile-result-card,
  .ile-question-card,
  .ile-status-card,
  .ile-context-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark :where(
  #usuarios-aula,
  #lb-lesson-editor-page,
  #virtual-course-archived,
  #ciw-app,
  #ytx,
  .reg2-wrapper,
  #iehes-q-wrap
) {
  --bg: var(--iehes-night-page);
  --light: var(--iehes-night-surface-raised);
  --dark: var(--iehes-night-text);
  --muted: var(--iehes-night-muted);
  --border: var(--iehes-night-border);
  background-color: var(--iehes-night-page) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(
  #usuarios-aula,
  #lb-lesson-editor-page,
  #virtual-course-archived,
  #ciw-app,
  #ytx,
  .reg2-wrapper,
  #iehes-q-wrap
) :where(
  .ua-block,
  .ua-table-wrap,
  .tg-shell,
  .tg-table-wrap,
  .lb-card,
  .lb-box,
  .cr-archived-shell,
  .ciw-panel,
  .ciw-sidebar,
  .ciw-toolbar,
  .card,
  .reg2-card,
  .iq-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark :where(
  .iehes-enrollment-table-wrap,
  .iehes-ib-loader-card,
  .iehes-pib-modal__dialog,
  .iehes-pib-step-loader-card,
  .iehes-pib-image-card,
  .iqb-modal__dialog,
  .iqb-result-card,
  .lbt-admin-card,
  .lbt-new-card,
  .lbt-card,
  .lbt-check-card
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark .iehes-enrollment-manager :where(
  .iehes-enrollment-table-wrap,
  .iehes-enrollment-empty,
  .iehes-enrollment-notice
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-enrollment-manager :where(
  .iehes-enrollment-head h2,
  .iehes-enrollment-search,
  .iehes-enrollment-table td,
  .iehes-enrollment-student strong
) {
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .iehes-enrollment-manager :where(
  .iehes-enrollment-head p,
  .iehes-enrollment-help,
  .iehes-enrollment-student span,
  .iehes-enrollment-empty-filter
) {
  color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .iehes-enrollment-manager :where(
  .iehes-enrollment-table,
  .iehes-enrollment-table th,
  .iehes-enrollment-table td
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
}

/* IEHESbot uses variables throughout, so one root override covers every
 * dynamically created panel, message, dashboard and input. */
html.iehes-theme-dark #iehesbot-root {
  --iehesbot-bg: var(--iehes-night-page);
  --iehesbot-light: var(--iehes-night-surface-raised);
  --iehesbot-dark: var(--iehes-night-text);
  --iehesbot-muted: var(--iehes-night-muted);
  --iehesbot-border: var(--iehes-night-border);
  --iehesbot-shadow-sm: 0 6px 14px rgba(0, 0, 0, 0.22);
  --iehesbot-shadow-md: 0 12px 32px rgba(0, 0, 0, 0.28);
  --iehesbot-shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.38);
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-panel,
  .iehesbot-callout,
  .iehesbot-header,
  .iehesbot-subtitle-row,
  .iehesbot-tabs,
  .iehesbot-body,
  .iehesbot-footer,
  .iehesbot-msg-bot .iehesbot-bubble,
  .iehesbot-typing .iehesbot-bubble,
  .iehesbot-dash-card,
  .iehesbot-kpi-box,
  .iehesbot-trends-row,
  .iehesbot-action-btn,
  .iehesbot-tab,
  .iehesbot-icon-btn
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root .iehesbot-body {
  background: linear-gradient(180deg, var(--iehes-night-page), var(--iehes-night-surface-raised)) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-callout-badge,
  .iehesbot-class-chip,
  .iehesbot-capability,
  .iehesbot-action-btn,
  .iehesbot-dash-btn,
  .iehesbot-pill,
  .iehesbot-study-context,
  .iehesbot-response-context,
  .iehesbot-response-followups button,
  .iehesbot-welcome-mobile__starters button,
  .iehesbot-coach-drawer-toggle
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  #iehesbot-input,
  .iehesbot-dash-input
) {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface) !important;
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-title,
  .iehesbot-callout-text,
  .iehesbot-callout-badge,
  .iehesbot-class-chip,
  .iehesbot-rich,
  .iehesbot-rich p,
  .iehesbot-rich h3,
  .iehesbot-rich h4,
  .iehesbot-rich strong,
  .iehesbot-rich em,
  .iehesbot-welcome-title,
  .iehesbot-welcome-prompt,
  .iehesbot-dash-title,
  .iehesbot-kpi-num,
  .iehesbot-dash-table td,
  .iehesbot-context-class,
  .iehesbot-tutor-promise strong,
  .iehesbot-study-context strong,
  .iehesbot-coach-sheet-header h2,
  .iehesbot-welcome-mobile h2
) {
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-subtitle,
  .iehesbot-hint,
  .iehesbot-dash-sub,
  .iehesbot-dash-meta,
  .iehesbot-dash-section-title
) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-rich ul,
  .iehesbot-rich ol,
  .iehesbot-rich blockquote,
  .iehesbot-rich code:not(pre code),
  .iehesbot-coach-guidance,
  .iehesbot-tutor-promise
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #iehesbot-root :where(
  .iehesbot-tab.is-active,
  .iehesbot-tab:hover,
  .iehesbot-send-btn,
  .iehesbot-msg-user .iehesbot-bubble,
  .iehesbot-fab
) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* Shared header/footer, inbox shortcut, private chat and safe interactive HTML. */
html.iehes-theme-dark :where(#masthead, .iehes-aula-footer, #ieh-chat-app) {
  color-scheme: dark;
}

html.iehes-theme-dark .main-header-menu :where(
  .ieh-inbox-menu-link,
  .ieh-inbox-menu-link:visited,
  .ieh-inbox-menu-link:hover,
  .ieh-inbox-menu-link:focus
) {
  color: #f4fbfd !important;
  -webkit-text-fill-color: #f4fbfd !important;
}

html.iehes-theme-dark .iehes-safe-code,
html.iehes-theme-dark .iehes-safe-code > :first-child {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-raised) !important;
  color: var(--iehes-night-text) !important;
  box-shadow: none !important;
}

html.iehes-theme-dark .iehes-safe-code__frame {
  background: var(--iehes-night-surface) !important;
}

/* Contrast findings measured against the authenticated production pages. */
html.iehes-theme-dark #teacher-page :where(
  .pf-badge,
  .pf-badge.pf-cat,
  .pf-badge.pf-catcount,
  .pf-badge.pf-coauthor
) {
  border-color: var(--iehes-night-border-strong) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation :where(
  .cw-stage-header__icon,
  .cw-stage-header__copy > span,
  .cw-stage-header__meta > span
) {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .cw-creation :where(
  .cw-note,
  .cw-note strong,
  .cw-note em,
  .hint,
  .hint strong,
  .cw-roadmap__tip,
  .cw-roadmap__tip strong
) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .cw-creation :where(#insert-media-button, .insert-media) {
  color: var(--iehes-night-link) !important;
  -webkit-text-fill-color: var(--iehes-night-link) !important;
}

html.iehes-theme-dark .cw-creation .cw-tour-skip {
  border-color: #b9c6d3 !important;
  background: #e2e8f0 !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}

html.iehes-theme-dark :where(
  #aula-home .ah-btn-light,
  #virtual-course .cr-edit-course-btn,
  #virtual-course .cr-archive-course-btn,
  #virtual-course #cr-start-tour,
  #virtual-classroom .vc-btn.vc-back-course,
  #virtual-classroom .vc-btn.vc-edit-class,
  #virtual-classroom .vc-tour-btn,
  .cw-creation .cw-ai-btn,
  .cw-creation .cw-ai-btn-mini
) {
  border-color: #0b5d77 !important;
  background: #0369a1 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html.iehes-theme-dark #learnbook-rcp .lb-section-label {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark .vc-course-nav-drawer :where(
  .vc-course-nav-head__copy h2,
  .vc-course-nav-current strong,
  .vc-course-nav-link__title,
  .vc-course-nav-section__title
) {
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark .vc-course-nav-drawer :where(
  .vc-course-nav-current__label,
  .vc-course-nav-link__meta,
  .vc-course-nav-head__copy p,
  .vc-course-nav-empty
) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  .hint,
  .vc-im-history-card > p,
  .vc-im-video-scope__label
) {
  color: var(--iehes-night-muted) !important;
  -webkit-text-fill-color: var(--iehes-night-muted) !important;
}

html.iehes-theme-dark #virtual-classroom .vc-notes-close {
  border-color: var(--iehes-night-border) !important;
  background: var(--iehes-night-surface-soft) !important;
  color: var(--iehes-night-text) !important;
  -webkit-text-fill-color: var(--iehes-night-text) !important;
}

html.iehes-theme-dark #virtual-classroom :where(
  #vc-save-note,
  #vc-im-start-live
) {
  border-color: #0b5d77 !important;
  background: #0369a1 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* Last-resort WCAG guard. JavaScript assigns one of these classes only when
 * the browser's computed foreground/background pair falls below 4.5:1. */
html.iehes-theme-dark .iehes-theme-auto-contrast-light {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  text-shadow: none !important;
}

html.iehes-theme-dark .iehes-theme-auto-contrast-dark {
  color: #020617 !important;
  -webkit-text-fill-color: #020617 !important;
  text-shadow: none !important;
}

/* Mi Cuaderno already owns its detailed dark palette. This global layer only
 * keeps the surrounding Astra shell continuous with it. */
html.iehes-theme-dark body.iehes-notebook-screen .site-content,
html.iehes-theme-dark body.iehes-notebook-screen .site-content > .ast-container,
html.iehes-theme-dark body.iehes-notebook-screen #content .ast-container,
html.iehes-theme-dark body.iehes-notebook-screen .ast-article-single {
  background: var(--iehes-night-page) !important;
}

html.iehes-theme-dark body.iehes-notebook-screen #masthead .site-primary-header-wrap,
html.iehes-theme-dark body.iehes-notebook-screen #masthead .ast-container {
  background: transparent !important;
}

@media (max-width: 921px) {
  #masthead .main-header-menu .iehes-theme-menu-item {
    width: 100%;
    padding: 4px 20px 12px !important;
  }

  #masthead .main-header-menu .iehes-theme-toggle {
    justify-content: flex-start;
    width: 100%;
    height: 48px;
    padding: 0 14px !important;
    border-color: rgba(181, 223, 235, 0.18) !important;
    background: rgba(7, 28, 45, 0.72) !important;
  }

  #masthead .main-header-menu .iehes-theme-toggle__label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    color: #d8e8ed;
    font-size: 13px;
    font-weight: 800;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  #masthead .main-header-menu .iehes-theme-toggle,
  .iehes-theme-fallback .iehes-theme-toggle {
    transition: none;
  }
}

@media print {
  .iehes-theme-menu-item,
  .iehes-theme-fallback {
    display: none !important;
  }
}
