.list-view {
  display: flex;
  flex-direction: column;
  /* #content already starts below the fixed top bar. */
  height: calc(100dvh - var(--header-height));
  min-height: 0;
}

.list-header {
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  flex-shrink: 0;
  background: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}

.list-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.list-header-actions {
  display: flex;
  gap: 8px;
}

.lv-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 0;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 24px;
}

.lv-search-input {
  flex: 1;
  min-width: 200px;
  --wa-input-height-medium: 36px;
}

.lv-filter-select {
  min-width: 140px;
  --wa-input-height-medium: 36px;
}

.lv-saved-view-select {
  min-width: 180px;
  --wa-input-height-medium: 36px;
}

.lv-dropdown-wrap {
  position: relative;
}

.lv-filter-badge {
  display: inline-block;
  margin-left: 4px;
  background: var(--wa-color-brand-40, #3b82f6);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.lv-filter-badge[hidden] {
  display: none;
}

.lv-filters-dropdown {
  min-width: 260px;
  max-height: 400px;
  overflow-y: auto;
}

.lv-filter-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--gray-200);
}

.lv-flex-button {
  flex: 1;
}

.list-table-wrapper {
  flex: 1;
  overflow: auto;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.list-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.list-table th {
  background: var(--gray-100);
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.list-table th.checkbox-col {
  width: 40px;
  text-align: center;
}

.list-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-700);
}

.list-table td.checkbox-col {
  width: 40px;
  text-align: center;
}

.list-table th.lv-select-col,
.list-table td.lv-select-col {
  width: 32px;
  padding-left: 12px;
}

.list-table th.lv-col-right,
.list-table td.lv-col-right {
  text-align: right;
}

/* Shared by every list view's row-actions cell (purchase-orders-list.js,
   invoices-list.js, barrel-operations-list.js, and this component's own
   default renderer) — all of them previously carried this identical
   declaration as an inline style="…" attribute. */
.actions-col {
  white-space: nowrap;
  text-align: right;
}

.list-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.list-table tbody tr:hover {
  background: var(--primary-50);
}

.list-table tbody tr.row-selected {
  background: rgba(37, 99, 235, 0.18);
}

.list-table tbody tr.row-selected:hover {
  background: rgba(37, 99, 235, 0.24);
}

.list-table tbody tr.inactive {
  opacity: 0.5;
}

/* Inline editing */
.list-table td.editing {
  padding: 4px 8px;
}

.list-table td.editing input {
  padding: 6px 8px;
  font-size: 13px;
  border: 2px solid var(--primary-500);
  border-radius: var(--radius);
}

.list-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-400);
  font-size: 14px;
}

.list-empty-error {
  color: var(--wa-color-danger-60, #c92a2a);
}

.lv-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 24px;
  border-top: 1px solid var(--gray-200);
}

.lv-pagination[hidden] {
  display: none;
}

.lv-page-info {
  font-size: 13px;
  color: var(--gray-600);
}

.lv-delete-dialog {
  --width: 420px;
}

.lv-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
}

/* Sortable headers */
.list-table th.sortable-header {
  cursor: pointer;
  user-select: none;
}

.list-table th.sortable-header:hover {
  background: var(--gray-200);
}

/* Drag and drop column reorder */
.list-table th[draggable="true"] {
  cursor: grab;
}

.list-table th.dragging {
  opacity: 0.4;
}

.list-table th.drag-over {
  border-left: 3px solid var(--primary-500, #2563eb);
}

/* Actions column */
.icon-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  vertical-align: middle;
}

.icon-action-btn:hover {
  color: #6b7280;
  background: var(--gray-100, #f3f4f6);
}

/* Columns dropdown — placement is owned by the enclosing `wa-popover`, so this
   only styles the panel surface. */
.columns-dropdown {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 200px;
  padding: 8px 0;
}

.columns-dropdown-title {
  padding: 4px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 4px;
}

.columns-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  box-sizing: border-box;
  width: 100%;
  user-select: none;
}

.columns-dropdown-item:hover {
  background: var(--gray-50);
}

.columns-dropdown-item input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0 0 0 auto;
}

.lv-column-filter {
  padding: 6px 12px;
}

.lv-column-filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  display: block;
  margin-bottom: 2px;
}

.lv-column-filter-select {
  width: 100%;
}
