/* ============================================================
   文献中心页样式（文献库 + 文献智能问答）
   ============================================================ */

html, body { overflow-x: hidden; }

/* ---------- 页面标题栏 ---------- */
.page-title-bar {
  margin-top: 72px;
  padding: 32px 0 20px;
  background: var(--grad-soft);
}
.page-title-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.page-title-text h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 1px;
}
.page-title-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-3);
}
.page-title-tip {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(41, 112, 192, 0.06);
  border: 1px solid rgba(41, 112, 192, 0.15);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
}
.page-title-tip > svg {
  color: #2970c0;
  flex-shrink: 0;
}
.page-title-tip .btn-xs {
  padding: 2px 12px;
  font-size: 12px;
  border-radius: 999px;
  line-height: 1.8;
}

/* ---------- 搜索框 ---------- */
.page-search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 4px 4px 4px 18px;
  box-shadow: 0 2px 8px rgba(41, 112, 192, 0.08);
  border: 1px solid var(--line);
  transition: border-color .25s, box-shadow .25s;
  flex: 0 1 480px;
  min-width: 360px;
  gap: 0;
}
.page-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(41, 112, 192, 0.15);
}
.page-search-input {
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  flex: 1;
  min-width: 0;
  padding: 8px 0;
}
.page-search-input:first-of-type {
  border-right: 1px solid var(--line);
  padding-right: 12px;
}
.page-search-input:last-of-type {
  padding-left: 12px;
}
.page-search-input::placeholder { color: var(--ink-3); }
.page-search-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  flex-shrink: 0;
}
.page-search-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(41, 112, 192, 0.3);
}

/* ---------- 一级 Tab 栏 ---------- */
.top-tabs-wrap {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 72px;
  z-index: 90;
}
.top-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }
.top-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 16px 30px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  position: relative;
  transition: color .25s;
  text-decoration: none;
}
.top-tab svg { flex-shrink: 0; }
.top-tab:hover { color: var(--primary); }
.top-tab.active { color: var(--primary); }
.top-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}
.top-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.top-tabs-row .top-tabs { flex: 0 0 auto; }
.top-tabs-extra {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.lit-help-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--primary-light);
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  cursor: pointer;
  transition: all .22s;
}
.lit-help-entry:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.top-tabs-tip {
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- 文献求助弹窗 ---------- */
.lit-help-modal {
  max-width: 520px;
  width: 94%;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.lit-help-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: .5px;
}
.lit-help-sub {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
}
.lit-help-modal > .lit-help-title,
.lit-help-modal > .lit-help-sub {
  padding: 28px 30px 0;
  flex-shrink: 0;
}
.lit-help-modal > .lit-help-sub {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.lit-help-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 30px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.lit-help-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lit-help-field label {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  gap: 4px;
}
.lit-help-field .req {
  color: #e74c3c;
  font-weight: 700;
  line-height: 1;
}
.lit-help-field input,
.lit-help-field textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  font-family: inherit;
  resize: none;
  box-sizing: border-box;
}
.lit-help-field input::placeholder,
.lit-help-field textarea::placeholder {
  color: #b4bcc7;
}
.lit-help-field input:hover,
.lit-help-field textarea:hover {
  border-color: #c5d0dd;
}
.lit-help-field input:focus,
.lit-help-field textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(41, 112, 192, 0.1);
}
.lit-help-field textarea { min-height: 72px; line-height: 1.55; }
.lit-help-submit-row {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 30px 22px;
  border-top: 1px dashed var(--line);
  background: #fff;
  flex-shrink: 0;
}
.lit-help-submit-row .btn-primary {
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(41, 112, 192, 0.25);
  transition: box-shadow .2s, transform .15s;
}
.lit-help-submit-row .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(41, 112, 192, 0.35);
  transform: translateY(-1px);
}
.lit-help-submit-row .btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.lit-help-modal .lit-modal-close {
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  color: var(--ink-3);
  background: #f5f7fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: none;
  transition: all .2s;
}
.lit-help-modal .lit-modal-close:hover {
  color: #fff;
  background: var(--primary);
  transform: rotate(90deg);
}

/* ---------- 主体 ---------- */
.lit-main {
  padding: 26px 0 64px;
  background: var(--bg-soft);
  min-height: calc(100vh - 72px);
}
.lit-panel[hidden] { display: none; }

/* ---------- 筛选栏 ---------- */
.lit-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lit-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.lit-chip {
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .25s ease;
  user-select: none;
}
.lit-chip:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--accent);
}
.lit-chip.active {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(41, 112, 192, 0.28);
}

.lit-fav-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .25s ease;
}
.lit-fav-filter:hover { border-color: #FF8A00; color: #FF8A00; }
.lit-fav-filter[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #FFB020, #FF8A00);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 138, 0, 0.3);
}
.lit-fav-count {
  font-style: normal;
  font-size: 12px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(18, 58, 107, 0.1);
  text-align: center;
}
.lit-fav-filter[aria-pressed="true"] .lit-fav-count { background: rgba(255, 255, 255, 0.28); }

/* ---------- 结果统计 ---------- */
.lit-result-meta {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 14px;
  min-height: 18px;
}
.lit-result-meta strong { color: var(--primary); font-weight: 700; }

/* ---------- 文献卡片 ---------- */
.lit-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lit-card {
  display: flex;
  gap: 18px;
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* 左侧期刊徽标 */
.lit-card-badge {
  flex-shrink: 0;
  width: 64px;
  height: 80px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  align-self: center;
  box-shadow: 0 6px 16px rgba(41, 112, 192, 0.25);
}
.lit-card-badge .lit-badge-year {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.lit-card-badge .lit-badge-label {
  font-size: 11px;
  opacity: .85;
  letter-spacing: 1px;
}

.lit-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

.lit-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  transition: color .25s;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lit-card-meta {
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}
.lit-card-meta .lit-journal {
  color: var(--primary-dark);
  font-weight: 600;
}
.lit-card-meta .lit-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line);
}
.lit-card-authors {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lit-card-abstract {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lit-card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lit-tag {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(41, 112, 192, 0.08);
  font-weight: 500;
}

.lit-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.lit-card-action-btns {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lit-card-doi {
  font-size: 12px;
  color: var(--ink-3);
  background: #f3f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 10px;
  font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: color .2s, border-color .2s, background .2s;
}
.lit-card-doi:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--accent);
}
.lit-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .22s ease;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
}
.lit-action-btn:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--accent);
}
.lit-action-btn.btn-primary-line {
  color: var(--primary);
  border-color: rgba(41, 112, 192, 0.35);
}
.lit-action-btn.btn-primary-line:hover {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
}
.lit-action-btn.lit-fav-btn.is-fav {
  color: #FF8A00;
  border-color: rgba(255, 138, 0, 0.4);
  background: rgba(255, 138, 0, 0.08);
}
.lit-action-btn.lit-fav-btn.is-fav svg { fill: currentColor; }

/* ---------- 状态层 ---------- */
.lit-state {
  padding: 72px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 15px;
  background: #fff;
  border-radius: var(--radius);
}
.lit-state p { margin-bottom: 14px; }
.lit-state-icon { font-size: 46px; line-height: 1; margin-bottom: 14px; }
.lit-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lit-spin .85s linear infinite;
}
@keyframes lit-spin { to { transform: rotate(360deg); } }
.btn-sm { padding: 8px 22px; font-size: 14px; border-radius: 999px; }

/* ---------- 分页 ---------- */
.pagination-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.pagination .page-item a,
.pagination .page-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
}
.pagination .page-item a:hover { color: var(--primary); border-color: var(--primary); }
.pagination .page-item.disabled span {
  color: var(--ink-3);
  cursor: default;
  background: #f5f6f8;
}
.pagination .page-indicator {
  font-size: 14px;
  color: var(--ink-2);
  padding: 0 10px;
  user-select: none;
}

/* ---------- 文献详情弹窗 ---------- */
.lit-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 32, 56, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: lit-fade .25s ease;
}
.lit-modal-overlay[hidden] { display: none; }
@keyframes lit-fade { from { opacity: 0; } to { opacity: 1; } }
.lit-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: 86vh;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: lit-pop .3s cubic-bezier(.25,.8,.25,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@keyframes lit-pop {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.lit-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  background: var(--bg-soft);
  transition: all .2s;
}
.lit-modal-close:hover { color: #fff; background: var(--primary); transform: rotate(90deg); }
.lit-modal-body { padding: 30px 32px 28px; overflow-y: auto; }

.lit-modal-cat {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(41, 112, 192, 0.1);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.lit-modal-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 16px;
  padding-right: 30px;
}
.lit-modal-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 20px;
}
.lit-modal-info-item { font-size: 13.5px; min-width: 0; }
.lit-modal-info-item label {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  margin-bottom: 2px;
}
.lit-modal-info-item span { color: var(--ink-2); font-weight: 600; word-break: break-all; }
.lit-modal-info-full { grid-column: 1 / -1; }
.lit-modal-section h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.lit-modal-section h4::before {
  content: '';
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--grad);
}
.lit-modal-section p {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.85;
}
.lit-modal-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.lit-modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ---------- 智能问答（Deepseek 风格） ---------- */
.lit-chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}
.lit-chat-card {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  border: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 250px);
  min-height: 480px;
}
.lit-chat-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  flex-wrap: wrap;
}
.lit-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lit-ai-avatar {
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.lit-chat-head > div:nth-child(2) { min-width: 0; }
.lit-chat-head h3 { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.lit-chat-status {
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.lit-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C55E;
}
.lit-chat-head-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lit-chat-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #999;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .2s;
  flex-shrink: 0;
}
.lit-chat-clear:hover { color: #667eea; background: #f5f5f5; }

/* 消息区 */
.lit-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #fff;
  scroll-behavior: smooth;
}
.lit-msg {
  display: flex;
  gap: 14px;
  max-width: 100%;
  animation: lit-msg-in .3s cubic-bezier(.25,.8,.25,1);
}
@keyframes lit-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.lit-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.lit-msg.ai .lit-msg-avatar {
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.lit-msg.user { flex-direction: row-reverse; }
.lit-msg.user .lit-msg-avatar {
  color: #fff;
  background: #555;
}
.lit-msg-bubble {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  background: #f7f7f8;
  word-break: break-word;
}
.lit-msg.ai .lit-msg-bubble {
  background: #f7f7f8;
  max-width: 760px;
}
.lit-msg.user .lit-msg-bubble {
  color: #333;
  background: #eef2ff;
  max-width: 70%;
}
.lit-msg-bubble p { margin-bottom: 8px; }
.lit-msg-bubble p:last-child { margin-bottom: 0; }
.lit-msg-bubble ul { padding-left: 18px; margin: 6px 0; list-style: disc; }
.lit-msg-bubble li { margin-bottom: 4px; }
.lit-msg-bubble strong { color: #667eea; }
.lit-msg.user .lit-msg-bubble strong { color: #4338ca; }

.lit-user-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.lit-user-img {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  cursor: zoom-in;
  border: 1px solid rgba(255,255,255,.3);
}

/* 打字指示 */
.lit-typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.lit-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbb;
  animation: lit-typing 1.2s infinite ease-in-out;
}
.lit-typing span:nth-child(2) { animation-delay: .18s; }
.lit-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes lit-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.lit-chat-kb-select {
  width: 200px;
  padding: 7px 30px 7px 34px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  background: #f7f7f8;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23bbb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: right 10px center, left 10px center;
  background-size: 14px, 14px;
  transition: all .18s ease;
}
.lit-chat-kb-select:hover {
  background-color: #eee;
  border-color: #ddd;
}
.lit-chat-kb-select:focus {
  outline: none;
  background-color: #fff;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}
.lit-chat-kb-select option {
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
  color: #333;
}

.lit-chat-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #888;
  flex-shrink: 0;
}
.lit-chat-switch input { display: none; }
.lit-chat-switch-slider {
  position: relative;
  width: 32px;
  height: 18px;
  background-color: #ddd;
  border-radius: 18px;
  transition: background-color .2s ease;
  flex-shrink: 0;
}
.lit-chat-switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.lit-chat-switch input:checked + .lit-chat-switch-slider {
  background-color: #667eea;
}
.lit-chat-switch input:checked + .lit-chat-switch-slider::after {
  transform: translateX(14px);
}
.lit-chat-switch-text {
  white-space: nowrap;
}

/* 输入区 */
.lit-chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 24px 24px;
  background: #fff;
}
.lit-chat-input-wrap {
  flex: 1;
  position: relative;
}
.lit-chat-input {
  width: 100%;
  resize: none;
  max-height: 180px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 14px 92px 14px 16px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #333;
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
  box-sizing: border-box;
}
.lit-chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .1);
}
.lit-chat-input::placeholder { color: #bbb; }

.lit-chat-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 4px;
}
.lit-chat-preview.show { display: flex; }
.lit-chat-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #f5f5f5;
}
.lit-chat-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lit-chat-preview-item .lit-chat-preview-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.85);
  font-size: 10px; color: #667eea;
}
.lit-chat-preview-item .lit-chat-preview-remove {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e5e5;
  color: #999;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.lit-chat-preview-item .lit-chat-preview-remove:hover { color: #e74c3c; border-color: #e74c3c; }
.lit-chat-preview-item.lit-chat-preview-error { border-color: #e74c3c; }

.lit-chat-attach {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #8a8a8a;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  position: absolute;
  right: 54px;
  bottom: 10px;
}
.lit-chat-attach:hover { color: #667eea; background: #f3f4fb; }
.lit-chat-attach:disabled { opacity: .4; cursor: not-allowed; }

.lit-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  position: absolute;
  right: 10px;
  bottom: 10px;
}
.lit-chat-send:hover { background: #5568d3; }
.lit-chat-send:disabled {
  opacity: .4;
  cursor: not-allowed;
  background: #ccc;
}

/* 侧边卡片 */
.lit-chat-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 150px; }
.lit-side-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.lit-side-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.lit-side-card ul { display: flex; flex-direction: column; gap: 10px; }
.lit-side-card li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.lit-side-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 7px;
  flex-shrink: 0;
}
.lit-side-tip {
  background: linear-gradient(150deg, rgba(41,112,192,.07), rgba(223,248,252,.6));
  border-color: rgba(41, 112, 192, 0.12);
}
.lit-side-tip p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 14px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .lit-chat-layout { grid-template-columns: 1fr; }
  .lit-chat-side {
    position: static;
    flex-direction: row;
  }
  .lit-side-card { flex: 1; }
  .lit-chat-card { height: calc(100vh - 230px); }
}

@media (max-width: 768px) {
  .page-title-bar { padding: 22px 0 14px; }
  .page-title-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .page-title-text h1 { font-size: 21px; }
  .page-title-sub { font-size: 13px; }
  .page-search { flex: none; min-width: 0; width: 100%; }
  .top-tabs-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .top-tabs-row .top-tabs { overflow-x: auto; }
  .top-tabs-extra { justify-content: flex-start; flex-wrap: wrap; }
  .top-tabs-tip { display: none; }
  .top-tab { padding: 14px 20px; font-size: 15px; }

  .lit-main { padding: 18px 0 48px; }
  .lit-filter-bar { gap: 12px; }
  .lit-chip { padding: 6px 14px; font-size: 13px; }

  .lit-card { flex-direction: column; gap: 14px; padding: 16px; }
  .lit-card-badge {
    width: 100%;
    height: auto;
    flex-direction: row;
    gap: 8px;
    align-self: stretch;
    padding: 10px 14px;
    border-radius: 10px;
  }
  .lit-card-badge .lit-badge-year { font-size: 16px; }
  .lit-card-title { font-size: 15.5px; -webkit-line-clamp: 3; }
  .lit-card-actions .lit-action-btn { padding: 6px 11px; font-size: 12.5px; }

  /* 弹窗移动端变底部抽屉 */
  .lit-modal-overlay { padding: 0; align-items: flex-end; }
  .lit-modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
  }
  .lit-modal-body { padding: 24px 20px 28px; }
  .lit-modal-title { font-size: 18px; }
  .lit-modal-info { grid-template-columns: 1fr; gap: 10px; }
  .lit-modal-actions .btn,
  .lit-modal-actions .lit-action-btn { flex: 1; justify-content: center; }

  /* 聊天 */
  .lit-chat-card {
    height: calc(100vh - 220px);
    min-height: 420px;
    border-radius: 0;
  }
  .lit-chat-head { padding: 12px 16px; gap: 10px; }
  .lit-chat-head-tools { width: 100%; margin-left: 0; gap: 8px; }
  .lit-chat-kb-select { flex: 1; min-width: 0; width: auto; }
  .lit-chat-messages { padding: 20px 16px; gap: 20px; }
  .lit-msg { max-width: 100%; gap: 10px; }
  .lit-msg-bubble { font-size: 14px; padding: 10px 14px; }
  .lit-chat-input-bar { padding: 10px 16px 20px; }
  .lit-chat-input { padding: 12px 88px 12px 14px; font-size: 14px; }
  .lit-chat-send { width: 34px; height: 34px; right: 8px; bottom: 8px; border-radius: 8px; }
  .lit-chat-attach { width: 34px; height: 34px; right: 46px; bottom: 8px; }
  .lit-chat-side { flex-direction: column; }
  .lit-chat-clear span { display: none; }

  .pagination .page-item a,
  .pagination .page-item span { height: 34px; padding: 0 12px; font-size: 13px; }
}
/* ---------- SSE 流式光标 ---------- */
.lit-streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  margin-left: 2px;
  background: currentColor;
  vertical-align: middle;
  animation: lit-cursor-blink 0.9s infinite steps(1);
}
@keyframes lit-cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ---------- SSE 状态提示行 ---------- */
.lit-status-wrap {
  margin-bottom: 8px;
}
.lit-status-text {
  font-size: 12px;
  color: #95a5a6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lit-status-text::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #3498db);
  animation: lit-status-dot 1.2s infinite;
}
@keyframes lit-status-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

.lit-answer-wrap { line-height: 1.65; }

.lit-status-done {
  color: #27ae60 !important;
}
.lit-status-done::before {
  background: #27ae60 !important;
  animation: none !important;
}

/* ---------- AI 回答富文本格式化（原文格式保持） ---------- */
.lit-answer-wrap {
  line-height: 1.9;
  font-size: 14px;
  color: var(--ink-2);
  word-break: break-word;
  white-space: pre-wrap;
}
.lit-answer-wrap .lit-para {
  margin-bottom: 12px;
}
.lit-answer-wrap .lit-para:last-child {
  margin-bottom: 0;
}
.lit-answer-wrap .lit-line {
  display: block;
  margin-bottom: 4px;
}
.lit-answer-wrap .lit-bold {
  font-weight: 700;
  color: var(--primary-dark);
}
.lit-answer-wrap .lit-code {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 13px;
  color: #e11d48;
}
.lit-answer-wrap ul,
.lit-answer-wrap ol {
  padding-left: 20px;
  margin: 6px 0 10px;
}
.lit-answer-wrap ul {
  list-style: disc;
}
.lit-answer-wrap ol {
  list-style: decimal;
}
.lit-answer-wrap li {
  margin-bottom: 4px;
  line-height: 1.85;
}
.lit-answer-wrap hr {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 12px 0;
}
.lit-answer-wrap h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 14px 0 6px;
}
.lit-answer-wrap h4::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--grad);
  margin-right: 6px;
  vertical-align: middle;
}
.u-toast {
  position: fixed; top: 28px; left: 50%; z-index: 999;
  transform: translateX(-50%) translateY(-16px);
  background: rgba(22,35,58,.92); color: #fff;
  padding: 12px 24px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  opacity: 0; pointer-events: none; transition: all .35s cubic-bezier(.22,.8,.36,1);
  max-width: 86vw;
}
.u-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.u-toast.success { background: rgba(47,163,107,.95); }
.u-toast.error { background: rgba(229,72,77,.95); }