/* SAMP Dental Workflows — Default Black Noir theme matching the application shell, switchable to Light mode */
#v-workflows,
#v-workflows.wf-theme-dark {
  --wf-bg: #0b0c0e;
  --wf-surface: #141517;
  --wf-surface-2: #191a1d;
  --wf-surface-3: #222328;
  --wf-border: #24262b;
  --wf-border-subtle: #1c1d22;
  --wf-border-hover: #38bdf8;
  --wf-text: #f2f3f5;
  --wf-secondary: #b7bac1;
  --wf-muted: #858991;
  --wf-teal: #0d9488;
  --wf-teal-soft: rgba(13, 148, 136, 0.18);
  --wf-navy: #191a1d;
  --wf-card-bg: #141517;
  --wf-card-shadow: 0 1px 3px rgba(0,0,0,.35), 0 14px 30px -12px rgba(0,0,0,.6);
  --wf-input-bg: #101113;
  --wf-toolbar-bg: rgba(20, 21, 23, 0.94);
  --wf-popover-bg: #18191d;
  --wf-popover-border: #2c2e36;
  --wf-popover-shadow: 0 16px 36px rgba(0,0,0,.5);
  --wf-node-bg: #16171b;
  --wf-node-border: #2c2e36;
  --wf-node-text: #f2f3f5;
  --wf-canvas-bg: #0b0c0e;
  --wf-grid-color: rgba(255, 255, 255, 0.03);
  --wf-grid-major: rgba(255, 255, 255, 0.075);
  min-height: calc(100vh - 120px);
  margin: -22px -24px -72px;
  padding: 28px 28px 76px;
  background: var(--wf-bg);
  color: var(--wf-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color .2s ease, color .2s ease;
}

#v-workflows.wf-theme-light {
  --wf-bg: #f6f8fa;
  --wf-surface: #ffffff;
  --wf-surface-2: #f1f5f9;
  --wf-surface-3: #e2e8f0;
  --wf-border: #e2e8f0;
  --wf-border-subtle: #f1f5f9;
  --wf-border-hover: #99f6e4;
  --wf-text: #0f172a;
  --wf-secondary: #334155;
  --wf-muted: #64748b;
  --wf-teal: #0d9488;
  --wf-teal-soft: #ccfbf1;
  --wf-navy: #0f2a33;
  --wf-card-bg: #ffffff;
  --wf-card-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 24px -14px rgba(15,23,42,.10);
  --wf-input-bg: #ffffff;
  --wf-toolbar-bg: rgba(255, 255, 255, 0.98);
  --wf-popover-bg: #ffffff;
  --wf-popover-border: #e2e8f0;
  --wf-popover-shadow: 0 12px 30px rgba(15,23,42,.15);
  --wf-node-bg: #ffffff;
  --wf-node-border: #cbd5e1;
  --wf-node-text: #0f172a;
  --wf-canvas-bg: #ffffff;
  --wf-grid-color: rgba(15, 23, 42, 0.035);
  --wf-grid-major: rgba(15, 23, 42, 0.08);
}

/* Workflows behaves like its own app surface: the CRM sidebar remains visible,
   while the editor owns the complete viewport instead of extending the page. */
body.workflows-mode { overflow: hidden; }
body.workflows-mode .main { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.workflows-mode .topbar,
body.workflows-mode .main > .toolbar,
body.workflows-mode #btn-ai-fab,
body.workflows-mode #ai-drawer { display: none !important; }
body.workflows-mode .content {
  width: 100% !important;
  max-width: none !important;
  min-height: 0;
  flex: 1;
  padding: 0 !important;
  overflow: hidden !important;
}
body.workflows-mode .content > .view:not(#v-workflows) { display: none !important; }
body.workflows-mode #v-workflows.on {
  display: flex !important;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 !important; /* Full edge-to-edge Miro canvas */
  flex-direction: column;
  overflow: hidden;
}

/* Modo Pizarrón Miro (Oculta la barra lateral para máxima perspectiva de lienzo) */
body.wf-miro-zen .side,
body.wf-miro-zen #side-backdrop {
  display: none !important;
  transform: translateX(-100%) !important;
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
body.wf-miro-zen .main {
  margin-left: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  transition: margin-left 0.2s ease, width 0.2s ease !important;
}

body.workflows-mode .wf-library {
  width: 100%;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.workflows-mode .wf-editor {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none !important;
  margin: 0 !important;
  flex-direction: column;
}
body.workflows-mode .wf-editor[hidden],
body.workflows-mode .wf-library[hidden] { display: none !important; }
body.workflows-mode .wf-editor-head { flex: 0 0 auto; }
body.workflows-mode .wf-editor > .wf-tab-panel.is-active {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}
body.workflows-mode .wf-editor > .wf-tab-panel[data-wf-panel="editor"].is-active { overflow: hidden; }
body.workflows-mode .wf-builder-shell { height: 100%; min-height: 0; }

#v-workflows *, #v-workflows *::before, #v-workflows *::after { box-sizing: border-box; }
#v-workflows button, #v-workflows input, #v-workflows textarea { font: inherit; }
#v-workflows button:focus-visible, #v-workflows input:focus-visible, #v-workflows textarea:focus-visible, #v-workflows [tabindex]:focus-visible { outline: 3px solid rgba(13, 148, 136, .26); outline-offset: 2px; }
#v-workflows svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wf-library { max-width: 1280px; margin: 0 auto; }
.wf-library-head, .wf-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wf-library-head { margin-bottom: 22px; }
.wf-library-head h2 { margin: 4px 0 6px; color: var(--wf-text); font-size: 28px; line-height: 1.15; letter-spacing: -.025em; }
.wf-library-head p { max-width: 680px; margin: 0; color: var(--wf-muted); font-size: 14px; }
.wf-eyebrow { color: #2dd4bf; font-size: 11px; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
#v-workflows.wf-theme-light .wf-eyebrow { color: #0f766e; }

.wf-button, .wf-icon-button, .wf-zoom-button {
  min-height: 42px; border: 1px solid var(--wf-border); border-radius: 10px; background: var(--wf-surface); color: var(--wf-secondary); cursor: pointer;
  transition: all .14s ease;
}
.wf-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; font-size: 13.5px; font-weight: 650; white-space: nowrap; }
.wf-button svg { width: 17px !important; height: 17px !important; }
.wf-button-primary { border-color: var(--wf-teal); background: var(--wf-teal); color: #fff; box-shadow: 0 6px 18px -10px rgba(13, 148, 136, .7); }
.wf-button-primary:hover { background: #0f766e; }
.wf-button-danger { border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.wf-button-danger:hover { border-color: #ef4444; background: #ef4444; color: #fff !important; box-shadow: 0 4px 14px -4px rgba(239, 68, 68, 0.6); }
.wf-button-secondary:hover, .wf-icon-button:hover, .wf-zoom-button:hover { border-color: var(--wf-border-hover); color: var(--wf-text); background: var(--wf-surface-2); }
.wf-icon-button { display: grid; width: 42px; padding: 0; place-items: center; }
.wf-icon-button svg { width: 18px !important; height: 18px !important; }
.wf-icon-button:disabled { opacity: .38; cursor: default; }

.wf-kind-callout { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; padding: 15px 17px; border: 1px solid rgba(13, 148, 136, 0.32); border-radius: 14px; background: rgba(13, 148, 136, 0.08); }
#v-workflows.wf-theme-light .wf-kind-callout { border-color: #99f6e4; background: #f0fdfa; }
.wf-kind-callout > svg { flex: 0 0 auto; color: #2dd4bf; }
#v-workflows.wf-theme-light .wf-kind-callout > svg { color: var(--wf-teal); }
.wf-kind-callout div { display: flex; flex-direction: column; gap: 3px; }
.wf-kind-callout strong { color: var(--wf-text); font-size: 13.5px; }
.wf-kind-callout span { color: var(--wf-muted); font-size: 13px; line-height: 1.5; }

.wf-library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.wf-segmented { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--wf-border); border-radius: 12px; background: var(--wf-surface); }
.wf-segmented button, .wf-tabs button, .wf-inspector-tabs button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--wf-muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.wf-segmented button.is-active { background: var(--wf-teal-soft); color: #2dd4bf; }
#v-workflows.wf-theme-light .wf-segmented button.is-active { color: #0f766e; }
.wf-search { position: relative; display: flex; width: 280px; align-items: center; }
.wf-search svg { position: absolute; left: 12px; width: 17px !important; height: 17px !important; color: var(--wf-muted); }
.wf-search input { width: 100%; min-height: 44px; padding: 9px 12px 9px 40px; border: 1px solid var(--wf-border); border-radius: 12px; background: var(--wf-input-bg); color: var(--wf-text); font-size: 13.5px; }

.wf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.wf-card { min-height: 210px; padding: 18px; border: 1px solid var(--wf-border); border-radius: 16px; background: var(--wf-card-bg); box-shadow: var(--wf-card-shadow); cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.wf-card:hover { transform: translateY(-2px); border-color: var(--wf-teal); box-shadow: 0 4px 22px -8px rgba(13,148,136,.4); }
.wf-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.wf-card-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--wf-teal-soft); color: #2dd4bf; }
#v-workflows.wf-theme-light .wf-card-icon { color: #0f766e; }
.wf-card[data-kind="bpmn"] .wf-card-icon { background: rgba(2, 132, 199, 0.15); color: #38bdf8; }
#v-workflows.wf-theme-light .wf-card[data-kind="bpmn"] .wf-card-icon { background: #e0f2fe; color: #0369a1; }
.wf-card h3 { margin: 25px 0 7px; color: var(--wf-text); font-size: 16px; letter-spacing: -.015em; }
.wf-card p { min-height: 42px; margin: 0; color: var(--wf-muted); font-size: 12.5px; line-height: 1.55; }
.wf-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--wf-border); color: var(--wf-muted); font-size: 11.5px; }
.wf-type-badge, .wf-status-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--wf-teal-soft); color: #2dd4bf; font-size: 10.5px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
#v-workflows.wf-theme-light .wf-type-badge, #v-workflows.wf-theme-light .wf-status-chip { color: #0f766e; }
.wf-type-badge.is-bpmn { background: rgba(2, 132, 199, 0.15); color: #38bdf8; }
#v-workflows.wf-theme-light .wf-type-badge.is-bpmn { background: #e0f2fe; color: #0369a1; }
.wf-card-actions { display: inline-flex; align-items: center; gap: 8px; }
.wf-card-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--wf-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--wf-muted);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  flex-shrink: 0;
}
.wf-card-trash svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: block;
}
.wf-card-trash:hover {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: scale(1.1);
}
.wf-card-trash:active {
  transform: scale(0.95);
}
#v-workflows.wf-theme-light .wf-card-trash {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}
#v-workflows.wf-theme-light .wf-card-trash:hover {
  color: #dc2626 !important;
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
}
.wf-empty-library { grid-column: 1/-1; padding: 60px 20px; border: 1px dashed var(--wf-border); border-radius: 16px; background: var(--wf-surface); text-align: center; }
.wf-empty-library strong { display: block; margin-bottom: 6px; font-size: 17px; color: var(--wf-text); }
.wf-empty-library span { color: var(--wf-muted); font-size: 13px; }

.wf-editor { width: 100%; height: 100%; max-width: 100% !important; margin: 0 !important; }
.wf-editor[hidden], .wf-library[hidden] { display: none !important; }
.wf-editor-head { min-height: 52px; height: 52px; margin: 0; padding: 0 16px; border-bottom: 1px solid var(--wf-border); background: var(--wf-surface); z-index: 20; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.wf-editor-head::-webkit-scrollbar { display: none; }
.wf-editor-head .wf-button { min-height: 36px; padding: 6px 12px; font-size: 12.5px; }
.wf-title-block { min-width: 180px; flex: 1; }
.wf-title-block input { display: block; width: min(100%, 340px); padding: 4px 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--wf-text); font-size: 16px; font-weight: 720; }
.wf-title-block input:hover, .wf-title-block input:focus { border-color: var(--wf-border); background: var(--wf-surface-2); }
.wf-title-block > div { display: flex; align-items: center; gap: 8px; margin: 2px 0 0 4px; }
#wf-save-state { color: var(--wf-muted); font-size: 11px; }
.wf-tabs { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--wf-border); border-radius: 10px; background: var(--wf-surface); }
.wf-tabs button.is-active { background: var(--wf-teal); color: #fff; }
.wf-tab-panel { display: none; }
.wf-tab-panel.is-active { display: block; }

.wf-builder-shell {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 0px;
  height: calc(100vh - 52px);
  min-height: 0;
  overflow: hidden;
  border: none !important;
  border-radius: 0 !important;
  background: var(--wf-surface);
  box-shadow: none !important;
  transition: grid-template-columns .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.wf-builder-shell.is-inspector-open {
  grid-template-columns: 1fr var(--wf-inspector-width, 320px);
}

.wf-palette {
  position: absolute;
  top: 68px;
  left: 16px;
  z-index: 25;
  width: 52px;
  max-height: calc(100% - 84px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border: 1px solid var(--wf-border);
  border-radius: 14px;
  background: var(--wf-toolbar-bg, rgba(20, 21, 25, 0.92));
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.35), 0 3px 8px -2px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.wf-palette::-webkit-scrollbar {
  display: none;
}
#v-workflows.wf-theme-light .wf-palette {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.12), 0 2px 6px -1px rgba(15, 23, 42, 0.06);
}

.wf-inspector {
  grid-column: 2;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  border-left: none;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--wf-surface);
  transition: opacity 0.18s ease;
}
.wf-builder-shell.is-inspector-open .wf-inspector {
  border-left: 1px solid var(--wf-border);
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
}

.wf-inspector-close-btn {
  width: 28px !important;
  min-height: 28px !important;
  height: 28px !important;
  margin-left: auto;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--wf-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
}
.wf-inspector-close-btn:hover {
  background: var(--wf-surface-2);
  color: var(--wf-text);
  border-color: var(--wf-border);
}

.wf-inspector-resizer { position: absolute; top: 0; left: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 12; user-select: none; touch-action: none; transition: background-color 0.15s ease; }
.wf-inspector-resizer:hover, .wf-inspector-resizer.is-resizing { background: rgba(99, 102, 241, 0.45); }
body.is-resizing-inspector, body.is-resizing-inspector * { cursor: col-resize !important; user-select: none !important; }
body.is-resizing-inspector .wf-builder-shell { transition: none !important; }
.wf-panel-title { color: var(--wf-text); font-size: 13.5px; font-weight: 750; }
.wf-palette .wf-panel-title { width: 100%; margin: 1px 0 11px; color: var(--wf-muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.wf-palette > p { display: none; }
#wf-palette-list { display: grid; width: 100%; justify-items: center; gap: 5px; }
.wf-palette-item { display: grid; width: 44px; min-height: 44px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 10px; background: var(--wf-surface); color: var(--wf-secondary); cursor: grab; user-select: none; }
.wf-palette-item:hover, .wf-palette-item:focus-visible { border-color: var(--wf-border-hover); background: var(--wf-surface-2); color: #2dd4bf; }
.wf-palette-item:active { cursor: grabbing; transform: translateY(1px); }
.wf-palette-item span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: var(--wf-surface-2); color: inherit; }
.wf-palette-item:hover span, .wf-palette-item:focus-visible span { background: var(--wf-teal-soft); }
.wf-palette-item svg { width: 18px !important; height: 18px !important; }
.wf-palette-item > div { display: none; }
.wf-palette-help { display: grid; width: 44px; height: 44px; margin-top: 14px; place-items: center; border-top: 1px solid var(--wf-border); color: var(--wf-muted); cursor: help; }
.wf-palette-help svg { width: 19px !important; height: 19px !important; }
.wf-palette-help strong, .wf-palette-help span { display: none; }

.wf-canvas-wrap { grid-column: 1; position: relative; width: 100%; height: 100%; min-width: 0; overflow: hidden; background: var(--wf-bg); }
.wf-canvas-toolbar { position: absolute; z-index: 20; top: 12px; left: 50%; display: flex; align-items: center; gap: 3px; padding: 4px 6px; transform: translateX(-50%); border: 1px solid var(--wf-border); border-radius: 12px; background: var(--wf-toolbar-bg); backdrop-filter: blur(8px); box-shadow: var(--wf-card-shadow); max-width: calc(100% - 24px); overflow-x: auto; }
.wf-canvas-toolbar .wf-icon-button, .wf-zoom-button { width: 32px; min-height: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; color: var(--wf-secondary); padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s ease; flex-shrink: 0; }
.wf-canvas-toolbar .wf-icon-button:hover, .wf-zoom-button:hover { background: var(--wf-surface-2); color: var(--wf-text); }
.wf-canvas-toolbar .wf-icon-button.is-active { color: #ffffff !important; background: #0284c7 !important; border-color: #0369a1; box-shadow: 0 1px 3px rgba(2,132,199,.3); }
.wf-canvas-toolbar .wf-icon-button#wf-tool-lock.is-locked { background: #fef3c7 !important; color: #b45309 !important; border-color: #fde68a !important; }
.wf-toolbar-divider { width: 1px; height: 18px; margin: 0 2px; background: var(--wf-border); flex-shrink: 0; }
#wf-zoom-label { min-width: 38px; color: var(--wf-secondary); font-size: 11px; text-align: center; flex-shrink: 0; user-select: none; }

/* Whiteboard / Excalidraw Style Popover */
.wf-style-popover { position: absolute; z-index: 22; top: 54px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: var(--wf-popover-bg); border: 1px solid var(--wf-popover-border); box-shadow: var(--wf-popover-shadow); animation: wfGhostIn .14s cubic-bezier(.16,1,.3,1) both; }
.wf-style-popover[hidden] { display: none !important; }
.wf-style-group { display: inline-flex; align-items: center; gap: 4px; }
.wf-style-label { font-size: 10px; font-weight: 700; color: var(--wf-muted); text-transform: uppercase; margin-right: 2px; user-select: none; }
.wf-style-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 11px; font-weight: 600; font-family: inherit; border: 1px solid var(--wf-border); border-radius: 6px; background: var(--wf-surface-2); color: var(--wf-secondary); cursor: pointer; transition: all .12s ease; }
.wf-style-btn:hover { background: var(--wf-surface-3); border-color: var(--wf-border-hover); color: var(--wf-text); }
.wf-style-btn.is-active { background: #0284c7; color: #ffffff; border-color: #0369a1; }
.wf-style-divider { width: 1px; height: 18px; background: var(--wf-border); margin: 0 2px; }
.wf-style-size { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid var(--wf-border); border-radius: 6px; background: var(--wf-surface-2); color: var(--wf-secondary); cursor: pointer; transition: all .12s ease; }
.wf-style-size:hover { background: var(--wf-surface-3); border-color: var(--wf-border-hover); color: var(--wf-text); }
.wf-style-size.is-active { background: #0284c7; color: #ffffff; border-color: #0369a1; }
.wf-color-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2px solid var(--wf-surface); box-shadow: 0 0 0 1px rgba(0,0,0,.3); cursor: pointer; transition: transform .12s ease; padding: 0; }
.wf-color-dot:hover { transform: scale(1.18); }
.wf-color-dot.is-active { box-shadow: 0 0 0 2px #0284c7, 0 2px 6px rgba(0,0,0,.35); transform: scale(1.18); }

/* Drawings Layers */
.wf-drawings-svg { position: absolute; inset: 0; width: 2400px !important; height: 1600px !important; pointer-events: none; overflow: visible; z-index: 5; }
.wf-drawings-html { position: absolute; inset: 0; width: 2400px; height: 1600px; pointer-events: none; z-index: 6; }
.wf-drawing-item { pointer-events: auto; }
.wf-canvas.tool-eraser .wf-drawing-item { cursor: pointer; }
.wf-canvas.tool-eraser .wf-drawing-item:hover { opacity: .45 !important; }
.wf-drawing-shape { stroke-linecap: round; stroke-linejoin: round; transition: stroke .1s ease, fill .1s ease; }
.wf-drawing-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wf-drawing-stroke.is-highlighter { opacity: .42; stroke-linecap: square; }
.wf-drawing-arrow { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Selection on drawing items */
.wf-drawing-item.is-selected .wf-drawing-shape,
.wf-drawing-item.is-selected .wf-drawing-stroke,
.wf-drawing-item.is-selected .wf-drawing-arrow {
  filter: drop-shadow(0 0 4px rgba(2, 132, 199, 0.7));
}
.wf-drawing-selection-box {
  fill: none;
  stroke: #0284c7;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

/* Floating Text in Whiteboard */
.wf-draw-text { position: absolute; min-width: 80px; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; font-weight: 550; color: #1e293b; background: transparent; outline: none; border: 1.5px dashed transparent; padding: 6px 10px; border-radius: 6px; pointer-events: auto; user-select: text; white-space: pre-wrap; word-break: break-word; cursor: text; transition: border-color .12s ease, background-color .12s ease; }
.wf-draw-text:hover { border-color: #94a3b8; background: rgba(255,255,255,.8); }
.wf-draw-text:focus, .wf-draw-text.is-selected { border-color: #0284c7; background: rgba(255,255,255,.96); box-shadow: 0 0 0 3px rgba(2,132,199,.18); }
.wf-draw-text:empty::before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }
.wf-canvas.canvas-dark .wf-draw-text { color: #f1f5f9; }
.wf-canvas.canvas-dark .wf-draw-text:hover { border-color: #475569; background: rgba(30, 32, 38, 0.8); }
.wf-canvas.canvas-dark .wf-draw-text:focus, .wf-canvas.canvas-dark .wf-draw-text.is-selected { border-color: #38bdf8; background: rgba(24, 25, 28, 0.96); box-shadow: 0 0 0 3px rgba(56,189,248,.2); }
.wf-canvas.canvas-dark .wf-draw-text:empty::before { color: #64748b; }

/* Integrated Text in Shapes */
.wf-shape-text { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: auto; padding: 10px 14px; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; font-weight: 550; outline: none; user-select: text; white-space: pre-wrap; word-break: break-word; cursor: text; border-radius: 6px; border: 1.5px dashed transparent; transition: border-color .12s ease, background-color .12s ease; overflow: visible; }
.wf-shape-text:hover { border-color: rgba(2,132,199,.35); background: rgba(255,255,255,.2); }
.wf-shape-text:focus, .wf-shape-text.is-editing { border-color: #0284c7; background: rgba(255,255,255,.65); box-shadow: 0 0 0 3px rgba(2,132,199,.15); }

/* Font Family Classes */
.font-sans { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; }
.font-serif { font-family: Georgia, Cambria, "Times New Roman", serif !important; }
.font-mono { font-family: "SF Mono", Menlo, Monaco, Consolas, monospace !important; }
.font-hand { font-family: 'Comic Sans MS', 'Caveat', cursive, sans-serif !important; }

/* Fill Swatches */
.wf-fill-dot { width: 18px; height: 18px; border-radius: 4px; background: var(--c); border: 1.5px solid #cbd5e1; cursor: pointer; transition: transform .12s ease; padding: 0; }
.wf-fill-dot:hover { transform: scale(1.18); }
.wf-fill-dot.is-active { box-shadow: 0 0 0 2px #0284c7, 0 2px 6px rgba(0,0,0,.2); transform: scale(1.18); border-color: #0284c7; }
.wf-fill-dot.is-transparent { background: linear-gradient(135deg, #ffffff 42%, #ef4444 48%, #ef4444 52%, #ffffff 58%); }

/* Floating Image in Whiteboard */
.wf-draw-image-wrap { position: absolute; display: inline-block; pointer-events: auto; user-select: none; border: 1.5px solid transparent; border-radius: 8px; transition: border-color .12s ease, box-shadow .12s ease; cursor: move; }
.wf-draw-image-wrap:hover, .wf-draw-image-wrap.is-selected { border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,.24); }
.wf-draw-image-wrap img { display: block; border-radius: 7px; max-width: 100%; height: auto; pointer-events: none; }
.wf-draw-image-del { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; border-radius: 50%; background: #ef4444; color: #fff; border: 1.5px solid #fff; font-size: 11px; font-weight: 800; display: none; place-items: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.wf-draw-image-wrap:hover .wf-draw-image-del { display: grid; }

/* Drawing Inspector Controls */
.wf-prop-btn-group { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.wf-prop-choice-btn { flex: 1; min-width: 54px; padding: 5px 8px; border: 1px solid var(--wf-border); background: var(--wf-surface-2); border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--wf-secondary); cursor: pointer; transition: all .12s ease; text-align: center; }
.wf-prop-choice-btn:hover { background: var(--wf-surface-3); border-color: var(--wf-border-hover); color: var(--wf-text); }
.wf-prop-choice-btn.is-active { background: #0284c7; border-color: #0369a1; color: #ffffff; }
.wf-prop-swatches { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 5px; }

/* Canvas Tool Cursors & Lock state */
.wf-canvas.tool-pen { cursor: crosshair; }
.wf-canvas.tool-rect, .wf-canvas.tool-diamond, .wf-canvas.tool-ellipse, .wf-canvas.tool-arrow, .wf-canvas.tool-line { cursor: crosshair; }
.wf-canvas.tool-text { cursor: text; }
.wf-canvas.tool-eraser { cursor: cell; }
.wf-canvas.tool-pan { cursor: grab; }
.wf-canvas.tool-pan:active { cursor: grabbing; }
.wf-canvas.is-locked { cursor: default; }
.wf-canvas.is-locked .wf-node-port, .wf-canvas.is-locked #wf-ghost-container { display: none !important; }
.wf-lock-indicator { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 22; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(254,243,199,.96); border: 1px solid #fde68a; color: #92400e; font-size: 11.5px; font-weight: 650; box-shadow: 0 4px 14px rgba(0,0,0,.08); pointer-events: none; animation: wfGhostIn .16s ease both; }
.wf-lock-indicator[hidden] { display: none !important; }
/* Canvas Backgrounds and Patterns */
.wf-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: default;
  background-color: var(--wf-canvas-bg, #0b0c0e);
  transition: background-color .2s ease;
}

/* 1. Puntos / Pizarrón (Default & dots) */
.wf-canvas.bg-dots,
.wf-canvas:not(.bg-grid):not(.bg-plain) {
  background-image: radial-gradient(circle, var(--wf-dots-color, rgba(15, 23, 42, 0.28)) 1.5px, transparent 1.6px);
  background-size: 24px 24px;
}

/* 2. Cuadrícula (Estilo Miro exacto: doble retícula con líneas mayores cada 120px y menores cada 24px) */
.wf-canvas.bg-grid {
  background-image: 
    linear-gradient(to right, var(--wf-grid-major, rgba(15, 23, 42, 0.08)) 1px, transparent 1px),
    linear-gradient(to bottom, var(--wf-grid-major, rgba(15, 23, 42, 0.08)) 1px, transparent 1px),
    linear-gradient(to right, var(--wf-grid-color, rgba(15, 23, 42, 0.035)) 1px, transparent 1px),
    linear-gradient(to bottom, var(--wf-grid-color, rgba(15, 23, 42, 0.035)) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}

/* 3. Liso (Canvas en blanco) */
.wf-canvas.bg-plain {
  background-image: none !important;
}

/* Ajustes para modo oscuro de pizarra / Black Noir */
.wf-canvas.canvas-dark {
  --wf-grid-color: rgba(255, 255, 255, 0.03) !important;
  --wf-grid-major: rgba(255, 255, 255, 0.075) !important;
}
.wf-canvas.canvas-dark.bg-dots {
  --wf-dots-color: rgba(255, 255, 255, 0.20) !important;
}
.wf-canvas.canvas-dark .wf-canvas-empty {
  color: #94a3b8;
  background: rgba(18, 19, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
}
.wf-canvas.canvas-dark .wf-canvas-empty strong {
  color: #f2f3f5;
}

/* Popover de Fondo del Lienzo */
.wf-bg-popover {
  position: absolute;
  z-index: 23;
  top: 54px;
  right: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--wf-popover-bg);
  border: 1px solid var(--wf-popover-border);
  box-shadow: var(--wf-popover-shadow);
  animation: wfGhostIn .14s cubic-bezier(.16,1,.3,1) both;
  min-width: 220px;
}
.wf-bg-popover[hidden] {
  display: none !important;
}
.wf-bg-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--wf-muted);
  letter-spacing: .04em;
  user-select: none;
}

.wf-canvas.is-panning { cursor: grab; }
.wf-canvas.is-panning:active { cursor: grabbing; }
.wf-stage { position: absolute; left: 0; top: 0; width: 2400px; height: 1600px; transform-origin: 0 0; }
.wf-connections { position: absolute; inset: 0; width: 2400px !important; height: 1600px !important; overflow: visible; pointer-events: none; }
.wf-edge { fill: none; stroke: #94a3b8; stroke-width: 2; marker-end: url(#wf-arrow); }
.wf-edge-preview { stroke: #0ea5e9; stroke-dasharray: 6 5; marker-end: url(#wf-arrow); }
.wf-edge-ghost { fill: none; stroke: #0284c7; stroke-width: 2; stroke-dasharray: 5 4; marker-end: url(#wf-arrow); opacity: .85; animation: wfGhostDash 1.2s linear infinite; }
.wf-edge-ghost.wf-edge-ghost-existing { stroke: #0284c7; stroke-width: 2.5; stroke-dasharray: 6 4; opacity: .95; }
@keyframes wfGhostDash { to { stroke-dashoffset: -18; } }
.wf-node { position: absolute; width: 184px; min-height: 70px; padding: 12px 12px 11px; border: 1px solid var(--wf-node-border); border-radius: 12px; background: var(--wf-node-bg); box-shadow: 0 8px 24px -10px rgba(0,0,0,.45); color: var(--wf-node-text); cursor: grab; user-select: none; transition: border-color .15s ease, box-shadow .15s ease; }
.wf-node:hover { border-color: #5eead4; }
.wf-node.is-selected { border: 2px solid var(--wf-teal); box-shadow: 0 0 0 4px rgba(13,148,136,.2), 0 12px 28px -16px rgba(0,0,0,.6); }
.wf-node.is-connecting { border-color: #0ea5e9; box-shadow: 0 0 0 4px rgba(14,165,233,.14); }
.wf-node.is-connect-target { border-color: #0ea5e9; box-shadow: 0 0 0 5px rgba(14,165,233,.13), 0 12px 28px -16px rgba(0,0,0,.4); }
.wf-node-head { display: flex; align-items: center; gap: 9px; }
.wf-node-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--wf-surface-2); color: var(--wf-secondary); }
.wf-node-icon svg { width: 16px !important; height: 16px !important; }
.wf-node[data-type="trigger"] .wf-node-icon { background: var(--wf-teal-soft); color: #2dd4bf; }
#v-workflows.wf-theme-light .wf-node[data-type="trigger"] .wf-node-icon { color: #0f766e; }
.wf-node[data-type="decision"] .wf-node-icon { background: #fef3c7; color: #b45309; transform: rotate(45deg); border-radius: 6px; }
.wf-node[data-type="decision"] .wf-node-icon svg { transform: rotate(-45deg); }
.wf-node[data-type="wait"] .wf-node-icon { background: #ede9fe; color: #6d28d9; }
.wf-node[data-type="end"] .wf-node-icon { background: #ffe4e6; color: #be123c; }
.wf-node[data-type="note"] .wf-node-icon { background: var(--wf-teal-soft); color: #0f766e; }
.wf-node strong { display: block; overflow: hidden; font-size: 12.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; color: var(--wf-node-text); }
.wf-node small { display: block; margin-top: 3px; color: var(--wf-muted); font-size: 10px; }
.wf-node-port { position: absolute; z-index: 28; width: 20px; height: 20px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #0ea5e9; box-shadow: 0 0 0 1px #0284c7, 0 3px 8px rgba(15,23,42,.18); cursor: crosshair; opacity: 0; pointer-events: auto; transition: opacity .14s ease, transform .14s ease, box-shadow .14s ease; }
.wf-node-port::before { content: ""; position: absolute; top: -8px; left: -8px; right: -8px; bottom: -8px; border-radius: 50%; pointer-events: auto; }
.wf-node-port::after { content: ""; position: absolute; left: 6px; top: 6px; width: 4px; height: 4px; border-top: 1.5px solid #fff; border-right: 1.5px solid #fff; }
.wf-node-port[data-port="right"] { right: -10px; top: calc(50% - 10px); }
.wf-node-port[data-port="right"]::after { transform: rotate(45deg); }
.wf-node-port[data-port="left"] { left: -10px; top: calc(50% - 10px); }
.wf-node-port[data-port="left"]::after { transform: rotate(-135deg); }
.wf-node-port[data-port="top"] { left: calc(50% - 10px); top: -10px; }
.wf-node-port[data-port="top"]::after { transform: rotate(-45deg); }
.wf-node-port[data-port="bottom"] { left: calc(50% - 10px); bottom: -10px; }
.wf-node-port[data-port="bottom"]::after { transform: rotate(135deg); }
.wf-node:hover .wf-node-port, .wf-node:focus-within .wf-node-port, .wf-node.is-selected .wf-node-port, .wf-node.is-connecting .wf-node-port, .wf-node.is-connect-target .wf-node-port { opacity: 1; pointer-events: auto; }
.wf-node-port:hover, .wf-node-port:focus-visible { box-shadow: 0 0 0 4px rgba(14,165,233,.22), 0 4px 10px rgba(15,23,42,.25); transform: scale(1.18); cursor: pointer; }
.wf-node-port[data-connected="true"] { background: #0284c7; box-shadow: 0 0 0 1px #0369a1, 0 3px 8px rgba(15,23,42,.2); cursor: crosshair; }
.wf-node-port[data-connected="true"]:hover, .wf-node-port[data-connected="true"]:focus-visible { box-shadow: 0 0 0 4px rgba(2,132,199,.25), 0 4px 10px rgba(15,23,42,.25); transform: scale(1.18); cursor: pointer; }

/* Edge hover hit area & disconnect button */
.wf-edge-hit { stroke: transparent; stroke-width: 34px; fill: none; cursor: pointer; pointer-events: stroke; }
.wf-edge-group { cursor: pointer; }
.wf-edge-group:hover .wf-edge, .wf-edge-group.is-edge-hovered .wf-edge { stroke: #ef4444 !important; stroke-width: 2.5px !important; marker-end: url(#wf-arrow-hover) !important; }
#wf-edge-actions { position: absolute; inset: 0; pointer-events: none; z-index: 22; }
.wf-edge-action { position: absolute; transform: translate(-50%, -50%); opacity: 0; pointer-events: none; padding: 12px 16px; transition: opacity .15s ease, transform .15s cubic-bezier(.16,1,.3,1); }
.wf-edge-action.is-edge-hovered, .wf-edge-action:hover, .wf-edge-action:focus-within { opacity: 1 !important; pointer-events: auto !important; transform: translate(-50%, -50%) scale(1.05) !important; }
.wf-edge-disconnect-btn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; font-size: 11px; font-weight: 650; font-family: inherit; color: #ef4444; background: #ffffff; border: 1.5px solid rgba(239,68,68,.4); border-radius: 999px; box-shadow: 0 3px 12px rgba(15,23,42,.16), 0 1px 4px rgba(239,68,68,.2); cursor: pointer; user-select: none; transition: all .14s ease; white-space: nowrap; }
.wf-edge-disconnect-btn:hover { background: #fef2f2; border-color: #ef4444; color: #dc2626; transform: scale(1.06); box-shadow: 0 6px 18px rgba(239,68,68,.3); }
.wf-disconnect-x { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: #fee2e2; color: #ef4444; font-size: 9px; font-weight: 800; line-height: 1; transition: all .14s ease; }
.wf-edge-disconnect-btn:hover .wf-disconnect-x { background: #ef4444; color: #ffffff; }

/* Soporte de botón cancelar en Modo Noir / Dark */
.wf-canvas.canvas-dark .wf-edge-disconnect-btn {
  background: #18191c;
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(239, 68, 68, 0.25);
}
.wf-canvas.canvas-dark .wf-edge-disconnect-btn:hover {
  background: #241416;
  border-color: #ef4444;
  color: #fca5a5;
}
.wf-canvas.canvas-dark .wf-disconnect-x {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}

/* Ghost node preview on port hover with Doble Opcion */
#wf-ghost-container { position: absolute; inset: 0; pointer-events: none; z-index: 35; }
.wf-ghost-node { position: absolute; width: 256px; box-sizing: border-box; min-height: 110px; padding: 9px 11px; border: 2px dashed #0284c7; border-radius: 12px; background: rgba(240,249,255,.96); backdrop-filter: blur(8px); box-shadow: 0 12px 32px -10px rgba(14,165,233,.42); pointer-events: auto !important; user-select: none; display: flex; flex-direction: column; gap: 7px; animation: wfGhostIn .14s cubic-bezier(.16,1,.3,1) both; transition: transform .14s ease, border-color .14s ease, background-color .14s ease, box-shadow .14s ease; z-index: 36 !important; }
@keyframes wfGhostIn { from { opacity: 0; transform: scale(.95); } to { opacity: .96; transform: scale(1); } }
.wf-ghost-node:hover { opacity: 1 !important; transform: scale(1.02) !important; border-color: #0284c7 !important; background: rgba(224,242,254,.98) !important; box-shadow: 0 16px 38px -8px rgba(14,165,233,.5) !important; }
.wf-ghost-node.wf-ghost-note { width: 192px !important; min-height: 192px !important; border-radius: 3px; background: var(--wf-ghost-bg, #ffe86d); border-color: #2563eb; opacity: .92; }
.wf-ghost-node.wf-ghost-note:hover { opacity: 1 !important; border-color: #1d4ed8 !important; }
.wf-ghost-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; }
.wf-ghost-badge { font-size: 8.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; background: #0284c7; color: #fff; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.wf-ghost-node.wf-ghost-note .wf-ghost-badge { background: #2563eb; }
.wf-ghost-dir-label { font-size: 9.5px; font-weight: 650; color: #0284c7; }
.wf-ghost-type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3.5px; width: 100%; margin-top: 2px; }
.wf-gtp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 5px; font-size: 10px; font-weight: 650; border-radius: 6px; border: 1px solid rgba(2, 132, 199, 0.25); background: rgba(255, 255, 255, 0.95); color: #0369a1; cursor: pointer !important; pointer-events: auto !important; white-space: nowrap; transition: all 0.12s ease; }
.wf-gtp-btn:hover { background: #0284c7 !important; color: #ffffff !important; border-color: #0284c7 !important; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35); }
.wf-gtp-btn.is-active { background: #0369a1 !important; color: #ffffff !important; border-color: #0284c7 !important; }
.wf-gtp-icon { display: grid; place-items: center; pointer-events: none; }
.wf-gtp-icon svg { width: 11px !important; height: 11px !important; }
.wf-ghost-content { display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background .12s ease; margin-top: 1px; }
.wf-ghost-content:hover { background: rgba(255,255,255,.65); }
.wf-ghost-icon { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; border-radius: 7px; background: rgba(255,255,255,.95); color: #0284c7; box-shadow: 0 2px 5px rgba(0,0,0,.08); }
.wf-ghost-node.wf-ghost-note .wf-ghost-icon { color: #0f766e; }
.wf-ghost-icon svg { width: 14px !important; height: 14px !important; }
.wf-ghost-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wf-ghost-text strong { font-size: 11.5px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-ghost-text small { font-size: 9.5px; color: #0369a1; font-weight: 500; white-space: nowrap; }
.wf-ghost-node.wf-ghost-note .wf-ghost-text small { color: #0f766e; }

.wf-canvas.canvas-dark .wf-ghost-node { background: rgba(20, 21, 25, 0.96); border-color: #0284c7; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65); }
.wf-canvas.canvas-dark .wf-gtp-btn { background: rgba(26, 27, 32, 0.95); border-color: rgba(56, 189, 248, 0.22); color: #38bdf8; }
.wf-canvas.canvas-dark .wf-gtp-btn:hover, .wf-canvas.canvas-dark .wf-gtp-btn.is-active { background: #0284c7; color: #ffffff; }
.wf-canvas.canvas-dark .wf-ghost-text strong { color: #f1f5f9; }
.wf-canvas.canvas-dark .wf-ghost-text small { color: #38bdf8; }
.wf-canvas.canvas-dark .wf-ghost-icon { background: rgba(30, 32, 38, 0.95); }

/* Existing node smart-connect preview pill & target pulse */
.wf-node.is-ghost-target {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 5px rgba(2,132,199,.24), 0 16px 36px -10px rgba(14,165,233,.45) !important;
  transform: scale(1.025);
  cursor: pointer !important;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.wf-ghost-connect-pill {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  background: #0284c7;
  color: #ffffff;
  border: 1.5px solid #38bdf8;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(2,132,199,.45), 0 2px 6px rgba(15,23,42,.2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  white-space: nowrap;
  animation: wfGhostPillIn .16s cubic-bezier(.16,1,.3,1) both;
  transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
  z-index: 26;
}
.wf-ghost-connect-pill:hover {
  background: #0369a1;
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 8px 26px rgba(2,132,199,.58);
}
.wf-ghost-connect-pill .wf-pill-icon {
  font-size: 13px;
  line-height: 1;
}
.wf-ghost-connect-pill small {
  font-size: 9.5px;
  opacity: .88;
  margin-left: 5px;
  padding-left: 7px;
  border-left: 1px solid rgba(255,255,255,.35);
  font-weight: 500;
}
@keyframes wfGhostPillIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.88); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
/* ===== NOTAS ADHESIVAS ESTILO MIRO (CLEAN YELLOW STICKY NOTE) ===== */
.wf-note {
  width: 192px;
  height: 192px;
  min-width: 90px;
  min-height: 90px;
  padding: 0 !important;
  overflow: visible !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 4px !important;
  background: var(--wf-note-bg, #ffe86d) !important;
  box-shadow: 0 10px 20px -8px rgba(15, 23, 42, 0.22), 0 2px 5px -1px rgba(15, 23, 42, 0.08) !important;
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.15s ease, outline 0.12s ease;
  box-sizing: border-box !important;
}
.wf-note:hover {
  box-shadow: 0 14px 26px -8px rgba(15, 23, 42, 0.28), 0 3px 8px -1px rgba(15, 23, 42, 0.1) !important;
}
.wf-note.is-selected {
  outline: 2px solid #2563eb !important;
  outline-offset: 1px !important;
  border-color: transparent !important;
  box-shadow: 0 12px 28px -10px rgba(37, 99, 235, 0.35), 0 2px 6px -1px rgba(15, 23, 42, 0.1) !important;
}
/* Tiradores circulares blancos estilo Miro en las 4 esquinas */
.wf-note.is-selected::before {
  display: none !important;
}
.wf-note::after {
  display: none !important;
}
.wf-note-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  cursor: grab;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  user-select: none;
  touch-action: none;
}
.wf-note-header:hover {
  background: rgba(0, 0, 0, 0.04);
}
.wf-note-header:active {
  cursor: grabbing;
}
.wf-note-pin {
  width: 28px;
  height: 4px;
  background: rgba(0, 0, 0, 0.16);
  border-radius: 2px;
  transition: background 0.15s ease, width 0.15s ease;
}
.wf-note-header:hover .wf-note-pin {
  background: rgba(0, 0, 0, 0.38);
  width: 36px;
}
.wf-note-body {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 24px 14px 14px 14px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.wf-note-center-wrap {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.wf-note-editor {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2px 4px;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: #1e293b !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.42;
  text-align: center;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  caret-color: #0f172a;
  field-sizing: content;
  pointer-events: auto;
  cursor: text;
}
.wf-note-editor:focus {
  outline: 0 !important;
}
.wf-note-editor::placeholder {
  color: rgba(30, 41, 59, 0.35);
  font-size: 13.5px;
}
.wf-note .wf-node-port {
  width: 12px !important;
  height: 12px !important;
  background: #2563eb !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
}
.wf-note .wf-node-port::after {
  display: none !important;
}
.wf-note .wf-node-port[data-port="right"] { right: -6px !important; top: calc(50% - 6px) !important; }
.wf-note .wf-node-port[data-port="left"] { left: -6px !important; top: calc(50% - 6px) !important; }
.wf-note .wf-node-port[data-port="top"] { left: calc(50% - 6px) !important; top: -6px !important; }
.wf-note .wf-node-port[data-port="bottom"] { left: calc(50% - 6px) !important; bottom: -6px !important; }

.wf-note-colors { margin: 0 0 15px; padding: 0; border: 0; }
.wf-note-colors legend { margin-bottom: 8px; color: var(--wf-secondary); font-size: 10.5px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.wf-note-colors button { width: 30px; height: 30px; margin-right: 7px; border: 1px solid var(--wf-border); border-radius: 8px; background: var(--wf-swatch); cursor: pointer; vertical-align: top; }
.wf-note-colors button:hover { border-color: #2563eb; }
.wf-note-colors button.is-active { border: 2px solid #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.wf-canvas-empty { position: absolute; left: 50%; top: 50%; display: flex; width: 250px; flex-direction: column; gap: 5px; transform: translate(-50%,-50%); color: var(--wf-muted); text-align: center; pointer-events: none; }
.wf-canvas-empty[hidden] { display: none !important; }
.wf-canvas-empty strong { color: var(--wf-secondary); font-size: 15px; }
.wf-canvas-empty span { font-size: 12px; line-height: 1.5; }

.wf-inspector-tabs { display: flex; align-items: center; gap: 4px; margin: -4px 0 18px; padding: 4px; border-radius: 10px; background: var(--wf-surface-2); }
.wf-inspector-tabs button { flex: 1; min-width: 0; min-height: 34px; padding: 6px 6px; font-size: 11.5px; color: var(--wf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.wf-inspector-tabs button.is-active { background: var(--wf-surface-3); color: var(--wf-text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.wf-inspector-expand-btn { flex: 0 0 28px !important; min-width: 28px !important; height: 28px !important; min-height: 28px !important; padding: 0 !important; display: grid; place-items: center; font-size: 13px; border-radius: 6px; color: var(--wf-muted); background: transparent; cursor: pointer; transition: all 0.15s ease; }
.wf-inspector-expand-btn:hover { background: var(--wf-surface-3); color: var(--wf-text); }
.wf-inspector-empty { padding: 28px 8px; text-align: center; }
.wf-inspector-empty svg { width: 28px !important; height: 28px !important; margin-bottom: 9px; color: #94a3b8; }
.wf-inspector-empty strong { display: block; margin-bottom: 4px; font-size: 13px; color: var(--wf-text); }
.wf-inspector-empty span { color: var(--wf-muted); font-size: 11px; line-height: 1.5; }
.wf-field { display: block; margin-bottom: 15px; }
.wf-field > span { display: block; margin-bottom: 6px; color: var(--wf-secondary); font-size: 10.5px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.wf-field input, .wf-field textarea, .wf-settings-card textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--wf-border); border-radius: 9px; background: var(--wf-input-bg); color: var(--wf-text); font-size: 13px; line-height: 1.45; resize: vertical; }
.wf-property-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.wf-connect-hint { margin: 4px 0 -8px; padding: 10px; border-radius: 9px; background: rgba(2, 132, 199, 0.15); color: #38bdf8; font-size: 10.5px; line-height: 1.45; }
#v-workflows.wf-theme-light .wf-connect-hint { background: #f0f9ff; color: #0369a1; }
.wf-property-actions button { min-height: 42px; padding: 8px; border: 1px solid var(--wf-border); border-radius: 9px; background: var(--wf-surface-2); color: var(--wf-secondary); cursor: pointer; font-size: 12px; font-weight: 650; }
.wf-property-actions .wf-delete { color: #ef4444; }
.wf-property-actions button:hover { background: var(--wf-surface-3); color: var(--wf-text); }
.wf-summary-list { display: grid; gap: 10px; }
.wf-summary-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--wf-border); color: var(--wf-muted); font-size: 11.5px; }
.wf-summary-item strong { color: var(--wf-text); font-size: 12px; }
.wf-history-log { margin-top: 18px; }
.wf-history-log h4 { margin: 0 0 10px; color: var(--wf-secondary); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.wf-history-entry { position: relative; margin-left: 5px; padding: 0 0 14px 15px; border-left: 1px solid var(--wf-border); color: var(--wf-muted); font-size: 10.5px; }
.wf-history-entry::before { content: ""; position: absolute; left: -4px; top: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--wf-teal); }
.wf-history-entry strong { display: block; margin-bottom: 2px; color: var(--wf-secondary); font-size: 11px; }

.wf-state-card, .wf-settings-card { max-width: 680px; margin: 54px auto; padding: 34px; border: 1px solid var(--wf-border); border-radius: 16px; background: var(--wf-surface); box-shadow: var(--wf-card-shadow); }
.wf-state-card { text-align: center; }
.wf-state-card > svg { width: 42px !important; height: 42px !important; color: var(--wf-teal); }
.wf-state-card h3, .wf-settings-card h3 { margin: 13px 0 7px; color: var(--wf-text); font-size: 18px; }
.wf-state-card p { max-width: 520px; margin: 0 auto 17px; color: var(--wf-muted); font-size: 13px; line-height: 1.6; }
.wf-settings-card > label { display: block; margin-top: 22px; color: var(--wf-secondary); font-size: 12px; font-weight: 700; }
.wf-settings-card textarea { margin-top: 7px; font-weight: 400; }
.wf-toggle-row { display: flex !important; align-items: center; justify-content: space-between; gap: 20px; }
.wf-toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.wf-toggle-row small { color: var(--wf-muted); font-weight: 400; }
.wf-toggle-row input { width: 22px; height: 22px; accent-color: var(--wf-teal); }
.wf-boundary-note { display: flex; flex-direction: column; gap: 3px; margin-top: 22px; padding: 13px; border: 1px solid rgba(245,158,11,.3); border-radius: 10px; background: rgba(245,158,11,.1); }
#v-workflows.wf-theme-light .wf-boundary-note { border-color: #fde68a; background: #fffbeb; }
.wf-boundary-note strong { color: #f59e0b; font-size: 11.5px; }
.wf-boundary-note span { color: #d97706; font-size: 11px; }

.wf-dialog { position: fixed; inset: 0; width: min(650px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid var(--wf-border); border-radius: 18px; background: var(--wf-surface); color: var(--wf-text); box-shadow: var(--wf-popover-shadow); }
.wf-dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.wf-dialog form { padding: 24px; }
.wf-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.wf-dialog-head h3 { margin: 3px 0 0; font-size: 20px; color: var(--wf-text); }
.wf-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.wf-choice { display: flex; min-height: 230px; flex-direction: column; align-items: flex-start; padding: 19px; border: 1px solid var(--wf-border); border-radius: 14px; background: var(--wf-surface-2); color: var(--wf-text); text-align: left; cursor: pointer; transition: all .14s ease; }
.wf-choice:hover { border-color: var(--wf-teal); background: var(--wf-surface-3); }
.wf-choice-icon { display: grid; width: 42px; height: 42px; margin-bottom: 18px; place-items: center; border-radius: 12px; background: var(--wf-teal-soft); color: #2dd4bf; }
#v-workflows.wf-theme-light .wf-choice-icon { color: #0f766e; }
.wf-choice:nth-child(2) .wf-choice-icon { background: rgba(2, 132, 199, 0.15); color: #38bdf8; }
#v-workflows.wf-theme-light .wf-choice:nth-child(2) .wf-choice-icon { background: #e0f2fe; color: #0369a1; }
.wf-choice strong { font-size: 15px; color: var(--wf-text); }
.wf-choice small { flex: 1; margin-top: 7px; color: var(--wf-muted); font-size: 12px; line-height: 1.55; }
.wf-choice > span:last-child { margin-top: 16px; color: #2dd4bf; font-size: 12px; font-weight: 750; }
#v-workflows.wf-theme-light .wf-choice > span:last-child { color: #0f766e; }

@media (max-width: 1180px) {
  .wf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .wf-editor-head { flex-wrap: wrap; height: auto; min-height: 52px; padding: 6px 12px; }
  .wf-tabs { order: 5; width: 100%; justify-content: center; }
  .wf-tabs button { flex: 1; }
  .wf-inspector { position: absolute; z-index: 30; right: 0; width: 300px; height: 100%; box-shadow: -12px 0 28px -20px rgba(15,23,42,.35); }
}
@media (max-width: 768px) {
  body.workflows-mode .main { height: 100dvh; }
  body.workflows-mode .topbar { display: flex !important; flex: 0 0 52px; }
  body.workflows-mode .main > .toolbar { display: none !important; }
  body.workflows-mode .content { height: calc(100dvh - 52px); padding-bottom: 60px !important; }
  body.workflows-mode #v-workflows.on { padding: 14px 12px 12px; }
  #v-workflows { margin: -14px -12px -86px; padding: 20px 14px 100px; }
  .wf-library-head, .wf-library-toolbar { align-items: stretch; flex-direction: column; }
  .wf-button { min-height: 46px; }
  .wf-search { width: 100%; }
  .wf-segmented { overflow-x: auto; }
  .wf-segmented button { white-space: nowrap; }
  .wf-grid { grid-template-columns: 1fr; }
  .wf-choice-grid { grid-template-columns: 1fr; }
  .wf-choice { min-height: 190px; }
  .wf-editor-head { gap: 8px; }
  .wf-title-block { min-width: calc(100% - 54px); }
  .wf-editor-head > .wf-button { flex: 1; }
  .wf-builder-shell { display: block; height: calc(100vh - 250px); min-height: 520px; }
  .wf-palette { display: flex; gap: 8px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--wf-border); overflow-x: auto; }
  .wf-palette .wf-panel-title, .wf-palette > p, .wf-palette-help { display: none; }
  #wf-palette-list { display: flex; gap: 7px; }
  .wf-palette-item { display: flex; width: 132px; min-height: 44px; margin: 0; padding: 5px 8px; flex: 0 0 auto; justify-content: flex-start; gap: 8px; text-align: left; }
  .wf-palette-item > div { display: block; }
  .wf-palette-item strong { display: block; color: var(--wf-text); font-size: 12px; }
  .wf-palette-item small { display: none; }
  .wf-canvas-wrap { height: calc(100% - 66px); }
  .wf-inspector { display: none; }
  .wf-canvas-toolbar { top: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .wf-card { transition: none; }
}

/* ==========================================================
   SELECCIÓN MÚLTIPLE EN CONJUNTO (ESTILO EXCALIDRAW / MIRO)
   ========================================================== */
.wf-marquee-box {
  position: absolute;
  pointer-events: none;
  z-index: 18;
  border: 1.5px dashed #6366f1;
  background-color: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
}

.wf-selection-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 15;
}

/* Recuadros individuales para cada elemento seleccionado */
.wf-item-selection-box {
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(99, 102, 241, 0.65);
  background: rgba(99, 102, 241, 0.03);
  border-radius: 3px;
  box-sizing: border-box;
}

/* Recuadro envolvente global con tiradores */
.wf-selection-bounds {
  position: absolute;
  pointer-events: none !important;
  border: 1.5px solid #2563eb;
  background-color: transparent;
  border-radius: 4px;
  box-sizing: border-box;
}

.wf-selection-bounds.is-nodes-only {
  pointer-events: none !important;
  border: 1.5px dashed rgba(99, 102, 241, 0.5);
}

/* Tiradores interactivos en las esquinas y parte superior (estilo Miro) */
.wf-sel-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 50%;
  pointer-events: auto !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  z-index: 25;
  transition: transform 0.1s ease, background-color 0.1s ease;
}
.wf-sel-handle:hover {
  transform: scale(1.25);
  background: #eff6ff;
}

.wf-sel-handle.handle-tl { top: -6px; left: -6px; cursor: nwse-resize; }
.wf-sel-handle.handle-tr { top: -6px; right: -6px; cursor: nesw-resize; }
.wf-sel-handle.handle-bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.wf-sel-handle.handle-br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.wf-sel-handle.handle-tc { top: -6px; left: calc(50% - 5.5px); cursor: ns-resize; }
.wf-sel-handle.handle-bc { bottom: -6px; left: calc(50% - 5.5px); cursor: ns-resize; }
.wf-sel-handle.handle-ml { top: calc(50% - 5.5px); left: -6px; cursor: ew-resize; }
.wf-sel-handle.handle-mr { top: calc(50% - 5.5px); right: -6px; cursor: ew-resize; }

/* Tirador superior de rotación / orientación */
.wf-sel-handle.handle-rot {
  top: -24px;
  left: calc(50% - 5.5px);
  width: 11px;
  height: 11px;
  cursor: grab;
}
.wf-sel-rot-stem {
  position: absolute;
  top: -16px;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 16px;
  background: #2563eb;
  pointer-events: none;
}

/* ==========================================================
   BARRA FLOTANTE CONTEXTUAL DE TEXTO (ESTILO MIRO)
   ========================================================== */
.wf-text-floating-toolbar {
  position: absolute;
  z-index: 45 !important;
  display: none !important;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 4px 10px -2px rgba(15, 23, 42, 0.08);
  transform: translate(-50%, -100%);
  margin-top: -10px;
  pointer-events: auto;
  user-select: none;
  animation: wfFtbIn 0.12s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.wf-text-floating-toolbar.is-active:not([hidden]) {
  display: flex !important;
}

.wf-text-floating-toolbar[hidden] {
  display: none !important;
}

@keyframes wfFtbIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

.wf-canvas.canvas-dark .wf-text-floating-toolbar {
  background: rgba(24, 25, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.wf-ftb-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.wf-ftb-divider {
  width: 1px;
  height: 18px;
  background: rgba(15, 23, 42, 0.12);
  margin: 0 2px;
}
.wf-canvas.canvas-dark .wf-ftb-divider {
  background: rgba(255, 255, 255, 0.12);
}

.wf-ftb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.12s ease;
}
.wf-canvas.canvas-dark .wf-ftb-btn {
  color: #cbd5e1;
}

.wf-ftb-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.wf-canvas.canvas-dark .wf-ftb-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.wf-ftb-btn.is-active {
  background: #0284c7;
  color: #ffffff;
}
.wf-canvas.canvas-dark .wf-ftb-btn.is-active {
  background: #38bdf8;
  color: #0b0c0e;
}
.wf-ftb-widths .wf-ftb-btn {
  font-size: 10.5px;
  padding: 0 5px;
  height: 24px;
}

.wf-ftb-size-label {
  font-size: 11.5px;
  font-weight: 600;
  padding: 0 4px;
  color: #475569;
}
.wf-canvas.canvas-dark .wf-ftb-size-label {
  color: #94a3b8;
}

.wf-ftb-del {
  color: #ef4444;
}
.wf-ftb-del:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ==========================================================
   COPILOTO IA EN EL INSPECTOR (PESTAÑA ✨ IA)
   ========================================================== */
.wf-ai-tab-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.14)) !important;
  color: #6366f1 !important;
  font-weight: 700 !important;
}
.wf-ai-tab-btn.is-active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.wf-ai-panel {
  display: flex;
  flex-direction: column;
  height: calc(100% - 48px);
  gap: 12px;
  padding-top: 4px;
}
.wf-ai-panel[hidden],
#wf-properties[hidden],
#wf-history[hidden] {
  display: none !important;
}

/* Ocultar cualquier recuadro de selección mientras se dibuja a mano alzada */
.wf-canvas.tool-pen #wf-selection-overlay {
  display: none !important;
}

.wf-ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
}

.wf-ai-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.wf-ai-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wf-ai-title-wrap strong {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--wf-inspector-text, #0f172a);
}
.wf-ai-title-wrap span {
  font-size: 10.5px;
  color: var(--wf-inspector-text-secondary, #64748b);
}

.wf-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}

.wf-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.05);
  color: var(--wf-inspector-text, #1e293b);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.wf-ai-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #6366f1;
  transform: translateY(-1px);
}

.wf-ai-chat {
  flex: 1;
  min-height: 240px;
  max-height: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.wf-ai-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  animation: wfMsgIn 0.15s ease both;
}

@keyframes wfMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wf-ai-msg.is-assistant .wf-ai-bubble {
  background: var(--wf-surface-2, #f8fafc);
  border: 1px solid var(--wf-border, #e2e8f0);
  border-radius: 12px 12px 12px 2px;
  padding: 10px 12px;
  color: var(--wf-inspector-text, #1e293b);
}

.wf-ai-msg.is-user .wf-ai-bubble {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-radius: 12px 12px 2px 12px;
  padding: 8px 12px;
  max-width: 85%;
}

.wf-ai-action-card {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wf-ai-insert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.wf-ai-insert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.wf-ai-form {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--wf-border, #e2e8f0);
}

.wf-ai-form input {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  border: 1px solid var(--wf-border, #cbd5e1);
  border-radius: 8px;
  background: var(--wf-surface, #ffffff);
  color: var(--wf-inspector-text, #0f172a);
  outline: none;
  transition: border-color 0.12s ease;
}
.wf-ai-form input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.wf-ai-form button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: #6366f1;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.12s ease;
}
.wf-ai-form button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.wf-ai-form button:hover {
  background: #4f46e5;
}

/* ==========================================================
   MODAL GALERÍA DE PLANTILLAS (ESTILO MIRO)
   ========================================================== */
.wf-templates-dialog {
  max-width: 980px;
  width: 94vw;
  max-height: 88vh;
  border: none;
  border-radius: 16px;
  background: var(--wf-surface, #ffffff);
  color: var(--wf-inspector-text, #0f172a);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
  padding: 0;
  overflow: hidden;
}

.wf-templates-shell {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.wf-templates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--wf-border, #e2e8f0);
}
.wf-templates-head h3 {
  margin: 4px 0 0 0;
  font-size: 18px;
  font-weight: 750;
}

.wf-templates-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 24px;
  background: var(--wf-surface-2, #f8fafc);
  border-bottom: 1px solid var(--wf-border, #e2e8f0);
}

.wf-templates-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 14px;
  font-size: 13px;
  border: 1px solid var(--wf-border, #cbd5e1);
  border-radius: 8px;
  background: var(--wf-surface, #ffffff);
  color: var(--wf-inspector-text, #0f172a);
}

.wf-templates-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.wf-tpl-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--wf-border, #e2e8f0);
  border-radius: 999px;
  background: var(--wf-surface, #ffffff);
  color: var(--wf-inspector-text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.wf-tpl-tab:hover {
  border-color: #0284c7;
  color: #0284c7;
}
.wf-tpl-tab.is-active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.wf-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 24px;
  overflow-y: auto;
  max-height: calc(88vh - 180px);
}

.wf-template-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wf-border, #e2e8f0);
  border-radius: 12px;
  background: var(--wf-surface, #ffffff);
  overflow: hidden;
  transition: all 0.16s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.wf-template-card:hover {
  transform: translateY(-2px);
  border-color: #0284c7;
  box-shadow: 0 10px 24px -6px rgba(14, 165, 233, 0.2);
}

.wf-template-thumb {
  height: 120px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06), rgba(99, 102, 241, 0.06));
  border-bottom: 1px solid var(--wf-border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.wf-template-thumb svg {
  width: 100%;
  height: 100%;
  max-height: 96px;
}

.wf-template-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wf-template-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.wf-template-body h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.wf-template-body p {
  margin: 0;
  font-size: 12px;
  color: var(--wf-inspector-text-secondary, #64748b);
  line-height: 1.4;
  flex: 1;
}

.wf-template-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--wf-border, #e2e8f0);
  background: var(--wf-surface-2, #f8fafc);
}

.wf-tpl-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 650;
  border-radius: 6px;
  border: 1px solid var(--wf-border, #cbd5e1);
  background: var(--wf-surface, #ffffff);
  color: var(--wf-inspector-text, #1e293b);
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
}
.wf-tpl-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.wf-tpl-btn.is-primary {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}
.wf-tpl-btn.is-primary:hover {
  background: #0369a1;
}

/* Modo presentacion: con cualquier herramienta que no sea la flecha (lapiz, formas, texto,
   borrador, manita) se ocultan los puntos de conexion, el panel fantasma y la flecha punteada
   de conexion. Permite senalar y explicar el pizarron sin controles de edicion al pasar el mouse. */
.wf-canvas:is(.tool-pen, .tool-rect, .tool-diamond, .tool-ellipse, .tool-triangle, .tool-divider, .tool-elbow, .tool-arrow, .tool-line, .tool-text, .tool-eraser, .tool-pan) .wf-node-port { opacity: 0 !important; pointer-events: none !important; }
.wf-canvas:is(.tool-pen, .tool-rect, .tool-diamond, .tool-ellipse, .tool-triangle, .tool-divider, .tool-elbow, .tool-arrow, .tool-line, .tool-text, .tool-eraser, .tool-pan) #wf-ghost-container { display: none !important; }
.wf-canvas:is(.tool-pen, .tool-rect, .tool-diamond, .tool-ellipse, .tool-triangle, .tool-divider, .tool-elbow, .tool-arrow, .tool-line, .tool-text, .tool-eraser, .tool-pan) .wf-edge-ghost, .wf-canvas:is(.tool-pen, .tool-rect, .tool-diamond, .tool-ellipse, .tool-triangle, .tool-divider, .tool-elbow, .tool-arrow, .tool-line, .tool-text, .tool-eraser, .tool-pan) .wf-ghost-node { display: none !important; }

/* El cursor de la herramienta manda sobre todo el lienzo: sin esto, los bloques imponen la
   manita de arrastre y el textarea de las notas impone el cursor de texto. */
.wf-canvas:is(.tool-pen, .tool-rect, .tool-diamond, .tool-ellipse, .tool-triangle, .tool-divider, .tool-elbow, .tool-arrow, .tool-line, .tool-text, .tool-eraser, .tool-pan) * { cursor: inherit !important; }

/* Lapiz, plumon y marcador: puntero con forma de lapiz en vez de la cruz. */
.wf-canvas.tool-pen, .wf-canvas.tool-pen * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 20.5l4.2-1.1L19.3 7.8l-3.1-3.1L4.6 16.3 3.5 20.5z' fill='%23ffffff' stroke='%23111827' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M15.4 5.5l3.1 3.1' stroke='%23111827' stroke-width='1.6'/%3E%3C/svg%3E") 3 21, crosshair !important; }

/* Fantasma de arrastre desde la paleta al pizarrón */
.wf-palette-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 999999;
  transform: translate(-50%, -50%);
  opacity: 0.92;
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.32), 0 4px 12px -2px rgba(15, 23, 42, 0.16);
  transition: none;
  user-select: none;
}

.wf-palette-drag-ghost.is-block {
  min-width: 184px;
  height: 52px;
  background: var(--wf-surface, #ffffff);
  border: 1.5px solid var(--wf-teal, #0d9488);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  box-sizing: border-box;
  color: var(--wf-text, #0f172a);
}

.wf-palette-drag-ghost.is-block .wf-palette-ghost-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--wf-teal-soft, rgba(13, 148, 136, 0.12));
  color: var(--wf-teal, #0d9488);
  flex-shrink: 0;
}

.wf-palette-drag-ghost.is-block .wf-palette-ghost-icon svg {
  width: 18px !important;
  height: 18px !important;
}

.wf-palette-drag-ghost.is-block .wf-palette-ghost-text {
  display: flex;
  flex-direction: column;
}

.wf-palette-drag-ghost.is-block .wf-palette-ghost-text strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.wf-palette-drag-ghost.is-block .wf-palette-ghost-text small {
  font-size: 11px;
  color: var(--wf-muted, #64748b);
  line-height: 1.2;
}

.wf-palette-drag-ghost.is-note {
  width: 150px;
  height: 150px;
  background: #ffe86d;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.wf-palette-drag-ghost.is-note .wf-palette-ghost-pin {
  width: 24px;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  margin: 0 auto 10px;
}

.wf-palette-drag-ghost.is-note .wf-palette-ghost-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.wf-palette-drag-ghost.is-note .wf-palette-ghost-content strong {
  font-size: 13px;
  color: #1e293b;
}

.wf-palette-drag-ghost.is-note .wf-palette-ghost-content span {
  font-size: 11px;
  color: rgba(30, 41, 59, 0.55);
}

body.wf-is-palette-dragging,
body.wf-is-palette-dragging * {
  cursor: grabbing !important;
}
