/* Final compatibility overrides for legacy flex-based page components. */
@media (max-width: 980px) {
    .dashboard-hero,
    .admin-command-banner,
    .tracking-reference-hero,
    .returns-hero,
    .payments-reference-hero,
    .loadsheet-hero,
    .reports-hero,
    .shopify-integration-hero,
    .shopify-orders-hero,
    .awaiting-orders-hero,
    .bulk-booking-hero,
    .shipper-management-hero,
    .profile-hero {
        display: grid !important;
    }

    .tracking-filter-primary,
    .awaiting-filter-primary,
    .returns-filter-form,
    .ledger-filters,
    .admin-order-filters,
    .admin-merchant-performance-filters,
    .report-date-form,
    .report-filter-grid,
    .shopify-filter-grid,
    .shipper-search-form {
        display: grid !important;
    }

    .loadsheet-row {
        display: grid !important;
    }

    .report-donut-layout,
    .profile-information-grid,
    .shopify-integration-workflow,
    .merchant-performance-summary {
        display: grid !important;
    }

    .reports-hero-copy,
    .loadsheet-hero-copy,
    .shopify-integration-hero-copy,
    .admin-command-banner-copy,
    .tracking-reference-hero > div,
    .returns-hero > div,
    .payments-reference-hero > div,
    .shipper-management-hero-copy {
        min-width: 0;
    }

    .reports-hero-copy,
    .loadsheet-hero-copy {
        align-items: flex-start !important;
    }

    .shopify-integration-status,
    .bulk-booking-hero-points {
        max-width: 100%;
        flex-wrap: wrap;
    }

    .topbar-actions > .badge {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .dashboard-hero,
    .admin-command-banner,
    .tracking-reference-hero,
    .returns-hero,
    .payments-reference-hero,
    .loadsheet-hero,
    .reports-hero,
    .shopify-integration-hero,
    .shopify-orders-hero,
    .awaiting-orders-hero,
    .bulk-booking-hero,
    .shipper-management-hero,
    .profile-hero {
        border-radius: 10px !important;
    }

    .shopify-integration-status,
    .bulk-booking-hero-points {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .shopify-integration-status > *,
    .bulk-booking-hero-points > * {
        width: 100%;
        min-width: 0;
        text-align: center;
    }

    .admin-command-banner-period strong,
    .loadsheet-number,
    .live-order-tracking,
    .topbar-profile-copy strong,
    .topbar-profile-copy small {
        overflow-wrap: anywhere;
        white-space: normal;
    }

    .tracking-status-tabs,
    .awaiting-reason-tabs,
    .shopify-status-tabs,
    .report-range-presets,
    .profile-tabs {
        -webkit-overflow-scrolling: touch;
    }
}
