/* Evidence graph tab (web/graph.js). Uses the variables defined in styles.css. */
#graph .g-head { padding: 12px 16px; }
#graph .g-head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#graph .g-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
#graph #graph-criterion { min-width: 280px; max-width: 100%; }
#graph .g-viewtoggle { display: flex; gap: 4px; }
#graph .g-built { margin-left: auto; font-size: 11.5px; }
#graph .g-intro { margin-top: 6px; }
#graph .src { font-size: 12px; color: var(--muted); }
#graph .g-msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
#graph .g-msg.warn { background: var(--warn-bg); color: var(--warn); }
#graph .g-msg.hidden { display: none; }

#graph .g-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1360px) { #graph .g-body { grid-template-columns: 1fr; } #graph #graph-panel { position: static; max-height: none; } }
#graph .g-canvas { padding: 14px 16px; overflow: hidden; }
#graph .g-svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
#graph #graph-panel { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; font-size: 13.5px; line-height: 1.5; }
#graph .gp-empty { padding: 18px 4px; text-align: center; }
#graph .gp-empty-t { font-weight: 650; color: var(--muted); margin-bottom: 4px; }

/* score breakdown */
#graph .g-score { padding: 14px 18px; }
#graph .g-score.hidden { display: none; }
#graph .gs-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
#graph .gs-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
#graph .gs-head .cls { font-size: 12.5px; padding: 3px 11px; border-radius: 999px; }
#graph .gs-total { margin-left: auto; font-size: 14px; color: var(--ink); }
#graph .gs-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#graph .gs-row { display: grid; grid-template-columns: 112px 190px minmax(0, 1fr); gap: 12px; align-items: center; font-size: 14px; }
@media (max-width: 900px) { #graph .gs-row { grid-template-columns: 100px 1fr; } #graph .gs-detail { grid-column: 1 / -1; } }
#graph .gs-pts { font: 700 13px var(--sans); padding: 3px 10px; border-radius: 999px; text-align: center; border: 1px solid #c9ced6; background: #f3f4f6; color: var(--muted); cursor: pointer; }
#graph span.gs-pts { cursor: default; }
#graph .gs-row.challenge .gs-pts { background: var(--review-bg); color: var(--review); border-color: #e9c48f; }
#graph .gs-row.support .gs-pts { background: var(--retain-bg); color: var(--retain); border-color: #a9d3c0; }
#graph .gs-name { font-weight: 650; text-transform: capitalize; }
#graph .gs-row.context .gs-name { color: var(--muted); font-weight: 600; text-transform: none; }
#graph .gs-detail { color: var(--muted); font-size: 13px; }
#graph .gs-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
#graph .gs-ok { color: var(--pass); font-weight: 650; }
#graph .gs-bad, #graph .gs-mismatch { color: var(--fail); font-weight: 650; }
#graph .gs-mismatch { background: var(--fail-bg); padding: 8px 10px; border-radius: 6px; font-size: 13.5px; }

/* nodes */
.g-svg .g-colhead { font-size: 11.5px; font-weight: 700; fill: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.g-svg .gnode, .g-svg .ggroup { cursor: pointer; outline: none; transition: opacity .15s; }
.g-svg .gnode rect, .g-svg .ggroup rect { fill: #fff; stroke: #aab2bf; stroke-width: 1.2; }
.g-svg .gnode rect.inner { fill: none; stroke-width: 1; }
.g-svg .cap { font-size: 10.5px; font-weight: 700; fill: var(--faint); text-transform: uppercase; letter-spacing: .4px; }
.g-svg .lbl { font-size: 13.5px; fill: var(--ink); }
.g-svg .lbl.strong { font-weight: 700; }
.g-svg .hint { font-size: 12px; fill: var(--accent); font-weight: 600; }
.g-svg .gnode.e-rule_inferred rect, .g-svg .gnode.e-curated_pharmacology rect { stroke-dasharray: 5 3; }
.g-svg .gnode.e-model_generated rect { stroke-dasharray: 1.5 2.5; }
.g-svg .gnode.t-Criterion rect { fill: #fbfaf3; stroke: var(--accent); stroke-width: 1.6; }
.g-svg .gnode.t-CuratedFact rect { fill: #f3faf6; stroke: #7fb79f; }
.g-svg .gnode.t-ComparatorThreshold rect { fill: #fff; stroke: #9aa3b0; }
.g-svg .gnode.t-GuidancePassage rect { fill: #f6f7f9; stroke: #b4bbc6; }
.g-svg .gnode.t-GuidancePassage .lbl { fill: var(--muted); font-size: 12.5px; }
.g-svg .ggroup rect { fill: #f4f5f7; stroke: #b4bbc6; }
.g-svg .ggroup rect.stack1, .g-svg .ggroup rect.stack2 { fill: #eceef1; }
.g-svg .ggroup .lbl { fill: var(--muted); }
.g-svg .ggroup:hover rect:last-of-type, .g-svg .ggroup:focus rect:last-of-type { stroke: var(--accent); }
.g-svg .gnode.t-ScoreRule rect { fill: var(--accent-soft); stroke: var(--accent); }
.g-svg .gnode.t-Assessment rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.g-svg .gnode.t-Recommendation rect { fill: #fff; stroke: var(--accent); }
.g-svg .gnode.t-MissingEvidence rect { fill: var(--insuff-bg); stroke: #a5a9c0; }
.g-svg .gnode.t-Classification rect { stroke-width: 1.6; }
.g-svg .gnode.t-Classification .pill { font-size: 14px; font-weight: 750; text-anchor: middle; }
.g-svg .gnode.t-Classification.k-review rect { fill: var(--review-bg); stroke: #d99a3d; }
.g-svg .gnode.t-Classification.k-review .pill { fill: var(--review); }
.g-svg .gnode.t-Classification.k-retain rect { fill: var(--retain-bg); stroke: var(--retain); }
.g-svg .gnode.t-Classification.k-retain .pill { fill: var(--retain); }
.g-svg .gnode.t-Classification.k-insufficient rect { fill: var(--insuff-bg); stroke: var(--insuff); }
.g-svg .gnode.t-Classification.k-insufficient .pill { fill: var(--insuff); }
.g-svg .gnode.t-ReviewerDecision rect { fill: var(--pass-bg); stroke: var(--pass); }
.g-svg .gnode:hover rect, .g-svg .gnode:focus rect { stroke-width: 2.2; }
.g-svg .gnode.sel rect { stroke: var(--accent); stroke-width: 2.8; }
.g-svg.has-sel .gnode:not(.near), .g-svg.has-sel .ggroup:not(.near) { opacity: .28; }

/* edges */
.g-svg .gedge path { fill: none; stroke: #b4bbc6; stroke-width: 1.2; opacity: .8; transition: opacity .15s; }
.g-svg .gedge.s-supports path { stroke: #4f9a7b; }
.g-svg .gedge.s-challenges path { stroke: #d08a2c; }
.g-svg .gedge.t-EVIDENCE_FOR path { stroke: #b4bbc6; stroke-dasharray: 4 4; stroke-width: 1.1; opacity: .7; }
.g-svg .gedge.t-RULE_SCORES path { stroke-width: 4.5; opacity: 1; stroke-dasharray: none; }
.g-svg .gedge.t-RULE_SCORES.s-supports path { stroke: var(--retain); }
.g-svg .gedge.t-RULE_SCORES.s-challenges path { stroke: #c27414; }
.g-svg .gedge.t-EVIDENCE_IN_RULE path { stroke-width: 2.2; opacity: .95; }
.g-svg .gedge.t-EVIDENCE_IN_RULE.scoped path { stroke-dasharray: 6 3; }
.g-svg .gedge.t-CRITERION_HAS_ASSESSMENT path { stroke: #9fb1c7; stroke-width: 1.2; opacity: .45; }
.g-svg .gedge.t-CRITERION_HAS_ASSESSMENT.hl path { opacity: 1; }
.g-svg .gedge.t-ASSESSMENT_CLASSIFIED_AS path, .g-svg .gedge.t-ASSESSMENT_RECOMMENDS path, .g-svg .gedge.t-ASSESSMENT_LACKS path { stroke: #9fb1c7; stroke-width: 1.4; }
.g-svg.has-sel .gedge:not(.hl) { opacity: .12; }
.g-svg .gedge.hl path { opacity: 1; }
.g-svg .gedge.hl:not(.t-RULE_SCORES) path { stroke-width: 2.6; }
.g-svg .g-elabel { font-size: 11.5px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.g-svg .g-elabel.grp { fill: var(--muted); font-weight: 650; }
.g-svg .g-elabel.grp.scope { fill: var(--retain); font-style: italic; }
.g-svg .g-badge rect { stroke-width: 1.4; }
.g-svg .g-badge text { text-anchor: middle; }
.g-svg .g-badge .b-main { font-size: 13px; font-weight: 800; }
.g-svg .g-badge .b-sub { font-size: 11px; font-weight: 600; }
.g-svg .g-badge.challenge rect { fill: #fff4e3; stroke: #d99a3d; }
.g-svg .g-badge.challenge text { fill: var(--review); }
.g-svg .g-badge.support rect { fill: #e6f4ee; stroke: #6fb093; }
.g-svg .g-badge.support text { fill: var(--retain); }
.g-svg .g-badge { transition: opacity .15s; pointer-events: none; }
.g-svg .g-badge.dim { opacity: .25; }

/* legend */
#graph .g-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11.5px; color: var(--muted); margin-top: 10px; align-items: center; }
#graph .g-legend svg { vertical-align: -2px; }
#graph .g-legend .lg-solid, #graph .g-legend .lg-dashed, #graph .g-legend .lg-dotted { fill: #fff; stroke: #5b6676; stroke-width: 1.2; }
#graph .g-legend .lg-dashed { stroke-dasharray: 4 2; }
#graph .g-legend .lg-dotted { stroke-dasharray: 1.2 2; }
#graph .lg-line { display: inline-block; width: 22px; border-top: 2px solid #9aa3b0; vertical-align: 3px; margin-right: 3px; }
#graph .lg-line.supports { border-color: var(--retain); }
#graph .lg-line.challenges { border-color: var(--review); }
#graph .lg-line.context { border-top-style: dashed; }
#graph .g-legend-notes { flex-basis: 100%; display: grid; gap: 3px; }

/* list view */
#graph .g-listwrap.hidden { display: none; }
#graph .g-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; font-size: 12.5px; }
#graph .g-list-col h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }
#graph .g-list ul { list-style: none; margin: 0; padding: 0; }
#graph .g-li { display: block; width: 100%; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; margin-bottom: 5px; font: 12px/1.4 var(--sans); }
#graph .g-li.sel { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
#graph .g-li .cap, #graph .gp-cap { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--faint); }
#graph .g-list-edges { grid-column: 1 / -1; }

/* side panel */
#graph .gp-title { margin: 2px 0 8px; font-size: 14px; }
#graph .gp-epi.e-source_fact { color: var(--pass); }
#graph .gp-epi.e-human { color: var(--accent); }
#graph .gp-quote { text-align: left; margin: 8px 0 10px; padding: 10px 12px; background: #f7f8fa; border-left: 4px solid var(--accent); border-radius: 0 6px 6px 0; }
#graph .gp-qtext { display: block; font-size: 14px; line-height: 1.5; color: #26313d; font-family: Georgia, "Times New Roman", serif; }
#graph .gp-qtext::before { content: "\201C"; } #graph .gp-qtext::after { content: "\201D"; }
#graph .gp-quote footer { text-align: left; padding: 0; margin-top: 6px; font-size: 11.5px; color: var(--faint); font-style: normal; }
#graph .gp-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0; }
#graph a.gp-btn { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 14px; border-radius: 7px; background: var(--accent); color: #fff; font: 650 13px var(--sans); text-decoration: none; border: 1px solid var(--accent); cursor: pointer; }
#graph a.gp-btn:hover { background: #173d61; }
#graph a.gp-btn .gp-btn-sub { font-size: 11px; font-weight: 500; opacity: .85; }
#graph a.gp-link { font-size: 12.5px; color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
#graph .gp-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
#graph .gp-kv span:nth-child(odd) { color: var(--muted); }
#graph .gp-sub { margin: 10px 0 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--faint); }
#graph .gp-links { margin: 0; padding: 0; list-style: none; }
#graph .gp-links li { margin-bottom: 6px; line-height: 1.4; }
#graph .gp-links .src { display: block; font-size: 11.5px; }
#graph .gp-expl { margin: 8px 0 0; }
#graph button.linkish { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-size: 12px; text-align: left; border-bottom: 1px dotted var(--accent); border-radius: 0; cursor: pointer; }

/* investigator + safeguards */
#graph .g-inv { margin-top: 14px; }
#graph .g-inv-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#graph .g-inv-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 8px; }
#graph .inv-qs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
#graph .inv-model { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
#graph .inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { #graph .inv-grid { grid-template-columns: 1fr; } }
#graph .inv-q-title { font-weight: 700; margin-bottom: 4px; }
#graph .inv-summary { margin: 4px 0 8px; }
#graph .inv-statements { margin: 0; padding-left: 20px; }
#graph .inv-statement { margin-bottom: 14px; font-size: 14px; line-height: 1.5; }
#graph .inv-statement[data-status="unsupported"] .inv-text { text-decoration: line-through; color: var(--faint); }
#graph .inv-status { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; margin-right: 4px; vertical-align: 1px; }
#graph .inv-status.supported { color: var(--pass); background: var(--pass-bg); border-color: #a9d3c0; }
#graph .inv-status.uncertain { color: var(--review); background: var(--review-bg); border-color: #e9c48f; }
#graph .inv-status.unsupported { color: var(--fail); background: var(--fail-bg); border-color: #e7a9a9; text-decoration: line-through; }
#graph .inv-pol { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .4px; margin-right: 4px; }
#graph .inv-ev, #graph .inv-checks { margin-top: 4px; display: flex; gap: 4px 10px; flex-wrap: wrap; }
#graph .inv-ev .ev-chip { font-size: 12.5px; }
#graph .inv-check { display: inline-flex; align-items: center; gap: 5px; font: 11px var(--sans); padding: 1px 8px; border-radius: 999px; background: #eef1f5; color: var(--muted); }
#graph .inv-check[hidden] { display: none; }
#graph .inv-check .ic-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
#graph .inv-check[data-result="pass"] { color: var(--pass); background: var(--pass-bg); }
#graph .inv-check[data-result="warn"] { color: var(--warn); background: var(--warn-bg); }
#graph .inv-check[data-result="fail"] { color: var(--fail); background: var(--fail-bg); }
#graph .inv-general { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
#graph .inv-counter { margin-top: 8px; font-size: 12.5px; }
#graph .inv-empty { background: var(--insuff-bg); color: var(--insuff); padding: 8px 10px; border-radius: 6px; margin: 6px 0; }
#graph .warnbox { background: var(--warn-bg); color: var(--warn); padding: 6px 9px; border-radius: 5px; margin: 6px 0; font-size: 12.5px; }
#graph #inv-security { border: 1px solid #c9d6e6; border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; background: #f4f8fc; font-size: 13px; line-height: 1.45; position: sticky; top: 10px; }
#graph #inv-security h4 { margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
#graph .sec-budget { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
#graph .sec-tile { background: #fff; border: 1px solid #d6e0ec; border-radius: 8px; padding: 6px 8px; text-align: center; }
#graph .sec-tile b { display: block; font-size: 16px; color: var(--ink); }
#graph .sec-tile span { font-size: 11px; color: var(--muted); }
#graph .sec-list { margin: 0; padding-left: 18px; }
#graph .sec-list li { margin-bottom: 4px; }
#graph .sec-list .sec-verifier { font-weight: 650; color: var(--pass); }
#graph .sec-model { font-weight: 650; }
#graph .inv-q-title { font-size: 15px; }
#graph .inv-summary { font-size: 14px; line-height: 1.55; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
#graph button.inv-q { font-size: 13px; padding: 6px 12px; }
