/* 科研工作台界面样式 · 学术温和主题
   契约：不改变 JS/HTML 依赖的类名与 ID，只使用本地样式，不加载任何外部资源。
   结构：设计令牌 → 基础层 → 控件 → 表单 → 外壳 → 导航 → 目录 → 详情 → 组件 → 响应式。 */

/* ---------- 设计令牌 ---------- */
:root {
  color-scheme: light;
  --canvas: #f5f1e8;
  --canvas-accent: #efe9dc;
  --bg: #fffdf8;
  --surface: #faf6ee;
  --surface-strong: #f2ecdf;
  --ink: #2a241d;
  --ink-soft: #3f372d;
  --muted: #5f564a;
  --faint: #675d50;
  --line: #e7dfd0;
  --line-strong: #d8cdb9;
  --control-border: #8c8170;
  --primary: #8a3b2a;
  --primary-deep: #6c2c1e;
  --primary-soft: #f6e9e1;
  --primary-edge: #e2c4b6;
  --ok: #3e6b48;
  --ok-soft: #e9f1e6;
  --warn-soft: #f8efda;
  --danger: #a12f22;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --shadow-xs: 0 1px 0 #3a2a1408;
  --shadow-sm: 0 1px 2px #3a2a140d;
  --shadow: 0 2px 8px #3a2a1412, 0 1px 2px #3a2a140a;
  --shadow-lg: 0 18px 40px #3a2a141a, 0 2px 6px #3a2a140d;
  --focus: #8a3b2a;
  --focus-ring: 0 0 0 3px #8a3b2a24;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font: 15px/1.65 var(--sans);
  color: var(--ink);
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4 { line-height: 1.35; text-wrap: balance; color: var(--ink); font-family: var(--serif); }
h1 { font-size: clamp(1.55rem, 1.25rem + 1vw, 1.95rem); font-weight: 600; letter-spacing: .01em; margin: 0 0 6px; }
h2 { font-size: 1.12rem; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 1rem; font-weight: 600; margin: 28px 0 10px; }
h4 { font-size: .9rem; font-weight: 600; margin: 20px 0 8px; }
p { max-width: 72ch; overflow-wrap: anywhere; margin: 10px 0; }
strong { font-weight: 600; }
small { color: var(--muted); }
a { color: var(--primary); text-underline-offset: 3px; }
ul, ol { padding-left: 20px; }
.eyebrow {
  display: block;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--faint);
  margin: 0 0 8px;
}
.boundary, .nav-footnote { color: var(--muted); font-size: .76rem; line-height: 1.75; }

/* ---------- 焦点与可访问性 ---------- */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.skip { position: fixed; z-index: 20; left: 16px; top: -80px; background: var(--bg); color: var(--ink); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip:focus { top: 12px; }

/* ---------- 按钮 ---------- */
button {
  font: inherit;
  font-size: .86rem;
  font-weight: 500;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
button:hover { background: var(--surface-strong); border-color: var(--control-border); color: var(--ink); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button:disabled:hover { background: var(--bg); border-color: var(--line-strong); color: var(--ink-soft); }
button[aria-busy=true] { cursor: progress; }
form button[type=submit] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
form button[type=submit]:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
form button[type=submit]:disabled { background: var(--primary); color: #fff; }
.workspace-nav button { border-color: transparent; }

/* ---------- 表单控件 ---------- */
form { min-width: 0; }
label { display: block; margin: 14px 0; font-weight: 500; font-size: .84rem; color: var(--ink-soft); }
input, textarea, select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  font: inherit;
  font-size: .92rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
input, select { min-height: 38px; }
textarea { resize: vertical; line-height: 1.7; min-height: 64px; }
input::placeholder, textarea::placeholder { color: #8f8476; }
input:hover, textarea:hover, select:hover { border-color: var(--ink-soft); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--primary); box-shadow: var(--focus-ring); outline: 2px solid transparent; outline-offset: 0; }
input[type=checkbox] { display: inline; width: auto; min-height: 0; margin: 0 8px 0 0; accent-color: var(--primary); vertical-align: middle; }
input[type=file] { overflow: hidden; padding: 7px; background: var(--surface); }
label:has(input[type=checkbox]) { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 6px 18px 16px;
  margin: 16px 0;
}
legend { padding: 2px 6px; font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
form p, fieldset p { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }
pre {
  max-width: 100%;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary-edge);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--ink-soft);
  overflow-x: auto;
}
details { margin: 16px 0; }
summary { cursor: pointer; font-weight: 500; font-size: .86rem; padding: 6px 0; }
summary::marker { color: var(--faint); }

/* ---------- 状态行 ---------- */
[role=status] { font-size: .82rem; color: var(--muted); line-height: 1.7; }
[role=status]:empty { display: none; }
#notice {
  margin: 0 0 14px;
  max-width: none;
  color: var(--muted);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
#notice::before { content: ''; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--primary-edge); }
#notice[data-loading=true]::before {
  width: 12px; height: 12px; border: 2px solid var(--primary-edge); border-top-color: var(--primary);
  background: transparent; animation: loading-turn 900ms linear infinite;
}
main:has(#workspace:not([hidden])) > #notice { margin-left: 252px; }
main:has(#login-view:not([hidden])) > #notice { max-width: 400px; margin: 0 auto 16px; }

/* ---------- 外壳 ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
  padding: 8px 28px;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand-lockup { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark, .login-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font: 600 17px/1 var(--serif);
}
.brand { display: block; font-family: var(--serif); font-size: 1.05rem; font-weight: 600; letter-spacing: .04em; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.environment-label {
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .72rem;
  white-space: nowrap;
}
#logout { min-height: 32px; padding: 4px 12px; font-size: .82rem; background: transparent; }
main { max-width: 1440px; margin: auto; padding: 24px 28px 48px; }

/* ---------- 登录 ---------- */
#login-view { max-width: 400px; margin: clamp(32px, 10vh, 96px) auto 24px; animation: surface-enter 220ms ease-out both; }
.login-card {
  padding: 36px 34px 30px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.login-mark { width: 44px; height: 44px; border-radius: var(--radius); font-size: 24px; margin-bottom: 20px; }
.login-card h1 { font-size: 1.6rem; margin: 0 0 4px; }
.login-help { color: var(--muted); margin: 0 0 20px; font-size: .9rem; }
#login-form label { font-size: .84rem; margin: 14px 0; }
#login-form input { min-height: 42px; }
#login-form button[type=submit] { width: 100%; min-height: 44px; margin-top: 10px; font-size: .95rem; }
#mfa-help { color: var(--faint); font-size: .76rem; margin: 2px 0 12px; max-width: none; }
#login-state { color: var(--primary); font-size: .8rem; margin: 12px 0 0; }
#login-state:empty { display: none; }

/* ---------- 工作区布局 ---------- */
#workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 32px; }
.workspace-content { min-width: 0; animation: surface-enter 200ms ease-out both; }

/* ---------- 导航 ---------- */
.workspace-nav {
  position: sticky;
  top: 80px;
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding: 0 4px 12px 0;
}
#nav-toggle { display: none; }
.nav-heading { display: none; }
.nav-section { margin: 0 0 18px; }
.nav-label {
  font-family: var(--serif);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--faint);
  margin: 0 0 4px;
  padding: 0 10px;
}
.nav-section[data-current=true] .nav-label { color: var(--primary); }
.workspace-nav button {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  text-align: left;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 34px;
  font-size: .9rem;
  font-weight: 400;
  margin: 1px 0;
}
.workspace-nav button:hover { background: var(--surface-strong); color: var(--ink); }
.workspace-nav button[aria-current] {
  background: var(--bg);
  color: var(--primary-deep);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary), 0 1px 2px #3a2a140f;
}
.workspace-nav button[aria-current]:hover { background: var(--bg); color: var(--primary-deep); }
.workspace-nav .nav-group-toggle { color: var(--muted); justify-content: space-between; }
.nav-group-toggle::after {
  content: '';
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-right: 4px;
  opacity: .6;
}
.nav-group-toggle[aria-expanded=true]::after { transform: rotate(45deg); }
.workspace-nav .nav-group-toggle[data-current=true] { color: var(--primary); }
.nav-group-items { margin: 2px 0 4px 12px; padding-left: 6px; border-left: 1px solid var(--line-strong); }
.trial-note { margin: 22px 10px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.trial-note summary { font-size: .76rem; font-weight: 400; color: var(--faint); }
.trial-note .boundary { margin: 6px 0 0; }

/* ---------- 页头工具条 ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 24px;
}
.toolbar > div { min-width: 0; }
.toolbar p { color: var(--muted); font-size: .92rem; margin: 0; max-width: 72ch; }
.toolbar .eyebrow { color: var(--primary); margin-bottom: 6px; font-family: var(--serif); }
#refresh { flex-shrink: 0; font-size: .82rem; }

/* ---------- 两栏与卡片 ---------- */
.columns { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.6fr); gap: 20px; margin-top: 4px; align-items: start; }
.directory-panel, #detail {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow-wrap: anywhere;
}
.directory-panel { overflow: hidden; }
.directory-heading {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.directory-heading h2 { font-size: .95rem; margin: 0; }
#items { padding: 4px; margin: 0; list-style: none; }
#items li + li { border-top: 1px solid var(--line); }
#items button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  padding: 11px 12px;
  background: transparent;
  line-height: 1.6;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
}
#items button:hover { background: var(--surface); color: var(--ink); }
#items button[aria-current] { background: var(--primary-soft); color: var(--primary-deep); box-shadow: inset 2px 0 0 var(--primary); }
#items small { display: block; color: var(--muted); margin-top: 4px; font-size: .78rem; font-weight: 400; line-height: 1.6; }
#next { margin: 4px 12px 14px; font-size: .8rem; max-width: calc(100% - 24px); }
#empty { margin: 0 18px; padding: 28px 0 30px; color: var(--muted); font-size: .88rem; text-align: center; }
.empty-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--faint);
  font: 1.1rem/1 var(--serif);
}
#empty h3 { color: var(--ink); font-size: .95rem; margin: 0 0 6px; }
#empty p { margin: 0 auto; line-height: 1.75; max-width: 34ch; }

/* ---------- 详情面板 ---------- */
#detail { padding: 22px 26px 28px; min-height: 280px; animation: surface-enter 180ms ease-out both; }
#detail > h2 { padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
#detail > p:first-of-type { color: var(--muted); }
#detail p { white-space: pre-wrap; font-size: .9rem; line-height: 1.8; }
#detail h3 { margin-top: 28px; padding-left: 10px; border-left: 2px solid var(--primary); }
#detail h4 { color: var(--muted); font-size: .82rem; letter-spacing: .04em; margin-top: 22px; }
#detail pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#detail form { margin-top: 20px; }
#detail form button { width: auto; margin-right: 8px; }
#detail input[type=checkbox] { display: inline; width: auto; margin-right: 8px; }
#detail label:has(input[type=checkbox]) { display: flex; gap: 10px; align-items: flex-start; }
#detail ul { margin: 12px 0; }
#detail li { margin: 6px 0; overflow-wrap: anywhere; }

/* 通用记录行：动态生成的清单项目 */
.note-claim-row, .event-card, .approval-history-row, .event-history-item,
.translation-observation, .dataset-entry-row {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 16px 0;
  margin: 0;
  min-width: 0;
}
.original-versions li, .claim-anchor-list li, .claim-anchor-directory li, #note-history-list li {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  list-style: none;
}
.original-versions, .claim-anchor-list, .claim-anchor-directory, #note-history-list { list-style: none; padding: 0; margin: 14px 0; }
.event-card-title { font-size: .95rem; font-weight: 620; margin: 0 0 12px; }
.event-card-state { color: var(--muted); font-size: .8rem; }
.event-source, #event-source, #dataset-entry-inputs textarea { background: var(--surface); }
.event-source-text, .claim-anchor-preview, #source-quote, #parse-quote,
.parse-block-text, .operation-text, .note-evidence, .note-history-evidence-result, .policy-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .84rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 10px 0;
}
.parse-block-text { padding: 12px 14px; background: var(--surface); border-radius: var(--radius-sm); max-width: 74ch; }
.briefing-evidence-title { font-size: .84rem; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--line-strong); margin: 8px 0; }
#source-segment, #parse-segment { min-height: 220px; }
#source-text-discard, #source-note-discard, #parse-note-discard, #note-create-discard,
#typeset-new-request, #typeset-discard, #acquisition-discard, #approval-discard,
#weekly-new-request, #project-new-request, #project-reload, #dataset-new-request,
#dataset-create-discard, #dataset-version-new, #dataset-version-discard, #dataset-parent-clear,
#note-reload, #query-reload, #profile-reload, #event-discard,
#approval-budget-panel button, #note-claim-add {
  background: var(--bg);
  color: var(--ink-soft);
}
.approval-open, .cpa-open, .translation-open, .parse-open, .parse-block-open,
.parse-asset-download, .original-download, .dataset-version-open, .source-open,
.notification-open, .discovery-adopt, .discovery-metrics, .document-download,
.translation-download, .recommendation-open, .acquisition-archive-download,
.report-download, .note-download, .note-bundle, .task-delivery-download,
.note-evidence, .note-history-evidence, .note-history-open, .typeset-source-open,
.recommendation-context-text {
  display: block;
  text-align: left;
  overflow-wrap: anywhere;
  margin: 8px 8px 8px 0;
  max-width: 100%;
}
.discovery-adopt { border-color: var(--primary-edge); color: var(--primary); background: var(--primary-soft); }
.discovery-adopt:hover { background: #e4ebfd; border-color: var(--primary); color: var(--primary-deep); }

/* 操作面板 */
#typeset-panel, #runtime-receipt-panel, #acquisition-panel, #recommendation-workspace,
#supplied-text-panel, #translation-panel, #cpa-panel, #approval-panel,
#parse-report-panel, #parse-quote-editor, #event-review-panel, #note-claims-editor,
#note-history, #note-cpa-context, #note-window-panel, #notification-panel {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
#typeset-panel button, #runtime-receipt-panel button, #acquisition-panel button,
#recommendation-workspace button, #original-upload button, #cpa-note-import button {
  width: auto;
  margin: 8px 8px 0 0;
  text-align: left;
  overflow-wrap: anywhere;
}
#document-materials button, #document-directory-load, #dataset-upload-state { margin: 8px 0; }
#translation-directory, #translation-observations, #cpa-directory, #parse-directory,
#approval-directory, #approval-budget-directory, #approval-history-directory, #event-directory,
#daily-directory, #discovery-records, #recommendation-candidates, #source-reader, #cpa-reader,
#cpa-text-reader, #cpa-question-reader, #translation-reader, #parse-reader, #notification-reader,
#approval-reader, #note-history-reader { margin: 14px 0; }
.approval-budget-select { display: block; }
.claim-anchor-directory-select { max-width: 100%; }
#job-refresh { margin-bottom: 8px; }
#dataset-entry-inputs legend { font-weight: 400; }
#dataset-entry-add { margin-top: 12px; }
.operation-panel h3, #supplied-text-panel h3, #parse-report-panel h3, #translation-panel h3,
#cpa-panel h3, #approval-panel h3, #note-claims-editor h3, #event-review-panel h3 { font-size: 1.02rem; }
.operation-card {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.operation-card button, .operation-panel > button { margin: 8px 8px 0 0; }
#translation-panel button, #cpa-panel button, #approval-panel button,
#parse-report-panel button, #event-review-panel button, #note-history button,
#notification-panel button { margin: 8px 8px 0 0; }

/* 表单容器卡片 */
#candidate-view, #weekly-create-view, #project-create-view, #dataset-create-view,
#budget-view, #profile-view, #daily-view, #supervisor-view {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 24px 26px;
  margin: 0 0 22px;
}
#candidate-view > p, #weekly-create-view > p, #project-create-view > p,
#dataset-create-view > p, #budget-view > p, #profile-view > p,
#daily-view > p, #supervisor-view > p { color: var(--muted); font-size: .84rem; }
#candidate-view h2, #weekly-create-view h2, #project-create-view h2,
#dataset-create-view h2, #budget-view h2, #profile-view h2 { font-size: 1.05rem; }
#candidate-form { display: flex; gap: 14px; align-items: flex-end; }
#candidate-form label { flex: 1; margin: 0; }
#candidate-form button { width: auto; white-space: nowrap; margin-bottom: 1px; }
#profile-view { max-width: 780px; }
#profile-form button, #weekly-create-form button, #project-create-form button,
#dataset-create-form button, #dataset-version-form button { width: auto; margin: 10px 8px 0 0; }
#budget-view, #candidate-view, #weekly-create-view, #project-create-view, #dataset-create-view,
#daily-view, #supervisor-view { max-width: 780px; }
#daily-editor button, #supervisor-editor button, #daily-detail button { margin: 8px 8px 0 0; }
#daily-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
#daily-range label { margin: 0; }
#daily-range button { grid-column: 1 / -1; justify-self: start; }
#daily-directory button, .supervisor-task-choice { display: block; text-align: left; margin: 8px 0; }
#daily-detail:not(:empty) { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; overflow-wrap: anywhere; }
#daily-state, #profile-state, #candidate-state, #weekly-create-state, #project-create-state,
#dataset-create-state, #budget-result, #original-download-state,
#typeset-state, #runtime-receipt-state, #approval-state, #acquisition-state,
#document-state, #translation-state, #cpa-state, #parse-state, #event-state,
#note-operation-state, #note-create-state, #note-history-state, #note-claims-state,
.claim-anchor-directory-state, #job-cancel-state, #supervisor-state, #supervisor-detail-state,
#supervisor-link-state, #dataset-version-state, #dataset-upload-state,
#cpa-note-state, #source-reader-state, #source-text-state, #source-cpa-state,
#cpa-note-target-state, #parse-quote-state, #parse-note-state, #discovery-state,
#recommendation-state, #query-state, #notification-state, #task-operation-state,
#project-operation-state, #approval-budget-state { min-height: 0; margin: 10px 0 0; }
.project-association .project-options-next { margin-left: 8px; }
#approval-budget-panel { margin: 16px 0; }
#dataset-versions, #dataset-declaration { margin-top: 22px; }
.dataset-version-open { margin: 10px 0; }
#notification-panel h3 { font-size: 1.02rem; }
#notification-reader { margin-top: 18px; }
#note-cpa-context pre, #note-history-reader pre, #approval-reader p, #cpa-text,
#cpa-question, #cpa-panel p, #translation-panel p, #notification-reader p,
.event-source-text, .source-quote { max-width: 74ch; }




/* ---------- 学术温和主题：表单页细节 ---------- */
#candidate-view, #weekly-create-view, #project-create-view, #dataset-create-view,
#budget-view, #profile-view, #daily-view, #supervisor-view { box-shadow: var(--shadow-sm); border-radius: var(--radius-lg); }
#daily-view > h2, #supervisor-view > h2 { font-size: 1.05rem; margin: 0 0 6px; }
#daily-view > h2 ~ h2 { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
#daily-editor > label { display: inline-block; width: calc(50% - 8px); margin-right: 12px; vertical-align: top; }
#daily-editor > label + label { margin-right: 0; }
#daily-items fieldset { display: grid; grid-template-columns: minmax(0, 1fr) 140px; column-gap: 14px; }
#daily-items legend { grid-column: 1 / -1; }
#daily-items fieldset > label { grid-column: 1 / -1; margin: 8px 0; }
#daily-items fieldset > button { grid-column: 1 / -1; justify-self: start; }
#daily-items textarea { min-height: 52px; }
#daily-range { margin-top: 8px; padding-top: 0; border-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; }
#daily-range button { grid-column: auto; }
#daily-directory button, .supervisor-task-choice { width: 100%; }
#supervisor-editor fieldset { background: transparent; border: 0; padding: 0; margin: 0; }
#candidate-view { max-width: none; }
#candidate-view h2 { margin-bottom: 4px; }
#candidate-view > p { margin-top: 0; }
#candidate-form input { margin-top: 6px; }
.columns:has(#detail) #detail > p:only-of-type { color: var(--faint); }
/* ---------- 动效 ---------- */
@keyframes loading-turn { to { transform: rotate(360deg); } }
@keyframes surface-enter { from { opacity: .72; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 响应式 ---------- */
@media (pointer: coarse) {
  button { min-height: 44px; }
}
@media (max-width: 1100px) {
  #workspace { grid-template-columns: 196px minmax(0, 1fr); gap: 20px; }
  main:has(#workspace:not([hidden])) > #notice { margin-left: 216px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  #detail { min-height: 260px; }
}
@media (max-width: 720px) {
  .app-header { padding: 10px 16px; gap: 12px; }
  .environment-label { display: none; }
  .header-actions { gap: 8px; }
  .brand { font-size: .94rem; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 20px; }
  #logout { font-size: .8rem; padding: 8px 12px; }
  main { padding: 14px 16px 28px; }
  main:has(#workspace:not([hidden])) > #notice { margin-left: 0; }
  #workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .workspace-nav { position: static; max-height: none; padding: 12px 10px; }
  .nav-heading { border-bottom: 0; padding: 2px 8px; }
  .workspace-nav #nav-toggle { display: block; width: auto; flex-shrink: 0; font-size: .75rem; background: var(--surface-strong); border-color: var(--line); margin: 0; min-height: 34px; padding: 6px 12px; }
  #nav-sections { display: none; }
  .workspace-nav[data-expanded=true] #nav-sections { display: block; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
  .toolbar { gap: 12px; padding: 0 0 18px; flex-wrap: wrap; margin-bottom: 18px; }
  #refresh { margin-top: 0; }
  #detail { padding: 20px; }
  #login-view { margin: 16px auto; }
  .login-card { padding: 26px 22px 22px; border-radius: var(--radius-lg); }
  .login-card h1 { font-size: 1.4rem; }
  #candidate-form { display: block; }
  #candidate-form button { margin-top: 12px; }
  #candidate-view, #weekly-create-view, #project-create-view, #dataset-create-view,
  #budget-view, #profile-view, #daily-view, #supervisor-view { padding: 20px; }
  #daily-range { grid-template-columns: minmax(0, 1fr); }
  fieldset { padding: 16px; }
  .directory-heading { padding: 14px 16px; }
  #detail form button { white-space: normal; }
  .columns { margin-top: 18px; }
}
@media (max-width: 460px) {
  main { padding: 12px; }
  h1 { font-size: 1.4rem; }
  .login-card { padding: 22px 18px 18px; }
}

/* ---------- 打印 ---------- */
@media print {
  .app-header, .workspace-nav, #notice, .toolbar button, #login-view, .skip { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  #workspace { display: block; }
  .columns { display: block; }
  .directory-panel, #detail { border: 0; box-shadow: none; }
  #detail { padding: 0; }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  button:active { transform: none; }
}

/* ---------- 学术温和主题：补充 ---------- */
#notice:empty { display: none; }
#directory[data-empty=true] { grid-template-columns: minmax(0, 1fr); }
#directory[data-empty=true] #detail { display: none; }
#directory[data-empty=true] .directory-panel { max-width: 780px; }
#daily-items fieldset > label:first-of-type { grid-column: 1; grid-row: 1; }
#daily-items fieldset > label:last-of-type { grid-column: 2; grid-row: 1; }
#daily-directory > p { color: var(--faint); font-size: .86rem; }

/* ---------- 详情内操作面板：默认收起 ---------- */
#detail > [data-collapsed] { margin: 0; padding: 0; border-top: 1px solid var(--line); }
#detail > [data-collapsed]:last-child { border-bottom: 1px solid var(--line); }
:is(#detail, .workspace-content) > [data-collapsed] > button.panel-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 4px;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: .98rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}
:is(#detail, .workspace-content) > [data-collapsed] > button.panel-toggle:hover { background: var(--surface); color: var(--primary-deep); }
:is(#detail, .workspace-content) > [data-collapsed] > button.panel-toggle::after {
  content: '';
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  opacity: .55;
  flex-shrink: 0;
  margin-right: 6px;
}
:is(#detail, .workspace-content) > [data-collapsed=false] > button.panel-toggle::after { transform: rotate(-135deg) translate(-2px, -2px); }
:is(#detail, .workspace-content) > [data-collapsed=true] > :not(.panel-toggle) { display: none !important; }
#detail > [data-collapsed=false] { padding-bottom: 18px; }
#detail > [data-collapsed] > .panel-toggle + h3 { display: none; }
#detail > [data-collapsed] > .panel-toggle + fieldset > legend { display: none; }
#detail > [data-collapsed] > .panel-toggle + fieldset { margin-top: 4px; }

/* 新建表单卡片：默认收起成一行 */
.workspace-content > [data-collapsed] { padding: 4px 22px; }
.workspace-content > [data-collapsed=false] { padding-bottom: 22px; }
.workspace-content > [data-collapsed] > button.panel-toggle { color: var(--primary-deep); font-size: .95rem; }
.workspace-content > [data-collapsed=false] > button.panel-toggle { border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.workspace-content > [data-collapsed] > .panel-toggle + h2 { display: none; }
#supervisor-upload[data-collapsed=true] + #supervisor-upload-discard { display: none; }
#detail > #supervisor-upload-discard { margin: 0 0 14px; }

/* ---------- 学术温和主题：窄屏导航 ---------- */
@media (max-width: 720px) {
  .workspace-nav { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px 10px; box-shadow: var(--shadow-sm); }
  .nav-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 4px; }
  .nav-heading .eyebrow { margin: 0; font-size: .7rem; letter-spacing: .1em; }
  #nav-current { font-family: var(--serif); font-weight: 600; font-size: .95rem; }
  .workspace-nav #nav-toggle { background: var(--surface-strong); border: 1px solid var(--line-strong); }
  .workspace-nav[data-expanded=true] #nav-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
  .workspace-nav[data-expanded=true] .trial-note { grid-column: 1 / -1; }
  .nav-section { margin: 0 0 10px; }
  #daily-editor > label { display: block; width: auto; margin-right: 0; }
  #daily-items fieldset { grid-template-columns: minmax(0, 1fr); }
  #daily-items fieldset > label:first-of-type, #daily-items fieldset > label:last-of-type { grid-column: 1; grid-row: auto; }
  #daily-range { grid-template-columns: minmax(0, 1fr); }
  .workspace-content > [data-collapsed] { padding: 2px 16px; }
  #detail > [data-collapsed] > button.panel-toggle { padding: 12px 0; }
}

/* ---------- 后台采集状态条与 AI 摘要 ---------- */
.worker-status { margin: 0 0 18px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--primary-edge); border-radius: var(--radius); }
.worker-status p { margin: 0 0 6px; font-size: .88rem; color: var(--ink-soft); max-width: none; }
.worker-status p.worker-warn { color: var(--primary-deep); }
.worker-status button { margin: 4px 8px 4px 0; font-size: .82rem; min-height: 32px; }
.worker-status details { margin: 6px 0 0; }
.worker-status summary { font-size: .82rem; color: var(--muted); }
.worker-status ul { margin: 6px 0 0; font-size: .84rem; color: var(--ink-soft); }
#briefing-digest h3, #detail > h3 { margin-top: 24px; }
.ai-digest { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; }
.ai-digest-label { color: var(--muted); font-size: .78rem !important; }
.briefing-evidence-title a { color: var(--ink); text-decoration-color: var(--primary-edge); }
.briefing-evidence-title a:hover { color: var(--primary-deep); }

/* ---------- AI 助手面板 ---------- */
.assistant-history .assistant-item { border-top: 1px solid var(--line); padding: 10px 0; }
.assistant-history .assistant-item:first-child { border-top: 0; }
#assistant-panel textarea { min-height: 70px; }

/* AI model choice */
.models-table{display:grid;gap:.5rem;margin:1rem 0;max-width:44rem}
.models-row{display:grid;grid-template-columns:8rem minmax(0,1fr) 10rem;gap:.75rem;align-items:center;padding:.6rem .8rem;background:var(--bg);border:1px solid var(--line);border-radius:8px}
.models-name{font-weight:600}
.models-note{color:var(--muted);font-size:.85rem}
.model-picker select{max-width:20rem}
@media (max-width:720px){.models-row{grid-template-columns:1fr}}

/* Literature: list -> detail drill-down with tabs */
#directory[data-mode=drill] { grid-template-columns: minmax(0, 1fr); }
#directory[data-mode=drill]:not([data-drill=open]) #detail { display: none; }
#directory[data-mode=drill][data-drill=open] .directory-panel { display: none; }
#directory[data-mode=drill] #items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 12px; }
#directory[data-mode=drill] #items li { margin: 0; }
#directory[data-mode=drill] #items li > button { height: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.detail-back { margin-bottom: 12px; background: transparent; border: none; color: var(--primary); padding: 4px 0; font-weight: 600; cursor: pointer; }
.detail-back:hover { text-decoration: underline; }
#detail[data-tabs=literature] > h2 { font-size: 1.35rem; line-height: 1.4; margin-bottom: 8px; border-bottom: none; }
.lit-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-strong); color: var(--ink-soft); font-size: .82rem; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--ink-soft); }
.lit-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.lit-tabs button { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.lit-tabs button[aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); }
.lit-pane > * + * { margin-top: 16px; }
.lit-pane > section > h3:first-of-type, .lit-pane > form > h3:first-of-type { font-size: 1rem; }
.lit-pane > section, .lit-pane > form { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--bg); }
.lit-pane .original-versions { list-style: none; padding: 0; margin: 8px 0; }
.lit-pane .original-versions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.lit-pane .original-versions li + li { margin-top: 8px; }
.lit-pane .original-versions li p { margin: 0; }
#directory[data-mode=drill] #items li + li { border-top: 0; }
.lit-pane #yiread-panel > form, .lit-pane #assistant-panel > form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.lit-pane #yiread-panel > form > label { flex: 1 1 160px; }
.lit-pane #assistant-panel > form > label:first-child { flex: 1 1 100%; }
.lit-pane #yiread-panel > form > button, .lit-pane #assistant-panel > form > button { flex: 0 0 auto; }

/* Global search */
.header-search { position: relative; flex: 1 1 auto; max-width: 420px; margin: 0 16px; }
#global-search input { width: 100%; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); font-size: .9rem; }
#search-results { position: absolute; top: 40px; left: 0; right: 0; z-index: 30; max-height: 60vh; overflow: auto; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 8px; }
#search-results h3 { font-size: .78rem; color: var(--muted); margin: 8px 6px 4px; }
#search-results button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; }
#search-results button:hover { background: var(--surface); }
@media (max-width: 720px) { .header-search { margin: 0 8px; } }

/* Overview */
#overview-view { margin-top: 4px; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.overview-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.overview-card h2 { font-size: 1rem; margin: 0 0 10px; }
.overview-card h3 { font-size: .8rem; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.overview-wide { grid-column: 1 / -1; }
.overview-link { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 8px 2px; cursor: pointer; color: var(--ink); }
.overview-link:hover { color: var(--primary); }
.overview-link small { color: var(--muted); white-space: nowrap; }
.overview-empty, .overview-meta { color: var(--muted); font-size: .9rem; }
.overview-run { margin: 6px 0; font-size: .92rem; }

/* Reading status */
.reading-control { display: inline-flex; gap: 4px; margin: 0 0 16px; flex-wrap: wrap; }
.reading-control button { border: 1px solid var(--line-strong); background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer; color: var(--ink-soft); }
.reading-control button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-reading { font-size: .75rem; padding: 1px 8px; }
.chip-reading.chip-reading { background: var(--primary-soft); color: var(--primary-deep); }

/* Bibliography and journal metrics */
.bib-line { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.journal-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.journal-chips .chip { font-size: .74rem; padding: 1px 8px; }
.chip-zone-1 { background: #f3dcd4; color: #7a2516; }
.chip-zone-2 { background: #f6e6d0; color: #7a4a12; }
.chip-zone-3 { background: #e7eedb; color: #3c5a1f; }
.chip-zone-4 { background: #e3e8ee; color: #34465a; }
.chip-if { background: var(--primary-soft); color: var(--primary-deep); }
.chip-open { background: var(--surface-strong); color: var(--muted); }
.bib-detail { margin: -4px 0 12px; }
.bib-detail p { margin: 2px 0; color: var(--ink-soft); font-size: .9rem; }
.journals-intro p { max-width: 760px; color: var(--ink-soft); }
.journals-import { display: grid; gap: 10px; max-width: 760px; margin: 12px 0; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.journals-import textarea, .journals-import input:not([type=file]) { width: 100%; }
.journals-import button { justify-self: start; }
.journals-search { margin: 12px 0 8px; width: min(360px, 100%); }
.journals-table { display: grid; gap: 4px; }
.journals-row { display: grid; grid-template-columns: minmax(0,2fr) 100px minmax(0,1.3fr) 110px 120px 56px; gap: 10px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .88rem; }
.journals-head { background: transparent; border: 0; color: var(--muted); font-weight: 600; font-size: .8rem; }
@media (max-width: 720px) { .journals-row { grid-template-columns: 1fr 1fr; } }

/* Folded audit wording */
details.caveats { margin: 8px 0; color: var(--muted); font-size: .85rem; }
details.caveats > summary { cursor: pointer; color: var(--faint); font-size: .8rem; list-style: none; display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
details.caveats > summary::-webkit-details-marker { display: none; }
details.caveats[open] > summary { margin-bottom: 6px; }
details.caveats p { margin: 4px 0; }

/* Industry feed */
#industry-head { margin-bottom: 16px; }
.feed-digest { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.feed-digest h2 { font-size: 1.05rem; margin: 0 0 10px; }
.feed-digest .ai-digest { white-space: pre-wrap; line-height: 1.7; }
.feed-meta { color: var(--muted); font-size: .85rem; margin: 10px 0 6px; }
.feed-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.feed-tools button { font-size: .85rem; }
.feed-sources { color: var(--muted); font-size: .85rem; }
.feed-sources p { margin: 3px 0; }
#directory[data-mode=drill] #items li.feed-group { grid-column: 1 / -1; font-weight: 600; color: var(--primary-deep); padding: 10px 4px 2px; border: 0; }
#directory[data-mode=drill] #items li.feed-empty { grid-column: 1 / -1; color: var(--muted); padding: 8px 4px; }
.feed-others button { background: transparent; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 6px 12px; color: var(--muted); cursor: pointer; }
.feed-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.feed-title { font-weight: 500; line-height: 1.45; }
.chip-score { font-size: .72rem; padding: 1px 8px; }
.chip-score-3 { background: var(--ok-soft); color: var(--ok); }
.chip-score-2 { background: var(--surface-strong); color: var(--ink-soft); }

/* ---------- 待办 ---------- */
#todos-view { max-width: 860px; }
.todo-add { display: grid; gap: 8px; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.todo-add textarea { width: 100%; resize: vertical; font: inherit; border: 0; background: transparent; padding: 4px; }
.todo-add textarea:focus { outline: none; }
.todo-add:focus-within { border-color: var(--primary-edge); box-shadow: var(--focus-ring); }
.todo-add-row { display: flex; align-items: center; gap: 12px; }
.todo-ai-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); margin: 0; }
.todo-hint { margin-left: auto; color: var(--faint); font-size: .8rem; }
.todo-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 18px 0 6px; border-bottom: 1px solid var(--line); }
.todo-tabs button { border: 0; background: none; border-radius: 0; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; box-shadow: none; }
.todo-tabs button[aria-selected="true"] { color: var(--primary-deep); border-bottom-color: var(--primary); font-weight: 600; }
.todo-head { color: var(--faint); font-size: .85rem; margin: 6px 0 4px; }
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.todo-item > input[type="checkbox"] { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.todo-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.todo-title { text-align: left; border: 0; background: none; padding: 0; font: inherit; font-size: 1rem; color: var(--ink); box-shadow: none; cursor: text; }
.todo-item.is-done .todo-title { color: var(--faint); text-decoration: line-through; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); }
.todo-meta .chip { font-size: .75rem; padding: 1px 8px; }
.chip-overdue { background: #f6dcd6; color: var(--danger); }
.chip-origin-supervisor { background: var(--primary-soft); color: var(--primary-deep); }
.todo-detail { white-space: pre-line; color: var(--muted); font-size: .88rem; margin: 2px 0 0; }
.todo-ai-state { color: var(--faint); }
.todo-suggestion { margin-top: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft); font-size: .9rem; }
.todo-suggestion p { margin: 0 0 4px; }
.todo-suggestion button { margin: 6px 8px 0 0; }
.todo-edit { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.todo-edit label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.todo-original { color: var(--faint); font-size: .82rem; margin: 0; }
.todo-edit button { justify-self: start; display: inline-block; margin-right: 8px; }
.danger-quiet { color: var(--danger); }
.todo-empty { padding: 28px 4px; color: var(--faint); }
.todo-quick input { width: 100%; margin-bottom: 8px; }
#weekly-draft-view { max-width: 860px; margin-bottom: 24px; }
.weekly-pick { display: flex; gap: 12px; align-items: end; margin-bottom: 8px; }
@media (max-width: 720px) { .todo-hint { display: none; } }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.todo-edit label, .weekly-pick label { margin: 0; }

/* ---------- PDF 阅读器（pdf.js 文字层规则摘自 pdf.js 4.10.38 viewer.css，Apache-2.0） ---------- */
.reader-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; border-bottom: 1px solid var(--line); }
.reader-bar select { width: auto; }
.reader-zoom { min-width: 3.2em; text-align: center; color: var(--muted); font-size: .85rem; }
.reader-state { color: var(--faint); font-size: .84rem; }
.reader-layout { display: flex; gap: 16px; align-items: flex-start; }
.reader-pages { flex: 1; min-width: 0; overflow-x: auto; display: grid; gap: 14px; justify-items: center; padding: 8px 0 24px; background: var(--surface-strong); border-radius: var(--radius); max-height: 80vh; overflow-y: auto; }
.reader-page { position: relative; background: #fff; box-shadow: var(--shadow); }
.reader-page canvas { display: block; }
.reader-page-no { position: absolute; top: 4px; right: -28px; font-size: .75rem; color: var(--faint); }
.reader-side { width: 300px; flex: none; max-height: 80vh; overflow-y: auto; display: grid; gap: 10px; align-content: start; }
.hl-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.hl { position: absolute; mix-blend-mode: multiply; border-radius: 2px; }
.hl-yellow { background: #ffe86b99; } .hl-green { background: #9be3a199; } .hl-blue { background: #9cc8ff99; } .hl-red { background: #ff9c9c99; }
.hl-card { border-left: 4px solid #f2d33a; padding: 6px 8px; background: var(--bg); border-radius: var(--radius-sm); display: grid; gap: 6px; }
.hl-card-green { border-left-color: #59b864; } .hl-card-blue { border-left-color: #5b9be8; } .hl-card-red { border-left-color: #e06666; }
.hl-quote { text-align: left; border: 0; background: none; padding: 0; font-size: .86rem; color: var(--ink-soft); }
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 2; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(0 0 255 / 0.25); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
@media (max-width: 900px) { .reader-layout { flex-direction: column; } .reader-side { width: 100%; } }

/* ---------- 引用网络、筛选、LetPub ---------- */
.citation-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.citation-meta { margin: 0; color: var(--muted); font-size: .88rem; }
.citation-group { margin: 10px 0; }
.citation-group summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.citation-group ul { list-style: none; padding: 0; margin: 0; }
.citation-item { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; justify-items: start; }
.citation-title { margin: 0; color: var(--ink); }
.citation-item small { color: var(--muted); }
.chip-new { background: var(--ok-soft); color: var(--ok); font-size: .72rem; padding: 0 7px; }
.lit-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.lit-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lit-filter-chips button { min-height: 30px; padding: 4px 12px; border-radius: 999px; font-size: .82rem; }
.lit-filter-chips button[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-edge); color: var(--primary-deep); }
.lit-export { margin-left: auto; }
.letpub-link { font-size: .84rem; color: var(--primary); }
.bib-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.citation-item button { min-height: 28px; padding: 3px 10px; font-size: .8rem; }
.todo-edit-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.todo-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.todo-edit-actions button { margin: 0; }
.todo-edit-actions .danger-quiet { margin-left: auto; }

/* =====================================================================
   主题：方向 A · 清爽理工（2026-10-23 选定）
   白底、单一无衬线字体、蓝色强调；去掉嵌套边框与阴影，用留白和细分隔线分区。
   作为最后一层覆盖：只改令牌和外观，不改布局契约与类名。
   ===================================================================== */
:root {
  --canvas: #ffffff;
  --canvas-accent: #f6f8fa;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-strong: #eef1f4;
  --ink: #1f2328;
  --ink-soft: #30363d;
  --muted: #57606a;
  --faint: #636c76;
  --line: #eaeef2;
  --line-strong: #d0d7de;
  --control-border: #7d8590;
  --primary: #0b5cd5;
  --primary-deep: #084298;
  --primary-soft: #e7f0fd;
  --primary-edge: #b6d0f7;
  --ok: #1a7f37;
  --ok-soft: #dafbe1;
  --warn-soft: #fff4d6;
  --danger: #b42318;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: 0 1px 3px #1f232814;
  --shadow-lg: 0 8px 24px #1f23281f;
  --focus: #0b5cd5;
  --focus-ring: 0 0 0 3px #0b5cd533;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  font: 15px/1.6 var(--sans);
}
h1 { font-weight: 600; letter-spacing: 0; font-size: clamp(1.4rem, 1.2rem + .7vw, 1.65rem); }
h2 { font-size: 1.02rem; }
.eyebrow { letter-spacing: 0; font-size: .78rem; }

/* 外壳与导航：浅灰侧栏，选中项为淡蓝底 */
.app-header { background: #ffffff; border-bottom: 1px solid var(--line); }
.brand { letter-spacing: 0; }
.workspace-nav { background: var(--surface); border-radius: var(--radius-lg); padding: 14px 8px; top: 76px; }
.nav-label { letter-spacing: 0; font-weight: 500; font-size: .76rem; color: var(--muted); }
.nav-section[data-current=true] .nav-label { color: var(--muted); }
.workspace-nav button:hover { background: var(--surface-strong); }
.workspace-nav button[aria-current], .workspace-nav button[aria-current]:hover {
  background: var(--primary-soft); color: var(--primary); box-shadow: none;
}
.nav-group-items { border-left-color: var(--line-strong); }
.toolbar { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.toolbar .eyebrow { color: var(--muted); }

/* 卡片：只保留一层细边框，去阴影；内部面板不再套框 */
.directory-panel, #detail { border-color: var(--line); box-shadow: none; }
#detail > h2 { border-bottom: 0; padding-bottom: 4px; font-size: 1.2rem; }
#detail h3 { padding-left: 0; border-left: 0; }
fieldset { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 8px 0 4px; }
legend { padding: 0 8px 0 0; letter-spacing: 0; }
.operation-card { background: var(--surface); border: 0; box-shadow: none; }
.lit-pane > section, .lit-pane > form { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 14px 0 4px; background: transparent; }
.lit-pane > :first-child { border-top: 0; padding-top: 0; }
#candidate-view, #weekly-create-view, #project-create-view, #dataset-create-view,
#budget-view, #profile-view, #daily-view, #supervisor-view { box-shadow: none; border-color: var(--line); }
pre { border: 0; border-left: 3px solid var(--primary-edge); background: var(--surface); }
#items button[aria-current] { box-shadow: inset 2px 0 0 var(--primary); }

/* 控件 */

form button[type=submit], button.primary { background: var(--primary); border-color: var(--primary); }
.chip { border-radius: var(--radius-xs); }
.reading-control button { border-radius: var(--radius-sm); }
.lit-filter-chips button { border-radius: var(--radius-sm); }
.lit-tabs button { font-weight: 500; }
.lit-tabs button[aria-selected=true] { font-weight: 600; }

/* 概览：去卡片框，行业要点用浅灰底块 */
.overview-grid { gap: 32px 40px; }
.overview-card { border: 0; padding: 0; background: transparent; }
.overview-card h2 { font-size: .98rem; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.overview-card.overview-wide { background: var(--surface); border-radius: var(--radius-lg); padding: 18px 22px; }
.overview-card.overview-wide h2 { border-bottom: 0; }
.feed-digest { background: var(--surface); border: 0; border-radius: var(--radius-lg); }

/* 待办与周报 */
.todo-add { box-shadow: none; border-color: var(--line-strong); }
.todo-suggestion { background: var(--primary-soft); }
.chip-origin-supervisor { background: var(--primary-soft); color: var(--primary-deep); }
.chip-overdue { background: #fdecea; color: var(--danger); }
.chip-zone-1 { background: #fdecea; color: #a8201a; }
.chip-if { background: var(--surface-strong); color: #344054; }
.chip-reading.chip-reading { background: var(--primary-soft); color: var(--primary-deep); }

/* 登录 */
.login-card { box-shadow: var(--shadow-lg); border-color: var(--line); }
.overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-card.overview-wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .overview-grid { grid-template-columns: minmax(0, 1fr); } .workspace-nav { border-radius: 0; } }
input::placeholder, textarea::placeholder { color: #6e7781; }
.wechat-paste { margin-top: 16px; padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.wechat-paste h2 { margin: 0 0 4px; }
.wechat-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wechat-form > input[type=url] { flex: 3 1 320px; }
.wechat-form > input:not([type]) { flex: 1 1 160px; }
.wechat-form > button { flex: 0 0 auto; }
.wechat-manual { flex: 1 1 100%; margin: 4px 0 0; }
.wechat-manual input, .wechat-manual textarea { display: block; width: 100%; margin-top: 8px; }
.wechat-list { list-style: none; padding: 0; margin: 10px 0 0; }
.wechat-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.wechat-title { font-size: .9rem; color: var(--ink); }
button.wechat-title { border: 0; background: none; padding: 0; min-height: 0; text-align: left; color: var(--primary); }
.wechat-item small { color: var(--muted); }
.wechat-error { flex: 1 1 100%; color: var(--danger) !important; }
.wechat-item button:not(.wechat-title) { min-height: 28px; padding: 2px 10px; font-size: .8rem; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.topic-card { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.topic-card h3 { margin: 0 !important; padding: 0 !important; border: 0 !important; font-size: .95rem; display: flex; justify-content: space-between; gap: 8px; }
.topic-card h3 span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.topic-card p { margin: 0; font-size: .88rem; line-height: 1.65; color: var(--ink-soft); }
.topic-card > button { align-self: flex-start; min-height: 28px; padding: 2px 10px; font-size: .8rem; }
.topic-card ul { list-style: none; padding: 0; margin: 4px 0 0; }
.topic-card li { padding: 5px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.topic-item { border: 0; background: none; padding: 0; min-height: 0; text-align: left; color: var(--primary); font-size: .85rem; }
.feed-rules { margin: 10px 0 0; }
.feed-rule-row { display: flex; flex-wrap: wrap; gap: 16px; }
.feed-rule-row label { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.feed-rule-row select { width: auto; }
.feed-source-list { list-style: none; padding: 0; margin: 6px 0 0; columns: 2 280px; }
.feed-source-list li { break-inside: avoid; padding: 4px 0; display: flex; flex-direction: column; }
.feed-source-list label { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 400; }
.feed-source-list small { margin-left: 24px; }
.pdf-overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; padding: 12px 20px; box-sizing: border-box; overflow: auto; }
.pdf-overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pdf-overlay .reader-pages { max-height: none; }
.pdf-overlay .reader { flex: 1; }

/* ---------- 文献订阅 ---------- */
#subscription-view { max-width: 920px; }
.sub-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--surface); border-radius: var(--radius-lg); }
.sub-head .feed-meta { margin: 0; }
.sub-settings { margin: 14px 0; }
.sub-settings > summary { font-size: .9rem; color: var(--ink-soft); }
.sub-form { display: grid; gap: 10px; padding: 10px 0; }
.sub-form label { margin: 0; display: grid; gap: 4px; }
.sub-journals { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; margin: 6px 0 10px; }
.sub-journals label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.sub-form > button { justify-self: start; }
.sub-alerts h2 { font-size: .95rem; margin: 10px 0 4px; }
.sub-list { list-style: none; padding: 0; margin: 8px 0 0; }
.sub-item { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.sub-title { margin: 0; font-size: .98rem; font-weight: 500; color: var(--ink); }
.sub-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; }
.sub-reason { color: var(--ink-soft); }
.sub-match { color: var(--faint); }
.sub-item details { margin: 0; }
.sub-item details p { font-size: .86rem; color: var(--ink-soft); margin: 4px 0; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sub-actions button { min-height: 30px; padding: 3px 12px; font-size: .82rem; }
.sub-actions a { font-size: .84rem; }
.sub-more { margin: 12px 0; }
