:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --rail: #fbfbfc;
  --line: #e8ebf0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #111827;
  --soft: #f3f4f6;
  --green: #14b86a;
  --blue: #3b82f6;
  --red: #dc2626;
  --amber: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

button:hover {
  background: #fafafa;
}

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

button.danger-text {
  color: var(--red);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
}

textarea {
  resize: none;
}

.hidden {
  display: none !important;
}

.mt8 {
  margin-top: 8px;
}

.mt16 {
  margin-top: 16px;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px 300px minmax(0, 1fr);
  height: 100vh;
}

.app-shell--no-rail {
  grid-template-columns: minmax(0, 1fr);
}

/* 操作日志：仅主内容区，无窄栏 / 知识库侧栏 */
.app-shell--operation-logs {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-header--logs {
  justify-content: flex-start;
  align-items: flex-start;
}

.workspace-header--logs.workspace-header--logs-with-actions {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.workspace-header-logs-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.workspace-header-logs-main h1 {
  margin: 0;
  font-size: 22px;
}

.logs-back-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.logs-back-btn:hover {
  background: #f8fafc;
}

/* 专属知识库：视图切换 + [搜索/文件夹/标签 | 主区] 同一模块 */
.kb-module {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1;
  height: 100%;
}

.kb-module-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  min-width: 0;
  align-items: stretch;
}

.kb-module-body > .kb-nav-sidebar {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.kb-sidebar-standard {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.kb-sidebar-ai-tree {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.kb-layout-ai .kb-sidebar-standard {
  display: none !important;
}

.kb-layout-ai .kb-sidebar-ai-tree {
  display: flex !important;
}

.kb-layout-ai .kb-nav-sidebar {
  overflow: hidden;
}

.kb-layout-ai #aiKbFolderFileTree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.ai-kb-tree-inner {
  padding-bottom: 8px;
}

.ai-kb-tree-folder .tree-left {
  min-width: 0;
}

.ai-kb-tree-folder .tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-kb-scope-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 2px;
  cursor: pointer;
}

.ai-kb-scope-check-wrap input {
  cursor: pointer;
}

.tree-file-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ai-kb-file-path {
  font-size: 11px;
  line-height: 1.3;
  word-break: break-all;
}

.tree-file-leaf {
  display: inline-block;
  width: 10px;
  flex-shrink: 0;
}

.tree-row--file {
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 0;
}

.tree-row--file:hover {
  background: #f1f5f9;
}

.tree-row--file.active {
  background: #eff6ff;
}

.tree-row--file .tree-name--file {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.tree-file-ext {
  flex-shrink: 0;
  font-size: 11px;
  margin-left: 6px;
}

.tree-folder-meta {
  flex-shrink: 0;
  margin-left: 8px;
  font-size: 11px;
}

.ai-kb-tree-children {
  border-left: 1px dashed #e2e8f0;
  margin-left: 10px;
  padding-left: 4px;
}

.kb-module-body > .workspace {
  min-width: 0;
  min-height: 0;
}

/* 首页：仅保留视图切换 + 居中对话，隐藏左侧栏 */
.kb-module--home .kb-module-body {
  grid-template-columns: 1fr;
}

.kb-module--home .kb-nav-sidebar {
  display: none !important;
}

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

.preview-page-workspace {
  border-left: none;
}

.preview-back-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.app-rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 14px 10px;
}

.rail-logo,
.rail-user {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 6px;
}

.rail-user {
  margin-top: auto;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.rail-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  font-size: 12px;
  text-decoration: none;
  text-align: center;
}

.rail-item.active {
  background: #edf9f2;
  color: #0e9f5b;
}

.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.rail-brand-name {
  font-size: 12px;
  line-height: 1.25;
  color: inherit;
}

.rail-brand-mark {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  color: #0369a1;
  line-height: 1.2;
}

.rail-item.active .rail-brand-mark {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #047857;
}

.space-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-brand-mark {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  color: #0369a1;
}

.space-sidebar,
.library-panel {
  background: var(--panel);
  overflow: auto;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.library-panel {
  border-right: none;
  border-left: 1px solid var(--line);
}

.space-header,
.workspace-header,
.library-header,
.composer-footer,
.explorer-topbar,
.modal-head,
.modal-row,
.modal-actions,
.manage-item,
.target-item,
.upload-row,
.link-row,
.table-actions,
.call-toolbar,
.sync-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.space-title,
.panel-title {
  font-size: 18px;
  font-weight: 700;
}

.space-subtitle,
.panel-subtitle,
.section-label,
.crumb,
.folder-meta,
.batch-summary,
.empty-text,
.detail-box,
.upload-meta,
.modal-tip,
.resume-tip,
.sync-item,
.global-upload-text {
  color: var(--muted);
  font-size: 12px;
}

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

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.space-search {
  margin: 16px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-tree {
  margin-top: 10px;
}

.tree-node {
  margin-bottom: 2px;
}

.tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.tree-row.active {
  background: #eef6ff;
}

.tree-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tree-toggle {
  width: 18px;
  text-align: center;
  color: var(--muted);
}

.tree-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-count {
  color: var(--muted);
  font-size: 12px;
}

.tree-children {
  padding-left: 18px;
}

.chip-wrap,
.header-actions,
.scope-bar,
.composer-meta,
.sync-filters,
.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.scope-chip,
.meta-chip,
.status-pill,
.mini-tag {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.chip.active,
.sync-filter.active {
  border-color: var(--blue);
  color: var(--blue);
}

.sidebar-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
}

.sidebar-card-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.sidebar-card-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 22px;
}

.workspace h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  font-weight: 700;
}

.brand-badge img {
  width: 24px;
  height: 24px;
}

.sync-log-section {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  max-height: min(320px, 40vh);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sync-log-section .sync-list {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* 独立「同步记录」页：列表可完整展开 */
.sync-log-section--page {
  max-height: none;
  margin-top: 16px;
}

.sync-records-page .sync-page-block-title {
  font-size: 15px;
  font-weight: 700;
  margin: 22px 0 10px;
  color: var(--text);
}

.sync-records-page .list-wrap--flush {
  margin-top: 0;
}

.sync-log-section--page > .list-wrap--flush {
  margin-top: 10px;
}

.btn-sync-log {
  border-color: #cbd5e1;
  background: #fff;
}

a.btn-sync-log {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.btn-sync-log[aria-expanded="true"] {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.explorer-rail-link {
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--blue);
}

.explorer-rail-link:hover {
  background: #f3f4f6;
}

.scope-bar {
  margin-top: 14px;
}

.explorer-section {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 280px;
  padding: 14px;
}

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

.summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
}

.summary-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 8px;
}

.summary-desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.hero-panel {
  width: min(680px, 100%);
  margin: 24px auto;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 32px;
}

.hero-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #ecfdf3;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.hero-panel h2 {
  margin: 0 0 10px;
}

.hero-panel p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.explorer-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-toolbar,
.preview-left,
.preview-actions,
.preview-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-toolbar {
  justify-content: space-between;
}

.preview-title {
  font-size: 18px;
  font-weight: 700;
}

.preview-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.preview-tab.active {
  background: var(--soft);
  border-color: #d7dbe3;
}

.preview-meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px 18px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.preview-meta-item {
  margin: 0;
}

.preview-meta-item dt {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 600;
}

.preview-meta-item dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.preview-find-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.preview-find-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.preview-find-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.preview-find-hint {
  font-size: 12px;
  color: var(--muted);
}

.preview-panel--viewer {
  min-height: 480px;
  max-height: min(78vh, 900px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  white-space: normal;
}

.preview-file-frame {
  flex: 1;
  width: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}

.preview-docx-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  background: #fff;
  white-space: normal;
}

.preview-loading,
.preview-error {
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}

.preview-error {
  color: #b91c1c;
}

.preview-origin-note {
  margin: 0;
  padding: 20px;
  line-height: 1.75;
  color: var(--muted);
  font-size: 14px;
}

.preview-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  min-height: 200px;
  white-space: pre-wrap;
  line-height: 1.8;
}

.preview-panel-scroll {
  max-height: min(440px, 52vh);
  overflow: auto;
}

.preview-panel--viewer.preview-panel-scroll {
  max-height: min(78vh, 900px);
}

.preview-highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

.path-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
}

.path-item {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f8fafc;
}

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

.sort-type-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.sort-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px 8px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.sort-type-btn:last-child {
  border-right: none;
}

.sort-type-btn:hover {
  background: #f8fafc;
  color: var(--text);
}

.sort-type-btn.active {
  background: #edf9f2;
  color: #0e9f5b;
  font-weight: 600;
}

.sort-type-btn__arrows {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  line-height: 1;
  font-size: 9px;
  letter-spacing: 0;
  -webkit-user-select: none;
  user-select: none;
}

.sort-arr {
  display: block;
  color: var(--muted);
  opacity: 0.35;
  line-height: 1;
  font-weight: 500;
}

.sort-type-btn.active .sort-arr--active {
  opacity: 1;
  color: #0e9f5b;
  font-weight: 700;
}

.batch-toolbar {
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 14px;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.disabled-action {
  opacity: 0.55;
}

.list-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}

.explorer-list-summary {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 4px 0;
  line-height: 1.5;
}

.path-cell {
  max-width: 200px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #ecfdf3;
  color: #15803d;
}

.status-pill.status-warn {
  background: #fff7ed;
  color: #c2410c;
}

.status-pill.status-bad {
  background: #fef2f2;
  color: #b91c1c;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table th,
.file-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 12px;
  font-size: 14px;
  vertical-align: top;
}

.file-table th {
  background: #fafbff;
}

.file-table tr:hover {
  background: #fcfcfd;
}

.checkbox-cell {
  width: 40px;
}

.file-name-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.file-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.file-tag-list,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.name-folder::before,
.name-file::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 4px;
}

.name-folder::before {
  background: #fde68a;
}

.name-file::before {
  background: #bfdbfe;
}

.chat-area {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 0 12px;
}

.message-list {
  max-width: 900px;
  margin: 0 auto;
}

.message {
  margin-bottom: 16px;
}

.message-role {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.message-bubble {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.citation-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.citation-card {
  border: 1px solid #dbe7ff;
  background: #f8fbff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
}

.citation-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.composer-panel {
  padding-top: 12px;
}

.composer-input-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ai-toolbox {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.ai-mode-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.ai-mode-tab.active {
  background: var(--soft);
  border-color: #d7dbe3;
}

.ai-config-inline {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafbfc;
}

.ai-config-panel--inline {
  gap: 6px;
}

.ai-config-panel--inline .ai-prompt-editor {
  min-height: 120px;
}

.ai-config-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.ai-config-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-config-title {
  font-size: 15px;
  font-weight: 700;
}

.ai-config-hint {
  font-size: 12px;
  color: var(--muted);
}

.ai-config-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.ai-prompt-editor {
  flex: 1;
  min-height: 160px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
}

.ai-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
}

.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.detail-tabs,
.tab-switch {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.library-tab.active,
.tab-btn.active,
.switch-tab.active {
  background: var(--soft);
  border-color: #d7dbe3;
}

.call-toolbar {
  margin-bottom: 12px;
}

.call-file-list,
.sync-list,
.upload-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-item,
.sync-item,
.upload-item,
.manage-item,
.target-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.call-item.active {
  border-color: var(--blue);
  background: #f8fbff;
}

.call-main,
.sync-main,
.upload-main,
.manage-main,
.target-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.call-top,
.sync-top,
.upload-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-track,
.global-upload-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.progress-fill,
.global-upload-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.status-success {
  color: var(--green);
}

.status-failed {
  color: var(--red);
}

.status-processing {
  color: var(--amber);
}

.detail-name {
  font-size: 16px;
  font-weight: 700;
}

.detail-box {
  white-space: pre-wrap;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.sync-toolbar {
  margin-bottom: 12px;
}

.sync-filter {
  border-radius: 999px;
}

.sync-status {
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.36);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: min(640px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(17, 24, 39, 0.18);
}

.modal-lg {
  width: min(840px, 100%);
}

.modal-xl {
  width: min(980px, 100%);
}

.modal-card--chat-history {
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-card--chat-history #chatHistoryListView,
.modal-card--chat-history #chatHistoryDetailView {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-card--chat-history .modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-card--chat-history .modal-title {
  flex: 1;
  min-width: 0;
}

.chat-history-back {
  flex-shrink: 0;
}

.chat-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.chat-history-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.chat-history-select-all input {
  cursor: pointer;
}

.chat-history-list {
  flex: 1;
  min-height: 200px;
  max-height: min(52vh, 420px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.chat-history-hint {
  margin-top: 12px;
  margin-bottom: 0;
}

.chat-history-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.chat-history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.chat-history-item:last-child {
  border-bottom: none;
}

.chat-history-item-check {
  flex-shrink: 0;
  padding-top: 2px;
  cursor: pointer;
}

.chat-history-item-check input {
  cursor: pointer;
}

.chat-history-item-main {
  flex: 1;
  min-width: 0;
}

.chat-history-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  word-break: break-word;
}

.chat-history-item-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.chat-history-detail-meta {
  margin-bottom: 12px;
}

.chat-history-detail-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  word-break: break-word;
}

.chat-history-detail-actions {
  margin-top: 10px;
}

.chat-history-detail-messages {
  max-height: min(56vh, 480px);
  overflow: auto;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.modal-card--ai-config {
  width: min(520px, 100%);
}

.ai-config-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.ai-config-modal-body .ai-prompt-editor {
  min-height: 160px;
}

.modal-head-actions {
  display: flex;
  gap: 8px;
}

.picker-row,
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: auto;
}

.resume-tip {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.upload-item.invalid {
  border-color: #fecaca;
  background: #fef2f2;
}

.upload-item.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.upload-item.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.modal-actions {
  margin-top: 16px;
}

.modal-actions-between {
  justify-content: space-between;
}

.target-item input {
  width: auto;
}

.manage-actions,
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.context-menu {
  position: fixed;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 60;
}

.context-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 10px;
}

.context-menu button:hover {
  background: #f5f7fb;
}

.context-menu button.disabled-action {
  pointer-events: auto;
}

.global-upload {
  position: fixed;
  top: 12px;
  right: 20px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 65;
}

.global-upload-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.global-upload-text {
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  z-index: 80;
}

.search-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input-row input {
  flex: 1;
  min-width: 0;
}

.search-history-wrap {
  margin-top: 10px;
}

.search-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.search-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow: auto;
}

.search-history-item {
  font-size: 12px;
  color: var(--blue);
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}

.file-tag-list .mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.mini-tag-ai {
  border-color: #93c5fd;
  background: #eff6ff;
}

.tag-ai-badge {
  font-size: 10px;
  padding: 0 4px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.tag-confidence {
  font-size: 10px;
  color: var(--muted);
}

.tag-conf-高 {
  color: #15803d;
}

.tag-conf-中 {
  color: #b45309;
}

.tag-conf-低 {
  color: #6b7280;
}

.btn-row-more {
  padding: 4px 10px;
  min-width: 36px;
}

.summary-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.summary-len-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.summary-len-opt input {
  width: auto;
}

.tag-create-row {
  flex-wrap: wrap;
}

.tag-create-row select {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.preset-tag-block {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.preset-tag-block strong {
  color: var(--text);
}

.classify-preview-scroll {
  max-height: 48vh;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.batch-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.batch-result-table th,
.batch-result-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.batch-result-table th {
  background: #fafafa;
  font-weight: 600;
}

.status-ok {
  color: #15803d;
}

.status-fail {
  color: #b91c1c;
}

/* —— 工作台外壳（左侧导航 + 顶栏），原型嵌入 workbench-embed —— */
.workbench {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.workbench-sidenav {
  width: 228px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 10px 20px;
  overflow-y: auto;
}

.workbench-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid #f0f2f5;
}

.workbench-brand-logo {
  flex-shrink: 0;
}

.workbench-brand-text {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.02em;
}

.workbench-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workbench-section {
  margin-top: 14px;
}

.workbench-section:first-of-type {
  margin-top: 4px;
}

.workbench-section-title {
  font-size: 11px;
  color: #9ca3af;
  padding: 6px 10px 8px;
  letter-spacing: 0.04em;
}

.workbench-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #4b5563;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.3;
  transition: background 0.12s ease, color 0.12s ease;
}

.workbench-nav-item:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.workbench-nav-item--active {
  background: #e8f1fe;
  color: #2563eb;
  font-weight: 500;
}

.workbench-nav-item--active .workbench-icon {
  color: #2563eb;
}

.workbench-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.workbench-nav-item:hover .workbench-icon {
  color: #374151;
}

.workbench-nav-label {
  flex: 1;
  min-width: 0;
}

.workbench-badge {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.workbench-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #eef1f6;
}

.workbench-topbar {
  flex-shrink: 0;
  min-height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f0f3f8;
  border-bottom: 1px solid #e2e6ed;
}

.workbench-breadcrumb {
  font-size: 14px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-bc-root {
  color: #6b7280;
}

.workbench-bc-sep {
  color: #d1d5db;
  -webkit-user-select: none;
  user-select: none;
}

.workbench-bc-current {
  color: #111827;
  font-weight: 500;
}

.workbench-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workbench-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workbench-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}

.workbench-user-line {
  font-size: 13px;
  color: #374151;
}

.workbench-user-line--muted {
  font-size: 12px;
  color: #9ca3af;
}

.workbench-embed {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  margin: 12px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#workbenchEmbedTarget {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#workbenchEmbedTarget > .app-shell {
  height: 100%;
  min-height: 0;
}

.sidebar-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-quick-link {
  text-decoration: none;
  font-size: 13px;
  margin-left: auto;
}

.workspace-header.workspace-header--actions-only {
  justify-content: flex-end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

/* 文件视图：顶栏快捷操作（上传 / 链接 / 同步 / 同步记录） */
.kb-files-toolbar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 0 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.kb-view-files .kb-files-toolbar {
  display: flex;
}

.kb-files-toolbar-link {
  text-decoration: none;
  color: inherit;
  margin-left: auto;
}

.kb-files-toolbar-link:hover {
  color: #1d4ed8;
}

/* —— 专属知识库：首页 / 操作 / AI 三视图 —— */
.kb-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kb-layout-switch {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  margin: 0 0 10px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.kb-layout-switch-btns {
  display: inline-flex;
  gap: 6px;
  padding: 3px;
  background: #eef2f7;
  border-radius: 10px;
}

.kb-layout-btn {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.kb-layout-btn:hover {
  color: var(--text);
}

.kb-layout-btn.active {
  background: #fff;
  color: #1d4ed8;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.kb-explorer-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.kb-workbench-ai {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  padding-top: 4px;
}

.kb-chat-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.composer-toolbar-imo {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.imo-chip {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: default;
}

.composer-actions--wide {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 文件页：仅资源列表与操作，不展示 AI 提问/总结/标签/归类、AI 配置与发送区 */
.kb-view-files .kb-workbench-ai {
  display: none !important;
}

.kb-view-files .kb-explorer-stack {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.kb-view-files .explorer-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* AI 视图：全宽对话区，隐藏文件表 */
.kb-view-ai .kb-explorer-stack {
  flex: 0 0 auto;
  min-height: 0;
}

.kb-view-ai #explorerSection {
  display: none !important;
}

.kb-view-ai .kb-workbench-ai {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  padding-top: 0;
  max-height: none;
  position: relative;
}

.kb-ai-view-close {
  display: none;
}

.kb-view-ai .kb-ai-view-close {
  display: inline-flex;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.kb-view-ai .kb-ai-view-close:hover {
  color: #0f172a;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.kb-files-ai-fab {
  display: none;
}

.kb-view-files .kb-files-ai-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 8;
  min-width: 52px;
  height: 52px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #1d4ed8 0%, #312e81 100%);
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.35);
}

.kb-view-files .kb-files-ai-fab:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(29, 78, 216, 0.4);
}

.kb-view-files .kb-files-ai-fab:active {
  transform: scale(0.98);
}

.kb-view-ai .kb-chat-stack {
  flex: 1;
  min-height: 0;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.kb-view-ai .kb-chat-stack .chat-area {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.kb-view-ai .composer-input-wrap {
  flex-shrink: 0;
}

/* 首页：居中对话主壳；隐藏文件列表 */
.kb-view-home .kb-explorer-stack {
  display: none !important;
}

.kb-view-home .kb-layout-switch {
  margin-bottom: 8px;
}

.kb-view-home .kb-workbench-ai {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px 32px;
  overflow: auto;
  max-height: none;
}

.kb-view-home .kb-chat-stack {
  order: 1;
  width: 100%;
  max-width: 680px;
  flex-direction: column-reverse;
  gap: 12px;
}

/* 首页不展示对话记录，发送后切至 AI 视图查看结果 */
.kb-view-home .kb-chat-stack .chat-area {
  display: none !important;
}

.kb-view-home .composer-box {
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  border-color: #e2e8f0;
}

.kb-view-home .composer-box textarea {
  min-height: 120px;
  border-radius: 16px;
  font-size: 15px;
}

.kb-view-home .composer-toolbar-imo {
  display: flex;
}

.kb-view-home .composer-input-wrap > .ai-toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  width: 100%;
  margin-top: 2px;
}

.kb-view-home .ai-mode-tab {
  flex: 0 1 auto;
  min-width: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  border-color: #e2e8f0;
  background: #fafbfc;
  color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.kb-view-home .ai-mode-tab:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #334155;
}

.kb-view-home .ai-mode-tab.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
}

.kb-view-home .composer-meta {
  display: none;
}

.kb-view-ai .composer-meta {
  display: flex;
}

/* AI 视图：底部已有「对话模式 / 智能体模式 / 知识库范围」，隐藏输入区上方重复一排 */
.kb-view-ai .composer-toolbar-imo {
  display: none !important;
}

.composer-meta--ai-modes button.meta-chip {
  cursor: pointer;
  font: inherit;
  line-height: inherit;
}

.meta-chip--action {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.meta-chip--action:hover {
  background: #dbeafe;
}

.composer-ai-config-btn {
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
}

.composer-mode-toggle.imo-chip {
  cursor: pointer;
}

/* 首页：隐藏「发起新会话」（与 AI 视图分工）；「历史记录」保留以便查看已归档对话 */
.kb-view-home .composer-actions--wide #btnNewChatSession {
  display: none !important;
}

.imo-chip--active {
  cursor: pointer;
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.imo-chip--active:hover {
  background: #dbeafe;
}

/* 对话模式 / 智能体模式切换（与 AI 提问、总结/标签/归类联动） */
#btnDialogueModeToggle {
  cursor: pointer;
}

.imo-chip--dialogue {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.imo-chip--dialogue:hover {
  background: #dbeafe;
}

.imo-chip--agent-mode {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: #c4b5fd;
}

.imo-chip--agent-mode:hover {
  background: #ede9fe;
}

.kb-scope-chosen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 6px 0 2px;
}

.kb-scope-chosen-empty {
  font-size: 12px;
  color: var(--muted);
}

.kb-scope-chosen-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
}

.kb-scope-name-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-scope-modal-body {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(220px, 1fr);
  gap: 16px;
  min-height: 300px;
  margin-top: 12px;
}

.kb-scope-pane-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.kb-scope-folder-list,
.kb-scope-file-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  max-height: 360px;
  overflow: auto;
  background: #fff;
}

.kb-scope-file-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.kb-scope-file-row:hover {
  background: #f8fafc;
}

.kb-scope-modal-summary {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 10px;
  line-height: 1.5;
}

/* —— 智能体配置（独立页 agent-config.html）—— */
.agent-config-workspace h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.agent-config-section {
  padding-top: 8px;
}

.agent-config-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.agent-config-table .agent-cell-url {
  max-width: 280px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-avatar-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.agent-avatar-thumb--corp {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
}

.agent-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.agent-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.agent-toggle-ui {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.15s ease;
  position: relative;
}

.agent-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

.agent-toggle input:checked + .agent-toggle-ui {
  background: var(--green);
}

.agent-toggle input:checked + .agent-toggle-ui::after {
  transform: translateX(18px);
}

.modal-card--agent-edit {
  width: min(760px, 100%);
  max-height: 90vh;
}

.modal-card--agent-edit .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-card--agent-edit .modal-title {
  margin: 0;
  font-size: 17px;
}

.agent-edit-form {
  margin-top: 8px;
}

.agent-edit-avatar {
  margin-bottom: 16px;
}

.agent-avatar-drop {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: #fafbfc;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.agent-avatar-drop:hover {
  background: #f3f4f6;
  border-color: #cbd5e1;
}

.agent-avatar-input {
  display: none;
}

.agent-avatar-filename {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.agent-avatar-hint {
  font-size: 12px;
  color: var(--muted);
}

.required-star {
  color: var(--red);
  margin-right: 2px;
}

.form-json-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.form-json-head .modal-label {
  margin: 0;
}

.agent-form-json-editor {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  min-height: 200px;
}

.agent-char-count {
  text-align: right;
  margin-top: 4px;
}

.modal--stack {
  z-index: 60;
}

.kb-maintainer-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.kb-maintainer-summary {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.kb-maintainer-summary--empty {
  color: var(--muted);
}

.modal-card--kb-user-picker .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-card--kb-user-picker .modal-title {
  margin: 0;
  font-size: 17px;
}

.kb-picker-intro {
  margin-top: 0;
  margin-bottom: 12px;
}

.kb-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.kb-picker-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.kb-picker-select-all input {
  width: auto;
  cursor: pointer;
}

.kb-picker-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.kb-picker-table-wrap {
  max-height: min(48vh, 360px);
  overflow: auto;
  margin-bottom: 8px;
}

.kb-user-picker-table .kb-picker-col-check {
  width: 44px;
}

.kb-user-picker-table .kb-user-check {
  width: auto;
  cursor: pointer;
}

.kb-user-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--soft);
  color: var(--muted);
}
