/* [CG] SYNGLI-7039 retain artwork and metric colours while theming app surfaces. */
html[data-theme="dark"] :is(.behind_header, .footer_container,
    .course-detail, .info-modal-content, .info-modal-navigation,
    .info-modal-program-course, .network_context, .network_owner_card,
    :is(#contacts_area, #search_results) > .network_panel_header, .network_profile_network,
    .app_banner, #activity_rank, #stripe_form_container) {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(.footer_container a, .course-name,
    .featured-course-name, .course-details, .course-creator,
    .info-modal-navigation-option, .info-modal-details-table th,
    .info-modal-details-table td, .info-modal-reviews-text,
    .review-author, .review-text, .no-courses-found, .learn_no_courses,
    .network_owner_card, .network_context, .network_panel_header,
    .network_settings label, .network_context h3, .network_context h4,
    .app_banner, .app_link, .settings-menu-title, .settings-header) {
    color: var(--app-text);
}
html[data-theme="dark"] #top-nav :is(.inkles, #inkles, .inkle_count,
    .inkles_label, #equivMoney) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #networks .network_card,
html[data-theme="dark"] .network_card.syngli_sortable_helper {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
    border-top-color: var(--network-colour, var(--app-action));
}
html[data-theme="dark"] :is(#networks > .network_card,
    .network_card.syngli_sortable_helper).network_circle > a > .network_name {
    color: var(--app-text);
    background: color-mix(in srgb, var(--network-colour, #2875ab) 15%, #1b1f24);
}
html[data-theme="dark"] #networks .network_name_text {
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 the course tile menu hover takes the dark selection colour, not #DDDDDD under light text */
html[data-theme="dark"] :is(.nav.network_view_tabs > li > a,
    .nav.nav-tabs.network_view_tabs > li.active > a,
    .nav.nav-tabs.network_view_tabs > li.active > a:hover,
    #create_network, .info-modal-navigation-option.active,
    .info-modal-navigation-option:hover) {
    color: var(--app-text);
    background: var(--app-selection);
    border-color: var(--app-border);
}
html[data-theme="dark"] .nav.nav-tabs.network_view_tabs {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] #networks > #create_network {
    background: var(--app-surface-secondary);
    color: var(--app-action);
}
html[data-theme="dark"] .network_invitation_settings {
    background: var(--app-surface-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] .network_settings_form :is(label, legend) {
    color: var(--app-text-secondary);
}

/* [CG] Authoring and account surfaces share the same palette as learner pages. */
html[data-theme="dark"] :is(.courses_content, .course-tab-content,
    #courses_table-placeholder, #selected_table, #all_table,
    .account_card, .account_history, .premises-create_tags,
    .select2-selection--multiple, .select2-selection__choice,
    .CodeMirror, .CodeMirror-gutters) {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
/* [CL] SYNGLI-7037 the auto-populate button joins the other premises action buttons */
html[data-theme="dark"] :is(.premises-action_button, .premises-create_auto_population_button, .nr-tabs,
    .select2-selection__choice,
    .course-action_button, .course-menu_toggle, .course-dropdown_toggle,
    .course-option_button, .course-control, .course-dropdown_menu,
    .course_mode_dropdown_menu, .nr_button) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
}
/* [CG] Only the active Profile section receives a selected background. */
html[data-theme="dark"] #profile_sub_menu > li > a {
    background: transparent;
    color: var(--app-action);
    border: 2px solid transparent;
}
html[data-theme="dark"] #profile_sub_menu > li > a:hover {
    background: var(--app-surface-secondary);
    color: var(--app-text);
}
html[data-theme="dark"] #profile_sub_menu > li.active > a,
html[data-theme="dark"] #profile_sub_menu > li.active > a:hover,
html[data-theme="dark"] #profile_sub_menu > li.active > a:focus {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-divider);
}
html[data-theme="dark"] #profile_sub_menu > li > a:focus-visible {
    outline: 2px solid var(--app-focus);
    outline-offset: 2px;
}

/* [CG] Media filenames and dates need room to read in either appearance. */
#content_content:has(.media-navbar) #thumbnail_display #thumbnail_list_line li {
    height: auto;
    min-height: 38px;
    padding: 6px 0;
    gap: 4px;
    font-family: inherit;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.4;
    border-bottom-color: var(--app-divider);
}
#content_content:has(.media-navbar) #thumbnail_display .file-gallery_date {
    font-size: 12px;
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #content_content:has(.media-navbar)
    #thumbnail_list_line .selectable_li {
    background: var(--app-surface);
    color: var(--app-text);
}
html[data-theme="dark"] #content_content:has(.media-navbar)
    #thumbnail_list_line :is(.audio_list, .long_text_list, .long_seg_list) {
    background: transparent;
    color: inherit;
}
html[data-theme="dark"] #content_content:has(.media-navbar)
    #thumbnail_list_line :is(.segmentation_plus_button, .text_viewer_button,
    .audio_play_button, .image_view_button) {
    color: var(--app-text-secondary);
}

/* [CG] Include the newer segmentation panels from SYNGLI-7043. */
html[data-theme="dark"] #passage_segmentation :is(.media-seg_section,
    #segment_editor_toolbar) {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-divider);
}
html[data-theme="dark"] #passage_segmentation :is(.media-seg_heading,
    .media-seg_range_labels, .segment_editor_help) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #passage_segmentation :is(
    #segmentation-options label, .settings-div-primary) {
    color: var(--app-text);
}
html[data-theme="dark"] #passage_segmentation .suboption {
    background: var(--app-surface-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] #passage_segmentation #segmentation-options
    label:hover {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] #passage_segmentation #segmentation-options
    label:has(input:checked) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] #passage_segmentation :is(.media-seg_help,
    .media-seg_progress) {
    color: var(--app-action);
}
html[data-theme="dark"] #passage_segmentation input {
    accent-color: var(--app-action);
}
html[data-theme="dark"] #passage_segmentation :is(.media-seg_note,
    #segment_editor_count) {
    background: var(--app-selection);
    color: var(--app-text);
    border-color: var(--app-border);
}
/* [CL] segments alternate blue and green, each with its own border as in light mode, so
   neighbors stay apart on the dark pane; untested ones keep lighter grey stripes */
html[data-theme="dark"] #passage_segmentation :is(.media-seg-preview, .media-seg) {
    background: #24435c;
    color: var(--app-text);
    border-color: #4f8cbf;
}
html[data-theme="dark"] #passage_segmentation .media-seg--alt {
    background: #1f4530;
    border-color: #5fa36f;
}
html[data-theme="dark"] #passage_segmentation .media-seg--never {
    background: repeating-linear-gradient(135deg, #2c323a 0 6px, #363d45 6px 12px);
    color: var(--app-text-muted);
    border-color: #8b96a3;
}
/* [CL] keep the edit-mode hover border, which the rules above would otherwise hide */
html[data-theme="dark"] #passage_segmentation .media-seg-editing .media-seg:hover {
    border-color: var(--app-action);
}
html[data-theme="dark"] #passage_segmentation .btn {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] #passage_segmentation .btn:hover:not(:disabled) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] #passage_segmentation :is(
    #button-segment, #button-save) {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-action);
}
html[data-theme="dark"] .media-seg_help_option {
    background: var(--app-surface);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .media-seg_help_option dt,
html[data-theme="dark"] .media-seg_help_note {
    background: var(--app-selection);
    color: var(--app-text);
    border-color: var(--app-divider);
}
html[data-theme="dark"] :is(.media-seg_help_body,
    .media-seg_help_intro, .media-seg_help_option dd) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.premises-page_title, .account_card h2,
    .account_card h3, .account_card label, .course-header,
    .courses_content label, #create_new_course, .title h2,
    .form_title h3, .page_title h1) { color: var(--app-text); }
html[data-theme="dark"] :is(#course_content_default > .course-tab-content,
    #course_content_default .nr-tabs, #relation_search_div,
    #tags_search_div, #tags_search_div .select2-selection--multiple) {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(#course_content_default li.active .nr-tabs,
    .course-option_button.active, .course-option_button:has(input:checked)) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] :is(.nr-tabs .course_name_text,
    .course-tab_name_text, .course-explanation_detail_title,
    .course-dropdown_menu li > a, .syngli-text_button) {
    color: var(--app-text);
}
html[data-theme="dark"] :is(.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected) {
    background: var(--app-selection);
}
html[data-theme="dark"] .CodeMirror-cursor { border-left-color: var(--app-text); }
html[data-theme="dark"] .CodeMirror-linenumber { color: var(--app-text-muted); }
html[data-theme="dark"] .cm-s-default .cm-keyword { color: #d6a7ff; }
html[data-theme="dark"] .cm-s-default .cm-string { color: #a5d6a7; }
html[data-theme="dark"] .cm-s-default .cm-number { color: #f6b26b; }
html[data-theme="dark"] .cm-s-default .cm-comment { color: #a3acb7; }
html[data-theme="dark"] .cm-s-default .cm-property { color: #a4c5ff; }
html[data-theme="dark"] .cm-s-default .cm-tag { color: #8ddbbd; }
html[data-theme="dark"] .cm-s-default .cm-attribute { color: #ffd086; }

/* [CG] Shared page sizing; individual pages can override the maximum. */
:root {
    --app-content-width: 80%;
    --app-content-max-width: 1400px;
}
html .syngli-page {
    box-sizing: border-box;
    width: var(--app-content-width);
    max-width: var(--app-content-max-width);
    margin-left: auto;
    margin-right: auto;
}
.syngli-page--form {
    --app-content-max-width: 1100px;
}
/* [CG] These responsive pages must not inherit the legacy 420px body minimum. */
html body:has(:is(#course_content_default, #history_container,
    #programs_content, #bundles_content)) {
    min-width: 0;
}
html :is(#course_content_default, #history_container, #programs_content, #bundles_content) {
    padding-left: 0;
    padding-right: 0;
}
html #history_container { display: block; }
#history_container .stats_history_table_placeholder {
    width: 100%;
    margin-left: 0;
}
@media (max-width: 480px) {
    :root { --app-content-width: 90%; }
}

/* [CG] Course authoring: selected rows, late Select2 styles and loading masks. */
html[data-theme="dark"] #course_content_default {
    background: transparent;
    --course-loading-surface: var(--app-surface);
    --course-loading-text: var(--app-text-secondary);
}
html[data-theme="dark"] #course_content_default :is(.select2-selection--multiple,
    #relation_search, #course_tags_input,
    .select2-search__field, #selected_course_info) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
    box-shadow: none;
}
html[data-theme="dark"] #course_content_default :is(.course-header,
    .course-tab-list, .nr-tabs) .syngli-icon {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #course_content_default li.active .nr-tabs {
    border-bottom-color: var(--app-selection) !important;
}
html[data-theme="dark"] :is(.course-option_button, .course-control,
    .course-dropdown_toggle, .course-mode-column) :is(.caret, .fa) {
    color: inherit;
}
html[data-theme="dark"] #course_content_default :is(.course-relations-status,
    #courses_table-placeholder) { background: var(--app-surface); }
html[data-theme="dark"] .course-relations-status[data-state="error"] {
    color: var(--app-error);
}

/* [CG] Legacy tables remain in Library and in some embedded selectors. */
html[data-theme="dark"] :is(.table, .nr-theader, .nr-tbody, .nrtable-zebra,
    .tablesorter-header, .grey) {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-divider);
}
html[data-theme="dark"] :is(.table, .nr-theader, .nr-tbody) :is(thead, th) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
}
html[data-theme="dark"] :is(.nrtable-zebra, .table-striped > tbody > tr:nth-of-type(odd)) {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] #library_content :is(.library-icon, .fa-eye,
    .glyphicon, .library_course_name, .nr-title, .nr-table_text) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #library_content :is(.icon-learn, .icon-test) {
    filter: none;
}
html[data-theme="dark"] .syngli-modal-body :is(.nrtable-zebra,
    .premises-zebra_row, .premises-zebra_row td) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
}
/* [CL] SYNGLI-7066 striped rows paint their cells, which hid the row hover on every other row */
html[data-theme="dark"] .syngli_table tbody tr.premises-zebra_row:hover,
html[data-theme="dark"] .syngli_table tbody tr.premises-zebra_row:hover td {
    background-color: var(--syngli-table-hover);
}

/* [CG] Editors must pair selection backgrounds with readable foregrounds. */
html[data-theme="dark"] :is(.syngli-modal-body, .premises-page_body,
    .premises-create_shell) :is([contenteditable="true"], .item_list_input,
    .pc_relation, #relation_before_A, #relation_between_two, #relation_after_B) {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(.CodeMirror, .syngli-modal-body,
    .premises-page_body, .premises-create_shell) ::selection {
    background: var(--app-selection);
    color: var(--app-text);
}
html[data-theme="dark"] :is(.CodeMirror-selectedtext,
    .CodeMirror-focused .CodeMirror-selectedtext) { color: var(--app-text); }
html[data-theme="dark"] :is(.syngli-editor_lang_item,
    .syngli-editor_file_item, .syngli-editor_file_tab).is-selected {
    background: var(--app-selection);
    color: var(--app-text);
}

/* [CG] Media's side panel is app furniture, distinct from media previews. */
html[data-theme="dark"] :is(#file_gallery, #file_information, #file_details,
    #display_file_information, #file_dropzone, #file_dropzone_info,
    #total_files, #gallery_sort_menu, .file_information,
    .audio_list, .long_text_list, .long_seg_list) {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(#gallery_sort_menu li, #total_files_badge,
    #selected_files_badge, #text-content) { color: var(--app-text); }
html[data-theme="dark"] #gallery_sort_menu li:is(:hover, .is-selected) {
    background: var(--app-selection);
}
html[data-theme="dark"] .media-layout > .pane {
    background: var(--app-surface-secondary) !important;
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] :is(.overview_tag_unselected, .network_shared_course,
    .network_courses_section, .network_course_count) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] .overview_tag_selected {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-action);
}
html[data-theme="dark"] .network_shared_course > span:not(.network_course_icon) {
    color: var(--app-text);
}
html[data-theme="dark"] .account_balance {
    background: var(--app-surface);
    color: var(--app-text);
}
/* [CL] keep the light theme's hierarchy: a softer amount, muted unit and breakdown */
html[data-theme="dark"] .account_balance_amount { color: var(--app-text-secondary); }
html[data-theme="dark"] :is(.account_balance_unit, .account_balance_breakdown) {
    background: transparent;
    color: var(--app-text-muted);
}
html[data-theme="dark"] :is(.account_card_title, .account_card_label,
    .account_upgrade p, .network_courses_heading) { color: var(--app-text-secondary); }

/* [CG] Keep neutral interface colours soft at both ends of the dark palette. */
html[data-theme="dark"] .syngli-icon.dark { color: var(--app-text-secondary); }
html[data-theme="dark"] .syngli-icon.dark:hover { color: var(--app-action); }
html[data-theme="dark"] :is(.program_secondary_button,
    .programs_eyebrow, .program_icon_button, .program_course_order,
    #program_course_count, #bundle_course_count) { color: var(--app-action); }
html[data-theme="dark"] :is(#upload_panel,
    .premises-create_mode_switch) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] #content_content .nav-tabs > li.active > a {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(#upload_panel_placeholder_text,
    #upload_panel_placeholder_hint, #upload_panel_placeholder .fa) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.gauge__min_value, .gauge__max_value) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background: var(--app-surface-secondary);
}

/* [CG] CodeMirror's active line is separate from its text selection layer. */
html[data-theme="dark"] :is(.CodeMirror-activeline-background,
    .CodeMirror-activeline-gutter, .CodeMirror-activeline .CodeMirror-linenumber) {
    background: var(--app-selection);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.syngli-editor_lang_item,
    .syngli-editor_file_item, .syngli-editor_file_tab,
    .premises-create_tag_chip, .premises-create_panel_header) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .syngli-editor_file_tab.is-active {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-action);
}

html[data-theme="dark"] #course_content_default :is(table, th, td) {
    border-color: var(--app-divider);
}
html[data-theme="dark"] :is(#programs_content, #bundles_content) :is(
    .programs_card, .bundle_pricing_type > label, .bundles_currency,
    .programs_table_shell, th, td) {
    border-color: var(--app-divider);
}
html[data-theme="dark"] .program_primary_button {
    background: var(--app-action);
    color: var(--app-on-action);
    border-color: var(--app-action);
}
html[data-theme="dark"] .program_primary_button:is(:hover, :focus) {
    background: var(--app-focus);
    color: var(--app-on-action);
}

html[data-theme="dark"] .program_group_status {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .program_group_row.is_editing .program_group_status {
    background: #493f24;
    color: #e3cc91;
}
html[data-theme="dark"] :is(#program_warning, #bundle_warning).program_message_success {
    background: var(--app-success-surface);
    color: var(--app-success);
    border-color: var(--app-success);
}
html[data-theme="dark"] :is(#program_warning, #bundle_warning).program_message_error {
    background: var(--app-error-surface);
    color: var(--app-error);
    border-color: var(--app-error);
}
html[data-theme="dark"] :is(.program_delete_button, .program_group_delete_button,
    .program_remove_course_button, .bundle_delete_button,
    .bundle_remove_course_button):is(:hover, :focus) {
    background: var(--app-error-surface);
    color: var(--app-error);
}

/* [CG] Shared course menus keep their text and active state in both appearances. */
html[data-theme="dark"] #side-menu #course_list label.course_label_list {
    color: var(--app-text-secondary) !important;
    border-color: var(--app-divider) !important;
}
html[data-theme="dark"] #side-menu #course_list label.course_label_list.active {
    background: var(--app-selection) !important;
    color: var(--app-action) !important;
}
html[data-theme="dark"] :is(.mm-title, .mm-navbar, .mm-header,
    .stats_side_menu_header, .stats_side_menu_header button,
    .stats_course_type_button, .course-list) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-divider);
}
/* [CG] Dialog controls inherit colours even when their styles load late. */
html[data-theme="dark"] :is(.syngli_btn, .syngli_btn_secondary,
    .syngli_dropdown_toggle, .syngli_dropdown_menu, .syngli_table_column_label,
    .syngli_table_column_actions, .syngli-editor_relation_tag,
    .syngli-editor_relation_preview, .syngli-editor_relation_help,
    .course-virtual_relation_chip, .presentation-order_table,
    .presentation-order_table thead, .premises-preview_card,
    .premises-preview_question, .premises-preview_empty, .premises-preview_loading,
    .premises-preview_meta_value, .premises-preview_item_audio_select) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(.premises-preview_label,
    .premises-preview_counter, .presentation-order_relation,
    .presentation-order_help, .course-virtual_relation_text,
    .syngli-editor_relation_tag, .syngli-editor_relation_preview,
    .syngli_table_column_menu a, .syngli_table_column_menu label,
    .syngli_table_column_menu button) { color: var(--app-text-secondary); }
html[data-theme="dark"] .premises-preview_itemA_wrap {
    background: var(--app-selection);
    color: var(--app-text);
}
html[data-theme="dark"] :is(.premises-preview_nav .btn,
    .premises-preview_edit_cancel, .presentation-order_moves button,
    .syngli_table_column_actions button) {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(.syngli_dropdown_menu li > a:hover,
    .syngli_table_column_label:hover, .language_li:hover) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] :is(.syngli-modal-body, .syngli-panel_body) code {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .presentation-order_table :is(th, td) {
    border-color: var(--app-divider);
}
html[data-theme="dark"] .presentation-order_itemA { color: var(--app-action); }

/* [CG] The shared legal content also appears inside update-notice dialogs. */
html[data-theme="dark"] :is(.info_content, .memberbox,
    .careers-position-title, .careers-position-content) {
    background-color: var(--app-page);
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] :is(#terms, #privacy, #careers, #contact,
    .info_content, .memberbox) :is(p, li, h2, h3, h4, small, .membertitle) {
    color: var(--app-text-secondary);
    text-shadow: none;
}
html[data-theme="dark"] .memberbox h3.membertitle { color: var(--app-text); }
html[data-theme="dark"] .org_logo {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--app-divider);
    border-radius: 8px;
    background: var(--app-surface);
}
html[data-theme="dark"] .org_logo img {
    width: auto;
    max-width: 100%;
    height: 72px;
    object-fit: contain;
}
/* [CL] SYNGLI-7037 footer icon hovers use the dark button blue; the light-blue action colour glared */
html[data-theme="dark"] .footer_container a:is(:focus, :hover) .footer-icon .st0 {
    fill: var(--app-primary-button-hover);
}
html[data-theme="dark"] #select_language .language_li {
    color: var(--app-text);
    border-color: var(--app-divider);
}

/* [CG] Account members, network identities and stats filters use readable labels. */
html[data-theme="dark"] :is(.account_member_name, .account_member_initials,
    .network_owner_name, .network_owner_title, .network_profile_identity h4,
    .network_context_description, .network_about_heading,
    .network_members_header, .network_members_title, .contacts_heading,
    #contacts_area .contact_name, #contacts_area .user_name,
    .stats_searchable_menu .user_name, .stats_searchable_menu .network_name,
    .stats_learning_filters .user_name, .stats_learning_filters .network_name,
    .stats_user_network_badge, .stats_user_network_more,
    .stats_user_network_overflow, .stats_history_source_badge,
    .stats_history_current_course, .stats_history_metric_basis) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.account_member_initials, .network_owner_badge,
    .stats_user_network_badge, .stats_user_network_more,
    .stats_user_network_overflow, .stats_history_source_badge,
    .stats_history_current_course, .stats_history_metric_basis,
    .stats_argument_completion_toggle button) {
    background: var(--app-surface-secondary);
    border-color: var(--app-divider);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.stats_argument_completion_toggle button.selected,
    .stats_user_network_more:hover) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] :is(.network_owner_email, .network_profile_email) {
    color: var(--app-text-muted);
}
/* [CG] A grid placeholder must not impose a fixed extra track while dragging. */
#networks > .network_card_placeholder {
    width: auto !important;
    min-width: 0;
    max-width: 100%;
}

/* [CG] Course detail overlays and large Dashboard cards retain metric colours. */
html[data-theme="dark"] :is(.course-description, .course-details,
    .info-modal-store-text, .info-modal-program-title,
    .info-modal-program-group-title, .comment_text, .review-text,
    .review-author, .rating_text, .info-modal-details-table tr th,
    .info-modal-details-table tr td) { color: var(--app-text-secondary); }
html[data-theme="dark"] .info-modal-details-table tr:nth-child(odd) {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] :is(.info-modal-navigation-option .fa,
    .course-detail .fa, .course-detail .glyphicon) { color: var(--app-text-secondary); }
html[data-theme="dark"] :is(.info-modal-button, .info-modal-button-half,
    .info-modal-button-icon) {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] .info-modal-button-like-hide { color: var(--app-action); }
/* [CL] SYNGLI-7037 the light-mode blue icon circles on Edit and the half-width buttons outranked the rule above */
html[data-theme="dark"] :is(.info-modal-button.blue, .info-modal-button-half) .info-modal-button-icon {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] :is(.vex .modal-section-text, .tutorial-content) { color: var(--app-text-secondary); }
html[data-theme="dark"] #library_content :is(.btn-success, .btn-danger) {
    background: var(--app-surface-secondary);
    border-color: var(--app-border);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #library_content .btn-success { color: var(--app-success); }
html[data-theme="dark"] #library_content .btn-danger { color: var(--app-error); }

html[data-theme="dark"] :is(.network_members_heading, #search_results_bar, #no_results,
    .contact_bubble_title, .contact_bubble_email, .contact_bubble_email_duplicate,
    .contact_bubble_networks, .network_owner_badge, .stats_side_menu_header a,
    .course_list_title) { color: var(--app-text-secondary); }
html[data-theme="dark"] #contacts_area .contact_bubble_label a {
    color: var(--app-text);
}
/* [CL] SYNGLI-7033 the search results label and empty-state box on dark surfaces */
html[data-theme="dark"] #search_results_bar { border-color: var(--app-divider); }
html[data-theme="dark"] #search_results_bar .close:hover { background: var(--app-surface-secondary); }
html[data-theme="dark"] #no_results {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text-muted);
}
html[data-theme="dark"] :is(.network_owner_badge, .course-virtual_relation_chip) {
    background: var(--app-surface-secondary);
    border-color: var(--app-divider);
}

html[data-theme="dark"] :is(#tab-setting, #button_setting,
    .dashboard_stats_tooltip, .jumbotron) {
    background-color: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] :is(#button_setting .setting_list_name,
    .account_page .user_name, .account_page .account_member_name span,
    .stats_learning_filters label, .history #users, .history #networks,
    #button_setting_icon) { color: var(--app-text-secondary); }
html[data-theme="dark"] #contacts_area .contact_bubble {
    /* [CG] Legacy member rendering sets its card surface inline. */
    background-color: var(--app-surface) !important;
    border-color: var(--app-divider);
}
html[data-theme="dark"] .contact_bubble.syngli_sortable_helper {
    background-color: var(--app-surface) !important;
}
html[data-theme="dark"] .network_avatar_initials {
    background: transparent;
    color: inherit;
}

html[data-theme="dark"] #library_content .errors {
    background: var(--app-error-surface);
    color: var(--app-error);
}
html[data-theme="dark"] #library_content .no_errors {
    background: var(--app-success-surface);
    color: var(--app-success);
}
html[data-theme="dark"] :is(.stats_list_view_button,
    .stats_program_button, .stats_program_course) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .stats_list_view_button.active,
html[data-theme="dark"] .account_tabs.nav-tabs > li.active > a {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-divider);
}
html[data-theme="dark"] #family_member_table .syngli_table :is(th, td) {
    color: var(--app-text-secondary);
}

html[data-theme="dark"] #library_content .slider {
    background-color: var(--app-error-surface);
    border: 1px solid var(--app-border);
}
html[data-theme="dark"] #library_content input:checked + .slider {
    background-color: var(--app-success-surface);
}
html[data-theme="dark"] #library_content .slider:before {
    background-color: var(--app-text-secondary);
}

html[data-theme="dark"] :is(.premises-relation_pagination_status,
    .premises-pagination_page) { color: var(--app-text-muted); }
html[data-theme="dark"] #course_content_default .syngli-text_button {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] .presentation-order_row--focused {
    background: var(--app-selection);
}

html[data-theme="dark"] .syngli-text_button {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] :is(.title-bar-button, .modal_left, .modal_right) {
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .title-bar-button-active {
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] .modal_circle { background: var(--app-border); }
html[data-theme="dark"] .modal_circle.active { background: var(--app-action); }

/* [CG] Media selection uses the same quiet blue for tabs, files and drag ranges. */
html[data-theme="dark"] #content_content .nav-tabs > li > a {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] #content_content .nav-tabs > li.active > a,
html[data-theme="dark"] #content_content .nav-tabs > li > a:focus {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] #thumbnail_display .selectable_li:hover {
    /* [CG] Gallery mouse handlers still set their old hover colour inline. */
    background-color: var(--app-surface-secondary) !important;
    color: var(--app-text);
}
html[data-theme="dark"] #thumbnail_display .selectable_li.gallery_selected {
    background-color: var(--app-selection) !important;
    color: var(--app-text);
    box-shadow: inset 3px 0 var(--app-action);
}
html[data-theme="dark"] .selectable_li.gallery_selected :is(
    .audio_list, .long_text_list, .long_seg_list) {
    background: transparent;
    color: var(--app-text);
}

html[data-theme="dark"] .file-gallery_batch_badge {
    /* [CG] These batch colours were applied inline by the legacy gallery. */
    background-color: hsl(var(--batch-hue, 210), 30%, 20%) !important;
    color: hsl(var(--batch-hue, 210), 45%, 80%) !important;
    border-color: hsl(var(--batch-hue, 210), 30%, 42%) !important;
}
html[data-theme="dark"] .file-gallery_batch_badge.is-active {
    background-color: hsl(var(--batch-hue, 210), 35%, 28%) !important;
}

html[data-theme="dark"] #sharing_module :is(.course-network_panel,
    .list-group, .list-group-item, .list-group-item.disabled) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}

html[data-theme="dark"] #sharing_module .list-group.checked-list-box
    .list-group-item:is(.active, .list-group-item-primary) {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-border);
}
html[data-theme="dark"] .presentation-order_table th {
    background: var(--app-surface-secondary);
    color: var(--app-text);
}
html[data-theme="dark"] .presentation-order_itemB { color: var(--app-error); }
html[data-theme="dark"] .premises-preview_header {
    border-color: var(--app-divider);
}

/* [CG] These are app-owned monochrome navigation icons, not course artwork. */
html[data-theme="dark"] .info-modal-navigation-option > img[src^="/images/icon_"] {
    filter: brightness(0) invert(.8);
}

/* [CG] Walkthrough headers and file-type tabs use the shared dark surfaces. */
html[data-theme="dark"] .vex.vex-theme-default .title-bar {
    background: var(--app-surface-secondary);
    color: var(--app-text);
}
html[data-theme="dark"] .vex.vex-theme-default .title-bar-button {
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .vex.vex-theme-default .title-bar-button-active {
    color: var(--app-text);
    background: var(--app-selection);
    border-color: var(--app-border);
}
html[data-theme="dark"] .syngli-editor_file_tabs {
    border-color: var(--app-divider);
}
html[data-theme="dark"] .syngli-editor_file_tab {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] .syngli-editor_file_tab:is(.is-active, :hover) {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-action);
}
html[data-theme="dark"] .premises-page_body .badge {
    background: var(--app-surface-elevated);
    color: var(--app-text);
    border: 1px solid var(--app-border);
}
html[data-theme="dark"] .premises-page_body .pc_badge {
    background: var(--app-selection);
    color: var(--app-action);
}
html[data-theme="dark"] .footer_container a:is(:hover, :focus)
    :is(#google_play_store_link, #apple_app_store_link),
html[data-theme="dark"] .footer_container
    :is(#google_play_store_link, #apple_app_store_link):hover {
    background: var(--app-primary-button);
}
html[data-theme="dark"] .footer_container a:is(:hover, :focus)
    :is(#google_play_store_link, #apple_app_store_link) i {
    color: #fff;
}
html[data-theme="dark"] #social_menu .google_btn,
html[data-theme="dark"] #social_menu .g_id_signin,
html[data-theme="dark"] #social_menu .g_id_signin iframe {
    background: transparent;
}
/* [CG] Keep the embedded provider canvas from inheriting forced dark colours. */
html[data-theme="dark"] #social_menu .g_id_signin iframe {
    color-scheme: normal;
}

/* [CG] Account history remains readable before and after changing tabs. */
html[data-theme="dark"] .account_page {
    --account-placeholder: var(--app-divider);
}
html[data-theme="dark"] .account_page .account_tabs {
    border-color: var(--app-divider);
}
html[data-theme="dark"] .account_page .account_tabs > li > a {
    color: var(--app-text-secondary);
    background: transparent;
}
html[data-theme="dark"] .account_page .account_tabs > li.active > a,
html[data-theme="dark"] .account_page .account_tabs > li > a:is(:hover, :focus) {
    color: var(--app-action);
    background: var(--app-selection);
    border-bottom-color: var(--app-action);
}
html[data-theme="dark"] .account_page .syngli_table :is(th, td),
html[data-theme="dark"] .account_page :is(.syngli_table_no_results,
    .syngli_table_message, .syngli_table_placeholder) {
    color: var(--app-text-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .account_page .syngli_table thead {
    border-bottom: 1px solid var(--app-divider);
}

/* [CG] Disabled profile actions stay muted without fading their text away. */
html[data-theme="dark"] .save_form_button .btn:is(.disabled, :disabled) {
    background: var(--app-surface-secondary);
    /* [CG] Override the legacy generic .disabled text colour. */
    color: var(--app-text-muted) !important;
    border-color: var(--app-border);
    opacity: 1;
    text-shadow: none;
}

/* [CG] Compact member previews blend into their card without white corners. */
html[data-theme="dark"] :is(#networks > .network_card,
    .network_card.syngli_sortable_helper).network_circle
    .network_members > .contact_bubble {
    border-color: var(--app-surface);
    background: var(--app-surface);
    overflow: hidden;
}
html[data-theme="dark"] :is(#networks > .network_card,
    .network_card.syngli_sortable_helper).network_circle
    .network_members > .contact_bubble > .panel-body {
    background: transparent;
    border-radius: inherit;
}

/* [CG] Library's legacy sharing editor needs explicit open and menu states. */
html[data-theme="dark"] #library_content .dropdown-toggle.btn-default {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
    box-shadow: none;
}
html[data-theme="dark"] #library_content .open > .dropdown-toggle.btn-default,
html[data-theme="dark"] #library_content .dropdown-toggle.btn-default:is(:hover, :focus) {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-action);
}
html[data-theme="dark"] #library_content .dropdown-menu > li > a {
    background: var(--app-surface);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #library_content .dropdown-menu > li > a:is(:hover, :focus) {
    background: var(--app-selection);
    color: var(--app-text);
}
html[data-theme="dark"] #library_content .library-sharing-dropdown
    :is(.network_name, .state-icon) {
    color: inherit;
}
html[data-theme="dark"] #library_content :is(.nr-network-private, .nr-network-multiple) {
    background: var(--app-surface-secondary);
    border-color: var(--app-text-secondary);
}
html[data-theme="dark"] #library_content .nr-network-public {
    background: var(--app-text-muted);
}

/* [CL] SYNGLI-7037 text the dark-mode contrast audit found below the readability guideline */
html[data-theme="dark"] .relation_AB { color: var(--app-action); }
html[data-theme="dark"] :is(.relation_AB.relation_B, .relation_B) { color: var(--app-error); }
html[data-theme="dark"] .syngli-tag-badge {
    color: var(--app-text);
    border-color: var(--app-border);
}
html[data-theme="dark"] .premises-premise_search_toggle { color: var(--app-text-secondary); }
/* [CL] SYNGLI-7066 solid explanation icons look brighter than the row's thin text in the same colour */
html[data-theme="dark"] :is(.premises-explanation_variants_icon, .premises-page_body .glyphicon-info-sign,
    .syngli_table_premises_view .glyphicon-info-sign) { color: var(--app-text-secondary); }
html[data-theme="dark"] #gallery_batch_tags_toggle.active {
    background-color: var(--app-selection);
    border-color: var(--app-action);
}
html[data-theme="dark"] :is(#programs_content, #bundles_content) .bundles_table_header {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #networks > #create_network > a,
html[data-theme="dark"] #networks > #create_network .create_network_title {
    color: var(--app-action);
}
html[data-theme="dark"] :is(#networks > .network_card, .network_card.syngli_sortable_helper).network_circle
    > .network_card_member_count {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .jsgrid-header-row > .jsgrid-header-cell {
    background: var(--app-surface-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] .navbar-brand { color: var(--app-text-muted); }
/* [CL] SYNGLI-7037 colours darkened for light-mode contrast need their own dark-mode values */
html[data-theme="dark"] .pc_prefix_span { color: var(--app-action); }
html[data-theme="dark"] :is(.sg-dropdown-header.active, .sg-dropdown-item.active,
    .sg-dropdown:has(.sg-dropdown-item.active) > .sg-dropdown-header) {
    /* [CL] SYNGLI-7037 half-way to the normal text colour: still clearly the current page, less glaring */
    color: color-mix(in srgb, var(--app-action) 55%, var(--app-text)) !important;
}
html[data-theme="dark"] #program_selected_courses_empty > td { color: var(--app-text-muted); }
html[data-theme="dark"] .network_settings_form .network_invitation_settings .help-block {
    color: var(--app-text-muted);
}
html[data-theme="dark"] #bundle_selected_courses_empty > td { color: var(--app-text-muted); }
html[data-theme="dark"] .password_reset .password_reset_link { color: var(--app-action); }
html[data-theme="dark"] .required_field_msg { color: var(--app-error); }
html[data-theme="dark"] :is(.sg-dropdown-selected, .current_page, .inkles:hover, .sg-dropdown-item:hover,
    .footer_container a:not(.footericon):is(:hover, :active, :focus)) {
    color: var(--app-action);
}
/* [CL] SYNGLI-7037 an unstyled button gets the browser's own grey in dark mode */
html[data-theme="dark"] #add_an_account {
    background: var(--app-surface-secondary);
    border: 1px solid var(--app-border);
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 SYNGLI-7055 Select2's own tag box, chip and result colours outrank the shared dark rules */
html[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background: var(--app-surface);
    border-color: var(--app-border);
}
html[data-theme="dark"] .select2-container--default.select2-container--disabled .select2-selection--multiple {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] .select2-container--default .select2-search__field {
    color: var(--app-text);
}
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--app-surface-secondary);
    color: var(--app-text);
    border-color: var(--app-border);
    box-shadow: none;
}
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--app-text-muted);
    border-color: var(--app-border);
}
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:is(:hover, :focus) {
    background: var(--app-selection);
    color: var(--app-text);
}
html[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--app-surface-secondary);
    border-color: var(--app-border);
}
html[data-theme="dark"] .select2-container--default .select2-results__option--selected {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--app-selection);
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 "Searching…" and "No results found" rows */
html[data-theme="dark"] .select2-results :is(.select2-results__message, .loading-results) {
    background: var(--app-surface-secondary);
    color: var(--app-text-muted);
}
/* [CL] SYNGLI-7037 course dropdown items (e.g. the course mode menu) turned near-white on hover */
html[data-theme="dark"] .course-dropdown_menu li > a:is(:hover, :focus) {
    background: var(--app-selection);
    color: var(--app-text);
}
html[data-theme="dark"] .ai_valid_premise_status_label {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
/* [CL] SYNGLI-7037 once an input gets a background colour Chrome draws its old 2px bevelled border; keep
   number boxes flat like the rest of the dark inputs */
html[data-theme="dark"] input[type="number"] {
    border: 1px solid var(--app-border);
    border-radius: 3px;
}
/* [CL] SYNGLI-7037 a checked but disabled option (e.g. reward types while reward is off) should not look active */
html[data-theme="dark"] .course-option_button:has(input:checked:disabled) {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
/* [CL] SYNGLI-7037 Bootstrap tab bars (e.g. Library's my courses / available courses): the selected tab stayed
   white and tabs turned light grey on hover */
html[data-theme="dark"] .nav-tabs > li.active > a,
html[data-theme="dark"] .nav-tabs > li.active > a:is(:hover, :focus) {
    background: var(--app-selection);
    color: var(--app-action);
    border-color: var(--app-border) var(--app-border) transparent;
}
html[data-theme="dark"] .nav > li > a:is(:hover, :focus) {
    background: var(--app-hover);
    color: var(--app-text);
}
html[data-theme="dark"] .nav-tabs {
    border-bottom-color: var(--app-border);
}
/* [CL] SYNGLI-7037 Overview's user dropdown has a white background set by id, and dropdown options inherit
   the select's background, which left light text on white */
html[data-theme="dark"] #overview-select-user {
    background: var(--app-surface);
    color: var(--app-text);
}
html[data-theme="dark"] .overview-users-options {
    border-color: var(--app-border);
}
html[data-theme="dark"] select option {
    background-color: var(--app-surface);
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 Bootstrap turns plain buttons (btn-default, e.g. the Dashboard toggle handle) white on hover */
html[data-theme="dark"] .btn-default:is(:hover, :focus, :active, .active),
html[data-theme="dark"] .open > .dropdown-toggle.btn-default {
    background: var(--app-hover);
    color: var(--app-text);
    border-color: var(--app-border);
}
/* [CL] SYNGLI-7037 toggle switches (Dashboard recent/remote, passage completion response type) use a soft grey
   knob in dark mode instead of white; SYNGLI-7066 moved them to .syngli_switch */
html[data-theme="dark"] .syngli_switch {
    background-color: var(--app-hover);
    border-color: var(--app-border);
}
html[data-theme="dark"] .syngli_switch_handle {
    background-color: var(--app-text-muted);
    border-color: var(--app-text-muted);
}
html[data-theme="dark"] .syngli_switch:hover .syngli_switch_handle {
    background-color: var(--app-text-secondary);
}
/* [CL] SYNGLI-7037 the invitation count's saturated red glares on dark pages; a softer red still reads as a badge */
html[data-theme="dark"] .network_invitation_count {
    background: #a8393c;
    color: #fbeaea;
}
/* [CL] SYNGLI-7033 the card invitation dot and the user menu count use the same softer red;
   the dot's ring takes the card colour instead of white */
html[data-theme="dark"] :is(#networks > .network_card, .network_card.syngli_sortable_helper).network_circle .network_invitation_dot {
    background: #a8393c;
    border-color: var(--app-surface);
}
/* [CL] SYNGLI-7037 every count badge, not just the Networks one, so none stay pure red in dark mode */
html[data-theme="dark"] .icon-badge {
    background-color: #a8393c;
    color: #fbeaea;
}
/* [CL] SYNGLI-7033 member profile pop-up: last login box, network rows and text on dark surfaces */
html[data-theme="dark"] .network_profile_identity h4,
html[data-theme="dark"] .network_profile_activity dd { color: var(--app-text); }
html[data-theme="dark"] :is(.network_profile_email, .network_profile_activity dt,
    .network_profile_network small, .network_profile_note) { color: var(--app-text-muted); }
html[data-theme="dark"] .network_profile_activity { background: var(--app-surface-secondary); }
html[data-theme="dark"] .network_profile_network {
    background: var(--app-surface-elevated);
    border-color: var(--app-divider);
    color: var(--app-text);
}
html[data-theme="dark"] .network_profile_network:hover { background: var(--app-hover); }

/* [CL] SYNGLI-7037 Create-premises labels use a bold font, so full-strength text glares in dark mode */
html[data-theme="dark"] :is(#create_new_premises_header .premises-page_title,
    .premises-create_relation_label, .premises-create_status_label,
    .premises-create_item_label) {
    color: var(--app-text-secondary);
}
html[data-theme="dark"] :is(.premises-create_mode_button-active,
    .premises-create_mode_button[aria-pressed='true']) {
    background: var(--app-surface-elevated);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] #help_relation .fa-question-circle { color: var(--app-text-secondary); }
html[data-theme="dark"] #help_relation:is(:hover, :focus) .fa-question-circle { color: var(--app-action); }

/* [CL] Large empty-state messages (26px) glare at full strength in dark mode: use muted text */
html[data-theme="dark"] :is(.stats_no_data_msg, span.no_data_msg) { color: var(--app-text-muted); }

/* [CL] SYNGLI-7037 the Buy Inkles dialog: its own sheet sets light colours, so match the dark palette here */
html[data-theme="dark"] #stripe_modal_payment :is(.modal-content, .payment_dialog_header, .modal-body,
    .modal-footer) {
    background: var(--app-surface-elevated);
    color: var(--app-text);
}
html[data-theme="dark"] #stripe_modal_payment :is(.payment_dialog_title, #purchase_name_on_payment,
    #purchase_price_on_payment) {
    color: var(--app-text);
}
html[data-theme="dark"] #stripe_modal_payment :is(.payment_dialog_close, .payment_dialog_amount_hint,
    .payment_dialog_total_label, #digital_purchase_term, #recaptcha_disclosure, .purchase_email_intro) {
    color: var(--app-text-muted);
}
html[data-theme="dark"] #stripe_modal_payment :is(.payment_dialog_close:hover, .payment_dialog_close:focus) {
    color: var(--app-text);
}
html[data-theme="dark"] #stripe_modal_payment #purchase_name_and_price {
    background: var(--app-surface-secondary);
    border-color: var(--app-divider);
}
html[data-theme="dark"] #stripe_modal_payment :is(#costAmount, .form-control) {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] #stripe_modal_payment #costAmount:focus {
    border-color: var(--app-action);
}
html[data-theme="dark"] #stripe_modal_payment #costAmount[readonly] {
    background: var(--app-surface-secondary);
}
html[data-theme="dark"] #stripe_modal_payment :is(.payment_dialog_powered, .purchase_email_links .btn-link) {
    color: var(--app-action);
}
html[data-theme="dark"] #stripe_modal_payment :is(#digital_purchase_term a, #recaptcha_disclosure a) {
    color: var(--app-action);
}

/* [CL] SYNGLI-7037 heading bars (Dashboard's Overall Stats and My Courses, and the same bars on other pages):
   a muted blue with soft text instead of the bright gradient and pure white */
html[data-theme="dark"] .section_title:is(._syngli_heading_color, ._course) {
    background-color: #1f3b54;
    background-image: linear-gradient(#24455f, #1a3247);
    color: var(--app-text);
}
html[data-theme="dark"] .section_title:is(._syngli_heading_color, ._course)
    :is(.glyphicon-info-sign, .my-courses-pagination, .toggle-text) {
    color: var(--app-text-muted);
}
html[data-theme="dark"] .creator-img { border-color: var(--app-border); }
html[data-theme="dark"] .course-rating { color: var(--app-text-muted); }

/* [CL] SYNGLI-7037 premise editor pop-up: the search banner, picker hovers and hint badges in dark mode */
html[data-theme="dark"] .premises-relation_premises_search_banner {
    background: var(--app-selection);
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] .premises-relation_premises_show_all { color: var(--app-action); }
html[data-theme="dark"] :is(.syngli-editor_lang_item, .syngli-editor_file_item,
    .syngli-editor_file_tab):not(.is-selected):not(.is-active):hover {
    background: var(--app-hover);
    color: var(--app-text);
}
html[data-theme="dark"] .syngli-editor_relation_file_order_btn:hover:not(:disabled) { color: var(--app-action); }
html[data-theme="dark"] .premises-variant_type_badge {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .premises-variant_type_badge-hint {
    background: #3d3417;
    color: #f0d68a;
}
html[data-theme="dark"] .premises-variant_row-editing td { background: var(--app-surface-secondary); }

/* [CL] SYNGLI-7037 premises page: the file type switch and the passage drop target in dark mode */
html[data-theme="dark"] .premises-page_body #multimedia_icon { background: var(--app-surface-secondary); }
html[data-theme="dark"] .premises-page_body .file_type_icon { color: var(--app-text-secondary); }
html[data-theme="dark"] .premises-page_body .file_type_icon:hover {
    background: var(--app-hover);
    color: var(--app-text);
}
html[data-theme="dark"] .premises-page_body .file_type_icon.is-selected {
    background: var(--app-selection);
    color: var(--app-action);
    box-shadow: none;
}
html[data-theme="dark"] .premises-create_passage_workspace #pc_text_viewer {
    background: var(--app-surface-secondary);
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] .premises-create_passage_workspace #pc_text_viewer.drag_enter {
    background: var(--app-selection);
    border-color: var(--app-action);
}
html[data-theme="dark"] .premises-create_passage_workspace :is(.pc_text_viewer_empty_state,
    .pc_text_viewer_empty_hint) { color: var(--app-text-secondary); }
/* [CL] SYNGLI-7037 large course tile: its #424242 title band read as a dull grey slab on dark pages */
html[data-theme="dark"] .info-modal-header {
    background-color: var(--app-surface-elevated);
    color: var(--app-text);
    border-bottom: 1px solid var(--app-divider);
}
html[data-theme="dark"] .info-modal-header a { color: var(--app-text); }
/* [CL] SYNGLI-7037 tutor: pure red and pale pink were set for light pages; dark mode uses the error tones */
html[data-theme="dark"] #question .false {
    border-color: var(--app-error);
    color: var(--app-error);
}
html[data-theme="dark"] :is(#expected_response, .missing_letter_wrong) { color: var(--app-error); }
html[data-theme="dark"] .ma_chip_incorrect,
html[data-theme="dark"] .ma_row_full .ma_chip_list {
    background-color: var(--app-error-surface);
    border-color: color-mix(in srgb, var(--app-error) 55%, transparent);
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 answer feedback (response_rendering.css) in dark mode: one red for the stamp's frame and mark,
   readable struck-through answers, and dark surfaces instead of pale highlights */
html[data-theme="dark"] .feedback_symbol_incorrect { color: var(--app-error); }
html[data-theme="dark"] .feedback_symbol_correct { color: var(--app-success); }
html[data-theme="dark"] .feedback_symbol :is(.feedback_symbol_icon, .fa) { color: inherit; }
/* [CL] before .line_through: a struck answer carries both classes and should stay red */
html[data-theme="dark"] .lighter_font { color: var(--app-text-muted) !important; }
html[data-theme="dark"] .line_through {
    color: var(--app-error) !important;
    text-decoration-color: color-mix(in srgb, var(--app-error) 70%, transparent);
}
html[data-theme="dark"] .strike_text_outer { color: var(--app-error); }
html[data-theme="dark"] .strike_text_span { text-decoration-color: var(--app-error); }
html[data-theme="dark"] .strike_text { color: var(--app-text-secondary); }
html[data-theme="dark"] .green_font { color: var(--app-success) !important; }
html[data-theme="dark"] .correct_number { border-color: var(--app-success); }
html[data-theme="dark"] .correct_mc_li {
    background: var(--app-success-surface);
    color: var(--app-text);
}
/* [CL] Multiple Choice results: the light green (#C3FDB8) and pink overlays glared on dark pages */
html[data-theme="dark"] :is(.mc_option_correct_selected, .mc_option_correct_unselected, .image_mc_correct) {
    background-color: var(--app-success-surface);
    color: var(--app-text);
}
html[data-theme="dark"] .image_mc_correct { border-color: var(--app-success-surface); }
html[data-theme="dark"] .mc_option_correct_selected { border-color: var(--app-success) !important; }
html[data-theme="dark"] .mc_option_correct_unselected {
    border-color: color-mix(in srgb, var(--app-success) 55%, transparent) !important;
}
html[data-theme="dark"] :is(.mc_option_incorrect_selected, .mc_option_incorrect_unselected, .image_mc_incorrect) {
    box-shadow: inset 0 0 0 1000px var(--app-error-surface);
    color: var(--app-text);
}
html[data-theme="dark"] .mc_option_incorrect_selected { border-color: var(--app-error) !important; }
html[data-theme="dark"] .mc_option_incorrect_unselected { border-color: var(--app-border) !important; }
html[data-theme="dark"] :is(.mc-item-image-selected, .drop-hover) { background-color: var(--app-hover); }
html[data-theme="dark"] .mc-item-image-selected { border-color: var(--app-text-secondary); }
html[data-theme="dark"] .ma_chip_correct {
    background-color: var(--app-success-surface);
    border-color: color-mix(in srgb, var(--app-success) 55%, transparent);
    color: var(--app-text);
}
html[data-theme="dark"] .ma_chip_missed {
    border-color: color-mix(in srgb, var(--app-success) 55%, transparent);
    color: var(--app-success);
}
html[data-theme="dark"] #question .true {
    border-color: var(--app-success);
    color: var(--app-success);
}
html[data-theme="dark"] #dismissed_label { color: var(--app-error); }
/* [CL] SYNGLI-7037 large course tile buttons: light mode's hover turns them pure red/blue with a black shadow,
   which outranked the dark rule and glared; dark mode deepens the same blue instead */
html[data-theme="dark"] :is(.info-modal-button, .info-modal-button.blue, .info-modal-button-half):hover {
    background: color-mix(in srgb, var(--app-action) 28%, var(--app-surface));
    color: var(--app-text);
    box-shadow: none;
}
/* [CL] SYNGLI-7037 explanation variants pop-up: the table heading, cell borders and the formatting preview */
html[data-theme="dark"] .premises-variant_table :is(th, td) { border-color: var(--app-divider); }
html[data-theme="dark"] .premises-variant_table th {
    background: var(--app-surface-secondary);
    color: var(--app-text-secondary);
}
html[data-theme="dark"] .syngli-explanation_preview {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}
/* [CL] SYNGLI-7037 small course tiles: a quiet border and shadow, and price colours that read on the dark card */
html[data-theme="dark"] .course-detail {
    border-color: var(--app-divider);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .course-detail:hover {
    border-color: var(--app-border);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .course-detail .free_course_text { color: #ff8a80; }
html[data-theme="dark"] .course-detail .paid_course_text { color: var(--app-text-secondary); }
html[data-theme="dark"] .creator-img { border-color: var(--app-divider); }
/* [CL] SYNGLI-7037 the dashboard "I'm interested in..." Go button: the dark theme's button blue, not light red */
html[data-theme="dark"] #interest_button {
    background-color: var(--app-primary-button);
    border-color: var(--app-primary-button);
    color: #fff;
}
html[data-theme="dark"] #interest_button:is(:hover, :focus) {
    background-color: var(--app-primary-button-hover);
    border-color: var(--app-primary-button-hover);
}
/* [CL] SYNGLI-7068 the Library's sharing cell and network picker on dark pages */
html[data-theme="dark"] .library-sharing-dropdown {
    background: var(--app-surface-elevated);
    border-color: var(--app-border);
    color: var(--app-text);
}
html[data-theme="dark"] :is(.library-sharing_header, .library-sharing_buttons) { border-color: var(--app-divider); }
html[data-theme="dark"] :is(.library-sharing_course, .library_sharing_members) { color: var(--app-text-muted); }
html[data-theme="dark"] .library-sharing_list li:is(:hover, :focus-visible) { background: var(--app-hover); }
html[data-theme="dark"] .library-sharing_list li.is-selected { background: var(--app-selection); }
html[data-theme="dark"] .library-sharing_check { border-color: var(--app-text-muted); }
html[data-theme="dark"] .library-sharing_list li.is-selected .library-sharing_check {
    border-color: var(--app-primary-button);
    background: var(--app-primary-button);
}
html[data-theme="dark"] .library_sharing_button:is(:hover, :focus-visible) {
    border-color: var(--app-border);
    background: var(--app-hover);
}
html[data-theme="dark"] .library_network_private { background: var(--app-surface-secondary); color: var(--app-text-secondary); }
html[data-theme="dark"] .library_sharing_more { border-color: var(--app-surface); background: var(--app-text-secondary); color: var(--app-surface); }
html[data-theme="dark"] .library_sharing_faces img { border-color: var(--app-surface-elevated); }
html[data-theme="dark"] :is(.library_pagination_status, .library_pagination_page,
    #library_table-placeholder .syngli_table_message) { color: var(--app-text-muted); }
html[data-theme="dark"] .library_pagination_input {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}
