:root {
    --color-primary: #521a75;    /* Púrpura corporativo oficial TaoVital */
    --color-secondary: #7b29ad;  /* Púrpura medio para gradientes */
    --color-highlight: #c9a7e6;  /* Lila suave para bordes y acentos */
    --color-lilac-bg: #ede0f7;   /* Fondo lila claro */
    --color-text: #2c123d;       /* Tinta oscura con matiz púrpura */
    --color-gray: #6e5c78;       /* Texto secundario cálido */
    --color-light: #fbf8f5;      /* Papel cálido institucional */
    --color-paper-muted: #f0ebe4;/* Papel secundario para inputs y fondos */
    --color-error: #b3452c;      /* Rojo sobrio de error */
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Pantallas (Portada / Login / Wizard) ---------- */
.pantalla.hidden { display: none; }

.pantalla-fullscreen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    z-index: 40;
}

.glow-blob {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

/* Fondo de portada: Ritual Modernism sobre lienzo cálido */
.portada-fondo {
    background: radial-gradient(120% 120% at 50% 10%, #ffffff 0%, #fbf8f5 45%, #f0ebe4 100%);
}

/* Fondo del login: Púrpura profundo con resplandor superior */
.login-fondo {
    background: radial-gradient(120% 140% at 85% -10%, rgba(184, 134, 255, 0.22) 0%, transparent 55%),
                linear-gradient(155deg, #7b29ad 0%, #521a75 45%, #2c123d 100%);
}

/* Tarjeta de login con glassmorphism */
.login-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 24px 50px -20px rgba(44, 18, 61, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-ghost-btn {
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
}

.login-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.72);
    margin-bottom: 5px;
}

.login-input {
    width: 100%;
    padding: 10px 13px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 13.5px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.login-input:focus {
    border-color: rgba(255,255,255,.6);
    box-shadow: 0 0 0 3px rgba(184, 134, 255, 0.25);
    outline: none;
}
.login-input-locked {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.75);
    cursor: not-allowed;
}
.login-input-locked:focus { box-shadow: none; }

.login-underline-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 2px 10px;
    border-bottom: 1.5px solid rgba(255,255,255,.32);
    transition: border-color .18s ease;
}
.login-underline-field:focus-within { border-bottom-color: var(--color-highlight); }

.login-password-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 18px;
    letter-spacing: 3px;
    color: #fff;
    font-weight: 600;
    min-width: 0;
}
.login-password-input::placeholder {
    color: rgba(255,255,255,.45);
    letter-spacing: normal;
    font-size: 13.5px;
    font-weight: 400;
}
.login-password-input:disabled { color: rgba(255,255,255,.35); }

.login-toggle-password {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
}
.login-toggle-password:hover svg { stroke: rgba(255,255,255,.95); }

.login-toggle-track {
    width: 36px;
    height: 21px;
    border-radius: 999px;
    position: relative;
    flex-shrink: 0;
    margin-top: 1px;
    display: inline-block;
    background: rgba(255,255,255,.2);
    transition: background-color .2s ease;
}
.login-toggle-track.on { background: var(--color-highlight); }
.login-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    background: #fff;
    transition: transform .2s ease, background-color .2s ease;
}
.login-toggle-track.on .login-toggle-knob {
    transform: translateX(15px);
    background: var(--color-primary);
}

.login-btn-ingresar {
    width: 100%;
    padding: 14px;
    border-radius: 999px;
    border: none;
    background: #ffffff;
    color: var(--color-primary);
    font-size: 14.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.35);
    transition: transform .15s ease, filter .15s ease;
}
.login-btn-ingresar:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.05);
}
.login-btn-ingresar:active:not(:disabled) { transform: translateY(0) scale(.98); }
.login-btn-ingresar:disabled { opacity: .6; cursor: not-allowed; }

.btn-spinner-dark {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    border: 2px solid rgba(82, 26, 117, 0.3);
    border-top-color: var(--color-primary);
    animation: girar .7s linear infinite;
    flex-shrink: 0;
}

/* ---------- Stepper ---------- */
#stepperViewport {
    overflow: hidden;
    padding: 4px 0 0;
}

#stepperTrack {
    display: flex;
    align-items: flex-start;
    transition: transform .55s cubic-bezier(.65, 0, .35, 1);
    width: max-content;
    padding: 0 130px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 104px;
    flex-shrink: 0;
}

.step-circle {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-gray);
    background: rgba(82, 26, 117, 0.10);
    box-shadow: 0 0 0 0 rgba(82, 26, 117, 0);
    transition: background-color .35s ease, color .35s ease, box-shadow .35s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}

.step-item.is-active .step-circle {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 0 5px rgba(82, 26, 117, 0.18);
    transform: scale(1.08);
}

.step-item.is-done .step-circle {
    background: #059669;
    color: #fff;
}

.step-item.is-error .step-circle {
    background: var(--color-error);
    color: #fff;
}

.step-circle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -7px 0 0 -7px;
    width: 14px;
    height: 14px;
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}

.step-item.is-done .step-circle .icon-check { transform: scale(1); }
.step-item.is-error .step-circle .icon-error { transform: scale(1); }

.step-item.is-done .step-circle span,
.step-item.is-error .step-circle span { display: none; }

.step-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--color-gray);
    white-space: nowrap;
    transition: color .35s ease;
}

.step-item.is-active .step-label { color: var(--color-primary); font-weight: 700; }
.step-item.is-error .step-label { color: var(--color-error); font-weight: 700; }

.step-connector {
    width: 44px;
    height: 2px;
    background: rgba(82, 26, 117, 0.15);
    border-radius: 999px;
    margin: 15px 4px 0;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.step-connector-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: #059669;
    transition: width .5s ease .1s;
}

.step-connector.is-error .step-connector-fill {
    background: var(--color-error);
    width: 100%;
}

/* ---------- Step panel transitions ---------- */
.step-panel { display: none; }
.step-panel.is-visible { display: block; }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-26px); }
    to { opacity: 1; transform: translateX(0); }
}

#wizardCard {
    transition: transform .32s cubic-bezier(.22,1,.36,1), opacity .28s ease;
}

/* ---------- Botones corporativos ---------- */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    box-shadow: 0 8px 22px -8px rgba(82, 26, 117, 0.6);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -8px rgba(82, 26, 117, 0.65);
    filter: brightness(1.05);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(.98);
    box-shadow: 0 4px 10px -6px rgba(82, 26, 117, 0.5);
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-outline {
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn-outline:hover:not(:disabled) {
    background: var(--color-light);
    transform: translateY(-1px);
}
.btn-outline:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn-outline:disabled { opacity: .45; cursor: not-allowed; }

/* Tarjetas de plantilla */
.card-plantilla {
    position: relative;
    border: 2px solid rgba(82, 26, 117, 0.12);
    background: #ffffff;
    transition: border-color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card-plantilla:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px -12px rgba(82, 26, 117, 0.35);
    border-color: rgba(82, 26, 117, 0.35);
}
.card-plantilla.activa {
    border-color: var(--color-primary);
    background: rgba(82, 26, 117, 0.04);
    box-shadow: 0 0 0 3px rgba(82, 26, 117, 0.12), 0 10px 22px -12px rgba(82, 26, 117, 0.35);
}

.icono-plantilla-grande {
    filter: drop-shadow(0 2px 4px rgba(44, 18, 61, 0.15));
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
    flex-shrink: 0;
    border-radius: 8px;
}
.card-plantilla:hover:not(:disabled) .icono-plantilla-grande {
    transform: scale(1.06);
}

.check-pop {
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.card-plantilla.activa .check-pop { transform: scale(1); }

/* Indicador de radio para tarjetas */
.card-radio {
    border-color: rgba(82, 26, 117, 0.22);
    background: #ffffff;
    transition: border-color .2s ease, background-color .2s ease;
}
.card-plantilla:hover:not(:disabled) .card-radio {
    border-color: rgba(82, 26, 117, 0.45);
}
.card-plantilla.activa .card-radio {
    border-color: var(--color-primary);
}

/* Badge de plantilla: nunca se fragmenta ni salta de línea internamente */
.badge-plantilla {
    display: inline-flex;
    align-items: center;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    line-height: 1.25;
}

/* Soporte de truncado multi-línea elegante */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Inputs y Áreas de texto */
input, textarea {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
input:focus, textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(82, 26, 117, 0.15);
    outline: none;
}

/* Componentes de Configuración de Transferencia */
.card-concepto-cobro {
    background: #faf8fc;
    border: 1.5px solid #ede0f7;
    border-radius: 14px;
    padding: 12px 14px;
    transition: all .2s ease;
}
.card-concepto-cobro.activo {
    background: #ffffff;
    border-color: rgba(82, 26, 117, 0.35);
    box-shadow: 0 4px 14px -4px rgba(82, 26, 117, 0.10);
}
.card-concepto-cobro.inactivo {
    opacity: 0.75;
    background: #fdfdfd;
}

.badge-config-transfer {
    background: #f3e8ff;
    color: #521a75;
    border: 1px solid #e9d5ff;
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Filas de destinatarios */
.fila-destinatario {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--color-light);
    border: 1px solid rgba(82, 26, 117, 0.10);
    transition: background-color .3s ease, border-color .3s ease;
    animation: slideInLeft .3s cubic-bezier(.22,1,.36,1) both;
}
.fila-destinatario.ok { background: rgba(5, 150, 105, 0.06); border-color: rgba(5, 150, 105, 0.25); }
.fila-destinatario.err { background: rgba(179, 69, 44, 0.06); border-color: rgba(179, 69, 44, 0.25); }

.fila-icono {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fila-icono svg {
    width: 15px;
    height: 15px;
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.fila-destinatario.ok .fila-icono svg, .fila-destinatario.err .fila-icono svg { transform: scale(1); }

.fila-spinner {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    border: 2px solid rgba(82, 26, 117, 0.25);
    border-top-color: var(--color-primary);
    animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.btn-spinner {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: girar .7s linear infinite;
    flex-shrink: 0;
}

@keyframes filaAnalisisIn {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}
.fila-analisis {
    animation: filaAnalisisIn .32s cubic-bezier(.22,1,.36,1) both;
}

@keyframes resumenAnalisisIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.resumen-analisis-in {
    animation: resumenAnalisisIn .3s ease both;
}

#progresoBarra { transition: width .4s cubic-bezier(.22,1,.36,1); }

.card-error {
    animation: slideInLeft .35s cubic-bezier(.22,1,.36,1) both;
}

/* ---------- Modal de éxito ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(44, 18, 61, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modalFadeIn .22s ease both;
}
.modal-overlay.hidden { display: none; }

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-envio-card {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 24px;
    padding: 40px 32px 32px;
    text-align: center;
    box-shadow: 0 24px 60px -20px rgba(44, 18, 61, 0.45);
    animation: modalPopIn .38s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes modalPopIn {
    from { opacity: 0; transform: translateY(14px) scale(.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.check-motion {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 0 auto 22px;
}
.check-motion-ring {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(5, 150, 105, 0.14);
    animation: checkRingPulse .6s ease-out .15s both;
}
@keyframes checkRingPulse {
    from { transform: scale(.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.check-motion-circle {
    position: absolute;
    inset: 10px;
    border-radius: 999px;
    background: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    animation: checkCirclePop .4s cubic-bezier(.34,1.56,.64,1) .25s both;
}
@keyframes checkCirclePop {
    to { transform: scale(1); }
}
.check-motion-circle svg {
    width: 32px;
    height: 32px;
}
.check-motion-circle polyline {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: checkDraw .35s ease .5s forwards;
}
@keyframes checkDraw {
    to { stroke-dashoffset: 0; }
}

.modal-envio-texto {
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 24px;
    color: var(--color-text);
}

.modal-envio-botones {
    display: flex;
    gap: 10px;
}
.modal-envio-botones button {
    flex: 1;
}
