#knowledgeMain {
  display: grid;
  gap: 14px;
}

#knowledgeMain .panel { overflow: hidden; }

/* 知识文档列表按自身容器宽度自适应：右侧管理智能体面板拖拽改变宽度时，表头与行操作不会被挤压换行。 */
.knowledge-list-panel {
  overflow: hidden;
  container-type: inline-size;
  container-name: knowledgelist;
}

.knowledge-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px;
}

.knowledge-form label {
  display: grid;
  gap: 6px;
  color: #687582;
  font-size: 11px;
  font-weight: 650;
}

.knowledge-form label:first-child,
.knowledge-form .knowledge-file,
.knowledge-form .form-error { grid-column: 1 / -1; }

.knowledge-form input,
.knowledge-form select,
.knowledge-tenant-control select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbe1e7;
  border-radius: 7px;
  background: #fff;
  color: #26323d;
  font: inherit;
  font-size: 12px;
  outline: 0;
}

.knowledge-form input,
.knowledge-form select,
.knowledge-tenant-control select {
  min-height: 40px;
  padding: 8px 34px 8px 10px;
}

.knowledge-form select,
.knowledge-tenant-control select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #71808c 50%), linear-gradient(135deg, #71808c 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.knowledge-form input:focus,
.knowledge-form select:focus,
.knowledge-tenant-control select:focus {
  border-color: #5f86d8;
  box-shadow: 0 0 0 3px rgba(45, 99, 214, .1);
}

.knowledge-file-native {
  position: absolute;
  width: 1px !important;
  height: 1px;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.knowledge-file-picker {
  min-height: 54px;
  padding: 8px;
  border: 1px dashed #c8d4df;
  border-radius: 8px;
  background: #f9fbfd;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}

.knowledge-file-picker:hover,
.knowledge-file:focus-within .knowledge-file-picker {
  border-color: #7d9dde;
  background: #f4f7fd;
}

.knowledge-file-picker b {
  min-width: 92px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  background: #243746;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 650;
}

.knowledge-file-picker > span {
  min-width: 0;
  overflow: hidden;
  color: #87939e;
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-file-picker.has-file {
  border-style: solid;
  border-color: #a8c9bd;
  background: #f5faf8;
}

.knowledge-file-picker.has-file > span {
  color: #315c50;
  font-weight: 600;
}

.knowledge-file small {
  color: #929ca6;
  font-size: 10px;
  font-weight: 400;
}

.knowledge-form .primary-button {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 0 18px;
}

.knowledge-tenant-control {
  width: min(230px, 42%);
  flex: 0 0 auto;
  display: grid;
  gap: 5px;
  color: #697681;
  font-size: 10px;
}

.knowledge-result { padding: 12px 0; border-top: 1px solid #edf0f2; }
.knowledge-result:first-child { border-top: 0; }
.knowledge-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.knowledge-result strong { color: #293744; font-size: 11px; }
.knowledge-result b { color: #2d63d6; font-size: 10px; }
.knowledge-result p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: #697681;
  font-size: 11px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.knowledge-empty { padding: 18px 0; color: #929ca6; font-size: 11px; }
.knowledge-list-panel .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
/* 知识库空间展示：位于列表上方，展示已用/全部/剩余，余量不足时给出缩减空间的操作建议。 */
.knowledge-storage-usage { margin: 0 20px 14px; padding: 12px 14px; border: 1px solid #e4eaf1; border-radius: 12px; background: #f7fafd; }
.knowledge-storage-usage .knowledge-storage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; color: #46525f; font-size: 12.5px; }
.knowledge-storage-usage .knowledge-storage-head b { color: #1f2a35; font-weight: 650; }
.knowledge-storage-usage .knowledge-storage-remain { color: #687582; }
.knowledge-storage-bar { position: relative; height: 6px; margin-top: 9px; border-radius: 99px; background: #e3e9f0; overflow: hidden; }
.knowledge-storage-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d63d6, #4c8bf5); transition: width .25s ease; }
.knowledge-storage-usage.is-low .knowledge-storage-bar i { background: linear-gradient(90deg, #d8892f, #e6a34a); }
.knowledge-storage-usage.is-full .knowledge-storage-bar i { background: linear-gradient(90deg, #c5443f, #e06a63); }
.knowledge-storage-note { display: block; margin-top: 8px; color: #8a95a0; font-size: 11.5px; line-height: 1.6; }
.knowledge-storage-usage.is-low .knowledge-storage-note,
.knowledge-storage-usage.is-full .knowledge-storage-note { color: #b4651f; }
.knowledge-list-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.knowledge-list-actions .knowledge-tenant-control { width: 220px; }
.knowledge-list-actions .primary-button { min-height: 40px; }
/* 表格保持可读宽度，容器变窄时由 .table-wrap 横向滚动，而不是压缩操作列。 */
.knowledge-list-panel .table-wrap { overflow-x: auto; }
.knowledge-list-panel table { min-width: 1000px; }
.knowledge-create-panel .panel-heading { display: block; }
.knowledge-create-panel .panel-heading .text-action { display: inline-flex; align-items: center; margin-bottom: 6px; }
.knowledge-list-panel td b,
.knowledge-list-panel td small { display: block; }
.knowledge-list-panel td small { margin-top: 4px; color: #8a95a0; font-size: 10px; }
.knowledge-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.knowledge-status::before { width: 7px; height: 7px; border-radius: 50%; background: #9aa5b1; content: ""; }
.knowledge-status.ready::before { background: #23a090; }
.knowledge-status.processing::before { background: #d89127; }
.knowledge-status.failed::before { background: #d95555; }
.knowledge-delete { border: 0; background: transparent; color: #bd4545; font-size: 11px; }
.knowledge-delete:hover { text-decoration: underline; }
.knowledge-delete:disabled { color: #b8a9a9; }
.knowledge-error-copy { max-width: 220px; color: #b04b4b !important; white-space: normal; }
.knowledge-form button:disabled { cursor: not-allowed; opacity: .6; }

@media (max-width: 1100px) {
  #knowledgeMain { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .knowledge-list-panel .panel-heading { align-items: flex-start; flex-direction: column; }
  .knowledge-tenant-control,
  .knowledge-list-actions,
  .knowledge-list-actions .knowledge-tenant-control { width: 100%; }
  .knowledge-list-actions { align-items: end; }
}

@media (max-width: 560px) {
  .knowledge-form { grid-template-columns: 1fr; }
  .knowledge-form label:first-child,
  .knowledge-form .knowledge-file,
  .knowledge-form .form-error,
  .knowledge-form .primary-button { grid-column: 1; }
  .knowledge-list-actions { align-items: stretch; flex-direction: column; }
}

/* 面板宽度由右侧管理智能体拖拽决定，用容器查询而不是窗口宽度决定折叠。 */
@container knowledgelist (max-width: 760px) {
  .knowledge-list-panel .panel-heading { align-items: flex-start; flex-direction: column; }
  .knowledge-list-actions { width: 100%; }
  .knowledge-list-actions .knowledge-tenant-control { width: min(220px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  .knowledge-file-picker { transition: none; }
}

/* 版本管理：左侧版本时间线 + 右侧所选版本详情，沿用控制台蓝白配色与密度。 */
/* 面板宽度随主内容区与智能体占位变化，两栏布局按容器宽度而不是视口宽度折叠。 */
#knowledgeVersionsPanel { overflow: hidden; container-type: inline-size; }
#knowledgeVersionsPanel [hidden] { display: none !important; }
#knowledgeVersionsPanel > .form-error { margin: 12px 22px 0; }
.knowledge-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 18px; border-bottom: 1px solid var(--line, #e2e6ea); background: #fff; }
.knowledge-panel-title { min-width: 0; display: grid; gap: 6px; }
.knowledge-panel-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.knowledge-panel-title h2 { margin: 0; color: var(--ink, #18212d); font-size: 18px; font-weight: 720; overflow-wrap: anywhere; }
.knowledge-panel-title p { margin: 0; color: var(--muted, #87919d); font-size: 12px; line-height: 1.65; }
.knowledge-panel-head > .secondary-button { flex: 0 0 auto; }
.knowledge-back { justify-self: start; padding: 0; font-size: 11px; }
.knowledge-version-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line, #e2e6ea); background: var(--line, #e2e6ea); gap: 1px; }
.knowledge-version-stats article { min-width: 0; padding: 14px 20px; background: #fff; display: grid; gap: 4px; }
.knowledge-version-stats span { color: #7c8794; font-size: 11px; }
.knowledge-version-stats strong { color: var(--ink, #18212d); font-size: 20px; line-height: 1.15; font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.knowledge-version-stats small { color: #98a2ad; font-size: 10px; line-height: 1.45; }
.knowledge-version-workspace { display: grid; grid-template-columns: minmax(286px, 352px) minmax(0, 1fr); min-height: 500px; }
.knowledge-version-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px 18px 16px; border-right: 1px solid var(--line, #e2e6ea); background: #fafbfd; }
.knowledge-version-items { display: grid; gap: 8px; align-content: start; padding: 2px; }
.knowledge-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.knowledge-section-heading :is(h3, h4) { margin: 0; color: #293744; font-size: 13px; font-weight: 700; }
.knowledge-section-heading > span, .knowledge-muted { flex-shrink: 0; color: #7b8795; font-size: 11px; }
.knowledge-help { margin: 8px 0; color: #74818f; font-size: 12px; line-height: 1.7; }
.knowledge-badge { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: #edf7f5; color: #147b6c !important; font-size: 10px; font-weight: 650; }
.knowledge-badge[data-publication="draft"] { background: #f1f3f7; color: #68737f !important; }
.knowledge-badge[data-publication="withdrawn"] { background: #fdf0f0; color: #b04b4b !important; }
.knowledge-version-card { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 9px; background: #fff; color: inherit; text-align: left; cursor: pointer; box-shadow: 0 1px 2px rgba(25, 43, 67, .03); transition: border-color .16s, background .16s, box-shadow .16s; }
.knowledge-version-card:hover { border-color: #cfd9e6; }
.knowledge-version-card.is-selected { border-color: #8aa9ea; background: #f7faff; box-shadow: 0 0 0 1px #e7efff; }
.knowledge-version-card:focus-visible { outline: 2px solid #8aa9ea; outline-offset: 2px; }
.knowledge-version-badge { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: #eef2f8; color: #53637a; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.knowledge-version-card.is-published .knowledge-version-badge { background: #eaf5f1; color: #24725c; }
.knowledge-version-card.is-failed .knowledge-version-badge { background: #fdf0f0; color: #b04b4b; }
.knowledge-version-summary { display: grid; gap: 3px; flex: 1 1 auto; min-width: 0; }
.knowledge-version-title { color: #22303c; font-size: 12.5px; font-weight: 700; }
.knowledge-version-sub { overflow: hidden; color: #8a95a0; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-version-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.kv-flag { padding: 1px 6px; border-radius: 999px; background: #f0f3f7; color: #68737f; font-size: 10px; font-style: normal; }
.kv-flag.is-done { background: #edf7f5; color: #147b6c; }
.kv-flag.is-active { background: #fff5e5; color: #9b6b14; }
.kv-flag.is-failed { background: #fdf0f0; color: #b04b4b; }
.kv-flag.is-publication-published { background: #eaf0fd; color: #2d63d6; }
.kv-flag.is-publication-withdrawn { background: #f1f3f7; color: #68737f; }
.knowledge-version-chevron { flex: 0 0 auto; color: #a8b2bd; font-size: 15px; }
.knowledge-version-empty { display: grid; gap: 5px; padding: 22px 16px; border: 1px dashed #dbe2ea; border-radius: 9px; background: #fff; color: #87919d; font-size: 11.5px; text-align: center; }
.knowledge-version-empty strong { color: #435361; font-size: 13px; }
.knowledge-version-footer { display: flex; align-items: center; grid-column: 1 / -1; border-top: 1px solid var(--line, #e2e6ea); background: #fff; }
.knowledge-version-footer .pager { flex: 1 1 auto; flex-wrap: wrap; row-gap: 8px; border-top: 0; padding: 12px 18px; }
.knowledge-version-footer .pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.knowledge-version-footer .pager-controls button { margin-left: 0; }
.knowledge-version-footer .page-number.active { border-color: var(--blue, #2d63d6); background: var(--blue, #2d63d6); color: #fff; }
.knowledge-version-footer > .knowledge-help { padding: 12px 18px; }
.knowledge-version-detail { display: grid; align-content: start; gap: 18px; min-width: 0; padding: 22px 24px 26px; background: #fff; }
.knowledge-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.knowledge-detail-head > div { min-width: 0; }
.knowledge-detail-eyebrow { color: #7b8795; font-size: 10px; letter-spacing: .1em; }
.knowledge-detail-head h3 { margin: 5px 0 0; color: #18212d; font-size: 17px; }
.knowledge-detail-head p { margin: 6px 0 0; color: #74818f; font-size: 12px; line-height: 1.65; }
.knowledge-detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; border: 1px solid #e8edf2; border-radius: 9px; background: #e8edf2; overflow: hidden; }
.knowledge-detail-meta > div { display: grid; gap: 3px; min-width: 0; padding: 10px 12px; background: #fff; }
.knowledge-detail-meta dt { color: #7b8795; font-size: 10.5px; }
.knowledge-detail-meta dd { margin: 0; color: #33424d; font-size: 12px; overflow-wrap: anywhere; }
.knowledge-action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.knowledge-action-row :is(.primary-button, .secondary-button) { min-height: 34px; padding: 6px 12px; font-size: 11px; }
.knowledge-version-upload-card { display: grid; gap: 12px; padding: 14px; border: 1px solid #e3e8ef; border-radius: 10px; background: #fafbfd; }
.knowledge-version-upload-card h4 { margin: 0; color: #22303c; font-size: 12.5px; }
.knowledge-version-upload-card p { margin: 5px 0 0; color: #7b8795; font-size: 11px; line-height: 1.6; }
.knowledge-version-upload { display: grid; gap: 10px; }
.knowledge-upload-label { color: #687582; font-size: 11px; font-weight: 650; }
.knowledge-file-picker { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border: 1px dashed #c8d4df; border-radius: 8px; background: #fff; cursor: pointer; transition: border-color .16s, background .16s; }
.knowledge-file-picker:hover { border-color: #8aa9ea; background: #fbfdff; }
.knowledge-file-picker:focus-within { border-color: #7d9dde; box-shadow: 0 0 0 3px rgba(45, 99, 214, .1); }
.knowledge-file-picker input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.knowledge-file-picker-action { flex: 0 0 auto; padding: 6px 12px; border-radius: 6px; background: #eef3fb; color: var(--blue, #2d63d6); font-size: 11px; font-weight: 700; }
.knowledge-file-picker-name { min-width: 0; overflow: hidden; color: #7b8795; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-version-upload .primary-button { justify-self: start; min-height: 36px; padding: 0 14px; font-size: 11px; }
.knowledge-version-upload .knowledge-upload-retry { margin: 0; color: #9b6b14; font-size: 11px; }
.knowledge-detail-empty { display: grid; justify-items: start; gap: 6px; padding: 24px; border: 1px dashed #dbe2ea; border-radius: 10px; background: #fafbfd; color: #7b8795; font-size: 12px; line-height: 1.7; }
.knowledge-detail-empty strong { color: #435361; font-size: 14px; }
.knowledge-detail-empty p { margin: 0; }
.knowledge-help.is-error { color: #b04b4b; }
/* 容器被智能体或窄窗口压缩时优先保证详情、文件选择与操作按钮可达，不依赖 body 视口宽度。 */
@container (max-width: 1040px) {
  .knowledge-version-workspace { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); }
  .knowledge-version-list { padding: 15px 14px; }
  .knowledge-version-detail { padding: 18px; }
}
@container (max-width: 860px) {
  .knowledge-version-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .knowledge-version-workspace { grid-template-columns: minmax(0, 1fr); }
  .knowledge-version-list { border-right: 0; border-bottom: 1px solid var(--line, #e2e6ea); }
  .knowledge-version-detail { padding: 18px 16px 22px; }
}
@container (max-width: 620px) {
  .knowledge-panel-head { flex-direction: column; padding: 16px; }
  .knowledge-panel-head > .secondary-button { align-self: flex-start; }
  .knowledge-version-stats article { padding: 12px 16px; }
  .knowledge-detail-meta { grid-template-columns: minmax(0, 1fr); }
  .knowledge-detail-head { flex-direction: column; }
  .knowledge-version-footer .pager { flex-direction: column; align-items: flex-start; gap: 8px; }
}
.knowledge-model-description { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.knowledge-model-description > :is(h3,p) { grid-column: 1 / -1; margin: 0; }
.knowledge-description-field { border: 1px solid #e1e7ef; border-radius: 8px; padding: 12px 14px; background: #fafbfd; min-width: 0; }
.knowledge-description-field h4 { margin: 0 0 8px; color: #435361; font-size: 12px; }
.knowledge-description-field ul { margin: 0; padding-left: 16px; color: #74818f; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.knowledge-detail-scroll .knowledge-table-preview { max-width: 100%; overflow-x: auto; }
@media (max-width: 760px) { .knowledge-model-description { grid-template-columns: minmax(0,1fr); } }
.knowledge-detail-scroll .knowledge-form select { height: 40px; }
#knowledgeAccessForm select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #d5dee6; border-radius: 7px; background: #fff; color: #33424d; font: inherit; }
#knowledgeAccessForm fieldset { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0; padding: 14px; border: 1px solid #dce3ed; border-radius: 8px; }
#knowledgeAccessForm legend { padding: 0 6px; color: #687784; font-size: 12px; }
#knowledgeAccessForm label:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; }
#knowledgeAccessForm input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: #2d63d6; }
@media (max-width: 480px) { #knowledgeAccessForm fieldset { grid-template-columns: minmax(0,1fr); } }
.knowledge-segment-table { width: 100%; table-layout: fixed; }
.knowledge-segment-table th:first-child { width: 48px; }
.knowledge-segment-table th:nth-child(2) { width: 84px; }
.knowledge-segment-table th:last-child { width: 120px; }
.knowledge-segment-table td { vertical-align: top; overflow-wrap: anywhere; }
.knowledge-segment-table td > small { display: block; margin-top: 6px; color: #8994a0; font-size: 11px; }
.knowledge-segment-table .knowledge-preview-block { border: 0; padding: 0; }

/* 列表行操作与状态圆点：四态与删除中。 */
.knowledge-row-actions { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
.knowledge-row-actions :is(.primary-button,.secondary-button) { min-height: 32px; padding: 5px 10px; font-size: 11px; white-space: nowrap; }
.knowledge-status.pending::before { background: #5c7cd6; }
.knowledge-status.deleting::before { background: #9aa5b1; }

/* 居中弹窗：上传文档与文档设置共用白底蓝配色，复用控制台 modal 观感。 */
.knowledge-modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(15, 35, 62, .38); }
.knowledge-modal-backdrop[hidden] { display: none; }
.knowledge-modal-card { position: relative; display: flex; flex-direction: column; width: min(560px, 100%); max-height: 85vh; border-radius: 16px; background: #fff; box-shadow: 0 24px 64px rgba(15, 35, 62, .26); overflow: hidden; }
.knowledge-modal-card-wide { width: min(720px, 100%); }
.knowledge-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 14px; border-bottom: 1px solid #edf0f3; }
.knowledge-modal-head h2 { margin: 0; color: #22303c; font-size: 16px; }
.knowledge-modal-head p { margin: 6px 0 0; color: #7b8795; font-size: 12px; line-height: 1.6; }
.knowledge-modal-close { flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid #d9e1e8; border-radius: 8px; background: #fff; color: #50606c; font-size: 18px; line-height: 1; cursor: pointer; }
.knowledge-modal-close:hover { background: #f2f5f8; }
.knowledge-modal-close:focus-visible { outline: 2px solid #8eaff0; outline-offset: 2px; }
.knowledge-modal-body { padding: 20px 24px; overflow: auto; }
.knowledge-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid #edf0f3; background: #fafbfd; }
.knowledge-modal-form { display: grid; gap: 14px; }
.knowledge-modal-field { display: grid; gap: 6px; min-width: 0; color: #687582; font-size: 11px; font-weight: 650; }
.knowledge-modal-field-full { grid-column: 1 / -1; }
.knowledge-modal-field input,
.knowledge-modal-field select { width: 100%; min-height: 40px; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d5dee6; border-radius: 7px; background: #fff; color: #33424d; font: inherit; font-size: 12px; }
.knowledge-modal-field input:focus,
.knowledge-modal-field select:focus { border-color: #5f86d8; box-shadow: 0 0 0 3px rgba(45, 99, 214, .1); outline: 0; }
.knowledge-modal-field :is(input,select):disabled { background: #f4f6f7; color: #64717d; cursor: not-allowed; }
.knowledge-modal-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
.knowledge-modal-subtitle { margin: 0 0 8px; color: #435361; font-size: 12px; font-weight: 700; }
.knowledge-modal-form .form-error { grid-column: 1 / -1; }
.knowledge-modal-card .muted-copy { margin: 0; color: #7b8795; font-size: 11px; font-weight: 400; line-height: 1.6; }
.knowledge-modal-form :is(.knowledge-modal-check,.knowledge-role-option) input[type="checkbox"],
.knowledge-modal-form .permission-checklist input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: #2d63d6; }
.knowledge-role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.knowledge-role-option,
.knowledge-modal-form .permission-checklist label { display: flex; align-items: center; gap: 8px; color: #435361; font-size: 12px; font-weight: 400; }
.knowledge-modal-form .permission-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; padding: 12px 14px; border: 1px solid #dce3ed; border-radius: 8px; min-width: 0; }
.knowledge-modal-form .permission-checklist legend { padding: 0 6px; color: #687784; font-size: 12px; }
@media (max-width: 560px) {
  .knowledge-role-options,
  .knowledge-modal-form .permission-checklist { grid-template-columns: minmax(0, 1fr); }
}

/* 独立检索问答页：左侧检索设置 + 右侧问答工作区，仅展示命中片段与来源，不调用生成模型。 */
#knowledgeRetrievalPanel { overflow: hidden; container-type: inline-size; }
.knowledge-retrieval-shell { display: grid; grid-template-columns: minmax(248px, 302px) minmax(0, 1fr); min-height: 560px; }
.knowledge-retrieval-shell.is-loading { display: block; min-height: 260px; }
.knowledge-retrieval-side { display: grid; align-content: start; gap: 16px; min-width: 0; padding: 20px 20px 22px; border-right: 1px solid var(--line, #e2e6ea); background: #fafbfd; }
.knowledge-retrieval-side-head { display: grid; gap: 8px; }
.knowledge-retrieval-side-head h2 { margin: 0; color: var(--ink, #18212d); font-size: 17px; overflow-wrap: anywhere; }
.knowledge-retrieval-side-head p { margin: 0; color: #74818f; font-size: 11.5px; line-height: 1.65; }
.knowledge-retrieval-eyebrow { color: #7b8795; font-size: 10px; letter-spacing: .1em; }
.knowledge-field { display: grid; gap: 6px; }
.knowledge-field label { display: grid; gap: 6px; color: #687582; font-size: 11px; font-weight: 650; }
.knowledge-field select { width: 100%; min-height: 40px; padding: 8px 36px 8px 11px; border: 1px solid #d5dee6; border-radius: 7px; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23687484' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 10px 6px; color: #33424d; font: inherit; font-size: 12px; cursor: pointer; appearance: none; -webkit-appearance: none; }
.knowledge-field select:hover { border-color: #bdcbd9; }
.knowledge-field select:focus { border-color: #86a7eb; outline: 0; box-shadow: 0 0 0 3px rgba(45, 99, 214, .12); }
.knowledge-retrieval-static { display: flex; align-items: center; min-height: 40px; padding: 8px 10px; border: 1px solid #e0e6ed; border-radius: 7px; background: #f4f6f7; color: #55616d; font-size: 12px; }
.knowledge-retrieval-facts { display: grid; gap: 1px; margin: 0; border: 1px solid #e6ebf1; border-radius: 9px; background: #e6ebf1; overflow: hidden; }
.knowledge-retrieval-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 11px; background: #fff; }
.knowledge-retrieval-facts dt { color: #7b8795; font-size: 11px; }
.knowledge-retrieval-facts dd { margin: 0; color: #33424d; font-size: 11.5px; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.knowledge-retrieval-side-actions { display: grid; }
.knowledge-retrieval-side-actions .secondary-button { width: 100%; min-height: 38px; color: var(--blue, #2d63d6); font-size: 11.5px; font-weight: 650; }
.knowledge-retrieval-main { display: flex; flex-direction: column; min-width: 0; background: #fff; }
.knowledge-retrieval-log { flex: 1 1 auto; display: grid; align-content: start; gap: 22px; min-height: 380px; max-height: min(62vh, 660px); padding: 20px 22px; overflow: auto; overscroll-behavior: contain; background: #fbfcfd; }
.knowledge-retrieval-hint { display: grid; align-self: center; justify-self: center; gap: 5px; max-width: 430px; padding: 26px 24px; border: 1px dashed #dbe2ea; border-radius: 10px; background: #fff; color: #87919d; font-size: 11.5px; line-height: 1.7; text-align: center; }
.knowledge-retrieval-hint strong { color: #435361; font-size: 13px; }
.knowledge-retrieval-hint p { margin: 0; }
.knowledge-retrieval-turn { display: grid; gap: 10px; }
.knowledge-retrieval-question { display: flex; align-items: flex-start; gap: 10px; }
.knowledge-retrieval-avatar { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: #eaf0fd; color: var(--blue, #2d63d6); font-size: 11px; font-weight: 750; }
.knowledge-retrieval-question p { margin: 3px 0 0; color: #26323d; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.knowledge-retrieval-answer { display: grid; gap: 10px; margin-left: 36px; padding: 14px 16px; border: 1px solid #e3e8ef; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(25, 43, 67, .03); min-width: 0; }
.knowledge-retrieval-answer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.knowledge-retrieval-answer-head strong { color: #22303c; font-size: 12px; }
.knowledge-retrieval-answer-head span { color: #96a0aa; font-size: 10.5px; }
.knowledge-retrieval-error { padding: 11px 13px; border: 1px solid #f2d7d7; border-radius: 8px; background: #fdf3f3; color: #b04b4b; font-size: 12px; line-height: 1.65; }
.knowledge-retrieval-warnings { display: grid; gap: 4px; margin: 0; padding: 9px 11px 9px 28px; border: 1px solid #f3e7cd; border-radius: 8px; background: #fffbf2; color: #9b6b14; font-size: 11px; line-height: 1.65; }
.knowledge-retrieval-warnings li::marker { color: #c99a44; }
.knowledge-retrieval-nohit { padding: 14px; border: 1px dashed #dbe2ea; border-radius: 8px; background: #fafbfd; color: #87919d; font-size: 12px; line-height: 1.7; }
.knowledge-retrieval-loading { display: flex; align-items: center; gap: 9px; color: #7b8795; font-size: 12px; }
.knowledge-retrieval-spinner { width: 13px; height: 13px; border: 2px solid #d7e1f2; border-top-color: var(--blue, #2d63d6); border-radius: 50%; animation: knowledge-spin .8s linear infinite; }
@keyframes knowledge-spin { to { transform: rotate(360deg); } }
.knowledge-retrieval-hits { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.knowledge-retrieval-hit { min-width: 0; padding: 12px 13px; border: 1px solid #e8edf2; border-radius: 9px; background: #fcfdfe; }
.knowledge-retrieval-hit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.knowledge-retrieval-rank { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: #eef2f8; color: #5b6b7d; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.knowledge-retrieval-kind { padding: 2px 7px; border-radius: 999px; background: #eef3fb; color: var(--blue, #2d63d6); font-size: 10px; }
.knowledge-retrieval-score { margin-left: auto; color: var(--blue, #2d63d6); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.knowledge-retrieval-text { margin: 0; padding: 10px 12px; border-radius: 7px; background: #f7f9fc; color: #435361; font: inherit; font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.knowledge-retrieval-image { display: grid; justify-items: start; gap: 8px; margin: 0; }
.knowledge-retrieval-image img { max-width: 100%; max-height: 320px; border: 1px solid #e6ebf1; border-radius: 8px; background: #fafbfd; cursor: zoom-in; }
.knowledge-retrieval-image figcaption { color: #7b8795; font-size: 11px; }
.knowledge-retrieval-image-status { padding: 18px 20px; border: 1px dashed #dbe2ea; border-radius: 8px; background: #fff; color: #87919d; font-size: 11px; }
.knowledge-retrieval-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 9px; color: #7b8795; font-size: 10.5px; }
.knowledge-retrieval-form { display: grid; gap: 8px; padding: 14px 18px 16px; border-top: 1px solid #e8edf2; background: #fff; }
.knowledge-field-label { color: #687582; font-size: 11px; font-weight: 650; }
.knowledge-retrieval-form textarea { width: 100%; min-height: 66px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d5dee6; border-radius: 8px; background: #fff; color: #33424d; font: inherit; font-size: 13px; resize: vertical; }
.knowledge-retrieval-form textarea:focus { border-color: #86a7eb; outline: 0; box-shadow: 0 0 0 3px rgba(45, 99, 214, .12); }
.knowledge-retrieval-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.knowledge-retrieval-form-foot span { color: #96a0aa; font-size: 10.5px; }
.knowledge-retrieval-form-foot .primary-button { min-height: 38px; padding: 0 20px; }
.knowledge-retrieval-state { display: grid; justify-items: center; align-content: center; gap: 10px; min-height: 420px; padding: 40px 24px; text-align: center; color: #7b8795; font-size: 12px; line-height: 1.8; }
.knowledge-retrieval-state-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #eef3fb; color: var(--blue, #2d63d6); font-size: 17px; font-weight: 700; }
.knowledge-retrieval-state.is-error .knowledge-retrieval-state-icon { background: #fdf0f0; color: #b04b4b; }
.knowledge-retrieval-state h3 { margin: 2px 0 0; color: #22303c; font-size: 15px; }
.knowledge-retrieval-state p { max-width: 440px; margin: 0; }
.knowledge-retrieval-state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.knowledge-retrieval-loading-panel { display: grid; place-items: center; min-height: 260px; color: #7b8795; font-size: 12px; }
.knowledge-retrieval-lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 68px 32px 32px; background: rgba(15, 35, 62, .72); }
.knowledge-retrieval-lightbox img { max-width: min(92vw, calc(100vw - 64px)); max-height: 88vh; border-radius: 10px; box-shadow: 0 24px 64px rgba(0, 0, 0, .4); cursor: zoom-out; }
.knowledge-retrieval-lightbox-close { position: fixed; top: 18px; right: 18px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .5); border-radius: 10px; background: rgba(15, 35, 62, .82); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.knowledge-retrieval-lightbox-close:hover { background: rgba(15, 35, 62, .96); }
.knowledge-retrieval-lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@container (max-width: 880px) {
  .knowledge-retrieval-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .knowledge-retrieval-side { gap: 12px; border-right: 0; border-bottom: 1px solid var(--line, #e2e6ea); }
  .knowledge-retrieval-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .knowledge-retrieval-facts > div { flex-direction: column; align-items: flex-start; gap: 2px; }
  .knowledge-retrieval-facts dd { text-align: left; }
  .knowledge-retrieval-hint { margin: 20px 0; }
}
@container (max-width: 620px) {
  .knowledge-retrieval-log { max-height: none; padding: 16px; }
  .knowledge-retrieval-answer { margin-left: 0; padding: 12px; }
  .knowledge-retrieval-facts { grid-template-columns: minmax(0, 1fr); }
  .knowledge-retrieval-form-foot { align-items: flex-start; flex-direction: column; }
  .knowledge-retrieval-form-foot .primary-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .knowledge-retrieval-spinner { animation: none; }
  .knowledge-version-card { transition: none; }
}
