/* Main-list controls only. Keep existing rows, grid dimensions, overflow modes,
   permission-driven visibility, and dropdown/dialog contents framework-owned. */
.wfx-list-actions,
.wfx-list-grid-toolbar {
    --list-surface: #282828;
    --list-hover: #353434;
    --list-border: rgba(255, 255, 255, .2);
    --list-text: #f3f4f6;
    --list-muted: #b8bdc7;
    --list-accent: #75b9fa;
    --list-success-bg: #236b48;
    --list-success-hover: #2d8057;
    --list-success-border: #479e70;
    --list-success-text: #f0fff4;
    --list-control-height: 44px;
}

.wfx-list-grid-toolbar {
    --list-control-height: 36px;
}

/* Direct-child launchers deliberately exclude filter popup actions, search
   dialog buttons, empty-state CTAs, and record/card Edit/Delete buttons. */
:is(
    .wfx-list-actions > .e-btn,
    .wfx-list-actions .wfx-document-list-primary > .e-btn,
    .wfx-list-actions .pager-display > .e-btn,
    .wfx-list-actions .wfx-list-search-launcher-row > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn,
    .wfx-list-grid-toolbar .wfx-list-search-launcher-row > .e-btn
) {
    box-sizing: border-box;
    min-width: 36px;
    min-height: var(--list-control-height) !important;
    max-width: 100%;
    height: auto !important;
    padding: 6px 12px !important;
    border: 1px solid var(--list-button-border, var(--list-border)) !important;
    border-radius: 8px !important;
    background: var(--list-button-bg, var(--list-surface)) !important;
    color: var(--list-button-text, var(--list-text)) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    text-transform: none;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease;
}

/* Keep the existing positive-action meaning of New/Create buttons. These
   variables only affect controls styled above, not buttons in their popups. */
:is(.wfx-list-actions, .wfx-list-grid-toolbar) .e-btn.e-success {
    --list-button-bg: var(--list-success-bg);
    --list-button-hover: var(--list-success-hover);
    --list-button-border: var(--list-success-border);
    --list-button-text: var(--list-success-text);
}

:is(
    .wfx-list-actions > .e-btn,
    .wfx-list-actions .wfx-document-list-primary > .e-btn,
    .wfx-list-actions .pager-display > .e-btn,
    .wfx-list-actions .wfx-list-search-launcher-row > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn,
    .wfx-list-grid-toolbar .wfx-list-search-launcher-row > .e-btn
):not(:disabled, .e-disabled, [aria-disabled="true"]):is(:hover, .e-active, [aria-expanded="true"]) {
    border-color: var(--list-accent) !important;
    background: var(--list-button-hover, var(--list-hover)) !important;
}

:is(
    .wfx-list-actions > .e-btn,
    .wfx-list-actions .wfx-document-list-primary > .e-btn,
    .wfx-list-actions .pager-display > .e-btn,
    .wfx-list-actions .wfx-list-search-launcher-row > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn,
    .wfx-list-grid-toolbar .wfx-list-search-launcher-row > .e-btn
):focus-visible {
    outline: 2px solid var(--list-accent);
    outline-offset: -2px;
}

:is(
    .wfx-list-actions > .e-btn,
    .wfx-list-actions .wfx-document-list-primary > .e-btn,
    .wfx-list-actions .pager-display > .e-btn,
    .wfx-list-actions .wfx-list-search-launcher-row > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn,
    .wfx-list-grid-toolbar .wfx-list-search-launcher-row > .e-btn
):is(:disabled, .e-disabled, [aria-disabled="true"]),
.wfx-list-grid-toolbar .e-toolbar-item.e-overlay > .e-btn {
    --list-button-bg: var(--list-surface);
    --list-button-text: var(--list-muted);
    --list-button-border: var(--list-border);
    opacity: .55;
    box-shadow: none;
}

/* Normalize only action glyphs. Native dropdown carets retain their own sizing
   and e-caret-hide behavior, as do active-filter glyphs' semantic colors. */
:is(
    .wfx-list-actions > .e-btn,
    .wfx-list-actions .wfx-document-list-primary > .e-btn,
    .wfx-list-actions .pager-display > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
    .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn
) > .e-btn-icon:not(.e-caret) {
    font-size: 18px !important;
    line-height: 20px !important;
}

@media (prefers-reduced-motion: reduce) {
    :is(
        .wfx-list-actions > .e-btn,
        .wfx-list-actions .wfx-document-list-primary > .e-btn,
        .wfx-list-actions .pager-display > .e-btn,
        .wfx-list-actions .wfx-list-search-launcher-row > .e-btn,
        .wfx-list-grid-toolbar .e-toolbar-item > .e-btn,
        .wfx-list-grid-toolbar .e-toolbar-item > div > .e-btn,
        .wfx-list-grid-toolbar .wfx-list-search-launcher-row > .e-btn
    ) {
        transition: none !important;
    }
}

@media (forced-colors: active) {
    .wfx-list-actions,
    .wfx-list-grid-toolbar {
        --list-surface: Canvas;
        --list-hover: Canvas;
        --list-border: ButtonText;
        --list-text: CanvasText;
        --list-muted: GrayText;
        --list-accent: Highlight;
        --list-success-bg: Canvas;
        --list-success-hover: Canvas;
        --list-success-border: Highlight;
        --list-success-text: CanvasText;
    }
}
