:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --border: #2a323d;
  --text: #e6ebf2;
  --muted: #8b98a8;
  --accent: #4f9eed;
  --accent-2: #2b6fb0;

  /* 节点类型配色 */
  --t-product: #4f9eed;
  --t-company: #f0a83e;
  --t-person: #6ac47a;
  --t-vc_firm: #c07be0;
}

* { 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: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.row { display: flex; gap: 8px; margin-bottom: 8px; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  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); }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; margin-top: 4px; }
.btn.round {
  width: 38px; height: 38px; padding: 0;
  font-size: 20px; line-height: 1; border-radius: 8px;
}

.hint { margin: 4px 0; color: var(--muted); font-size: 12px; }

/* 类型筛选 */
.filters { display: flex; flex-direction: column; gap: 6px; }
.filter-item {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  padding: 4px 6px; border-radius: 6px;
}
.filter-item:hover { background: var(--panel-2); }
.filter-item .swatch {
  width: 12px; height: 12px; border-radius: 3px; flex: none;
}
.filter-item .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.filter-item.off { opacity: 0.4; }

/* 最短路径结果 */
.path-result { margin-top: 10px; font-size: 13px; }
.path-status {
  display: inline-block; padding: 3px 8px; border-radius: 5px;
  font-size: 12px; margin-bottom: 8px;
}
.path-status.ok { background: #1e3d29; color: #6ac47a; }
.path-status.unreachable { background: #3d2a1e; color: #f0a83e; }
.path-status.same { background: #1e2f3d; color: #4f9eed; }
.path-status.invalid { background: #3d1e24; color: #ed6a7a; }
.path-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.path-node {
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px; font-size: 12px;
}
.path-node:hover { border-color: var(--accent); }
.path-arrow { color: var(--muted); }

/* 统计榜单 */
.stats-top { margin: 0; padding-left: 0; list-style: none; counter-reset: rank; }
.stats-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
}
.stats-row:hover { background: var(--panel-2); }
.stats-row .rank {
  width: 20px; text-align: center; color: var(--muted); font-size: 12px;
}
.stats-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stats-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-row .deg {
  font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600;
}

.stats-grid { display: flex; flex-direction: column; gap: 4px; }
.stat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 6px; font-size: 13px;
}
.stat-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stat-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-item .val {
  font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600;
}

/* ---------- 画布 ---------- */
#stage { position: relative; flex: 1; height: 100%; overflow: hidden; }
#graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graph-canvas.dragging { cursor: grabbing; }

.legend {
  position: absolute; left: 16px; bottom: 16px;
  background: rgba(23, 28, 36, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  backdrop-filter: blur(4px);
}
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend .li .swatch { width: 12px; height: 12px; border-radius: 3px; }

.zoom-controls {
  position: absolute; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
}

/* 节点信息面板 */
.info-panel {
  position: absolute; top: 16px; right: 16px;
  width: 300px; max-height: calc(100% - 32px); overflow-y: auto;
  background: rgba(23, 28, 36, 0.96);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
  backdrop-filter: blur(6px);
}
.info-panel.hidden { display: none; }
.info-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.info-close:hover { color: var(--text); }
.info-title { margin: 0 24px 4px 0; font-size: 17px; }
.info-type {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 12px; color: #0e1116; font-weight: 600; margin-bottom: 8px;
}
.info-desc { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.info-stats { display: flex; gap: 14px; margin: 8px 0; font-size: 12px; }
.info-stats b { color: var(--text); font-size: 15px; }
.info-stats span { display: block; color: var(--muted); }
.info-aliases { font-size: 12px; color: var(--muted); margin: 6px 0; }
.info-section-title {
  margin: 12px 0 6px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.neighbor {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.neighbor:hover { background: var(--panel-2); }
.neighbor .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.neighbor .rel { color: var(--accent); font-size: 11px; }
.neighbor .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neighbor .dir { color: var(--muted); font-size: 11px; }
