.knowledge-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  animation: fadeUp 220ms var(--ease) both;
}

.knowledge-grid {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.knowledge-grid.has-preview {
  grid-template-columns: minmax(0, 1fr);
}

.knowledge-main,
.preview-column {
  min-width: 0;
  min-height: 0;
}

.knowledge-main {
  overflow: hidden;
}

.library-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px 18px;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title h2,
.preview-head h2 {
  color: #0f172a;
  font-size: 16px;
  font-weight: 850;
}

.panel-title p,
.preview-head p {
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.file-search {
  width: min(320px, 100%);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #d7e0ea;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.file-search:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
}

.file-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  color: #0f172a;
  font-size: 13px;
  background: transparent;
}

.file-search input:focus {
  outline: none;
}

.panel-tools {
  min-width: min(470px, 100%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.library-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.folder-rail {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  border-right: 1px solid #edf2f7;
  padding-right: 12px;
}

.folder-tree {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
}

.folder-tree button {
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #334155;
  font-size: 13px;
  text-align: left;
  animation: listRowIn 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--delay, 0ms);
}

.folder-tree button.active {
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
  font-weight: 850;
}

.folder-tree b {
  min-width: 24px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
}

.knowledge-sync-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.knowledge-sync-btn:hover:not(:disabled) {
  border-color: #1e40af;
  background: #1d4ed8;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
  transform: translateY(-1px);
}

.knowledge-sync-btn:disabled {
  cursor: not-allowed;
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
  box-shadow: none;
}

.document-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.document-area.read-only {
  grid-template-rows: minmax(0, 1fr) auto;
}

.upload-input {
  display: none;
}

.upload-zone {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  background: #f8fbff;
  color: #334155;
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.upload-zone:hover {
  border-color: #60a5fa;
  background: #f3f8ff;
}

.upload-zone.disabled {
  cursor: default;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.upload-zone.busy {
  opacity: 0.72;
}

.upload-zone i {
  color: #2563eb;
  font-size: 31px;
}

.upload-zone strong {
  font-size: 13px;
  font-weight: 850;
}

.upload-zone span {
  color: #64748b;
  font-size: 12px;
}

.doc-table-wrap {
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf2f7;
  color: #24324a;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f7fafc;
  color: #64748b;
  font-weight: 800;
  white-space: nowrap;
}

.knowledge-document-table th:not(:first-child),
.knowledge-document-table td:not(:first-child) {
  text-align: center;
}

.knowledge-document-table th:first-child,
.knowledge-document-table td:first-child {
  text-align: left;
}

.doc-row {
  cursor: pointer;
  animation: listRowIn 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--delay, 0ms);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.doc-row:hover {
  background: #f8fbff;
}

.doc-row.selected {
  background: linear-gradient(90deg, rgba(var(--theme-primary-rgb), 0.08), rgba(59, 130, 246, 0.04));
  box-shadow: inset 3px 0 0 var(--theme-primary);
}

.file-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
  white-space: nowrap;
}

.file-name .pdf,
.viewer-filetype.pdf { color: #ef4444; }
.file-name .word,
.viewer-filetype.word { color: #2563eb; }
.file-name .excel,
.viewer-filetype.excel { color: var(--success); }

.doc-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.state-tag {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.state-tag.success {
  background: var(--success-soft);
  color: var(--success-hover);
}

.state-tag.muted {
  background: #e2e8f0;
  color: #475569;
}

.state-tag.warning {
  background: #ffedd5;
  color: #f97316;
}

.state-tag.danger {
  background: #fee2e2;
  color: #dc2626;
}

.state-cell {
  display: grid;
  justify-items: center;
}

.ingest-time-cell {
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
}

.more-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #2563eb;
}

.more-btn:hover:not(:disabled):not(.is-disabled) {
  background: #eff6ff;
}

.more-btn.danger {
  color: #dc2626;
}

.more-btn.ingest {
  color: var(--theme-primary-active);
}

.more-btn.llm-wiki-view {
  color: #c2410c;
}

.more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.more-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.empty-row {
  color: #64748b;
  text-align: center;
}

.list-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.pager {
  display: inline-flex;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.pager button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.pager button:hover:not(.active) {
  background: #fff;
  color: var(--theme-primary-active);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.pager button.active {
  background: var(--theme-primary);
  color: #fff;
  box-shadow: 0 8px 16px var(--theme-primary-shadow);
}

.list-foot .page-summary {
  color: #64748b;
  font-size: 14px;
  font-weight: 650;
}

.page-nav {
  color: #64748b;
}

.page-size-select {
  width: 112px;
  justify-self: end;
}

.preview-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 20px 22px;
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf2f7;
}

.preview-copy {
  min-width: 0;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-action,
.icon-action,
.viewer-toolbar-actions button {
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #fff;
  color: #334155;
}

.mini-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.icon-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}

.preview-summary-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.preview-secondary-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
}

.preview-viewer {
  min-height: 0;
  margin-top: 18px;
  display: grid;
}

.preview-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 3vh 2vw;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent 32%),
    rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(10px);
}

.preview-modal-shell {
  width: min(96vw, 1600px);
  height: min(94vh, 1180px);
  min-height: 0;
}


.preview-modal-panel {
  height: 100%;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.24);
}

.preview-modal-panel:focus {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(96, 165, 250, 0.22),
    0 30px 90px rgba(15, 23, 42, 0.24);
}

.llm-wiki-overlay {
  background:
    radial-gradient(circle at top, rgba(var(--theme-primary-rgb), 0.12), transparent 30%),
    rgba(15, 23, 42, 0.58);
}

.llm-wiki-shell {
  width: min(94vw, 1480px);
  height: min(92vh, 1080px);
}

.llm-wiki-panel {
  padding-bottom: 18px;
}

.llm-wiki-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.llm-wiki-meta span,
.llm-wiki-count {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.llm-wiki-count {
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
}

.llm-wiki-stat-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.llm-wiki-stat-grid span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
}

.llm-wiki-body {
  min-height: 0;
  margin-top: 18px;
  display: grid;
  overflow: hidden;
}

.llm-wiki-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  overflow: hidden;
}

.llm-wiki-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  overflow: hidden;
}

.llm-wiki-alert {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
}

.llm-wiki-alert strong {
  color: #991b1b;
  font-size: 13px;
  font-weight: 850;
}

.llm-wiki-alert p {
  color: #7f1d1d;
  font-size: 12px;
  line-height: 1.6;
}

.llm-wiki-alert.warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.llm-wiki-alert.warning strong,
.llm-wiki-alert.warning p {
  color: #9a3412;
}

.llm-wiki-alert.success,
.llm-wiki-alert.info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.llm-wiki-alert.success strong,
.llm-wiki-alert.success p,
.llm-wiki-alert.info strong,
.llm-wiki-alert.info p {
  color: #1d4ed8;
}

.llm-wiki-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.llm-wiki-section-head h3 {
  color: #0f172a;
  font-size: 15px;
  font-weight: 850;
}

.llm-wiki-section-head p {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.llm-wiki-editor {
  width: 100%;
  min-height: 0;
  height: 100%;
  resize: none;
  padding: 16px;
  border: 1px solid #d7e0ea;
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.llm-wiki-editor:focus {
  outline: none;
  border-color: rgba(var(--theme-primary-rgb), 0.42);
  box-shadow: 0 0 0 4px var(--theme-focus-ring);
}

.llm-wiki-candidate-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.llm-wiki-candidate-card {
  display: grid;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.llm-wiki-candidate-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.llm-wiki-candidate-card strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.llm-wiki-candidate-card header span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.llm-wiki-candidate-card p {
  color: #334155;
  font-size: 13px;
  line-height: 1.65;
}

.llm-wiki-chip-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.llm-wiki-chip-list span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
}

.llm-wiki-evidence {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}

.preview-status {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.preview-status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.preview-embed-wrap,
.preview-image-wrap {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #fff;
}

.preview-embed {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}

.preview-image-wrap {
  display: grid;
  place-items: center;
  padding: 20px;
}

.preview-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.onlyoffice-preview-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}

.onlyoffice-preview-host {
  width: 100%;
  height: 100%;
  min-height: 720px;
}

.preview-status-overlay {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(248, 250, 252, 0.92);
}

.excel-preview-wrap {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}

.excel-sheet-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  overflow-x: auto;
}

.excel-sheet-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.excel-sheet-tab.active {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.excel-preview-scroll {
  min-height: 0;
  overflow: auto;
}

.excel-preview-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.excel-preview-table th,
.excel-preview-table td {
  padding: 10px 12px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.5;
}

.excel-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f0fe;
  color: #0f172a;
  font-weight: 800;
}

.excel-preview-table td {
  color: #334155;
  background: #fff;
}

.excel-preview-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.excel-preview-table tr > *:last-child {
  border-right: 0;
}

.excel-preview-table tbody tr:last-child td {
  border-bottom: 0;
}

.page-stage {
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  gap: 20px;
  padding-right: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 18px 18px 18px 18px;
}

.page-sheet {
  display: grid;
  gap: 18px;
  padding: 0 0 20px;
  border-bottom: 1px solid #edf2f7;
  background: transparent;
  box-shadow: none;
  animation: previewSheetIn 360ms var(--ease) both;
  animation-delay: var(--page-delay, 0ms);
}

.page-sheet:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
}

.page-title strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 850;
}

.page-title span {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  display: grid;
  gap: 4px;
  padding: 0 0 10px;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
}

.summary-item span {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.summary-item strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
}

.page-content {
  display: grid;
  gap: 16px;
}

.content-block {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.content-block h3 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.content-block ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: #475569;
  font-size: 13px;
  line-height: 1.75;
}

.preview-modal-enter-active,
.preview-modal-leave-active {
  transition: opacity 220ms ease;
}

.preview-modal-enter-active .preview-modal-shell,
.preview-modal-leave-active .preview-modal-shell {
  transition: transform 320ms var(--ease), opacity 220ms ease;
}

.preview-modal-enter-from,
.preview-modal-leave-to {
  opacity: 0;
}

.preview-modal-enter-from .preview-modal-shell,
.preview-modal-leave-to .preview-modal-shell {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
}

@keyframes previewSheetIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .knowledge-grid,
  .knowledge-grid.has-preview {
    grid-template-columns: 1fr;
    gap: 16px;
    overflow-y: auto;
  }

  .library-body {
    grid-template-columns: 1fr;
  }

  .folder-rail {
    border-right: 0;
    border-bottom: 1px solid #edf2f7;
    padding: 0 0 12px;
  }
}

@media (max-width: 760px) {
  .knowledge-page {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  .knowledge-grid,
  .knowledge-main,
  .library-panel,
  .library-body,
  .document-area {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .knowledge-grid,
  .library-panel,
  .library-body,
  .document-area {
    display: block;
  }

  .knowledge-grid,
  .knowledge-main,
  .library-panel,
  .library-body,
  .document-area,
  .doc-table-wrap,
  .folder-tree {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .library-panel {
    padding: 12px;
  }

  .panel-title,
  .preview-head,
  .llm-wiki-section-head,
  .viewer-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-tools,
  .file-search,
  .knowledge-sync-btn {
    width: 100%;
  }

  .library-body {
    margin-top: 12px;
  }

  .folder-rail {
    display: block;
    padding: 0 0 10px;
  }

  .folder-tree {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .folder-tree button {
    flex: 0 0 auto;
    width: max-content;
    min-width: 132px;
  }

  .upload-zone {
    margin-bottom: 10px;
  }

  .doc-table-wrap {
    overflow: visible;
  }

  .knowledge-document-table,
  .knowledge-document-table thead,
  .knowledge-document-table tbody,
  .knowledge-document-table tr,
  .knowledge-document-table th,
  .knowledge-document-table td {
    display: block;
  }

  .knowledge-document-table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
  }

  .knowledge-document-table thead {
    display: none;
  }

  .knowledge-document-table tbody {
    display: grid;
    gap: 10px;
  }

  .knowledge-document-table tr {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  }

  .knowledge-document-table td,
  .knowledge-document-table th:not(:first-child),
  .knowledge-document-table td:not(:first-child),
  .knowledge-document-table td:first-child {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 30px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px dashed #edf2f7;
    text-align: left;
    white-space: normal;
  }

  .knowledge-document-table td:last-child {
    border-bottom: 0;
  }

  .knowledge-document-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.6;
  }

  .knowledge-document-table td:first-child {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  .knowledge-document-table td:first-child::before {
    display: none;
  }

  .knowledge-document-table .empty-row {
    display: block;
    padding: 12px 0;
    border-bottom: 0;
    text-align: center;
  }

  .knowledge-document-table .empty-row::before {
    display: none;
  }

  .file-name {
    white-space: normal;
  }

  .state-cell {
    justify-items: start;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .summary-grid,
  .list-foot {
    grid-template-columns: 1fr;
  }

  .list-foot {
    gap: 12px;
    justify-items: stretch;
  }

  .pager,
  .page-size-select {
    justify-self: stretch;
  }

  .preview-modal-overlay {
    padding: 8px;
  }

  .preview-modal-shell {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }

  .preview-modal-panel {
    border-radius: 18px;
    padding: 16px;
  }

  .preview-head {
    padding-bottom: 12px;
  }

  .preview-viewer {
    margin-top: 14px;
  }

  .llm-wiki-grid {
    grid-template-columns: 1fr;
  }

  .llm-wiki-shell {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }

  .llm-wiki-section {
    padding: 14px;
  }

  .llm-wiki-editor {
    min-height: 320px;
  }
}

@media (max-width: 1080px) {
  .llm-wiki-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes listRowIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .folder-tree button,
  .doc-row,
  .page-sheet {
    animation: none !important;
  }
}
