.head.tools {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 24px;
  min-height: 36px;
}
.head.tools > div:first-child {
  display: contents;
}
.head.tools .lead {
  grid-row: 2;
  grid-column: 1 / -1;
}
.head.tools > .filters {
  grid-row: 1;
  grid-column: 2;
  justify-content: flex-end;
}
.head.tools > .filters:last-child {
  grid-column: 2 / -1;
}
.head.tools > .actions {
  grid-row: 1;
  grid-column: 3;
}

/* lists: filters above, rows load on scroll */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  display: block;
}
/* a tab's filter row sticks together with the tabs */
.tab-body .filters {
  position: sticky;
  top: calc(56px + var(--head, 0px) + var(--tabs, 0px));
  z-index: 8;
  margin-block: -8px;
  padding-block: 8px;
  background: var(--bg);
}
.filters .search {
  flex: 1 1 240px;
  max-width: 360px;
}
.search .ic {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}
label.search input[type="search"] {
  padding-left: 32px;
}
.filters .select {
  flex: none;
}
.filters .end {
  margin-left: auto;
}
.vsearch .search {
  width: min(280px, 100%);
}

@media (max-width: 760px) {
  .head.tools {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 12px;
  }
  .head.tools > .filters {
    grid-row: 3;
    grid-column: 1 / -1;
  }
  .head.tools > .actions {
    grid-column: 2;
    width: auto;
  }
  .filters .search {
    max-width: none;
    flex-basis: 100%;
  }
  /* the filters share one row under the search, and only the search stays once the head sticks */
  .filters .select {
    flex: 1 1 0;
  }
  .filters .select > button {
    gap: 4px;
    padding-inline: 8px;
  }
  .head.tools.stuck > .filters > .select {
    display: none;
  }
}

/* the rarer filters sit behind one button; it lights up while any of them is set */
.filter-more > .pop:popover-open {
  display: block;
  width: min(260px, calc(100vw - 32px));
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 6px;
}
.filter-more .pop-label:not(:first-child) {
  margin-top: 10px;
}
.filter-more .pop-item {
  width: 100%;
  min-height: 30px;
  font-size: 12px;
}
/* the filter menu's button, dressed like the selects beside it */
.field-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line2);
  background: var(--field);
  white-space: nowrap;
  cursor: pointer;
}
.field-btn:focus-visible,
.field-btn:has(+ .pop:popover-open) {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--accbg);
}
.field-btn:disabled {
  color: var(--muted);
  cursor: default;
}
.filter-more > .field-btn.on {
  color: var(--acc);
}
