/* Warehouse flow map: page styles on the shared shell (nr-shell.css tokens v3). Class names start fm- to stay clear of the shell's. */
.sheet { display: flex; flex-direction: column; height: calc(100vh - 60px); min-height: 560px; }
.fm-test { margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: var(--orange-tint); color: var(--ink); font-size: 14px; font-weight: 500; }
.fm-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.fm-head h1 { margin: 0; }
.fm-views { display: inline-flex; background: var(--tan); border-radius: 8px; padding: 3px; gap: 2px; }
.fm-viewbtn, .fm-viewbtn:hover { background: transparent; border-color: transparent; color: var(--ink2); }
.fm-viewbtn[aria-pressed="true"] { background: var(--white); border-color: var(--line); color: var(--ink); }
.fm-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 12px; }
.fm-counts { margin-left: 8px; color: var(--ink2); font-size: 14px; font-variant-numeric: tabular-nums; }
.fm-save { margin-left: auto; color: var(--ink2); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.fm-save.bad { color: var(--ink); background: var(--orange-tint); padding: 4px 10px; border-radius: 6px; }

.fm-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; min-height: 0; }
.fm-stage { position: relative; min-width: 0; min-height: 0; border-radius: 8px; background: var(--cream); overflow: auto; }
.fm-canvas svg { display: block; margin: 0 auto; overflow: visible; }
#fm-movef { margin-top: 12px; }
.fm-panel { min-width: 0; min-height: 0; overflow: auto; padding-right: 4px; }

/* the map */
.fm-node { cursor: pointer; outline: none; }
.fm-node rect { stroke-width: 1; }
.fm-node.k-source rect { fill: var(--green-tint); stroke: var(--green); }
.fm-node.k-station rect { fill: var(--white); stroke: var(--ink3); }
.fm-node.k-exit rect { fill: var(--tan); stroke: var(--ink); stroke-width: 1.5; }
.fm-node text { fill: var(--ink); font: 500 14px/1 var(--font); }
.fm-node text.st { fill: var(--ink2); font-weight: 400; font-size: 13px; font-variant-numeric: tabular-nums; }
.fm-node:hover rect, .fm-node:focus-visible rect { stroke: var(--ink); stroke-width: 2; }
.fm-node.on rect { stroke: var(--ink); stroke-width: 2.5; }
.fm-edge { fill: none; stroke: var(--ink3); stroke-width: 1.5; }
.fm-edge.usual { stroke: var(--ink2); stroke-width: 2; }
.fm-edge.maybe { stroke: var(--ink3); stroke-width: 1.5; stroke-dasharray: 5 4; }
.fm-edge.back { stroke: var(--orange); }
.fm-note { fill: var(--ink2); font: 400 12px/1 var(--font); paint-order: stroke; stroke: var(--cream); stroke-width: 4px; stroke-linejoin: round; }
.fm-arrow { fill: var(--ink3); } .fm-arrow-back { fill: var(--orange); }
.dim { opacity: .22; }
.fm-legend { position: sticky; left: 0; bottom: 0; display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 12px; font-size: 13px; color: var(--ink2); background: var(--cream); }
.fm-legend i { display: inline-block; width: 18px; height: 12px; vertical-align: -1px; margin-right: 6px; border: 1px solid var(--ink3); background: var(--white); border-radius: 3px; }
.fm-legend i.k-source { background: var(--green-tint); border-color: var(--green); border-radius: 6px; }
.fm-legend i.k-exit { background: var(--tan); border: 1.5px solid var(--ink); }
.fm-legend i.ln { border: 0; height: 0; background: none; vertical-align: 3px; border-radius: 0; width: 22px; }
.fm-legend i.usual { border-top: 2px solid var(--ink2); }
.fm-legend i.maybe { border-top: 2px dashed var(--ink3); }
.fm-legend i.back { border-top: 2px solid var(--orange); }

/* empty map */
.fm-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: start; gap: 12px; padding: 24px; }
.fm-empty h2 { margin: 0; font-size: 20px; }
.fm-empty div { display: flex; gap: 8px; flex-wrap: wrap; }

/* the side panel */
.fm-panel h2 { margin: 0 0 12px; font-size: 18px; }
.fm-panel h3 { margin: 20px 0 8px; font-size: 14px; font-weight: 500; color: var(--ink2); }
.fm-panel label { display: block; margin: 0 0 12px; font-size: 14px; color: var(--ink2); }
.fm-panel .row { display: flex; gap: 8px; align-items: center; }
.fm-kinds { display: flex; gap: 4px; margin: 6px 0 12px; }
.fm-kinds label { margin: 0; flex: 1; }
.fm-kinds input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fm-kinds span { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 6px; background: var(--tan); color: var(--ink2); font-size: 14px; cursor: pointer; }
.fm-kinds input:checked + span { background: var(--ink); color: var(--white); }
.fm-kinds input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.fm-list { list-style: none; margin: 0; padding: 0; }
.fm-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 14px; }
.fm-list li .to { flex: 1; min-width: 0; }
.fm-list li .to button { background: none; border: 0; color: var(--ink); padding: 0; min-height: 32px; font: 500 14px/1.2 var(--font); text-align: left; white-space: normal; }
.fm-list li .to button:hover { text-decoration: underline; }
.fm-list li .note { display: block; color: var(--ink2); font-size: 13px; }
.fm-tag.soft { background: var(--tan); }
.fm-tag { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--orange-tint); color: var(--ink); white-space: nowrap; }
.fm-x { min-height: 32px; width: 32px; padding: 0; }
.fm-panel .err { margin: 8px 0 0; color: var(--ink); background: var(--orange-tint); padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.fm-panel .none { color: var(--ink2); font-size: 14px; margin: 0; }
.fm-danger { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.fm-probs li button { background: none; border: 0; padding: 0; min-height: 32px; color: var(--ink); font: 400 14px/1.3 var(--font); text-align: left; white-space: normal; }
.fm-probs li button:hover { text-decoration: underline; }
.fm-probs li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }

/* every path */
.fm-paths { padding: 16px 20px; }
.fm-paths h2 { margin: 0 0 4px; font-size: 18px; }
.fm-paths ol { margin: 12px 0 0; padding-left: 28px; }
.fm-paths li { padding: 6px 0; font-size: 14px; line-height: 1.7; color: var(--ink2); font-variant-numeric: tabular-nums; }
.fm-chip { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--white); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.fm-chip.k-source { background: var(--green-tint); border-color: transparent; }
.fm-chip.k-exit { background: var(--tan); border-color: transparent; }
.fm-sep { margin: 0 4px; color: var(--ink3); }

@media (max-width: 1100px) {
  .fm-body { grid-template-columns: minmax(0, 1fr); }
  .fm-stage { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .dim { transition: none; } }

/* r1b: review fixes and usual path / can happen */
#fm-undo:disabled { visibility: hidden; }
.fm-only { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 4px; font-size: 14px; color: var(--ink2); cursor: pointer; min-height: 36px; }
.fm-only input, .fm-usual input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--ink); }
.fm-probbtn { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); font: 500 14px/1 var(--font); text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }
.fm-probbtn:hover { background: none; }
.fm-warn { margin: 0 0 12px; padding: 6px 10px; border-radius: 6px; background: var(--orange-tint); color: var(--ink); font-size: 14px; font-weight: 500; }
.fm-list li { display: block; }
.fm-probs li { display: flex; align-items: center; gap: 8px; }
.fm-mv { display: flex; align-items: center; gap: 6px; }
.fm-mv .fm-to { flex: 1; min-width: 0; background: none; border: 0; color: var(--ink); padding: 0; min-height: 32px; font: 500 14px/1.2 var(--font); text-align: left; white-space: normal; justify-content: flex-start; }
.fm-mv .fm-to:hover { text-decoration: underline; background: none; }
.fm-mv2 { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
.fm-usual { display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important; white-space: nowrap; font-size: 13px; cursor: pointer; }
.fm-noteinp { flex: 1; min-width: 0; min-height: 32px !important; height: 32px; margin: 0; font-size: 13px !important; padding: 0 8px; }
.fm-outs li + li { border-top: 1px solid var(--line); padding-top: 6px; }
.fm-addmove { margin-top: 8px !important; }
.fm-paths h3 { margin: 16px 0 0; font-size: 14px; font-weight: 500; color: var(--ink2); }
.fm-chip { font: inherit; min-height: 0; cursor: pointer; }
.fm-chip:hover { background: var(--tan); }
.fm-chip.on { outline: 2px solid var(--ink); outline-offset: 0; }
body.fm-locked .fm-body, body.fm-locked .fm-bar > :not(.fm-save) { opacity: .5; pointer-events: none; }
body.fm-readonly .fm-bar [data-add], body.fm-readonly #fm-undo, body.fm-readonly .fm-danger, body.fm-readonly .fm-addmove { display: none; }
@media (max-width: 1100px) { .sheet { height: auto; } .fm-stage { height: 70vh; } }

/* r2: sections, things, drafts, view only */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fm-pick { margin: 0; }
.small-sel { min-height: 36px !important; height: 36px; margin: 0; width: auto; max-width: 180px; font-size: 14px !important; padding: 0 8px; }
.sec-0 { fill: var(--green); background: var(--green); }
.sec-1 { fill: var(--ink); background: var(--ink); }
.sec-2 { fill: var(--ink3); background: var(--ink3); }
.sec-3 { fill: var(--line); background: var(--line); }
i.sw { display: inline-block; width: 4px !important; height: 14px !important; border: 0 !important; border-radius: 2px !important; margin-right: 8px; vertical-align: -2px; flex: none; }
.fm-node.draft rect:first-child { stroke-dasharray: 2 3; }
.fm-node.ghost { opacity: .55; }
.fm-legend i.dr { border: 1.5px dotted var(--ink3); background: transparent; }
.fm-note.hand { fill: var(--ink); font-weight: 500; }
.fm-becomes { display: inline-block; margin: 0 4px 0 0; padding: 1px 6px; border-radius: 4px; background: var(--green-tint); color: var(--ink); font-size: 12px; white-space: nowrap; }
.fm-view { margin: 0 0 12px; padding: 6px 10px; border-radius: 6px; background: var(--tan); color: var(--ink); font-size: 14px; font-weight: 500; }
.fm-draftline { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; padding: 4px 4px 4px 10px; border-radius: 6px; border: 1.5px dotted var(--ink3); font-size: 14px; color: var(--ink); }
.fm-thingd { margin: 0 0 8px; font-size: 13px; color: var(--ink2); }
.fm-thingd summary { cursor: pointer; min-height: 28px; display: flex; align-items: center; }
.fm-thingd label { margin: 4px 0 8px; font-size: 13px; }
.fm-thingd select { min-height: 36px !important; height: 36px; font-size: 14px !important; margin-top: 4px; }
.fm-secs input { min-height: 36px !important; height: 36px; margin: 0; font-size: 14px !important; }
.fm-ed { margin: 6px 0 8px !important; font-size: 13px !important; }
.fm-secro { flex: 1; font-size: 14px; color: var(--ink); }
#fm-secf, #fm-thingf { margin-top: 8px; }
#fm-secf input, #fm-thingf input { min-height: 36px !important; height: 36px; margin: 0; font-size: 14px !important; }
.fm-nothing { padding: 24px; color: var(--ink2); }
.fm-legend i.sw.sec-0, .fm-panel i.sw.sec-0 { background: var(--green); }
.fm-legend i.sw.sec-1, .fm-panel i.sw.sec-1 { background: var(--ink); }
.fm-legend i.sw.sec-2, .fm-panel i.sw.sec-2 { background: var(--ink3); }
.fm-legend i.sw.sec-3, .fm-panel i.sw.sec-3 { background: var(--line); }

/* r3: dragging */
.fm-node.dragging { cursor: grabbing; }
.fm-node.dragging rect:first-child { stroke: var(--ink); stroke-width: 2; }
.fm-canvas svg { touch-action: none; user-select: none; -webkit-user-select: none; }
/* r3: sign-in and no-access pages */
body.fm-signin { min-height: 100vh; display: grid; place-items: center; background: var(--cream); padding: 16px; }
.fm-signin-card { width: min(420px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.fm-signin-card .logo { width: 140px; height: auto; display: block; margin-bottom: 16px; }
.fm-signin-card h1 { margin: 0 0 16px; font-size: 24px; }
.fm-signin-card label { display: block; margin: 0 0 12px; font-size: 14px; color: var(--ink2); }
.fm-signin-card button { width: 100%; margin-top: 4px; }
.fm-signin-help { margin: 16px 0 0; font-size: 14px; color: var(--ink2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fm-signin-card .logo { content: url("logo-dark.png"); } }
:root[data-theme="dark"] .fm-signin-card .logo { content: url("logo-dark.png"); }

/* r4: the legend sits under the map, never on top of boxes */
.fm-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 6px; }
.fm-left .fm-stage { flex: 1; }
.fm-legend { position: static; padding: 4px 4px 0; background: none; }
@media (max-width: 1100px) { .fm-left .fm-stage { height: 70vh; flex: none; } }

/* r5: Warehouse / Technology */
.fm-sides .fm-side, .fm-sides .fm-side:hover { background: transparent; border-color: transparent; color: var(--ink2); }
.fm-sides .fm-side[aria-pressed="true"] { background: var(--white); border-color: var(--line); color: var(--ink); }
.fm-node .ticon { fill: none; stroke: var(--ink2); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.ticon-l { width: 16px; height: 13px; vertical-align: -2px; margin-right: 6px; fill: none; stroke: var(--ink2); stroke-width: 1.4; }
.fm-edge.via { stroke: var(--ink3); stroke-width: 1.5; stroke-dasharray: 1.5 4; stroke-linecap: round; }
.fm-legend i.via { border-top: 2px dotted var(--ink3); }
.fm-techbox { margin: 0 0 12px !important; }

/* r6: a fifth section color (brand bright green) */
:root { --fm-bright: #5EF6E6; }   /* the brand bright green; not in the shell tokens */
.sec-4 { fill: var(--fm-bright); background: var(--fm-bright); }
.fm-legend i.sw.sec-4, .fm-panel i.sw.sec-4 { background: var(--fm-bright); }

/* r7: fit, zoom and pan; collapsible panel; wrapped names; tighter header */
.fm-stage { overflow: hidden; cursor: grab; touch-action: none; }
.fm-stage.panning { cursor: grabbing; }
.fm-canvas, .fm-canvas svg { width: 100%; height: 100%; }
.fm-canvas svg { margin: 0; }
.fm-paths { position: absolute; inset: 0; overflow: auto; cursor: auto; }
.fm-zoom { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; gap: 4px; }
.fm-zoom button { min-width: 40px; min-height: 36px; padding: 0 10px; font-size: 15px; font-variant-numeric: tabular-nums; }
.fm-headright { display: flex; align-items: center; gap: 8px; }
body.fm-nopanel .fm-body { grid-template-columns: minmax(0, 1fr) 0; gap: 0; }
body.fm-nopanel .fm-panel { display: none; }
.fm-node text.nm { font: 500 13px/1 var(--font); fill: var(--ink); }
.fm-node text.nm.sm { font-size: 11px; }
.fm-panel textarea { min-height: 52px; padding: 8px 12px; resize: vertical; }
.fm-test { margin-bottom: 8px; padding: 6px 12px; }
.fm-bar { margin: 10px 0 8px; }
.fm-left { gap: 4px; }
.fm-legend { padding: 2px 4px 0; row-gap: 2px; }

/* r8: lanes, grouped exits, larger names, compact header */
.fm-node text.nm { font: 500 15px/1 var(--font); }
.fm-node text.nm.sm { font-size: 12px; }
.fm-node.group rect:first-child { fill: var(--cream); stroke: var(--ink3); stroke-dasharray: 5 4; }
.fm-node.group { cursor: pointer; }
.fm-legend i.grpkey { border: 1.5px dashed var(--ink3); background: var(--cream); }
.fm-head { gap: 12px; }
.fm-head .fm-counts { margin-left: auto; }
.fm-head .fm-save { margin-left: 0; }
#fm-undo:disabled { display: none; }
.small-sel { max-width: 150px; }
.fm-bar { gap: 6px; margin: 8px 0 6px; }
.fm-test { margin-bottom: 6px; padding: 4px 12px; font-size: 13px; }

/* r9: detours read as attached (Cavin, Nov 18): a stronger dashed line */
.fm-edge.detour { stroke: var(--ink2); stroke-width: 2; stroke-dasharray: 6 3; }

/* r9: the skill pass (Nov 18) */
/* design-taste / emil: drafts are a corner dot, not a dashed border; the exit group is a solid tan box */
.fm-node.draft rect:first-child { stroke-dasharray: none; }
.fm-node .drdot { fill: var(--ink2); stroke: none; }
.fm-legend i.drk { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--ink2); vertical-align: 0; }
.fm-node.group rect:first-child { fill: var(--tan); stroke: var(--ink3); stroke-dasharray: none; }
.fm-legend i.grpkey { border: 1px solid var(--ink3); background: var(--tan); }
/* arrowheads match their lines */
.fm-arrow { fill: var(--ink2); } .fm-arrow-maybe { fill: var(--ink3); }
/* design-accessibility: a move back differs by pattern, not only color; dimmed boxes keep readable names */
.fm-edge.back { stroke-dasharray: 8 3 2 3; }
.fm-legend i.back { border-top: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--orange) 0 8px, transparent 8px 11px, var(--orange) 11px 13px, transparent 13px 16px); }
.fm-node.dim, .fm-note.dim { opacity: 1; }
.fm-node.dim rect:first-child { stroke: var(--line); }
.fm-node.dim text { fill: var(--ink2); }
.fm-note.dim { fill: var(--ink3); }
.fm-edge.dim { opacity: .3; }
.fm-edge, .fm-node rect, .fm-node text { transition: opacity 150ms ease, stroke 150ms ease, fill 150ms ease; }
@media (prefers-reduced-motion: reduce) { .fm-edge, .fm-node rect, .fm-node text { transition: none; } }
.fm-node:focus-visible rect:first-child { stroke: var(--ink); stroke-width: 3px; vector-effect: non-scaling-stroke; }
.fm-node.on rect:first-child { vector-effect: non-scaling-stroke; }
.fm-stage:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fm-probbtn { min-height: 24px; }
i.sw.split { -webkit-mask: linear-gradient(#000 0 42%, transparent 42% 58%, #000 58%); mask: linear-gradient(#000 0 42%, transparent 42% 58%, #000 58%); }
/* the panel: Add move button, Move the box buttons */
.fm-addmove { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.fm-addmove label { flex: 1; min-width: 0; margin: 0 !important; }
.fm-addmove button { flex: none; min-height: 36px; }
.fm-nudge { display: flex; align-items: center; gap: 4px; margin-top: 20px; font-size: 14px; color: var(--ink2); }
.fm-nudge span { margin-right: auto; }
.fm-nudge button { min-width: 36px; min-height: 36px; padding: 0; font-size: 16px; }
.fm-danger .none { margin-top: 8px !important; }
#fm-allprobs { margin-top: 4px; }
/* frontend-ui-engineering: Undo keeps its place, so the toolbar does not jump */
#fm-undo:disabled { display: inline-flex; visibility: hidden; }
/* frontend-ui-engineering / responsive: header and toolbar each fit one row at 1366 (Undo sits by the save line) */
.fm-head #fm-undo { margin-left: 0; }
.fm-bar .small-btn, .fm-sides .fm-side { padding: 0 9px; }
.fm-bar { gap: 4px; }
.fm-bar .fm-only { margin: 0 0 0 4px; gap: 6px; font-size: 13px; }
.fm-bar .small-sel { max-width: 114px; font-size: 13px !important; }
/* r9: a copy-only technology box says where its copy comes from (no line across the map) */
.fm-node text.fm-copyfrom { fill: var(--ink2); font: 400 11px/1 var(--font); }
