/* Shared colors and typography. Use these tokens in future modules. */
:root {
  --bg: #fbfcf9;
  --card: #ffffff;
  --card-strong: #ffffff;
  --surface: #f3f6f0;
  --surface-raised: #f8faf5;
  --text: #223e39;
  --muted: #5e7065;
  --border: #dce4da;
  --border-strong: #bacdbf;
  --accent: #28604f;
  --accent-hover: #1e4c3e;
  --accent-soft: #eaf2e8;
  --accent-soft-2: #f3f7ef;
  --success-soft: #edf5ed;
  --green: #47745a;
  --orange: #9b753e;
  --sidebar: #f1f5ed;
  --code-bg: #f7f9f4;
  --code-panel: #eff3eb;
  --code-text: #273e33;
  --shadow: 0 12px 30px rgba(35,64,47,.06);
  --shadow-soft: 0 4px 16px rgba(35,64,47,.035);
  --accent-rgb: 40,96,79;
  --ink-rgb: 35,64,47;
  --line-rgb: 220,228,218;
  --reader-code-font-size: 17px;
  --reader-note-font-size: 16.8px;
  --reader-line-height: 1.8;
  --graph-innovation: #77794f;
  --graph-innovation-bg: #f2f2e5;
  --graph-innovation-border: #d8d9bb;
  --graph-method: #47745a;
  --graph-method-bg: #edf4e9;
  --graph-method-border: #c5d8be;
  --graph-mechanism: #9b753e;
  --graph-mechanism-bg: #f8f2e5;
  --graph-mechanism-border: #e6d6b7;
  --graph-system: #527e7a;
  --graph-system-bg: #edf4f1;
  --graph-system-border: #c5dbd5;
  --graph-direction: #a16d59;
  --graph-direction-bg: #f8eeea;
  --graph-direction-border: #e6cdc2;
}
body { background:var(--bg); color:var(--text); font-family:Inter,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; font-size:16px; line-height:1.7; -webkit-font-smoothing:antialiased; }
.hidden { display:none !important; }
::selection { background:#d3e6cf; color:#1c4233; }
a { color:var(--accent); }
button,input,select,textarea { font:inherit; }
button,.secondary { min-height:44px; padding:11px 18px; border:1px solid transparent; border-radius:10px; background:var(--accent); color:#fff; font-size:16px; font-weight:650; line-height:1.5; box-shadow:none; }
button:hover:not(:disabled),.menu-refresh:hover { background:var(--accent-hover); box-shadow:none; }
button:disabled { opacity:.55; box-shadow:none; }
.secondary,.ghost-btn,.ghost-btn.compact,.reader-settings summary,.manual-range summary { background:var(--card); border-color:var(--border); color:var(--accent); box-shadow:none; }
.secondary:hover,.ghost-btn:hover:not(:disabled),.ghost-btn.compact:hover:not(:disabled),.reader-settings summary:hover,.manual-range summary:hover { background:var(--accent-soft); color:var(--accent-hover); border-color:var(--border-strong); box-shadow:none; }
button.secondary:hover:not(:disabled) { background:var(--accent-soft); color:var(--accent-hover); border-color:var(--border-strong); }
button.active-toggle.secondary,.graph-actions button.active-toggle { background:var(--accent); color:#fff; border-color:var(--accent); box-shadow:none; }
button.active-toggle.secondary:hover:not(:disabled) { background:var(--accent-hover); color:#fff; }
input,textarea,select { min-width:0; background:var(--card); color:var(--text); border-color:var(--border); border-radius:10px; font-size:16px; line-height:1.6; }
input:not([type=checkbox]):not([type=radio]),select { min-height:44px; }
input::placeholder,textarea::placeholder { color:#738274; opacity:1; }
input[type=checkbox],input[type=radio] { accent-color:var(--accent); }
input::file-selector-button { background:var(--surface); color:var(--accent); border:1px solid var(--border); border-radius:6px; padding:5px 10px; margin-right:9px; font:inherit; }
input:focus,select:focus,textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(var(--accent-rgb),.11); }
a:focus-visible,button:focus-visible,summary:focus-visible { outline:3px solid #8cab91; outline-offset:4px; }
label { color:var(--muted); font-size:15px; font-weight:550; }
.eyebrow { padding:0; border-radius:0; background:transparent; color:var(--accent); font-size:13px; font-weight:700; letter-spacing:.12em; }
.muted,.empty { color:var(--muted); }
.card,.context-card,.chat-main { border-color:var(--border); box-shadow:none; backdrop-filter:none; }
.card-head,.pane-title { background:var(--card); border-color:var(--border); }
.card-head { padding:24px; }
.card h2 { font-size:26px; font-weight:700; letter-spacing:-.02em; }
.card h3 { font-size:20px; font-weight:650; }
.card p { line-height:1.8; }
.hint,.subtle,.connection-help { font-size:14px; line-height:1.85; }

/* Common navigation and title hierarchy. */
.global-menu { background:var(--bg); border-bottom:1px solid var(--border); min-height:78px; padding:16px 30px; gap:6px; flex-wrap:wrap; }
.global-menu a { color:var(--muted); border-radius:8px; font-size:16px; font-weight:550; padding:8px 12px; white-space:nowrap; }
.global-menu a:hover,.global-menu a.active { background:var(--accent-soft); color:var(--accent); }
.global-menu .global-brand { display:inline-flex; align-items:center; gap:11px; margin-right:auto; padding:0 20px 0 0; color:var(--text); font-size:20px; font-weight:750; }
.global-menu .global-brand:hover { background:transparent; }
.global-brand span,.brand-mark { display:grid; place-items:center; width:44px; height:44px; background:var(--accent); color:white; border-radius:11px; font:700 27px Georgia,serif; }
.topbar,.chat-topbar { padding:34px 32px 30px; background:var(--bg); color:var(--text); box-shadow:none; border-bottom:1px solid var(--border); }
.topbar h1,.chat-topbar h1,.hero h1 { font-size:40px; font-weight:750; line-height:1.35; letter-spacing:-.035em; margin:8px 0 14px; }
.topbar p,.chat-topbar p,.hero p { color:var(--muted); font-size:17px; line-height:1.85; }
.topbar p,.chat-topbar p { max-width:760px; }
.status-box,.chat-cost-box { min-width:260px; gap:10px; }
.status,.chat-status { color:var(--accent); background:var(--accent-soft); border:1px solid var(--border); border-radius:8px; font-size:14px; padding:7px 12px; }
.llm-status,.chat-llm-status { color:var(--muted); font-size:14px; line-height:1.7; }
.model-meta { color:var(--muted); font-size:14px; width:100%; max-width:350px; }
.model-meta summary { cursor:pointer; text-align:right; padding:5px 0; }
.model-meta[open] summary { margin-bottom:10px; }
.cost-panel { min-width:0; background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:10px; }
.cost-panel span,.token-usage { color:var(--muted); font-size:14px; }
.cost-panel strong { font-size:16px; }
.ghost-link { color:var(--accent); background:var(--card); border:1px solid var(--border); font-size:14px; }

/* Research hub. */
.side-menu { background:var(--sidebar); color:var(--text); border-right:1px solid var(--border); overflow-y:auto; }
.brand { border-color:var(--border); padding-bottom:22px; }
.brand-mark { flex-shrink:0; }
.brand strong { font-size:19px; }
.brand span { color:var(--muted); font-size:13px; line-height:1.6; }
.side-menu nav { gap:5px; }
.side-menu a { color:var(--muted); font-size:16px; font-weight:550; border-radius:9px; }
.side-menu a:hover,.side-menu a.active { background:#e0ebdb; color:var(--accent); border-color:#d4e2cf; }
.side-menu a.active { box-shadow:inset 3px 0 0 var(--accent); font-weight:700; }
.menu-refresh { background:var(--accent); color:white; font-size:15px; }
.menu-note { color:var(--muted); font-size:14px; line-height:1.8; }
.hero { padding:34px 32px 28px; }
.controls { padding:20px 24px; gap:14px; grid-template-columns:145px minmax(170px,1fr) auto auto; }
.compact-controls { grid-template-columns:minmax(0,1fr) 210px auto; }
.radar-controls { grid-template-columns:145px minmax(200px,1fr) auto auto; }
.cost-row,.source-status { font-size:14px; line-height:1.85; }
.source-status { margin:16px 24px; color:var(--muted); background:var(--surface); }
.daily-actions { margin:22px 24px; }
.hub-daily { margin:0 24px 28px; padding:26px; background:var(--surface-raised); border-color:var(--border); }
.hub-daily .daily-title { font-size:30px; font-weight:750; line-height:1.6; }
.hub-page { scroll-margin-top:250px; }
.radar-subtitle { margin:26px 24px 14px; }
.trend-details { margin:20px 24px; }
.trend-details summary { color:var(--accent); font-size:16px; font-weight:600; }
.candidate-panel,.import-box,.direct-upload-box,.graph-legend,.graph-tabs-note { background:var(--surface-raised); }
.panel-head { padding:22px 24px; }
.papers-list { padding:20px 24px; gap:18px; }
.paper-card { padding:22px; border-radius:14px; }
.paper-card:hover { border-color:var(--border-strong); box-shadow:var(--shadow-soft); }
.paper-title { color:var(--text); font-size:20px; font-weight:700; line-height:1.6; margin-bottom:12px; }
.paper-meta { color:var(--muted); font-size:14px; line-height:1.8; }
.paper-abstract { color:var(--muted); font-size:16px; line-height:1.85; }
.tag,.range-pill { color:var(--accent); background:var(--accent-soft); font-size:14px; font-weight:600; }
.paper-actions button,.paper-actions a.secondary { min-height:40px; padding:8px 13px; font-size:15px; }
.library-connect-banner { margin:20px 24px; padding:22px; }
.library-import-options { margin:0 24px 20px; border:1px solid var(--border); border-radius:10px; overflow:hidden; }
.library-import-options > summary { padding:14px 18px; color:var(--accent); font-size:16px; font-weight:600; cursor:pointer; background:var(--surface-raised); }
.library-connect-banner strong,.upload-intro strong,.import-box strong { color:var(--text); font-size:18px; }
.library-connect-banner p,.direct-upload-box .upload-intro p,.import-box p { font-size:15px; line-height:1.8; }
.import-box,.direct-upload-box { padding:22px 24px; }
.inline-check { font-size:15px; color:var(--muted); }
.detail-title { color:var(--text); font-size:30px; font-weight:700; line-height:1.55; }
.paper-detail { padding:26px; font-size:17px; line-height:1.9; }
.detail-section { padding:20px; background:var(--surface-raised); }
.detail-section h3,.report-section h3 { font-size:20px; color:var(--accent); }
.report-title,.related-title,.analysis-title { color:var(--text); font-size:24px; line-height:1.6; }
.graph-analysis .analysis-title { font-size:24px; }
.related-rank { font-size:14px; }
.related-reason { font-size:16px; line-height:1.85; }
.report-box,.related-synthesis,.graph-analysis { font-size:17px; line-height:1.85; }
.connections-card .connection-section { padding:28px 24px; }
.connection-heading h3 { font-size:24px; }
.connection-heading p,.connection-result { font-size:16px; }
.connection-icon { color:var(--accent); background:var(--accent-soft); }
.connection-section .controls { grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); padding:16px 0; }
.connection-section .connection-buttons { margin-top:22px; }
.daily-stages { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin:20px 0; }
.daily-stages > div { background:var(--surface-raised); border:1px solid var(--border); border-radius:12px; padding:18px; }
.daily-stages span { color:var(--accent); font-size:14px; margin-right:9px; }
.daily-stages strong { font-size:17px; }.daily-stages p { font-size:15px; margin-top:8px; }
.candidate-standfirst { padding:18px; background:var(--surface); border-left:3px solid var(--accent); margin:18px 0 !important; }

/* Strong action hierarchy, shared across research modules. */
button:not(.secondary):not(.ghost-btn):not(.active-toggle),.menu-refresh { border-color:#1f513f;box-shadow:0 4px 0 #1a43371a,0 5px 12px #23402f12;font-weight:750; }
button:not(.secondary):not(.ghost-btn):hover:not(:disabled),.menu-refresh:hover { box-shadow:0 5px 15px #23402f25; }
.secondary,.ghost-btn { border-color:#9db4a3;border-width:1.5px;font-weight:700; }
.card-head { border-bottom:2px solid #c6d8c6; }
.card-head h2,.connection-heading h3 { color:#204f3f; }
.daily-stages>div { border-top:3px solid var(--accent);background:#f0f5e9; }
.daily-stages span { display:inline-grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--accent);color:#fff;font-weight:750;font-size:12px; }
.graph-stats,.graph-tabs-note,.graph-legend span { font-size:15px; }
.map-paper-title { font-size:21px; }
.map-paper-meta,.map-paper-summary,.map-paper-sub { font-size:15px; line-height:1.8; }
.concept-card { font-size:16px; }
.graph-wrap,#knowledgeGraph.knowledge-graph,.knowledge-graph,.network-graph { background:var(--surface-raised); }
.concept-card em { color:var(--accent); font-size:13px; }
.network-paper-title { font-size:15px; }
.network-paper-desc { font-size:13px; }
.network-concept-label { font-size:14px; }
.network-graph { width:1500px; min-width:1500px; height:900px; min-height:900px; }

/* Chat prioritizes reading and the source papers. */
.chat-workspace { grid-template-columns:minmax(280px,340px) minmax(0,1fr); gap:22px; padding:26px 32px; }
.context-card { padding:22px; }
.context-card h3 { font-size:20px; color:var(--text); font-weight:700; }
.context-body { font-size:16px; line-height:1.9; }
.context-project-id { color:var(--muted); font-size:14px; overflow-wrap:anywhere; }
.context-badge { font-size:14px; }
.paper-search-input,.paper-item { font-size:15px; }
.paper-list { max-height:340px; }
.paper-item { display:grid; grid-template-columns:18px minmax(0,1fr); align-items:start; gap:4px 10px; padding:12px 10px; }
.paper-item input[type=checkbox] { grid-column:1; grid-row:1 / span 2; margin-top:6px; }
.paper-item-title { grid-column:2; white-space:normal; line-height:1.65; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.paper-item-meta { grid-column:2; }
.paper-item-meta,.paper-chip { font-size:14px; }
.paper-item.selected { border-color:var(--border-strong); }
.paper-chip button { min-height:28px; }
.paper-chip button:hover:not(:disabled) { background:var(--accent-soft); color:var(--graph-direction); }
.chat-messages { background:var(--surface-raised); padding:28px; }
.chat-empty { padding:55px 26px; }
.chat-empty-icon { font-size:24px; font-weight:750; opacity:1; color:var(--accent); background:var(--accent-soft); border-radius:14px; padding:12px 17px; }
.chat-empty-title { font-size:28px; font-weight:700; margin-top:12px; }
.chat-empty-text { font-size:17px; line-height:1.95; max-width:600px; }
.chat-message { max-width:86%; font-size:17px; line-height:1.9; padding:20px 22px; }
.chat-message.user { background:var(--accent-soft); color:var(--text); border-color:var(--border-strong); }
.chat-message-role,.chat-meta { font-size:14px; }
.chat-message-content code,.chat-message-content pre { font-size:15px; line-height:1.8; }
.chat-message-content pre { background:var(--code-bg); color:var(--code-text); border:1px solid var(--border); }
.chat-input-area { padding:18px 24px 22px; }
.chat-input-row textarea { font-size:17px; line-height:1.8; padding:14px 16px; }
.chat-input-row button { font-size:17px; background:var(--accent); box-shadow:none; min-height:50px; }
.chat-input-row button:hover:not(:disabled) { background:var(--accent-hover); box-shadow:none; }
.chat-thinking { color:var(--accent); font-size:15px; background:var(--accent-soft); }

/* Reader: light paper canvas, sage selection, and larger explanations. */
.setup { padding:24px; margin:24px; }
.workspace { gap:20px; }
.pane-title { padding:20px; }
.pane-title h2,.section-head h3 { font-size:22px; font-weight:700; line-height:1.6; }
.pane-title > div:first-child { min-width:0; }
#currentFileTitle { overflow-wrap:anywhere; }
.core-chip .chip-role { font-size:13px; }
.core-chip:hover:not(:disabled) { background:var(--accent-soft); color:var(--text); border-color:var(--border-strong); }
.core-chip .chip-path,.file-role,.file-score { font-size:14px; }
.file-path { font-size:16px; }
.file-row { padding:14px; }
.selection-chip,.selection-tip { font-size:14px; line-height:1.7; }
.line-controls { gap:8px; }
.line-controls button,.reader-settings summary,.manual-range summary { font-size:14px; }
.code-viewer { background:var(--code-bg); color:var(--code-text); }
.code-viewer.empty-code { color:var(--muted); font-family:inherit; }
.line-no { color:#71846e; border-color:var(--border); }
.code-line:hover { background:var(--surface); }
.code-line.selected-range { background:#e1edd9; }
.code-line.active-range { background:#d8e9d0; border-left-color:var(--accent); box-shadow:inset 0 0 0 1px #b7cfae; }
.code-viewer .line-annotation { background:var(--card); color:var(--text); border-color:var(--border-strong); box-shadow:var(--shadow-soft); }
.line-annotation.active { border-color:var(--accent); }
.note-title,.note-body,.note-paper { color:var(--text); }
.note-paper span { color:var(--accent); }
.info-label,.inline-summary-label { font-size:15px; color:var(--accent); }
.info-content,.inline-summary-content,.explain-body,.answer { font-size:16px; line-height:1.9; }
.explain-title { font-size:18px; }
.paper-rel { font-size:15px; }
.inline-prompt-bar { background:var(--surface-raised); }
.inline-prompt-bar textarea,.inline-prompt-bar select { font-size:16px; }
.thinking-overlay { background:rgba(243,246,240,.2); }
.thinking-card { border-color:var(--border-strong); color:var(--text); box-shadow:var(--shadow); }
.thinking-title { font-size:20px; }
.thinking-text { color:var(--muted); font-size:16px; }
.spinner,.mini-spinner { border-color:var(--border); border-top-color:var(--accent); }

@media (max-width:1300px) {
  .direct-upload-box { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .radar-controls { grid-template-columns:145px minmax(0,1fr); }
  .related-controls { grid-template-columns:1fr; }
}
@media (min-width:1051px) and (max-height:820px) {
  .side-menu { gap:12px; }
  .brand { padding:4px 6px 16px; }
  .side-menu nav { gap:3px; }
  .side-menu a { padding:8px 12px; line-height:1.6; }
  .side-menu .menu-note { display:none; }
}
@media (max-width:1050px) {
  .hero { padding:28px 24px; }
  .controls,.compact-controls,.import-box { grid-template-columns:1fr; }
  .side-menu { border-bottom:1px solid var(--border); border-right:0; }
  .side-menu nav { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .side-menu .menu-note { display:none; }
}
@media (max-width:980px) {
  .status-box,.chat-cost-box { min-width:0; width:100%; justify-items:start; }
  .model-meta { max-width:none; }
  .model-meta summary { text-align:left; }
  .llm-status,.chat-llm-status { text-align:left; }
  .chat-topbar { flex-direction:column; }
  .chat-workspace { grid-template-columns:1fr; }
  .paper-list { max-height:260px; }
}
@media (max-width:760px) {
  .daily-stages { grid-template-columns:1fr; }
  .global-menu { padding:16px 20px; gap:6px; }
  .global-menu .global-brand { flex-basis:100%; margin-bottom:10px; }
  .global-menu a { font-size:15px; padding:7px 10px; }
  .topbar,.chat-topbar { padding:28px 22px; }
  .topbar h1,.chat-topbar h1,.hero h1 { font-size:32px; }
  .topbar p,.chat-topbar p,.hero p { font-size:16px; }
  .card { border-radius:14px; }
  .card h2 { font-size:24px; }
  .side-menu { padding:18px 16px; gap:12px; }
  .side-menu nav { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .side-menu a { font-size:15px; }
  .hero { padding:26px 20px; flex-direction:column; gap:12px; }
  .hub-page { margin-left:12px; margin-right:12px; }
  .card-head,.panel-head { padding:20px; flex-direction:column; }
  .controls,.compact-controls,.import-box,.direct-upload-box,.radar-controls { grid-template-columns:1fr; padding:20px; }
  .daily-actions { margin:20px; }
  .hub-daily { margin:0 16px 22px; padding:20px; }
  .hub-daily .daily-title { font-size:25px; }
  .source-status,.trend-details { margin:16px; }
  .papers-list { padding:16px; }
  .paper-card { padding:20px; }
  .paper-title { font-size:19px; }
  .paper-detail { padding:20px; }
  .detail-title { font-size:25px; }
  .connections-card .connection-section { padding:24px 20px; }
  .connections-card .controls { grid-template-columns:1fr; padding-left:0; padding-right:0; }
  .connection-section input[type=password],.related-controls select { width:100%; min-width:0; }
  .chat-workspace { padding:20px 16px; }
  .chat-messages { padding:20px 16px; }
  .chat-message { max-width:94%; font-size:16px; }
  .chat-empty { padding:38px 8px; }
  .chat-empty-title { font-size:25px; }
  .chat-empty-text { font-size:16px; }
  .chat-input-area { padding:16px; }
  .chat-input-row { flex-wrap:wrap; }
  .chat-input-row textarea { flex-basis:100%; }
  .chat-input-row button { margin-left:auto; }
  .setup { margin:20px 14px; padding:20px; }
  .workspace { padding:0 14px 20px; }
  .pane-title,.code-title { flex-wrap:wrap; }
  .selection-chip { white-space:normal; }
  .thinking-card { min-width:0; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; transition:none !important; animation-duration:.01ms !important; }
}
