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

:root {
  --bg: #0e1117;
  --panel: #161b26;
  --panel2: #1d2433;
  --border: #2a3347;
  --text: #dbe2f0;
  --muted: #8b95ab;
  --accent: #6ea8ff;
  --path: #ffd166;
  --c-product: #4f8ef7;
  --c-company: #f5a623;
  --c-person: #2ecc9a;
  --c-vc: #ef5b7b;
}

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

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

/* ---------- sidebar ---------- */
#sidebar {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 14px;
}
.brand h1 { font-size: 18px; letter-spacing: 1px; }
.brand .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.panel {
  margin-top: 14px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: .5px;
}

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

button {
  background: #232c40;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
.btn-primary { background: #2a4a86; border-color: #3c62a8; }
.btn-block { width: 100%; margin-top: 8px; }

.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; margin-bottom: 0; }
.search-results { margin-top: 6px; max-height: 180px; overflow-y: auto; }
.search-item {
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-item:hover { background: #263049; }
.search-item .sid { color: var(--muted); font-size: 11px; margin-left: auto; }

.type-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}
.type-chip.off { opacity: .35; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.path-btns { display: flex; gap: 6px; }
.path-btns button { flex: 1; }
.path-result { margin-top: 8px; font-size: 12px; line-height: 1.7; word-break: break-all; }
.path-result .msg-ok { color: #9be59b; }
.path-result .msg-err { color: #ff9c9c; }
.path-seq { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.path-node {
  background: #33313d;
  border: 1px solid var(--path);
  color: var(--path);
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
  font-size: 12px;
}
.path-arrow { color: var(--muted); align-self: center; }

.stats-top { list-style: none; counter-reset: rank; }
.stats-top li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
}
.stats-top li:hover { background: #263049; }
.stats-top li::before {
  content: counter(rank);
  color: var(--muted);
  width: 16px;
  text-align: right;
  font-size: 11px;
}
.stats-top .deg { margin-left: auto; color: var(--accent); font-weight: 600; }

.stats-types { display: flex; flex-direction: column; gap: 4px; }
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 5px;
}
.stat-row .cnt { margin-left: auto; color: var(--accent); font-weight: 600; }
.stats-relations .stat-row { cursor: default; font-size: 12px; }
.stat-bar {
  height: 4px;
  background: #35507e;
  border-radius: 2px;
  flex: none;
}

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

#graph-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 16px;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}

#legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 12px;
  background: rgba(22,27,38,.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  pointer-events: none;
}
#legend .dot { margin-right: 5px; }

.node-detail {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 300px;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  background: rgba(22,27,38,.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.node-detail.hidden { display: none; }
#detail-close { position: absolute; top: 8px; right: 8px; padding: 2px 7px; }
.nd-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; padding-right: 26px; }
.nd-id { color: var(--muted); font-size: 11px; margin-bottom: 8px; word-break: break-all; }
.nd-type {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); margin-bottom: 8px;
}
.nd-desc { color: #b7c0d4; line-height: 1.6; margin-bottom: 8px; }
.nd-meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.nd-meta b { color: var(--text); }
.nd-sec { font-size: 12px; font-weight: 600; color: var(--accent); margin: 10px 0 6px; }
.nd-nb {
  display: flex; align-items: baseline; gap: 6px;
  padding: 4px 6px; border-radius: 5px; cursor: pointer;
}
.nd-nb:hover { background: #263049; }
.nd-nb .rel { color: var(--muted); font-size: 11px; margin-left: auto; flex: none; }
.nd-nb .dot { align-self: center; }

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