/* Mobile-only compatibility layer for the running frontend. No business scripts change. */
@media (max-width: 720px) {
    html .creation-model-picker-surface .creation-model-picker-menu.is-model-list .canvas-model-picker-two-pane,
    html .canvas-model-picker-menu.is-model-list .canvas-model-picker-two-pane {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        min-width: 0;
        min-height: 0;
        gap: 8px;
    }

    html .creation-model-picker-surface .creation-model-picker-menu.is-model-list .canvas-model-picker-brand-rail,
    html .canvas-model-picker-menu.is-model-list .canvas-model-picker-brand-rail {
        display: flex;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        align-content: start;
        gap: 4px;
        padding: 0 0 8px;
        border-right: 0;
        border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    html .canvas-model-picker-menu.is-model-list .canvas-model-picker-brand-rail .canvas-model-picker-brand {
        width: 144px;
        min-height: 44px;
        flex: 0 0 144px;
        padding: 8px;
        gap: 8px;
    }

    html .canvas-model-picker-brand-rail .canvas-model-picker-brand-arrow,
    html .canvas-model-picker-brand-rail .model-picker-availability-track {
        display: none;
    }

    html .canvas-model-picker-menu.is-model-list .canvas-model-picker-model-pane {
        min-width: 0;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }
}

@media (max-width: 639px) {
    html [data-admin-root] .admin-page-root,
    html [data-admin-root] .admin-page-root > div,
    html [data-admin-root] .admin-data-table,
    html [data-admin-root] .admin-list-toolbar-main,
    html [data-admin-root] .admin-list-toolbar-actions,
    html [data-admin-root] .admin-table-frame,
    html [data-admin-root] .admin-table-surface,
    html [data-admin-root] .admin-table-surface .ant-table-wrapper {
        min-width: 0;
        max-width: 100%;
    }

    html [data-admin-root] .admin-page-frame {
        padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    }

    html [data-admin-root] .admin-page-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        min-height: 0;
        gap: 8px !important;
        margin-bottom: 8px;
    }

    html [data-admin-root] .admin-page-title {
        font-size: 14px;
    }

    html [data-admin-root] .admin-page-description {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    html [data-admin-root] .admin-page-actions {
        width: auto;
        max-width: 100%;
        gap: 4px !important;
    }

    html [data-admin-root] .admin-page-actions:has(.ant-btn) {
        grid-column: 1 / -1;
    }

    html [data-admin-root] .admin-density-toggle {
        width: 32px;
        justify-content: center;
        padding: 0;
        font-size: 0;
        gap: 0;
    }

    html [data-admin-root] .admin-list-toolbar {
        gap: 4px;
        padding: 0;
    }

    html [data-admin-root] .admin-list-toolbar-main {
        width: 100%;
        gap: 8px;
    }

    html [data-admin-root] .admin-list-toolbar-filters {
        padding: 0;
        gap: 8px;
    }

    html [data-admin-root] .admin-list-toolbar-filters > .ant-select {
        min-width: 0;
        flex: 1 1 0;
        width: 0;
    }

    html [data-admin-root] .admin-table-pagination {
        min-height: 40px;
        padding: 4px 8px;
    }

    html [data-admin-root] .admin-pagination-bar {
        width: 100%;
        flex-wrap: wrap;
        gap: 4px 8px;
        padding: 0;
    }

    html [data-admin-root] .admin-pagination-total {
        width: auto;
        flex: 1 1 auto;
    }

    html [data-admin-root] .admin-pagination-size {
        width: 96px;
    }

    html [data-admin-root] .admin-pagination-pages {
        margin-left: auto;
    }

    html [data-admin-root] .admin-pagination-pages > button:not([aria-label], [aria-current]),
    html [data-admin-root] .admin-pagination-ellipsis {
        display: none;
    }

    /* Retain the existing buttons, accessible names, confirmation and event handlers. */
    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-cell-fix-left,
    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-cell-fix-left-last {
        position: static !important;
        left: auto !important;
    }

    html [data-admin-root] .admin-all-models colgroup col:last-child {
        width: 76px !important;
        min-width: 76px !important;
    }

    html [data-admin-root] .admin-channel-model-manager colgroup col:last-child {
        width: 88px !important;
        min-width: 88px !important;
    }

    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-tbody > tr > td:last-child {
        padding-inline: 6px;
    }

    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-tbody > tr > td:last-child .ant-space {
        width: 64px;
        flex-wrap: wrap;
        gap: 4px !important;
    }

    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-tbody > tr > td:last-child .ant-btn {
        width: 30px;
        min-width: 30px;
        height: 30px;
        padding: 0;
        gap: 0;
        font-size: 0;
    }

    html [data-admin-root] :is(.admin-all-models, .admin-channel-model-manager) .ant-table-tbody > tr > td:last-child .ant-btn > span:not(.ant-btn-icon) {
        font-size: 0;
    }
}
