/* Mobile UX fixes across the app */

@media (max-width: 768px) {
    /* Prevent iOS zoom and fix scroll lock issues */
    input, select, textarea, button {
        font-size: 16px;
    }

    body.h-screen {
        height: auto !important;
    }

    body.overflow-hidden {
        overflow: auto !important;
    }

    /* Sidebar layout safety */
    main {
        min-width: 0;
        overflow: visible !important;
    }

    /* Tables */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.mobile-stack thead {
        display: none;
    }

    table.mobile-stack,
    table.mobile-stack tbody,
    table.mobile-stack tr,
    table.mobile-stack td {
        display: block;
        width: 100%;
    }

    table.mobile-stack tr {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 0.75rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    table.mobile-stack td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.35rem 0;
        white-space: normal;
        border: none !important;
    }

    table.mobile-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        flex: 0 0 45%;
    }

    /* Modals and fixed-width panels */
    .w-96, .w-80, .w-72, .w-64, .w-60, .w-56, .w-48, .w-40, .w-32 {
        width: 100% !important;
        max-width: 100% !important;
    }

    .w-1\/2, .w-1\/3, .w-2\/3, .w-1\/4, .w-3\/4 {
        width: 100% !important;
    }

    .max-w-sm, .max-w-md, .max-w-lg, .max-w-xl, .max-w-2xl, .max-w-3xl, .max-w-4xl, .max-w-5xl, .max-w-6xl, .max-w-7xl {
        max-width: 100% !important;
    }

    .h-\[80vh\] {
        height: 70vh !important;
    }

    .h-\[90vh\] {
        height: 75vh !important;
    }

    .sticky {
        position: static !important;
    }

    .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-cols-6 {
        grid-template-columns: 1fr !important;
    }

    /* Client portal nav */
    .client-nav .client-nav-inner {
        flex-direction: column;
        height: auto;
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .selection-viewer {
        height: 60vh !important;
    }

    /* Diagnostic overlay */
    #diagLog {
        width: 90vw !important;
        max-height: 60vh !important;
        right: 5vw !important;
    }
}
