:root {
  --bg: #0d1117;
  --bg-panel: #161b22;
  --bg-hover: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --path: #ffd33d;
  --c-product: #4fc3f7;
  --c-company: #ffb74d;
  --c-person: #81c784;
  --c-vc_firm: #ba68c8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
#app { display: flex; height: 100vh; }

/* ---------- sidebar ---------- */
#sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
}
.side-header h1 { font-size: 18px; }
.side-header h1 span { font-size: 12px; color: var(--text-dim); font-weight: normal; margin-left: 6px; }
.panel { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.panel h2 { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.panel h3 { font-size: 12px; color: var(--text-dim); margin: 10px 0 6px; }

input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }
button {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }

.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; }
.search-results {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.search-results.hidden { display: none; }
.search-item { padding: 6px 10px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.search-item:hover { background: var(--bg-hover); }
.search-item .t { font-size: 11px; }

/* type filter + legend */
.type-row, .legend-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.type-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.count-badge { color: var(--text-dim); font-size: 11px; }
.legend { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* path */
.path-form { display: flex; flex-direction: column; gap: 6px; }
.path-form button { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.path-form button:hover { background: #388bfd; color: #fff; }
.path-result { margin-top: 8px; font-size: 13px; min-height: 20px; }
.path-result .msg { padding: 6px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.path-result .msg.ok { border-color: #3fb950; color: #3fb950; }
.path-result .msg.err { border-color: #f85149; color: #f85149; }
.path-nodes { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }
.path-node {
  background: rgba(255, 211, 61, .12);
  border: 1px solid var(--path);
  color: var(--path);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.path-arrow { color: var(--text-dim); font-size: 11px; }

/* stats */
.stats-top { list-style: none; }
.stats-top li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.stats-top li:hover { background: var(--bg-hover); }
.stats-top .rank { width: 20px; color: var(--text-dim); font-size: 11px; flex: none; }
.stats-top .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-top .deg { color: var(--accent); font-variant-numeric: tabular-nums; }
.stats-list { list-style: none; }
.stats-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px; font-size: 13px;
}
.stats-list .lbl { flex: 1; }
.stats-list .cnt { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- stage ---------- */
#stage { flex: 1; position: relative; overflow: hidden; }
#graph-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#graph-canvas.dragging { cursor: grabbing; }
#toolbar {
  position: absolute; top: 12px; left: 12px;
  display: flex; gap: 6px;
}
#toolbar button { min-width: 34px; background: rgba(22,27,34,.9); }
#hint {
  position: absolute; bottom: 10px; left: 12px;
  font-size: 11px; color: var(--text-dim);
  background: rgba(13,17,23,.7); padding: 3px 8px; border-radius: 4px;
  pointer-events: none;
}

/* node detail */
#node-detail {
  position: absolute; top: 12px; right: 12px;
  width: 300px; max-height: calc(100% - 60px);
  overflow-y: auto;
  background: rgba(22,27,34,.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
#node-detail.hidden { display: none; }
#node-detail h2 { font-size: 16px; margin-bottom: 6px; padding-right: 20px; }
#node-detail h3 { font-size: 12px; color: var(--text-dim); margin: 10px 0 6px; }
#node-detail-close {
  position: absolute; top: 8px; right: 8px;
  border: none; background: none; font-size: 16px; color: var(--text-dim);
}
#nd-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#nd-meta .chip {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-dim);
}
#nd-desc { font-size: 13px; line-height: 1.6; color: var(--text); }
#nd-aliases { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
#nd-neighbors { list-style: none; }
#nd-neighbors li {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
#nd-neighbors li:hover { background: var(--bg-hover); }
#nd-neighbors .rel { color: var(--text-dim); font-size: 11px; margin-left: auto; flex: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
