/* Kit de formularios (web pública, panel y sistema comercial). Colores propios con respaldo para cualquier tema. */
:root { --fk-bad: #c0392b; --fk-ok: #1d7a43; --fk-ink: #14202c; --fk-card: #ffffff; --fk-line: #dde3ea; }
:root[data-theme="dark"] { --fk-bad: #f08a80; --fk-ok: #5fc27f; --fk-ink: #e6ecf2; --fk-card: #172331; --fk-line: #2a3b50; }

/* Mensaje bajo el campo: aparece deslizándose */
.fk-msg { display: block; position: static !important; max-height: 0; overflow: hidden; margin: 0; opacity: 0; color: var(--fk-bad); font-size: .8rem; font-weight: 600; line-height: 1.35;
  transform: translateY(-4px); transition: max-height .25s ease, opacity .2s ease, transform .25s ease, margin .25s ease; pointer-events: none; }
.fk-msg.on { max-height: 4em; opacity: 1; transform: none; margin-top: 6px; }
.fk-bad, .fk-bad:focus { border-color: var(--fk-bad) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fk-bad) 18%, transparent) !important; }
.fk-good:not(:focus) { border-color: color-mix(in srgb, var(--fk-ok) 55%, var(--fk-line)) !important; }

/* Sacudida corta en el campo con error */
.fk-shake { animation: fk-shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes fk-shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-6px); } }

/* Botón guardando: punto girando y texto atenuado */
.fk-loading { position: relative; pointer-events: none; color: transparent !important; }
.fk-loading > * { visibility: hidden; }
.fk-loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / .35); border-top-color: #fff; animation: fk-spin .7s linear infinite; }
.a-btn.ghost.fk-loading::after, .btn.ghost.fk-loading::after { border-color: color-mix(in srgb, var(--fk-ink) 25%, transparent); border-top-color: var(--fk-ink); }
@keyframes fk-spin { to { transform: rotate(360deg); } }

/* Contador de caracteres */
.fk-count { display: block; text-align: right; font-size: .74rem; color: color-mix(in srgb, var(--fk-ink) 55%, transparent); opacity: 0; transition: opacity .2s; position: static !important; }
.fk-count.on { opacity: 1; } .fk-count.near { color: var(--fk-bad); font-weight: 700; }

/* Avisos flotantes */
.fk-toasts { position: fixed; z-index: 200; left: 50%; top: 14px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.fk-toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--fk-card); color: var(--fk-ink); border: 1px solid var(--fk-line);
  box-shadow: 0 18px 40px -14px rgb(10 20 30 / .45); font-weight: 600; font-size: .92rem; animation: fk-in .35s cubic-bezier(.2, .8, .2, 1) both; }
.fk-toast i { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-style: normal; font-weight: 800; color: #fff; background: var(--fk-ok); }
.fk-toast.err i { background: var(--fk-bad); }
.fk-toast.out { animation: fk-out .35s ease both; }
@keyframes fk-in { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
@keyframes fk-out { to { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* Barra de cambios sin guardar (panel) */
.fk-dirty { position: fixed; z-index: 150; left: 50%; bottom: 18px; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--fk-ink); color: var(--fk-card); box-shadow: 0 20px 44px -16px rgb(10 20 30 / .55); font-weight: 600; font-size: .9rem;
  transform: translate(-50%, 140%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); max-width: calc(100vw - 24px); }
.fk-dirty.on { transform: translate(-50%, 0); }
.fk-dirty button { border: 0; border-radius: 999px; padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.fk-undo { background: transparent; color: inherit; opacity: .75; } .fk-undo:hover { opacity: 1; }
.fk-save { background: #2f86cc; color: #fff; } .fk-save:hover { background: #1a5f99; }
@media (max-width: 760px) { .fk-dirty { bottom: 84px; font-size: .84rem; padding-left: 14px; } .fk-dirty span { white-space: nowrap; } }

/* Respuesta al toque en todos los botones */
.a-btn, .btn, .cm-quick a, .sv2-wa, .it-del { transition: transform .15s ease, background .2s, border-color .2s, box-shadow .2s; }
.a-btn:active, .btn:active, .cm-quick a:active, .sv2-wa:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) { .fk-msg, .fk-dirty, .fk-toast, .fk-count { transition: none; animation: none; } .fk-loading::after { animation-duration: 1.6s; } }
@media (max-width: 760px) { body.cx .fk-dirty { bottom: 16px; } }
