/* The screens ported from the earlier front (resource forms, workflow editor): its own rules,
   scoped to .cl so nothing else in this app changes, coloured with this app's tokens. Made from
   web/public/style.css; dialogs are .cl-modal / .cl-drawer on a .cl-overlay. */
.cl { --ink: var(--fg); --hover: var(--raised); --danger: var(--bad); --radius: var(--r); color: var(--fg); font: 13.5px/1.45 var(--font); }
.cl-overlay { font: 13.5px/1.45 var(--font); }
.cl .mono, .cl .wf-node-name, .cl .json-tree, .cl .code-editor .code-paint, .cl .code-editor .code-input { font-family: var(--mono); }
.cl h1 { font-size: 20px; margin: 0; } .cl h2 { font-size: 15px; margin: 0 0 10px; }
/* code and result colours: dark first, light with the light theme */
.cl .code-editor { --tok-comment: #7f8899; --tok-string: #8fd4a0; --tok-number: #f0a868; --tok-keyword: #c79bf2; --tok-literal: #f0a868; --tok-call: #8ab4ff; --tok-prop: #7fd6e0; --tok-template: #f08a82; }
.cl .j-key { color: #7fd6e0; } .cl .j-string { color: #8fd4a0; } .cl .j-number { color: #f0a868; } .cl .j-boolean, .cl .j-null { color: #c79bf2; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .cl .code-editor { --tok-comment: #7a8394; --tok-string: #1a7f4b; --tok-number: #b35c00; --tok-keyword: #8a3fc9; --tok-literal: #b35c00; --tok-call: #2157c4; --tok-prop: #0c7c8c; --tok-template: #b3261e; }
  :root:not([data-theme="dark"]) .cl .j-key { color: #0c7c8c; } :root:not([data-theme="dark"]) .cl .j-string { color: #1a7f4b; } :root:not([data-theme="dark"]) .cl .j-number { color: #b35c00; } :root:not([data-theme="dark"]) .cl .j-boolean, :root:not([data-theme="dark"]) .cl .j-null { color: #8a3fc9; }
}
:root[data-theme="light"] .cl .code-editor { --tok-comment: #7a8394; --tok-string: #1a7f4b; --tok-number: #b35c00; --tok-keyword: #8a3fc9; --tok-literal: #b35c00; --tok-call: #2157c4; --tok-prop: #0c7c8c; --tok-template: #b3261e; }
:root[data-theme="light"] .cl .j-key { color: #0c7c8c; } :root[data-theme="light"] .cl .j-string { color: #1a7f4b; } :root[data-theme="light"] .cl .j-number { color: #b35c00; } :root[data-theme="light"] .cl .j-boolean, :root[data-theme="light"] .cl .j-null { color: #8a3fc9; }

.cl td.wrap { white-space: normal; max-width: 420px; }
.cl .ok { color: #2e9e5b; }
.cl .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }


.cl .wf-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.cl .wf-top .spacer { flex: 1; }
.cl .wf-editor { flex: 1; display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.cl .wf-canvas { overflow: auto; background-color: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.cl .wf-surface { position: relative; min-width: 100%; min-height: 100%; }
.cl .wf-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cl .wf-edge { fill: none; stroke: var(--muted); stroke-width: 2; pointer-events: stroke; cursor: pointer; }
.cl .wf-edge:hover, .cl .wf-edge.selected { stroke: var(--accent); stroke-width: 3; }
.cl .wf-edge.temp { stroke: var(--accent); stroke-dasharray: 5 4; pointer-events: none; }
.cl .wf-node { position: absolute; width: 230px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px; padding: 9px 12px 10px; cursor: grab; user-select: none; touch-action: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.cl .wf-node:active { cursor: grabbing; }
.cl .wf-node.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cl .wf-node.start { border-left-color: #2e9e5b; }
.cl .wf-node.resource { border-left-color: #2a78d6; }
.cl .wf-node.code { border-left-color: #8a5cd6; }
.cl .wf-node.response { border-left-color: #c98500; }
.cl .wf-node.loop { border-left-color: #1baf7a; }
.cl .wf-port.out.err { top: 50px; right: -9px; width: 16px; height: 16px; font-size: 10px; font-weight: 700; border-color: var(--line); color: var(--muted); opacity: 0; transition: opacity 0.1s; }
.cl .wf-node:hover .wf-port.out.err, .cl .wf-port.out.err.used { opacity: 1; }
.cl .wf-port.out.err:hover, .cl .wf-port.out.err.used { border-color: #c0392b; color: #c0392b; }
.cl .wf-edge.err { stroke: #c0392b; stroke-dasharray: 5 4; }
.cl .run-list { display: grid; gap: 6px; }
.cl .run-row { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; cursor: pointer; }
.cl .run-row:hover, .cl .run-row.active { border-color: var(--accent); }
.cl .run-step { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--panel); }
.cl .run-step > summary { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none; }
.cl .run-step > summary::-webkit-details-marker { display: none; }
.cl .run-step > summary::before { content: "▸"; color: var(--muted); }
.cl .run-step[open] > summary::before { content: "▾"; }
.cl .run-step > summary .spacer { flex: 1; }
.cl .run-step-body { padding: 0 10px 10px; display: grid; gap: 6px; }
.cl .wf-node.branch { border-left-color: #d6457a; }
.cl .wf-node.workflow { border-left-color: #3a9db5; }
.cl .wf-ways { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 6px; }
.cl .wf-way { position: relative; display: flex; gap: 6px; align-items: center; height: 24px; padding: 0 14px 0 6px; font-size: 12px; background: var(--bg); border-radius: 5px; }
.cl .wf-way .mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.cl .wf-way { min-width: 0; }
.cl .wf-node-name { white-space: nowrap; }

.cl .wf-grip { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: ew-resize; border-radius: 0 8px 8px 0; }
.cl .wf-grip:hover, .cl .wf-node.sizing .wf-grip { background: color-mix(in srgb, var(--accent) 35%, transparent); }
body.wf-sizing { cursor: ew-resize; user-select: none; }
.cl .wf-way-kind { color: var(--muted); flex: none; }
.cl .wf-way.taken { box-shadow: inset 0 0 0 1px #2e9e5b; background: color-mix(in srgb, #2e9e5b 16%, var(--bg)); }
.cl .wf-way.taken .wf-way-kind { color: #2e9e5b; font-weight: 600; }
.cl .wf-way.taken .wf-port.out { border-color: #2e9e5b; color: #2e9e5b; }

.cl .wf-edge.taken { stroke: #2e9e5b; stroke-width: 2.5; }
.cl .wf-edge.taken.selected, .cl .wf-edge.taken:hover { stroke: var(--accent); }
.cl .wf-way .wf-port.out { top: 2px; right: -23px; }
.cl .wf-title { border: 0; background: none; padding: 2px 4px; font: inherit; cursor: pointer; border-radius: 5px; }
.cl .wf-title:hover { background: var(--bg); }
.cl .wf-desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl .import-pick { display: grid; grid-template-columns: 1fr 220px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.cl .import-pick .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.cl .wf-node-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cl .wf-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl .wf-node-name { font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.cl .wf-node-sum { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl .wf-status { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.cl .wf-status.ok { background: #2e9e5b; }
.cl .wf-status.failed { background: #c0392b; }
.cl .wf-status.skipped { background: #8a93a5; }
.cl .wf-status.running { background: #2f5fd0; animation: wf-pulse 1s ease-in-out infinite; }
.cl .wf-node:has(.wf-status.running) { border-color: #2f5fd0; box-shadow: 0 0 0 2px color-mix(in srgb, #2f5fd0 35%, transparent); }
.cl .run-step.running { border-color: #2f5fd0; }
@keyframes wf-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .cl .wf-status.running { animation: none; } }
.cl .wf-port { position: absolute; top: 24px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); border: 2px solid var(--muted); display: grid; place-items: center; font-size: 13px; line-height: 1; color: var(--muted); }
.cl .wf-port.in { left: -13px; width: 12px; height: 12px; top: 28px; }
.cl .wf-port.out { right: -11px; cursor: crosshair; }
.cl .wf-port.out:hover { border-color: var(--accent); color: var(--accent); }
.cl .wf-menu { position: fixed; z-index: 30; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.cl .wf-menu button { border: 0; text-align: left; }
.cl .wf-inspector { border-left: 1px solid var(--line); background: var(--panel); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cl .wf-inspector .field label { margin-bottom: 4px; }
.cl .wf-inspector .hint { font-size: 12px; margin-top: 4px; }
.cl .wf-more summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.cl .wf-more .field, .cl .wf-more .check-row { margin-bottom: 10px; }

.cl .wf-editor { grid-template-columns: var(--wf-side, 420px) 6px 1fr; }
.cl .wf-resize { cursor: col-resize; background: var(--line); }
.cl .wf-resize:hover, body.resizing .wf-resize { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
.cl .wf-inspector { border-left: 0; min-width: 0; }


.cl .code-editor { position: relative; resize: vertical; overflow: hidden; min-height: 90px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); --tok-comment: #7a8394; --tok-string: #1a7f4b; --tok-number: #b35c00; --tok-keyword: #8a3fc9; --tok-literal: #b35c00; --tok-call: #2157c4; --tok-prop: #0c7c8c; --tok-template: #b3261e; }
.cl .code-editor:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl .code-editor .code-paint, .cl .code-editor .code-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 8px 10px; border: 0; border-radius: 0; font: 12.5px/20px ui-monospace, Consolas, monospace; white-space: pre; tab-size: 2; letter-spacing: 0; min-height: 0; }
.cl .code-editor .code-paint { overflow: hidden; pointer-events: none; color: var(--ink); background: transparent; }
.cl .code-editor .code-input { overflow: auto; resize: none; color: transparent; caret-color: var(--ink); background: transparent; outline: none; }
.cl .code-editor .code-input::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.cl .tok-comment { color: var(--tok-comment); font-style: italic; }
.cl .tok-string { color: var(--tok-string); }
.cl .tok-number { color: var(--tok-number); }
.cl .tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.cl .tok-literal { color: var(--tok-literal); }
.cl .tok-call { color: var(--tok-call); }
.cl .tok-prop { color: var(--tok-prop); }
.cl .tok-template { color: var(--tok-template); font-weight: 600; }


.cl .result-tabs { display: flex; gap: 4px; align-items: center; margin-top: 8px; }
.cl .result-tabs button[data-mode] { padding: 2px 10px; font-size: 12px; }
.cl .result-tabs button.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cl .result-tabs .link { margin-left: auto; font-size: 12px; }
.cl .json-tree { background: var(--bg); padding: 8px 10px; border-radius: 6px; font: 12px/1.6 ui-monospace, Consolas, monospace; overflow: auto; }
.cl .json-tree summary { cursor: pointer; white-space: nowrap; }
.cl .json-tree summary:hover { background: var(--hover); }
.cl .j-kids { padding-left: 16px; border-left: 1px solid var(--line); margin-left: 4px; }
.cl .j-leaf { padding-left: 14px; white-space: pre-wrap; word-break: break-word; }
.cl .j-key { color: var(--tok-prop, #0c7c8c); }
.cl .j-string { color: #1a7f4b; }
.cl .j-number { color: #b35c00; }
.cl .j-boolean, .cl .j-null { color: #8a3fc9; }
.cl .wf-suggest-box { position: relative; }
.cl .wf-suggest { position: absolute; z-index: 6; left: 0; right: 0; top: 100%; margin-top: 2px; max-height: 240px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.cl .wf-suggest div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 9px; cursor: pointer; font-size: 12px; }
.cl .wf-suggest div span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.cl .wf-suggest div.active, .cl .wf-suggest div:hover { background: var(--hover); }
.cl .wf-output { max-height: 320px; overflow: auto; margin: 6px 0 0; }
.cl .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.cl label.check-row { display: flex; gap: 8px; align-items: center; }
.cl .choices button { display: grid; gap: 6px; text-align: left; padding: 14px; white-space: normal; }
.cl button, .cl .btn { font: inherit; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.cl button:hover { background: var(--hover); }
.cl button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cl button.danger { color: var(--danger); }
.cl button:disabled { opacity: 0.5; cursor: default; }
.cl button.link { border: 0; background: none; padding: 0; color: var(--accent); }

.cl input, .cl select, .cl textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
.cl input[type="checkbox"] { width: auto; }
.cl textarea { min-height: 90px; resize: vertical; }
.cl input:focus, .cl select:focus, .cl textarea:focus, .cl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl input:disabled, .cl select:disabled, .cl textarea:disabled { background: var(--bg); color: var(--muted); }

.cl .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.cl .toolbar { display: flex; gap: 8px; padding: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); align-items: center; }
.cl .toolbar input[type="search"] { width: 220px; }
.cl .toolbar select { width: auto; max-width: 180px; }
.cl .table-wrap { overflow-x: auto; }
.cl table { border-collapse: collapse; width: 100%; }
.cl th, .cl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.cl th { font-size: 12px; color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
.cl th.check, .cl td.check { width: 30px; cursor: default; }
.cl tbody tr:hover { background: var(--hover); }
.cl .empty { padding: 28px; text-align: center; color: var(--muted); }
.cl .pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px; color: var(--muted); font-size: 13px; }
.cl .bulkbar { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--hover); border-bottom: 1px solid var(--line); }

.cl .badge { display: inline-flex; align-items: center; gap: 6px; }
.cl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.cl .muted { color: var(--muted); }
.cl .error { color: var(--danger); }

.cl .form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; padding: 16px; }
.cl .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cl .field.wide { grid-column: 1 / -1; }
.cl .field .check-row { display: flex; align-items: center; gap: 8px; height: 34px; }
.cl .step { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--bg); }
.cl .step-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cl .step-head button { padding: 3px 10px; }
.cl .pair-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; align-items: center; }
.cl .pair-row label { display: flex; gap: 4px; align-items: center; margin: 0; white-space: nowrap; }
.cl .pair-row button { padding: 3px 9px; }
.cl .field .req { color: var(--danger); }
.cl details.group { border-top: 1px solid var(--line); }
.cl details.group > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 13px; }
.cl details.group > summary:hover { background: var(--hover); }
.cl details.group[open] > summary { border-bottom: 1px solid var(--line); }
.cl .kv-list { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; }
.cl .kv-list .kv { gap: 16px; }
.cl .kv-list .kv span:last-child { text-align: right; word-break: break-word; }
.cl a.btn { display: inline-block; }
.cl a.btn:hover { background: var(--hover); text-decoration: none; }
.cl .meta-line { padding: 0 16px 14px; color: var(--muted); font-size: 12px; }
.cl .lookup { position: relative; }
.cl .lookup-menu { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; max-height: 220px; overflow-y: auto; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); }
.cl .lookup-menu div { padding: 6px 9px; cursor: pointer; }
.cl .lookup-menu div:hover { background: var(--hover); }
.cl-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; justify-content: flex-end; z-index: 20; }
.cl-overlay.center { justify-content: center; align-items: center; }
.cl .cl-drawer { width: min(520px, 100vw); height: 100%; background: var(--panel); padding: 20px; overflow-y: auto; }
.cl .cl-modal { width: min(460px, 94vw); background: var(--panel); border-radius: var(--radius); padding: 20px; max-height: 90vh; overflow-y: auto; }
.cl .cl-modal .row, .cl .cl-drawer .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.cl .audit { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cl .audit .what { font-size: 12px; color: var(--muted); word-break: break-word; }
.cl pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; }

.cl .wf-editor.no-side { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.cl .wf-editor.no-side .wf-inspector, .cl .wf-editor.no-side .wf-resize { display: none; }


.cl .fn-list { display: grid; gap: 0; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.cl .fn-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cl .fn-row:last-child { border-bottom: 0; }
.cl .fn-what { flex: 1; min-width: 0; }
.cl .fn-what .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.cl .wf-top .wf-close { margin-left: 4px; }
.cl .fn-what .muted a { color: var(--accent); }
.cl .fn-add { display: grid; gap: 6px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.cl .fn-add[hidden] { display: none; }
.cl .fn-add-row { display: flex; gap: 8px; }
.cl .fn-add-row input { flex: 1; min-width: 0; }


.cl .wf-editor.no-side { grid-template-columns: 1fr; }
@media (max-width: 900px) { .cl .wf-editor:not(.no-side) .wf-inspector { order: 2; } }

/* fitting into this app: dialogs above everything, its shadow and corners; the page area a screen fills */
.cl-overlay { z-index: 60; background: rgba(10, 8, 14, 0.55); }
.cl .cl-modal { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; }
.cl .cl-drawer { border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.cl.cl-page { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.cl .wf-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cl .ok { color: var(--ok); }
.cl .error { color: var(--bad); }
@media (max-width: 900px) {
  .cl .wf-editor { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  .cl .wf-resize { display: none; }
  .cl .wf-inspector { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) { .cl .choices { grid-template-columns: 1fr; } }
.cl [hidden] { display: none !important; }
.cl button.link { justify-self: start; text-align: left; }
.cl .head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cl .spacer { flex: 1; }
.cl .crumb { color: var(--muted); font-size: 13px; }
.cl .hint { font-size: 12px; }
.cl h3 { font-size: 13px; }
