:root {
  --td-brand-color: #0052d9;
  --td-brand-color-hover: #266fe8;
  --td-brand-color-light: #ecf2fe;
  --td-bg-color-page: #f5f7fa;
  --td-bg-color-container: #ffffff;
  --td-bg-color-secondarycontainer: #f3f3f3;
  --td-text-color-primary: #1d2129;
  --td-text-color-secondary: #4e5969;
  --td-text-color-placeholder: #86909c;
  --td-border-color: #e5e6eb;
  --td-shadow-1: 0 1px 4px rgba(0, 0, 0, 0.06);
  --td-shadow-2: 0 4px 16px rgba(0, 0, 0, 0.08);
  --sidebar-width: 232px;
  --sidebar-width-collapsed: 56px;
  --topbar-height: 56px;
  --radius-default: 8px;
  --radius-small: 4px;
  --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-page);
  min-height: 100vh;
}

a { color: var(--td-brand-color); text-decoration: none; }
a:hover { color: var(--td-brand-color-hover); }

.icon {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -3px;
  flex-shrink: 0;
  line-height: 0;
}
.icon svg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; display: block; }
.icon-color svg { fill: none; }
.icon-rich { color: #2c2c2c; }
.icon-rich svg { fill: currentColor; }
.icon-rich-white { color: #fff; }
.icon-rich-white svg { fill: currentColor; }
.icon-sm { width: 16px; height: 16px; vertical-align: -2px; }
.icon-lg { width: 28px; height: 28px; vertical-align: -6px; }
.icon-xl { width: 40px; height: 40px; vertical-align: -10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--radius-default);
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: var(--td-text-color-primary);
  transition: all .15s ease;
}
.btn:hover { background: var(--td-bg-color-secondarycontainer); }
.btn-primary { background: var(--td-brand-color); color: #fff; border-color: var(--td-brand-color); }
.btn-primary:hover { background: var(--td-brand-color-hover); color: #fff; }
.btn-outline { border-color: var(--td-border-color); background: #fff; }
.btn-danger { color: #e34d59; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  color: var(--td-text-color-primary);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--td-brand-color);
  box-shadow: 0 0 0 2px rgba(0, 82, 217, .12);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 2px;
  margin-bottom: 6px;
  color: var(--td-text-color-secondary);
  font-size: 13px;
}
.form-row { margin-bottom: 16px; }
.form-inline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
}
.badge-success { background: #e8f8f2; color: #00a870; }
.badge-warning { background: #fff3e0; color: #ed7b2f; }
.badge-info { background: #ecf2fe; color: #0052d9; }
.badge-danger { background: #fdecee; color: #e34d59; }
.badge-default { background: #f2f3f5; color: #4e5969; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-default);
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: #e8f8f2; border-color: #bcebdc; color: #007a5e; }
.alert-error { background: #fdecee; border-color: #f9d7d9; color: #c9353f; }

.card {
  background: var(--td-bg-color-container);
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  box-shadow: var(--td-shadow-1);
}
.card-body { padding: 20px 24px; }
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--td-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { margin: 0; font-size: 16px; font-weight: 600; }

.table-wrap { overflow: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
}
table.data-table th,
table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--td-border-color);
  text-align: left;
  vertical-align: middle;
}
table.data-table th {
  background: #fafafa;
  color: var(--td-text-color-secondary);
  font-weight: 500;
  font-size: 13px;
}
table.data-table tr:hover td { background: #fafcff; }
.table-empty { text-align: center; color: var(--td-text-color-placeholder); padding: 48px 16px; }

.page-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.page-desc { margin: 0 0 20px; color: var(--td-text-color-secondary); }

.layout-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ecf2fe 0%, var(--td-bg-color-page) 40%);
}
.login-card { width: 400px; max-width: calc(100vw - 32px); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { margin: 0; font-size: 28px; }
.login-brand p { margin: 8px 0 0; color: var(--td-text-color-secondary); }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--td-text-color-placeholder); line-height: 1.6; }

.layout-app { display: flex; min-height: 100vh; }
.layout-app:has(.page-content--flush),
.layout-app:has(.page-content--fill) {
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--td-border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: width .22s ease;
}
.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--td-border-color);
  font-weight: 600;
  font-size: 16px;
}
.sidebar-brand-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}
.brand-wordmark {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--td-text-color-primary);
  white-space: nowrap;
}
.sidebar-toggle {
  border: 0;
  background: transparent;
  padding: 4px;
  border-radius: var(--radius-small);
  cursor: pointer;
  color: var(--td-text-color-secondary);
  line-height: 0;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: var(--td-bg-color-secondarycontainer);
  color: var(--td-text-color-primary);
}
.sidebar-toggle .icon-rich {
  color: currentColor;
  opacity: .85;
}
.sidebar-toggle:hover .icon-rich { opacity: 1; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow: auto; }
.nav-group { margin-bottom: 16px; }
.nav-group-title {
  padding: 8px 12px 6px;
  font-size: 12px;
  color: var(--td-text-color-placeholder);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-default);
  color: var(--td-text-color-primary);
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--td-bg-color-secondarycontainer); color: var(--td-text-color-primary); }
.nav-item.active {
  background: var(--td-brand-color-light);
  color: var(--td-brand-color);
  font-weight: 500;
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--td-border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--td-brand-color-light);
  color: var(--td-brand-color);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.avatar.avatar-img {
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .role { font-size: 12px; color: var(--td-text-color-placeholder); }

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}

html.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}
html.sidebar-collapsed .main-wrap {
  margin-left: var(--sidebar-width-collapsed);
}
html.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0 8px;
}
html.sidebar-collapsed .sidebar-brand-main {
  justify-content: center;
  width: 100%;
}
html.sidebar-collapsed .brand-wordmark { display: none; }
html.sidebar-collapsed .sidebar-toggle { display: none; }
html.sidebar-collapsed .brand-logo { cursor: pointer; }
html.sidebar-collapsed .nav-group { margin-bottom: 8px; }
html.sidebar-collapsed .nav-group-title { display: none; }
html.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 10px 8px;
}
html.sidebar-collapsed .nav-label { display: none; }
html.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 12px 8px;
}
html.sidebar-collapsed .user-meta,
html.sidebar-collapsed .sidebar-footer > a { display: none; }
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--td-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.breadcrumb { color: var(--td-text-color-secondary); font-size: 13px; }
.breadcrumb a { color: var(--td-text-color-secondary); }
.breadcrumb a:hover { color: var(--td-brand-color); }
.breadcrumb .sep { margin: 0 8px; color: var(--td-text-color-placeholder); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.parse-queue-wrap {
  position: relative;
}
.recall-log-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.recall-log-stat {
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  padding: 12px 14px;
}
.recall-log-stat-label {
  font-size: 12px;
  color: var(--td-text-color-secondary);
  margin-bottom: 4px;
}
.recall-log-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--td-text-color-primary);
}
.recall-log-kb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}
.recall-log-detail { display: inline-block; }
.recall-log-detail > summary {
  list-style: none;
  cursor: pointer;
}
.recall-log-detail > summary::-webkit-details-marker { display: none; }
.recall-log-detail-body {
  position: absolute;
  right: 24px;
  z-index: 20;
  width: min(520px, 92vw);
  margin-top: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
}
.recall-log-detail-block + .recall-log-detail-block { margin-top: 10px; }
.recall-log-detail-block strong { display: block; margin-bottom: 6px; font-size: 12px; }
@media (max-width: 900px) {
  .recall-log-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.parse-queue-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-small);
  background: transparent;
  cursor: pointer;
  color: var(--td-text-color-secondary);
}
.parse-queue-trigger:hover {
  background: var(--td-brand-color-light);
  color: var(--td-brand-color);
}
.parse-queue-trigger .icon-color svg {
  width: 22px;
  height: 22px;
}
.parse-queue-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--td-error-color, #e34d59);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}
.parse-queue-badge.hidden { display: none; }
.parse-queue-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: 420px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 120;
}
.parse-queue-panel.hidden { display: none; }
.parse-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--td-border-color);
}
.parse-queue-head strong { font-size: 14px; }
.parse-queue-summary { font-size: 12px; }
.parse-queue-body {
  overflow: auto;
  padding: 8px;
  flex: 1;
}
.parse-queue-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--td-text-color-placeholder);
  font-size: 13px;
}
.parse-queue-section-label {
  padding: 8px 8px 4px;
  font-size: 12px;
  color: var(--td-text-color-secondary);
}
.parse-queue-item {
  padding: 10px;
  border-radius: var(--radius-small);
}
.parse-queue-item + .parse-queue-item,
.parse-queue-section-label + .parse-queue-item {
  margin-top: 2px;
}
.parse-queue-item:hover { background: var(--td-bg-color-container-hover, #f3f3f3); }
.parse-queue-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.parse-queue-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}
.parse-queue-item-status { color: var(--td-brand-color); }
.parse-queue-item--failed .parse-queue-item-status { color: var(--td-error-color, #e34d59); }
.parse-queue-link {
  font-size: 12px;
  color: var(--td-text-color-secondary);
}
.parse-queue-link:hover { color: var(--td-brand-color); }
.parse-queue-error {
  margin-top: 4px;
  font-size: 11px;
  color: var(--td-error-color, #e34d59);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.parse-queue-progress {
  margin-top: 8px;
  height: 4px;
  border-radius: 999px;
  background: var(--td-border-color);
  overflow: hidden;
}
.parse-queue-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--td-brand-color), #48c9b0);
  transition: width 0.4s ease;
}
.parse-queue-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--td-border-color);
  text-align: right;
}
.parse-queue-audit-link {
  font-size: 12px;
  color: var(--td-text-color-secondary);
}
.parse-queue-audit-link:hover { color: var(--td-brand-color); }
.page-content { padding: 24px; flex: 1; min-height: 0; }

.split-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; min-height: calc(100vh - var(--topbar-height) - 96px); }
.tree-panel, .list-panel { min-height: 480px; }
.tree-list { list-style: none; margin: 0; padding: 8px; }
.tree-item a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-small); color: var(--td-text-color-primary);
}
.tree-item a:hover, .tree-item a.active { background: var(--td-brand-color-light); color: var(--td-brand-color); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  overflow: hidden;
  background: #fff;
}
.editor-layout.preview-hidden { grid-template-columns: 1fr; }
.editor-layout.preview-hidden .preview-pane { display: none; }
.editor-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 24px;
}
.editor-page #doc-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.editor-meta { margin-bottom: 12px; flex-shrink: 0; }
.editor-meta-body {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.8fr) minmax(200px, 1fr);
  gap: 16px;
  align-items: start;
}
.editor-meta-body .form-row { margin: 0; }
.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  line-height: 1.5;
}
.editor-pane, .preview-pane { display: flex; flex-direction: column; min-height: 0; }
.editor-pane { border-right: 1px solid var(--td-border-color); }
.pane-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--td-border-color);
  background: #fafafa;
  font-size: 13px;
  color: var(--td-text-color-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.editor-toolbar { flex-wrap: wrap; }
.pane-label { font-weight: 500; color: var(--td-text-color-primary); }
.editor-toolbar-group { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--td-text-color-secondary);
}
.btn-ghost:hover { background: var(--td-bg-color-secondarycontainer); color: var(--td-text-color-primary); }
.editor-stat { margin-left: auto; }
.editor-index-status {
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  white-space: nowrap;
}
.editor-textarea {
  flex: 1; border: 0; border-radius: 0; padding: 16px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px; line-height: 1.7; resize: none; min-height: 0;
  tab-size: 2;
}
.editor-textarea:focus { box-shadow: none; }
.preview-body { flex: 1; padding: 16px 20px; overflow: auto; line-height: 1.7; }
.preview-body h1, .preview-body h2, .preview-body h3 { margin-top: 1.2em; }
.preview-body pre { background: #f6f8fa; padding: 12px; border-radius: 6px; overflow: auto; }
.preview-body code { background: #f6f8fa; padding: 2px 4px; border-radius: 4px; font-size: .92em; }
.preview-body table { border-collapse: collapse; width: 100%; }
.preview-body th, .preview-body td { border: 1px solid var(--td-border-color); padding: 8px; }

.doc-preview-card .doc-preview-body { display: flex; flex-direction: column; gap: 20px; }
.doc-preview-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}
.doc-preview-head { flex-shrink: 0; }
.doc-preview-title { font-size: 18px; margin: 0; }
.doc-preview-desc { margin: 4px 0 0; }
.preview-layout {
  display: grid;
  flex: 1;
  min-height: 0;
  gap: 0;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  overflow: hidden;
  background: #fff;
}
.preview-layout--text { grid-template-columns: 280px 1fr; }
.preview-layout--markdown { grid-template-columns: 1fr 1fr; }
.preview-layout--split { grid-template-columns: minmax(300px, 42%) 1fr; }
.preview-layout--rag { grid-template-columns: minmax(260px, 30%) 1fr minmax(280px, 32%); }
.preview-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--td-border-color);
}
.preview-col:last-child { border-right: 0; }
.preview-col-head {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--td-text-color-secondary);
  border-bottom: 1px solid var(--td-border-color);
  background: #fafbfc;
}
.preview-col-head-meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--td-text-color-placeholder);
  white-space: nowrap;
}
/* 解析文本：吃满列高，内部滚动（不再写死 56vh） */
.preview-body--capped {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.preview-col-original {
  overflow: hidden;
}
.preview-col-original .preview-image-wrap {
  margin: 12px;
  flex-shrink: 0;
}
/* Chrome PDF viewer 易撑破列宽；用裁切容器钉死 */
.preview-embed-frame {
  position: relative;
  flex-shrink: 0;
  align-self: stretch;
  height: min(36vh, 360px);
  margin: 12px;
  overflow: hidden;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  background: #525659;
  box-sizing: border-box;
  isolation: isolate;
  contain: layout size;
}
.preview-embed-frame .preview-embed {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  display: block;
}
.preview-meta-panel {
  padding: 0 12px 12px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.preview-meta-head {
  margin: 12px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--td-text-color-primary);
}
.preview-meta-head-sub { margin-top: 16px; color: var(--td-text-color-secondary); }
.preview-meta-list { margin: 0; }
.preview-meta-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--td-border-color-light, #f0f0f0);
}
.preview-meta-row:last-child { border-bottom: 0; }
.preview-meta-row dt { margin: 0; color: var(--td-text-color-placeholder); }
.preview-meta-row dd { margin: 0; color: var(--td-text-color-primary); word-break: break-all; }
.preview-source-code,
.preview-plain-text {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fafbfc;
  border: 0;
}
.preview-source-code code { background: transparent; padding: 0; }
.preview-col-parsed,
.preview-col-render,
.preview-col-main {
  min-height: 0;
}
.preview-col-parsed .preview-body,
.preview-col-render .preview-body,
.preview-col-main .preview-plain-text {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.preview-segment-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}
.preview-segment-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-small);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.preview-segment-item:hover,
.preview-segment-item.active {
  border-color: var(--td-brand-color);
  background: var(--td-brand-color-light);
}
.preview-segment-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--td-text-color-primary);
  margin-bottom: 4px;
}
.preview-segment-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8f8f2;
  color: #007a5e;
  font-size: 10px;
  font-weight: 500;
}
.preview-segment-snippet {
  font-size: 12px;
  line-height: 1.5;
  color: var(--td-text-color-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.preview-panel-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--td-text-color-secondary); }
.preview-image-wrap { text-align: center; background: #f6f8fa; border-radius: 8px; padding: 16px; }
.preview-image { max-width: 100%; max-height: 72vh; object-fit: contain; border-radius: 4px; }
.preview-embed {
  width: 100%;
  max-width: 100%;
  height: min(72vh, 820px);
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}
.preview-embed--original {
  height: 100%;
}
.preview-hint { margin: 8px 0 0; font-size: 12px; color: var(--td-text-color-placeholder); }
.preview-hint--pad { margin: 0 12px 8px; }
.preview-office-card {
  margin: 12px;
  padding: 28px 20px;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  background: #fafbfc;
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
}
.preview-office-card-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--td-brand-color);
}
.preview-office-card-icon .icon,
.preview-office-card-icon svg { width: 48px; height: 48px; }
.preview-office-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--td-text-color-primary);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 6px;
}
.preview-office-card-meta {
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  margin-bottom: 8px;
}
.preview-office-card-desc {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--td-text-color-secondary);
}
.preview-embed-frame--text { background: #fff; }
.preview-alert {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 4px;
}
.preview-alert-warn { background: #fff3e0; color: #a65b00; }
.preview-alert-info { background: #ecf2fe; color: #0052d9; }
.preview-empty { padding: 32px; text-align: center; color: var(--td-text-color-placeholder); }

.recall-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Recall Test ── */
.recall-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 24px;
  background: #f5f6f8;
}
.recall-page-head {
  margin-bottom: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}
.recall-page-head-actions { position: relative; flex-shrink: 0; }
.recall-history-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--td-text-color-secondary);
}
.recall-history-trigger:hover,
.recall-history-trigger.is-open {
  border-color: var(--td-brand-color);
  color: var(--td-brand-color);
  background: #eef4ff;
}
.recall-history-trigger .icon { width: 18px; height: 18px; }
.recall-history-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(360px, 92vw);
  max-height: min(420px, 70vh);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
  padding: 12px 14px;
}
.recall-history-panel.hidden { display: none; }
.recall-history-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.recall-history-empty {
  margin: 8px 0;
  color: var(--td-text-color-secondary);
  font-size: 13px;
}
.recall-form-card,
.recall-right {
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 10px;
}
.recall-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.recall-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}
.recall-left .recall-form-card { flex: 1; }
.recall-form-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.recall-form-block { display: flex; flex-direction: column; gap: 8px; }
.recall-form-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--td-text-color-primary);
}
.recall-query-input {
  width: 100%; border: 1px solid var(--td-border-color); border-radius: 8px;
  padding: 12px 14px; font: inherit; line-height: 1.55; resize: vertical; min-height: 120px;
  background: #fafbfc;
}
.recall-query-input:focus {
  outline: none; border-color: var(--td-brand-color);
  background: #fff; box-shadow: 0 0 0 3px rgba(0, 82, 217, .08);
}
.recall-query-foot {
  display: flex; align-items: center; justify-content: space-between;
}
.mode-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  background: #eef4ff; color: var(--td-brand-color);
  font-size: 12px; font-weight: 500;
}
.char-count { font-size: 12px; color: var(--td-text-color-placeholder); }
.recall-collections { gap: 10px 14px; }
.recall-form-inline { flex-direction: row; align-items: flex-end; }
.recall-history-card {
  padding: 14px 16px; flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.recall-history-empty {
  margin: 12px 0 0; font-size: 13px; color: var(--td-text-color-placeholder);
}
.recall-history-pager {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--td-border-color);
}
.recall-right {
  min-height: 0; overflow: auto; display: flex; flex-direction: column;
  padding: 16px 18px;
}
.recall-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--td-text-color-placeholder); text-align: center; gap: 8px; min-height: 280px;
}
.recall-result-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-shrink: 0;
}
.recall-result-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.recall-json-details { margin-top: 16px; }
.recall-json-details summary {
  cursor: pointer; font-size: 13px; color: var(--td-text-color-secondary);
}
.history-list { list-style: none; margin: 8px 0 0; padding: 0; overflow: auto; }
.history-item {
  padding: 10px 0; border-bottom: 1px solid var(--td-border-color);
  cursor: pointer; transition: background .12s;
}
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: #f7f8fa; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.history-main { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 4px; }
.history-query {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.history-meta { font-size: 12px; color: var(--td-text-color-placeholder); padding-left: 4px; }
.checkbox-group-inline { flex-direction: row; flex-wrap: wrap; max-height: none; }
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; color: var(--td-text-color-placeholder); text-align: center;
  background: #f9fafb; border-radius: var(--radius-default); min-height: 360px;
}
.empty-state-sm { min-height: 120px; padding: 24px; background: transparent; }
.empty-icon { width: 40px; height: 40px; opacity: .45; margin-bottom: 8px; }
.empty-icon-lg { width: 56px; height: 56px; opacity: .35; }
.empty-state p { margin: 0; font-size: 13px; }
.json-summary { cursor: pointer; color: var(--td-text-color-secondary); font-size: 13px; margin-bottom: 8px; }
.hit-card {
  padding: 12px 14px;
  margin-bottom: 0;
  border: 1px solid var(--td-border-color);
  border-radius: 10px;
  background: #fff;
}
.hit-card--empty { padding: 24px 14px; text-align: center; }
.hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.hit-rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 22px; padding: 0 6px;
  border-radius: 4px; background: #eef4ff; color: var(--td-brand-color);
  font-size: 12px; font-weight: 600;
}
.hit-score {
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--td-text-color-primary); font-weight: 600;
}
.hit-source { font-size: 12px; color: var(--td-text-color-placeholder); }
.hit-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  max-width: 55%;
}
.hit-collection-link {
  font-size: 12px;
  color: var(--td-text-color-secondary);
  text-decoration: none;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hit-collection-link:hover {
  color: var(--td-brand-color);
  text-decoration: underline;
}
.hit-preview-link {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--td-brand-color);
  text-decoration: none;
  white-space: nowrap;
}
.hit-preview-link:hover { text-decoration: underline; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.file-explorer-nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 4px 12px;
}
.btn-block { width: 100%; justify-content: center; text-align: center; }
.btn-ghost {
  border: 0; background: transparent; color: var(--td-text-color-secondary);
  box-shadow: none;
}
.btn-ghost:hover { background: #f0f0f0; color: var(--td-text-color-primary); }
label.btn { cursor: pointer; margin: 0; }

.storage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: #f3f3f3; color: var(--td-text-color-secondary);
  font-size: 12px;
}
.storage-pill .icon { width: 14px; height: 14px; }

.upload-form { margin: 0; }
.upload-dropzone {
  margin: 0 20px 12px;
  padding: 18px 16px;
  border: 1px dashed var(--td-border-color);
  border-radius: var(--radius-default);
  background: #fafafa;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.upload-dropzone.dragover {
  border-color: var(--td-brand-color);
  background: var(--td-brand-color-light);
}
.upload-dropzone-title {
  font-size: 13px; font-weight: 500; color: var(--td-text-color-primary);
}
.upload-dropzone-hint {
  margin-top: 6px; font-size: 12px; color: var(--td-text-color-placeholder);
}
.upload-dropzone-hint code {
  font-size: 11px; background: #eee; padding: 1px 4px; border-radius: 3px;
}
.upload-dropzone-hint .warn { color: #e37318; }

.file-icon-md {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px;
  background: #0052d9; color: #fff; font-size: 9px; font-weight: 700;
  letter-spacing: -.5px; opacity: 1;
}

.row-more-menu a {
  display: block; padding: 8px 12px; border-radius: 4px;
  color: var(--td-text-color-primary); text-decoration: none;
}
.row-more-menu a:hover { background: #f5f5f5; }

.badge-info { background: #ecf2fe; color: #0052d9; }

/* ── File Explorer (Lexiang 云知识库) ── */
.file-explorer {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--topbar-height) - 80px);
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  overflow: hidden;
}
.file-explorer-nav {
  border-right: 1px solid var(--td-border-color);
  background: #fafafa;
  padding: 12px 8px;
}
.file-explorer-nav-head {
  font-size: 12px; color: var(--td-text-color-placeholder);
  padding: 4px 10px 10px; font-weight: 500;
}
.file-nav-list { list-style: none; margin: 0; padding: 0; }
.file-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-default);
  color: var(--td-text-color-primary); font-size: 13px;
}
.file-nav-item:hover { background: #f0f0f0; color: var(--td-text-color-primary); }
.file-nav-item.active { background: #ebebeb; font-weight: 500; }
.file-explorer-main { border: 0; border-radius: 0; box-shadow: none; }
.file-explorer-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--td-border-color);
}
.file-explorer-title { display: flex; align-items: center; gap: 8px; }
.file-explorer-title h1 { margin: 0; font-size: 16px; font-weight: 600; }
.file-explorer-title .muted { color: var(--td-text-color-placeholder); font-weight: 400; }
.back-link { display: inline-flex; color: var(--td-text-color-secondary); }
.back-link:hover { color: var(--td-brand-color); }
.file-name { display: inline-flex; align-items: center; gap: 8px; color: var(--td-text-color-primary); font-weight: 500; }
.file-name:hover { color: var(--td-brand-color); }
.file-icon { width: 18px; height: 18px; opacity: .7; }
.text-muted { color: var(--td-text-color-placeholder); font-size: 13px; }
.data-table-files th:first-child,
.data-table-files td:first-child { padding-left: 20px; }
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}
table.data-table th.sticky-act,
table.data-table th.row-actions-col,
.list-table th.sticky-act,
.list-table th.row-actions-col {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #fff;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  width: 108px;
  min-width: 108px;
  max-width: 108px;
  text-align: right;
  vertical-align: middle;
}
table.data-table td.sticky-act,
table.data-table td.row-actions,
.list-table td.sticky-act,
.list-table td.row-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  width: 108px;
  min-width: 108px;
  max-width: 108px;
  text-align: right;
  vertical-align: middle;
}
.list-table thead th.sticky-act,
.list-table thead th.row-actions-col {
  z-index: 3;
}
table.data-table tr:hover td.sticky-act,
table.data-table tr:hover td.row-actions,
.list-table tbody tr:hover td.sticky-act,
.list-table tbody tr:hover td.row-actions {
  background: #fafcff;
}
.table-act.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.table-act {
  display: inline;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  color: var(--td-brand-color);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  outline: none;
  text-decoration: none;
  vertical-align: baseline;
}
.table-act:hover { text-decoration: underline; }
.table-act.is-danger { color: #e34d59; }
.row-more { position: relative; }
.row-more summary { list-style: none; cursor: pointer; }
.row-more summary::-webkit-details-marker { display: none; }
.row-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default); box-shadow: var(--td-shadow-2);
  min-width: 120px; padding: 4px;
}
.row-more-menu form button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 12px;
  font: inherit; cursor: pointer; border-radius: 4px;
}
.row-more-menu form button:hover { background: #f5f5f5; }
.row-more-menu form button.danger { color: #e34d59; }

.file-nav-list > li { position: relative; }
.folder-actions { position: absolute; right: 4px; top: 6px; }
.folder-actions summary { cursor: pointer; list-style: none; font-size: 12px; color: var(--td-text-color-placeholder); }
.folder-actions summary::-webkit-details-marker { display: none; }
.folder-actions[open] { z-index: 5; background: #fff; border: 1px solid var(--td-border-color); border-radius: 6px; padding: 6px; box-shadow: var(--td-shadow-2); }
.recall-input .mode-tabs, .mode-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.mode-tabs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}
.mode-tabs-wrap .mode-tab {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
}
.mode-tab {
  border: 1px solid var(--td-border-color);
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--td-text-color-secondary);
}
.mode-tab.active {
  border-color: var(--td-brand-color);
  background: #eef4ff;
  color: var(--td-brand-color);
  font-weight: 600;
}
.hit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hit-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--td-border-color);
}
.hit-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 0; min-width: 0; }
.hit-title {
  font-weight: 600; margin-bottom: 4px; font-size: 14px;
  color: var(--td-text-color-primary); line-height: 1.4;
}
.hit-snippet {
  color: var(--td-text-color-secondary); line-height: 1.55; font-size: 13px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hit-actions { margin-top: 8px; display: flex; gap: 8px; }
.json-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 14px;
  border-radius: var(--radius-default);
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 320px;
}
.meta-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 0;
  color: var(--td-text-color-secondary);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 480px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: var(--radius-default);
  box-shadow: var(--td-shadow-2);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--td-border-color); font-weight: 600; }
.modal-header-split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-sub {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--td-text-color-secondary);
}
.modal-close {
  border: 0;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: var(--td-text-color-placeholder);
  line-height: 0;
}
.modal-close:hover { color: var(--td-text-color-primary); }
.modal-upload { width: min(920px, calc(100vw - 32px)); }
.upload-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 320px;
}
.upload-modal-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.upload-modal-side .upload-queue { flex: 1; min-height: 0; }
.upload-drop-zone {
  border: 1px dashed var(--td-border-color);
  border-radius: 12px;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  transition: border-color .15s ease, background .15s ease;
}
.upload-drop-zone.is-dragover {
  border-color: var(--td-brand-color);
  background: var(--td-brand-color-light);
}
.upload-drop-icon { color: var(--td-brand-color); margin-bottom: 12px; }
.upload-drop-title { margin: 0 0 8px; color: var(--td-text-color-primary); }
.upload-drop-link {
  border: 0;
  background: transparent;
  color: var(--td-brand-color);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.upload-drop-hint { margin: 0; font-size: 12px; color: var(--td-text-color-placeholder); }
.upload-pdf-mode {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--td-component-border);
  border-radius: 8px;
  background: var(--td-bg-color-container);
}
.upload-pdf-mode-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--td-text-color-primary);
}
.upload-pdf-mode .checkbox-item { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; }
.upload-pdf-mode-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.5; }
.select-xs {
  height: 24px;
  padding: 0 6px;
  font-size: 12px;
  width: auto;
  min-width: 64px;
  margin-right: 4px;
}
.doc-reparse-form { display: inline-flex; align-items: center; gap: 2px; }
.doc-reparse-menu { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; }
.doc-reparse-menu-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--td-text-color-secondary); }
.upload-queue {
  border: 1px solid var(--td-border-color);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.upload-queue-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--td-border-color);
  font-size: 13px;
  color: var(--td-text-color-secondary);
}
.upload-queue-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow: auto;
  flex: 1;
}
.upload-queue-item { padding: 8px 6px; }
.upload-queue-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.upload-queue-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-queue-status {
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  white-space: nowrap;
}
.upload-queue-item--done .upload-queue-status { color: #00a870; }
.upload-queue-item--error .upload-queue-status { color: #e34d59; }
.upload-queue-remove {
  border: 0;
  background: transparent;
  color: var(--td-text-color-placeholder);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.upload-queue-bar {
  height: 4px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
}
.upload-queue-bar-fill {
  height: 100%;
  background: var(--td-brand-color);
  transition: width .15s ease;
}
.upload-queue-bar-fill.is-processing {
  background: linear-gradient(90deg, var(--td-brand-color) 0%, #7eb6ff 50%, var(--td-brand-color) 100%);
  background-size: 200% 100%;
  animation: upload-processing 1.1s linear infinite;
}
@keyframes upload-processing {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.page-content--flush,
.page-content--fill {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.page-content--flush { padding: 0; }
.page-content--fill { padding: 0; }
.page-content--fill .doc-preview-page {
  padding: 16px 20px 20px;
  height: 100%;
  box-sizing: border-box;
}

.page-fill-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.list-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 24px;
}
.list-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.list-page-head-main { min-width: 0; }
.list-page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.audit-purge { position: relative; }
.audit-purge > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.audit-purge > summary::-webkit-details-marker { display: none; }
.audit-purge-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  padding: 6px;
}
.audit-purge-menu-title {
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--td-text-color-secondary);
}
.audit-purge-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--td-text-color-primary);
  cursor: pointer;
}
.audit-purge-item:hover {
  background: #f3f3f3;
  color: var(--td-error-color, #e34d59);
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-header--with-tabs {
  flex-wrap: wrap;
}
.page-header--with-tabs .config-tabs {
  margin-bottom: 0;
  margin-left: auto;
}
.list-page-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.list-page-toolbar .input { width: auto; min-width: 140px; flex: 1; max-width: 220px; }
.list-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  overflow: hidden;
}
.list-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.list-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
.list-page-desc a.is-active,
.page-desc a.is-active { color: var(--td-brand-color); font-weight: 500; }
.list-pagination,
.lx-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--td-border-color);
  background: #fff;
  flex-shrink: 0;
}
.list-pagination-nav,
.list-pagination-pages,
.list-pagination-size,
.lx-pagination-nav,
.lx-pagination-pages,
.lx-pagination-size {
  display: flex;
  align-items: center;
  gap: 6px;
}
.list-page-btn,
.list-page-num,
.list-page-size,
.lx-page-btn,
.lx-page-num,
.lx-page-size {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--td-text-color-secondary);
  background: transparent;
}
.list-page-btn.is-disabled,
.lx-page-btn.is-disabled { opacity: .35; pointer-events: none; }
.list-page-num.is-active,
.list-page-size.is-active,
.lx-page-num.is-active,
.lx-page-size.is-active {
  background: var(--td-brand-color-light);
  color: var(--td-brand-color);
  font-weight: 500;
}
.list-page-indicator,
.lx-page-indicator {
  font-size: 13px;
  color: var(--td-text-color-secondary);
  min-width: 36px;
  text-align: center;
}
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }

.checkbox-group { display: flex; flex-direction: column; gap: 8px; max-height: 160px; overflow: auto; }
.checkbox-item { display: flex; align-items: center; gap: 8px; }

.mcp-tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mcp-tool {
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  padding: 14px;
  background: #fafafa;
}
.mcp-tool code { font-weight: 600; color: var(--td-brand-color); }
.code-copy {
  position: relative;
}
.code-copy pre {
  background: #1e1e1e; color: #d4d4d4;
  padding: 14px; border-radius: var(--radius-default);
  overflow: auto; font-size: 12px;
}

@media (max-width: 1200px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-pane { border-right: 0; border-bottom: 1px solid var(--td-border-color); }
  .recall-layout { grid-template-columns: 1fr; }
  .recall-workspace { grid-template-columns: 1fr; }
  .split-layout { grid-template-columns: 1fr; }
  .file-explorer { grid-template-columns: 1fr; }
  .file-explorer-nav { border-right: 0; border-bottom: 1px solid var(--td-border-color); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
}

/* ── Toast notifications ── */
.toast-stack {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
.toast-top {
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}
.toast-upload {
  right: 24px;
  bottom: 24px;
  align-items: flex-end;
}
.toast {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--td-shadow-2);
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .28s ease, transform .28s ease;
  background: #fff;
  color: var(--td-text-color-primary);
}
.toast-upload .toast { transform: translateY(8px); }
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-leave {
  opacity: 0 !important;
  transform: translateY(-6px) !important;
}
.toast-upload .toast-leave { transform: translateY(6px) !important; }
.toast-success { border-color: #bcebdc; background: #e8f8f2; color: #007a5e; }
.toast-error { border-color: #f9d7d9; background: #fdecee; color: #c9353f; }
.toast-info { border-color: #d4e3fc; background: #ecf2fe; color: #0052d9; }
.toast-progress { border-color: var(--td-border-color); min-width: 260px; }
.toast-progress-bar {
  height: 4px; border-radius: 2px; background: #eee; overflow: hidden;
}
.toast-progress-fill {
  height: 100%; background: var(--td-brand-color);
  transition: width .2s ease;
}

/* ── Knowledge base (Lexiang / TDesign style) ── */

/* List page */
.kb-list-page { padding: 28px 32px 40px; max-width: 1280px; }
.kb-list-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 28px;
}
.kb-list-header-main { display: flex; gap: 16px; align-items: center; }
.nav-item .icon { margin-right: 2px; }

.sidebar-footer a .icon-rich { opacity: .85; }
.sidebar-footer a:hover .icon-rich { opacity: 1; }

.btn .icon { margin-right: 0; }

.kb-list-header-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #fff8e1, #fff);
  border: 1px solid #ffe082;
  display: flex; align-items: center; justify-content: center;
}
.kb-list-header-icon .icon { width: 40px; height: 40px; }

.lx-file-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: #f7f8fa;
  border: 1px solid #eef0f4;
}
.lx-file-icon-rag,
.lx-file-icon-grep { background: #f7f8fa; color: inherit; }
.lx-file-icon .icon { width: 22px; height: 22px; }

.lx-kb-back {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--td-border-color);
}
.lx-kb-back .icon { width: 16px; height: 16px; }

.lx-action-btn .icon { width: 16px; height: 16px; }

.lx-cos-ok .icon { width: 14px; height: 14px; }

.kb-card-del .icon { width: 16px; height: 16px; opacity: .7; }
.kb-card-del:hover .icon { opacity: 1; }

.empty-icon .icon-color,
.kb-empty-icon .icon-color { opacity: .75; }
.kb-list-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.kb-list-sub { margin: 4px 0 0; font-size: 13px; color: var(--td-text-color-placeholder); }

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.kb-card {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--td-border-color);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.kb-card:hover {
  border-color: #c9d8f0;
  box-shadow: 0 8px 24px rgba(0, 82, 217, .08);
  transform: translateY(-2px);
}
.kb-card-cover {
  height: 88px;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--td-border-color);
}
.kb-card-body { padding: 16px 18px 12px; flex: 1; }
.kb-card-name { margin: 0; font-size: 16px; font-weight: 600; }
.kb-card-slug { margin-top: 4px; }
.kb-card-slug code { font-size: 12px; color: var(--td-text-color-placeholder); background: #f5f6f8; padding: 2px 6px; border-radius: 4px; }
.kb-card-stats {
  display: flex; gap: 14px; margin-top: 12px;
  font-size: 12px; color: var(--td-text-color-secondary);
}
.kb-card-stats span { display: inline-flex; align-items: center; gap: 4px; }
.kb-card-stats .icon { width: 14px; height: 14px; }
.kb-card-stat-time .icon { width: 22px; height: 22px; vertical-align: -6px; }
.kb-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 14px;
  border-top: 1px solid #f0f1f5;
}
.kb-card-enter {
  font-size: 13px; color: var(--td-brand-color);
  display: inline-flex; align-items: center; gap: 2px;
}
.kb-card-del-form { margin: 0; }
.kb-card-del {
  border: 0; background: transparent; cursor: pointer;
  color: var(--td-text-color-placeholder); padding: 4px; border-radius: 6px;
}
.kb-card-del:hover { color: #e34d59; background: #fdecee; }

.kb-empty-state {
  text-align: center; padding: 80px 24px;
  background: #fff; border: 1px dashed var(--td-border-color); border-radius: 12px;
}
.kb-empty-icon { color: var(--td-text-color-placeholder); margin-bottom: 12px; }
.kb-empty-icon .icon { width: 48px; height: 48px; display: inline-flex; }
.kb-empty-state h3 { margin: 0 0 8px; font-size: 18px; }
.kb-empty-state p { margin: 0 0 20px; color: var(--td-text-color-secondary); }

/* Detail — full-height explorer */
.lx-kb {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.lx-kb-tree {
  border-right: 1px solid var(--td-border-color);
  background: #fbfbfc;
  display: flex; flex-direction: column;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}
.lx-kb-tree-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px;
}
.lx-kb-back {
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--td-text-color-secondary);
  background: #fff; border: 1px solid var(--td-border-color);
}
.lx-kb-back:hover { color: var(--td-brand-color); border-color: #c9d8f0; }
.lx-kb-col-title { min-width: 0; }
.lx-kb-col-name {
  display: block; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lx-kb-col-slug { display: block; font-size: 11px; color: var(--td-text-color-placeholder); margin-top: 1px; }

.lx-kb-tree-label {
  padding: 14px 16px 6px;
  font-size: 11px; font-weight: 600;
  color: var(--td-text-color-placeholder);
  text-transform: uppercase; letter-spacing: .04em;
}
.lx-tree-nav { flex: 1; overflow: auto; padding: 0 8px; }
.lx-tree-row { position: relative; }
.lx-tree-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--td-text-color-primary); font-size: 13px;
  margin-bottom: 2px;
}
.lx-tree-item .icon { flex-shrink: 0; }
.lx-tree-more .icon { width: 16px; height: 16px; }
.kb-card-cover .icon { width: 40px; height: 40px; }
.lx-drop-overlay .icon { width: 48px; height: 48px; }
.lx-drop-overlay .icon-rich { color: var(--td-brand-color); }
.lx-tree-item:hover { background: rgba(0,0,0,.04); color: var(--td-text-color-primary); }
.lx-tree-item.is-active {
  background: #fff; color: var(--td-brand-color); font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.lx-tree-more { position: absolute; right: 4px; top: 6px; }
.lx-tree-more summary {
  list-style: none; cursor: pointer; color: var(--td-text-color-placeholder);
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.lx-tree-more summary:hover { background: rgba(0,0,0,.05); color: var(--td-text-color-secondary); }
.lx-tree-more summary::-webkit-details-marker { display: none; }
.lx-tree-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--td-border-color);
  border-radius: 10px; padding: 12px; box-shadow: var(--td-shadow-2); min-width: 200px;
  display: flex; flex-direction: column; gap: 10px;
}
.lx-tree-menu form { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lx-tree-menu-label {
  font-size: 11px; font-weight: 500; color: var(--td-text-color-placeholder);
}
.lx-tree-menu-actions { display: flex; justify-content: flex-end; }
.lx-tree-menu-move {
  width: 100%; padding: 8px 0 0; margin: 0; border: 0; border-top: 1px solid #f0f1f5;
  background: transparent; color: var(--td-text-color-secondary); font-size: 13px; cursor: pointer; text-align: center;
}
.lx-tree-menu-move:hover { color: var(--td-brand-color); }
.lx-tree-menu-del {
  width: 100%; padding: 8px 0 0; margin: 0; border: 0; border-top: 1px solid #f0f1f5;
  background: transparent; color: #e34d59; font-size: 13px; cursor: pointer; text-align: center;
}
.lx-tree-menu-del:hover { color: #c9353f; }
.lx-tree-add {
  margin: 8px 12px 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border: 1px dashed var(--td-border-color); border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 13px;
  color: var(--td-text-color-secondary);
}
.lx-tree-add:hover { border-color: var(--td-brand-color); color: var(--td-brand-color); background: #fafcff; }

.lx-kb-tree-foot { padding: 12px 14px 16px; border-top: 1px solid var(--td-border-color); margin-top: auto; }
.lx-cap-hint { display: flex; flex-wrap: wrap; gap: 6px; }
.lx-cap-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500;
}
.lx-cap-chip.rag { background: #ecf2fe; color: #0052d9; }
.lx-cap-chip.grep { background: #e8f8f2; color: #007a5e; }
.lx-cap-chip.cos { background: #f3f3f3; color: #4e5969; }
.lx-cap-chip.sql { background: #f5f0ff; color: #7c3aed; text-decoration: none; }

.lx-kb-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.lx-kb-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--td-border-color);
  gap: 16px;
  flex-shrink: 0;
}
.lx-kb-toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lx-kb-folder-title { margin: 0; font-size: 16px; font-weight: 600; }
.lx-kb-count { font-size: 12px; color: var(--td-text-color-placeholder); }
.lx-kb-manage-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-left: 2px; padding: 0;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--td-text-color-secondary); cursor: pointer;
}
.lx-kb-manage-btn:hover { background: #f3f3f3; color: var(--td-text-color-primary); border-color: var(--td-border-color); }
.lx-kb-manage-btn .icon { width: 16px; height: 16px; }
.lx-kb-toolbar-right { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.lx-agent-kb-tip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--td-text-color-secondary); line-height: 1.4;
}
.lx-agent-kb-tip .icon { width: 20px; height: 20px; flex-shrink: 0; }

.modal-kb-manage { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.kb-manage-body { display: flex; flex-direction: column; gap: 20px; }
.kb-manage-section { padding-bottom: 4px; }
.kb-manage-h { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--td-text-color-primary); }
.kb-manage-hint { margin: 0 0 12px; font-size: 12px; color: var(--td-text-color-secondary); line-height: 1.5; }
.kb-manage-inline { display: flex; gap: 8px; align-items: center; }
.kb-manage-inline .input { flex: 1; }
.kb-manage-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 12px 0 0; }
.kb-manage-meta dt { font-size: 11px; color: var(--td-text-color-placeholder); margin: 0 0 2px; }
.kb-manage-meta dd { margin: 0; font-size: 13px; }
.kb-manage-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kb-manage-stat {
  border: 1px solid var(--td-border-color); border-radius: 8px; padding: 10px 8px; text-align: center;
  background: #fafbfc;
}
.kb-manage-stat-n { display: block; font-size: 15px; font-weight: 600; }
.kb-manage-stat-l { display: block; margin-top: 2px; font-size: 11px; color: var(--td-text-color-placeholder); }
.kb-manage-type-line { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; font-size: 12px; color: var(--td-text-color-secondary); }
.kb-manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kb-manage-reindex { margin: 12px 0; }
.kb-manage-actions { display: flex; justify-content: flex-end; }
.kb-manage-danger { border-top: 1px solid var(--td-border-color); padding-top: 16px; }
.btn-danger {
  background: #fff; border: 1px solid #f5c0c4; color: #e34d59; border-radius: 6px; padding: 6px 14px; cursor: pointer;
}
.btn-danger:hover { background: #fdecee; }

.lx-kb-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #fafbfc; border-bottom: 1px solid var(--td-border-color);
  gap: 12px;
  flex-shrink: 0;
}
.lx-kb-search {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  max-width: 220px;
  margin-left: auto;
}
.lx-kb-search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}
.lx-kb-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--td-text-color-placeholder);
  line-height: 0;
  pointer-events: none;
}
.lx-kb-search-input {
  width: 100%;
  height: 28px;
  padding-left: 30px;
  font-size: 13px;
}
.lx-segment {
  display: inline-flex; flex-wrap: wrap; background: #eef0f4; border-radius: 8px; padding: 3px; gap: 2px;
}
.lx-segment-item {
  padding: 5px 14px; border-radius: 6px; font-size: 13px;
  color: var(--td-text-color-secondary);
}
.lx-segment-item:hover { color: var(--td-text-color-primary); }
.lx-segment-item.is-active {
  background: #fff; color: var(--td-brand-color); font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.list-page-tabs { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.config-subtabs.lx-segment { padding: 2px; }
.config-subtabs .lx-segment-item { padding: 3px 10px; font-size: 12px; }
.lx-batch { display: flex; align-items: center; gap: 4px; margin: 0; }
.select-sm { height: 28px; padding: 4px 8px; font-size: 12px; width: auto; }

.lx-cos-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--td-text-color-secondary);
  background: #f5f6f8; padding: 4px 10px; border-radius: 6px;
}
.lx-cos-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}
.lx-cos-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
.lx-cos-status--ok {
  background: #00a870;
  color: #fff;
}
.lx-cos-status--connecting {
  background: #e37318;
  color: #fff;
}
.lx-cos-status--fail {
  background: #f5f6f8;
  color: var(--td-text-color-secondary);
}
.lx-cos-status--fail .lx-cos-status-dot {
  background: var(--td-error-color, #e34d59);
  opacity: 1;
}

.lx-kb-panel {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lx-drop-overlay {
  position: absolute; inset: 12px; z-index: 5;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 8px;
  background: rgba(236, 242, 254, .92);
  border: 2px dashed var(--td-brand-color); border-radius: 12px;
  color: var(--td-brand-color); font-size: 14px; font-weight: 500;
  pointer-events: none;
}
.lx-kb-panel.is-dragover .lx-drop-overlay { display: flex; }

.lx-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.lx-file-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: var(--td-text-color-placeholder);
  border-bottom: 1px solid var(--td-border-color);
  padding: 10px 16px;
}
.lx-file-table td { padding: 10px 16px; border-bottom: 1px solid #f0f1f5; }
.lx-file-table tbody tr:hover td { background: #fafcff; }
.lx-file-table .col-check { width: 44px; }
.lx-file-table .col-type { width: 72px; }
.lx-file-table .col-size { width: 100px; }
.lx-file-table .col-status { width: 120px; }
.doc-status-wrap { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-status-badge { display: inline-flex; align-items: center; gap: 6px; }
.status-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: homory-spin 0.7s linear infinite;
  opacity: 0.85;
  flex-shrink: 0;
}
@keyframes homory-spin { to { transform: rotate(360deg); } }
.doc-reparse-form { margin: 0; display: inline; }
.btn-retry {
  font-size: 12px;
  color: var(--td-brand-color);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.btn-retry:hover { text-decoration: underline; }
.lx-file-table .col-time { width: 64px; vertical-align: middle; }
.lx-file-table .col-actions { width: 72px; }
.lx-time-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.25;
  font-size: 11px;
}
.lx-time-line { display: block; white-space: nowrap; }
.lx-time-year { color: var(--td-text-color-placeholder); font-weight: 500; }
.lx-time-hm { opacity: 0.85; }

.lx-file-cell {
  display: flex; align-items: center; gap: 12px;
  color: var(--td-text-color-primary); min-width: 0;
}
.lx-file-cell:hover { color: var(--td-brand-color); }
.lx-file-meta { min-width: 0; }
.lx-file-name {
  display: block; font-weight: 500; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lx-file-sub { display: block; font-size: 12px; color: var(--td-text-color-placeholder); margin-top: 1px; }

.lx-type-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
}
.lx-type-rag { background: #ecf2fe; color: #0052d9; }
.lx-type-grep { background: #e8f8f2; color: #007a5e; }
.lx-type-sql { background: #f5f0ff; color: #7c3aed; }

.lx-cos-ok { color: #00a870; margin-left: 4px; vertical-align: middle; }
.lx-cos-pending {
  display: inline-flex; width: 16px; height: 16px; border-radius: 50%;
  background: #fff3e0; color: #ed7b2f; font-size: 11px; font-weight: 700;
  align-items: center; justify-content: center; margin-left: 4px; vertical-align: middle;
}

.lx-row-actions { display: flex; gap: 4px; }
.lx-action-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--td-border-color); background: #fff;
  color: var(--td-text-color-secondary); cursor: pointer; list-style: none;
}
.lx-action-btn:hover { border-color: #c9d8f0; color: var(--td-brand-color); background: #fafcff; }
.lx-row-more { position: relative; }
.lx-row-more summary::-webkit-details-marker { display: none; }
.lx-row-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--td-border-color);
  border-radius: 8px; box-shadow: var(--td-shadow-2); min-width: 120px; padding: 4px;
}
.lx-row-menu a, .lx-row-menu button, .lx-row-menu .lx-row-menu-btn {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  border: 0; background: transparent; font: inherit; cursor: pointer;
  color: var(--td-text-color-primary); border-radius: 4px; text-decoration: none;
}
.lx-row-menu a:hover, .lx-row-menu button:hover, .lx-row-menu .lx-row-menu-btn:hover { background: #f5f6f8; }
.lx-row-menu button.danger { color: #e34d59; }
.doc-reparse-menu { display: none; } /* 旧菜单项已改为弹窗 */

.lx-table-empty { padding: 0 !important; border: 0 !important; }
.lx-empty-inline {
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.lx-empty-title {
  margin: 0;
  font-size: 14px;
  color: var(--td-text-color-secondary);
}
.lx-empty-hint {
  margin: 0;
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  line-height: 1.5;
  max-width: 480px;
}

@media (max-width: 1100px) {
  .lx-kb { grid-template-columns: 200px 1fr; }
}
@media (max-width: 860px) {
  .lx-kb { grid-template-columns: 1fr; }
  .lx-kb-tree { border-right: 0; border-bottom: 1px solid var(--td-border-color); max-height: 220px; }
  .kb-list-page { padding: 20px 16px; }
}

/* Settings config */
.config-tabs {
  display: inline-flex;
}
.config-panel { margin-bottom: 24px; }
.config-subtitle {
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: 600;
}
.config-subtitle:first-of-type { margin-top: 0; }
.config-section-desc {
  margin: 0 0 16px;
  color: var(--td-text-color-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.config-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}
.config-form-span { grid-column: 1 / -1; }
.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--td-text-color-placeholder);
  line-height: 1.5;
}
.config-model-block {
  border: 1px solid var(--td-border-color);
  border-radius: var(--radius-default);
  margin-bottom: 16px;
  overflow: hidden;
}
.config-model-head {
  padding: 12px 16px;
  background: #fafbfc;
  border-bottom: 1px solid var(--td-border-color);
}
.config-model-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.config-model-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--td-text-color-placeholder);
}
.config-model-body { padding: 16px; }
@media (max-width: 768px) {
  .config-form-grid { grid-template-columns: 1fr; }
}

/* 标题后说明：xinxi；气泡经 JS 挂到 body，避免父级 overflow 裁切 */
.ui-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
  outline: none;
}
.ui-tip-icon {
  width: 14px;
  height: 14px;
  opacity: .45;
  color: var(--td-text-color-secondary);
}
.ui-tip:hover .ui-tip-icon,
.ui-tip:focus .ui-tip-icon,
.ui-tip.is-open .ui-tip-icon {
  opacity: .9;
  color: var(--td-brand-color);
}
.ui-tip-panel { display: none !important; }
.ui-tip-floating {
  position: fixed;
  z-index: 2147483000;
  min-width: 320px;
  max-width: min(640px, 92vw);
  padding: 10px 12px;
  border-radius: 8px;
  background: #1f2329;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease;
}
.ui-tip-floating.is-visible {
  opacity: 1;
  visibility: visible;
}
.ui-tip-floating::after {
  content: '';
  position: absolute;
  left: var(--tip-arrow-x, 50%);
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2329;
}
.ui-tip-floating.is-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #1f2329;
}
.page-title,
.card-title,
.config-subtitle,
.config-model-title,
.kb-manage-h,
.modal-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}
.kb-manage-stat-l {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* HOSO aggregated search — Exa dashboard landing */
.hoso-page {
  --hoso-bg: #ffffff;
  --hoso-text: #0b0f19;
  --hoso-text-muted: #64748b;
  --hoso-surface: #ffffff;
  --hoso-surface-subtle: #f1f5f9;
  --hoso-card-border: rgba(15, 23, 42, 0.08);
  --hoso-link: #2563eb;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--hoso-bg);
}
.hoso-page--landing { overflow: auto; }
.hoso-settings-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 30;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--hoso-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.hoso-settings-btn:hover,
.hoso-settings-btn[aria-expanded="true"] {
  background: var(--hoso-surface-subtle);
  color: var(--hoso-text);
}
.hoso-settings-btn .icon-color {
  width: 18px;
  height: 18px;
}
.hoso-settings-panel {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 40;
  min-width: 260px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  background: var(--hoso-surface);
  border: 1px solid var(--hoso-card-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hoso-settings-panel[hidden] {
  display: none !important;
}
.hoso-collection-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hoso-collection-picker-search {
  position: relative;
}
.hoso-collection-picker-input {
  width: 100%;
  height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}
.hoso-collection-picker-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 200px;
  overflow: auto;
  background: var(--hoso-surface, #fff);
  border: 1px solid var(--hoso-card-border, rgba(15, 23, 42, 0.08));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.hoso-collection-picker-list[hidden] {
  display: none !important;
}
.hoso-collection-picker-option {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--hoso-text, #0b0f19);
  cursor: pointer;
}
.hoso-collection-picker-option:hover,
.hoso-collection-picker-option.is-active {
  background: var(--hoso-surface-subtle, #f1f5f9);
}
.hoso-collection-picker-option.is-empty {
  color: var(--hoso-text-muted, #64748b);
  cursor: default;
}
.hoso-collection-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}
.hoso-collection-picker-hint {
  font-size: 12px;
  line-height: 1.5;
}
.hoso-collection-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 6px 2px 8px;
  border-radius: 999px;
  background: var(--hoso-surface-subtle, #f1f5f9);
  border: 1px solid var(--hoso-card-border, rgba(15, 23, 42, 0.08));
  font-size: 12px;
  line-height: 1.4;
  color: var(--hoso-text, #0b0f19);
}
.hoso-collection-picker-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hoso-collection-picker-chip-remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--hoso-text-muted, #64748b);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.hoso-collection-picker-chip-remove:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--hoso-text, #0b0f19);
}
.hoso-search-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}
.hoso-page--landing .hoso-search-stage {
  flex: 1;
  min-height: min(calc(100vh - 56px), 820px);
}
.hoso-page--results .hoso-search-stage,
.hoso-page.is-loading .hoso-search-stage {
  flex: 0 0 auto;
  min-height: 0;
  padding: 10px 20px 8px;
  justify-content: stretch;
  align-items: stretch;
}
.hoso-page--results .hoso-exa-card,
.hoso-page.is-loading .hoso-exa-card {
  max-width: none;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  overflow: visible;
  text-align: left;
}
.hoso-page--results .hoso-exa-card-shader,
.hoso-page.is-loading .hoso-exa-card-shader,
.hoso-page--results .hoso-title,
.hoso-page.is-loading .hoso-title,
.hoso-page--results .hoso-suggestions,
.hoso-page.is-loading .hoso-suggestions {
  display: none;
}
.hoso-page--results .hoso-exa-card-inner,
.hoso-page.is-loading .hoso-exa-card-inner {
  align-items: stretch;
}
.hoso-page--results .hoso-search-form,
.hoso-page.is-loading .hoso-search-form {
  max-width: 640px;
  margin: 0 auto;
}
.hoso-page--results .hoso-search-bar,
.hoso-page.is-loading .hoso-search-bar {
  padding: 4px 10px 4px 16px;
  gap: 6px;
}
.hoso-page--results .hoso-search-input,
.hoso-page.is-loading .hoso-search-input {
  font-size: 14px;
  padding: 6px 0;
  line-height: 1.4;
}
.hoso-page--results .hoso-search-submit,
.hoso-page.is-loading .hoso-search-submit {
  width: 30px;
  height: 30px;
}
.hoso-page--results .hoso-search-submit svg,
.hoso-page.is-loading .hoso-search-submit svg {
  width: 15px;
  height: 15px;
}
.hoso-exa-card {
  position: relative;
  width: 100%;
  max-width: 920px;
  border-radius: 20px;
  border: 1px solid var(--hoso-card-border);
  background: #e9edfc;
  padding: 88px 24px 64px;
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
}
.hoso-exa-card-shader {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 42%),
    radial-gradient(ellipse 70% 55% at 20% 100%, rgba(147, 197, 253, 0.75) 0%, transparent 70%),
    radial-gradient(ellipse 65% 50% at 80% 105%, rgba(96, 165, 250, 0.55) 0%, transparent 68%),
    radial-gradient(ellipse 80% 40% at 50% 110%, rgba(191, 219, 254, 0.45) 0%, transparent 72%);
}
.hoso-exa-card-shader::before,
.hoso-exa-card-shader::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  animation: hoso-shimmer 10s ease-in-out infinite alternate;
}
.hoso-exa-card-shader::before {
  width: 55%;
  height: 45%;
  left: -8%;
  bottom: -18%;
  background: radial-gradient(circle, rgba(0, 64, 240, 0.28) 0%, transparent 70%);
}
.hoso-exa-card-shader::after {
  width: 50%;
  height: 42%;
  right: -6%;
  bottom: -15%;
  background: radial-gradient(circle, rgba(99, 141, 255, 0.35) 0%, transparent 68%);
  animation-delay: -5s;
}
@keyframes hoso-shimmer {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(2%, -3%) scale(1.06); }
}
.hoso-exa-card-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hoso-title {
  margin: 0 0 32px;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--hoso-text);
}
.hoso-search-form {
  width: 100%;
  max-width: 576px;
}
.hoso-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 22px;
  background: var(--hoso-surface);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 28px rgba(15, 23, 42, 0.06);
}
.hoso-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  padding: 12px 0;
  color: var(--hoso-text);
}
.hoso-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}
.hoso-search-submit {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--hoso-link);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s, transform 0.12s;
}
.hoso-search-submit:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.hoso-search-submit.is-empty {
  opacity: 0.55;
}
.hoso-submit-spinner,
.hoso-submit-stop { display: none; }
.hoso-page.is-loading .hoso-submit-arrow { display: none; }
.hoso-page.is-loading .hoso-submit-spinner {
  display: block;
  animation: hoso-spin 0.8s linear infinite;
}
.hoso-page.is-loading .hoso-search-submit:hover .hoso-submit-spinner,
.hoso-page.is-loading .hoso-search-submit:focus .hoso-submit-spinner {
  display: none;
}
.hoso-page.is-loading .hoso-search-submit:hover .hoso-submit-stop,
.hoso-page.is-loading .hoso-search-submit:focus .hoso-submit-stop {
  display: block;
}
.hoso-page.is-loading .hoso-search-submit {
  opacity: 1;
  cursor: pointer;
}
@keyframes hoso-spin {
  to { transform: rotate(360deg); }
}
.hoso-suggestions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.hoso-suggestion {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: var(--hoso-surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--hoso-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.hoso-suggestion:hover {
  background: var(--hoso-surface-subtle);
}
.hoso-suggestion.is-active {
  border-color: rgba(0, 64, 240, 0.35);
  box-shadow: 0 0 0 3px rgba(0, 64, 240, 0.08);
  background: #fff;
}
.hoso-suggestion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hoso-text-muted);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.hoso-suggestion-icon .icon,
.hoso-suggestion-icon .icon-rich,
.hoso-suggestion-icon .icon-color {
  width: 14px;
  height: 14px;
}
.hoso-results {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 4px 0 12px;
  display: flex;
  flex-direction: column;
}
.hoso-page--results .hoso-results {
  padding-bottom: 0;
}
.hoso-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.hoso-workspace-search {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}
.hoso-agent-panel {
  display: none;
}
.hoso-page--agent .hoso-workspace {
  flex-direction: column;
  gap: 0;
}
.hoso-page--agent.hoso-page--results .hoso-workspace,
.hoso-page--agent.is-loading .hoso-workspace {
  flex-direction: row;
  border-top: 1px solid var(--hoso-card-border);
}
.hoso-page--agent .hoso-workspace-search {
  flex: 1;
  max-width: none;
  border-right: none;
  padding: 0;
}
.hoso-page--agent.hoso-page--results .hoso-workspace-search,
.hoso-page--agent.is-loading .hoso-workspace-search {
  flex: 1 1 42%;
  max-width: 52%;
  border-right: 1px solid var(--hoso-card-border);
  padding: 8px 12px 12px;
}
.hoso-page--agent .hoso-workspace-search .hoso-settings-btn {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin: 0;
}
.hoso-page--agent .hoso-workspace-search .hoso-settings-panel {
  top: 52px;
  right: 8px;
  left: auto;
}
.hoso-page--agent.hoso-page--results .hoso-search-stage,
.hoso-page--agent.is-loading .hoso-search-stage {
  padding: 4px 0 10px;
  justify-content: stretch;
  align-items: stretch;
}
.hoso-page--agent.hoso-page--results .hoso-search-form,
.hoso-page--agent.is-loading .hoso-search-form {
  max-width: none;
  margin: 0;
  width: 100%;
}
.hoso-search-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.hoso-search-toolbar .hoso-search-bar {
  flex: 1;
  min-width: 0;
}
.hoso-page--agent.hoso-page--results .hoso-search-bar,
.hoso-page--agent.is-loading .hoso-search-bar {
  width: auto;
}
.hoso-page--agent .hoso-agent-panel {
  display: none;
  flex: 1 1 58%;
  min-width: 280px;
  flex-direction: column;
  background: #fafbfc;
  min-height: 0;
}
.hoso-page--agent.hoso-page--results .hoso-agent-panel:not([hidden]),
.hoso-page--agent.is-loading .hoso-agent-panel:not([hidden]) {
  display: flex;
}
.hoso-page--agent .hoso-agent-panel[hidden] {
  display: none !important;
}
.hoso-page--agent .hoso-chat-dock,
.hoso-page--agent .hoso-chat-mask,
.hoso-page--agent .hoso-chat-sheet {
  display: none !important;
}
.hoso-agent-panel__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--hoso-card-border);
}
.hoso-agent-panel__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--hoso-text);
}
.hoso-agent-panel__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.hoso-agent-panel__body .hoso-chat-msg {
  margin-bottom: 0;
}
.hoso-agent-panel__foot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hoso-card-border);
  background: #fff;
}
.hoso-agent-panel__input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  overflow-y: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  outline: none;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #0b0f19;
  box-sizing: border-box;
}
.hoso-agent-panel__input:focus {
  border-color: rgba(37, 99, 235, 0.42);
}
.hoso-agent-panel__send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hoso-agent-panel__send .icon,
.hoso-agent-panel__send .icon-rich {
  width: 18px;
  height: 18px;
  color: #fff;
}
.hoso-agent-panel__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hoso-source-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin-bottom: 2px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.hoso-source-tabs[hidden] {
  display: none !important;
}
.hoso-source-tabs::-webkit-scrollbar {
  display: none;
}
.hoso-source-tab {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--hoso-text-muted);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.hoso-source-tab:hover {
  background: var(--hoso-surface-subtle);
  color: var(--hoso-text);
}
.hoso-source-tab.is-active {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
  font-weight: 600;
}
.hoso-source-tab-count {
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.75;
}
.hoso-page--agent .hoso-results {
  padding: 0;
}
.hoso-page--agent .hoso-columns {
  display: block;
  overflow: hidden;
  padding: 0;
  scroll-snap-type: none;
}
.hoso-page--agent .hoso-columns::before,
.hoso-page--agent .hoso-columns::after {
  display: none;
}
.hoso-page--agent .hoso-column {
  display: none;
  flex: none;
  width: 100%;
  max-width: none;
  min-width: 0;
}
.hoso-page--agent .hoso-column.is-active {
  display: flex;
  height: 100%;
}
.hoso-chat-msg--system {
  align-self: stretch;
}
.hoso-chat-msg--system .hoso-chat-msg__bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  background: transparent;
  border: 1px dashed rgba(15, 23, 42, 0.12);
  color: var(--hoso-text-muted);
  font-size: 13px;
  border-radius: 10px;
  padding: 8px 10px;
}
.hoso-chat-process {
  margin: 0 0 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
  max-width: 100%;
  overflow: hidden;
}
.hoso-chat-process__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #64748b;
}
.hoso-chat-process__summary::-webkit-details-marker {
  display: none;
}
.hoso-chat-process__label {
  font-weight: 600;
  color: #475569;
}
.hoso-chat-process__meta {
  color: #94a3b8;
  font-size: 11px;
}
.hoso-chat-process__chevron {
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #94a3b8;
  transition: transform 0.15s ease;
}
.hoso-chat-process[open] .hoso-chat-process__chevron {
  transform: rotate(180deg);
}
.hoso-chat-process__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}
.hoso-chat-process:not([open]) .hoso-chat-process__body {
  display: none;
}
.hoso-chat-process__item-title {
  font-size: 12px;
  line-height: 1.4;
  color: #475569;
  font-weight: 560;
  margin-top: 8px;
}
.hoso-chat-process__item--tool .hoso-chat-process__item-title {
  color: #1d4ed8;
}
.hoso-chat-process__item--think .hoso-chat-process__item-title {
  color: #64748b;
}
.hoso-chat-process__item.is-streaming .hoso-chat-process__item-title::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: #3b82f6;
  vertical-align: middle;
  animation: hoso-spin 0.9s linear infinite;
  opacity: 0.85;
}
.hoso-chat-process__item-detail {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-left: 2px solid rgba(37, 99, 235, 0.2);
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
@media (max-width: 900px) {
  .hoso-page--agent.hoso-page--results .hoso-workspace,
  .hoso-page--agent.is-loading .hoso-workspace {
    flex-direction: column;
  }
  .hoso-page--agent.hoso-page--results .hoso-workspace-search,
  .hoso-page--agent.is-loading .hoso-workspace-search {
    flex: 1 1 42%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--hoso-card-border);
    max-height: 46vh;
  }
  .hoso-page--agent.hoso-page--results .hoso-agent-panel:not([hidden]),
  .hoso-page--agent.is-loading .hoso-agent-panel:not([hidden]) {
    flex: 1 1 54%;
    min-width: 0;
  }
}
.hoso-columns {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  align-items: stretch;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 8px;
  scroll-padding-inline: 24px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hoso-columns::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
/* flex 横向滚动时 padding 容易失效，用伪元素做左右边距，保证第一列能滑回来 */
.hoso-columns::before,
.hoso-columns::after {
  content: '';
  flex: 0 0 24px;
  width: 24px;
  pointer-events: none;
}
.hoso-columns.is-centered {
  justify-content: center;
}
.hoso-columns.is-centered::before,
.hoso-columns.is-centered::after {
  flex: 1 1 24px;
  width: auto;
  min-width: 24px;
}
.hoso-column {
  flex: 0 0 min(300px, 72vw);
  width: min(300px, 72vw);
  max-width: 340px;
  min-width: 240px;
  min-height: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}
.hoso-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
  flex-shrink: 0;
}
.hoso-column-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.hoso-column-title h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--hoso-text);
}
.hoso-column-count {
  font-size: 12px;
  color: var(--hoso-text-muted);
}
.hoso-column-head .select-sm {
  min-width: 84px;
  font-size: 12px;
  padding: 3px 8px;
  height: 28px;
}
.hoso-column-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hoso-column-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.hoso-hit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hoso-hit {
  min-width: 0;
}
.hoso-hit-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--hoso-text);
  text-decoration: none;
  margin-bottom: 4px;
}
a.hoso-hit-title:hover {
  color: var(--hoso-link);
}
.hoso-hit-snippet {
  font-size: 13px;
  line-height: 1.5;
  color: var(--hoso-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.hoso-hit-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.hoso-hit-link {
  font-size: 12px;
  color: var(--hoso-link);
  text-decoration: none;
  word-break: break-all;
}
.hoso-hit-link:hover {
  text-decoration: underline;
}
.hoso-hit-time {
  font-size: 12px;
  color: var(--hoso-text-muted);
  white-space: nowrap;
}
.hoso-column.is-loading .hoso-column-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.hoso-column.is-loading .hoso-column-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: hoso-spin 0.8s linear infinite;
}
.hoso-empty {
  text-align: center;
  padding: 40px 16px;
}
@media (max-width: 768px) {
  .hoso-page--landing .hoso-search-stage {
    min-height: calc(100vh - 56px);
    padding: 16px;
  }
  .hoso-exa-card {
    padding: 64px 16px 48px;
  }
  .hoso-title {
    font-size: 26px;
    margin-bottom: 24px;
  }
  .hoso-search-bar { padding: 6px 12px 6px 16px; }
  .hoso-search-input { font-size: 16px; }
  .hoso-columns::before,
  .hoso-columns::after {
    flex-basis: 16px;
    width: 16px;
  }
  .hoso-column {
    flex-basis: min(280px, 82vw);
    width: min(280px, 82vw);
  }
  .hoso-settings-panel {
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* HOSO 追问（参考 daily 呼哈搜索，主题色对齐 HOSO） */
.hoso-page .hoso-chat-md h1,
.hoso-page .hoso-chat-md h2,
.hoso-page .hoso-chat-md h3 {
  font-weight: 700;
  margin: 0.85rem 0 0.45rem;
  line-height: 1.45;
  color: var(--hoso-text);
}
.hoso-page .hoso-chat-md h1 { font-size: 1.05rem; }
.hoso-page .hoso-chat-md h2 { font-size: 1rem; }
.hoso-page .hoso-chat-md p { margin: 0.45rem 0; }
.hoso-page .hoso-chat-md strong { font-weight: 700; }
.hoso-page .hoso-chat-md ul,
.hoso-page .hoso-chat-md ol {
  padding-left: 1.2rem;
  margin: 0.5rem 0;
}
.hoso-page .hoso-chat-md ul { list-style: disc; }
.hoso-page .hoso-chat-md ol { list-style: decimal; }
.hoso-page .hoso-chat-md blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 0.65rem;
  color: var(--hoso-text-muted);
  margin: 0.6rem 0;
}
.hoso-page .hoso-chat-md code {
  background: var(--hoso-surface-subtle);
  padding: 0.05rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.92em;
}
.hoso-page .hoso-chat-md pre {
  background: var(--hoso-surface-subtle);
  padding: 0.65rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.6rem 0;
}
.hoso-page .hoso-chat-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.65rem 0;
  font-size: 0.92em;
  border: 1px solid var(--hoso-card-border);
  border-radius: 8px;
  overflow: hidden;
}
.hoso-page .hoso-chat-md th,
.hoso-page .hoso-chat-md td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--hoso-card-border);
}
.hoso-page .hoso-chat-md thead th {
  background: var(--hoso-surface-subtle);
  font-weight: 600;
}
.hoso-page .hoso-chat-msg--bot .hoso-chat-md a.hoso-chat-link-chip,
.hoso-chat-msg--bot .hoso-chat-md a.hoso-chat-link-chip {
  display: inline;
  padding: 0.12em 0.48em;
  margin: 0 0.06em;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92em;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}
.hoso-page .hoso-chat-msg--bot .hoso-chat-md a.hoso-chat-link-chip:hover,
.hoso-chat-msg--bot .hoso-chat-md a.hoso-chat-link-chip:hover {
  background: #dbeafe;
  color: #1e40af;
}

.hoso-chat-dock {
  position: fixed;
  z-index: 120;
  left: var(--hoso-dock-x, 50%);
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  width: min(100%, 440px);
  max-width: calc(100vw - 32px);
  transform: translate(-50%, calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.32s ease,
    width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.28s ease;
}
.hoso-chat-dock.hoso-chat-dock--in {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
/* 激发态：点进追问框且 sheet 未展开 — 蓝色渐变聚焦 */
body:not(.hoso-chat-dock-expanded):not(.hoso-chat-narrow-open) .hoso-chat-dock.hoso-chat-dock--in:focus-within::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: min(200%, 780px);
  height: 160px;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 78% 92% at 50% 100%, rgba(37, 99, 235, 0.48) 0%, rgba(96, 165, 250, 0.2) 40%, transparent 74%);
  filter: blur(2px);
  opacity: 1;
  transition: opacity 0.35s ease;
}
body:not(.hoso-chat-dock-expanded):not(.hoso-chat-narrow-open) .hoso-chat-dock.hoso-chat-dock--in:focus-within .hoso-chat-dock__inner {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.14),
    0 8px 28px rgba(37, 99, 235, 0.18),
    0 24px 64px rgba(37, 99, 235, 0.24),
    0 48px 112px rgba(59, 130, 246, 0.16);
}
.hoso-chat-dock__inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 16px 48px rgba(15, 23, 42, 0.14),
    0 4px 12px rgba(15, 23, 42, 0.08);
  overflow: visible;
  transition:
    border-radius 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.36s ease,
    border-color 0.28s ease,
    background 0.28s ease,
    padding 0.28s ease;
}
.hoso-chat-dock__input,
.hoso-chat-sheet__input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  overflow-y: hidden;
  overflow-x: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  outline: none;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #0b0f19;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: height 0.14s ease, border-color 0.15s ease;
  box-sizing: border-box;
}
.hoso-chat-dock__input::-webkit-scrollbar,
.hoso-chat-sheet__input::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.hoso-chat-dock__input:focus,
.hoso-chat-sheet__input:focus {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: none;
}
.hoso-chat-dock__send,
.hoso-chat-sheet__send {
  flex-shrink: 0;
  align-self: flex-end;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: #2563eb;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.hoso-chat-dock__send:hover,
.hoso-chat-sheet__send:hover {
  opacity: 0.92;
}
.hoso-chat-dock__send:disabled,
.hoso-chat-sheet__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hoso-chat-dock__send .icon-rich,
.hoso-chat-sheet__send .icon-rich {
  width: 18px;
  height: 18px;
}
.hoso-chat-dock__send svg path,
.hoso-chat-sheet__send svg path {
  fill: #ffffff !important;
}

.hoso-chat-mask {
  position: fixed;
  inset: 0;
  z-index: 124;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.hoso-chat-mask.hoso-chat-mask--in {
  opacity: 1;
  pointer-events: auto;
}
.hoso-chat-reopen {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hoso-chat-reopen.hidden { display: none !important; }

.hoso-chat-sheet {
  position: fixed;
  z-index: 125;
  left: var(--hoso-dock-x, 50%);
  bottom: 0;
  width: min(100%, 560px);
  max-width: calc(100vw - 16px);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 16px 16px 0 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-bottom: 0;
  background: #ffffff;
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.14);
  transform: translate(-50%, 100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
  overflow: hidden;
}
.hoso-chat-sheet__head,
.hoso-chat-sheet__body,
.hoso-chat-sheet__foot {
  background: #ffffff;
}
.hoso-chat-sheet.hoso-chat-sheet--in {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.hoso-chat-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.hoso-chat-sheet__title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #0b0f19;
}
.hoso-chat-sheet__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.05);
  font-size: 17px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.hoso-chat-sheet__close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0b0f19;
}
.hoso-chat-sheet__body {
  flex: 1;
  overflow: auto;
  padding: 8px 12px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hoso-chat-sheet__body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.hoso-chat-msg--bot .hoso-chat-md pre {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hoso-chat-msg--bot .hoso-chat-md pre::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.hoso-chat-sheet__foot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  overflow: visible;
}
.hoso-chat-limit-note {
  margin: 0;
  padding: 0 14px 12px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}
.hoso-chat-limit-note.hidden { display: none !important; }

.hoso-chat-msg {
  display: flex;
  margin-bottom: 12px;
}
.hoso-chat-msg--user {
  justify-content: flex-end;
}
.hoso-chat-msg--user .hoso-chat-msg__bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px 14px 4px 14px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.hoso-chat-msg--bot {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.hoso-chat-msg__bot-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}
.hoso-chat-msg--bot .hoso-chat-msg__bubble {
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #f1f5f9;
  color: #0b0f19;
  font-size: 14px;
  line-height: 1.55;
}
.hoso-chat-msg__bubble.hidden {
  display: none !important;
}
.hoso-chat-msg__bubble--loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
}
.hoso-chat-status {
  font-size: 12px;
  color: #64748b;
  padding-left: 2px;
}
.hoso-chat-status.hidden { display: none !important; }
.hoso-chat-suggest-wrap.hidden { display: none !important; }
.hoso-chat-suggest-chip {
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #0b0f19;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.hoso-chat-suggest-chip:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}
.hoso-chat-spin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(100, 116, 139, 0.25);
  border-top-color: #2563eb;
  animation: hoso-spin 0.75s linear infinite;
}

/* 宽屏：dock 先展宽，sheet 再从 dock 上方「长出来」 */
body.hoso-chat-dock-expanded .hoso-chat-dock {
  width: min(100%, 560px);
  max-width: calc(100vw - 16px);
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-top: none;
  border-radius: 0 0 16px 16px;
}
body.hoso-chat-dock-expanded .hoso-chat-dock__inner {
  border-radius: 0 0 16px 16px;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom, 0px));
}
body.hoso-chat-wide-open .hoso-chat-sheet {
  border-radius: 16px 16px 0 0;
  border-bottom: none;
  max-height: min(64vh, 580px);
  box-shadow: none;
}
body.hoso-chat-wide-open .hoso-chat-dock {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 16px 48px rgba(15, 23, 42, 0.14),
    0 4px 12px rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}
body.hoso-chat-wide-open .hoso-chat-sheet__foot {
  display: none;
}

@media (min-width: 640px) {
  body.hoso-chat-dock-expanded .hoso-chat-sheet:not(.hidden):not(.hoso-chat-sheet--in) {
    transform: translate(-50%, 0) scaleY(0);
    opacity: 0;
    transform-origin: bottom center;
  }
  body.hoso-chat-dock-expanded .hoso-chat-sheet.hoso-chat-sheet--in {
    transform: translate(-50%, 0) scaleY(1);
    opacity: 1;
    pointer-events: auto;
    transform-origin: bottom center;
  }
}

/* 窄屏：全屏 sheet，底部用 sheet 内输入框 */
body.hoso-chat-narrow-open .hoso-chat-dock.hoso-chat-dock--in {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 32px));
}

@media (min-width: 640px) {
  .hoso-chat-sheet {
    border-radius: 16px;
  }
  .hoso-chat-sheet.hoso-chat-sheet--in {
    transform: translate(-50%, 0);
  }
}
@media (max-width: 639px) {
  .hoso-chat-dock {
    width: min(calc(100vw - 20px), 420px);
  }
}
