/* ============================================
   QR FLOW EDITOR — node canvas at /qr
   ============================================ */

.qrf-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
/* the canvas slides in from the right (VE-style takeover); the floating
   chrome fades in after it — the root itself must never carry a transform,
   or its fixed-position children lose their viewport anchoring */
.qrf-viewport {
  animation: qrf-slide-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes qrf-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.qrf-close,
#qrfFab {
  animation: qrf-chrome-in 0.3s ease 0.25s both;
}
@keyframes qrf-chrome-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* exit: chrome drops first, the canvas slides back off to the right */
.qrf-root.is-leaving .qrf-viewport {
  animation: qrf-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.qrf-root.is-leaving .qrf-close,
.qrf-root.is-leaving #qrfFab {
  animation: qrf-chrome-out 0.15s ease both;
}
@keyframes qrf-slide-out {
  to { transform: translateX(100%); }
}
@keyframes qrf-chrome-out {
  to { opacity: 0; }
}

/* ── Canvas ── */

.qrf-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Clip the dotted canvas to the framed corners (matches the visual editor). */
  border-radius: var(--radius-lg);
  cursor: default;
  background-color: var(--bg-color);
  /* dot brightness driven by --qrf-dot-alpha (zoom-linked, set by JS) */
  background-image: radial-gradient(circle,
    color-mix(in srgb, var(--border-color) calc(var(--qrf-dot-alpha, 1) * 100%), transparent) 1px,
    transparent 1px);
  background-size: 24px 24px;
  touch-action: none;
}

.qrf-viewport.is-panning { cursor: grabbing; }
.qrf-viewport.is-pan-ready { cursor: grab; }
.qrf-root.is-connecting .qrf-viewport { cursor: crosshair; }

.qrf-marquee {
  position: absolute;
  z-index: 50;
  border: 1px solid var(--text-muted);
  background: var(--hover-bg);
  border-radius: 4px;
  pointer-events: none;
}

.qrf-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.qrf-edges {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}

/* tall close pill, vertically centred on the canvas's left edge */
.qrf-close {
  position: fixed;
  top: 50%;
  left: calc(var(--content-left, var(--sidebar-full, 72px)) + 10px);
  transform: translateY(-50%);
  z-index: 250;
  width: 26px;
  height: 88px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: width 0.15s ease, background-color 0.15s ease;
}
.qrf-close:hover {
  width: 30px;
  background: var(--text-color);
  color: var(--bg-color);
}

.qrf-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  pointer-events: none;
}
.qrf-empty i { font-size: 2rem; opacity: 0.5; }
.qrf-empty p { margin: 0; font-size: var(--text-base); }

/* ── Edges ── */

.qrf-edge {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.75;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke 0.15s ease;
}
.qrf-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: pointer;
}
.qrf-edge.is-selected { stroke: var(--text-color); stroke-width: 2.5; }
.qrf-edge--temp { stroke-dasharray: 6 5; pointer-events: none; }
.qrf-edge.is-lit {
  stroke: var(--text-color);
  stroke-width: 2.75;
}

/* ── Nodes ── */

.qrf-node {
  position: absolute;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.qrf-node:active { cursor: grabbing; }
.qrf-node:hover { border-color: var(--text-muted); }
.qrf-node.is-selected {
  border-color: var(--text-color);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
}
.qrf-node.is-lit {
  border-color: var(--text-color);
  box-shadow: 0 0 0 3px var(--hover-bg), 0 4px 18px rgba(0, 0, 0, 0.14);
}
.qrf-node.is-destination {
  animation: qrf-pulse 0.9s ease 2;
}

@keyframes qrf-pulse {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.04); }
}

.qrf-shake { animation: qrf-shake 0.35s ease; }
@keyframes qrf-shake {
  0%, 100% { margin-left: 0; }
  25% { margin-left: -6px; }
  75% { margin-left: 6px; }
}

/* QR node */
.qrf-node--qr { width: 148px; }
.qrf-node--qr .qrf-node-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.qrf-qr-img {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qrf-qr-img img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.qrf-qr-img--empty { background: var(--bg-tertiary); color: var(--text-muted); font-size: 2rem; }
/* Dark scheme: drop the white plate and invert the QR so modules read white.
   screen blend turns the (now black) inverted background transparent. */
[data-theme="dark"] .qrf-qr-img:not(.qrf-qr-img--empty) { background: transparent; }
[data-theme="dark"] .qrf-qr-img img { filter: invert(1); mix-blend-mode: screen; }
.qrf-qr-code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-color);
}
.qrf-qr-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.qrf-scan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
}
.qrf-qr-download { color: var(--text-muted); }
.qrf-qr-download:hover { color: var(--text-color); }

/* Page node — portrait card */
.qrf-node--page { width: 140px; }
.qrf-node--page .qrf-node-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.qrf-page-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}
.qrf-page-art img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.qrf-page-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qrf-page-slug {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Condition node — fields edit inline; the right column carries True/False */
.qrf-node--condition { width: 268px; }
.qrf-out-text {
  position: absolute;
  left: calc(100% - 46px); /* 26px from the fields, snug to the edge */
  transform: translateY(-50%);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}
.qrf-out-text--true { top: 32%; }
.qrf-out-text--false { top: 68%; }
.qrf-node--condition .qrf-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 6px 26px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.qrf-node-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 72px 16px 26px; /* right column reserved for True/False */
}
.qrf-node-fields .qrf-field { gap: 4px; }
.qrf-node-fields .qrf-field-input {
  height: 32px;
  line-height: 30px; /* native fallback: centre the closed select's text */
  padding: 0 10px;
  border-radius: 8px;
  font-size: var(--text-sm);
  cursor: pointer;
}
.qrf-node-fields input.qrf-field-input { cursor: text; }

/* Ports */
.qrf-port {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-color);
  border: 2px solid var(--text-muted);
  cursor: crosshair;
  z-index: 2;
}
.qrf-port:hover, .qrf-port.is-target {
  border-color: var(--text-color);
  transform: scale(1.25);
}
.qrf-port--in { left: -7px; top: 50%; margin-top: -7px; }
.qrf-port--in.is-from-true {
  background: var(--text-color);
  border-color: var(--text-color);
}
.qrf-port--out { right: -7px; top: 50%; margin-top: -7px; }

/* boolean outputs sit at 1/3 and 2/3 height with labels */
.qrf-node--condition .qrf-port--true { top: 32%; }
.qrf-node--condition .qrf-port--false { top: 68%; }
/* monochrome ports, always visible.
   TRUE reads as a solid dot, FALSE as a hollow ring — shape, not colour. */
.qrf-port--out {
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.qrf-port--true {
  background: var(--text-color);
  border-color: var(--text-color);
}
/* sim hit: glow ring + scale, preserving the solid/hollow shape coding */
.qrf-port--out.is-lit {
  opacity: 1;
  transform: scale(1.3);
  border-color: var(--text-color);
  box-shadow: 0 0 0 3px var(--hover-bg);
}


/* ── Groups ("flows") ── */

.qrf-group {
  position: absolute;
  border: 1.5px dashed var(--border-color);
  background: var(--hover-bg);
  border-radius: 16px;
  pointer-events: none; /* canvas interactions pass through; only the head is interactive */
}
.qrf-group.is-locked {
  border-style: solid;
  border-color: var(--text-muted);
}

.qrf-group-head {
  position: absolute;
  top: -34px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  pointer-events: auto;
  cursor: grab;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.qrf-group-head:active { cursor: grabbing; }
.qrf-group.is-locked .qrf-group-head { border-color: var(--text-muted); }

.qrf-group-title {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-color);
  outline: none;
  min-width: 24px;
}
.qrf-group-title[contenteditable="true"] {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.qrf-group-lock {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
}
.qrf-group-lock:hover { background: var(--hover-bg); color: var(--text-color); }
.qrf-group.is-locked .qrf-group-lock { color: var(--text-color); }

/* ── Library arc (pages + QR codes fanned around the FAB) ── */

.qrf-arc {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.qrf-arc-item {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 76px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: grab;
  pointer-events: auto;
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.2s ease;
}
.qrf-arc.is-open .qrf-arc-item {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.qrf-arc-item:hover .qrf-arc-thumb {
  border-color: var(--text-color);
  transform: scale(1.12);
}

.qrf-arc-thumb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.15rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.qrf-arc-thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.qrf-arc-thumb--qr { background: #fff; }
.qrf-arc-thumb--qr img { object-fit: contain; padding: 5px; }
[data-theme="dark"] .qrf-arc-thumb--qr { background: transparent; }
[data-theme="dark"] .qrf-arc-thumb--qr img { filter: invert(1); mix-blend-mode: screen; }
.qrf-arc-thumb--icon { background: var(--bg-color); }
.qrf-arc-item--newqr .qrf-arc-thumb { border-style: dashed; }

.qrf-arc-label {
  max-width: 84px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-color);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qrf-arc-ghost {
  position: fixed;
  z-index: 1000;
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) !important;
  pointer-events: none !important;
}

/* ── Context menu ── */

.qrf-menu {
  position: fixed;
  z-index: 500;
  min-width: 200px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  padding: 6px;
}
.qrf-menu-section {
  padding: 8px 12px 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.qrf-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: var(--text-sm);
  color: var(--text-color);
  cursor: pointer;
  text-align: left;
}
.qrf-menu-item:hover { background: var(--hover-bg); }
.qrf-menu-item i { color: var(--text-muted); width: 16px; text-align: center; }
.qrf-menu-item--danger { color: #c25555; }
.qrf-menu-item--danger i { color: #c25555; }
.qrf-menu-item--danger:hover { background: rgba(194, 85, 85, 0.08); }

/* ── Node popover / sim panel shared ── */

.qrf-popover, .qrf-sim {
  position: fixed;
  z-index: 400;
  width: 280px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  padding: 14px;
}

.qrf-pop-head, .qrf-sim-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 12px;
}
.qrf-pop-head i, .qrf-sim-head i { color: var(--text-muted); }
.qrf-pop-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 0.8rem;
}
.qrf-pop-close:hover { background: var(--hover-bg); color: var(--text-color); }

.qrf-pop-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.qrf-pop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--text-sm);
}
.qrf-pop-key { color: var(--text-muted); flex-shrink: 0; }
.qrf-pop-val {
  color: var(--text-color);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qrf-mono { font-family: var(--font-mono); font-size: 0.95em; }

.qrf-pop-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.qrf-pop-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.qrf-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.qrf-pop-btn:hover { background: var(--hover-bg); }
.qrf-pop-btn--danger { color: #c25555; border-color: rgba(194, 85, 85, 0.4); }
.qrf-pop-btn--danger:hover { background: rgba(194, 85, 85, 0.08); }

.qrf-pop-fields, .qrf-sim-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.qrf-field { display: flex; flex-direction: column; gap: 4px; }
.qrf-field-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}
.qrf-field-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: var(--text-sm);
  outline: none;
}
.qrf-field-input:focus { border-color: var(--text-muted); }

/* number fields: native spinners hidden, house steppers instead */
.qrf-field-input[type="number"]::-webkit-inner-spin-button,
.qrf-field-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qrf-field-input[type="number"] {
  -moz-appearance: textfield;
}

/* date fields: the native calendar icon is black — invert it so it's visible on
   the dark node background */
.qrf-field-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.6;
  cursor: pointer;
}
.qrf-field-input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
.qrf-num {
  position: relative;
  display: block;
}
.qrf-num .qrf-field-input {
  width: 100%;
  padding-right: 32px;
}
.qrf-num-btns {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
}
.qrf-num-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 20px;
  height: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
}
.qrf-num-btn:hover { color: var(--text-color); background: var(--hover-bg); }
.qrf-num-btn:disabled { opacity: 0.4; cursor: default; }

.qrf-pop-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

/* ── Sim panel ── */

.qrf-sim {
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
}
.qrf-sim-run {
  width: 100%;
  border: none;
  background: var(--text-color);
  color: var(--bg-color);
  padding: 9px;
  border-radius: 9px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.qrf-sim-run:hover { opacity: 0.85; }
.qrf-sim-result {
  position: relative;
  isolation: isolate;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text-color);
  background: var(--bg-color);
  border-radius: 10px;
  padding: 10px 12px;
  animation: qrf-sim-pop 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes qrf-sim-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.qrf-sim-ico { flex-shrink: 0; font-size: 14px; line-height: 1; }
.qrf-sim-msg { flex-shrink: 0; }
.qrf-sim-url {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
.qrf-sim-result.is-success .qrf-sim-url { text-align: left; }
.qrf-sim-open {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Fallback: muted, no glow */
.qrf-sim-result.is-fallback {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.qrf-sim-result.is-fallback .qrf-sim-ico { color: var(--text-muted); }

/* Success: the rotating gradient ring from the toast (.ve-toast) */
.qrf-sim-result.is-success .qrf-sim-ico { color: #4ade80; }
.qrf-sim-result.is-success::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: 11px;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    #48dbfb, #4ade80, #48dbfb, #54a0ff, #ff9ff3, #54a0ff, #48dbfb
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1.5px;
  z-index: -1;
  pointer-events: none;
  animation: toast-glow-rotate 3s linear infinite;
}

/* ── Status (inside FAB) ── */

.qrf-status {
  padding: 0 12px 0 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Toast ── */

.qrf-toast {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translate(-50%, 8px);
  background: var(--text-color);
  color: var(--bg-color);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: var(--text-sm);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.qrf-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================================
   MOBILE VERTICAL VIEW (≤900px)
   Auto-laid-out top-to-bottom flow; the canvas + its chrome are hidden.
   ============================================ */
.qrf-mobile { display: none; }

@media (max-width: 900px) {
  .qrf-viewport { display: none; }
  #qrfFab,
  .qrf-arc,
  .qrf-menu,
  .qrf-popover,
  .qrf-sim { display: none !important; }

  /* back pill → top-left round button, clear of the list */
  .qrf-close {
    top: 12px;
    left: 12px;
    transform: none;
    width: 40px;
    height: 40px;
    z-index: 1250;
  }

  .qrf-mobile {
    display: block;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-color);
    padding: 64px 16px 110px;
  }
  .qrf-m-flow { max-width: 520px; margin: 0 auto; }
  .qrf-m-blank {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    line-height: 1.6;
  }

  .qrf-m-node {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
  }
  .qrf-m-node:active { background: var(--bg-tertiary); }
  .qrf-m-node--qr { border-color: var(--text-color); }
  .qrf-m-node-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    font-size: 18px;
  }
  .qrf-m-node-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .qrf-m-node-title { font-size: 14px; font-weight: 600; }
  .qrf-m-node-summary {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .qrf-m-node-go { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }

  /* vertical connector between sequential nodes */
  .qrf-m-link { width: 2px; height: 18px; background: var(--border-color); margin: 0 auto; }

  /* condition branches: indented blocks with a coloured spine */
  .qrf-m-branches { margin-top: 10px; display: flex; flex-direction: column; gap: 14px; }
  .qrf-m-branch {
    margin-left: 19px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
  }
  .qrf-m-branch--yes { border-left-color: #4ade80; }
  .qrf-m-branch--no { border-left-color: #fb7185; }
  .qrf-m-branch-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 8px;
  }
  .qrf-m-branch--yes .qrf-m-branch-label { color: #4ade80; }
  .qrf-m-branch--no .qrf-m-branch-label { color: #fb7185; }
  .qrf-m-end,
  .qrf-m-loop { font-size: 12px; color: var(--text-muted); padding: 6px 0; }
}

/* ── Mobile node editor modal (opened only from the ≤900 view) ── */
.qrf-m-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: qrf-m-fade 0.15s ease;
}
@keyframes qrf-m-fade { from { opacity: 0; } to { opacity: 1; } }
.qrf-m-modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-color);
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px 18px 28px;
}
@media (min-width: 481px) {
  .qrf-m-modal-overlay { align-items: center; }
  .qrf-m-modal { border-radius: 20px; }
}
.qrf-m-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 18px;
}
.qrf-m-modal-head i { font-size: 18px; }
.qrf-m-modal-close {
  margin-left: auto;
  border: none;
  background: var(--bg-tertiary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qrf-m-rows { display: flex; flex-direction: column; gap: 12px; }
.qrf-m-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.qrf-m-row span:first-child { color: var(--text-muted); flex-shrink: 0; }
.qrf-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.qrf-m-act {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.qrf-m-fields { display: flex; flex-direction: column; gap: 16px; }
