/* Approved quiet raised buttons. Screen-only: existing receipt/report print styles stay intact.
 * This final component layer also covers legacy action classes and unclassed submit buttons.
 * Navigation, dedicated tabs, dismiss controls, clickable data and pagination keep their own appearance.
 */
@media screen {
    :root {
        --action-edge: #b2bfd1;
        --action-highlight: rgba(255, 255, 255, .85);
        --action-shadow: rgba(15, 23, 42, .1);
        --action-border: #b9c7d9;
        --action-focus: #2563eb;
        --action-bg: var(--surface-soft);
        --action-fg: var(--text);
        --action-bottom: var(--action-edge);
        --action-stroke: var(--action-border);
        --action-height: 44px;
        --action-size: 15px;
    }
    html[data-theme="dark"] {
        --action-edge: #101a2b;
        --action-highlight: rgba(255, 255, 255, .14);
        --action-shadow: rgba(0, 0, 0, .24);
        --action-border: #596b84;
        --action-focus: #93c5fd;
    }
    html[data-theme="dark"][data-theme-depth="deep"] {
        --action-edge: #020408;
        --action-border: #52647e;
        --action-shadow: rgba(0, 0, 0, .4);
    }

    /* Explicit action inventory; do not turn every button into a raised action. */
    :root body :is(button, a, input):is(
        .btn, .btn-header, .btn-3d, .btn-icon, .btn-icon-mini, .btn-action,
        .btn-action-large, .btn-action-small, .btn-submit, .btn-ghost, .btn-back,
        .btn-action-modern, .quick-search-filter__btn, .quick-filter-btn,
        .btn-compare-action, .control-btn, .comparison-button, .btn-quick-date,
        .header-quick-action, .theme-choice, .login-btn, .select-all-btn,
        .order-items-editor__sync, .order-items-editor__add, .order-item-remove,
        .edit-order-label-print-button, .mobile-order-edit-button,
        .mobile-order-delete-button, .mobile-order-print-button,
        .telegram-link-card__button, .message-send-button,
        .message-attachment-button, .message-screen-capture-button,
        .returns-print-button, .advanced-search-print-cancel,
        .advanced-search-print-confirm, .returns-print-cancel, .returns-print-confirm,
        [type="submit"]
    ) {
        --action-control: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px !important;
        min-height: var(--action-height) !important;
        height: auto !important;
        padding: 9px 16px !important;
        border: 1px solid var(--action-stroke) !important;
        border-radius: 8px !important;
        background: var(--action-bg) !important;
        background-image: linear-gradient(rgba(255, 255, 255, .035), transparent) !important;
        color: var(--action-fg) !important;
        font-family: var(--font-family-primary) !important;
        font-size: var(--action-size) !important;
        font-weight: 700 !important;
        line-height: 1.45 !important;
        text-align: center;
        text-decoration: none;
        box-shadow: inset 0 1px 0 var(--action-highlight),
            0 2px 0 var(--action-bottom), 0 4px 5px var(--action-shadow) !important;
        transform: none !important;
        transition: transform 110ms ease, box-shadow 110ms ease, filter 110ms ease !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Primary actions: search, add, save, send and print. */
    :root body :where(
        .btn-primary, .btn-submit, .btn-save, .btn-view, .btn-print, .btn-print-receipts,
        .btn-modal-primary, .btn-icon.primary, .quick-search-filter__btn--primary,
        .btn-action-modern.active, .btn-view-mode.active, .quick-filter-btn.active,
        .comparison-button.is-primary, .header-add-action, .login-btn,
        .message-send-button, .telegram-link-card__button:not(.is-secondary),
        .advanced-search-print-confirm, .returns-print-confirm,
        .header-barcode-dialog__input-row button,
        .returns-filter-actions button, .customer-phones-filters button[type="submit"],
        .returns-import-upload button, .returns-import-card__actions button,
        .order-items-editor__add, [type="submit"]
    ) {
        --action-bg: var(--primary);
        --action-fg: var(--on-accent);
        --action-bottom: #153f9b;
        --action-stroke: #3d74e9;
    }
    :root body :where(.btn-success, .btn-action.success, .btn-submit.success,
        .btn-table-success, .btn-modal-success) {
        --action-bg: var(--success-fill);
        --action-fg: var(--on-accent);
        --action-bottom: #095031;
        --action-stroke: #39966a;
    }
    :root body :where(.btn-danger, .btn-delete-custom, .btn-table-danger,
        .btn-modal-danger, .btn-logout, .btn-icon.danger, .btn-action.danger,
        .btn-icon-mini.delete, .mobile-order-delete-button, .warehouse-delete-button,
        .advanced-search-delete-btn, .order-item-remove) {
        --action-bg: var(--danger-50);
        --action-fg: var(--danger);
        --action-bottom: color-mix(in srgb, var(--danger-50) 78%, #000);
        --action-stroke: color-mix(in srgb, var(--danger) 40%, var(--border));
    }
    :root body :where(.btn-warning, .btn-warning-action, .btn-action.warning) {
        --action-bg: var(--warning-50);
        --action-fg: var(--warning-800);
        --action-bottom: color-mix(in srgb, var(--warning-50) 72%, #000);
        --action-stroke: color-mix(in srgb, var(--warning) 40%, var(--border));
    }
    :root body :where(.btn-edit, .btn-edit-custom, .btn-info-action,
        .btn-icon-mini.edit, .btn-icon.secondary, .theme-choice[aria-pressed="true"]) {
        --action-bg: var(--primary-50);
        --action-fg: var(--link);
        --action-bottom: color-mix(in srgb, var(--primary-50) 78%, #000);
        --action-stroke: color-mix(in srgb, var(--link) 40%, var(--border));
    }
    :root body .header-barcode-action {
        --action-bg: var(--success-50);
        --action-fg: var(--success-800);
        --action-stroke: color-mix(in srgb, var(--success) 40%, var(--border));
    }
    :root body .message-send-button.is-broadcast {
        --action-bg: #9a3412;
        --action-fg: var(--on-accent);
        --action-bottom: #66240e;
        --action-stroke: #c7643d;
    }
    /* An explicitly secondary submit must retain its neutral appearance. */
    :root body :where(.btn-secondary, .btn-modal-secondary, .btn-reset,
        .btn-outline, .btn-outline-secondary, .btn-ghost, .btn-back,
        .telegram-link-card__button.is-secondary) {
        --action-bg: var(--surface-soft);
        --action-fg: var(--text);
        --action-bottom: var(--action-edge);
        --action-stroke: var(--action-border);
    }

    :root body :is(button, a, input):is(
        .btn, .btn-header, .btn-3d, .btn-icon, .btn-icon-mini, .btn-action,
        .btn-action-large, .btn-action-small, .btn-submit, .btn-ghost, .btn-back,
        .btn-action-modern, .quick-search-filter__btn, .quick-filter-btn,
        .btn-compare-action, .control-btn, .comparison-button, .btn-quick-date,
        .header-quick-action, .theme-choice, .login-btn, .select-all-btn,
        .order-items-editor__sync, .order-items-editor__add, .order-item-remove,
        .edit-order-label-print-button, .mobile-order-edit-button,
        .mobile-order-delete-button, .mobile-order-print-button,
        .telegram-link-card__button, .message-send-button,
        .message-attachment-button, .message-screen-capture-button,
        .returns-print-button, .advanced-search-print-cancel,
        .advanced-search-print-confirm, .returns-print-cancel, .returns-print-confirm,
        [type="submit"]
    ):not(:disabled):not([aria-disabled="true"]) {
        cursor: pointer;
    }
    /* :where keeps this state rule below semantic variants and disabled rules. */
    :root body :is(button, a, input):where(
        .btn, .btn-header, .btn-3d, .btn-icon, .btn-icon-mini, .btn-action,
        .btn-action-large, .btn-action-small, .btn-submit, .btn-ghost, .btn-back,
        .btn-action-modern, .quick-search-filter__btn, .quick-filter-btn,
        .btn-compare-action, .control-btn, .comparison-button, .btn-quick-date,
        .header-quick-action, .theme-choice, .login-btn, .select-all-btn,
        .order-items-editor__sync, .order-items-editor__add, .order-item-remove,
        .edit-order-label-print-button, .mobile-order-edit-button,
        .mobile-order-delete-button, .mobile-order-print-button,
        .telegram-link-card__button, .message-send-button,
        .message-attachment-button, .message-screen-capture-button,
        .returns-print-button, .advanced-search-print-cancel,
        .advanced-search-print-confirm, .returns-print-cancel, .returns-print-confirm,
        [type="submit"]
    ):not(:disabled):not([aria-disabled="true"]):hover {
        filter: brightness(1.025);
    }
    :root body :is(button, a, input):is(
        .btn, .btn-header, .btn-3d, .btn-icon, .btn-icon-mini, .btn-action,
        .btn-action-large, .btn-action-small, .btn-submit, .btn-ghost, .btn-back,
        .btn-action-modern, .quick-search-filter__btn, .quick-filter-btn,
        .btn-compare-action, .control-btn, .comparison-button, .btn-quick-date,
        .header-quick-action, .theme-choice, .login-btn, .select-all-btn,
        .order-items-editor__sync, .order-items-editor__add, .order-item-remove,
        .edit-order-label-print-button, .mobile-order-edit-button,
        .mobile-order-delete-button, .mobile-order-print-button,
        .telegram-link-card__button, .message-send-button,
        .message-attachment-button, .message-screen-capture-button,
        .returns-print-button, .advanced-search-print-cancel,
        .advanced-search-print-confirm, .returns-print-cancel, .returns-print-confirm,
        [type="submit"]
    ):not(:disabled):not([aria-disabled="true"]):active {
        transform: translateY(2px) !important;
        box-shadow: inset 0 1px 2px var(--action-shadow) !important;
    }
    :root body :is(button, a, input):is(
        .btn, .btn-header, .btn-3d, .btn-icon, .btn-icon-mini, .btn-action,
        .btn-action-large, .btn-action-small, .btn-submit, .btn-ghost, .btn-back,
        .btn-action-modern, .quick-search-filter__btn, .quick-filter-btn,
        .btn-compare-action, .control-btn, .comparison-button, .btn-quick-date,
        .header-quick-action, .theme-choice, .login-btn, .select-all-btn,
        .order-items-editor__sync, .order-items-editor__add, .order-item-remove,
        .edit-order-label-print-button, .mobile-order-edit-button,
        .mobile-order-delete-button, .mobile-order-print-button,
        .telegram-link-card__button, .message-send-button,
        .message-attachment-button, .message-screen-capture-button,
        .returns-print-button, .advanced-search-print-cancel,
        .advanced-search-print-confirm, .returns-print-cancel, .returns-print-confirm,
        [type="submit"]
    ):is(:disabled, [aria-disabled="true"], [disabled]) {
        background: var(--surface-muted) !important;
        background-image: none !important;
        color: var(--text-muted) !important;
        border-color: var(--border-strong) !important;
        border-style: dashed !important;
        opacity: 1 !important;
        box-shadow: none !important;
        transform: none !important;
        filter: none !important;
        cursor: not-allowed;
    }
    /* All button labels follow the parent color and type, including legacy styled spans. */
    :root body :is(button, a[class*="btn"], a.comparison-button) > :is(span, strong) {
        color: inherit !important;
        font-size: inherit !important;
        font-weight: inherit !important;
        line-height: inherit !important;
    }
    :root body :is(button, a[class*="btn"], a.comparison-button):focus-visible {
        outline: 3px solid var(--action-focus) !important;
        outline-offset: 3px !important;
    }
    /* Dense desktop rows retain compact actions; pointer targets expand below. */
    :root body :is(.btn-sm, .btn-icon, .btn-icon-mini, .btn-action-small,
        .btn-adjustment-delete, .header-quick-action) {
        --action-size: 14px;
        --action-height: 38px;
        padding: 7px 10px !important;
    }
    :root body .header-quick-action { --action-height: 44px; }
    /* These legacy page rules used !important sizes or shadows above the shared component. */
    :root body.activity-log-page :is(.quick-search-filter > .d-flex, .professional-table) .btn-action-large,
    :root body.delivery-people-page .action-buttons .btn,
    :root body.index-page .professional-table .btn-action-large {
        font-size: 14px !important;
        font-weight: 700 !important;
    }
    :root body.activity-log-page :is(.quick-search-filter > .d-flex, .professional-table) .btn-action-large:not(:disabled):not([aria-disabled="true"]):not(:active) {
        box-shadow: inset 0 1px 0 var(--action-highlight),
            0 2px 0 var(--action-bottom), 0 4px 5px var(--action-shadow) !important;
    }
    :root body.delivery-people-page .tabs-container .btn { border-radius: 8px !important; }
    :root body .btn-icon {
        width: var(--action-height) !important;
        min-width: var(--action-height);
        padding: 7px !important;
    }
    :root body .header-user-dropdown .theme-choice {
        --action-size: 14px;
        --action-height: 60px;
        padding: 7px 3px !important;
        gap: 4px !important;
        white-space: normal;
        line-height: 1.5 !important;
    }
    :root body .header-user-dropdown { width: min(260px, calc(100vw - 32px)); }
    :root body .theme-options__choices { gap: 7px; }
    :root body .theme-choice[aria-pressed="true"] {
        border-color: var(--link) !important;
        box-shadow: inset 0 0 0 1px var(--link),
            inset 0 1px 0 var(--action-highlight), 0 2px 0 var(--action-bottom) !important;
    }
    /* Long submit labels wrap inside their original container on narrow screens. */
    :root body :is(button[type="submit"], .message-send-button, .comparison-button) {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
@media screen and (any-pointer: coarse) {
    :root body :is(.btn-sm, .btn-icon, .btn-icon-mini, .btn-action-small, .btn-adjustment-delete) {
        --action-height: 44px;
    }
}
@media screen and (prefers-reduced-motion: reduce) {
    :root body :is(button, a[class*="btn"], a.comparison-button) { transition: none !important; }
}
