/* Automation lab. Layout only; colours, type and radii come from the approved theme tokens. */
.lab-banner { margin: 0 0 18px; }
.lab-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.lab-controls strong { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.lab-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-buttons select { width: auto; min-width: 210px; }
.lab-inline-label { margin: 0; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.lab-stack { display: grid; gap: 18px; min-width: 0; }
.lab-stack > .panel, .lab-grid > .panel { min-width: 0; }
.lab-node { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 14px; margin: 12px 0 0; background: var(--surface); min-width: 0; }
.lab-node legend { padding: 0 6px; font-size: 12px; color: var(--ink); }
.lab-node legend span { color: var(--muted); margin-left: 4px; }
.lab-node.lab-end { background: var(--surface-alt); }
.lab-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.lab-fields label { margin-top: 10px; }
.lab-wide { grid-column: 1 / -1; }
.lab-json { margin-top: 16px; }
.lab-json summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.lab-json textarea { font-size: 12px; font-variant-numeric: tabular-nums; }
.lab-list { display: grid; gap: 8px; margin-top: 12px; }
.lab-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.lab-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.lab-row p { margin: 4px 0 0; }
button.lab-row { cursor: pointer; font: inherit; }
button.lab-row:hover, .lab-row.selected { border-color: var(--accent-line); background: var(--accent-soft); }
button.lab-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-trace { margin-bottom: 18px; overflow-wrap: anywhere; }
.lab-trace h4 { margin: 20px 0 6px; font-size: 13px; color: var(--ink); }
.lab-trace-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.lab-trace-head h3 { margin: 4px 0; }
.lab-steps small { color: var(--muted); }
.lab-accounts { border: 0; padding: 0; margin: 12px 0 0; }
.lab-accounts legend { font-size: 10px; color: var(--ink); margin-bottom: 4px; }
.lab-review .lab-row { flex-wrap: wrap; }
@media (max-width: 1190px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 650px) {
  .lab-fields { grid-template-columns: minmax(0, 1fr); }
  .lab-controls { align-items: stretch; }
  .lab-buttons select { min-width: 0; width: 100%; }
  .lab-row { flex-direction: column; }
}

/* Workflow canvas. Positions are applied by script (no inline styles, so the CSP stays strict). */
.cv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 6px; }
.cv-toolbar select { width: auto; min-width: 230px; }
.cv-status { min-height: 1.2em; margin: 4px 0; font-size: 13px; color: var(--accent); }
.cv-validation .result-banner { margin: 8px 0 12px; }
.cv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.cv-wrap { position: relative; height: 600px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; overscroll-behavior: contain;
  background-color: var(--surface-alt); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 24px 24px; }
.cv-wrap:focus-within { border-color: var(--line-strong); }
.cv-stage { position: relative; }
.cv-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cv-edges marker path { fill: var(--dim); }
.cv-edge { fill: none; stroke: var(--dim); stroke-width: 1.5; opacity: .85; }
.cv-edge.related { stroke: var(--accent); stroke-width: 2.5; }
/* Node type colours: trigger coral, condition blue, message rose, guide jade, wait amber, end neutral. A full tinted
   border and a kind pill carry the type; there are no coloured side stripes. */
.cv-node { --kind: var(--muted); --kind-soft: var(--surface-alt); --kind-line: var(--line);
  position: absolute; width: 210px; border: 1px solid var(--kind-line); border-radius: 14px; background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow-color), 0 6px 16px var(--shadow-color); transition: border-color .15s ease-out, box-shadow .15s ease-out; }
.cv-node.cv-trigger { --kind: var(--accent); --kind-soft: var(--accent-soft); --kind-line: var(--accent-line); }
.cv-node.cv-condition { --kind: var(--blue); --kind-soft: var(--blue-soft); --kind-line: var(--blue-line); }
.cv-node.cv-action { --kind: var(--rose); --kind-soft: var(--rose-soft); --kind-line: var(--rose-line); }
.cv-node.cv-act-send_guide { --kind: var(--green); --kind-soft: var(--green-soft); --kind-line: var(--green-line); }
.cv-node.cv-wait { --kind: var(--amber); --kind-soft: var(--amber-soft); --kind-line: var(--amber-line); }
.cv-node.cv-end { background: var(--surface-alt); box-shadow: none; }
.cv-node:hover { border-color: var(--kind); }
.cv-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-line), 0 10px 24px var(--shadow-color); }
.cv-node.has-error { border-color: var(--red); }
.cv-node.has-error small { color: var(--red); font-weight: 600; }
.cv-node.cv-target { outline: 2px dashed var(--accent); outline-offset: 3px; }
.cv-node.dragging { opacity: .9; z-index: 2; box-shadow: 0 16px 32px var(--shadow-color); }
.cv-node-main { display: block; width: 100%; padding: 9px 12px 5px; border: 0; background: none; color: var(--ink); text-align: left; font: inherit; cursor: grab; touch-action: none; border-radius: 14px 14px 0 0; }
.cv-node-main:active { cursor: grabbing; }
.cv-node-main:focus-visible, .cv-port:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cv-node-main strong { display: block; font-size: 13.5px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; margin-top: 5px; }
.cv-node-main small { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.cv-kind { display: inline-block; max-width: 100%; padding: 3px 8px; border-radius: 999px; background: var(--kind-soft); color: var(--kind);
  font-size: 11px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.cv-ports { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 9px; }
.cv-port { font: inherit; font-size: 11px; line-height: 1; padding: 6px 9px; min-height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.cv-port:hover { border-color: var(--line-strong); background: var(--surface-alt); }
.cv-port.cv-open { border-style: dashed; border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber); }
.cv-port.active { background: var(--accent); border-color: var(--accent); color: var(--primary-text); }
.cv-panel { border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 16px; background: var(--surface); max-height: 600px; overflow: auto; }
.cv-panel h3 { margin: 14px 0 2px; font-size: 16px; overflow-wrap: anywhere; }
.cv-panel label { margin-top: 10px; }
.cv-problems { margin: 12px 0 0; padding: 10px 12px 10px 28px; border: 1px solid var(--red-line); border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 13px; line-height: 1.5; }
@media (max-width: 1190px) { .cv-layout { grid-template-columns: minmax(0, 1fr); } .cv-panel { max-height: none; } }
@media (max-width: 650px) {
  .cv-wrap { height: 460px; }
  .cv-toolbar select { min-width: 0; width: 100%; }
  .cv-toolbar .btn { flex: 1 1 auto; }
}

/* Messages, buttons and the flow preview. */
.cv-text { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.cv-chip { font-size: 10.5px; padding: 2px 7px; border-radius: 8px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.cv-chip.url { border-color: var(--line); background: var(--surface-alt); color: var(--ink); }
.cv-buttons { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 12px; margin: 14px 0 0; min-width: 0; background: var(--bg); }
.cv-buttons legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; color: var(--ink); }
.cv-button-row { border-bottom: 1px dashed var(--line); padding-bottom: 10px; margin-bottom: 6px; }
.cv-button-row .btn { margin-top: 8px; }
.cv-tabs { display: flex; margin-top: 12px; }
.cv-tabs .btn { flex: 1; }
.cv-preview h3 { margin-top: 6px; }
.cv-preview-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cv-preview-note { font-size: 13px; padding: 9px 12px; border-radius: 12px; background: var(--blue-soft); border: 1px solid var(--blue-line); color: var(--ink); }
/* DM preview: an incoming message bubble whose buttons sit inside it, as the recipient would see them. */
.cv-dm { max-width: 272px; margin: 12px 0; padding: 12px 12px 8px; border-radius: 20px 20px 20px 6px; background: var(--surface-alt); border: 1px solid var(--line); }
.cv-dm p { margin: 0 2px 10px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cv-dm-button { display: block; width: 100%; margin-top: 6px; min-height: 40px; padding: 9px; font: inherit; font-size: 13.5px; font-weight: 600; text-align: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); cursor: pointer; }
.cv-dm-button:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.cv-dm-button.url { color: var(--ink); font-weight: 550; }
.cv-dm-button:disabled { opacity: .55; cursor: not-allowed; }
.cv-dm-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cv-count.over { color: var(--red); font-weight: 600; }

/* Automations area (U2) and canvas editor (U3), 02 Nov 2026. */
.heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.lab-tabs button { white-space: nowrap; }
.tab-intro { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.editor-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.editor-bar select { width: auto; min-width: 280px; max-width: 100%; }
.editor-rev { font-size: 12.5px; color: var(--muted); }
.cv-toolbar { position: sticky; top: 0; z-index: 6; margin: 0; padding: 8px 0; background: var(--bg); gap: 6px 10px; }
.cv-group { display: flex; align-items: center; gap: 4px; }
.cv-toolbar .btn.cv-icon { min-width: 40px; padding: 8px 10px; font-size: 16px; line-height: 1; }
.cv-toolbar .btn.cv-zoom { min-width: 64px; padding: 8px 10px; font-variant-numeric: tabular-nums; }
.cv-toolbar select { min-width: 200px; }
.cv-spacer { flex: 1 1 auto; }
.cv-board { position: relative; min-width: 0; }
.cv-wrap { height: max(480px, calc(100vh - 300px)); }
.cv-panel { max-height: max(480px, calc(100vh - 300px)); }
.cv-sizer { position: relative; }
.cv-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-kind .icon { width: 12px; height: 12px; margin: -2px 4px 0 0; vertical-align: middle; stroke-width: 2; }
.cv-minimap { position: absolute; right: 12px; bottom: 12px; width: 168px; height: 104px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 4px 12px var(--shadow-color); cursor: pointer; }
.cv-minimap svg { display: block; width: 100%; height: 100%; }
.mm-node { fill: var(--line-strong); }
.mm-node.cv-trigger { fill: var(--accent-line); }
.mm-node.cv-condition { fill: var(--blue-line); }
.mm-node.cv-action { fill: var(--rose-line); }
.mm-node.cv-act-send_guide { fill: var(--green-line); }
.mm-node.cv-wait { fill: var(--amber-line); }
.mm-node.selected { fill: var(--accent); }
.mm-view { fill: var(--accent); fill-opacity: .08; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@media (max-width: 1190px) { .cv-panel { max-height: none; } .cv-wrap { height: 560px; } }
@media (max-width: 650px) {
  .cv-minimap { display: none; }
  .cv-wrap { height: 460px; }
  .cv-toolbar { position: static; }
  .editor-bar select, .cv-toolbar select { min-width: 0; width: 100%; }
}
.cv-toolbar select { min-width: 0; width: 210px; }
.cv-status:empty { min-height: 0; margin: 0; }
.cv-validation:empty { display: none; }
.cv-kind { font-size: 10.5px; padding: 3px 7px; }
@media (max-width: 650px) { .cv-toolbar select { width: 100%; } }
@media (max-width: 650px) { .heading-actions { justify-content: flex-start; } }
/* Keep the editor toolbar on one row at 1440 px, including the unsaved state. */
.cv-toolbar { gap: 6px 8px; }
.cv-toolbar select { width: 180px; }
.cv-toolbar .btn.cv-zoom { min-width: 58px; }
@media (max-width: 650px) { .cv-toolbar select { width: 100%; } }
.recovered-note { margin-bottom: 10px; }
