/* No separate mobile DOM: original cells and controls become cards on phones. */
.mc-toolbar,
.mc-table > :is(tbody, tfoot) > tr > .mc-details {
    display: none;
}

@media screen and (max-width: 767.98px) {
    .mc-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
        justify-content: space-between;
        gap: .75rem;
        padding: .75rem .25rem;
        position: sticky;
        left: 0;
        width: 100%;
    }

    .mc-toolbar .mc-view-switch {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: auto !important;
    }
    .mc-toolbar .mc-view-switch .btn { min-width: 5rem; width: auto !important; }
    .mc-sort { flex: 1 1 11rem; max-width: 100%; font-size: .8rem; color: #495057; }
    .mc-sort select { margin-top: .25rem; }

    .table-responsive:has(> .mc-cards) {
        overflow: visible;
        max-height: none !important;
    }

    table.mc-table.mc-cards,
    table.mc-table.mc-cards > :is(tbody, tfoot) {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
        border: 0;
        background: transparent;
        overflow: visible;
    }

    table.mc-cards > thead {
        /* Keep real header associations available to screen readers. */
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    table.mc-cards > :is(tbody, tfoot) > tr:not([hidden]):not(.collapse):not(.collapsing),
    table.mc-cards > :is(tbody, tfoot) > tr.collapse.show {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 .75rem;
        margin: 0 0 .85rem;
        padding: .8rem 1rem;
        border: 1px solid #dce3ec;
        border-radius: .85rem;
        background: var(--bs-body-bg, #fff);
        box-shadow: 0 2px 6px rgba(26, 48, 80, .05);
        transform: none !important;
    }

    table.mc-cards > :is(tbody, tfoot) > tr[data-mobile-context]:not([data-mobile-context=""])::before {
        content: attr(data-mobile-context);
        grid-column: 1 / -1;
        font-weight: 600;
        padding: .25rem 0 .5rem;
        overflow-wrap: anywhere;
    }

    table.mc-table.mc-cards > :is(tbody, tfoot) > tr > :is(td, th) {
        display: block;
        min-width: 0 !important;
        max-width: 100% !important;
        width: auto !important;
        padding: .45rem 0;
        border: 0;
        box-shadow: none;
        background: transparent;
        position: static;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: normal;
        text-align: left !important;
        font-size: .95rem;
    }

    table.mc-cards > :is(tbody, tfoot) > tr > :is(td, th)::before {
        content: attr(data-mobile-label);
        display: block;
        margin-bottom: .2rem;
        color: #5c6675;
        font-size: .75rem;
        font-weight: 400;
        line-height: 1.35;
        text-transform: none;
        text-shadow: none;
    }

    table.mc-table.mc-cards > :is(tbody, tfoot) > tr > .mc-title {
        grid-column: 1 / -1;
        padding-bottom: .65rem;
        border-bottom: 1px solid #edf0f4;
        margin-bottom: .25rem;
        font-weight: 600;
        font-size: 1rem;
        color: var(--bs-body-color, #212529);
        order: -1;
    }

    table.mc-cards .mc-title > a { display: inline-block; padding-block: .3rem; }
    table.mc-cards > :is(tbody, tfoot) > tr > :is(.mc-actions, .mc-details) { grid-column: 1 / -1; }
    table.mc-cards > :is(tbody, tfoot) > tr > .mc-details::before { content: none; }
    table.mc-table.mc-cards > :is(tbody, tfoot) > tr:not(.mc-expanded) > .mc-secondary { display: none; }
    table.mc-cards .mc-details-button { width: 100%; }
    table.mc-cards :is(.form-control, .form-select) { min-width: 0 !important; width: 100%; }
    table.mc-cards .btn-group { flex-wrap: wrap; }
    table.mc-cards :is(.text-nowrap, .text-truncate) { white-space: normal !important; overflow-wrap: anywhere; }
    table.mc-cards > :is(tbody, tfoot) > tr > [colspan]:not([colspan="1"]) { grid-column: 1 / -1; }
}
