/* User-selectable application theme. Geometry and component ownership stay in their source CSS. */
.app-theme-control {
    display: grid;
    gap: 8px;
    padding: 10px 14px;
    border-block: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, #ffffff);
}

.app-theme-control--auth {
    margin: 0 0 14px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 10px;
}

.app-theme-control__label {
    color: var(--color-text, #1e293b);
    font-size: 0.86rem;
    font-weight: 750;
}

.app-theme-control__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
}

.app-theme-control__option {
    min-width: 0;
    min-height: 44px;
    padding: 8px 6px;
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 8px;
    background: var(--color-surface, #ffffff);
    color: #173f5b;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.app-theme-control__option:hover {
    border-color: color-mix(in srgb, var(--color-primary, #4a90d9) 68%, var(--color-border, #cbd5e1));
    background: color-mix(in srgb, var(--color-primary, #4a90d9) 8%, var(--color-surface, #ffffff));
}

.app-theme-control__option[aria-pressed="true"] {
    border-color: #4a90d9;
    background: #e7f1ff;
    color: #123d6b;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #4a90d9 26%, transparent);
}

.app-theme-control__status {
    grid-column: 1 / -1;
    color: var(--color-text-secondary, #64748b);
    font-size: 0.7rem;
    line-height: 1.45;
}

.app-theme-control__option:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-primary, #4a90d9) 55%, transparent);
    outline-offset: 2px;
}

html[data-theme="dark"] .app-theme-control__option {
    background: #111a29;
    border-color: #40546d;
    color: #dbeafe;
}

html[data-theme="dark"] .app-theme-control__option:hover {
    background: #172f52;
    border-color: #7db7ff;
}

html[data-theme="dark"] .app-theme-control__option[aria-pressed="true"] {
    background: #1d4e89;
    border-color: #93c5fd;
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(219, 234, 254, 0.3);
}

html[data-theme="dark"] {
    --color-primary: #60a5fa;
    --color-primary-dark: #3b82f6;
    --color-primary-light: #93c5fd;
    --color-primary-bg: #172554;
    --color-text: #e7eef8;
    --color-text-secondary: #bdc9d8;
    --color-text-muted: #8fa0b5;
    --color-bg: #0b1220;
    --color-surface: #151f30;
    --color-surface-raised: #1b283b;
    --color-surface-soft: #111a29;
    /* Decorative boundaries stay visible without turning every dark card into a heavy grid. */
    --color-border: rgba(143, 160, 181, 0.24);
    --color-border-light: rgba(143, 160, 181, 0.14);
    --color-success: #4ade80;
    --color-success-bg: #12351f;
    --color-warning: #fbbf24;
    --color-warning-bg: #3b2a0e;
    --color-danger: #fb7185;
    --color-danger-bg: #421821;
    --color-info: #7db7ff;
    --color-info-bg: #172f52;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 18px 46px rgba(0, 0, 0, 0.42);
    --ad-bg: #0b1220;
    --app-statusbar-bg: #0b1220;
    color-scheme: dark;
    background: #0b1220 !important;
}

/* Reveal one intact root snapshot so inverse text/background colors never blend. */
::view-transition-old(root) {
    animation: none;
}

::view-transition-new(root) {
    animation: app-theme-reveal 2000ms cubic-bezier(0.45, 0, 0.55, 1) both;
}

@keyframes app-theme-reveal {
    from { clip-path: circle(0 at calc(100% - 44px) 44px); }
    to { clip-path: circle(150vmax at calc(100% - 44px) 44px); }
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.unified-page,
html[data-theme="dark"] body.unified-page.app-shell,
html[data-theme="dark"] body.private-bids-page,
html[data-theme="dark"] body.profile-page,
html[data-theme="dark"] body::before,
html[data-theme="dark"] body.profile-page::before,
html[data-theme="dark"] body.private-bids-page::before {
    background: #0b1220 !important;
    color: var(--color-text) !important;
    color-scheme: dark !important;
}

html[data-theme="dark"] #iosPwaStatusbarShield,
html[data-theme="dark"] body.profile-page > .container,
html[data-theme="dark"] body.private-bids-page > .container {
    background: var(--app-statusbar-bg) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active),
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) > .container,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .container,
html[data-theme="dark"] .app-viewport-region,
html[data-theme="dark"] .app-content-region,
html[data-theme="dark"] main {
    background-color: #0b1220 !important;
    color: var(--color-text) !important;
}

/* Header, navigation, user menu */
html[data-theme="dark"] header,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) header,
html[data-theme="dark"] .sticky-search-bar,
html[data-theme="dark"] #stickySearchBar,
html[data-theme="dark"] .bottom-tab-bar {
    background: rgba(17, 26, 41, 0.97) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] :where(
    .header-icon-btn,
    .header-menu-btn,
    .bottom-tab-btn,
    .global-nav button,
    .global-nav a
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .header-icon-btn:hover,
    .header-icon-btn:focus-visible,
    .header-menu-btn:hover,
    .bottom-tab-btn.active
) {
    background: #22324a !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .header-menu-label,
html[data-theme="dark"] .header-icon-label,
html[data-theme="dark"] .version-pill {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .user-menu {
    background: var(--color-surface-raised) !important;
    border: 1px solid var(--color-border) !important;
    box-shadow: var(--shadow-lg) !important;
}

html[data-theme="dark"] .user-menu-header {
    background: linear-gradient(135deg, #172235 0%, #22324a 100%) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(.user-menu-header strong, .user-menu-item, .umc-val) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.user-menu-header small, .umc-label, .umc-loading, .umc-next) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.user-menu-credit, .umc-item) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .umc-va {
    background: #17264a !important;
}

html[data-theme="dark"] :where(.umc-va-label, .umc-va-num, .umc-link) {
    color: #93c5fd !important;
}

html[data-theme="dark"] .user-menu-item:hover,
html[data-theme="dark"] .user-menu-item:focus-visible {
    background: #22324a !important;
}

html[data-theme="dark"] :where(
    .search-bookmark-side,
    .search-bookmark-side-header,
    .search-bookmark-side-list,
    .search-bookmark-side-item,
    .bookmark-item
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

/* Search, filters, inputs, dropdowns */
html[data-theme="dark"] :where(
    .search-bookmark-row,
    .search-section,
    .search-panel,
    .search-box,
    .search-container,
    .search-input-wrapper,
    .search-history-dropdown,
    .short-search-menu,
    .compact-filter-menu,
    .filter-section,
    .search-filter-dialog,
    .license-dialog,
    .exclude-picker-dialog
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    textarea,
    select,
    [contenteditable="true"]
) {
    background-color: #0e1726 !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
    caret-color: #93c5fd !important;
}

html[data-theme="dark"] :where(input, textarea)::placeholder {
    color: #8292a7 !important;
    opacity: 1;
}

html[data-theme="dark"] :where(input, textarea, select, button, [role="button"]):focus-visible {
    outline-color: #7db7ff !important;
}

html[data-theme="dark"] :where(
    .search-history-item,
    .short-search-menu button,
    .compact-filter-option,
    .filter-section-header,
    .license-open-btn,
    .region-btn,
    .region-chip,
    .region-select-all,
    .data-type-chip,
    .amount-preset-btn,
    .filter-chip,
    .view-filter-btn
) {
    background-color: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .search-history-item:hover,
    .search-history-item:focus-visible,
    .short-search-menu button:hover,
    .compact-filter-option:hover,
    .compact-filter-option.active,
    .region-chip:hover,
    .region-chip:focus-within,
    .region-chip:has(input:checked),
    .data-type-chip:has(input:checked),
    .filter-chip.active,
    .view-filter-btn.active
) {
    background-color: #243956 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    .search-heading,
    .search-title,
    .filter-section-title,
    .filter-keyword-label,
    .search-result-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .search-subtitle,
    .filter-section-summary,
    .filter-keyword-hint,
    .search-hint,
    .empty-message
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-bookmark-row .search-section,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box {
    background: #111a29 !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-panel {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    border-top-color: var(--color-primary) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box input[type="search"],
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box input[type="text"] {
    background: #0e1726 !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section :where(
    .short-search-toggle,
    .compact-folder-btn,
    #licenseFilterBtn,
    #infoPanelToggleBtn,
    .result-view-select
) {
    background: #172235 !important;
    border-color: #41536b !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-folder-btn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #licenseFilterBtn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #homePrivateBidCreateAction,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .short-search-toggle,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box > .short-search-wrap .short-search-toggle {
    background: #172235 !important;
    border-color: #41536b !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #statusFilterMenu,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #typeFilterMenu,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .short-search-menu {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #statusFilterMenu .view-filter-btn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #typeFilterMenu .type-filter-btn {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #statusFilterMenu .view-filter-btn.active,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #typeFilterMenu .type-filter-btn.active {
    background: #244875 !important;
    color: #eaf3ff !important;
}

/* Calendar, weather, dashboard, news and list cards */
html[data-theme="dark"] :where(
    .date-weather-card,
    .date-card,
    .weather-card,
    .dashboard-section,
    .dashboard-card,
    .dash-card,
    .dash-panel,
    .dash-notices-panel,
    .dash-chart-card,
    .dash-stat-card,
    .dash-summary-card,
    .info-cards-section,
    .info-card,
    .info-card-item,
    .news-card,
    .news-item,
    .market-card,
    .calendar-card,
    .favorite-card,
    .bookmark-card,
    .notice-card,
    .result-card,
    .private-bid-card,
    .pb-card
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] :where(
    .dash-weather-top,
    .dash-weather-forecast,
    .dash-notices-header,
    .dash-notices-col,
    .dash-notices-col-header,
    .dash-table-wrap,
    .dash-chart-body,
    .dash-list-header
) {
    background: #111a29 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .dash-weather-temp,
    .dash-weather-desc,
    .dash-weather-loc,
    .dash-notices-title,
    .dash-list-title,
    .dash-panel-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .dash-notices-subtitle,
    .dash-list-sub,
    .dash-col-count,
    .dash-list-loading
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .info-tabs,
    .info-tab-row,
    .dashboard-tabs,
    .dash-stat-tabs,
    .pb-tab-bar,
    .calendar-dialog-top,
    .weather-dialog-top
) {
    background: #111a29 !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(
    .info-tab,
    .info-tab-btn,
    .dash-stat-tab,
    .pb-tab,
    .news-category-btn
) {
    background-color: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .info-tab.active,
    .info-tab-btn.active,
    .dash-stat-tab.active,
    .pb-tab.active,
    .news-category-btn.active
) {
    background-color: #244875 !important;
    color: #eaf3ff !important;
}

html[data-theme="dark"] :where(
    .date-mmdd,
    .date-weekday-label,
    .date-agenda-text,
    .weather-temp,
    .weather-desc,
    .weather-location,
    .weather-mini-day,
    .weather-mini-temp
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.date-agenda-label, .weather-mini-label) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .weather-forecast-mini {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(
    .news-title,
    .info-card-title,
    .notice-title,
    .card-title,
    .dashboard-title,
    .pb-card-title,
    .result-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .news-summary,
    .info-card-meta,
    .notice-meta,
    .card-meta,
    .result-meta,
    .pb-card-meta,
    .dashboard-subtitle
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] table,
html[data-theme="dark"] :where(.dashboard-table, .results-table, .contract-table, .pb-table) {
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(th, thead, .table-header) {
    background-color: #1d2c42 !important;
    color: #dce7f5 !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(td, tbody tr, .table-row) {
    border-color: var(--color-border-light) !important;
}

html[data-theme="dark"] tbody tr:hover {
    background-color: #1c2b40 !important;
}

/* The compact home owns high-specificity mobile rules in unified_search.html.
   Keep its controls legible while using quieter separators for content rows. */
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons :where(
    .compact-folder-value,
    .compact-status-control::before,
    .compact-type-control::before
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-folder-count {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #infoCardsSection .info-tab-btn {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #infoCardsSection .info-tab-btn.active {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #infoCardsSection .info-card-loading-label {
    color: var(--color-text-secondary) !important;
}

@media (max-width: 767px) {
    html[data-theme="dark"] body.unified-page #infoCardsSection :is(
        #newsInfoTabs,
        #stockInfoTabs,
        #bidWorkTabs
    ) .info-tab-btn::before {
        background: var(--color-surface-raised) !important;
        border-color: var(--color-border) !important;
    }

    html[data-theme="dark"] body.unified-page #infoCardsSection :is(
        #newsInfoTabs,
        #stockInfoTabs,
        #bidWorkTabs
    ) .info-tab-btn:is(.active, [aria-selected="true"])::before {
        background: var(--color-info-bg) !important;
        border-color: #3d78b5 !important;
    }

    html[data-theme="dark"] body.unified-page #infoCardsSection .info-card-pager-btn {
        color: #dbeafe !important;
    }

    html[data-theme="dark"] body.unified-page #infoCardsSection .info-card-pager-btn > span {
        background: var(--color-info-bg) !important;
        border-color: #3d78b5 !important;
        color: #dbeafe !important;
    }
}

html[data-theme="dark"] #newsCard .news-item-source {
    color: #93c5fd !important;
}

html[data-theme="dark"] #bidWorkCard .bid-work-name {
    color: var(--color-text) !important;
}

html[data-theme="dark"] #bidWorkCard :where(.bid-work-meta, .bid-work-empty) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #bidWorkCard .bid-work-time {
    color: #5eead4 !important;
}

html[data-theme="dark"] #infoCardsSection .service-footer {
    background: var(--color-bg) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

/* Results, details and dialogs */
html[data-theme="dark"] :where(
    .results-dialog,
    .results-container,
    .results-content,
    .results-header,
    .results-info,
    .results-filter-controls,
    .modal-content,
    .modal-header,
    .modal-body,
    .dialog-content,
    .dialog-header,
    .dialog-body,
    .detail-content,
    .detail-section,
    .detail-card,
    .attachment-card,
    .file-card,
    .contract-group,
    details,
    summary
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.modal-header, .dialog-header, .results-header) {
    background-color: #172235 !important;
}

/* Detail descriptions keep a light-theme foreground in unified_style.css.
 * Scope the dark override to this body only so badges, status copy and rich
 * content elsewhere retain their own semantic colours. */
html[data-theme="dark"] #detailModal #descriptionSection #detailDescription {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .detail-label,
    .info-label,
    .field-label,
    .meta-label,
    .modal-subtitle,
    .detail-muted
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .detail-value,
    .info-value,
    .field-value,
    .meta-value,
    .modal-title,
    .detail-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .close-btn,
    .sfd-close-btn,
    .dialog-close,
    .modal-close,
    .collapse-btn,
    .more-btn
) {
    background-color: #22324a !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    .loading-card,
    .loading-state,
    .empty-state,
    .error-state,
    .skeleton,
    .skeleton-line
) {
    background-color: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .skeleton,
html[data-theme="dark"] .skeleton-line {
    background-image: linear-gradient(90deg, #172235 25%, #263a55 50%, #172235 75%) !important;
}

/* Authentication and account pages */
html[data-theme="dark"] :where(
    .auth-modal,
    .auth-form,
    .auth-toggle,
    .kakao-auth-box,
    .profile-card,
    .profile-section,
    .pricing-card,
    .subscription-card
) {
    background-color: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.auth-hint, .kakao-auth-note, .form-hint, .profile-help) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.auth-toggle button, .auth-link-btn) {
    color: #93c5fd !important;
}

html[data-theme="dark"] :where(.auth-toggle button.active, .auth-submit) {
    color: #ffffff !important;
}

/* Profile/settings is intentionally self-contained and its inline light palette is
   loaded after the shared theme. Override colors only; its geometry stays owned there. */
html[data-theme="dark"] body.profile-page .settings-card {
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .settings-tabs,
    .s-row,
    .profile-condition-overview,
    .filter-item,
    .cp-license-wrap,
    .license-category-section,
    .license-item,
    .keyword-item,
    .kakao-connect-card,
    .identity-card,
    .profile-exit-bar
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.profile-page .settings-tab {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.profile-page .settings-tab.active {
    background: var(--color-surface) !important;
    border-bottom-color: var(--color-primary) !important;
    color: var(--color-primary-light) !important;
}

html[data-theme="dark"] body.profile-page .settings-tab:hover:not(.active) {
    background: var(--color-surface-raised) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .s-section h3,
    .s-value,
    .profile-condition-overview-title,
    .filter-item-name,
    .filter-condition-row dd,
    .identity-title,
    .kakao-connect-title,
    .category-name,
    .license-name
) {
    color: var(--color-text) !important;
    border-color: var(--color-border-light) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .s-label,
    .s-form label,
    .profile-condition-overview-source,
    .profile-condition-label,
    .profile-condition-note,
    .cp-license-summary,
    .cp-license-code,
    .cp-license-lookup-status,
    .filter-condition-row dt,
    .identity-body,
    .kakao-connect-body,
    .filter-empty,
    .license-empty,
    .service-footer,
    .service-footer-identity,
    .service-footer-details,
    .service-footer-contact,
    .service-footer-note
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .profile-avatar-meta > div:first-child,
    #startupQuickAccessPreferenceSection small,
    #profileSubPeriod,
    .s-section > p
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .s-btn,
    .cp-license-clear,
    .filter-item-actions button,
    .profile-exit-btn
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.profile-page :where(
    .s-btn-primary,
    .profile-exit-btn.primary
) {
    background: #2563eb !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.profile-page :where(
    .s-btn:hover:not(.s-btn-primary),
    .cp-license-clear:hover,
    .filter-item-actions button:hover,
    .profile-exit-btn:hover:not(.primary)
) {
    background: #22324a !important;
}

html[data-theme="dark"] body.profile-page :where(.s-btn-danger, .filter-item-actions .fi-delete-btn, #avatarDeleteBtn) {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] body.profile-page :where(.cp-license-lookup-btn, .filter-current-badge) {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] body.profile-page .profile-condition-chip {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] body.profile-page .profile-condition-chip.is-empty {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.profile-page :where(.profile-condition-more summary, .service-footer a) {
    color: var(--color-primary-light) !important;
}

html[data-theme="dark"] body.profile-page :where(.cp-cb-label:hover, .license-item:hover) {
    background: var(--color-surface-raised) !important;
}

html[data-theme="dark"] body.profile-page :where(.license-item.selected, .filter-item.is-current) {
    background: #172f52 !important;
    border-color: #3d78b5 !important;
}

html[data-theme="dark"] body.profile-page :where(#cpRegionGrid, #profileSubHint) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

/* Consultation, messages, notifications, Q&A and discussion */
html[data-theme="dark"] :where(
    .consult-overlay-panel,
    .consult-header,
    .consult-body,
    .consult-messages,
    .messenger-panel,
    .messenger-shell,
    .messenger-list,
    .messenger-chat,
    .chat-overlay,
    .chat-panel,
    .notification-inbox,
    .notification-dialog,
    .qna-dialog,
    .qna-board,
    .discussion-thread,
    .discussion-list,
    .discussion-composer
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    color-scheme: dark !important;
}

html[data-theme="dark"] :where(
    .consult-message,
    .message-row,
    .messenger-item,
    .notification-item,
    .qna-row,
    .discussion-comment
) {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .consult-message.user,
    .message-row.own,
    .discussion-comment.is-own
) {
    background: #183861 !important;
}

/* Components that still own legacy literal light colors. Keep the override
   theme-scoped so their light-theme contract remains byte-for-byte intact. */
html[data-theme="dark"] :where(
    .consult-input-row,
    .consult-suggestions,
    .consult-suggestion-btn,
    .consult-quick-actions,
    .consult-quick-btn,
    .consult-summary,
    .consult-result-card,
    .consult-result-cards-header
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .consult-suggestion-btn:hover,
    .consult-suggestion-btn:focus-visible,
    .consult-quick-btn:hover,
    .consult-quick-btn:focus-visible
) {
    background: #22324a !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    .consult-hint,
    .consult-result-meta,
    .consult-result-more,
    .consult-summary
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #notifInboxModal > div,
html[data-theme="dark"] #notifInboxList {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    color-scheme: dark !important;
}

html[data-theme="dark"] #notifInboxModal > div > div:first-child,
html[data-theme="dark"] #notifTabs {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #notifInboxModal :where(.notif-tab, .notif-empty, .notif-body, .notif-meta) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #notifInboxModal .notif-tab.active {
    color: #93c5fd !important;
    border-bottom-color: #60a5fa !important;
}

html[data-theme="dark"] #notifInboxModal :where(.notif-item, .notif-cat-badge) {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #notifInboxModal .notif-item.unread {
    background: #172f52 !important;
    border-left-color: #60a5fa !important;
}

html[data-theme="dark"] #notifInboxModal .notif-item:hover {
    background: #22324a !important;
}

html[data-theme="dark"] :where(
    .messenger-overlay,
    .messenger-standalone-root,
    .messenger-auth-state,
    .messenger-auth-panel,
    .messenger-header,
    .messenger-tabs,
    .messenger-body,
    .messenger-tab-content,
    .msg-friend-header,
    .msg-chat-list,
    .msg-scroll-area,
    .msg-add-dialog,
    .msg-add-dialog-header,
    .msg-add-dialog-body,
    .messenger-info-dialog,
    .messenger-info-head,
    .messenger-info-body,
    .messenger-info-foot
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    color-scheme: dark !important;
}

html[data-theme="dark"] :where(
    .messenger-header,
    .messenger-tabs,
    .msg-section-title,
    .msg-add-dialog-header,
    .messenger-info-head,
    .messenger-info-foot
) {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] :where(
    .messenger-header-title,
    .messenger-auth-title,
    .messenger-auth-form label,
    .messenger-tab.active,
    .msg-friend-name,
    .msg-chat-name,
    .msg-add-dialog-title,
    .messenger-info-details > summary
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .messenger-tab,
    .messenger-auth-message,
    .messenger-header-close,
    .msg-section-title,
    .msg-friend-meta,
    .msg-chat-last-msg,
    .msg-chat-time,
    .msg-empty,
    .msg-read-receipt,
    .messenger-info-body,
    .messenger-info-skip
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.messenger-auth-back, .messenger-auth-link) {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .messenger-auth-error {
    color: #fda4af !important;
}

html[data-theme="dark"] :where(
    .msg-friend-card,
    .msg-chat-card,
    .msg-search-result,
    .messenger-info-details,
    .msg-drop-inner
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .msg-friend-card:hover,
    .msg-chat-card:hover,
    .msg-friend-card:focus-visible,
    .msg-chat-card:focus-visible
) {
    background: #22324a !important;
}

html[data-theme="dark"] :where(.msg-friend-avatar, .msg-friend-search-btn, .msg-btn-reject) {
    background: #26374e !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.messenger-info-note, .msg-add-mobile-tip) {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

/* Full-feature QC: these component owners still use literal light colors.
   Keep all overrides theme-scoped and color-only. */
html[data-theme="dark"] :where(
    .weather-dialog,
    .weather-dialog-top,
    .weather-dialog-body,
    .weather-dialog-credit,
    .weather-week-list,
    .weather-week-item,
    .weather-week-main,
    .weather-week-detail,
    .wk-expand,
    .wk-hourly-section,
    .wk-hourly-table,
    .wk-hourly-header,
    .wk-hourly-row
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .weather-week-item.today,
    .weather-week-item.past,
    .weather-week-item.past .weather-week-main,
    .weather-week-detail,
    .wk-hourly-section,
    .wk-hourly-header,
    .wk-hourly-row:nth-child(even)
) {
    background: var(--color-surface-soft) !important;
}

html[data-theme="dark"] :where(
    .weather-dialog-location,
    .weather-dialog-credit,
    .weather-dialog-credit a,
    .weather-week-date,
    .weather-week-desc,
    .wk-hourly-heading span,
    .wk-hourly-scroll-cue,
    .wk-hourly-secondary b,
    .wk-hourly-row small
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .weather-dialog-title,
    .weather-week-day,
    .wk-hourly-heading,
    .wk-hourly-row
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .detail-section h3,
    .detail-item,
    .extra-info-item,
    .attachment-item
) {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.extra-label, .detail-label) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border-light) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.extra-value, .detail-value, .attachment-name) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .section-guide,
    #kepcoDataLimitBanner,
    #missingBiddersBanner
) {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] .attachments-notice {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] :where(
    .msg-bubble-other,
    .msg-message-composer,
    .msg-composer-row,
    .msg-reply-preview,
    .msg-composer-context
) {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .msg-bubble-mine {
    background: #183861 !important;
    border-color: #315d91 !important;
    color: #eaf3ff !important;
}

html[data-theme="dark"] .consult-message.assistant .bubble {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .consult-message.user .bubble {
    background: #183861 !important;
    border-color: #315d91 !important;
    color: #eaf3ff !important;
}

html[data-theme="dark"] :where(.consult-overlay-btn, .consult-close-btn) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .signup-wizard,
    .sw-header,
    .sw-body,
    .sw-footer,
    .sw-intro,
    .sw-agreement,
    .sw-agreement-all,
    .sw-done
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .sw-option,
    .sw-input,
    .sw-textarea,
    .sw-btn-back,
    .sw-btn-skip
) {
    background: var(--color-surface-soft) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(.sw-option:hover, .sw-option:focus-visible, .sw-option.selected) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #eaf3ff !important;
}

html[data-theme="dark"] .sw-option.sw-option-disabled {
    background: #172235 !important;
    border-color: var(--color-border-light) !important;
    color: var(--color-text-muted) !important;
}

html[data-theme="dark"] :where(
    .sw-title,
    .sw-question,
    .sw-intro-title,
    .sw-option-label,
    .sw-done-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .sw-hint,
    .sw-intro-body,
    .sw-intro-reason,
    .sw-option-desc,
    .sw-done-desc
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .sw-option-badge {
    background: var(--color-info-bg) !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] :where(.sw-progress, .sw-progress-track) {
    background: #26374e !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    .collab-detail-dialog,
    #collabModalHeader,
    #collabModalTabs,
    #collabDetailBody,
    .lobby-panel,
    .collab-member-row
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    .collab-member-row,
    .pvt-collab-touch-row > button,
    #lobbyPanel-members > button,
    #collabModalActions > button,
    .collab-detail-close
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #collabDetailModal .lobby-tab {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #collabDetailModal .lobby-tab.active {
    border-bottom-color: #60a5fa !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] #collabDetailModal .collab-change-history-trigger,
html[data-theme="dark"] #collabDetailModal .collab-expired-banner {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    span[style*="background:#f5f5f5"],
    span[style*="background: #f5f5f5"]
) {
    background: var(--color-surface-raised) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    span[style*="background:#e3f2fd"],
    span[style*="background: #e3f2fd"]
) {
    background: var(--color-info-bg) !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    span[style*="background:#fff3e0"],
    span[style*="background: #fff3e0"]
) {
    background: var(--color-warning-bg) !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    button[style*="color:#c62828"],
    button[style*="color: #c62828"]
) {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #collabDetailModal :where(
    button[style*="color:#2e7d32"],
    button[style*="color: #2e7d32"]
) {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] #closedBetaNotice {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] #closedBetaNotice :where(strong, span) {
    color: inherit !important;
}

/* The quick-access dialog appears immediately after the startup notice. */
html[data-theme="dark"] .startup-quick-access-dialog {
    background: var(--color-surface-raised);
    border-color: var(--color-border);
    color: var(--color-text);
    box-shadow: var(--shadow-lg);
}

html[data-theme="dark"] .startup-quick-access-heading h2 {
    color: var(--color-text);
}

html[data-theme="dark"] .startup-quick-access-heading p,
html[data-theme="dark"] .startup-quick-access-dismiss {
    color: var(--color-text-secondary);
}

html[data-theme="dark"] .startup-quick-access-action {
    background: linear-gradient(155deg, #1b2b42 0%, #17253a 100%);
    border-color: var(--color-border);
    color: #dbeafe;
}

html[data-theme="dark"] .startup-quick-access-action:hover {
    background: #223d60;
    border-color: #60a5fa;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .startup-quick-access-close {
    background: var(--color-surface-soft);
    color: var(--color-text-secondary);
}

html[data-theme="dark"] .startup-quick-access-close:hover {
    background: #223d60;
    color: var(--color-text);
}

html[data-theme="dark"] :where(
    .startup-quick-access-close,
    .startup-quick-access-action,
    .startup-quick-access-dismiss input
):focus-visible {
    outline-color: rgba(147, 197, 253, 0.78);
}

html[data-theme="dark"] .startup-quick-access-footer {
    background: var(--color-surface-soft);
    border-color: var(--color-border-light);
}

html[data-theme="dark"] .startup-quick-access-dismiss input {
    accent-color: #60a5fa;
}

html[data-theme="dark"] .startup-quick-access-status {
    color: var(--color-text-muted);
}

html[data-theme="dark"] .startup-quick-access-status.error {
    color: #fda4af;
}

/* Full-product button and status palette audit (2026-09-01).
   Legacy components still declare light literals after their structural CSS.
   These rules are deliberately theme-scoped and change color only. */
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .short-search-toggle,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box > .short-search-wrap .short-search-toggle {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .short-search-toggle:hover,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .short-search-toggle:focus-visible,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box > .short-search-wrap .short-search-toggle:hover,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-box > .short-search-wrap .short-search-toggle:focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .secondary-btn {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .secondary-btn:hover,
html[data-theme="dark"] .secondary-btn:focus-visible,
html[data-theme="dark"] .secondary-btn.active {
    background: #2d4463 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) :where(
    .search-bookmark-side,
    .view-filters-inline,
    .dash-rate-help
) {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.weather-refresh-location-btn, #qnaModalCloseBtn) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] :where(.weather-refresh-location-btn, #qnaModalCloseBtn):hover,
html[data-theme="dark"] :where(.weather-refresh-location-btn, #qnaModalCloseBtn):focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .dash-wx-day.dash-wx-today {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .time-pill {
    background: var(--color-warning-bg) !important;
    border: 1px solid #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .time-pill.urgent {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #detailModal .detail-item > label {
    /* The row owns the cell surface; plain field names must not look like badges. */
    background: transparent !important;
    border-color: var(--color-border-light) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #detailModal :where(.org-history-btn, .bid-guide-btn) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #detailModal :where(.org-history-btn, .bid-guide-btn):hover,
html[data-theme="dark"] #detailModal :where(.org-history-btn, .bid-guide-btn):focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailModal .eligibility-banner.eligible {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] #detailModal .eligibility-banner.ineligible {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #detailModal .eligibility-banner.check-needed,
html[data-theme="dark"] #detailModal .data-source-badge.estimate {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #detailModal :where(.org-stats-summary, .og-stat, .og-grid) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #detailModal .timeline-step .tl-icon {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #detailModal .timeline-step.done .tl-icon {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] #detailModal .area-tag {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #detailModal .attachment-summary-btn {
    background: #3a2357 !important;
    border: 1px solid #8b5cf6 !important;
    color: #f3e8ff !important;
}

html[data-theme="dark"] #detailModal .attachment-view-btn {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #detailModal :where(.attachment-source-link, .attachment-download-btn) {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] #detailModal .attachment-summary-btn:hover,
html[data-theme="dark"] #detailModal .attachment-summary-btn:focus-visible {
    background: #523175 !important;
    border-color: #a78bfa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailModal .attachment-view-btn:hover,
html[data-theme="dark"] #detailModal .attachment-view-btn:focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailModal :where(.attachment-source-link, .attachment-download-btn):hover,
html[data-theme="dark"] #detailModal :where(.attachment-source-link, .attachment-download-btn):focus-visible {
    background: #1b4a2b !important;
    border-color: #4ade80 !important;
    color: #dcfce7 !important;
}

html[data-theme="dark"] #detailModal :where(
    .attachment-summary-btn,
    .attachment-view-btn,
    .attachment-source-link,
    .attachment-download-btn
):disabled {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-muted) !important;
    opacity: 0.72;
}

html[data-theme="dark"] #detailModal .discussion-thread__count,
html[data-theme="dark"] #detailModal :where(.discussion-thread__avatar, .discussion-thread__composer-avatar) {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #detailModal .discussion-thread__action {
    color: #a9c9ed !important;
}

html[data-theme="dark"] #detailModal .discussion-thread__action.is-danger {
    color: #fda4af !important;
}

html[data-theme="dark"] #detailModal .action-btn.primary {
    background: #2563eb !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailModal .action-btn.collab {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] #detailModal .action-btn.secondary {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #detailModal .action-btn.secondary:hover,
html[data-theme="dark"] #detailModal .action-btn.secondary:focus-visible {
    background: #2d4463 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.profile-page .license-category-header {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.profile-page .identity-badge {
    background: var(--color-surface-raised) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.profile-page .identity-badge.on {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] body.profile-page :where(.s-msg.error, .s-msg.err) {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] body.profile-page :where(.s-msg.success, .s-msg.ok) {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] body.profile-page :where(input[type="checkbox"], input[type="radio"]) {
    accent-color: #60a5fa;
}

html[data-theme="dark"] body.private-bids-page :where(
    .pb-tab-bar,
    .bid-writing-card,
    .bookmark-card-surface,
    .managed-card-surface,
    .pvtbid-context-menu
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.private-bids-page :where(
    .writing-card-title,
    .writing-card-next strong,
    .bookmark-card-title,
    .managed-card-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.private-bids-page :where(
    .writing-card-meta,
    .writing-card-updated,
    .writing-card-next span,
    .bookmark-card-meta,
    .managed-card-meta
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.private-bids-page .writing-doc-chip {
    background: var(--color-surface-raised) !important;
    border: 1px solid var(--color-border-light) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.private-bids-page .writing-doc-chip.more {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] body.private-bids-page .pvtbid-context-menu button {
    background: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.private-bids-page .pvtbid-context-menu button:hover,
html[data-theme="dark"] body.private-bids-page .pvtbid-context-menu button:focus-visible {
    background: #22324a !important;
    color: #ffffff !important;
}

/* Full-product interactive-control contrast audit (2026-09-02).
   These owners still ship literal light/bright button colors. Keep the fix
   theme-scoped and color-only so approved navigation geometry is untouched. */
html[data-theme="dark"] .header-icon-btn#consultToggleBtn.active {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .header-icon-btn#consultToggleBtn.active .header-icon-label {
    color: #ffffff !important;
}

html[data-theme="dark"] #searchFilterDialog .filter-keyword-add-btn,
html[data-theme="dark"] .search-filter-dialog .filter-keyword-add-btn {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #searchFilterDialog .filter-keyword-add-btn.exclude,
html[data-theme="dark"] .search-filter-dialog .filter-keyword-add-btn.exclude {
    background: #991b1b !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #searchFilterDialog .sfd-reset-btn,
html[data-theme="dark"] .search-filter-dialog .sfd-reset-btn {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #searchFilterDialog .sfd-apply-btn,
html[data-theme="dark"] .search-filter-dialog .sfd-apply-btn {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #searchFilterDialog .sfd-save-btn,
html[data-theme="dark"] .search-filter-dialog .sfd-save-btn {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #searchFilterDialog :where(.sfd-reset-btn, .sfd-save-btn):hover,
html[data-theme="dark"] #searchFilterDialog :where(.sfd-reset-btn, .sfd-save-btn):focus-visible,
html[data-theme="dark"] .search-filter-dialog :where(.sfd-reset-btn, .sfd-save-btn):hover,
html[data-theme="dark"] .search-filter-dialog :where(.sfd-reset-btn, .sfd-save-btn):focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #notifInboxModal :where(
    #notifReadAllBtn,
    button[onclick="_notifReadAll()"]
) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #notifInboxModal :where(
    #notifInboxClose,
    .notif-icon-btn,
    button[onclick="_notifClose()"]
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .notif-action-btn.primary {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .notif-action-btn.secondary {
    background: var(--color-surface-raised) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .notif-action-btn.danger {
    background: var(--color-danger-bg) !important;
    color: #fda4af !important;
}

html[data-theme="dark"] :where(
    .notif-action-btn.secondary,
    #notifInboxModal #notifReadAllBtn,
    #notifInboxModal button[onclick="_notifReadAll()"]
):hover,
html[data-theme="dark"] :where(
    .notif-action-btn.secondary,
    #notifInboxModal #notifReadAllBtn,
    #notifInboxModal button[onclick="_notifReadAll()"]
):focus-visible {
    background: #244875 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #qnaHeaderWriteBtn,
html[data-theme="dark"] #qnaContent button[onclick^="QnaBoard.goPage"][style*="#3b82f6"] {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .messenger-header-return,
    .messenger-header-browser,
    .msg-friend-search-clear,
    .msg-friend-kebab
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .msg-friend-header .msg-friend-add-btn[style*="#6366f1"] {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-sort-control {
    background: var(--color-surface-soft) !important;
    border-color: #41536b !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-sort-button,
html[data-theme="dark"] body.unified-page .results-dialog .results-filter-controls .compact-folder-btn,
html[data-theme="dark"] body.unified-page .results-dialog .results-dialog-close-btn {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    .compact-folder-caption,
    .results-sort-chevron
) {
    color: var(--color-text-secondary) !important;
    border-color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .compact-folder-btn::after {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .compact-folder-value {
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .compact-folder-count {
    color: #93c5fd !important;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    .results-refine-action,
    .results-related-company-btn
) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-refine-action.active {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    .results-sort-button,
    .compact-folder-btn,
    .results-refine-action,
    .results-related-company-btn,
    .results-dialog-close-btn
):hover,
html[data-theme="dark"] body.unified-page .results-dialog :where(
    .results-sort-button,
    .compact-folder-btn,
    .results-refine-action,
    .results-related-company-btn,
    .results-dialog-close-btn
):focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .results-sort-menu,
    .results-status-filter-menu,
    .results-type-filter-menu
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-sort-menu > .result-sort-option,
html[data-theme="dark"] :where(.results-status-filter-menu, .results-type-filter-menu) > button {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-sort-menu > .result-sort-option:is(:hover, :focus-visible, .active),
html[data-theme="dark"] :where(.results-status-filter-menu, .results-type-filter-menu) > button:is(:hover, :focus-visible, .active) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-related-company-btn:disabled {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-muted) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .result-card .btn-detail-sm {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .result-card .btn-detail-sm:hover,
html[data-theme="dark"] body.unified-page .results-dialog .result-card .btn-detail-sm:focus-visible {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(#consultDialogTitle, .consult-title) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .msg-chat-list-toolbar {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .msg-chat-list-toolbar .msg-search-btn {
    background: #172f52 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .msg-chat-list-toolbar .msg-search-btn:is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

/* The desktop-messenger launcher owns an inline light hint. Keep the hint and
   its actions legible without changing its placement or responsive geometry. */
html[data-theme="dark"] #iliyaDesktopMessengerHint {
    background: #172235 !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] #iliyaDesktopMessengerHint a {
    color: #93c5fd !important;
}

html[data-theme="dark"] #iliyaDesktopMessengerHintClose {
    background: #1b283b !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

/* Saving a filter is a child dialog, so its literal light sheets need the
   same final dark owner as the parent search-filter dialog. */
html[data-theme="dark"] :where(
    #filterSaveDialog,
    #filterSaveDialog .fsd-header,
    #filterSaveDialog .fsd-body,
    #filterSaveDialog .fsd-footer,
    #filterSaveDialog .fsd-summary
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #filterSaveDialog .fsd-alert-section {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
}

html[data-theme="dark"] #filterSaveDialog :where(
    .fsd-label,
    .fsd-summary-title,
    .fsd-summary-row,
    .fsd-summary-row .fsd-key,
    .fsd-summary-row .fsd-val
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #filterSaveDialog :where(.fsd-alert-toggle-label, .fsd-alert-desc) {
    color: #fde68a !important;
}

html[data-theme="dark"] #filterSaveDialog .fsd-close-btn {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #filterSaveDialog .fsd-submit-btn {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

/* Calendar and weather dialogs are opened from the home dashboard but still
   own a literal light palette. */
html[data-theme="dark"] :where(
    .cal-modal,
    .cal-month-title,
    .cal-event-list,
    .cal-ev-header,
    .cal-ev-item,
    .sched-dialog,
    .sched-dialog-header,
    .sched-dialog-actions,
    .weather-location-menu,
    .weather-location-picker,
    .weather-location-picker-header,
    .weather-location-map
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .cal-lunar-btn,
    .cal-year-select,
    .cal-today-btn,
    .sched-dialog-cancel,
    .weather-retry-btn,
    .weather-location-picker-header button,
    .weather-location-picker-actions .secondary
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .cal-lunar-btn-active,
    .cal-add-schedule-btn,
    .weather-location-search-row button,
    .weather-location-picker-actions .primary
) {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(.cal-form-save, .sched-dialog .cal-form-save) {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .weather-location-menu button {
    background: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .cal-lunar-btn,
    .cal-year-select,
    .cal-today-btn,
    .cal-add-schedule-btn,
    .sched-dialog-cancel,
    .weather-retry-btn,
    .weather-location-menu button,
    .weather-location-picker-header button,
    .weather-location-picker-actions button
):is(:hover, :focus-visible, :active) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .cal-cell:is(:hover, :focus-within),
html[data-theme="dark"] .cal-cell.cal-today-cell {
    background: #172f52 !important;
}

html[data-theme="dark"] .cal-cell.cal-cell-selected {
    background: #244875 !important;
}

html[data-theme="dark"] :where(.cal-day-label, .cal-lunar, .cal-lunar-first) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .weather-history-pull,
    .weather-ranking.weather-comparison,
    .weather-ranking-list,
    .weather-ranking-row,
    .weather-ranking-empty,
    .weather-week-left,
    .weather-week-top-row,
    .wk-hourly-table
) {
    background: #172235 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .weather-history-pull-grip {
    background: #41536b !important;
}

html[data-theme="dark"] .weather-history-pull-icon {
    background: #244875 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    .weather-history-pull-copy small,
    .weather-ranking-heading small,
    .weather-ranking-columns,
    .weather-comparison-order,
    .weather-ranking-region small,
    .weather-week-day small
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .weather-ranking-heading,
    .weather-ranking-region,
    .weather-ranking-row strong,
    .weather-week-top-row,
    .weather-period-heading
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .wk-cell.wk-rain-probability,
    .wk-hr-rain-prob
) {
    background: #172f52 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] :where(
    .wk-cell.wk-rain-amount,
    .wk-hr-rain-amount
) {
    background: #244875 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .wk-rain-probability .wk-lbl,
    .wk-rain-amount .wk-lbl,
    .wk-rain-amount .wk-val,
    .wk-hr-rain-prob small,
    .wk-hr-rain-amount small
) {
    color: #dbeafe !important;
}

/* Related-company analysis is a child dialog of search results. */
html[data-theme="dark"] :where(
    .related-companies-panel,
    .related-companies-heading,
    .related-company-mode-tabs,
    .related-company-history-notice,
    .related-companies-status,
    .related-company-card,
    .related-company-detail-dialog,
    .related-company-detail-header,
    .related-company-detail-body,
    .related-company-detail-row,
    .related-company-detail-actions,
    .related-company-history-confirm
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .related-company-mode-description,
    .related-company-history-notice,
    .related-company-list-controls,
    .related-companies-status,
    .related-company-card-meta,
    .related-company-detail-actions > p,
    .related-company-detail-empty,
    .related-company-history-confirm p
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #relatedCompaniesOverlay :where(
    #relatedCompaniesScopeBox,
    .bid-history-scope-box
) {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #relatedCompaniesOverlay :where(
    #relatedCompaniesTitle,
    .related-companies-heading h3,
    #relatedCompaniesScopeTitle,
    .bid-history-scope-copy strong
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #relatedCompaniesOverlay :where(
    #relatedCompaniesScopeText,
    .bid-history-past-progress
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .related-company-mode-tabs > button,
    .related-company-search-control button,
    #relatedCompaniesOverlay .bid-history-past-button,
    .related-companies-load-more button,
    .related-company-phone-reveal,
    .related-company-card-actions button,
    .related-company-detail-actions button,
    .related-company-detail-header button,
    .related-company-history-confirm-actions button
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .related-company-mode-tabs > button.active,
    .related-company-card-actions button.primary,
    .related-company-detail-actions button.primary,
    .related-company-history-confirm-actions button.primary
) {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .related-company-mode-tabs > button,
    .related-company-search-control button,
    #relatedCompaniesOverlay .bid-history-past-button,
    .related-companies-load-more button,
    .related-company-phone-reveal,
    .related-company-card-actions button,
    .related-company-detail-actions button,
    .related-company-detail-header button,
    .related-company-history-confirm-actions button
):is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

/* Company analysis owns several feature-local light cards and controls. Keep
   their fields, profile cells and child dialogs on the same dark surface scale
   without changing the feature-owned layout. */
html[data-theme="dark"] :where(
    .related-companies-overlay,
    .related-company-detail-overlay,
    .related-company-history-confirm-overlay,
    .bidder-company-card-overlay
) {
    background: rgba(2, 6, 23, 0.82) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .bidder-company-card-dialog,
    .bidder-company-card-header,
    .bidder-company-card-body,
    .bidder-company-card-actions,
    .bidder-company-credit-note,
    .related-company-detail-header,
    .related-company-detail-body,
    .related-company-detail-actions
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .related-companies-heading,
    .related-company-detail-header,
    .related-company-detail-actions,
    .bidder-company-card-header,
    .bidder-company-card-actions,
    .bidder-company-credit-note
) {
    background: var(--color-surface-raised) !important;
}

html[data-theme="dark"] #relatedCompaniesOverlay :where(
    .related-companies-close,
    .related-company-search-control input,
    .related-company-sort-control select
) {
    border-color: #41536b !important;
    background: var(--color-surface-soft) !important;
    color: #e7eef8 !important;
    color-scheme: dark;
}

html[data-theme="dark"] #relatedCompaniesOverlay .related-company-search-control input::placeholder {
    color: #8fa0b5 !important;
    opacity: 1;
}

html[data-theme="dark"] #relatedCompaniesOverlay .related-company-winner-toggle input {
    accent-color: #60a5fa;
    color-scheme: dark;
}

html[data-theme="dark"] #relatedCompaniesOverlay :where(
    .related-company-search-control input,
    .related-company-sort-control select,
    .related-companies-close
):is(:focus, :focus-visible) {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24) !important;
    outline: 0;
}

html[data-theme="dark"] :where(
    .related-companies-panel,
    .related-company-detail-body,
    .bidder-company-card-body
) {
    scrollbar-color: #526782 var(--color-surface-soft) !important;
}

html[data-theme="dark"] :where(
    .related-companies-panel::-webkit-scrollbar-track,
    .related-company-detail-body::-webkit-scrollbar-track,
    .bidder-company-card-body::-webkit-scrollbar-track
) {
    background: var(--color-surface-soft) !important;
}

html[data-theme="dark"] :where(
    .related-companies-panel::-webkit-scrollbar-thumb,
    .related-company-detail-body::-webkit-scrollbar-thumb,
    .bidder-company-card-body::-webkit-scrollbar-thumb
) {
    border-color: var(--color-surface-soft) !important;
    background: #526782 !important;
}

html[data-theme="dark"] :where(
    .related-company-card,
    .related-company-detail-stats > div,
    .bidder-company-profile-message
) {
    border-color: #41536b !important;
    background: var(--color-surface-raised) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .related-company-detail-profile,
    .bidder-company-current-bid,
    .bidder-company-profile-grid
) {
    border-color: #41536b !important;
    background: #41536b !important;
}

html[data-theme="dark"] :where(
    .related-company-detail-row,
    .bidder-company-current-bid > div,
    .bidder-company-profile-grid > div
) {
    background: var(--color-surface-soft) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .related-company-card-heading h4,
    .related-company-detail-header h3,
    .related-company-detail-row dd,
    .related-company-detail-licenses h4,
    .bidder-company-card-header h3,
    .bidder-company-current-bid dd,
    .bidder-company-profile-grid dd,
    .bidder-company-profile-section h4,
    .bidder-company-license-section h4
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    .related-company-bizno,
    .related-company-card-meta,
    .related-company-evidence,
    .related-company-contact-note,
    .bidder-company-contact-note,
    .related-companies-heading p,
    #relatedCompaniesIntro,
    #relatedCompaniesCoverage,
    .related-company-search > label,
    .related-company-winner-toggle,
    .related-company-sort-control,
    .related-company-detail-header span,
    .related-company-detail-row dt,
    .related-company-detail-stats span,
    .related-company-detail-empty,
    .bidder-company-card-header span,
    .bidder-company-bizno,
    .bidder-company-current-bid dt,
    .bidder-company-profile-grid dt,
    .bidder-company-profile-grid dd small,
    .bidder-company-phone-note,
    .bidder-company-muted,
    .bidder-company-credit-note
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .related-company-phone,
    .bidder-company-phone,
    .related-company-detail-stats strong,
    .related-company-history-confirm-kicker,
    .related-company-license.more
) {
    color: #93c5fd !important;
}

html[data-theme="dark"] .related-company-detail-stats .is-inferred strong {
    color: #fde68a !important;
}

html[data-theme="dark"] :where(
    .related-company-status,
    .related-company-contact-status,
    .bidder-company-contact-status
) {
    border-color: #41536b !important;
    background: #172235 !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .related-company-status.is-active,
    .related-company-contact-status.is-eligible,
    .bidder-company-contact-status.is-eligible,
    .bidder-company-bid-status.is-normal
) {
    border-color: #2d7a4a !important;
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] :where(
    .related-company-status.is-suspended,
    .related-company-contact-status.is-blocked,
    .bidder-company-contact-status.is-blocked,
    .bidder-company-bid-status.is-winner,
    .related-company-detail-stats .is-inferred,
    .bidder-company-identity-warning
) {
    border-color: #a87824 !important;
    background: #3b2a0e !important;
    color: #fde68a !important;
}

html[data-theme="dark"] :where(
    .related-company-status.is-closed,
    .bidder-company-bid-status.is-disqualified,
    .bidder-company-profile-message.is-error
) {
    border-color: #9f4a56 !important;
    background: #421821 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] :where(
    .related-company-contact-status.is-review,
    .bidder-company-contact-status.is-review,
    .related-company-match-badge
) {
    border-color: #356ba4 !important;
    background: #172f52 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] :where(
    .related-company-license,
    .related-company-detail-license,
    .bidder-company-license
) {
    border-color: #41536b !important;
    background: #172235 !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .related-company-history-confirm .related-company-history-credit-note {
    border-color: #356ba4 !important;
    background: #172f52 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] .related-companies-status.error {
    border-color: #9f4a56 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .related-company-card-actions {
    border-color: #41536b !important;
}

html[data-theme="dark"] .bidder-company-business-status {
    background: #2c2449 !important;
    color: #ddd6fe !important;
}

html[data-theme="dark"] :where(
    .bidder-company-card-header button,
    .bidder-company-profile-message button,
    .bidder-company-phone-reveal,
    .bidder-company-card-actions button
) {
    border-color: #41536b !important;
    background: var(--color-surface-raised) !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bidder-company-card-actions button.primary {
    border-color: #60a5fa !important;
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .bidder-company-card-header button,
    .bidder-company-profile-message button,
    .bidder-company-phone-reveal,
    .bidder-company-card-actions button
):is(:hover, :focus-visible) {
    border-color: #60a5fa !important;
    background: #244875 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bidder-company-spinner {
    border-color: #41536b !important;
    border-top-color: #60a5fa !important;
}

/* News summary and discussion are one visual flow.  The feature stylesheet owns
   both desktop and full-screen mobile light palettes, so every reachable state
   needs an explicit, color-only dark owner here. */
html[data-theme="dark"] #newsDialogOverlay {
    background: rgba(2, 6, 23, 0.82) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-dialog,
    .news-dialog-header,
    .news-dialog-summary-section,
    .news-dialog-actions,
    .news-dialog-comments,
    .news-comments
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-dialog-title,
    .news-comments-title,
    .news-comments-field-label,
    .news-comment-author,
    .news-comment-body,
    .news-comments-action-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-dialog-close,
    .news-dialog-source,
    .news-comments-subtitle,
    .news-comments-boundary,
    .news-comments-notice,
    .news-comments-status,
    .news-comments-empty,
    .news-comments-check,
    .news-comment-login-copy,
    .news-comment-time,
    .news-comment-meta,
    .news-comment-action,
    .news-comments-action-close
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-dialog-category {
    background: var(--color-info-bg) !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-dialog-body,
    .news-dialog-body.pending,
    .news-comments-textarea,
    .news-comments-select
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-dialog-body.pending {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comments-textarea,
    .news-comments-select
):focus-visible {
    background: #172235 !important;
    border-color: #60a5fa !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comments-textarea,
    .news-comments-select
)::placeholder {
    color: var(--color-text-muted) !important;
    opacity: 1 !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-dialog-link {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-dialog-link:is(:hover, :focus-visible) {
    background: #244875 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comment-composer,
    .news-comment-composer.is-guest
) {
    background: rgba(21, 31, 48, 0.98) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comment-avatar,
    .discussion-thread__avatar.anonymous
) {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .discussion-thread__list,
    .discussion-thread__item,
    .discussion-thread__context,
    .news-comment-replies
) {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-comment-state {
    background: var(--color-surface-raised) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-comment-state.state-restored {
    background: var(--color-success-bg) !important;
    color: #86efac !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-comment-state.state-temporarily_hidden,
html[data-theme="dark"] #newsDialogOverlay .news-comment-state.state-copyright_hidden,
html[data-theme="dark"] #newsDialogOverlay .news-comment-state.state-moderation_removed {
    background: var(--color-warning-bg) !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comments-status.is-error,
    .news-comments-action-status
) {
    color: #fda4af !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-comment-action.is-danger {
    color: #fda4af !important;
}

html[data-theme="dark"] #newsDialogOverlay .news-comments-primary {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comments-secondary,
    .news-comments-more
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #newsDialogOverlay :where(
    .news-comment-action,
    .news-comments-action-close
) {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .news-comments-action-overlay {
    background: rgba(2, 6, 23, 0.82) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .news-comments-action-dialog {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-lg) !important;
}

html[data-theme="dark"] .news-comments-action-dialog :where(
    .news-comments-action-title,
    .news-comments-field-label
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .news-comments-action-dialog :where(
    .news-comments-action-close,
    .news-comments-check
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .news-comments-action-dialog .news-comments-action-status {
    color: #fda4af !important;
}

html[data-theme="dark"] .news-comments-action-dialog .news-comments-primary {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .news-comments-action-dialog .news-comments-primary:is(:hover, :focus-visible) {
    background: #2563eb !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .news-comments-action-dialog :where(
    .news-comments-textarea,
    .news-comments-select
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .news-comments-action-dialog :where(
    .news-comments-textarea,
    .news-comments-select
):focus-visible {
    background: #172235 !important;
    border-color: #60a5fa !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .news-comments-action-dialog :where(
    .news-comments-textarea,
    .news-comments-select
)::placeholder {
    color: var(--color-text-muted) !important;
    opacity: 1 !important;
}

@media (max-width: 600px) {
    html[data-theme="dark"] #newsDialogOverlay .news-dialog-category,
    html[data-theme="dark"] #newsDialogOverlay :where(
        .news-dialog-body,
        .news-dialog-body.pending
    ) {
        background: transparent !important;
    }
}

/* Feature-owned dynamic panels: work log, document loader, private-work wizard
   and consortium controls. */
html[data-theme="dark"] :where(
    .news-comments-action-dialog,
    .work-log-dialog,
    .work-log-card,
    .bdw-lazy-dialog
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .news-comments-secondary,
    .news-comments-more,
    .work-log-entry-actions button,
    .work-log-action,
    .bdw-lazy-actions button,
    .profile-avatar-action-btn,
    .wizard-card .btn-secondary,
    .wizard-card .btn-map-open,
    .wizard-card .map-engine-tab,
    .wizard-card .media-dialog-btn,
    .wizard-card .vid-step-btn,
    #collabDetailModal .collab-btn-sm,
    #collabDetailModal .collab-btn-leave,
    .collab-detail-dialog .collab-btn-sm,
    .collab-detail-dialog .collab-btn-leave
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .wizard-card .btn-draft,
    .work-log-action.is-warning
) {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] :where(
    .wizard-card .btn-danger,
    #collabDetailModal .collab-btn-leave,
    .collab-detail-dialog .collab-btn-leave,
    .work-log-action.is-danger
) {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] :where(
    .news-comments-secondary,
    .news-comments-more,
    .work-log-entry-actions button,
    .work-log-action,
    .bdw-lazy-actions button,
    .profile-avatar-action-btn,
    .wizard-card .btn-secondary,
    .wizard-card .btn-map-open,
    .wizard-card .map-engine-tab,
    .wizard-card .media-dialog-btn,
    .wizard-card .vid-step-btn,
    #collabDetailModal .collab-btn-sm,
    #collabDetailModal .collab-btn-leave,
    .collab-detail-dialog .collab-btn-sm,
    .collab-detail-dialog .collab-btn-leave
):is(:hover, :focus-visible, :active) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    #collabDetailModal .collab-btn-leave,
    .collab-detail-dialog .collab-btn-leave,
    .work-log-action.is-danger
):is(:hover, :focus-visible, :active) {
    background: #5a1c2a !important;
    border-color: #fb7185 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    #detailModal .btn-sm,
    body.private-bids-page .btn-sm,
    .search-history-btn,
    .refine-search-btn,
    .refine-clear-btn,
    .refine-pick-btn
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    #detailModal .btn-sm,
    body.private-bids-page .btn-sm,
    .search-history-btn,
    .refine-search-btn,
    .refine-clear-btn,
    .refine-pick-btn
):is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

/* Standalone pages use the same palette as the application shell. */
html[data-theme="dark"] body.pricing-page {
    --ink: #e7eef8;
    --muted: #bdc9d8;
    --line: rgba(143, 160, 181, 0.24);
    --accent: #8fc3ff;
    --accent-soft: #172f52;
    --ok: #86efac;
    --danger: #fda4af;
    --bg: #0b1220;
    --paper: #151f30;
    --paper-deep: #111a29;
    --work-ink: #dce7f5;
    --work-red: #fda4af;
}

html[data-theme="dark"] body.pricing-page :where(
    .btn,
    .panel,
    .common-features,
    .product-card,
    .product-actions,
    .policy-box,
    .status,
    .details-dialog,
    .details-head,
    .details-body,
    .refund-reason,
    .feature-row
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.pricing-page :where(
    .product-panel,
    .common-features,
    .product-card.featured,
    .product-actions,
    .policy-box,
    .feature-row
) {
    background: var(--color-surface-soft) !important;
}

html[data-theme="dark"] body.pricing-page .product-card.featured .product-heading {
    background: #172f52 !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.pricing-page :where(
    .product-panel .section-title,
    .common-features-copy strong,
    .product-title,
    .price,
    .policy-box h3,
    .service-footer-identity strong,
    .details-head h3,
    .feature-row strong
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.pricing-page :where(
    .selection-notes dd,
    .common-features-copy p,
    .product-desc,
    .product-meta,
    .policy-box ul,
    .service-footer,
    .service-footer-identity,
    .service-footer-details,
    .service-footer-contact,
    .service-footer-note,
    .details-close,
    .feature-row span
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.pricing-page :where(
    .product-grid,
    .product-card,
    .product-heading,
    .product-offer,
    .product-meta,
    .selection-notes,
    .selection-notes > div,
    .service-footer
) {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] body.pricing-page :where(.btn.primary, .product-actions > .primary) {
    background: #2563eb !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.pricing-page .discount-line {
    background: var(--color-success-bg) !important;
    color: #86efac !important;
}

html[data-theme="dark"] body.pricing-page .status.ok {
    background: var(--color-success-bg) !important;
    border-color: #236b3c !important;
    color: #86efac !important;
}

html[data-theme="dark"] body.pricing-page .status.err {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] body.pricing-page .history-table th {
    background: #1d2c42 !important;
    color: #dce7f5 !important;
}

html[data-theme="dark"] body:not([class]) > main :where(p, ol, .url-label),
html[data-theme="dark"] body:not([class]) > main li {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body:not([class]) > main .step-box {
    background: var(--color-info-bg) !important;
    border-color: #285b91 !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body:not([class]) > main .step-title {
    color: #bfdbfe !important;
}

html[data-theme="dark"] body:not([class]) > main :where(.alt-link, .url-box) {
    background: var(--color-surface) !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body:not([class]) > main .note {
    background: var(--color-info-bg) !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] body:not([class]) > main .note.warn {
    background: var(--color-warning-bg) !important;
    color: #fde68a !important;
}

html[data-theme="dark"] body:not([class]) > main :where(.back, .copy-status) {
    color: #8fc3ff !important;
}

html[data-theme="dark"] body:not([class]) > main :where(.install-link, .chrome-link),
html[data-theme="dark"] body.messenger-download-page .messenger-download-button:not(.is-disabled) {
    color: #ffffff !important;
}

html[data-theme="dark"] body.messenger-download-page {
    --dm-bg: #0b1220;
    --dm-card: #151f30;
    --dm-text: #e7eef8;
    --dm-muted: #bdc9d8;
    --dm-border: rgba(143, 160, 181, 0.24);
    --dm-primary: #2563eb;
    --dm-primary-dark: #1d4ed8;
}

html[data-theme="dark"] body.messenger-download-page :where(
    .messenger-download-card,
    .messenger-download-steps
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.messenger-download-page :where(
    .messenger-download-back,
    .messenger-download-card p,
    .messenger-download-steps ol
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.messenger-download-page .messenger-download-button.is-disabled {
    background: #26374e !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] body.messenger-download-page .messenger-download-note {
    background: var(--color-warning-bg) !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .guest-call-panel {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .guest-call-head {
    background: #172f52 !important;
}

html[data-theme="dark"] .guest-call-sub {
    color: #dbeafe !important;
}

html[data-theme="dark"] .guest-call-meta {
    background: var(--color-surface-soft) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .guest-call-meta strong {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .guest-call-note {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .guest-call-btn:disabled {
    background: #34445a !important;
    color: #dce7f5 !important;
}

html[data-theme="dark"] .guest-call-error {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .guest-call-home-link {
    background: #22324a !important;
    color: var(--color-text) !important;
}

/* Dark-theme QC remediation (2026-09-02).
   These selectors are deliberately surface-specific. They repair confirmed
   contrast leaks and harmonize action geometry without touching the approved
   nine-item main-menu contract. */
html[data-theme="dark"] #detailModal .detail-item > span,
html[data-theme="dark"] #detailModal .detail-org-wrap > span {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #detailModal .discussion-thread__composer.comment-form {
    background: #111a29 !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #detailModal :where(
    .discussion-thread__subtitle,
    .discussion-thread__context,
    .discussion-thread__empty,
    .anon-label
) {
    color: #9ca3bf !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .result-card :where(
    .search-match-comment-text,
    .deadline
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] body.unified-page .results-dialog #resultsStatusFilterMenu > .results-view-filter-btn,
html[data-theme="dark"] body.unified-page .results-dialog #resultsTypeFilterMenu > .results-type-filter-btn {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] body.unified-page .results-dialog #resultsStatusFilterMenu > .results-view-filter-btn.active,
html[data-theme="dark"] body.unified-page .results-dialog #resultsTypeFilterMenu > .results-type-filter-btn.active {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    #resultsStatusFilterMenu,
    #resultsTypeFilterMenu
)::before {
    background: #172235 !important;
    border-color: #41536b !important;
}

html[data-theme="dark"] .search-history-header button {
    color: #fda4af !important;
}

html[data-theme="dark"] .search-history-header {
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .search-history-header button:hover {
    background: var(--color-danger-bg) !important;
}

/* Search-history rows inherit a dark surface, but their legacy descendants
   own light-theme colors. Keep every saved-query field readable explicitly. */
html[data-theme="dark"] .search-history-item .sh-keyword {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .search-history-item .sh-count {
    color: #93c5fd !important;
}

html[data-theme="dark"] .search-history-item :where(.sh-filters, .sh-time) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .search-history-empty {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.sh-confirm-box, .sh-confirm-filters, .sh-confirm-col) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .sh-confirm-box h3,
    .sh-confirm-filters .sh-cf-val,
    .sh-confirm-col-title
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .sh-confirm-filters .sh-cf-label {
    color: var(--color-text-muted) !important;
}

html[data-theme="dark"] .sh-confirm-actions .sh-btn-cancel {
    background: var(--color-surface-raised) !important;
    color: var(--color-text) !important;
}

/* The results dialog has late, high-specificity light canvas rules. Preserve
   the raised dark cards while keeping the surrounding and empty-state canvas
   dark, and override the card label element that owns its own #333 color. */
html[data-theme="dark"] body.unified-page .results-dialog .results-virtual-wrapper {
    background: var(--color-bg) !important;
    scrollbar-color: #52637a transparent !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-virtual-wrapper::-webkit-scrollbar-thumb {
    background: #52637a !important;
}

/* iOS can composite the momentum-scrolling result list above its flex-header
   until a tap forces repaint. Give the dark result header one stable layer;
   menus are portalled to the dialog so their viewport positioning is intact. */
html[data-theme="dark"] body.unified-page .results-dialog > .results-header {
    z-index: 2;
    isolation: isolate;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    .no-results,
    #suggestKeywords
) {
    background: var(--color-bg) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .no-results h3,
html[data-theme="dark"] body.unified-page .results-dialog .no-results-company-card strong,
html[data-theme="dark"] body.unified-page .results-dialog .result-card .info-value strong {
    color: var(--color-text) !important;
}

/* Award cards retain a warm accent, but the summary itself must stay on a
   dark surface.  The legacy cream gradient otherwise combines with the
   dark-theme light text override and makes every award value unreadable. */
html[data-theme="dark"] body.unified-page .results-dialog .result-card .award-summary {
    background: linear-gradient(135deg, #2a2114 0%, #1b283b 100%) !important;
    border-top-color: rgba(251, 191, 36, 0.38) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .result-card .award-summary :where(
    .award-row .info-value,
    .award-company,
    .award-amount
) {
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .result-card .award-summary .info-value strong {
    color: #fbbf24 !important;
}

html[data-theme="dark"] body.unified-page .results-dialog :where(
    .no-results .hint,
    .suggest-keywords .suggest-label,
    .no-results-company-card span
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .no-results-company-card {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .refine-search-panel {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .suggest-keywords .suggest-kw-btn {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .suggest-keywords .suggest-kw-btn:is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #qnaContent [style*="color:#64748b"],
html[data-theme="dark"] #qnaContent [style*="color: #64748b"] {
    color: #9ca3bf !important;
}

html[data-theme="dark"] .fig-msg-time {
    color: #9ca3bf !important;
}

html[data-theme="dark"] .desktop-app-banner {
    background: #172f52 !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .msg-message-swipe-row .msg-message-swipe-surface {
    background: #151f30 !important;
}

html[data-theme="dark"] :where(.mobile-shell-panel, .mobile-shell-loading) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] .mobile-shell-loading-title {
    color: var(--color-text) !important;
}

html[data-theme="dark"] .mobile-shell-loading-detail {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(.mobile-shell-open-btn, .mobile-shell-retry-btn) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #msgChatView > div:first-child,
html[data-theme="dark"] #msgChatView > div:last-child {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #msgRtStatus {
    color: #9ca3bf !important;
}

html[data-theme="dark"] #msgHistoryLoader {
    background: rgba(23, 34, 53, 0.96) !important;
    border-color: #41536b !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(#msgRoomCtxMenu, #msgMsgCtxMenu) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] #msgRoomCtxMenu > div:first-child {
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #msgRoomCtxMenu > div[style*="color:#1f2937"] {
    color: var(--color-text) !important;
}

html[data-theme="dark"] #msgRoomCtxMenu > div[style*="color:#dc2626"] {
    color: #fda4af !important;
}

html[data-theme="dark"] #msgRoomCtxMenu > div:is(:hover, :focus-visible) {
    background: #22324a !important;
}

/* Messenger collaboration/search styles are injected after page load. Their
   declarations are non-important, so these dark-only semantic owners remain
   authoritative without changing the injected component geometry. */
html[data-theme="dark"] :where(
    .msg-private-bid-folder,
    .msg-private-bid-folder-head,
    .msg-private-bid-room,
    .msg-room-entry,
    .msg-chat-list-toolbar,
    .msg-collab-panel,
    .msg-collab-head,
    .msg-search-advanced,
    .msg-search-result,
    .msg-search-empty,
    .msg-reaction,
    .msg-pref-choice
) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .msg-private-bid-folder-head,
    .msg-search-advanced,
    .msg-search-empty,
    .msg-reaction
) {
    background: var(--color-surface-soft) !important;
}

html[data-theme="dark"] :where(
    .msg-private-bid-folder-toggle,
    .msg-private-bid-post-link,
    .msg-private-bid-room-kind,
    .msg-search-room,
    .msg-search-go
) {
    color: #93c5fd !important;
}

html[data-theme="dark"] :where(
    .msg-private-bid-folder-meta,
    .msg-message-flags,
    .msg-search-intro,
    .msg-search-field,
    .msg-search-status,
    .msg-search-meta,
    .msg-pref-choice span
) {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] :where(
    .msg-collab-close,
    .msg-search-advanced-toggle,
    .msg-search-reset,
    .msg-search-chip,
    .msg-room-menu-item,
    .msg-message-menu-item,
    .msg-reaction
) {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    .msg-private-bid-room,
    .msg-room-entry,
    .msg-search-result,
    .msg-room-menu-item,
    .msg-message-menu-item
):is(:hover, :focus-visible) {
    background: #22324a !important;
    border-color: #60a5fa !important;
}

html[data-theme="dark"] :where(
    .msg-search-advanced-toggle[aria-expanded="true"],
    .msg-search-chip:has(input:checked),
    .msg-reaction.is-mine,
    .msg-search-more
) {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .msg-message-menu-item.is-danger {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

/* The active room menu keeps its danger state as an inline color for the
   native menu button. Match that semantic preimage without changing the
   menu's keyboard or action contract. */
html[data-theme="dark"] #msgRoomCtxMenu .msg-room-menu-item[style*="color:#dc2626"] {
    background: var(--color-danger-bg) !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #msgRoomCtxMenu .msg-room-menu-item[style*="color:#dc2626"]:is(:hover, :focus-visible) {
    background: #5b1f2b !important;
    border-color: #fb7185 !important;
    color: #fecdd3 !important;
}

/* Messenger still creates a few authenticated surfaces with inline light
   colors. Scope their corrections to the owning dialog/menu so unrelated
   inline styles keep their original meaning. */
html[data-theme="dark"] :where(#msgFriendCtxMenu, #msgP2PGuideModal > div) {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
    box-shadow: var(--shadow-md) !important;
}

html[data-theme="dark"] #msgFriendCtxMenu > div:first-child {
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #msgFriendCtxMenu .msg-friend-menu-item {
    background: transparent !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #msgFriendCtxMenu .msg-friend-menu-item:is(:hover, :focus-visible) {
    background: #22324a !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #msgFriendCtxMenu .msg-friend-menu-item[style*="color:#dc2626"] {
    background: var(--color-danger-bg) !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #msgFriendCtxMenu .msg-friend-menu-item[style*="color:#dc2626"]:is(:hover, :focus-visible) {
    background: #5b1f2b !important;
    color: #fecdd3 !important;
}

html[data-theme="dark"] :where(
    #msgMessageList,
    #msgCreateGroupDialog,
    #msgInviteOverlay,
    #msgP2PGuideModal
) [style*="color:#6b7280"] {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #msgP2PGuideTitle {
    color: #c4b5fd !important;
}

html[data-theme="dark"] #msgP2PGuideModal [style*="color:#374151"] {
    color: var(--color-text) !important;
}

html[data-theme="dark"] #msgP2PGuideCancel {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    #msgCreateGroupDialog #msgGroupFriendList,
    #msgInviteOverlay #msgInviteList
) {
    background: var(--color-surface-soft) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    #msgCreateGroupDialog .msg-group-friend-row,
    #msgInviteOverlay #msgInviteList > label
) {
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] :where(
    #msgCreateGroupDialog,
    #msgInviteOverlay,
    #msgMembersOverlay,
    #msgAddFriendDialog
) .msg-add-dialog-close {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #msgGroupSelCount {
    color: #93c5fd !important;
}

html[data-theme="dark"] #msgInviteOverlay [style*="background:#eef2ff"] {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] .msg-friend-name [style*="color:#6b7280"] {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] #msgMessageList .msg-empty > button[style*="background:#fff"] {
    background: var(--color-surface-raised) !important;
    border-color: #41536b !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] #msgMessageList [data-msg-id] > span[style*="background:#eef2ff"] {
    background: var(--color-info-bg) !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #msgChatView [id^="msgProg_"] {
    background: var(--color-info-bg) !important;
    border-color: #3d78b5 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #msgChatView [id^="msgProg_"] [style*="background:#dbeafe"] {
    background: #22324a !important;
}

html[data-theme="dark"] #msgChatView [id^="msgProg_"] .msg-prog-bar {
    background: #60a5fa !important;
}

html[data-theme="dark"] #msgChatView [id^="msgProg_"] .msg-prog-cancel {
    color: #fda4af !important;
}

html[data-theme="dark"] .msg-room-header :where(
    .msg-room-back-btn,
    .msg-search-btn,
    .msg-room-menu-btn
),
html[data-theme="dark"] #msgChatView :where(
    .msg-room-back-btn,
    .msg-search-btn,
    .msg-room-menu-btn
),
html[data-theme="dark"] #msgChatView > div:first-child > button {
    background: #172f52 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
}

/* Dialog close actions remain true 44px controls on desktop as well as touch
   layouts. The visible glyph stays compact while the focus/tap rect is stable. */
html[data-theme="dark"] :where(
    .consult-close-btn,
    #qnaModalCloseBtn,
    #searchFilterDialog .sfd-close-btn,
    #filterSaveDialog .fsd-close-btn
) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    box-sizing: border-box;
}

/* Private-bid labels keep their semantic colour without reusing light-theme
   foregrounds on dark surfaces.  The favorite chip has an inline light-theme
   colour, so the dark rule must intentionally outrank it. */
html[data-theme="dark"] .bid-type {
    background: #1d3a63 !important;
    color: #dbeafe !important;
    box-shadow: inset 0 0 0 1px #45658b;
}

html[data-theme="dark"] .info-badge.work {
    background: linear-gradient(135deg, #065f46, #047857) !important;
    color: #ecfdf5 !important;
}

html[data-theme="dark"] .info-badge.stock {
    background: linear-gradient(135deg, #7c2d12, #9a3412) !important;
    color: #fff7ed !important;
}

html[data-theme="dark"] .info-badge.news {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8) !important;
    color: #eff6ff !important;
}

html[data-theme="dark"] :where(.info-item-category, .joint-supply-badge.allowed) {
    background: #112d49 !important;
    color: #bfdbfe !important;
    border-color: #31577c !important;
}

html[data-theme="dark"] .joint-supply-badge.denied {
    background: #3b1f26 !important;
    color: #fda4af !important;
    border-color: #713341 !important;
}

html[data-theme="dark"] :where(.stock-up, .deadline.soon) {
    color: #fda4af !important;
}

html[data-theme="dark"] .stock-down {
    color: #93c5fd !important;
}

html[data-theme="dark"] .search-match-comment::before,
html[data-theme="dark"] .comment-indicator {
    color: #7dd3fc !important;
}

html[data-theme="dark"] .search-match-comment-more {
    color: #9ca3bf !important;
}

html[data-theme="dark"] #searchHistoryDropdown .search-history-loading {
    color: #9ca3bf !important;
}

html[data-theme="dark"] .summary-text {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .summary-text :where(p, li) {
    color: #dbeafe !important;
}

html[data-theme="dark"] .summary-text h3 {
    color: #f1f5f9 !important;
    border-bottom-color: #41536b !important;
}

html[data-theme="dark"] .summary-text h4,
html[data-theme="dark"] .summary-text strong {
    color: #f8fafc !important;
}

html[data-theme="dark"] .summary-text a {
    color: #93c5fd !important;
}

html[data-theme="dark"] .summary-meta {
    color: #9ca3bf !important;
    border-top-color: #41536b !important;
}

html[data-theme="dark"] .cached-badge {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] body.unified-page :where(.filter-count.phase-loading, .compact-folder-count.phase-loading) {
    color: #93c5fd !important;
    background: none !important;
    background-clip: border-box !important;
    -webkit-background-clip: border-box !important;
    -webkit-text-fill-color: #93c5fd !important;
}

html[data-theme="dark"] .status.active {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] .status.canceled {
    background: #3b1f26 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .status.awarded,
html[data-theme="dark"] .consortium-badge {
    background: linear-gradient(135deg, #3a2f14, #4b3b17) !important;
    color: #fde68a !important;
    border-color: #705c25 !important;
}

html[data-theme="dark"] .type-badge:is(.bid, .all) {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8) !important;
    color: #eff6ff !important;
}

html[data-theme="dark"] .type-badge:is(.bid_purchase, .sme_support, .bizinfo) {
    background: linear-gradient(135deg, #065f46, #047857) !important;
    color: #ecfdf5 !important;
}

html[data-theme="dark"] .type-badge:is(.bid_service, .rnd, .success_bid_purchase) {
    background: linear-gradient(135deg, #581c87, #7e22ce) !important;
    color: #faf5ff !important;
}

html[data-theme="dark"] .type-badge:is(.subsidy, .private_bid) {
    background: linear-gradient(135deg, #7c2d12, #9a3412) !important;
    color: #fff7ed !important;
}

html[data-theme="dark"] .type-badge:is(.success_bid, .success_bid_service) {
    background: linear-gradient(135deg, #701a3f, #9d174d) !important;
    color: #fdf2f8 !important;
}

html[data-theme="dark"] .type-badge.prespec {
    background: linear-gradient(135deg, #4d4c0c, #63620f) !important;
    color: #fefce8 !important;
}

html[data-theme="dark"] .type-badge.consortium {
    background: linear-gradient(135deg, #1e3a8a, #065f46) !important;
    color: #eff6ff !important;
}

html[data-theme="dark"] #searchBookmarkSide :where(.bm-side-name, .bm-side-meta, .bm-side-deadline, .bm-side-empty) {
    color: #9ca3bf !important;
}

html[data-theme="dark"] #searchBookmarkSide .bm-side-name {
    color: #dbeafe !important;
}

html[data-theme="dark"] #searchBookmarkSide .bm-side-status-open {
    color: #86efac !important;
}

html[data-theme="dark"] #searchBookmarkSide .bm-side-viewall {
    color: #93c5fd !important;
}

html[data-theme="dark"] #searchBookmarkSide :where(.bm-side-item, .bm-side-viewall):is(:hover, :focus-visible) {
    background: #1b283b !important;
    color: #dbeafe !important;
    outline-color: #60a5fa !important;
}

html[data-theme="dark"] .status-pill {
    background: #25344a !important;
    color: #dbeafe !important;
    box-shadow: inset 0 0 0 1px #41536b;
}

html[data-theme="dark"] .status-pill:is(.open, .done) {
    background: #12351f !important;
    color: #86efac !important;
    box-shadow: inset 0 0 0 1px #28643e;
}

html[data-theme="dark"] .status-pill.closed {
    background: #3b1f26 !important;
    color: #fda4af !important;
    box-shadow: inset 0 0 0 1px #713341;
}

html[data-theme="dark"] .status-pill:is(.draft, .active) {
    background: #3a2f14 !important;
    color: #fde68a !important;
    box-shadow: inset 0 0 0 1px #705c25;
}

html[data-theme="dark"] .status-pill:is(.awarded, .pending) {
    background: #112d49 !important;
    color: #bfdbfe !important;
    box-shadow: inset 0 0 0 1px #31577c;
}

html[data-theme="dark"] body.private-bids-page #tab-my-bookmarks .status-pill:not(.open):not(.closed):not(.draft):not(.awarded):not(.active):not(.pending):not(.done) {
    background: #3a2f14 !important;
    color: #ffe29a !important;
    box-shadow: inset 0 0 0 1px #705c25;
}

/* A single dark backdrop gradient keeps the pin treatment, while solid text
   stays readable through every stop.  Avoid text clipping and inverse colour
   seams: both made the title disappear at the midpoint on real phones. */
html[data-theme="dark"] body.private-bids-page .writing-swipe-row.is-pinned .writing-card-title,
html[data-theme="dark"] body.private-bids-page .bookmark-swipe-row.is-pinned .bid-list-card-title,
html[data-theme="dark"] body.private-bids-page .managed-swipe-row.is-pinned .bid-list-card-title {
    color: #f5fbf8 !important;
    -webkit-text-fill-color: #f5fbf8 !important;
    background: linear-gradient(
        90deg,
        rgba(20, 83, 63, 0.98) 0%,
        rgba(20, 83, 63, 0.94) 48%,
        rgba(20, 47, 43, 0.88) 72%,
        rgba(21, 31, 48, 0) 100%
    ) !important;
    background-clip: padding-box !important;
    -webkit-background-clip: padding-box !important;
    text-shadow: none;
}

/* User-approved search/result control geometry. The visual hierarchy is
   neutral filters -> tinted create -> primary active results. */
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-status-control,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-type-control {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-status-control::before,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-type-control::before {
    border-right-color: var(--color-border) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-folder-btn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #licenseFilterBtn,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #homePrivateBidCreateAction,
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn {
    border-color: #38506b !important;
    border-radius: 10px !important;
    background: linear-gradient(180deg, #1b283b 0%, #172235 100%) !important;
    color: #dce7f5 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22) !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #homePrivateBidCreateAction {
    background: linear-gradient(180deg, #1d3c64 0%, #172f52 100%) !important;
    border-color: #3d78b5 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn.info-panel-btn-active:not(:disabled) {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn:disabled {
    background: #172235 !important;
    border-color: #34465d !important;
    color: #9ca3bf !important;
    opacity: 0.78 !important;
}

html[data-theme="dark"] body.unified-page:not(.results-dialog-active) .search-section .search-buttons #licenseFilterBtn .filter-caption {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

@media (min-width: 768px) {
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-status-control,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-type-control,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #statusFilterFolderBtn,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #typeFilterFolderBtn,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #licenseFilterBtn,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #homePrivateBidCreateAction,
    html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #infoPanelToggleBtn {
        min-height: 42px !important;
        height: 42px !important;
        border-radius: 10px !important;
    }

    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-status-control,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-type-control,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #statusFilterFolderBtn,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #typeFilterFolderBtn,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #licenseFilterBtn,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #homePrivateBidCreateAction,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) #searchSection .search-buttons #infoPanelToggleBtn {
        min-height: 44px !important;
        height: 44px !important;
    }
}

@media (max-width: 767px) {
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons {
        gap: 6px !important;
    }

    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-status-control,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-type-control,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons .compact-folder-btn,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons #licenseFilterBtn,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons #homePrivateBidCreateAction,
    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn {
        min-height: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
        line-height: 1.15 !important;
    }

    html[data-theme="dark"].iliya-touch-layout body.unified-page:not(.results-dialog-active) .search-section .search-buttons #infoPanelToggleBtn br {
        display: none !important;
    }

    html[data-theme="dark"] body.unified-page .results-dialog .results-refine-action,
    html[data-theme="dark"] body.unified-page .results-dialog .results-related-company-btn,
    html[data-theme="dark"] body.unified-page .results-dialog .results-filter-controls .compact-folder-btn,
    html[data-theme="dark"] body.unified-page .results-dialog .results-dialog-close-btn,
    html[data-theme="dark"] body.unified-page .results-dialog .results-sort-button {
        min-height: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
        box-sizing: border-box;
    }

    html[data-theme="dark"] body.unified-page .results-dialog .results-sort-control {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border-radius: 10px !important;
    }

    html[data-theme="dark"] body.unified-page .results-dialog > .results-header > .results-dialog-close-btn {
        width: 44px !important;
        min-width: 44px !important;
        flex-basis: 44px !important;
    }

    html[data-theme="dark"] body.unified-page .results-dialog .result-card .card-bookmark-btn,
    html[data-theme="dark"] body.unified-page .results-dialog .result-card .btn-detail-sm,
    html[data-theme="dark"] #detailModal #bookmarkBtn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 44px !important;
        width: 44px !important;
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        box-sizing: border-box;
    }

    html[data-theme="dark"] .search-history-header button {
        min-height: 44px !important;
        padding-inline: 10px !important;
    }
}

/* Full-surface dark contrast contract (2026-09-02).
   Feature modules can add their own styles after initial page load. These
   selectors therefore own colour, border and fill only; component geometry,
   scrolling and interaction remain with the feature stylesheet. */
html[data-theme="dark"] body.unified-page .results-dialog .results-count-summary {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-count-summary #resultsCount {
    color: #93c5fd !important;
}

html[data-theme="dark"] body.unified-page .results-dialog .results-heading-label {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #searchFilterDialog :where(.sfd-header, .sfd-footer),
html[data-theme="dark"] #searchSection .search-buttons {
    border-color: #334155 !important;
}

html[data-theme="dark"] #detailModal .timeline-step .tl-label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] #detailModal :where(
    .timeline-step .tl-date,
    .timeline-step .tl-detail,
    .basis-breakdown,
    .bid-guide-hint
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .weather-week-day small,
    .weather-week-desc
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .weather-week-max {
    color: #fca5a5 !important;
}

html[data-theme="dark"] .weather-week-min {
    color: #93c5fd !important;
}

html[data-theme="dark"] .weather-week-sun {
    color: #fde68a !important;
}

html[data-theme="dark"] .user-menu-label {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] #detailModal :where(
    .discussion-thread__title,
    .discussion-thread__author,
    .discussion-thread__body
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #detailModal :where(
    .discussion-thread__notice,
    .discussion-thread__status,
    .detail-async-status,
    .org-history-stable-state
),
html[data-theme="dark"] #collabSearchDetailModal .collab-search-detail-state,
html[data-theme="dark"] :where(
    .bdw-lazy-status,
    .messenger-tab-loader-title,
    .messenger-tab-loader-status,
    .cal-loading-state,
    .cal-day-loading,
    .weather-dialog-state,
    .notif-loading-state,
    .notif-state,
    .notif-action-status
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .org-history-dialog {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-header,
    .org-history-tabs
) {
    border-color: #334155 !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-header h3,
    .oh-title,
    .company-history-title-row > strong
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-close,
    .org-history-summary,
    .org-history-loading,
    .org-history-empty,
    .org-history-stable-state,
    .oh-meta,
    .oh-award-rate,
    .oh-award-bidders,
    .oh-winner-name,
    .company-history-winner-toggle,
    .company-history-load-state,
    .bid-history-scope-copy p,
    .bid-history-past-progress
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-detail-pending,
    .company-history-partners-placeholder,
    .bid-history-scope-box,
    .oh-item,
    .consortium-partners-block
) {
    background-color: #172235 !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-tab,
    .org-history-search-input,
    .company-history-load-state button,
    .bid-history-past-button
) {
    background: #172235 !important;
    border-color: #526783 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .org-history-close,
    .org-history-tab,
    .company-history-load-state button,
    .bid-history-past-button
):is(:hover, :focus-visible) {
    background: #24405f !important;
    border-color: #93c5fd !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #orgHistoryOverlay .org-history-tab.active {
    background: #1d4f91 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .bid-history-scope-copy strong,
    .oh-budget,
    .company-history-type,
    .company-history-archive-summary
) {
    color: #93c5fd !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .company-history-confirmed,
    .oh-award-amount
) {
    color: #86efac !important;
}

html[data-theme="dark"] #orgHistoryOverlay :where(
    .company-history-inferred,
    .oh-award-company,
    .consortium-partners-block h4,
    .consortium-partners-block p,
    .consortium-partner-chips span
) {
    color: #fde68a !important;
}

html[data-theme="dark"] #orgHistoryOverlay .consortium-partner-chips span {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .oh-item:is(:hover, .oh-cancelled) {
    background: #1b2a40 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .org-history-body {
    scrollbar-color: #60748f #172235 !important;
}

/* Company bid-history rows share the dialog's dark surface at every load,
   result, and archive state.  Keep this color-only so the history component
   retains its own responsive grid and scrolling behavior. */
html[data-theme="dark"] #orgHistoryOverlay .company-history-winner-toggle input {
    accent-color: #60a5fa;
    color-scheme: dark;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-type {
    background: #172f52 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-fields {
    border-color: #41536b !important;
    background: #41536b !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-fields > div,
html[data-theme="dark"] #orgHistoryOverlay .company-history-notes {
    border-color: #41536b !important;
    background: #111a29 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-fields span,
html[data-theme="dark"] #orgHistoryOverlay .company-history-note {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-fields strong {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-result.is-normal,
html[data-theme="dark"] #orgHistoryOverlay .oh-rank-badge,
html[data-theme="dark"] #orgHistoryOverlay .oh-badge.oh-badge-cancelled {
    background: #26374e !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-result.is-winner,
html[data-theme="dark"] #orgHistoryOverlay .oh-rank-badge.oh-winner {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-result.is-unknown,
html[data-theme="dark"] #orgHistoryOverlay .oh-badge.oh-badge-revised {
    background: #3b2a0e !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-result.is-disqualified,
html[data-theme="dark"] #orgHistoryOverlay .oh-rank-badge.oh-disqualified {
    background: #421821 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-note.is-error,
html[data-theme="dark"] #orgHistoryOverlay .company-history-load-state.error,
html[data-theme="dark"] #orgHistoryOverlay .oh-dqlfctn {
    color: #fda4af !important;
}

html[data-theme="dark"] #orgHistoryOverlay .company-history-load-state.loading::before {
    border-color: #41536b !important;
    border-top-color: #60a5fa !important;
}

html[data-theme="dark"] #detailModal .discussion-thread__status.is-error {
    background-color: #421821 !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #collabSearchDetailModal .collab-search-detail-state.is-error,
html[data-theme="dark"] :where(
    .detail-async-status.is-error,
    .org-history-stable-state.is-error,
    .bdw-lazy-status.is-error,
    .messenger-tab-loader-status.is-error,
    .cal-loading-state.is-error,
    .weather-dialog-state.is-error,
    .notif-loading-state.is-error,
    .notif-state.is-error,
    .notif-action-status.is-error
) {
    color: #fda4af !important;
}

html[data-theme="dark"] .auth-form label,
html[data-theme="dark"] #authModal .form-group > label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] :where(
    #authBizLookupResult,
    #authBizInfoDisplay,
    #authFormStatus
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #authFormStatus.auth-form-status-error {
    background: #421821 !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] #authFormStatus.auth-form-status-success {
    background: #12351f !important;
    border-color: #28643e !important;
    color: #86efac !important;
}

html[data-theme="dark"] #authBizIdentityWarn {
    background: #421821 !important;
    border-color: #7f2634 !important;
    color: #fecaca !important;
}

html[data-theme="dark"] #authBizCeo:read-only,
html[data-theme="dark"] .password-toggle {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    .auth-submit,
    .auth-toggle button.active,
    #authBizLookupBtn
) {
    background: #1d4f91 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    .auth-submit,
    .auth-toggle button.active,
    #authBizLookupBtn
):is(:hover, :focus-visible, :active) {
    background: #245ea8 !important;
    border-color: #93c5fd !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .pwa-guide-note {
    background: #1b283b !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .app-file-save-panel,
    .detail-attachment-save-panel,
    .detail-pending-panel,
    #p2pAcceptDialog > div,
    .dash-rate-help,
    .work-log-intro,
    .work-log-status,
    .work-log-empty,
    .work-log-entry
),
html[data-theme="dark"] :where(
    #creditAlertOverlay,
    #bookmarkNotificationAlertOverlay,
    #loginRequiredOverlay
) > div {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    #creditAlertOverlay,
    #bookmarkNotificationAlertOverlay,
    #loginRequiredOverlay,
    #p2pAcceptDialog
) :where(
    [style*="color:#1e293b"],
    [style*="color:#172033"],
    [style*="color:#1f2937"]
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    #creditAlertOverlay,
    #bookmarkNotificationAlertOverlay,
    #loginRequiredOverlay,
    #p2pAcceptDialog
) :where(
    [style*="color:#333"],
    [style*="color:#374151"],
    [style*="color:#445064"],
    [style*="color:#475569"],
    [style*="color:#64748b"],
    [style*="color:#6b7280"],
    [style*="color:#666"]
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #loginRequiredOverlay [style*="color:#1565c0"] {
    color: #93c5fd !important;
}

html[data-theme="dark"] :where(
    #loginRequiredOverlay button[style*="background:#e2e8f0"],
    #p2pRejectBtn
) {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    #creditAlertOverlay button,
    #bookmarkNotificationAlertConfirm,
    #loginRequiredOverlay a[style*="background:#1565c0"],
    #p2pAcceptBtn
) {
    background: #1d4f91 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailModal .detail-pending-panel :where(strong, p) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #detailModal .detail-pending-spinner {
    border-color: #41536b !important;
    border-top-color: #60a5fa !important;
}

html[data-theme="dark"] #detailModal .detail-pending-cancel {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #appFileSaveSheet :where(
    .app-file-save-close,
    .app-file-save-name,
    .app-file-save-action:not(.is-primary),
    .app-file-save-fallback
),
html[data-theme="dark"] #detailAttachmentSaveSheet :where(
    #detailAttachmentSaveClose,
    #detailAttachmentSaveCancel,
    .detail-attachment-fallback-url
) {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #appFileSaveSheet .app-file-save-status,
html[data-theme="dark"] #detailAttachmentSaveSheet .detail-attachment-save-status {
    background: #172f52 !important;
    border-color: #31577c !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #appFileSaveSheet .app-file-save-status:is(
    [data-state="error"],
    [data-state="fallback"]
),
html[data-theme="dark"] #detailAttachmentSaveSheet .detail-attachment-save-status:is(
    [data-state="error"],
    [data-state="fallback"]
) {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #appFileSaveSheet .app-file-save-action.is-primary,
html[data-theme="dark"] #detailAttachmentShareBtn:not(:disabled) {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #detailAttachmentFallbackBtn {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #detailAttachmentShareBtn:disabled {
    background: #26374e !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .org-history-stable-state button,
    .org-history-detail-pending button
) {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    .org-history-stable-state.is-loading,
    .org-history-detail-pending.is-loading,
    .company-history-partners-placeholder
)::before {
    border-color: #41536b !important;
    border-top-color: #60a5fa !important;
}

html[data-theme="dark"] .work-log-intro strong,
html[data-theme="dark"] .work-log-entry-title,
html[data-theme="dark"] .work-log-content {
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    .work-log-intro span,
    .work-log-author,
    .work-log-card p,
    .work-log-upload-status
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(
    .work-log-date-tag,
    .work-log-time-tag
) {
    background: #172f52 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .work-log-verify-tag {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] .work-log-verify-tag.is-declared {
    background: #3b2a0e !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .work-log-status.is-error {
    background: #421821 !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .work-log-card :where(input[type="text"], textarea) {
    background: #172235 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .work-log-legal {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .work-log-legal-links a {
    color: #93c5fd !important;
}

html[data-theme="dark"] #appOrientationGuard,
html[data-theme="dark"] .mobile-shell-loading-close {
    background: #0b1220 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #appOrientationGuard .app-orientation-guard__title {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #appOrientationGuard .app-orientation-guard__description {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #appOrientationGuard .app-orientation-guard__icon {
    border-color: #60a5fa !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] :where(
    .info-card-loading-lines > span,
    .cal-loading-skeleton > span,
    .weather-dialog-skeleton > span,
    .notif-skeleton-row,
    .messenger-tab-loader .skeleton,
    .bdw-lazy-placeholder span,
    .wiz-bid-prediction-skeleton i,
    .work-log-skeleton
) {
    background-color: #1e2a3d !important;
    background-image: linear-gradient(
        90deg,
        #1e2a3d 0%,
        #2b3a52 50%,
        #1e2a3d 100%
    ) !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .wiz-bid-prediction-shell {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-bid-prediction-state {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .wiz-bid-prediction-state strong {
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-bid-prediction-spinner {
    border-color: #41536b !important;
    border-top-color: #60a5fa !important;
}

html[data-theme="dark"] .wiz-bid-prediction-retry {
    background: #1d4f91 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .msg-bubble-mine .msg-attachment-download {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .msg-bubble-mine .msg-attachment-download:is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #93c5fd !important;
    color: #ffffff !important;
}

/* Public-shell labels must not fall back to light-theme colours. These
   selectors own colours only; layout remains feature-owned. */
html[data-theme="dark"] body.unified-page:not(.results-dialog-active) #searchSection .search-buttons .compact-folder-caption {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .service-footer {
    background-color: #151f30 !important;
    border-color: #334155 !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .service-footer .service-footer-identity,
html[data-theme="dark"] .service-footer .service-footer-details,
html[data-theme="dark"] .service-footer .service-footer-contact,
html[data-theme="dark"] .service-footer .service-footer-note {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .service-footer .service-footer-identity strong {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .service-footer a {
    color: #93c5fd !important;
}

html[data-theme="dark"] body.private-bids-page .pb-tab-count {
    background: #27364b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body.private-bids-page .pb-tab.active .pb-tab-count {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

/* Private-bid status totals must stay on dark semantic surfaces. The base
   stylesheet uses light pastel fills, which combine with dark-theme text
   variables to produce nearly invisible labels. */
html[data-theme="dark"] body.private-bids-page .bid-stat-chip {
    background: #172235 !important;
    border-color: #41536b !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip .bid-stat-count {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip .bid-stat-label {
    color: #dbeafe !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.open {
    background: #12351f !important;
    border-color: #28643e !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.open .bid-stat-count {
    color: #dcfce7 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.open .bid-stat-label {
    color: #bbf7d0 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.draft {
    background: #3a2f14 !important;
    border-color: #705c25 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.draft .bid-stat-count {
    color: #fef3c7 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.draft .bid-stat-label {
    color: #fde68a !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.closed {
    background: #3b1f26 !important;
    border-color: #713341 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.closed .bid-stat-count {
    color: #ffe4e6 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.closed .bid-stat-label {
    color: #fecdd3 !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.awarded {
    background: #112d49 !important;
    border-color: #31577c !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.awarded .bid-stat-count {
    color: #dbeafe !important;
}

html[data-theme="dark"] body.private-bids-page .bid-stat-chip.awarded .bid-stat-label {
    color: #bfdbfe !important;
}

html[data-theme="dark"] .msg-friend-filter-status {
    color: #bdc9d8 !important;
}

/* Feedback colors keep their meaning without introducing bright sheets. */
html[data-theme="dark"] :where(.success-message, .status-success, .badge-success) {
    background-color: var(--color-success-bg) !important;
    color: #86efac !important;
    border-color: #236b3c !important;
}

html[data-theme="dark"] :where(.warning-message, .status-warning, .badge-warning, .notice-contact-use-notice) {
    background-color: var(--color-warning-bg) !important;
    color: #fde68a !important;
    border-color: #7c5b17 !important;
}

html[data-theme="dark"] :where(.error-message, .status-error, .badge-danger) {
    background-color: var(--color-danger-bg) !important;
    color: #fda4af !important;
    border-color: #7f2634 !important;
}

html[data-theme="dark"] :where(.info-message, .status-info, .public-shared-disclosure) {
    background-color: var(--color-info-bg) !important;
    color: #bfdbfe !important;
    border-color: #285b91 !important;
}

html[data-theme="dark"] a:not(.primary-btn):not(.auth-submit):not(.kakao-login-btn) {
    color: #8fc3ff;
}

html[data-theme="dark"] hr {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] mark.search-keyword-highlight {
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #facc15 !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    text-decoration-line: underline !important;
    text-decoration-color: #ca8a04 !important;
    text-decoration-thickness: 0.11em !important;
    text-underline-offset: 0.13em !important;
}

/* Bid and award process guides are nested above the dark detail dialog. Keep
   their complete visual tree on dark surfaces, including legacy inline colour
   declarations emitted by bid_wizard.js. Geometry remains component-owned. */
html[data-theme="dark"] .bid-guide-btn {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .bid-guide-btn:is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #93c5fd !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-overlay {
    background: rgba(3, 7, 18, 0.78) !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bwiz-box {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bwiz-header {
    background: #172f52 !important;
    border-color: #41536b !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-progress,
html[data-theme="dark"] .bwiz-actions {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .bwiz-content,
html[data-theme="dark"] .bwiz-step-body {
    background: #151f30 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(.bwiz-step-title, .wiz-summary-title, .wiz-section-title) {
    color: #dbeafe !important;
    border-color: #41536b !important;
}

html[data-theme="dark"] :where(.bwiz-page, .wiz-range-sub, .wiz-bar-range, .wiz-hist-pct, .wiz-price-idx, .wiz-corp-more) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .bwiz-dot {
    background: #27364b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .bwiz-dot.done {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] .bwiz-dot.active {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-close {
    background: transparent !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-close:is(:hover, :focus-visible) {
    background: rgba(147, 197, 253, 0.16) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-btn-prev {
    background: #27364b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bwiz-btn-prev:hover:not(:disabled) {
    background: #354861 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-btn-next {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-btn-next:hover:not(:disabled),
html[data-theme="dark"] .bwiz-btn-next:focus-visible {
    background: #2563eb !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-btn-done {
    background: #166534 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-btn-done:hover:not(:disabled),
html[data-theme="dark"] .bwiz-btn-done:focus-visible {
    background: #15803d !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(.wiz-data, .wiz-price-selected-note.active) {
    background: #12351f !important;
    border-color: #28643e !important;
    color: #dcfce7 !important;
}

html[data-theme="dark"] :where(.wiz-data-label, .wiz-data-val, .wiz-price-selected-note.active) {
    color: #bbf7d0 !important;
}

html[data-theme="dark"] :where(.wiz-table td, .wiz-corp-row, .wiz-corp-action) {
    border-color: #41536b !important;
}

html[data-theme="dark"] .wiz-table td:first-child {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .wiz-table td:last-child,
html[data-theme="dark"] :where(.wiz-price-val, .wiz-corp-name) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(.wiz-price-rate, .wiz-corp-rate) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(.wiz-insight, .wiz-badge-warn) {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] :where(.wiz-empty, .wiz-range-box, .wiz-sim-card, .wiz-check-item, .wiz-price-selected-note) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-guidance-details {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-guidance-details > summary {
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(.wiz-range-highlight, .wiz-price-cell.wiz-price-hot) {
    background: #172f52 !important;
    border-color: #3b82f6 !important;
}

html[data-theme="dark"] :where(.wiz-range-title, .wiz-hist-label) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(.wiz-range-vals, .wiz-highlight, .wiz-corp-amt, .wiz-corp-open, .all-bidders-open) {
    color: #93c5fd !important;
}

html[data-theme="dark"] :where(.wiz-bar-track, .wiz-hist-bar-wrap) {
    background: #27364b !important;
}

html[data-theme="dark"] .wiz-badge-ok {
    background: #12351f !important;
    color: #86efac !important;
}

html[data-theme="dark"] .wiz-price-cell {
    background: #1b283b !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-price-cell:is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
}

html[data-theme="dark"] .wiz-price-cell.wiz-price-selected {
    background: #12351f !important;
    border-color: #4ade80 !important;
}

html[data-theme="dark"] .wiz-price-select {
    background: #172f52 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .wiz-price-selected .wiz-price-select {
    background: #166534 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .wiz-sim-card.wiz-sim-primary {
    background: #172f52 !important;
    border-color: #3b82f6 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wiz-sim-primary :where(.wiz-sim-label, .wiz-sim-sub) {
    color: #bfdbfe !important;
}

html[data-theme="dark"] .wiz-corp-action:is(:hover, :focus-visible),
html[data-theme="dark"] .all-bidders-action-row:is(:hover, :focus-visible) {
    background: #172f52 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(.wiz-corp-action.wiz-corp-winner, .wiz-corp-winner) {
    background: #3b2a0e !important;
    border-color: #d97706 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .wiz-corp-rank {
    background: #27364b !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .wiz-corp-winner .wiz-corp-rank {
    background: #b45309 !important;
    color: #ffffff !important;
}

/* Legacy wizard steps still emit semantic cards with inline light palettes.
   Attribute-scoped rules keep those cards readable without changing content or
   layout, and can be removed once the renderer owns semantic classes. */
html[data-theme="dark"] .bwiz-overlay [style*="background:#f8fbff"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#eef6ff"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#eff6ff"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#eef2ff"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#f0f4ff"],
html[data-theme="dark"] .bwiz-overlay [style*="background:linear-gradient(135deg,#dbeafe,#eff6ff)"] {
    background: #172f52 !important;
    border-color: #3b82f6 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#fbfffc"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#f0fdf4"] {
    background: #12351f !important;
    border-color: #28643e !important;
    color: #dcfce7 !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#fffaf5"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fff7e6"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#ffedcc"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#FFF3E0"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fff3e0"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fef3c7"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fffbeb"],
html[data-theme="dark"] .bwiz-overlay [style*="background:linear-gradient(135deg,#fff7e6,#ffedcc)"] {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#faf5ff"] {
    background: #3a2357 !important;
    border-color: #7e4aa8 !important;
    color: #f3e8ff !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#fce7f3"] {
    background: #421821 !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#f8fafc"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#f1f5f9"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#f9fafb"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fafafa"],
html[data-theme="dark"] .bwiz-overlay [style*="background:#fff;"] {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#1d4ed8"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#1e40af"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#1e3a5f"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#0f4c81"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#075985"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#0c4a6e"] {
    color: #93c5fd !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#15803d"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#166534"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#059669"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#14532d"] {
    color: #86efac !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#c2410c"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#92400e"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#78350f"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#b26a00"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#e65100"] {
    color: #fde68a !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#7e22ce"] {
    color: #e9d5ff !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#9d174d"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#831843"] {
    color: #fda4af !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#334155"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#1f2937"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#222"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#333"] {
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#475569"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#4b5563"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#64748b"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#6b7280"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#888"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#999"],
html[data-theme="dark"] .bwiz-overlay [style*="color:#9ca3af"] {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#666"] {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="color:#3730a3"] {
    color: #c7d2fe !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#059669"] {
    background: #047857 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#0891b2"] {
    background: #0e7490 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .bwiz-overlay [style*="background:#d97706"] {
    background: #b45309 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #allBiddersDialog > div {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #allBiddersDialog :where(input, thead, tfoot),
html[data-theme="dark"] #allBiddersDialog > div > div:first-child,
html[data-theme="dark"] #allBiddersDialog > div > div:last-child {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #allBiddersDialog :where(th, td, tr) {
    border-color: #41536b !important;
}

html[data-theme="dark"] #allBiddersDialog tr[style*="background:#fff8e1"] {
    background: #3b2a0e !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #allBiddersDialog tr[style*="background:#fafafa"] {
    background: #111a29 !important;
    color: #bdc9d8 !important;
}

/* The document-preparation wizard is rendered dynamically above the bid
   guide. Its renderer still emits light inline colours, so the root ID owns
   every semantic state until those strings are replaced by CSS classes. */
html[data-theme="dark"] #bidDocWizOverlay {
    background: rgba(3, 7, 18, 0.78) !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bidDocWizOverlay #bidDocWizBox,
html[data-theme="dark"] #bidDocWizOverlay section {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="background:#fff"],
    [style*="background: #fff"],
    [style*="background:#f8fafc"],
    [style*="background:#f5f7ff"],
    [style*="background:#f1f5f9"],
    [style*="background:#eeeeee"]
) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="background:#eff6ff"],
    [style*="color:#1976d2"],
    [style*="color:#1d4ed8"]
) {
    background: #172f52 !important;
    border-color: #3b82f6 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="background:#e8f5e9"],
    [style*="color:#2e7d32"],
    [style*="color:#1b5e20"]
) {
    background: #12351f !important;
    border-color: #28643e !important;
    color: #bbf7d0 !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="background:#fff7ed"],
    [style*="background:#fff3e0"],
    [style*="background:#FFF3E0"],
    [style*="color:#e65100"],
    [style*="color:#b26a00"],
    [style*="color:#9a3412"]
) {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="background:#ede7f6"],
    [style*="color:#6a1b9a"]
) {
    background: #3a2357 !important;
    border-color: #7e4aa8 !important;
    color: #f3e8ff !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="color:#1e293b"],
    [style*="color:#334155"]
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bidDocWizOverlay :where(
    [style*="color:#475569"],
    [style*="color:#64748b"],
    [style*="color:#666"],
    [style*="color:#555"]
) {
    color: #bdc9d8 !important;
}

/* Standalone private-work registration loads its feature stylesheet after the
   shared theme. Scope the stronger theme owner to the unique form instead of
   changing generic wizard or button classes used by sign-up. */
html[data-theme="dark"] body:has(#wizardForm),
html[data-theme="dark"] body:has(#wizardForm) :where(.container, main),
html[data-theme="dark"] .wizard-card:has(#wizardForm) {
    background: #0f1726 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(
    h2,
    h3,
    label,
    .price-type-title,
    .appendix-item-name,
    .review-table td,
    .numpad-popup-header h3,
    .upload-modal-title
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(
    .step-subtitle,
    .field-hint,
    .price-type-desc,
    .appendix-item-size,
    .review-none,
    .media-dialog-desc,
    .map-selected-text,
    .upload-modal-status,
    .vid-time-label,
    .vid-timing-label,
    .vid-pause-label,
    .vid-no-audio-label
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(
    input:not([type="radio"]):not([type="checkbox"]):not([type="color"]),
    select,
    textarea,
    .body-editor,
    .price-type-card,
    .appendix-item,
    .existing-appendix,
    .review-body-preview,
    .section-row,
    .vid-mode-radio,
    .vid-shape-chip
) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(
    input,
    select,
    textarea,
    .body-editor
)::placeholder,
html[data-theme="dark"] .wizard-card:has(#wizardForm) .body-editor:empty::before {
    color: #9ca3bf !important;
    opacity: 1 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .wizard-step-indicator .step-circle {
    background: #172235 !important;
    border-color: #536983 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .wizard-step-indicator.active .step-circle {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .wizard-step-indicator.completed .step-circle {
    background: #166534 !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .wizard-step-connector {
    background: #41536b !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .wizard-step-connector.completed {
    background: #4ade80 !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(.step-guide, .linked-bid-banner) {
    background: #172f52 !important;
    border-color: #3b82f6 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) :where(
    .linked-bid-label,
    .linked-bid-name,
    .linked-bid-meta
) {
    color: #bfdbfe !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .price-type-option input[type="radio"]:checked + .price-type-card,
html[data-theme="dark"] .wizard-card:has(#wizardForm) .vid-mode-radio:has(input:checked),
html[data-theme="dark"] .wizard-card:has(#wizardForm) .vid-shape-chip.selected {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body:has(#wizardForm) :where(
    .map-popup-modal,
    .media-dialog,
    .img-edit-modal,
    .numpad-popup-modal,
    .upload-modal-box
) {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] body:has(#wizardForm) :where(
    .map-popup-header,
    .map-search-bar,
    .map-info-bar,
    .map-popup-footer,
    .img-edit-header,
    .img-edit-body,
    .img-edit-toolbar,
    .img-edit-text-bar,
    .numpad-popup-header,
    .numpad-display,
    .numpad-footer,
    .vid-time-bar,
    .vid-seek-btns,
    .upload-modal-box .upload-progress-bar
) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] body:has(#wizardForm) :where(
    .map-engine-tab,
    .img-edit-tool,
    .numpad-key,
    .numpad-quick,
    .vid-step-btn,
    .vid-play-btn,
    .vid-poster-btn,
    .vid-shape-icon,
    .vid-now-btn,
    .upload-modal-cancel,
    .btn-add-section
) {
    background: #172235 !important;
    border-color: #536983 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] body:has(#wizardForm) :where(
    .map-engine-tab,
    .img-edit-tool,
    .numpad-key,
    .numpad-quick,
    .vid-step-btn,
    .vid-play-btn,
    .vid-poster-btn,
    .vid-shape-icon,
    .vid-now-btn,
    .upload-modal-cancel,
    .btn-add-section
):is(:hover, :focus-visible, :active) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body:has(#wizardForm) :where(.error-box, .numpad-backspace, .appendix-item-remove, .existing-appendix .delete-btn) {
    background: #421821 !important;
    border-color: #7f2634 !important;
    color: #fda4af !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .btn-primary {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .wizard-card:has(#wizardForm) .btn-primary:disabled {
    background: #34445a !important;
    border-color: #536983 !important;
    color: #dce7f5 !important;
    opacity: 0.72 !important;
}

/* Dynamic diagnostics and collaboration children sit outside their already
   themed parent panels. ID roots prevent these fixes leaking into unrelated
   buttons or the protected main menu. */
html[data-theme="dark"] #msgDiagModal,
html[data-theme="dark"] :where(
    #collabMemberPermissionDialog,
    #collabMinutesMobileDialog,
    #collabDmDialog,
    #agrChatDialog
) {
    background: rgba(3, 7, 18, 0.78) !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #msgDiagModal > div,
html[data-theme="dark"] #collabMemberPermissionDialog .collab-member-permission-dialog,
html[data-theme="dark"] #collabMinutesMobileDialog .collab-minutes-mobile-panel,
html[data-theme="dark"] #collabDmDialog .collab-dm-panel,
html[data-theme="dark"] #agrChatDialog .agr-chat-panel {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    #collabMemberPermissionDialog .collab-member-permission-header,
    #collabMemberPermissionDialog .collab-member-permission-body,
    #collabMinutesMobileDialog .collab-minutes-mobile-header,
    #collabMinutesMobileDialog .collab-minutes-mobile-body,
    #collabDmDialog .collab-dm-header,
    #collabDmDialog .collab-dm-messages,
    #collabDmDialog .collab-dm-compose,
    #agrChatDialog .agr-chat-header,
    #agrChatDialog .agr-chat-messages,
    #agrChatDialog .agr-chat-compose
) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #collabMinutesMobileDialog .collab-minutes-mobile-title,
html[data-theme="dark"] #collabDmDialog .collab-dm-title,
html[data-theme="dark"] #agrChatDialog #agrChatTitle {
    color: #e7eef8 !important;
}

html[data-theme="dark"] :where(
    #msgDiagModalClose,
    #collabMemberPermissionDialog button,
    #collabMinutesMobileDialog button,
    #collabDmDialog button,
    #agrChatDialog button
) {
    background: #172235 !important;
    border-color: #536983 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] :where(
    #msgDiagModalClose,
    #collabMemberPermissionDialog button,
    #collabMinutesMobileDialog button,
    #collabDmDialog button,
    #agrChatDialog button
):is(:hover, :focus-visible) {
    background: #244875 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(#msgDiagRetry, #collabDmDialog .collab-dm-send, #agrChatDialog .agr-chat-send) {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] :where(
    #collabMemberPermissionDialog input,
    #collabMemberPermissionDialog select,
    #collabMinutesMobileDialog input,
    #collabMinutesMobileDialog select,
    #collabDmDialog input,
    #agrChatDialog input
) {
    background: #172235 !important;
    border-color: #536983 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #msgDiagModal :where(#msgDiagResults, #msgDiagHint),
html[data-theme="dark"] :where(
    #collabMemberPermissionDialog [style*="color:#111827"],
    #collabMemberPermissionDialog [style*="color:#64748b"]
) {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #bdc9d8 !important;
}

/* The integrated bid-writing workspace is created lazily and carries a legacy
   light palette inline. Own its application chrome here; the generated
   document iframe intentionally stays white because it represents paper. */
html[data-theme="dark"] #bdwOverlay {
    color: #e7eef8 !important;
    color-scheme: dark;
}

html[data-theme="dark"] #bdwOverlay #bdwBox,
html[data-theme="dark"] #bdwPresetPicker > div,
html[data-theme="dark"] #bdwConflictDialog > div,
html[data-theme="dark"] .bdw-appendix-dialog {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48) !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-header,
    #bdwWorkflowFooter,
    .bdw-tabbar,
    .bdw-preview-tools
),
html[data-theme="dark"] :where(
    #bdwPresetPicker,
    #bdwConflictDialog,
    .bdw-appendix-dialog
) [style*="background:#fff"] {
    background: #111a29 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    #bdwForm,
    .bdw-body,
    .bdw-preview-panel
) {
    background: #0e1726 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

/* The workspace renderer still uses a few neutral inline fills on nested
   sections and controls. Keep those application surfaces dark; the preview
   iframe is restored to paper-white by the stronger rule below. */
html[data-theme="dark"] #bdwOverlay :where(
    [style*="background:#fff"],
    [style*="background: #fff"],
    [style*="background:#f8fafc"],
    [style*="background: #f8fafc"],
    [style*="background:#f1f5f9"],
    [style*="background: #f1f5f9"]
) {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay .bdw-preview-wrap {
    background: #0b1220 !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPreview {
    background: #ffffff !important;
    color-scheme: light;
}

html[data-theme="dark"] #bdwOverlay :where(
    #bdwStatus,
    #bdwWorkflowStage,
    .bdw-preview-tools > span,
    label,
    p,
    small,
    figcaption,
    .bdw-toolbar-label,
    .bdw-appendix-empty,
    .bdw-appendix-index,
    .bdw-appendix-inline,
    .bdw-appendix-state,
    .bdw-appendix-wait,
    .bdw-profile-copy span,
    .bdw-profile-copy small
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-header > strong,
    #bdwForm b,
    #bdwForm strong,
    #bdwForm h1,
    #bdwForm h2,
    #bdwForm h3,
    .bdw-appendix-dialog-title
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    input:not([type="checkbox"]):not([type="file"]),
    textarea,
    select,
    [contenteditable="true"]
),
html[data-theme="dark"] .bdw-appendix-dialog :where(
    input:not([type="checkbox"]):not([type="file"]),
    textarea,
    select,
    [contenteditable="true"]
) {
    background: #172235 !important;
    border-color: #536983 !important;
    color: #e7eef8 !important;
    caret-color: #ffffff;
}

html[data-theme="dark"] #bdwOverlay :where(input, textarea, [contenteditable="true"])::placeholder,
html[data-theme="dark"] .bdw-appendix-dialog :where(input, textarea, [contenteditable="true"])::placeholder,
html[data-theme="dark"] #bdwOverlay :where(.bdw-rich-editor-placeholder, [data-rich-key]):empty::before {
    color: #8fa0b5 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    #bdwAddPresetBtn,
    #bdwUndoBtn,
    #bdwRedoBtn,
    #bdwTogglePreviewBtn,
    #bdwPrintBtn,
    #bdwValidateBtn,
    .bdw-tool-btn,
    .bdw-tool-select,
    .bdw-table-tools button,
    .bdw-appendix-add,
    .bdw-appendix-edit,
    #bdwZoomOutBtn,
    #bdwZoomResetBtn,
    #bdwZoomInBtn,
    .bdw-appendix-dialog-btn.secondary,
    [data-doctab]
),
html[data-theme="dark"] #bdwPresetPicker :where(button, [data-preset-doc]),
html[data-theme="dark"] #bdwConflictDialog [data-conflict-action="server"] {
    background: #1b283b !important;
    border-color: #536983 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    #bdwSaveBtn,
    .bdw-tool-btn.active,
    .bdw-table-tools button.active,
    [data-doctab][style*="background:#1976d2"]
),
html[data-theme="dark"] #bdwConflictDialog [data-conflict-action="local"],
html[data-theme="dark"] .bdw-appendix-dialog-btn:not(.secondary) {
    background: #1d4ed8 !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #bdwOverlay #bdwFinalizeBtn {
    background: #12351f !important;
    border-color: #4ade80 !important;
    color: #bbf7d0 !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPdfBtn {
    background: #172f52 !important;
    border-color: #60a5fa !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #bdwOverlay #bdwCloseBtn {
    background: #26374e !important;
    border-color: #536983 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-appendix-delete,
    [data-cost-remove],
    [style*="background:#fee2e2"],
    [style*="background: #fee2e2"]
) {
    background: #451a25 !important;
    border-color: #9f5262 !important;
    color: #fecdd3 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    button,
    select,
    input,
    textarea,
    [contenteditable="true"]
):focus-visible,
html[data-theme="dark"] :where(
    #bdwPresetPicker,
    #bdwConflictDialog,
    .bdw-appendix-dialog
) :where(button, select, input, textarea, [contenteditable="true"]):focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.72) !important;
    outline-offset: 2px !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-rich-toolbar,
    .bdw-toolbar-group,
    .bdw-table-tools,
    .bdw-cost-items,
    .bdw-cost-items > div,
    .bdw-cost-items thead tr,
    .bdw-appendix-list,
    .bdw-appendix-row,
    [data-rich-key] table.bdw-rich-table
) {
    background: #151f30 !important;
    border-color: #41536b !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-cost-items th,
    .bdw-cost-items td,
    [data-rich-key] th,
    [data-rich-key] td,
    [data-rich-key] h2,
    [data-rich-key] blockquote,
    [data-rich-key] hr,
    .bdw-appendix-row
) {
    border-color: #41536b !important;
}

html[data-theme="dark"] #bdwOverlay [data-rich-key] blockquote {
    background: #111a29 !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [data-rich-key] th.bdw-cell-selected,
    [data-rich-key] td.bdw-cell-selected,
    [data-rich-key] th.bdw-merge-selected,
    [data-rich-key] td.bdw-merge-selected
) {
    background: #3b2a0e !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-profile-defaults,
    .bdw-finalization-panel,
    [style*="background:#f0f9ff"],
    [style*="background:#f8fbff"]
) {
    background: #172f52 !important;
    border-color: #456c96 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPreparationPanel {
    background: #24213d !important;
    border-color: #625f91 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPreparationPanel [style*="background:#ede9fe"] {
    background: #3a2357 !important;
    border-color: #7e4aa8 !important;
    color: #f3e8ff !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPreparationPanel :where(button, blockquote) {
    background: #1b283b !important;
    border-color: #536983 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #bdwOverlay #bdwPreparationPanel button:disabled {
    background: #26374e !important;
    border-color: #41536b !important;
    color: #8fa0b5 !important;
}

html[data-theme="dark"] #bdwOverlay .bdw-profile-actions button:disabled {
    background: #26374e !important;
    border-color: #536983 !important;
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-sensitive-field-notice,
    .bdw-validation-panel,
    [style*="background:#fff8e1"],
    [style*="background:#fffbeb"],
    [style*="background:#fffaf0"],
    [style*="background:#fff7ed"]
) {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="background:#f0fdf4"],
    .bdw-profile-actions button:not(.secondary):not(:disabled)
) {
    background: #12351f !important;
    border-color: #397c4c !important;
    color: #bbf7d0 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    .bdw-validation-list,
    .bdw-validation-issue,
    .bdw-validation-more
) {
    background: #2a2114 !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#111827"],
    [style*="color:#1f2937"],
    [style*="color:#334155"],
    [style*="color:#444"]
),
html[data-theme="dark"] :where(#bdwPresetPicker, #bdwConflictDialog, .bdw-appendix-dialog) :where(
    [style*="color:#111827"],
    [style*="color:#1f2937"],
    [style*="color:#334155"],
    [style*="color:#444"]
) {
    color: #e7eef8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#475569"],
    [style*="color:#64748b"],
    [style*="color:#666"],
    [style*="color:#888"]
),
html[data-theme="dark"] :where(#bdwPresetPicker, #bdwConflictDialog, .bdw-appendix-dialog) :where(
    [style*="color:#475569"],
    [style*="color:#64748b"],
    [style*="color:#666"],
    [style*="color:#888"]
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#1565c0"],
    [style*="color:#075985"],
    [style*="color:#0369a1"],
    [style*="color:#1976d2"],
    [style*="color:#1e3a8a"],
    [style*="color:#1d4ed8"],
    [style*="color:#312e81"],
    [style*="color:#3730a3"],
    [style*="color:#7b1fa2"],
    [style*="color:#0f5fae"]
),
html[data-theme="dark"] :where(#bdwPresetPicker, .bdw-appendix-dialog) :where(
    [style*="color:#3730a3"],
    [style*="color:#7b1fa2"]
) {
    color: #93c5fd !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#14532d"],
    [style*="color:#166534"],
    [style*="color:#047857"]
),
html[data-theme="dark"] #bdwPresetPicker [style*="color:#047857"] {
    color: #86efac !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#713f12"],
    [style*="color:#854d0e"],
    [style*="color:#92400e"],
    [style*="color:#b45309"]
) {
    color: #fde68a !important;
}

html[data-theme="dark"] #bdwOverlay :where(
    [style*="color:#991b1b"],
    [style*="color:#b91c1c"],
    [style*="color:#e53935"]
),
html[data-theme="dark"] :where(#bdwPresetPicker, #bdwConflictDialog, .bdw-appendix-dialog) :where(
    [style*="color:#991b1b"],
    [style*="color:#b91c1c"]
) {
    color: #fda4af !important;
}

html[data-theme="dark"] #bdwOverlay :where(input, textarea, select)[style*="#e53935"] {
    border-color: #fb7185 !important;
}

html[data-theme="dark"] #bdwOverlay :where(kbd, code) {
    background: #26374e !important;
    border-color: #536983 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] .bdw-appendix-dialog .bdw-appendix-dialog-title {
    color: #e7eef8 !important;
}

/* Detail content can arrive after the initial shell. Correct the remaining
   semantic inline states at the stable detail root. */
html[data-theme="dark"] #detailModal :where(
    #openingWatchStatus,
    [style*="color:#2E7D32"]
) {
    color: #86efac !important;
}

html[data-theme="dark"] #detailModal [style*="background:#fff8e1"] {
    background: #3b2a0e !important;
    border-color: #7c5b17 !important;
    color: #fde68a !important;
}

html[data-theme="dark"] #detailModal :where(
    [style*="color:#e65100"],
    [style*="color:#6d4c00"]
) {
    color: #fde68a !important;
}

html[data-theme="dark"] #detailModal :where(
    [style*="color:#64748b"],
    [style*="color:#888"]
) {
    color: #bdc9d8 !important;
}

html[data-theme="dark"] :where(.cal-legend, .cal-day-label) {
    color: #bdc9d8 !important;
    border-color: #41536b !important;
}

html[data-theme="dark"] .cal-month-title {
    background: #151f30 !important;
    color: #e7eef8 !important;
}

html[data-theme="dark"] ::selection {
    background: #315d91;
    color: #ffffff;
}

html[data-theme="dark"] :where(img, video, canvas, svg, iframe, .pdf-page, .document-page) {
    color-scheme: normal;
}

@media (max-width: 767px) {
    .app-theme-control__options {
        gap: 5px;
    }

    html[data-theme="dark"] :where(
        .mobile-shell,
        .mobile-panel,
        .mobile-sticky-bar,
        .pb-tab-bar
    ) {
        background-color: #111a29 !important;
        border-color: var(--color-border) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-new(root) {
        animation-duration: 0.01ms !important;
    }

    html[data-theme] *,
    html[data-theme] *::before,
    html[data-theme] *::after {
        transition-duration: 0.01ms !important;
    }
}
