/* Workflow maps (WF01–WF14). Every selector is .wfm- prefixed; colours come only from styles.css tokens. */
.wfm { display: flex; flex-direction: column; gap: 16px; min-width: 0; font-size: 13px; }
.wfm-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* Header */
.wfm-head { display: flex; flex-direction: column; gap: 6px; }
.wfm-head h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wfm-id { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 4px; padding: 1px 7px; letter-spacing: 0; }
.wfm-purpose { color: var(--ink-2); max-width: 78ch; }
.wfm-auto { margin-top: 6px; border: 1px dashed var(--line-2); border-radius: var(--r); padding: 10px 12px; background: var(--panel); }
.wfm-auto-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wfm-auto-h .wfm-sub { margin-top: 0; }
.wfm-auto-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 6px 20px; margin-top: 8px; }
.wfm-ul { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.wfm-ul li + li { margin-top: 3px; }
.wfm-ul li::marker { color: var(--muted); }

/* Common execution pattern */
.wfm-pattern { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 10px 12px; }
.wfm-pattern-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.wfm-pattern-key { font-size: 11.5px; color: var(--muted); }
.wfm-gate-dot { display: inline-block; font-family: var(--mono); color: var(--accent); }
.wfm-pattern ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; counter-reset: none; }
.wfm-pattern li { display: grid; grid-template-columns: auto 1fr; gap: 2px 7px; align-items: start; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; color: var(--ink-2); background: var(--sunk); }
.wfm-pn { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.6; }
.wfm-pattern li.wfm-on { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--ink); padding: 5px 7px; }
.wfm-pattern li.wfm-on .wfm-pn { color: var(--accent); }
.wfm-pg { grid-column: 2; font-size: 10.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }

/* Diagram */
.wfm-dia { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wfm-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--ink-2); }
.wfm-legend li { display: inline-flex; align-items: center; gap: 6px; }
.wfm-sw { display: inline-flex; width: 28px; height: 18px; font-size: 10px; }
.wfm-sw .wfm-in { padding: 0 !important; width: 100%; display: flex; align-items: center; justify-content: center; }
.wfm-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overscroll-behavior-x: contain; scrollbar-width: thin; }
.wfm-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wfm-grid { display: grid; grid-template-rows: auto repeat(5, minmax(76px, auto)); gap: 0; width: max-content; position: relative; }

.wfm-lanebg { grid-column: 1 / -1; border-top: 1px solid var(--line); z-index: 0; }
.wfm-lanebg.wfm-lane-guest, .wfm-lanelab.wfm-lane-guest { background: var(--lane-guest); }
.wfm-lanebg.wfm-lane-ai, .wfm-lanelab.wfm-lane-ai { background: var(--lane-ai); }
.wfm-lanebg.wfm-lane-human, .wfm-lanelab.wfm-lane-human { background: var(--lane-human); }
.wfm-lanebg.wfm-lane-ops, .wfm-lanelab.wfm-lane-ops { background: var(--lane-ops); }
.wfm-lanebg.wfm-lane-ext, .wfm-lanelab.wfm-lane-ext { background: var(--lane-ext); }
.wfm-lanebg { opacity: .55; }
.wfm-lanelab { grid-column: 1; position: sticky; left: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 10px; border-top: 1px solid var(--line); border-right: 1px solid var(--line-2); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.wfm-lanelab em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11px; }

.wfm-railhead, .wfm-rail { position: sticky; top: 0; z-index: 2; background: var(--panel); font-family: var(--mono); font-size: 10.5px; color: var(--muted); padding: 5px 0; text-align: center; }
.wfm-railhead { left: 0; z-index: 4; text-align: left; padding-left: 10px; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font); font-weight: 700; border-right: 1px solid var(--line-2); }
.wfm-rail { font-weight: 700; color: var(--ink-2); }
.wfm-rail-k { color: var(--line-2); font-weight: 400; }

/* Connectors: per-row pieces so vertical lines follow row height */
.wfm-k { position: relative; z-index: 1; }
.wfm-k::before, .wfm-k::after { content: ''; position: absolute; }
.wfm-k-h::before { left: 0; right: 5px; top: 50%; border-top: 1.5px solid var(--muted); }
.wfm-k-s::before { left: 0; width: 50%; top: 50%; border-top: 1.5px solid var(--muted); }
.wfm-k-s.wfm-k-dn::after { left: 50%; top: 50%; bottom: 0; border-left: 1.5px solid var(--muted); }
.wfm-k-s.wfm-k-up::after { left: 50%; top: 0; bottom: 50%; border-left: 1.5px solid var(--muted); }
.wfm-k-m::after { left: 50%; top: 0; bottom: 0; border-left: 1.5px solid var(--muted); }
.wfm-k-e::before { left: 50%; right: 5px; top: 50%; border-top: 1.5px solid var(--muted); }
.wfm-k-e.wfm-k-dn::after { left: 50%; top: 0; bottom: 50%; border-left: 1.5px solid var(--muted); }
.wfm-k-e.wfm-k-up::after { left: 50%; top: 50%; bottom: 0; border-left: 1.5px solid var(--muted); }
.wfm-ah { position: absolute; right: -2px; top: 50%; transform: translateY(-52%); font-size: 11px; line-height: 1; color: var(--muted); }

/* Nodes */
.wfm-node { position: relative; z-index: 2; align-self: center; margin: 7px 0; min-height: 64px; display: flex; font-size: 12px; line-height: 1.35; }
.wfm-in { flex: 1; min-width: 0; padding: 7px 9px; background: var(--panel); color: var(--ink); border-radius: inherit; }
.wfm-nk { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wfm-mk { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.wfm-no { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0; }
.wfm-nt { margin-top: 3px; color: var(--ink); overflow-wrap: anywhere; }
.wfm-sys { margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--unk); }
.wfm-pw { margin-top: 4px; display: inline-block; font-size: 10px; font-weight: 700; color: var(--warn); border: 1px dashed var(--warn); border-radius: 3px; padding: 0 4px; }
.wfm-dl { margin-top: 4px; font-size: 11px; color: var(--wait); }
.wfm-dl em { color: var(--muted); font-style: normal; }
.wfm-br { list-style: none; margin: 5px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.wfm-br li { display: flex; justify-content: space-between; gap: 6px; border-top: 1px dotted var(--line-2); padding-top: 2px; color: var(--ink-2); }
.wfm-to { font-family: var(--mono); font-size: 10.5px; color: var(--ink); white-space: nowrap; }
.wfm-pat-ref { margin-top: 4px; font-size: 10.5px; color: var(--accent); font-weight: 700; }
.wfm-st { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 3px; }
.wfm-st .b { font-size: 10px; padding: 0 5px; white-space: normal; }

/* Node shapes (shape + marker + label, never colour alone) */
.wfm-t-trigger, .wfm-t-event { border-radius: 18px; border: 1.5px solid var(--brand); }
.wfm-t-trigger .wfm-in, .wfm-t-event .wfm-in { background: var(--brand-soft); padding-inline: 12px; }
.wfm-t-event { border-style: solid; border-width: 1px; }
.wfm-t-step { border-radius: 4px; border: 1px solid var(--line-2); }
.wfm-t-decision { background: var(--warn); padding: 1.5px; border-radius: 0; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
.wfm-t-decision .wfm-in { background: var(--warn-bg); padding-inline: 14px; clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%); }
.wfm-t-decision .wfm-mk { color: var(--warn); }
.wfm-t-wait { border-radius: 6px; border: 1.5px dashed var(--wait); }
.wfm-t-wait .wfm-mk { color: var(--wait); }
.wfm-t-human { border-radius: 4px; border: 3px solid var(--accent); }
.wfm-t-human .wfm-nk { color: var(--accent); }
.wfm-t-human .wfm-mk { color: var(--accent); }
.wfm-t-ext { border-radius: 2px; border: 1.5px solid var(--unk); border-left-width: 5px; }
.wfm-t-ext .wfm-mk { color: var(--unk); }
.wfm-t-evidence { border-radius: 6px; border: 4px double var(--ok); }
.wfm-t-evidence .wfm-in { background: var(--ok-bg); }
.wfm-t-evidence .wfm-mk, .wfm-t-evidence .wfm-nk { color: var(--ok); }
.wfm-sw.wfm-t-human { border-width: 2.5px; }
.wfm-sw.wfm-t-evidence { border-width: 3px; }
.wfm-sw.wfm-t-ext { border-left-width: 4px; }

/* Failure strip */
.wfm-fail { display: flex; flex-direction: column; gap: 8px; }
.wfm-fail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; }
.wfm-fcard { border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 6px; background: var(--panel); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.wfm-fh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wfm-fid { font-family: var(--mono); font-size: 11px; font-weight: 700; background: var(--sunk); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 5px; }
.wfm-fk { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.wfm-fon { font-weight: 700; color: var(--ink); }
.wfm-fthen { color: var(--ink-2); }
.wfm-f-reconcile { border-left-color: var(--unk); }
.wfm-f-reconcile .wfm-fk { color: var(--unk); }
.wfm-f-pause, .wfm-f-human { border-left-color: var(--accent); }
.wfm-f-pause .wfm-fk, .wfm-f-human .wfm-fk { color: var(--accent); }
.wfm-f-escalate { border-left-color: var(--crit); }
.wfm-f-escalate .wfm-fk { color: var(--crit); }
.wfm-f-wait { border-left-color: var(--wait); border-left-style: dashed; }
.wfm-f-wait .wfm-fk { color: var(--wait); }
.wfm-f-reopen { border-left-color: var(--warn); }
.wfm-f-reopen .wfm-fk { color: var(--warn); }
.wfm-f-supersede, .wfm-f-stop, .wfm-f-route { border-left-color: var(--muted); }
.wfm-rules { font-size: 12px; color: var(--ink-2); border-left: 3px solid var(--line-2); background: var(--sunk); padding: 6px 10px; border-radius: 0 6px 6px 0; }

/* Panels */
.wfm-panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; align-items: start; }
.wfm-p { min-width: 0; font-size: 12.5px; }
.wfm-p .panel-h { padding: 8px 12px; }
.wfm-p .panel-h h3 { font-size: 14px; }
.wfm-p .panel-b { padding: 10px 12px; color: var(--ink-2); }
.wfm-p .panel-b > p { color: var(--ink); }
@media (min-width: 900px) { .wfm-wide { grid-column: span 2; } }
.wfm-kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 5px 12px; margin: 0; font-size: 12.5px; }
.wfm-kv dt { color: var(--ink); font-weight: 600; }
.wfm-kv dd { margin: 0; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.wfm-kv dd .b { margin-left: 2px; vertical-align: 1px; }
@media (max-width: 520px) { .wfm-kv { grid-template-columns: 1fr; } .wfm-kv dd { margin-bottom: 4px; } }
.wfm-rw { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px 18px; }
.wfm-rw .b { white-space: normal; margin-left: 2px; }
.wfm-step { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--ink); background: var(--sunk); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; white-space: nowrap; }
.wfm-ev { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.wfm-ev li { display: grid; grid-template-columns: minmax(110px, 36%) 1fr; gap: 8px; border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: var(--sunk); }
.wfm-evs { font-weight: 700; color: var(--ok); font-size: 12px; }
@media (max-width: 520px) { .wfm-ev li { grid-template-columns: 1fr; gap: 2px; } }
.wfm-p a { font-weight: 600; }
