/* ── Controlfy Login — Premium (temeable: claro/oscuro + acento) ── */

:root {
    --cfl-bg:        var(--cf-login-bg, #f5f5f7);
    --cfl-card:      var(--cf-login-card, #ffffff);
    --cfl-text:      var(--cf-login-text, #1d1d1f);
    --cfl-muted:     var(--cf-login-muted, #86868b);
    --cfl-faint:     var(--cf-login-faint, #aeaeb2);
    --cfl-border:    var(--cf-login-border, #e5e5ea);
    --cfl-input:     var(--cf-login-input, #fafafa);
    --cfl-input-focus:var(--cf-login-input-focus, #ffffff);
    --cfl-accent:    var(--cf-login-accent, #1d1d1f);   /* botón + enlaces + foco */
    --cfl-accent-hover:var(--cf-login-accent-hover, #333336);
    --cfl-accent-text:var(--cf-login-accent-text, #ffffff);  /* texto sobre el acento */
    --cfl-card-shadow: var(--cf-login-card-shadow, 0 0 0 1px rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.06), 0 12px 48px rgba(0,0,0,0.04));
    --cfl-focus-ring: var(--cf-login-focus-ring, rgba(29,29,31,0.10));
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.cflogin-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cfl-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 20px;
}

/* ── Container ───────────────────────────────────────── */

.cflogin-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* ── Card ────────────────────────────────────────────── */

.cflogin-card {
    width: 100%;
    background: var(--cfl-card);
    border-radius: 20px;
    padding: 44px 40px 36px;
    box-shadow: var(--cfl-card-shadow);
    position: relative;
    overflow: hidden;
}

/* ── Logo ────────────────────────────────────────────── */

.cflogin-logo {
    text-align: center;
    margin-bottom: 28px;
}

.cflogin-logo img {
    max-width: 140px;
    height: auto;
    display: inline-block;
}

.cflogin-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--cfl-text);
    letter-spacing: -0.02em;
}

/* ── Steps (screens) ─────────────────────────────────── */

.cflogin-step {
    display: none;
    animation: cfloginFadeIn 0.3s ease;
}

.cflogin-step.active {
    display: block;
}

@keyframes cfloginFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Subtitle ────────────────────────────────────────── */

.cflogin-subtitle {
    text-align: center;
    font-size: 15px;
    color: var(--cfl-muted);
    margin-bottom: 28px;
    line-height: 1.5;
    font-weight: 400;
}

/* ── Form Fields ─────────────────────────────────────── */

.cflogin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cflogin-field-row {
    display: flex;
    gap: 12px;
}

.cflogin-field-row .cflogin-field {
    flex: 1;
}

.cflogin-field input {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 1.5px solid var(--cfl-border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--cfl-text);
    background: var(--cfl-input);
    transition: all 0.2s ease;
    outline: none;
}

.cflogin-field input::placeholder {
    color: var(--cfl-faint);
}

.cflogin-field input:focus {
    border-color: var(--cfl-accent);
    background: var(--cfl-input-focus);
    box-shadow: 0 0 0 3px var(--cfl-focus-ring);
}

/* ── Primary Button ──────────────────────────────────── */

.cflogin-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 52px;
    margin-top: 8px;
    padding: 0 24px;
    border: none;
    border-radius: 12px;
    background: var(--cfl-accent);
    color: var(--cfl-accent-text);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.cflogin-btn-primary:hover {
    background: var(--cfl-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--cfl-focus-ring);
}

.cflogin-btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.cflogin-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cflogin-btn-primary .cflogin-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.cflogin-btn-primary:hover .cflogin-arrow {
    transform: translateX(2px);
}

/* ── Spinner ─────────────────────────────────────────── */

.cflogin-spinner-small {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--cfl-accent-text);
    border-radius: 50%;
    animation: cfloginSpin 0.6s linear infinite;
}

@keyframes cfloginSpin {
    to { transform: rotate(360deg); }
}

/* ── Error Message ───────────────────────────────────── */

.cflogin-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 10px;
    color: #ef4444;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    animation: cfloginFadeIn 0.2s ease;
}

/* ── Switch Link ─────────────────────────────────────── */

.cflogin-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--cfl-muted);
}

.cflogin-switch a {
    color: var(--cfl-accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.cflogin-switch a:hover {
    color: var(--cfl-accent-hover);
}

/* ── Admin Link ──────────────────────────────────────── */

.cflogin-admin-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--cfl-faint);
    text-decoration: none;
    transition: color 0.15s;
}

.cflogin-admin-link:hover {
    color: var(--cfl-muted);
}

/* ── OTP Inputs ──────────────────────────────────────── */

.cflogin-otp-target {
    text-align: center;
    font-size: 14px;
    color: var(--cfl-muted);
    margin-bottom: 24px;
    font-weight: 500;
}

.cflogin-otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

.cflogin-otp-digit {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    font-family: 'SF Mono', Monaco, Menlo, Consolas, monospace;
    color: var(--cfl-text);
    background: var(--cfl-input);
    border: 1.5px solid var(--cfl-border);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    caret-color: transparent;
}

.cflogin-otp-digit:focus {
    border-color: var(--cfl-accent);
    background: var(--cfl-input-focus);
    box-shadow: 0 0 0 3px var(--cfl-focus-ring);
    transform: scale(1.05);
}

.cflogin-otp-digit.filled {
    border-color: var(--cfl-accent);
    background: var(--cfl-bg);
}

.cflogin-otp-digit.error {
    border-color: #ef4444;
    background: rgba(220, 38, 38, 0.08);
    animation: cfloginShake 0.4s ease;
}

@keyframes cfloginShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ── OTP Actions ─────────────────────────────────────── */

.cflogin-otp-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.cflogin-link-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cfl-muted);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
}

.cflogin-link-btn:hover {
    color: var(--cfl-text);
}

.cflogin-link-btn:disabled {
    color: var(--cfl-faint);
    cursor: not-allowed;
}

.cflogin-sms-btn {
    color: var(--cfl-accent);
    font-weight: 500;
}

.cflogin-sms-btn:hover {
    color: var(--cfl-accent-hover);
}

/* ── Back Link ───────────────────────────────────────── */

.cflogin-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    font-size: 14px;
    color: var(--cfl-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.cflogin-back-link:hover {
    color: var(--cfl-text);
}

.cflogin-back-link svg {
    width: 16px;
    height: 16px;
}

/* ── Success Screen ──────────────────────────────────── */

.cflogin-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(34, 197, 94, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cfloginPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cflogin-success-icon svg {
    width: 32px;
    height: 32px;
    color: #22c55e;
}

@keyframes cfloginPop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.cflogin-success-msg {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--cfl-text);
    margin-bottom: 8px;
}

.cflogin-success-sub {
    text-align: center;
    font-size: 14px;
    color: var(--cfl-muted);
}

/* ── Powered By ──────────────────────────────────────── */

.cflogin-powered {
    font-size: 12px;
    color: var(--cfl-faint);
    text-align: center;
    opacity: 0.7;
}

.cflogin-powered strong {
    font-weight: 600;
    color: var(--cfl-muted);
}

/* ── Split-screen / Minimal / Glass (plantillas) ─────── */

/* SPLIT: marca a la izquierda, form a la derecha */
.cflogin-body.cfl-tpl-split { align-items: stretch; padding: 0; }
.cflogin-body.cfl-tpl-split .cflogin-aside {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--cfl-accent); color: var(--cfl-accent-text); padding: 40px; gap: 16px;
}
.cflogin-body.cfl-tpl-split .cflogin-aside .cfl-aside-logo img { max-width: 200px; filter: brightness(0) invert(1); }
.cflogin-body.cfl-tpl-split .cflogin-aside h2 { font-size: 26px; font-weight: 800; text-align: center; }
.cflogin-body.cfl-tpl-split .cflogin-aside p { opacity: .85; text-align: center; max-width: 340px; }
.cflogin-body.cfl-tpl-split .cflogin-main {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--cfl-bg);
}
.cflogin-body.cfl-tpl-split .cflogin-card { box-shadow: none; background: transparent; }
@media (max-width: 820px) { .cflogin-body.cfl-tpl-split { flex-direction: column; } .cflogin-body.cfl-tpl-split .cflogin-aside { padding: 32px; } }

/* MINIMAL: fondo full con acento, tarjeta cristal */
.cflogin-body.cfl-tpl-minimal { background: var(--cfl-accent); }
.cflogin-body.cfl-tpl-minimal .cflogin-card { background: var(--cfl-card); }

/* GLASS: tarjeta con blur sobre el fondo */
.cflogin-body.cfl-tpl-glass .cflogin-card {
    background: color-mix(in srgb, var(--cfl-card) 78%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid color-mix(in srgb, var(--cfl-text) 10%, transparent);
}
.cflogin-aside { display: none; }
.cflogin-body.cfl-tpl-split .cflogin-aside { display: flex; }

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 480px) {
    .cflogin-card {
        padding: 36px 24px 28px;
        border-radius: 16px;
    }

    .cflogin-otp-digit {
        width: 44px;
        height: 52px;
        font-size: 20px;
    }

    .cflogin-otp-inputs {
        gap: 8px;
    }

    .cflogin-field-row {
        flex-direction: column;
        gap: 12px;
    }
}


/* ── Contrato público: --cf-login-* (el tema viste su marca sin tocar el módulo) ─────────
   Colores: --cf-login-{bg,card,text,muted,faint,border,input,input-focus,accent,accent-hover,accent-text,card-shadow,focus-ring}
   Tipografía de títulos: --cf-login-font-titulos · Arte tenue del panel (split): --cf-login-arte */
.cflogin-step-title,
.cflogin-logo h1,
.cfl-aside-logo h2 { font-family: var(--cf-login-font-titulos, inherit); }

.cflogin-body.cfl-tpl-split .cflogin-aside { position: relative; overflow: hidden; }
.cflogin-body.cfl-tpl-split .cflogin-aside::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: var(--cf-login-arte, none) center / cover no-repeat; opacity: .18;
}
.cflogin-body.cfl-tpl-split .cflogin-aside > * { position: relative; z-index: 1; }

.cf-login-valores { list-style: none; display: grid; gap: 14px; margin-top: 28px; max-width: 340px; }
.cf-login-valor { display: grid; gap: 2px; }
.cf-login-valor__titulo { font-weight: 700; font-size: 15px; }
.cf-login-valor__linea { opacity: .8; font-size: 13px; line-height: 1.4; }
@media (max-width: 820px) { .cf-login-valores { display: none; } }

/* Alta (tras verificar el correo): aviso informativo y casilla de novedades (separada, desmarcada) */
.cflogin-aviso { font-size: 13px; margin: 4px 0 12px; }
.cflogin-aviso a { color: var(--cfl-accent); text-decoration: underline; }
.cflogin-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--cfl-text); margin: 4px 0 14px; cursor: pointer; }
.cflogin-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--cfl-accent); }

/* Aviso fijo para el equipo: igual para todas las personas (no revela cuentas) */
.cflogin-aviso-equipo { font-size: 13px; line-height: 1.45; color: var(--cfl-muted); margin: -2px 0 12px; }
