/* Extend the existing phone toolbar to larger touch-based inner screens. */
@media (pointer: coarse) and (min-width: 768px) and (max-width: 1200px) {
  .sales-statistics-page { padding: 2px 6px 6px; }
  .sales-statistics-page > div { gap: 2px; }
  .sales-theme-clean-business .sales-business-header {
    display: block; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none;
  }
  .sales-business-header .sales-header-identity,
  .sales-statistics-page .sales-sheet-tabs { display: none; }

  .sales-business-header .sales-mobile-quickbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 44px;
    align-items: center; gap: 4px; padding: 0;
    border: 0; border-radius: 0; background: transparent;
  }
  .sales-mobile-quickbar [data-slot='native-select-wrapper'] { min-width: 0; width: 100%; }
  .sales-statistics-page .sales-mobile-quickbar :where(select, button) {
    width: 100%; min-width: 0; height: 32px; margin: 0; padding: 0 6px;
    border: 0; border-radius: 4px; background: transparent; box-shadow: none;
    color: var(--sales-clean-text, #24416d);
    /* Dense reading toolbar: scale labels, retain 32px targets and generous expanded tools. */
    font-size: clamp(11px, calc(14px * var(--sales-table-zoom, 1)), 16px) !important;
    line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    touch-action: manipulation; cursor: pointer;
  }
  .sales-statistics-page .sales-mobile-quickbar select { padding-right: 20px; }
  .sales-mobile-quickbar [data-slot='native-select-icon'] { right: 4px; width: 12px; }
  .sales-mobile-quickbar .sales-mobile-tools-toggle { color: #1d4ed8; font-weight: 600; padding: 0 3px; background: #eaf1ff; }
  .sales-mobile-quickbar :where(select, button):focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
  .sales-mobile-quickbar :where(select, button):active { background: #e4eeff; }

  .sales-business-header .sales-header-tools {
    zoom: var(--sales-table-zoom, 1);
    width: 100%; min-width: 0; margin-top: 8px; padding: 8px;
    gap: max(8px, calc(8px / var(--sales-table-zoom, 1)));
    border: 1px solid var(--sales-clean-border); border-radius: 8px; background: #f6f9ff;
  }
  .sales-business-header:not([data-mobile-tools-open='true']) .sales-header-tools { display: none; }
  .sales-business-header .sales-header-tools > div {
    max-width: 100%; flex-wrap: wrap;
    gap: max(8px, calc(8px / var(--sales-table-zoom, 1)));
  }
  .sales-business-header .sales-header-tools :where(button, a[data-slot='button'], select) {
    min-height: calc(44px / var(--sales-table-zoom, 1));
    min-width: calc(44px / var(--sales-table-zoom, 1));
    height: auto; touch-action: manipulation;
  }
  .sales-business-header .sales-header-tools select {
    min-width: 0; font-size: 16px !important; padding-left: 8px; padding-right: 28px;
  }
  .sales-business-header .sales-header-tools .sales-header-date {
    display: grid;
    grid-template-columns: max(88px, calc(48px / var(--sales-table-zoom, 1))) minmax(0, 1fr);
    width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none;
  }
  .sales-header-date > svg { display: none; }
  .sales-header-date [data-slot='native-select-wrapper'] {
    min-width: 0; width: 100%; border: 1px solid var(--sales-clean-border-soft); border-radius: 8px; background: #fff;
  }
  .sales-header-date[data-period-mode='all'] { grid-template-columns: minmax(0, 1fr) !important; }
  .sales-header-date[data-period-mode='custom'] { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important; }
  .sales-header-date[data-period-mode='custom'] > [data-slot='native-select-wrapper']:first-of-type { grid-column: 1 / -1; }
  .sales-statistics-page .sales-workbook-panel { padding: 0; border: 0; border-radius: 8px; box-shadow: none; }
  .sales-statistics-page .sales-workbook-panel::before { display: none; }
  /* 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);
  }
}
/* Compact visual polish only; retain the current table font, zoom and data. */
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px), (pointer: coarse) and (max-width: 1200px) {
  .sales-statistics-page .sales-business-header .sales-mobile-quickbar {
    grid-template-columns: minmax(0, 120px) minmax(0, 144px) minmax(0, 1fr) 44px;
    column-gap: 4px;
  }
  .sales-mobile-quickbar > :nth-child(1) { grid-column: 1; }
  .sales-mobile-quickbar > :nth-child(2) { grid-column: 2; }
  .sales-statistics-page .sales-mobile-quickbar .sales-mobile-tools-toggle { grid-column: 4; }
  .sales-statistics-page .monthly-report-heading {
    gap: 0;
    padding: 0 8px 2px;
    border-radius: 6px 6px 0 0;
  }
  .sales-statistics-page .monthly-report-heading[data-summary-open='false'] { padding-bottom: 0; }
  .sales-statistics-page .monthly-report-heading[data-summary-open] .monthly-report-context { min-height: 44px; }
  .sales-statistics-page .sales-monthly-summary-toggle { height: 100%; }
  .sales-statistics-page .monthly-report-context { column-gap: 8px; }
  .sales-statistics-page .monthly-report-context > .whitespace-nowrap {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    color: var(--monthly-label);
    font-weight: 400;
  }
  .sales-statistics-page .monthly-report-context > .whitespace-nowrap + .whitespace-nowrap::before {
    content: '·';
    margin-right: 6px;
  }
  .sales-statistics-page .monthly-report-metrics { row-gap: 2px; }
}
