/* ============================================================
   Demo 2 — AI Workflow Design (NLP)
   Owned solely by this demo. Every selector is prefixed `wfd-`
   so it cannot collide with the other demos' styles. Builds on
   the shared tokens/components in main.css.

   The right-hand canvas is skinned to read as the Asite Adoddle
   "Visual Workflow Designer": a blue title bar, an editor toolbar,
   a left "Shape Repository" palette, a docked "Properties" panel,
   and BPMN node vocabulary (system/user tasks, exclusive gateways,
   start/end events). The chat panel keeps the modern, streaming
   chat-driven feel.
   ============================================================ */

/* ---- Builder: full-width designer; the AI assistant docks INSIDE the
   designer work band as a native column (palette | canvas | assistant),
   so it reads as part of the Asite platform rather than a detached card. ---- */
.wfd-builder { display: block; }

/* ---- AI Assistant panel — true likeness of the Asite in-platform
   assistant: purple->blue gradient header, light-gray conversation body,
   white "ASSISTANT" cards, dark-navy right-aligned "USER" bubbles. ---- */
.wfd-chat {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #eef1f4;
  border-left: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}
@media (max-width: 1100px) { .wfd-chat { width: 320px; } }
.wfd-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  flex-shrink: 0;
  color: #fff;
  background: linear-gradient(95deg, #7b2ff7 0%, #5a3cf0 42%, #2f6dff 100%);
}
.wfd-chat-ic {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.wfd-chat-htext { flex: 1; min-width: 0; }
.wfd-chat-title {
  font-size: 15px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wfd-chat-headbtns { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.wfd-chat-hbtn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px;
  background: transparent; color: #fff; opacity: .9;
  cursor: pointer;
  transition: background .12s, opacity .12s;
}
.wfd-chat-expand { cursor: default; }
.wfd-chat-hbtn:hover { background: rgba(255,255,255,.18); opacity: 1; }
.wfd-chat-hbtn:disabled { opacity: .45; cursor: default; background: transparent; }

.wfd-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  background: #eef1f4;
  min-height: 200px;
}
.wfd-msg { display: flex; flex-direction: column; }
.wfd-msg.user { align-items: flex-end; }
.wfd-msg-card {
  max-width: 92%;
  border-radius: 10px;
  padding: 9px 12px 10px;
}
.wfd-msg.ai .wfd-msg-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .09);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.wfd-msg.user .wfd-msg-card {
  max-width: 86%;
  background: linear-gradient(180deg, #20406a, #173253);
  border: 1px solid rgba(255, 255, 255, .06);
}
.wfd-msg-role {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 5px;
}
.wfd-msg-role .wfd-role-ic { display: inline-flex; }
.wfd-msg.ai .wfd-msg-role { color: #8b94a4; }
.wfd-msg.user .wfd-msg-role { color: #9fbbe0; }
.wfd-bub {
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}
.wfd-msg.ai .wfd-bub { color: #2a3242; }
.wfd-msg.user .wfd-bub { color: #fff; }
.wfd-bub.md > :first-child { margin-top: 0; }
.wfd-bub.md > :last-child { margin-bottom: 0; }
.wfd-typing { display: flex; gap: 4px; align-items: center; }
.wfd-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: wfd-bounce 1s infinite;
}
.wfd-typing span:nth-child(2) { animation-delay: .15s; }
.wfd-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes wfd-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.wfd-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}
.wfd-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--asite-blue-text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.wfd-chip:hover { background: var(--asite-blue-light); border-color: #BBD6F5; }
.wfd-chip svg { color: var(--asite-blue); }
.wfd-allset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ok);
  font-weight: 600;
}

.wfd-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  align-items: flex-end;
  flex-shrink: 0;
}
.wfd-input { flex: 1; resize: none; min-height: 38px; line-height: 1.4; }
.wfd-send { flex-shrink: 0; width: 38px; height: 38px; padding: 0; }

/* ============================================================
   DESIGNER FRAME — Asite "Visual Workflow Designer"
   ============================================================ */
.wfd-canvas {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
  min-height: 560px;
}

/* ---- Blue title bar ---- */
.wfd-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #1f78c2, #15598f);
  color: #fff;
  flex-shrink: 0;
}
.wfd-tb-ico { display: inline-flex; opacity: .92; }
.wfd-tb-title {
  flex: 1 1 auto;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.wfd-tb-title .wfd-tb-ctx { font-weight: 500; opacity: .85; }
.wfd-tb-badges { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.wfd-tb-ver {
  font-size: 10.5px; font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  padding: 1px 7px;
  border-radius: 10px;
}
.wfd-tb-deployed {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700;
  color: #fff;
  background: rgba(31,157,107,.9);
  border: 1px solid rgba(255,255,255,.25);
  padding: 1px 7px;
  border-radius: 10px;
}
.wfd-tb-ctrls { display: flex; align-items: center; gap: 2px; margin-left: 4px; flex-shrink: 0; }
.wfd-tb-ctrl {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85);
  border-radius: 4px;
  font-size: 13px;
}

/* ---- Editor toolbar ---- */
.wfd-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.wfd-tool {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: default;
}
.wfd-tool:hover { background: #fff; border-color: var(--line); color: var(--text-2); }
.wfd-tool-sep {
  width: 1px; height: 18px;
  background: var(--line-strong);
  margin: 0 4px;
  flex-shrink: 0;
}
.wfd-toolbar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ---- Work area: palette | canvas ---- */
.wfd-work {
  display: flex;
  flex: 1;
  min-height: 430px;
  min-width: 0;
}

/* ---- Shape Repository palette ---- */
.wfd-palette {
  width: 158px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wfd-pal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #2a4f76;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.wfd-pal-head .wfd-pal-collapse { opacity: .8; display: inline-flex; }
.wfd-pal-scroll { overflow-y: auto; padding: 6px 0 10px; }
.wfd-pal-group { padding: 2px 0; }
.wfd-pal-gtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}
.wfd-pal-gtitle::before {
  content: '';
  width: 7px; height: 1.5px;
  background: var(--text-3);
  opacity: .7;
  flex-shrink: 0;
}
.wfd-pal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 14px;
  font-size: 11.5px;
  color: var(--text-2);
  border: 1px solid transparent;
  cursor: default;
}
.wfd-pal-item.is-action { cursor: pointer; }
.wfd-pal-item.is-action:hover { background: var(--asite-blue-light); color: var(--asite-blue-text); }
.wfd-pal-mini {
  width: 22px; height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
/* Mini glyphs for the palette */
.wfd-pal-mini .pm-circle {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1.5px solid #3a9d6a;
  background: #fff;
}
.wfd-pal-mini .pm-circle.end { border-width: 3px; border-color: var(--asite-blue-text); }
.wfd-pal-mini .pm-circle.timer { border-color: var(--text-3); }
.wfd-pal-mini .pm-task {
  width: 20px; height: 14px;
  border-radius: 3px;
  border: 1.5px solid #E2CE73;
  background: linear-gradient(0deg, #fdf8e3, #fefcf2);
}
.wfd-pal-mini .pm-task.user {
  border-color: #9CC0E8;
  background: linear-gradient(0deg, #e8f1fc, #f5f9fe);
}
.wfd-pal-mini .pm-diamond {
  width: 13px; height: 13px;
  border: 1.5px solid #8b97a8;
  background: #fff;
  border-radius: 3px;
  transform: rotate(45deg);
}
.wfd-pal-mini .pm-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.wfd-pal-mini .pm-line {
  width: 20px;
  color: var(--text-3);
  display: inline-flex;
}

/* ---- Canvas area ---- */
.wfd-canvas-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.wfd-canvas-body {
  flex: 1;
  min-height: 430px;
  position: relative;
  background-color: #fbfcfe;
  background-image: radial-gradient(circle, #e0e5ed 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ---- Empty state ---- */
.wfd-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}
.wfd-empty-ic {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--asite-blue);
  background: var(--asite-blue-light);
  border: 1px solid #BBD6F5;
  margin-bottom: 14px;
}
.wfd-empty-t { font-size: 15px; font-weight: 700; }
.wfd-empty-d { font-size: 12.5px; color: var(--text-3); max-width: 340px; margin-top: 6px; }

/* ---- Stage (scrollable diagram) ---- */
.wfd-canvas-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 12px;
}
.wfd-stage { position: relative; margin: 0 auto; }

.wfd-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wfd-edge { fill: none; stroke: #64748b; stroke-width: 1.6; }
.wfd-edge.warn { stroke: #C98A14; }
.wfd-edge.loop { stroke-dasharray: 5 4; }

.wfd-elabel {
  position: absolute;
  transform: translate(-50%, -50%);
  background: #fbfcfe;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
  border-radius: 3px;
  white-space: nowrap;
}
.wfd-elabel.warn { color: #C98A14; }

/* ============================================================
   NODES — BPMN vocabulary
   ============================================================ */
.wfd-node {
  position: absolute;
  box-sizing: border-box;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .1s;
}
.wfd-node:active { transform: scale(.99); }

/* Reveal / highlight for newly added or changed steps */
.wfd-node.isnew { animation: wfd-pop .45s ease; }
.wfd-node.isnew::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 11px;
  border: 2px solid var(--asite-blue);
  animation: wfd-ring 1.6s ease-out forwards;
  pointer-events: none;
}
@keyframes wfd-pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wfd-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0,114,206,.40); opacity: 1; }
  100% { box-shadow: 0 0 0 12px rgba(0,114,206,0); opacity: 0; }
}

/* ---- Task nodes (process): system + user ---- */
.wfd-node.t-process {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--sh-1);
  padding: 7px 24px 7px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}
.wfd-node.t-process:hover { box-shadow: var(--sh-2); border-color: var(--asite-blue); }
.wfd-node.t-process.sel { border-color: var(--asite-blue); box-shadow: 0 0 0 3px var(--asite-blue-light); }

.wfd-node.kind-system {
  background: linear-gradient(0deg, #fdf8e3, #fefdf6);
  border-color: #E2CE73;
}
.wfd-node.kind-user {
  background: linear-gradient(0deg, #e8f1fc, #f6faff);
  border-color: #9CC0E8;
}

.wfd-task-ico {
  position: absolute;
  top: 5px; left: 6px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.kind-system .wfd-task-ico { color: #9a7d1e; }
.kind-user .wfd-task-ico { color: var(--asite-blue-text); }

.wfd-task-kick {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}
.kind-user .wfd-task-kick { color: #4a78a8; }
.kind-system .wfd-task-kick { color: #9a7d1e; }

.wfd-node-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.wfd-node-sub {
  font-size: 10px;
  color: var(--text-3);
}
.wfd-task-timer {
  position: absolute;
  bottom: -9px; left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}
.wfd-task-timer svg { color: var(--asite-amber); }

.wfd-node-grip {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border-left: 1px solid var(--line-soft);
  border-radius: 0 8px 8px 0;
  opacity: 0;
  transition: opacity .12s, color .12s, background .12s;
}
.wfd-node.t-process:hover .wfd-node-grip { opacity: 1; }
.wfd-node-grip:hover { color: var(--asite-blue); background: rgba(255,255,255,.6); }

/* ---- Event nodes (start / end) — circles with a side label ---- */
.wfd-node.t-start, .wfd-node.t-end { display: block; overflow: visible; }
.wfd-ev-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  border: 1.6px solid #7a8aa0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  box-shadow: var(--sh-1);
  transition: box-shadow .15s, border-color .15s;
}
.t-start .wfd-ev-ring { border-color: #3a9d6a; color: #1F9D6B; }
.t-start .wfd-ev-ring svg { margin-left: 2px; }
.t-end .wfd-ev-ring { border-width: 3px; border-color: var(--asite-blue-text); }
.wfd-node.t-start:hover .wfd-ev-ring,
.wfd-node.t-end:hover .wfd-ev-ring { box-shadow: var(--sh-2); }
.wfd-node.t-start.sel .wfd-ev-ring,
.wfd-node.t-end.sel .wfd-ev-ring { border-color: var(--asite-blue); box-shadow: 0 0 0 3px var(--asite-blue-light); }
.wfd-node.t-start.isnew::after,
.wfd-node.t-end.isnew::after { border-radius: 50%; inset: -4px; }

.wfd-side-label {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}
.wfd-side-label.left {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 7px;
}

/* ---- Gateway node (decision) — diamond with an X ---- */
.wfd-node.t-decision { display: block; overflow: visible; }
.wfd-gw {
  position: absolute;
  top: 50%; left: 50%;
  width: 70.7%; height: 70.7%;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #fff;
  border: 1.6px solid #8b97a8;
  border-radius: 5px;
  box-shadow: var(--sh-1);
  transition: box-shadow .15s, border-color .15s;
}
.wfd-gw-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  pointer-events: none;
}
.wfd-node.t-decision:hover .wfd-gw { box-shadow: var(--sh-2); border-color: var(--asite-blue); }
.wfd-node.t-decision.sel .wfd-gw { border-color: var(--asite-blue); box-shadow: 0 0 0 3px var(--asite-blue-light); }

/* ============================================================
   PROPERTIES DOCK
   ============================================================ */
.wfd-props {
  border-top: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}
.wfd-props-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #2a4f76;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.wfd-props-head .wfd-props-collapse { opacity: .8; display: inline-flex; }
.wfd-props-body {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 30px;
}
.wfd-prop-fields { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wfd-prop {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wfd-prop-l {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}
.wfd-prop-v {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wfd-prop-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-sunken);
  color: var(--text-2);
}
.wfd-prop-type.system { background: #fdf8e3; border-color: #E2CE73; color: #9a7d1e; }
.wfd-prop-type.user { background: #e8f1fc; border-color: #9CC0E8; color: var(--asite-blue-text); }
.wfd-prop-type.gateway { background: #fff; border-color: #8b97a8; color: var(--text-2); }
.wfd-prop-type.start { background: var(--ok-bg); border-color: #C2E5D2; color: var(--ok); }
.wfd-prop-type.end { background: var(--asite-blue-light); border-color: #BBD6F5; color: var(--asite-blue-text); }

.wfd-prop-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.wfd-hint-muted { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 11.5px; }
.wfd-hint-muted svg { color: var(--text-3); }
.wfd-linklike {
  background: none; border: none;
  color: var(--asite-blue-text);
  font-weight: 700;
  cursor: pointer;
  font-size: 11.5px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wfd-linklike:hover { text-decoration: underline; }
.wfd-linklike.danger { color: var(--err); }
.wfd-linklike svg { vertical-align: -1px; }

/* ---- Narrow: collapse the palette so the canvas stays usable ---- */
@media (max-width: 760px) {
  .wfd-palette { display: none; }
}

/* ---- Add / Edit step modals ---- */
.wfd-flabel { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 14px 0 5px; }
.wfd-modal-p + .wfd-flabel { margin-top: 14px; }
.wfd-modal-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 12px 0 0;
}
.wfd-modal-note svg { flex-shrink: 0; margin-top: 1px; color: var(--text-3); }

/* ---- Deploy modal ---- */
.wfd-modal-p { margin: 0 0 4px; font-size: 13px; color: var(--text-2); }
.wfd-deploy-stats { display: flex; gap: 10px; margin: 14px 0; }
.wfd-dstat {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  text-align: center;
  background: var(--bg-sunken);
}
.wfd-dstat-n { display: block; font-size: 20px; font-weight: 700; color: var(--asite-blue-text); }
.wfd-dstat-l {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-top: 2px;
}
.wfd-deploy-stats + .note-callout { margin-top: 2px; }
.check-row.wfd-confirm, .wfd-deploy-stats ~ .check-row { margin-top: 14px; }

/* ============================================================
   ADODDLE CDE SHELL (Workflow Definitions landing)
   ============================================================ */
.wfd-platform {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.wfd-cde { font-size: 12.5px; }

/* ---- top bar ---- */
.wfd-cde-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  height: 44px;
  background: linear-gradient(90deg, #2a6db5, #15375f);
  color: #fff;
}
.wfd-cde-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.wfd-cde-logo {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .16);
}
.wfd-cde-brandtx { letter-spacing: .04em; font-size: 14px; }
.wfd-cde-search {
  display: flex; align-items: center; gap: 8px;
  width: 220px; height: 28px; padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  color: var(--text-3);
}
.wfd-cde-proj { display: flex; align-items: center; gap: 6px; opacity: .96; }
.wfd-cde-proj strong { font-weight: 700; }
.wfd-cde-tools { margin-left: auto; display: flex; align-items: center; gap: 11px; }
.wfd-cde-ic { opacity: .9; display: inline-flex; }
.wfd-cde-flag {
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, .18);
}

/* ---- avatars ---- */
.wfd-ava {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 9.5px; font-weight: 800; color: #fff; flex: none;
}
.wfd-ava.sm { width: 24px; height: 24px; }
.wfd-ava.blue { background: #2f74c0; }
.wfd-ava.teal { background: #2f9c8f; }
.wfd-ava.red  { background: #cf6b5f; }

/* ---- tabs ---- */
.wfd-cde-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
}
.wfd-cde-tab {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 11px 12px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.wfd-cde-tab.active { color: var(--asite-blue-text); border-bottom-color: var(--asite-blue); font-weight: 700; }

/* ---- body layout ---- */
.wfd-cde-body { display: flex; align-items: stretch; min-height: 430px; }
.wfd-cde-rail {
  width: 96px; flex: none;
  border-right: 1px solid var(--line);
  background: #fafbfc;
  padding: 8px 0;
}
.wfd-rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; text-align: center;
  font-size: 10.5px; line-height: 1.2; color: var(--text-3);
  border-left: 3px solid transparent;
}
.wfd-rail-ic { color: var(--text-3); display: inline-flex; }
.wfd-rail-item.active {
  color: var(--asite-blue-text); background: var(--asite-blue-light);
  border-left-color: var(--asite-blue); font-weight: 700;
}
.wfd-rail-item.active .wfd-rail-ic { color: var(--asite-blue); }

.wfd-cde-tree {
  width: 168px; flex: none;
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  background: #fff;
}
.wfd-tree-head { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.wfd-tree-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px; border-radius: 6px;
  font-size: 12px; color: var(--text-2);
}
.wfd-tree-row svg { color: #e0a64a; flex: none; }
.wfd-tree-tw { display: inline-flex; opacity: .55; }
.wfd-tree-tw svg { color: var(--text-3); }
.wfd-tree-row.child { margin-left: 16px; }
.wfd-tree-star { color: #e0a64a; }
.wfd-tree-row.active { background: var(--asite-blue-light); color: var(--asite-blue-text); font-weight: 700; }

/* ---- main column ---- */
.wfd-cde-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wfd-cde-mainhead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.wfd-cde-title { font-size: 14px; font-weight: 800; margin: 0; color: var(--text); }
.wfd-cde-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.wfd-cde-find {
  display: flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line-strong); color: var(--text-3); font-size: 12px;
}
.wfd-cde-iconbtn {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text-2); cursor: pointer;
}
.wfd-cde-addbtn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--asite-blue); background: var(--asite-blue); color: #fff;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.wfd-cde-addbtn svg { color: #fff; }
.wfd-cde-addbtn.ghost { background: #fff; color: var(--asite-blue-text); }
.wfd-cde-addbtn.ghost svg { color: var(--asite-blue); }
.wfd-cde-addbtn:hover { filter: brightness(.96); }

/* ---- definitions table ---- */
.wfd-cde-tablewrap { flex: 1; overflow: auto; }
.wfd-def-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.wfd-def-table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 700; color: var(--text-3);
  background: #f5f7fa; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.wfd-def-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.wfd-def-table tr:hover td { background: var(--asite-blue-light); }
.wfd-col-chk { width: 30px; }
.wfd-chk { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 3px; vertical-align: middle; }
.wfd-deflink { color: var(--asite-blue-text); font-weight: 600; text-decoration: none; cursor: pointer; }
.wfd-deflink:hover { text-decoration: underline; }
.wfd-col-dim { color: var(--text-3); }
.wfd-t-ico { display: inline-flex; }
.wfd-t-ico.blue svg { color: #2f74c0; }
.wfd-t-ico.green svg { color: #2f9c6a; }
.wfd-t-ico.red svg { color: #cf6b5f; }
.wfd-cde-user { display: inline-flex; align-items: center; gap: 7px; }
.wfd-cde-uname { color: var(--asite-blue-text); }

/* ---- list footer ---- */
.wfd-cde-foot {
  display: flex; align-items: center; gap: 18px;
  padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3);
}
.wfd-cde-rpp { display: inline-flex; align-items: center; gap: 4px; }
.wfd-cde-showing { margin-left: auto; }
.wfd-cde-pager { display: inline-flex; gap: 4px; }
.wfd-cde-pager .pg {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
}
.wfd-cde-pager .pg.active { background: var(--asite-blue); color: #fff; border-color: var(--asite-blue); }
.wfd-cde-customise { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.wfd-cde-rpp strong { color: var(--text-2); }

@media (max-width: 720px) {
  .wfd-cde-rail, .wfd-cde-tree { display: none; }
}

/* ---- Create Workflow modal: route choice cards ---- */
.wfd-routes { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wfd-route {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.wfd-route:hover { border-color: #BBD6F5; background: var(--asite-blue-light); }
.wfd-route.sel {
  border-color: var(--asite-blue);
  background: var(--asite-blue-light);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, .12);
}
.wfd-route-ic {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff;
}
.wfd-route-ic.manual { background: linear-gradient(135deg, #5A6473, #2A3340); }
.wfd-route-ic.ai { background: linear-gradient(135deg, #7b2ff7, #5a3cf0); }
.wfd-route-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wfd-route-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wfd-route-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--asite-blue);
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
}
.wfd-route-desc { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.wfd-route-check {
  width: 22px;
  height: 22px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  color: #fff;
  background: transparent;
}
.wfd-route.sel .wfd-route-check { background: var(--asite-blue); border-color: var(--asite-blue); }
.wfd-route:not(.sel) .wfd-route-check svg { opacity: 0; }

/* "Asite Coworker" (ai) card wears the Coworker purple brand, not the generic
   Asite blue used by the Manual designer card. */
.wfd-route[data-route="ai"]:hover {
  border-color: #c9b8f7;
  background: rgba(123, 47, 247, .05);
}
.wfd-route[data-route="ai"].sel {
  border-color: #7b2ff7;
  background: rgba(123, 47, 247, .08);
  box-shadow: 0 0 0 3px rgba(123, 47, 247, .14);
}
.wfd-route[data-route="ai"].sel .wfd-route-check {
  background: #7b2ff7;
  border-color: #7b2ff7;
}
.wfd-route[data-route="ai"] .wfd-route-badge { background: #7b2ff7; }

/* ---- Designer chrome: AI toggle + mode chip ---- */
.wfd-ai-toggle.on {
  border-color: var(--asite-blue);
  color: var(--asite-blue-text);
  background: var(--asite-blue-light);
}
.wfd-ai-toggle.on svg { color: var(--asite-blue); }
.wfd-tb-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
}
.wfd-tb-mode svg { opacity: .9; }

/* ============================================================
   CREATE WORKFLOW DEFINITION modal (Adoddle dialog)
   ============================================================ */
.wfd-cwd-modal { width: min(640px, 94vw); }
.wfd-cwd-modal .modal-h {
  background: linear-gradient(90deg, #2a6db5, #15375f);
  color: #fff;
  border-bottom: 0;
}
.wfd-cwd-modal .modal-h .x { color: #fff; opacity: .85; }
.wfd-cwd-modal .modal-h .x:hover { opacity: 1; }

.wfd-cwd-build { margin-bottom: 18px; }
.wfd-cwd-buildlbl { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 9px; }

.wfd-cwd-form {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.wfd-cwd-row { display: grid; grid-template-columns: 158px 1fr; align-items: start; gap: 12px; }
.wfd-cwd-lbl { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding-top: 9px; }
.wfd-cwd-lbl .req { color: #d2433a; margin: 0 1px; }
.wfd-cwd-field .field { width: 100%; }
.wfd-cw-desc { resize: vertical; min-height: 64px; font-family: inherit; line-height: 1.45; }
.wfd-cwd-field select.field[disabled] { background: var(--bg); color: var(--text-3); cursor: not-allowed; }

@media (max-width: 560px) {
  .wfd-cwd-row { grid-template-columns: 1fr; }
  .wfd-cwd-lbl { text-align: left; padding-top: 0; }
}
