* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1216;
  --panel: #171c23;
  --panel-border: #262e39;
  --text: #dfe6ee;
  --muted: #8a96a5;
  --accent: #e8b339;
  --product: #4f8ef7;
  --company: #f0784f;
  --person: #4fc98a;
  --vc_firm: #b06ff0;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

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

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

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

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel h2 { font-size: 14px; margin-bottom: 8px; color: var(--accent); }
.panel h3 { font-size: 12px; margin: 10px 0 6px; color: var(--muted); }

input[type="text"] {
  width: 100%;
  background: #0d1116;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

button {
  background: #232b36;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }

.wide-btn { width: 100%; margin-top: 8px; }

.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; }

.suggestions {
  list-style: none;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}
.suggestions.hidden { display: none; }
.suggestions li {
  padding: 6px 9px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #1c232c;
}
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover { background: #232b36; }
.suggestions .sug-type { color: var(--muted); font-size: 11px; margin-left: 6px; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.filter-row label {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; cursor: pointer; color: var(--muted);
}
.filter-row .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- Path ---------- */
.path-row { display: flex; align-items: center; gap: 6px; }
.path-row .arrow { color: var(--muted); }
.path-result { margin-top: 10px; font-size: 13px; line-height: 1.7; }
.path-result .path-msg { color: var(--muted); }
.path-result .path-msg.err { color: #f06f6f; }
.path-result .path-node {
  display: inline-block;
  background: #232b36;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1px 7px;
  margin: 2px 3px 2px 0;
  cursor: pointer;
}
.path-result .path-node:hover { border-color: var(--accent); color: var(--accent); }
.path-result .path-sep { color: var(--muted); margin-right: 3px; }

/* ---------- Stats ---------- */
.stats-list { list-style: none; }
.stats-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
}
.stats-list li:hover { background: #232b36; }
.stats-list .rank { color: var(--muted); width: 22px; font-size: 11px; }
.stats-list .s-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-list .s-degree { color: var(--accent); font-variant-numeric: tabular-nums; }

.stats-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-chips .chip {
  display: flex; align-items: center; gap: 5px;
  background: #1c232c;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
}
.stats-chips .chip .cnt { color: var(--accent); font-variant-numeric: tabular-nums; }
.stats-chips .chip .dot { width: 8px; height: 8px; border-radius: 50%; }

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

#legend {
  position: absolute; top: 12px; right: 12px;
  background: rgba(23, 28, 35, 0.88);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  pointer-events: none;
}
#legend .lg-item { display: flex; align-items: center; gap: 6px; margin: 3px 0; color: var(--muted); }
#legend .dot { width: 9px; height: 9px; border-radius: 50%; }

#node-detail {
  position: absolute; top: 12px; left: 12px;
  width: 300px; max-height: calc(100% - 24px);
  overflow-y: auto;
  background: rgba(23, 28, 35, 0.94);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px;
}
#node-detail.hidden { display: none; }
#node-detail h2 { font-size: 16px; margin-bottom: 4px; padding-right: 20px; }
#node-detail .nd-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
#node-detail p { font-size: 13px; line-height: 1.6; margin-bottom: 8px; }
#node-detail h3 { font-size: 12px; color: var(--accent); margin: 10px 0 6px; }
#node-detail-close {
  position: absolute; top: 8px; right: 8px;
  padding: 0 8px; font-size: 16px; line-height: 1.6;
}
#nd-neighbors { list-style: none; }
#nd-neighbors li {
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  display: flex; justify-content: space-between; gap: 6px;
}
#nd-neighbors li:hover { background: #232b36; }
#nd-neighbors .nb-rel { color: var(--muted); flex-shrink: 0; }
#nd-neighbors .nb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#hover-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(23, 28, 35, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
}
#hover-tip.hidden { display: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #2a3340; border-radius: 4px; }
