/* The workflow editor's reading tools (js/workflow-view.js): the bar at the top of the canvas, the readings it
   opens (upstream, downstream, path, lens, compare), the stage, the guide, the canvas styles and the canvas theme.
   Loaded after workflow.css and scoped under .wf like it; colours come from that file's --wf-* tokens. */

/* ---- the bar ---- */
.wf .wf-canvas { container-type: inline-size; }
.wf .wfx-bar {
    position: absolute; left: 12px; top: 10px; z-index: 6; display: flex; align-items: center; gap: 1px; padding: 3px;
    max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none;
    background: var(--wf-chrome); border: 1px solid var(--wf-line); border-radius: 10px; box-shadow: var(--wf-shadow);
}
.wf .wfx-bar::-webkit-scrollbar { display: none; }
.wf .wfx-b {
    display: inline-flex; align-items: center; gap: 6px; flex: none; height: 30px; min-width: 30px; padding: 0 7px;
    border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.wf .wfx-b > span:not(.wf-ic) { display: none; }
.wf .wfx-b:hover { background: var(--wf-hover); }
.wf .wfx-b[aria-pressed="true"] { background: var(--wf-accent-soft); color: var(--wf-accent); }
.wf .wfx-sep { flex: none; width: 1px; height: 18px; margin: 0 3px; background: var(--wf-line); }
@container (min-width: 1080px) {
    .wf .wfx-b > span:not(.wf-ic) { display: inline; }
    .wf .wfx-b { padding: 0 9px; }
}
.wf .wfx-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.wf .wfx-flip svg { transform: scaleX(-1); }

/* ---- what a reading says ---- */
.wf .wfx-panel {
    position: absolute; left: 12px; top: 52px; z-index: 6; display: flex; gap: 10px; align-items: flex-start;
    width: max-content; max-width: min(640px, calc(100% - 24px)); padding: 9px 8px 9px 12px; font-size: 12.5px;
    background: var(--wf-chrome); border: 1px solid var(--wf-line); border-radius: 11px; box-shadow: var(--wf-shadow-lg);
}
.wf .wfx-panel__t { flex: 1; min-width: 0; }
.wf .wfx-panel__t p { margin: 0; font-weight: 600; }
.wf .wfx-panel__t small { display: block; margin-top: 2px; color: var(--wf-muted); }
.wf .wfx-panel__a { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 2px; max-width: 250px; }
.wf .wfx-panel__a .wf-tb { height: 28px; min-width: 28px; }
.wf .wfx-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 7px 0 0; padding: 0; list-style: none; }
.wf .wfx-steps li { display: inline-flex; align-items: center; gap: 4px; color: var(--wf-muted); }
.wf .wfx-chip {
    max-width: 24ch; padding: 2px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; cursor: pointer;
    background: var(--wf-field); border: 1px solid var(--wf-line); border-radius: 999px;
}
.wf .wfx-chip:hover { border-color: var(--wf-accent); }

/* ---- lens: the kinds ---- */
.wf .wfx-lens {
    position: absolute; left: 12px; bottom: 56px; z-index: 6; display: flex; flex-direction: column; gap: 2px; padding: 6px;
    max-height: calc(100% - 210px); overflow-y: auto;
    background: var(--wf-chrome); border: 1px solid var(--wf-line); border-radius: 11px; box-shadow: var(--wf-shadow-lg);
}
.wf .wfx-kind {
    display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 12.5px; text-align: left; cursor: pointer;
    background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.wf .wfx-kind:hover { background: var(--wf-hover); }
.wf .wfx-kind[aria-pressed="true"] { background: var(--wf-accent-soft); border-color: var(--wf-accent); }
.wf .wfx-kind i { flex: none; width: 11px; height: 11px; border-radius: 3px; }
.wf .wfx-kind b { margin-left: auto; padding-left: 14px; color: var(--wf-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- a reading on the canvas: what is lit stays, the rest steps back ---- */
.wf.wfx-reading .wf-nodes .wf-node:not(.wfx-lit) { opacity: .24; }
.wf.wfx-reading .wf-notes .wf-node { opacity: .45; }
.wf.wfx-reading .wf-edge:not(.wfx-lit) { opacity: .12; }
.wf.wfx-reading .wf-edge.wfx-lit .wf-edge__line { stroke-width: 3.6; opacity: 1; }
.wf .wf-node.wfx-origin, .wf .wf-node.wfx-target { border-color: var(--wf-accent); box-shadow: 0 0 0 3px var(--wf-accent), var(--wf-shadow); }
.wf.wfx-picking .wf-view, .wf.wfx-picking .wf-node { cursor: crosshair; }

/* The trace along lit wires runs a few times and stops; the dashes live in the keyframes, so the wire is solid again after. */
@keyframes wfx-trace {
    from { stroke-dasharray: 9 7; stroke-dashoffset: 0; }
    to { stroke-dasharray: 9 7; stroke-dashoffset: -64; }
}
@keyframes wfx-pulse {
    from { box-shadow: 0 0 0 0 var(--wf-accent); }
    to { box-shadow: 0 0 0 20px transparent; }
}
@media (prefers-reduced-motion: no-preference) {
    .wf.wfx-reading .wf-edge.wfx-lit .wf-edge__line { animation: wfx-trace 1s linear 3; }
    .wf .wf-node.wfx-pulse { animation: wfx-pulse .6s ease-out 2; }
}

/* ---- find, guide ---- */
.wf .wfx-find { left: 50%; top: 52px; width: min(420px, calc(100% - 24px)); transform: translateX(-50%); }
.wf .wfx-guide {
    position: absolute; left: 50%; top: 50%; z-index: 12; width: min(580px, calc(100% - 24px)); max-height: calc(100% - 24px);
    padding: 12px 16px 14px; overflow-y: auto; transform: translate(-50%, -50%);
    background: var(--wf-chrome); border: 1px solid var(--wf-line-strong); border-radius: 13px; box-shadow: var(--wf-shadow-lg);
}
.wf .wfx-guide__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf .wfx-guide__h b { font-size: 15px; }
.wf .wfx-guide h3 { margin: 12px 0 5px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--wf-muted); }
.wf .wfx-guide dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 0; font-size: 12.5px; }
.wf .wfx-guide dt { color: var(--wf-muted); }
.wf .wfx-guide dd { margin: 0; user-select: text; -webkit-user-select: text; }
.wf .wfx-guide__note { margin: 12px 0 0; font-size: 12px; color: var(--wf-muted); }
.wf .wfx-menu__note { max-width: 300px; margin-top: 4px; padding: 7px 10px 4px; font-size: 11.5px; color: var(--wf-muted); border-top: 1px solid var(--wf-line); }

/* ---- the stage ---- */
.wf.wfx-stage .wf-toolbar, .wf.wfx-stage .wf-pal, .wf.wfx-stage .wf-insp, .wf.wfx-stage .wf-scrim, .wf.wfx-stage .wfx-bar,
.wf.wfx-stage .wfx-panel, .wf.wfx-stage .wfx-lens, .wf.wfx-stage .wf-zoomctl, .wf.wfx-stage .wf-vpanel, .wf.wfx-stage .wf-minimap { display: none !important; }
.wf.wfx-stage .wf-node, .wf.wfx-stage .wf-edge__hit, .wf.wfx-stage .wf-edge__del { pointer-events: none; }
.wf .wfx-cap {
    position: absolute; left: 50%; bottom: 22px; z-index: 8; width: min(700px, calc(100% - 32px)); padding: 12px 16px; transform: translateX(-50%);
    background: var(--wf-chrome); border: 1px solid var(--wf-line-strong); border-radius: 13px; box-shadow: var(--wf-shadow-lg);
}
.wf .wfx-cap__n { float: right; display: flex; align-items: center; gap: 4px; margin: -4px -8px 0 12px; font-size: 12px; color: var(--wf-muted); font-variant-numeric: tabular-nums; }
.wf .wfx-cap > b { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.wf .wfx-cap p { margin: 5px 0 0; font-size: 13.5px; color: var(--wf-muted); }

/* ---- compare: what changed since an earlier version ---- */
.wf .wf-node.wfx-added { outline: 2.5px solid var(--wf-ok); outline-offset: 3px; }
.wf .wf-node.wfx-changed { outline: 2.5px solid var(--wf-warn); outline-offset: 3px; }
.wf .wf-node.wfx-moved { outline: 2.5px dashed var(--wf-cached); outline-offset: 3px; }
.wf .wf-edge.wfx-eadded .wf-edge__line { stroke: var(--wf-ok); stroke-width: 3.6; }
.wf .wfx-ghosts { z-index: 0; }
.wf .wfx-ghost {
    position: absolute; left: 0; top: 0; display: flex; flex-direction: column; gap: 2px; min-height: 52px; padding: 8px 11px; pointer-events: none;
    color: var(--rl-text); background: color-mix(in srgb, var(--wf-bad) 8%, var(--wf-node)); border: 2px dashed var(--wf-bad); border-radius: 11px; opacity: .92;
}
.wf .wfx-ghost b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf .wfx-ghost small { color: var(--wf-bad); font-weight: 600; }
.wf .wfx-was { position: absolute; left: 0; top: 0; pointer-events: none; border: 2px dashed var(--wf-cached); border-radius: 12px; opacity: .5; }
.wf .wfx-gone__line { stroke: var(--wf-bad); stroke-width: 2.4; stroke-dasharray: 6 6; stroke-linecap: round; opacity: .85; }
.wf .wfx-changes { display: flex; flex-direction: column; gap: 2px; max-height: min(34vh, 250px); margin: 8px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.wf .wfx-change {
    width: 100%; padding: 4px 8px; font-size: 12.5px; text-align: left; cursor: pointer;
    background: transparent; border: 0; border-left: 3px solid var(--wf-line-strong); border-radius: 5px;
}
.wf .wfx-change:hover, .wf .wfx-change.is-at { background: var(--wf-hover); }
.wf .wfx-change--added { border-left-color: var(--wf-ok); }
.wf .wfx-change--removed { border-left-color: var(--wf-bad); }
.wf .wfx-change--changed { border-left-color: var(--wf-warn); }
.wf .wfx-change--moved { border-left-color: var(--wf-cached); }

/* ---- canvas styles (S). They restyle the canvas and what floats on it; the toolbar, palette and inspector stay as they are. ---- */
.wf.wfx-style-signal .wf-edge__line { stroke-width: 3; filter: drop-shadow(0 0 3px var(--ty)); }
.wf.wfx-style-signal .wf-nodes .wf-node { border-left: 4px solid var(--cat); }
@media (prefers-reduced-motion: no-preference) {
    .wf.wfx-style-signal .wf-edge:not(.wfx-lit):not(.is-flow) .wf-edge__line { stroke-dasharray: 8 7; animation: wf-flow 1.2s linear infinite; }
}

.wf.wfx-style-blueprint .wf-canvas {
    --wf-canvas: #0f3a6b; --wf-dot: rgba(190, 220, 255, .3); --wf-node: #11447c; --wf-chrome: #11447c; --wf-field: #0d3462; --wf-hover: #175391;
    --wf-line: #7fb0e6; --wf-line-strong: #b9d8f8; --wf-muted: #bcd6f2; --rl-text: #f2f8ff; --rl-text-muted: #bcd6f2; --rl-border: #7fb0e6;
    --wf-accent: #ffffff; --wf-accent-soft: rgba(255, 255, 255, .16);
    --wf-shadow: none; --wf-shadow-lg: 0 0 0 1px #b9d8f8, 0 10px 30px rgba(0, 0, 0, .35);
    --wf-ty-text: #dcecff; --wf-ty-image: #dcecff; --wf-ty-mesh: #dcecff; --wf-ty-audio: #dcecff; --wf-ty-video: #dcecff; --wf-ty-file: #dcecff; --wf-ty-json: #dcecff; --wf-ty-any: #dcecff;
    color: #f2f8ff; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
.wf.wfx-style-blueprint .wf-view { background-image: linear-gradient(var(--wf-dot) 1px, transparent 1px), linear-gradient(90deg, var(--wf-dot) 1px, transparent 1px); }
.wf.wfx-style-blueprint .wf-edge__line { stroke-width: 1.7; }
.wf.wfx-style-blueprint .wf-nodes .wf-node { border-style: solid; border-width: 1.5px; }

.wf.wfx-style-paper .wf-canvas {
    --wf-canvas: #ffffff; --wf-dot: transparent; --wf-node: #ffffff; --wf-chrome: #ffffff; --wf-field: #ffffff; --wf-hover: #f0f0f0;
    --wf-line: #1b1f27; --wf-line-strong: #000000; --wf-muted: #444444; --rl-text: #111111; --rl-text-muted: #444444; --rl-border: #1b1f27;
    --wf-shadow: none; --wf-shadow-lg: 0 0 0 1px #1b1f27;
    --wf-ty-text: #1b1f27; --wf-ty-image: #1b1f27; --wf-ty-mesh: #1b1f27; --wf-ty-audio: #1b1f27; --wf-ty-video: #1b1f27; --wf-ty-file: #1b1f27; --wf-ty-json: #1b1f27; --wf-ty-any: #1b1f27;
    color: #111111;
}
.wf.wfx-style-paper .wf-edge__line { stroke-width: 1.6; }
.wf.wfx-style-paper .wf-nodes .wf-node { border-width: 1px; }

/* ---- canvas theme (T): the editor in light or dark whatever the site is in. The values are the stock ones from
   app.css and workflow.css, written out because the site's own switch is not ours to flip. ---- */
:root .wf.wf[data-wfx-theme="light"] {
    color-scheme: light;
    --rl-bg: #ffffff; --rl-bg-rgb: 255, 255, 255; --rl-surface: #ffffff; --rl-surface-raised: #f5f6f8; --rl-surface-sunken: #eceef2;
    --rl-text: #16181d; --rl-text-rgb: 22, 24, 29; --rl-text-muted: #5b6472; --rl-border: #dfe2e8; --rl-accent: #2f6df6; --rl-accent-contrast: #ffffff;
    --rl-danger: #b3261e; --rl-ok: #1a7f4b;
    --wf-canvas: var(--rl-surface-raised); --wf-node: var(--rl-surface); --wf-chrome: var(--rl-surface); --wf-dot: rgba(100, 116, 139, .38); --wf-field: var(--rl-bg);
    --wf-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 4px 14px rgba(15, 23, 42, .1);
    --wf-shadow-lg: 0 10px 34px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .14);
    --wf-warn: #b45309; --wf-cached: #2563eb;
    --wf-ty-text: #5d6b82; --wf-ty-image: #d6407f; --wf-ty-mesh: #7a56e8; --wf-ty-audio: #c26f00; --wf-ty-video: #08899f; --wf-ty-file: #8b6a3a; --wf-ty-json: #2c9a57; --wf-ty-any: #55606f;
    --wf-note-mm: #e8c75a;
}
:root .wf.wf[data-wfx-theme="dark"] {
    color-scheme: dark;
    --rl-bg: #14161a; --rl-bg-rgb: 20, 22, 26; --rl-surface: #1a1d23; --rl-surface-raised: #1f232a; --rl-surface-sunken: #24282f;
    --rl-text: #e8eaee; --rl-text-rgb: 232, 234, 238; --rl-text-muted: #9aa3b2; --rl-border: #2c313a; --rl-accent: #6f9bff; --rl-accent-contrast: #0d1017;
    --rl-danger: #ff8f87; --rl-ok: #5bd08c;
    --wf-canvas: var(--rl-bg); --wf-node: var(--rl-surface-raised); --wf-chrome: var(--rl-surface); --wf-dot: rgba(148, 163, 184, .26); --wf-field: var(--rl-surface);
    --wf-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 5px 16px rgba(0, 0, 0, .35);
    --wf-shadow-lg: 0 12px 38px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
    --wf-warn: #f0b24d; --wf-cached: #7db3ff;
    --wf-ty-text: #9fb0c8; --wf-ty-image: #ff7fb0; --wf-ty-mesh: #aa90ff; --wf-ty-audio: #ffb35c; --wf-ty-video: #4fd3ea; --wf-ty-file: #d2ad72; --wf-ty-json: #62d68f; --wf-ty-any: #c4cbd6;
    --wf-note-mm: #8a7424;
}

.wf--narrow .wfx-bar { left: 8px; top: 8px; }
.wf--narrow .wfx-panel { left: 8px; top: 48px; }
.wf--narrow .wfx-panel__a { max-width: 96px; }
.wf--narrow .wfx-lens { left: 8px; }

.wf .wf-vcode { margin-left: 6px; padding: 0 4px; font-size: 10.5px; color: var(--wf-muted); background: var(--wf-hover); border-radius: 4px; }

/* ---- the page around the editor: Describe it, and the run list's buttons ---- */
.wbp__describeText { font-size: .9rem; }
.wbp__describe { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .6rem; font-size: .88rem; }
.wbp__describe label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.wbp__describe select { max-width: 22rem; }
.wbp__receipt { margin-top: .7rem; font-size: .88rem; }
.wbp__receipt p { margin: 0 0 .3rem; }
.wbp__receipt ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.wbp__receipt code { margin-right: .35rem; font-size: .78rem; color: var(--rl-text-muted); }
.wbp__receipt--bad { color: var(--rl-danger); }
.wbp__runBtns { display: inline-flex; gap: .35rem; margin-left: auto; }
