/* Keep the server-rendered list from painting before its first layout. */
html.list-layout-enabled .app-shell > .main > .content[data-list-layout="pending"] :is(.table-panel, .table-wrap, .ai-table-wrap, .record-grid, .wechat-users, .file-list, .approval-history, .ai-empty, .list-workspace-scroll, table.data-table, .pagination),
html.list-layout-enabled .app-shell > .main > .content[data-list-layout="pending"] :is(.table-panel, .table-wrap, .ai-table-wrap, .record-grid, .wechat-users, .file-list, .approval-history, .ai-empty, .list-workspace-scroll, table.data-table, .pagination) * {
  visibility: hidden !important;
}

/* Tables scroll inside their own workspace; the pager occupies a separate row. */
.app-shell > .main > .content .list-workspace-grid {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: var(--list-workspace-height, 360px);
  gap: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  font-size: var(--ui-font-body, 13px);
}

.app-shell > .main > .content .list-workspace-grid > .list-workspace-scroll {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c7cfda transparent;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
}

.app-shell > .main > .content .list-workspace-grid:has(> .list-workspace-scroll:focus-visible) {
  border-color: var(--primary);
}

.list-workspace-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.list-workspace-scroll::-webkit-scrollbar-thumb {
  background: #c7cfda;
  border-radius: 3px;
}

.app-shell > .main > .content .list-workspace-scroll > table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.app-shell > .main > .content .list-workspace-scroll thead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f2f4f8;
}

.app-shell > .main > .content .list-workspace-scroll thead th {
  background: #f2f4f8;
  box-shadow: inset 0 -1px 0 var(--line-soft);
}

.app-shell > .main > .content .list-workspace-grid > .pagination {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  width: 100%;
  min-height: 54px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  background: #fff;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  font-size: var(--ui-font-body, 13px);
}

.list-workspace-pagination .pagination-controls {
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.list-workspace-pagination .pagination-form {
  flex-wrap: wrap;
  gap: 6px 10px;
}

.list-workspace-pagination .pagination-form > label {
  margin: 0;
}

.app-shell > .main > .content .list-workspace-grid > .record-grid,
.app-shell > .main > .content .list-workspace-grid > .wechat-users {
  align-content: start;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
}

.app-shell > .main > .content .list-workspace-grid > .file-list,
.app-shell > .main > .content .list-workspace-grid > .approval-history {
  align-content: start;
  padding: 14px;
}

.app-shell > .main > .content .list-workspace-grid > .ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* The tree and result list use the same height, without scrolling the toolbar. */
.app-shell > .main > .content .industry-workspace.list-workspace-industry {
  height: var(--list-workspace-height, 480px);
  min-height: 0;
  align-items: stretch;
}

.app-shell > .main > .content .list-workspace-industry > .industry-tree-panel,
.app-shell > .main > .content .list-workspace-industry > .reference-list-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.app-shell > .main > .content .list-workspace-industry > .industry-tree-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell > .main > .content .industry-tree-panel > .industry-tree-tools {
  flex: 0 0 auto;
}

.app-shell > .main > .content .industry-tree-panel > .industry-tree-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-shell > .main > .content .reference-list-pane:has(> .list-workspace-grid) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.app-shell > .main > .content .reference-list-pane > .maintenance-toolbar {
  flex: 0 0 auto;
}

.app-shell > .main > .content .reference-list-pane > .list-workspace-nested {
  flex: 1 1 0;
  height: auto;
}

@media (max-width: 760px) {
  .app-shell > .main > .content .industry-workspace.list-workspace-industry {
    height: auto;
  }

  .app-shell > .main > .content .list-workspace-industry > .industry-tree-panel {
    height: 240px;
    max-height: 240px;
  }

  .app-shell > .main > .content .list-workspace-industry > .reference-list-pane {
    height: auto;
  }

  .app-shell > .main > .content .reference-list-pane > .list-workspace-nested {
    flex: 0 0 auto;
    height: var(--list-workspace-height, 360px);
  }

  .app-shell > .main > .content .list-workspace-grid > .pagination {
    align-items: flex-start;
    gap: 8px;
  }

  .list-workspace-pagination .pagination-controls {
    justify-content: flex-start;
  }

  .list-workspace-pagination .pagination-form {
    margin-left: 0;
  }
}
