.graph-shell {
  --graph-bg: var(--code);
  --graph-surface: var(--sheet);
  --graph-raised: var(--chrome);
  --graph-border: var(--stroke);
  --graph-muted: var(--muted);
  --graph-ink: var(--text);
  --graph-key: #71d0bd;
  --graph-review: #ceaa7a;
  --graph-focus: var(--accent);
  min-width: 0;
  padding: clamp(12px, 2vw, 24px);
  color: var(--graph-ink);
}
.graph-header { display: flex; justify-content: space-between; align-items: start; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.graph-header h2 { color: var(--graph-ink); font-size: 1.25rem; line-height: 1.25; letter-spacing: -.025em; }
.graph-header p { color: var(--graph-muted); margin-top: 4px; font-size: .875rem; }
.graph-header-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.graph-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--graph-border); border-radius: 7px; background: var(--graph-bg); }
.graph-switch button { border: 1px solid transparent; padding: 5px 9px; background: transparent; border-radius: 4px; color: var(--graph-muted); font-size: .81rem; font-weight: 600; white-space: nowrap; }
.graph-switch button:hover { color: var(--graph-ink); }
.graph-switch button[aria-pressed="true"] { color: var(--accent-ink); background: var(--soft-accent); border-color: var(--accent-border); }
.graph-search { position: relative; display: flex; align-items: center; gap: 7px; min-width: min(200px, 100%); padding: 0 7px 0 10px; border: 1px solid var(--graph-border); border-radius: 6px; background: var(--graph-bg); }
.graph-search:focus-within { border-color: var(--graph-focus); box-shadow: 0 0 0 1px #ff967a46; }
.graph-search input { flex: 1; min-width: 0; width: 134px; height: 34px; border: 0; outline: none; padding: 0; font: inherit; font-size: .81rem; color: var(--graph-ink); background: transparent; }
.graph-search input::placeholder { color: var(--graph-muted); }
.graph-search input:focus-visible { outline: none; }
.graph-search kbd { flex: 0 0 auto; color: var(--graph-muted); border: 1px solid var(--graph-border); border-radius: 3px; font: .72rem var(--mono); padding: 1px 4px; }
.graph-search-icon { position: relative; flex: 0 0 10px; width: 10px; height: 10px; border: 1.5px solid var(--graph-muted); border-radius: 100%; margin-right: 3px; }
.graph-search-icon::after { content: ''; position: absolute; right: -4px; bottom: -2px; width: 5px; height: 1.5px; transform: rotate(45deg); background: var(--graph-muted); }
.graph-search-results { position: absolute; inset: calc(100% + 6px) 0 auto 0; min-width: 236px; z-index: 12; border: 1px solid var(--stroke-strong); border-radius: 6px; background: var(--graph-raised); padding: 4px; max-height: 265px; overflow: auto; box-shadow: 0 12px 25px #0a090da0; }
.graph-search-results button { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 8px; text-align: left; background: transparent; border: 0; border-radius: 3px; color: var(--graph-ink); }
.graph-search-results button:hover, .graph-search-results [aria-selected="true"] { background: var(--soft-accent); }
.graph-search-results code { min-width: 0; overflow-wrap: anywhere; font: .76rem var(--mono); }
.graph-search-results button span { flex: 0 0 auto; font-size: .69rem; color: var(--graph-muted); }
.graph-search-results p { padding: 7px; font-size: .76rem; color: var(--graph-muted); }
.graph-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.graph-controls { display: flex; align-items: end; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.graph-controls label { display: grid; gap: 4px; min-width: 128px; color: var(--graph-muted); font-size: .785rem; font-weight: 550; }
.graph-controls select { appearance: none; width: 100%; min-height: 34px; padding: 6px 29px 6px 9px; border: 1px solid var(--graph-border); border-radius: 5px; background: linear-gradient(45deg,transparent 50%,var(--graph-muted) 50%) right 14px center/5px 5px no-repeat,linear-gradient(135deg,var(--graph-muted) 50%,transparent 50%) right 9px center/5px 5px no-repeat,var(--graph-surface); color: var(--graph-ink); font: inherit; cursor: pointer; }
.graph-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(211px,265px); gap: 12px; align-items: start; }
.graph-board { min-width: 0; border: 1px solid var(--graph-border); border-radius: 8px; background: var(--graph-surface); }
.graph-board-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 10px; padding: 8px 11px; color: var(--graph-ink); font-size: .82rem; }
.graph-board-title, .graph-board-title p { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; min-width: 0; }
.graph-board-title code { overflow-wrap: anywhere; color: var(--graph-ink); font: 650 .82rem var(--mono); }
.graph-board-icon { color: var(--accent); font-size: 1rem; }
.graph-count { font-size: .75rem; color: var(--graph-muted); }
.graph-tools { display: flex; align-items: center; gap: 3px; }
.graph-tool { display: inline-flex; align-items: center; justify-content: center; min-width: 27px; height: 27px; padding: 0 4px; border: 1px solid var(--graph-border); border-radius: 4px; color: var(--graph-ink); background: var(--graph-raised); font: 650 .94rem/1 var(--mono); }
.graph-tool:hover:not(:disabled) { border-color: var(--accent-border); background: var(--hover); }
.graph-tool:disabled { opacity: .45; cursor: default; }
.graph-tool-text { min-width: 0; padding-inline: 7px; font: 600 .75rem/1 var(--sans, system-ui); }
.graph-zoom { min-width: 34px; color: var(--graph-muted); text-align: center; font: 500 .71rem var(--mono); }
.graph-navigation { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; padding: 6px 11px 7px; border-top: 1px solid var(--graph-border); background: var(--graph-surface); color: var(--graph-muted); font-size: .726rem; }
.graph-legend { display: flex; gap: 10px; }
.graph-legend span { display: flex; align-items: center; gap: 5px; }
.graph-legend span::before { content: ''; display: inline-block; width: 16px; border-top: 2px solid var(--graph-key); }
.graph-legend .graph-review-mark::before { border-top: 2px dashed var(--graph-review); }
.graph-viewport { position: relative; height: clamp(292px, 53vh, 480px); overflow: auto; isolation: isolate; overscroll-behavior: contain; border-top: 1px solid var(--graph-border); border-radius: 0 0 7px 7px; scrollbar-color: var(--stroke-strong) var(--graph-bg); background: radial-gradient(circle,var(--stroke) 1px,transparent 1.2px) 0 0/18px 18px,var(--graph-bg); cursor: grab; }
.graph-viewport:focus-visible { outline-offset: -2px; }
.graph-viewport.is-panning { cursor: grabbing; user-select: none; }
.graph-extent { position: relative; min-width: 100%; min-height: 100%; overflow: hidden; }
.graph-world { position: absolute; inset: 0 auto auto 0; transform-origin: 0 0; }
.graph-space { position: relative; width: 678px; }
.graph-links { position: absolute; z-index: 0; inset: 0 auto auto 0; }
.graph-stroke { fill: none; stroke: var(--graph-key); stroke-width: 1.7; opacity: .82; }
.graph-stroke.review { stroke: var(--graph-review); stroke-dasharray: 5 4; }
.graph-stroke.selected { stroke: var(--graph-focus); stroke-width: 2.65; opacity: 1; }
.graph-edge-hit { stroke: transparent; stroke-width: 15; fill: none; pointer-events: stroke; cursor: pointer; }
.graph-edge-hit:hover { stroke: #ff967a30; }
.graph-card { position: absolute; top: var(--gy); left: var(--gx); width: var(--gw); z-index: 1; border: 1px solid var(--stroke-strong); border-radius: 7px; background: var(--graph-surface); box-shadow: 0 7px 18px #0a090d70; }
.graph-card-selected { border-color: var(--graph-focus); box-shadow: 0 0 0 1px #ff967a35, 0 7px 18px #0a090d70; }
.graph-card-title { display: flex; align-items: center; gap: 8px; width: 100%; height: 45px; padding: 0 10px; border-radius: 6px 6px 0 0; background: var(--graph-raised); text-align: left; }
.graph-card-title:hover, .graph-card-title[aria-pressed="true"] { background: var(--soft-accent); }
.graph-card-title>span { color: var(--accent); font-size: 1.03rem; }
.graph-card-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--graph-ink); font: 650 .83rem var(--mono); }
.graph-card-title small { margin-left: auto; color: var(--graph-muted); font-size: .68rem; }
.graph-card ul, .graph-field-list { list-style: none; margin: 0; padding: 0; }
.graph-card li { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 28px; padding: 0 10px; border-top: 1px solid var(--graph-border); color: var(--graph-muted); font-size: .795rem; }
.graph-card li.graph-column-selected { background: var(--soft-accent); color: var(--accent-ink); }
.graph-card li code, .graph-field-list code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-card li span { color: #e3cf95; font: .68rem var(--mono); }
.graph-card>p { display: flex; align-items: center; height: 23px; padding: 0 10px; border-top: 1px solid var(--graph-border); color: var(--graph-muted); font-size: .73rem; }
.graph-edge-button { position: absolute; top: var(--gy); left: var(--gx); z-index: 2; transform: translate(-50%,-50%); min-width: 40px; min-height: 24px; padding: 2px 7px; border: 1px solid #4e786f; border-radius: 4px; background: #172f32; color: #acebd8; font: 650 .735rem var(--mono); }
.graph-edge-button.review { border-color: #7b644a; background: #342a2a; color: #edc499; }
.graph-edge-button:hover, .graph-edge-button.selected { border-color: var(--graph-focus); background: var(--soft-accent); color: var(--accent-ink); }
.graph-inspector { min-width: 0; padding: 13px; border: 1px solid var(--graph-border); border-radius: 8px; background: var(--graph-surface); color: var(--graph-ink); }
.graph-inspector h3 { margin: 4px 0 8px; font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.graph-caption { color: var(--accent); font: 650 .71rem/1.4 var(--mono); letter-spacing: .065em; }
.graph-equality { display: grid; gap: 1px; margin: 7px 0 10px; padding: 8px; background: var(--graph-raised); border: 1px solid var(--stroke-strong); border-radius: 5px; color: var(--graph-ink); font-size: .77rem; }
.graph-equality code { overflow-wrap: anywhere; }
.graph-equality span { color: var(--graph-muted); line-height: 1; }
.graph-stats { display: grid; gap: 5px; margin: 10px 0; }
.graph-stats div { display: flex; justify-content: space-between; gap: 8px; font-size: .807rem; }
.graph-stats dt, .graph-muted { color: var(--graph-muted); }
.graph-stats dd { margin: 0; text-align: right; font: 500 .78rem/1.5 var(--mono); }
.graph-muted, .graph-reason { margin: 8px 0; font-size: .817rem; }
.graph-reason { border-left: 2px solid var(--graph-focus); padding: 4px 0 4px 7px; background: var(--graph-raised); color: var(--graph-muted); }
.graph-detail-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 6px; margin-top: 11px; }
.graph-detail-actions .button { white-space: normal; text-align: left; }
.graph-field-list { max-height: 240px; overflow: auto; }
.graph-field-list li { display: flex; justify-content: space-between; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--graph-border); color: var(--graph-ink); font-size: .76rem; }
.graph-field-list li span { color: var(--graph-muted); white-space: nowrap; }
.graph-empty { padding: 11px; font-size: .812rem; color: var(--graph-muted); }
.lineage-chain { display: flex; align-items: center; gap: 37px; width: max-content; height: 100%; list-style: none; margin: 0; padding: 0; }
.lineage-chain li { position: relative; }
.lineage-chain li+li::before { position: absolute; content: ''; width: 29px; height: 8px; top: calc(50% - 4px); left: -33px; background: var(--accent); clip-path: polygon(0 39%,77% 39%,77% 0,100% 50%,77% 100%,77% 61%,0 61%); }
.lineage-card { display: flex; flex-direction: column; align-items: start; gap: 7px; width: 218px; min-height: 120px; padding: 11px; border: 1px solid var(--stroke-strong); border-radius: 7px; color: var(--graph-ink); background: var(--graph-raised); text-align: left; box-shadow: 0 7px 18px #0a090d70; }
.lineage-card:hover, .lineage-card[aria-pressed="true"] { border-color: var(--graph-focus); background: var(--soft-accent); }
.lineage-card span { color: var(--graph-muted); font-size: .76rem; }
.lineage-card strong { color: var(--graph-ink); font: 650 .8rem/1.3 var(--mono); overflow-wrap: anywhere; }
.lineage-card code, .graph-trace-column { color: #a7dfd1; font: 550 .83rem/1.35 var(--mono); overflow-wrap: anywhere; }
.graph-trace-column { display: block; margin: 2px 0 6px; }
.graph-file-path { color: var(--graph-muted); font: .7rem/1.4 var(--mono); overflow-wrap: anywhere; }
.graph-sql { margin: 8px 0 0; padding: 5px 0; border: 1px solid var(--graph-border); border-radius: 4px; background: var(--graph-bg); color: var(--graph-ink); font: .7rem/1.55 var(--mono); overflow: auto; }
.graph-sql span { display: block; min-width: max-content; padding-right: 8px; }
.graph-sql i { display: inline-block; width: 26px; margin-right: 5px; color: var(--graph-muted); text-align: right; font-style: normal; }
.graph-sql-focus { color: var(--graph-ink); background: var(--soft-accent); }
.graph-fullscreen { position: fixed !important; inset: 0 !important; z-index: 1000 !important; overflow: auto; background: var(--code); min-height: 100vh; }
.graph-fullscreen .graph-viewport { height: max(292px, calc(100dvh - 201px)); }
@media (max-width: 940px) { .graph-layout { grid-template-columns: minmax(0,1fr) minmax(185px,223px); } }
@media (max-width: 740px) { .graph-layout { grid-template-columns: minmax(0,1fr); } .graph-viewport { height: 355px; } }
@media (max-width: 490px) {
  .graph-header { flex-direction: column; }
  .graph-controls label { flex: 1 1 123px; min-width: 0; }
  .graph-controls select { min-width: 0; }
  .graph-viewport { height: 285px; }
  .graph-fullscreen .graph-viewport { height: max(285px, calc(100dvh - 260px)); }
}
