/* Graph workspace: shared application colours, type and control conventions. */
#app:has(#page-graph.active) { padding: var(--nav-height) 0 0; max-width: none; margin-right: 0; }
#page-graph { position: relative; height: calc(100dvh - var(--nav-height)); min-height: 360px; }
#page-graph.active { display: block; }
#page-graph > .graph-container { height: 100%; min-height: 0; }
.graph-widget-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.graph-workspace-bar { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 40; }
.graph-workspace-bar > * { pointer-events: auto; }
#graph-workspace-status { font-size: .78rem; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xs); padding: 4px 10px; }
.graph-widget { position: absolute; width: 268px; max-width: calc(100% - 24px); display: flex; flex-direction: column; pointer-events: auto; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); box-shadow: var(--shadow-card-hover); overflow: hidden; }
.graph-widget[hidden], .graph-widget-body[hidden] { display: none; }
.graph-widget-header { display: flex; align-items: center; flex: 0 0 38px; height: 38px; gap: 4px; padding: 0 7px; background: var(--bg-card-hover); }
.graph-widget-header h2 { flex: 1; min-width: 0; margin: 0; font: 600 .85rem var(--font-stack); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.graph-widget-icon { width: 28px; height: 28px; padding: 4px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-xs); color: var(--text-secondary); background: transparent; cursor: pointer; }
.graph-widget-icon:hover { background: var(--bg-secondary); color: var(--accent-teal); }
.graph-widget-icon:focus-visible, .graph-mini-node:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: -2px; }
.graph-widget-handle { cursor: grab; touch-action: none; }
.graph-widget-handle svg { width: 19px; height: 19px; }
.graph-widget.is-dragging { box-shadow: 0 8px 32px #0004; }
.graph-widget.is-dragging .graph-widget-handle { cursor: grabbing; }
.graph-widget-body { padding: 12px; overflow: auto; overscroll-behavior: contain; min-height: 0; border-top: 1px solid var(--border-color); }
.graph-widget .gsp-section { margin-bottom: 12px; }
.graph-widget .gsp-section:last-child { margin-bottom: 0; }
.graph-widget .control-input { width: 100%; font: inherit; font-size: .8rem; }
.graph-widget .toggle-label { font-size: .8rem; margin: 5px 0; }
.graph-widget-note { font-size: .75rem; line-height: 1.4; color: var(--text-muted); margin: 8px 0 0; }
.graph-widget .graph-legend { margin: 0; padding: 0; border: 0; flex-direction: column; gap: 8px; }
.graph-widget .legend-item { font-size: .78rem; }
.graph-legend-shape { display: inline-block; flex: 0 0 12px; height: 12px; background: var(--text-secondary); }
.graph-legend-buyer { border-radius: 2px; }
.graph-legend-supplier { border-radius: 50%; }
.graph-legend-consortium { background: #d982ff; transform: rotate(45deg); margin: 2px; flex-basis: 9px; height: 9px; }
.graph-widget-details { width: 440px; }
.graph-widget-details .graph-widget-header { border-left: 3px solid var(--accent-teal); }
.graph-inspector-title { font-size: 1.2rem; line-height: 1.3; margin: 4px 0 10px; overflow-wrap: anywhere; }
.graph-inspector-kind { color: var(--accent-teal); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.graph-inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.graph-inspector-actions a { text-decoration: none; }
.graph-inspector-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.graph-inspector-metric { padding: 10px; background: var(--bg-secondary); border-radius: var(--radius-xs); }
.graph-inspector-metric small { display: block; font-size: .72rem; color: var(--text-secondary); }
.graph-inspector-metric strong { display: block; font-size: 1.1rem; overflow-wrap: anywhere; }
.graph-inspector-method { border-left: 3px solid var(--accent-teal); padding: 6px 10px; margin: 12px 0; background: var(--bg-secondary); color: var(--text-secondary); font-size: .78rem; line-height: 1.45; }
.graph-inspector-method summary { cursor: pointer; color: var(--text-primary); font-weight: 600; }
.graph-inspector-method p { margin: 6px 0; }
.graph-inspector-tabs { display: flex; gap: 4px; margin: 14px 0 10px; border-bottom: 1px solid var(--border-color); }
.graph-inspector-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-secondary); padding: 8px 4px; font: 600 .84rem var(--font-stack); cursor: pointer; }
.graph-inspector-tabs button[aria-selected="true"] { color: var(--accent-teal); border-color: var(--accent-teal); }
.graph-mini { width: 100%; height: 220px; display: block; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-xs); margin: 10px 0; }
.graph-mini line { stroke: var(--border-hover); stroke-width: 1.5; }
.graph-mini-node { cursor: pointer; }
.graph-mini-node text { fill: var(--text-primary); font: 11px var(--font-stack); }
.graph-mini-node circle, .graph-mini-node rect, .graph-mini-node polygon { stroke: var(--bg-card); stroke-width: 2; }
.graph-mini-node:hover text { fill: var(--accent-teal); font-weight: 600; }
.graph-inspector-row { padding: 10px 0; border-bottom: 1px solid var(--border-color); }
.graph-inspector-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.graph-inspector-row-head > button { text-align: left; border: 0; padding: 0; background: transparent; color: var(--accent-teal); font: 600 .85rem var(--font-stack); cursor: pointer; overflow-wrap: anywhere; }
.graph-inspector-row-head small { flex-shrink: 0; color: var(--text-secondary); font-size: .73rem; }
.graph-inspector-row p { font-size: .78rem; color: var(--text-secondary); margin: 4px 0; }
.graph-inspector-row .graph-inspector-actions { margin: 6px 0 0; }
.graph-inspector-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 0; font-size: .75rem; color: var(--text-secondary); }
.graph-contract-evidence { margin-top: 8px; padding: 10px; background: var(--bg-secondary); border-radius: var(--radius-xs); font-size: .8rem; }
.graph-contract-evidence dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.graph-contract-evidence dt { color: var(--text-secondary); }
.graph-contract-evidence dd { text-align: right; margin: 0; overflow-wrap: anywhere; }
.graph-contract-evidence h4 { font-size: .8rem; margin: 12px 0 4px; }
.graph-contract-evidence a { overflow-wrap: anywhere; }
.graph-contract-evidence .graph-value-warning { color: var(--accent-amber); font-weight: 600; }
@media (max-width: 700px) {
    .graph-workspace-bar { gap: 4px; top: 8px; }
    #graph-workspace-status { display: none; }
    .graph-widget { width: min(300px, calc(100% - 24px)); }
    .graph-widget-details { width: calc(100% - 24px); }
}
