/* Diagrama de flujo de llamadas (web pública y vista previa del panel). */
.flow-canvas { overflow-x: auto; padding: 1.25rem 1rem 1.5rem; background:
  radial-gradient(circle at 1px 1px, rgba(21, 59, 100, .12) 1px, transparent 0) 0 0 / 20px 20px, var(--surface-2); }
.fl-diagram { width: max-content; min-width: 100%; margin: 0 auto; }
.fl-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center; }
.fl-node { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 24px; width: 100%; }
.fl-node::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 24px; margin-left: -1px; background: var(--line-strong); }
.fl-diagram > .fl-steps > .fl-node:first-child { padding-top: 0; }
.fl-diagram > .fl-steps > .fl-node:first-child::before { display: none; }
.fl-card { --tone: var(--dt-navy); position: relative; z-index: 1; width: 300px; max-width: 100%; display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--tone); border-radius: 10px; box-shadow: var(--shadow-1); text-align: left; }
.fl-ic { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--tone) 12%, transparent); color: var(--tone); }
.fl-body { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.fl-kind { font: 700 .62rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fl-body b { font-weight: 650; font-size: .9rem; line-height: 1.25; }
.fl-meta { font: .7rem var(--font-mono); color: var(--tone); }
.fl-text { font-size: .8rem; color: var(--ink-2); line-height: 1.35; }
.fl-text::before { content: "«"; } .fl-text::after { content: "»"; }
.is-edit { border-bottom: 1px dashed var(--line-strong); cursor: text; border-radius: 3px; outline: none; }
.is-edit:hover { background: rgba(255, 86, 64, .06); }
.is-edit:focus { background: #fff; box-shadow: 0 0 0 2px rgba(21, 59, 100, .25); border-bottom-color: transparent; }
.is-edit:empty::before { content: "escribe aquí"; color: var(--muted); }
.fl-text.is-edit:empty::before { content: "escribe aquí"; }
.t-horario > .fl-card, .t-movil > .fl-card, .t-cita > .fl-card, .t-pago > .fl-card { --tone: var(--dt-teal); }
.t-ia > .fl-card, .t-grabacion > .fl-card, .t-llamada > .fl-card { --tone: var(--dt-coral-deep); }
.t-whatsapp > .fl-card, .t-plantilla > .fl-card { --tone: #1E8E5A; }
.t-buzon > .fl-card, .t-fin > .fl-card, .t-encuesta > .fl-card, .t-mensaje > .fl-card, .t-crm > .fl-card, .t-etiqueta > .fl-card, .t-espera > .fl-card, .t-email > .fl-card { --tone: #5B6B82; }
.fl-node.is-off > .fl-card { opacity: .55; border-style: dashed; border-left-style: dashed; box-shadow: none; background: var(--surface-2); }
.fl-node.is-off > .fl-card .fl-body b { text-decoration: line-through; text-decoration-color: rgba(14, 27, 46, .35); }

.fl-switch { position: relative; flex: 0 0 auto; display: inline-flex; margin: .1rem 0 0 .2rem; cursor: pointer; }
.fl-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fl-switch span { width: 34px; height: 20px; border-radius: 20px; background: var(--line-strong); position: relative; transition: background .15s ease; }
.fl-switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s ease; }
.fl-switch input:checked + span { background: var(--dt-teal); }
.fl-switch input:checked + span::after { transform: translateX(14px); }
.fl-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(21, 59, 100, .3); }
.fl-switch input:disabled + span { opacity: .6; }
.fl-switch.sm span { width: 28px; height: 16px; } .fl-switch.sm span::after { width: 12px; height: 12px; } .fl-switch.sm input:checked + span::after { transform: translateX(12px); }

.fl-branches { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(200px, auto)); justify-content: center; width: 100%; margin-top: 24px; }
.fl-branches::before { content: ""; position: absolute; top: -24px; left: 50%; width: 2px; height: 24px; margin-left: -1px; background: var(--line-strong); }
.fl-branch { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 8px; }
.fl-branch::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--line-strong); }
.fl-branch:first-of-type::before { left: 50%; }
.fl-branch:last-of-type::before { right: 50%; }
.fl-branch:only-of-type::before { display: none; }
.fl-branch::after { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 14px; margin-left: -1px; background: var(--line-strong); }
.fl-blabel { position: relative; z-index: 1; margin-top: 14px; display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .25rem .55rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.fl-blabel kbd { font: 700 .7rem var(--font-mono); background: var(--dt-navy); color: #fff; border-radius: 4px; padding: .1rem .35rem; }
.fl-blabel > span { min-width: 2ch; }
.fl-branch.is-off .fl-blabel { opacity: .55; border-style: dashed; }
.fl-x { border: 0; background: transparent; color: var(--muted); padding: 0 .1rem; line-height: 1; }
.fl-x:hover { color: var(--dt-coral-deep); }
.fl-add { grid-column: 1 / -1; justify-self: center; margin-top: 14px; border: 1px dashed var(--line-strong); background: var(--surface); border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; color: var(--ink-2); }
.fl-add:hover { border-color: var(--dt-navy); color: var(--dt-navy); }
.fl-steps.is-empty { padding-top: 24px; position: relative; }
.fl-steps.is-empty::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 24px; margin-left: -1px; background: var(--line-strong); }
.fl-end { font: .7rem var(--font-mono); color: var(--muted); }

.flow-lines { list-style: none; margin: 0; padding: 1rem 1.2rem; display: grid; gap: .15rem; font-size: .88rem; color: var(--ink-2); }
.flow-lines li { padding-left: calc(var(--d, 0) * 1.1rem); }
.flow-story summary { cursor: pointer; list-style: none; }
.flow-story summary::-webkit-details-marker { display: none; }

.fl-addstep { position: relative; list-style: none; display: flex; flex-direction: column; align-items: center; padding-top: 14px; }
.fl-addstep::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 14px; margin-left: -1px; background: repeating-linear-gradient(to bottom, var(--line-strong) 0 3px, transparent 3px 6px); }
.fl-addstep .fl-add { margin-top: 0; opacity: .75; }
.fl-addstep:hover .fl-add, .fl-addstep .fl-add:focus-visible { opacity: 1; }
.fl-palette { position: absolute; z-index: 20; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 340px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-2); }
.fl-palette[hidden] { display: none; }
.fl-palette button { display: flex; gap: .4rem; align-items: center; text-align: left; border: 0; background: transparent; padding: .4rem .5rem; border-radius: 6px; font-size: .8rem; color: var(--ink-2); }
.fl-palette button:hover { background: var(--surface-2); color: var(--dt-navy); }
.fl-palette .bi { color: var(--dt-coral-deep); }
.fl-node.is-extra > .fl-card { border-style: dashed; border-left-style: solid; background: linear-gradient(180deg, #fff, #FFF8F6); }
.fl-node.is-extra .fl-kind { color: var(--dt-coral-ink); }
.t-crm > .fl-card, .t-calendario > .fl-card, .t-webhook > .fl-card { --tone: #5B3FA8; }
.t-email > .fl-card, .t-sms > .fl-card { --tone: #1F6B9A; }
@media (max-width: 767.98px) {
  .flow-canvas { padding: 1rem .6rem; }
  .fl-diagram { width: auto; }
  .fl-steps { align-items: stretch; }
  .fl-node { align-items: stretch; padding-top: 14px; }
  .fl-node::before { left: 16px; height: 14px; }
  .fl-card { width: 100%; }
  .fl-branches { display: block; margin: 10px 0 0 14px; }
  .fl-branches::before { left: 2px; top: -10px; height: 10px; }
  .fl-branch { align-items: stretch; padding: 0 0 0 12px; border-left: 2px solid var(--line-strong); }
  .fl-branch::before, .fl-branch::after { display: none; }
  .fl-blabel { margin-top: 10px; align-self: flex-start; }
  .fl-add { margin: 10px 0 0 12px; }
  .fl-addstep { align-items: flex-start; padding-left: 0; } .fl-addstep::before { left: 16px; }
  .fl-addstep .fl-add { margin: 0 0 0 4px; }
  .fl-palette { left: 0; transform: none; width: min(320px, 86vw); grid-template-columns: 1fr; }
  .fl-steps.is-empty { padding-top: 6px; } .fl-steps.is-empty::before { display: none; }
}

/* Lienzo con zoom y mano (≥ 768 px) */
.fl-vp-host { position: relative; }
.flow-canvas.is-vp { position: relative; overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.flow-canvas.is-vp.is-grabbing { cursor: grabbing; }
.flow-canvas.is-vp .fl-diagram { position: absolute; left: 0; top: 0; min-width: 0; margin: 0; transform-origin: 0 0; will-change: transform; }
.flow-canvas.is-vp [contenteditable="true"] { user-select: text; cursor: text; }
.fl-zoom { position: absolute; right: .75rem; bottom: .75rem; z-index: 5; display: flex; align-items: center; gap: .15rem;
  padding: .2rem; border: 1px solid var(--line, rgba(21,59,100,.15)); border-radius: 10px; background: var(--surface, #fff);
  box-shadow: 0 6px 18px rgba(21, 59, 100, .12); font: 500 .78rem/1 var(--font-mono, ui-monospace, monospace); }
.fl-zoom[hidden] { display: none; }
.fl-zoom button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 7px; color: var(--ink, #153B64); }
.fl-zoom button:hover, .fl-zoom button:focus-visible { background: var(--surface-2, #f2f5f9); color: var(--dt-coral); }
.fl-zoom-pct { min-width: 3.4rem; text-align: center; color: var(--muted, #5b6b7d); }
.fl-zoom-hint { padding: 0 .5rem 0 .35rem; border-left: 1px solid var(--line, rgba(21,59,100,.15)); color: var(--muted, #5b6b7d); white-space: nowrap; }
@media (max-width: 991.98px) { .fl-zoom-hint { display: none; } }

/* Más color en los textos: diagrama y «así funcionará» */
.fl-kind { color: var(--tone); }
.fl-body b { color: var(--dt-navy-deep, var(--ink)); }
.fl-text { color: var(--ink-2); }
.fl-text::before, .fl-text::after { color: var(--dt-coral); font-weight: 700; }
.fl-blabel { color: var(--dt-navy); }
.fl-blabel > i { color: var(--dt-teal); }
.fl-blabel kbd { background: var(--dt-coral-deep); }
.flow-lines li { position: relative; }
.flow-lines li.is-top::before { content: "›"; position: absolute; left: -.85rem; color: var(--dt-coral); font-weight: 700; }
.ln-title { color: var(--dt-navy); font-weight: 600; }
.ln-who { color: var(--dt-teal); font: 600 .8em var(--font-mono); }
.ln-sep { color: var(--muted); }
.ln-quote { color: var(--dt-coral-ink); font-style: italic; }
.ln-branch { color: var(--dt-teal); font: 600 .8em/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.fe-preview ~ .fl-zoom .fl-zoom-hint { display: none; }

/* ── Diseñador único: capas, por qué lo necesita tu sector y ventajas ─────── */
.layer-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .4rem; }
@media (max-width: 575.98px) { .layer-pick { grid-template-columns: minmax(0, 1fr); } }
.layer-opt { position: relative; cursor: pointer; }
.layer-opt input { position: absolute; opacity: 0; inset: 0; }
.layer-opt__box { display: grid; grid-template-columns: auto 1fr; gap: .1rem .55rem; align-items: center; height: 100%; padding: .7rem .85rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, background .2s, box-shadow .2s; }
.layer-opt__box > .bi { grid-row: span 2; font-size: 1.3rem; color: var(--muted); }
.layer-opt__box small { grid-column: 2; color: var(--muted); font-size: .78rem; }
.layer-opt input:checked + .layer-opt__box { border-color: var(--dt-navy); background: #F3F7FC; box-shadow: 0 0 0 3px rgba(21, 59, 100, .08); }
.layer-opt input:checked + .layer-opt__box > .bi { color: var(--dt-coral); }
.layer-opt[data-layer-opt="ai"] input:checked + .layer-opt__box { border-color: #5B3FA8; background: #F6F3FC; }
.layer-opt[data-layer-opt="ai"] input:checked + .layer-opt__box > .bi { color: #5B3FA8; }
.layer-opt input:focus-visible + .layer-opt__box { outline: 2px solid var(--dt-coral); outline-offset: 2px; }
.layer-opt.is-off { opacity: .5; cursor: not-allowed; }

.why-band { display: flex; gap: 1.1rem; align-items: flex-start; margin-bottom: 1.5rem; padding: 1.3rem 1.4rem; border-radius: var(--radius-lg); background: linear-gradient(120deg, #FFF4F1, #F3F7FC 70%); border: 1px solid rgba(255, 86, 64, .2); }
.why-band__icon { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; background: #fff; color: var(--dt-coral); box-shadow: var(--shadow-1); }
.why-band h2 { color: var(--dt-navy); }
.why-band__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.why-band__list li { display: flex; gap: .45rem; font-size: .93rem; color: var(--ink-2); }
.why-band__list .bi { color: var(--dt-teal); margin-top: .1rem; }
@media (max-width: 575.98px) { .why-band { flex-direction: column; } }

.flow-layer--ai > .code-card__bar .bi { color: #5B3FA8; }
.flow-layer--calls > .code-card__bar .bi { color: var(--dt-coral); }
.flow-layer > .code-card__bar .bi { margin-right: .35rem; }
.flow-lines li.is-section { margin: .6rem 0 .2rem; font: 700 .72rem var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--dt-teal); list-style: none; }
.flow-lines li.is-section:first-child { margin-top: 0; }

.gain-count { margin: .3rem 0 .6rem; color: var(--ink-2); }
.gain-count b { font: 800 1.9rem/1 var(--font-sans); color: var(--dt-coral); margin-right: .2rem; vertical-align: -3px; }
.gain-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .45rem; max-height: 420px; overflow: auto; }
.gain-list li { display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; line-height: 1.35; animation: gain-in .35s ease both; }
.gain-list .bi { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: #F3F7FC; color: var(--dt-navy); font-size: .85rem; }
.gain-list li.is-ai .bi { background: #F6F3FC; color: #5B3FA8; }
@keyframes gain-in { from { opacity: 0; transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .gain-list li { animation: none; } }
