:root {
  --paper: #f5f1e6;
  --surface: #fffcf3;
  --ink: #173238;
  --muted: #526365;
  --line: #c9cec3;
  --rule: #e3e4d9;
  --relief: #f2c443;
  --selected: #fbefbd;
  --hover: #eceee4;
  --neutral: #edf0e7;
  --light: #85bce0;
  --speed: #b0ca77;
  --focus: #145cc5;
  --error: #9c3028;
  --warning: #765000;
  --success: #256345;
  --radius: 2px;
  --panel-shadow: 4px 4px 0 var(--ink);
  --space: 16px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.45;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
button:hover { background: var(--hover); border-color: #81928b; }
button:active { background: #dce2d7; }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
button.primary:hover { background: #29494e; }
button.accent { background: var(--relief); border-color: #d9ab2c; }
button.accent:hover { background: #e8b934; }
button.secondary { background: var(--neutral); }
button:disabled, button:disabled:hover { color: #697771; background: #f0f0e8; border-color: var(--rule); cursor: not-allowed; }
button.active, button[aria-pressed=true] { background: var(--selected); border-color: #ad9140; color: var(--ink); }
button.active:hover, button[aria-pressed=true]:hover { background: #f5e2a0; }
button.quiet { background: transparent; }
button.danger-link { color: var(--error); background: transparent; border-color: transparent; }
button.danger-link:hover { background: #f9e8df; }
button.full { width: 100%; }
.ui-icon { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; flex: none; }
button .ui-icon { margin-right: 6px; }
button[aria-label] .ui-icon, .task-card .ui-icon { margin-right: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
/* Keep focus and dialog keyboard behavior, without a ring after mouse/touch input. */
html[data-focus-input="pointer"] :focus { outline: none !important; }
::selection { background: var(--relief); color: var(--ink); }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.025em; }
h2 { font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 15px; line-height: 1.4; }
p { line-height: 1.55; }
.muted, .small, .tiny { color: var(--muted); }
.small, .tiny { font-size: 12px; line-height: 1.55; }
.tag { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
input:not([type=checkbox]), textarea, select {
  max-width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #94a199; border-radius: 4px;
  background: var(--surface); font-size: 16px;
  font-variant-numeric: tabular-nums; caret-color: var(--ink);
}
textarea { resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--error); }
input[type=checkbox] { accent-color: var(--ink); width: 18px; height: 18px; }
summary { cursor: pointer; min-height: 44px; align-content: center; font-size: 13px; font-weight: 600; }
summary:hover { color: #385950; }
[hidden] { display: none !important; }

/* A quiet frame for the working surfaces. */
.app-header { height: 56px; margin: 0 24px; display: flex; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; white-space: nowrap; }
.brand-mark svg { display: block; width: 24px; height: 24px; }
.workshop-name { font-size: 12px; color: var(--muted); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-actions button { min-height: 44px; padding: 8px 12px; background: transparent; border-color: transparent; font-size: 12px; }
.header-actions button:hover { background: var(--hover); }
.header-actions #export-project { border-color: #93a099; }
.save-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; font-size: 12px; color: var(--muted); }
.save-status:before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.save-status.unsaved { color: var(--error); }
.save-status.unsaved:before { background: var(--error); }
.lab-banner { display: flex; align-items: center; gap: 14px; margin: 0 24px; min-height: 84px; padding: 12px 0; }
.lab-number { width: 36px; height: 40px; display: grid; place-items: center; flex: none; border-radius: 3px; background: var(--relief); font-size: 14px; font-weight: 700; }
.lab-heading { min-width: 0; flex: 1; }
.lab-heading h1 { font-size: 24px; margin: 0 0 3px; }
.lab-heading p { font-size: 12px; color: var(--muted); margin: 0; }
.main-tabs { display: flex; align-items: center; gap: 4px; }
.main-tabs button { padding: 10px 18px; background: transparent; border-color: transparent; font-size: 14px; }
.main-tabs button.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.main-tabs button:hover { background: var(--hover); }
.main-tabs button.active:hover { background: #29494e; }
.page { padding: 0 24px 24px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; margin-bottom: 12px; }
.workspace-heading h2, .workspace-heading h1 { font-size: 18px; margin: 0 0 4px; }
.workspace-heading>div>p:last-child { margin: 0; font-size: 12px; color: var(--muted); max-width: 72ch; }
.workspace-label { font-size: 12px; color: var(--muted); margin: 0; }
#warehouse-page>.workspace-heading { flex-direction: row; }
.layout-tabs, .segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); background: #ebece2; border-radius: 7px; }
.layout-tabs button, .segmented button { border-color: transparent; background: transparent; border-radius: 4px; padding: 8px 14px; font-size: 13px; }
.layout-tabs button.active, .segmented button.active { background: var(--surface); border-color: #b9c1b5; color: var(--ink); }
.layout-tabs button:not(.active):hover, .segmented button:not(.active):hover { background: #dfe4d7; }
.warehouse-workspace, .flow-workspace { display: grid; grid-template-columns: 224px minmax(0,1fr) 272px; gap: 12px; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.panel-title h2, .panel-title h3 { font-size: 15px; letter-spacing: 0; margin: 0; }
.right-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Supply library: one consistent row, with the count in a stable column. */
.inventory-panel>p { margin: 12px; font-size: 12px; }
.inventory-list { padding: 0 6px; }
.supply-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; min-height: 68px; text-align: left; border-color: transparent; border-radius: 4px; background: transparent; margin-bottom: 2px; }
.supply-card:hover { background: var(--hover); border-color: transparent; }
.supply-card.selected, .supply-card[aria-pressed=true] { background: var(--selected); border-color: #c2a64e; }
.supply-card.complete { background: var(--neutral); }
.supply-icon { display: grid; place-items: center; width: 32px; height: 40px; flex: none; }
.supply-icon svg { width: 32px; height: 32px; image-rendering: pixelated; }
.supply-card>span:nth-child(2) { flex: 1; min-width: 0; }
.supply-card strong { display: block; font-size: 13px; line-height: 1.35; }
.supply-card small { display: block; margin-top: 5px; font-size: 11px; color: var(--muted); font-weight: 400; }
.supply-card>b { min-width: 24px; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.supply-card>b small { font-size: 10px; margin-top: 0; }
.priority { display: inline; white-space: nowrap; }
.priority:before { content: ' · '; }
.priority-high { color: var(--warning); font-weight: 600; }
.inventory-foot { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 12px; }
.inventory-foot button { margin-left: auto; padding: 8px; font-size: 12px; border-color: transparent; }
.inventory-panel>.tiny { margin: 8px 12px 16px; }

/* Canvas and tools. Zoom changes the drawing, never the surrounding controls. */
.floor-panel { --canvas-height: clamp(340px, calc(100svh - 340px), 720px); }
.floor-title { padding: 10px 12px; min-height: 60px; }
.floor-title>div:first-child { min-width: 0; }
.floor-scale { margin: 4px 0 0; padding: 0; font-size: 11px; color: var(--muted); }
.zoom-tools { display: flex; gap: 2px; align-items: center; flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.zoom-tools button { min-width: 36px; padding: 8px; border-color: transparent; }
.zoom-tools span { min-width: 34px; text-align: center; }
.canvas-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--rule); background: #f5f6ed; flex-wrap: wrap; }
.tool-buttons { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tool-buttons button { font-size: 12px; padding: 8px 10px; background: transparent; border-color: transparent; }
.tool-buttons button.active { background: var(--selected); border-color: #c2a64e; }
.tool-buttons button:hover { background: var(--hover); }
.tool-buttons button.active:hover { background: #f5e2a0; }
.tool-buttons button:disabled { color: #697771; background: transparent; }
.tool-buttons button[aria-label] { min-width: 40px; }
.divider { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.floor-context { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 38px; padding: 6px 12px; font-size: 12px; color: var(--muted); }
.floor-context strong { color: var(--ink); font-weight: 600; }
.selection-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink) !important; }
.overlay-label { margin-left: auto; display: flex; align-items: center; gap: 7px; min-height: 30px; font-size: 11px; cursor: pointer; }
.overlay-label input { margin: 0; width: 16px; height: 16px; }
.warehouse-canvas { padding: 8px 12px; height: var(--canvas-height); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.warehouse-canvas svg { display: block; height: auto; max-width: calc((var(--canvas-height) - 40px) * .978 * var(--warehouse-zoom,1)); margin: 0 auto; cursor: crosshair; touch-action: manipulation; user-select: none; overflow: visible; }
.placement-ghost { pointer-events: none; }
.warehouse-canvas:focus-visible, .flow-scroll:focus-visible { outline-offset: -4px; }

/* Inspectors share the same visual structure in both workspaces. */
.placement-inspector>h2, .flow-inspector>h3 { margin: 0; padding: 16px; border-bottom: 1px solid var(--rule); background: #f8f4e5; border-radius: var(--radius) var(--radius) 0 0; font-size: 16px; }
.inspector-body { padding: 16px; display: grid; grid-template-columns: 64px minmax(0,1fr); column-gap: 12px; align-items: start; }
.inspector-body>* { grid-column: 1/-1; }
.equipment-stage { display: grid; place-items: center; height: 80px; background: #eef0e4; border-radius: 4px; }
.equipment-stage svg { width: 64px; height: 64px; image-rendering: pixelated; }
.inspector-body>.equipment-stage { grid-column: 1; grid-row: 1/3; margin-bottom: 16px; }
.inspector-body>.equipment-stage+h3 { grid-column: 2; font-size: 19px; margin: 2px 0 5px; }
.inspector-body>.equipment-stage+h3+p { grid-column: 2; font-size: 11px; margin-bottom: 16px; }
.inspector-body>p { font-size: 13px; }
.inspector-rule { border-top: 1px solid var(--rule); margin-bottom: 16px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair label { font-size: 12px; }
.field-pair input { display: block; width: 100%; margin-top: 6px; }
.orientation-controls { display: flex; gap: 8px; margin: 12px 0; }
.orientation-controls button { flex: 1; }
.inspector-body>.full { margin-bottom: 8px; }
.callout { padding: 12px; background: var(--neutral); border-radius: 4px; font-size: 12px !important; line-height: 1.6; margin: 12px 0; color: var(--muted); }
.callout strong { color: var(--ink); }
.keyboard-help { font-size: 12px; margin-top: 0; }
.keyboard-help p { margin: 4px 0 0; color: var(--muted); }
.compatibility>summary { padding: 8px 16px; font-size: 13px; }
.check-row { display: flex; gap: 10px; margin: 16px; }
.check-row>span { width: 18px; flex: none; }
.check-row p { margin: 0; }
.check-row strong { display: block; font-size: 13px; }
.check-row small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.pass { color: var(--success); }
.fail, .error { color: var(--error); }
.warning { color: var(--warning); }
.access-results { margin: 16px; padding: 12px; background: var(--neutral); font-size: 12px; border-radius: 4px; }
.access-results ul { list-style: none; padding: 0; }
.access-results li { margin-bottom: 6px; }
.notes-panel { padding: 16px; }
.notes-panel h3 { font-size: 14px; }
.notes-panel textarea { width: 100%; font-size: 13px; }
.layout-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.layout-actions button { font-size: 12px; }
.compatibility { padding-bottom: 12px; }
.compatibility p { margin: 4px 16px 12px; font-size: 12px; color: var(--muted); }
.compatibility button { margin-left: 16px; font-size: 12px; }
.action-strip { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.action-strip strong { font-size: 13px; }
.action-strip p { margin: 4px 0 0; color: var(--muted); font-size: 12px; max-width: 75ch; }
.action-strip>div:last-child { display: flex; align-items: center; gap: 8px; flex: none; }
.notice { margin: 0 24px 12px; padding: 12px 16px; border: 1px solid #94b39c; border-radius: var(--radius); background: #eef4e7; font-size: 13px; }
.intro-band { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 24px; padding: 8px 0; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.intro-band button { background: transparent; border-color: transparent; font-weight: 400; font-size: 12px; }
footer { display: flex; justify-content: space-between; gap: 16px; margin: 0 24px; padding: 0 0 20px; font-size: 12px; }
footer span { font-size: 11px; color: var(--muted); }

/* Process library, canvas, timing, and review. */
.flow-palette { padding-bottom: 12px; }
.flow-palette>.small { margin: 12px; }
.flow-symbols { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 8px; }
.flow-symbols button { padding: 8px; font-size: 11px; flex: 1; }
.task-card { display: block; position: relative; width: calc(100% - 16px); margin: 0 8px; padding: 12px 20px 12px 40px; min-height: 88px; text-align: left; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; }
.task-art { position: absolute; left: 2px; top: 16px; width: 28px; height: 28px; }
.task-art svg { width: 28px; height: 28px; }
.task-card>span:not(.task-art) { display: block; font-size: 13px; line-height: 1.4; }
.task-card small, .task-card em { display: block; margin-top: 5px; font-size: 11px; color: var(--muted); font-weight: 400; font-style: normal; }
.task-card b { position: absolute; right: 0; top: 14px; }
.flow-palette>details { margin: 12px 16px 0; font-size: 12px; }
.flow-center .canvas-toolbar { gap: 6px; }
.flow-center .segmented { padding: 2px; }
.flow-center .segmented button { font-size: 12px; padding: 8px 10px; }
.flow-hint { min-height: 40px; padding: 10px 12px; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 12px; }
.flow-scroll { position: relative; overflow: auto; height: clamp(380px, calc(100svh - 300px), 740px); padding: 12px; overscroll-behavior: contain; scrollbar-gutter: stable; background: var(--surface); }
.flow-svg { display: block; }
.flow-scroll:has(.canvas-empty) { display: grid; place-items: center; }
.flow-scroll:has(.canvas-empty) .flow-svg { display: none; }
.canvas-empty { max-width: 290px; text-align: center; padding: 24px 12px; }
.canvas-empty>svg { width: 64px; height: 64px; margin-bottom: 20px; }
.canvas-empty h3 { font-size: 20px; font-weight: 600; }
.canvas-empty p { font-size: 13px; color: var(--muted); line-height: 1.65; }
.flow-node { cursor: grab; touch-action: none; }
.flow-node>rect, .flow-node>path { fill: var(--surface); stroke: #71847b; stroke-width: 1.5; }
.flow-node text { fill: var(--ink); font: 14px Arial,sans-serif; pointer-events: none; }
.flow-node .flow-sub { font-size: 12px; fill: var(--muted); }
.flow-node.selected>rect, .flow-node.selected>path { fill: var(--selected); stroke: var(--ink); stroke-width: 2; }
.flow-node.link-source>rect { stroke-dasharray: 6 3; }
.flow-edge { cursor: pointer; }
.edge-hit { stroke: transparent; fill: none; stroke-width: 20; }
.edge-line { stroke: var(--ink); fill: none; stroke-width: 1.5; }
.flow-edge.selected .edge-line { stroke-width: 3; }
.flow-edge text { font-size: 12px; fill: var(--ink); }
.flow-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--muted); }
.flow-inspector>label, .flow-inspector>.field-pair, .flow-inspector>fieldset, .flow-inspector>.small, .flow-inspector>.empty-inspector, .flow-inspector>.review-details, .flow-inspector>.callout, .process-limits { margin: 16px; }
.flow-inspector>.equipment-stage { margin: 16px; height: 80px; }
.flow-inspector>label { display: block; font-size: 12px; }
.flow-inspector label textarea, .flow-inspector input:not([type=checkbox]) { display: block; width: 100%; margin-top: 6px; font-size: 14px; }
.flow-inspector input[readonly] { background: var(--neutral); border-color: var(--line); }
.flow-inspector>.full { width: calc(100% - 32px); margin: 4px 16px; font-size: 12px; }
.flow-inspector fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.flow-inspector legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.flow-inspector .check-label { display: flex; align-items: center; min-height: 40px; gap: 6px; font-size: 12px; }
.empty-inspector { padding: 8px 0; }
.empty-inspector>.ui-icon { color: var(--muted); width: 24px; height: 24px; margin-bottom: 8px; }
.empty-inspector p { font-size: 13px; line-height: 1.6; }
.process-limits { padding-top: 8px; border-top: 1px solid var(--rule); }
.process-limits .callout { margin-top: 0; }
.review-details { border-top: 1px solid var(--rule); padding-top: 8px; font-size: 12px; }
.review-details ul { line-height: 1.6; padding-left: 18px; }
.review-details li { margin-bottom: 8px; }
.review-details summary span { padding: 2px 6px; background: var(--neutral); border-radius: 3px; margin-left: 5px; }
.notes-label { font-weight: 600; }
.notes-label textarea { font-weight: 400; }
.mini-stat { font-size: 12px; white-space: nowrap; }
.mini-stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stat small, .mini-stat span { font-size: 11px; font-weight: 400; color: var(--muted); }
.timeline { position: relative; background: var(--surface); min-height: 390px; }
.timeline-head { position: relative; height: 70px; border-bottom: 1px solid var(--line); font-size: 12px; }
.timeline-head>span { position: absolute; top: 10px; left: 0; }
.timeline-head b { position: absolute; bottom: 10px; transform: translateX(-50%); font-weight: 400; }
.timeline-body { position: relative; height: 240px; }
.timeline-lane-label { position: absolute; left: 0; width: 100px; height: 110px; padding-top: 40px; font-size: 13px; background: var(--surface); z-index: 3; font-weight: 600; }
.timeline-row-line { position: absolute; left: 100px; right: 0; border-top: 1px solid var(--rule); }
.timeline-task { position: absolute; min-height: 0; background: #dfe5d8; border: 1px solid #71847b; border-radius: 3px; padding: 8px 4px; overflow: hidden; font-size: 12px; z-index: 2; text-align: center; }
.timeline-task.selected { background: var(--selected); border-color: var(--ink); }
.timeline-task span { display: block; font-size: 12px; font-weight: 400; white-space: nowrap; }
.timeline-task svg { display: block; margin: 4px auto; }
.timeline-task:focus-visible { z-index: 4; }
.timeline-target { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--warning); z-index: 1; }
.timeline>.muted { padding: 16px 0; font-size: 12px; max-width: 700px; }
.task-table { padding: 0 12px; border-top: 1px solid var(--rule); font-size: 12px; overflow: auto; }
.task-table table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.task-table th, .task-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-table button { font-size: 12px; padding: 8px; }
.task-table td:nth-child(2) { white-space: normal; min-width: 180px; }

/* The guide is a readable course brief, rather than another editor. */
#guide-page { max-width: 1240px; margin: 0 auto; padding-top: 12px; }
.guide-hero { display: flex; justify-content: space-between; gap: 48px; padding: 32px 0; margin-bottom: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.guide-hero>div:first-child { max-width: 700px; }
.guide-hero h2 { font-size: 30px; margin: 12px 0 20px; letter-spacing: -.025em; }
.guide-hero p { font-size: 15px; max-width: 68ch; }
.guide-numbers { display: flex; flex-direction: column; justify-content: center; gap: 20px; min-width: 200px; }
.guide-numbers p { margin: 0; }
.guide-numbers b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.guide-numbers b span { font-size: 13px; margin-left: 6px; }
.guide-numbers p>span { font-size: 12px; color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; }
.guide-grid .panel { padding: 0 0 24px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.guide-grid h2 { font-size: 20px; }
.guide-grid h3 { margin-top: 24px; }
.guide-role-details>h3:first-child { margin-top: 0; }
/* Shared rows keep each role's heading, introduction, steps and reference aligned. */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 701px) {
    .guide-grid { row-gap: 24px; }
    .guide-grid>.guide-role { display: grid; grid-template-rows: subgrid; grid-row: span 4; }
    .guide-role>h2, .guide-role>p, .guide-role>ol { margin-block: 0; }
  }
}
.guide-grid p, .guide-grid li { font-size: 14px; line-height: 1.7; max-width: 72ch; }
.guide-grid li { margin-bottom: 12px; }
.guide-grid ol, .guide-grid ul { padding-left: 20px; }
.reference-tasks>div { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reference-tasks strong { font-size: 13px; }
.reference-tasks span, .reference-tasks small { font-size: 12px; }
.reference-tasks small { grid-column: 1/-1; color: var(--muted); }
dialog { max-width: min(560px,calc(100% - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 16px 64px #17323830; }
dialog::backdrop { background: #17323866; }
dialog p { font-size: 14px; }
.skip-link { position: fixed; left: 12px; top: -100px; padding: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--ink); z-index: 100; }
.skip-link:focus { top: 12px; }

/* Printed Workshop: ink-edged sheets and stamped controls. */
.app-header { border-bottom: 2px solid var(--ink); }
.brand { font-weight: 800; letter-spacing: -.02em; }
.lab-number { border: 2px solid var(--ink); border-radius: 0; box-shadow: 3px 3px 0 var(--ink); }
.lab-heading h1 { font-weight: 800; }
.panel { border: 2px solid var(--ink); border-radius: var(--radius); }
.floor-panel, .flow-center { box-shadow: var(--panel-shadow); }
.panel-title { border-bottom: 2px solid var(--ink); }
.inventory-panel>.panel-title, .flow-palette>.panel-title { background: var(--relief); }
.placement-inspector>h2, .flow-inspector>h3 { border-bottom: 2px solid var(--ink); background: var(--paper); border-radius: 0; }
button { border-radius: 2px; }
button.primary, button.accent {
  border: 2px solid var(--ink); border-radius: 2px; box-shadow: 2px 2px 0 var(--ink);
}
button.primary:active, button.accent:active { box-shadow: none; }
.main-tabs button.active { background: var(--relief); color: var(--ink); }
.main-tabs button.active:hover { background: #e8b934; }
.layout-tabs, .segmented { padding: 0; gap: 0; border: 2px solid var(--ink); border-radius: 2px; background: transparent; }
.layout-tabs button, .segmented button { border-radius: 0; }
.layout-tabs button.active, .segmented button.active { background: var(--relief); border-color: var(--ink); color: var(--ink); }
.supply-card { border-radius: 0; }
.supply-card.selected, .supply-card[aria-pressed=true] { background: var(--selected); border: 1px solid var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.inventory-list { padding-top: 8px; }
.canvas-toolbar { border-bottom: 1px solid var(--ink); background: var(--paper); }
.tool-buttons button.active { border-color: var(--ink); border-radius: 2px; background: var(--relief); }
.equipment-stage { background: transparent; border-radius: 0; }
input:not([type=checkbox]), textarea, select { border-radius: 0; border-color: #83918d; }
.action-strip { border-top: 2px solid var(--ink); }
.guide-hero { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.guide-grid .panel { border-bottom: 1px solid var(--ink); }

@media (min-width: 1100px) {
  .inventory-panel, .right-stack, .flow-palette, .flow-inspector { position: sticky; top: 12px; max-height: calc(100svh - 24px); overflow: auto; scrollbar-width: thin; }
}
@media (max-width: 1099px) and (min-width: 701px) {
  .warehouse-workspace, .flow-workspace { grid-template-columns: 200px minmax(0,1fr); }
  .right-stack { grid-column: 2; display: grid; grid-template-columns: 1fr 1fr; }
  .placement-inspector { grid-column: 1/-1; }
  .compatibility { grid-column: 1/-1; }
  .flow-inspector { grid-column: 2; }
  .lab-heading h1 { font-size: 21px; }
  .main-tabs button { padding: 10px 12px; font-size: 13px; }
  .workshop-name, .save-status { display: none; }
  .floor-title { flex-wrap: wrap; }
  .guide-grid { gap: 24px; }
  .action-strip { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .app-header { height: auto; min-height: 56px; margin: 0 16px; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
  .brand { font-size: 13px; gap: 6px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .workshop-name, .save-status { display: none; }
  .header-actions { gap: 0; }
  .header-actions button { padding: 8px; font-size: 11px; }
  .lab-banner { margin: 0 16px; gap: 10px; flex-wrap: wrap; padding: 16px 0 12px; }
  .lab-number { width: 30px; height: 36px; font-size: 12px; }
  .lab-heading h1 { font-size: 21px; }
  .main-tabs { width: 100%; margin-top: 4px; gap: 4px; }
  .main-tabs button { flex: 1; padding: 10px 8px; font-size: 13px; }
  .page { padding: 0 16px 20px; }
  .workspace-heading { flex-wrap: wrap; gap: 8px; }
  #warehouse-page>.workspace-heading { flex-direction: column; align-items: stretch; }
  .workspace-label { display: none; }
  .layout-tabs button { flex: 1; }
  .warehouse-workspace, .flow-workspace { display: flex; flex-direction: column; gap: 12px; }
  .warehouse-workspace>*, .flow-workspace>* { width: 100%; }
  .inventory-panel .panel-title { min-height: 44px; padding: 10px 12px; }
  .inventory-panel>.small { margin: 8px 12px; }
  .inventory-list { display: flex; overflow-x: auto; gap: 6px; padding: 0 8px 8px; scroll-snap-type: x proximity; }
  .supply-card { width: 180px; flex: 0 0 180px; min-height: 76px; padding: 10px 8px; border: 1px solid var(--rule); scroll-snap-align: start; }
  .inventory-foot { padding-top: 4px; margin-top: 0; }
  .inventory-panel>.tiny { margin-bottom: 12px; }
  .floor-panel { --canvas-height: 360px; }
  .floor-title { flex-wrap: wrap; gap: 6px; }
  .floor-title>div:first-child { flex: 1 1 180px; }
  .zoom-tools { margin-left: auto; }
  .canvas-toolbar { padding: 6px; }
  .tool-buttons { gap: 2px; }
  .tool-buttons button { padding: 8px; }
  .floor-context { gap: 6px; }
  .overlay-label { margin-left: 0; }
  .warehouse-canvas { padding: 8px; }
  .right-stack { display: flex; }
  .action-strip { flex-direction: column; align-items: stretch; gap: 12px; }
  .action-strip>div:last-child { flex-wrap: wrap; }
  .action-strip button { flex: 1; }
  .notice { margin: 0 16px 12px; }
  .flow-palette { display: flex; overflow-x: auto; flex-wrap: nowrap; padding: 10px; gap: 8px; }
  .flow-palette>.panel-title, .flow-palette>.small, .flow-palette>details { display: none; }
  .flow-symbols { flex: 0 0 130px; flex-direction: column; margin: 0; }
  .task-card { flex: 0 0 190px; width: 190px; margin: 0; border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px 12px 40px; }
  .task-art { left: 6px; }.task-card b { right: 4px; }
  .flow-scroll { height: 400px; }
  .flow-center .tool-buttons { flex-wrap: wrap; }
  .mini-stat { display: none; }
  #guide-page { padding-top: 0; }
  .guide-hero { display: block; padding: 24px 0; }
  .guide-hero h2 { font-size: 26px; }
  .guide-numbers { min-width: 0; flex-direction: row; flex-wrap: wrap; gap: 24px; margin-top: 24px; }
  .guide-numbers b { font-size: 21px; }
  .guide-grid { display: block; }
  .guide-grid .panel { margin-bottom: 24px; }
  .reference-tasks>div { grid-template-columns: 1fr; }
  .intro-band { margin: 0 16px; flex-wrap: wrap; gap: 0; }
  .intro-band button { padding-left: 0; }
  footer { margin: 0 16px; display: block; }
  footer span { display: block; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { button[aria-pressed=true], button.active { outline: 2px solid Highlight; }.pallet.selected>rect { stroke: Highlight; } }
@media print {
  @page { size: landscape; margin: 12mm; }
  body { background: white; }
  .app-header, .lab-banner, .intro-band, footer, .canvas-toolbar, .floor-context,
  .inventory-panel, .right-stack, .flow-palette, .flow-inspector,
  .flow-hint, .flow-bottom, .layout-tabs, #notice, .action-strip, .task-table { display: none !important; }
  .page { padding: 0; }.workspace-heading { margin-bottom: 10px; }
  .warehouse-workspace, .flow-workspace { display: block; }
  .floor-panel { max-width: 175mm; border: 0; box-shadow: none; margin: 0 auto; }
  .warehouse-canvas { padding: 0; overflow: visible; height: auto; }
  .warehouse-canvas svg { width: 100% !important; min-width: 0 !important; max-width: none; }
  .floor-title .zoom-tools { display: none; }
  .flow-center { border: 0; }
  .flow-scroll { overflow: visible; height: auto; }.flow-svg { max-width: 100%; height: auto; }
  .guide-hero { padding: 20px 0; break-inside: avoid; }.guide-grid { display: block; }
  .guide-grid .panel { border: 0; padding: 12px 0; break-inside: avoid; }
  .guide-grid button, .workspace-heading>button, .guide-numbers { display: none; }
}


/* References sit apart from the two editing workspaces. */
.header-actions .guide-entry { border: 1px solid var(--ink); margin-right: 16px; font-weight: 700; text-decoration: none; }
.header-actions .guide-entry[aria-expanded=true] { background: var(--relief); }
.guide-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#guide-page { margin-top: 24px; padding: 24px; border: 2px solid var(--ink); background: var(--surface); box-shadow: var(--panel-shadow); }
#guide-page>.workspace-heading h1 { font-size: 30px; }
.flow-hint:empty { display: none; }
@media(max-width:700px) {
  .header-actions .guide-entry { margin-right: 6px; }
  #guide-page { margin: 16px; padding: 16px; }
  .guide-actions { width: 100%; }
}
@media print { .guide-actions { display: none; } #guide-page { border: 0; box-shadow: none; margin: 0; } }

/* A reference sheet above the current work, with the paper identity intact. */
.header-actions .guide-entry { display: inline-flex; align-items: center; gap: 7px; background: var(--paper); border: 2px solid var(--ink); border-radius: 2px; box-shadow: 2px 2px 0 var(--ink); }
.header-actions .guide-entry .ui-icon { margin: 0; }
.header-actions .guide-entry:hover { background: var(--selected); }
.header-actions .guide-entry:active { box-shadow: none; }
body.guide-open { overflow: hidden; }
#guide-dialog { width: min(1040px,calc(100vw - 64px)); max-width: none; max-height: min(860px,calc(100svh - 64px)); padding: 0; margin: auto; overflow: auto; overscroll-behavior: contain; border: 2px solid var(--ink); border-radius: 2px; background: var(--surface); box-shadow: 7px 7px 0 var(--ink); scrollbar-color: var(--line) var(--surface); }
#guide-dialog::backdrop { background: rgb(23 50 56 / 38%); }
#guide-dialog #guide-page { margin: 0; padding: 0 32px 32px; border: 0; box-shadow: none; max-width: none; }
#guide-dialog .workspace-heading { position: sticky; top: 0; z-index: 1; margin: 0 -32px; padding: 16px 32px; background: var(--paper); border-bottom: 2px solid var(--ink); }
#guide-dialog .workspace-heading h1 { font-size: 24px; }
#guide-dialog .guide-actions { flex-direction: row-reverse; }
#close-guide { background: var(--relief); border: 1px solid var(--ink); }
#guide-dialog .guide-hero { border-top: 0; padding-top: 24px; gap: 24px; }
#guide-dialog .guide-hero h2 { font-size: 26px; }
#guide-dialog .guide-numbers { min-width: 160px; }
@media(max-width:700px) {
 #guide-dialog { width: calc(100vw - 32px); max-height: calc(100svh - 40px); box-shadow: 4px 4px 0 var(--ink); }
 #guide-dialog #guide-page { padding: 0 16px 24px; }
 #guide-dialog .workspace-heading { margin: 0 -16px; padding: 12px 16px; flex-wrap: nowrap; }
 #guide-dialog .workspace-heading h1 { font-size: 20px; white-space: nowrap; }
 #guide-dialog .guide-actions { width: auto; gap: 4px; }
 #guide-dialog .guide-actions button { padding: 8px; font-size: 12px; }
}
@media print {
 body.guide-open { overflow: visible; }
 body.guide-open>main, body.guide-open>.app-header, body.guide-open>.intro-band, body.guide-open>footer { display: none !important; }
 #guide-dialog[open] { position: static; width: auto; max-height: none; overflow: visible; border: 0; box-shadow: none; }
 #guide-dialog .workspace-heading { position: static; }
 #guide-dialog::backdrop { background: transparent; }
}

/* File formats share one entry point in the paper header. */
.file-action { position: relative; }
.file-formats { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 224px; padding: 4px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.file-formats[hidden] { display: none; }
.header-actions .file-formats button { display: block; width: 100%; padding: 10px 12px; text-align: left; border: 0; font-size: 14px; }
.file-formats button span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.header-actions .file-formats button:hover { background: var(--selected); }
#process-page>.workspace-heading>.segmented { flex-shrink: 0; }

/* Supplies establishes the height of the adjacent editor sheet. */
@media screen and (min-width: 701px) {
  .warehouse-workspace>.inventory-panel { position: static; }
  .floor-panel { display: flex; flex-direction: column; height: var(--supplies-height, 720px); min-height: 0; }
  .floor-panel>* { flex-shrink: 0; }
  .floor-panel>.warehouse-canvas { flex: 1 1 0; min-height: 0; height: auto; padding: 12px 16px 28px; container-type: size; }
  .warehouse-canvas svg { max-width: calc(max(0px, 100cqh - 2px) * .978 * var(--warehouse-zoom, 1)); }
}
@media screen and (max-width: 700px) {
  .warehouse-canvas { padding-bottom: 24px; }
}

/* Lab parts are paper dividers; file actions remain quiet utilities. */
.app-header { height: auto; min-height: 64px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.app-header .brand { gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -.025em; }
.app-header .brand strong { display: block; font-weight: 600; line-height: 1; transform: translateY(1px); }
.app-header .brand-mark { display: flex; align-items: center; flex: none; }
.app-header .brand-mark svg { width: 38px; height: auto; }
.header-actions #import-project, .header-actions #export-project { border: 1px solid transparent; background: transparent; box-shadow: none; }
.header-actions #import-project:hover, .header-actions #export-project:hover,
.header-actions #import-project[aria-expanded=true], .header-actions #export-project[aria-expanded=true] { background: var(--selected); }
.lab-banner { padding: 16px 0; }
.main-tabs { display: flex; width: auto; min-width: 0; margin: 0 24px 16px; padding: 4px 2px 0; gap: 6px; align-items: stretch; overflow-x: auto; background: linear-gradient(var(--ink),var(--ink)) left bottom / 100% 2px no-repeat; scrollbar-width: thin; }
.main-tabs button { position: relative; flex: 0 0 auto; min-height: 44px; max-width: none; padding: 10px 20px; white-space: nowrap; border: 2px solid var(--ink); border-radius: 2px 2px 0 0; background: var(--paper); color: var(--muted); box-shadow: none; font-size: 14px; }
.main-tabs button.active { background: var(--relief); color: var(--ink); border-color: var(--ink); border-bottom-color: var(--relief); box-shadow: none; }
.main-tabs button:hover { background: var(--selected); color: var(--ink); }
.main-tabs button.active:hover { background: var(--relief); }
.main-tabs button:focus-visible { outline-offset: -5px; }
@media (max-width: 700px) {
 .app-header { padding: 10px 0; row-gap: 8px; }
 .main-tabs { width: auto; margin: 0 16px 16px; gap: 6px; }
 .main-tabs button { flex: 0 0 auto; padding: 10px 16px; font-size: 13px; }
}
@media print { .main-tabs { display: none; } }

/* Push short tab sets right; overflowing sets remain reachable from the start. */
.main-tabs button:first-child { margin-left: auto; }

/* Title and part tabs share one compact heading band. */
.lab-banner { align-items: center; padding: 16px 0 0; margin-bottom: 16px; border-bottom: 2px solid var(--ink); }
.lab-banner>.lab-number, .lab-banner>.lab-heading { margin-bottom: 16px; }
.lab-banner>.main-tabs { align-self: flex-end; flex-shrink: 0; margin: 0 0 -2px auto; padding-top: 4px; background: none; max-width: 55%; }
@media (max-width: 700px) {
 .lab-banner { padding-top: 16px; row-gap: 0; }
 .lab-banner>.main-tabs { flex-basis: 100%; max-width: 100%; margin-left: 0; }
}

#warehouse-page>.workspace-heading { justify-content: center; }
@media (max-width: 700px) {
 #warehouse-page>.workspace-heading { align-items: center; }
}

#process-page>.workspace-heading { position: relative; justify-content: center; }
#process-page>.workspace-heading>.mini-stat { position: absolute; right: 0; }
@media (max-width: 700px) {
 #process-page>.workspace-heading>.mini-stat { position: static; flex-basis: 100%; text-align: center; }
}

/* One consistent ink frame and divider for segmented switches. */
.layout-tabs button, .segmented button { border: 0; }
.layout-tabs button + button, .segmented button + button { border-left: 2px solid var(--ink); }

/* The floor is an editor, not selectable document artwork. */
#warehouse-svg, #warehouse-svg * { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
#warehouse-svg:focus { outline: none; }
#warehouse-svg:focus-visible { outline: 1px dashed var(--muted); outline-offset: -2px; }

.floor-panel>.canvas-toolbar { flex-wrap: wrap; justify-content: flex-start; overflow: visible; padding: 8px 10px; }
.floor-panel>.canvas-toolbar>.tool-buttons, .floor-panel>.canvas-toolbar>.zoom-tools { flex: 0 0 auto; flex-wrap: nowrap; white-space: nowrap; }
.floor-panel>.canvas-toolbar>.tool-buttons:last-child { margin-left: auto; }
#reset-dialog { width: min(380px, calc(100vw - 40px)); padding: 24px; background: var(--paper); border: 2px solid var(--ink); border-radius: 2px; box-shadow: 5px 5px 0 var(--ink); }
#reset-dialog::backdrop { background: rgb(23 50 56 / .38); }
#reset-dialog h2 { margin: 0 0 12px; font-size: 20px; }
#reset-dialog p { margin: 0 0 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.header-actions #project-menu { display: inline-flex; align-items: center; gap: 6px; }
#project-menu .ui-icon { width: 16px; height: 16px; margin: 0; transition: transform .15s ease-out; }
#project-menu[aria-expanded=true] .ui-icon { transform: rotate(180deg); }
.header-actions #import-matlab { border-top: 1px solid var(--line); }

/* Zoom shares one squared paper-and-ink frame in both editors. */
.canvas-toolbar .zoom-tools { display: inline-flex; align-items: stretch; gap: 0; padding: 0; border: 2px solid var(--ink); border-radius: 2px; background: var(--paper); overflow: hidden; }
.canvas-toolbar .zoom-tools button { display: grid; place-items: center; width: 40px; min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); }
.canvas-toolbar .zoom-tools button .ui-icon { margin: 0; width: 18px; height: 18px; }
.canvas-toolbar .zoom-tools span { display: grid; place-items: center; min-width: 52px; padding: 0 6px; border-inline: 1px solid var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.canvas-toolbar .zoom-tools button:hover:not(:disabled) { background: var(--selected); }
.canvas-toolbar .zoom-tools button:active:not(:disabled) { background: var(--relief); }
.canvas-toolbar .zoom-tools button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; background: var(--selected); }
.canvas-toolbar .zoom-tools button:disabled { color: var(--muted); opacity: .45; background: transparent; }

.canvas-toolbar .toolbar-access { margin: 0 8px 0 0; padding: 0 6px; min-height: 40px; color: var(--ink); white-space: nowrap; font-size: 12px; }

/* Core editing stays visible; secondary actions share a paper dropdown. */
.floor-panel { container-type: inline-size; }
.warehouse-toolbar { position: relative; z-index: 2; gap: 8px; }
.warehouse-toolbar .editing-tools { flex-wrap: wrap !important; min-width: 0; max-width: 100%; }
.warehouse-toolbar .zoom-tools { margin-left: auto; }
.warehouse-toolbar .toolbar-more { flex: 0 0 auto; }
#warehouse-more { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 1px solid var(--ink); border-radius: 2px; background: var(--paper); }
#warehouse-more .ui-icon { margin: 0; width: 16px; }
#warehouse-more[aria-expanded=true] { background: var(--selected); }
#warehouse-options { width: 216px; max-width: calc(100vw - 48px); }
#warehouse-options button, #warehouse-options .toolbar-access { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; padding: 10px 12px; min-height: 44px; border: 0; background: transparent; text-align: left; font-size: 12px; }
#warehouse-options button:hover:not(:disabled), #warehouse-options .toolbar-access:hover { background: var(--selected); }
#warehouse-options .toolbar-access { white-space: normal; border-bottom: 1px solid var(--line); }
#warehouse-options #undo { border-top: 1px solid var(--line); }
.warehouse-toolbar button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
@container (max-width: 700px) {
 .warehouse-toolbar .editing-tools .tool-label { display: none; }
 .warehouse-toolbar .editing-tools button { width: 40px; min-width: 40px; padding: 8px; }
 .warehouse-toolbar .editing-tools button .ui-icon { margin: 0; }
 .warehouse-toolbar .editing-tools .divider { display: none; }
}

/* Keep overflow scrollable without visible scrollbar chrome. */
.warehouse-workspace>.inventory-panel,
.warehouse-workspace>.floor-panel,
.warehouse-canvas { scrollbar-width: none; -ms-overflow-style: none; }
.warehouse-canvas { scrollbar-gutter: auto; }
.warehouse-workspace>.inventory-panel::-webkit-scrollbar,
.warehouse-workspace>.floor-panel::-webkit-scrollbar,
.warehouse-canvas::-webkit-scrollbar { display: none; width: 0; height: 0; }

#warehouse-options #reset-layout { border-top: 1px solid var(--line); color: var(--error); }


/* A single door-seeded search wave settles into the existing access wash. */
.aisle-access.is-revealing .aisle-wave { animation: aisle-spread 220ms ease-out backwards; animation-delay: var(--aisle-delay, 0ms); }
.aisle-access.is-revealing .aisle-unreachable { animation: aisle-unreached 180ms ease-out backwards; animation-delay: var(--aisle-delay, 0ms); }
@keyframes aisle-spread {
 0% { opacity: 0; }
 25% { opacity: .32; }
 100% { opacity: .16; }
}
@keyframes aisle-unreached {
 from { opacity: 0; }
 to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
 .aisle-access.is-revealing .aisle-wave, .aisle-access.is-revealing .aisle-unreachable { animation: none; }
}

/* Process map: one timed sheet beside a persistent task library. */
.process-workspace { display: grid; grid-template-columns: 248px minmax(0,1fr); gap: 12px; align-items: stretch; margin-top: 16px; min-width: 0; }
.process-palette, .process-canvas { min-width: 0; height: clamp(400px,calc(100svh - 222px),900px); }
.process-palette { display: flex; flex-direction: column; overflow: hidden; }
.process-palette .panel-title { flex: 0 0 55px; background: var(--relief); padding: 8px 12px; border-bottom: 2px solid var(--ink); }
.process-palette .panel-title h2 { font-size: 16px; }
.process-palette .panel-title>span { font-size: 12px; }
.process-palette .panel-title button { padding: 0; min-height: 36px; background: transparent; border: 0; }
.process-library { overflow: auto; scrollbar-width: none; min-height: 0; padding: 6px; }
.process-library::-webkit-scrollbar, .process-scroll::-webkit-scrollbar { display: none; }
.process-palette .task-card { display: block; min-width: 0; width: 100%; min-height: 76px; margin: 0; padding: 12px 10px; border: 0; border-radius: 0; background: transparent; text-align: left; }
.process-palette .task-card:hover { background: var(--selected); }
.process-palette .task-art { position: static; width: 28px; height: 28px; }
.process-palette .task-name { font-size: 13px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.process-palette .task-card small { display: block; font-weight: 400; font-size: 12px; margin-top: 6px; color: var(--muted); }
.process-palette .task-count { position: static; text-align: right; font-size: 16px; font-variant-numeric: tabular-nums; }
.process-unscheduled { margin: 12px 6px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; }
.process-unscheduled>button { display: block; width: 100%; text-align: left; margin-top: 6px; }
.process-canvas { display: flex; flex-direction: column; box-shadow: var(--panel-shadow); overflow: visible; }
.process-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; border-bottom: 1px solid var(--ink); background: var(--paper); }
.process-history { display: flex; gap: 2px; padding-inline: 8px; border-inline: 1px solid var(--line); }
.process-history>button, .process-more>button { background: transparent; border-color: transparent; }
.process-more { position: relative; margin-left: auto; }
.process-more>button { display: flex; align-items: center; gap: 8px; }
.process-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 190px; max-width: calc(100vw - 40px); border: 2px solid var(--ink); padding: 6px; background: var(--surface); box-shadow: var(--panel-shadow); }
.process-menu>button, .process-menu .layout-export-group>button { display: block; width: 100%; text-align: left; border: 0; background: transparent; }
.process-menu>button:hover, .process-menu .layout-export-group>button:hover { background: var(--selected); }
.process-new, .process-shelve { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.process-new.active { background: var(--relief); border-color: var(--ink); }
.process-palette .panel-title { gap: 8px; }
.process-palette .panel-title>button { display: inline-flex; align-items: center; gap: 4px; border-color: transparent; background: transparent; padding: 6px; }
.process-palette .panel-title>button:hover:enabled { background: var(--selected); }
.shelf-row { display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: center; border-bottom: 1px solid var(--rule); }
.shelf-remove { width: 36px; padding: 6px; border: 0; background: transparent; color: var(--muted); }
.shelf-remove:hover { color: var(--ink); background: var(--selected); }
.shelf-empty { margin: 16px 6px; font-size: 13px; color: var(--muted); }
.process-worker-control { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 12px; font-size: 13px; }
.process-worker-control input { width: 76px; min-width: 0; padding: 8px; }
.process-map-frame { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 84px minmax(0,1fr); }
.process-label-scroll { overflow: hidden; min-height: 0; border-right: 2px solid var(--ink); }
.process-lane-head { display: grid; height: 100%; min-height: calc(var(--workers) * var(--lane-min) + 36px); grid-template-rows: 36px repeat(var(--workers),minmax(0,1fr)); background: var(--surface); font-size: 13px; text-align: center; z-index: 2; }
.process-lane-head>span { align-self: center; font-size: 11px; color: var(--muted); }
.process-lane-head>strong { display: grid; place-items: center; padding: 8px 4px; border-top: 1px solid var(--line); }
.process-scroll { min-height: 0; min-width: 0; overflow: auto; scrollbar-width: none; overscroll-behavior: contain; background: var(--surface); cursor: grab; }
.process-scroll.panning { cursor: grabbing; }
.process-scroll:focus-visible { outline-offset: -4px; }
.process-sheet { position: relative; height: 100%; min-height: calc(var(--workers) * var(--lane-min) + 36px); min-width: 100%; margin-left: 12px; user-select: none; -webkit-user-select: none; }
.process-ruler { position: absolute; inset: 0; pointer-events: none; }
.process-tick { position: absolute; top: 36px; bottom: 0; border-left: 1px solid var(--rule); }
.process-tick.major { border-color: var(--line); }
.process-tick>span { position: absolute; bottom: calc(100% + 10px); left: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.process-lanes { position: relative; top: 36px; height: calc(100% - 36px); }
.process-lane { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.process-block { position: absolute; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; min-height: 0; min-width: 0; padding: 12px 8px; overflow: hidden; border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); text-align: center; cursor: grab; font-size: 13px; line-height: 1.35; touch-action: pan-x pan-y; z-index: 1; }
.process-block>strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; overflow-wrap: anywhere; }
.process-block>span { color: var(--muted); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.process-block.compact { padding: 8px 4px; font-size: 12px; gap: 8px; }
.process-block:hover { background: var(--hover); }
.process-block.selected { background: var(--selected); }
.process-block.dragging { background: var(--selected); cursor: grabbing; z-index: 3; }
.process-block:focus-visible { z-index: 4; outline-offset: 1px; }
.process-empty { position: absolute; top: 50%; left: calc(50% + 42px); transform: translate(-50%,-50%); width: min(260px,70%); padding: 20px; background: var(--surface); text-align: center; pointer-events: none; }
.process-empty>svg { display: block; margin: 0 auto 14px; }
.process-empty p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 950px) { .process-workspace { grid-template-columns: 224px minmax(0,1fr); } }
@media (max-width: 700px) {
 .process-workspace { grid-template-columns: minmax(0,1fr); margin-top: 12px; }
 .process-palette { height: auto; max-height: 300px; }
 .process-library { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 8px; }
 .process-palette .task-card { min-height: 72px; padding: 8px 4px; }
 .process-palette .task-art { display: none; }
 .process-palette .task-name { font-size: 12px; }
 .process-palette .task-card small { font-size: 11px; }
 .process-unscheduled { grid-column: 1/-1; }
 .process-canvas { height: 520px; }
 .process-toolbar { gap: 4px; padding: 6px; }
 .process-history>button { width: 34px; padding: 6px; }
 .process-toolbar .zoom-tools button { min-width: 32px; width: 32px; }
 .process-toolbar .zoom-tools span { min-width: 42px; }
 .process-more>button { padding: 6px; }
 .process-map-frame { grid-template-columns: 68px minmax(0,1fr); }
 .process-lane-head { font-size: 12px; }
 .process-empty { left: calc(50% + 34px); }
 .process-block { padding: 4px; font-size: 12px; }
 .process-block>span { font-size: 10px; }
}
@media (forced-colors: active) { .process-block.selected { outline: 2px solid Highlight; } }
@media print { .process-palette,.process-toolbar { display: none; } .process-workspace { display: block; } .process-canvas { height: auto; border: 0; box-shadow: none; } .process-scroll { overflow: visible; } }

/* Direct manipulation: the sheet itself owns task editing. */
.process-palette .task-card[aria-pressed=true] { background: var(--selected); outline: 1px solid var(--ink); outline-offset: -1px; }
.process-palette .task-card[draggable=true] { cursor: grab; }
.process-scroll.placing { cursor: crosshair; }
.process-block { overflow: visible; }
.process-block .process-name { cursor: text; max-width: 100%; }
.process-block .process-duration { display: block; }
.process-block .process-duration { cursor: text; }
.process-block.selected { touch-action: none; }
.process-block.editing { min-width: 0; min-height: 0; z-index: 5; }
/* Paper edge tabs: the visible grip sits inside a larger transparent hit area. */
.process-resize-handle { display: none; position: absolute; left: 50%; transform: translateX(-50%); width: 40px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: ns-resize; touch-action: none; z-index: 3; }
.process-block.selected .process-resize-handle { display: block; }
.process-block.editing .process-resize-handle { display: none; }
.process-resize-handle.top { top: -15px; }
.process-resize-handle.bottom { bottom: -15px; }
.process-resize-handle.left, .process-resize-handle.right { top: 50%; left: auto; transform: translateY(-50%); width: 28px; height: 40px; cursor: ew-resize; }
.process-resize-handle.left { left: -15px; }
.process-resize-handle.right { right: -15px; }
.process-resize-handle::after { content: ''; position: absolute; inset: 10px 10px; border: 1px solid var(--ink); background: var(--surface); pointer-events: none; }
.process-resize-handle.left::after, .process-resize-handle.right::after { inset: 10px 10px; }
.process-resize-handle::before { content: ''; position: absolute; inset: 12px 16px; border-block: 1px solid var(--ink); z-index: 1; pointer-events: none; }
.process-resize-handle.left::before, .process-resize-handle.right::before { inset: 16px 12px; border-block: 0; border-inline: 1px solid var(--ink); }
.process-resize-handle:hover, .process-resize-handle:active { background: transparent; }
.process-resize-handle:hover::after, .process-resize-handle:focus-visible::after { background: var(--relief); }
.process-resize-handle:active::after { background: var(--ink); }
.process-resize-handle:active::before { border-color: var(--surface); }
.process-block.resizing { background: var(--selected); z-index: 3; }
.process-inline-name { width: 100%; min-height: 28px; max-height: calc(100% - 36px); overflow: auto; resize: none; margin: 0; padding: 4px; border: 1px solid var(--ink); background: var(--surface); text-align: center; font: inherit; font-weight: 700; line-height: 1.35; user-select: text; -webkit-user-select: text; cursor: text; }
.process-inline-duration { width: 100%; min-height: 32px; padding: 4px; background: var(--surface); font-size: 12px; text-align: center; }
.process-ghost { position: absolute; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; min-width: 0; padding: 8px; border: 2px dashed var(--ink); background: var(--selected); opacity: .7; pointer-events: none; z-index: 4; text-align: center; overflow: hidden; font-size: 13px; overflow-wrap: anywhere; }
.process-ghost>span { font-size: 12px; }
.process-ghost.invalid { border-color: var(--error); }

/* Gesture previews leave the saved geometry and pointer-capture owner intact. */
.process-block.gesture-source { opacity: .15; }
.process-block.gesture-preview { pointer-events: none; z-index: 5; }

/* Process-only finish: drafting controls and responsive paper feedback. */
.process-workspace { --process-ease: cubic-bezier(.16,1,.3,1); }
.process-toolbar button { border-radius: 0; }
.process-new { border-color: var(--ink); background: var(--surface); }
.process-new:hover:enabled, .process-shelve:hover:enabled,
.process-history>button:hover:enabled, .process-more>button:hover:enabled { background: var(--selected); border-color: var(--ink); }
.process-toolbar button:active:enabled { background: var(--relief); }
.process-shelve { background: transparent; border-color: transparent; }
.process-toolbar .ui-icon { flex-shrink: 0; margin: 0; width: 18px; height: 18px; }
.process-history>button { width: 36px; padding: 8px; }
.process-toolbar .zoom-tools { display: flex; align-items: stretch; gap: 0; margin-left: auto; border: 2px solid var(--ink); background: var(--paper); }
.process-toolbar .zoom-tools button { display: grid; place-items: center; min-width: 34px; width: 34px; min-height: 36px; padding: 0; border: 0; background: transparent; }
.process-toolbar .zoom-tools span { display: grid; place-items: center; min-width: 48px; padding-inline: 4px; border-inline: 1px solid var(--ink); font-size: 12px; font-weight: 600; }
.process-toolbar .zoom-tools button:hover:enabled { background: var(--selected); }
.process-toolbar .zoom-tools button:active:enabled { background: var(--relief); }
.process-more { margin-left: 0; }
.process-more>button .ui-icon { transition: transform 180ms var(--process-ease); }
.process-more>button[aria-expanded=true] .ui-icon { transform: rotate(180deg); }
.process-menu:not([hidden]) { animation: process-menu-open 160ms var(--process-ease); transform-origin: top right; }
.process-menu>button, .process-menu .layout-export-group>button { font-size: 13px; }
.process-worker-control { border-block: 1px solid var(--rule); margin-block: 4px; }
.process-library { padding: 6px 8px; }
.process-palette .task-card { transition: background-color 140ms ease-out; }
.process-palette .task-card:active { cursor: grabbing; background: var(--selected); }
.shelf-remove { min-height: 40px; }
.shelf-remove .ui-icon { width: 16px; height: 16px; margin: 0; }
.shelf-empty { margin: 18px 10px; }
.process-lane-head { background: var(--paper); }
.process-lane-head>strong { font-size: 12px; font-weight: 600; color: var(--muted); }
.process-tick.major>span { font-weight: 700; color: var(--ink); }
.process-block { transition: background-color 140ms ease-out, border-color 140ms ease-out; }
.process-block.selected:not(.gesture-preview) { z-index: 2; }
.process-block.selected:not(.gesture-source):not(.gesture-preview) { box-shadow: inset 0 0 0 1px var(--ink); }
.process-block.editing { z-index: 5; }
.process-block .process-name { line-height: 1.4; text-wrap: balance; }
.process-resize-handle::after { transition: background-color 120ms ease-out; }
.process-block.selected .process-resize-handle { animation: process-grip-reveal 120ms ease-out; }
.process-inline-name, .process-inline-duration { caret-color: var(--ink); }
/* Pointer tracking must stay immediate: never tween task geometry. */
.process-block.gesture-preview, .process-ghost { transition: none; }
.process-block.gesture-preview { box-shadow: 3px 3px 0 var(--ink); }
@keyframes process-menu-open { from { opacity: .4; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes process-grip-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) {
 .process-history { padding-inline: 4px; }
 .process-toolbar .zoom-tools { margin-left: 0; }
 .process-more { margin-left: auto; }
 .process-toolbar .zoom-tools button { min-width: 32px; width: 32px; }
 .process-toolbar .zoom-tools span { min-width: 42px; }
}
@media (prefers-reduced-motion: reduce) {
 .process-menu:not([hidden]), .process-block.selected .process-resize-handle { animation: none; }
 .process-more>button .ui-icon, .process-palette .task-card,
 .process-workspace *, .process-workspace *::after { transition: none; }
}

/* Both editors: edit, zoom, More; identical icon scale and label spacing. */
.warehouse-toolbar .editing-tools button,
.process-new, .process-remove, .process-shelve { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.warehouse-toolbar .editing-tools button .ui-icon,
.process-toolbar .ui-icon { width: 18px; height: 18px; margin: 0; flex: 0 0 18px; }
.process-remove { background: transparent; border-color: transparent; }
.process-remove:hover:enabled { background: var(--selected); border-color: var(--ink); }
.process-shelve { margin-left: 4px; }
.process-toolbar .zoom-tools { border-radius: 2px; overflow: hidden; }
.process-toolbar .zoom-tools button { width: 40px; min-width: 40px; min-height: 40px; }
.process-toolbar .zoom-tools span { min-width: 52px; padding-inline: 6px; }
.process-more>button { border: 1px solid var(--ink); border-radius: 2px; background: var(--paper); gap: 6px; }
.process-more>button[aria-expanded=true] { background: var(--selected); }
.process-more>button .ui-icon { width: 16px; flex-basis: 16px; }
.process-menu>button, .process-menu .layout-export-group>button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; font-size: 12px; }
.process-menu [data-action=undo] { border-top: 1px solid var(--line); }
@media (max-width: 700px) {
 .process-toolbar .zoom-tools button { width: 32px; min-width: 32px; }
 .process-toolbar .zoom-tools span { min-width: 42px; padding-inline: 4px; }
}

.process-shelve:disabled, .process-shelve:disabled:hover { color: var(--muted); background: transparent; border-color: transparent; box-shadow: none; opacity: .6; }

/* Map styles: preview the structure before opening a blank sheet. */
.process-style-picker { min-height: 0; margin-top: 0; padding: clamp(20px,2.5vw,36px); display: flex; flex-direction: column; justify-content: safe center; gap: 24px; overflow-y: auto; scrollbar-width: none; }
.process-style-picker::-webkit-scrollbar { display: none; }
.style-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.style-picker-heading h2 { margin: 0; font-size: 22px; }
.process-style-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.process-style-options>button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px 16px; min-width: 0; border: 2px solid var(--ink); background: var(--surface); font-size: 16px; }
.map-style-preview { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; background: var(--surface); border: 1px solid var(--line); user-select: none; overflow: hidden; }
.map-style-preview text { fill: var(--muted); font-family: inherit; font-size: 9px; font-weight: 400; }
.map-style-preview .preview-name { fill: var(--ink); font-size: 11px; font-weight: 700; }
.map-style-preview .preview-time { font-size: 10px; }
.map-style-preview .preview-header { fill: var(--paper); }
.map-style-preview .preview-rule { fill: none; stroke: var(--line); stroke-width: 1; }
.map-style-preview .preview-grid { fill: none; stroke: var(--rule); stroke-width: 1; }
.map-style-preview .preview-dot { fill: var(--line); }
.map-style-preview .preview-task { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.map-style-preview .preview-arrow { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: miter; }
.process-style-options>button:hover, .process-style-options>button[aria-pressed=true] { background: var(--selected); border-color: var(--ink); }
.process-style-options>button:active { background: var(--relief); }
.vertical-map { display: flex; flex-direction: column; }
.vertical-map .process-label-scroll { flex: 0 0 36px; margin-left: 48px; border-right: 0; border-bottom: 1px solid var(--ink); }
.vertical-map .process-lane-head { height: 36px; min-height: 0; min-width: calc(var(--workers) * var(--lane-min)); grid-template-rows: 1fr; grid-template-columns: repeat(var(--workers),minmax(0,1fr)); }
.vertical-map .process-lane-head>strong { border-top: 0; border-left: 1px solid var(--line); }
.vertical-map .process-scroll { flex: 1; }
.vertical-map .process-sheet { margin: 0; width: 100%; min-width: calc(var(--workers) * var(--lane-min) + 48px); min-height: 100%; }
.vertical-map .process-ruler { left: 48px; }
.vertical-map .process-tick { left: 0; right: 0; bottom: auto; border-left: 0; border-top: 1px solid var(--rule); }
.vertical-map .process-tick.major { border-color: var(--line); }
.vertical-map .process-tick>span { top: 0; bottom: auto; left: -40px; width: 30px; text-align: right; transform: translateY(-50%); }
.vertical-map .process-lanes { top: 0; left: 48px; width: calc(100% - 48px); height: 100%; }
.vertical-map .process-lane { top: 0; bottom: 0; right: auto; border-top: 0; border-left: 1px solid var(--line); }
.vertical-map .process-block.compact { gap: 4px; padding: 4px; }
.vertical-map .process-block.compact:not(.editing) .process-name { display: none; }
.vertical-map .process-block.editing { min-height: 80px; }
.freeform-map { display: flex; }
.freeform-map .process-scroll { flex: 1; }
.freeform-map .process-sheet { min-width: 100%; min-height: 100%; margin: 0; }
.freeform-map .process-lanes { top: 0; height: 100%; }
.freeform-map .process-block { gap: calc(4px * var(--diagram-zoom)); padding: calc(12px * var(--diagram-zoom)); font-size: calc(13px * var(--diagram-zoom)); }
.freeform-map .process-block>span { font-size: calc(12px * var(--diagram-zoom)); }
.freeform-map .process-block .process-people { cursor: text; font-size: calc(11px * var(--diagram-zoom)); }
.freeform-map .process-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; color: var(--ink); }
.process-edge { pointer-events: auto; cursor: pointer; }
.process-edge .edge-hit { stroke: transparent; stroke-width: 16px; fill: none; pointer-events: stroke; }
.process-edge .edge-line { fill: none; stroke: var(--ink); stroke-width: 2px; pointer-events: none; }
.process-edge.selected .edge-line { stroke: var(--warning); stroke-width: 3px; }
.process-edge text { fill: var(--ink); font-size: 12px; }
.connection-preview { fill: none; stroke: var(--ink); stroke-width: 2px; stroke-dasharray: 5 4; pointer-events: none; }
.process-connect { position: absolute; right: -28px; top: calc(50% - 14px); width: 28px; min-height: 28px; height: 28px; display: grid; place-items: center; padding: 3px; border: 1px solid var(--ink); background: var(--surface); cursor: crosshair; }
.process-connect .ui-icon { width: 16px; height: 16px; margin: 0; }
.process-connect:hover { background: var(--relief); }
.process-corner { position: absolute; width: 24px; height: 24px; min-height: 0; border: 0; padding: 0; background: transparent; }
.process-corner::after { content: ''; position: absolute; inset: 9px; border: 1px solid var(--ink); background: var(--surface); }
.process-corner.nw { top: -13px; left: -13px; cursor: nwse-resize; }
.process-corner.ne { top: -13px; right: -13px; cursor: nesw-resize; }
.process-corner.sw { bottom: -13px; left: -13px; cursor: nesw-resize; }
.process-corner.se { bottom: -13px; right: -13px; cursor: nwse-resize; }
.process-corner:hover { background: transparent; }
.process-corner:hover::after { background: var(--relief); }
.process-inline-name { min-width: 0; }
@media (max-width: 700px) {
 .process-style-picker { padding: 20px; gap: 20px; }
 .process-style-options { grid-template-columns: 1fr; gap: 12px; }
 .process-style-options>button { flex-direction: row; justify-content: flex-start; gap: 24px; padding: 12px 16px; }
 .process-style-options>button>.map-style-preview { width: 100px; height: auto; flex: 0 0 100px; }
}
.process-style-picker, .process-map-frame { animation: process-sheet-arrive 160ms ease-out; }
@keyframes process-sheet-arrive { from { opacity: .65; } to { opacity: 1; } }

/* Plain shapes on a ruled workshop sheet. Timing remains student-authored text. */
.diagram-shapes { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 4px 0 20px; }
.diagram-shapes button { min-width: 0; min-height: 60px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.diagram-shapes button:hover { background: var(--selected); border-color: var(--ink); }
.diagram-shapes button[aria-pressed="true"] { background: var(--relief); border-color: var(--ink); }
.diagram-shapes svg { width: 54px; height: 34px; }
.saved-shapes-title { font-size: 14px; margin: 0 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.freeform-map .process-lanes { background-image: radial-gradient(circle, rgb(23 50 56 / .16) .8px, transparent 1px); background-size: var(--diagram-grid) var(--diagram-grid); background-position: 0 0; }
.diagram-lane { position: absolute; inset-inline: 0; border-bottom: 1px solid var(--line); pointer-events: none; }
/* Cover the parent lane border so connectors cannot show through label seams. */
.diagram-lane strong { position: sticky; left: 0; z-index: 8; height: calc(100% + 1px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: calc(12px * var(--diagram-zoom)); background: var(--paper); border-right: 1px solid var(--line); font-size: calc(13px * var(--diagram-zoom)); text-align: center; overflow-wrap: anywhere; }
.diagram-divider { position: absolute; left: 0; width: 100%; height: 12px; min-height: 0; padding: 0; transform: translateY(-50%); background: transparent; border: 0; border-radius: 0; cursor: ns-resize; z-index: 1; }
.diagram-divider:hover { background: rgb(23 50 56 / .07); }
.freeform-map .diagram-shape { border: 0; background: transparent; box-shadow: none; overflow: visible; gap: 0; z-index: 2; }
.freeform-map .diagram-shape.selected { background: transparent; box-shadow: none; }
.shape-surface { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.diagram-shape.selected .shape-surface { fill: var(--selected); }
.diagram-shape .process-name,.diagram-shape .process-inline-name { position: relative; white-space: pre-wrap; z-index: 1; }
.freeform-map .diagram-shape { padding: var(--shape-pad-y) var(--shape-pad-x); }
.freeform-map .diagram-shape .process-inline-name { min-height: 0; max-height: 100%; }
.freeform-map .shape-text.selected { outline: 1px dashed var(--ink); outline-offset: -1px; }
.freeform-map .process-connect { width: 24px; height: 24px; min-height: 0; padding: 0; background: transparent; border: 0; border-radius: 0; }
.freeform-map .process-connect::after { content: ''; position: absolute; inset: 9px; border: 1px solid var(--ink); background: var(--surface); border-radius: 50%; }
.freeform-map .process-connect:hover::after { background: var(--relief); transform: scale(1.35); }
.freeform-map .process-connect.port-top { left: calc(50% - 12px); top: -12px; right: auto; }
.freeform-map .process-connect.port-bottom { left: calc(50% - 12px); top: auto; bottom: -12px; right: auto; }
.freeform-map .process-connect.port-left { left: -12px; top: calc(50% - 12px); right: auto; }
.freeform-map .process-connect.port-right { left: auto; right: -12px; top: calc(50% - 12px); }
.freeform-map .edge-line { vector-effect: non-scaling-stroke; }
.process-edge text { paint-order: stroke; stroke: var(--surface); stroke-width: 5px; fill: var(--ink); text-anchor: middle; pointer-events: auto; font-size: 12px; }
.process-palette .task-card > svg { flex: 0 0 32px; width: 32px; height: 28px; }
.process-input-dialog { width: min(460px,calc(100vw - 40px)); max-height: calc(100svh - 40px); overflow-y: auto; padding: 24px; background: var(--paper); border: 2px solid var(--ink); border-radius: 2px; box-shadow: 5px 5px 0 var(--ink); }
.process-input-dialog::backdrop { background: rgb(23 50 56 / .38); }
.process-input-dialog h2 { font-size: 20px; margin: 0 0 20px; }
.process-input-dialog label { display: grid; gap: 8px; }
.process-input-dialog input { width: 100%; min-width: 0; }
.process-input-dialog .dialog-actions { margin-top: 24px; }
.swimlane-fields { display: grid; gap: 8px; margin-bottom: 12px; }
.swimlane-field { display: grid; grid-template-columns: minmax(0,1fr) repeat(3,32px); gap: 4px; align-items: center; }
.swimlane-field button { padding: 4px; min-height: 36px; display: grid; place-items: center; }
.swimlane-field [data-up] svg { transform: rotate(-90deg); }
.swimlane-field [data-down] svg { transform: rotate(90deg); }

.freeform-map .diagram-shape.selected:not(.gesture-source):not(.gesture-preview) { box-shadow: none; }
.freeform-map .diagram-shape .process-name { min-height: 0; max-height: 100%; overflow: hidden; overflow-wrap: anywhere; }

.freeform-map .diagram-shape.process-ghost { border: 0; background: transparent; box-shadow: none; z-index: 4; }
.freeform-map .process-ghost .shape-surface { fill: var(--selected); stroke-dasharray: 4 3; }
/* Four precise ports, revealed only while working with a shape or connection. */
.freeform-map .process-connect { visibility: hidden; opacity: 0; pointer-events: none; transition: opacity 100ms ease-out; z-index: 6; }
.freeform-map .diagram-shape:hover .process-connect,
.freeform-map .diagram-shape.selected .process-connect,
.freeform-map .diagram-shape:focus-within .process-connect,
.freeform-map .connecting .process-connect { visibility: visible; opacity: 1; pointer-events: auto; }
.freeform-map .process-connect.snap-target::after { background: var(--relief); transform: scale(1.5); }
.connection-end { position: absolute; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; background: transparent; z-index: 7; cursor: crosshair; }
.connection-end::after { content: ''; position: absolute; inset: 8px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); }
.connection-end:hover { background: transparent; }
.connection-end:hover::after { background: var(--relief); }

.freeform-map .process-scroll.placing .process-connect { visibility: hidden; opacity: 0; pointer-events: none; }

/* Quiet paper/ink chrome for scrollbars that are visible. */
* { scrollbar-color: var(--line) var(--surface); }
html { scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: var(--surface); }
*::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--surface); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.worker-stepper { display: flex; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.process-worker-control .worker-stepper input { width: 44px; padding: 6px; border: 0; background: transparent; text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.worker-stepper input::-webkit-inner-spin-button, .worker-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.worker-stepper-buttons { display: grid; border-left: 1px solid var(--line); }
.process-menu .worker-stepper-buttons button { display: grid; place-items: center; width: 30px; min-height: 24px; padding: 2px; border: 0; border-radius: 0; background: transparent; }
.process-menu .worker-stepper-buttons button + button { border-top: 1px solid var(--line); }
.worker-stepper-buttons svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.process-menu .worker-stepper-buttons button:hover:not(:disabled) { background: var(--selected); }
.process-menu .worker-stepper-buttons button:active:not(:disabled) { background: var(--relief); }
.process-menu .worker-stepper-buttons button:disabled { opacity: .35; background: transparent; }

/* Export modifier sits beneath its action, with a single section divider. */
.layout-export-group { padding-bottom: 8px; }
#warehouse-options .export-image-option, #process-menu .export-image-option { display: flex; align-items: center; gap: 7px; padding: 0 12px 0 38px; min-height: 28px; font-size: 11px; color: var(--muted); cursor: pointer; }
#warehouse-options input[type="checkbox"], .layout-export-group input[type="checkbox"] { appearance: none; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; flex: 0 0 auto; border: 1px solid var(--muted); border-radius: 1px; background: var(--surface); display: grid; place-content: center; cursor: pointer; }
#warehouse-options .export-image-option input, #process-menu .export-image-option input { width: 14px; height: 14px; }
#warehouse-options input[type="checkbox"]:checked, .layout-export-group input[type="checkbox"]:checked { background: var(--relief); border-color: var(--ink); }
#warehouse-options input[type="checkbox"]:checked::after, .layout-export-group input[type="checkbox"]:checked::after { content: ''; width: 7px; height: 4px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }
#warehouse-options label:hover input[type="checkbox"], .layout-export-group label:hover input[type="checkbox"] { border-color: var(--ink); }
#warehouse-options .export-image-option:hover, #process-menu .export-image-option:hover { color: var(--ink); }

/* The lab's opening spread; the compact workspaces retain their own scale. */
@font-face { font-family: 'Fraunces'; src: url('assets/fonts/fraunces.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
.landing-course { display: none; margin-left: auto; font-size: 13px; letter-spacing: .2em; white-space: nowrap; }
.landing-active .header-actions { display: none; }
.landing-active .landing-course { display: block; }
.landing-active #main { margin: 0; padding: 0; max-width: none; }
#landing-page { width: min(100%, calc((100svh - 64px) * 2)); max-width: 1480px; margin: 0 auto; padding: clamp(20px,3vh,36px) clamp(24px,3vw,48px); min-height: calc(100svh - 64px); display: grid; grid-template-columns: minmax(0,.88fr) minmax(0,1.12fr); gap: clamp(12px,2vw,32px); align-items: center; }
.landing-copy { min-width: 0; position: relative; z-index: 1; padding-bottom: 0; }
.landing-lab { display: flex; align-items: center; gap: 20px; margin-bottom: clamp(20px,3vh,32px); }
.landing-lab>span { width: 54px; height: 54px; display: grid; place-items: center; flex: none; background: var(--relief); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 26px; font-weight: 700; }
.landing-lab>strong { flex: 1; align-self: stretch; display: flex; align-items: center; border-bottom: 1px solid var(--ink); font-size: clamp(18px,1.9vw,28px); line-height: 1.2; }
#landing-title { font-family: 'Fraunces',Georgia,serif; font-weight: 750; font-variation-settings: 'opsz' 72, 'SOFT' 0, 'WONK' 1; font-size: clamp(42px,min(4.8vw,8vh),72px); line-height: .99; letter-spacing: -.035em; margin: 0 0 20px; }
.landing-intro { font-size: clamp(16px,min(1.25vw,2.3vh),18px); line-height: 1.45; max-width: 52ch; }
.landing-intro p { margin: 0 0 16px; }
.landing-enter { margin-top: 8px; width: 100%; display: flex; align-items: center; gap: 24px; text-align: left; padding: 12px 20px; border: 2px solid var(--ink); border-radius: 0; background: var(--relief); box-shadow: 3px 3px 0 var(--ink); transition: background 180ms ease-out, transform 180ms ease-out, box-shadow 180ms ease-out; }
.landing-enter>svg { width: 34px; height: 34px; flex: none; }
.landing-enter strong { display: block; font-family: 'Fraunces',Georgia,serif; font-size: clamp(23px,2vw,28px); font-weight: 700; line-height: 1.2; }
.landing-enter small { display: block; font-size: clamp(13px,1.15vw,17px); font-weight: 400; margin-top: 4px; }
.landing-enter:hover { background: #f5ce61; border-color: var(--ink); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.landing-enter:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.landing-links { display: flex; align-items: center; margin-top: 20px; gap: 18px; }
.landing-links button { display: flex; align-items: center; gap: 12px; background: transparent; border: 0; padding: 8px 0; font-size: clamp(13px,1.15vw,16px); text-align: left; }
.landing-links button+button { border-left: 1px solid var(--line); padding-left: 22px; }
.landing-links button:hover { text-decoration: underline; text-underline-offset: 4px; }
.landing-links svg { width: 28px; height: 28px; flex: none; }
.landing-art { display: block; width: 100%; height: auto; max-height: max(280px, calc(100svh - 148px)); object-fit: contain; user-select: none; -webkit-user-drag: none; animation: landing-arrive 700ms cubic-bezier(.16,1,.3,1) both; }
@keyframes landing-arrive { from { opacity: .7; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) {
 .landing-course { font-size: 10px; letter-spacing: .12em; }
 #landing-page { width: 100%; grid-template-columns: 1fr; padding: 32px 24px; gap: 0; }
 .landing-copy { max-width: 580px; margin-inline: auto; }
 #landing-title { font-size: clamp(44px,8.5vw,64px); }
 .landing-art { max-height: none; max-width: 560px; margin: 12px auto 0; }
 .landing-links { gap: 12px; }
 .landing-links button+button { padding-left: 14px; }
 .landing-links svg { width: 23px; }
}
@media (max-width: 380px) { .landing-course { display: none !important; } .landing-enter { padding: 14px; gap: 14px; } .landing-links { flex-wrap: wrap; } .landing-links button+button { border: 0; padding-left: 0; } }
@media (prefers-reduced-motion: reduce) { .landing-art { animation: none; } .landing-enter { transition: none; } }

/* The entry action is an envelope: a quiet label and an oversized right closure. */
.landing-enter {
 position: relative; isolation: isolate; overflow: visible;
 display: grid; grid-template-columns: minmax(0,1fr) 132px;
 gap: 8px; min-height: 120px; padding: 16px 0 16px 24px;
 background: #ecd18c; border: 1px solid var(--ink);
 box-shadow: 3px 3px 0 var(--ink);
}
.landing-enter:hover { background: #f1d998; }
.envelope-label { position: relative; z-index: 2; grid-column: 1; grid-row: 1; min-width: 0; }
.landing-enter .envelope-label strong { font-size: clamp(32px,2.8vw,40px); line-height: 1.12; }
.landing-enter .envelope-label small { max-width: 26ch; margin-top: 7px; font-size: 14px; line-height: 1.35; }
.landing-enter>.envelope-lock {
 position: absolute; right: 0; top: 50%; transform: translateY(-50%);
 width: 132px; height: 124px; overflow: visible; pointer-events: none; z-index: 3;
}
.stud-shadow { fill: var(--ink); opacity: .1; }
.stud { fill: #dfbd6b; stroke: #796744; stroke-width: .8; }
.stud-pin { fill: var(--ink); stroke: none; r: 2.2px; }
.envelope-lock [data-cord] { stroke-linecap: round; stroke-linejoin: round; fill: none; }
.cord-shadow { stroke: var(--ink); stroke-width: 2; opacity: .12; transform: translate(.6px,1px); }
.cord-ink { stroke: #394640; stroke-width: 1.7; }
.landing-enter.untying { cursor: pointer; transform: none; box-shadow: 3px 3px 0 var(--ink); }
@media (max-width: 480px) {
 .landing-enter { grid-template-columns: minmax(0,1fr) 108px; min-height: 116px; padding-left: 16px; gap: 4px; }
 .landing-enter>.envelope-lock { width: 108px; height: 112px; }
 .landing-enter .envelope-label strong { font-size: 28px; }
 .landing-enter .envelope-label small { font-size: 12px; }
}
@media (min-width: 761px) and (max-height: 780px) {
 .landing-lab { margin-bottom: 18px; }
 #landing-title { margin-bottom: 16px; }
 .landing-links { margin-top: 14px; }
}

/* Crossfading illustrations share one footprint; the paragraph never reflows. */
.landing-carousel { position: relative; min-width: 0; }
.landing-scenes { position: relative; width: 100%; aspect-ratio: 1; max-height: max(280px,calc(100svh - 180px)); }
.landing-scenes .landing-art { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; max-width: none; margin: 0; object-fit: contain; animation: none; opacity: 0; transition: opacity 600ms ease-in-out; pointer-events: none; }
.landing-scenes .landing-art.is-current { opacity: 1; }
.landing-intro .scenario-phrase { display: inline; cursor: pointer; min-height: 0; padding: 0; border: 0; border-radius: 0; font: inherit; color: inherit; background: transparent; text-align: left; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color 600ms ease-in-out; }
.landing-intro .scenario-phrase[aria-pressed="true"] { background: var(--selected); }
.landing-intro .scenario-phrase:hover { background: #f1e3b0; }
@media (max-width: 760px) { .landing-carousel { width: 100%; max-width: 560px; margin: 12px auto 0; } .landing-scenes { max-height: none; } }
@media (prefers-reduced-motion: reduce) { .landing-scenes .landing-art, .landing-intro .scenario-phrase { transition: none; } }

html[data-focus-input="keyboard"] .scenario-phrase:focus { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The complete illustration gently grows within its existing footprint. */
.landing-scenes .landing-art { transform: scale(.97); transform-origin: center; }
@media (prefers-reduced-motion: reduce) { .landing-scenes .landing-art { transform: none; } }

/* Responsive workshop: bounded laptop sheets, tablet columns, phone stacks. */
@media screen {
 .app-header, .lab-banner, .page, .landing-copy { min-width: 0; }
 .process-canvas { container-type: inline-size; }
 .file-formats, #warehouse-options, .process-menu {
  max-height: calc(100svh - 160px); overflow-y: auto; overscroll-behavior: contain;
 }
 dialog { max-height: calc(100svh - 40px); overflow-y: auto; overscroll-behavior: contain; }
 .landing-links { flex-wrap: wrap; }
}
@media screen and (min-width: 701px) {
 .warehouse-workspace>.inventory-panel {
  max-height: clamp(300px,calc(100svh - 182px),900px);
  overflow: auto; overscroll-behavior: contain;
 }
 .inventory-panel>.panel-title { position: sticky; top: 0; z-index: 1; }
 .process-palette, .process-canvas { height: clamp(300px,calc(100svh - 202px),900px); }
}
@container (max-width: 620px) {
 .process-style-picker { padding: 20px; gap: 16px; }
 .process-style-options { grid-template-columns: minmax(0,1fr); gap: 12px; }
 .process-style-options>button { flex-direction: row; justify-content: flex-start; gap: 16px; padding: 12px; }
 .process-style-options>button>.map-style-preview { width: min(100px,35%); height: auto; flex: 0 1 100px; }
}
@media screen and (min-width: 761px) and (max-width: 1000px) and (min-height: 700px) {
 #landing-page { grid-template-columns: minmax(0,1fr); width: 100%; max-width: 720px; gap: 24px; }
 .landing-copy { max-width: 580px; margin-inline: auto; }
 .landing-carousel { width: 100%; max-width: 520px; margin-inline: auto; }
 .landing-scenes { max-height: none; }
}
@media screen and (max-width: 700px) {
 .app-header { column-gap: 12px; }
 .app-header .brand { white-space: normal; min-width: 0; }
 .app-header .brand strong { line-height: 1.2; }
 .header-actions { flex-wrap: wrap; gap: 8px; }
 .header-actions .guide-entry { margin-right: 0; }
 .process-palette { height: auto; max-height: 220px; }
 .process-canvas { height: clamp(360px,70svh,640px); }
 .floor-panel { --canvas-height: clamp(300px,65svh,560px); }
 .process-toolbar { gap: 8px; }
 .process-toolbar .zoom-tools { flex: 0 0 auto; }
 .process-new, .process-remove, .process-shelve { white-space: normal; }
 .style-picker-heading { flex-wrap: wrap; }
 .style-picker-heading h2 { font-size: 20px; }
 #guide-dialog .workspace-heading h1 { white-space: normal; }
 #guide-dialog .workspace-heading { gap: 8px; }
 .landing-links { gap: 8px 16px; }
 .landing-links button+button { border: 0; padding-left: 0; }
}
@media screen and (max-width: 380px) {
 .page { padding-inline: 12px; }
 .app-header, .lab-banner { margin-inline: 12px; }
 .header-actions { width: 100%; justify-content: flex-end; }
 #landing-page { padding: 24px 16px; }
 .landing-lab { gap: 12px; }
 .landing-lab>span { width: 44px; height: 44px; font-size: 22px; }
 .landing-enter { grid-template-columns: minmax(0,1fr) 92px; padding-left: 12px; }
 .landing-enter>.envelope-lock { width: 92px; }
 .landing-enter .envelope-label strong { font-size: 28px; }
}
@media screen and (max-height: 500px) and (min-width: 701px) {
 #landing-page { width: 100%; }
 .landing-scenes { max-height: none; }
}
@media screen and (pointer: coarse) {
 .warehouse-toolbar .editing-tools button,
 .canvas-toolbar .zoom-tools button,
 .process-toolbar .zoom-tools button { width: 44px; min-width: 44px; min-height: 44px; }
 .process-palette .panel-title>button, .shelf-remove { min-width: 44px; min-height: 44px; }
 .shelf-row { grid-template-columns: minmax(0,1fr) 44px; }
 .process-menu .worker-stepper-buttons button { width: 44px; min-height: 44px; }
 .swimlane-field { grid-template-columns: minmax(0,1fr) repeat(3,44px); }
 .swimlane-field button { min-height: 44px; }
 #warehouse-options .export-image-option, #process-menu .export-image-option { min-height: 44px; }
 .process-input-dialog input, .process-inline-name, .process-inline-duration { font-size: 16px; }
}

/* Editing handles reserve their gesture; the surrounding sheet still pans. */
.diagram-divider, .process-connect, .connection-end, .process-corner { touch-action: none; }

/* Phone composition: compact framing and deliberate rows above the artifact. */
@media screen and (max-width: 600px) {
 .app-header { margin-inline: 16px; gap: 8px; min-height: 64px; }
 .app-header .brand { font-size: 14px; gap: 8px; }
 .app-header .brand-mark svg { width: 28px; }
 .header-actions { width: auto; margin-left: auto; gap: 6px; }
 .header-actions button { padding-inline: 8px; }
 .header-actions .guide-entry { font-size: 12px; }
 .lab-banner { margin-inline: 16px; padding-top: 12px; min-height: 0; }
 .lab-banner>.lab-number { width: 28px; height: 32px; margin-bottom: 12px; }
 .lab-banner>.lab-heading { margin-bottom: 12px; }
 .lab-heading h1 { font-size: 20px; }
 .lab-banner>.main-tabs { width: 100%; gap: 0; padding-top: 0; }
 .lab-banner>.main-tabs button { flex: 1; margin-left: 0; text-align: center; }
 .lab-banner>.main-tabs button+button { border-left: 0; }
 .page { padding-inline: 16px; }
 .workspace-heading { margin-bottom: 10px; gap: 8px; }
 .layout-tabs { width: 100%; }
 .layout-tabs button { flex: 1; padding-inline: 8px; }
 .warehouse-workspace { gap: 12px; }
 .inventory-panel .panel-title { min-height: 40px; padding: 8px 10px; }
 .inventory-panel .panel-title h2 { font-size: 14px; }
 .inventory-list { padding: 8px; gap: 8px; }
 .supply-card { flex-basis: 156px; width: 156px; min-height: 64px; margin: 0; }
 .supply-card strong { font-size: 12px; }
 .supply-card>b { font-size: 14px; min-width: 20px; }
 .floor-panel>.warehouse-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 8px; gap: 8px; }
 .warehouse-toolbar .editing-tools { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; width: 100%; }
 .warehouse-toolbar .editing-tools button { width: 100%; min-width: 0; min-height: 44px; padding: 6px; flex-direction: column; gap: 4px; font-size: 11px; }
 .warehouse-toolbar .editing-tools .tool-label { display: inline; }
 .warehouse-toolbar .zoom-tools { margin-left: 0; justify-self: start; }
 .floor-panel>.warehouse-toolbar>.toolbar-more { margin-left: 0; justify-self: end; }
 .floor-panel { --canvas-height: auto; }
 .warehouse-canvas { height: min(520px,calc((100vw - 52px) * 1.022 + 32px)); padding: 12px 8px 20px; container-type: size; }
 .warehouse-canvas svg { max-width: calc(max(0px,100cqh - 2px) * .978 * var(--warehouse-zoom,1)); }
 .process-workspace { margin-top: 0; gap: 12px; }
 .process-palette { max-height: 164px; }
 .process-palette .panel-title { flex-basis: auto; min-height: 40px; padding: 6px 10px; }
 .process-library { display: flex; gap: 8px; padding: 8px; overflow: auto; }
 .process-library>.shelf-row { flex: 0 0 184px; align-self: stretch; border: 1px solid var(--line); }
 .process-library>.shelf-empty { margin: 8px 2px; }
 .process-library>.process-unscheduled { flex: 0 0 184px; margin: 0; }
 .diagram-shapes { flex: 0 0 auto; display: flex; gap: 6px; padding: 0; }
 .diagram-shapes button { flex: 0 0 52px; width: 52px; min-height: 52px; padding: 0; }
 .diagram-shapes svg { width: 40px; height: 28px; }
 .saved-shapes-title { flex: 0 0 64px; align-self: center; border: 0; padding: 0; margin: 0 4px; font-size: 12px; }
 .process-toolbar { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 8px; }
 .process-toolbar>.process-new, .process-toolbar>.process-remove, .process-toolbar>.process-shelve { min-width: 0; margin: 0; padding: 6px 4px; min-height: 52px; flex-direction: column; gap: 4px; font-size: 11px; text-align: center; }
 .process-toolbar>.zoom-tools { grid-column: 1 / 3; margin-left: 0; justify-self: start; }
 .process-toolbar>.process-more { grid-column: 3; justify-self: end; }
 .process-toolbar:not(:has(.process-new)) { grid-template-columns: minmax(140px,1fr) minmax(0,1fr); }
 .process-toolbar:not(:has(.process-new))>.zoom-tools { grid-column: 1; }
 .process-toolbar:not(:has(.process-new))>.process-more { grid-column: 2; }
 .process-canvas.process-style-picker { height: auto; min-height: 0; padding: 16px; gap: 16px; }
 .process-style-options>button { min-height: 80px; }
 .process-canvas { height: clamp(360px,65svh,560px); }
 .landing-active .landing-course { display: block !important; font-size: 10px; letter-spacing: .08em; }
 #landing-page { min-height: 0; padding: 24px 20px 32px; gap: 24px; }
 .landing-copy { width: 100%; }
 .landing-lab { gap: 12px; margin-bottom: 20px; }
 .landing-lab>span { width: 36px; height: 36px; font-size: 18px; box-shadow: 2px 2px 0 var(--ink); }
 .landing-lab>strong { font-size: 18px; }
 #landing-title { font-size: clamp(40px,10.5vw,56px); line-height: 1.04; margin-bottom: 20px; }
 .landing-intro { font-size: 16px; line-height: 1.5; }
 .landing-intro p { margin-bottom: 16px; }
 .landing-enter { grid-template-columns: minmax(0,1fr) 76px; min-height: 88px; padding: 16px 0 16px 16px; gap: 4px; margin-top: 8px; }
 .landing-enter .envelope-label strong { font-size: 28px; line-height: 1.12; }
 .landing-enter>.envelope-lock { width: 76px; height: 90px; }
 .landing-links { display: grid; grid-template-columns: 1fr; margin-top: 24px; gap: 0; }
 .landing-links button { min-height: 44px; gap: 10px; font-size: 14px; }
 .landing-links svg { width: 20px; height: 20px; }
 .landing-carousel { max-width: 320px; margin: 0 auto; }
}
@media screen and (max-width: 360px) {
 .app-header .brand strong { max-width: 100px; }
 .header-actions .guide-entry { gap: 4px; }
 .header-actions .guide-entry .ui-icon { width: 16px; }
 .header-actions #project-menu { gap: 4px; }
 .landing-active .landing-course { display: none !important; }
}

/* The guide reuses the landing scenario at the scale of the paper dialog. */
#guide-dialog .guide-grid>.panel { border-bottom: 0; }
#guide-dialog .guide-hero { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; }
#guide-dialog .guide-hero>.landing-carousel { width: 100%; max-width: none; margin: 0; }
#guide-dialog .guide-hero .landing-scenes { max-height: none; }
@media (max-width: 700px) {
  #guide-dialog .guide-hero { grid-template-columns: minmax(0, 1fr); }
  #guide-dialog .guide-hero>.landing-carousel { max-width: 320px; margin-inline: auto; }
}

/* Layout selection shares the toolbar, freeing its former heading row for the floor. */
.warehouse-toolbar>.layout-tabs { flex: 0 0 auto; margin-left: auto; width: auto; }
.warehouse-toolbar>.layout-tabs button { min-height: 40px; padding-inline: 12px; white-space: nowrap; }
.warehouse-toolbar>.layout-tabs + .zoom-tools { margin-left: 0; }
@container (min-width: 701px) and (max-width: 940px) {
 .warehouse-toolbar .editing-tools .tool-label { display: none; }
 .warehouse-toolbar .editing-tools button { width: 40px; min-width: 40px; padding: 8px; }
 .warehouse-toolbar .editing-tools .divider { display: none; }
}
@media screen and (max-width: 600px) {
 .warehouse-toolbar>.layout-tabs { grid-column: 1 / -1; grid-row: 1; width: 100%; margin-left: 0; }
}

/* Family File menu: lab accent, ink frame, and project-wide actions. */
.header-actions #project-menu{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;padding:8px 12px;background:var(--relief);color:var(--ink);border:2px solid var(--ink);border-radius:2px;box-shadow:2px 2px 0 var(--ink);font:600 12px/1.3 Arial,Helvetica,sans-serif;cursor:pointer;list-style:none}
.header-actions #project-menu:hover{background:color-mix(in srgb,var(--relief) 82%,var(--paper))}
.header-actions #project-menu[aria-expanded="true"],.header-actions #project-menu:active{background:var(--relief);box-shadow:none;transform:translate(2px,2px)}
.header-actions #project-menu:focus-visible{outline:3px solid var(--focus);outline-offset:4px}
.header-actions #project-menu svg{width:16px;height:16px;flex:none;margin:0}
#project-formats{width:264px;max-width:calc(100vw - 32px);background:var(--paper);border:2px solid var(--ink);box-shadow:3px 3px 0 var(--ink);padding:4px}
#project-formats button{display:block;width:100%;min-height:44px;padding:10px 12px;text-align:left;background:transparent;border:0;border-radius:0;box-shadow:none;font-size:14px;font-weight:600;line-height:1.4}
#project-formats button:hover{background:var(--selected)}
#project-formats button span{display:block;margin-top:3px;font-size:12px;font-weight:400;color:var(--muted)}
#project-formats .reset-lab{color:#9c3028;border-top:1px solid var(--line);margin-top:4px}

.header-actions #project-menu[aria-expanded="true"] svg{transform:rotate(180deg)}

/* Direct image export shares the existing canvas toolbar controls. */
.warehouse-toolbar>#save-layout-image { flex: 0 0 auto; padding: 8px; min-width: 40px; background: var(--relief); color: var(--ink); border: 1px solid var(--ink); border-radius: 2px; box-shadow: none; }
.warehouse-toolbar>#save-layout-image:hover { background: #f5e2a0; }
.warehouse-toolbar>#save-layout-image .ui-icon { margin: 0; }
@media (max-width: 600px) {
 .floor-panel>.warehouse-toolbar { grid-template-columns: minmax(0,1fr) auto auto; }
}

/* Phase controls occupy their own thin row; diagram coordinates remain unchanged. */
.phase-header { position: sticky; top: 0; height: 44px; z-index: 9; background: var(--paper); border-bottom: 1px solid var(--ink); }
.phase-caption { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; justify-content: center; height: 100%; background: var(--paper); border-right: 1px solid var(--line); font-size: 12px; }
.phase-cell { position: absolute; top: 0; height: 100%; padding: 4px 16px; }
.phase-cell button, .phase-cell input { width: 100%; height: 100%; min-height: 0; margin: 0; padding: 4px; border: 0; border-radius: 0; background: transparent; color: var(--ink); text-align: center; font-size: 13px; font-weight: 700; }
.phase-cell button { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-cell button:hover, .phase-cell button[aria-pressed="true"] { background: var(--selected); }
.phase-cell input { background: var(--surface); outline: 1px solid var(--ink); font-size: 16px; }
/* Keep a generous invisible hit target around the small printed divider tab. */
.phase-divider { position: absolute; top: 0; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; width: 24px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); cursor: col-resize; touch-action: none; z-index: 2; }
.phase-divider::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--ink); opacity: .45; pointer-events: none; }
.phase-divider svg { position: relative; display: block; flex: none; width: 18px; height: 28px; overflow: visible; fill: var(--surface); stroke: currentColor; stroke-width: 1; pointer-events: none; }
.phase-divider svg path { fill: none; stroke-width: 1.5; }
.phase-divider:hover, .phase-divider:active { background: transparent; }
.phase-divider:hover svg, .phase-divider:focus-visible svg { fill: var(--selected); }
.phase-divider:active svg { fill: var(--relief); }
.phase-divider:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.phase-add { position: absolute; top: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--ink); white-space: nowrap; isolation: isolate; }
.phase-add::before { content: ''; position: absolute; inset: 6px 0; z-index: -1; border: 1px solid transparent; border-radius: var(--radius); pointer-events: none; }
.phase-add .ui-icon { display: block; margin: 0; }
.phase-add:hover:not(:disabled), .phase-add:active:not(:disabled) { background: transparent; }
.phase-add:hover:not(:disabled)::before { background: var(--selected); border-color: var(--line); }
.phase-add:active:not(:disabled)::before { background: var(--relief); border-color: var(--ink); }
.phase-add:focus-visible { outline: none; }
.phase-add:focus-visible::before { border: 2px solid var(--ink); background: var(--selected); }
.phase-add:disabled, .phase-add:disabled:hover { background: transparent; color: var(--muted); opacity: .6; }
.phase-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--ink); opacity: .45; pointer-events: none; }
@media (pointer: coarse) { .phase-divider { width: 44px; } .phase-cell { padding-inline: 24px; } .phase-add { margin-left: 8px; } }
