/* Shared interaction accent. Business/status colors and page photography stay local. */
@media screen {
    :root {
        --apple-accent: #0066cc;
        --apple-focus: #007aff;
        --apple-selected: #0066cc;
        --apple-on-selected: #fff;
        --apple-field: #fff;
        --apple-menu: #f9f9fb;
        --apple-menu-glass: rgb(249 249 251 / 96%);
        --apple-ink: #1d1d1f;
        --apple-muted: #626268;
        --apple-line: #86868b;
        --apple-hover: #e8f0fc;
    }
    html[data-esr-theme="dark"], body:has(.engagement-entry), body.engagement-entry {
        --apple-accent: #0a84ff;
        --apple-focus: #64b5ff;
        --apple-selected: #0071e3;
        --apple-field: #202022;
        --apple-menu: #29292c;
        --apple-menu-glass: rgb(41 41 44 / 96%);
        --apple-ink: #f5f5f7;
        --apple-muted: #b6b6bd;
        --apple-line: #86868b;
        --apple-hover: #263b55;
    }
    /* Signed-in visitors still see the public pages in their own light palette. */
    html[data-esr-theme] .public-page {
        --apple-accent: #0066cc;
        --apple-focus: #007aff;
        --apple-selected: #0066cc;
        --apple-field: #fff;
        --apple-menu: #f9f9fb;
        --apple-menu-glass: rgb(249 249 251 / 96%);
        --apple-ink: #1d1d1f;
        --apple-muted: #626268;
        --apple-line: #86868b;
        --apple-hover: #e8f0fc;
    }
    html body.esr-workspace.esr-reading:not(:has(.public-page)) {
        --appearance-blue: var(--apple-accent);
        --appearance-focus: var(--apple-focus);
        --workspace-blue: var(--apple-accent);
    }
    /* Late, narrow overrides of the historical red/white/green form accents. */
    html body input:is([type="checkbox"], [type="radio"], [type="range"]) {
        accent-color: var(--apple-accent) !important;
    }
    html body :is(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
        outline: 2px solid var(--apple-focus) !important;
        outline-offset: 3px;
    }
    html body :is(input, textarea)::selection { color: #fff; background: #0066cc; }
    html body :is(input:not([type]), input:is([type="text"], [type="email"], [type="tel"], [type="password"], [type="search"], [type="url"], [type="number"], [type="date"], [type="time"], [type="month"], [type="datetime-local"]), select, textarea) {
        border-radius: 8px !important;
        transition: border-color 140ms ease, box-shadow 140ms ease;
    }
    html body :is(input, select, textarea):focus-visible:not([aria-invalid="true"]):not(.is-invalid):not(:user-invalid) {
        border-color: var(--apple-focus);
    }
    /* The border and message keep their error hue even with a blue focus ring. */
    html body :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--app-red, #ac2921) !important; }
    html body :is(input, select, textarea):disabled { cursor: not-allowed; }
    html body :is(input, textarea)[readonly] { cursor: default; }
    html body .auth-form .password-visibility-toggle[aria-pressed="true"] {
        color: var(--apple-on-selected) !important; background: var(--apple-selected) !important;
        border-radius: 6px;
    }

    html body .esr-setting-switch[aria-checked="true"] .esr-setting-switch__track {
        background: var(--apple-accent); border-color: var(--apple-accent);
    }
    html body .esr-setting-switch[aria-checked="true"] .esr-setting-switch__track::after { background: #fff; }
    html body .esr-setting-switch:disabled:not([aria-busy="true"]) .esr-setting-switch__track { opacity: .65; }

    html body :is(.auth-space-link.is-selected, .auth-space-link[aria-current="page"]) {
        color: var(--apple-ink); background: var(--apple-hover); border-color: var(--apple-accent);
        box-shadow: inset 0 0 0 1px var(--apple-accent);
    }
    html body .auth-space-link.is-selected .auth-space-monogram { background: var(--apple-selected); color: var(--apple-on-selected); }
    html body .auth-space-context { border-left-color: var(--apple-accent); }
    html body .candidate-mandate .candidate-mandate__choice input:checked + span,
    html body.esr-workspace.esr-reading .workspace-clients__workbench .candidate-mandate .candidate-mandate__choice input:checked + span {
        color: var(--apple-on-selected); background: var(--apple-selected);
    }
    html body .candidate-mandate .candidate-mandate__choice input:focus-visible + span,
    html body.esr-workspace.esr-reading .workspace-clients__workbench .candidate-mandate .candidate-mandate__choice input:focus-visible + span {
        outline: 2px solid var(--apple-focus); outline-offset: -4px;
    }
    html body :is(.booking-offer, .booking-gearbox):has(input:checked) {
        color: var(--apple-ink); border-color: var(--apple-accent); background: var(--apple-hover);
        box-shadow: inset 0 0 0 1px var(--apple-accent);
    }

    /* Functional menus only: opaque fallback first, restrained glass where supported. */
    html body :is(.workspace-profile-options,
        .esr-app-account > .app-header-actions, .esr-app-more > div,
        .public-mobile-menu > nav, .direction-search__suggestions,
        .candidate-search__results, .client-lookup__results) {
        color: var(--apple-ink) !important; background: var(--apple-menu) !important;
        border-color: var(--apple-line); border-radius: 12px;
        box-shadow: 0 12px 32px #0003, inset 0 1px 0 #ffffff1f;
    }
    html body .direction-search__form:focus-within { outline: 2px solid var(--apple-focus); outline-offset: 3px; }
    html body :is(.candidate-search__results, .client-lookup__results) [role="option"] { color: var(--apple-ink); }
    html body :is(.direction-search__result small, .candidate-search__results span, .client-lookup__results span) { color: var(--apple-muted) !important; }
    html body :is(.workspace-profile-options, .esr-app-more-panel, .esr-app-account > .app-header-actions, .public-mobile-links) :is(a, button) {
        color: var(--apple-ink) !important;
    }
    html body :is(.workspace-profile-options, .esr-app-more-panel, .esr-app-account > .app-header-actions, .public-mobile-links) :is(a, button):is(:hover, :focus-visible, [aria-current="true"], [aria-current="page"]) {
        color: var(--apple-on-selected) !important; background: var(--apple-selected) !important; border-radius: 6px;
    }
    html body :is(.direction-search__result, .candidate-search__results [role="option"], .client-lookup__results [role="option"])[aria-selected="true"] {
        color: var(--apple-on-selected) !important; background: var(--apple-selected) !important;
        outline-color: var(--apple-selected); text-decoration: none;
    }
    html body.esr-workspace.esr-reading .direction-search__result[aria-selected="true"] { color: var(--apple-on-selected); background: var(--apple-selected); }
    html body :is(.direction-search__result, .candidate-search__results [role="option"], .client-lookup__results [role="option"])[aria-selected="true"] :is(small, span, strong) { color: inherit !important; }
    @media (hover: hover) and (pointer: fine) {
        html body :is(.direction-search__result, .candidate-search__results [role="option"], .client-lookup__results [role="option"]):hover {
            background: var(--apple-hover); color: var(--apple-ink);
        }
        html body :is(.direction-search__result, .candidate-search__results [role="option"], .client-lookup__results [role="option"])[aria-selected="true"]:hover {
            background: var(--apple-selected); color: var(--apple-on-selected);
        }
    }
    @supports (backdrop-filter: blur(20px)) {
        html body :is(.workspace-profile-options,
            .esr-app-account > .app-header-actions, .esr-app-more > div, .public-mobile-menu > nav,
            .direction-search__suggestions, .candidate-search__results, .client-lookup__results) {
            background: var(--apple-menu-glass) !important; backdrop-filter: blur(20px) saturate(125%);
        }
    }
    @media (prefers-reduced-transparency: reduce) {
        html body :is(.workspace-profile-options,
            .esr-app-account > .app-header-actions, .esr-app-more > div, .public-mobile-menu > nav,
            .direction-search__suggestions, .candidate-search__results, .client-lookup__results) {
            background: var(--apple-menu) !important; backdrop-filter: none;
        }
    }
    @media (prefers-reduced-motion: reduce) {
        html body :is(input, select, textarea) { transition: none; }
    }
    @media (forced-colors: active) {
        html body input:is([type="checkbox"], [type="radio"], [type="range"]) { accent-color: auto !important; }
        html body :is(a, button, summary, input, select, textarea, [tabindex]):focus-visible { outline-color: Highlight !important; }
        html body .esr-setting-switch[aria-checked="true"] .esr-setting-switch__track { background: Highlight; border-color: Highlight; }
        html body .esr-setting-switch[aria-checked="true"] .esr-setting-switch__track::after { background: HighlightText; }
        html body .auth-form .password-visibility-toggle[aria-pressed="true"] { color: HighlightText !important; background: Highlight !important; }
        html body :is(.workspace-profile-options, .esr-app-account > .app-header-actions, .esr-app-more > div,
            .public-mobile-menu > nav, .direction-search__suggestions, .candidate-search__results, .client-lookup__results) {
            color: CanvasText !important; background: Canvas !important; border-color: ButtonText;
            box-shadow: none; backdrop-filter: none;
        }
        html body :is(.workspace-profile-options, .esr-app-more-panel, .esr-app-account > .app-header-actions, .public-mobile-links) :is(a, button) { color: LinkText !important; }
        html body :is(.direction-search__result small, .candidate-search__results span, .client-lookup__results span) { color: CanvasText !important; }
        html body :is(input, select, textarea)[aria-invalid="true"] { border-color: CanvasText !important; }
        html body :is(.auth-space-link.is-selected, .auth-space-link[aria-current="page"], .candidate-mandate .candidate-mandate__choice input:checked + span,
            .direction-search__result[aria-selected="true"], .candidate-search__results [aria-selected="true"], .client-lookup__results [aria-selected="true"]) {
            color: HighlightText !important; background: Highlight !important; border-color: Highlight; box-shadow: none;
        }
        html body :is(.workspace-profile-options, .esr-app-more-panel, .esr-app-account > .app-header-actions, .public-mobile-links) :is(a, button):is(:hover, :focus-visible, [aria-current="true"], [aria-current="page"]) {
            color: HighlightText !important; background: Highlight !important;
        }
    }
}
