:root {
  --bg: #0d1117;
  --panel: #141b25;
  --panel-2: #1b2432;
  --border: #263041;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4c8bf5;
  --accent-2: #f5a623;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --same: #a371f7;

  --c-product: #4c8bf5;
  --c-company: #f5a623;
  --c-person: #3fb950;
  --c-vc_firm: #a371f7;
}

* { 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;
}

#app {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  height: 100vh;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}
#panel-right { border-right: none; border-left: 1px solid var(--border); }

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

.control-block { margin-top: 20px; }
.block-title {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  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;
}
input[type="text"]:focus { outline: none; border-color: var(--accent); }

.search-row { display: flex; gap: 6px; }
.search-row button {
  flex: 0 0 auto;
  width: 34px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.search-row button:hover { color: var(--text); border-color: var(--accent); }

.suggest {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.suggest li {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.suggest li:hover { background: var(--border); }
.suggest .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.suggest .sid { color: var(--muted); font-size: 11px; margin-left: auto; }

.type-filters { display: flex; flex-direction: column; gap: 6px; }
.type-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.type-filters label:hover { background: var(--panel-2); }
.type-filters .dot { width: 12px; height: 12px; border-radius: 50%; }
.type-filters .cnt { margin-left: auto; color: var(--muted); font-size: 12px; }

.path-form { display: flex; flex-direction: column; gap: 6px; }
.path-form button, .reset-btn {
  padding: 9px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.path-form button:hover, .reset-btn:hover { filter: brightness(1.1); }
.reset-btn { width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.reset-btn:hover { border-color: var(--accent); filter: none; }

.path-result { margin-top: 10px; font-size: 13px; min-height: 8px; }
.path-result .status-line { margin-bottom: 8px; font-weight: 600; }
.path-result[data-bench-path-status="ok"] .status-line { color: var(--ok); }
.path-result[data-bench-path-status="unreachable"] .status-line { color: var(--err); }
.path-result[data-bench-path-status="same"] .status-line { color: var(--same); }
.path-result[data-bench-path-status="invalid"] .status-line { color: var(--warn); }

.path-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.path-chain .pnode {
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
}
.path-chain .pnode:hover { background: var(--accent); color: #fff; }
.path-chain .arrow { color: var(--muted); }

.node-info-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.node-info-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #05070a;
  font-weight: 600;
  margin-bottom: 8px;
}
.node-info-desc { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.node-info-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.node-info-stats b { color: var(--text); }
.rel-title { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.rel-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.rel-list li {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
}
.rel-list li:hover { background: var(--border); }
.rel-list .rel-type { color: var(--accent-2); font-weight: 600; }
.rel-list .rel-dir { color: var(--muted); }

/* stage */
#stage { position: relative; overflow: hidden; background: radial-gradient(circle at 50% 40%, #121a26 0%, #0d1117 70%); }
#graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graph-canvas.dragging { cursor: grabbing; }

.loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px;
  background: rgba(13,17,23,0.7);
  pointer-events: none;
}

.hover-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(20,27,37,0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  max-width: 240px;
  z-index: 5;
}
.hover-tip .ht-name { font-weight: 700; }
.hover-tip .ht-type { color: var(--muted); font-size: 11px; }

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

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

/* stats */
.stats-top { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.stats-top li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); margin-bottom: 5px;
}
.stats-top li:hover { background: var(--border); }
.stats-top .rank { width: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats-top .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.stats-top .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-top .dg {
  color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums;
}

.stats-types { display: flex; flex-direction: column; gap: 6px; }
.stats-types .titem {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; background: var(--panel-2);
}
.stats-types .dot { width: 11px; height: 11px; border-radius: 50%; }
.stats-types .tname { flex: 1; }
.stats-types .tcount { font-weight: 700; }

.stats-relations { display: flex; flex-direction: column; gap: 3px; }
.stats-relations .ritem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; border-radius: 5px; background: var(--panel-2); font-size: 12px;
}
.stats-relations .rname { color: var(--muted); }
.stats-relations .rcount { font-weight: 700; color: var(--accent-2); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
