/* Keep the agreed thin person / month / more row. Only the sheet itself zooms. */
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px) {
  .sales-statistics-page {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    min-height: 100dvh;
  }

  .sales-statistics-page .monthly-report-heading {
    /* The heading is inside the zoomed table wrapper: cancel that scale for legibility. */
    zoom: calc(1 / var(--sales-table-zoom, 1));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px 8px;
    color: var(--sales-clean-heading);
    background: #f5f8fd;
  }
  .sales-statistics-page .monthly-report-context {
    gap: 6px;
    min-width: 0;
    line-height: 18px;
  }
  .sales-statistics-page .monthly-report-context h3 {
    font-size: 13px !important;
    line-height: 18px;
    font-weight: 600;
  }
  .sales-statistics-page .monthly-report-context > .whitespace-nowrap {
    font-size: 10px !important;
    line-height: 16px;
    padding: 0 5px;
  }
  .sales-statistics-page .monthly-report-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    width: 100%;
    min-width: 0;
    font-size: 12px;
    line-height: 18px;
  }
  .sales-statistics-page .monthly-metric {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .sales-statistics-page .monthly-metric strong {
    margin-left: auto;
    max-width: 100%;
    font-size: 13px;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .sales-statistics-page .monthly-report-heading [data-testid='selection-sum'] {
    order: 3;
    flex-basis: auto;
    flex-wrap: wrap;
    gap: 2px 12px;
    font-size: 12px;
    line-height: 18px;
  }

  /* Expanded tools stay easy to tap even when the data grid is zoomed down. */
  .sales-statistics-page .sales-business-header .sales-header-tools {
    zoom: 1;
    gap: 8px;
    margin-top: 4px;
    padding: 8px;
  }
  .sales-statistics-page .sales-header-tools > div { gap: 8px; }
  .sales-statistics-page .sales-header-tools :where(button, a[data-slot='button'], select) {
    min-height: 44px;
    min-width: 44px;
  }
  .sales-statistics-page .sales-header-tools .sheet-action-button { width: 44px; height: 44px; }
  .sales-statistics-page .sales-header-tools select { font-size: 16px !important; }
  .sales-statistics-page .sales-header-tools .sales-header-date {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}

@media (min-width: 600px) and (max-width: 1023px) and (max-height: 500px) {
  .sales-statistics-page .monthly-report-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
