/* Pantallas de acceso (login, registro, código, contraseña, invitación).
   Los colores vienen de crm-color.css (paleta Navy Mirage), igual que en el
   CRM; aquí solo el acomodo propio de estas pantallas. */

/* Sin barra de desplazamiento visible: la página sigue bajando con la rueda,
   el touchpad o el teclado, solo no se ve la barra junto a la foto. */
html:has(body.auth-body-bg),
body.auth-body-bg {
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* Edge antiguo */
}
html:has(body.auth-body-bg)::-webkit-scrollbar,
body.auth-body-bg::-webkit-scrollbar {
    display: none;                  /* Chrome, Edge, Safari */
}

/* Acción principal a todo el ancho, igual que "Continuar con Google/GitHub". */
.auth-body-bg form .btn-primary[type=submit] {
    width: 100%;
    padding-top: .6rem;
    padding-bottom: .6rem;
    font-weight: 500;
}

/* La plantilla fija el panel izquierdo a 100vh y centra el contenido: si el
   formulario es más alto que la pantalla (registro), el logo y el título se
   salían por arriba sin poder alcanzarlos. Con altura automática crece con
   el contenido y sigue centrado cuando cabe (min-vh-100). */
.auth-body-bg .authentication-page-content {
    height: auto;
}

/* El panel de la foto acompaña al bajar: en registro el formulario es más
   alto que la pantalla y antes quedaba una franja blanca debajo de la foto. */
@media (min-width: 992px) {
    .auth-body-bg .authentication-bg {
        position: sticky;
        top: 0;
    }
}

/* Aviso de lo que sigue después de registrarse. */
.auth-next-step {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .75rem .9rem;
    border-radius: 10px;
    background: var(--crm-blue-soft, rgba(53, 87, 125, .08));
    color: var(--bs-body-color);
    font-size: 13px;
}
.auth-next-step i {
    color: var(--bs-primary);
    font-size: 18px;
    line-height: 1.1;
}

/* ---------------------------------------------------------------------
   Solicitud en espera (registrado, sin empresa asignada todavía).
   --------------------------------------------------------------------- */
.auth-wait-avatar {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 2rem auto 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #35577D, #5A7FA8);
    color: #fff;
    font-size: 2rem;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(53, 87, 125, .25);
}
.auth-wait-avatar-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1b44c;
    border: 3px solid #fff;
    font-size: 14px;
}
.auth-wait-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .7rem;
    border-radius: 99px;
    background: rgba(241, 180, 76, .15);
    color: #a8700f;
    font-size: 12.5px;
    font-weight: 600;
}
.auth-wait-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f1b44c;
    animation: auth-wait-pulse 1.6s ease-in-out infinite;
}
@keyframes auth-wait-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(241, 180, 76, .6); }
    50% { box-shadow: 0 0 0 5px rgba(241, 180, 76, 0); }
}
@media (prefers-reduced-motion: reduce) { .auth-wait-dot { animation: none; } }

.auth-wait-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}
.auth-wait-steps li {
    position: relative;
    display: flex;
    gap: .85rem;
    padding-bottom: 1.15rem;
}
.auth-wait-steps li:last-child { padding-bottom: 0; }
/* Línea que une los pasos. */
.auth-wait-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 17px;
    top: 38px;
    bottom: 4px;
    width: 2px;
    background: #E3E9F1;
}
.auth-wait-steps li.is-done:not(:last-child)::after { background: #1cbb8c; }
.auth-wait-icon {
    flex: 0 0 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #E3E9F1;
    background: #fff;
    color: #B5C1D0;
    font-size: 17px;
}
.auth-wait-steps li.is-done .auth-wait-icon { border-color: #1cbb8c; background: #1cbb8c; color: #fff; }
.auth-wait-steps li.is-current .auth-wait-icon {
    border-color: #f1b44c;
    color: #c98a14;
    box-shadow: 0 0 0 4px rgba(241, 180, 76, .15);
}
.auth-wait-steps strong { display: block; font-size: 14px; color: var(--bs-body-color); }
.auth-wait-steps li:not(.is-done):not(.is-current) strong { color: #74788d; }
.auth-wait-steps small { display: block; color: #74788d; font-size: 12.5px; line-height: 1.45; margin-top: .1rem; }

/* ---------------------------------------------------------------------
   Campos: se iluminan con el azul del CRM al tocarlos (como en los paneles),
   la etiqueta se pinta de azul, asterisco rojo en los obligatorios y
   palomita verde al salir de un campo que quedó bien.
   --------------------------------------------------------------------- */
.auth-body-bg form .form-label {
    font-weight: 600;
    transition: color .15s ease;
}
.auth-body-bg form .asteriskField,
.auth-body-bg form .form-label .text-danger {
    color: var(--bs-danger);
    margin-left: .15rem;
}
.auth-body-bg form .form-control {
    min-height: 46px;
    border-radius: 10px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.auth-body-bg form .form-control:hover:not(:focus) {
    border-color: #AEBFD2;
}
.auth-body-bg form .form-control:focus {
    background-color: #fff;
    border-color: #5A7FA8;
    box-shadow: 0 0 0 4px rgba(90, 127, 168, .16);
}
.auth-body-bg form .mb-3:focus-within .form-label,
.auth-body-bg form .mb-3:focus-within .auth-field-icon {
    color: #35577D;
}
.auth-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #74788d;
    pointer-events: none;
    z-index: 2;
    font-size: 1.05rem;
    transition: color .15s ease;
}
.auth-pw-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #74788d;
    cursor: pointer;
    z-index: 2;
    font-size: 1.1rem;
}
.auth-pw-eye:hover { color: #35577D; }
.auth-body-bg form .form-control.auth-ok {
    border-color: #1cbb8c;
    padding-right: 2.6rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231cbb8c' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.6 14.2-4-4 1.4-1.4 2.6 2.6 5.8-5.8 1.4 1.4Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
}
/* En los de contraseña el ojo ocupa la derecha: solo se pinta el borde. */
.auth-body-bg form input[name^="password"].auth-ok { background-image: none; }
.auth-body-bg form .form-control.auth-bad { border-color: #f1b44c; }

/* Errores del servidor. El ícono del campo lo envuelve en un contenedor y
   Bootstrap solo muestra .invalid-feedback cuando va justo después del
   input, así que el mensaje quedaba oculto. Crispy solo lo pinta cuando hay
   error, por eso aquí se muestra siempre (el JS lo quita al corregir). */
.auth-body-bg form .invalid-feedback {
    display: block;
    margin-top: .4rem;
    font-size: 12.5px;
    color: #e0284a;
}
.auth-body-bg form .invalid-feedback[hidden] { display: none; }
/* Crispy pone cada error en su <p><strong>: uno debajo del otro, con ícono. */
.auth-body-bg form .invalid-feedback p {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    margin: 0 0 .2rem;
}
.auth-body-bg form .invalid-feedback strong { font-weight: 500; }
.auth-body-bg form .invalid-feedback p::before {
    content: "\F0028"; /* mdi-alert-circle */
    font-family: "Material Design Icons";
    font-size: 14px;
    line-height: 1.1;
}
/* En contraseña el ojo ocupa la derecha: sin el ícono rojo de Bootstrap. */
.auth-body-bg form input[name^="password"].is-invalid,
.auth-body-bg form input[name="oldpassword"].is-invalid { background-image: none; }
.auth-body-bg form .invalid-feedback a { color: inherit; font-weight: 600; text-decoration: underline; }
.auth-body-bg form .form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(255, 61, 96, .14); }

/* Ayuda corta debajo de un campo (p. ej. reglas del usuario). */
.auth-field-hint {
    margin-top: .4rem;
    font-size: 12.5px;
    color: #74788d;
}
.auth-field-hint.is-bad { color: #c98a14; }
.auth-field-hint.is-ok { color: #13a179; }

/* Registro con Google/GitHub: etiqueta del proveedor y correo fijo. */
.auth-provider-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .8rem .3rem .4rem;
    border: 1px solid #E3E9F1;
    border-radius: 99px;
    background: #fff;
    color: #495057;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(53, 87, 125, .08);
}
.auth-provider-pill .mdi-github { font-size: 20px; color: #24292e; }
.auth-provider-g {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #E3E9F1;
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 13px;
    background-image: conic-gradient(from -45deg, #4285f4 0 90deg, #34a853 0 180deg, #fbbc05 0 270deg, #ea4335 0 360deg);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-provider-g-lg { width: 40px; height: 40px; font-size: 24px; border: 0; }

/* Ícono grande de estado (correo enviado, listo, cancelado, error...). */
.auth-status-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.auth-status-icon.is-info { background: rgba(90, 127, 168, .12); color: #35577D; }
.auth-status-icon.is-success { background: rgba(28, 187, 140, .12); color: #13a179; }
.auth-status-icon.is-warning { background: rgba(241, 180, 76, .16); color: #c98a14; }
.auth-status-icon.is-danger { background: rgba(255, 61, 96, .1); color: #e0284a; }
.auth-status-icon .mdi-github { color: #24292e; }

.auth-body-bg form .form-control:disabled {
    background-color: #F3F6FA;
    border-color: #E3E9F1;
    color: #495057;
    cursor: not-allowed;
}
.auth-field-hint code {
    color: #35577D;
    background: #EEF2F7;
    padding: .05rem .35rem;
    border-radius: 5px;
}

/* Resumen arriba del formulario cuando el servidor lo rechaza. */
.auth-error-summary {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .75rem .9rem;
    margin-bottom: 1.25rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 61, 96, .25);
    background: rgba(255, 61, 96, .07);
    color: #b0213c;
    font-size: 13px;
}
.auth-error-summary > i { font-size: 18px; line-height: 1.1; }
.auth-error-summary strong { display: block; margin-bottom: .1rem; }
.auth-body-bg form .form-control.auth-ok:focus { box-shadow: 0 0 0 4px rgba(28, 187, 140, .15); }

/* ---------------------------------------------------------------------
   Contraseña nueva: barra de seguridad, requisitos, sugerencias y generador.
   --------------------------------------------------------------------- */
.auth-body-bg form .form-control.nivel-1 { border-color: #ff3d60; }
.auth-body-bg form .form-control.nivel-2 { border-color: #f1b44c; }
.auth-body-bg form .form-control.nivel-3 { border-color: #5A7FA8; }
.auth-body-bg form .form-control.nivel-4 { border-color: #1cbb8c; }
.auth-body-bg form .form-control.nivel-1:focus { box-shadow: 0 0 0 4px rgba(255, 61, 96, .14); }
.auth-body-bg form .form-control.nivel-2:focus { box-shadow: 0 0 0 4px rgba(241, 180, 76, .18); }
.auth-body-bg form .form-control.nivel-4:focus { box-shadow: 0 0 0 4px rgba(28, 187, 140, .16); }

.auth-pw-panel {
    margin-top: .6rem;
    padding: .75rem .85rem;
    border: 1px solid #E3E9F1;
    border-radius: 12px;
    background: #F8FAFC;
    font-size: 12.5px;
}
.auth-pw-meter {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.auth-pw-bars {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}
.auth-pw-bars span {
    height: 5px;
    border-radius: 99px;
    background: #E3E9F1;
    transition: background-color .25s ease;
}
.auth-pw-level {
    min-width: 7.5rem;
    text-align: right;
    font-weight: 600;
    color: #74788d;
}
.nivel-1 .auth-pw-bars span:nth-child(-n+1) { background: #ff3d60; }
.nivel-2 .auth-pw-bars span:nth-child(-n+2) { background: #f1b44c; }
.nivel-3 .auth-pw-bars span:nth-child(-n+3) { background: #5A7FA8; }
.nivel-4 .auth-pw-bars span { background: #1cbb8c; }
.auth-pw-meter.nivel-1 .auth-pw-level { color: #ff3d60; }
.auth-pw-meter.nivel-2 .auth-pw-level { color: #c98a14; }
.auth-pw-meter.nivel-3 .auth-pw-level { color: #35577D; }
.auth-pw-meter.nivel-4 .auth-pw-level { color: #13a179; }

.auth-pw-rules {
    list-style: none;
    margin: .65rem 0 0;
    padding: 0;
    display: grid;
    gap: .3rem;
}
.auth-pw-rules li {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: #74788d;
    transition: color .2s ease;
}
.auth-pw-rules li i { font-size: 15px; color: #B5C1D0; transition: color .2s ease; }
.auth-pw-rules li.is-pending { color: #495057; }
.auth-pw-rules li.is-ok { color: #13a179; }
.auth-pw-rules li.is-ok i { color: #1cbb8c; }

.auth-pw-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .65rem;
}
.auth-pw-chips-label { color: #74788d; margin-right: .15rem; }
.auth-pw-chip {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .1rem .55rem;
    border: 1px solid #D6DFEA;
    border-radius: 99px;
    background: #fff;
    color: #35577D;
    font-family: var(--bs-font-monospace);
    font-size: 11.5px;
    transition: all .2s ease;
}
.auth-pw-chip.is-ok {
    border-color: #1cbb8c;
    background: rgba(28, 187, 140, .1);
    color: #13a179;
}

.auth-pw-tip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .65rem;
    padding-top: .6rem;
    border-top: 1px dashed #E3E9F1;
    color: #74788d;
}
.auth-pw-tip > i { color: #f1b44c; font-size: 15px; align-self: flex-start; }
.auth-pw-tip > span { flex: 1 1 0; min-width: 0; line-height: 1.5; }
.auth-pw-tip code {
    color: #35577D;
    background: #EEF2F7;
    padding: .05rem .35rem;
    border-radius: 5px;
    white-space: nowrap;
}
.auth-pw-generate {
    flex-basis: 100%;
    text-align: left;
    margin-left: 1.35rem;
    padding: 0;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}
.auth-pw-generated {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .6rem;
    padding: .5rem .65rem;
    border-radius: 10px;
    background: rgba(28, 187, 140, .1);
    color: #13a179;
}
.auth-pw-generated > i { font-size: 16px; }
.auth-pw-generated .btn { margin-left: auto; padding: .1rem .55rem; font-size: 12px; }

.auth-pw-match {
    margin-top: .4rem;
    font-size: 12.5px;
}
.auth-pw-match:empty { display: none; }
.auth-pw-match.is-ok { color: #13a179; }
.auth-pw-match.is-bad { color: #c98a14; }
