/* Shared visual treatment only: do not alter button sizes or hit areas. */
:root {
    --crm-button-text: #234b75;
    --crm-button-border: #507baa;
    --crm-button-top: #edf5ff;
    --crm-button-bottom: #cfe2fa;
    --crm-button-shadow: inset 0 0 0 1px rgb(80 123 169 / 18%), inset 0 1px 0 rgb(255 255 255 / 85%), 0 2px 4px rgb(43 74 110 / 16%);
    --crm-button-focus: #315f93;
}

:is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"], .related-widget-wrapper-link, .selector-chooseall, .selector-clearall, .object-tools .addlink, .submit-row .deletelink) {
    color: var(--crm-button-text);
    background-color: var(--crm-button-bottom);
    background-image: linear-gradient(180deg, var(--crm-button-top), var(--crm-button-bottom));
    border-color: var(--crm-button-border);
    box-shadow: var(--crm-button-shadow);
    text-decoration: none;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

:is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"], .related-widget-wrapper-link, .selector-chooseall, .selector-clearall, .object-tools .addlink, .submit-row .deletelink):hover {
    color: #193c63;
    background-color: #bdd8f7;
    background-image: linear-gradient(180deg, #e1efff, #bdd8f7);
    border-color: #4d7cac;
    box-shadow: inset 0 0 0 1px rgb(49 95 147 / 22%), inset 0 1px 0 rgb(255 255 255 / 80%), 0 3px 7px rgb(43 74 110 / 23%);
    text-decoration: none;
}

:is(body, body.service-admin, body.window-frame) :is(button.primary, .button.primary, input[type="submit"].default, .object-tools .addlink, .wm-keep) {
    color: #18413b;
    background-color: #a4ded8;
    background-image: linear-gradient(180deg, #c7ece7, #a4ded8);
    border-color: #39988b;
    box-shadow: inset 0 0 0 1px rgb(40 106 97 / 14%), inset 0 1px 0 rgb(255 255 255 / 75%), 0 2px 5px rgb(44 116 106 / 23%);
}

:is(body, body.service-admin, body.window-frame) :is(button.primary, .button.primary, input[type="submit"].default, .object-tools .addlink, .wm-keep):hover {
    color: #14332f;
    background-color: #9fdbd3;
    background-image: linear-gradient(180deg, #b9e5de, #8dcec7);
    border-color: #2f7c72;
    box-shadow: inset 0 0 0 1px rgb(40 106 97 / 20%), inset 0 1px 0 rgb(255 255 255 / 65%), 0 3px 7px rgb(44 116 106 / 30%);
}

:is(body, body.service-admin, body.window-frame) :is(.danger-button, .button.danger, button.danger, .submit-row .deletelink, input[type="submit"].deletelink, .delete-confirmation input[type="submit"], .wm-drop) {
    color: #8a233b;
    background-color: #f5c7d2;
    background-image: linear-gradient(180deg, #ffe9ee, #f5c7d2);
    border-color: #c06f84;
    box-shadow: inset 0 0 0 1px rgb(170 56 73 / 14%), inset 0 1px 0 rgb(255 255 255 / 75%), 0 2px 5px rgb(140 47 70 / 19%);
}

:is(body, body.service-admin, body.window-frame) :is(.danger-button, .button.danger, button.danger, .submit-row .deletelink, input[type="submit"].deletelink, .delete-confirmation input[type="submit"], .wm-drop):hover {
    color: #72192e;
    background-color: #edacbd;
    background-image: linear-gradient(180deg, #ffdae3, #edacbd);
    border-color: #a84a64;
}

/* Compact icon controls keep their original border widths and dimensions. */
:is(body, body.service-admin, body.window-frame) .wm-controls button[data-action],
:is(body, body.service-admin, body.window-frame) .auth-card .auth-password-toggle,
:is(body, body.service-admin, body.window-frame) .crm-toast .crm-toast-close {
    color: #234b75;
    background-color: #d9e9fc;
    background-image: linear-gradient(180deg, #f0f7ff, #d9e9fc);
    border-color: #507baa;
    box-shadow: var(--crm-button-shadow);
}

:is(body, body.service-admin, body.window-frame) .wm-controls button[data-action="close"]:hover,
:is(body, body.service-admin, body.window-frame) .crm-toast .crm-toast-close:hover {
    color: #8a233b;
    background-color: #f5c7d2;
    background-image: linear-gradient(180deg, #ffe9ee, #f5c7d2);
    border-color: #c06f84;
}

/* Menu/search rows must remain distinct rows, not a wall of raised buttons. */
:is(body, body.service-admin, body.window-frame) .crm-context-menu .crm-context-item,
:is(body, body.service-admin, body.window-frame) .smart-search-results button.smart-search-result,
:is(body, body.service-admin, body.window-frame) .smart-search-results button.smart-search-all {
    color: #234b75;
    background-color: #edf4fd;
    background-image: none;
    box-shadow: inset 0 -1px 0 rgb(80 123 169 / 16%);
}

:is(body, body.service-admin, body.window-frame) .crm-context-menu .crm-context-item:hover,
:is(body, body.service-admin, body.window-frame) .smart-search-results button:hover,
:is(body, body.service-admin, body.window-frame) .smart-search-results button[aria-selected="true"] {
    color: #193c63;
    background-color: #cfe2fa;
    box-shadow: inset 3px 0 0 #315f93;
}

:is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"], .related-widget-wrapper-link, .selector-chooseall, .selector-clearall, .object-tools .addlink, .submit-row .deletelink):active {
    box-shadow: inset 0 2px 4px rgb(33 57 84 / 24%), inset 0 0 0 1px rgb(49 95 147 / 22%);
}

:is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"], .related-widget-wrapper-link, .selector-chooseall, .selector-clearall, .object-tools .addlink, .submit-row .deletelink):focus-visible {
    outline: 3px solid var(--crm-button-focus);
    outline-offset: 2px;
}

:is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"], .related-widget-wrapper-link, .selector-chooseall, .selector-clearall, .submit-row .deletelink):is(:disabled, .disabled, [aria-disabled="true"]):is(:disabled, .disabled, [aria-disabled="true"]) {
    color: #58667a;
    background-color: #e6ebf2;
    background-image: linear-gradient(180deg, #f1f4f8, #e6ebf2);
    border-color: #aebbc9;
    box-shadow: inset 0 0 0 1px rgb(98 112 132 / 12%);
    cursor: not-allowed;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    :is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"]) {
        transition: none;
    }
}

/* Windows-like neutral menu surface, independent of raised service buttons. */
:is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item {
    color: #222;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
}
:is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-secondary {
    color: #666;
}
:is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item:hover {
    color: #222;
    background-color: #ebebeb;
    box-shadow: none;
}
:is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item:focus-visible {
    color: #222;
    background-color: #ebebeb;
    box-shadow: inset 0 0 0 2px #888;
}
:is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item:active {
    color: #222;
    background-color: #dedede;
    box-shadow: none;
}
@media (forced-colors: active) {
    :is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item {
        color: ButtonText;
        background-color: ButtonFace;
        box-shadow: inset 0 0 0 1px ButtonText;
    }
    :is(body, body.service-admin, body.window-frame) .crm-context-menu button.crm-context-item:is(:hover, :focus-visible, :active) {
        color: HighlightText;
        background-color: Highlight;
        box-shadow: inset 0 0 0 1px HighlightText;
    }
    :is(body, body.service-admin, body.window-frame) :is(button, .button, input[type="submit"], input[type="button"], input[type="reset"], a[role="button"]) {
        color: ButtonText;
        background: ButtonFace;
        box-shadow: inset 0 0 0 1px ButtonText;
        outline-color: Highlight;
    }
}
