/* Dashboard mobile scroll fix · 2026-11-03
   The mobile header is the first grid row. Previously the dashboard content
   also used 100dvh, while body/layout clipped overflow and the table held
   a second vertical scroll. Give the header its own row and make the
   remaining dashboard content the sole vertical scroll container.
   Scope strictly to dashboard; leave order management and desktop untouched. */
@media (max-width: 900px) {
  #app > .layout:has(> .content > .dashboard-table-panel) {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: calc(56px + env(safe-area-inset-top)) minmax(0, 1fr);
    grid-auto-rows: auto;
    align-content: stretch;
  }

  #app > .layout:has(> .content > .dashboard-table-panel) > .mobile-app-header {
    grid-column: 1;
    grid-row: 1;
  }

  #app > .layout:has(> .content > .dashboard-table-panel) > .content {
    grid-column: 1;
    grid-row: 2;
    display: block;
    height: auto;
    min-height: 0;
    min-width: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  /* The table remains horizontally scrollable, but does not trap vertical swipes. */
  #app > .layout > .content:has(> .dashboard-table-panel) > .dashboard-table-panel {
    display: block;
    flex: none;
    height: auto;
    min-height: 0;
    max-height: none;
    /* overflow-x:auto makes overflow-y:visible compute to auto.
       Do not retain the base dashboard panel's overscroll-behavior:contain:
       it traps vertical swipes inside the horizontal-scrolling table. */
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
  }

  #app > .layout > .content:has(> .dashboard-table-panel) > .admin-pagination {
    flex: none;
    margin-bottom: 12px;
  }
}
