/* Shared listing chrome — aligned with Service Orders / Dashboard tables */

.elev-listing-page {
    position: relative;
    display: grid;
    gap: 1.5rem;
    align-content: start;
}

/* Absolute loading covers the shell content area without stretching the listing grid. */
.elev-listing-page > .elev-page-loading-overlay.mud-overlay {
    position: fixed !important;
    top: var(--elev-topbar-height) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: var(--elev-sidebar-collapsed-width) !important;
    width: auto !important;
    height: auto !important;
    border-radius: 1.25rem 0 0 0;
}

body:has(.sidebar:hover) .elev-listing-page > .elev-page-loading-overlay.mud-overlay,
body:has(.sidebar:focus-within) .elev-listing-page > .elev-page-loading-overlay.mud-overlay {
    left: var(--elev-sidebar-width) !important;
}

@media (max-width: 960px) {
    .elev-listing-page > .elev-page-loading-overlay.mud-overlay,
    body:has(.sidebar:hover) .elev-listing-page > .elev-page-loading-overlay.mud-overlay,
    body:has(.sidebar:focus-within) .elev-listing-page > .elev-page-loading-overlay.mud-overlay {
        left: 0 !important;
        border-radius: 0;
    }
}

.elev-listing-page .elev-page-heading {
    align-items: center;
    margin-bottom: 0 !important;
}

.elev-listing-page .service-orders-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.elev-listing-page .orders-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.elev-listing-page .orders-table-toolbar__controls {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.elev-listing-page .orders-search-field {
    flex: 0 1 19.5rem;
    width: 19.5rem;
    min-width: 12rem;
    max-width: 20.8rem;
}

.elev-listing-page .orders-table-card .mud-table-container {
    overflow-x: auto;
}

.elev-listing-page .orders-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

/* Desktop: shrink-wrap actions (do not absorb leftover table width) */
.elev-listing-page .orders-table-card .mud-table-head .mud-table-cell.orders-table-cell--actions,
.elev-listing-page .orders-table-card .mud-table-body .mud-table-cell.orders-table-cell--actions,
.elev-listing-page .orders-table-card .service-orders-table .mud-table-cell:last-child {
    width: 3.5rem !important;
    max-width: 3.5rem !important;
    min-width: 3.5rem !important;
    white-space: nowrap;
    text-align: right;
    padding-inline: 0.25rem 0.75rem !important;
    box-sizing: border-box;
}

/* Mud keeps mud-xs-table class always; stacked layout only applies under 600px */
@media (max-width: 600px) {
    .elev-listing-page .mud-xs-table .mud-table-body .mud-table-cell.orders-table-cell--actions,
    .elev-listing-page .mud-sm-table .mud-table-body .mud-table-cell.orders-table-cell--actions,
    .elev-listing-page .mud-md-table .mud-table-body .mud-table-cell.orders-table-cell--actions,
    .elev-listing-page .mud-xs-table .service-orders-table .mud-table-cell:last-child,
    .elev-listing-page .mud-sm-table .service-orders-table .mud-table-cell:last-child,
    .elev-listing-page .mud-md-table .service-orders-table .mud-table-cell:last-child {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        justify-content: flex-end;
        text-align: end !important;
    }

    .elev-listing-page .mud-xs-table .mud-table-body .mud-table-cell.orders-table-cell--actions::before,
    .elev-listing-page .mud-sm-table .mud-table-body .mud-table-cell.orders-table-cell--actions::before,
    .elev-listing-page .mud-md-table .mud-table-body .mud-table-cell.orders-table-cell--actions::before {
        content: none;
    }

    .elev-listing-page .mud-xs-table .mud-table-body .mud-table-cell.orders-table-cell--actions .orders-row-actions,
    .elev-listing-page .mud-sm-table .mud-table-body .mud-table-cell.orders-table-cell--actions .orders-row-actions,
    .elev-listing-page .mud-md-table .mud-table-body .mud-table-cell.orders-table-cell--actions .orders-row-actions {
        margin-inline-start: auto;
    }
}

.elev-listing-page .listing-org-cell {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
}

.elev-listing-page .listing-org-cell__primary {
    color: var(--elev-foreground);
    font-family: var(--elev-font-sans);
    font-size: var(--elev-text-sm-size);
    font-weight: 500;
    line-height: var(--elev-text-sm-line);
}

.elev-listing-page .listing-org-cell__secondary {
    color: var(--elev-muted);
    font-family: var(--elev-font-sans);
    font-size: var(--elev-text-xs-size);
    font-weight: 500;
    line-height: var(--elev-text-xs-line);
}
