:root {
  --bg: #e8eef8;
  --side: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --blue: #3b6ef5;
  --blue-2: #5b8cff;
  --line: #e5e7eb;
  --ok: #059669;
  --card: #ffffff;
  --radius: 18px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
[data-theme="dark"] {
  --bg: #0f172a;
  --side: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #1f2937;
  --card: #1e293b;
  --blue: #60a5fa;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100%; }
.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 18px 16px 28px;
  overflow: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b6ef5, #7c5cfc);
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.brand-row b { font-size: 16px; }
.brand-row span { display: block; font-size: 11px; color: var(--muted); }
.h { font-size: 13px; font-weight: 700; color: var(--blue); margin: 16px 0 8px; }
label.mini { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
select, input[type="text"], input[type="password"], textarea, .field {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text); font: inherit;
}
.okbox {
  margin-top: 10px; background: #ecfdf5; color: #047857;
  border-radius: 12px; padding: 10px 12px; font-size: 12.5px;
}
[data-theme="dark"] .okbox { background: #064e3b; color: #6ee7b7; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 12px 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
}
.nav-item:hover { background: #f1f5ff; }
[data-theme="dark"] .nav-item:hover { background: #1e293b; }
.nav-item.on, .nav-item:has(input:checked) {
  background: #eef2ff; color: var(--blue); font-weight: 600;
}
[data-theme="dark"] .nav-item.on, [data-theme="dark"] .nav-item:has(input:checked) {
  background: #1e3a5f; color: #93c5fd;
}
.nav-item input { accent-color: var(--blue); }
.main { padding: 22px 28px 48px; max-width: 1180px; }
.hero {
  background: linear-gradient(90deg, #3b6ef5 0%, #5b8cff 100%);
  color: #fff; text-align: center; border-radius: 22px;
  padding: 32px 24px 28px; box-shadow: 0 14px 36px rgba(59,110,245,.28);
}
.hero h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: .02em; }
.hero p { margin: 10px 0 0; opacity: .95; font-size: 15px; }
.scard {
  border-radius: 18px; padding: 26px 18px; text-align: center; cursor: pointer;
  border: 2px solid transparent; min-height: 140px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
  transition: .15s ease;
}
.section-head { text-align: center; margin: 28px 0 8px; }
.section-head h2 { margin: 0; font-size: 22px; }
.section-head p { color: var(--muted); margin: 6px 0 0; }
.badge {
  display: inline-block; background: #eef2ff; color: #3b6ef5;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; margin: 12px 0;
}
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 12px 0 18px; }
.scard:hover, .scard.on { border-color: var(--blue); transform: translateY(-2px); }
.scard b { display: block; margin: 8px 0 6px; font-size: 16px; }
.scard span { font-size: 12.5px; color: var(--muted); }
.c1 { background: #eef4ff; }
.c2 { background: #ecfdf5; }
.c3 { background: #fff7ed; }
.c4 { background: #f5f3ff; }
.c5 { background: #fdf2f8; }
[data-theme="dark"] .c1, [data-theme="dark"] .c2, [data-theme="dark"] .c3,
[data-theme="dark"] .c4, [data-theme="dark"] .c5 { background: #1e293b; }
.qrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.qbtn {
  border: 0; background: var(--blue); color: #fff; border-radius: 12px;
  padding: 10px 16px; font-size: 14px; cursor: pointer;
}
.qbtn:hover { filter: brightness(1.08); }
.btn {
  border: 0; background: var(--blue); color: #fff; border-radius: 12px;
  padding: 9px 14px; font-size: 13.5px; cursor: pointer;
}
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.gold { background: #f59e0b; color: #111; }
.drop {
  border: 1.5px dashed #93c5fd; background: #f8fbff; border-radius: 14px;
  padding: 18px; text-align: center; color: var(--muted); cursor: pointer; margin: 8px 0;
}
[data-theme="dark"] .drop { background: #0f172a; border-color: #334155; }
.drop input { display: none; }
.page { display: none; }
.page.show { display: block; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-top: 12px;
}
.grid2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; }
.chat-log { min-height: 180px; max-height: 360px; overflow: auto; padding: 8px 0; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 12px; margin: 8px 0; white-space: pre-wrap; line-height: 1.7; font-size: 14px; }
.bubble.user { margin-left: auto; background: var(--blue); color: #fff; }
.bubble.bot { background: #f1f5f9; }
[data-theme="dark"] .bubble.bot { background: #0f172a; }
.report h4 { margin: 14px 0 6px; }
.report ul { margin: 0; padding-left: 18px; line-height: 1.75; }
.pre { white-space: pre-wrap; background: #f8fafc; border-radius: 10px; padding: 12px; }
[data-theme="dark"] .pre { background: #0f172a; }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: #111827; color: #fff;
  padding: 10px 14px; border-radius: 10px; display: none; z-index: 50;
}
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.35); display: none;
  align-items: center; justify-content: center; z-index: 40; pointer-events: none;
}
.overlay.show { display: flex; pointer-events: auto; }
.overlay .box { background: var(--card); padding: 20px 24px; border-radius: 16px; }
.spin { width: 26px; height: 26px; border: 3px solid #ddd; border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 8px; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.example { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.example div { background: #f8fafc; border-radius: 10px; padding: 10px; font-size: 13px; line-height: 1.6; }
.feat { cursor: pointer; }
.feat:hover { border-color: var(--blue); }
.viz-svg { overflow: auto; margin: 12px 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.viz-svg svg { max-width: 100%; height: auto; display: block; }
[data-theme="dark"] .viz-svg { background: #0f172a; }

/* 科研 Agent */
.paper-card, .hit-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; cursor: pointer; background: var(--card, #fff); }
.paper-card:hover, .hit-card:hover { border-color: var(--blue); }
.tag-gold { color: #b45309; font-weight: 600; }
.dedup-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dedup-box { background: #fff; border-radius: 14px; max-width: 560px; width: 100%; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
[data-theme="dark"] .dedup-box { background: #0f172a; color: #e2e8f0; }
.reader-layout { display: grid; grid-template-columns: 160px 1fr 200px; gap: 10px; min-height: 520px; }
.reader-toc, .reader-refs { border: 1px solid var(--line); border-radius: 12px; padding: 10px; overflow: auto; max-height: 70vh; font-size: 12.5px; }
.reader-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.reader-col { border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 520px; }
.reader-scroll { overflow: auto; padding: 10px; flex: 1; max-height: 65vh; line-height: 1.65; font-size: 13.5px; }
.rd-para { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.toc-item { display: block; margin: 4px 0; color: var(--blue); text-decoration: none; }
.toc-item.lv2 { padding-left: 8px; } .toc-item.lv3 { padding-left: 16px; }
.ref-item { padding: 6px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; }
.ref-item.active, .cite-ref.flash, a.cite.flash { background: #fef3c7; }
.cite-ref, a.cite { color: var(--blue); text-decoration: underline; cursor: pointer; }
.graph-svg { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.graph-svg .g-edge { stroke: #94a3b8; stroke-width: 1.2; }
.graph-svg .g-node circle { fill: #60a5fa; stroke: #1e3a8a; stroke-width: 1; }
.graph-svg .g-corner circle { fill: #fbbf24; stroke: #b45309; }
.graph-svg .g-edge circle { fill: #cbd5e1; stroke: #64748b; }
.graph-svg text { font-size: 10px; fill: #334155; }
.evidence-list { font-size: 13px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; max-height: 120px; overflow: auto; }
.reader-hint { margin: 0 0 10px; font-size: 12.5px; }
.rd-zh.pending { opacity: 0.92; }
.zh-badge { display: inline-block; font-size: 11px; color: #92400e; background: #fef3c7; border-radius: 4px; padding: 0 6px; margin-right: 6px; vertical-align: middle; }
.reader-col h4 { margin: 8px 12px 0; font-size: 13px; color: var(--muted); }
.agent-plan { margin: 8px 0; padding-left: 1.2em; }
.agent-plan li { margin: 8px 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card, #fff); }
.agent-plan .st-running { border-color: var(--blue); }
.agent-plan .st-done { border-color: #16a34a; }
.agent-plan .st-warn, .agent-plan .st-error { border-color: #dc2626; }
.agent-sum { margin-top: 4px; font-size: 13px; }
.agent-err { color: #b91c1c; font-size: 13px; }
.agent-thoughts { max-height: 260px; overflow: auto; font-size: 13px; line-height: 1.55; }
.agent-thoughts .thought { padding: 4px 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 1100px) {
  .reader-layout { grid-template-columns: 1fr; }
  .reader-panes { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .cards3, .grid2, .example { grid-template-columns: 1fr; }
}
