:root {
    --theme-canvas: #f2f4f8;
    --theme-surface: #ffffff;
    --theme-surface-subtle: #f7f9fc;
    --theme-border: #dfe5ec;
    --theme-text: #17233b;
    --theme-muted: #667085;
    --theme-link: #155eef;
    --theme-header: #183f66;
    --theme-shadow: 0 4px 16px rgba(16, 24, 40, .07);
}

html[data-theme="dark"] {
    --theme-canvas: #0b1220;
    --theme-surface: #141e2e;
    --theme-surface-subtle: #101827;
    --theme-border: #2b3a4f;
    --theme-text: #e7edf6;
    --theme-muted: #9cabc0;
    --theme-link: #75a7ff;
    --theme-header: #163b60;
    --theme-shadow: 0 6px 20px rgba(0, 0, 0, .24);
}

body,
.wrapper,
.main-panel,
#main {
    background-color: var(--theme-canvas);
    color: var(--theme-text);
    transition: background-color .18s ease, color .18s ease;
}

.theme-toggle {
    align-items: center;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, .08);
    color: var(--theme-text);
    display: inline-flex;
    flex: 0 0 40px;
    height: 40px;
    justify-content: center;
    margin: 7px 14px 0 0;
    padding: 0;
    position: relative;
    width: 40px;
}

.theme-toggle:hover {
    background: var(--theme-surface-subtle);
    border-color: #9aabc0;
}

.theme-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(21, 94, 239, .28);
    outline: 0;
}

.theme-toggle__icon {
    font-family: Arial, sans-serif;
    font-size: 21px;
    line-height: 1;
}

.theme-toggle__icon--dark,
html[data-theme="dark"] .theme-toggle__icon--light {
    display: none;
}

html[data-theme="dark"] .theme-toggle__icon--dark {
    display: inline;
}

.pl-top .theme-toggle {
    float: right;
    margin-right: 10px;
}

html[data-theme="dark"] body,
html[data-theme="dark"] p,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] label,
html[data-theme="dark"] dt,
html[data-theme="dark"] dd {
    color: var(--theme-text);
}

html[data-theme="dark"] a:not(.btn):not(.bus-button) {
    color: var(--theme-link);
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small {
    color: var(--theme-muted) !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .jumbotron,
html[data-theme="dark"] .pl-white {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text);
}

html[data-theme="dark"] .card {
    box-shadow: var(--theme-shadow);
}

html[data-theme="dark"] .card-header:not([data-background-color]),
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    border-color: var(--theme-border);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .input-group-text {
    background-color: var(--theme-surface-subtle) !important;
    border-color: #3a4a60 !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] select:disabled {
    background-color: #202c3d !important;
    color: #9cabc0 !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8998ad !important;
    opacity: 1;
}

html[data-theme="dark"] .input-group.no-border.property-search,
html[data-theme="dark"] .input-group.no-border.property-search .form-control,
html[data-theme="dark"] .input-group.no-border.property-search .input-group-append,
html[data-theme="dark"] .input-group.no-border.property-search .input-group-text {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border);
}

html[data-theme="dark"] .input-group.no-border.property-search .input-group-text,
html[data-theme="dark"] .navbar .material-icons {
    color: #d9e5f3 !important;
}

html[data-theme="dark"] .table,
html[data-theme="dark"] table {
    color: var(--theme-text);
}

html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th,
html[data-theme="dark"] table td,
html[data-theme="dark"] table th,
html[data-theme="dark"] hr {
    border-color: var(--theme-border);
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, .035);
    color: var(--theme-text);
}

.properties-table .property-row--flagged {
    background-color: #ffdddd;
}

.properties-table.table-hover .property-row--flagged:hover {
    background-color: #ffd0d0;
}

html[data-theme="dark"] .properties-table .property-row--flagged {
    background-color: #3a2026;
    color: var(--theme-text);
}

html[data-theme="dark"] .properties-table.table-hover .property-row--flagged:hover {
    background-color: #4a2930;
}

html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .nav-tabs .nav-link,
html[data-theme="dark"] .pagination .page-link {
    border-color: var(--theme-border);
}

html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .pagination .page-link {
    background-color: var(--theme-surface);
    color: var(--theme-text);
}

html[data-theme="dark"] .footer,
html[data-theme="dark"] .footer.footer-default {
    background-color: var(--theme-canvas);
    color: var(--theme-muted);
}

html[data-theme="dark"] .sidebar-mini li.active {
    background-color: #223047;
}

html[data-theme="dark"] .ui-autocomplete {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

/* Select2 renders its menu outside the originating form, so both the control
   and detached results popup need explicit dark-theme colours. */
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-theme="dark"] .select2-dropdown,
html[data-theme="dark"] .select2-results,
html[data-theme="dark"] .select2-results__options {
    background-color: var(--theme-surface-subtle) !important;
    border-color: #3a4a60 !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__rendered,
html[data-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field,
html[data-theme="dark"] .select2-search--dropdown .select2-search__field,
html[data-theme="dark"] .select2-results__option {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .select2-container--default .select2-selection__placeholder,
html[data-theme="dark"] .select2-results__option[aria-disabled="true"] {
    color: var(--theme-muted) !important;
}

html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #26364c !important;
    color: #f4f7fb !important;
}

html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"]:hover {
    background-color: #3978d4 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    border-color: #52729b;
}

/* Notes use a speech-bubble surface defined inside several Razor views. Keep
   the surface and its folded corner in the same palette as the surrounding card. */
html[data-theme="dark"] .leftNote {
    background: #1c293b !important;
    border-color: #3a4a60 !important;
    color: #f0f4fa !important;
}

html[data-theme="dark"] .leftNote::before {
    border-top-color: #3a4a60 !important;
}

html[data-theme="dark"] .leftNote::after {
    border-top-color: #1c293b !important;
}

html[data-theme="dark"] .leftNote small {
    color: #aebbd0 !important;
}

html[data-theme="dark"] .leftNote .add-note-as-task {
    color: #80adff !important;
}

/* Common Bootstrap light utilities otherwise retain a bright surface while
   inheriting dark-mode foreground colours. */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .alert-light,
html[data-theme="dark"] .badge-light,
html[data-theme="dark"] .btn-light {
    background-color: #1c293b !important;
    border-color: #3a4a60 !important;
    color: #f0f4fa !important;
}

/* DataTables supplies its own white row, sorting-column and paging colours.
   These shared overrides cover DWP, reporting, administration and list pages. */
html[data-theme="dark"] .dataTables_wrapper,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_processing,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] table.dataTable,
html[data-theme="dark"] table.dataTable thead th,
html[data-theme="dark"] table.dataTable thead td,
html[data-theme="dark"] table.dataTable tfoot th,
html[data-theme="dark"] table.dataTable tfoot td {
    background-color: var(--theme-surface-subtle) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] table.dataTable tbody tr,
html[data-theme="dark"] table.dataTable tbody th,
html[data-theme="dark"] table.dataTable tbody td,
html[data-theme="dark"] table.dataTable.display tbody tr > .sorting_1,
html[data-theme="dark"] table.dataTable.display tbody tr > .sorting_2,
html[data-theme="dark"] table.dataTable.display tbody tr > .sorting_3,
html[data-theme="dark"] table.dataTable.order-column tbody tr > .sorting_1,
html[data-theme="dark"] table.dataTable.order-column tbody tr > .sorting_2,
html[data-theme="dark"] table.dataTable.order-column tbody tr > .sorting_3 {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] table.dataTable.stripe tbody tr.odd,
html[data-theme="dark"] table.dataTable.display tbody tr.odd,
html[data-theme="dark"] table.dataTable.stripe tbody tr.odd > .sorting_1,
html[data-theme="dark"] table.dataTable.display tbody tr.odd > .sorting_1 {
    background-color: #182438 !important;
}

html[data-theme="dark"] table.dataTable.hover tbody tr:hover,
html[data-theme="dark"] table.dataTable.display tbody tr:hover,
html[data-theme="dark"] table.dataTable tbody tr:hover > .sorting_1,
html[data-theme="dark"] table.dataTable tbody tr:hover > .sorting_2,
html[data-theme="dark"] table.dataTable tbody tr:hover > .sorting_3 {
    background-color: #223451 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] table.dataTable tbody tr.selected,
html[data-theme="dark"] table.dataTable tbody tr.selected > * {
    background-color: #294f82 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--theme-surface-subtle) !important;
    border: 1px solid #465a74 !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: transparent !important;
    border-color: transparent !important;
    color: #b9c7da !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #294f82 !important;
    border-color: #4f79ad !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: transparent !important;
    border-color: transparent !important;
    color: #718096 !important;
}

html[data-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background: linear-gradient(to right, transparent, rgba(20, 30, 46, .96) 25%, rgba(20, 30, 46, .96) 75%, transparent) !important;
}

/* File upload panels are repeated throughout job and evidence screens and
   frequently carry inline light-grey backgrounds. */
html[data-theme="dark"] .card > .card-footer,
html[data-theme="dark"] .dropzone,
html[data-theme="dark"] .dropzone .dz-button,
html[data-theme="dark"] [style*="background: lightgray"],
html[data-theme="dark"] [style*="background:lightgray"],
html[data-theme="dark"] [style*="background-color: lightgray"],
html[data-theme="dark"] [style*="background-color:lightgray"],
html[data-theme="dark"] [style*="background-color: #D5D5D5"] {
    background-color: var(--theme-surface-subtle) !important;
    border-color: #3a4a60 !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .dropzone .dz-message,
html[data-theme="dark"] .dropzone .dz-message .dz-button,
html[data-theme="dark"] #selected-file-name {
    color: #c3cee0 !important;
}

html[data-theme="dark"] input[type="file"]::file-selector-button {
    background: #294f82;
    border: 1px solid #4f79ad;
    color: #ffffff;
}

/* Legacy timelines, dashboard tiles and jQuery UI overlays use embedded white
   surfaces that are otherwise missed by Bootstrap-level theming. */
html[data-theme="dark"] .log-content,
html[data-theme="dark"] .dash-info-item .wrap,
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .ui-menu,
html[data-theme="dark"] .ui-datepicker,
html[data-theme="dark"] .ui-dialog {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .log-timeline::after,
html[data-theme="dark"] .log-container::after {
    background-color: #465a74 !important;
}

html[data-theme="dark"] .log-right::before {
    border-color: transparent var(--theme-surface) transparent transparent !important;
}

html[data-theme="dark"] .dash-info-item__title,
html[data-theme="dark"] .dash-info-item__subInfo,
html[data-theme="dark"] .dash-info-item__count,
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .ui-widget-content a {
    color: var(--theme-text) !important;
}

/* FullCalendar 1.x is shared by the scheduler and appointment views. Its
   stylesheet is injected by the calendar partial, so use scoped high-specificity
   rules to keep the toolbar and date headers in the dark palette. */
html[data-theme="dark"] .fc {
    color: var(--theme-text);
}

html[data-theme="dark"] .fc table.fc-header,
html[data-theme="dark"] .fc thead tr.fc-first,
html[data-theme="dark"] .fc .fc-widget-header,
html[data-theme="dark"] .fc .fc-agenda-allday th {
    background-color: #1c293b !important;
    border-color: #34465d !important;
    color: #dce6f4 !important;
}

html[data-theme="dark"] .fc table.fc-header {
    border: 1px solid #34465d;
    border-bottom: 0;
}

html[data-theme="dark"] .fc .fc-header-title h2,
html[data-theme="dark"] .fc .fc-day-header,
html[data-theme="dark"] .fc .fc-agenda-axis,
html[data-theme="dark"] .fc .fc-day-number {
    color: #dce6f4 !important;
}

html[data-theme="dark"] .fc .fc-sun,
html[data-theme="dark"] .fc .fc-sat,
html[data-theme="dark"] .fc .fc-other-month .fc-day-number {
    color: #91a1b7 !important;
}

html[data-theme="dark"] .fc .fc-widget-content,
html[data-theme="dark"] .fc .fc-agenda-slots th,
html[data-theme="dark"] .fc .fc-agenda-slots td,
html[data-theme="dark"] .fc .fc-border-separate tr.fc-last th {
    background-color: var(--theme-surface) !important;
    border-color: #34465d !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .fc .fc-agenda-divider-inner {
    background-color: #34465d !important;
}

html[data-theme="dark"] .fc .fc-state-highlight {
    background-color: rgba(41, 79, 130, .28) !important;
}

html[data-theme="dark"] .fc .fc-state-default {
    background: transparent !important;
    border-color: #ff7055 !important;
    color: #ff8a72 !important;
}

html[data-theme="dark"] .fc .fc-state-hover {
    background-color: #3a2730 !important;
    color: #ff9a86 !important;
}

html[data-theme="dark"] .fc .fc-state-down,
html[data-theme="dark"] .fc .fc-state-active {
    background-color: #ff5a36 !important;
    border-color: #ff5a36 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .fc .fc-state-disabled {
    background-color: #33242b !important;
    border-color: #51323a !important;
    color: #c98678 !important;
    opacity: .72;
}

html[data-theme="dark"] .fc .fc-cell-overlay {
    background-color: #3978d4 !important;
}

html[data-theme="dark"] .operations-dashboard {
    --dashboard-ink: #e7edf6;
    --dashboard-muted: #9cabc0;
    --dashboard-line: #2b3a4f;
    --dashboard-surface: #141e2e;
    --dashboard-canvas: #101827;
    --dashboard-brand: #75a7ff;
    --dashboard-brand-soft: #192d4b;
    --dashboard-danger: #ff8a80;
    --dashboard-danger-soft: #3a2026;
    --dashboard-warning: #ffc078;
    --dashboard-warning-soft: #392b1d;
}

html[data-theme="dark"] .dashboard-action-list li + li {
    border-color: var(--dashboard-line);
}

html[data-theme="dark"] .dashboard-pipeline__bar {
    background: #334155;
}

html[data-theme="dark"] .bus-details-page,
html[data-theme="dark"] .bus-case {
    --bus-ink: #e7edf6;
    --bus-muted: #9cabc0;
    --bus-line: #2b3a4f;
    --bus-soft: #101827;
    --bus-green-soft: #17372d;
    --bus-blue-soft: #192d4b;
    --bus-red-soft: #3a2026;
}

html[data-theme="dark"] .bus-case,
html[data-theme="dark"] .bus-phase,
html[data-theme="dark"] .bus-milestone-panel,
html[data-theme="dark"] .bus-activity,
html[data-theme="dark"] .bus-activity__body,
html[data-theme="dark"] .bus-summary__card {
    background-color: var(--theme-surface);
    border-color: var(--theme-border);
}

html[data-theme="dark"] .bus-phase:hover,
html[data-theme="dark"] .bus-phase.is-active,
html[data-theme="dark"] .bus-milestone__summary[role="button"]:hover,
html[data-theme="dark"] .bus-milestone__summary[role="button"].is-expanded,
html[data-theme="dark"] .bus-milestone__editor {
    background-color: var(--theme-surface-subtle);
}

html[data-theme="dark"] .bus-details-page .bus-phase.is-active {
    background: #203550 !important;
    border-bottom-color: #ff704f !important;
    box-shadow: inset 0 -2px 0 #ff704f, inset 0 0 0 1px #476787;
    color: #ff876c !important;
}

html[data-theme="dark"] .bus-details-page .bus-phase.is-active small {
    color: #d6e2f0 !important;
}

html[data-theme="dark"] .bus-details-page .bus-case__status-select--active {
    background-color: #17372d !important;
    border-color: #48a77b !important;
    box-shadow: 0 0 0 1px rgba(91, 204, 148, .2);
    color: #8de2b8 !important;
}

html[data-theme="dark"] .bus-milestone__body > strong,
html[data-theme="dark"] .bus-activity__body h2,
html[data-theme="dark"] .bus-activity__timeline strong {
    color: var(--theme-text);
}

html[data-theme="dark"] .bus-activity__timeline li > span {
    background: var(--theme-surface);
}

html[data-theme="dark"] .project-kanban,
html[data-theme="dark"] .project-kanban__column,
html[data-theme="dark"] .project-kanban__card,
html[data-theme="dark"] .project-kanban__toolbar,
html[data-theme="dark"] .project-kanban__board-empty {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .project-kanban__column {
    background-color: var(--theme-surface-subtle) !important;
}

html[data-theme="dark"] .project-kanban__card-title,
html[data-theme="dark"] .project-kanban__column-title,
html[data-theme="dark"] .project-kanban__metadata dd {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .project-kanban__reference,
html[data-theme="dark"] .project-kanban__description,
html[data-theme="dark"] .project-kanban__metadata dt,
html[data-theme="dark"] .project-kanban__search-summary {
    color: var(--theme-muted) !important;
}

/* The legacy CreateSimple form injects its own white fieldset and form-card
   surfaces after the shared stylesheet. Keep these overrides page-scoped. */
html[data-theme="dark"] .property-create-simple #addPropertyForm fieldset,
html[data-theme="dark"] .property-create-simple #addPropertyForm fieldset .form-card {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm fieldset .form-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, .28) !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm .form-card .card {
    background-color: var(--theme-surface-subtle) !important;
    border: 1px solid var(--theme-border) !important;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .24) !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm .form-card .card-header {
    background: linear-gradient(90deg, #163b60, #295883) !important;
    border-bottom: 1px solid #3c658d !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm input,
html[data-theme="dark"] .property-create-simple #addPropertyForm textarea,
html[data-theme="dark"] .property-create-simple #addPropertyForm select.list-dt {
    background-color: #101827 !important;
    border-bottom-color: #465a74 !important;
    color: #edf3fb !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm input:focus,
html[data-theme="dark"] .property-create-simple #addPropertyForm textarea:focus,
html[data-theme="dark"] .property-create-simple #addPropertyForm select.list-dt:focus {
    border-bottom-color: #75a7ff !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm input::placeholder,
html[data-theme="dark"] .property-create-simple #addPropertyForm textarea::placeholder {
    color: #a7b6ca !important;
}

html[data-theme="dark"] .property-create-simple #postcode_lookup,
html[data-theme="dark"] .property-create-simple #postcode_lookup label,
html[data-theme="dark"] .property-create-simple #postcode_lookup p,
html[data-theme="dark"] .property-create-simple #postcode_lookup span {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .property-create-simple #idpc_input,
html[data-theme="dark"] .property-create-simple #idpc_dropdown {
    background-color: #101827 !important;
    border: 1px solid #465a74 !important;
    color: #edf3fb !important;
}

html[data-theme="dark"] .property-create-simple #idpc_button {
    background-color: #294f82 !important;
    border: 1px solid #4f79ad !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm .action-button {
    background-color: #3978d4 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .property-create-simple #addPropertyForm .action-button:hover,
html[data-theme="dark"] .property-create-simple #addPropertyForm .action-button:focus {
    background-color: #4b8ae2 !important;
    box-shadow: 0 0 0 3px rgba(117, 167, 255, .35) !important;
}

/* Authentication pages inject their legacy light surfaces after theme.css,
   so use important page-scoped values for login and password-recovery flows. */
html[data-theme="dark"] .login-container {
    background: var(--theme-canvas) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .login-box {
    background: var(--theme-surface) !important;
    border: 1px solid var(--theme-border) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .38) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .login-title,
html[data-theme="dark"] .forgot-password-title {
    color: #f1f5fb !important;
}

html[data-theme="dark"] .login-box .login-input,
html[data-theme="dark"] .login-box .login-password,
html[data-theme="dark"] .login-box .login-input-container input {
    background-color: transparent !important;
    border-bottom-color: #52647c !important;
    color: #edf3fb !important;
}

html[data-theme="dark"] .login-box .login-input:focus,
html[data-theme="dark"] .login-box .login-password:focus,
html[data-theme="dark"] .login-box .login-input-container input:focus {
    border-bottom-color: #75a7ff !important;
    box-shadow: 0 2px 0 #75a7ff !important;
    outline: 0;
}

html[data-theme="dark"] .login-box input::placeholder {
    color: #a8b5c8 !important;
}

html[data-theme="dark"] .login-box p {
    color: #b7c3d5 !important;
}

html[data-theme="dark"] .login-box a {
    color: #82afff !important;
}

html[data-theme="dark"] .login-box a:hover,
html[data-theme="dark"] .login-box a:focus {
    color: #abc8ff !important;
}

html[data-theme="dark"] .login-box .btn-primary {
    background-color: #3978d4 !important;
    border-color: #3978d4 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .login-box .btn-primary:hover,
html[data-theme="dark"] .login-box .btn-primary:focus {
    background-color: #4b8ae2 !important;
    border-color: #4b8ae2 !important;
    box-shadow: 0 0 0 3px rgba(117, 167, 255, .3) !important;
}

/* Property Measures uses a jQuery UI accordion whose legacy theme paints
   collapsed rows white. Keep these overrides local to the Measures tab. */
html[data-theme="dark"] .property-measures-page #measuresSection {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header {
    background: #1c293b !important;
    border: 1px solid #34465d !important;
    color: #dce6f4 !important;
    transition: background-color .15s ease, border-color .15s ease;
}

html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header strong,
html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header span {
    color: inherit !important;
}

html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header:hover,
html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header:focus {
    background: #24344a !important;
    border-color: #527197 !important;
    color: #ffffff !important;
    outline: 0;
}

html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-header.ui-state-active {
    background: linear-gradient(90deg, #1769c2, #245f9e) !important;
    border-color: #4b8ae2 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .property-measures-page #measuresSection .ui-accordion-content {
    background: var(--theme-surface-subtle) !important;
    border-color: #34465d !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .property-measures-page #measuresSection .measure-category-container,
html[data-theme="dark"] .property-measures-page #measuresSection .measure-category-container label {
    color: #dce6f4 !important;
}

html[data-theme="dark"] .property-measures-page > div > form > .card > .card-body,
html[data-theme="dark"] .property-measures-page > div > form > .card > .card-footer {
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .property-measures-page .card-header,
html[data-theme="dark"] .property-measures-page .card-body,
html[data-theme="dark"] .property-measures-page .card-footer {
    color: var(--theme-text);
}

html[data-theme="dark"] .property-measures-page .nav-pills .nav-link:not(.active) {
    background-color: var(--theme-surface-subtle) !important;
    border: 1px solid var(--theme-border);
    color: #9fc0ff !important;
}

html[data-theme="dark"] .property-measures-page .btn-light {
    background-color: #294f82 !important;
    border-color: #4f79ad !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .property-measures-page .btn-light:hover,
html[data-theme="dark"] .property-measures-page .btn-light:focus {
    background-color: #3978d4 !important;
    border-color: #75a7ff !important;
}

@media (max-width: 700px) {
    .theme-toggle {
        flex-basis: 36px;
        height: 36px;
        margin-top: 3px;
        width: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body,
    .wrapper,
    .main-panel,
    #main {
        transition: none;
    }
}
