.auth-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 14% 8%, color-mix(in srgb, color-mix(in srgb, var(--color-primary) 28%, var(--color-paper)) 22%, transparent), transparent 34rem),
        linear-gradient(145deg, color-mix(in srgb, var(--color-primary) 16%, var(--color-paper)), color-mix(in srgb, var(--color-primary) 16%, var(--color-paper)));
    color: var(--color-text, var(--color-text));
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}

.auth-card {
    width: min(100%, 460px);
    padding: clamp(24px, 5vw, 42px);
    border: 1px solid color-mix(in srgb, var(--color-line) 13%, transparent);
    border-radius: 24px;
    background: color-mix(in srgb, color-mix(in srgb, var(--color-warning) 16%, var(--color-paper)) 94%, transparent);
    box-shadow: 0 24px 70px color-mix(in srgb, var(--color-overlay) 13%, transparent);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.auth-brand .brand-mark {
    flex: 0 0 auto;
}

.auth-brand strong,
.auth-brand span {
    display: block;
}

.auth-brand strong {
    font-size: 1rem;
    letter-spacing: .02em;
}

.auth-brand span {
    margin-top: 2px;
    color: var(--color-muted, var(--color-text));
    font-size: .8rem;
}

.auth-heading {
    margin-bottom: 24px;
}

.auth-heading h1 {
    margin: 4px 0 10px;
    font-size: clamp(2rem, 7vw, 2.7rem);
    font-weight: 500;
    letter-spacing: -.04em;
}

.auth-heading p:last-child {
    margin: 0;
    color: var(--color-muted, var(--color-text));
    line-height: 1.55;
}

.auth-form {
    display: grid;
    gap: 17px;
}

.auth-field {
    display: grid;
    gap: 7px;
}

.auth-field > span {
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: .015em;
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--color-line) 18%, transparent);
    border-radius: 11px;
    background: var(--color-paper);
    color: inherit;
    font: inherit;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.auth-field input:focus {
    border-color: color-mix(in srgb, var(--color-line) 75%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-overlay) 12%, transparent);
}

.auth-field small {
    color: var(--color-muted, var(--color-text));
    font-size: .75rem;
    line-height: 1.45;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
}

.auth-message {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: .86rem;
    line-height: 1.5;
}

.auth-message-error {
    border-color: color-mix(in srgb, var(--color-danger) 25%, transparent);
    background: color-mix(in srgb, var(--color-danger) 8%, transparent);
    color: var(--color-danger);
}

.auth-message-info {
    border-color: color-mix(in srgb, var(--color-line) 22%, transparent);
    background: color-mix(in srgb, var(--color-blue) 8%, transparent);
    color: var(--color-blue);
}

.auth-message-success {
    border-color: color-mix(in srgb, var(--color-line) 24%, transparent);
    background: color-mix(in srgb, var(--color-sage) 9%, transparent);
    color: var(--color-sage);
}

.auth-empty-state {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 14px;
    background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 28%, var(--color-paper)) 22%, transparent);
}

.auth-empty-state h2,
.auth-empty-state p {
    margin: 0;
}

.auth-empty-state p {
    color: var(--color-muted, var(--color-text));
    line-height: 1.55;
}

.account-layout {
    display: grid;
    grid-template-columns: minmax(240px, .72fr) minmax(420px, 1.28fr);
    gap: 22px;
    padding: 24px;
}

.account-card {
    align-self: start;
}

.account-role {
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-muted) 12%, transparent);
    color: var(--color-text);
    font-size: .74rem;
    font-weight: 700;
}

.account-details {
    display: grid;
    gap: 13px;
    margin: 22px 0 0;
}

.account-details div {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--color-line) 10%, transparent);
}

.account-details dt {
    color: var(--color-muted, var(--color-text));
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.account-details dd {
    margin: 0;
    font-weight: 600;
}

.account-password-form {
    max-width: 620px;
    margin-top: 22px;
}

@media (max-width: 850px) {
    .account-layout {
        grid-template-columns: 1fr;
        padding: 16px;
    }
}


/* V011 — contrôle d’affichage du mot de passe */
.password-control {
    position: relative;
    display: block;
    width: 100%;
}

.password-control > input {
    width: 100%;
    padding-right: 7.25rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: .55rem;
    transform: translateY(-50%);
    min-width: 5.8rem;
    padding: .48rem .7rem;
    border: 1px solid color-mix(in srgb, var(--color-line) 18%, transparent);
    border-radius: .65rem;
    background: color-mix(in srgb, var(--color-paper) 90%, transparent);
    color: var(--color-text, var(--color-text));
    font: inherit;
    font-size: .78rem;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 .1rem .35rem color-mix(in srgb, var(--color-overlay) 8%, transparent);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--color-line) 36%, transparent);
    background: var(--color-paper);
    outline: none;
}

.password-toggle[aria-pressed="true"] {
    background: color-mix(in srgb, color-mix(in srgb, var(--color-sage) 16%, var(--color-paper)) 78%, transparent);
}

.auth-diagnostic {
    margin-top: 1rem;
    padding: .85rem 1rem;
    border: 1px dashed color-mix(in srgb, var(--color-line) 22%, transparent);
    border-radius: .85rem;
    background: color-mix(in srgb, var(--color-paper) 52%, transparent);
    font-size: .82rem;
}

.auth-diagnostic summary {
    cursor: pointer;
    font-weight: 700;
}

.auth-diagnostic dl {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: .35rem .8rem;
    margin: .75rem 0 0;
}

.auth-diagnostic dt {
    color: var(--color-text-muted, var(--color-text));
}

.auth-diagnostic dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* V021 — thème individuel dans Mon compte */
.account-theme-card { grid-column: 1 / -1; }
.account-theme-copy { margin: 12px 0 16px; color: var(--color-muted); font-size: .78rem; line-height: 1.6; }

/* V082 — connexion WebAuthn / biométrie locale. */
.auth-biometric-login { display: grid; gap: 12px; margin-top: 18px; }
.auth-or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; color: var(--color-muted); }
.auth-or i { height: 1px; background: var(--color-line); }
.auth-or em { font-size: .74rem; font-style: normal; text-transform: uppercase; letter-spacing: .12em; }
.auth-biometric-button { width: 100%; min-height: 48px; justify-content: center; gap: 9px; }
.auth-biometric-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 18px; }
.auth-biometric-button.is-loading::after,
#webauthnRegisterButton.is-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: webauthn-spin .75s linear infinite; }
@keyframes webauthn-spin { to { transform: rotate(360deg); } }
.account-biometric-card { grid-column: 1 / -1; }
.account-biometric-copy { max-width: 820px; margin: 12px 0 18px; color: var(--color-muted); font-size: .82rem; line-height: 1.65; }
.webauthn-register-row { display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 12px; max-width: 760px; }
.webauthn-register-row .button { min-height: 48px; }
.webauthn-device-list { display: grid; gap: 8px; margin-top: 18px; }
.webauthn-device { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-layer-light); }
.webauthn-device div { min-width: 0; display: grid; gap: 4px; }
.webauthn-device strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.webauthn-device small { color: var(--color-muted); font-size: .72rem; line-height: 1.45; }
.webauthn-empty { margin: 0; padding: 15px; border-radius: 11px; background: var(--color-layer-light); color: var(--color-muted); font-size: .8rem; }
@media (max-width: 620px) {
    .webauthn-register-row { grid-template-columns: 1fr; }
    .webauthn-device { align-items: stretch; flex-direction: column; }
    .webauthn-device .button { align-self: flex-end; }
}


/* V084 — empreinte digitale clairement visible. */
.auth-biometric-button,
.webauthn-register-button {
    display: inline-flex;
    align-items: center;
}
.auth-biometric-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 0;
}
.auth-fingerprint-svg {
    width: 30px;
    height: 30px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.auth-biometric-button:not(:disabled) .auth-fingerprint-svg,
.webauthn-register-button:not(:disabled) .auth-fingerprint-svg {
    animation: fingerprint-breathe 2.2s ease-in-out infinite;
}
@keyframes fingerprint-breathe {
    0%, 100% { transform: scale(1); opacity: .82; }
    50% { transform: scale(1.06); opacity: 1; }
}
.webauthn-register-button { gap: 10px; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
    .auth-fingerprint-svg { animation: none !important; }
}


/* V085 — surface biométrique tactile, sans apparence de bouton. */
.auth-biometric-login {
    justify-items: center;
    margin: 1.25rem 0 1.1rem;
}
.auth-biometric-title {
    margin: 0;
    color: var(--color-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.auth-fingerprint-reader {
    appearance: none;
    -webkit-appearance: none;
    width: 112px;
    min-width: 112px;
    height: 132px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-accent, #3f8c8e);
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 9px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.auth-fingerprint-reader-ring {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, currentColor 56%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 8%, var(--color-paper));
    box-shadow: 0 10px 28px color-mix(in srgb, currentColor 12%, transparent), inset 0 0 0 8px color-mix(in srgb, currentColor 4%, transparent);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-fingerprint-reader .auth-fingerprint-svg {
    width: 62px;
    height: 62px;
    stroke-width: 1.25;
}
.auth-fingerprint-reader-label {
    color: var(--color-muted);
    font-size: .72rem;
    font-weight: 700;
}
.auth-fingerprint-reader:hover .auth-fingerprint-reader-ring,
.auth-fingerprint-reader:focus-visible .auth-fingerprint-reader-ring {
    transform: scale(1.035);
    background: color-mix(in srgb, currentColor 13%, var(--color-paper));
    box-shadow: 0 12px 34px color-mix(in srgb, currentColor 18%, transparent), inset 0 0 0 8px color-mix(in srgb, currentColor 6%, transparent);
}
.auth-fingerprint-reader:focus-visible { outline: none; }
.auth-fingerprint-reader:active .auth-fingerprint-reader-ring,
.auth-fingerprint-reader.is-scanning .auth-fingerprint-reader-ring {
    transform: scale(.96);
    background: color-mix(in srgb, currentColor 18%, var(--color-paper));
}
.auth-fingerprint-reader.is-scanning .auth-fingerprint-svg {
    animation: fingerprint-scan 1.05s ease-in-out infinite;
}
.auth-fingerprint-reader:disabled { opacity: .52; cursor: wait; }
.auth-fingerprint-reader + .auth-message { width: 100%; }
@keyframes fingerprint-scan {
    0%, 100% { opacity: .52; transform: scale(.94); }
    50% { opacity: 1; transform: scale(1.04); }
}
@media (max-width: 620px) {
    .auth-fingerprint-reader { width: 122px; min-width: 122px; height: 142px; }
    .auth-fingerprint-reader-ring { width: 102px; height: 102px; }
    .auth-fingerprint-reader .auth-fingerprint-svg { width: 68px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-fingerprint-reader-ring,
    .auth-fingerprint-reader .auth-fingerprint-svg { animation: none !important; transition: none !important; }
}


/* V089 — identité All in One et biométrie réservée au smartphone */
.auth-brand {
    justify-content: center;
    margin-bottom: 28px;
}
.auth-brand-logo {
    width: min(100%, 330px);
    height: auto;
    display: block;
    object-fit: contain;
}
.auth-biometric-login,
.auth-or {
    display: none;
}
html.is-phone-device .auth-biometric-login {
    display: grid;
}
html.is-phone-device .auth-or {
    display: grid;
}
