:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2a3441;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #58a6ff;
  --accent-2: #f0b429;

  --t-product: #4f9dff;
  --t-person: #4ecb8d;
  --t-company: #f6a04d;
  --t-vc_firm: #c887f0;
  --path: #ff5c7a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---------- 侧边栏 ---------- */
#sidebar {
  width: 340px;
  min-width: 340px;
  height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 1px;
}
.brand .subtitle {
  margin: 2px 0 0;
  color: var(--accent);
  font-size: 13px;
}
.brand .meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}
.panel h3 {
  margin: 14px 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.field { position: relative; margin-bottom: 8px; }
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); background: #232b39; }
.btn-block { display: block; width: 100%; margin-top: 6px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #08111f; font-weight: 600; }
.btn-primary:hover { background: #6cb2ff; }

/* 类型筛选 */
.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.type-chip .dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.type-chip.off { opacity: 0.4; }

/* 搜索建议 */
.suggest {
  position: absolute;
  z-index: 30;
  top: 100%;
  left: 0; right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
}
.suggest .item {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.suggest .item:last-child { border-bottom: none; }
.suggest .item:hover, .suggest .item.active { background: #232b39; }
.suggest .item .sub { color: var(--muted); font-size: 11px; margin-left: auto; }

/* 路径结果 */
.path-result {
  margin-top: 10px;
  font-size: 13px;
  min-height: 20px;
}
.path-result .status-line { margin-bottom: 8px; font-weight: 600; }
.path-result .status-line.ok { color: var(--t-person); }
.path-result .status-line.unreachable,
.path-result .status-line.invalid { color: var(--path); }
.path-result .status-line.same { color: var(--accent-2); }
.path-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.path-node {
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
}
.path-node:hover { background: #232b39; }
.path-arrow { color: var(--muted); }

/* 统计 */
.stats-top { margin: 0; padding-left: 20px; }
.stats-top li {
  padding: 4px 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dotted var(--border);
}
.stats-top li:hover { color: var(--accent); }
.stats-top .deg { color: var(--accent-2); font-variant-numeric: tabular-nums; }

.stats-types { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-type {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 12px;
}
.stat-type .dot { width: 10px; height: 10px; border-radius: 50%; }
.stat-type .cnt { color: var(--accent-2); font-weight: 600; }

.stats-relations { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.stat-rel {
  display: flex; justify-content: space-between; gap: 6px;
  padding: 4px 8px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 11px;
}
.stat-rel .cnt { color: var(--accent-2); font-weight: 600; }

/* ---------- 图谱区 ---------- */
#stage {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, #131a24 0%, var(--bg) 60%);
}
#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#graph-canvas.grabbing { cursor: grabbing; }

.toolbar {
  position: absolute;
  top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.btn-icon {
  width: 36px; height: 36px;
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}

.legend {
  position: absolute;
  left: 14px; bottom: 14px;
  background: rgba(22,27,34,0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.legend .row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; }

/* 节点详情 */
.node-info {
  position: absolute;
  top: 14px; left: 14px;
  width: 320px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  background: rgba(22,27,34,0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.node-info .close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.node-info .close:hover { color: var(--text); }
.node-info h3 { margin: 0 6px 0 0; font-size: 17px; display: inline; }
.ni-type-badge {
  display: inline-block; vertical-align: middle;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  color: #08111f; font-weight: 600;
}
.node-info .desc { color: var(--text); margin: 10px 0; line-height: 1.5; }
.node-info .stats-inline { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.node-info .aliases { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.ni-rel-head { margin: 12px 0 6px; font-size: 13px; color: var(--accent); }
.ni-rel-list { list-style: none; margin: 0; padding: 0; }
.ni-rel {
  padding: 7px 8px; border-radius: 6px; margin-bottom: 4px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 12px; cursor: pointer;
}
.ni-rel:hover { border-color: var(--accent); }
.ni-rel .rt { color: var(--accent-2); font-family: monospace; }
.ni-rel .peer { font-weight: 600; }
.ni-rel .lbl { display: block; color: var(--muted); margin-top: 2px; }

.toast {
  position: absolute;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(255,92,122,0.15);
  border: 1px solid var(--path);
  color: #ffb3c1;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2f3947; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
