/* ═══════════════════════════════════════════════════════════
   WORKFLOWS · lista en tarjetas (Recursos › Desarrollo › Workflows)
   Handoff design_handoff_workflows (SDD §2-§6, §9, §11). Solo la LISTA: el editor de canvas
   tiene sus propias reglas. Prefijo `.wfc-*`; SOLO tokens de nisto-tokens.css (nada de hex
   crudo ni azul/indigo/violeta: el acento es grafito).

   Gotchas que este archivo respeta:
     · todo lo que pasa por `x-show` define su `display` acá (clase), nunca inline: x-show
       borra el display inline al mostrar y el flex/grid se pierde;
     · Tailwind es precompilado (tailwind.css): el layout no depende de utilidades que no
       existen ahí (p.ej. md:grid-cols-2), por eso la grilla y los breakpoints viven acá.
   ═══════════════════════════════════════════════════════════ */

/* width:100% → hija de #nisto-main (flex columna): sin esto la vista toma el ancho de su contenido. */
.wfc-page { width: 100%; min-width: 0; max-width: 1240px; margin: 0 auto; padding: 22px 26px 80px; }
.wfc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── Cabecera ─────────────────────────────────────────────── */
.wfc-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.wfc-head-text { min-width: 0; flex: 1 1 280px; }
.wfc-sub { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-muted); max-width: 540px; }
.wfc-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.wfc-link { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--neutral-600); background: none; border: none; padding: 10px 12px; white-space: nowrap;
  cursor: pointer; border-radius: 8px; text-decoration: none; }
.wfc-link:hover, .wfc-link.is-on { color: var(--text-strong); }
.wfc-link-tpl { display: inline-flex; }
.wfc-search-toggle, .wfc-mrow { display: none; }

/* ── Toolbar: buscador + segmentos ────────────────────────── */
.wfc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.wfc-search { position: relative; flex: 1; min-width: 240px; max-width: 340px; }
.wfc-search-ico { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px;
  color: var(--text-faint); pointer-events: none; }
.wfc-search-input { width: 100%; background: var(--surface-card); border: 1px solid var(--pv3-border);
  border-radius: 10px; padding: 9px 36px 9px 34px; font: inherit; font-size: 13.5px; color: var(--text-body); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.wfc-search-input::placeholder { color: var(--text-faint); }
.wfc-search-input:focus { border-color: var(--border-default); box-shadow: var(--ring-focus); }
.wfc-search-x { display: none; position: absolute; right: 4px; top: 50%; width: 30px; height: 30px; margin-top: -15px;
  align-items: center; justify-content: center; border: none; background: none; color: var(--text-faint);
  border-radius: 8px; cursor: pointer; }
.wfc-search-x:hover { color: var(--text-strong); background: var(--neutral-50); }
.wfc-search.has-q .wfc-search-x { display: flex; }
.wfc-seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; }
.wfc-seg-n { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.wfc-total { margin-left: auto; font-size: 12.5px; color: var(--text-faint); }

/* ── Grilla de tarjetas ───────────────────────────────────── */
.wfc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wfc-card { position: relative; background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 16px 17px 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(16,16,18,.04);
  transition: border-color .16s, box-shadow .16s; outline: none; min-width: 0; }
.wfc-card:hover { border-color: var(--pv3-border-btn); box-shadow: 0 8px 20px -14px rgba(16,16,18,.25); }
.wfc-card:focus-visible { border-color: var(--border-default); box-shadow: var(--ring-focus); }
.wfc-card.is-menu { z-index: 5; }
.wfc-row1 { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 11px; }
.wfc-main { flex: 1; min-width: 0; }
.wfc-name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.2px; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfc-trig { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.wfc-trig-kind { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--pv3-text-soft); }
.wfc-ico { display: inline-flex; font-size: 13px; }
.wfc-sep { color: var(--pv3-dot-idle); }
.wfc-freq, .wfc-ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Pill de estado (SDD §2): En vivo / Pausado / Borrador. Siempre con texto (no solo color). */
.wfc-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.wfc-pill-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.wfc-pill--live { background: var(--success-bg); color: var(--success-fg); }
.wfc-pill--paused { background: var(--neutral-100); color: var(--pv3-text-soft); }
.wfc-pill--paused .wfc-pill-dot { background: var(--text-faint); }
.wfc-pill--draft { background: var(--state-amber-bg); color: var(--state-amber-fg); }
.wfc-pill--draft .wfc-pill-dot { background: var(--timeline-pending); }

/* Chips de versión (mono 10.5px, radio 6). */
.wfc-chips { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.wfc-chip { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .3px; padding: 3px 8px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.wfc-chip--pub { background: var(--neutral-50); color: var(--pv3-text-soft); border-color: var(--pv3-chip-border); }
.wfc-chip--none { background: var(--surface-card); color: var(--text-faint); border-color: var(--border-subtle); }
.wfc-chip--draft { background: var(--state-amber-bg); color: var(--state-amber-fg); border-color: var(--draft-border); }

/* Última / próxima corrida */
.wfc-runs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding-top: 12px;
  border-top: 1px solid var(--neutral-100); }
.wfc-cell { min-width: 0; }
.wfc-label { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 4px; }
.wfc-val { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-body); min-width: 0; }
.wfc-val.is-muted { color: var(--text-faint); }
.wfc-approx { flex: none; font-size: 11.5px; color: var(--text-faint); cursor: help; }
.wfc-dot { width: 6px; height: 6px; border-radius: 99px; flex: none; background: var(--pv3-dot-idle); }
.wfc-run--ok .wfc-dot { background: var(--success-fg); }
.wfc-run--fail { color: var(--danger-fg); }
.wfc-run--fail .wfc-dot { background: var(--danger-fg); }
.wfc-run--wait { color: var(--state-amber-fg); }
.wfc-run--wait .wfc-dot { background: var(--timeline-pending); }
.wfc-run--run .wfc-dot { background: var(--text-body); }
.wfc-run--idle .wfc-dot { background: var(--text-faint); }
.wfc-run--never { color: var(--text-faint); }

/* Pie: quién editó + afford «Abrir →» */
.wfc-foot { display: flex; align-items: center; gap: 10px; margin-top: 13px; min-height: 22px; }
.wfc-avatar { width: 22px; height: 22px; border-radius: var(--radius-xs); background: var(--neutral-100); color: var(--pv3-text-soft);
  font-size: 9.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.wfc-edited { font-size: 12.5px; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfc-open { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-strong); flex: none; opacity: 0; transform: translateX(-3px); transition: opacity .14s ease, transform .14s ease; }
.wfc-card:hover .wfc-open, .wfc-card:focus-visible .wfc-open { opacity: 1; transform: none; }

/* ── Menú ⋯ ───────────────────────────────────────────────── */
.wfc-menu-wrap { position: relative; flex: none; }
.wfc-more { flex: none; width: 28px; height: 28px; border-radius: 8px; border: none; background: none; color: var(--text-faint);
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wfc-more:hover, .wfc-more[aria-expanded="true"] { background: var(--surface-page); color: var(--text-strong); }
.wfc-menu { display: block; position: absolute; top: 34px; right: 0; z-index: 40; min-width: 210px; background: var(--surface-card);
  border: 1px solid var(--border-subtle); border-radius: 12px; padding: 6px;
  box-shadow: 0 18px 40px -20px rgba(16,16,18,.3), 0 2px 4px rgba(16,16,18,.05); cursor: default; }
.wfc-menu.is-up { top: auto; bottom: 34px; }
.wfc-menu-item { width: 100%; text-align: left; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: none;
  background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-body); border-radius: 8px; cursor: pointer; }
.wfc-menu-item:hover, .wfc-menu-item:focus-visible { background: var(--neutral-50); outline: none; }
.wfc-menu-item.is-warn { color: var(--state-amber-fg); }
.wfc-menu-item.is-danger { color: var(--danger-fg); }

/* ── Skeletons / vacío / sin resultados / error ───────────── */
.wfc-card--sk { cursor: default; }
.wfc-card--sk:hover { border-color: var(--border-subtle); box-shadow: 0 1px 2px rgba(16,16,18,.04); }
.wfc-sk { display: block; height: 12px; }
.wfc-sk--name { height: 16px; width: 62%; margin-bottom: 10px; }
.wfc-sk--trig { width: 44%; margin-bottom: 14px; }
.wfc-sk--chip { width: 26%; margin-bottom: 14px; }
.wfc-sk--row { width: 100%; height: 30px; }
.wfc-empty { background: var(--surface-card); border: 1px dashed var(--border-default); border-radius: 16px; padding: 40px 32px; }
.wfc-empty-head { max-width: 470px; }
.wfc-empty-title { font-size: 19px; font-weight: 600; letter-spacing: -0.4px; color: var(--text-strong); margin-bottom: 7px; }
.wfc-empty-sub { margin: 0 0 24px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.wfc-tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.wfc-tpl { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; width: 100%;
  border: 1px solid var(--border-subtle); border-radius: 12px; padding: 14px 15px; background: var(--surface-subtle);
  cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.wfc-tpl:hover, .wfc-tpl:focus-visible { background: var(--surface-card); border-color: var(--border-default); outline: none; }
.wfc-tpl:disabled { opacity: .6; cursor: progress; }
.wfc-tpl-kind { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; color: var(--text-faint); }
.wfc-tpl-name { font-size: 14px; font-weight: 600; color: var(--text-strong); margin: 8px 0 5px; }
.wfc-tpl-desc { font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.wfc-scratch { background: none; border: none; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--pv3-text-soft);
  cursor: pointer; padding: 0; text-align: left; text-decoration: underline; text-decoration-color: var(--border-default);
  text-underline-offset: 3px; }
.wfc-scratch:hover { color: var(--text-strong); }
.wfc-note { display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--surface-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 46px 24px; text-align: center; }
.wfc-note-title { font-size: 14.5px; font-weight: 600; color: var(--text-strong); }
.wfc-note-sub { font-size: 13px; color: var(--text-muted); }

/* ── Papelera ─────────────────────────────────────────────── */
.wfc-trash { display: block; margin-top: 26px; }
.wfc-trash-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text-body); }
.wfc-trash-help { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); max-width: 640px; }
.wfc-trash-box { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.wfc-trash-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--neutral-100); }
.wfc-trash-row:first-of-type { border-top: none; }
.wfc-trash-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--neutral-600);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfc-trash-when { flex: none; font-size: 12.5px; color: var(--text-faint); }
.wfc-trash-restore { flex: none; background: none; border: none; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text-strong); cursor: pointer; padding: 6px 0; }
.wfc-trash-restore:hover { text-decoration: underline; }
.wfc-trash-purge { color: var(--danger-fg); }
.wfc-trash-empty { display: block; padding: 30px 16px; text-align: center; font-size: 13.5px; color: var(--text-faint); }

/* ── Panel de detalle (drawer 440px; en móvil .nisto-sheet lo vuelve bottom sheet) ── */
.wfc-drawer { width: 440px; border-left: 1px solid var(--border-subtle); }
.wfc-d { padding: 22px 24px 30px; }
.wfc-d-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.wfc-d-titles { flex: 1; min-width: 0; }
.wfc-d-eyebrow { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 7px; }
.wfc-d-name { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.4px; color: var(--text-strong); line-height: 1.3;
  outline: none; overflow-wrap: anywhere; }
.wfc-d-close { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--surface-card);
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wfc-d-close:hover { background: var(--neutral-50); color: var(--text-strong); }
.wfc-d-chips { margin-bottom: 20px; }
.wfc-d-actions { display: flex; gap: 8px; margin-bottom: 22px; }
.wfc-d-open { flex: 1; justify-content: center; }
.wfc-d-sec { display: flex; gap: 8px; flex: none; }
.wfc-d-more { width: 44px; justify-content: center; padding-left: 0; padding-right: 0; }
.wfc-d-menu { top: 48px; }
.wfc-d-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 15px 16px; background: var(--surface-subtle);
  border: 1px solid var(--pv3-border-soft); border-radius: 12px; margin-bottom: 22px; }
.wfc-d-meta > div { min-width: 0; }
.wfc-d-val { font-size: 13px; color: var(--text-body); overflow-wrap: anywhere; }
.wfc-d-runs-title { font-size: 13.5px; font-weight: 600; color: var(--text-strong); margin-bottom: 10px; }
.wfc-d-runs { border: 1px solid var(--pv3-border-soft); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.wfc-d-run { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-top: 1px solid var(--pv3-border-row); color: var(--text-body); }
.wfc-d-run:first-child { border-top: none; }
.wfc-d-run-when { flex: 1; min-width: 0; font-size: 13px; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfc-d-run-dur { flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.wfc-d-run-st { flex: none; font-size: 12.5px; font-weight: 500; }
.wfc-d-run-empty { padding: 16px 13px; font-size: 13px; color: var(--text-faint); }
.wfc-d-all { font-size: 13px; font-weight: 500; color: var(--pv3-text-soft); text-decoration: none; }
.wfc-d-all:hover { color: var(--text-strong); text-decoration: underline; }

/* ── Selector «Desde plantilla» (lista no vacía) ──────────── */
.wfc-tpl-modal { display: flex; align-items: center; justify-content: center; padding: 16px; }
.wfc-tpl-panel { position: relative; width: 640px; max-width: 100%; max-height: 86vh; overflow-y: auto; background: var(--surface-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-float); padding: 22px 24px 24px; }
.wfc-tpl-panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.wfc-tpl-panel-title { flex: 1; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.3px; color: var(--text-strong); outline: none; }
.wfc-tpl-panel .wfc-tpl-grid { margin-bottom: 0; }

/* FAB (solo móvil) */
.wfc-fab { display: none; }

/* ═══ Móvil (≤768px · SDD §6) ═══════════════════════════════ */
@media (max-width: 768px) {
  .wfc-page { padding: 14px 16px calc(var(--mnav-h) + 90px); }
  .wfc-head { align-items: flex-start; gap: 12px; margin-bottom: 0; }
  .wfc-head-text { flex: 1; }
  .wfc-head .nis-eyebrow { display: none; }
  .wfc-head .nis-h1 { font-size: 22px; letter-spacing: -0.6px; }
  .wfc-sub { font-size: 13.5px; }
  .wfc-head-actions { display: none; }
  .wfc-search-toggle { display: flex; flex: none; width: 44px; height: 44px; border-radius: var(--radius-sm); align-items: center;
    justify-content: center; padding: 0; cursor: pointer; background: var(--surface-card); color: var(--text-body); border: 1px solid var(--pv3-border); }
  .wfc-search-toggle.is-on { background: var(--surface-dark); color: var(--text-on-dark); border-color: var(--surface-dark); }

  .wfc-mrow { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
  .wfc-mrow-link { flex: 1; min-height: 44px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600;
    color: var(--text-body); text-decoration: none; }
  .wfc-mbtn { flex: none; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 0 14px; border: 1px solid var(--pv3-border); background: var(--surface-card); border-radius: var(--radius-sm); font: inherit;
    font-size: 14px; font-weight: 600; color: var(--text-body); cursor: pointer; }
  .wfc-mbtn--icon { padding: 0; width: 44px; }
  .wfc-mbtn.is-on { background: var(--surface-dark); color: var(--text-on-dark); border-color: var(--surface-dark); }

  .wfc-toolbar { display: block; margin-bottom: 0; }
  .wfc-search { display: none; max-width: none; min-width: 0; margin-bottom: 12px; }
  .wfc-search.is-open { display: block; }
  .wfc-search-ico { left: 13px; width: 16px; height: 16px; margin-top: -8px; }
  .wfc-search-input { font-size: 16px; border-radius: var(--radius-sm); padding: 12px 44px 12px 37px; }   /* 16px: sin zoom en iOS */
  .wfc-search.is-open .wfc-search-x { display: flex; right: 2px; width: 40px; height: 40px; margin-top: -20px; border-radius: 10px; }
  .wfc-seg { display: flex; gap: 7px; overflow-x: auto; background: none; padding: 0 16px 4px; margin: 0 -16px 16px; border-radius: 0;
    scrollbar-width: none; }
  .wfc-seg::-webkit-scrollbar { display: none; }
  .wfc-seg-opt { flex: none; min-height: 44px; border: 1px solid var(--pv3-border); background: var(--surface-card); color: var(--pv3-text-soft);
    font-size: 13.5px; padding: 0 16px; border-radius: 99px; box-shadow: none; }
  .wfc-seg-opt.active { background: var(--surface-dark); color: var(--text-on-dark); border-color: var(--surface-dark); box-shadow: none; }
  .wfc-seg-opt .wfc-seg-n { color: inherit; opacity: .65; }
  .wfc-total { display: none; }

  .wfc-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wfc-card { padding: 15px 16px 13px; }
  .wfc-row1 { margin-bottom: 0; }
  .wfc-name { white-space: normal; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .wfc-trig { font-size: 13px; margin-top: 8px; }
  .wfc-pill { font-size: 11.5px; padding: 4px 9px; }
  .wfc-card .wfc-menu-wrap { display: none; }          /* sin ⋯ en la tarjeta: las acciones viven en el sheet */
  .wfc-chips { margin: 10px 0 0; gap: 7px; }
  .wfc-runs { margin-top: 12px; }
  .wfc-foot { display: none; }

  .wfc-empty { padding: 22px 18px; }
  .wfc-empty-title { font-size: 17px; letter-spacing: -0.3px; margin-bottom: 6px; }
  .wfc-empty-sub { font-size: 13.5px; margin-bottom: 18px; }
  .wfc-tpl-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 16px; }
  .wfc-tpl { padding: 13px 14px; }
  .wfc-tpl-name { font-size: 14.5px; margin: 7px 0 5px; }
  .wfc-tpl-desc { font-size: 13px; }
  .wfc-scratch { min-height: 44px; }
  .wfc-note { padding: 34px 18px; }

  .wfc-trash { margin-top: 20px; }
  .wfc-trash-row { flex-wrap: wrap; gap: 6px 12px; padding: 13px 15px; }
  .wfc-trash-name { flex-basis: 100%; white-space: normal; }
  .wfc-trash-when { flex: 1; }
  .wfc-trash-restore { min-height: 44px; font-size: 13px; }

  .wfc-d { padding: 8px 18px 26px; }
  .wfc-d-close { width: 44px; height: 44px; }
  .wfc-d-actions { flex-direction: column; gap: 9px; margin-bottom: 20px; }
  .wfc-d-open { width: 100%; min-height: 48px; font-size: 15px; }
  .wfc-d-sec .nis-btn-2 { min-height: 48px; }
  .wfc-d-sec { width: 100%; }
  .wfc-d-sec .wfc-d-run-btn { flex: 1; justify-content: center; }
  .wfc-d-more { width: 48px; }
  .wfc-d-menu { left: auto; right: 0; top: auto; bottom: 54px; }
  .wfc-d-val { font-size: 13.5px; }
  .wfc-d-run { padding: 12px 13px; }
  .wfc-d-all { display: inline-flex; align-items: center; min-height: 44px; }
  .wfc-menu-item { min-height: 44px; }

  .wfc-tpl-modal { align-items: flex-end; padding: 0 0 var(--mnav-h); }
  .wfc-tpl-panel { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; padding: 18px 18px 24px; }

  .wfc-fab { display: flex; position: fixed; right: 16px; bottom: calc(var(--mnav-h) + 16px); z-index: 40; width: 54px; height: 54px;
    border-radius: 99px; background: var(--surface-dark); color: var(--text-on-dark); border: none; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; box-shadow: 0 10px 26px -10px rgba(16,16,18,.55); }
}

/* ═══════════════════════════════════════════════════════════
   ANALÍTICA DE PROCEDIMIENTOS (`.ins-*`) — Workflows › Resumen (resultados) y
   Actividades › Procedimientos › Resumen / Procedimientos (operación).
   Mismo kit visual que Campañas › Resumen (handoff «Campañas y Workflows»): tarjetas de 13px de
   radio, eyebrow mono 9.5px, KPIs auto-fit 160px, gráficos con NistoMini (.nm-* en
   nisto-tokens.css). Solo tokens; lo que pasa por x-show define su display en clase.
   ═══════════════════════════════════════════════════════════ */
.ins-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 13px; min-width: 0; }
.ins-pad { padding: 14px 16px; }
.ins-col { display: flex; flex-direction: column; }
.ins-eb { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); }
.ins-mono { font-family: var(--font-mono); }
.ins-muted { color: var(--text-muted); }
.ins-faint { color: var(--text-faint); }
.ins-hrow { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; }
.ins-hrow--top { align-items: flex-start; }
.ins-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ins-kpi { padding: 14px 15px; }
.ins-kpi-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-kpi-v { display: block; margin-top: 7px; font-size: 25px; font-weight: 700; letter-spacing: -0.7px; color: var(--text-strong); white-space: nowrap; }
.ins-kpi-d { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-faint); line-height: 1.4; }
.ins-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.ins-row > .ins-wide { flex: 2 1 440px; }
.ins-row > .ins-narrow { flex: 1 1 300px; }
.ins-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 12px; margin-bottom: 12px; }
.ins-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-muted); }
.ins-legend > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ins-legend .ins-lname { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; display: inline-block; }
.ins-line { width: 12px; height: 2px; border-radius: 2px; flex: none; display: inline-block; background: var(--series-revenue); }
.ins-empty { display: flex; align-items: center; justify-content: center; min-height: 170px; font-size: 13px; color: var(--text-muted); text-align: center; padding: 16px; flex: 1; }
.ins-note { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.ins-link { border: 0; background: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-body); padding: 0; white-space: nowrap; }
.ins-link:hover { color: var(--text-strong); }
.ins-link:focus-visible { outline: none; box-shadow: var(--ring-focus); border-radius: 4px; }
.ins-badge { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: var(--warning-bg); color: var(--warning-fg); white-space: nowrap; }
.ins-cta { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 9px; border: 0; cursor: pointer;
  background: var(--surface-dark); color: var(--text-on-dark); font: inherit; font-size: 13px; font-weight: 600; align-self: flex-start; }
.ins-cta:focus-visible { outline: none; box-shadow: var(--ring-focus); }
/* Selector de período (segmented) y pestañas de la vista. */
.ins-seg { display: inline-flex; gap: 2px; background: var(--surface-sunken); border-radius: 9px; padding: 3px; }
.ins-seg button { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 7px;
  background: transparent; color: var(--text-muted); white-space: nowrap; }
.ins-seg button.on { background: var(--surface-card); color: var(--text-strong); box-shadow: 0 1px 3px rgba(16,16,18,.12); }
.ins-seg button:focus-visible, .ins-tab:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.ins-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ins-tabs-sp { flex: 1; }
.ins-tab { cursor: pointer; border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); font: inherit;
  font-size: 13px; font-weight: 600; height: 34px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ins-tab.on { border-color: var(--tab-on-border); background: var(--tab-on-bg); color: var(--tab-on-fg); }
.ins-tab .ins-mono { font-weight: 500; }
/* Skeletons con la forma de cada tarjeta. */
.ins-skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--neutral-100) 0%, var(--neutral-50) 50%, var(--neutral-100) 100%);
  background-size: 200% 100%; animation: insShim 1.3s ease-in-out infinite; }
@keyframes insShim { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.ins-state { padding: 52px 24px; text-align: center; }
.ins-state-t { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.ins-state .ins-cta { margin: 16px auto 0; }
/* Tablas con scroll horizontal DENTRO de la tarjeta. */
.ins-table { overflow-x: auto; }
.ins-thead, .ins-tr { display: grid; gap: 10px; align-items: center; padding: 9px 16px; }
.ins-thead { border-bottom: 1px solid var(--chart-axis); }
.ins-thead > span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
.ins-tr { padding: 10px 16px; border-bottom: 1px solid var(--chart-grid); font-family: var(--font-mono); font-size: 12px; color: var(--text-body); cursor: pointer; outline: none; }
.ins-tr:hover, .ins-tr:focus-visible { background: var(--surface-subtle); }
.ins-r { text-align: right; }
.ins-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ins-name > b { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-sub { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 16px; font-size: 12px; color: var(--text-muted); }
.wfr-top { min-width: 780px; grid-template-columns: 20px minmax(150px, 1fr) 104px 80px 62px 58px 56px 82px 76px 56px; }
/* Ingreso por procedimiento: barra de participación + ranking. */
.ins-share { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; margin-top: 16px; }
.ins-share > span { display: block; height: 100%; min-width: 3px; outline: none; }
.ins-share > span:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-ring); }
.ins-rank { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.ins-rank > button { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; font: inherit; font-size: 12.5px;
  text-align: left; background: none; border: 0; padding: 4px 6px; margin: 0 -6px; border-radius: 7px; cursor: pointer; color: var(--text-body); }
.ins-rank > button:hover, .ins-rank > button:focus-visible { background: var(--surface-subtle); outline: none; }
.ins-rank .ins-rn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-rank .ins-rv { font-family: var(--font-mono); font-weight: 600; color: var(--text-strong); }
.ins-rank .ins-rs { font-family: var(--font-mono); color: var(--text-faint); text-align: right; }
/* Barras horizontales (Qué las dispara). */
.ins-hbars { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ins-hbar { display: grid; grid-template-columns: minmax(0, 140px) minmax(40px, 1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-body); }
.ins-hbar-t { height: 8px; border-radius: 99px; background: var(--surface-page); display: block; overflow: hidden; }
.ins-hbar-t > span { display: block; height: 100%; border-radius: 99px; background: var(--text-body); }
.ins-hbar-v { font-family: var(--font-mono); font-size: 12px; color: var(--text-strong); text-align: right; }
/* Esperando + Últimas fallas. */
.ins-wrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; margin: 0 -6px; border: 0; border-bottom: 1px solid var(--chart-grid);
  background: none; border-radius: 8px; cursor: pointer; font: inherit; text-align: left; }
.ins-wrow:last-child { border-bottom: 0; }
.ins-wrow:hover, .ins-wrow:focus-visible { background: var(--surface-subtle); outline: none; }
.ins-wrow-l { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-strong); min-width: 0; }
.ins-wrow-d { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.ins-wrow-n { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-strong); min-width: 26px; text-align: right; }
.ins-wrow.is-zero .ins-wrow-l, .ins-wrow.is-zero .ins-wrow-n { color: var(--text-faint); font-weight: 500; }
.ins-fail { display: block; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--chart-grid); border-left: 3px solid var(--danger-fg);
  background: none; cursor: pointer; text-align: left; font: inherit; }
.ins-fail:last-child { border-bottom: 0; }
.ins-fail:hover, .ins-fail:focus-visible { background: var(--surface-subtle); outline: none; }
.ins-fail-h { display: flex; justify-content: space-between; gap: 10px; }
.ins-fail-h b { font-size: 13px; font-weight: 600; color: var(--text-strong); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-fail-h span { font-size: 12px; font-weight: 600; color: var(--text-body); white-space: nowrap; }
.ins-fail-e { display: block; font-size: 12.5px; line-height: 1.4; color: var(--danger-fg); margin-top: 3px; }
.ins-fail-m { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 2px; }
@media (max-width: 768px) {
  .ins-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ins-kpi-v { font-size: 21px; }
  .ins-tabs { margin-bottom: 12px; }
  .ins-tabs-sp { flex-basis: 100%; height: 0; }
}
.proc-list { min-width: 720px; grid-template-columns: minmax(160px, 1fr) 92px 110px 60px 56px 100px 92px; gap: 10px; }
/* Actividades › Procedimientos: en móvil el hub no tiene gutter propio (cada bloque pone el suyo). */
@media (max-width: 768px) { .proc-ins { padding: 0 16px; } }
