/* ═══════════════════════════════════════════════════════════════════════════
   WF UI 1.6 - Estilo WF para pantallas de administración (guía WF-DESIGN-GUIDE.md v1.0)
   Todo cuelga de .wfui (tokens + componentes con prefijo wfui-). No toca nada fuera de él.
   ═══════════════════════════════════════════════════════════════════════════ */
.wfui-wrap { margin: 10px 20px 0 2px; }
.wfui, .wfui *, .wfui *::before, .wfui *::after { box-sizing: border-box; }
.wfui {
    --wf-ink: #0f172a; --wf-mute: #64748b; --wf-line: #e2e8f0; --wf-line-2: #cbd5e1; --wf-bg: #f8fafc; --wf-card: #fff; --wf-surface: #fff; --wf-surface-2: #f1f5f9; --wf-inv: #fff;
    --wf-gold: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-d: var(--wfak-accent-2, #a8873a); --wf-gold-h: var(--wfak-accent-2, #a8873a); --wf-gold-soft: rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .18); --wf-gold-tx: var(--wfak-accent-2, #7a5f17); --wf-gold-ink: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-on-gold: var(--wfak-on-accent, #1a1405); --wf-on-gold-h: var(--wfak-on-accent, #fff);
    --wf-ok: #16a34a; --wf-err: #dc2626; --wf-warn: #d97706; --wf-info: #2563eb;
    --wf-ok-bg: #dcfce7; --wf-ok-soft: #f0fdf4; --wf-ok-bd: #bbf7d0; --wf-ok-tx: #166534;
    --wf-warn-bg: #fef3c7; --wf-warn-soft: #fffbeb; --wf-warn-bd: #fde68a; --wf-warn-tx: #92400e;
    --wf-bad-bg: #fee2e2; --wf-bad-soft: #fef2f2; --wf-bad-bd: #fecaca; --wf-bad-tx: #991b1b;
    --wf-info-bg: #dbeafe; --wf-info-soft: #eff6ff; --wf-info-bd: #bfdbfe; --wf-info-tx: #1e40af;
    --wf-badge-tx: #334155; --wf-skel-a: #eef2f7; --wf-skel-b: #f8fafc; --wf-chipx: rgba(255,255,255,.14); --wf-chipx-h: rgba(255,255,255,.28); --wf-toast-ok: #4ade80;
    --wf-r: calc(var(--wfak-radius, 10px) + 4px); --wf-r-sm: var(--wfak-radius, 10px); --wf-sh: 0 1px 2px rgba(15,23,42,.05); --wf-sh-lg: 0 20px 50px rgba(15,23,42,.28);
    --wf-focus: 0 0 0 3px rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .45);
    color-scheme: light;
    color: var(--wf-ink); font-size: 14px; line-height: 1.45; position: relative;
}
/* Modo oscuro (WF UI 1.5): mismos tokens con otros valores. data-wf-theme = light | dark | auto.
   auto sigue al sistema operativo y al modo oscuro de AdminKit (body.wf-ak-dark). Sin JS: no hay parpadeo. */
.wfui[data-wf-theme="dark"], body.wf-ak-dark .wfui[data-wf-theme="auto"] {
    --wf-ink: #e8edf5; --wf-mute: #94a3b8; --wf-line: #2a3750; --wf-line-2: #3a4a68; --wf-bg: #0b1220; --wf-card: #131c2e; --wf-surface: #131c2e; --wf-surface-2: #1c2740; --wf-inv: #0b1220;
    --wf-gold: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-d: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-h: var(--wfak-accent-2, #b8963a); --wf-gold-soft: rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .22); --wf-gold-tx: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-ink: var(--wfak-accent-2, #8a6d1c); --wf-on-gold: var(--wfak-on-accent, #1a1405); --wf-on-gold-h: var(--wfak-on-accent, #1a1405);
    --wf-ok: #22c55e; --wf-err: #f87171; --wf-warn: #fbbf24; --wf-info: #60a5fa;
    --wf-ok-bg: rgba(34,197,94,.18); --wf-ok-soft: rgba(34,197,94,.10); --wf-ok-bd: rgba(34,197,94,.35); --wf-ok-tx: #86efac;
    --wf-warn-bg: rgba(251,191,36,.18); --wf-warn-soft: rgba(251,191,36,.10); --wf-warn-bd: rgba(251,191,36,.35); --wf-warn-tx: #fcd34d;
    --wf-bad-bg: rgba(248,113,113,.18); --wf-bad-soft: rgba(248,113,113,.10); --wf-bad-bd: rgba(248,113,113,.35); --wf-bad-tx: #fca5a5;
    --wf-info-bg: rgba(96,165,250,.18); --wf-info-soft: rgba(96,165,250,.10); --wf-info-bd: rgba(96,165,250,.35); --wf-info-tx: #93c5fd;
    --wf-badge-tx: #cbd5e1; --wf-skel-a: #1c2740; --wf-skel-b: #26334f; --wf-chipx: rgba(0,0,0,.16); --wf-chipx-h: rgba(0,0,0,.3); --wf-toast-ok: #15803d;
    --wf-sh: 0 1px 2px rgba(0,0,0,.4); --wf-sh-lg: 0 20px 50px rgba(0,0,0,.6);
    --wf-focus: 0 0 0 3px rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .45);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    .wfui[data-wf-theme="auto"] {
        --wf-ink: #e8edf5; --wf-mute: #94a3b8; --wf-line: #2a3750; --wf-line-2: #3a4a68; --wf-bg: #0b1220; --wf-card: #131c2e; --wf-surface: #131c2e; --wf-surface-2: #1c2740; --wf-inv: #0b1220;
        --wf-gold: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-d: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-h: var(--wfak-accent-2, #b8963a); --wf-gold-soft: rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .22); --wf-gold-tx: var(--wfak-accent, var(--wfak-fe-accent, #c9a84c)); --wf-gold-ink: var(--wfak-accent-2, #8a6d1c); --wf-on-gold: var(--wfak-on-accent, #1a1405); --wf-on-gold-h: var(--wfak-on-accent, #1a1405);
        --wf-ok: #22c55e; --wf-err: #f87171; --wf-warn: #fbbf24; --wf-info: #60a5fa;
        --wf-ok-bg: rgba(34,197,94,.18); --wf-ok-soft: rgba(34,197,94,.10); --wf-ok-bd: rgba(34,197,94,.35); --wf-ok-tx: #86efac;
        --wf-warn-bg: rgba(251,191,36,.18); --wf-warn-soft: rgba(251,191,36,.10); --wf-warn-bd: rgba(251,191,36,.35); --wf-warn-tx: #fcd34d;
        --wf-bad-bg: rgba(248,113,113,.18); --wf-bad-soft: rgba(248,113,113,.10); --wf-bad-bd: rgba(248,113,113,.35); --wf-bad-tx: #fca5a5;
        --wf-info-bg: rgba(96,165,250,.18); --wf-info-soft: rgba(96,165,250,.10); --wf-info-bd: rgba(96,165,250,.35); --wf-info-tx: #93c5fd;
        --wf-badge-tx: #cbd5e1; --wf-skel-a: #1c2740; --wf-skel-b: #26334f; --wf-chipx: rgba(0,0,0,.16); --wf-chipx-h: rgba(0,0,0,.3); --wf-toast-ok: #15803d;
        --wf-sh: 0 1px 2px rgba(0,0,0,.4); --wf-sh-lg: 0 20px 50px rgba(0,0,0,.6);
        --wf-focus: 0 0 0 3px rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .45);
        color-scheme: dark;
    }
}
/* Contenedor sin pantalla propia (avisos y dialogos en paginas que no son de wf-ui): no ocupa sitio ni pinta fondo. */
.wfui.wfui-host { background: transparent !important; padding: 0 !important; margin: 0; height: 0; min-height: 0; }

/* En oscuro, la pantalla (el .wfui de primer nivel) pinta su propio fondo: el escritorio de WordPress sigue siendo claro. */
.wfui[data-wf-theme="dark"]:not(.wfui .wfui), body.wf-ak-dark .wfui[data-wf-theme="auto"]:not(.wfui .wfui) { background: var(--wf-bg); border-radius: var(--wf-r); padding: 16px 20px 20px; }
@media (prefers-color-scheme: dark) { .wfui[data-wf-theme="auto"]:not(.wfui .wfui) { background: var(--wf-bg); border-radius: var(--wf-r); padding: 16px 20px 20px; } }
.wfui[data-wf-theme="dark"] .wfui-drawer, .wfui[data-wf-theme="dark"] .wfui-dialog { border: 1px solid var(--wf-line); }
.wfui[data-wf-theme="dark"] code { background: var(--wf-surface-2); }

/* Selector de tema (cabecera de las pantallas) */
.wfui-theme { position: relative; }
.wfui-theme-menu { position: absolute; z-index: 99991; right: 0; top: calc(100% + 6px); min-width: 170px; margin: 0; padding: 4px; list-style: none; background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: 12px; box-shadow: var(--wf-sh-lg); }
.wfui-theme-menu button { appearance: none; display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--wf-ink); font-size: 13.5px; text-align: left; cursor: pointer; }
.wfui-theme-menu button:hover, .wfui-theme-menu button:focus-visible { background: var(--wf-gold-soft); outline: none; }
.wfui-theme-menu button[aria-checked=true] { font-weight: 700; }
.wfui-theme-menu button[aria-checked=true]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--wf-gold); }

.wfui button, .wfui input, .wfui select, .wfui textarea { font-family: inherit; }
.wfui [hidden] { display: none !important; }
/* Avisos nativos de WordPress y de otros plugins dentro de una pantalla WF: conservan su fondo claro, asi que el texto va oscuro tambien en modo oscuro. */
.wfui .notice:not(.wfui-alert), .wfui div.updated, .wfui div.error, .wfui .update-nag { color: #1d2327; }
.wfui .notice:not(.wfui-alert) a, .wfui div.updated a, .wfui div.error a, .wfui .update-nag a { color: #2271b1; }
.wfui-i { flex: none; vertical-align: middle; }
.wfui code { background: var(--wf-surface-2); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; color: var(--wf-ink); }
.wfui a { color: var(--wf-gold-d); }
.wfui-notices:empty { display: none; }
.wfui-notices { margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }

/* Cabecera */
.wfui-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 18px; }
.wfui-h1 { margin: 6px 0 4px !important; padding: 0 !important; font-size: 26px !important; line-height: 1.2 !important; font-weight: 700; color: var(--wf-ink); }
.wfui-sub { margin: 0; color: var(--wf-mute); font-size: 13.5px; max-width: 80ch; }
.wfui-head-a { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wfui-wrap .wp-header-end { border: 0; margin: 0; height: 0; visibility: hidden; }

/* Botones */
.wfui-btn {
    appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: var(--wf-r-sm);
    border: 1px solid var(--wf-line); background: var(--wf-surface); color: var(--wf-ink); font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .15s; line-height: 1; white-space: nowrap;
}
.wfui-btn:hover { border-color: var(--wf-line-2); background: var(--wf-bg); color: var(--wf-ink); }
.wfui-btn:focus-visible { outline: none; box-shadow: var(--wf-focus); }
.wfui-btn:disabled, .wfui-btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.wfui-btn-primary { background: var(--wf-gold); border-color: var(--wf-gold); color: var(--wf-on-gold); box-shadow: 0 2px 8px rgba(var(--wfak-accent-rgb, var(--wfak-fe-accent-rgb, 201,168,76)), .35); }
.wfui-btn-primary:hover { background: var(--wf-gold-h); border-color: var(--wf-gold-h); color: var(--wf-on-gold-h); }
.wfui-btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.wfui-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.wfui-btn-ghost { background: transparent; border-color: transparent; }
.wfui-btn-ghost:hover { background: var(--wf-surface-2); border-color: transparent; }
.wfui-btn-sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.wfui-btn-icon { min-height: 34px; width: 34px; padding: 0; }
.wfui-btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.wfui-btn.is-busy .wfui-i { opacity: 0; }
.wfui-btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.25); border-top-color: var(--wf-on-gold); border-radius: 50%; animation: wfui-spin .7s linear infinite; }
@keyframes wfui-spin { to { transform: rotate(360deg); } }
.wfui-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tarjetas */
.wfui-card { background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-r); box-shadow: var(--wf-sh); margin: 0 0 16px; overflow: hidden; }
.wfui-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.wfui-card-h h2, .wfui-card-h h3 { margin: 0; padding: 0; font-size: 16px; font-weight: 700; color: var(--wf-ink); display: flex; align-items: center; gap: 8px; }
.wfui-card-h h2 .wfui-i, .wfui-card-h h3 .wfui-i { color: var(--wf-gold-d); }
.wfui-card-h p { margin: 4px 0 0; color: var(--wf-mute); font-size: 13px; max-width: 75ch; }
.wfui-card-b { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }

/* Cifras */
.wfui-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 16px; }
.wfui-stat { background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: var(--wf-r); padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--wf-sh); }
.wfui-stat-i { width: 38px; height: 38px; border-radius: 12px; background: var(--wf-surface-2); color: var(--wf-mute); display: grid; place-items: center; flex: none; }
.wfui-stat-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wfui-stat-l { font-size: 11.5px; color: var(--wf-mute); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.wfui-stat b { font-size: 21px; line-height: 1.2; }
.wfui-stat.is-ok .wfui-stat-i { background: var(--wf-ok-bg); color: var(--wf-ok); }
.wfui-stat.is-warn .wfui-stat-i { background: var(--wf-warn-bg); color: var(--wf-warn); }
.wfui-stat.is-bad .wfui-stat-i { background: var(--wf-bad-bg); color: var(--wf-err); }
.wfui-stat.is-gold .wfui-stat-i { background: var(--wf-gold-soft); color: var(--wf-gold-d); }

/* Avisos */
.wfui-alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: 13.5px; }
.wfui-alert > div { flex: 1; min-width: 0; }
.wfui-alert .wfui-i { margin-top: 1px; }
.wfui-alert.is-ok { background: var(--wf-ok-soft); border-color: var(--wf-ok-bd); color: var(--wf-ok-tx); }
.wfui-alert.is-warn { background: var(--wf-warn-soft); border-color: var(--wf-warn-bd); color: var(--wf-warn-tx); }
.wfui-alert.is-bad { background: var(--wf-bad-soft); border-color: var(--wf-bad-bd); color: var(--wf-bad-tx); }
.wfui-alert.is-info { background: var(--wf-info-soft); border-color: var(--wf-info-bd); color: var(--wf-info-tx); }
.wfui-alert a { color: inherit; font-weight: 700; }

/* Insignias */
.wfui-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--wf-surface-2); color: var(--wf-badge-tx); white-space: nowrap; }
.wfui-badge.is-gold { background: var(--wf-gold-soft); color: var(--wf-gold-tx); }
.wfui-badge.is-ok { background: var(--wf-ok-bg); color: var(--wf-ok-tx); }
.wfui-badge.is-warn { background: var(--wf-warn-bg); color: var(--wf-warn-tx); }
.wfui-badge.is-bad { background: var(--wf-bad-bg); color: var(--wf-bad-tx); }
.wfui-badge.is-info { background: var(--wf-info-bg); color: var(--wf-info-tx); }
.wfui-badge.is-ink { background: var(--wf-ink); color: var(--wf-inv); }

/* Campos */
.wfui-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wfui-f.is-hidden { display: none; }
.wfui-fl { font-weight: 700; font-size: 13px; color: var(--wf-ink); }
.wfui-fl .wfui-req { color: var(--wf-err); margin-left: 3px; }
.wfui-help { margin: 0; color: var(--wf-mute); font-size: 12.5px; line-height: 1.45; max-width: 80ch; }
.wfui-err { margin: 0; color: var(--wf-err); font-size: 12.5px; font-weight: 600; }
.wfui .wfui-in, .wfui select.wfui-in, .wfui textarea.wfui-in {
    width: 100%; max-width: none; min-height: 40px; padding: 8px 12px; border: 1px solid var(--wf-line); border-radius: var(--wf-r-sm); background: var(--wf-surface); color: var(--wf-ink); font-size: 14px; box-shadow: none; line-height: 1.4;
}
.wfui textarea.wfui-in { min-height: 76px; resize: vertical; }
.wfui .wfui-in:focus { outline: none; border-color: var(--wf-gold); box-shadow: var(--wf-focus); }
.wfui .wfui-in.is-invalid { border-color: var(--wf-err); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.wfui-mono { font-family: Consolas, Menlo, monospace !important; font-size: 13px !important; }
.wfui-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wfui-row > .wfui-in { flex: 1 1 220px; width: auto; }
.wfui-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.wfui-sep { border: 0; border-top: 1px solid var(--wf-line); margin: 0; }

/* Interruptor */
.wfui-sw { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 4px 0; user-select: none; }
.wfui-sw input[type=checkbox] { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; margin: 0 !important; }
.wfui-sw-ui { flex: none; width: 44px; height: 24px; border-radius: 999px; background: var(--wf-line-2); position: relative; transition: background .18s; margin-top: 1px; }
.wfui-sw-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
.wfui-sw input:checked + .wfui-sw-ui { background: var(--wf-ok); }
.wfui-sw input:checked + .wfui-sw-ui::after { transform: translateX(20px); }
.wfui-sw input:focus-visible + .wfui-sw-ui { box-shadow: var(--wf-focus); }
.wfui-sw input:disabled + .wfui-sw-ui { opacity: .5; }
.wfui-sw-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wfui-sw-t b { font-size: 13.5px; font-weight: 700; }
.wfui-sw-t small { color: var(--wf-mute); font-size: 12.5px; line-height: 1.4; }
.wfui-sw.is-mini { padding: 0; }

/* Segmentado */
/* Pestañas y segmentados: SIEMPRE en una sola linea horizontal. Si no caben, se desplazan en X (sin barra) y la activa se centra sola (wf-ui.js). Nunca en columna ni en varias filas. */
.wfui-seg, .wfui-tabs { display: inline-flex; flex-direction: row; flex-wrap: nowrap; gap: 2px; padding: 3px; background: var(--wf-surface-2); border-radius: 12px; max-width: 100%; box-sizing: border-box; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
.wfui-seg::-webkit-scrollbar, .wfui-tabs::-webkit-scrollbar { display: none; }
.wfui-seg button, .wfui-tabs button { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: center; appearance: none; border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--wf-mute); cursor: pointer; min-height: 34px; }
.wfui-seg button:hover, .wfui-tabs button:hover { color: var(--wf-ink); }
.wfui-seg button.is-on, .wfui-tabs button.is-on { background: var(--wf-surface); color: var(--wf-ink); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.wfui-seg button:focus-visible, .wfui-tabs button:focus-visible { outline: none; box-shadow: var(--wf-focus); }

/* Chips (selección múltiple con botones) */
.wfui-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wfui-chip { appearance: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--wf-line); background: var(--wf-surface); color: var(--wf-mute); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.wfui-chip:hover { border-color: var(--wf-line-2); color: var(--wf-ink); }
.wfui-chip[aria-pressed=true] { background: var(--wf-ink); border-color: var(--wf-ink); color: var(--wf-inv); }
.wfui-chip:focus-visible { outline: none; box-shadow: var(--wf-focus); }
.wfui-chip .wfui-chip-x { opacity: .6; }

/* Selección múltiple con fichas */
.wfui select[data-wfui-multi] { display: none !important; }
.wfui-multi { position: relative; }
.wfui-multi-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px; border: 1px solid var(--wf-line); border-radius: var(--wf-r-sm); background: var(--wf-surface); cursor: text; }
.wfui-multi.is-open .wfui-multi-box, .wfui-multi-box:focus-within { border-color: var(--wf-gold); box-shadow: var(--wf-focus); }
.wfui .wfui-multi-in { flex: 1 1 120px; min-width: 90px; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; padding: 4px 2px !important; min-height: 28px !important; font-size: 14px; }
.wfui-multi-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 11px; border-radius: 999px; background: var(--wf-ink); color: var(--wf-inv); font-size: 12.5px; font-weight: 600; }
.wfui-multi-chip button { appearance: none; border: 0; background: var(--wf-chipx); color: var(--wf-gold-ink); width: 20px; height: 20px; border-radius: 50%; line-height: 1; cursor: pointer; font-size: 14px; padding: 0; }
.wfui-multi-chip button:hover { background: var(--wf-chipx-h); }
.wfui-multi-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 220px; overflow-y: auto; background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: 12px; box-shadow: var(--wf-sh-lg); }
.wfui-multi-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; margin: 0; }
.wfui-multi-list li:hover, .wfui-multi-list li.is-hi { background: var(--wf-gold-soft); }
.wfui-multi-list li[data-add] { font-weight: 700; color: var(--wf-gold-d); }
.wfui-multi-list li.is-empty { color: var(--wf-mute); cursor: default; }
.wfui-multi-list li.is-empty:hover { background: transparent; }

/* Cantidad (stepper) */
.wfui-step { display: inline-flex; align-items: center; border: 1px solid var(--wf-line); border-radius: var(--wf-r-sm); background: var(--wf-surface); overflow: hidden; }
.wfui-step button { appearance: none; border: 0; background: var(--wf-bg); width: 34px; height: 38px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--wf-ink); }
.wfui-step button:hover { background: var(--wf-surface-2); }
.wfui-step input { width: 46px; border: 0 !important; text-align: center; font-weight: 700; font-size: 14px; box-shadow: none !important; background: transparent !important; -moz-appearance: textfield; padding: 0; min-height: 38px; }
.wfui-step input::-webkit-outer-spin-button, .wfui-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Barra de herramientas / filtros */
.wfui-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.wfui-bar .wfui-grow { flex: 1 1 auto; }
.wfui-search { position: relative; width: min(320px, 100%); }
.wfui-search .wfui-i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--wf-mute); }
.wfui .wfui-search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border: 1px solid var(--wf-line); border-radius: 12px; background: var(--wf-surface); font-size: 14px; box-shadow: var(--wf-sh); }
/* Buscadores (VI-08): la lupa va DENTRO del campo, a la izquierda, y el texto o el placeholder nunca se montan sobre ella. Un tema puede poner `padding: 0 1em !important` y `width: calc(100% - 2em) !important` a todos los input de texto, y pisaba el hueco de la lupa; por eso el relleno izquierdo va
   con !important y mas especificidad. Vale para .wfui-search y para cualquier input que venga despues de un icono dentro de un contenedor cuyo nombre lleve 'search'. */
.wfui .wfui-search input:not(.wfui-x),
.wfui [class*="search"] > :is(svg, i, .wfui-i) ~ input:is([type="text"], [type="search"], [type="email"], [type="tel"], [type="url"], [type="number"], :not([type])):not(.wfui-x) { padding-left: 38px !important; padding-right: 14px !important; width: 100% !important; box-sizing: border-box !important; }
.wfui .wfui-search input:focus { outline: none; border-color: var(--wf-gold); box-shadow: var(--wf-focus); }

/* Vacío */
.wfui-empty { text-align: center; padding: 44px 24px; background: var(--wf-surface); border: 1px dashed var(--wf-line-2); border-radius: var(--wf-r); color: var(--wf-mute); }
.wfui-empty-i { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--wf-gold-soft); color: var(--wf-gold-d); margin-bottom: 12px; }
.wfui-empty h3 { margin: 0 0 6px; font-size: 18px; color: var(--wf-ink); }
.wfui-empty p { margin: 0 auto 16px; max-width: 52ch; }
.wfui-empty .wfui-actions { justify-content: center; }

/* Cajón lateral (drawer) y diálogo */
.wfui-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); display: flex; justify-content: flex-end; animation: wfui-fade .15s; }
.wfui-overlay.is-center { justify-content: center; align-items: center; padding: 20px; }
@keyframes wfui-fade { from { opacity: 0; } }
@keyframes wfui-slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes wfui-pop { from { transform: scale(.96); opacity: 0; } }
.wfui-drawer { width: min(720px, 100%); height: 100%; background: var(--wf-surface); display: flex; flex-direction: column; box-shadow: var(--wf-sh-lg); animation: wfui-slide .2s; color: var(--wf-ink); }
.wfui-drawer > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wfui-drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--wf-line); }
.wfui-drawer-h h2 { margin: 0; padding: 0; font-size: 19px; font-weight: 700; }
.wfui-drawer-b { flex: 1; overflow-y: auto; padding: 20px 22px 28px; display: flex; flex-direction: column; gap: 18px; background: var(--wf-bg); }
.wfui-drawer-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--wf-line); background: var(--wf-surface); }
.wfui-dialog { width: min(440px, 100%); background: var(--wf-surface); border-radius: 18px; padding: 24px; box-shadow: var(--wf-sh-lg); animation: wfui-pop .15s; color: var(--wf-ink); }
.wfui-dialog h3 { margin: 0 0 8px; font-size: 18px; }
.wfui-dialog p { margin: 0 0 18px; color: var(--wf-mute); font-size: 14px; white-space: pre-line; }
.wfui-dialog p:empty { display: none; }
.wfui-dialog .wfui-actions { justify-content: flex-end; }
body.wfui-lock { overflow: hidden; }
body.wfui-lock:not(:has(.wfui-overlay)) { overflow: auto; }

/* Sección dentro de un cajón (tarjeta ligera con título numerado) */
.wfui-sec { background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: var(--wf-r); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.wfui-sec-t { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14.5px; font-weight: 700; }
.wfui-sec-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--wf-ink); color: var(--wf-gold-ink); font-size: 12px; font-weight: 700; flex: none; }
.wfui-sec-d { margin: -8px 0 0 34px; color: var(--wf-mute); font-size: 12.5px; }

/* Avisos efímeros (toasts) */
.wfui-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100002; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.wfui-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: var(--wf-ink); color: var(--wf-inv); font-size: 13.5px; box-shadow: var(--wf-sh-lg); animation: wfui-slide .2s; }
.wfui-toast .wfui-i { color: var(--wf-gold-ink); }
.wfui-toast.is-ok .wfui-i { color: var(--wf-toast-ok); }
.wfui-toast.is-err { background: #7f1d1d; color: #fff; }
.wfui-toast.is-err .wfui-i { color: #fca5a5; }

/* Barra de cambios sin guardar */
.wfui-dirty { position: sticky; bottom: 12px; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--wf-ink); color: var(--wf-inv); box-shadow: var(--wf-sh-lg); margin-top: 16px; }

/* Esqueleto de carga */
.wfui-skel { background: linear-gradient(90deg, var(--wf-skel-a) 25%, var(--wf-skel-b) 37%, var(--wf-skel-a) 63%); background-size: 400% 100%; animation: wfui-sk 1.2s infinite; border-radius: 10px; min-height: 18px; }
@keyframes wfui-sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Arrastrar y soltar (WFUI.sortable) */
.wfui-grip { appearance: none; display: inline-grid; place-items: center; width: 30px; min-width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--wf-mute); cursor: grab; touch-action: none; flex: none; transition: background .15s, color .15s; }
.wfui-grip:hover { background: var(--wf-bg); color: var(--wf-ink); border-color: var(--wf-line); }
.wfui-grip:focus-visible { outline: none; box-shadow: var(--wf-focus); color: var(--wf-ink); }
.wfui-grip:active { cursor: grabbing; }
.wfui-sort-ph { box-sizing: border-box; border: 2px dashed var(--wf-gold); background: var(--wf-gold-soft); border-radius: var(--wf-r-sm); flex: none; }
.wfui-sort-drag { box-shadow: 0 18px 40px rgba(15,23,42,.28) !important; opacity: .96; transform: rotate(.6deg); cursor: grabbing; background: var(--wf-card, #fff); }
.wfui-sort-target.wfui-sort-over { outline: 2px dashed var(--wf-gold); outline-offset: 3px; border-radius: var(--wf-r-sm); }
body.wfui-sorting { user-select: none; -webkit-user-select: none; cursor: grabbing !important; }
body.wfui-sorting * { cursor: grabbing !important; }
@media (prefers-reduced-motion: reduce) { .wfui-sort-drag { transform: none; } }

/* Utilidades */
.wfui-muted { color: var(--wf-mute); }
.wfui-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 782px) {
    .wfui-wrap { margin-right: 10px; }
    .wfui-drawer { width: 100%; }
    .wfui-drawer-h, .wfui-drawer-b, .wfui-drawer-f { padding-left: 16px; padding-right: 16px; }
    .wfui-toasts { left: 12px; right: 12px; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { .wfui *, .wfui-overlay, .wfui-overlay * { animation: none !important; transition: none !important; } }

/* UX-19: en el MOVIL todos los campos de un formulario ocupan el ancho completo (una columna). Nada de 50 % ni 33 %: las pantallas son pequenas y los dedos grandes.
   Lista de las rejillas de campos de los plugins WF; una rejilla nueva de campos se anade aqui. */
@media (max-width: 640px) {
    .wfui :is(.wfui-grid2, .wfui-grid3, .wfcj-two, .wfcj-cols, .wfcj-rr, .wfcj-altrow, .wfcj-lr, .wfwc-m-two, .wfwc-m-three, .apfw-grid, .apfw-opts, .wfx-line, .wfx-fgrid, .wfx-payform, .wfc-line, .wfas-fgrid, .wfns-fields-grid, .wfns-profile-grid) { grid-template-columns: minmax(0, 1fr) !important; }
    .wfui .wfui-f :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea) { width: 100% !important; max-width: none !important; box-sizing: border-box; }
}
