/* Native V2 Chat flows: flow list (250px side column, a drawer below 900px), card with toolbar and a pannable canvas, nodes, palette.
 * Reuses .wk-* (kit.css), .tp-chip (templets.css), .cb-switchlbl (chatbots.css), .ct-busy / .ct-loading (contacts.css). */
.cf { position: absolute; inset: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); background: #f1f1f1; font-size: 14px; color: var(--ink); overflow: hidden; }
.cf.off { visibility: hidden; pointer-events: none; }
.cf .ct-loading { grid-column: 1 / -1; }

/* side column: flows */
.cf-side { background: #fff; display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 8px; gap: 12px; }
.cf-sidehead { display: grid; gap: 12px; justify-items: center; }
.cf-art { width: 200px; max-width: 100%; height: auto; display: block; }
.cf-new { width: 100%; }
.cf-cap2 { margin: 0; color: gray; font-size: 13px; text-align: center; }
.cf-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 4px; align-content: start; border-top: 1px solid #eee; padding-top: 8px; }
.cf-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px; border-radius: 10px; padding: 2px 2px; }
.cf-row:hover { background: #f7f7f7; } .cf-row.on { background: #dfe9e2; }
.cf-rowmain { border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; display: grid; min-width: 0; padding: 4px 6px; border-radius: 8px; }
.cf-rowtitle { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-rowmain small { color: gray; font-size: 12px; }
.cf-act { color: #ed6c02; } .cf-del { color: #d32f2f; }
.cf-none { color: gray; font-size: 13px; text-align: center; margin: 12px 0; }
.cf-scrim { display: none; }

/* main card */
.cf-main { padding: 16px; min-width: 0; min-height: 0; display: flex; container-type: inline-size; }
.cf-card-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; }
.cf-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid #eee; }
.cf-menu { display: none; color: var(--green); }
.cf-title { flex: 1 1 180px; min-width: 120px; width: auto; background: #f5f7fb; border-color: #f5f7fb; font-weight: 600; }
.cf-tbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--green); background: #fff; color: var(--green); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.cf-tbtn:hover { background: var(--mint); }
.cf-save { padding: 0 16px; }
.cf-save .wk-i, .cf-tbtn .wk-i { flex: none; }
.cf-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }

/* canvas */
.cf-canvas { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; direction: ltr; outline: none;
  background-color: #fafbfa; background-image: radial-gradient(#cdd3cf 1.1px, transparent 1.2px); background-size: 22px 22px; }
.cf-canvas.pan { cursor: grabbing; } .cf-canvas.arming { cursor: crosshair; }
.cf-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }
.cf-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.cf-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cf-ehit { fill: none; stroke: transparent; stroke-width: 20; pointer-events: stroke; cursor: pointer; }
.cf-epath { fill: none; stroke: #9aa39d; stroke-width: 2; pointer-events: none; }
.cf-edge:hover .cf-epath { stroke: #5f6a62; } .cf-edge.sel .cf-epath { stroke: var(--green); stroke-width: 3; }
.cf-conn { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-dasharray: 6 4; pointer-events: none; }
.cf-nodes { position: absolute; left: 0; top: 0; }
.cf-ex { position: absolute; left: 0; top: 0; z-index: 6; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #d32f2f; background: #fff; color: #d32f2f; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18); padding: 0; }
.cf-box-sel { position: absolute; z-index: 5; border: 1px solid var(--green); background: rgba(42, 146, 69, .1); pointer-events: none; }
.cf-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cf-empty .wk-cta { pointer-events: auto; }

/* nodes */
.cf-node { position: absolute; left: 0; top: 0; width: 270px; cursor: default; outline: none; }
.cf-node.cf-wide { width: 300px; }
.cf-node.drag { cursor: grabbing; } .cf-node.drag .cf-card { box-shadow: 5px 10px 50px 0 rgba(0,0,0,.22); }
.cf-card { background: #fff; border-radius: 12px; border: 1px solid #f1f1f1; padding: 8px; display: grid; gap: 8px; box-shadow: 0 4px 8px rgba(0,0,0,.05); font-size: 12px; }
.cf-node.sel .cf-card { box-shadow: 5px 10px 50px 0 rgba(0,0,0,.22); border-color: var(--green); }
.cf-nhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #fff; border-radius: 8px; padding: 3px 4px 3px 10px; cursor: grab; }
.cf-ntitle { font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-nact { display: flex; align-items: center; gap: 2px; flex: none; }
.cf-nact .wk-ibtn { color: #fff; } .cf-nact .wk-ibtn:hover { background: rgba(255,255,255,.22); }
.cf-nbody { display: grid; gap: 8px; min-width: 0; }
.cf-field { font-size: 12px; padding: 8px 10px; border-radius: 8px; background: #f5f7fb; border-color: #f5f7fb; min-width: 0; }
textarea.cf-field { resize: vertical; min-height: 84px; font-family: inherit; line-height: 1.4; }
.cf-field:disabled { opacity: .6; }
select.cf-field { border-color: #cfe5c8; background: #fff; }
.cf-entry { display: flex; align-items: center; gap: 4px; } .cf-entry .cf-field { flex: 1; }
.cf-add { color: var(--green); } .cf-add:disabled { color: #bdbdbd; cursor: not-allowed; }
.cf-hint { color: gray; font-size: 11px; line-height: 1.3; } .cf-cap { color: gray; font-size: 11.5px; }
.cf-center { color: gray; font-size: 11.5px; text-align: center; }
.cf-fwrap { display: grid; gap: 2px; min-width: 0; }
.cf-info { background: #e8f4fd; color: #0b5394; border-radius: 8px; padding: 8px 10px; font-size: 11.5px; line-height: 1.4; }
.cf-box { background: #f5f7fb; border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.cf-inline, .cf-boxhead.cf-inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cf-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-check { display: flex; align-items: center; gap: 8px; font-size: 12px; } .cf-check input { accent-color: var(--green); width: 16px; height: 16px; }
.cf-upload { display: grid; place-items: center; min-height: 72px; border-radius: 10px; background: #ececec; color: gray; cursor: pointer; text-align: center; padding: 10px; }
.cf-upload:hover { background: #e4e8e5; } .cf-uptext { font-size: 12px; }
.cf-prev { display: grid; justify-items: center; } .cf-img { max-width: 100%; max-height: 160px; border-radius: 8px; } .cf-audio { width: 100%; }
.cf-methods { display: flex; flex-wrap: wrap; gap: 6px; } .cf-methods .tp-chip, .cf-agents .tp-chip, .cf-pairs .tp-chip, .cf-secrows .tp-chip { min-height: 26px; padding: 0 10px; font-size: 11px; }
.cf-agents { display: grid; gap: 6px; } .cf-agent { justify-content: flex-start; overflow-wrap: anywhere; }
.cf-pairs, .cf-optchips, .cf-sheetrows { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow: auto; }
.cf-pairin { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cf-pairchip, .cf-minichip { gap: 4px; padding-right: 4px; }
.cf-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; padding: 0; opacity: .8; } .cf-x:hover { background: rgba(0,0,0,.1); opacity: 1; }
.cf-pairadd, .cf-secsubmit, .cf-try, .cf-credsave { min-height: 32px; font-size: 12px; padding: 0 12px; border-radius: 8px; }
.cf-sec { background: #f5f7fb; border-radius: 10px; padding: 8px; display: grid; gap: 4px; } .cf-sechead { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.cf-secrows { display: flex; flex-wrap: wrap; gap: 6px; } .cf-secs { display: grid; gap: 6px; }
.cf-secnew { background: #f5f7fb; border-radius: 10px; padding: 8px; display: grid; gap: 6px; } .cf-secnewfoot { display: flex; justify-content: space-between; gap: 8px; }
.cf-tz { display: flex; align-items: center; gap: 8px; border-radius: 8px; padding: 6px 10px; background: #fdeded; color: #5f2120; font-size: 12px; } .cf-tz.ok { background: #edf7ed; color: #1e4620; }
.cf-resp { overflow: auto; } .cf-okmsg { background: #edf7ed; color: #1e4620; border-radius: 8px; padding: 8px 10px; font-size: 11.5px; }
.cf-json { margin: 6px 0 0; max-height: 220px; overflow: auto; background: #f5f7fb; border-radius: 8px; padding: 8px; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cf-drop { display: grid; gap: 2px; justify-items: center; text-align: center; border: 1px dashed #bbb; border-radius: 10px; padding: 14px 8px; cursor: pointer; font-size: 12px; } .cf-drop small { color: gray; }
.cf-err { background: #fdeded; color: #5f2120; border-radius: 8px; padding: 6px 10px; font-size: 11.5px; } .cf-okline { background: #edf7ed; color: #1e4620; border-radius: 8px; padding: 6px 10px; font-size: 11.5px; overflow-wrap: anywhere; }
.cf-sample { display: grid; gap: 2px; font-size: 10.5px; color: gray; } .cf-sample a { color: var(--deep); }
.cf-hist { font-weight: 700; font-size: 16px; padding: 2px 10px; }
.cf-rangewrap { display: flex; align-items: center; gap: 16px; padding: 12px 4px; } .cf-range { flex: 1; accent-color: var(--green); }
.cf-swl { flex: none; }
.cf-nact .cf-swl { transform: scale(.8); }

/* output chips and handles */
.cf-chips { display: grid; gap: 6px; padding-top: 8px; }
.cf-chip { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #fff; border: 1px solid #d9d9d9; border-radius: 10px; padding: 4px 24px 4px 12px; min-height: 30px; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.cf-chiplabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cf-handle { position: absolute; z-index: 4; width: 12px; height: 12px; border-radius: 50%; background: var(--hc, #555); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.28); cursor: crosshair; touch-action: none; }
.cf-handle::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.cf-handle[hidden] { display: none; }
.cf-tgt { left: 0; top: 50%; transform: translate(-50%, -50%); }
.cf-src { right: 0; top: 50%; transform: translate(50%, -50%); }
.cf-srcmain { right: 0; top: 50%; }
.cf-handle:hover, .cf-handle.hot { box-shadow: 0 0 0 3px rgba(42,146,69,.45); }
.cf-handle.armed { box-shadow: 0 0 0 4px var(--green); }
.cf-canvas.locked .cf-handle { cursor: not-allowed; } .cf-canvas.locked .cf-nhead { cursor: default; }
@media (pointer: coarse) { .cf-handle { width: 16px; height: 16px; } .cf-handle::after { inset: -14px; } .cf-field { font-size: 13px; } }

/* controls, mini map */
.cf-ctl { position: absolute; left: 12px; bottom: 12px; z-index: 8; display: grid; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.25); background: #fff; }
.cf-cbtn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-bottom: 1px solid #eee; background: #fff; color: #333; cursor: pointer; padding: 0; } .cf-cbtn:last-child { border-bottom: 0; } .cf-cbtn:hover { background: var(--mint); } .cf-cbtn.on { background: #dfe9e2; color: var(--deep); }
.cf-mini { position: absolute; right: 12px; bottom: 12px; z-index: 8; background: #fff; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.25); cursor: pointer; touch-action: none; }
.cf-miniview { fill: rgba(42,146,69,.1); stroke: var(--green); stroke-width: 1.5; }

/* palette drawer */
.cf-pal { position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 100%; z-index: 20; background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.15); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .2s ease; visibility: hidden; }
.cf-pal.open { transform: none; visibility: visible; }
.cf-palhead { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; }
.cf-palbody { overflow-y: auto; padding: 8px 16px 20px; display: grid; gap: 14px; align-content: start; }
.cf-kb { justify-self: end; background: linear-gradient(90deg, #2A9245, #96C93E); }
.cf-group { display: grid; gap: 8px; } .cf-group summary { display: flex; align-items: center; gap: 10px; background: #f1f1f1; border-radius: 12px; padding: 8px 16px; font-weight: 600; cursor: pointer; list-style: none; } .cf-group summary::-webkit-details-marker { display: none; }
.cf-group summary .wk-i:last-child { margin-inline-start: auto; transition: transform .15s; } .cf-group:not([open]) summary .wk-i:last-child { transform: rotate(-90deg); }
.cf-gitems { display: grid; gap: 8px; }
.cf-pitem { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 10px; padding: 12px; color: #fff; font: inherit; text-align: start; cursor: pointer; }
.cf-pitem:hover { filter: brightness(1.06); } .cf-pitem:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cf-pname { display: grid; flex: 1; min-width: 0; } .cf-pname b { font-size: 13.5px; } .cf-pname small { font-size: 11px; opacity: .9; line-height: 1.3; }

/* dialogs */
.cf-modal { width: min(560px, 94vw); } .cf-modal input.wk-field { background: #f5f7fb; border-color: #f5f7fb; }
.cf-actmodal { width: min(900px, 96vw); }
.cf-actbody { display: grid; gap: 14px; } .cf-actchips { margin-bottom: 4px; }
.cf-acttablewrap { overflow: auto; max-height: 62vh; border-radius: 10px; background: #f9f9f9; }
.cf-acttable { width: 100%; border-collapse: collapse; font-size: 13px; } .cf-acttable th { text-align: start; font-weight: 600; padding: 10px 12px; background: #f1f1f1; position: sticky; top: 0; } .cf-acttable td { padding: 6px 12px; border-top: 1px solid #eee; } .cf-actdel { width: 80px; } .cf-actremove { color: #d32f2f; }
.cf-actpager { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cf-kbl { margin: 6px 0 0; padding-inline-start: 22px; display: grid; gap: 4px; font-size: 13px; } .cf-kbl code { background: #f1f1f1; padding: 1px 6px; border-radius: 6px; }
.cf .wk-toast { z-index: 2000; }

@container (max-width: 880px) { .cf-import .cf-lbl, .cf-export .cf-lbl { display: none; } .cf-import, .cf-export { padding: 0 12px; } }

/* narrow: the flow list is a drawer, the toolbar wraps, the buttons keep their icons only */
.cf[data-layout="narrow"] { grid-template-columns: minmax(0, 1fr); }
.cf[data-layout="narrow"] .cf-main { padding: 8px; }
.cf[data-layout="narrow"] .cf-menu { display: inline-grid; }
.cf[data-layout="narrow"] .cf-side { position: absolute; z-index: 60; top: 0; bottom: 0; left: 0; width: min(300px, 86%); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(0,0,0,.2); visibility: hidden; }
.cf[data-layout="narrow"][data-side="open"] .cf-side { transform: none; visibility: visible; }
.cf[data-layout="narrow"][data-side="open"] .cf-scrim { display: block; position: absolute; inset: 0; z-index: 55; background: rgba(20, 30, 20, .4); }
.cf[data-layout="narrow"][dir="rtl"] .cf-side { left: auto; right: 0; transform: translateX(102%); } .cf[data-layout="narrow"][dir="rtl"][data-side="open"] .cf-side { transform: none; }
.cf[data-layout="narrow"] .cf-title { flex: 1 1 calc(100% - 60px); }
.cf[data-layout="narrow"] .cf-tools { gap: 6px; padding: 8px; }
.cf[data-layout="narrow"] .cf-tbtn, .cf[data-layout="narrow"] .cf-save { flex: 1 1 0; padding: 0 8px; }
.cf[data-layout="narrow"] .cf-lbl { display: none; }
.cf[data-layout="narrow"] .cf-pal { width: 100%; }
.cf[dir="rtl"] .cf-menu svg { transform: scaleX(-1); }
.cf-eu { position: absolute; left: 0; top: 0; z-index: 6; width: 14px; height: 14px; padding: 0; border-radius: 50%; border: 2px solid var(--green); background: #fff; cursor: grab; touch-action: none; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.cf-eu::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
.cf-eu[hidden] { display: none; }
@media (pointer: coarse) { .cf-eu { width: 18px; height: 18px; } .cf-eu::after { inset: -14px; } }
.cf-edge.updating { opacity: .35; }
.cf-edge:focus { outline: none; } .cf-edge:focus-visible .cf-epath { stroke: var(--green); stroke-width: 3; stroke-dasharray: 2 3; }
.cf-canvas.locked .cf-eu { display: none; }
/* AI step: saved AI connection (Account → AI connections) */
.cf-aiconn { border: 1px solid #d3e2d5; background: #f4faf5; }
.cf-alink { font-size: 11.5px; font-weight: 600; color: #1f6f35; text-decoration: none; white-space: nowrap; } .cf-alink:hover { text-decoration: underline; }
.cf-field[hidden] { display: none; }
