/* 2.41.0: the Visual IVR builder (public/ivr.js). Modern Calm: white cards on the page's grey, soft tinted icons, one
   accent; four step families in calm hues (say, ask, decide, end), each with its dark shade. The canvas is SVG on a dot
   grid; the editor fills the page's width and height. */
.ivr-ed, .ivr-cards, .ivr-hero, .ivr-list-head, .ivr-empty {
  --ivr-say: #1E6FD9; --ivr-ask: #7C3AED; --ivr-decide: #0D9488; --ivr-end: #D97706;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ivr-ed, :root:not([data-theme="light"]) .ivr-cards { --ivr-say: #7DB7F5; --ivr-ask: #B79CF7; --ivr-decide: #5EEAD4; --ivr-end: #FBBF24; } }
:root[data-theme="dark"] .ivr-ed, :root[data-theme="dark"] .ivr-cards { --ivr-say: #7DB7F5; --ivr-ask: #B79CF7; --ivr-decide: #5EEAD4; --ivr-end: #FBBF24; }
.c-say { --c: var(--ivr-say); } .c-ask { --c: var(--ivr-ask); } .c-decide { --c: var(--ivr-decide); } .c-end { --c: var(--ivr-end); }

/* pills, the line's number */
.ivr-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.ivr-pill.ok { background: color-mix(in srgb, var(--ok) 13%, var(--panel)); color: color-mix(in srgb, var(--ok) 80%, var(--ink)); }
.ivr-pill.wait { background: color-mix(in srgb, var(--wait) 15%, var(--panel)); color: color-mix(in srgb, var(--wait) 75%, var(--ink)); }
.ivr-pill.info { background: var(--accent-soft); color: var(--accent); }
.ivr-pill.bad { background: var(--fault-soft); color: var(--fault); }
.ivr-code { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; background: var(--panel); color: var(--ink); }
.ivr-code .ico { color: var(--accent); }

/* the tab: off, and the flows */
.ivr-hero { display: flex; gap: 18px; align-items: flex-start; padding: 24px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: 860px; }
.ivr-hero-ico, .ivr-card-ico, .ivr-empty > svg { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.ivr-hero h2 { margin: 2px 0 6px; font-size: 20px; }
.ivr-hero p { margin: 0 0 12px; color: var(--muted); line-height: 1.55; }
.ivr-hero-points { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.ivr-hero-points .ico { color: var(--ok); }
.ivr-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.ivr-list-head h2 { margin: 0 0 4px; font-size: 18px; }
.ivr-list-head p { margin: 0; }
.ivr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ivr-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ivr-card.off { opacity: .72; }
.ivr-card p { margin: 0; }
.ivr-card-head { display: flex; gap: 12px; align-items: flex-start; }
.ivr-card-ico { width: 40px; height: 40px; border-radius: 12px; }
.ivr-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ivr-card-title h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ivr-card .ivr-code { background: var(--sunk); border: 0; }
.ivr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.ivr-tpls { display: grid; gap: 8px; }
.ivr-tpl { display: flex; gap: 12px; align-items: center; text-align: start; white-space: normal; padding: 10px 12px; border-radius: 12px; }
.ivr-tpl[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--focus); }
.ivr-tpl b { display: block; }
.ivr-tpl small { display: block; color: var(--muted); font-weight: 400; }
.ivr-tpl-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }

/* the editor */
.main:has(.ivr-ed) { padding-top: 16px; padding-bottom: 16px; }
.ivr-ed { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ivr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
.ivr-back { padding: 8px; }
.ivr-title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ivr-name { font-size: 18px; font-weight: 600; border-color: transparent !important; background: transparent !important; padding: 2px 6px !important; max-width: 520px; }
.ivr-name:hover { border-color: var(--line) !important; }
.ivr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-inline-start: 6px; }
.ivr-meta .ivr-code { background: var(--sunk); padding-block: 2px; }
.ivr-save { font-size: 12px; color: var(--muted); }
.ivr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ivr-actions button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.ivr-body { display: grid; grid-template-columns: 180px minmax(0, 1fr) 340px; gap: 12px; height: calc(100vh - 210px); min-height: 560px; }
.ivr-palette { overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.ivr-pal-group { display: flex; flex-direction: column; gap: 4px; }
.ivr-pal-group h4 { margin: 0 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ivr-pal { justify-content: flex-start; gap: 8px; padding: 5px 8px; border-radius: 10px; font-weight: 400; font-size: 13.5px; border-color: transparent; background: transparent; cursor: grab; white-space: normal; text-align: start; }
.ivr-pal:hover { background: var(--sunk); border-color: var(--line); }
.ivr-pal-ico, .ivr-li-ico, .ivr-side-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--panel)); }
.ivr-pal-ico > svg, .ivr-li-ico > svg, .ivr-side-ico > svg { display: block; }

.ivr-stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ivr-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ivr-tools-canvas { display: flex; align-items: center; gap: 4px; }
.ivr-tools-canvas[hidden] { display: none; }
.ivr-tools .iconbtn, .ivr-ed .iconbtn { width: 32px; height: 32px; border-radius: 8px; }
.ivr-tools button:not(.iconbtn) { padding: 5px 10px; font-size: 13px; }
.ivr-zoom-l { min-width: 44px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ivr-viewseg { flex: none; }
.ivr-viewseg button { padding: 5px 12px; font-size: 13px; }
.ivr-canvas { position: relative; flex: 1; min-height: 0; background: color-mix(in srgb, var(--sunk) 60%, var(--panel)); }
.ivr-canvas[hidden], .ivr-steplist[hidden] { display: none; }
.ivr-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: grab; outline: none; }
.ivr-svg:active { cursor: grabbing; }
.ivr-svg:focus-visible { box-shadow: inset var(--focus); }
.ivr-dot { fill: color-mix(in srgb, var(--muted) 30%, transparent); }

/* a step on the canvas */
.ivr-node { cursor: pointer; outline: none; }
.ivr-n-box { fill: var(--panel); stroke: var(--line); stroke-width: 1.2; filter: drop-shadow(0 1px 2px rgba(15, 23, 42, .07)); }
.ivr-n-band { fill: var(--c); opacity: .85; }
.ivr-n-icobox { fill: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.ivr-n-ico { color: var(--c); }
.ivr-n-title { font-size: 13.5px; font-weight: 600; fill: var(--ink); font-family: inherit; unicode-bidi: plaintext; }
.ivr-n-sub { font-size: 12px; fill: var(--muted); font-family: inherit; unicode-bidi: plaintext; }
.ivr-n-count { font-size: 11px; font-weight: 600; fill: var(--muted); font-family: inherit; }
.ivr-n-flag.error { fill: var(--fault); }
.ivr-n-flag.warning { fill: var(--wait); }
.ivr-node:hover .ivr-n-box { stroke: color-mix(in srgb, var(--c) 55%, var(--line)); }
.ivr-node:focus-visible .ivr-n-box { stroke: var(--accent-bright); stroke-width: 3; }
.ivr-node.sel .ivr-n-box { stroke: var(--c); stroke-width: 2.2; }
.ivr-node.on .ivr-n-box { fill: color-mix(in srgb, var(--accent) 7%, var(--panel)); stroke: var(--accent); stroke-width: 2; }
.ivr-node.now .ivr-n-box { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 6 4; animation: ivr-ants 1s linear infinite; }
@keyframes ivr-ants { to { stroke-dashoffset: -20; } }
@media (prefers-reduced-motion: reduce) { .ivr-node.now .ivr-n-box { animation: none; } }
.ivr-port { cursor: crosshair; }
.ivr-port rect { fill: color-mix(in srgb, var(--c) 9%, var(--panel)); stroke: color-mix(in srgb, var(--c) 35%, var(--line)); }
.ivr-port text { font-size: 11.5px; fill: var(--ink); font-family: inherit; unicode-bidi: plaintext; pointer-events: none; }
.ivr-port.open rect { fill: var(--panel); stroke-dasharray: 3 3; stroke: color-mix(in srgb, var(--wait) 60%, var(--line)); }
.ivr-port.open.soft rect { stroke: var(--line); }
.ivr-port-dot { fill: var(--c); stroke: var(--panel); stroke-width: 1.5; }
.ivr-port:hover rect { stroke: var(--c); }
.ivr-start rect { fill: var(--ok); }
.ivr-start text { font-size: 11.5px; font-weight: 600; fill: #fff; font-family: inherit; }
.ivr-start-line { stroke: var(--ok); stroke-width: 2; }
.ivr-edge { fill: none; stroke: color-mix(in srgb, var(--muted) 55%, var(--line)); stroke-width: 1.8; }
.ivr-edge.back { stroke-dasharray: 5 4; }
.ivr-edge.open { stroke: color-mix(in srgb, var(--wait) 50%, var(--line)); stroke-dasharray: 2 3; }
.ivr-edge.on { stroke: var(--accent); stroke-width: 3; }
.ivr-arrowhead { fill: color-mix(in srgb, var(--muted) 55%, var(--line)); }
.ivr-arrowhead.on { fill: var(--accent); }
.ivr-temp { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }

/* the list of steps */
.ivr-steplist { flex: 1; overflow: auto; padding: 12px; }
.ivr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.ivr-li { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); border-inline-start: 4px solid var(--c); }
.ivr-li.on { box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent); }
.ivr-li summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.ivr-li summary::-webkit-details-marker { display: none; }
.ivr-li summary:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 12px; }
.ivr-li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ivr-li-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ivr-li-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.ivr-list-add { margin-top: 12px; max-width: 320px; }

/* the side: a step's form, the flow's, the simulator */
.ivr-side-wrap { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.ivr-side { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.ivr-side .field, .ivr-li-body .field { max-width: none; margin-bottom: 12px; }
.ivr-side-top { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.ivr-side-top > div { flex: 1; min-width: 0; }
.ivr-side-top h3 { margin: 0; font-size: 15px; }
.ivr-side-h { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 15px; }
.ivr-side-h .ico { color: var(--accent); }
.ivr-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.ivr-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; align-items: flex-start; }
.ivr-opt { display: grid; grid-template-columns: 74px minmax(0, 1fr) 32px; gap: 6px; align-items: center; width: 100%; }
.ivr-opt > select:first-child { padding-inline: 6px; }
.ivr-exits { border-top: 1px solid var(--line); padding-top: 10px; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.ivr-exits h4, .ivr-fallback h4, .ivr-line h4, .ivr-probs h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.ivr-exit { display: grid; grid-template-columns: minmax(80px, 38%) minmax(0, 1fr); gap: 8px; align-items: center; }
.ivr-exit-l { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-self: start; max-width: 100%; }
.ivr-alt { margin: -4px 0 12px; }
.ivr-alt summary { cursor: pointer; font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.ivr-week { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ivr-day { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; }
.ivr-lookat small { display: block; margin-top: 4px; }
.ivr-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--sunk); font-size: 12.5px; line-height: 1.5; margin: 0 0 12px; }
.ivr-note > svg { flex: none; margin-top: 2px; color: var(--accent); }
.ivr-note.warn { background: color-mix(in srgb, var(--wait) 12%, var(--panel)); }
.ivr-note.warn > svg { color: var(--wait); }
.ivr-step-actions { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.ivr-fallback, .ivr-line { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.ivr-fallback h4 .ico { color: var(--ok); }
.ivr-line .pbx-dp p { margin-top: 0; }
.ivr-cmd { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ivr-cmd pre { margin: 0; width: 100%; padding: 10px 12px; background: var(--sunk); border-radius: 8px; overflow-x: auto; font-size: 12px; text-align: left; }
.ivr-secret { padding: 4px 8px; border-radius: 6px; background: var(--sunk); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ivr-calls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ivr-calls li { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.ivr-probs { flex: none; max-height: 34%; overflow: auto; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.ivr-probs h4 .ivr-pill { margin-inline-start: auto; }
.ivr-plist { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ivr-plist li { display: flex; gap: 8px; align-items: flex-start; }
.ivr-plist li > svg { flex: none; margin-top: 2px; }
.ivr-plist li.error > svg { color: var(--fault); }
.ivr-plist li.warning > svg { color: var(--wait); }
.ivr-plist .linkish { border: 0; background: none; padding: 0; color: var(--ink); text-align: start; white-space: normal; font-weight: 400; display: inline; }
.ivr-plist .linkish:hover b { color: var(--accent); text-decoration: underline; }
.ivr-side-wrap.sim .ivr-probs { display: none; }

/* the simulator */
.ivr-sim-log { list-style: none; margin: 0 0 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--sunk); border-radius: 12px; max-height: 44vh; min-height: 120px; overflow: auto; }
.ivr-sim-log li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 92%; }
.ivr-sim-log li.me { align-self: flex-end; align-items: flex-end; }
.ivr-sim-log li.end { align-self: center; }
.ivr-bubble { padding: 7px 11px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; }
.ivr-sim-log li.me .ivr-bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ivr-sim-log li.k-ask .ivr-bubble { border-color: color-mix(in srgb, var(--ivr-ask) 45%, var(--line)); }
.ivr-sim-log li.k-transfer .ivr-bubble, .ivr-sim-log li.k-voicemail .ivr-bubble, .ivr-sim-log li.k-app .ivr-bubble { background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.ivr-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; max-width: 260px; margin-inline: auto; }
.ivr-keypad button { justify-content: center; font-size: 18px; font-variant-numeric: tabular-nums; padding: 10px 0; border-radius: 12px; }
.ivr-keypad button.wide { grid-column: 1 / -1; font-size: 13px; }
.ivr-whpick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ivr-whpick p { width: 100%; margin: 0; }
.ivr-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ivr-versions li { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ivr-versions li.live { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }

@media (max-width: 1280px) {
  .ivr-body { grid-template-columns: 168px minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  .ivr-body { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ivr-palette { flex-direction: row; overflow-x: auto; padding: 8px; }
  .ivr-pal-group { flex-direction: row; align-items: center; flex: none; }
  .ivr-pal-group h4 { display: none; }
  .ivr-pal { white-space: nowrap; }
  .ivr-stage { height: 64vh; min-height: 420px; }
  .ivr-stage.is-list { height: auto; min-height: 0; }
  .ivr-stage.is-list .ivr-steplist { overflow: visible; }
  .ivr-probs { max-height: none; }
}
@media (max-width: 640px) {
  .main:has(.ivr-ed) { padding-inline: 12px; }
  .ivr-top { padding: 10px; }
  .ivr-actions { width: 100%; }
  .ivr-actions button { flex: 1 1 auto; justify-content: center; padding-inline: 10px; }
  .ivr-two { grid-template-columns: 1fr; }
  .ivr-hero { flex-direction: column; padding: 18px; }
  .ivr-cards { grid-template-columns: minmax(0, 1fr); }
  .ivr-opt { grid-template-columns: 64px minmax(0, 1fr) 32px; }
}
