.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) 0;
  gap: 0;
  transition: grid-template-columns 320ms var(--ease), gap 320ms var(--ease);
}

.knowledge-grid.has-preview {
  grid-template-columns: minmax(560px, 1fr) minmax(420px, 0.82fr);
  gap: 16px;
}

.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: flex-start;
  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;
}

.preview-hint {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 220ms ease, color 220ms ease;
}

.preview-hint.active {
  background: #dcfce7;
  color: #059669;
}

.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: auto minmax(0, 1fr) auto;
  gap: 12px;
  border-right: 1px solid #edf2f7;
  padding-right: 12px;
}

.folder-search {
  height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  color: #64748b;
}

.folder-search input {
  min-width: 0;
  border: 0;
  color: #0f172a;
  font-size: 13px;
}

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

.folder-search button {
  border: 0;
  background: transparent;
  color: #64748b;
}

.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;
}

.folder-tree button.active {
  background: #dcfce7;
  color: #059669;
  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;
}

.new-folder-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(16, 185, 129, .28);
  border-radius: 8px;
  background: #f0fdf4;
  color: #059669;
  font-size: 13px;
  font-weight: 850;
}

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

.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;
}

.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: 690px;
  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;
}

.doc-row {
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease;
}

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

.doc-row.selected {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.04));
  box-shadow: inset 3px 0 0 #10b981;
}

.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: #10b981; }

.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: #dcfce7;
  color: #059669;
}

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

.more-btn {
  border: 0;
  background: transparent;
  color: #2563eb;
}

.list-foot {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 13px;
}

.list-foot button {
  min-height: 32px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-weight: 750;
}

.pager {
  display: inline-flex;
  gap: 6px;
}

.pager button {
  width: 32px;
  padding: 0;
}

.pager button.active {
  border-color: #059669;
  background: #059669;
  color: #fff;
}

.list-foot input {
  width: 42px;
  height: 30px;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  text-align: center;
}

.preview-column {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

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

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.preview-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  font-size: 11px;
  font-weight: 800;
}

.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-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf2f7;
}

.preview-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.preview-viewer {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.viewer-filetype {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.viewer-toolbar-actions {
  display: inline-flex;
  gap: 8px;
}

.viewer-toolbar-actions button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.page-stage {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 16px;
  padding-right: 4px;
}

.page-sheet {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  animation: previewSheetIn 360ms var(--ease) both;
  animation-delay: var(--page-delay, 0ms);
}

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

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

.page-title span,
.page-title b {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

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

.summary-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
}

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

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

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

.content-block {
  padding: 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #edf2f7;
}

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

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

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

.preview-panel-enter-from,
.preview-panel-leave-to {
  opacity: 0;
  transform: translateX(24px) scale(0.98);
}

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

@media (max-width: 1320px) {
  .knowledge-grid.has-preview {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  }
}

@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) {
  .panel-title,
  .preview-head,
  .viewer-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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