/**
 * MLD public dark-mode skin — Harbor Night.
 *
 * Loaded after search and property-detail styles so legacy literal light
 * colors participate in the shared semantic palette without changing layout.
 * Accent cyan is reserved for edges, focus, links, and data. Filled actions
 * use the deeper teal token so white labels retain WCAG AA contrast.
 */

@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: var(--ds-text-primary, #F7FAFC);
        --text-light: var(--ds-text-secondary, #CBD5DC);
        --brand-color: var(--ds-teal-action, #0B7189);

        --v3-primary: var(--ds-teal, #55D6E8);
        --v3-primary-hover: var(--ds-teal-hover, #8BE5F0);
        --v3-primary-dark: var(--ds-teal-action, #0B7189);
        --v3-primary-light: rgba(85, 214, 232, 0.16);
        --v3-secondary: var(--ds-text-secondary, #CBD5DC);
        --v3-background: var(--ds-surface-dark, #0B1115);
        --v3-surface: var(--ds-surface, #121A20);
        --v3-surface-elevated: var(--ds-surface-subtle, #1A252D);
        --v3-surface-hover: var(--ds-surface-subtle, #1A252D);
        --v3-border: var(--ds-border, #34454F);
        --v3-border-hover: var(--ds-border-strong, #4C606C);
        --v3-text-primary: var(--ds-text-primary, #F7FAFC);
        --v3-text-secondary: var(--ds-text-secondary, #CBD5DC);
        --v3-text-tertiary: var(--ds-text-muted, #9AA8B2);
        --v3-text-inverse: #FFFFFF;
        --v3-glass-bg: rgba(18, 26, 32, 0.92);
        --v3-glass-border: rgba(85, 214, 232, 0.22);
    }

    /* Full-screen search canvas and loading state. */
    body.mld-map-active,
    .mld-fixed-wrapper,
    #bme-listings-list-container {
        color: var(--ds-text-primary, #F7FAFC);
        background: var(--ds-surface-dark, #0B1115);
    }

    #bme-map-container {
        background: #0B1115;
    }

    #mld-mobile-loading {
        color: var(--ds-text-primary, #F7FAFC);
        background: rgba(18, 26, 32, 0.96);
        border: 1px solid var(--ds-border, #34454F);
    }

    #mld-mobile-loading span::before {
        border-color: var(--ds-border, #34454F);
        border-top-color: var(--ds-teal, #55D6E8);
    }

    /* Search controls, menus, filters, and map option rail. */
    #bme-search-input,
    #bme-search-input-modal,
    #bme-property-type-select,
    #bme-agent-search-input,
    .bme-control-select,
    .bme-filter-row input,
    .bme-filter-row select,
    .bme-range-selects select,
    .bme-polygon-name-input,
    .bme-select-display {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: var(--ds-border, #34454F);
        background-color: var(--ds-surface, #121A20);
    }

    :where(#bme-search-input, #bme-search-input-modal, #bme-agent-search-input)::placeholder {
        color: var(--ds-text-muted, #9AA8B2);
        opacity: 1;
    }

    #bme-filters-button,
    #bme-sort-button,
    #bme-sort-menu,
    #bme-autocomplete-suggestions,
    #bme-autocomplete-suggestions-modal,
    #bme-agent-suggestions,
    .bme-select-dropdown,
    .bme-drawing-panel,
    #bme-map-type-popup,
    .bme-map-control-btn,
    #bme-map-controls .bme-nearby-toggle-container,
    .bme-draw-toggle-container {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: var(--ds-border, #34454F);
        background: var(--ds-surface, #121A20);
        box-shadow: var(--ds-shadow-md);
    }

    #bme-save-search-btn,
    #bme-save-search-btn:hover {
        color: #FFFFFF;
        border-color: var(--ds-teal-action, #0B7189);
        background-color: var(--ds-teal-action, #0B7189);
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.44);
    }

    #bme-save-search-btn:focus-visible {
        outline-color: var(--ds-teal, #55D6E8);
    }

    #bme-filters-button svg,
    #bme-sort-button svg,
    .bme-sold-label,
    .bme-nearby-label,
    #bme-map-controls .bme-nearby-label,
    .bme-draw-toggle-label,
    .bme-control-label,
    .bme-controls-title,
    .bme-controls-icon,
    .bme-chevron,
    .bme-map-control-btn,
    .bme-school-toggles .bme-toggle-label,
    .bme-select-arrow,
    .bme-select-option span,
    .bme-polygon-name,
    .bme-drawing-panel-header h3 {
        color: var(--ds-text-secondary, #CBD5DC);
    }

    #bme-sort-menu li,
    .bme-suggestion-item,
    .bme-agent-suggestion,
    .bme-select-option label {
        color: var(--ds-text-primary, #F7FAFC);
    }

    #bme-sort-menu li:hover,
    .bme-suggestion-item:hover,
    .bme-suggestion-item.active,
    .bme-agent-suggestion:hover,
    .bme-select-option label:hover,
    .bme-controls-toggle:hover,
    .bme-control-item:hover,
    .bme-polygon-item:hover {
        background: var(--ds-surface-raised, #22303A);
    }

    .bme-suggestion-type,
    .bme-polygon-item,
    .bme-filter-header,
    #bme-filter-tags-container-modal {
        color: var(--ds-text-secondary, #CBD5DC);
        background: var(--ds-surface-subtle, #1A252D);
        border-color: var(--ds-border, #34454F);
    }

    .bme-map-controls-panel,
    .bme-map-controls-panel:hover {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: rgba(85, 214, 232, 0.22) !important;
        background: rgba(18, 26, 32, 0.9) !important;
        box-shadow: 0 8px 26px rgba(0, 0, 0, 0.48),
            0 0 0 1px rgba(85, 214, 232, 0.08) inset !important;
    }

    .bme-controls-header,
    .bme-action-button {
        color: var(--ds-text-secondary, #CBD5DC);
        border-color: rgba(85, 214, 232, 0.18);
        background: rgba(26, 37, 45, 0.86);
    }

    .bme-action-button:hover {
        background: rgba(34, 48, 58, 0.96);
    }

    .bme-toggle-slider,
    .bme-draw-toggle {
        background-color: var(--ds-border-strong, #4C606C);
    }

    .bme-toggle-switch input:checked + .bme-toggle-slider,
    .bme-draw-toggle.active,
    input:checked + .bme-slider {
        background-color: var(--ds-teal-action, #0B7189);
    }

    .bme-toggle-slider::before,
    .bme-draw-toggle-slider,
    .bme-slider::before {
        background-color: #F7FAFC;
    }

    /* Presets and active filter chips remain readable over map tiles. */
    .bme-quick-filter-preset {
        color: var(--ds-text-secondary, #CBD5DC);
        border-color: rgba(154, 168, 178, 0.42);
        background: rgba(18, 26, 32, 0.92);
        box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4);
    }

    .bme-quick-filter-preset:hover {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: rgba(85, 214, 232, 0.64);
        background: rgba(26, 37, 45, 0.97);
    }

    .bme-quick-filter-preset.is-active,
    .bme-quick-filter-preset[aria-pressed="true"],
    .bme-quick-filter-preset.is-active:hover,
    .bme-quick-filter-preset[aria-pressed="true"]:hover {
        color: #E6F8FB;
        border-color: var(--ds-teal, #55D6E8);
        background: #163D49;
        box-shadow: 0 0 0 1px rgba(85, 214, 232, 0.18), 0 3px 9px rgba(0, 0, 0, 0.42);
    }

    .bme-quick-filter-preset:focus-visible {
        outline-color: var(--ds-teal, #55D6E8);
        box-shadow: 0 0 0 2px #0B1115;
    }

    .bme-filter-tag {
        color: #E6F8FB;
        border-color: rgba(85, 214, 232, 0.68);
        background: #163D49;
    }

    .bme-filter-tag-remove {
        color: var(--ds-teal, #55D6E8);
    }

    /* Price pins: dark body, luminous perimeter, white price. */
    .bme-price-marker,
    .bme-unit-cluster-marker,
    .mld-price-marker {
        color: #FFFFFF;
        border-color: #55D6E8;
        background: #163D49;
        box-shadow: 0 0 0 1px rgba(85, 214, 232, 0.2), 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    .mld-price-marker {
        border: 1px solid #55D6E8;
    }

    .mld-price-marker::after {
        border-top-color: #163D49;
    }

    .mld-price-marker.active,
    .mld-price-marker:hover,
    .mld-price-marker:active {
        color: #FFFFFF;
        border-color: #8BE5F0;
        background: #0B7189;
        box-shadow: 0 0 0 2px rgba(85, 214, 232, 0.36), 0 5px 14px rgba(0, 0, 0, 0.54);
    }

    .mld-price-marker.active::after,
    .mld-price-marker:hover::after,
    .mld-price-marker:active::after {
        border-top-color: #0B7189;
    }

    .bme-dot-marker {
        border-color: #0B1115;
        background-color: #55D6E8;
        box-shadow: 0 0 0 2px rgba(85, 214, 232, 0.35);
    }

    .bme-price-marker-archive,
    .bme-unit-cluster-marker-archive {
        color: #F7FAFC !important;
        border-color: #60727D !important;
        background: #34454F !important;
    }

    .bme-price-marker-public-record {
        color: #FFFFFF !important;
        border-color: #60A5FA !important;
        background: #315D7C !important;
    }

    .bme-price-marker-team {
        color: #FFFFFF !important;
        border-color: #55D6E8 !important;
        background: #0B7189 !important;
        box-shadow: 0 0 0 1px rgba(85, 214, 232, 0.3), 0 4px 14px rgba(0, 0, 0, 0.52);
        animation: none;
    }

    .bme-team-house-banner {
        color: #E6F8FB;
        border-color: #55D6E8;
        background: #163D49;
    }

    .bme-exclusive-star-banner,
    .bme-card-tag.mld-exclusive-badge {
        color: #111827 !important;
        background: #FBBF24;
    }

    .bme-price-marker.highlighted-hover,
    .bme-unit-cluster-marker.highlighted-hover,
    .bme-price-marker.highlighted-active,
    .bme-unit-cluster-marker.highlighted-active,
    .bme-marker-container.highlighted-active .bme-marker-hover-reveal {
        color: #FFFFFF;
        border-color: #55D6E8;
        background: #0B7189;
        box-shadow: 0 0 0 2px rgba(85, 214, 232, 0.42), 0 0 18px rgba(85, 214, 232, 0.3), 0 5px 14px rgba(0, 0, 0, 0.55);
    }

    /* Google map popovers and custom controls follow the surrounding map
       appearance instead of retaining the default white card. */
    .gm-style .gm-style-iw-c,
    .mld-map-info-card,
    .mld-map-popup {
        color: var(--ds-text-primary, #F7FAFC) !important;
        border: 1px solid var(--ds-border, #34454F) !important;
        background: var(--ds-surface, #121A20) !important;
    }

    .gm-style .gm-style-iw-t::after,
    .gm-style .gm-style-iw-tc::after {
        background: var(--ds-surface, #121A20) !important;
    }

    .gm-style .gm-ui-hover-effect {
        filter: invert(1) grayscale(1);
    }

    .mld-info-card-price,
    .mld-map-popup-price,
    .mld-map-popup h4 {
        color: var(--ds-text-primary, #F7FAFC) !important;
    }

    .mld-info-card-address,
    .mld-map-popup-details,
    .mld-map-popup .details {
        color: var(--ds-text-secondary, #CBD5DC) !important;
    }

    .mld-info-card-btn-primary,
    .mld-popup-link {
        color: #FFFFFF !important;
        background: var(--ds-teal-action, #0B7189) !important;
    }

    .mld-info-card-btn-secondary,
    .mld-v3-map-directions-control {
        color: var(--ds-text-primary, #F7FAFC) !important;
        border-color: var(--ds-border, #34454F) !important;
        background: var(--ds-surface-subtle, #1A252D) !important;
    }

    /* Listing cards and map popovers. */
    .bme-listing-card {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: var(--ds-border, #34454F);
        background: var(--ds-surface, #121A20);
        box-shadow: var(--ds-shadow-md);
    }

    .bme-card-price,
    .bme-card-specs,
    .mld-card-address-line,
    .mld-card-specs-row strong {
        color: var(--ds-text-primary, #F7FAFC);
    }

    .bme-card-address,
    .bme-card-monthly-estimate,
    .bme-card-secondary-info,
    .mld-card-specs-row,
    .mld-card-meta-text {
        color: var(--ds-text-secondary, #CBD5DC);
    }

    .bme-favorite-btn,
    .bme-hide-btn {
        background: rgba(18, 26, 32, 0.94) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.48) !important;
    }

    .bme-favorite-btn svg,
    .bme-hide-btn svg {
        fill: #CBD5DC !important;
    }

    .bme-favorite-btn.saved {
        background: rgba(185, 28, 28, 0.22) !important;
    }

    .bme-hide-btn:hover {
        background: rgba(185, 28, 28, 0.24) !important;
    }

    .bme-view-details-btn,
    #bme-filters-modal-footer .button-primary {
        color: #FFFFFF;
        background: var(--ds-teal-action, #0B7189);
    }

    /* Filter and saved-search dialogs. */
    #bme-filters-modal-content,
    #bme-filters-modal-footer {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: var(--ds-border, #34454F);
        background: var(--ds-surface, #121A20);
    }

    #bme-filters-modal-header,
    #bme-filters-modal-footer,
    .bme-filter-group,
    .bme-filter-content,
    .bme-drawing-panel-header {
        border-color: var(--ds-border, #34454F);
    }

    #bme-filters-modal-close {
        color: var(--ds-text-primary, #F7FAFC);
        background: var(--ds-surface-raised, #22303A);
    }

    #bme-filters-modal-footer .button-secondary,
    .bme-input-note,
    .bme-drawing-instructions,
    .bme-no-polygons,
    #bme-open-house-count,
    .bme-select-option .bme-filter-count {
        color: var(--ds-text-muted, #9AA8B2);
    }

    .bme-button-group button,
    .bme-home-type-btn,
    .bme-price-slider-handle,
    .bme-district-grade-btn {
        color: var(--ds-text-secondary, #CBD5DC);
        border-color: var(--ds-border, #34454F);
        background: var(--ds-surface-subtle, #1A252D);
    }

    .bme-button-group button:hover,
    .bme-home-type-btn:hover,
    .bme-home-type-btn.active,
    .bme-district-grade-btn:hover {
        color: var(--ds-text-primary, #F7FAFC);
        border-color: var(--ds-teal, #55D6E8);
        background: #163D49;
    }

    .bme-button-group button.active {
        color: #FFFFFF;
        border-color: var(--ds-teal, #55D6E8);
        background: var(--ds-teal-action, #0B7189);
    }

    .bme-district-rating-picker {
        background: var(--ds-surface-raised, #22303A);
    }

    .bme-district-grade-btn.active {
        color: #FFFFFF;
        background: var(--ds-teal-action, #0B7189);
    }

    /* Google-provided zoom buttons inherit the same floating control skin. */
    .gm-control-active.gm-zoom-in,
    .gm-control-active.gm-zoom-out {
        border-color: rgba(85, 214, 232, 0.22) !important;
        background: #121A20 !important;
    }

    .gm-control-active.gm-zoom-in:hover,
    .gm-control-active.gm-zoom-out:hover {
        background: #22303A !important;
    }

    /* Property-detail shells use the same elevations as native cards. */
    body.single-property,
    body.mld-property-mobile-v3,
    .mld-v3-property,
    .mld-mobile-container {
        color: var(--v3-text-primary);
        background: var(--v3-background);
    }

    .mld-v3-nav-bar,
    .mld-v3-nav-bar.scrolled,
    .mld-v3-section,
    .mld-v3-property-header,
    .mld-v3-stats-bar,
    .mld-v3-listing-agent,
    .mld-v3-open-houses,
    .mld-v3-calculator,
    .mld-v3-market-stats,
    .mld-v3-property .mld-market-conditions,
    .mld-v3-property .mld-market-city-banner,
    .mld-v3-full-width-section {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface);
    }

    .mld-v3-property .mld-v3-nav-link {
        color: var(--v3-text-secondary);
    }

    .mld-v3-property .mld-v3-nav-link:hover {
        color: var(--v3-text-primary);
        background: var(--ds-surface-raised, #22303A);
    }

    .mld-v3-property .mld-v3-nav-link.active {
        color: var(--ds-teal, #55D6E8);
        border-color: var(--ds-teal, #55D6E8);
        background: #163D49;
    }

    .mld-v3-property .mld-v3-nav-toggle-sticky,
    .mld-v3-property .mld-v3-nav-action {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-property .mld-breadcrumbs,
    .mld-v3-property .mld-breadcrumbs a,
    .mld-v3-property .mld-breadcrumbs .current {
        color: var(--v3-text-muted);
    }

    .mld-v3-property .mld-breadcrumbs a:hover {
        color: var(--ds-teal, #55D6E8);
    }

    .mld-v3-property .mld-v3-nav-brand__img {
        filter: brightness(0) invert(1);
        opacity: 0.9;
    }

    .mld-v3-overview-item,
    .mld-v3-fact-card,
    .mld-v3-room-card,
    .mld-v3-open-house-item,
    .mld-v3-school-item,
    .mld-v3-calc-summary-card,
    .mld-v3-stat-card,
    .mld-v3-financial-item,
    .mld-v3-market-stats .mld-v3-stat-item,
    .mld-v3-history-table,
    .mld-facts-section,
    .mld-est-panel,
    .mld-est-cta-card,
    .mld-pm-card,
    .mld-v3-rail-card,
    .mld-tourslots,
    .mld-commute-card {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
        box-shadow: var(--ds-shadow-sm);
    }

    /* The V3 stylesheet qualifies several selectors with the page root, so
       mirror that specificity here to prevent isolated light cards. */
    .mld-v3-property .mld-v3-overview-item,
    .mld-v3-property .mld-property-characteristics,
    .mld-v3-property .timeline-content,
    .mld-v3-property .mld-mc-header,
    .mld-v3-property .mld-mc-health-indicator,
    .mld-v3-property .mld-mc-sparkline-container {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
        box-shadow: var(--ds-shadow-sm);
    }

    .mld-v3-property .mld-v3-stat-icon,
    .mld-v3-property .mld-v3-tag.open-house,
    .mld-v3-property .mld-v3-oh-date {
        color: var(--ds-teal, #55D6E8);
        background: #163D49;
    }

    .mld-v3-property .mld-v3-status.active {
        color: #6EE7B7;
        border-color: rgba(52, 211, 153, 0.36);
        background: rgba(4, 120, 87, 0.22);
    }

    .mld-v3-property :where(.timeline-date, .timeline-details, .timeline-agent-info, .agent-name, .office-name),
    .mld-v3-property :where(.mld-mc-health-summary, .mld-mc-sparkline-label, .mld-mc-sparkline-empty) {
        color: var(--v3-text-secondary);
    }

    /* Tour planner. The selected day/time is the action; the remaining
       choices are raised controls, never white islands inside a dark card. */
    .mld-v3-property :where(.mld-tourday, .mld-tourtime, .mld-tour-chip) {
        color: var(--v3-text-secondary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-property :where(.mld-tourday, .mld-tourtime, .mld-tour-chip):hover {
        color: var(--v3-text-primary);
        border-color: var(--ds-teal, #55D6E8);
        background: var(--ds-surface-raised, #22303A);
    }

    .mld-v3-property :where(.mld-tourday, .mld-tourtime, .mld-tour-chip).selected {
        color: #FFFFFF;
        border-color: var(--ds-teal, #55D6E8);
        background: var(--ds-teal-action, #0B7189);
    }

    .mld-v3-property :where(.mld-tourday-dow, .mld-tourday-date, .mld-tourday-count, .mld-tourtime-day, .mld-tourtime-time) {
        color: inherit;
    }

    /* Comparable-sales workspace (server-rendered and progressively
       enhanced) previously retained Bootstrap's paper palette. */
    .mld-v3-property :where(
        .mld-comp-filter-header,
        .mld-comp-filter-panel,
        .mld-comp-toolbar,
        .mld-comp-card,
        .mld-comp-adjustments
    ) {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
        box-shadow: var(--ds-shadow-sm);
    }

    .mld-v3-property :where(
        .mld-quick-filter,
        .mld-sort-btn,
        .mld-comp-arv-btn,
        .mld-comp-share-btn,
        .mld-comp-map-toggle-btn,
        .mld-weight-btn,
        .mld-weight-reset-btn,
        .mld-mc-toggle
    ) {
        color: var(--v3-text-secondary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-property :where(.mld-quick-filter, .mld-sort-btn, .mld-weight-btn):hover,
    .mld-v3-property :where(.mld-quick-filter, .mld-sort-btn, .mld-weight-btn).active {
        color: var(--v3-text-primary);
        border-color: var(--ds-teal, #55D6E8);
        background: #163D49;
    }

    .mld-v3-property :where(.mld-comp-address, .mld-comp-price) {
        color: var(--v3-text-primary);
    }

    .mld-v3-property :where(.mld-comp-details, .mld-comp-toolbar-label, .mld-weight-value) {
        color: var(--v3-text-secondary);
    }

    .mld-v3-property .mld-comp-distance {
        color: #BFDBFE;
        background: rgba(49, 93, 124, 0.42);
    }

    .mld-v3-property .mld-comp-grade {
        border-color: var(--v3-border);
        background: var(--ds-surface-raised, #22303A);
    }

    .mld-v3-property .mld-comp-grade.grade-SUBJECT { color: var(--ds-teal, #55D6E8); }
    .mld-v3-property .mld-comp-grade.grade-C { color: #FDE68A; }
    .mld-v3-property .mld-comp-grade.grade-D { color: #FDBA74; }
    .mld-v3-property .mld-comp-grade.grade-F { color: #FCA5A5; }

    .mld-v3-property .mld-ppsf-diff.positive {
        color: #FDE68A;
        background: rgba(180, 83, 9, 0.24);
    }

    .mld-v3-property .mld-ppsf-diff.negative {
        color: #A5F3FC;
        background: rgba(14, 116, 144, 0.25);
    }

    .mld-v3-property .mld-v3-calc-disclaimer {
        color: var(--v3-text-secondary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-property .mld-v3-amort-interest {
        background: rgba(185, 28, 28, 0.42);
    }

    .mld-v3-property .mld-v3-amort-principal {
        background: rgba(4, 120, 87, 0.46);
    }

    .mld-v3-property :where(.mld-skeleton-line, .mld-skeleton-tab, .mld-skeleton-metric-card) {
        border-color: var(--v3-border);
        background: linear-gradient(90deg, #1A252D 25%, #34454F 50%, #1A252D 75%);
        background-size: 200% 100%;
    }

    .mld-v3-overview-item:hover,
    .mld-v3-fact-card:hover,
    .mld-v3-room-card:hover,
    .mld-pm-card:hover {
        border-color: var(--v3-border-hover);
        background: var(--ds-surface-raised, #22303A);
    }

    .mld-v3-property .mld-pm-card-photo {
        background: var(--ds-surface-raised, #22303A);
    }

    .mld-v3-property .mld-pm-card-price {
        color: var(--v3-text-primary) !important;
    }

    .mld-v3-property .mld-pm-card-addr {
        color: var(--v3-text-tertiary) !important;
    }

    .mld-v3-property .mld-similar-alert {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
        background-image: none;
    }

    .mld-v3-property .mld-similar-alert__eyebrow {
        color: var(--ds-teal, #55D6E8);
    }

    .mld-v3-property .mld-similar-alert__copy strong {
        color: var(--v3-text-primary);
    }

    .mld-v3-property .mld-similar-alert__copy > span:last-child {
        color: var(--v3-text-secondary);
    }

    .mld-v3-property .mld-similar-alert__action {
        color: #FFFFFF;
        border-color: var(--ds-teal-action, #0B7189);
        background: var(--ds-teal-action, #0B7189);
    }

    .mld-v3-section h2,
    .mld-v3-section h3,
    .mld-v3-listing-agent h2,
    .mld-v3-address,
    .mld-v3-price,
    .mld-v3-stat-value,
    .mld-v3-overview-value,
    .mld-v3-rail-price,
    .mld-est-value,
    .mld-v3-history-table td,
    .mld-facts-section-title {
        color: var(--v3-text-primary) !important;
    }

    .mld-v3-location,
    .mld-v3-monthly,
    .mld-v3-stat-label,
    .mld-v3-overview-label,
    .mld-v3-rail-monthly,
    .mld-v3-rail-facts,
    .mld-pm-card-meta,
    .mld-pm-card-address {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-calc-field input,
    .mld-v3-calc-field select,
    .mld-tour-chip,
    .mld-tourdate,
    .mld-tourtime,
    .mld-tourpick-day,
    .mld-tourpick-time,
    .mld-commute-add,
    .mld-v3-rail-btn {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-btn-primary,
    .mld-v3-cta-primary,
    .mld-v3-cta-btn,
    .mld-v3-rail-btn-primary {
        color: #FFFFFF;
        border-color: var(--ds-teal-action, #0B7189);
        background: var(--ds-teal-action, #0B7189);
    }

    .mld-v3-btn-secondary,
    .mld-v3-cta-secondary {
        color: var(--ds-teal, #55D6E8);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
    }

    .mld-v3-history-table th {
        color: var(--v3-text-secondary) !important;
        border-color: var(--v3-border) !important;
        background: var(--ds-surface-raised, #22303A) !important;
    }

    .mld-v3-history-table td,
    .mld-v3-history-table tr,
    .mld-v3-history-table {
        border-color: var(--v3-border);
    }

    .mld-est-skel-line {
        background: linear-gradient(90deg, #1A252D 25%, #34454F 50%, #1A252D 75%);
        background-size: 200% 100%;
    }

    /* Several legacy property-detail modules ship page-local styles after the
       shared stylesheets, and one characteristics panel carries inline colors.
       These scoped overrides are intentionally important so those light-mode
       literals cannot create isolated paper cards in dark appearance. */
    .mld-v3-property .mld-v3-overview-item,
    .mld-v3-property .mld-property-characteristics,
    .mld-v3-property .mld-comp-filter-header,
    .mld-v3-property .mld-comp-filter-panel,
    .mld-v3-property .mld-comp-toolbar,
    .mld-v3-property .mld-comp-card {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
    }

    .mld-v3-property .mld-comp-adjustments {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--ds-surface-raised, #22303A) !important;
    }

    .mld-v3-property .mld-v3-nav-toggle-sticky,
    .mld-v3-property .mld-v3-nav-action,
    .mld-v3-property .mld-quick-filter,
    .mld-v3-property .mld-sort-btn,
    .mld-v3-property .mld-comp-arv-btn,
    .mld-v3-property .mld-comp-share-btn,
    .mld-v3-property .mld-comp-map-toggle-btn,
    .mld-v3-property .mld-weight-btn,
    .mld-v3-property .mld-weight-reset-btn,
    .mld-v3-property .mld-mc-toggle {
        color: var(--v3-text-secondary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
    }

    .mld-v3-property .mld-quick-filter:hover,
    .mld-v3-property .mld-quick-filter.active,
    .mld-v3-property .mld-sort-btn:hover,
    .mld-v3-property .mld-weight-btn:hover,
    .mld-v3-property .mld-weight-btn.active,
    .mld-v3-property .mld-comp-arv-btn:hover,
    .mld-v3-property .mld-comp-share-btn:hover,
    .mld-v3-property .mld-comp-map-toggle-btn:hover,
    .mld-v3-property .mld-comp-map-toggle-btn.active,
    .mld-v3-property .mld-mc-toggle:hover {
        color: var(--v3-text-primary) !important;
        border-color: var(--ds-teal, #55D6E8) !important;
        background: #163D49 !important;
    }

    .mld-v3-property .mld-property-characteristics label,
    .mld-v3-property .mld-comp-details,
    .mld-v3-property .mld-comp-toolbar-label,
    .mld-v3-property .mld-weight-value,
    .mld-v3-property .mld-comp-adjustments-header {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-property .mld-comp-address,
    .mld-v3-property .mld-comp-price {
        color: var(--v3-text-primary) !important;
    }

    /* Deep property modules predate the shared tokens and include a mix of
       inline and highly-qualified light-mode text colors. Keep their semantic
       hierarchy while guaranteeing readable values and captions. */
    .mld-v3-property :where(
        .mld-tourslots-title,
        .mld-est-cta-title,
        .mld-v3-financial-value,
        .mld-v3-agent-value,
        .mld-mc-trends h4
    ) {
        color: var(--v3-text-primary) !important;
    }

    .mld-v3-property :where(
        .mld-property-track-benefit,
        .mld-tourslots-sub,
        .mld-est-cta-sub,
        .timeline-date,
        .timeline-details,
        .timeline-agent-info,
        .mld-v3-financial-label,
        .mld-v3-feature-item strong,
        .mld-commute-card p,
        .mld-v3-agent-label,
        .mld-mc-health-label,
        .mld-mc-health-summary,
        .mld-mc-sparkline-label,
        .mld-mc-sparkline-empty,
        .mld-ppsf-label,
        .mld-market-city-banner__subtitle
    ) {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-property .mld-v3-feature-item > span,
    .mld-v3-property .mld-v3-agent-value a {
        color: var(--v3-text-primary) !important;
    }

    .mld-v3-property .mld-v3-agent-value a:hover,
    .mld-v3-property .mld-v3-summary-value {
        color: var(--ds-teal, #55D6E8) !important;
    }

    .mld-v3-property .mld-v3-rate-cost,
    .mld-v3-property .mld-v3-interest-pct,
    .mld-v3-property .mld-v3-amort-interest .mld-v3-amort-label {
        color: #FCA5A5 !important;
    }

    .mld-v3-property .mld-v3-rate-scenario {
        color: var(--v3-text-primary);
        border-color: var(--v3-border);
        background: var(--v3-surface-elevated);
        background-image: none;
    }

    .mld-v3-property .mld-v3-rate-label {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-property .mld-v3-rate-value {
        color: var(--v3-text-primary) !important;
    }

    .mld-v3-property .mld-v3-rate-save {
        color: #6EE7B7 !important;
    }

    .mld-v3-property .mld-v3-amort-principal .mld-v3-amort-label {
        color: #6EE7B7 !important;
    }

    .mld-v3-property .mld-comp-price > span,
    .mld-v3-property .mld-comp-content > div:not([class]),
    .mld-v3-property .mld-comp-content > div:not([class]) span,
    .mld-v3-property .mld-weight-controls > div,
    .mld-v3-property .mld-weight-controls span,
    .mld-v3-property .mld-comp-adjustments-header span {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-property .mld-comp-content > div:not([class]) strong,
    .mld-v3-property .mld-weight-value {
        color: var(--ds-teal, #55D6E8) !important;
    }

    .mld-v3-property .mld-weight-controls {
        color: var(--v3-text-secondary) !important;
        border-color: var(--v3-border) !important;
        background: var(--ds-surface-raised, #22303A) !important;
        background-image: none !important;
    }

    .mld-v3-property .mld-adjustment-item > span:first-child {
        color: var(--v3-text-secondary) !important;
    }

    .mld-v3-property .mld-adjustment-positive,
    .mld-v3-property .mld-adjustment-positive strong {
        color: #6EE7B7 !important;
    }

    .mld-v3-property .mld-adjustment-negative,
    .mld-v3-property .mld-adjustment-negative strong {
        color: #FCA5A5 !important;
    }

    /* Media controls stay legible over both bright and dark photography. */
    .mld-v3-property .mld-v3-gallery-nav,
    .mld-v3-property .mld-v3-gallery-action,
    .mld-v3-property .mld-comp-favorite {
        color: #FFFFFF !important;
        border-color: rgba(255, 255, 255, 0.24) !important;
        background: rgba(11, 17, 21, 0.88) !important;
        backdrop-filter: blur(10px);
    }

    .mld-v3-property .mld-v3-gallery-nav:hover,
    .mld-v3-property .mld-v3-gallery-action:hover,
    .mld-v3-property .mld-comp-favorite:hover {
        color: #FFFFFF !important;
        border-color: var(--ds-teal, #55D6E8) !important;
        background: rgba(11, 113, 137, 0.94) !important;
    }

    /* The mobile property page is a separate, app-like bottom-sheet tree (it
       does not sit inside .mld-v3-property), so it needs its own semantic skin. */
    body.mld-property-mobile-v3,
    body.mld-property-mobile-v3 .mld-mobile-container {
        color: var(--v3-text-primary) !important;
        background: var(--v3-background) !important;
    }

    body.mld-property-mobile-v3 :is(.mld-bottom-sheet, .mld-sheet-content) {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-background) !important;
    }

    body.mld-property-mobile-v3 .mld-handle-bar {
        background: var(--v3-border-hover) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-section-mobile,
        .mld-v3-open-houses,
        .mld-tourslots,
        .mld-est-panel,
        .mld-est-cta-card,
        .timeline-content,
        .mld-v3-history-table,
        .mld-v3-rate-impact,
        .mld-v3-amortization,
        .mld-commute-card,
        .mld-listing-agent-card,
        .mld-v3-disclosure-mobile,
        .mld-contact-card,
        .mld-v3-full-width-section,
        .mld-market-conditions,
        .mld-market-city-banner
    ) {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface) !important;
        background-image: none !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-overview-item-mobile,
        .mld-v3-open-house-item,
        .mld-v3-calc-summary-card,
        .mld-v3-calc-item,
        .mld-v3-rate-scenario,
        .mld-mc-health-indicator,
        .mld-mc-sparkline-container,
        .mld-comp-filter-panel,
        .mld-comp-filter-header,
        .mld-comp-toolbar,
        .mld-comp-card,
        .mld-property-characteristics,
        .mld-comp-adjustments,
        .mld-weight-controls
    ) {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
        background-image: none !important;
        box-shadow: var(--ds-shadow-sm);
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-monthly,
        .mld-stat,
        .mld-gallery-controls-inline,
        .mld-v3-action-btn-mobile,
        .mld-tourday,
        .mld-tourtime,
        .mld-commute-add,
        .mld-map-expand-btn,
        .mld-map-fab,
        .mld-quick-filter,
        .mld-sort-btn,
        .mld-comp-arv-btn,
        .mld-comp-share-btn,
        .mld-comp-map-toggle-btn,
        .mld-weight-btn,
        .mld-weight-reset-btn,
        .mld-mc-toggle,
        .mld-sticky-cta-contact,
        .mobile-action-btn
    ) {
        color: var(--v3-text-secondary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
        background-image: none !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-action-btn-mobile,
        .mld-tourday,
        .mld-tourtime,
        .mld-commute-add,
        .mld-map-expand-btn,
        .mld-quick-filter,
        .mld-sort-btn,
        .mld-comp-arv-btn,
        .mld-comp-share-btn,
        .mld-comp-map-toggle-btn,
        .mld-weight-btn,
        .mld-weight-reset-btn,
        .mld-mc-toggle,
        .mld-sticky-cta-contact,
        .mobile-action-btn
    ):hover {
        color: var(--v3-text-primary) !important;
        border-color: var(--ds-teal, #55D6E8) !important;
        background: var(--ds-surface-raised, #22303A) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-cta-primary,
        .mld-schedule-tour,
        .mld-sticky-cta-primary,
        .mld-tourday.selected,
        .mld-tourtime.selected,
        .mld-weight-btn.active,
        .mld-comp-map-toggle-btn.active
    ) {
        color: #FFFFFF !important;
        border-color: var(--ds-teal-action, #0B7189) !important;
        background: var(--ds-teal-action, #0B7189) !important;
    }

    body.mld-property-mobile-v3 :is(.mld-cta-secondary, .mld-contact-agent) {
        color: var(--ds-teal, #55D6E8) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
    }

    body.mld-property-mobile-v3 .mld-status-badge.active,
    body.mld-property-mobile-v3 .mld-status-badge-inline.active {
        color: #6EE7B7 !important;
        border-color: rgba(52, 211, 153, 0.36) !important;
        background: rgba(4, 120, 87, 0.42) !important;
    }

    body.mld-property-mobile-v3 .mld-v3-tag.open-house {
        color: #FDE68A !important;
        border-color: rgba(251, 191, 36, 0.34) !important;
        background: rgba(180, 83, 9, 0.34) !important;
    }

    body.mld-property-mobile-v3 .mld-v3-monthly {
        color: var(--v3-text-primary) !important;
        background: #163D49 !important;
    }

    body.mld-property-mobile-v3 .mld-sticky-cta {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: rgba(18, 26, 32, 0.92) !important;
        backdrop-filter: blur(18px);
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-calc-field input,
        .mld-v3-calc-field select
    ) {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
        color-scheme: dark;
    }

    body.mld-property-mobile-v3 .mld-v3-calc-disclaimer {
        color: var(--v3-text-secondary) !important;
        border-color: rgba(251, 191, 36, 0.28) !important;
        background: rgba(180, 83, 9, 0.2) !important;
    }

    body.mld-property-mobile-v3 .mld-v3-map-container {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-background) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-modal-content,
        .mld-glossary-tooltip
    ) {
        color: var(--v3-text-primary) !important;
        border-color: var(--v3-border) !important;
        background: var(--v3-surface-elevated) !important;
    }

    body.mld-property-mobile-v3 .mld-modal-close {
        color: #FFFFFF !important;
        background: rgba(11, 17, 21, 0.72) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-skeleton-tab,
        .mld-skeleton-metric-card,
        .mld-skeleton-line
    ) {
        border-color: var(--v3-border) !important;
        background: linear-gradient(90deg, #1A252D 25%, #34454F 50%, #1A252D 75%) !important;
        background-size: 200% 100% !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-comp-address,
        .mld-comp-price,
        .mld-v3-financial-value,
        .mld-v3-rate-value,
        .mld-v3-agent-value,
        .mld-tourslots-title,
        .mld-est-cta-title,
        .mld-mc-trends h4
    ) {
        color: var(--v3-text-primary) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-comp-details,
        .mld-comp-toolbar-label,
        .mld-property-characteristics label,
        .mld-comp-adjustments-header,
        .mld-weight-controls > div,
        .mld-weight-controls span,
        .mld-v3-financial-label,
        .mld-v3-agent-label,
        .timeline-date,
        .timeline-details,
        .timeline-agent-info,
        .mld-tourslots-sub,
        .mld-est-cta-sub,
        .mld-mc-health-label,
        .mld-mc-health-summary,
        .mld-mc-sparkline-label,
        .mld-mc-sparkline-empty,
        .mld-ppsf-label,
        .mld-market-city-banner__subtitle
    ) {
        color: var(--v3-text-secondary) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-content > div:not([class]),
    body.mld-property-mobile-v3 .mld-comp-content > div:not([class]) span {
        color: var(--v3-text-secondary) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-content > div:not([class]) strong,
    body.mld-property-mobile-v3 .mld-weight-value,
    body.mld-property-mobile-v3 .mld-v3-summary-value {
        color: var(--ds-teal, #55D6E8) !important;
    }

    body.mld-property-mobile-v3 .mld-ppsf-diff.positive {
        color: #FDE68A !important;
        background: rgba(180, 83, 9, 0.24) !important;
    }

    body.mld-property-mobile-v3 .mld-ppsf-diff.negative {
        color: #A5F3FC !important;
        background: rgba(14, 116, 144, 0.25) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-distance {
        color: #BFDBFE !important;
        background: rgba(49, 93, 124, 0.42) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-grade {
        border-color: var(--v3-border) !important;
        background: var(--ds-surface-raised, #22303A) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-favorite {
        color: #FFFFFF !important;
        border-color: rgba(255, 255, 255, 0.24) !important;
        background: rgba(11, 17, 21, 0.88) !important;
    }

    body.mld-property-mobile-v3 .mld-breadcrumbs a,
    body.mld-property-mobile-v3 :is(
        .mld-listing-agent-phone,
        .mld-contact-card-label,
        .mld-contact-card-phone,
        .mld-modal-section-title
    ) {
        color: var(--ds-teal, #55D6E8) !important;
    }

    body.mld-property-mobile-v3 .mld-breadcrumbs :is(.current, .separator) {
        color: var(--v3-text-secondary) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-price,
        .mld-address,
        .mld-stat strong,
        .mld-v3-section-header h2,
        .mld-v3-section-header h3,
        .mld-v3-section-mobile > h2,
        .mld-v3-section-mobile > h3,
        .mld-v3-property-overview-mobile h3,
        .mld-v3-overview-value-mobile,
        .mld-property-type-link,
        .mld-fact-value,
        .mld-v3-fact-value-mobile,
        .mld-commute-title,
        .mld-comp-filter-header h3,
        .mld-sticky-cta-price strong
    ) {
        color: var(--v3-text-primary) !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-dom,
        .mld-location-info,
        .mld-listing-details,
        .mld-v3-mls-number-mobile,
        .mld-gallery-control span,
        .mld-property-track-benefit,
        .mld-v3-overview-label-mobile,
        .mld-fact-label,
        .mld-v3-fact-label-mobile,
        .mld-commute-empty p,
        .mld-sticky-cta-price span
    ) {
        color: var(--v3-text-secondary) !important;
    }

    body.mld-property-mobile-v3 .mld-v3-history-timeline h4 {
        color: var(--ds-teal, #55D6E8) !important;
    }

    body.mld-property-mobile-v3 .mld-v3-oh-date {
        color: var(--v3-text-primary) !important;
        border-color: rgba(85, 214, 232, 0.34) !important;
        background: #163D49 !important;
    }

    body.mld-property-mobile-v3 .mld-v3-oh-date :is(.mld-v3-oh-day, .mld-v3-oh-month) {
        color: inherit !important;
    }

    body.mld-property-mobile-v3 .mld-v3-add-calendar {
        color: #FFFFFF !important;
        border-color: var(--ds-teal-action, #0B7189) !important;
        background: var(--ds-teal-action, #0B7189) !important;
    }

    body.mld-property-mobile-v3 :is(.mld-tourday-dow, .mld-tourday-count) {
        color: var(--v3-text-secondary) !important;
    }

    body.mld-property-mobile-v3 :is(.mld-tourday-date, .mld-tourtime-time) {
        color: var(--v3-text-primary) !important;
    }

    body.mld-property-mobile-v3 :is(.mld-tourday.selected, .mld-tourtime.selected) * {
        color: #FFFFFF !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-rate-cost,
        .mld-v3-interest-pct,
        .mld-v3-amort-interest .mld-v3-amort-label,
        .mld-comp-grade.grade-F
    ) {
        color: #FCA5A5 !important;
    }

    body.mld-property-mobile-v3 :is(
        .mld-v3-rate-save,
        .mld-v3-amort-principal .mld-v3-amort-label
    ) {
        color: #6EE7B7 !important;
    }

    body.mld-property-mobile-v3 .mld-comp-grade.grade-SUBJECT {
        color: var(--ds-teal, #55D6E8) !important;
    }

    body.mld-property-mobile-v3 .mld-comp-grade.grade-C {
        color: #FDE68A !important;
    }

    body.mld-property-mobile-v3 .mld-comp-grade.grade-D {
        color: #FDBA74 !important;
    }

    body.mld-property-mobile-v3 .mld-comp-price > span,
    body.mld-property-mobile-v3 .mld-comp-adjustments-header > span {
        color: var(--v3-text-secondary) !important;
    }

    /* Keep intentionally light QR codes, photographs, and media viewers intact. */
    :where(.mld-app-promo-qr, .mld-guide-app-promo__qr, .mld-v3-gallery-photo, .mld-v3-carousel) {
        color-scheme: light;
    }
}
