:root {
  --bg: #0e1117;
  --panel: #161b22;
  --panel-2: #1c2230;
  --border: #2a3140;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --product: #4f9dff;
  --person: #ff9966;
  --company: #5fd08a;
  --vc_firm: #c792ea;
}

* { 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",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
}

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

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

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

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

.row { display: flex; gap: 6px; margin-bottom: 6px; }
.row:last-child { margin-bottom: 0; }

input[type="text"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn.ghost { padding: 7px 10px; }
.btn.wide { width: 100%; }

.hits { margin-top: 6px; max-height: 160px; overflow-y: auto; }
.hit-item {
  padding: 5px 8px; border-radius: 5px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 3px;
  background: var(--bg); font-size: 12px;
}
.hit-item:hover { border-color: var(--accent); }
.hit-item .hit-type { color: var(--muted); font-size: 11px; margin-left: 6px; }

.type-filters { display: flex; flex-direction: column; gap: 5px; }
.type-filter { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.type-filter input { accent-color: var(--accent); }
.type-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.path-result { margin-top: 8px; font-size: 12px; }
.path-result .status { font-weight: 600; margin-bottom: 4px; }
.path-result .status.ok { color: var(--company); }
.path-result .status.unreachable { color: #ff7b72; }
.path-result .status.same { color: #d29922; }
.path-result .status.invalid { color: #ff7b72; }
.path-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.path-node {
  padding: 3px 7px; border-radius: 5px; background: var(--bg);
  border: 1px solid var(--accent); cursor: pointer; font-size: 12px;
}
.path-arrow { color: var(--muted); }

.stats-top { margin: 0; padding-left: 20px; }
.stats-top li {
  cursor: pointer; padding: 3px 4px; border-radius: 4px; font-size: 12px;
  display: flex; justify-content: space-between; gap: 8px;
}
.stats-top li:hover { background: var(--bg); }
.stats-top .deg { color: var(--accent); font-weight: 600; }

.stats-types, .stats-relations { list-style: none; margin: 0; padding: 0; }
.stats-types li, .stats-relations li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 4px; border-radius: 4px; font-size: 12px; cursor: default;
}
.stats-relations li { cursor: pointer; }
.stats-relations li:hover { background: var(--bg); }
.stats-types .cnt, .stats-relations .cnt { color: var(--accent); font-weight: 600; }
.stats-types li .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

#stage { position: relative; flex: 1; height: 100%; }
#graph { width: 100%; height: 100%; display: block; cursor: grab; }
#graph.dragging { cursor: grabbing; }

.legend {
  position: absolute; top: 12px; right: 12px;
  background: rgba(22,27,34,0.85); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
}
.legend .leg-item { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; }

.node-info {
  position: absolute; left: 12px; bottom: 12px; max-width: 340px;
  background: rgba(22,27,34,0.95); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-size: 12px;
}
.node-info.hidden { display: none; }
.node-info h3 { margin: 0 0 4px; font-size: 15px; }
.node-info .meta { color: var(--muted); margin-bottom: 6px; }
.node-info .desc { margin: 6px 0; line-height: 1.5; }
.node-info .neighbors { margin-top: 8px; max-height: 140px; overflow-y: auto; }
.node-info .nb {
  display: inline-block; padding: 2px 7px; margin: 2px;
  border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 11px;
}
.node-info .nb:hover { border-color: var(--accent); }
.node-info .close { position: absolute; top: 6px; right: 8px; cursor: pointer; color: var(--muted); }

.hint {
  position: absolute; bottom: 12px; right: 12px;
  color: var(--muted); font-size: 11px;
  background: rgba(22,27,34,0.7); padding: 4px 8px; border-radius: 6px;
}
