/* List page template (A21; macros/pr/list_page.html).
   Header (count, scope, the one primary action), toolbar (search, filter
   chips, Clear filters, Columns, Export), body (table or a state in a card),
   pager. Every state keeps the header in place so nothing jumps.
   Tablet: columns marked drop=True leave the table (components/table.css).
   Phone: filters scroll sideways in one row, Columns goes (cards have no
   columns), the pager becomes "Load more", and the primary action is pinned
   at the bottom of main, which ends above the tab bar. */

.pr-listpage { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pr-space-lg); }
.pr-listpage > * { min-width: 0; }

.pr-listpage__head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--pr-space-md); }
.pr-listpage__meta {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-wrap: wrap; gap: var(--pr-space-xs) var(--pr-space-md);
  font-size: 0.75rem; line-height: 1.4; color: var(--pr-text-secondary);
}
.pr-listpage__primary { flex: none; }

.pr-listpage__bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--pr-space-sm); }
.pr-listpage__search { flex: 0 1 280px; min-width: 200px; margin: 0; }
.pr-listpage__search .pr-input { height: var(--pr-density-standard-control); }
.pr-listpage__search input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.pr-listpage__filters { display: flex; align-items: center; gap: var(--pr-space-sm); min-width: 0; }
.pr-listpage__filters .pr-chip { min-height: 32px; }
.pr-listpage__clear { font-size: 0.85rem; white-space: nowrap; }
.pr-listpage__tools { display: flex; align-items: center; gap: var(--pr-space-sm); margin-left: auto; }

.pr-listpage__body.pr-card { padding: var(--pr-space-lg) var(--pr-space-xl); }
.pr-listpage__body .pr-empty { padding: var(--pr-space-2xl) var(--pr-space-xl); }
.pr-listpage__body .pr-skel-list { padding: var(--pr-space-sm) 0; gap: var(--pr-space-xl); }

.pr-listpage__pager { display: flex; align-items: center; justify-content: flex-end; gap: var(--pr-space-sm); font-size: 0.75rem; color: var(--pr-text-caption); }
.pr-listpage__steps { display: inline-flex; gap: var(--pr-space-sm); }
.pr-listpage__more { display: none; }
/* Sort is a phone control: the table's sortable headers are hidden there. */
.pr-listpage__sort { display: none; }

/* The pinned copy of the primary action exists for phones only. */
.pr-listpage__pin { display: none; }

@media (max-width: 768px) {
  .pr-listpage { gap: var(--pr-space-md); }
  .pr-listpage__primary { display: none; }
  .pr-listpage__search { flex: 1 1 100%; min-width: 0; }
  .pr-listpage__search .pr-input { height: 48px; }
  /* One row of chips that scrolls sideways; the page itself never does. */
  .pr-listpage__filters {
    flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    padding: 2px;
  }
  .pr-listpage__filters::-webkit-scrollbar { display: none; }
  .pr-listpage__filters .pr-chip { max-width: none; flex: none; }
  .pr-listpage__filters .pr-chip { min-height: var(--pr-touch-target); }
  .pr-listpage__clear { display: inline-flex; align-items: center; min-height: var(--pr-touch-target); padding: 0 var(--pr-space-xs); }
  .pr-listpage__sort { display: block; flex: none; width: auto; }
  .pr-listpage__sort > select.pr-input { height: var(--pr-touch-target); width: auto; padding-left: var(--pr-space-md); border-radius: var(--pr-radius-pill); background: var(--pr-surface-nested); font-size: 0.85rem; }
  .pr-listpage__tools { margin-left: 0; }
  .pr-listpage__tools:not(:has(> :not(.pr-listpage__desk))) { display: none; }
  .pr-listpage__desk { display: none; }
  .pr-listpage__body.pr-card { padding: var(--pr-space-md); }
  .pr-listpage__body:not(.pr-card) .pr-table-wrap { border-radius: var(--pr-radius-md); }
  .pr-listpage__pager { justify-content: center; flex-direction: column; gap: var(--pr-space-sm); }
  .pr-listpage__steps { display: none; }
  .pr-listpage__more { display: inline-flex; width: 100%; }
  .pr-listpage__pin {
    display: block;
    position: sticky; bottom: 0; z-index: var(--pr-z-sticky);
    padding: var(--pr-space-sm) 0 calc(var(--pr-space-sm) + env(safe-area-inset-bottom, 0px));
    background: var(--pr-surface-page);
  }
  .pr-listpage__pin .pr-btn { width: 100%; height: 48px; }
}
