/* 指标关系网络 —— 页面样式
   基调：浅蓝灰绿底 + 白面板 + 细分隔线，克制、学术、以图为绝对主体 */

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

:root {
  --bg: #eef4f5;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #888888;
  --hairline: #d8e2e3;
  --c-geren: #6FA8A8;
  --c-shengli: #5D80D9;
  --c-xinli: #8FA65C;
  --c-xingwei: #CAA266;
}

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  width: 10px; height: 10px;
  align-self: center;
  background: conic-gradient(var(--c-geren) 0 25%, var(--c-shengli) 0 50%, var(--c-xinli) 0 75%, var(--c-xingwei) 0 100%);
  border-radius: 50%;
}
.brand-name { font-weight: 600; letter-spacing: 0.02em; }
.brand-sep { color: var(--hairline); }
.topbar h1 { font-size: 15px; font-weight: 600; }
.back-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .15s;
}
.back-link:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- 主区 ---------- */
.stage { position: relative; height: calc(100% - 56px); }
.graph { position: absolute; inset: 0; }

/* ---------- 工具条 ---------- */
.toolbar {
  position: absolute;
  top: 16px; left: 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  z-index: 10;
  max-width: calc(100% - 420px);
}
.search-box { position: relative; }
#searchInput {
  width: 240px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  outline: none;
  transition: border-color .15s;
}
#searchInput:focus { border-color: var(--ink); }
.search-list {
  position: absolute; top: 38px; left: 0; right: 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  overflow: hidden;
  display: none;
  max-height: 260px;
  overflow-y: auto;
}
.search-list.show { display: block; }
.search-list li {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex; justify-content: space-between; gap: 8px;
  border-bottom: 1px dashed var(--hairline);
}
.search-list li:last-child { border-bottom: none; }
.search-list li:hover { background: #f4f8f8; }
.search-list .s-path { color: var(--muted); font-size: 11px; white-space: nowrap; }

.chips { display: flex; background: var(--panel); border: 1px solid var(--hairline); border-radius: 7px; overflow: hidden; }
.chip {
  border: none; background: transparent;
  padding: 8px 14px; font-size: 12px; color: var(--muted);
  cursor: pointer;
  border-right: 1px solid var(--hairline);
  transition: color .15s, background .15s;
}
.chip:last-child { border-right: none; }
.chip:hover { color: var(--ink); }
.chip.active { color: var(--ink); font-weight: 600; background: #f4f8f8; }

.switches { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 7px; padding: 0 12px; height: 34px; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--ink); }
.layout-switch { display: flex; border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline); padding: 0 4px; }
.ls-btn {
  border: none; background: transparent;
  padding: 6px 10px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.ls-btn.active { color: var(--ink); font-weight: 600; }
.reset-btn {
  border: none; background: transparent;
  font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px 2px;
}
.reset-btn:hover { color: var(--ink); }

/* ---------- 边图例 ---------- */
.edge-legend {
  position: absolute;
  left: 18px; bottom: 16px;
  z-index: 10;
  display: flex; align-items: center; gap: 16px;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.05em;
  background: rgba(255,255,255,.85);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 7px 12px;
}
.el-item { display: flex; align-items: center; gap: 7px; }
.el-item.dim { color: #aab6b7; }
.line { display: inline-block; width: 22px; height: 0; }
.line.solid { border-top: 1.5px solid #9fb2b3; }
.line.dashed { border-top: 1.5px dashed #b98a3e; }

/* ---------- 详情面板 ---------- */
.panel {
  position: absolute;
  top: 16px; right: 18px;
  width: 360px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 20px 22px;
  z-index: 10;
}
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 2px; }

.p-meta {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.p-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  letter-spacing: 0.05em;
}
.p-title { font-size: 19px; font-weight: 700; margin: 10px 0 2px; }
.p-sub { font-size: 12px; color: var(--muted); }
.p-id {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px; color: var(--muted);
  margin-top: 6px;
}
.p-rule { border: none; border-top: 1px solid var(--hairline); margin: 14px 0; }
.p-sec-title {
  font-size: 11px; letter-spacing: 0.12em; color: var(--muted);
  margin-bottom: 8px;
}
.p-desc { font-size: 13px; line-height: 1.7; }
.p-path {
  font-size: 12px; color: var(--muted); line-height: 1.8;
}
.p-path b { color: var(--ink); font-weight: 600; }

.p-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 7px; overflow: hidden; margin-top: 14px; }
.p-stat { background: var(--panel); padding: 12px 14px; }
.p-stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.p-stat .k { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; margin-top: 2px; }

.p-list { list-style: none; }
.p-list li {
  padding: 7px 2px;
  border-bottom: 1px dashed var(--hairline);
  font-size: 12.5px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  transition: padding-left .15s;
}
.p-list li:last-child { border-bottom: none; }
.p-list li:hover { padding-left: 6px; }
.p-list .rel-label { font-size: 11px; color: #b98a3e; white-space: nowrap; }
.p-list .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

.p-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--ink);
  padding-bottom: 1px;
}
.p-link:hover { border-bottom-style: solid; }

.p-tip { font-size: 12px; color: var(--muted); line-height: 1.8; margin-top: 14px; }
.p-tip b { color: var(--ink); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stage { height: auto; display: flex; flex-direction: column; }
  .graph { position: relative; height: 62vh; inset: auto; }
  .toolbar { position: static; max-width: none; padding: 10px 12px 0; }
  .panel { position: static; width: auto; max-height: none; margin: 12px; }
  .edge-legend { display: none; }
  #searchInput { width: 100%; }
  .search-box { flex: 1 1 100%; }
}
