/* 主题：默认浅色（白色）；黑色与「随系统」由 data-theme 与媒体查询控制 */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #eef0f3;
  --line: #e3e6eb;
  --text: #1a1d24;
  --muted: #6b7280;
  --brand: #2f6bff;
  --ok: #14a06b;
  --warn: #d98300;
  --err: #e23b3b;
  --wait: #9aa1ad;
  --radius: 12px;
  /* 论文工作台（默认浅色，与全局主题一致） */
  --pw-bg: #f4f5f7;
  --pw-panel: #ffffff;
  --pw-panel2: #eef0f3;
  --pw-line: #e3e6eb;
  --pw-text: #1a1d24;
  --pw-muted: #6b7280;
  --pw-brand: #2f6bff;
  --pw-ok: #14a06b;
  --pw-warn: #d98300;
  --pw-err: #e23b3b;
}
/* 黑色主题 */
[data-theme="dark"] {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b93a1;
  --brand: #4f8cff;
  --ok: #3ecf8e;
  --warn: #f5a623;
  --err: #ff5c5c;
  --wait: #8b93a1;
  /* 论文工作台深色 */
  --pw-bg: #0f1115;
  --pw-panel: #171a21;
  --pw-panel2: #1f232c;
  --pw-line: #2a2f3a;
  --pw-text: #e6e8ec;
  --pw-muted: #8b93a1;
  --pw-brand: #4f8cff;
  --pw-ok: #3ecf8e;
  --pw-warn: #f5a623;
  --pw-err: #ff5c5c;
}
/* 随系统：系统为深色时跟随（未强制指定白色/黑色时生效） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1f232c;
    --line: #2a2f3a;
    --text: #e6e8ec;
    --muted: #8b93a1;
    --brand: #4f8cff;
    --ok: #3ecf8e;
    --warn: #f5a623;
    --err: #ff5c5c;
    --wait: #8b93a1;
    /* 论文工作台深色 */
    --pw-bg: #0f1115;
    --pw-panel: #171a21;
    --pw-panel2: #1f232c;
    --pw-line: #2a2f3a;
    --pw-text: #e6e8ec;
    --pw-muted: #8b93a1;
    --pw-brand: #4f8cff;
    --pw-ok: #3ecf8e;
    --pw-warn: #f5a623;
    --pw-err: #ff5c5c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--err); font-size: 12px; min-height: 16px; }

/* 登录 */
.login-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 50; }
.login-card { background: var(--panel); padding: 32px; border-radius: 16px; width: 320px; border: 1px solid var(--line); }
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-card input { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px; border-radius: 8px; }
.login-card button { background: var(--brand); color: #fff; border: 0; padding: 10px; border-radius: 8px; cursor: pointer; }

/* 布局 */
.app { height: 100vh; position: relative; overflow: hidden; }
.main { height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 18px 18px 88px; }
/* 顶部栏：一键刷新本页（左）→ 设置 → 全局搜索（右） */
.topbar-search { margin-left: auto; display: flex; align-items: center; }
.topbar-search input {
  width: 220px; max-width: 46vw; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); padding: 8px 14px; border-radius: 999px; outline: none;
}
.topbar-search input:focus { border-color: var(--brand); }
/* 底部导航栏 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: 60px; z-index: 30;
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex; align-items: stretch; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); cursor: pointer; font-size: 11px; text-decoration: none;
  background: transparent; border: 0; user-select: none; padding: 0;
}
.nav-item .nav-ico { font-size: 20px; line-height: 1; }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--brand); }
.nav-item.active .nav-ico { transform: translateY(-1px); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 12px; padding: 0 16px; background: var(--panel);
}
.topbar-title { font-weight: 700; font-size: 15px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { background: transparent; border: 0; color: var(--text); font-size: 20px; cursor: pointer; }
.content { flex: 1; min-height: 0; overflow: auto; }

.btn { background: var(--brand); color: #fff; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 7px; border-radius: 8px; }
.theme-sel { display: inline-block; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; position: relative; cursor: pointer; transition: border-color .15s;
}
.card:hover { border-color: var(--brand); }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 22px; font-weight: 700; margin-top: 6px; word-break: break-all; }
.card .value.empty { font-size: 13px; color: var(--muted); font-weight: 400; }
.card .card-refresh { position: absolute; top: 10px; right: 10px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); }
.dot-err { background: var(--err); } .dot-wait { background: var(--wait); } .dot-empty { background: var(--wait); }


/* 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.section-title { font-size: 16px; font-weight: 700; margin: 18px 0 10px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }

/* 进度条 */
.progress { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .3s; }
.op-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }

/* 弹窗 / 抽屉 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(880px, 92vw); max-height: 86vh; display: flex; flex-direction: column; }
.modal-head, .drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-body { padding: 16px; overflow: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(460px, 92vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 45; display: flex; flex-direction: column; }
.drawer-body { padding: 16px; overflow: auto; }
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 9px; border-radius: 8px; }
.list-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.list-item .t { font-weight: 600; }
.list-item .d { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: pre-wrap; word-break: break-all; }

/* Toast */
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 60; }

/* 健康聊天框 */
.chat-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 320px; overflow: auto; margin-bottom: 4px; }
.msg { padding: 6px 8px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.msg.user { background: rgba(79,140,255,.16); }
.msg.assistant { background: var(--panel); }

/* 睡眠时间面板 */
.sleep-panel { display: flex; flex-direction: column; gap: 10px; }
.sleep-row { display: flex; align-items: baseline; justify-content: space-between; }
.sleep-row .label { font-size: 13px; color: var(--muted); }
.sleep-row .value { font-size: 20px; font-weight: 700; }
.sleep-row .value.empty { font-size: 14px; color: var(--muted); font-weight: 400; }

/* AI 健康建议面板 */
.advice-panel { display: flex; flex-direction: column; gap: 10px; }
.advice-text { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.advice-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 北京时间时钟框（总览页） */
.clock-wrap { display: flex; justify-content: center; margin: 4px 0 18px; }
.clock-box { text-align: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 30px; background: var(--panel); min-width: 220px; }
.clock-label { font-size: 12px; color: var(--muted); letter-spacing: 3px; }
.clock { font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, "Courier New", monospace; font-size: 42px; font-weight: 700; letter-spacing: 4px; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* AI 新闻带图卡片 */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.news-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.news-img { width: 100%; height: 150px; object-fit: cover; background: var(--panel-2); display: block; }
.news-img-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.news-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.news-title { font-weight: 700; font-size: 14px; line-height: 1.4; }
.news-summary { font-size: 12px; color: var(--muted); line-height: 1.6; }
.news-foot { display: flex; gap: 10px; align-items: center; font-size: 12px; margin-top: 2px; }
.news-link { color: var(--brand); text-decoration: none; }
.news-src { color: var(--muted); }

/* 健康助手悬浮球 + 对话面板 */
.health-fab {
  position: fixed; right: 22px; bottom: 86px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: 0; font-size: 24px; cursor: pointer; z-index: 35;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.health-fab:hover { filter: brightness(1.05); }
.health-chat-panel {
  position: fixed; right: 22px; bottom: 86px; width: min(380px, 92vw); height: min(70vh, 560px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; z-index: 45; box-shadow: 0 10px 30px rgba(0,0,0,.25); overflow: hidden;
}
.hcp-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.hcp-body { flex: 1; overflow: auto; padding: 12px; background: var(--panel-2); }
.hcp-foot { border-top: 1px solid var(--line); padding: 10px; }
.hcp-foot textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px; resize: vertical; }
.hcp-btns { display: flex; gap: 8px; margin-top: 8px; }

/* 论文智能助手（右侧内嵌面板） */
.paper-assistant {
  position: fixed; right: 0; bottom: 60px; width: min(520px, 100vw); height: calc(100vh - 60px - 56px);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 25;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.paper-assistant.collapsed { transform: translateX(calc(100% - 44px)); }
.paper-assistant.hidden { display: none !important; }
.pa-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.pa-skills {
  padding: 10px; display: flex; flex-wrap: wrap; gap: 6px;
  border-bottom: 1px solid var(--line); max-height: 120px; overflow-y: auto; flex-shrink: 0;
}
.pa-skill {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); font-size: 12px; cursor: pointer; color: var(--text);
  white-space: nowrap; transition: border-color .15s, color .15s, background .15s;
}
.pa-skill:hover { border-color: var(--brand); color: var(--brand); background: rgba(79,140,255,.08); }
.pa-body { flex: 1; overflow-y: auto; padding: 12px; background: var(--panel-2); }
.pa-foot { padding: 10px; border-top: 1px solid var(--line); flex-shrink: 0; }
.pa-foot textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px; resize: vertical; font-size: 13px;
}
.pa-foot textarea:focus { border-color: var(--brand); outline: none; }
.pa-btns { display: flex; gap: 8px; margin-top: 8px; }
.pa-upload { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
/* 论文 AI 导师已改为悬浮球入口，正文不再为侧栏留白（.pa-* 保留给其它内嵌面板复用） */

/* 待办事项（总览页） */
.todo-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.todo-add { display: flex; gap: 8px; }
.todo-add input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 9px; border-radius: 8px; }
.todo-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.todo-item .todo-text { flex: 1; font-size: 13px; word-break: break-all; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* 个人主页（总览） */
.home-hero { text-align: center; margin: 6px 0 2px; }
.home-name { font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.home-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.home-actions { text-align: center; margin-top: 16px; }

/* 全局搜索结果 */
.search-list { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow: auto; }
.search-res { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.search-res:hover { border-color: var(--brand); }
.search-ico { font-size: 18px; }
.search-main { flex: 1; min-width: 0; }
.search-label { font-size: 14px; font-weight: 600; word-break: break-all; }
.search-val { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.search-tag { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* 移动端 */
@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .topbar-search input { width: 150px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .bottom-nav .nav-item { font-size: 10px; }
}

/* 规划模块：待办 / 日历 / 复盘 / 历史复盘 */
.plan-todo-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.plan-todo-add { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-todo-add input[type="text"], .plan-todo-add input:not([type="date"]) {
  flex: 1; min-width: 160px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); padding: 9px; border-radius: 8px;
}
.plan-todo-add input[type="date"] { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 8px; border-radius: 8px; }
.plan-todo-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.plan-todo-item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.plan-todo-item .plan-todo-text { flex: 1; font-size: 13px; word-break: break-all; }
.plan-todo-item.done .plan-todo-text { text-decoration: line-through; color: var(--muted); }
.plan-todo-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.plan-todo-deadline { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.plan-todo-deadline.none { opacity: .7; }
.plan-todo-deadline.overdue { color: var(--err); border-color: var(--err); }

/* 日历 */
.plan-calendar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; max-width: 460px; margin: 0 auto; }
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 10px; }
.cal-title { font-weight: 700; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { aspect-ratio: 1 / 0.82; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; position: relative; padding: 2px; }
.cal-cell.cal-head { background: transparent; border: 0; cursor: default; font-size: 11px; color: var(--muted); aspect-ratio: auto; padding: 4px 0; }
.cal-cell.cal-empty { background: transparent; border: 0; cursor: default; }
.cal-cell:hover { border-color: var(--brand); }
.cal-cell.cal-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-cell.cal-has-todo { background: rgba(47,107,255,.10); }
.cal-cell.cal-has-review { border-color: var(--ok); }
.cal-d { font-weight: 600; line-height: 1.1; }
.cal-mk { font-size: 10px; line-height: 1.2; color: var(--ok); height: 12px; }
.cal-cell.cal-has-todo .cal-mk { color: var(--brand); }
.cal-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: var(--muted); }

/* 今日复盘 */
.plan-review { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.plan-review label { font-size: 13px; font-weight: 600; color: var(--text); }
.plan-review textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px; resize: vertical; font-size: 13px; }
.plan-review textarea:focus { border-color: var(--brand); outline: none; }
.plan-review .btn { align-self: flex-start; }

/* 历史复盘 */
.plan-history { display: flex; flex-direction: column; gap: 10px; }
.review-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.review-date { font-weight: 700; font-size: 13px; color: var(--brand); margin-bottom: 6px; }
.review-q { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.review-q b { color: var(--text); }
.review-q div { color: var(--text); font-size: 13px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

/* 规划模块移动端微调 */
@media (max-width: 720px) {
  .plan-todo-add { flex-direction: column; }
  .plan-todo-add input[type="date"] { width: 100%; }
  .cal-d { font-size: 12px; }
}

/* ==================== 论文工作台（极简学术风 · 随系统主题） ==================== */
/* --pw-* 已随全局 :root / [data-theme=dark] / 随系统 三套主题定义，此处只写结构 */
[data-module="paper"] .content { background: var(--pw-bg); color: var(--pw-text); }
[data-module="paper"] .paper-assistant {
  background: var(--pw-panel); border-left-color: var(--pw-line); color: var(--pw-text);
}
[data-module="paper"] .pa-head, [data-module="paper"] .pa-skills, [data-module="paper"] .pa-foot { border-color: var(--pw-line); }
[data-module="paper"] .pa-body { background: var(--pw-bg); }
[data-module="paper"] .pa-skill { background: var(--pw-panel2); border-color: var(--pw-line); color: var(--pw-text); }
[data-module="paper"] .pa-foot textarea { background: var(--pw-panel2); border-color: var(--pw-line); color: var(--pw-text); }

/* 课题切换栏（多课题并行管理） */
.pw-projectbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--pw-panel); border: 1px solid var(--pw-line); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 12px;
}
.pw-pb-left { display: flex; align-items: center; gap: 8px; }
.pw-pb-ico { font-size: 15px; }
.pw-pb-left select {
  background: var(--pw-panel2); border: 1px solid var(--pw-line); color: var(--pw-text);
  padding: 6px 10px; border-radius: 8px; font-size: 13px; max-width: 220px;
}
.pw-pb-degree {
  font-size: 11px; color: var(--pw-muted); background: var(--pw-panel2);
  border: 1px solid var(--pw-line); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.pw-pb-topic { flex: 1; min-width: 120px; font-size: 12.5px; color: var(--pw-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-pb-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pw-projectbar .btn.xs { padding: 5px 10px; font-size: 12px; }

/* 在线选刊库（弹窗内） */
.jdb { font-size: 13px; }
.jdb-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.jdb-tab {
  background: var(--pw-panel2); border: 1px solid var(--pw-line); color: var(--pw-muted);
  padding: 7px 12px; border-radius: 10px; font-size: 12.5px; cursor: pointer;
}
.jdb-tab.on { background: var(--pw-brand); border-color: var(--pw-brand); color: #fff; font-weight: 700; }
.jdb-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.jdb-filters input, .jdb-filters select {
  background: var(--pw-panel2); border: 1px solid var(--pw-line); color: var(--pw-text);
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px;
}
.jdb-filters input { flex: 1; min-width: 200px; }
.jdb-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.jdb-item { background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 10px; padding: 10px 12px; }
.jdb-item-h { font-size: 13.5px; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jdb-item-m { font-size: 11.5px; margin-bottom: 6px; }
.jdb-item-acts { display: flex; gap: 6px; flex-wrap: wrap; }

.pw-loading { padding: 40px; text-align: center; color: var(--pw-muted, var(--muted)); }
.pw { color: var(--pw-text); font-size: 13.5px; line-height: 1.65; }

/* 顶部 */
.pw-head {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  background: var(--pw-panel); border: 1px solid var(--pw-line); border-radius: 14px; padding: 16px 18px;
}
.pw-h1 { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.pw-h2 { font-size: 12px; color: var(--pw-muted); margin-top: 2px; }
.pw-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pw-layer { display: flex; gap: 4px; background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 999px; padding: 3px; }
.pw-layer-btn {
  border: none; background: transparent; color: var(--pw-muted); font-size: 12px;
  padding: 4px 14px; border-radius: 999px; cursor: pointer;
}
.pw-layer-btn.on { background: var(--pw-brand); color: #fff; font-weight: 700; }
.pw-ai-state { font-size: 11.5px; color: var(--pw-muted); display: flex; align-items: center; gap: 6px; }
.pw-headbar {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px;
  border-top: 1px solid var(--pw-line); padding-top: 12px; margin-top: 4px;
}
.pw-hb-item {
  flex: 1; min-width: 90px; background: var(--pw-panel2); border: 1px solid var(--pw-line);
  border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column;
}
.pw-hb-item b { font-size: 18px; font-weight: 800; }
.pw-hb-item span { font-size: 11px; color: var(--pw-muted); }

/* 标签页 */
.pw-tabs {
  display: flex; gap: 6px; margin: 14px 0; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin;
}
.pw-tab {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  background: var(--pw-panel); border: 1px solid var(--pw-line); color: var(--pw-muted);
  padding: 8px 14px; border-radius: 10px; font-size: 12.5px; cursor: pointer; transition: .15s;
}
.pw-tab:hover { color: var(--pw-text); border-color: var(--pw-brand); }
.pw-tab.on { background: var(--pw-brand); border-color: var(--pw-brand); color: #fff; font-weight: 700; }

/* 区块 */
.pw-sec { background: var(--pw-panel); border: 1px solid var(--pw-line); border-radius: 14px; padding: 16px 18px; }
.pw-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pw-sec-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.pw-sec-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pw-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.pw-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.pw textarea, .pw input, .pw select {
  background: var(--pw-panel2); border: 1px solid var(--pw-line); color: var(--pw-text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; width: 100%;
}
.pw textarea:focus, .pw input:focus, .pw select:focus { outline: none; border-color: var(--pw-brand); }
.pw .btn { background: var(--pw-brand); color: #fff; border: 1px solid var(--pw-brand); }
.pw .btn.ghost { background: transparent; color: var(--pw-text); border-color: var(--pw-line); }
.pw .btn.xs { padding: 3px 9px; font-size: 11.5px; border-radius: 7px; }
.pw .icon-btn { color: var(--pw-muted); }
.pw .muted { color: var(--pw-muted); }

/* 进度看板 */
.pw-progress-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 16px; }
.pw-progress-info b { font-size: 22px; }
.pw-ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pw-ch { background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 12px; padding: 12px; }
.pw-ch.done { border-color: rgba(57,208,168,.5); background: rgba(57,208,168,.07); }
.pw-ch-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.pw-check { display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.pw-check input { width: 15px; height: 15px; flex: none; }
.pw-ch-bar { height: 5px; background: rgba(125,145,175,.2); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.pw-ch-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pw-brand), var(--pw-ok)); border-radius: 999px; }
.pw-ch-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--pw-muted); }
.pw-ch-acts { display: flex; gap: 6px; margin-top: 10px; }

/* 检索 / 筛选 */
.pw-searchbar { display: flex; gap: 8px; flex-wrap: wrap; }
.pw-searchbar input { flex: 1; min-width: 200px; }
.pw-searchbar select { width: auto; min-width: 120px; }
.pw-dbs { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.pw-db {
  background: var(--pw-panel2); border: 1px solid var(--pw-line); color: var(--pw-text);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.pw-db:hover { border-color: var(--pw-brand); color: var(--pw-brand); }
.pw-filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 10px 0; font-size: 12.5px; }
.pw-filters input[type="text"], .pw-filters input:not([type]) { width: 200px; }
.pw-filters label { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--pw-muted); }
.pw-filters label input { width: auto; }

/* 表格 */
.pw-table-wrap { overflow-x: auto; border: 1px solid var(--pw-line); border-radius: 10px; }
.pw-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pw-table th, .pw-table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--pw-line); white-space: nowrap; }
.pw-table th { background: var(--pw-panel2); font-weight: 700; color: var(--pw-muted); font-size: 11.5px; }
.pw-table tbody tr:last-child td { border-bottom: none; }
.pw-table tbody tr:hover { background: rgba(79,140,255,.06); }
.pw-table .lt-title { white-space: normal; min-width: 260px; font-weight: 600; }

/* 标签 */
.pw-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; border: 1px solid var(--pw-line); color: var(--pw-muted); background: var(--pw-panel2); vertical-align: middle;
}
.pw-tag.tg-hot { color: #ff9d5c; border-color: rgba(255,157,92,.45); background: rgba(255,157,92,.1); }
.pw-tag.tg-new { color: var(--pw-ok); border-color: rgba(57,208,168,.45); background: rgba(57,208,168,.1); }
.pw-tag.tg-warn { color: var(--pw-err); border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.1); }

/* 卡片 */
.pw-card { background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 12px; padding: 12px 14px; }
.pw-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13.5px; }
.pw-card-head .muted { font-size: 11px; margin-left: auto; }
.pw-card-body { font-size: 13px; line-height: 1.75; word-break: break-word; }
.pw-card-body h3, .pw-card-body h4 { margin: 10px 0 4px; font-size: 13.5px; color: var(--pw-brand); }
.pw-card-body ul { margin: 6px 0; padding-left: 20px; }
.pw-card-body code { background: rgba(125,145,175,.16); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.pw-pre {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.8; margin: 0; max-height: 340px; overflow: auto; color: var(--pw-text);
}
/* 综述生成控制区 */
.pw-gen-box {
  background: var(--pw-panel2); border: 1px solid var(--pw-line);
  border-radius: 12px; padding: 12px 14px;
}
.pw-gen-box .muted { font-size: 11.5px; }
/* AI 撰写未完成时的「文献素材」卡片：左侧警示条，与正式初稿区分开 */
.pw-card.partial { border-left: 3px solid var(--pw-warn); }
.pw-note {
  font-size: 12px; line-height: 1.7; padding: 8px 10px; border-radius: 8px;
  margin-bottom: 8px; background: rgba(125,145,175,.12); color: var(--pw-muted);
}
.pw-note.warn {
  background: rgba(245,166,35,.12); border: 1px solid rgba(245,166,35,.35); color: var(--pw-warn);
}
.pw-src summary { cursor: pointer; font-size: 12px; color: var(--pw-muted); margin-top: 8px; }
.pw-src pre { white-space: pre-wrap; font-size: 11.5px; color: var(--pw-muted); max-height: 180px; overflow: auto; }

/* 看板列 */
.pw-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.pw-col { background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 12px; overflow: hidden; }
.pw-col-head {
  padding: 9px 12px; font-size: 12.5px; font-weight: 700; border-bottom: 1px solid var(--pw-line);
  display: flex; justify-content: space-between; align-items: center;
}
.pw-col-head span { font-size: 11px; color: var(--pw-muted); }
.pw-col-head.p-hi { color: var(--pw-err); }
.pw-col-head.p-mid { color: var(--pw-warn); }
.pw-col-head.p-low { color: var(--pw-ok); }
.pw-col-body { padding: 10px; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
.pw-mini {
  display: flex; align-items: center; gap: 6px; background: var(--pw-panel);
  border: 1px solid var(--pw-line); border-radius: 8px; padding: 7px 9px; font-size: 12.5px;
}
.pw-mini > div:first-child { flex: 1; word-break: break-word; }
.pw-mini .pw-check { flex: 1; font-weight: 400; }
.pw-mini.done .pw-check span { text-decoration: line-through; color: var(--pw-muted); }
.pw-due { font-size: 10.5px; color: var(--pw-muted); white-space: nowrap; }
.pw-due.over { color: var(--pw-err); font-weight: 700; }
.pw-addbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pw-addbar input:first-child { flex: 1; min-width: 200px; }
.pw-addbar select, .pw-addbar input[type="date"] { width: auto; }

/* 检索结果 */
.pw-res { display: flex; gap: 10px; background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 10px; padding: 10px 12px; }
.pw-res-t { font-weight: 600; font-size: 13px; }
.pw-res-x { font-size: 12px; color: var(--pw-muted); margin-top: 3px; }

/* 期刊画像 */
.pw-terms { display: flex; flex-wrap: wrap; gap: 6px; }
.pw-term {
  background: var(--pw-panel); border: 1px solid var(--pw-line); border-radius: 6px;
  padding: 3px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px;
}
.pw-term i { font-style: normal; font-size: 10.5px; color: var(--pw-brand); }
.pw-fit { padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pw-fit.hi { background: rgba(57,208,168,.16); color: var(--pw-ok); }
.pw-fit.mid { background: rgba(245,166,35,.16); color: var(--pw-warn); }
.pw-fit.lo { background: rgba(142,151,168,.16); color: var(--pw-muted); }
.pw-hit { margin-top: 8px; font-size: 11.5px; color: var(--pw-ok); }

/* 计量分析 */
.pw-reg { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin: 14px 0; }
.pw-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.pw-field label { font-size: 11.5px; color: var(--pw-muted); }
.pw-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.pw-stat-out { margin-top: 14px; }
.pw-stat-out h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--pw-brand); }
.pw-stat-sum { margin-top: 10px; font-size: 12px; color: var(--pw-text); }
.pw-panelbox { background: var(--pw-panel2); border: 1px solid var(--pw-line); border-radius: 12px; padding: 12px 14px; }

/* 助手：技能分组 / 忙碌态 / 消息 */
.pa-skill-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; width: 100%; }
.pa-skill-gt { font-size: 10.5px; color: var(--muted); width: 100%; margin-top: 2px; }
.pa-skill.hi { border-color: var(--brand); color: var(--brand); }
.paper-assistant.busy .pa-skills { opacity: .5; pointer-events: none; }
.paper-assistant.busy .pa-head::after { content: '思考中…'; font-size: 11px; color: var(--brand); font-weight: 400; }
.pa-body .msg { margin-bottom: 14px; font-size: 13px; line-height: 1.75; }
.pa-body .msg b { color: var(--brand); font-size: 12px; }
.pa-body .msg.user b { color: var(--muted); }
.pa-body .msg-x { margin-top: 3px; word-break: break-word; }
.pa-body .msg-x h3, .pa-body .msg-x h4 { margin: 8px 0 3px; font-size: 13px; }
.pa-body .msg-x ul { margin: 5px 0; padding-left: 20px; }
.pa-body .msg-x code { background: rgba(125,145,175,.16); padding: 1px 5px; border-radius: 4px; }

/* 设置页 AI 区块 */
.ai-block { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.ai-block-t { font-weight: 700; font-size: 13px; color: var(--brand); margin-bottom: 10px; }
.ok-tag { font-size: 10.5px; color: var(--ok); border: 1px solid var(--ok); border-radius: 999px; padding: 0 7px; margin-left: 6px; }
.warn-tag { font-size: 10.5px; color: var(--warn, #e0a33e); border: 1px solid var(--warn, #e0a33e); border-radius: 999px; padding: 0 7px; margin-left: 6px; }

/* ===== 双引擎设置卡片 ===== */
.eng-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.eng-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.eng-t { font-weight: 700; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eng-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.eng-switch input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.eng-desc { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.eng-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.eng-badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.eng-badge.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.eng-badge.wait { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 45%, transparent); }
.eng-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.eng-acts a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.eng-status { font-size: 12px; line-height: 1.6; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
.eng-note { font-size: 11px; line-height: 1.65; margin-top: 8px; }
.eng-adv { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.eng-adv summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.eng-adv[open] summary { margin-bottom: 10px; }
.key-input { display: flex; gap: 6px; align-items: stretch; }
.key-input input { flex: 1; min-width: 0; }
.key-eye { flex: 0 0 auto; width: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1; }
.key-eye:hover { border-color: var(--brand); }
.key-ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.key-env { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
.key-env code { color: var(--text); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== 论文助手模式切换栏 ===== */
.pw-modebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--pw-panel); border: 1px solid var(--pw-line); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; }
.pw-mb-label { font-size: 12px; font-weight: 700; color: var(--pw-muted); white-space: nowrap; }
.pw-mb-seg { display: flex; gap: 4px; background: var(--pw-bg); border: 1px solid var(--pw-line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.pw-mb-btn { border: 0; background: transparent; color: var(--pw-muted); font-size: 12.5px; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; transition: .15s; }
.pw-mb-btn:hover { color: var(--pw-text); }
.pw-mb-btn.on { background: var(--brand); color: #fff; font-weight: 600; }
.pw-mb-status { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.pw-eng-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--pw-line); background: var(--pw-bg); color: var(--pw-muted); cursor: pointer; }
.pw-eng-pill b { color: var(--pw-text); font-weight: 600; }
.pw-eng-pill:hover { border-color: var(--brand); }
.pw-mb-desc { flex-basis: 100%; font-size: 11.5px; color: var(--pw-muted); line-height: 1.6; border-top: 1px dashed var(--pw-line); padding-top: 8px; }
.pw-mb-desc .warn { color: var(--wait); }

@media (max-width: 900px) {
  .pw-modebar { padding: 10px; gap: 8px; }
  .pw-mb-label { display: none; } /* 省空间 */
  .pw-mb-seg { width: 100%; justify-content: stretch; }
  .pw-mb-btn { flex: 1; justify-content: center; padding: 7px 4px; font-size: 12px; white-space: normal; text-align: center; line-height: 1.3; }
  .pw-mb-status { margin-left: 0; width: 100%; justify-content: center; }
}
@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .pw-head { grid-template-columns: 1fr; }
  .pw-head-right { align-items: flex-start; }
  .pw-ch-grid { grid-template-columns: 1fr; }
  .pw-progress-wrap { justify-content: center; }
  .pw-sec { padding: 14px 12px; }
}

/* ===================================================================
   联合研究助手（Phase 2）：检索控制条 / 引用角标 / 文献卡片 /
   OpenAlex 检索弹窗 / 参考文献导出
   =================================================================== */
.pa-ctl {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel); font-size: 11.5px; color: var(--muted); flex-shrink: 0;
}
[data-module="paper"] .pa-ctl { background: var(--pw-panel); border-color: var(--pw-line); }
.pa-ctl-mode { font-weight: 700; color: var(--brand); }
.pa-ctl-item { display: inline-flex; align-items: center; gap: 4px; }
.pa-ctl select {
  background: var(--panel-2); color: inherit; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 4px; font-size: 11.5px;
}
.pa-ctl-hint { font-style: italic; }

/* 模式标签 + 降级提示 */
.pa-mtag {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px;
}
.pa-mtag.warn { color: var(--pw-warn); border-color: color-mix(in srgb, var(--pw-warn) 45%, transparent); }
.pa-notice {
  margin: 6px 0; padding: 6px 9px; border-radius: 8px; font-size: 11.5px; line-height: 1.6;
  color: var(--pw-warn); background: color-mix(in srgb, var(--pw-warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--pw-warn) 35%, transparent);
}

/* 正文里的 [n] 引用角标 */
.pa-cite {
  color: var(--brand); cursor: pointer; font-weight: 600; text-decoration: none;
  padding: 0 1px; border-radius: 3px;
}
.pa-cite:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }

/* 检索过程折叠区 */
.pa-trace { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pa-trace summary { cursor: pointer; user-select: none; }
.pa-trace > div { padding: 5px 0 0 10px; line-height: 1.7; word-break: break-word; }

/* 文献卡片 */
.pa-refs { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.pa-refs-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  flex-wrap: wrap; font-size: 11.5px; margin-bottom: 6px;
}
.pa-refs-head b { color: var(--text); font-size: 11.5px; }
.pa-refs-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.pa-ref {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  margin-bottom: 6px; background: var(--panel); transition: box-shadow .2s, border-color .2s;
}
[data-module="paper"] .pa-ref { background: var(--pw-panel); border-color: var(--pw-line); }
.pa-ref.hit { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.pa-ref-t { font-size: 12px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.pa-ref-n { color: var(--brand); margin-right: 4px; }
.pa-ref-m { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.pa-ref-cite { margin-left: 6px; }
.pa-ref-abs { font-size: 11px; color: var(--muted); margin-top: 4px; }
.pa-ref-abs summary { cursor: pointer; }
.pa-ref-abs > div { margin-top: 4px; line-height: 1.65; max-height: 150px; overflow: auto; }
.pa-ref-f { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.pa-ref-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pa-ref-links a { font-size: 11px; color: var(--brand); text-decoration: none; }
.pa-ref-links a:hover { text-decoration: underline; }

/* OpenAlex 检索弹窗 */
.oa-search { display: flex; flex-direction: column; gap: 10px; }
.oa-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.oa-bar input { flex: 1; min-width: 180px; }
.oa-bar2 { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.oa-bar2 label { display: inline-flex; align-items: center; gap: 5px; }
.oa-meta { font-size: 12px; }
.oa-results { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.oa-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--panel);
}
.oa-item:hover { border-color: var(--brand); }
.oa-item.dup { opacity: .55; cursor: default; }
.oa-item input { margin-top: 3px; accent-color: var(--brand); flex-shrink: 0; }
.oa-item-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.oa-item-t { font-size: 12.5px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.oa-item-m { font-size: 11px; color: var(--muted); }
.oa-item-l { display: flex; gap: 9px; flex-wrap: wrap; }
.oa-item-l a { font-size: 11px; color: var(--brand); text-decoration: none; }
.oa-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* 参考文献导出 */
.refs-out { display: flex; flex-direction: column; gap: 14px; }
.refs-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.refs-out .pw-pre { max-height: 32vh; overflow: auto; font-size: 12px; line-height: 1.8; }

/* ============================================================
   趋势雷达（原 AI 学习页重构）
   沿用全局主题变量，移动端优先，禁止横向溢出
   ============================================================ */
.tr-page { display: flex; flex-direction: column; gap: 14px; max-width: 100%; overflow-x: hidden; }
.tr-pull { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; transition: height .18s; }

/* —— 顶部 —— */
.tr-head { display: flex; flex-direction: column; gap: 10px; }
.tr-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tr-title { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: .3px; }
.tr-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.tr-search-row { display: flex; }
.tr-search { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 13px; }
.tr-search:focus { outline: none; border-color: var(--brand); }
.tr-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tr-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.tr-cache-tag { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--panel-2); color: var(--warn); margin-left: 4px; }
.tr-srcstat { cursor: pointer; font-size: 11.5px; }
.tr-srcstat.ok { color: var(--ok); }
.tr-srcstat.warn { color: var(--warn); }
.tr-switches { display: flex; gap: 8px; }
.tr-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tr-seg button { border: 0; background: var(--panel); color: var(--muted); font-size: 11.5px;
  padding: 5px 10px; cursor: pointer; min-height: 30px; }
.tr-seg button.on { background: var(--brand); color: #fff; }

/* 分类：移动端横向滑动 */
.tr-cats { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tr-cats::-webkit-scrollbar { display: none; }
.tr-cat { flex: 0 0 auto; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 12.5px; cursor: pointer; min-height: 32px; white-space: nowrap; }
.tr-cat.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tr-soon { font-style: normal; font-size: 9px; opacity: .65; margin-left: 4px; }

/* —— 今日智能简报 —— */
.tr-brief { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tr-brief-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tr-brief-head h2 { font-size: 15px; margin: 0; }
.tr-brief-meta { font-size: 11px; }
.tr-brief-ov { font-size: 12.5px; color: var(--muted); line-height: 1.7; padding: 8px 10px;
  background: var(--panel-2); border-radius: 8px; }
.tr-brief-list { display: flex; flex-direction: column; gap: 10px; }
.tr-brief-item { border-left: 3px solid var(--brand); padding: 2px 0 2px 10px; }
.tr-bi-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tr-bi-no { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tr-bi-title { font-size: 13.5px; font-weight: 600; }
.tr-bi-concl { font-size: 12.5px; line-height: 1.7; margin-top: 5px; }
.tr-bi-detail { font-size: 12px; line-height: 1.8; color: var(--muted); margin-top: 6px;
  display: flex; flex-direction: column; gap: 3px; }
.tr-bi-detail.hidden { display: none; }
.tr-bi-srcs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tr-bi-src { font-size: 11px; color: var(--brand); text-decoration: none; }
.tr-bi-src:hover { text-decoration: underline; }
.tr-brief-acts { display: flex; gap: 7px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); }
.tr-brief-idle { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tr-warn { color: var(--warn); font-size: 12.5px; }

/* —— 区块 —— */
.tr-sec { display: flex; flex-direction: column; gap: 10px; }
.tr-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tr-sec-head h2 { font-size: 15px; margin: 0; }
.tr-sec-note { font-size: 11px; color: var(--muted); }
.tr-notice { padding: 14px; background: var(--panel); border: 1px dashed var(--line);
  border-radius: var(--radius); color: var(--muted); font-size: 12.5px; }
.tr-src-fail { font-size: 11.5px; color: var(--warn); padding: 6px 10px;
  background: var(--panel-2); border-radius: 8px; }

/* —— 平台热榜卡片：移动端可横向滑动 —— */
.tr-plat-scroll { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.tr-plat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tr-plat-fail { border-style: dashed; }
.tr-plat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tr-plat-name { font-size: 13.5px; font-weight: 600; }
.tr-plat-time { font-size: 10.5px; color: var(--muted); }
.tr-plat-list { display: flex; flex-direction: column; }
.tr-plat-err { font-size: 12px; color: var(--muted); padding: 8px 0; }
.tr-plat-errmsg { font-size: 11px; color: var(--warn); margin-top: 4px; word-break: break-word; }
.tr-plat-more { border: 0; background: transparent; color: var(--brand); font-size: 11.5px;
  cursor: pointer; padding: 6px; min-height: 32px; }
.tr-row { display: flex; align-items: center; gap: 7px; padding: 7px 2px;
  border-bottom: 1px solid var(--line); min-height: 38px; }
.tr-row:last-child { border-bottom: 0; }
.tr-rank { width: 20px; text-align: center; font-size: 11.5px; color: var(--muted); flex-shrink: 0; font-weight: 600; }
.tr-rank.r1 { color: #ff4d4f; } .tr-rank.r2 { color: #ff7a45; } .tr-rank.r3 { color: #ffa940; }
.tr-chg { font-style: normal; font-size: 9.5px; flex-shrink: 0; width: 26px; text-align: center; }
.tr-chg.up { color: var(--err); } .tr-chg.down { color: var(--ok); }
.tr-chg.new { color: #fff; background: var(--err); border-radius: 3px; padding: 0 3px; font-size: 8.5px; }
.tr-chg.same { color: var(--wait); }
.tr-row-title { flex: 1; font-size: 12.5px; line-height: 1.5; cursor: pointer; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-row-title:hover { color: var(--brand); }
.tr-tag { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: var(--panel-2);
  color: var(--warn); flex-shrink: 0; }
.tr-hot { font-size: 10.5px; color: var(--muted); flex-shrink: 0; }
.tr-row-ai { border: 0; background: transparent; cursor: pointer; font-size: 12px;
  padding: 4px 6px; min-width: 30px; min-height: 30px; }

/* —— 资讯卡片 —— */
.tr-news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.tr-news { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.tr-news-img { width: 100%; height: 132px; object-fit: cover; background: var(--panel-2); }
.tr-news-body { padding: 11px; display: flex; flex-direction: column; gap: 7px; }
.tr-news-badges { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tr-kind { font-size: 9.5px; padding: 1.5px 6px; border-radius: 4px; font-weight: 600; }
.tr-kind-hot { background: rgba(217,131,0,.14); color: var(--warn); }
.tr-kind-news { background: rgba(20,160,107,.14); color: var(--ok); }
.tr-cred { font-size: 9.5px; padding: 1.5px 6px; border-radius: 4px; }
.cred-ok { background: rgba(20,160,107,.12); color: var(--ok); }
.cred-mid { background: var(--panel-2); color: var(--muted); }
.cred-warn { background: rgba(217,131,0,.12); color: var(--warn); }
.cred-err { background: rgba(226,59,59,.12); color: var(--err); }
.tr-via { font-size: 9.5px; color: var(--muted); }
.tr-news-title { font-size: 13.5px; font-weight: 600; line-height: 1.55; margin: 0; cursor: pointer;
  word-break: break-word; }
.tr-news-title:hover { color: var(--brand); }
.tr-news-sum { font-size: 11.5px; color: var(--muted); line-height: 1.65; margin: 0; }
.tr-news-meta { display: flex; gap: 9px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.tr-news-acts { display: flex; gap: 4px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line); }
.tr-news-acts button { border: 0; background: transparent; color: var(--muted); font-size: 11px;
  cursor: pointer; padding: 5px 7px; border-radius: 6px; min-height: 32px; }
.tr-news-acts button:hover { background: var(--panel-2); color: var(--brand); }

/* —— 紧凑榜单视图 —— */
.tr-compact { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 11px; }
.tr-crow { display: flex; align-items: center; gap: 9px; padding: 9px 0;
  border-bottom: 1px solid var(--line); min-height: 40px; }
.tr-crow:last-child { border-bottom: 0; }
.tr-crow-title { flex: 1; font-size: 12.5px; cursor: pointer; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-crow-title:hover { color: var(--brand); }
.tr-crow-src, .tr-crow-time { font-size: 10.5px; color: var(--muted); flex-shrink: 0; }

/* —— AI 抽屉：桌面右侧 / 移动端底部 —— */
.tr-drawer { position: fixed; top: 0; right: 0; width: min(460px, 100%); height: 100%;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 70;
  display: flex; flex-direction: column; box-shadow: -6px 0 24px rgba(0,0,0,.14); }
.tr-drawer.hidden { display: none; }
.tr-drawer-head { display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.tr-drawer-body { flex: 1; overflow: auto; padding: 15px; -webkit-overflow-scrolling: touch; }
.tr-drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 69; }
.tr-drawer-mask.hidden { display: none; }
.tr-an h4 { font-size: 14px; margin: 0 0 12px; line-height: 1.5; }
.tr-an-sec { margin-bottom: 14px; }
.tr-an-sec b { font-size: 12px; color: var(--brand); display: block; margin-bottom: 5px; }
.tr-an-sec p { font-size: 12.5px; line-height: 1.75; margin: 0; color: var(--text); }
.tr-an-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; }
.tr-an-list.ok li { color: var(--ok); }
.tr-an-list.warn li { color: var(--warn); }
.tr-an-sources { border-top: 1px solid var(--line); padding-top: 11px; }
.tr-an-src { display: block; font-size: 11px; color: var(--brand); text-decoration: none;
  margin-bottom: 5px; word-break: break-all; }
.tr-an-acts { display: flex; gap: 7px; flex-wrap: wrap; }
.tr-more { display: flex; flex-direction: column; gap: 7px; }
.tr-more button { text-align: left; min-height: 40px; }
.tr-quiz { margin-bottom: 11px; padding: 9px; background: var(--panel-2); border-radius: 8px; }
.tr-quiz-q { font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.tr-quiz-o { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.tr-quiz details { margin-top: 6px; font-size: 12px; }
.tr-quiz summary { cursor: pointer; color: var(--brand); }
.tr-pre { background: var(--panel-2); padding: 10px; border-radius: 8px; font-size: 11.5px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.tr-srclist { display: flex; flex-direction: column; gap: 7px; }
.tr-srcrow { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tr-dot.ok { background: var(--ok); } .tr-dot.err { background: var(--err); }
.tr-srcname { flex: 1; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-srcinfo { font-size: 11px; color: var(--muted); flex-shrink: 0; max-width: 40%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-skeleton { padding: 26px; text-align: center; color: var(--muted); font-size: 12.5px; }
.tr-err { padding: 20px; text-align: center; color: var(--err); font-size: 12.5px; }

/* —— 移动端 —— */
@media (max-width: 720px) {
  .tr-title { font-size: 19px; }
  .tr-plat-scroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 11px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tr-plat-scroll::-webkit-scrollbar { display: none; }
  .tr-plat { flex: 0 0 86%; scroll-snap-align: start; }
  .tr-news-grid { grid-template-columns: 1fr; }
  .tr-drawer { width: 100%; height: 82vh; top: auto; bottom: 0; border-left: 0;
    border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .tr-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .tr-switches { justify-content: space-between; }
}

/* 趋势雷达设置面板 */
.tr-settings { display: flex; flex-direction: column; gap: 4px; }
.tr-set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 6px; }
.tr-set-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; min-height: 34px; }
.tr-set-chk.off { opacity: .58; cursor: not-allowed; }
.tr-set-chk input { accent-color: var(--brand); }
.tr-set-soon { font-style: normal; font-size: 9.5px; color: var(--muted); margin-left: auto; }
.tr-set-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.tr-set-row .field { flex: 1; min-width: 148px; }
.tr-set-feeds { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.tr-set-feed { display: flex; align-items: center; gap: 9px; font-size: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--line); }
.tr-set-feed > span:first-child { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .tr-set-row { flex-direction: column; align-items: stretch; } }

/* ===================== 趋势雷达 · 第二阶段/第三阶段扩展 ===================== */
.tr-aux { margin-top: 14px; }
.tr-evt-list { display: flex; flex-direction: column; gap: 10px; }
.tr-evt { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.tr-evt-top { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.tr-evt-title { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.35; flex: 1; }
.tr-evt-plats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tr-evt-plat { font-size: 11.5px; padding: 3px 8px; border-radius: 20px; background: color-mix(in srgb, var(--pc, #888) 16%, transparent); color: var(--pc, #888); border: 1px solid color-mix(in srgb, var(--pc, #888) 40%, transparent); font-weight: 600; }
.tr-evt-plat em { font-style: normal; opacity: .82; font-weight: 500; margin-left: 2px; }
.tr-evt-foot { display: flex; align-items: center; gap: 12px; margin-top: 9px; flex-wrap: wrap; font-size: 12px; }
.tr-evt-score { font-weight: 600; color: var(--brand); }
.tr-evt-newslinks { display: flex; gap: 6px; flex-wrap: wrap; }
.tr-evt-news { font-size: 11.5px; color: var(--brand); text-decoration: none; padding: 2px 7px; border: 1px solid var(--line); border-radius: 16px; }
.tr-evt-news:hover { border-color: var(--brand); }

/* 个性化推荐相关度 */
.tr-rel { font-size: 10.5px; padding: 1px 7px; border-radius: 10px; font-weight: 600; margin-left: 6px; }
.tr-rel.rel-hi { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.tr-rel.rel-mid { background: rgba(255,179,46,.16); color: #c8870a; }
.tr-rel.rel-lo { background: var(--line); color: var(--muted); }

/* 每日学习包 */
.tr-pack-list { display: flex; flex-direction: column; gap: 6px; }
.tr-pack { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tr-pack-rel { font-size: 10.5px; color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.tr-pack-title { flex: 1; min-width: 0; font-size: 13.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-pack-src { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tr-pack-acts { display: flex; gap: 8px; margin-top: 10px; }
.tr-pack-gen { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tr-pack-gen-head { font-size: 12.5px; color: var(--brand); font-weight: 600; }
.tr-gc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.tr-gc.fail { color: #e0533a; border-color: #e0533a55; }
.tr-gc-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tr-gc-pts { margin: 0; padding-left: 18px; font-size: 12px; color: var(--text); }
.tr-gc-terms { font-size: 11px; color: var(--muted); }

/* 趋势历史 */
.tr-hist-search { margin: 8px 0 10px; }
.tr-hist-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
.tr-hist { border-collapse: collapse; width: 100%; font-size: 12px; }
.tr-hist th, .tr-hist td { border-bottom: 1px solid var(--line); padding: 5px 7px; text-align: center; white-space: nowrap; }
.tr-hist thead th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; z-index: 1; }
.tr-ht { text-align: left !important; position: sticky; left: 0; background: var(--panel); min-width: 140px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tr-ht-meta { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.tr-hc { color: var(--muted); }
.tr-hc.empty { color: var(--line); }
.tr-hc.top { background: #ffe1e1; color: #d32f2f; font-weight: 700; }
.tr-hc.hi { background: #fff3d6; color: #b9770a; font-weight: 600; }
.tr-hc.mid { color: #4a6fa5; }
.tr-hc.low { color: var(--muted); }
@media (prefers-color-scheme: dark) { .tr-hc.top { background: #5a2222; color: #ff9b9b; } .tr-hc.hi { background: #5a4a1e; color: #ffce6b; } }

/* 学习卡错误（简洁展示） */
.tr-gc-err { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ===== 采集状态条（替换永久「正在采集」）===== */
.tr-collect-status { margin: 0 0 8px; padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tr-collect-status.collecting { background: rgba(59,130,246,.12); color: #3b82f6; }
.tr-collect-status.ok { background: rgba(16,185,129,.1); color: #10b981; }
.tr-collect-status.partial { background: rgba(245,158,11,.1); color: #d97706; }
.tr-collect-status.fail { background: rgba(239,68,68,.1); color: #ef4444; }
.tr-spin { width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; display: inline-block; animation: tr-spin 0.8s linear infinite; }
@keyframes tr-spin { to { transform: rotate(360deg); } }
.tr-collect-detail { background: none; border: 1px solid currentColor; color: inherit; padding: 1px 8px; border-radius: 10px; font-size: 11px; cursor: pointer; }

/* 学习卡层级徽标 */
.tr-gc-tier { font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle; font-weight: 500; }
.tr-gc-tier.local { background: rgba(245,158,11,.15); color: #d97706; }
.tr-gc-tier.compat { background: rgba(59,130,246,.15); color: #3b82f6; }
.tr-gc-tier.ai { background: rgba(16,185,129,.15); color: #10b981; }

/* 学习卡问题/答案、标签 */
.tr-card-qa p { margin: 4px 0 8px; padding: 8px 10px; background: var(--panel-2, rgba(0,0,0,.04)); border-radius: 6px; border-left: 3px solid var(--brand, #3b82f6); }
.tr-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-card-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(59,130,246,.1); color: #3b82f6; }

/* 数据源状态分组 */
.tr-srclist-sec { margin-bottom: 14px; }
.tr-srclist-sec b { display: block; font-size: 12px; margin-bottom: 6px; color: var(--muted); }
.tr-srcname { color: var(--fg); }
.tr-srcname[href] { text-decoration: underline; }

/* 趋势历史行可点击 */
.tr-hist-row { cursor: pointer; transition: background .15s; }
.tr-hist-row:hover { background: rgba(59,130,246,.06); }
.tr-hist-detail { width: 100%; font-size: 13px; }
.tr-hist-detail td { padding: 4px 10px; border-bottom: 1px solid var(--border, rgba(0,0,0,.06)); }
.tr-hist-detail td:last-child { text-align: right; color: var(--muted); }

/* 平台标题可点 */
a.tr-plat-name { color: var(--fg); text-decoration: none; }
a.tr-plat-name:hover { text-decoration: underline; }

/* 事件平台标签可点 */
.tr-evt-plat[data-act] { cursor: pointer; transition: opacity .15s; }
.tr-evt-plat[data-act]:hover { opacity: 0.8; }

/* ==========================================================================
   论文 AI 导师 · 论文页专属悬浮球（FAB）+ 聊天抽屉
   只在论文页挂载；移动端底部抽屉，桌面端右侧面板；transform+opacity 240ms
   ========================================================================== */
:root { --pt-anim: 240ms cubic-bezier(.22,.61,.36,1); }

/* ---------- 悬浮球 ---------- */
.pt-fab {
  position: fixed; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  border: 0; cursor: pointer; padding: 0;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #7b5cff));
  color: #fff; font-size: 25px; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.08) inset;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.6) translateY(10px);
  transition: transform var(--pt-anim), opacity var(--pt-anim), box-shadow .2s;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.pt-fab.in { opacity: 1; transform: scale(1) translateY(0); }
.pt-fab:hover { box-shadow: 0 10px 26px rgba(0,0,0,.34); }
.pt-fab:active { transform: scale(.93); }
.pt-fab.dragging { transition: none; opacity: .92; transform: scale(1.06); }
.pt-fab.active { transform: scale(.9) rotate(-8deg); }
.pt-fab-ico { pointer-events: none; }
.pt-fab-dot {
  position: absolute; right: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--panel); background: var(--muted);
}
.pt-fab-dot[data-st="ok"]   { background: #35c26a; }
.pt-fab-dot[data-st="warn"] { background: #f0a63a; }
.pt-fab-dot[data-st="err"]  { background: #ef5b5b; }
.pt-fab-dot[data-st="wait"] { background: var(--muted); }
.pt-fab.queued::after {
  content: ''; position: absolute; left: 2px; bottom: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: #f0a63a; border: 2px solid var(--panel);
}

/* ---------- 遮罩 ---------- */
.pt-mask {
  position: fixed; inset: 0; z-index: 58; background: rgba(0,0,0,.42);
  opacity: 0; pointer-events: none; transition: opacity var(--pt-anim);
}
.pt-mask.show { opacity: 1; pointer-events: auto; }
body.pt-locked { overflow: hidden; }

/* ---------- 面板：桌面右侧 ---------- */
.pt-panel {
  position: fixed; z-index: 62; display: flex; flex-direction: column;
  top: 0; right: 0; height: 100vh; width: min(440px, 100vw);
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0,0,0,.3);
  transform: translateX(102%); opacity: 0; pointer-events: none;
  transition: transform var(--pt-anim), opacity var(--pt-anim);
  will-change: transform, opacity;
}
.pt-panel.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
.pt-grip { display: none; }

.pt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.pt-head-l { min-width: 0; }
.pt-title { font-size: 14px; font-weight: 700; }
.pt-paper {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pt-head-r { display: flex; gap: 2px; flex-shrink: 0; }
.pt-ico {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-size: 15px; line-height: 1;
  transition: background .15s, color .15s;
}
.pt-ico:hover { background: var(--panel-2); color: var(--text); }
.pt-ico.xs { width: 24px; height: 24px; font-size: 12px; }

/* 状态条 */
.pt-status {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 7px 14px; font-size: 11.5px; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.pt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.pt-dot[data-st="ok"]   { background: #35c26a; box-shadow: 0 0 0 3px rgba(53,194,106,.16); }
.pt-dot[data-st="warn"] { background: #f0a63a; box-shadow: 0 0 0 3px rgba(240,166,58,.16); }
.pt-dot[data-st="err"]  { background: #ef5b5b; box-shadow: 0 0 0 3px rgba(239,91,91,.16); }
.pt-st-txt { flex: 1; min-width: 120px; }
.pt-model {
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); white-space: nowrap;
}
.pt-link {
  background: transparent; border: 0; color: var(--brand); cursor: pointer;
  font-size: 11.5px; padding: 0 2px; text-decoration: underline;
}

/* 能力按钮 */
.pt-skills {
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  max-height: 104px; overflow-y: auto; flex-shrink: 0;
}
.pt-skill-g { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 4px; }
.pt-skill-gt { font-size: 10.5px; color: var(--muted); width: 100%; }
.pt-skill {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); font-size: 11.5px; cursor: pointer; color: var(--text);
  white-space: nowrap; transition: border-color .15s, color .15s, background .15s;
}
.pt-skill:hover { border-color: var(--brand); color: var(--brand); }
.pt-panel.busy .pt-skills { opacity: .45; pointer-events: none; }

/* 消息区 */
.pt-msgs {
  flex: 1; overflow-y: auto; padding: 14px 12px; background: var(--panel-2);
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.pt-welcome { font-size: 12.5px; color: var(--muted); line-height: 1.85; }
.pt-msg { margin-bottom: 14px; display: flex; flex-direction: column; font-size: 13px; line-height: 1.75; }
.pt-msg.me { align-items: flex-end; }
.pt-msg.ai { align-items: flex-start; }
.pt-av {
  font-size: 10px; color: var(--brand); font-weight: 700; letter-spacing: .5px; margin-bottom: 3px;
}
.pt-bubble {
  max-width: 94%; padding: 9px 12px; border-radius: 12px; word-break: break-word;
  background: var(--panel); border: 1px solid var(--line);
}
.pt-msg.me .pt-bubble {
  background: color-mix(in srgb, var(--brand) 16%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 32%, transparent);
  border-bottom-right-radius: 4px;
}
.pt-msg.ai .pt-bubble { border-bottom-left-radius: 4px; }
.pt-bubble.err { border-color: color-mix(in srgb, #ef5b5b 50%, transparent); color: #ef5b5b; font-size: 12px; }
.pt-time { font-size: 10px; color: var(--muted); margin-top: 3px; }
.pt-x h3, .pt-x h4 { margin: 8px 0 3px; font-size: 13px; }
.pt-x ul { margin: 5px 0; padding-left: 20px; }
.pt-x code { background: rgba(125,145,175,.16); padding: 1px 5px; border-radius: 4px; }
.pt-tag {
  display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px; margin: 0 4px 5px 0;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand);
}
.pt-tag.mini { color: var(--muted); border-color: var(--line); }
.pt-tag.warn { color: #f0a63a; border-color: color-mix(in srgb, #f0a63a 45%, transparent); }
.pt-notice { font-size: 11.5px; color: #f0a63a; margin-bottom: 5px; }
.pt-cite {
  color: var(--brand); cursor: pointer; padding: 0 1px; border-radius: 3px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.pt-cite:hover { background: color-mix(in srgb, var(--brand) 20%, transparent); }
.pt-trace { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pt-trace summary { cursor: pointer; user-select: none; }
.pt-trace > div { padding: 5px 0 0 10px; line-height: 1.7; word-break: break-word; }
.pt-typing .pt-bubble { color: var(--muted); font-size: 12px; }
.pt-dots i {
  display: inline-block; width: 5px; height: 5px; margin-right: 2px; border-radius: 50%;
  background: var(--brand); animation: ptb 1s infinite ease-in-out;
}
.pt-dots i:nth-child(2) { animation-delay: .16s; }
.pt-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes ptb { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* 文献块 */
.pt-refs-in { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.pt-refs-h { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pt-refs-h b { font-size: 11.5px; }
.pt-refs-a { display: flex; gap: 4px; flex-wrap: wrap; }
.pt-refs-a.bar { margin-bottom: 10px; }
.pt-ref { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; }
.pt-ref.hit { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.pt-ref-t { font-size: 12px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.pt-ref-n { color: var(--brand); margin-right: 4px; }
.pt-ref-m { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pt-ref-c { margin-left: 6px; }
.pt-oa { margin-left: 6px; font-size: 10px; color: #35c26a; border: 1px solid rgba(53,194,106,.4); border-radius: 4px; padding: 0 4px; }
.pt-ref-abs { font-size: 11px; color: var(--muted); margin-top: 5px; }
.pt-ref-abs summary { cursor: pointer; }
.pt-ref-f { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.pt-ref-l a { color: var(--brand); font-size: 11px; margin-right: 8px; text-decoration: none; }
.pt-ref-l a:hover { text-decoration: underline; }

/* 内联提示（替代阻塞弹窗） */
.pt-tip {
  margin: 0 12px 8px; padding: 7px 30px 7px 10px; border-radius: 8px; font-size: 11.5px;
  position: relative; line-height: 1.6; flex-shrink: 0;
  background: color-mix(in srgb, #ef5b5b 12%, var(--panel)); border: 1px solid color-mix(in srgb, #ef5b5b 34%, transparent); color: #ef5b5b;
}
.pt-tip.warn { background: color-mix(in srgb, #f0a63a 12%, var(--panel)); border-color: color-mix(in srgb, #f0a63a 34%, transparent); color: #f0a63a; }
.pt-tip.info { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 34%, transparent); color: var(--brand); }
.pt-tip.hidden { display: none; }
.pt-tip-d { margin-top: 4px; color: var(--muted); }
.pt-tip-d summary { cursor: pointer; }
.pt-tip-d > div { margin-top: 3px; word-break: break-word; white-space: pre-wrap; }
.pt-tip-close { position: absolute; right: 6px; top: 5px; background: transparent; border: 0; color: inherit; cursor: pointer; font-size: 12px; }

/* 输入区 */
.pt-foot {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); flex-shrink: 0; background: var(--panel);
}
.pt-foot textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 10px; resize: none; font-size: 13px; line-height: 1.6;
  max-height: 120px; font-family: inherit;
}
.pt-foot textarea:focus { border-color: var(--brand); outline: none; }
.pt-btns { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.pt-spacer { flex: 1; }
.pt-mode { font-size: 11px; color: var(--muted); }
.pt-btns .hidden { display: none; }

/* 覆盖层：历史记录 / 引用文献 */
.pt-overlay {
  position: absolute; inset: 0; z-index: 3; background: var(--panel);
  display: flex; flex-direction: column;
  animation: ptSlide 200ms cubic-bezier(.22,.61,.36,1);
}
.pt-overlay.hidden { display: none; }
@keyframes ptSlide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
.pt-ov-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); font-size: 14px; flex-shrink: 0;
}
.pt-ov-sub { flex: 1; font-size: 11px; color: var(--muted); font-weight: 400; }
.pt-ov-body { flex: 1; overflow-y: auto; padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--panel-2); }
.pt-loading, .pt-empty { font-size: 12px; color: var(--muted); padding: 20px 4px; text-align: center; line-height: 1.8; }
.pt-hg { margin-bottom: 12px; }
.pt-hg-t { font-size: 11px; color: var(--muted); margin: 4px 0 6px; }
.pt-hitem {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin-bottom: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.pt-hitem:hover { border-color: var(--brand); transform: translateX(2px); }
.pt-hitem.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.pt-hi-m { flex: 1; min-width: 0; }
.pt-hi-t { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-hi-s { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-hi-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.pt-hi-time { font-size: 10.5px; color: var(--muted); }
.pt-hi-n { font-size: 10px; color: var(--muted); }
.pt-hi-acts { display: flex; gap: 0; }

/* ---------- 移动端：底部抽屉 ---------- */
@media (max-width: 720px) {
  .pt-fab { width: 56px; height: 56px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .pt-panel {
    top: auto; bottom: 0; right: 0; left: 0; width: 100vw;
    height: min(86vh, 100vh - 48px);
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,.36);
    transform: translateY(101%);
  }
  .pt-panel.open { transform: translateY(0); }
  .pt-grip {
    display: block; width: 38px; height: 4px; border-radius: 999px;
    background: var(--line); margin: 7px auto 1px; flex-shrink: 0;
  }
  .pt-paper { max-width: 46vw; }
  .pt-skills { max-height: 88px; }
  .pt-bubble { max-width: 100%; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .pt-fab, .pt-panel, .pt-mask, .pt-overlay { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* 设置页：论文 AI 导师自检结果 */
.pt-tr { padding: 3px 0; font-size: 12px; line-height: 1.7; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pt-tr .status-dot { flex-shrink: 0; }
.pt-raw { font-size: 11px; line-height: 1.6; max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--panel-2); padding: 10px; border-radius: 8px; }

/* ---------- 登录页（标题居中偏上，帐户/密码表单居中偏下） ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: stretch; justify-content: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(47,107,255,.10), transparent 60%),
    var(--bg);
  overflow: auto;
}
.login-card {
  width: min(420px, 94vw);
  display: flex; flex-direction: column;
  padding: 0 22px;
}
.login-brand {
  margin-top: 16vh;
  text-align: center;
  font-size: 30px; font-weight: 800; letter-spacing: 2px;
  color: var(--text);
}
.login-sub {
  margin-top: 10px; margin-bottom: auto;
  text-align: center;
  font-size: 13px; color: var(--muted);
}
.login-form {
  margin: 24vh 0 10vh;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.login-field input {
  height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  padding: 0 12px; font-size: 15px; outline: none;
}
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.login-btn {
  height: 46px; border-radius: 10px; border: none;
  background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 700; letter-spacing: 4px;
  cursor: pointer; margin-top: 4px;
}
.login-btn:disabled { opacity: .6; cursor: default; }
.login-btn.ghost {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); letter-spacing: 0; font-weight: 600;
}
.login-err { min-height: 18px; font-size: 12.5px; color: var(--err); text-align: center; }
.login-tip { font-size: 11.5px; color: var(--muted); line-height: 1.6; text-align: center; }
@media (max-height: 700px) {
  .login-brand { margin-top: 8vh; }
  .login-form { margin: 14vh 0 6vh; }
}

/* ---------- 文件中心 ---------- */
.file-drop {
  border: 2px dashed var(--line); border-radius: 14px;
  background: var(--panel); padding: 22px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.over { border-color: var(--brand); background: rgba(47,107,255,.05); }
.file-drop-ico { font-size: 26px; }
.file-drop-t { font-size: 14px; font-weight: 600; margin: 6px 0 4px; }
.file-progress {
  height: 8px; border-radius: 999px; background: var(--panel-2);
  overflow: hidden; margin-top: 10px;
}
.file-progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.file-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.file-table th, .file-table td {
  text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.file-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.file-name { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-col-size { width: 90px; white-space: nowrap; }
.file-col-time { width: 165px; white-space: nowrap; color: var(--muted); font-size: 12px; }
.file-col-act { width: 130px; white-space: nowrap; }
.file-col-act .btn { padding: 4px 10px; font-size: 12px; margin-right: 4px; text-decoration: none; }
@media (max-width: 600px) {
  .file-col-time { display: none; }
  .file-name { max-width: 150px; }
}
