/* Keep floated legacy page panels above the footer. This lives with the
   versioned theme assets rather than relying on the cached site bundle. */
#mainBodyConent { display: flow-root; }

/* Keep mailbox badges legible inside results, selected chips and highlighted rows. */
.communication-team-mailbox {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid #0f766e;
    border-radius: 4px;
    background: #e6f5f2;
    color: #115e59;
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
}
html[data-theme="dark"] .communication-team-mailbox {
    background: #153e3b;
    color: #99f6e4;
    border-color: #5eead4;
}
@media (forced-colors: active) {
    .communication-team-mailbox,
    html[data-theme="dark"] .communication-team-mailbox {
        color: CanvasText;
        background: Canvas;
        border-color: CanvasText;
    }
}
.app-footer { display: flow-root; clear: both; }

/* Select2 attaches the popup to body; scope its selected/highlighted states explicitly. */
html[data-theme="dark"] .select2-container--default .communication-recipient-dropdown .select2-results__option {
    background: #202b38;
    color: #e0e6ed;
}
html[data-theme="dark"] .select2-container--default .communication-recipient-dropdown .select2-results__option--selected,
html[data-theme="dark"] .select2-container--default .communication-recipient-dropdown .select2-results__option[aria-selected="true"] {
    background: #33465c;
    color: #e0e6ed;
}
html[data-theme="dark"] .select2-container--default .communication-recipient-dropdown .select2-results__option--highlighted {
    background: #285b8c;
    color: #fff;
}

/* Communication editors: override the legacy inline widths consistently across layouts. */
#new_comm textarea:is(#newMessageSubject, #newMessage) {
    display: block;
    box-sizing: border-box;
    width: calc(100% - 32px) !important;
    max-width: none;
    margin: 16px;
    padding: 11px 14px;
    border: 1px solid #7b8fa3;
    border-radius: 8px;
    background: #fff;
    color: #243347;
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#new_comm #newMessageSubject { min-height: 44px; height: 44px; }
#new_comm #newMessage { min-height: 160px; }
#new_comm h5 {
    margin: 16px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}
#new_comm h5 + textarea:is(#newMessageSubject, #newMessage) { margin-top: 0; }
#new_comm textarea:is(#newMessageSubject, #newMessage):focus {
    border-color: #2563eb;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    box-shadow: none;
}
html[data-theme="dark"] #new_comm textarea:is(#newMessageSubject, #newMessage) {
    background: #17212c;
    color: #e0e6ed;
    border-color: #718298;
}
html[data-theme="dark"] #new_comm textarea:is(#newMessageSubject, #newMessage):focus {
    border-color: #9dceff;
    outline-color: #9dceff;
}
.theme-picker { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
/* Recipient controls share the editors' inset, label rhythm and focus treatment. */
#new_comm .communication-recipient-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 4fr);
    gap: 8px;
    margin: 16px;
    width: calc(41.666667% - 32px);
    margin-left: calc(58.333333% + 16px);
}
/* Bootstrap's clearfix pseudo-elements otherwise occupy anonymous grid cells. */
#new_comm .communication-recipient-field::before,
#new_comm .communication-recipient-field::after,
#new_comm .communication-email-row::before,
#new_comm .communication-email-row::after { display: none; }
#new_comm .communication-recipient-field > .communication-recipient-label {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
}
#new_comm .communication-recipient-field > .col-md-4 {
    grid-column: 2;
    grid-row: 1;
}
#new_comm .communication-recipient-field > [class*="col-md-"] {
    float: none;
    width: 100%;
    margin-left: 0;
    padding: 0 !important;
    min-width: 0;
}
#new_comm .communication-recipient-label label { margin: 0; font-weight: 600; line-height: 1.5; }
@media (max-width: 991px) {
    #new_comm .communication-recipient-field {
        width: auto;
        margin-left: 16px;
        grid-template-columns: minmax(0, 1fr);
    }
    #new_comm .communication-recipient-field > .col-md-4 {
        grid-column: 1;
        grid-row: 2;
    }
}
#new_comm .communication-recipient-field .row { margin-left: 0; margin-right: 0; }
#new_comm .communication-recipient-field :is(.col-md-10, .col-md-12) { width: 100%; padding: 0; min-width: 0; }
#new_comm .communication-recipient-field .select2-container { width: 100% !important; min-width: 0; }
#new_comm .communication-recipient-field .select2-selection--multiple {
    min-height: 44px;
    border: 1px solid #7b8fa3;
    border-radius: 8px;
    background: #dff0d8 !important;
    color: #243347;
}
#new_comm .communication-recipient-field .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
}
/* Select2's inline search belongs to the outer control, not a second bordered input.
   Keep the caret and keyboard search; the container supplies the visible focus ring. */
#new_comm .communication-recipient-field .select2-search--inline { float: none; margin: 0; min-width: 0; }
#new_comm .communication-recipient-field .select2-search__field,
#new_comm .communication-recipient-field .select2-search__field:focus {
    min-height: 24px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    font: inherit;
}
#new_comm .communication-recipient-field .select2-selection__choice {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    float: none;
    max-width: 100%;
    margin: 0;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: normal;
    line-height: 1.4;
}
#new_comm .communication-recipient-field .select2-selection__choice:has(.communication-team-mailbox) {
    background: #e6f5f2;
    border: 1px solid #0f766e;
    color: #115e59;
}
#new_comm .communication-recipient-field .select2-selection__choice .communication-team-mailbox {
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}
#new_comm .communication-recipient-field .select2-selection__choice__display { padding: 0; min-width: 0; }
#new_comm .communication-recipient-field .select2-selection__choice__remove {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    min-width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 20px;
}
#new_comm .communication-recipient-field .select2-selection__choice__remove:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}
#new_comm .communication-recipient-field .select2-container--disabled .select2-selection__choice__remove { display: none; }
html[data-theme="dark"] #new_comm .communication-recipient-field .select2-selection__choice:has(.communication-team-mailbox) {
    background: #153e3b;
    border-color: #5eead4;
    color: #99f6e4;
}
#new_comm .communication-email-row { display: flex; gap: 8px; align-items: flex-start; }
#new_comm .communication-email-row > .col-md-10 { flex: 1 1 0; width: auto; }
#new_comm .communication-email-row > .col-md-1 { flex: 0 0 44px; width: 44px; }
#new_comm .communication-recipient-field .row + .row { margin-top: 8px; }
#new_comm .comunicationPSemail {
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 44px;
    padding: 10px 14px;
    border: 1px solid #7b8fa3;
    border-radius: 8px;
    background: #fff;
    color: #243347;
    font: inherit;
    box-shadow: none;
}
#new_comm :is(.addEmail, .removeEmail) {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #7b8fa3;
    border-radius: 8px;
    background: #edf2f7;
    color: #243347;
    cursor: pointer;
}
#new_comm :is(.addEmail, .removeEmail):hover { background: #dce6f0; }
#new_comm :is(.comunicationPSemail, .addEmail, .removeEmail):focus-visible,
#new_comm .communication-recipient-field .select2-container--focus .select2-selection--multiple {
    border-color: #2563eb;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    box-shadow: none;
}
html[data-theme="dark"] #new_comm .communication-recipient-field .select2-selection--multiple,
html[data-theme="dark"] #new_comm .comunicationPSemail {
    background: #17212c !important;
    color: #e0e6ed;
    border-color: #718298;
}
html[data-theme="dark"] #new_comm :is(.addEmail, .removeEmail) { background: #293647; color: #e0e6ed; border-color: #718298; }
html[data-theme="dark"] #new_comm :is(.addEmail, .removeEmail):hover { background: #33465c; }
html[data-theme="dark"] #new_comm :is(.comunicationPSemail, .addEmail, .removeEmail):focus-visible,
html[data-theme="dark"] #new_comm .communication-recipient-field .select2-container--focus .select2-selection--multiple {
    border-color: #9dceff;
    outline-color: #9dceff;
}
.theme-picker label { margin: 0; }
.theme-picker select { width: auto; }

/* Mirror the shared button layout in the versioned asset for cached bundles. */
.btn {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.pasectionhidden button[data-input-button] { display: none; }

/* Wide tables scroll inside their panel instead of widening the page. */
.app-table-scroll { width: 100%; max-width: 100%; min-width: 0; margin-bottom: 20px; }
.app-table-scroll.is-overflowing { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-table-scroll > table { margin-bottom: 0; }
/* Enum labels wrap their input, so Bootstrap's negative radio offset is unnecessary. */
label.radio.action-status-option { display: flex; align-items: center; gap: 8px; min-height: 26px; margin: 0; padding: 0; }
label.radio.action-status-option input[type="radio"] { position: static; flex: 0 0 auto; margin: 0; }

/* Larger table scrollbars keep the horizontal handle easy to grab. */
:is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) {
    --table-scroll-track: #e3e9ef;
    --table-scroll-thumb: #64778b;
    --table-scroll-hover: #435b72;
    scrollbar-width: auto;
    scrollbar-color: var(--table-scroll-thumb) var(--table-scroll-track);
}
html[data-theme="dark"] :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) {
    --table-scroll-track: #17212c;
    --table-scroll-thumb: #91a6bc;
    --table-scroll-hover: #bfd7ee;
}
@supports selector(::-webkit-scrollbar) {
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) { scrollbar-color: auto; }
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody)::-webkit-scrollbar { width: 18px; height: 18px; }
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody)::-webkit-scrollbar-track { background: var(--table-scroll-track); border-radius: 9px; }
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody)::-webkit-scrollbar-thumb { background: var(--table-scroll-thumb); border: 3px solid var(--table-scroll-track); border-radius: 9px; }
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody)::-webkit-scrollbar-thumb:hover { background: var(--table-scroll-hover); }
    :is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody)::-webkit-scrollbar-corner { background: var(--table-scroll-track); }
}

:is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) :is(button, a, input).btn:not(.btn-xs):not(.btn-sm):not(.btn-link) { min-width: 8em; }
.app-table-scroll:focus-visible { outline: 2px solid #337ab7; outline-offset: 2px; }
.app-table-hint { margin: 0 0 6px; color: #526275; font-size: 12px; }
:is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) .mytooltip { position: relative; }
:is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) .mytooltip .mytooltiptext { display: none; right: 0; max-width: min(280px, calc(100vw - 40px)); overflow-wrap: anywhere; }
:is(.app-table-scroll, .table-responsive, .placement-table-scroll, .dataTables_scrollBody) .mytooltip:hover .mytooltiptext { display: block; }
#new_comm .row .row { margin-left: 0; margin-right: 0; }

/* Loaded after institution styles. Branding images and status meanings are retained. */
@media screen {
    html[data-theme="light"] { color-scheme: light; }
    html[data-theme="dark"] {
        color-scheme: dark; background: #151c24;
        --epad-editor-editable: #17212c;
        --epad-editor-readonly: #293647;
        --epad-history-background: #573c29;
        --epad-history-foreground: #ffe3cc;
        --epad-history-border: #c4936e;
    }
    html[data-theme="dark"] body { background: #151c24; color: #e0e6ed; }
    html[data-theme="dark"] .app-table-hint { color: #b2c0d0; }
    html[data-theme="dark"] .app-table-scroll:focus-visible { outline-color: #9dceff; }
    html[data-theme="dark"] .role-picker__heading h1,
    html[data-theme="dark"] .role-picker__name { color: #e0e6ed; }
    html[data-theme="dark"] .role-picker__heading p,
    html[data-theme="dark"] .role-picker__description { color: #b2c0d0; }
    html[data-theme="dark"] .role-picker .role-picker__card {
        background: #202a36; color: #e0e6ed; border-color: #718298;
        box-shadow: 0 3px 12px rgba(0, 0, 0, .2);
    }
    html[data-theme="dark"] .role-picker .role-picker__card:hover {
        background: #293647; border-color: #9dceff;
    }
    html[data-theme="dark"] .role-picker .role-picker__card:focus {
        outline-color: #9dceff;
    }
    html[data-theme="dark"] .role-picker__icon {
        background: #293647; color: #9dceff;
    }
    html[data-theme="dark"] .role-picker__continue { color: #9dceff; }
    html[data-theme="dark"] .role-picker__count--empty { background: #334155; color: #cbd5e1; }
    html[data-theme="dark"] .filterChoices {
        background: #17212c; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] .filterChoices > strong {
        display: block; padding: 5px 0; color: #e0e6ed;
    }
    html[data-theme="dark"] .filterChoices > div[data-dragula-item],
    html[data-theme="dark"] .gu-mirror[data-dragula-item] {
        background: #293647; color: #e0e6ed; border: 1px solid #516174;
    }
    html[data-theme="dark"] .filterChoices > div[data-dragula-item]:hover,
    html[data-theme="dark"] .gu-mirror[data-dragula-item] {
        background: #33465c; border-color: #9dceff;
    }
    html[data-theme="dark"] .filterChoices > div[data-id][style*="color: red"],
    html[data-theme="dark"] .gu-mirror[data-id][style*="color: red"] { color: #ffafb9 !important; }
    html[data-theme="dark"] .filterChoices > .gu-transit { opacity: .55; }
    html[data-theme="dark"] :is(.app-header, #main-menu.sidebar, .sidebar-mobile-header,
        .panel, .panel-body, .modal-content, .dropdown-menu, .well, .list-group-item,
        .popover, .swal-modal, .datepicker, .select2-dropdown, .note-editor,
        .note-editable, .note-toolbar, .note-statusbar) {
        background-color: #202a36; color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] :is(.panel-default > .panel-heading, .panel-footer,
        .modal-header, .modal-footer, .app-header__account-summary, .breadcrumb,
        .table > thead > tr > th, .note-editor .note-toolbar) {
        background-color: #293647; color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] :is(a, .app-header__account,
        .dropdown-menu > li > a, .nav-tabs > li > a, .swal-title, .swal-text) { color: #9dceff; }
    html[data-theme="dark"] :is(.app-header__role, .app-header__chevron,
        .app-header__account-summary span, .text-muted, .help-block, #main-menu .sidebar-heading) { color: #b2c0d0; }
    html[data-theme="dark"] :is(.form-control, .select2-container--default .select2-selection--single,
        .select2-container--default .select2-selection--multiple, .select2-search__field) {
        background-color: #17212c; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] .select2-container--default .select2-selection__rendered { color: #e0e6ed; }
    html[data-theme="dark"] .form-control::placeholder { color: #a7b5c5; }
    html[data-theme="dark"] :is(.form-control[disabled], .form-control[readonly],
        .select2-selection__choice, .btn-default, .pagination > li > a, .pagination > li > span,
        .app-header #sidebarToggle, #sidebarClose, .app-header__avatar) {
        background-color: #293647; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] :is(.table > tbody > tr > td, .table > tbody > tr > th,
        .table > thead > tr > th, .table-bordered, .nav-tabs, hr) { border-color: #516174; }
    html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) { background-color: #202a36; }
    html[data-theme="dark"] :is(.table-hover > tbody > tr:hover, .dropdown-menu > li > a:hover,
        .dropdown-menu > li > a:focus, #main-menu a:hover, .nav > li > a:hover,
        .nav > li > a:focus, .nav-tabs > li.active > a, .btn-default:hover) {
        background-color: #33465c; color: #fff;
    }
    html[data-theme="dark"] :is(.alert-success, .bg-success, .table > tbody > tr.success > td,
        .table > tbody > tr > td.success) { background-color: #214738; color: #d2f2df; }
    html[data-theme="dark"] :is(.alert-danger, .bg-danger, .table > tbody > tr.danger > td,
        .table > tbody > tr > td.danger) { background-color: #542d36; color: #ffdae0; }
    html[data-theme="dark"] :is(.alert-warning, .bg-warning, .table > tbody > tr.warning > td,
        .table > tbody > tr > td.warning) { background-color: #493d22; color: #fff0bf; }
    html[data-theme="dark"] :is(.alert-info, .bg-info, .table > tbody > tr.info > td,
        .table > tbody > tr > td.info) { background-color: #233f55; color: #d4ecff; }
    html[data-theme="dark"] :is(.text-danger, .field-validation-error, .required-field) { color: #ffafb9; }
    html[data-theme="dark"] .text-success { color: #9cdfb9; }
    html[data-theme="dark"] .text-warning { color: #fff0bf; }
    html[data-theme="dark"] .text-info { color: #9dceff; }
    html[data-theme="dark"] .red { color: #ffafb9; }
    html[data-theme="dark"] .blue { color: #9dceff; }
    html[data-theme="dark"] .close { color: #fff; opacity: .8; text-shadow: none; }
    /* Institution logos may contain dark lettering or a baked-in white background. */
    html[data-theme="dark"] .app-header__institution {
        background: #fff; border-radius: 4px; padding: 4px;
    }
    html[data-theme="dark"] .app-header__product {
        background: transparent;
    }
    /* Inline V2 heading fills retain their light-theme fallbacks while adopting dark colours. */
    html[data-theme="dark"] .panel-heading {
        --placement-heading-purple: #3d2e50;
        --placement-heading-pink: #4e303e;
        --placement-heading-blue: #233f55;
    }
    html[data-theme="dark"] .note-status-output { background-color: #214738 !important; color: #d2f2df; }
    /* Stored messages use legacy pink fills. Summernote's initializer uses
       theme variables for its inline fills so switching themes stays live. */
    html[data-theme="dark"] .display-text-border {
        background: #293647 !important; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] .note-editor .note-editable,
    html[data-theme="dark"] .note-editor .note-statusbar {
        background: #17212c !important; color: #e0e6ed;
    }
    html[data-theme="dark"] .note-editor .note-editable[contenteditable="false"] {
        background: #293647 !important; color: #e0e6ed; opacity: 1;
    }
    html[data-theme="dark"] .btn-primary { background: #285b8c; border-color: #80b7e8; color: #fff; }
    html[data-theme="dark"] .btn-success { background: #27613e; border-color: #80c99d; color: #fff; }
    html[data-theme="dark"] .btn-info { background: #245c73; border-color: #80c5e0; color: #fff; }
    html[data-theme="dark"] .btn-warning { background: #79551c; border-color: #e5bc79; color: #fff; }
    html[data-theme="dark"] .btn-danger { background: #943d49; border-color: #e8a1aa; color: #fff; }
    html[data-theme="dark"] .btn:not(.btn-link):is(:hover, :focus) {
        filter: brightness(1.12); color: #fff;
    }
    html[data-theme="dark"] :is(.btn.disabled, .btn[disabled], fieldset[disabled] .btn,
        .note-btn.disabled, .note-btn[disabled]) {
        background: #334155 !important; color: #cbd5e1;
        -webkit-text-fill-color: #cbd5e1;
        border-color: #718298; opacity: 1; filter: none; box-shadow: none;
        cursor: not-allowed;
    }

    /* Legacy forms use important green/pink backgrounds, including on controls
       without Bootstrap's form-control class. Override those backgrounds here. */
    html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(.btn),
    html[data-theme="dark"] textarea,
    html[data-theme="dark"] select,
    html[data-theme="dark"] .select2-search__field {
        background: #17212c !important;
        color: #e0e6ed;
        -webkit-text-fill-color: #e0e6ed;
        border-color: #718298;
        caret-color: #fff;
    }
    html[data-theme="dark"] :is(input, textarea, select):disabled,
    html[data-theme="dark"] :is(input, textarea)[readonly] {
        background: #293647 !important;
        color: #bfcbd9;
        -webkit-text-fill-color: #bfcbd9;
        opacity: 1;
    }
    html[data-theme="dark"] :is(input, textarea)::placeholder {
        color: #a7b5c5;
        -webkit-text-fill-color: #a7b5c5;
        opacity: 1;
    }
    html[data-theme="dark"] :is(input, textarea, select, .form-control):focus {
        border-color: #9dceff;
        outline: 2px solid #9dceff;
        outline-offset: 1px;
        box-shadow: none;
    }
    html[data-theme="dark"] input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px #17212c inset;
        -webkit-text-fill-color: #e0e6ed;
    }
    html[data-theme="dark"] select option { background: #17212c; color: #e0e6ed; }
    html[data-theme="dark"] .select2-container--default .select2-selection--multiple {
        background: #17212c !important; color: #e0e6ed;
    }
    html[data-theme="dark"] :is(input[type="checkbox"], input[type="radio"]) { accent-color: #9dceff; }

    html[data-theme="dark"] .student-header .student-header-card,
    html[data-theme="dark"] :is(.studentDetailsHeader, .placement-tools__card,
        .placement-results, .navbar-default, .navbar-collapse, pre, code,
        .thumbnail, .jumbotron, .tab-content, .ui-widget-content) {
        background: #202a36; color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] .student-header__row strong,
    html[data-theme="dark"] .student-header__row:first-child > .col-md-4,
    html[data-theme="dark"] :is(.placement-tools__label, .placement-results__total) { color: #d1dce9; }
    html[data-theme="dark"] .student-header-card > .student-header__row:first-child { border-color: #516174; }
    html[data-theme="dark"] :is(.student-header .student-qualification,
        .student-header__row > .student-header__coach, .placement-tools__options .radio-inline,
        .placement-tools__layout, .placement-results__count, .app-header .app-header__account,
        .app-header .app-header__account:hover, .app-header .app-header__account:focus) {
        background: #293647; color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] .student-header-card .student-header__action {
        background: #542d36; color: #ffdae0; border-color: #b2717e;
    }
    html[data-theme="dark"] .panel > .panel-heading,
    html[data-theme="dark"] :is(.heading-bg-color, .guidelines > .panel-heading,
        .endofpart > .panel-heading, .popover-title, .ui-widget-header) {
        background: #293647; color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] .panel > .panel-heading :is(h1, h2, h3, h4, h5, .panel-title, a:not(.btn)) { color: inherit; }
    /* Retain the original panel categories using colours suited to dark surfaces. */
    html[data-theme="dark"] .panel-primary { border-color: #648ec2; }
    html[data-theme="dark"] .panel-primary > .panel-heading {
        background: #23446d; color: #e0edff; border-color: #648ec2;
    }
    html[data-theme="dark"] .panel-info { border-color: #568daa; }
    html[data-theme="dark"] .panel-info > .panel-heading,
    html[data-theme="dark"] .heading-bg-color {
        background: #233f55; color: #d4ecff; border-color: #568daa;
    }
    html[data-theme="dark"] .panel-success { border-color: #588c70; }
    html[data-theme="dark"] .panel-success > .panel-heading {
        background: #214738; color: #d2f2df; border-color: #588c70;
    }
    html[data-theme="dark"] .panel-warning { border-color: #a38a50; }
    html[data-theme="dark"] .panel-warning > .panel-heading {
        background: #493d22; color: #fff0bf; border-color: #a38a50;
    }
    html[data-theme="dark"] .panel-danger { border-color: #b2717e; }
    html[data-theme="dark"] .panel-danger > .panel-heading {
        background: #542d36; color: #ffdae0; border-color: #b2717e;
    }
    html[data-theme="dark"] .guidelines > .panel-heading {
        background: #353e49; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] .endofpart > .panel-heading {
        background: #493353; color: #f0def8; border-color: #a680b7;
    }
    html[data-theme="dark"] .panel > .panel-heading + .panel-collapse > .panel-body { border-top-color: inherit; }
    html[data-theme="dark"] .table :is(th, td).success { background: #214738; color: #d2f2df; }
    html[data-theme="dark"] .table :is(th, td).warning { background: #493d22; color: #fff0bf; }
    html[data-theme="dark"] .table :is(th, td).danger { background: #542d36; color: #ffdae0; }
    html[data-theme="dark"] .table :is(th, td).info { background: #233f55; color: #d4ecff; }
    html[data-theme="dark"] .table th[style*="color: #337ab7"] { color: #9dceff !important; }
    html[data-theme="dark"] .fa[style*="color: green"] { color: #9cdfb9 !important; }
    html[data-theme="dark"] .fa[style*="color: red"] { color: #ffafb9 !important; }
    html[data-theme="dark"] .medicines-toggles .btn {
        background: #202a36; color: #e0e6ed; border: 1px solid #8094aa;
        min-width: 66px; padding: 7px 10px;
    }
    html[data-theme="dark"] .medicines-toggles .btn::before {
        content: ""; display: inline-block; width: 12px; margin-right: 5px;
    }
    html[data-theme="dark"] .medicines-toggles .btn:not(.active):not(.disabled):not([disabled]):hover {
        background: #33465c; border-color: #b8dcff;
    }
    html[data-theme="dark"] .medicines-toggles .btn.active {
        background: #176bc0; color: #fff; border-color: #b8dcff;
        font-weight: 700; box-shadow: inset 0 0 0 1px #b8dcff;
        opacity: 1;
    }
    html[data-theme="dark"] .medicines-toggles .btn.active::before {
        content: "\2713";
    }
    html[data-theme="dark"] .medicines-toggles .btn:focus-within {
        outline: 3px solid #f7ce70; outline-offset: 2px; z-index: 3;
    }
    html[data-theme="dark"] [id^="oar_placement_NotCompleted"] {
        background-color: #202a36 !important; color: #e0e6ed;
    }
    html[data-theme="dark"] .rounded-progress-bar { background: #334155; }
    html[data-theme="dark"] .rounded-progress-text { color: #e0e6ed; }
    html[data-theme="dark"] .placement-table-hint { color: #b2c0d0; }
    html[data-theme="dark"] .qq-gallery.qq-uploader {
        background: #202a36; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] .qq-gallery .qq-upload-button {
        background: #245c73; color: #fff; border-color: #80c5e0;
    }
    html[data-theme="dark"] .qq-gallery :is(.qq-upload-list li, .qq-upload-drop-area) {
        background: #293647; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] a[data-toggle="collapse"][style*="color: black"] { color: #b8dcff !important; }
    html[data-theme="dark"] .panel-heading[style*="lightGreen" i],
    html[data-theme="dark"] .panel-heading .row[style*="lightGreen" i] {
        background: #214738 !important; color: #d2f2df;
    }
    html[data-theme="dark"] .panel-heading[style*="lightSalmon" i] { background: #573c29 !important; color: #ffe3cc; }
    html[data-theme="dark"] .panel-heading[style*="lightBlue" i] { background: #233f55 !important; color: #d4ecff; }
    html[data-theme="dark"] .panel-heading[style*="lightCoral" i] { background: #542d36 !important; color: #ffdae0; }
    html[data-theme="dark"] .plymouth-midpoint-rating [style*="#216e39"] { color: #9cdfb9 !important; }
    html[data-theme="dark"] .plymouth-midpoint-rating [style*="#805500"] { color: #fff0bf !important; }
    html[data-theme="dark"] .plymouth-midpoint-rating [style*="#b42318"] { color: #ffafb9 !important; }
    html[data-theme="dark"] .plymouth-midpoint-rating [style*="#555"] { color: #b2c0d0 !important; }
    /* Placement V2 stages use their own status classes on table headers. */
    html[data-theme="dark"] .notSubmittedOrRejected { background: #542d36; color: #ffdae0; }
    html[data-theme="dark"] .submittedByStudent { background: #493d22; color: #fff0bf; }
    html[data-theme="dark"] .approvedByMentor { background: #214738; color: #d2f2df; }
    html[data-theme="dark"] :is(.notSubmittedOrRejected, .submittedByStudent, .approvedByMentor) a { color: inherit; text-decoration: underline; }
    html[data-theme="dark"] .app-header #name .dropdown-menu > li > a { color: #b8dcff; }
    html[data-theme="dark"] .app-header #name .app-header__account-summary { color: #e0e6ed; }
    html[data-theme="dark"] .app-header #name .dropdown-menu > li > a:is(:hover, :focus) {
        background: #33465c; color: #fff;
    }
    html[data-theme="dark"] #main-menu .menu-item,
    html[data-theme="dark"] #main-menu #mainNavbar a,
    html[data-theme="dark"] #main-menu .menu-item:visited,
    html[data-theme="dark"] .app-header #topNavbar .navbar-nav > li > a,
    html[data-theme="dark"] .navbar-default .navbar-nav > li > a { color: #b8dcff; }
    html[data-theme="dark"] #main-menu .menu-item:hover,
    html[data-theme="dark"] #main-menu #mainNavbar a:not(.disabled):hover,
    html[data-theme="dark"] #main-menu #mainNavbar a:focus,
    html[data-theme="dark"] #main-menu .menu-item:focus,
    html[data-theme="dark"] .app-header #topNavbar .navbar-nav > li > a:hover {
        background: #33465c; color: #fff;
    }
    html[data-theme="dark"] #main-menu .menu-item.active,
    html[data-theme="dark"] #main-menu #mainNavbar a.is-current,
    html[data-theme="dark"] #main-menu #mainNavbar a.is-current:hover,
    html[data-theme="dark"] #main-menu .active > .menu-item,
    html[data-theme="dark"] .navbar-default .navbar-nav > .active > a,
    html[data-theme="dark"] .nav-pills > li.active > a,
    html[data-theme="dark"] .nav-tabs > li.active > a,
    html[data-theme="dark"] .pagination > .active > a {
        background: #285b8c; color: #fff; border-color: #9dceff;
    }
    html[data-theme="dark"] .nav-tabs > li > a,
    html[data-theme="dark"] .navbar-default .navbar-nav > li > a { background-color: transparent; }
    html[data-theme="dark"] .nav-tabs > li.active > a:hover,
    html[data-theme="dark"] .nav-tabs > li.active > a:focus { background: #285b8c; color: #fff; }
    html[data-theme="dark"] a.btn:is(.btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger) { color: #fff; }
    html[data-theme="dark"] a.btn.btn-default { color: #e0e6ed; }
    html[data-theme="dark"] .btn.btn-secondary { background: #334155; color: #e0e6ed; border-color: #718298; }
    html[data-theme="dark"] .btn-link { color: #9dceff; }
    html[data-theme="dark"] :is(.select2-container--default .select2-selection__choice,
        .select2-container--default .select2-results__option[aria-selected="true"],
        .datepicker table tr td.day:hover, .datepicker table tr td span:hover,
        .note-editor .note-btn, .progress) { background: #33465c; color: #e0e6ed; }
    html[data-theme="dark"] :is(.has-error .control-label, .has-error .help-block,
        .validation-summary-errors) { color: #ffafb9; }
    html[data-theme="dark"] .has-error .form-control { border-color: #ffafb9; }
    html[data-theme="dark"] .table > tbody > tr.active > td { background: #33465c; color: #fff; }
    html[data-theme="dark"] :is(.table > tfoot > tr > td, .table > tfoot > tr > th,
        .table-bordered > thead > tr > td, .table-bordered > tbody > tr > th) { border-color: #516174; }
    html[data-theme="dark"] .midpoint-rating-option span { background: #293647; color: #e0e6ed; }
    html[data-theme="dark"] .midpoint-rating-option-0 input:checked + span { background: #214738; color: #d2f2df; }
    html[data-theme="dark"] .midpoint-rating-option-1 input:checked + span { background: #493d22; color: #fff0bf; }
    html[data-theme="dark"] .midpoint-rating-option-2 input:checked + span { background: #542d36; color: #ffdae0; }
    html[data-theme="dark"] #HoursSummaryModal :is(.modal-content, .modal-header, .modal-body,
        .modal-footer, .hours-summary-intro, .hours-part-card, .hours-part-heading,
        .hours-part-card.total .hours-part-heading) { background: #202a36; color: #e0e6ed; border-color: #516174; }
    html[data-theme="dark"] #HoursSummaryModal :is(h4, h5, .hours-metric-value) { color: #e0e6ed; }
    html[data-theme="dark"] #HoursSummaryModal { color: #e0e6ed; }
    html[data-theme="dark"] #HoursSummaryModal .hours-metric.completed .hours-metric-value { color: #9cdfb9; }
    html[data-theme="dark"] #HoursSummaryModal .modal-header .close { color: #e0e6ed; }
    html[data-theme="dark"] #HoursSummaryModal :is(.hours-summary-subtitle, .hours-metric-label) { color: #b2c0d0; }
    html[data-theme="dark"] #HoursSummaryModal .hours-part-badge { background: #493d22; color: #fff0bf; }
    html[data-theme="dark"] #HoursSummaryModal .hours-absence { background: #542d36; color: #ffdae0; }
    html[data-theme="dark"] .placement-v3 { --v3-navy: #e0e6ed; --v3-muted: #b2c0d0; }
    html[data-theme="dark"] .placement-v3 :is(.v3-toolbar, .v3-panel, .v3-placement-card,
        .v3-summary-card, .v3-part-overview-card, .v3-part-group-heading, .v3-deadlines, .v3-empty) {
        background: #202a36; border-color: #516174;
    }
    html[data-theme="dark"] .placement-v3 .v3-part-group-heading:hover { background: #33465c; }
    html[data-theme="dark"] .placement-v3 .v3-overview-decision.yes { color: #9cdfb9; }
    html[data-theme="dark"] .placement-v3 .v3-status-current { background: #214738; color: #d2f2df; }
    html[data-theme="dark"] .placement-v3 .v3-status-upcoming { background: #493d22; color: #fff0bf; }
    html[data-theme="dark"] .placement-v3 .v3-status-past { background: #293647; color: #e0e6ed; }
    html[data-theme="dark"] .placement-v3 .v3-overview-decision.awaiting { color: #fff0bf; }
    html[data-theme="dark"] .placement-v3 :is(.v3-overview-decision.no, .v3-stage-outcome.not-achieved) { color: #ffafb9; }
    /* Historical action lists encode their status in inline Bootstrap colours. */
    html[data-theme="dark"] :is(tr, td)[style*="background-color: #f5f5f5"] { background-color: #293647 !important; color: #e0e6ed; }
    html[data-theme="dark"] [style*="background-color:#f2dede"] { background-color: #542d36 !important; color: #ffdae0; }
    html[data-theme="dark"] [style*="background-color:#fcf8e3"] { background-color: #493d22 !important; color: #fff0bf; }
    html[data-theme="dark"] [style*="background-color:#dff0d8"] { background-color: #214738 !important; color: #d2f2df; }
    /* Disabled navigation retains a muted dark surface in every interaction state. */
    html[data-theme="dark"] :is(#main-menu #mainNavbar, .app-header, .navbar-default, .nav-tabs, .dropdown-menu)
        :is(a.disabled, a[aria-disabled="true"], .disabled > a) {
        background: #293647 !important;
        color: #a7b5c5 !important;
        border-color: #516174;
        opacity: 1;
        cursor: not-allowed;
        box-shadow: none;
    }
}
/* Summernote chrome follows the theme; colour swatches retain their actual colours. */
.note-editor .note-status-output:empty { display: none; }
.note-editor .note-status-output { background: transparent !important; }
.note-editor .note-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
.note-editor .note-toolbar > .note-btn-group { margin: 0; }
.note-editor .note-toolbar .note-btn { min-height: 32px; }
@media screen {
    html[data-theme="dark"] :is(.note-toolbar, .note-popover, .note-modal) {
        color: #e0e6ed; border-color: #516174;
    }
    html[data-theme="dark"] :is(.note-dropdown-menu, .note-modal-content, .note-modal-header, .note-modal-footer, .note-popover .popover-content) {
        background: #202a36; color: #e0e6ed; border-color: #718298;
    }
    html[data-theme="dark"] :is(.note-toolbar, .note-popover, .note-modal) .note-btn {
        background: #33465c; color: #e0e6ed; border-color: #718298; box-shadow: none;
    }
    html[data-theme="dark"] :is(.note-toolbar, .note-popover, .note-modal) .note-btn:not([disabled]):is(:hover, :focus-visible, .active, :active) {
        background: #285b8c; color: #fff; border-color: #9dceff;
    }
    html[data-theme="dark"] :is(.note-toolbar, .note-popover, .note-modal) .note-btn:focus-visible {
        outline: 2px solid #9dceff; outline-offset: 2px;
    }
    html[data-theme="dark"] .note-dropdown-menu :is(a, .note-dropdown-item, .note-palette-title, .note-color-reset, .note-color-select) {
        background: transparent; color: #e0e6ed;
    }
    html[data-theme="dark"] .note-dropdown-menu :is(a, .note-dropdown-item, .note-color-reset, .note-color-select):is(:hover, :focus) {
        background: #33465c; color: #fff;
    }
    html[data-theme="dark"] .note-editor .note-status-output { background: #17212c !important; color: #e0e6ed; }
    html[data-theme="dark"] .note-editor .note-statusbar { border-color: #516174; }
    html[data-theme="dark"] .note-editor .note-resizebar .note-icon-bar { border-color: #91a6bc; }
    html[data-theme="dark"] .note-editor .note-placeholder { color: #b2c0d0; }
    html[data-theme="dark"] .note-modal :is(label, h4, .note-modal-title, .note-form-label) { color: #e0e6ed; }
    html[data-theme="dark"] .note-modal .note-form-control { background: #17212c; color: #e0e6ed; border-color: #718298; }
    html[data-theme="dark"] .note-modal .note-close { color: #e0e6ed; opacity: 1; }
    html[data-theme="dark"] .note-dimension-picker-unhighlighted { border-color: #91a6bc; }
    html[data-theme="dark"] .note-dimension-picker-highlighted { background: #285b8c; border-color: #9dceff; }
}
@media print {
    .app-table-scroll, .app-table-scroll.is-overflowing { overflow: visible !important; max-width: none; }
    .app-table-hint { display: none !important; }
    :root { color-scheme: light; }
    html, body { background: #fff !important; color: #000 !important; }
    .theme-picker { display: none; }
}
