﻿:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.brand h1 { margin: 0; font-size: 22px; letter-spacing: 1px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
}
.status.ok { background: #dcfce7; color: #166534; }
.status.rule { background: #fef3c7; color: #92400e; }
.status.err { background: #fee2e2; color: #991b1b; }

.llm-banner {
  max-width: 960px;
  margin: 12px auto 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.llm-banner.warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.llm-banner.ollama-ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.llm-banner .ollama-picker {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: #fffbeb;
  border: 1px dashed #f59e0b;
  border-radius: 8px;
  font-size: 13px;
}
.llm-banner select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
}
.llm-error { color: #dc2626; margin-top: 6px; }

.tabs {
  max-width: 960px;
  margin: 14px auto 0;
  display: flex;
  gap: 8px;
  padding: 0 16px;
}
.tab {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-card h3 { margin: 0 0 6px; font-size: 17px; }
.modal-card label {
  display: block;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.modal-card select, .modal-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fbfcfe;
}
#msStatus { margin-top: 10px; font-size: 13px; min-height: 18px; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

.profile-block h3 {
  margin: 12px 0 6px;
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}
.profile-block h3:first-child { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
}

textarea, input, select, button {
  font: inherit;
  color: inherit;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfcfe;
}
textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
  padding: 6px 14px;
  cursor: pointer;
}
button:hover { background: #f3f4f6; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover { background: #1d4ed8; }
button.ghost { color: var(--muted); }
button.period-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.hint { color: #16a34a; font-size: 13px; }

.empty { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.cat-project { background: #2563eb; }
.cat-goal { background: #16a34a; }
.cat-knowledge { background: #7c3aed; }
.cat-idea { background: #d97706; }
.cat-todo { background: #dc2626; }
.cat-preference { background: #0891b2; }
.cat-general { background: #6b7280; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 3px 10px;
  color: #374151;
}
.chip .count { color: var(--muted); margin-left: 4px; }

ul { list-style: none; margin: 0; padding: 0; }

.summary-list li, .memory-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.summary-list li:last-child, .memory-list li:last-child { border-bottom: none; }
.summary-list .badge { margin-right: 8px; }
.memory-list .kind { font-size: 11px; margin-right: 6px; color: var(--muted); }
.memory-list li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.memory-list .strength { font-size: 11px; color: var(--muted); }
.memory-list .alias { font-size: 11px; color: #9ca3af; }
.pri-core, .pri-temp {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.pri-core { background: #dcfce7; color: #166534; }
.pri-temp { background: #f3f4f6; color: #6b7280; }

.cluster-chip .alias { color: #9ca3af; margin-left: 4px; }

.event-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}
.event-list li:last-child { border-bottom: none; }
.ev {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.ev-decision { background: #7c3aed; }
.ev-change { background: #0891b2; }
.ev-milestone { background: #16a34a; }
.ev-problem { background: #dc2626; }
.event-list .record-time { margin-left: auto; }

.insight-summary { font-size: 14px; }
.insight-row { margin-top: 8px; font-size: 14px; }
.insight-focus {
  margin-top: 8px;
  font-size: 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
}

.question-list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.question-list li:last-child { border-bottom: none; }
.question-text { font-size: 14px; font-weight: 600; }
.question-src { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.question-reason { font-size: 12px; color: #6d28d9; margin: 2px 0 4px; }
.question-method { font-size: 11px; color: #b45309; margin: 2px 0 4px; }
.question-list input { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.answered { font-size: 12px; color: #166534; margin-top: 4px; }

.record-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.record-list li:last-child { border-bottom: none; }
.record-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.record-time { font-size: 12px; color: var(--muted); }
.record-summary { font-size: 14px; font-weight: 500; }
.record-reason { font-size: 12px; color: var(--muted); margin-top: 2px; }
.edit-btn { margin-left: auto; font-size: 12px; padding: 2px 8px; color: var(--muted); }
.edit-box { margin-top: 8px; padding: 8px; background: #fbfcfe; border: 1px dashed var(--line); border-radius: 8px; }
.edit-box textarea { font-size: 13px; }
.record-detail { margin-top: 4px; font-size: 13px; color: var(--muted); }
.record-detail summary { cursor: pointer; color: #9ca3af; font-size: 12px; }
.record-detail p { margin: 6px 0 0; white-space: pre-wrap; }
.record-topics { margin-top: 6px; }
.record-qa { margin-top: 6px; font-size: 12px; color: #374151; }

#reviewBox .stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.stat-chip {
  font-size: 12px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 4px 10px;
}
.review-summary { font-size: 14px; }
.review-action {
  margin-top: 8px;
  font-size: 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
}
.review-why, .insight-why {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.book-list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.book-list li:last-child { border-bottom: none; }
.book-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.book-head strong { font-size: 14px; }
.book-head button { margin-left: auto; }
.book-detail { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.book-detail h4 { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.concept-box {
  margin: 6px 0;
  padding: 8px 10px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.concept-head { display: flex; align-items: center; gap: 8px; }
.concept-badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  flex: none;
}
.concept-badge.badge-core { background: #fde68a; color: #92400e; }
.concept-badge.badge-important { background: #e0e7ff; color: #3730a3; }
.concept-status {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
}
.concept-status.s-learning { background: #fef3c7; color: #92400e; }
.concept-status.s-learned { background: #e0f2fe; color: #075985; }
.concept-status.s-mastered { background: #dcfce7; color: #166534; }
.concept-source { margin-top: 4px; color: #6d28d9; font-size: 12px; }
.concept-plain { margin-top: 3px; color: #166534; font-size: 13px; }
.concept-analogy { margin-top: 3px; color: #7c3aed; font-size: 12px; }
.concept-checks { margin-top: 6px; }
.concept-check-title { font-size: 12px; color: #b45309; }
.concept-check { font-size: 12px; color: #374151; }
.concept-links { margin-top: 6px; }
.concept-link-title { font-size: 12px; color: #075985; }
.concept-explain { margin-top: 2px; color: #374151; }
.concept-link { margin-top: 3px; font-size: 12px; color: #6d28d9; }
.concept-app { margin-top: 3px; font-size: 12px; color: #166534; }
.coverage-review {
  margin: 8px 0;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  font-size: 12px;
}
.coverage-review.method-note { background: #f0fdf4; border-color: #86efac; }
.coverage-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.coverage-head strong { color: #0f766e; }
.coverage-conclusion { color: #374151; margin-bottom: 3px; }
.coverage-missing { margin-top: 4px; }

/* 知识 Wiki（LLM Wiki 模式） */
.wiki-query { margin-top: 8px; }
#wikiAnswer { margin-top: 8px; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.wiki-answer-text { font-size: 13px; color: #1f2937; white-space: pre-wrap; }
.wiki-cites { margin-top: 6px; }
#wikiLintReport { margin-top: 8px; }
.wiki-group-title { margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
.wiki-card { margin: 6px 0; padding: 8px 10px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; }
.wiki-card-head { display: flex; align-items: center; gap: 8px; }
.wiki-card-head strong { font-size: 13px; }
.wiki-card-head .record-time { margin-left: auto; }
.wiki-card-summary { margin-top: 3px; font-size: 12px; color: #4b5563; }
.wiki-detail { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; }
.wiki-detail-content { white-space: pre-wrap; color: #1f2937; }
.wiki-detail-links, .wiki-detail-backlinks { margin-top: 5px; font-size: 12px; color: #6d28d9; }
.wiki-detail-sources { margin-top: 6px; }
.wiki-issue { margin: 6px 0; padding: 6px 8px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; font-size: 12px; }
.wiki-issue-msg { color: #92400e; }
.wiki-log { margin-top: 6px; }
.wiki-log-item { display: flex; gap: 8px; font-size: 12px; color: #374151; padding: 2px 0; }

/* 重复书籍检测 */
.duplicate-panel {
  margin: 8px 0;
  padding: 8px 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
  font-size: 13px;
}
.duplicate-title { color: #c2410c; font-weight: 600; margin-bottom: 4px; }
.duplicate-row { display: flex; gap: 8px; align-items: baseline; margin: 2px 0; }
.duplicate-detail { margin-top: 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
#bookDupGroups { margin-top: 8px; }
.dup-group {
  margin: 6px 0;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
}
.dup-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dup-group-head strong { color: #b91c1c; }
.dup-group-head button { margin-left: auto; }

/* 对话（Chats） */
.chat-list { margin-top: 6px; }
.chat-messages { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { padding: 8px 10px; border-radius: 8px; font-size: 13px; max-width: 90%; }
.chat-user { background: #e0f2fe; align-self: flex-end; }
.chat-ai { background: #f1f5f9; align-self: flex-start; }
.chat-msg-text { white-space: pre-wrap; color: #1f2937; }
.chat-msg .row { margin-top: 4px; }

/* 弹窗与图谱 */
.modal-wide { width: min(920px, 94vw); max-height: 88vh; overflow: auto; }
#graphCanvas { width: 100%; border-radius: 8px; background: #0f172a; cursor: grab; }
#schemaHistory .row { margin: 3px 0; }
.wiki-detail-history { margin-top: 6px; padding: 6px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; }
.slot-row { display: flex; gap: 6px; align-items: center; margin: 5px 0; font-size: 12px; flex-wrap: wrap; }
.slot-row label { flex: 0 0 130px; }
.slot-row select, .slot-row input { flex: 1; min-width: 80px; }

.feynman-learn { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.feynman-step { font-size: 12px; color: #b45309; margin-bottom: 4px; }
.explain-input { font-size: 13px; }
.explain-feedback { margin-top: 8px; padding: 8px 10px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; }
.fb-ok { font-size: 13px; color: #166534; font-weight: 600; }
.fb-warn { font-size: 13px; color: #b45309; font-weight: 600; }
.fb-praise { margin-top: 4px; font-size: 13px; color: #166534; }
.fb-progress { margin-top: 2px; font-size: 13px; color: #075985; }
.fb-text { margin-top: 4px; font-size: 13px; color: #374151; }
.fb-examples { margin-top: 6px; }
.fb-example-title { font-size: 12px; color: #7c3aed; }
.fb-example { margin-top: 2px; font-size: 12px; color: #4c1d95; }
.blindspot-box { margin-top: 6px; }
.blindspot-title { font-size: 12px; color: #dc2626; }
.blindspot-item { font-size: 12px; color: #991b1b; }
.feynman-example { margin-top: 8px; font-size: 13px; }
.feynman-example summary { cursor: pointer; color: #2563eb; font-size: 12px; }
.feynman-history { margin-top: 6px; font-size: 12px; }
.feynman-history summary { cursor: pointer; color: #9ca3af; }
.hist-item { margin-top: 2px; color: #374151; }
.feynman-done { font-size: 13px; color: #166534; font-weight: 600; margin-bottom: 4px; }

.discussion-wrap { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.discussion-msgs {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.msg {
  max-width: 88%;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  white-space: pre-wrap;
}
.msg-user { align-self: flex-end; background: #2563eb; color: #fff; }
.msg-ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: #374151; }
.discussion-input { margin-top: 8px; font-size: 13px; }
.final-eval { margin-top: 10px; padding: 8px 10px; background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; }

.blindspot-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}
.blindspot-list li:last-child { border-bottom: none; }
.blindspot-list button { margin-left: auto; }
.review-item {
  margin: 6px 0;
  padding: 8px 10px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.review-q { font-weight: 500; }
.review-queue-list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.review-queue-list li:last-child { border-bottom: none; }
.review-answer {
  margin-top: 6px;
  font-size: 13px;
  background: var(--accent-soft);
  padding: 8px 10px;
  border-radius: 8px;
}
#bookFile, #bookTitle {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fbfcfe;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 12px;
}

/* 语音输入 / 播报 */
.icon-btn { font-size: 14px; padding: 6px 10px; }
.record-head .icon-btn { margin-left: 6px; }
/* 阶段 5：下一步行动与提醒 */
.reminder-item { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #eee; }
.reminder-text { flex: 1; }
.reminder-due { font-size: 12px; }
.due-overdue { background: #fdecea; color: #c0392b; }
.due-today { background: #fff3cd; color: #b7791f; }
.due-tomorrow { background: #e8f0fe; color: #1a73e8; }
.due-week { background: #e8f5e9; color: #2e7d32; }
.reminder-prio { cursor: pointer; font-weight: 600; }
.prio-high { background: #fdecea; color: #c0392b; }
.prio-medium { background: #fff3cd; color: #b7791f; }
.prio-low { background: #e8f0fe; color: #1a73e8; }
.keep-on { background: #e8f5e9 !important; color: #2e7d32 !important; }