/* ===== PaperMind v2 · 优化样式 ===== */
:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --primary-bg: #f0fdfa;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fef3c7;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-sub: #64748b;
  --text-faint: #94a3b8;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --transition: all .18s cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px; height: 58px;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(13, 148, 136, .25);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; color: #fff;
  letter-spacing: .3px;
}
.logo svg { color: #5eead4; }
.nav-tabs { display: flex; gap: 4px; }
.tab-btn {
  background: transparent; border: none; color: rgba(255,255,255,.7);
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px;
  transition: var(--transition); font-weight: 500;
}
.tab-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.tab-btn.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.topbar-stats {
  margin-left: auto; font-size: 13px; color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.1); padding: 5px 14px; border-radius: 999px;
}
.topbar-stats b { color: #fff; font-weight: 600; }

/* ===== 布局 ===== */
.main { max-width: 1280px; margin: 0 auto; padding: 24px 28px 80px; }
.view[hidden] { display: none; }

/* ===== 上传区 ===== */
.dropzone {
  border: 2px dashed #99f6e4; border-radius: 16px;
  background: linear-gradient(180deg, var(--primary-bg), #ecfdf5);
  padding: 36px 24px; text-align: center; color: var(--primary-dark);
  transition: var(--transition); margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.dropzone::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(13,148,136,.04) 0%, transparent 60%);
  pointer-events: none;
}
.dropzone.drag {
  border-color: var(--primary); background: var(--primary-light);
  transform: scale(1.01); box-shadow: var(--shadow-md);
}
.dz-text { margin-top: 10px; font-size: 15px; font-weight: 500; position: relative; }
.dz-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-sub); position: relative; }
.link-btn {
  background: none; border: none; color: var(--primary-dark);
  font-size: 15px; font-weight: 600; text-decoration: underline; padding: 0;
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex; gap: 10px; margin-bottom: 16px;
  align-items: center;
}
.search-input {
  flex: 1; padding: 10px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card); outline: none;
  transition: var(--transition); font-size: 14px;
}
.search-input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}
.select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); outline: none; color: var(--text); cursor: pointer;
  transition: var(--transition);
}
.select:focus { border-color: var(--primary); }

/* ===== 按钮 ===== */
.btn {
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px;
  font-weight: 500; transition: var(--transition); border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(13,148,136,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: var(--card); color: var(--text-sub); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-bg); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #fecaca; }
.btn-danger-ghost:hover { background: var(--danger-light); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.icon-btn {
  padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text-sub);
  font-size: 14px; transition: var(--transition); line-height: 1;
}
.icon-btn:hover { background: var(--border-light); color: var(--text); }

/* ===== 分类 chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 7px 16px; font-size: 13px; color: var(--text-sub);
  transition: var(--transition); cursor: pointer; font-weight: 500;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-bg); }
.chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  font-weight: 600; box-shadow: 0 2px 6px rgba(13,148,136,.25);
}

/* ===== 文献卡片 ===== */
.paper-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px;
}
.paper-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.paper-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #2dd4bf);
  opacity: 0; transition: opacity .2s;
}
.paper-card:hover {
  box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: #99f6e4;
}
.paper-card:hover::before { opacity: 1; }
.pc-title {
  font-weight: 600; font-size: 15px; line-height: 1.5; cursor: pointer;
  color: var(--text); transition: color .15s;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-title:hover { color: var(--primary-dark); }
.pc-meta { font-size: 12.5px; color: var(--text-sub); line-height: 1.5; min-height: 18px; }
.pc-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--border-light); color: var(--text-sub); font-weight: 500;
  white-space: nowrap;
}
.badge.st-待筛选 { background: var(--accent-light); color: var(--accent-dark); }
.badge.st-待读   { background: #dbeafe; color: #2563eb; }
.badge.st-精读中 { background: var(--primary-light); color: var(--primary-dark); }
.badge.st-已读完 { background: #d1fae5; color: #059669; }
.badge.st-已放弃 { background: #f1f5f9; color: var(--text-faint); }
.badge-s {
  background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff;
  font-weight: 700; box-shadow: 0 1px 4px rgba(245,158,11,.3);
}
.badge-a { background: #ede9fe; color: #7c3aed; font-weight: 600; }
.pc-progress {
  font-size: 12px; color: var(--text-sub); display: flex; align-items: center; gap: 8px;
  margin-top: auto;
}
.pc-progress .bar {
  flex: 1; height: 5px; background: var(--border-light); border-radius: 999px; overflow: hidden;
}
.pc-progress .bar i {
  display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #2dd4bf);
  border-radius: 999px; transition: width .3s;
}
.pc-actions { display: flex; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border-light); }
.pc-actions .btn { flex: 1; }

/* ===== 空状态 ===== */
.empty-tip {
  text-align: center; padding: 60px 20px; color: var(--text-faint); font-size: 15px;
}

/* ===== 阅读器 ===== */
.reader-head {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}
.reader-title {
  font-size: 16px; font-weight: 600; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-layout {
  display: grid; grid-template-columns: 1fr 380px; gap: 16px;
  align-items: start;
}
.pdf-pane {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 74px;
}
.pdf-controls {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--border-light); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pdf-pageinfo {
  display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-sub);
}
.pdf-pageinfo input {
  width: 48px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px;
  text-align: center; font-size: 13px;
}
.v-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.pdf-scroll {
  height: calc(100vh - 200px); overflow: auto; position: relative;
  background: #f1f5f9; display: flex; justify-content: center; padding: 20px;
}
#pdf-canvas {
  box-shadow: var(--shadow-lg); border-radius: 2px; background: #fff;
  max-width: 100%;
}
.pdf-msg {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(255,255,255,.95); padding: 30px; text-align: center;
  color: var(--text-sub); font-size: 14px; line-height: 1.7;
}

/* ===== 侧面板 ===== */
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-tabs {
  display: flex; border-bottom: 1px solid var(--border); background: var(--border-light);
}
.ptab {
  flex: 1; padding: 12px 8px; font-size: 13px; font-weight: 500;
  color: var(--text-sub); transition: var(--transition); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ptab:hover { color: var(--text); background: rgba(0,0,0,.02); }
.ptab.active {
  color: var(--primary-dark); background: var(--card);
  border-bottom-color: var(--primary); font-weight: 600;
}
.ptab-body { padding: 18px; max-height: calc(100vh - 200px); overflow-y: auto; }
.ptab-body[hidden] { display: none; }

/* ===== 筛选 ===== */
.hint { font-size: 12.5px; color: var(--text-sub); line-height: 1.6; margin-bottom: 14px; }
.screen-reason {
  background: var(--accent-light); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: #92400e; margin-bottom: 16px; line-height: 1.6;
}
.screen-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.screen-item span:first-child { font-size: 13.5px; flex: 1; line-height: 1.5; }
.screen-opts { display: flex; gap: 6px; flex-shrink: 0; }
.opt-btn {
  padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); background: var(--card); color: var(--text-sub);
  transition: var(--transition);
}
.opt-btn.yes.on { background: var(--success); color: #fff; border-color: var(--success); }
.opt-btn.no.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.screen-score {
  margin-top: 16px; padding: 12px 16px; background: var(--primary-bg);
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  color: var(--primary-dark); text-align: center;
}
.decision { display: flex; gap: 10px; margin-top: 14px; }
.decision .btn { flex: 1; }

/* ===== 笔记 ===== */
.notes-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.notes-head .hint { margin-bottom: 0; }
.field { margin-bottom: 14px; }
.field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.field-label .sec { color: var(--accent); margin-right: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition); font-size: 13.5px; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.08);
}
.mini-btn {
  padding: 3px 10px; font-size: 11.5px; background: var(--primary-bg);
  color: var(--primary-dark); border-radius: 4px; font-weight: 500;
}
.mini-btn:hover { background: var(--primary-light); }
.divider { border: none; border-top: 2px solid var(--border-light); margin: 18px 0; }

/* ===== AI 助手 ===== */
.ai-settings { margin-bottom: 14px; }
.ai-settings summary {
  cursor: pointer; font-size: 13px; color: var(--text-sub); padding: 8px 0;
  font-weight: 500;
}
.ai-settings .hint { margin-top: 8px; font-size: 12px; }
.ai-connection-status {
  margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; background: var(--border-light); color: var(--text-sub);
}
.ai-connection-status.ready { background: #d1fae5; color: #065f46; }
.ai-connection-status.warn { background: var(--accent-light); color: #92400e; }
.ai-chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.ai-chip {
  background: var(--primary-bg); color: var(--primary-dark); border: 1px solid #99f6e4;
  font-size: 12.5px; padding: 7px 12px; border-radius: var(--radius-sm);
  transition: var(--transition); font-weight: 500;
}
.ai-chip:hover { background: var(--primary-light); border-color: var(--primary); }
.ai-chat {
  max-height: 280px; overflow-y: auto; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px; padding: 4px;
}
.ai-empty {
  text-align: center; padding: 30px 16px; color: var(--text-faint); font-size: 13px; line-height: 1.7;
}
.ai-msg { display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 88%; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.65; word-break: break-word;
}
.ai-msg.user .ai-bubble {
  background: var(--primary); color: #fff; border-bottom-right-radius: 4px;
}
.ai-msg.assistant .ai-bubble {
  background: var(--border-light); color: var(--text); border-bottom-left-radius: 4px;
}
.ai-actions { display: flex; gap: 6px; margin-top: 6px; }
.ai-actions .btn { font-size: 11.5px; padding: 4px 10px; }
.ai-record-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 12.5px; color: var(--text-sub);
}
.ai-record-row .select { flex: 1; padding: 6px 10px; font-size: 12.5px; }
.ai-context-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  flex-wrap: wrap;
}
.ai-context-mode {
  display: flex; gap: 4px; background: var(--border-light); padding: 3px;
  border-radius: var(--radius-sm);
}
.ai-context-mode label {
  display: flex; align-items: center; gap: 5px; padding: 5px 12px;
  border-radius: 5px; font-size: 12.5px; cursor: pointer; color: var(--text-sub);
  transition: var(--transition); font-weight: 500;
}
.ai-context-mode label:hover { color: var(--text); }
.ai-context-mode input[type="radio"] { accent-color: var(--primary); margin: 0; }
.ai-context-mode label:has(input:checked) {
  background: var(--card); color: var(--primary-dark);
  box-shadow: var(--shadow); font-weight: 600;
}
.ai-context-info {
  font-size: 11.5px; color: var(--primary-dark); background: var(--primary-bg);
  padding: 3px 10px; border-radius: 999px; font-weight: 500;
}
#ai-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; resize: vertical; font-size: 13.5px; margin-bottom: 10px;
  transition: var(--transition); min-height: 60px;
}
#ai-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.08); }

/* ===== 问题库 ===== */
.q-add {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.q-add h3 { font-size: 16px; margin-bottom: 8px; }
.q-add textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; resize: vertical; margin-bottom: 12px; font-size: 14px;
}
.q-add textarea:focus { border-color: var(--primary); }
.q-add-row { display: flex; gap: 10px; }
.q-add-row .select { flex: 1; }
#question-list { display: flex; flex-direction: column; gap: 10px; }
.q-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow); transition: var(--transition);
}
.q-item:hover { box-shadow: var(--shadow-md); border-color: #99f6e4; }
.q-item.done { opacity: .6; }
.q-item.done .q-body { text-decoration: line-through; }
.q-check { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.q-body { flex: 1; }
.q-src { font-size: 12px; color: var(--primary-dark); margin-top: 6px; }
.q-src .link-like { cursor: pointer; text-decoration: underline; }
.q-date { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.q-del { flex-shrink: 0; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  animation: fadeIn .15s;
}
.modal-mask[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 16px; width: 90%; max-width: 520px;
  max-height: 85vh; overflow: hidden; box-shadow: var(--shadow-lg);
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-light);
}
.modal-head h3 { font-size: 16px; }
#modal-body { padding: 20px 22px; max-height: 55vh; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--border-light); background: var(--border-light);
}
.modal-foot .spacer { flex: 1; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 300;
  animation: toastIn .2s;
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .reader-layout { grid-template-columns: 1fr; }
  .pdf-pane { position: static; }
  .pdf-scroll { height: 60vh; }
  .ptab-body { max-height: none; }
  .main { padding: 16px; }
  .topbar { padding: 0 16px; gap: 14px; }
  .topbar-stats { display: none; }
}

/* ===== 危险按钮 ===== */
.btn-danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626; box-shadow: 0 2px 8px rgba(239,68,68,.3);
}

/* ===== 自定义确认对话框 ===== */
.confirm-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  opacity: 0; transition: opacity .15s;
}
.confirm-mask.show { opacity: 1; }
.confirm-box {
  background: var(--card); border-radius: 16px; width: 90%; max-width: 380px;
  padding: 28px 24px 20px; box-shadow: var(--shadow-lg); text-align: center;
  transform: scale(.95); transition: transform .15s;
}
.confirm-mask.show .confirm-box { transform: scale(1); }
.confirm-icon { font-size: 36px; margin-bottom: 12px; }
.confirm-msg {
  font-size: 14.5px; line-height: 1.6; color: var(--text); margin-bottom: 20px;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 10px 16px; font-size: 14px; }

/* ===== 顶栏右侧布局 ===== */
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== 语言切换按钮 ===== */
.lang-switch {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
  letter-spacing: .5px;
}
.lang-switch:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.5);
  transform: translateY(-1px);
}
.lang-switch:active { transform: translateY(0); }

/* ===== 主页面 AI 悬浮按钮 ===== */
.ai-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.ai-float-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
}
.ai-float-btn:active { transform: scale(1.05); }

/* ===== 主页面 AI 面板 ===== */
.main-ai-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 140px);
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.18);
  z-index: 998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}
.main-ai-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.main-ai-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.main-ai-title { display: flex; align-items: center; gap: 8px; }
.main-ai-header-actions { display: flex; gap: 4px; }
.main-ai-header-actions .icon-btn {
  color: rgba(255,255,255,0.8);
  padding: 4px 8px;
  font-size: 16px;
}
.main-ai-header-actions .icon-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* 消息区 */
.main-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}
.main-ai-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
  font-size: 13.5px;
  line-height: 1.7;
}
.main-ai-msg {
  display: flex;
  max-width: 100%;
}
.main-ai-msg-user { justify-content: flex-end; }
.main-ai-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}
.main-ai-msg-user .main-ai-bubble {
  background: linear-gradient(135deg, #10b981, #0d9488);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.main-ai-msg-bot .main-ai-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.main-ai-loading .main-ai-bubble { opacity: .6; font-style: italic; }

/* 输入区 */
.main-ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.main-ai-input-area textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  resize: none;
  font-size: 13.5px;
  font-family: inherit;
  max-height: 80px;
  outline: none;
  transition: border-color .2s;
  line-height: 1.5;
}
.main-ai-input-area textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.08);
}
.main-ai-input-area .btn {
  padding: 8px 18px;
  font-size: 13.5px;
  white-space: nowrap;
  height: fit-content;
}

/* ===== 响应式：主AI面板 ===== */
@media (max-width: 500px) {
  .main-ai-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
    height: 70vh;
  }
  .ai-float-btn {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}

/* ============================================================
 * v2 · 主页 Hero + 学科分类 + 筛选栏 + API 设置面板
 * ============================================================ */

/* ===== Hero 区 ===== */
.hero-section {
  text-align: center;
  padding: 44px 16px 34px;
  background:
    radial-gradient(ellipse 70% 90% at 50% -20%, rgba(13, 148, 136, .10), transparent),
    linear-gradient(180deg, var(--primary-bg), var(--bg));
  border: 1px solid var(--border-light);
  border-radius: 20px;
  margin-bottom: 34px;
}
.hero-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .3px;
  background: linear-gradient(120deg, #0f766e, #0d9488 55%, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  margin-top: 8px;
  color: var(--text-sub);
  font-size: 14.5px;
}
.hero-input-box {
  position: relative;
  max-width: 680px;
  margin: 26px auto 0;
}
#heroAIInput {
  width: 100%;
  min-height: 96px;
  resize: none;
  padding: 16px 60px 16px 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  outline: none;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}
#heroAIInput:focus {
  border-color: var(--primary);
  box-shadow: 0 6px 24px rgba(13, 148, 136, .16);
}
.hero-input-box.drag { border-radius: 16px; }
.hero-input-box.drag #heroAIInput {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.hero-send-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 3px 12px rgba(13, 148, 136, .35);
  transition: var(--transition);
}
.hero-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 16px rgba(13, 148, 136, .45);
}
.hero-send-btn:active { transform: scale(.96); }

/* 快捷指令卡片 */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.quick-btn:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ===== 分类浏览 ===== */
.categories-section { margin-top: 6px; }
.section-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 16px;
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.category-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  padding: 22px 18px 18px;
  border-radius: 16px;
  color: #fff;
  background: var(--card-gradient, var(--primary));
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.category-card::after {
  content: '';
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  transition: transform .3s;
}
.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .18);
}
.category-card:hover::after { transform: scale(1.35); }
.category-icon { font-size: 30px; line-height: 1; }
.category-name {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px;
}
.category-count {
  margin-top: 4px;
  font-size: 12.5px;
  opacity: .85;
}

/* ===== 分类页头部 ===== */
.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.category-title { font-size: 20px; font-weight: 700; }
.count-badge {
  padding: 2px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 999px;
}
.back-btn {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.back-btn:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: var(--primary-bg);
}

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-input,
.filter-select {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}
.filter-input:focus,
.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .1);
}
.filter-input.small { width: 86px; }
.filter-input.grow { flex: 1; min-width: 180px; }
.filter-select { cursor: pointer; }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.filter-check input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ===== API 设置面板（BYOK） ===== */
.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  animation: fadeIn .15s;
}
.settings-panel[hidden] { display: none; }
.settings-content {
  width: 92%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s cubic-bezier(.4, 0, .2, 1);
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.settings-header h3 { font-size: 16px; }
.close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 14px;
  transition: var(--transition);
}
.close-btn:hover { background: var(--border-light); color: var(--text); }
.settings-body { padding: 18px 20px 20px; }
.form-group { margin-bottom: 14px; }
.form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .1);
}
.form-input.small { width: 110px; }
.form-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
}
a.form-hint:hover { color: var(--primary-dark); text-decoration: underline; }
.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.settings-actions .btn { flex: 1; }
#settingsStatus { margin-top: 10px; font-size: 12.5px; }
#settingsStatus.ready { color: var(--success); }
#settingsStatus.fail { color: var(--danger); }

/* ===== 响应式：主页 ===== */
@media (max-width: 640px) {
  .hero-title { font-size: 23px; }
  .hero-section { padding: 30px 12px 26px; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .category-card { padding: 16px 14px 14px; }
  .category-icon { font-size: 24px; }
  .filter-input.small { width: 72px; }
}

/* ============================================================
 * v3 · 视觉整容 + 可用性改进（覆盖段，不改变既有布局与逻辑）
 * 1) 统一品牌渐变与设计令牌
 * 2) 统一线条图标(.ic) + 可访问性/焦点态
 * 3) 按钮禁用/加载态、空态、微交互
 * 4) 响应式与阅读器布局加固
 * ============================================================ */
:root {
  --brand-teal: #0d9488;      /* 主品牌主色 */
  --brand-deep: #0f766e;      /* 主品牌深色 */
  --brand-bright: #2dd4bf;    /* 品牌亮青 */
  --focus-ring: rgba(13, 148, 136, .42);
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  --grad-brand: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  --grad-brand-soft: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #10b981);
}

/* ---- 统一线条图标基础 ---- */
.ic {
  display: inline-block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -1px;
}
button .ic, a .ic { pointer-events: none; }
.btn .ic { margin-right: 2px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
}

/* ---- 统一主 AI 浮层/面板/气泡到品牌青（消除双绿色割裂） ---- */
.ai-float-btn { background: var(--grad-brand); box-shadow: 0 4px 20px rgba(13,148,136,.4); }
.ai-float-btn:hover { box-shadow: 0 6px 28px rgba(13,148,136,.5); }
.main-ai-header { background: var(--grad-brand); }
.main-ai-msg-user .main-ai-bubble { background: var(--grad-brand); }
.ai-msg.user .ai-bubble { background: var(--grad-brand); }
.hero-send-btn { background: var(--grad-brand); }
.ai-connection-status.ready { color: #065f46; }

/* ---- 顶栏精细与激活态 ---- */
.topbar { background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%); }
.tab-btn.active { box-shadow: inset 0 -2px 0 rgba(255,255,255,.9); background: rgba(255,255,255,.16); }
.topbar .icon-btn { color: rgba(255,255,255,.85); }
.topbar .icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ---- 通用 :focus-visible 焦点环（仅键盘触发，美观） ---- */
:is(a, button, input, select, textarea, [tabindex], .category-card):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}
body:not(:focus-within) #pdf-canvas:focus { outline: none; }

/* ---- 按钮禁用态 ---- */
.btn:disabled, button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---- 危险操作在文本按钮上更有存在感（modal 删除/确认） ---- */
.btn-danger-ghost { font-weight: 600; }
.confirm-icon { color: var(--danger); }
.confirm-icon svg { display: block; margin: 0 auto; }

/* ---- 空态：统一的柔和浅色容器（图标 + 文案） ---- */
.empty-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 420px;
  margin: 24px auto;
  padding: 40px 28px;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1.8;
}
.empty-tip .ic-empty {
  width: 56px; height: 56px;
  color: #cbd5e1;
  stroke-width: 1.4;
}
.empty-tip b { color: var(--text-sub); }
.empty-tip[hidden] { display: none !important; }

/* ---- Toast 可用性 ---- */
.toast { max-width: 90vw; text-align: center; }

/* ---- 阅读器/侧栏滚动区高度自适应 ---- */
.ptab-body {
  max-height: calc(100vh - 200px);
  overscroll-behavior: contain;
}

/* ---- 卡片微整容：统一悬停、焦点可达、标题层级 ---- */
.category-card { cursor: pointer; }
.category-name { margin-top: 8px; }
.pc-title { line-height: 1.5; }
.pc-meta { min-height: 0; }

/* ---- 筛选栏在窄于容器时对齐更清爽 ---- */
.filter-bar { align-items: center; }

/* ============================================================
 * v3 · 深色模式（尊重系统偏好，未提供页面内切换）
 * ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --border-light: #283548;
    --text: #e2e8f0;
    --text-sub: #94a3b8;
    --text-faint: #64748b;
    --primary-bg: #134e4a;
    --primary-light: #115e59;
    --danger-light: #3f1d1d;
    --accent-light: #4b3410;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
    color-scheme: dark;
  }
  body { background: var(--bg); color: var(--text); }
  .dropzone {
    background: linear-gradient(180deg, #134e4a, #0f2a28);
    border-color: #0d9488;
  }
  .pdf-scroll { background: #0b1220; }
  #pdf-canvas { background: #fff; } /* 保持论文页白底可读 */
  .ai-chat .ai-bubble, .main-ai-messages { background: transparent; }
  .main-ai-msg-bot .main-ai-bubble { background: #1e293b; }
  .badge.st-待读   { background: #1e3a5f; color: #93c5fd; }
  .badge.st-精读中 { background: #115e59; color: #5eead4; }
  .badge.st-已读完 { background: #14532d; color: #6ee7b7; }
  .badge.st-已放弃 { background: #334155; color: #94a3b8; }
  .badge.st-待筛选 { background: #4b3410; color: #fcd34d; }
  .category-card:hover { box-shadow: 0 10px 26px rgba(0,0,0,.4); }
}

/* ============================================================
 * v3 · 响应式加固（平板与更窄）
 * ============================================================ */
@media (max-width: 1180px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1024px) {
  .paper-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 900px) {
  .reader-layout { grid-template-columns: 1fr; }
  .pdf-scroll { height: 62vh; }
}
@media (max-width: 720px) {
  .filter-bar { align-items: stretch; }
  .filter-input.grow { min-width: 100%; }
  .filter-select { flex: 1 1 auto; }
}
@media (max-width: 640px) {
  .main { padding: 14px; }
  .paper-grid { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .reader-head { flex-wrap: wrap; row-gap: 8px; }
  .pc-actions { flex-wrap: wrap; }
}
@media (max-width: 500px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .tab-btn { padding: 8px 10px; }
  .topbar-right { gap: 6px; }
  .hero-input-box { padding: 0 4px; }
  .decision, .q-add-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
 * v4 · Editorial Research Workspace
 * 克制的学术工作台：纸张色、低饱和品牌色、少阴影、无装饰渐变
 * ============================================================ */
:root {
  --primary: #315f52;
  --primary-dark: #24493f;
  --primary-light: #e4ece7;
  --primary-bg: #f1f5f2;
  --accent: #9a7040;
  --accent-dark: #76532c;
  --accent-light: #f3eadf;
  --bg: #f4f3ef;
  --card: #fffefa;
  --border: #d9ddd7;
  --border-light: #e9ebe7;
  --text: #242722;
  --text-sub: #566057;
  --text-faint: #667067;
  --danger: #a8443f;
  --danger-light: #f6e9e7;
  --success: #386b55;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: none;
  --shadow-md: 0 8px 24px rgba(36, 39, 34, .08);
  --shadow-lg: 0 18px 48px rgba(36, 39, 34, .14);
  --focus-ring: rgba(49, 95, 82, .28);
  --transition: color .14s ease, background-color .14s ease, border-color .14s ease, box-shadow .14s ease;
  color-scheme: light;
}

body {
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

a { color: var(--primary-dark); }

/* ---- 顶部导航：像工具栏，而不是营销页横幅 ---- */
.topbar {
  height: 62px;
  padding: 0 32px;
  gap: 34px;
  background: rgba(255, 254, 250, .96);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(10px);
}
.logo {
  color: var(--primary-dark);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.1px;
}
.logo svg { color: var(--primary); }
.nav-tabs { align-self: stretch; gap: 26px; }
.tab-btn {
  position: relative;
  padding: 0 1px;
  border-radius: 0;
  color: var(--text-sub);
  font-weight: 500;
}
.tab-btn::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform .14s ease;
}
.tab-btn:hover { background: transparent; color: var(--text); }
.tab-btn.active {
  background: transparent;
  color: var(--primary-dark);
  font-weight: 650;
  box-shadow: none;
}
.tab-btn.active::after { transform: scaleX(1); }
.topbar-right { gap: 8px; }
.topbar .icon-btn {
  color: var(--text-sub);
  border: 1px solid transparent;
}
.topbar .icon-btn:hover {
  color: var(--primary-dark);
  background: var(--primary-bg);
  border-color: var(--border);
}
.lang-switch {
  min-width: 42px;
  padding: 5px 9px;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: 600;
}
.lang-switch:hover {
  color: var(--primary-dark);
  background: var(--primary-bg);
  border-color: #aebbb3;
  transform: none;
}
.topbar-stats {
  margin-left: 10px;
  padding: 0;
  color: var(--text-faint);
  background: transparent;
  border-radius: 0;
  font-size: 12px;
}
.topbar-stats b { color: var(--text-sub); }

/* ---- 页面与主页：编辑部式留白和信息层级 ---- */
.main { max-width: 1280px; padding: 34px 32px 88px; }
.hero-section {
  position: relative;
  margin-bottom: 38px;
  padding: 52px 54px 46px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hero-section::before {
  content: '';
  position: absolute;
  top: 46px;
  bottom: 46px;
  left: 0;
  width: 3px;
  background: var(--primary);
}
.hero-eyebrow {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
}
.hero-title {
  color: var(--text);
  background: none;
  -webkit-text-fill-color: currentColor;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.25;
}
.hero-subtitle {
  max-width: 560px;
  margin-top: 10px;
  color: var(--text-sub);
  font-size: 15px;
}
.hero-input-box {
  max-width: 760px;
  margin: 28px 0 0;
}
#heroAIInput {
  min-height: 90px;
  padding: 17px 62px 17px 18px;
  border: 1px solid #c9cec7;
  border-radius: 8px;
  box-shadow: none;
  background: #fff;
}
#heroAIInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.hero-input-box.drag,
.hero-input-box.drag #heroAIInput { border-radius: 8px; }
.hero-send-btn {
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
  box-shadow: none;
}
.hero-send-btn:hover {
  background: var(--primary-dark);
  transform: none;
  box-shadow: none;
}
.quick-actions {
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
}
.quick-btn {
  gap: 8px;
  padding: 7px 11px;
  color: var(--text-sub);
  background: transparent;
  border-color: var(--border);
  border-radius: 6px;
  box-shadow: none;
  font-size: 12.5px;
}
.quick-btn:hover {
  color: var(--primary-dark);
  background: var(--primary-bg);
  border-color: #aebbb3;
  box-shadow: none;
  transform: none;
}
.quick-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-family: Georgia, serif;
}
.categories-section { margin-top: 0; }
.section-title {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.015em;
}
.categories-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.category-card {
  min-height: 126px;
  padding: 20px 18px 17px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--subject-color, var(--primary));
  border-radius: 8px;
  box-shadow: none;
}
.category-card::after { display: none; }
.category-card:hover {
  background: #fafbf8;
  border-color: #b9c0b9;
  border-left-color: var(--subject-color, var(--primary));
  box-shadow: none;
  transform: none;
}
.category-icon {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 7px;
  color: var(--subject-color, var(--primary));
  background: var(--primary-bg);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: Consolas, ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}
.category-name {
  margin-top: 18px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
}
.category-count {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 12px;
  opacity: 1;
}

/* ---- 通用控件与文献库 ---- */
.btn {
  border-radius: 6px;
  font-weight: 550;
  box-shadow: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover {
  color: #fff;
  background: var(--primary-dark);
  box-shadow: none;
}
.btn-primary:active { transform: none; }
.btn-ghost { background: transparent; color: var(--text-sub); border-color: var(--border); }
.btn-ghost:hover { color: var(--primary-dark); background: var(--primary-bg); border-color: #aebbb3; }
.icon-btn, .close-btn { border-radius: 5px; }
.chip, .badge, .count-badge { border-radius: 4px; box-shadow: none; }
.chip { padding: 6px 11px; }
.chip.active { background: var(--primary-light); color: var(--primary-dark); border-color: #b9c8bf; }
.category-header { margin-bottom: 20px; }
.category-title { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.count-badge { padding: 2px 8px; color: var(--primary-dark); background: var(--primary-light); }
.back-btn { padding: 6px 10px; background: transparent; border-radius: 5px; }
.filter-bar {
  gap: 8px;
  padding: 10px;
  background: var(--card);
  border-radius: 8px;
  box-shadow: none;
}
.filter-input,
.filter-select,
.search-input,
.select,
.form-input {
  background: #fff;
  border-color: #cfd4ce;
  border-radius: 6px;
}
.filter-input:focus,
.filter-select:focus,
.search-input:focus,
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.toolbar { margin-bottom: 14px; }
.dropzone {
  padding: 32px 24px;
  color: var(--primary-dark);
  background: var(--card);
  border: 1px dashed #aebbb3;
  border-radius: 8px;
}
.dropzone::before { display: none; }
.dropzone.drag {
  background: var(--primary-bg);
  border-color: var(--primary);
  box-shadow: none;
  transform: none;
}
.paper-card,
.card,
.q-item,
.pdf-pane,
.panel {
  background: var(--card);
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: none;
}
.paper-card { padding: 18px; }
.paper-card::before { display: none; }
.paper-card:hover,
.q-item:hover {
  background: #fafbf8;
  border-color: #b9c0b9;
  box-shadow: none;
  transform: none;
}
.pc-progress .bar { border-radius: 2px; }
.pc-progress .bar i { background: var(--primary); border-radius: 2px; }
.badge-s { color: var(--accent-dark); background: var(--accent-light); box-shadow: none; }
.badge-a { color: #57566a; background: #ecebf0; }
.badge.st-待筛选 { color: #76532c; background: #f3eadf; }
.badge.st-待读 { color: #465f73; background: #e6edf2; }
.badge.st-精读中 { color: #315f52; background: #e4ece7; }
.badge.st-已读完 { color: #386b55; background: #e5eee8; }
.badge.st-已放弃 { color: #626862; background: #eceeea; }
.empty-tip { color: var(--text-faint); }
.empty-tip .ic-empty {
  color: #8a938b;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- 阅读区：减少装饰，让论文和笔记成为主体 ---- */
.pdf-pane { position: sticky; top: 82px; }
.pdf-controls,
.panel-tabs { background: #f7f7f3; }
.pdf-scroll { background: #e7e8e4; }
.ptab { color: var(--text-sub); }
.ptab:hover { color: var(--text); background: transparent; }
.ptab.active {
  color: var(--primary-dark);
  background: var(--card);
  border-bottom-color: var(--primary);
}
.screen-reason {
  color: #634923;
  background: var(--accent-light);
  border-left-color: var(--accent);
}
.screen-score { background: var(--primary-bg); border-radius: 6px; }
.opt-btn { border-radius: 5px; }
.opt-btn.yes.on { background: var(--success); }

/* ---- 研究助理：从“客服悬浮球”改成工作台工具 ---- */
.ai-float-btn {
  right: 28px;
  bottom: 24px;
  width: auto;
  height: 42px;
  padding: 0 14px;
  gap: 8px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary-dark);
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(36, 73, 63, .18);
}
.ai-float-btn svg { width: 18px; height: 18px; }
.ai-float-label { font-size: 12.5px; font-weight: 600; }
.ai-float-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 26px rgba(36, 73, 63, .22);
  transform: none;
}
.main-ai-panel {
  bottom: 78px;
  width: 410px;
  height: 590px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
}
.main-ai-panel.open { transform: translateY(0); }
.main-ai-header {
  padding: 14px 16px;
  color: var(--text);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.main-ai-title {
  color: var(--primary-dark);
  font-weight: 650;
}
.main-ai-header-actions .icon-btn { color: var(--text-sub); }
.main-ai-header-actions .icon-btn:hover { color: var(--text); background: var(--primary-bg); }
.main-ai-messages { background: #f7f7f3; }
.main-ai-empty { color: var(--text-faint); }
.main-ai-bubble { border-radius: 8px; }
.main-ai-msg-user .main-ai-bubble {
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #c8d5cd;
  border-bottom-right-radius: 3px;
}
.main-ai-msg-bot .main-ai-bubble {
  background: var(--card);
  border-color: var(--border);
  border-bottom-left-radius: 3px;
  box-shadow: none;
}
.main-ai-input-area { background: var(--card); }
.main-ai-input-area textarea { border-radius: 6px; }
.ai-chat { background: #f7f7f3; }
.ai-chip { color: var(--primary-dark); background: var(--primary-bg); border-color: #c8d5cd; border-radius: 5px; }
.ai-chip:hover { background: var(--primary-light); }
.ai-msg.user .ai-bubble {
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #c8d5cd;
}

/* ---- 弹窗：仅浮层保留明确层级 ---- */
.modal-mask,
.settings-panel,
.confirm-mask {
  background: rgba(36, 39, 34, .42);
  backdrop-filter: blur(2px);
}
.modal,
.settings-content,
.confirm-box {
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.modal-foot { background: #f7f7f3; }
.toast { border-radius: 6px; }

/* ---- 响应式：保持信息结构，不把工具栏挤成彩色按钮墙 ---- */
@media (max-width: 1024px) {
  .categories-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 58px; padding: 0 16px; gap: 16px; flex-wrap: wrap; }
  .logo { height: 58px; }
  .nav-tabs { order: 3; width: 100%; height: 40px; }
  .tab-btn { flex: 1; }
  .topbar-right { margin-left: auto; }
  .main { padding: 22px 16px 76px; }
  .hero-section { padding: 34px 26px 30px; }
  .hero-section::before { top: 32px; bottom: 32px; }
  .hero-input-box { margin-top: 22px; }
  .filter-bar { align-items: stretch; }
}
@media (max-width: 520px) {
  .hero-section { padding: 30px 20px 26px; }
  .hero-title { font-size: 28px; }
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-btn { justify-content: flex-start; }
  .categories-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 108px; }
  .ai-float-label { display: none; }
  .ai-float-btn { right: 16px; bottom: 16px; width: 42px; padding: 0; border-radius: 7px; }
  .main-ai-panel { right: 10px; left: 10px; bottom: 68px; width: auto; }
}

/* ---- 显式深色主题：不再随系统突然切换，用户可在顶栏控制 ---- */
html[data-theme="dark"] {
  --primary: #5f8f7b;
  --primary-dark: #b8d2c6;
  --primary-light: #33483e;
  --primary-bg: #293730;
  --accent: #b68a55;
  --accent-dark: #e2c59f;
  --accent-light: #463a2c;
  --bg: #1c201d;
  --card: #252a26;
  --border: #3d453f;
  --border-light: #313832;
  --text: #edf0eb;
  --text-sub: #bdc5bd;
  --text-faint: #9da69e;
  --danger: #d47b74;
  --danger-light: #482d2b;
  --success: #7fb19a;
  --focus-ring: rgba(143, 183, 165, .28);
  color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .topbar {
  background: rgba(37, 42, 38, .96);
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .hero-section,
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .paper-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .q-item,
html[data-theme="dark"] .dropzone,
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .pdf-pane,
html[data-theme="dark"] .settings-content,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .main-ai-panel { background: var(--card); }
html[data-theme="dark"] #heroAIInput,
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .main-ai-input-area textarea { background: #202521; }
html[data-theme="dark"] .category-card:hover,
html[data-theme="dark"] .paper-card:hover,
html[data-theme="dark"] .q-item:hover { background: #29302a; }
html[data-theme="dark"] .pdf-controls,
html[data-theme="dark"] .panel-tabs,
html[data-theme="dark"] .main-ai-messages,
html[data-theme="dark"] .ai-chat,
html[data-theme="dark"] .modal-foot { background: #202521; }
html[data-theme="dark"] .pdf-scroll { background: #111512; }
html[data-theme="dark"] #pdf-canvas { background: #fff; }

/* 公网 BYOK 设置提示 */
.api-privacy-note {
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  line-height: 1.55;
}
.remember-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -2px;
  font-size: 13px;
}
.remember-key-row input { accent-color: var(--primary); }
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .hero-send-btn,
html[data-theme="dark"] .ai-float-btn { background: #4f7b68; color: #fff; }
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .hero-send-btn:hover,
html[data-theme="dark"] .ai-float-btn:hover { background: #426958; }
