/* Layout for the work surfaces inside the mobile shell. */
@media (max-width: 760px), (max-width: 960px) and (max-height: 540px) {
  .pd-shell .pc-log-list button,
  .pd-shell .pc-dept-open,
  .pd-shell .pd-tasks :is(.pd-action, .pd-detail, .pd-tabs button, .pd-legend button),
  .wi-shell :is(.wi-back, .wi-banner-link, .wi-segments button, .wi-tabs button, .wi-export, .wi-select select, .wi-month input),
  .dp79 :is(.dp79-refresh, .dp79-periods button, .dp79-primary),
  .wbf-page :is(.wbf-button, .wbf-expanded > summary),
  .sx-workbench :is(.sx-button, .sx-cycle-select select),
  .ma-page :is(.ma-back, .ma-button),
  .rwb-root :is(.rwb-button, .rwb-date-label input, .rwb-filter-row select, .rwb-filter-row input),
  .ec-desk :is(.ec-store-order.ec-button, .ec-shop-target-button, .ec-product-shop-filter select, .ec-store-tools .ec-button, .ec-month-label input) {
    min-height: 44px;
  }

  .wi-shell .wi-banner-links { min-width: 0; }
  .wi-shell .wi-select { min-width: 0; max-width: 100%; }
  .wi-shell .wi-filter-controls select { min-width: 0; max-width: 100%; }
  .wi-shell .wi-tabs button { flex: none; }
  .dp79 .dp79-custom label { min-width: 0; }

  .wbf-page .wbf-inbox-card > header,
  .wbf-page .wbf-pagination {
    flex-wrap: wrap;
  }
  .wbf-page .wbf-source-filter,
  .wbf-page .wbf-source-tag { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

  .sx-workbench .sx-cycle-bar { flex-wrap: wrap; padding-block: 10px; }
  .sx-workbench .sx-cycle-select { flex: 1 1 180px; }
  .sx-workbench .sx-cycle-select select { flex: 1; min-width: 0; max-width: 100%; }
  .sx-workbench .sx-cycle-tools { flex-wrap: wrap; gap: 6px 10px; }
  .sx-workbench .sx-cycle-date { display: inline; font-size: 12px; }

  /* The desktop side note contains the action for an outstanding analysis request. */
  .ma-detail-page aside.ma-simple-context {
    display: block;
    position: static;
    padding: 16px;
  }
  .ma-detail-page .ma-simple-context :is(p, .ma-context-bottom > p) {
    font-size: 13px;
    line-height: 1.65;
  }

  .ec-desk.rdc .ec-stores { height: auto; min-height: 0; }
  .ec-desk.rdc .ec-stores .rd51-heading,
  .ec-desk .ec-store-tools { flex-wrap: wrap; }
  .ec-desk .ec-shop-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    grid-auto-rows: auto;
    max-height: none;
    overflow: visible;
  }
  .ec-desk article.ec-store-card { height: auto; min-height: 176px; }
  .ec-desk .ec-store-head > strong,
  .ec-desk .ec-store-amount small {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .ec-desk .ec-shop-target-button { min-width: 44px; }
  .ec-desk .ec-filter-group { flex-wrap: wrap; }

  .rwb-root .rwb-summary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
    gap: 8px;
  }
  .rwb-root .rwb-metric { padding: 12px; }
  .rwb-root .rwb-metric > div { font-size: 13px; line-height: 1.45; }
  .rwb-root .rwb-metric small { font-size: 12px; line-height: 1.45; }
  .rwb-root .rwb-metric strong { overflow-wrap: anywhere; }
  .rwb-root .rwb-inline-actions { flex: 0 1 auto; max-width: 100%; }
  .rwb-root .rwb-record-bottom { flex-wrap: wrap; }
  .rwb-root .rwb-pagination { flex-wrap: wrap; }
  .rwb-root .rwb-pagination small { display: inline; font-size: 12px; }
  .rwb-root .rwb-button { font-size: 13px; }
}

@media (max-width: 480px) {
  .pd-shell .pd-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'title title' 'status time' 'action action';
    row-gap: 5px;
  }
  .pd-shell .pd-actions { flex-wrap: wrap; justify-content: flex-start; }
  .pd-shell .pd-time,
  .pd-shell .pd-meta { overflow-wrap: anywhere; }

  .dp79 .dp79-custom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .dp79 .dp79-custom label { max-width: none; }
  .dp79 .dp79-custom :is(button, small) { grid-column: 1 / -1; }
  .dp79 .dp79-custom input { box-sizing: border-box; width: 100%; }

  .rwb-root .rwb-header { flex-wrap: wrap; gap: 10px; }
  .rwb-root .rwb-header-actions {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
  }
  .rwb-root .rwb-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .rwb-root .rwb-station-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rwb-root .rwb-datebar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px auto;
    width: 100%;
    gap: 4px;
  }
  .rwb-root .rwb-date-label,
  .rwb-root .rwb-date-label input { min-width: 0; width: 100%; }
  .rwb-root .rwb-date-label input { box-sizing: border-box; }
}

@media (max-height: 540px) and (max-width: 960px) {
  /* On a landscape phone the report header scrolls away with its filters. */
  .wi-shell { display: block; overflow: auto; overscroll-behavior: contain; }
  .wi-shell .wi-scroll { overflow: visible; }
}
