/* Search events: inline decision actions, selection, bulk bar, keyboard row. */
.search-select { margin: 0 0 var(--sp-1); }
.search-table .select-col, .search-table .select-cell { width: var(--touch-target); padding-left: var(--sp-1); padding-right: var(--sp-1); }
.select-hit {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--touch-target); min-height: var(--touch-target); margin: calc(-1 * var(--sp-2)) 0; cursor: pointer; border-radius: var(--radius-md);
}
.select-hit:hover { background: var(--surface-2); }
.select-hit input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); margin: 0; }

.search-row { outline: none; }
.search-row.is-selected { background: var(--accent-soft); }
.search-row.is-current { box-shadow: inset 4px 0 0 var(--accent); }
.search-row.is-current td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.search-row:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.search-row[aria-busy="true"] { opacity: .75; }

.decision-cell { min-width: 12rem; }
.decision-cell .badges { margin: 0 0 var(--sp-1); }
.decision-reason { margin-bottom: var(--sp-1); overflow-wrap: anywhere; }
.badge-past { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: flex-start; }
.row-actions .btn { white-space: nowrap; }
.row-more { position: relative; }
.row-more > summary { list-style: none; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more[open] > summary { margin-bottom: 0; background: var(--surface-2); }
.row-more-menu {
  display: flex; flex-direction: column; gap: var(--sp-1); margin-top: var(--sp-1); padding: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  min-width: 12rem; max-width: 18rem;
}
.row-error { margin: var(--sp-1) 0 0; }

.search-bulk-bar[aria-busy="true"] { cursor: progress; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.bulk-error { flex-basis: 100%; margin: 0; }

/* Touch: every action is at least 44 × 44 px; phones stack rows (components.css) so actions wrap, never scroll sideways. */
@media (max-width: 700px), (pointer: coarse) {
  .row-actions .btn, .row-more > summary, .row-more-menu .btn, .search-bulk-bar .btn, .search-select .btn { min-height: var(--touch-target); min-width: var(--touch-target); }
}
@media (max-width: 700px) {
  /* Checkbox in the card's top-right corner instead of a row of its own. */
  .search-table tr { position: relative; }
  .table-wrap .search-table td.select-cell { position: absolute; top: .2rem; right: .2rem; left: auto; width: auto; padding: 0; }
  .search-table .select-cell .select-hit { margin: 0; }
  .table-wrap .search-table td[data-label="When"] { padding-right: var(--sp-8); }
  .decision-cell { min-width: 0; }
  .row-actions .btn { flex: 1 1 auto; }
  .row-more { flex: 1 1 100%; }
  .row-more > summary { width: 100%; }
  .row-more-menu { max-width: none; }
  .row-more-menu .btn { white-space: normal; }
  .bulk-actions { width: 100%; }
  .bulk-actions .btn { flex: 1 1 calc(50% - .4rem); }
}

/* When filter (always visible), "Delete all matching" and the "Recently deleted" dialog list. */
.search-when-row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.search-when { display: flex; align-items: center; gap: var(--sp-2); }
.search-when label { font-weight: var(--fw-semibold); }
.search-delete-row { align-items: center; margin: 0; }
.search-delete-row p { margin: 0; }
.deleted-list li.deleted-item { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
.deleted-list li.deleted-item > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px), (pointer: coarse) {
  .search-delete-row .btn, .deleted-list .btn, .search-when select { min-height: var(--touch-target); }
}
