/* Workflow builder canvas (includes/visuals/nodes.php) */
.nd { --nd-canvas: var(--paper); --nd-chrome: var(--white); --nd-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: var(--nd-chrome); }
.section--paper .nd { --nd-canvas: #f8f6f3; }
.nd-i { flex: none; width: 14px; height: 14px; }

/* toolbar */
.nd-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.nd-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 15px; color: var(--forest); }
.nd-flow { position: relative; flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--forest); }
.nd-flow::before, .nd-flow::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.nd-flow::before { left: 5px; top: 5px; }
.nd-flow::after { right: 5px; bottom: 5px; box-shadow: -7px -7px 0 -1.5px var(--green); }
.nd-ver { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.nd-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--green-text); }
.nd-on { width: 8px; height: 8px; border-radius: 50%; background: var(--green-2); }
.nd-owner { margin: 0; font-size: 13px; color: var(--ink-2); }

/* canvas: a 1000 × 390 design space scaled with container units */
.nd-canvas { padding: 18px 10px 12px; padding: clamp(14px, 2.2vw, 30px) clamp(8px, 2vw, 28px) clamp(8px, 1.4vw, 18px);
  background-color: var(--nd-canvas); background-image: radial-gradient(circle, #cbc5bc 1.1px, transparent 1.5px); background-size: 22px 22px; background-position: 11px 11px; }
.nd-space { --t: clamp(52px, 6.6cqw, 78px); position: relative; container-type: inline-size; aspect-ratio: 1000 / 390; }
.nd-svg { position: absolute; inset: 0; height: 100%; }
.nd-edge { fill: none; stroke: #7d8a80; stroke-width: 2.2; stroke-linecap: round; }
.nd-edge--alt { stroke-dasharray: 6 7; }
.nd-dot { fill: none; stroke: var(--forest); stroke-width: 11; stroke-linecap: round; stroke-dasharray: 0 2000; opacity: 0; }

.nd-nodes { list-style: none; margin: 0; padding: 0; }
.nd-node { --t: clamp(52px, 6.6cqw, 78px); position: absolute; z-index: 1; left: calc(var(--x) * .1cqw); top: calc(var(--y) * .1cqw); width: 17cqw;
  display: flex; flex-direction: column; align-items: center; text-align: center; transform: translate(-50%, calc(var(--t) / -2)); }
.nd-node--trigger { --x: 90; --y: 170; }
.nd-node--filter { --x: 285; --y: 170; }
.nd-node--enrich { --x: 480; --y: 60; }
.nd-node--hold { --x: 480; --y: 280; }
.nd-node--crm { --x: 680; --y: 170; }
.nd-node--notify { --x: 890; --y: 60; }
.nd-node--email { --x: 890; --y: 280; }

.nd-tile { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: var(--t); height: var(--t); border-radius: 26%; background: var(--white); color: var(--forest);
  box-shadow: 0 0 0 1px rgba(12, 43, 21, .1), 0 6px 16px rgba(12, 43, 21, .1); }
.nd-ic { width: 40%; height: 40%; }
/* ports */
.nd-tile::before, .nd-tile::after { content: ""; position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid #7d8a80; transform: translate(-50%, -50%); }
.nd-tile::before { left: 0; }
.nd-tile::after { left: 100%; }
.nd-node--trigger .nd-tile::before, .nd-node--hold .nd-tile::after, .nd-node--notify .nd-tile::after, .nd-node--email .nd-tile::after { display: none; }
.nd-node--trigger .nd-tile { background: var(--forest); color: var(--green); }
.nd-node--hold .nd-tile { box-shadow: none; outline: 1.5px dashed #7d8a80; background: var(--white); }
.nd-ring { position: absolute; inset: -7px; border-radius: 30%; border: 2px solid var(--green-2); opacity: 0; pointer-events: none; }
.nd-node--crm .nd-ring { border-style: dashed; border-color: var(--forest); border-radius: 50%; inset: -9px; }

.nd-txt { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; margin-top: 10px; }
.nd-kind { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--green-text); }
.nd-title { font-size: 13px; font-size: clamp(12.5px, 1.45cqw, 15px); font-weight: 600; line-height: 1.3; color: var(--forest); }
.nd-badge { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--forest); font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; }
.nd-badge .nd-i { width: 12px; height: 12px; color: var(--green); }
/* yes / no on the filter's two outputs, placed at the middle of each connector */
.nd-if { position: absolute; left: calc(50% - 9.75cqw); padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font-size: 12px; font-weight: 700; color: var(--ink); transform: translate(-50%, -50%); }
.nd-node--enrich .nd-if { top: calc(var(--t) / 2 + 5.5cqw); }
.nd-node--hold .nd-if { left: calc(50% - 7.05cqw); top: calc(var(--t) / 2 - 2.65cqw); }

/* run log */
.nd-log { padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.nd-log-h { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--green-text); }
.nd-run { font-family: var(--nd-mono); letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.nd-lgs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 32px; }
.nd-lg { display: grid; grid-template-columns: 14px auto auto minmax(0, 1fr); align-items: baseline; gap: 4px 10px; padding: 6px 4px; border-bottom: 1px dashed var(--line); font-size: 13.5px; line-height: 1.4; }
.nd-lg .nd-i { align-self: center; color: var(--green-text); }
.nd-lg-t { font-family: var(--nd-mono); font-size: 12.5px; color: var(--ink-2); }
.nd-lg-step { font-weight: 600; color: var(--forest); }
.nd-lg-msg { color: var(--ink); }
.nd-lg--retry { border-radius: 6px; border-bottom-color: transparent; background: var(--mint); }
.nd-lg--retry .nd-i { color: var(--forest); }
.nd-log-sum { display: inline-flex; align-items: center; gap: 7px; margin: 12px 0 0; font-size: 13.5px; font-weight: 600; color: var(--forest); }
.nd-log-sum .nd-i { color: var(--green-text); }
@media (min-width: 1000px) {
  .nd-lgs { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(4, auto); }
}

/* ---------- animation ---------- */
.js .vz-figure .nd-node { opacity: 0; transition: opacity .45s ease; }
.js .vz-figure .nd-tile { transform: scale(.82); transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.js .vz-figure.is-visible .nd-node { opacity: 1; }
.js .vz-figure.is-visible .nd-tile { transform: none; }
.js .vz-figure.is-visible .nd-node--filter, .js .vz-figure.is-visible .nd-node--filter .nd-tile { transition-delay: .15s; }
.js .vz-figure.is-visible .nd-node--enrich, .js .vz-figure.is-visible .nd-node--enrich .nd-tile,
.js .vz-figure.is-visible .nd-node--hold, .js .vz-figure.is-visible .nd-node--hold .nd-tile { transition-delay: .3s; }
.js .vz-figure.is-visible .nd-node--crm, .js .vz-figure.is-visible .nd-node--crm .nd-tile { transition-delay: .45s; }
.js .vz-figure.is-visible .nd-node--notify, .js .vz-figure.is-visible .nd-node--notify .nd-tile,
.js .vz-figure.is-visible .nd-node--email, .js .vz-figure.is-visible .nd-node--email .nd-tile { transition-delay: .6s; }

.js .vz-figure .nd-edge { stroke-dasharray: 400; stroke-dashoffset: 400; transition: stroke-dashoffset .55s ease; }
.js .vz-figure .nd-edge--alt { stroke-dasharray: 6 7; stroke-dashoffset: 0; opacity: 0; transition: opacity .5s ease; }
.js .vz-figure.is-visible .nd-edge { stroke-dashoffset: 0; }
.js .vz-figure.is-visible .nd-edge--alt { opacity: 1; }
.js .vz-figure.is-visible .nd-e1 { transition-delay: .2s; }
.js .vz-figure.is-visible .nd-e2, .js .vz-figure.is-visible .nd-e3 { transition-delay: .4s; }
.js .vz-figure.is-visible .nd-e4 { transition-delay: .6s; }
.js .vz-figure.is-visible .nd-e5, .js .vz-figure.is-visible .nd-e6 { transition-delay: .8s; }

.js .vz-figure .nd-lg, .js .vz-figure .nd-log-sum { opacity: 0; transform: translateY(5px); transition: opacity .35s ease, transform .35s ease; }
.js .vz-figure.is-visible .nd-lg, .js .vz-figure.is-visible .nd-log-sum { opacity: 1; transform: none; }
.js .vz-figure.is-visible .nd-lg1 { transition-delay: 1s; }
.js .vz-figure.is-visible .nd-lg2 { transition-delay: 1.12s; }
.js .vz-figure.is-visible .nd-lg3 { transition-delay: 1.24s; }
.js .vz-figure.is-visible .nd-lg4 { transition-delay: 1.36s; }
.js .vz-figure.is-visible .nd-lg5 { transition-delay: 1.75s; }
.js .vz-figure.is-visible .nd-lg6 { transition-delay: 1.87s; }
.js .vz-figure.is-visible .nd-lg7 { transition-delay: 1.99s; }
.js .vz-figure.is-visible .nd-log-sum { transition-delay: 2.2s; }

/* the run loop (7 s): the data dot travels, waits at the CRM while it retries, then splits to both outputs */
.js .vz-figure.is-visible .nd-dot--main { animation: nd-run 7s linear 1.6s infinite; }
.js .vz-figure.is-visible .nd-dot--fork { animation: nd-fork 7s linear 1.6s infinite; }
.js .vz-figure.is-visible .nd-node--crm .nd-ring { animation: nd-retry 7s linear 1.6s infinite; }
.js .vz-figure.is-visible .nd-node--crm .nd-badge { animation: nd-badge 7s ease 1.6s infinite; }
.js .vz-figure.is-visible .nd-node--trigger .nd-ring { animation: nd-hit 7s ease-out 1.6s infinite; }
.js .vz-figure.is-visible .nd-node--filter .nd-ring { animation: nd-hit 7s ease-out 2.1s infinite; }
.js .vz-figure.is-visible .nd-node--enrich .nd-ring { animation: nd-hit 7s ease-out 2.72s infinite; }
.js .vz-figure.is-visible .nd-node--notify .nd-ring, .js .vz-figure.is-visible .nd-node--email .nd-ring { animation: nd-hit 7s ease-out 6.5s infinite; }
@keyframes nd-run {
  0% { stroke-dashoffset: 0; opacity: 0; } 2% { opacity: 1; } 25% { stroke-dashoffset: -664; }
  55% { stroke-dashoffset: -664; } 70% { stroke-dashoffset: -910; opacity: 1; } 73%, 100% { stroke-dashoffset: -910; opacity: 0; }
}
@keyframes nd-fork {
  0%, 55% { stroke-dashoffset: 0; opacity: 0; } 56% { opacity: 1; } 70% { stroke-dashoffset: -245; opacity: 1; } 73%, 100% { stroke-dashoffset: -245; opacity: 0; }
}
@keyframes nd-retry { 0%, 25% { opacity: 0; transform: rotate(0); } 28% { opacity: 1; } 52% { opacity: 1; transform: rotate(240deg); } 56%, 100% { opacity: 0; transform: rotate(270deg); } }
@keyframes nd-badge { 0%, 26% { transform: none; } 30% { transform: scale(1.08); } 34%, 100% { transform: none; } }
@keyframes nd-hit { 0% { opacity: .9; transform: scale(.92); } 9% { opacity: 0; transform: scale(1.18); } 100% { opacity: 0; } }

/* ---------- phones: a vertical flow, branches indented ---------- */
@media (max-width: 699px) {
  .nd-bar { padding: 12px 14px; }
  .nd-canvas { padding: 20px 14px 16px; }
  .nd-space { aspect-ratio: auto; container-type: normal; }
  .nd-svg { display: none; }
  .nd-nodes { display: grid; gap: 18px; }
  .nd-node { --t: 48px; position: relative; left: auto; top: auto; width: auto; transform: none; display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; align-items: center; text-align: left; }
  .nd-node + .nd-node::before { content: ""; position: absolute; left: 23px; top: -18px; bottom: 50%; border-left: 2px solid #7d8a80; }
  .nd-node--branch { margin-left: 40px; }
  .nd-node--branch::before { left: -17px !important; width: 17px; border-bottom: 2px solid #7d8a80; border-bottom-left-radius: 12px; }
  .nd-node--hold::before { border-left-style: dashed; border-bottom-style: dashed; }
  .nd-node--hold::after { content: ""; position: absolute; left: -17px; top: 0; bottom: -18px; border-left: 2px solid #7d8a80; }
  .nd-tile { border-radius: 14px; }
  .nd-tile::before, .nd-tile::after { display: none; }
  .nd-txt { align-items: flex-start; margin: 0; }
  .nd-title { font-size: 14.5px; }
  .nd-if { position: static; transform: none; margin-bottom: 3px; padding: 0 8px; }
  .nd-log { padding: 14px 14px 16px; }
  .nd-lg { grid-template-columns: 14px auto minmax(0, 1fr); }
  .nd-lg-msg { grid-column: 2 / -1; }
}
