/* 《小微信贷理论与实务》课程知识图谱 — 样式 */
:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-2: #2563eb;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }
.muted { color: var(--ink-2); font-size: 12.5px; line-height: 1.6; }
code { background: #eff6ff; padding: 1px 5px; border-radius: 4px; font-size: 12px; color: #1e40af; }

/* ---------- 顶栏 ---------- */
#topbar {
  background: linear-gradient(135deg, #0f2b6b 0%, #1d4ed8 70%, #2563eb 100%);
  color: #fff; padding: 10px 18px; display: flex; align-items: center;
  gap: 18px; flex-wrap: wrap; box-shadow: var(--shadow); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
  border: 1px solid rgba(255,255,255,.3);
}
#topbar h1 { margin: 0; font-size: 17px; letter-spacing: .5px; }
#topbar .sub { margin: 2px 0 0; font-size: 11.5px; color: rgba(255,255,255,.75); }
.badge { background: #22c55e; color: #062e12; border-radius: 20px; padding: 1px 9px; font-size: 11px; margin-left: 8px; }
.searchbox { position: relative; flex: 0 1 340px; min-width: 220px; }
#searchInput {
  width: 100%; padding: 9px 14px; border: none; border-radius: 22px; outline: none;
  font-size: 13px; background: rgba(255,255,255,.95); color: var(--ink);
}
#searchInput::placeholder { color: var(--ink-3); }
.dropdown {
  position: absolute; top: 42px; left: 0; right: 0; background: #fff; color: var(--ink);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.18); overflow: hidden;
  max-height: 380px; overflow-y: auto; z-index: 99;
}
.dropdown .dd-item { padding: 8px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.dropdown .dd-item:hover { background: #eff6ff; }
.dropdown .dd-item .tp { font-size: 11px; color: var(--ink-3); margin-left: auto; }
#viewTabs { display: flex; gap: 4px; flex-wrap: wrap; }
#viewTabs .tab {
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff;
  padding: 7px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: .15s;
}
#viewTabs .tab:hover { background: rgba(255,255,255,.15); }
#viewTabs .tab.active { background: #fff; color: var(--brand); font-weight: 600; }

/* ---------- 布局 ---------- */
main { flex: 1; position: relative; overflow: hidden; }
.view { display: none; height: 100%; }
.view.active { display: flex; }
.panel {
  width: 268px; min-width: 230px; background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 14px; flex-shrink: 0;
}
#detailPanel { border-right: none; border-left: 1px solid var(--line); width: 320px; }
.panel-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.panel-block { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.panel-block h4 { margin: 8px 0 6px; font-size: 12px; color: var(--ink-2); }
.panel-block label { display: flex; align-items: center; gap: 6px; padding: 2.5px 0; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.content-area { flex: 1; overflow: auto; padding: 16px; }
.placeholder { color: var(--ink-3); text-align: center; padding: 60px 20px; font-size: 13px; }
.detail-empty { color: var(--ink-3); font-size: 13px; line-height: 1.8; padding: 8px 0; }

#graphCanvas { flex: 1; min-width: 0; background: #f8fafc; }
#graphCanvas canvas { outline: none; }

.stats-mini { font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.stats-mini b { color: var(--brand); }
.legend-note { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1e40af; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12.5px; margin: 3px 3px 3px 0; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.filebtn { position: relative; overflow: hidden; }
.sel {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; margin-bottom: 4px; background: #fff; color: var(--ink);
}

/* ---------- 详情面板 ---------- */
.detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail-head h2 { font-size: 17px; margin: 0; flex: 1; }
.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 12px; color: #fff; white-space: nowrap;
}
.chip.outline { background: #fff !important; border: 1px solid currentColor; }
.detail-def { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.8; margin: 8px 0; }
.detail-quote { font-size: 12px; color: var(--ink-2); font-style: italic; border-left: 3px solid #cbd5e1; padding-left: 8px; margin: 8px 0; line-height: 1.7; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; font-size: 12px; color: var(--ink-2); }
.meta-row .m { background: #eff6ff; border-radius: 6px; padding: 2px 8px; }
.rel-group { margin-top: 10px; }
.rel-group h5 { margin: 6px 0 4px; font-size: 12px; color: var(--ink-2); }
.rel-item {
  display: inline-flex; align-items: center; margin: 2px 4px 2px 0; padding: 3px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; font-size: 12px;
  cursor: pointer; transition: .15s;
}
.rel-item:hover { border-color: var(--brand-2); color: var(--brand); }
.detail-actions { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.star-btn { color: var(--warn); }

/* ---------- 树视图 ---------- */
.tree { font-size: 13.5px; }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dashed #dbe4ee; }
.tree > ul { padding-left: 0; border-left: none; }
.tree .tnode {
  display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 8px;
  cursor: pointer; margin: 1px 0;
}
.tree .tnode:hover { background: #eff6ff; }
.tree .tnode.selected { background: #dbeafe; }
.tree .caret { width: 14px; color: var(--ink-3); font-size: 11px; flex-shrink: 0; }
.tree .tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .cnt { font-size: 11px; color: var(--ink-3); }
.reqchip {
  background: var(--warn); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 9px;
}

/* ---------- 路径 ---------- */
.path-flow { display: flex; flex-direction: column; gap: 0; }
.path-node {
  display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; cursor: pointer; box-shadow: var(--shadow);
  position: relative;
}
.path-node:hover { border-color: var(--brand-2); }
.path-node .step {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0;
}
.path-node .pn-name { font-weight: 600; font-size: 14.5px; }
.path-node .pn-def { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.6; }
.path-arrow { text-align: center; color: var(--ink-3); padding: 2px 0 2px 26px; font-size: 12px; }
.path-arrow .rel { color: var(--warn); font-weight: 600; }

/* ---------- 学习路径 ---------- */
.learn-step {
  display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.learn-step.done { opacity: .62; }
.learn-step.done .ls-name { text-decoration: line-through; }
.learn-step input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ok); cursor: pointer; }
.ls-body { flex: 1; }
.ls-name { font-weight: 600; cursor: pointer; }
.ls-name:hover { color: var(--brand); }
.ls-def { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-top: 2px; }
.ls-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.progressbar { background: #e2e8f0; border-radius: 10px; height: 10px; overflow: hidden; margin: 6px 0; }
.progressbar > div { background: linear-gradient(90deg, #10b981, #34d399); height: 100%; transition: width .3s; }

/* ---------- 练习 ---------- */
.quiz-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); max-width: 780px; margin: 0 auto; }
.quiz-progress { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.quiz-stem { font-size: 15px; font-weight: 600; line-height: 1.7; margin-bottom: 16px; }
.quiz-opt {
  display: block; border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px;
  margin-bottom: 9px; cursor: pointer; font-size: 13px; line-height: 1.6; transition: .15s;
}
.quiz-opt:hover { border-color: var(--brand-2); background: #eff6ff; }
.quiz-opt.correct { border-color: var(--ok); background: #ecfdf5; }
.quiz-opt.wrong { border-color: var(--danger); background: #fef2f2; }
.quiz-opt.disabled { pointer-events: none; }
.quiz-result { text-align: center; padding: 30px; }
.quiz-result .big { font-size: 34px; font-weight: 700; color: var(--brand); }
.quiz-actions { margin-top: 16px; }

/* ---------- 学情 ---------- */
.ana-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--ink); }
.chart-box { height: 260px; }
.reco-item {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 7px; font-size: 13px;
}
.reco-item .reason { color: var(--ink-3); font-size: 12px; flex: 1; }

/* ---------- 管理 ---------- */
.admin-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.atab { border: none; background: none; padding: 9px 16px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); border-bottom: 2px solid transparent; }
.atab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.toolbar input { flex: 1; max-width: 320px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th { text-align: left; background: #f8fafc; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); position: sticky; top: 0; }
table.grid td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; }
table.grid tr:hover td { background: #f8fafc; }
td .name-link { cursor: pointer; color: var(--brand); font-weight: 500; }
td .name-link:hover { text-decoration: underline; }
.edit-cell input, .edit-cell select, .edit-cell textarea {
  width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px;
  font-family: inherit;
}
.edit-cell textarea { min-height: 54px; }
.api-endpoint { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 10px 14px; font-family: Consolas, monospace; font-size: 12px; margin: 6px 0; overflow-x: auto; white-space: pre; }
.api-item h4 { margin: 14px 0 4px; font-size: 13px; }

/* ---------- 底栏 & toast ---------- */
#footbar {
  background: #0f172a; color: #94a3b8; font-size: 11.5px; padding: 7px 18px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
#toast {
  position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%);
  background: rgba(15, 23, 42, .92); color: #fff; padding: 10px 22px; border-radius: 24px;
  font-size: 13px; z-index: 999; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
#adminStatus .dirty { color: var(--warn); font-weight: 600; }
@media (max-width: 1100px) {
  #detailPanel { width: 270px; }
  #filterPanel { width: 230px; }
}
