:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --paper:#f6f6f3; --white:#fff; --ink:#111; --grey-1:#deded9; --grey-2:#969691; --grey-3:#5d5d59; --slot-full:#555551; --yellow:#f2c94c; --yellow-dark:#795b00; --yellow-shell:#fff1ae; --gold:#a87300; --gold-light:#efd98d; --gold-shell:#f8edc8; --red:#ed5a4f; --red-dark:#7f241e; --red-shell:#ffd3cf; --blue:#1769d2; --blue-dark:#0d3f80; --blue-light:#a9cdf8; --blue-shell:#dceafb;
  /* Shortest-path colors. Green alternative: --path:#93c722; --path-light:#d4eba0; --path-shell:#eef7dc */
  --path:#1769d2; --path-light:#a9cdf8; --path-shell:#dceafb; }
* { box-sizing: border-box; }
body { margin:0; min-height:100vh; min-height:100dvh; overflow:hidden; color:var(--ink); background:var(--paper); }
button,input,textarea { font:inherit; color:inherit; }
button { cursor:pointer; }
.app { height:100vh; height:100dvh; display:grid; grid-template-columns:184px minmax(0,1fr); grid-template-rows:64px 116px minmax(0,1fr); }
.sidebar { grid-column:1; grid-row:1/-1; display:flex; flex-direction:column; gap:18px; padding:24px 18px; border-right:1px solid var(--grey-1); background:rgba(246,246,243,.94); }
.sidebar-title { margin:0 0 4px; color:var(--grey-3); font-size:11px; font-weight:500; letter-spacing:.08em; text-transform:uppercase; }
.sidebar .switch { justify-content:space-between; }
.sidebar .button { width:100%; margin-top:4px; }
.sidebar-field { display:grid; gap:6px; color:var(--grey-3); font-size:12px; }
.sidebar-field .select { width:100%; }
.range-label { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.range-label output { color:var(--ink); font-variant-numeric:tabular-nums; }
.range { width:100%; margin:0; accent-color:var(--ink); }
.sidebar-settings { display:contents; }
.settings-toggle { display:none; }
.back-button { display:flex; align-items:center; justify-content:center; min-height:40px; margin:0 0 6px !important; font-size:13px; font-weight:600; text-decoration:none; }
.back-button:hover { background:var(--grey-3); border-color:var(--grey-3); }
.topbar { grid-column:2; grid-row:1; display:flex; align-items:center; gap:22px; padding:0 24px; border-bottom:1px solid var(--grey-1); background:rgba(246,246,243,.94); }
.topbar-title { font-size:14px; white-space:nowrap; }
.cost-area { grid-column:2; grid-row:2; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:10px 20px 20px; text-align:center; }
.cost-metrics { display:flex; align-items:flex-end; justify-content:center; gap:clamp(8px,4vw,38px); width:min(100%,520px); min-height:54px; }
.cost-metric { display:grid; flex:1 1 0; gap:4px; min-width:0; }
.cost-label,.switch,.status { color:var(--grey-3); font-size:12px; }
.cost { color:var(--ink); font-size:34px; line-height:1; font-weight:500; font-variant-numeric:tabular-nums; }
.cost.robust { color:var(--gold); }
.cost.adversarial { color:var(--red); }
[hidden] { display:none !important; }
.spacer { flex:1; }
.switch { display:inline-flex; align-items:center; gap:8px; white-space:nowrap; cursor:pointer; }
.switch input { appearance:none; width:30px; height:17px; margin:0; border:1px solid var(--grey-2); border-radius:10px; background:var(--white); position:relative; cursor:pointer; }
.switch input::after { content:""; position:absolute; top:3px; left:3px; width:9px; height:9px; border-radius:50%; background:var(--grey-2); transition:transform 150ms ease,background 150ms ease; }
.switch input:checked { border-color:var(--ink); }
.switch input:checked::after { transform:translateX(13px); background:var(--ink); }
.switch input:disabled { opacity:.35; cursor:not-allowed; }
.button { min-height:32px; padding:0 12px; border:1px solid var(--grey-1); border-radius:4px; background:var(--white); font-size:12px; }
.button:hover { border-color:var(--grey-2); }
.button.primary { border-color:var(--ink); color:var(--white); background:var(--ink); }
.select { min-height:32px; padding:0 28px 0 9px; border:1px solid var(--grey-1); border-radius:4px; background:var(--white); font-size:12px; }
.stage { grid-column:2; grid-row:3; position:relative; min-height:0; }
.graph-scroll { width:100%; height:100%; }
#graph { width:100%; height:100%; display:block; }
.export-button { position:absolute; top:10px; right:12px; z-index:2; min-height:22px; padding:0 8px; font-size:11px; color:var(--grey-3); background:rgba(255,255,255,.8); }
.edge-shell { y:-9px; height:18px; fill:var(--grey-1); stroke:var(--grey-3); stroke-width:1; }
.edge-arrow { fill:var(--grey-3); transform:scaleY(.7); transform-box:fill-box; transform-origin:center; }
.edge-hit { fill:transparent; cursor:pointer; }
.slot { y:-6px; height:12px; fill:var(--white); stroke:var(--grey-2); stroke-width:.75; }
.weight-block { y:-5px; height:10px; fill:var(--slot-full); transition:fill 180ms ease; }
.edge.path .edge-shell { y:-13px; height:26px; fill:var(--path-shell); stroke:var(--path); }
.edge.path .edge-arrow { fill:var(--path); transform:scaleY(1); }
.edge.path .slot { y:-9px; height:18px; fill:var(--path-light); stroke:var(--path); }
.edge.path .weight-block { y:-8px; height:16px; fill:var(--path); }
.edge.path.robust-path { opacity:.85; }
.edge.path.robust-path .edge-shell { fill:var(--gold-shell); stroke:var(--gold); }
.edge.path.robust-path .edge-arrow { fill:var(--gold); }
.edge.path.robust-path .slot { fill:var(--gold-light); stroke:var(--gold); }
.edge.path.robust-path .weight-block { fill:var(--gold); }
.edge.path.received-under-capacity .edge-shell { fill:var(--yellow-shell); stroke:var(--yellow); }
.edge.path.received-under-capacity .edge-arrow { fill:var(--yellow); }
.edge.path.received-under-capacity .slot { fill:#fff5c9; stroke:var(--yellow-dark); }
.edge.path.received-under-capacity .weight-block { fill:#b88a00; }
.edge.path.received-at-capacity .edge-shell { fill:var(--red-shell); stroke:var(--red); }
.edge.path.received-at-capacity .edge-arrow { fill:var(--red); }
.edge.path.received-at-capacity .slot { fill:#ffe2df; stroke:var(--red-dark); }
.edge.path.received-at-capacity .weight-block { fill:#c43d34; }
.edge.inaccessible .edge-shell,.edge.path.inaccessible .edge-shell { fill:var(--ink); stroke:var(--ink); }
.edge.inaccessible .edge-arrow,.edge.path.inaccessible .edge-arrow { fill:var(--ink); }
.edge.inaccessible .slot,.edge.path.inaccessible .slot { fill:var(--ink); stroke:var(--white); }
.edge.inaccessible .weight-block,.edge.path.inaccessible .weight-block { fill:var(--ink); }
.edge.adversary-supplier .edge-shell { fill:var(--yellow-shell); stroke:var(--yellow); stroke-width:2; }
.edge.adversary-supplier .edge-arrow { fill:var(--yellow); }
.edge.adversary-supplier .slot { stroke:var(--yellow-dark); }
.edge.inaccessible.adversary-supplier .edge-shell { fill:var(--yellow-shell); stroke:var(--yellow); }
.edge.inaccessible.adversary-supplier .edge-arrow { fill:var(--yellow); }
.edge.editor-selected .edge-shell { stroke:var(--blue); stroke-width:2; }
.badge-weight rect { fill:var(--slot-full); stroke:var(--ink); stroke-width:1; }
.badge-weight text { fill:var(--white); }
.badge-capacity rect { fill:var(--white); stroke:var(--ink); stroke-width:1; }
.badge-capacity text { fill:var(--ink); }
.edge-badge text { font-size:11px; font-weight:500; text-anchor:middle; dominant-baseline:middle; }
.weight-block.supply-flash { fill:var(--yellow); }
.weight-block.receive-flash { fill:var(--red); }
.edge.path .weight-block.supply-flash { fill:var(--yellow); }
.edge.path .weight-block.receive-flash { fill:var(--red); }
.node circle { fill:var(--white); stroke:var(--ink); stroke-width:1.5; }
.node text { fill:var(--ink); font-size:9px; font-weight:500; text-anchor:middle; dominant-baseline:middle; pointer-events:none; }
.node.endpoint .node-label { font-size:16px; }
.node.path circle { fill:var(--path); stroke:var(--path); }
.node.path .node-label { fill:var(--white); }
.node.path.robust-path { opacity:.85; }
.node.path.robust-path circle { fill:var(--gold); stroke:var(--gold); }
.endpoint-note { fill:var(--grey-3); font-size:11px; letter-spacing:.04em; }
.source-note { text-anchor:end; }
.target-note { text-anchor:start; }
.edge-editor { position:absolute; left:50%; bottom:22px; z-index:2; display:none; align-items:center; gap:12px; min-height:48px; padding:7px 8px 7px 14px; border:1px solid var(--grey-1); border-radius:6px; background:rgba(255,255,255,.96); box-shadow:0 8px 28px rgba(0,0,0,.08); transform:translateX(-50%); }
.edge-editor.visible { display:flex; }
.edge-editor-label { min-width:72px; font-size:12px; white-space:nowrap; }
.edge-adjuster { display:flex; align-items:center; gap:6px; color:var(--grey-3); font-size:12px; white-space:nowrap; }
.edge-adjuster output { min-width:22px; color:var(--ink); text-align:center; font-variant-numeric:tabular-nums; }
.step-button { width:32px; padding:0; }
.status { min-height:18px; color:var(--grey-3); font-size:13px; line-height:1.35; }
.status.error { color:var(--red); }
dialog { width:min(500px,calc(100vw - 32px)); padding:0; border:1px solid var(--grey-2); border-radius:6px; background:var(--white); box-shadow:0 24px 70px rgba(0,0,0,.18); }
dialog::backdrop { background:rgba(17,17,17,.22); }
.dialog-body { padding:22px; }
.dialog-title { margin:0 0 18px; font-size:16px; font-weight:500; }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field { display:grid; gap:6px; margin-bottom:14px; color:var(--grey-3); font-size:12px; }
.field input,.field textarea { width:100%; border:1px solid var(--grey-1); border-radius:4px; background:var(--white); padding:9px 10px; outline:none; }
.field input:focus,.field textarea:focus { border-color:var(--ink); }
.field textarea { height:190px; resize:vertical; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; line-height:1.55; }
.field small { color:var(--grey-2); }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; padding:14px 22px; border-top:1px solid var(--grey-1); }
@media (max-width:1150px) { .app{grid-template-rows:auto 116px minmax(0,1fr)} .topbar{min-height:64px;padding:10px 14px;gap:10px;flex-wrap:wrap} .spacer{display:none} }
@media (max-width:760px) { .app{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto 96px minmax(0,1fr)} .sidebar{grid-column:1;grid-row:1;display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:10px 12px;border-right:0;border-bottom:1px solid var(--grey-1)} .sidebar .button,.sidebar .back-button{margin:0 !important;min-height:36px} .settings-toggle{display:block} .sidebar-settings{display:none;grid-column:1/-1;grid-template-columns:1fr 1fr;gap:14px 16px;max-height:45dvh;overflow-y:auto;padding:10px 2px 4px} .sidebar.is-open .sidebar-settings{display:grid} .sidebar.is-open .settings-toggle{border-color:var(--ink)} .sidebar-settings .sidebar-title{display:none} .sidebar-settings .sidebar-field{grid-column:span 1} .topbar,.cost-area,.stage{grid-column:1} .topbar{grid-row:2} .cost-area{grid-row:3} .stage{grid-row:4} .topbar{padding:8px 10px} .cost-area{padding:8px 12px 14px} .edge-editor{left:12px;right:12px;bottom:42px;transform:none;flex-wrap:wrap} .edge-editor-label{width:100%;min-width:0} .graph-scroll{overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain} #graph{width:900px} .endpoint-note{display:none} .topbar{gap:8px} .topbar-title{flex-basis:100%} .topbar .button{flex:1 1 0;min-width:0;padding:0 6px;white-space:nowrap} }
