/* 关系图谱页。图谱本身使用固定 viewBox，容器必须给 SVG 一个可见高度，
   否则浏览器会退回 SVG 的 300×150 默认尺寸，右侧节点会被裁掉。 */
.relation-banner{display:flex;align-items:center;gap:12px;padding:14px 16px;margin-bottom:16px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#59656a}
.relation-banner>svg{width:22px;height:22px;flex:none;color:var(--accent)}
.relation-banner>div{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.relation-banner strong{font-size:14px;color:#354149;font-weight:600}
.relation-banner span{font-size:11px;color:#89949a;line-height:1.6}
.relation-banner>.badge{flex:none}
.relation-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px;padding:10px 12px;border:1px solid var(--line);border-radius:7px;background:#fff;color:#6c777c;font-size:11px}
.relation-toolbar label{display:flex;align-items:center;gap:6px;min-height:30px}
.relation-toolbar select{min-height:30px;padding:5px 8px;font-size:11px;max-width:220px}
.relation-toolbar .relation-checkbox{cursor:pointer;white-space:nowrap}
.relation-toolbar input{width:14px;height:14px;padding:0;accent-color:var(--accent)}
.relation-count{margin-left:auto;color:#9aa3a7;font-size:10px;white-space:nowrap}
.relation-layout{display:grid;grid-template-columns:minmax(540px,1fr) minmax(300px,360px);gap:16px;align-items:start}
.relation-graph-panel,.relation-inspector{min-width:0;border:1px solid var(--line);border-radius:8px;background:#fff;overflow:hidden}
.relation-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:15px 17px;border-bottom:1px solid var(--line);background:#fcfdfc}
.relation-panel-head h2{font-size:14px;color:#39464b}
.relation-panel-head p{margin-top:4px;font-size:10px;color:#9aa3a7;line-height:1.6}
.relation-legend{display:flex;align-items:center;gap:12px;flex:none;color:#879196;font-size:10px;padding-top:2px}
.relation-legend span{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.relation-panel-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}
.relation-dot{display:inline-block;width:10px;height:8px;background:#d98173;flex:none}
.relation-dot-person{border-radius:999px;background:#e56d64}
.relation-dot-material{clip-path:polygon(0 0,82% 0,100% 50%,82% 100%,0 100%,18% 50%);background:#d79b57}
.relation-dot-item{width:9px;height:9px;transform:rotate(45deg);border-radius:1px;background:#9274c5}
.relation-dot-event{border-radius:999px;background:#74a6b8}
.relation-canvas{position:relative;min-height:360px;height:min(62vh,600px);padding:8px 12px;overflow:hidden;background:radial-gradient(circle at 50% 48%,#fff 0%,#fff 38%,#fcfdfc 100%)}
.relation-graph-svg{display:block;width:100%;height:100%;min-height:340px;overflow:visible}
.relation-graph-svg marker path{fill:#c4aaa5}
.relation-reset{display:inline-flex;align-items:center;gap:5px;min-height:30px;padding:5px 9px;border:1px solid var(--line);border-radius:5px;background:#fff;color:#7f898d;font-size:11px;cursor:pointer}
.relation-reset:hover{border-color:var(--brand-line,#e9b6aa);color:var(--accent);background:var(--brand-soft,#fff8f6)}
.relation-reset svg{width:14px;height:14px}
.relation-reset-primary{min-height:32px;padding-inline:11px;border-color:var(--brand-line,#e9b6aa);background:var(--brand-soft,#fff8f6);color:var(--accent);font-weight:600;box-shadow:0 2px 7px rgba(215,25,20,.08)}
.relation-reset-primary:hover{background:#fff0ed;border-color:var(--accent)}
.relation-edge{fill:none;stroke:#d7c5c1;stroke-width:1.8;stroke-linecap:round;vector-effect:non-scaling-stroke;cursor:pointer;pointer-events:stroke;transition:stroke .18s ease,stroke-width .18s ease,opacity .18s ease,filter .18s ease}
.relation-edge:hover,.relation-edge.is-selected,.relation-edge.is-active{stroke:var(--accent);stroke-width:3.5;filter:drop-shadow(0 0 3px rgba(215,25,20,.25))}
.relation-edge.is-related{stroke:#d9988d;stroke-width:2.7;opacity:.9}
.relation-edge.is-dimmed{opacity:.12;pointer-events:stroke}
.relation-node{cursor:grab;outline:none;user-select:none}
.relation-node{touch-action:none;will-change:transform}
.relation-node.is-dragging{cursor:grabbing}
.relation-node-shape{fill:#fff;stroke:#d9e0df;stroke-width:1.5;vector-effect:non-scaling-stroke;filter:drop-shadow(0 3px 6px rgba(38,52,61,.08));transition:fill .18s ease,stroke .18s ease,stroke-width .18s ease,opacity .18s ease,filter .18s ease}
.relation-node:hover .relation-node-shape,.relation-node:focus .relation-node-shape,.relation-node.is-selected .relation-node-shape{fill:#fff8f6;stroke:var(--accent);stroke-width:2}
.relation-node-money .relation-node-shape{fill:#fffaf3;stroke:#e3cda8}
.relation-node-item .relation-node-shape{fill:#faf7ff;stroke:#bda8df}
.relation-node-event .relation-node-shape{fill:#f5f9fb;stroke:#a9c5d1}
.relation-node.is-related .relation-node-shape{stroke:var(--accent);stroke-width:2.2;filter:drop-shadow(0 0 5px rgba(215,25,20,.2))}
.relation-node.is-active .relation-node-shape{stroke:var(--accent);stroke-width:3;filter:drop-shadow(0 0 8px rgba(215,25,20,.28))}
.relation-node-center .relation-node-shape{stroke:#c94a42;stroke-width:2.4;filter:drop-shadow(0 5px 10px rgba(215,25,20,.16))}
.relation-node-center .relation-node-label{font-size:15px}
.relation-node.is-dimmed{opacity:.16}
.relation-node.is-active .relation-node-label,.relation-node.is-active .relation-node-type{font-weight:700}
.relation-node.is-related .relation-node-label{fill:#5f3d39}
@keyframes relation-pulse{0%,100%{opacity:1}50%{opacity:.68}}
.relation-node.is-active{animation:relation-pulse 1.8s ease-in-out infinite}
@keyframes relation-edge-pulse{0%,100%{stroke-opacity:.72}50%{stroke-opacity:1}}
.relation-edge.is-related{animation:relation-edge-pulse 1.6s ease-in-out infinite}
.relation-node-type{font:500 11px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;fill:#9a6e63;pointer-events:none}
.relation-node-label{font:600 14px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;fill:#3d494f;pointer-events:none}
.relation-inspector{max-height:calc(100vh - 260px);overflow:auto;position:sticky;top:78px}
.relation-inspector .relation-panel-head{position:sticky;top:0;z-index:2}
.relation-selected,.relation-explanation,.relation-edge-card{padding:16px}
.relation-selected h3,.relation-edge-card h3{font-size:15px;color:#3e4b50;line-height:1.5}
.relation-selected>span{display:block;margin-top:4px;font-size:10px;color:#9a6e63}
.relation-selected>p,.relation-edge-card>p,.relation-explanation p{margin-top:10px;font-size:11px;line-height:1.75;color:#78858a}
.relation-explanation p+p{margin-top:7px}
.relation-edge-card{margin:12px;border:1px solid #eee5e2;border-radius:7px;background:#fffdfc}
.relation-edge-card.is-selected{border-color:var(--brand-line,#e9b6aa);box-shadow:0 0 0 2px rgba(215,25,20,.07)}
.relation-edge-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:9px}
.relation-edge-card h3 span{color:#b3babd;font-weight:400;margin:0 3px}
.relation-edge-sources{display:flex;flex-direction:column;gap:5px;margin-top:12px}
.relation-source-link{display:flex;align-items:center;gap:6px;width:100%;min-height:28px;padding:4px 6px;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--accent);font-size:10px;text-align:left;justify-content:flex-start;white-space:normal}
.relation-source-link:hover{border-color:var(--brand-line,#e9b6aa);background:var(--brand-soft,#fff8f6)}
.relation-source-link:disabled{color:#adb5b8;background:transparent;border-color:transparent}
.relation-source-link svg{width:13px;height:13px;flex:none}
.relation-unavailable{display:block;color:#a7afb2;font-size:10px;padding:4px 6px}
.relation-citation-more{display:block;padding:3px 5px;color:#9a8f86;font-size:10px}
.relation-edge-list{margin-top:16px;border:1px solid var(--line);border-radius:8px;background:#fff;overflow:hidden}
.relation-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 17px;border-bottom:1px solid var(--line);background:#fcfdfc}
.relation-section-head h2{font-size:14px;color:#39464b}
.relation-section-head>span{font-size:10px;color:#9aa3a7}
.relation-summary-wrap{overflow-x:auto}
.relation-summary-table{width:100%;min-width:700px;border-collapse:collapse;table-layout:fixed;font-size:11px}
.relation-summary-table th{height:36px;padding:8px 12px;background:#f8faf9;color:#8b969a;font-size:10px;font-weight:500;border-bottom:1px solid var(--line);text-align:left}
.relation-summary-table th:nth-child(1){width:24%}.relation-summary-table th:nth-child(2){width:16%}.relation-summary-table th:nth-child(3){width:34%}.relation-summary-table th:nth-child(4){width:26%}
.relation-summary-table td{padding:11px 12px;vertical-align:top;border-bottom:1px solid #eef1ef;color:#68767b;line-height:1.65;overflow-wrap:anywhere}
.relation-summary-table tbody tr:last-child td{border-bottom:0}
.relation-summary-row{cursor:pointer}
.relation-summary-row:hover,.relation-summary-row.is-selected{background:#fff8f6}
.relation-summary-table td strong{display:block;color:#46535a;font-weight:600}
.relation-summary-table td small{display:block;margin-top:3px;color:#a0a9ad;font-size:9px}
.relation-summary-table .relation-kind{display:inline-block;margin-right:5px}
.relation-summary-table .relation-edge-sources{margin-top:-3px}
.relation-kind{display:inline-flex;align-items:center;min-height:19px;padding:0 5px;border-radius:3px;background:#fff0ed;color:#a9473d;font-size:10px;white-space:nowrap}
.relation-basis{color:#78858a;font-size:10px}
.relation-graph-panel+.relation-inspector .story-source-wrap{margin:0;border:0;border-top:1px solid var(--line);border-radius:0}
.relation-inspector .source-panel{border:0}
.relation-inspector .source-head{padding:11px 14px}
.relation-inspector .source-content{max-height:36vh;padding:12px}
.relation-inspector .source-footer{position:sticky;bottom:0;background:#fff}
.relation-inspector .source-line{font-size:12px;grid-template-columns:22px minmax(0,1fr)}
@media(max-width:1100px){.relation-layout{grid-template-columns:minmax(0,1fr) minmax(280px,330px);gap:12px}.relation-canvas{height:430px}}
@media(max-width:900px){.relation-layout{grid-template-columns:1fr}.relation-inspector{position:relative;top:auto;max-height:none;overflow:visible}.relation-inspector .relation-panel-head{position:relative}.relation-inspector .source-content{max-height:42vh}.relation-canvas{height:400px}}
@media(max-width:600px){.relation-banner{align-items:flex-start;padding:12px}.relation-banner>.badge{display:none}.relation-banner strong{font-size:13px}.relation-toolbar{align-items:flex-start;flex-direction:column;gap:7px}.relation-toolbar label{width:100%;justify-content:space-between}.relation-toolbar select{max-width:none;flex:1}.relation-count{margin-left:0}.relation-panel-head{padding:13px 14px}.relation-panel-actions{width:100%;justify-content:space-between;gap:8px}.relation-legend{gap:7px;font-size:9px}.relation-reset-primary{font-size:10px}.relation-canvas{height:360px;min-height:300px;padding:5px}.relation-graph-svg{min-height:300px}.relation-summary-table{min-width:650px}}
