:root {
    --color-primary: #7B5B43;
    --color-secondary: #B98868;
    --color-highlight: #EBD9C3;
    --color-text: #3A2A1E;
    --color-gray: #8C7B6B;
    --color-light: #FBF3EA;
    --color-error: #B3452C;
}

* { 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; }

/* Portada y Login cubren toda la ventana y centran su contenido ahí,
   en vez de vivir dentro del contenedor angosto del wizard. */
.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;
}


/* La portada ES la pantalla completa: el degradado va directo en el
   contenedor fullscreen, sin una tarjeta separada adentro. */
.portada-fondo {
    background: linear-gradient(165deg, #FDF7F0 0%, #F5E4CE 32%, #E9CFA6 62%, #C9A171 100%);
}

/* El fondo del login es el mismo degradado oscuro, pero ahora vive en
   toda la pantalla; la tarjeta flota encima con efecto vidrio. */
.login-fondo {
    background: linear-gradient(165deg, #3A2A1E 0%, #5C3F2E 46%, #8A6849 100%);
}

/* El login sí sigue siendo una tarjeta acotada, centrada sobre toda la
   ventana gracias a .pantalla-fullscreen, con efecto glassmorfismo
   flotando sobre el degradado de .login-fondo. */
.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 18px 42px -22px rgba(58, 42, 30, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.login-ghost-btn { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.14); }

.login-identity-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 14px 7px 8px; border-radius: 999px;
    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,.62); 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,.5); box-shadow: 0 0 0 3px rgba(255,255,255,.10); outline: none; }
.login-input-locked {
    background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.62);
    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,.4); 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,.85); }

.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,.16);
    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: var(--color-highlight); color: var(--color-primary);
    font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform .15s ease, filter .15s ease;
}
.login-btn-ingresar:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }
.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(123, 91, 67, 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: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-gray);
    background: rgba(123, 91, 67, 0.12);
    box-shadow: 0 0 0 0 rgba(123, 91, 67, 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(123, 91, 67, 0.16);
    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(123, 91, 67, 0.15);
    border-radius: 999px;
    margin: 14px 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); }
}

/* La tarjeta entera se desliza como un bloque al cambiar de paso */
#wizardCard {
    transition: transform .32s cubic-bezier(.22,1,.36,1), opacity .28s ease;
}

/* ---------- Feedback / hover ---------- */
.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 20px -8px rgba(123, 91, 67, 0.55);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(123, 91, 67, 0.6); filter: brightness(1.03); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(.98); box-shadow: 0 4px 10px -6px rgba(123, 91, 67, 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; }

.card-plantilla {
    position: relative;
    border: 2px solid rgba(123, 91, 67, 0.15);
    background: #fffdfb;
    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(123, 91, 67, 0.45); }
.card-plantilla.activa {
    border-color: var(--color-primary);
    background: rgba(123, 91, 67, 0.05);
    box-shadow: 0 0 0 3px rgba(123, 91, 67, 0.12), 0 10px 22px -12px rgba(123, 91, 67, 0.35);
}

.icono-plantilla-grande {
    filter: drop-shadow(0 2px 4px rgba(58, 42, 30, 0.18));
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
    flex-shrink: 0;
}
.card-plantilla:hover:not(:disabled) .icono-plantilla-grande { transform: scale(1.08) rotate(-3deg); }

.check-pop {
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.card-plantilla.activa .check-pop { transform: scale(1); }

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(123, 91, 67, 0.14);
    outline: none;
}

/* ---------- Recipient rows ---------- */
.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(123, 91, 67, 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(123, 91, 67, 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: envío completado ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(58, 42, 30, 0.45);
    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: 360px;
    background: #fffdfb;
    border-radius: 24px;
    padding: 40px 32px 32px;
    text-align: center;
    box-shadow: 0 24px 60px -20px rgba(58, 42, 30, 0.4);
    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;
}

/* ---------- Panel Configuración Transferencia ---------- */
#panelConfigTransferencia {
    animation: slideInDown .28s cubic-bezier(.22,1,.36,1) both;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chip-descuento {
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid rgba(123, 91, 67, 0.20);
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
}
.chip-descuento:hover {
    background: var(--color-light);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}
.chip-descuento:active {
    transform: translateY(0) scale(.97);
}
.chip-descuento.activa {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px -2px rgba(123, 91, 67, 0.5);
}

/* ---------- Modal: Vista Previa Correo ---------- */
.modal-preview-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 820px;
    height: 88vh;
    max-height: 820px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px -15px rgba(58, 42, 30, 0.4);
    border: 1px solid rgba(123, 91, 67, 0.15);
    animation: modalScaleUp .24s cubic-bezier(.22,1,.36,1) both;
}

@keyframes modalScaleUp {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(123, 91, 67, 0.12);
    background: #fffdfb;
}

.modal-preview-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-gray);
    transition: all .15s ease;
}
.modal-preview-close:hover {
    background: var(--color-light);
    color: var(--color-text);
}

.preview-device-toggle {
    display: flex;
    align-items: center;
    background: var(--color-light);
    border-radius: 9px;
    padding: 2px;
    border: 1px solid rgba(123, 91, 67, 0.15);
}
.preview-device-btn {
    padding: 5px 9px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--color-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
}
.preview-device-btn:hover:not(.activa) {
    color: var(--color-primary);
}
.preview-device-btn.activa {
    background: #fff;
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(58, 42, 30, 0.12);
}

.modal-preview-body {
    flex: 1;
    min-height: 0;
    background: #eee7df;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.preview-frame-wrap {
    background: #fff;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    overflow: hidden;
    transition: width .3s cubic-bezier(.22,1,.36,1);
    height: 100%;
}
.preview-frame-wrap.desktop {
    width: 640px;
    max-width: 100%;
}
.preview-frame-wrap.mobile {
    width: 385px;
    max-width: 100%;
}

.preview-frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.modal-preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(123, 91, 67, 0.12);
    background: #fffdfb;
}

