/* ============ 担保链图谱 ============ */

.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; }
.page-title { font-size: 19px; font-weight: 700; color: var(--green-950); letter-spacing: 0.02em; }
.page-subtitle { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.page-title-actions { display: flex; gap: 8px; }
.head-sub { font-size: 11.5px; font-weight: 400; color: var(--ink-3); }

/* Filters */
.graph-filters { padding: 9px 12px; }

.graph-legend {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-2);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.graph-legend .lg { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.lg-line { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.lg-line.solid.green { border-color: var(--green-700); }
.lg-line.dashed { border-top-style: dashed; }
.lg-line.dashed.brass { border-color: var(--brass-500); }
.lg-line.solid.grey { border-color: #A5A492; }
.lg-line.dashed.red { border-color: var(--red-500); }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--red-500); }

/* Layout */
.graph-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) 320px;
  gap: 10px;
  align-items: stretch;
  min-height: 480px;
}

.graph-side-left { display: flex; flex-direction: column; gap: 10px; }

/* Risk overview */
.risk-stat { padding: 4px 0 8px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.risk-stat:last-of-type { border-bottom: none; margin-bottom: 0; }
.risk-stat .rs-label { font-size: 11.5px; color: var(--ink-3); }
.risk-stat .rs-value { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--green-950); }
.risk-stat .rs-value .rs-unit { font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }

.risk-dist-title { font-size: 12px; font-weight: 700; color: var(--green-900); margin: 10px 0 6px; }

.risk-dist-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  padding: 3px 0;
}

.risk-dist-item .num { margin-left: auto; font-weight: 600; }
.risk-dist-item .dot.red { background: var(--red-500); }

/* Graph controls */
.graph-controls { display: flex; gap: 14px; align-items: center; justify-content: center; }

.ctrl-pad {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  grid-template-rows: repeat(3, 26px);
  gap: 3px;
  justify-items: center;
  align-items: center;
}

.ctrl-pad .ctrl-btn:nth-child(1) { grid-column: 2; grid-row: 1; }
.ctrl-pad .ctrl-btn:nth-child(2) { grid-column: 1; grid-row: 2; }
.ctrl-pad .ctrl-btn:nth-child(3) { grid-column: 2; grid-row: 2; }
.ctrl-pad .ctrl-btn:nth-child(4) { grid-column: 3; grid-row: 2; }
.ctrl-pad .ctrl-btn:nth-child(5) { grid-column: 2; grid-row: 3; }

.ctrl-col { display: flex; flex-direction: column; gap: 4px; }

.ctrl-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover { border-color: var(--green-700); color: var(--green-800); }
.ctrl-center { color: var(--brass-600); }

/* Graph canvas */
.graph-canvas-card {
  position: relative;
  min-height: 480px;
  background:
    radial-gradient(circle at 72% 34%, rgba(192, 57, 43, 0.05), transparent 42%),
    #FFFFFF;
}

#graphCanvas { position: absolute; inset: 0; }

.graph-flag {
  position: absolute;
  top: 14px;
  right: 18%;
  z-index: 5;
  background: var(--red-bg);
  border: 1px solid var(--red-500);
  color: var(--red-600);
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 3px;
  padding: 3px 10px;
  pointer-events: none;
}

/* Right detail panel */
.graph-side-right { overflow-y: auto; max-height: 640px; display: flex; flex-direction: column; }

.circle-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #FFF7F6, #fff);
}

.circle-head .ch-title-row { display: flex; align-items: center; gap: 8px; }
.circle-head .ch-title { font-size: 15px; font-weight: 700; color: var(--red-600); }

.circle-head .ch-metrics { display: flex; gap: 18px; margin-top: 8px; }
.ch-metric .m-label { font-size: 11px; color: var(--ink-3); }
.ch-metric .m-value { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink); }
.ch-focus { font-size: 12px; color: var(--red-600); font-weight: 600; margin-top: 6px; }
.circle-body .field-row.is-focus { background: var(--red-bg); border-radius: 3px; padding: 2px 4px; }

.score-block { text-align: right; margin-left: auto; }
.score-block .score-num { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--red-500); line-height: 1; }
.score-block .score-den { font-size: 11px; color: var(--ink-3); }
.score-block .score-label { font-size: 11px; color: var(--ink-3); }

.circle-tabs { display: flex; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); }

.circle-tab {
  padding: 8px 2px;
  font-size: 12.5px;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.circle-tab.active { color: var(--green-900); font-weight: 700; border-bottom-color: var(--green-800); }

.circle-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.circle-path-stack { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin-top: 8px; }
.circle-path-stack .path-card { min-width: 0; }
.circle-path-stack .path-arrow { align-self: center; padding: 4px 0; transform: rotate(90deg); }
.circle-body .field-list { display: flex; flex-direction: column; gap: 7px; }
.circle-body .field-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.5; }
.circle-body .field-label { color: var(--ink-3); }
.circle-body .field-value { color: var(--ink); text-align: right; }
.circle-body .mod-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }

.circle-points-title { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--green-900); }
.circle-points-title .link-btn { margin-left: auto; font-weight: 500; }

.ai-badge-sm {
  font-size: 10px;
  font-weight: 400;
  color: var(--brass-600);
  border: 1px solid var(--brass-200);
  background: var(--amber-bg);
  border-radius: 3px;
  padding: 0 5px;
  line-height: 15px;
}

.circle-point {
  display: flex;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.65;
}

.circle-point .dot { margin-top: 6px; flex-shrink: 0; }

/* stress simulation */
.stress-box { background: var(--parchment); border: 1px solid var(--line-strong); border-radius: 5px; padding: 10px 12px; }
.stress-title { display: flex; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--green-900); margin-bottom: 8px; }
.stress-title .select { margin-left: auto; font-size: 11px; padding: 2px 6px; }

.stress-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stress-metric .sm-label { font-size: 10.5px; color: var(--ink-3); }
.stress-metric .sm-value { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--red-500); }
.stress-metric .sm-value .sm-unit { font-family: var(--sans); font-size: 10px; font-weight: 400; color: var(--ink-3); }

.stress-more { width: 100%; margin-top: 9px; }

/* advice */
.advice-item { display: flex; gap: 6px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.advice-item .adv-idx { color: var(--brass-600); font-weight: 700; flex-shrink: 0; }

/* related alerts */
.rel-head { display: flex; align-items: center; }
.rel-head .link-btn { margin-left: auto; }

.rel-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 12px;
}

.rel-alert:last-child { border-bottom: none; }
.rel-alert .rel-text { color: var(--ink-2); line-height: 1.5; }
.rel-alert .rel-time { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }

/* Path preview */
.path-body { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 14px 16px; }

.path-card {
  min-width: 168px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 9px 11px;
  background: #fff;
  flex-shrink: 0;
}

.path-card.origin { border-color: var(--red-500); background: #FFF9F8; }

.path-card .pc-name { font-size: 12px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 5px; }
.path-card .pc-badge { font-size: 9.5px; background: var(--red-500); color: #fff; border-radius: 2px; padding: 0 4px; line-height: 14px; }

.path-card .pc-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 5px;
}

.path-card .pc-row .num { color: var(--ink); font-weight: 600; }

.path-arrow {
  align-self: center;
  padding: 0 10px;
  color: var(--red-500);
  font-size: 16px;
  flex-shrink: 0;
}

@media (max-width: 1250px) {
  .graph-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .graph-side-right { grid-column: 1 / -1; max-height: none; }
}
