.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(rgba(15, 15, 23, 0.65), rgba(15, 15, 23, 0.65)), url("/images/login-background.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Radzen ne pose la police du thème sur body que si la page contient un RadzenLayout
       (":root:has(.rz-layout) body"), ce que les pages de compte n'ont pas : sans ceci, elles
       s'affichaient dans la police par défaut du navigateur. */
    font-family: var(--rz-text-font-family);
}

/* Les champs et boutons n'héritent pas de la police par défaut. */
.auth-page input,
.auth-page button {
    font-family: inherit;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: var(--rz-border-radius, 1rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    padding: 2.25rem 2rem;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Logo du site vitrine, coins arrondis dans les mêmes proportions (.marque img de site.css). */
.auth-brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin-bottom: 0.75rem;
}

.auth-brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--rz-text-color);
    margin: 0;
}

.auth-subtitle {
    text-align: center;
    color: var(--rz-text-secondary-color);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}

/* Alerts */
.auth-alert {
    border-radius: var(--rz-border-radius, 0.6rem);
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.auth-alert-danger {
    background-color: var(--rz-danger-lighter, rgba(229, 57, 53, 0.12));
    border: 1px solid var(--rz-danger-light, rgba(229, 57, 53, 0.4));
    color: var(--rz-danger, #c62828);
}

.auth-alert-success {
    background-color: var(--rz-success-lighter, rgba(67, 160, 71, 0.12));
    border: 1px solid var(--rz-success-light, rgba(67, 160, 71, 0.4));
    color: var(--rz-success, #2e7d32);
}

/* Champ avec label flottant (CSS-only, sans Bootstrap) */
.auth-field {
    position: relative;
}

.auth-field + .auth-field {
    margin-top: 0.85rem;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    height: 3.5rem;
    padding: 1.625rem 0.85rem 0.625rem;
    background-color: var(--rz-body-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: var(--rz-border-radius, 0.5rem);
    color: var(--rz-text-color);
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.auth-input:focus {
    border-color: var(--rz-primary);
    box-shadow: 0 0 0 0.2rem var(--rz-primary-lighter);
}

.auth-input::placeholder {
    color: transparent;
}

.auth-field label {
    position: absolute;
    top: 0;
    left: 0.85rem;
    height: 100%;
    padding: 1rem 0 0;
    pointer-events: none;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: var(--rz-text-secondary-color);
    font-size: 1rem;
    white-space: nowrap;
}

/* Le label remonte quand le champ est focusé ou rempli */
.auth-input:focus ~ label,
.auth-input:not(:placeholder-shown) ~ label {
    opacity: 0.75;
    transform: scale(0.78) translateY(-0.6rem);
}

/* ... y compris quand le navigateur l'a prérempli (identifiants enregistrés) : avant toute
   interaction, Chrome n'expose pas la valeur et :placeholder-shown reste vrai. Règles séparées :
   un sélecteur inconnu du navigateur invaliderait toute la liste. */
.auth-input:-webkit-autofill ~ label {
    opacity: 0.75;
    transform: scale(0.78) translateY(-0.6rem);
}

.auth-input:autofill ~ label {
    opacity: 0.75;
    transform: scale(0.78) translateY(-0.6rem);
}

/* Case à cocher */
.auth-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-check-input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--rz-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.auth-check-label {
    color: var(--rz-text-color);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Boutons */
.auth-btn {
    display: inline-block;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--rz-border-radius, 0.6rem);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.auth-btn-full {
    width: 100%;
    display: block;
    margin-top: 1.25rem;
}

.auth-btn-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.auth-btn-row .auth-btn {
    flex: 1;
    margin-top: 0;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--rz-primary), var(--rz-primary-dark));
    color: var(--rz-on-primary);
    border: none;
}

.auth-btn-primary:hover {
    background: linear-gradient(135deg, var(--rz-primary-dark), var(--rz-primary-darker));
    color: var(--rz-on-primary);
}

.auth-btn-secondary {
    background: transparent;
    color: var(--rz-text-secondary-color);
    border-color: var(--rz-border-color);
}

.auth-btn-secondary:hover {
    background-color: var(--rz-primary-lighter);
    color: var(--rz-primary);
    border-color: var(--rz-primary-light);
}

.auth-btn-link {
    background: transparent;
    border: none;
    color: var(--rz-primary);
    padding: 0;
    font-weight: 400;
    font-size: 0.875rem;
}

.auth-btn-link:hover {
    color: var(--rz-primary-light);
    text-decoration: underline;
}

/* Liens en bas de formulaire */
.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.auth-links a {
    color: var(--rz-primary);
    text-decoration: none;
}

.auth-links a:hover {
    color: var(--rz-primary-light);
    text-decoration: underline;
}

/* Mobile : "Mot de passe oublié" passe sous "Se souvenir de moi" plutôt que de se
   compresser à droite (le lien sur deux lignes rendait la rangée illisible en version
   mobile - voir capture d'écran signalée par l'utilisateur). */
@media (max-width: 480px) {
    .auth-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Saisie OTP */
.otp-input-row {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin: 0.5rem 0 1.25rem;
}

.otp-box {
    width: 3rem;
    height: 3.25rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: var(--rz-border-radius, 0.6rem);
    border: 1px solid var(--rz-border-color);
    background-color: var(--rz-body-background-color);
    color: var(--rz-text-color);
    outline: none;
}

.otp-box:focus {
    border-color: var(--rz-primary);
    box-shadow: 0 0 0 0.2rem var(--rz-primary-lighter);
}

/* QR code TOTP */
.auth-qrcode {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0;
}

.auth-qrcode img {
    border-radius: var(--rz-border-radius, 0.75rem);
    border: 1px solid var(--rz-border-color);
    padding: 0.5rem;
    background: #fff;
}

/* Page publique de téléchargement de l'application Windows (Components\Pages\Telecharger.razor,
   docs\adr\0003 point 5) : même carte que la connexion, un peu plus large pour les notes. */
.auth-card:has(.dl-version) {
    max-width: 560px;
}

.auth-alert-info {
    background-color: var(--rz-info-lighter, rgba(33, 150, 243, 0.1));
    border: 1px solid var(--rz-info-light, rgba(33, 150, 243, 0.4));
    color: var(--rz-info-darker, #0d47a1);
}

.dl-version {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--rz-base-100, #f5f5f5);
    border-radius: var(--rz-border-radius, 0.6rem);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.dl-version > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.dl-libelle {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
}

.dl-numero {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--rz-text-title-color);
}

.dl-meta {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
    line-height: 1.5;
    margin: 0 0 0.75rem;
    overflow-wrap: anywhere;
}

.dl-empreinte {
    font-family: Consolas, monospace;
}

.dl-notes {
    border-top: 1px solid var(--rz-border-color);
    padding-top: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.55;
}

.dl-notes p {
    white-space: pre-line;
    margin: 0.4rem 0 0;
}