/* One order, typed once (#viz-flow) */
.vf { --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 7%, transparent), 0 6px 18px color-mix(in srgb, var(--ink) 6%, transparent);
  display: flex; flex-direction: column; gap: 16px; padding: 24px 24px 20px; color: var(--ink); font-family: var(--sans); }
.vf button { font: inherit; color: inherit; background: none; -webkit-tap-highlight-color: transparent; }
.vf :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.vf-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px 20px; }
.vf-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.vf-tag::before { content: ""; width: 18px; height: 1px; background: var(--gold); }
.vf-title { margin-top: 6px; font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.1; letter-spacing: -.005em; color: var(--ink); }
.vf-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sheet); border: 1px solid var(--line); }
.vf-seg button { min-height: 40px; min-width: 76px; padding: 0 16px; border-radius: 999px; font-size: 13px; color: var(--muted); transition: background .25s ease-out, color .25s ease-out; }
.vf-seg button[aria-checked=true] { background: var(--work); color: var(--ink); box-shadow: var(--shadow); }
.vf-seg button:hover { color: var(--ink); }

.vf-stage { position: relative; height: 350px; transition: opacity .2s ease-out; }
.vf-stage.is-swap { opacity: 0; }
.vf-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; fill: none; stroke: none; }
.vf-wires .w-base { stroke: var(--line); stroke-width: 1.25; stroke-dasharray: 2 5; }
.vf-wires .w-live { stroke: var(--quiet); stroke-width: 1.5; stroke-linecap: round; }
.vf[data-m=after] .w-live { stroke: var(--gold); stroke-width: 1.75; }
.vf-pk { fill: var(--muted); }
.vf[data-m=after] .vf-pk { fill: var(--gold); }
.vf-badge { opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; transition: opacity .3s ease-out, transform .35s cubic-bezier(.2, .9, .3, 1.3); }
.vf-badge.is-on { opacity: 1; transform: none; }
.vf-badge circle { fill: var(--work); stroke: var(--line); stroke-width: 1; }
.vf-badge path { stroke: var(--muted); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.vf-pos { position: absolute; transform: translate(-50%, -50%); z-index: 1; }
.vf-pos.vf-from { z-index: 3; }
.vf-node { position: relative; display: block; width: var(--nw, 140px); min-height: 44px; padding: 9px 12px 10px; text-align: left; cursor: pointer;
  background: var(--work); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  opacity: .55; transform: scale(.97); transition: opacity .4s ease-out, transform .4s ease-out, border-color .4s ease-out, background-color .4s ease-out; }
.vf-node.is-on { opacity: 1; transform: none; }
.vf-k { display: block; font-size: 12px; line-height: 1.4; color: var(--muted); }
.vf-v { display: block; margin-top: 2px; font-size: 13px; line-height: 1.45; color: var(--ink); }
.vf-node mark { background: none; color: var(--diff); font-weight: 600; border-bottom: 1.5px solid var(--diff); }
.vf-register { background-color: var(--sheet); background-image: repeating-linear-gradient(to bottom, transparent 0 19px, var(--line) 19px 20px); }
.vf-register .vf-v { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.2; }
.vf-node.is-bad { border-color: var(--diff); background: color-mix(in srgb, var(--diff) 6%, var(--work)); }
.vf-node.is-good { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.vf-node.is-good::after { content: ""; position: absolute; top: 11px; right: 12px; width: 4px; height: 8px; border: solid var(--ok); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.vf-node.is-good .vf-k { padding-right: 14px; }

.vf-hub { width: 68px; min-height: 68px; height: 68px; padding: 0; display: grid; place-items: center; border-radius: 50%; border-color: var(--gold); }
.vf-hub svg { width: 30px; height: 30px; stroke: var(--gold); stroke-width: 1.3; fill: none; }
.vf-hub.is-on { background: color-mix(in srgb, var(--gold) 8%, var(--work)); }
.vf-hub::before { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--gold); opacity: 0; pointer-events: none; }
.vf-hub-l { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); white-space: nowrap; font-size: 12px; color: var(--muted); }

.vf-bubble { position: relative; display: block; width: var(--bw, 150px); padding: 9px 12px 14px; text-align: left; font-size: 13px; line-height: 1.5; color: var(--ink);
  background: var(--sheet); background: color-mix(in srgb, var(--emerald) 11%, var(--work)); border: 1px solid color-mix(in srgb, var(--emerald) 30%, var(--line));
  border-radius: 14px 14px 14px 4px; box-shadow: var(--shadow); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.vf-who { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; font-size: 12px; color: var(--emerald); font-weight: 500; }
.vf-who span + span { font-weight: 400; color: var(--muted); }
.vf-hint { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 9px; white-space: nowrap;
  font-size: 12px; line-height: 1.5; color: var(--ink); background: var(--work); border: 1px solid var(--gold); border-radius: 999px; box-shadow: var(--shadow);
  pointer-events: none; transition: opacity .3s ease-out; }
.vf-hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.vf:not(.is-idle) .vf-hint { opacity: 0; }
.vf-drag { will-change: transform; }
.vf-drag.is-drag .vf-bubble { cursor: grabbing; box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 16%, transparent); }
.vf-drag.is-fly { transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .55s ease-out; pointer-events: none; }
.vf-drag.is-back { transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .4s ease-out; }
.vf.is-idle .is-target { outline: 1px dashed var(--gold); outline-offset: 6px; }
.vf .is-target.is-over { outline: 2px solid var(--gold); outline-offset: 6px; opacity: 1; transform: none; }
.vf-hub.is-target { outline-offset: 7px; }

.vf-tip { position: absolute; z-index: 5; left: 0; top: 0; max-width: min(260px, 92%); padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5;
  color: var(--work); background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out; }
.vf-tip.is-on { opacity: 1; transform: none; }

.vf-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.vf-stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin: 0; font-size: 13px; color: var(--muted); }
.vf-stats b { font-variant-numeric: lining-nums tabular-nums; font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1; color: var(--ink); }
.vf-time { display: inline-flex; align-items: baseline; gap: 7px; }
.vf-time svg { width: 16px; height: 16px; align-self: center; stroke: var(--muted); stroke-width: 1.4; fill: none; }
.vf-hand { transform-box: view-box; transform-origin: 12px 12px; transition: transform .6s ease-out; stroke-linecap: round; }
.vf-saved { color: var(--ok); font-weight: 500; }
.vf-saved:empty { display: none; }
.vf-send { min-height: 44px; padding: 0 20px; border-radius: 999px; font-size: 13px; background: var(--ink) !important; color: var(--work) !important; transition: transform .2s ease-out, opacity .2s ease-out; }
.vf-send:hover { opacity: .88; }
.vf-send:active { transform: scale(.97); }
.vf-cap { margin: -4px 0 0; font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .vf.is-idle .vf-bob { animation: vf-bob 2.6s ease-in-out infinite; }
  .vf-hub.is-on::before { animation: vf-ring .9s ease-out 1; }
  @keyframes vf-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
  @keyframes vf-ring { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.6); } }
}
@media (max-width: 480px) {
  .vf { padding: 18px 16px 16px; gap: 14px; }
  .vf-title { font-size: 25px; }
  .vf-stats { gap: 4px 16px; }
  .vf-hub { width: 60px; height: 60px; min-height: 60px; }
}
