/* Keep document layout inside the phone; wide data scrolls in its own region.
   Do not mask document overflow: content and controls must remain reachable. */
@media (max-width: 800px) {
    html, body { width:100%; max-width:100%; min-width:0; }
    body, body *, body *::before, body *::after { box-sizing:border-box; }
    body :is(main, section, article, form, fieldset),
    body :is(.lm-main,.lm-content,.admin-main,.admin-content,.tools-shell,.progress-shell,.planner-shell,.recipe-container,.account-public,.lm-guide-shell) {
        min-width:0; max-width:100%;
    }
    body :is(.tools-grid,.progress-grid,.account-grid,.kitchen-form,.recipe-grid,.recipe-cooking-grid,.recipe-detail-hero,.admin-form-grid,.lm-top-grid,.lm-target-row,.staff-chat-layout) > * {
        min-width:0;
    }
    body :is(p,h1,h2,h3,h4,li,dt,dd,label,a,button,summary,figcaption) { overflow-wrap:anywhere; }
    body :is(input,select,textarea,button) { max-width:100%; }
    body :is(input,select,textarea) { min-width:0; }
    body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea) { font-size:16px; }
    body button { white-space:normal; }
    body :is(img,video,canvas,svg,iframe) { max-width:100%; }
    body :is(img,video) { height:auto; }
    body pre { max-width:100%; overflow:auto; }
    body fieldset { margin-inline:0; }
    body dialog { box-sizing:border-box; max-width:calc(100% - 24px); }
    body :is(.tools-scroll,.progress-scroll,.admin-table-wrapper,.admin-table-wrap,.recipe-table-wrapper,.discount-table-wrap,.access-table-wrap,.lm-table-scroll) {
        min-width:0; max-width:100%;
    }
    body .lm-table-scroll {
        width:100%; overflow-x:auto; overscroll-behavior-x:contain;
        -webkit-overflow-scrolling:touch; touch-action:pan-x pan-y;
    }
    .lm-table-scroll[data-mobile-overflow=true]::before {
        content:'Swipe sideways to see the full table →';
        position:sticky; left:0; display:block; width:fit-content; max-width:100%;
        padding:8px 2px; font-size:12px; line-height:1.5; color:#526b47;
    }
    .lm-table-scroll:focus-visible { outline:2px solid #68a94c; outline-offset:3px; }
    /* Existing sample-plan rows already contain labelled meal cells: preserve
       those cards and let customers swipe between days instead of the page. */
    body .sample-week-table { overflow:visible; }
    body .sample-week-table table { display:block; min-width:0; width:100%; }
    body .sample-week-table tbody {
        display:flex; gap:12px; width:100%; max-width:100%; overflow-x:auto;
        scroll-snap-type:x proximity; overscroll-behavior-x:contain;
        -webkit-overflow-scrolling:touch; padding-bottom:12px;
    }
    body .sample-week-table tbody tr {
        display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
        flex:0 0 calc(100% - 20px); min-width:0; max-width:100%;
        scroll-snap-align:start; align-content:start;
        margin:0; border:1px solid #d7e3d2; border-radius:14px; background:#fff;
    }
    body .sample-week-table tbody th { grid-column:1/-1; background:#edf5e8; }
    body .sample-week-table tbody td { display:block; overflow-wrap:anywhere; }
    body .sample-week-table tbody td::before { content:attr(data-label); display:block; font-size:12px; font-weight:700; color:#526b47; margin-bottom:6px; }
    body .sample-week-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
    .sample-week-table.lm-swipe-days::before { content:'Swipe to see each day →'; display:block; padding:8px 0; font-size:12px; color:#526b47; }
}
@media print {
    .lm-table-scroll { overflow:visible!important; }
    .lm-table-scroll::before,.sample-week-table.lm-swipe-days::before { display:none!important; }
}
