.table-results-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.table-results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
}
.table-results-title { display: flex; align-items: center; gap: 9px; color: var(--text); }
.table-results-title > i { color: var(--muted); }
.table-results-title h2 { margin: 0; font-size: .9rem; font-weight: 700; }
.table-results-count {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.table-results-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; margin-left: auto; }
.table-page-size-form { display: flex; align-items: center; gap: 10px; margin: 0; padding: 5px 7px 5px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.table-page-size-form label { color: var(--text); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.table-page-size-select { width: 88px; min-height: 36px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.table-page-size-select:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.table-scroll-tools { display: flex; align-items: center; gap: 6px; }
.table-scroll-note { margin-right: 6px; color: var(--muted); font-size: .75rem; }
.table-scroll-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.table-scroll-button:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.table-scroll-button:disabled { opacity: .35; cursor: default; }
.table-scroll-button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.table-scroll-tools[hidden] { display: none; }
.table-results-panel > .table-shell {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.table-shell {
  max-height: min(68vh, 720px);
  scroll-padding-block: 60px 10px;
  isolation: isolate;
}
.table-shell > .table { min-width: 640px; font-size: .875rem; line-height: 1.45; }
.table-shell .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 100px;
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: none;
  white-space: normal;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}
.table-shell .table thead th.sortable-header { padding: 0; }
.table-shell .table-sort-link { min-height: 52px; padding: 11px 14px; gap: 8px; white-space: normal; }
.table-shell .table-sort-link > span { white-space: normal; }
.table-shell .table-sort-icon { font-size: .72rem; }
.table-shell .table tbody tr { --table-row-bg: var(--surface); --table-hover-bg: var(--surface-hover); }
.table-shell .table tbody tr:nth-child(even) { --table-row-bg: var(--surface-soft); }
.table-shell .table tbody tr.row-danger { --table-row-bg: var(--danger-soft); --table-hover-bg: #ffe4e6; }
.table-shell .table tbody tr.row-complete { --table-row-bg: var(--surface-soft); --table-hover-bg: #e9eef5; }
.table-shell .table tbody td {
  padding: 11px 14px;
  background: var(--table-row-bg);
  color: var(--text);
  overflow-wrap: break-word;
  vertical-align: middle;
}
.table-shell .table tbody tr:hover > td,
.table-shell .table tbody tr:focus-within > td { background: var(--table-hover-bg); }
.table-shell .table tbody tr.row-complete > td { color: var(--muted); }
.table-shell .table-pinned-reference thead th:first-child {
  left: 0;
  z-index: 4;
  min-width: 150px;
}
.table-shell .table-pinned-reference tbody td:first-child:not([colspan]) {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 150px;
  white-space: nowrap;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.table-shell.is-scrolled .table-pinned-reference thead th:first-child,
.table-shell.is-scrolled .table-pinned-reference tbody td:first-child:not([colspan]) {
  box-shadow: 1px 0 0 var(--line), 5px 0 8px -6px rgba(15, 23, 42, .25);
}
.table-shell.has-table-actions .table-actions-heading,
.table-shell.has-table-actions .table-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 1%;
  min-width: 68px;
  text-align: right;
  white-space: nowrap;
}
.table-shell.has-table-actions .table-actions-heading { z-index: 5; }
.table-shell.has-table-actions.has-more-columns .table-actions-heading,
.table-shell.has-table-actions.has-more-columns .table-actions {
  box-shadow: -1px 0 0 var(--line), -5px 0 8px -6px rgba(15, 23, 42, .25);
}
.table-shell.has-table-actions .table-actions-heading > .visually-hidden {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}
.table-shell .table-actions { padding-block: 8px; }
.table-shell .table-actions a { width: 34px; height: 34px; border-radius: 8px; }
.table-shell .table-actions a + a { margin-left: 4px; }
.table-shell .table-date,
.table-shell .table-number,
.table-shell .table-identifier { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-shell .table-number { text-align: right; }
.table-shell .table-description { min-width: 200px; max-width: 360px; }
.table-shell .table-email,
.table-shell .table-url { min-width: 190px; max-width: 280px; overflow-wrap: anywhere; }
.table-shell .table-identity { min-width: 180px; }
.table-shell .profile-name { gap: 9px; }
.table-shell .user-avatar { flex: 0 0 auto; }
.table-shell .empty-state { padding: 56px 24px !important; color: var(--muted); font-size: .9rem; text-align: left; }
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.table-pagination-summary { margin: 0; color: var(--muted); font-size: .8rem; }
.table-pagination-summary strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-pagination .pagination { margin: 0; gap: 6px; }
.table-pagination .page-link { min-height: 36px; padding: 7px 11px; border-radius: 8px; font-size: .8rem; }
.table-pagination .page-item.active .page-link { background: var(--primary-soft); border-color: var(--line); color: var(--primary); }
.table-pagination .page-link-icon { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 36px; }
.table-pagination .page-item.disabled .page-link { background: var(--surface-soft); border-color: var(--line); color: var(--muted); opacity: .5; }
.table-results-panel[aria-busy='true'] .table-shell { opacity: .6; }
html[data-theme='dark'] .table-shell .table tbody tr.row-danger { --table-hover-bg: #48171d; }
html[data-theme='dark'] .table-shell .table tbody tr.row-complete { --table-hover-bg: #1c2940; }
@media (max-width: 600px) {
  .table-results-toolbar { min-height: 60px; padding: 10px 12px; }
  .table-results-controls { width: 100%; justify-content: space-between; margin-left: 0; }
  .table-scroll-note { display: none; }
  .table-scroll-button { width: 40px; height: 40px; }
  .table-shell { max-height: min(70vh, 600px); }
  .table-shell .table-pinned-reference thead th:first-child,
  .table-shell .table-pinned-reference tbody td:first-child:not([colspan]) { min-width: 140px; }
  .table-shell .table tbody td { padding: 10px 12px; }
  .table-shell .table-actions a { width: 38px; height: 38px; }
  .table-pagination { padding: 12px; }
  .table-pagination-summary { flex: 1 0 100%; text-align: center; }
  .table-pagination > .table-page-size-form { justify-content: space-between; width: 100%; }
  .table-pagination .table-page-link-label { display: none; }
  .table-pagination > nav { width: 100%; }
  .table-pagination .pagination { justify-content: center; }
}

/* Treat each filter form and its result table as one compact workspace. */
.filter-bar:has(~ .table-results-panel[data-live-search-results]) {
  margin-bottom: 0;
  padding: 11px 13px;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: none;
}
.filter-bar:has(~ .table-results-panel[data-live-search-results]) .filter-bar-heading {
  padding-bottom: 7px;
  margin-bottom: 0;
}
.filter-bar:has(~ .table-results-panel[data-live-search-results]) .filter-bar-title { gap: 7px; font-size: .8rem; }
.filter-bar:has(~ .table-results-panel[data-live-search-results]) .filter-bar-title i { width: 26px; height: 26px; border-radius: 7px; }
.filter-bar:has(~ .table-results-panel[data-live-search-results]) .filter-field-label { margin-bottom: 4px; font-size: .72rem; }
.filter-bar:has(~ .table-results-panel[data-live-search-results]) .filter-actions .btn { min-height: 36px; padding: 7px 10px; font-size: .78rem; }
.filter-bar ~ .live-search-status {
  margin: 0;
  padding: 3px 13px;
  border-inline: 1px solid var(--line);
  background: var(--surface);
  font-size: .73rem;
}
.filter-bar ~ .table-results-panel[data-live-search-results] { border-radius: 0 0 14px 14px; }
.table-results-toolbar { min-height: 52px; padding: 8px 12px; }
.table-results-title { gap: 7px; }
.table-results-title h2 { font-size: .84rem; }
.table-results-count { padding: 2px 7px; font-size: .7rem; }
.table-page-size-form { gap: 7px; padding: 3px 6px 3px 9px; border-radius: 8px; }
.table-page-size-form label { font-size: .72rem; }
.table-page-size-select { min-height: 32px; font-size: .78rem; }
.table-shell > .table { font-size: .82rem; line-height: 1.35; }
.table-shell .table thead th { padding: 9px 11px; font-size: .7rem; }
.table-shell .table-sort-link { min-height: 42px; padding: 8px 11px; gap: 6px; }
.table-shell .table tbody td { padding: 8px 11px; }
.table-shell .table-actions a { width: 31px; height: 31px; border-radius: 7px; }
.table-pagination { gap: 9px; padding: 10px 12px; }
.table-pagination .page-link { min-height: 32px; padding: 6px 9px; font-size: .76rem; }
.table-shell .empty-state { padding: 38px 18px !important; }

@media (max-width: 600px) {
  .filter-bar:has(~ .table-results-panel[data-live-search-results]) { padding: 10px 11px; }
  .table-results-toolbar { min-height: 50px; padding: 8px 10px; }
  .table-shell .table tbody td { padding: 8px 9px; }
  .table-pagination { padding: 9px 10px; }
}
