/* Theme selector and shared workspace styling. Light and Dark supply the palette tokens. */

/* Sign-in and workspace entry */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .logo-container {
    background: var(--ui-surface-tinted);
    box-shadow: inset 0 -1px var(--ui-divider-subtle);
}

/* The startup credentials loader is separate from the shared wait overlay. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home #loading-credentials {
    background-color: var(--ui-page-bg);
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home :is(
    #logged-username, .user-logout, .user-changepassword, .cancel-change-password,
    .user-gototheaccount, .ateam-join-beta-block a
) {
    color: var(--ui-link);
    border-color: currentColor;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home :is(.loader-icon, .unread-notifications-block) {
    color: var(--ui-accent);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .unread-notifications-block.user-have-critical-notifications {
    color: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .credentials-button {
    background: var(--ui-primary-bg);
    border-color: var(--ui-primary-bg);
    color: var(--ui-primary-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .credentials-button:is(:hover, :active) {
    background: var(--ui-primary-hover);
    border-color: var(--ui-primary-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog {
    color: var(--ui-text);
    background: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog h2 {
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog p {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog.is-success h2,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog.is-success h2::before {
    color: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-dialog.is-error h2::before {
    color: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]) .ui-page-home .account-launch-actions a.is-secondary {
    color: var(--ui-text);
    background: var(--ui-surface-raised);
}

/* Theme selector and workspace shell */
/* Theme picker styles also apply in Standard through the fallback values. */
.ui-theme-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin-inline-end: .5rem;
    border: 1px solid var(--ui-border, #79a7c9);
    border-radius: 50%;
    background: var(--ui-surface, #eaf5ff);
    color: var(--ui-accent, #225f8d);
    font-size: 1.1rem;
    cursor: pointer;
}

/* The select receives the tap directly. The icon covers its closed caption while the
   browser displays the option names in its own picker. Both share the same grid cell. */
.ui-theme-native-control {
    display: inline-grid;
    flex: 0 0 auto;
}

.ui-theme-native-control > select,
.ui-theme-native-control > i {
    grid-area: 1 / 1;
}

.ui-theme-native-control > select {
    appearance: none;
    box-sizing: border-box;
    padding: 0;
    font-size: 16px;
}

.ui-theme-native-control > i {
    display: grid;
    place-items: center;
    justify-self: start;
    width: 34px;
    height: 34px;
    margin: 1px;
    border-radius: 50%;
    background: var(--ui-surface, #eaf5ff);
    color: var(--ui-accent, #225f8d);
    font-size: 1.1rem;
    pointer-events: none;
}

.ui-theme-trigger[hidden],
.ui-theme-options[hidden] {
    display: none;
}

.ui-theme-trigger:hover,
.ui-theme-trigger[aria-expanded="true"] {
    background: var(--ui-surface-hover, #d9ecfc);
}

.ui-theme-trigger:focus-visible,
.ui-theme-option:has(input:focus-visible) {
    outline: 2px solid var(--ui-focus, #175f97);
    outline-offset: 1px;
}

.tippy-box[data-theme~="ui-theme"] {
    background: var(--ui-surface, #fff);
    color: var(--ui-text, #193950);
    box-shadow: var(--ui-shadow, 0 4px 16px rgb(21 48 72 / 22%));
    border: 1px solid var(--ui-border, #79a7c9);
    border-radius: .65rem;
}

.tippy-box[data-theme~="ui-theme"] .tippy-content {
    padding: .35rem;
}

.ui-theme-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6rem;
    box-sizing: border-box;
    min-width: 10rem;
    min-height: 38px;
    padding: .35rem .65rem;
    border-radius: .4rem;
    cursor: pointer;
}

.ui-theme-option:hover,
.ui-theme-option:has(input:checked) {
    background: var(--ui-surface-hover, #eaf5ff);
}

.ui-theme-option input {
    /* Make the whole row the native radio hit area and keep keyboard navigation. */
    appearance: none;
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
}

.ui-theme-option-icon,
.ui-theme-option-check {
    color: var(--ui-accent, #225f8d);
}

.ui-theme-option-check {
    margin-inline-start: auto;
    visibility: hidden;
}

.ui-theme-option input:checked ~ .ui-theme-option-check {
    visibility: visible;
}

/* Workspace canvas, header, and footer */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]),
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) body {
    background: var(--ui-page-bg);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(.atpai-header, .footer) {
    background: var(--ui-surface);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-header {
    border-bottom: 1px solid var(--ui-border);
}

/* Apply tint after the base header and footer surfaces. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(.section-heading-titles, [data-role="footer"]) {
    background-color: var(--ui-surface-tinted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .section-heading-titles {
    border-block-end: 1px solid var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .section-heading-titles > div {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) [data-role="footer"] {
    border-block-start: 1px solid var(--ui-divider-subtle);
}

/* Header links and live bridge indicators */
html:is([data-ui-theme="dark"], [data-ui-theme="light"])
:is(#header-atpaicrm-link, #header-ecosystem-account-link) {
    /* The shared header sets this link's color with !important. */
    color: var(--ui-nav-text) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(.header-admin-bridges-stats, #left-menu-admin-label) {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .bridge-app-stat-cell + .bridge-app-stat-cell {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .faq-quick-link-block a {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .bridge-app-activity-cell[data-role="online"] {
    background: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .bridge-app-activity-cell[data-role="offline"] {
    background: var(--ui-danger);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .bridge-app-activity-cell[data-role="pending"] {
    background: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .administrator-session-banner {
    background: var(--ui-warning-surface);
    color: var(--ui-warning);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .administrator-session-banner button {
    background: var(--ui-surface);
    color: var(--ui-warning);
    border-color: var(--ui-border);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .administrator-session-banner button:hover {
    background: var(--ui-surface-hover);
}

/* Left navigation geometry and status cues */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar {
    background: var(--ui-nav-bg);
    /* Theme selection can change row heights between viewport resize events. */
    overflow-y: auto;
    scrollbar-width: thin;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar.left-menu-scroll-enabled::after {
    background: linear-gradient(to bottom, transparent, var(--ui-nav-bg));
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar .left-bar-menu-item {
    /* Match the desktop header's 55px content box and its lower border. */
    height: 56px;
    color: var(--ui-nav-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar #left-menu-support {
    min-height: 56px;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar #left-menu-admin-label {
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar :is(#left-menu-organization-admin, #left-menu-users, #left-menu-api) {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar .left-bar-menu-item:not(#left-menu-admin-label):hover,
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .atpai-left-bar .left-bar-menu-item.active {
    background: var(--ui-surface-hover);
    color: var(--ui-accent);
}

/* The Dashboard and Storage set important legacy triangle borders by menu item ID. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"])
#atpai-left-menu-bar .left-bar-menu-item.active .left-menu-current-section-triangle > span {
    border-right-color: var(--ui-nav-marker, var(--ui-accent)) !important;
}

/* Keep support badges legible when the sidebar changes its link color on hover. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) #left-menu-support :is(
    [data-role="organization-opened-tickets-count"], [data-role="saas-opened-tickets-count"]
) {
    color: #fff;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) #left-menu-support :is(
    [data-role="unresponded-messages-from-tech-support-icon"],
    [data-role="unresponded-messages-from-users-support-icon"]
) {
    background-color: var(--ui-danger-surface);
    color: var(--ui-danger);
}

/* Loading and legacy modal overlays already carry their opacity in the palette token. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .wait-loader .overlay,
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(.modal-overlay, .atpai-modal .overlay) {
    background: var(--ui-overlay);
    opacity: 1;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .wait-loader .loader-icon {
    color: var(--ui-accent);
}

/* Native controls keep the workspace palette outside authored and export content. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:is(
    input:not([type]), input[type="text"], input[type="number"], input[type="email"], input[type="date"],
    input[type="password"], input[type="search"], input[type="tel"], input[type="url"], select, textarea
):not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-surface);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:is(input, textarea):not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
))::placeholder {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:is(a, button, input, select, textarea):focus-visible:not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    outline: 2px solid var(--ui-focus);
    outline-offset: 2px;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
.button:not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
.button:hover:not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:is(.button.green-button, #usernamerole):not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-primary-bg);
    color: var(--ui-primary-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:is(.button.green-button, #usernamerole):hover:not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-primary-hover);
}

/* The legacy notification badge uses important declarations for its warning colors. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) #usernamerole.user-have-critical-notifications {
    background: var(--ui-danger-surface) !important;
    color: var(--ui-danger);
    border-color: var(--ui-danger) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .user-have-critical-notifications .user-notifications-bell-block {
    color: var(--ui-danger) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ui-theme-workspace
:where(main, .modal, .ateam-modal-v2, .atpai-modal) a[href]:not(:where(
    .button, .page-block *, .next-page-area-cell *, #export-pt-pdf-output-area-wrapper *,
    [data-role="textarea-extracted-content"] *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, .product-subscription-actions *
)) {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .modal-form-many-fields .field-label-description, .ateam-modal-top-short-description
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .requred-field > div {
    background: var(--ui-surface-hover);
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .field-with-wrong-data:not(:where(.page-block *, .proposal-rates-page *, #export-pt-pdf-output-area-wrapper *)) {
    background-color: var(--ui-danger-surface) !important;
    border-color: var(--ui-danger);
}

/* Tabs, result tables and pagers share the same treatment across staff pages. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .action-tabs:not(:where(.page-block *)) {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .action-tab:not(:where(.page-block *)) {
    color: var(--ui-text-muted);
    opacity: 1;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .action-tab:hover:not(:where(.page-block *)) {
    background: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .action-tab.active:not(:where(.page-block *)) {
    background: var(--ui-surface-tinted);
    border-color: var(--ui-border);
    color: var(--ui-text);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-standard-table-v2-header, .ateam-standard-table-v2-footer, .ateam-standard-table-row-v2
):not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) td {
    color: var(--ui-text);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-standard-table-v2-header, .ateam-standard-table-v2-footer
):not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) td {
    background: var(--ui-surface-tinted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ateam-standard-table-row-v2:hover:not(:where(
    .page-block *, .proposal-rates-page *,
    .qbo-preview-table-scroll *, #export-pt-pdf-output-area-wrapper *
)) {
    background: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) div:is([data-role="pagination"], [data-role="pagination-2"]):not(:where(.page-block *)) {
    background: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) div:is([data-role="pagination"], [data-role="pagination-2"]):not(:where(.page-block *)) .pager-left-label {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) div:is([data-role="pagination"], [data-role="pagination-2"]):not(:where(.page-block *)) div[data-role="pager"] {
    background: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-link);
    box-shadow: none;
    text-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) div:is([data-role="pagination"], [data-role="pagination-2"]):not(:where(.page-block *)) div[data-role="pager"]:hover {
    background: var(--ui-surface-hover);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) div:is([data-role="pagination"], [data-role="pagination-2"]):not(:where(.page-block *)) div[data-role="pager"][data-activepage="yes"] {
    background: var(--ui-surface-hover);
    border-color: var(--ui-accent);
    color: var(--ui-text) !important;
    box-shadow: none;
    text-shadow: none;
}

/* Cover both project dialog families and the vendor dialogs mounted on body. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .ateam-modal-v2,
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .alertify .ajs-dimmer {
    background: var(--ui-overlay);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-modal-central-part-v2-content, .ui-dialog, .alertify .ajs-dialog, dialog.product-subscription-overlay
) {
    background: var(--ui-surface);
    color: var(--ui-text);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-modal-header-v2, .ateam-modal-title-content-v2, .ateam-modal-buttons-content-v2,
    .ateam-modal-header-title-v2--close-modal, .ui-dialog .ui-dialog-titlebar,
    .alertify .ajs-header, .alertify .ajs-footer
) {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-modal-header-title-v2, .ui-dialog .ui-dialog-content, .alertify .ajs-content, .product-subscription-overlay h2
) {
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .product-subscription-overlay p {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .product-subscription-actions button {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ateam-modal-header-title-v2--close-modal, .alertify .ajs-button
):hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(.modal-header i, .modal-header-icon-before, .modal-icon) {
    color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .alertify-notifier .ajs-message {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-divider-subtle);
    text-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .alertify-notifier .ajs-message.ajs-success {
    border-color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) .alertify-notifier .ajs-message.ajs-error {
    border-color: var(--ui-danger);
}

/* Date pickers, autocomplete results and Select2 popovers use the current surface. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ui-datepicker, .ui-autocomplete, .select2-dropdown,
    .select2-container .select2-selection--single, .select2-container .select2-selection--multiple
) {
    background: var(--ui-surface);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ui-datepicker .ui-datepicker-header, .ui-datepicker .ui-state-default,
    .select2-container .select2-selection__choice
) {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .ui-datepicker .ui-state-active, .ui-autocomplete .ui-state-active,
    .select2-container .select2-results__option--highlighted[aria-selected],
    .select2-container .select2-results__option[aria-selected="true"]
) {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
    border-color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]) :is(
    .select2-container .select2-selection__rendered, .select2-container .select2-selection__choice__remove,
    .select2-container .select2-selection__clear, .select2-container .select2-search__field
) {
    color: var(--ui-text);
}

/* Dashboard and activity feed */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .last-events-header {
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .section-heading-titles > div, .last-events-disclaimer, .event-date-and-staff,
    .days-since-sent-label, .estimator-text-label, .proposal-locked-cell,
    .proposal-views-mini-cell span, .proposals-chat-messages-overview-cell-short span,
    .proposal-status-and-icon .name, .bulkrow-views-counter[data-viewscount="0"],
    .client-rate-label, .client-stats-signed-text-label
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .faq-quick-link-block a, [data-role="clear-search-block"], .data-filtered-clean-filter,
    .year-pill-text, [data-role="refresh-items"], .icon-as-name-block,
    .proposal-menu-bars, .inhouse-assigned-project-number-icon, .client-type-PERSON
) {
    color: var(--ui-link);
}

/* Search controls and the filter strip shared by browse and search results. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-search-additional-filters, .proposals-search-additional-filters--statuses-dropdown,
    .proposals-search-additional-filters--dates-dropdown, .search-string-block,
    .buttons-additional-filter-extra-small, .year-pill, div[data-role="pagination"],
    .proposals-top-control-row, .proposals-loading-block
) {
    background: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page #proposal-search-textinput {
    background: transparent;
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page #proposal-search-textinput::placeholder {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .search-go {
    background: var(--ui-primary-bg);
    color: var(--ui-primary-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposals-search-bar-with-additions:is(:hover, :focus-within, .active) {
    box-shadow: 0 0 0 1px var(--ui-focus);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposals-grey-overlay-layout {
    background: var(--ui-page-bg);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-management-area, .search-results-heading-row, .proposals-statuses-tabs,
    .proposals-layout-switcher, .events-list-pagination, .last-events-header, .proposal-row-mobile-layout
) {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page #events-list-pagination-before,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-event-element {
    border-bottom-color: var(--ui-border);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .buttons-additional-filter-extra-small:hover, .date-row:hover, .year-pill:hover,
    .proposals-statuses-tabs .status-tab:hover, .proposals-layout-switcher .action-tab:hover
) {
    background: var(--ui-surface-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .year-pill.active, .date-rows-list .date-row.active,
    .sorting-current-field .cell-name .name-text
) {
    background: var(--dashboard-selected-bg);
    border-color: var(--ui-accent);
    color: var(--ui-text);
    text-shadow: none;
    box-shadow: none;
}

/* The legacy favorite filter sets its selected background with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="favorites-sub-filter"].active {
    background: var(--dashboard-selected-bg) !important;
    border-color: var(--ui-accent);
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .pager-left-label, .control-cell .cell-name .sort-btn
) {
    color: var(--ui-text-muted);
}

/* The legacy list stylesheet sets the status column caption with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .control-cell.proposal-status-and-icon .name-text {
    color: var(--ui-text) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .sorting-current-field .cell-name .sort-btn i {
    color: var(--ui-success);
}

/* Reuse the pager markup from the shared list helpers in both Dashboard columns. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page div[data-role="pager"] {
    background: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-link);
    text-shadow: none;
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page div[data-role="pager"]:hover {
    background: var(--ui-surface-hover);
}

/* Match the legacy active page's !important foreground. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page div[data-role="pager"][data-activepage="yes"] {
    background: var(--dashboard-selected-bg);
    border-color: var(--ui-accent);
    color: var(--ui-text) !important;
}

/* The lower pager container has a separate !important shadow in the list stylesheet. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .pagination-second-block {
    box-shadow: none !important;
}

/* Keep every count readable. The raised surface and outline identify the active tab. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-statuses-tabs .status-tab, .proposals-layout-switcher .action-tab
) {
    color: var(--ui-text-muted);
    opacity: 1;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-statuses-tabs .status-tab.active, .proposals-layout-switcher .action-tab.active
) {
    background: var(--ui-surface);
    border-color: var(--ui-accent);
    color: var(--ui-text);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-statuses-tabs .counter, .proposals-statuses-tabs .all-proposals-bulk-text,
    .proposals-statuses-tabs .status-loading-icon
) {
    color: var(--ui-text-muted);
}

/* The renderer supplies status and event codes on the host. Theme the nested
   icons consistently across summary tabs, activity cards and bulk recipients. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .status-tab, .proposal-event-element, [data-role="proposal-bulk-recipient-row"]
) {
    --dashboard-status-accent: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .status-tab[data-status-id="PREPARATION"],
    .proposal-event-element[data-event-type="PROPOSAL_CREATED"],
    .proposal-event-element[data-event-type="PROPOSAL_EDITED"],
    .proposal-event-element[data-event-type="PROPOSAL_COPIED"],
    .bulk-row-status-PREPARING, .bulk-row-status-PREPARATION
) {
    --dashboard-status-accent: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .status-tab[data-status-id="ALL"], .status-tab[data-status-id="SENT"],
    .proposal-event-element[data-event-type="PROPOSAL_SENT"], .bulk-row-status-SENT
) {
    --dashboard-status-accent: var(--dashboard-cyan);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .status-tab[data-status-id="RE-SENT"], .proposal-event-element[data-event-type="PROPOSAL_REMINDER"],
    .proposal-event-element[data-event-type="PROPOSAL_FILE_ADDED"],
    .proposal-event-element[data-event-type="PROPOSAL_FILE_REMOVED"], .bulk-row-status-RE-SENT
) {
    --dashboard-status-accent: var(--ui-warning);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .status-tab[data-status-id="VIEWED"], .status-tab[data-status-id="SIGNED"],
    .proposal-event-element[data-event-type="PROPOSAL_VIEWED"],
    .proposal-event-element[data-event-type="PROPOSAL_PREVIEWED"],
    .proposal-event-element[data-event-type^="PROPOSAL_SIGNED_"],
    .proposal-event-element[data-event-type="PROPOSAL_WON_SIGNED_BY_BOTH_PARTIES"],
    .bulk-row-status-VIEWED, .bulk-row-status-SIGNED
) {
    --dashboard-status-accent: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-event-element[data-event-type="PROPOSAL_DOCUMENT_UPDATED"],
    .proposal-event-element[data-event-type^="PROPOSAL_PDF_"],
    .proposal-event-element[data-event-type^="PROPOSAL_COMMENTED_"]
) {
    --dashboard-status-accent: var(--dashboard-purple);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-event-element[data-event-type$="_FAILED"],
    .proposal-event-element[data-event-type="PROPOSAL_REVOKED"],
    .proposal-event-element[data-event-type="PROPOSAL_MESSAGE_DELETED"]
) {
    --dashboard-status-accent: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-event-element:is(
    [data-event-type*="_SYNCHRONIZED_"], [data-event-type*="_RESYNC_"],
    [data-event-type="PROPOSAL_ESTIMATOR_CHANGED"], [data-event-type*="_PROJECT_NUMBER_CREATED_"]
) {
    --dashboard-status-accent: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .status-tab .status-icon,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-event-element[data-event-type] .proposal-event-icon-type i,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="proposal-bulk-recipient-row"] [class^="bulk-row-status-"] i {
    color: var(--dashboard-status-accent);
}

/* The existing row status controls the surface. Favorites use a separate marker. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-row-element {
    background: var(--dashboard-open-row);
    color: var(--ui-text);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-row-element[data-status-type="SIGNED"],
    .proposal-event-element[data-event-type="PROPOSAL_SIGNED_BY_CLIENT"],
    .proposal-event-element[data-event-type="PROPOSAL_WON_SIGNED_BY_BOTH_PARTIES"]
) {
    background: var(--dashboard-signed-row);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-row-element[data-status-type="REJECTED"], .proposal-row-element[data-status-type="ARCHIVED"],
    .proposal-event-element[data-event-type^="PROPOSAL_REJECTED_"],
    .proposal-event-element[data-event-type="PROPOSAL_ARCHIVED"]
) {
    background: var(--dashboard-closed-row);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-event-element[data-event-type="PROPOSAL_CREATED"],
    .proposal-event-element[data-event-type="PROPOSAL_SIGNED_BY_ESTIMATOR"]
) {
    background: var(--dashboard-open-row);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-row-element.favorite-proposal-row {
    border-inline-start-color: var(--ui-warning);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-row-element, .proposal-event-element
):is(:hover, :focus-within) {
    border-inline-color: var(--ui-focus);
    box-shadow: none;
}

/* The renderer and the legacy status rules both use the original
   .proposal-type-rectanle spelling for the classification tile. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .last-events-layout, .proposal-types-column, .proposal-type-rectanle,
    .proposals-list-content .proposal-row-element[data-status-type] .proposal-type-rectanle
) {
    background: var(--ui-surface);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-type-rectangle-NEW_PROPOSAL, .proposal-total-sum-cs,
    .proposal-type-block[data-role="proposal-type-construction-staking"],
    .proposals-chat-messages-overview-cell-short > div
) {
    color: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-type-rectangle-PROPOSAL_REVISION, .favorite-proposal, .client-type-COMPANY,
    .client-rate-stars-area .fa-star
) {
    color: var(--ui-warning);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-type-rectangle-PROPOSAL_WITH_CONTRACT_MOD, .proposal-bulk-row-block
) {
    color: var(--dashboard-purple);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-total-sum-std, .proposal-type-block[data-role="proposal-type-standard"],
    .proposal-views-info-short > div, .qbo-proposal-synchronized-success i
) {
    color: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-tm-pricing-only, .proposal-type-block[data-role="proposal-type-tm"]
) {
    color: var(--dashboard-cyan);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-total-sum-ub, .proposal-type-block[data-role="proposal-type-unit-based"],
    i.proposal-revoked-icon
) {
    color: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .historical-proposal {
    background: var(--dashboard-closed-row);
    color: var(--ui-warning);
}

/* Bulk recipient rows keep the closed parent neutral and each recipient status legible. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-bulk-recipients-area,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="proposal-row"][data-status-type] .proposal-bulk-recipients-area {
    background: var(--ui-surface);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"],
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] td,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-bulk-recipient-mobile-devices {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] :is(thead td, tbody td) {
    background: var(--ui-surface-raised);
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] tbody tr:hover td,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-bulk-recipient-mobile-details-cell {
    background: var(--ui-surface-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-bulk-recipient-row-REJECTED, .proposal-bulk-recipient-row-ARCHIVED
) {
    opacity: 1;
}

/* Legacy bulk table CSS uses !important for status fills. Keep the same
   precedence for themed status rows and their hover override. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="proposal-row"]:is(
    [data-status-type="ARCHIVED"], [data-status-type="REJECTED"]
) [data-role="bulk-proposals-recipients-table"] tr td,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] :is(
    .proposal-bulk-recipient-row-ARCHIVED, .proposal-bulk-recipient-row-REJECTED
) td {
    background: var(--dashboard-closed-row) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] .proposal-bulk-recipient-row-SIGNED td {
    background: var(--dashboard-signed-row) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="proposal-row"]:is(
    [data-status-type="ARCHIVED"], [data-status-type="REJECTED"]
) [data-role="bulk-proposals-recipients-table"] tbody tr:hover td,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page [data-role="bulk-proposals-recipients-table"] :is(
    .proposal-bulk-recipient-row-ARCHIVED, .proposal-bulk-recipient-row-REJECTED, .proposal-bulk-recipient-row-SIGNED
):hover td {
    background: var(--ui-surface-hover) !important;
}

/* Client-context filter, drag targets, and the proposal type chooser. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .client-row, .proposals-quick-actions-top-area, .choose-proposal-type-option,
    .data-filtered-by-single-client-label, .person-parent-company-data
) {
    background: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
    box-shadow: none;
}

/* The Dashboard client-context row's legacy hover fill is already important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .client-row:hover {
    background: var(--ui-surface-hover) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposals-quick-actions-top-area {
    opacity: 1;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-quick-action-drop-area {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .proposal-quick-action-drop-area.ui-droppable-area-hover,
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .choose-proposal-type-option:hover {
    background: var(--ui-surface-hover);
    border-color: var(--ui-focus);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposal-quick-action-icon, .proposal-quick-action-text, .choose-proposal-type-modal .modal-header
) {
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .choose-proposal-type-modal .modal-overlay {
    background: var(--ui-page-bg);
}

/* The legacy choice dialog stylesheet sets label colors with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .select-new-proposal-type-big-label, .select-new-proposal-type-sub-label
) {
    color: var(--ui-text) !important;
}

/* Match the responsive tab and dialog icon treatments. Some come from inline colors. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-layout-switcher .action-tab[data-tabcode="proposals"], .choose-proposal-type-modal .modal-header
) i {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page :is(
    .proposals-layout-switcher .action-tab[data-tabcode="events"], #choose-proposal-type-archive
) i {
    color: var(--ui-warning) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page #choose-proposal-type-current i {
    color: var(--ui-success);
}

/* Dashboard notifications retain their success and error border cues. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .alertify-notifier .ajs-message {
    background: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-text);
    text-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .alertify-notifier .ajs-error {
    border-color: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
body.proposals-dashboard-page .alertify-notifier .ajs-success {
    border-color: var(--ui-success);
}

/* The compact recipient card has its own background in the mobile stylesheet. */
@media (max-width: 767.98px) {
    html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="dashboard"])
    body.proposals-dashboard-page .proposal-receiver {
        background: var(--ui-surface);
        box-shadow: none;
    }
}

/* Clients, Storage, Templates, and Statistics */
/* Client search is shared by all three appearances. Fallbacks supply Standard. */
:where(html[data-ui-theme-components~="libraries"]) .ui-page-clients .clients-search-client-string {
    background-color: var(--ui-surface, #fff);
    color: var(--ui-text, #222);
    box-shadow: none;
}

/* Keep focus visible on the search container and the input on the same surface. */
:where(html[data-ui-theme-components~="libraries"]) .ui-page-clients .clients-search-client-string #client-search-textinput {
    background: transparent;
    color: inherit;
    outline: none;
}

:where(html[data-ui-theme-components~="libraries"]) .ui-page-clients .clients-search-bar-with-additions:focus-within {
    box-shadow: 0 0 0 1px var(--ui-focus, #b16a00);
}

:where(html[data-ui-theme-components~="libraries"]) .ui-page-clients .clients-search-client-string .search-go {
    background-color: var(--ui-primary-bg, #217841);
    color: var(--ui-primary-text, #fff);
}

:where(html[data-ui-theme-components~="libraries"]) .ui-page-clients .clients-search-client-string .search-go:hover {
    background-color: var(--ui-primary-hover, #175f33);
}

/* Client directory and client import. Keep the company/person icons as type cues. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-row, .clients-search-additional-filters, .clients-list-content [data-role="pagination"],
    .import-clients-from-the-file-input-area, .import-clients-from-the-file-preview-area-top-description,
    .imported-clients-list-exception-details-area
) {
    background-color: var(--ui-surface-tinted, var(--ui-surface));
    border-color: var(--ui-divider-subtle, var(--ui-border));
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-row, .choose-client-type-option, .contact-persons-titles-list
) {
    border: 1px solid var(--ui-divider-subtle, var(--ui-border));
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-row:hover, .clients-table tbody tr:hover, .choose-client-type-option:hover,
    .contact-person-editable-title:hover, .clients-types-tabs .status-tab:hover
) {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-row-responsive-layout, .client-rate-block, .client-addresses-block,
    .contact-person-editable-title, .customer-allowed-for-bulk-proposals-block,
    .import-clients-from-the-file-preview-area tr td
) {
    border-color: var(--ui-divider-subtle, var(--ui-border));
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-address-label, .client-notes-sublabel, .client-rate-label, .client-stats-signed-text-label,
    .estimator-text-label, .create-new-client-small-description, .client-view-proposals--noproposals,
    .clients-types-tabs .counter, .clients-types-tabs .all-proposals-bulk-text
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .clients-types-tabs .status-tab {
    opacity: 1;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .clients-types-tabs .status-tab.active {
    background: var(--ui-surface-tinted, var(--ui-surface));
    border-color: var(--ui-accent);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .clients-search-bar-with-additions:is(:hover, .active, :focus-within) {
    box-shadow: 0 0 0 1px var(--ui-focus);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .clients-search-bar-with-additions:is(:hover, .active) :is(
    .search-string-block, .clients-search-additional-filters
) {
    border-color: var(--ui-focus);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .clients-grey-overlay-layout, .ateam-clients-importing-process-modal, .ateam-clients-imported-modal
) {
    background: var(--ui-overlay);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(.person-parent-company-data, .client-excluded-row td) {
    background-color: var(--ui-surface-raised);
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .contact-persons-filtered-by-single-client-label {
    background-color: var(--ui-warning-surface, var(--ui-surface-raised));
    color: var(--ui-warning);
}

/* The legacy filtered-client hover fill is already important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .contact-persons-filtered-by-single-client-info > div:hover {
    background-color: var(--ui-surface-hover) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-no-rated-yet, .import-clients-from-the-file-input-area input
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-type-PERSON, .clients-titles-dropdown .edit-clients-titles, .contact-person-editable-title .edit-title,
    .client-rate-stars-bar .fa-star.fa-solid, .client-rate-stars-area .fa-star.fa-solid,
    .importing-clients-from-a-file-title, .importing-clients-from-a-file--file-name
) {
    color: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(.client-create-proposal, .modal-client-create-proposal) {
    color: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients .contact-person-editable-title .delete-title {
    color: var(--ui-danger);
}

/* These icon colors replace fixed inline colors in the client directory and its dialogs. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .clients-types-tabs [data-status-id="PERSON"] .img i, .clients-types-tabs .status-icon,
    .choose-client-type-option > div:has(.fa-user), .modal-header :is(.fa-users, .fa-crown),
    .ateam-clients-importing-process-modal .fa-database, .ateam-clients-imported-modal .fa-database
) {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(
    .client-type-COMPANY, .clients-types-tabs [data-status-id="COMPANY"] .img i,
    .choose-client-type-option > div:has(.fa-building-columns), .modal-header .fa-building-columns
) {
    color: var(--ui-warning) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-clients :is(.fa-file-csv, .cliens-were-imported-central-icon) {
    color: var(--ui-success) !important;
}

/* Template and section catalog surfaces. The paper stylesheet controls preview fills. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-templates) :is(
    .proposal-section-block, .proposal-template-block
) {
    background-color: var(--ui-surface-tinted, var(--ui-surface));
    border: 1px solid var(--ui-divider-subtle, var(--ui-border));
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-templates .proposal-template-block {
    border-block-start-width: 4px;
    border-block-start-color: var(--ui-accent);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-templates) .section-pages {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-divider-subtle, var(--ui-border));
}

/* Set the preview's default ink; theme rules never target authored children here. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-templates) .section-pages .page-block {
    color: #000;
    color-scheme: light;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-templates) :is(
    .template-creator-name, .section-creator-name
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-templates) .page-name-top-label {
    color: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-templates .template-collapsed-info-area {
    background-color: var(--ui-surface-raised);
}

/* The legacy templates stylesheet sets this filter caption with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-templates .only-my-data-block {
    color: var(--ui-text) !important;
}

/* Storage rates, local files, and service library lists. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .invoice-editor-library .invoice-lib-header, .ratelibs-editor-subheader-block,
    .stored-survey-service-item-theader, .upload-new-file-from-storage-row,
    .production-subtab-description-badge, .cse-group-templates-include-group-items-area,
    .cs-estimate-template-name-textfield, .cs-estimate-template-editor-modal-buttons,
    .ateam-bottom-helping-scrollbar-holder
) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-divider-subtle, var(--ui-border));
    color: var(--ui-text);
    box-shadow: none;
}

/* Keep the read-only rate subheader stable over the legacy important hover fill. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .ratelibs-editor-subheader-block:hover {
    background-color: var(--ui-surface-raised) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .invoice-editor-library .invoice-lib-item, .company-survey-services-library .stored-survey-service-item,
    .stored-image-item, .stored-file-item, [data-role="cs-estimation-group"]
) {
    background-color: var(--ui-surface-tinted, var(--ui-surface));
    border-color: var(--ui-divider-subtle, var(--ui-border));
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .invoice-editor-library .invoice-lib-item:hover, .company-survey-services-library .stored-survey-service-item:hover,
    .stored-image-item:hover, .stored-file-item:hover
) {
    background-color: var(--ui-surface-hover);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .invoice-lib-item .unit-details, .image-creator-name, .file-creator-name, .invoice-rendered-subheader,
    .formula-label-block .sub-text, .quick-formulas-description
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .delete-rate-string-button, .delete-survey-service-string-button
) {
    border-color: var(--ui-link);
    color: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(.delete-rate-icon, .item-mobilization-excluded-cell) {
    color: var(--ui-danger);
}

/* The legacy attachment icon sets its color with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .stored-file-item .file-object-preview-area i {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .images-library-bottom-buttons.have-files {
    border-color: var(--ui-divider-subtle, var(--ui-border));
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage #uploaded-binary-preview-row {
    color: var(--ui-warning);
}

/* Production totals, help panels and selection states. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    #pt-template-total-sum, .cs-add-new-column-block-details, .cs-change-cell-details-short-description,
    .cs-estimate-any-modal-top-short-description, .material-is-already-added-to-the-estimate-row td
) {
    background-color: var(--ui-success-surface, var(--ui-surface-raised));
    color: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .cs-estimatrion-group-headrow, .cs-estimatrion-group-subtotal-row td, .cs-estimatrion-table-total-block-row td,
    .cs-formula-block-text-description
) {
    background-color: var(--ui-warning-surface, var(--ui-surface-raised));
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .cs-estimatrion-group-headrow:hover, .cs-estimation-group .ateam-standard-table-v2-header:hover td
) {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .material-is-not-presented-in-the-csem-table td, .service-is-not-presented-in-the-csem-table td,
    [data-role="cs-estimation-group-item"][data-ismobexcluded="1"] td,
    [data-role="production-cs-group-row"][data-isalreadyinthegroup="1"],
    [data-role="cs-template-group"][data-isalreadyintheestimate="1"]
) {
    background-color: var(--ui-surface-raised);
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage :is(
    .cell-formula-editor-button.cell-type-formula, .cell-formula-editor-button.cell-type-number
) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-link);
}

/* The CSE stylesheet uses an important background for invalid fields. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .cse-field-completed-with-error {
    background-color: var(--ui-danger-surface, var(--ui-surface-raised)) !important;
    color: var(--ui-danger);
}

/* Storage hosts the same production editor as proposals. Supply the tokens
   consumed by the shared editor sheet when it runs in Storage. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage {
    --editor-selection-bg: var(--ui-surface-hover);
    --editor-document-accent: var(--ui-accent);
}

/* Whole-table and rate template dialogs render distinct sets of editing controls. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-production-template-modal .modal-form-many-fields {
    background-color: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-production-template-modal :is(
    .invoice-lib-header .lib-block-expander, .invoice-group [data-role="select-group"]
) {
    color: var(--ui-link);
}

/* The common production styles apply these action icon colors with !important. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-production-template-modal
    :is(.group-add-to-the-current-pt, .group-control[data-role="group-create-template"]) i {
    color: var(--ui-success) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-rates-template-modal :is(
    .invoice-lib-header, .std-rate-template-column-header
) {
    background-color: var(--ui-surface-raised);
    color: var(--ui-text);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-rates-template-modal .invoice-lib-item:not(.std-rate-template-column-header) {
    background-color: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-rates-template-modal .invoice-lib-item .unit-details {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-std-rates-template-modal .template-preview-price-input {
    box-shadow: none;
}

/* The T&M template form edits live rows. Its renderer also creates customer tables,
   so keep overrides inside the staff dialog rather than on the shared row classes. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal .modal-subheader {
    color: var(--ui-text-muted);
}

/* The legacy renderer gives the invoice heading and manual rows important fills. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal .invoice-table-heading-row {
    background-color: var(--ui-surface-raised) !important;
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal [data-role="tm-rate-row"] {
    background-color: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal [data-role="tm-rate-row"][data-ratetype="manual-other-item"] {
    background-color: var(--ui-surface-raised) !important;
}

/* Keep the hover override important for editable manual rows too. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal [data-role="tm-rate-row"]:hover {
    background-color: var(--ui-surface-hover) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal [data-role="proposal-tm-row-delete"] {
    color: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-tm-template-modal .proposal-tm-row-delete:has(.fa-lock) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .template-control-buttons [data-role="edit-template"] {
    color: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-storage .template-control-buttons [data-role="delete-template"] {
    color: var(--ui-danger);
}

/* The CSE editor emits its tab icon colors inline. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
#ateam-edit-cs-estimate-template-modal .cs-estimate-editor-action-tabs i {
    color: var(--ui-link) !important;
}

/* The two staff file browsers share tree rows, menus and drag feedback. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) :is(
    .proposal-remote-files-storage, .proposal-files-quick-tips
) {
    background-color: var(--ui-surface-tinted, var(--ui-surface));
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) :is(
    .s3-tree-item:hover, .s3-tree-item.s3-active, .drag-and-drop-current-folder-selected
) {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) :is(
    .s3-tree-item.s3-active, .drag-and-drop-current-folder-selected
) {
    border-color: var(--ui-accent);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) .s3-tree-item.readonly {
    color: var(--ui-text-muted);
    opacity: 1;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) :is(
    #proposal-files-context-menu, #cloud-files-context-menu, .s3-drag-helper
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) .proposal-remote-object-item-folder {
    color: var(--ui-warning);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
:is(.ui-page-storage, .ui-page-editproposal) .proposal-remote-object-item-file {
    color: var(--ui-link);
}

/* Statistics output uses the same tones for filtering, totals and graph labels. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics :is(
    .stats-select-period-row, .stat-summary-cell, .total-view-time-block .total-view-time-cell
) {
    background-color: var(--ui-surface-tinted, var(--ui-surface));
    color: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics :is(
    .stat-summary-cell:hover, .total-view-time-block .total-view-time-cell:hover
) {
    background-color: var(--ui-surface-hover);
    box-shadow: none;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics :is(.stats-section-separator, .stat-kv-cell) {
    border-color: var(--ui-divider-subtle, var(--ui-border));
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stat-kv-cell :is(.name, .value) {
    background-color: var(--ui-page-bg);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stat-kv-cell:hover {
    border-color: var(--ui-accent);
    color: var(--ui-link);
}

/* The statistics renderer sets fixed icon colors inline. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stat-summary-cell .icon-cell {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stat-summary-cell .icon-cell:has(.fa-signature) {
    color: var(--ui-success) !important;
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stat-summary-cell .icon-cell:has(.fa-ban) {
    color: var(--ui-text-muted) !important;
}

/* D3 v4 creates explicit black SVG strokes and text fills for every axis. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph svg {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stats-chart-axis :is(.domain, .tick line) {
    stroke: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stats-chart-axis .tick text {
    fill: var(--ui-text-muted);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .stats-chart-view-time-axis .tick text {
    fill: var(--ui-danger);
}

/* The D3 renderer uses the same SVG attributes for legend marks and plotted
   series. Styling those attributes keeps their colors aligned on theme changes. */
html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph text:not([fill]) {
    fill: var(--ui-text);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph [fill="#20a7c7"] {
    fill: var(--ui-link);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph [fill="#14810a"] {
    fill: var(--ui-success);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph :is(
    text[fill="red"], circle[fill="red"], circle[fill="#ff5f5f"]
) {
    fill: var(--ui-danger);
}

html:is([data-ui-theme="light"], [data-ui-theme="dark"]):where([data-ui-theme-components~="libraries"])
.ui-page-statistics .d3-stats-graph :is(circle[stroke="red"], line[stroke="#ff5f5f"]) {
    stroke: var(--ui-danger);
}

/* Editors and Production templates */
/* Authored and exported content
   Set the default ink and native controls on paper, section previews, signature samples,
   and export surfaces. The renderers apply each authored element's own styles.
   The dark stylesheet applies the staff paper tint to screen previews. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    .next-page-area-cell > [data-role="page-block-outer-holder"] > .page-block,
    .section-content-area .page-block,
    .signature-main-text-area,
    .signature-initials-area,
    .export-pt-pdf-file-output-area,
    .proposal-rates-page,
    .qbo-preview-table-scroll
) {
    color: #000;
    color-scheme: light;
}

/* Staff signing dialog
   Both staff signing flows use the same custom picker and live samples. Its JavaScript
   sets the chosen font on the collapsed picker, name sample, and initials sample. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal
:is(.fonttype-dd, .fonttype-dropdown .dropdown-content) {
    background-color: var(--ui-surface);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal
.fonttype-dropdown .dropdown-content {
    box-shadow: inset 0 0 0 1px var(--ui-border), var(--ui-shadow);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal .font-dropdown-item {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal
:is(.fonttype-preview, .font-dropdown-item):hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal .font-dropdown-item:active {
    background-color: var(--editor-selection-bg);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal .close-font-style-selector {
    color: var(--ui-link);
}

/* Use workspace colors for the modal samples after the default paper ink above. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#ateam-sign-proposal-modal
:is(.signature-main-text-area, .signature-initials-area) {
    background-color: var(--ui-surface-tinted);
    color: var(--ui-text);
    color-scheme: inherit;
}

/* Document editor chrome
   The three editor pages reuse the document navigator, property panels, and attachment pickers.
   The :where() boundary preserves selector specificity when Storage loads the file for production templates. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .proposal-document-edition-block,
    .proposal-document-sections-navigator,
    .add-page-elements-block,
    .page-part-properties-block,
    .chat-message-input-area,
    .pricing-table .switch-invoice-type
) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .next-page-area-cell .next-page-name-row,
    .page-part-properties-header,
    .property-row-subheader,
    .section-navigation-row,
    .drawn-element-control-block,
    .images-library,
    .files-library,
    .user-sections-list,
    .user-sections-list .proposal-section-block
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .page-part-property-row,
    .proposal-document-sections-navigator--label,
    .section-editor-select-page-conditional-displaying-area-description,
    .template-editor [data-role="section-area"],
    .user-sections-list .section-pages,
    .files-group-header
) {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .next-page-area-cell.selected .next-page-name-row,
    .section-navigation-row.selected-section-nav,
    .section-navigation-row:hover,
    .add-page-elements-block .add-page-block:hover,
    .drawn-element-control-block > div:hover
) {
    background-color: var(--editor-selection-bg);
    border-color: var(--ui-accent);
    color: var(--ui-text);
    box-shadow: none;
}

/* The outline distinguishes the selected page in the editor. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) .next-page-area-cell.selected .page-block {
    border-color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .next-page-name-row .section-header-action-button,
    .add-page-elements-block .add-page-block,
    .change-opened-element-properties,
    .show-hide-pages-grid,
    .pricing-table .invoice-exit-preview-mode,
    .pricing-table .invoice-save-display-type,
    .section-name-preview:not(:where(.page-block *))
) {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .section-page-conditions-set,
    .page-condition-heading-label,
    .show-hide-pages-grid[data-isshown="true"],
    #remove-opened-element-properties
) {
    color: var(--ui-danger) !important;
}

/* Match the importance of the legacy element-type input colors. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) .page-part-editor-head-row-element-type input {
    background-color: var(--ui-surface-hover) !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .section-pages-count,
    .section-creator-name,
    .image-uploaded-date,
    .file-uploaded-date
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) .files-library .stored-file-item .file-object-preview-area i {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:where(.edit-proposal-page, .proposal-webdoc-template-editor, .proposal-webdoc-section-editor) :is(
    .page-conditions-info-row,
    .proposal-doc-page-is-not-applicable-by-condition,
    .proposal-unsaved-badge
) {
    background-color: var(--ui-warning-surface);
    border-color: var(--ui-warning);
    color: var(--ui-warning);
}

/* Save and production toolbars remain distinct from the scrolling editor. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    .save-proposal-button-outer,
    .invoice-buttons-bar,
    .proposal-document-bottom-buttons-area,
    .template-operating-buttons,
    .ateam-bottom-helping-scrollbar-holder,
    .cs-estimate-template-editor-modal-buttons
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow);
    color: var(--ui-text);
}

/* Proposal details and status
   The Primary tab and proposal actions reuse the same surfaces for identifiers, rate
   information, location confirmation, and status notices. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-edition-tabs-content,
    .client-rate-information-primary,
    .client-rate-information-contact-person,
    .project-location-address-search,
    .proposal-project-on-the-map-interactive-container,
    .project-location-pending-address,
    .ateam-parcel-match-summary,
    .ateam-parcel-confirmation-note,
    .delete-proposal-confirmation-target,
    .proposal-assigned-project-real-number,
    .proposal-assigned-inhouse-real-number,
    .proposal-and-qbo-synchronized-headrow,
    .open-parent-proposal-icon
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.edit-proposal-tabs-head [data-action-id] .img i {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.edit-proposal-tabs-head [data-action-id] .img i.have-content-tab-icon {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-fields-group--rows h2,
    .buttons-horizontal-bar,
    .proposal-action-row,
    .proposal-text-stats-rows > div,
    .stats-section-separator,
    .proposal-client-block-separation-line,
    .proposal-any-block-separation-line,
    .sent-proposal-email-details
) {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-field-subdescription:not([style*="color"]),
    .client-rate-comment,
    .project-location-address-search-hint,
    .project-location-pending-address-coordinates,
    .ateam-replace-project-location-confirmation,
    .ateam-parcel-fields-help,
    .ateam-parcel-field-label,
    .create-new-pdf-export-small-description,
    .open-template-management-window-option-description,
    .invoice-standard-summ-no-discount,
    .invoice-standard-summ-no-markup
) {
    color: var(--ui-text-muted);
}

/* Proposal, location, and integration states share the workspace feedback colors. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-by-other-estimator,
    .entering-archival-data.section-heading-titles,
    .this-proposal-is-tm-heading-title,
    .project-location-pending-approval,
    .ateam-parcel-confirmation-warning,
    .ateam-parcel-field-row.has-conflict,
    .project-location-automation-status.is-warning,
    .invoice-last-edit-date,
    .document-last-edit-date,
    .qbo-preview-warnings
) {
    background: var(--ui-warning-surface);
    border-color: var(--ui-warning);
    color: var(--ui-warning);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-by-me-info-area,
    .pricing-templates-template-used,
    .pricing-templates-common-rates-used,
    .proposal-signature-object.signature-by-CLIENT,
    .project-location-automation-status.is-success,
    .ateam-parcel-field-row:not(.has-conflict),
    .qbo-authentication-modal .modal-content,
    .qbo-sync-modal .modal-content,
    .qbo-preview-sample-badge,
    .qbo-preview-pricing-notice
) {
    background: var(--ui-success-surface);
    border-color: var(--ui-success);
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .this-proposal-is-revoked.section-heading-titles,
    .proposal-compensation-types-save-changes,
    .delete-proposal-confirmation-warning,
    .project-location-automation-status.is-error,
    .qbo-preview-error
) {
    background: var(--ui-danger-surface);
    border-color: var(--ui-danger);
    color: var(--ui-danger);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .this-proposal-is-readonly.section-heading-titles,
    .proposal-is-readonly-template-top-notification,
    .proposal-is-readonly-badge,
    .proposal-signature-object.rejected-by-CLIENT,
    .project-location-automation-status,
    .bar-button
) {
    background-color: var(--ui-surface-raised);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .project-location-automation-status.is-loading,
    .proposal-signature-object.signature-by-ESTIMATOR,
    .bar-button.bb-active,
    .pt-standard-markup-applied
) {
    background-color: var(--editor-selection-bg);
    border-color: var(--ui-accent);
    color: var(--ui-text);
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .project-location-address-search-title,
    .headblock-inhouse-project-number-logo-micro,
    .signature-info-headcell--estimator,
    .status-PREPARATION,
    .status-SENT,
    .proposal-attached-file-label,
    .change-email-sender-cog a,
    .ateam-parcel-recorder-links a,
    .client-rate-information-primary .fa-star.fa-solid,
    .client-rate-information-contact-person .fa-star.fa-solid
) {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .status-SIGNED,
    .status-VIEWED,
    .signature-info-headcell:not(.signature-info-headcell--estimator),
    .proposal-is-synced-with-qbo-details-row,
    .proposal-is-synced-with-axis-details-content,
    .re-send-proposal--total-stats-string,
    .ateam-parcel-field-proposed,
    .client-crown-icon
) {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .status-RE-SENT,
    .archival-data-book-icon,
    .ateam-parcel-field-current
) {
    color: var(--ui-warning);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .cannot-sync-data-server-is-offline,
    .cannot-sync-data-iht-not-sync-yet,
    .open-bridges-stats-modal,
    .proposal-rejection-status,
    .proposal-signed-by-estimator-for-client,
    .archival-data-warning-icon,
    .delete-proposal-confirmation-error,
    .delete-proposal-row .description,
    .item-mobilization-excluded-cell
) {
    color: var(--ui-danger);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.project-location-automation-status::before {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .bulk-recipient-context,
    .bulk-recipient-icon-area,
    .proposal-bulk-recipients-top-notification-block
) {
    color: var(--editor-document-accent);
}

/* Production tables
   The proposal tab and template modals are separate DOM roots. Use those roots for
   shared table selectors because the PDF exporter also uses the invoice row classes. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal,
    #ateam-edit-cs-estimate-template-modal
) :is(
    .invoice-builder-section,
    .std-production-table-editor-content .invoice-group .group-item,
    .invoice-data-table tbody tr:not(.invoice-table-heading-row, .invoice-rowtotal, .invoice-group-row),
    [data-role="cs-estimation-group"],
    .cse-group-templates-include-group-items-area
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal,
    #ateam-edit-cs-estimate-template-modal
) :is(
    .invoice-lib-header,
    .std-production-table-editor-content .invoice-group .group-subheader,
    .cs-estimatrion-group-headrow,
    .cs-estimatrion-group-subtotal-row td,
    .cs-estimatrion-table-total-block-row td,
    .cs-estimate-template-name-textfield
) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal,
    #ateam-edit-cs-estimate-template-modal
) :is(.invoice-lib-item, .group-item:not(.group-subheader), .cs-estimatrion-group-headrow):hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal,
    #ateam-edit-cs-estimate-template-modal
) :is(
    .invoice-editor-content,
    .invoice-data-table .invoice-row,
    .std-production-table-editor-content .invoice-group,
    .tm-rates-content-table td,
    .std-rates-content-table td,
    .std-pt-rates-content-table td,
    .invoice-editor-library .invoice-lib-item
) {
    border-color: var(--ui-border);
}

/* Standard estimate groups keep their own selection accent above the table surface. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .std-production-table-editor-content .invoice-group.selected-group {
    border-top-color: var(--ui-accent);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .std-production-table-editor-content .invoice-group :is(.group-name, .group-description) {
    background-color: var(--editor-selection-bg);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .std-production-table-editor-content :is(.group-text-cell .cell-label, .invoice-group .group-control) {
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .std-production-table-editor-content .invoice-group .group-item :is(
    .group-item-drag-handler, .item-remove, [data-role="count-action-minus"], [data-role="count-action-plus"]
) {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .invoice-editor-library .invoice-lib-item .unit-details {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
:is(
    #proposal-estimation-sections,
    #ateam-edit-std-production-template-modal
) .std-production-table-editor-content input:is(
    [data-role="group-name"], [data-role="group-code"], [data-role="group-description"],
    .item-price-input, .item-count-input
) {
    box-shadow: none;
}

/* Manual rates and invalid cells override the legacy highlighted backgrounds. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#proposal-estimation-sections :is(
    [data-role="add-new-row-container"],
    [data-role="tm-rate-row"][data-ratetype="manual-other-item"]
) {
    background-color: var(--ui-surface-raised) !important;
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#proposal-estimation-sections .cse-field-completed-with-error {
    background-color: var(--ui-danger-surface) !important;
    color: var(--ui-danger);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
#proposal-estimation-sections :is(
    [data-role="tm-rate-row"], [data-role="ub-data-row"]
):hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .material-is-not-presented-in-the-csem-table,
    .service-is-not-presented-in-the-csem-table,
    [data-role="cs-estimation-group-item"][data-ismobexcluded="1"]
):not(:where(.page-block *, .export-pt-pdf-file-output-area *)) td {
    color: var(--ui-text);
    background-color: var(--ui-surface-raised);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.material-is-already-added-to-the-estimate-row:not(:where(.page-block *, .export-pt-pdf-file-output-area *)) td {
    color: var(--ui-text);
    background-color: var(--ui-success-surface);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.material-is-already-added-to-the-estimate-label {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .cs-formula-block-text-description,
    .cs-add-new-column-block-details,
    .cs-change-cell-details-short-description,
    .cs-estimate-any-modal-top-short-description
) {
    background-color: var(--ui-surface-tinted);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
:is(.quick-formulas-description, .formula-label-block .sub-text) {
    color: var(--ui-text-muted);
}

/* Stacked mobile rows gain a separate label surface in the responsive table layout. */
@media (max-width: 991.98px) {
    html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
    :is(#proposal-estimation-sections, #ateam-edit-std-production-template-modal) .group-item .item-name {
        color: var(--ui-text);
        background-color: var(--ui-surface-raised);
    }
}

/* Chat, history, stats, recipients, and attachments */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .chat-messages,
    .stat-row .label,
    .stat-row .value,
    .proposal-uploaded-files-list,
    .proposal-bulk-recipients-template-editor-name,
    .proposal-bulk-sending-subarea,
    .ateam-no-bulk-recipients-area,
    .choose-pdf-std-export-type-option,
    .choose-templates-type-option
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

/* The bubble and its pointer inherit the same sender-specific surface. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page .proposal-chat-message {
    --editor-bubble-bg: var(--editor-selection-bg);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.proposal-chat-message[data-sendertype="client"] {
    --editor-bubble-bg: var(--ui-surface-raised);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page .proposal-message-text {
    background-color: var(--editor-bubble-bg);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page .chat-cloud-arrow-down {
    border-top-color: var(--editor-bubble-bg);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .message-date, .estimator-icon, .no-attached-files, .bulk-proposal-row-is-not-sent-yet,
    .views-counter-no-views-yet, .bulkrow-views-counter[data-viewscount="0"], .status-ARCHIVED, .status-REJECTED
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
:is(.proposal-event-row, .proposal-attached-file-row) {
    background-color: var(--ui-surface-raised);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page .proposal-event-row:is(
    [data-eventtype="PROPOSAL_CREATED"], [data-eventtype="PROPOSAL_SIGNED_BY_ESTIMATOR"]
) {
    background-color: var(--editor-selection-bg);
    border-color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page .proposal-event-row:is(
    [data-eventtype="PROPOSAL_SIGNED_BY_CLIENT"], [data-eventtype="PROPOSAL_WON_SIGNED_BY_BOTH_PARTIES"]
) {
    background-color: var(--ui-success-surface);
    border-color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page :is(
    .proposal-attached-file-row,
    .choose-pdf-std-export-type-option,
    .choose-templates-type-option
):hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.edit-proposal-page
.proposal-attached-file-row :is(.remove-file-db, .remove-file-ui, .binary-file-preview-icon) {
    color: var(--ui-link);
}

/* QuickBooks preview and synchronization
   The dialog and its controls use the theme. The estimate preview table keeps a white
   surface and the default paper ink defined at the start of this file. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog {
    background-color: var(--ui-surface);
    color: var(--ui-text);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog::backdrop {
    background: var(--ui-overlay);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog
:is(.qbo-preview-header, .qbo-preview-toolbar, .qbo-preview-footer) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog :is(
    .qbo-preview-header h2, .qbo-preview-section-heading h3, .qbo-preview-icon-button, .qbo-preview-tab
) {
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog :is(
    .qbo-preview-eyebrow, #qbo-preview-view-description, .qbo-preview-document-summary p,
    .qbo-preview-grand-total > span, .qbo-preview-grand-total > small, .qbo-preview-status,
    .qbo-preview-empty, .qbo-preview-footer p
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog .qbo-preview-tabs {
    border-color: var(--ui-border);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog
:is(.qbo-preview-tab, .qbo-preview-icon-button):hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog
.qbo-preview-tab[aria-selected="true"] {
    background-color: var(--editor-selection-bg);
    border-color: var(--ui-accent);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-dialog
:is(.qbo-preview-grand-total > strong, .qbo-preview-section-total) {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-preview-table-scroll {
    background-color: #fff;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-sync-wait-loader[open] {
    background-color: var(--ui-surface);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-sync-wait-loader::backdrop {
    background: var(--ui-overlay);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="editor"])
.qbo-sync-wait-loader
:is(.qbo-sync-proposal-icon, .pqbo-sync-center-block i) {
    color: var(--ui-link);
}

/* Account, administration, FAQ, and support */
/* Account photos and the directory's empty avatar surfaces. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
:is(
    body.ui-page-account .edit-photo-block,
    body.ui-page-admin-users :is(.user-no-avatar, .user-editor-no-photo-circle)
) {
    background-color: var(--ui-surface-tinted);
    color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
:is(
    body.ui-page-account .set-user-photo-icon,
    body.ui-page-admin-users :is(.user-no-avatar .photo-icon, .user-header-element, .user-buttons > div i)
) {
    color: var(--ui-link);
}

/* The user directory notice links out to the SurveySphere portal. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-account-management-notice {
    background-color: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-account-management-notice a {
    color: var(--ui-link);
}

/* Directory rows share the same presentation in the desktop and mobile layouts. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users :is(
    .users-data-table, .user-row-mobile-responsive, .users-list [data-role="pagination"]
) {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .users-list [data-role="pagination"] {
    box-shadow: none;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-row-element {
    background-color: var(--ui-surface-tinted);
    box-shadow: 0 1px 2px var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-row-status-FIRED {
    background-color: var(--ui-surface-raised);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-row-element:hover {
    border-inline-color: var(--ui-accent);
    box-shadow: 0 1px 3px var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-buttons > div:hover {
    background-color: var(--ui-surface-hover);
    border-color: var(--ui-accent);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-buttons > div:hover i {
    color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-dont-have-access-to-this-module-inner-badge {
    background-color: var(--ui-surface-raised);
    box-shadow: var(--ui-shadow);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users :is(
    .user-never-visited, .no-contact-details-specified, .no-proposals-stats-found,
    .user-row-contacts-cell i, .user-stats i
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-status-active {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .user-status-fired {
    color: var(--ui-danger);
}

/* The directory stylesheet marks these two glyph colors as important. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .signed-proposals-icon {
    color: var(--ui-success) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-admin-users .total-proposals-icon {
    color: var(--ui-link) !important;
}

/* Organization settings and QuickBooks connection health. Logo pixels retain their uploaded colors. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings .organization-logo-preview-area {
    background-color: var(--ui-surface-tinted);
    color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings :is(
    .inhouse-numbers-generator-examples, .saas-organization-settings-separated-block h2
) {
    background-color: var(--ui-surface-tinted);
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings .saas-organization-settings-bottom-buttons {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings :is(
    .field-sublabel, .qbo-synchronization-is-not-configured-yet-label
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings .qbo-synchronization-is-configured-label {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-organization-settings .qbo-synchronization-expired-label {
    color: var(--ui-danger);
}

/* Personal settings controls. TinyMCE renders the saved email HTML inside its own iframe. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .settings-param-separation-row {
    background-color: var(--ui-divider-subtle);
}

/* Settings uses inline backgrounds for the Personal info and Company info labels. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .settings-fields-group-label {
    background-color: var(--ui-surface-tinted) !important;
    color: var(--ui-text);
}

/* The rotated labels are SVG text and paint with fill. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .settings-fields-group-label .category-text-rotated {
    fill: currentColor;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .email-template-message-title {
    border-color: var(--ui-border) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .settings-field-subdesctiption {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .action-tab[data-action-id="PRIMARY"] i {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-settings .action-tab[data-action-id="EMAILS"] i {
    color: var(--ui-accent);
}

/* FAQ search and explanatory links. Embedded screenshots retain their original appearance. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-search-area-block {
    background-color: var(--ui-surface-tinted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-search-results-dropdown-content {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq :is(.faq-layout h2, .faq-search-results-item, .search-results-inner-count) {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-layout h5 {
    border-color: var(--ui-link);
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-search-results-item:hover {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq :is(.search-results-block-content, .search-results-block-heading) {
    color: var(--ui-text) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq :is(.text-section-link-block-inline, .text-section-link-block-inline a, .faq-item-text a) {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .search-results-substring {
    background-color: var(--ui-warning-surface);
    color: var(--ui-warning);
}

/* Recolor the static FAQ labels by their original inline colors. Embedded examples remain original. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text :is(
    [style*="color: #4b94ff"], [style*="color: #227fad"], [style*="color: #1d69f9"],
    [style*="color: #065ec7"], [style*="color: #00a9c5"], [style*="color: #0f96bd"],
    [style*="color: #aa0ebb"], [style*="color: rebeccapurple"]
) {
    color: var(--ui-link) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text :is(
    [style*="color: green"], [style*="color: #028313"], [style*="color: #5bb516"], [style*="color: #14810a"]
) {
    color: var(--ui-success) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text :is(
    [style*="color: #cf7706"], [style*="color: #b34e11"]
) {
    color: var(--ui-warning) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text :is(
    [style*="color: #db4837"], [style*="color: red"]
) {
    color: var(--ui-danger) !important;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text :is(
    [style*="color: #333333"], [style*="color: #757575"], [style*="color: #a3a3a3"]
) {
    color: var(--ui-text-muted) !important;
}

/* Inline important declarations still win the color cascade on these links.
   Text fill provides a readable link color while preserving the example markup. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-faq .faq-item-text a[style*="!important"] {
    -webkit-text-fill-color: var(--ui-link);
}

/* Support ticket list, reply composer and message surfaces. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .tech-support-ticket-block, .ticket-modal-window-separation-line
) {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .field-sublabel, .support-tickets-notification-top-text, .support-attachment-input-hint
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .no-tickets-found-block, .add-new-message-to-the-ticket-header
) {
    background-color: var(--ui-surface-tinted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .ticket-message-block {
    box-shadow: 0 1px 2px var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .ticket-message-block[data-messagesender="CLIENT"] {
    background-color: var(--ui-warning-surface);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .ticket-message-block[data-messagesender="SUPPORT"], .tech-support-ticket-block.support-ticket-status-SOLVED td
) {
    background-color: var(--ui-success-surface);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .tech-support-ticket-block.support-ticket-status-SOLVED {
    opacity: 1;
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .tech-support-ticket-block:hover td {
    background-color: var(--ui-surface-hover);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .ticket-cell-status-SOLVED {
    color: var(--ui-success);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .ticket-cell-status-WAITING_FOR_SUPPORT_REPLY, .ticket-urgency-label-HIGH, .ticket-urgency-label-URGENT
) {
    color: var(--ui-danger);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .ticket-urgency-label-MEDIUM {
    color: var(--ui-warning);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(.ticket-cell-status-WAITING_FOR_CLIENT_REPLY, .message-data-text .ws-attached-file) {
    color: var(--ui-link);
}

/* Theme file cards, links and image borders around attachments. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .support-attachment-preview-cell, .ticket-message-attached-document > a
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-border);
    box-shadow: none;
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .support-attachment-preview-cell:hover, .ticket-message-attached-document > a:hover
) {
    background-color: var(--ui-surface-hover);
    border-color: var(--ui-accent);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(.support-attachment-document-link, .support-attachment-document-link:hover) {
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support :is(
    .support-attachment-document-icon, .support-attachment-document-extension,
    .ticket-message-attached-document-icon, .ticket-message-attached-document-extension
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .support-attachment-document-extension {
    background-color: var(--ui-surface-raised);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="administration"])
body.ui-page-support .ticket-message-attached-image {
    border-color: var(--ui-divider-subtle);
}

/* Staff document previews and thumbnails */
/* Staff document sheets and section thumbnails
   Apply the default paper tint to screen rendering. Print and public pages keep
   their renderer backgrounds, and authored elements keep their own display styles. */
@media screen {
    /* Apply the warning palette to the status marker beside the staff thumbnail. */
    html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="paper"])
    .ui-theme-workspace .next-page-area-cell
    > .conditional-page-top-mark-outer > .conditional-page-top-mark:not(:where(.page-block *)) {
        box-sizing: border-box;
        background-color: var(--ui-warning-surface);
        border: 1px solid var(--ui-warning);
        color: var(--ui-warning);
        box-shadow: var(--ui-shadow);
    }
}

/* TinyMCE chrome */
/*
 * TinyMCE injects Oxide after the workspace stylesheets. The root theme
 * selector gives these chrome overrides enough specificity to win. TinyMCE
 * renders the authored content in a separate iframe with its own stylesheet.
 */

/* Editor frame, toolbar and auxiliary popup surfaces. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox.tox-tinymce {
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-editor-header:not(.tox-editor-header--empty), .tox-menubar,
    .tox-toolbar, .tox-toolbar-overlord, .tox-toolbar__primary, .tox-toolbar__overflow,
    .tox-promotion, .tox-statusbar, .tox-menu, .tox-pop__dialog,
    .tox-collection__group, .tox-dialog, .tox-dialog__header, .tox-dialog__footer
) {
    background-color: var(--ui-surface);
    border-color: var(--ui-divider-subtle);
    color: var(--ui-text);
}

/* Oxide gives the format, font and size selectors a separate fill. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-tbtn--bespoke {
    background-color: var(--ui-surface-raised);
}

/* The promotion wrapper shares the header surface. Its link has its own fill. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-promotion-link {
    background-color: var(--ui-surface-tinted);
    color: var(--ui-link);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-promotion-link:is(:hover, :focus) {
    background-color: var(--ui-surface-hover);
}

/* The header divider uses an inset shadow to preserve the editor dimensions. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-editor-header:not(.tox-editor-header--empty) {
    box-shadow: inset 0 -1px var(--ui-divider-subtle);
}

/* Preserve Oxide's 39px row spacing and its opt-out for non-wrapping toolbars. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow
):not(.tox-toolbar--no-divider, .tox-toolbar--scrolling) {
    background-image: repeating-linear-gradient(var(--ui-divider-subtle) 0 1px, transparent 1px 39px);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-toolbar__group:not(:last-of-type) {
    border-inline-end-color: var(--ui-divider-subtle);
}

/* Toolbar buttons and their active, keyboard and disabled states. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-mbtn, .tox-tbtn, .tox-split-button, .tox-collection__item,
    .tox-button--naked, .tox-dialog__body
) {
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-mbtn, .tox-tbtn, .tox-split-button, .tox-button--naked
):not(:disabled, [aria-disabled="true"], .tox-tbtn--disabled):is(
    :hover, :focus, :active, .tox-mbtn--active, .tox-tbtn--enabled
) {
    background-color: var(--ui-surface-hover);
    box-shadow: none;
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-mbtn, .tox-tbtn, .tox-button--naked
):is(:disabled, [aria-disabled="true"], .tox-tbtn--disabled),
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-collection__item--state-disabled {
    color: var(--ui-text-muted);
}

/* TinyMCE icons and the Tiny brand mark are SVG glyphs with explicit skin fills. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-tbtn, .tox-collection__item-icon, .tox-collection__item-caret,
    .tox-statusbar__branding a, .tox-statusbar__resize-handle, .tox-swatches__picker-btn
) svg {
    fill: currentColor;
}

/* Oxide uses more specific fill rules for selected, focused and disabled glyphs. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-tbtn:focus:not(.tox-tbtn--disabled), .tox-tbtn--enabled.tox-tbtn--disabled, .tox-tbtn--disabled,
    .tox-statusbar__branding a:hover:not([aria-disabled="true"]),
    .tox-statusbar__branding a:focus:not([aria-disabled="true"]),
    .tox-collection__item--state-disabled .tox-collection__item-caret
) svg {
    fill: currentColor;
}

/* Footer metadata and secondary labels use the muted text token. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-statusbar a, .tox-statusbar__path-item, .tox-statusbar__wordcount, .tox-statusbar__resize-handle,
    .tox-collection__item-accessory,
    .tox-label, .tox-toolbar-label, .tox-insert-table-picker__label
) {
    color: var(--ui-text-muted);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-statusbar a, .tox-statusbar__path-item, .tox-statusbar__wordcount, .tox-statusbar__resize-handle
):not(:disabled, [aria-disabled="true"]):is(:focus, :hover) {
    color: var(--ui-text);
}

/* TinyMCE appends its menus and dialogs in an auxiliary container under body. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-collection--list, .tox-collection--toolbar, .tox-collection--grid
) .tox-collection__item:is(
    .tox-collection__item--enabled, .tox-collection__item--active, :hover, :focus
):not(.tox-collection__item--state-disabled, [aria-disabled="true"]) {
    background-color: var(--ui-surface-hover);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-dialog-wrap__backdrop, .tox-dialog-wrap__backdrop--opaque, .tox-dialog__busy-spinner
) {
    background-color: var(--ui-overlay);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-collection__group-heading, .tox-listboxfield .tox-listbox--select, .tox-selectfield select,
    .tox-textarea, .tox-textfield, .tox-toolbar-textfield, .tox-button--secondary
) {
    background-color: var(--ui-surface-raised);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-textarea, .tox-textfield, .tox-toolbar-textfield, .tox-listboxfield .tox-listbox--select,
    .tox-selectfield select, .tox-button--secondary
):not(:disabled):is(:focus, :hover) {
    background-color: var(--ui-surface-hover);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

/* Keep keyboard focus visible within clipped or tightly spaced vendor controls. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox :is(
    .tox-mbtn, .tox-tbtn, .tox-split-button, .tox-promotion-link, .tox-button, .tox-collection__item,
    .tox-textarea, .tox-textfield, .tox-toolbar-textfield, .tox-listboxfield .tox-listbox--select
):focus-visible {
    outline: 2px solid var(--ui-focus);
    outline-offset: -2px;
}

/* The table grid has its own cells and highlighted selection. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-insert-table-picker > div {
    border-color: var(--ui-divider-subtle);
}

html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-insert-table-picker .tox-insert-table-picker__selected {
    background-color: var(--ui-surface-hover);
    border-color: var(--ui-accent);
}

/* The editable iframe keeps the stock light canvas, native controls and content stylesheet. */
html:is([data-ui-theme="dark"], [data-ui-theme="light"]):where([data-ui-theme-components~="richtext"])
.tox .tox-edit-area__iframe {
    color-scheme: light;
}
