.auth-dialog,
.auth-dialog *,
.auth-page,
.auth-page * {
    box-sizing: border-box;
}

.auth-dialog {
    width: min(900px, calc(100vw - 32px));
    max-width: none;
    max-height: min(760px, calc(100dvh - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line, #e0e0e0);
    border-radius: 22px;
    background: var(--surface, #fff);
    color: var(--ink, #171717);
    box-shadow: 0 30px 90px rgba(14, 17, 14, .28);
    font-family: var(--font, "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif);
}

.auth-dialog[open] {
    display: grid;
    grid-template-columns: minmax(280px, .82fr) minmax(430px, 1.18fr);
    animation: auth-dialog-in .22s cubic-bezier(.2, .75, .35, 1) both;
}

.auth-dialog::backdrop {
    background: rgba(12, 15, 13, .62);
    backdrop-filter: blur(7px);
    animation: auth-backdrop-in .18s ease both;
}

html.auth-modal-open {
    overflow: hidden;
}

.auth-dialog__visual {
    position: relative;
    display: flex;
    min-height: 630px;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 32px;
    background:
        radial-gradient(circle at 25% 19%, rgba(255, 255, 255, .2), transparent 28%),
        linear-gradient(145deg, #243d98 0%, #315bc8 52%, #5679df 100%);
    color: #fff;
}

.auth-dialog__visual::before {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, #000, transparent 75%);
    content: "";
}

.auth-dialog__orb {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
}

.auth-dialog__orb--one {
    top: -100px;
    left: -115px;
    width: 310px;
    height: 310px;
}

.auth-dialog__orb--two {
    top: 64px;
    right: -105px;
    width: 235px;
    height: 235px;
}

.auth-dialog__card-stack {
    position: absolute;
    top: 100px;
    left: 50%;
    width: 154px;
    height: 220px;
    transform: translateX(-50%) rotate(-3deg);
}

.auth-dialog__card-stack > span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 13px;
    background: rgba(255, 255, 255, .13);
    box-shadow: 0 22px 40px rgba(9, 21, 65, .26);
    backdrop-filter: blur(4px);
}

.auth-dialog__card-stack > span:first-child {
    transform: translate(-30px, 16px) rotate(-12deg);
}

.auth-dialog__card-stack > span:nth-child(2) {
    transform: translate(28px, 9px) rotate(10deg);
}

.auth-dialog__card-stack > span:last-child {
    background: rgba(255, 255, 255, .94);
}

.auth-dialog__card-stack i {
    position: relative;
    display: block;
    width: 72px;
    height: 72px;
    border: 7px solid #315bc8;
    border-radius: 50%;
}

.auth-dialog__card-stack i::before {
    position: absolute;
    top: 50%;
    right: -7px;
    left: -7px;
    height: 7px;
    background: #315bc8;
    content: "";
    transform: translateY(-50%);
}

.auth-dialog__card-stack i::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17px;
    height: 17px;
    border: 5px solid #315bc8;
    border-radius: 50%;
    background: #fff;
    content: "";
    transform: translate(-50%, -50%);
}

.auth-dialog__visual-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 7px;
}

.auth-dialog__visual-copy strong {
    font-size: 20px;
    letter-spacing: -.35px;
}

.auth-dialog__visual-copy span {
    max-width: 240px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    line-height: 1.55;
}

.auth-dialog__content {
    position: relative;
    max-height: min(760px, calc(100dvh - 32px));
    overflow: auto;
    padding: 46px 50px 38px;
    scrollbar-width: thin;
}

.auth-dialog__close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line, #e0e0e0);
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft, #666666);
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, transform .18s ease;
}

.auth-dialog__close:hover {
    border-color: var(--ink, #171717);
    color: var(--ink, #171717);
    transform: rotate(4deg);
}

.auth-dialog__close:focus-visible,
.auth-tabs button:focus-visible,
.auth-submit:focus-visible,
.auth-password__toggle:focus-visible,
.auth-form__switch a:focus-visible,
.auth-form__switch button:focus-visible,
.auth-page__back:focus-visible {
    outline: 3px solid var(--accent-soft, #e8eefc);
    outline-offset: 2px;
}

.auth-dialog__heading,
.auth-page__heading {
    margin-bottom: 25px;
}

.auth-dialog__eyebrow,
.auth-page__kicker {
    display: block;
    margin-bottom: 9px;
    color: var(--accent, #315bc8);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.65px;
    text-transform: uppercase;
}

.auth-dialog__heading h2,
.auth-page__heading h2 {
    margin: 0;
    color: var(--ink, #171717);
    font-size: clamp(27px, 3vw, 34px);
    line-height: 1.1;
    letter-spacing: -1.15px;
}

.auth-dialog__heading p,
.auth-page__heading p {
    margin: 9px 0 0;
    color: var(--ink-soft, #666666);
    font-size: 13px;
    line-height: 1.55;
}

.auth-page__notice {
    margin: -8px 0 22px;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--success, #288653) 30%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--success, #288653) 11%, var(--surface, #fff));
    color: var(--success, #288653);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
}

/* Lien de réinitialisation périmé : même bloc, registre d'alerte. */
.auth-page__notice--error {
    border-color: color-mix(in srgb, var(--danger, #c84b3e) 30%, transparent);
    background: color-mix(in srgb, var(--danger, #c84b3e) 11%, var(--surface, #fff));
    color: var(--danger, #c84b3e);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 25px;
    padding: 3px;
    border: 1px solid var(--line, #e0e0e0);
    border-radius: 11px;
    background: var(--surface-muted, #f0f0f0);
}

.auth-tabs button {
    min-height: 39px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft, #666666);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.auth-tabs button.is-active {
    background: var(--surface, #fff);
    color: var(--ink, #171717);
    box-shadow: 0 2px 8px rgba(25, 26, 24, .08);
}

.auth-panel[hidden],
.auth-form__alert[hidden],
.auth-field__error[hidden] {
    display: none;
}

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

.auth-form__alert {
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--danger, #c84b3e) 30%, transparent);
    border-radius: 9px;
    background: var(--danger-soft, #fbe9e6);
    color: var(--danger-dark, #9f332a);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.45;
}

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

.auth-field label,
.auth-field__label-line {
    color: var(--ink, #171717);
    font-size: 11px;
    font-weight: 750;
}

.auth-field__label-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.auth-field__label-line span {
    color: var(--ink-faint, #999999);
    font-size: 9px;
    font-weight: 550;
}

.auth-field__link {
    color: var(--accent, #315bc8);
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
}

.auth-field__link:hover {
    text-decoration: underline;
}

.auth-field__link:focus-visible {
    outline: 3px solid var(--accent-soft, #e8eefc);
    outline-offset: 2px;
    border-radius: 4px;
}

.auth-field input {
    width: 100%;
    height: 45px;
    padding: 0 13px;
    border: 1px solid var(--line-strong, #cccccc);
    border-radius: 9px;
    outline: none;
    background: var(--field-background, rgba(255, 255, 255, .65));
    color: var(--ink, #171717);
    font: inherit;
    font-size: 13px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.auth-field input:hover {
    border-color: var(--ink-faint, #999999);
}

.auth-field input:focus {
    border-color: var(--accent, #315bc8);
    background: var(--surface, #fff);
    box-shadow: 0 0 0 3px var(--accent-soft, #e8eefc);
}

.auth-field input[aria-invalid="true"] {
    border-color: var(--danger, #c84b3e);
}

.auth-field__error {
    color: var(--danger-dark, #9f332a);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.4;
}

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

.auth-terms__choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-terms__choice input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--accent, #315bc8);
    cursor: pointer;
}

.auth-terms__choice label {
    color: var(--ink, #171717);
    font-size: 12px;
    line-height: 1.7;
    cursor: pointer;
}

.auth-terms a {
    color: var(--accent, #315bc8);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-terms input:focus-visible,
.auth-terms a:focus-visible {
    outline: 2px solid var(--accent, #315bc8);
    outline-offset: 3px;
}

.auth-terms input[aria-invalid="true"] {
    outline: 2px solid var(--danger, #c84b3e);
    outline-offset: 2px;
}

.auth-terms__new-tab {
    font-size: 10px;
}

.auth-terms__privacy {
    margin: 0;
    color: var(--ink-soft, #666666);
    font-size: 10px;
    line-height: 1.6;
}

.auth-password {
    position: relative;
}

.auth-password input {
    padding-right: 44px;
}

.auth-password__toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-faint, #999999);
    cursor: pointer;
    transform: translateY(-50%);
}

.auth-password__toggle:hover {
    background: var(--surface-muted, #f0f0f0);
    color: var(--ink, #171717);
}

.auth-password__toggle svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.auth-password__toggle[aria-pressed="true"] svg {
    opacity: .5;
}

.auth-submit {
    position: relative;
    display: inline-flex;
    width: 100%;
    min-height: 47px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 2px;
    padding: 0 17px;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    background: var(--surface-dark, #111111);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.auth-submit:hover {
    background: #242424;
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:disabled {
    cursor: wait;
    opacity: .78;
    transform: none;
}

.auth-submit__arrow {
    font-size: 16px;
    transition: transform .18s ease;
}

.auth-submit:hover .auth-submit__arrow {
    transform: translateX(3px);
}

.auth-submit__spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .34);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}

.auth-form.is-submitting .auth-submit__arrow {
    display: none;
}

.auth-form.is-submitting .auth-submit__spinner {
    display: block;
}

.auth-form__switch {
    margin: -2px 0 0;
    color: var(--ink-soft, #666666);
    font-size: 11px;
    text-align: center;
}

.auth-form__switch a,
.auth-form__switch button {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent, #315bc8);
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.auth-form__switch a:hover,
.auth-form__switch button:hover {
    text-decoration: underline;
}

.auth-dialog__noscript {
    margin: 18px 0 0;
    color: var(--ink-soft, #666666);
    font-size: 10px;
    text-align: center;
}

.auth-page {
    min-height: 100vh;
    background: var(--canvas, #f7f7f7);
    color: var(--ink, #171717);
}

.auth-page__main {
    display: grid;
    min-height: calc(100vh - var(--header-height, 72px));
    grid-template-columns: minmax(420px, 1.05fr) minmax(450px, .95fr);
}

.auth-page__story {
    position: relative;
    display: flex;
    min-height: 690px;
    align-items: center;
    overflow: hidden;
    padding: clamp(50px, 7vw, 96px);
    background:
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .08), transparent 22%),
        linear-gradient(145deg, #17265f 0%, #284db0 52%, #315bc8 100%);
    color: #fff;
}

.auth-page__story::before {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at center, #000, transparent 76%);
    content: "";
}

.auth-page__story-inner {
    position: relative;
    z-index: 2;
    width: min(520px, 78%);
}

.auth-page__kicker {
    margin-bottom: 19px;
    color: rgba(255, 255, 255, .56);
}

.auth-page__story h1 {
    max-width: 520px;
    margin: 0;
    font-size: clamp(44px, 5.4vw, 76px);
    font-weight: 780;
    line-height: .98;
    letter-spacing: -3.8px;
}

.auth-page__story h1 em {
    color: #9eb3ff;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.auth-page__story-inner > p {
    max-width: 470px;
    margin: 25px 0 38px;
    color: rgba(255, 255, 255, .7);
    font-size: 14px;
    line-height: 1.7;
}

.auth-page__feature {
    display: grid;
    max-width: 400px;
    grid-template-columns: 30px 1fr;
    gap: 13px;
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, .14);
}

.auth-page__feature > span {
    padding-top: 2px;
    color: #9eb3ff;
    font-size: 10px;
    font-weight: 800;
}

.auth-page__feature strong,
.auth-page__feature small {
    display: block;
}

.auth-page__feature strong {
    margin-bottom: 3px;
    font-size: 12px;
}

.auth-page__feature small {
    color: rgba(255, 255, 255, .56);
    font-size: 10px;
    line-height: 1.45;
}

.auth-page__art {
    position: absolute;
    z-index: 1;
    right: -110px;
    bottom: -35px;
    width: 370px;
    height: 500px;
    opacity: .72;
}

.auth-page__art-card {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 250px;
    height: 350px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(5, 11, 38, .25);
}

.auth-page__art-card--back {
    background: rgba(255, 255, 255, .08);
    transform: translate(-90px, -35px) rotate(-20deg);
}

.auth-page__art-card--middle {
    background: rgba(255, 255, 255, .11);
    transform: translate(-38px, -20px) rotate(-8deg);
}

.auth-page__art-card--front {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .91);
    color: #315bc8;
    transform: rotate(7deg);
}

.auth-page__art-card--front > span {
    position: absolute;
    right: 18px;
    bottom: 15px;
    font-size: 11px;
    font-weight: 900;
}

.auth-page__art-ball {
    position: relative;
    width: 116px;
    height: 116px;
    border: 10px solid currentColor;
    border-radius: 50%;
}

.auth-page__art-ball::before {
    position: absolute;
    top: 50%;
    right: -10px;
    left: -10px;
    height: 10px;
    background: currentColor;
    content: "";
    transform: translateY(-50%);
}

.auth-page__art-ball i {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: 29px;
    height: 29px;
    border: 8px solid currentColor;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
}

.auth-page__form-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 52px clamp(30px, 6vw, 86px);
    background: var(--canvas, #f7f7f7);
}

.auth-page__form-wrap {
    width: min(400px, 100%);
}

.auth-page__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 44px;
    color: var(--ink-soft, #666666);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.auth-page__back:hover {
    color: var(--ink, #171717);
}

.auth-page__heading {
    margin-bottom: 30px;
}

@keyframes auth-dialog-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.985);
    }
}

@keyframes auth-backdrop-in {
    from {
        opacity: 0;
    }
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1050px) {
    .auth-page__main {
        grid-template-columns: minmax(350px, .85fr) minmax(420px, 1.15fr);
    }

    .auth-page__story {
        padding: 58px;
    }

    .auth-page__story-inner {
        width: 100%;
    }

    .auth-page__story h1 {
        font-size: 52px;
        letter-spacing: -2.8px;
    }

    .auth-page__art {
        opacity: .34;
    }
}

@media (max-width: 790px) {
    .auth-dialog {
        width: min(510px, calc(100vw - 22px));
        max-height: calc(100dvh - 22px);
        border-radius: 18px;
    }

    .auth-dialog[open] {
        display: block;
    }

    .auth-dialog__visual {
        display: none;
    }

    .auth-dialog__content {
        max-height: calc(100dvh - 22px);
        padding: 45px 30px 30px;
    }

    .auth-page__main {
        display: block;
        min-height: 0;
    }

    .auth-page__story {
        min-height: auto;
        padding: 56px 28px 64px;
    }

    .auth-page__story h1 {
        max-width: 560px;
        font-size: clamp(40px, 10vw, 60px);
    }

    .auth-page__story-inner > p {
        margin-bottom: 0;
    }

    .auth-page__feature,
    .auth-page__art {
        display: none;
    }

    .auth-page__form-section {
        padding: 48px 24px 66px;
    }

    .auth-page__back {
        margin-bottom: 34px;
    }
}

@media (max-width: 520px) {
    .auth-dialog {
        width: 100vw;
        max-height: 100dvh;
        margin: auto 0 0;
        border: 0;
        border-radius: 20px 20px 0 0;
    }

    .auth-dialog[open] {
        animation-name: auth-sheet-in;
    }

    .auth-dialog__content {
        max-height: 100dvh;
        padding: 44px 21px 28px;
    }

    .auth-dialog__heading {
        margin-bottom: 20px;
    }

    .auth-dialog__heading h2 {
        padding-right: 28px;
        font-size: 28px;
    }

    .auth-tabs {
        margin-bottom: 21px;
    }

    .auth-form {
        gap: 14px;
    }

    .auth-page__story {
        padding: 44px 22px 50px;
    }

    .auth-page__story h1 {
        font-size: 40px;
        letter-spacing: -2.25px;
    }

    .auth-page__story-inner > p {
        font-size: 12px;
    }

    .auth-page__form-section {
        padding: 38px 20px 54px;
    }
}

@keyframes auth-sheet-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-dialog[open],
    .auth-dialog::backdrop,
    .auth-submit__spinner {
        animation-duration: .001ms;
    }

    .auth-dialog__close,
    .auth-submit,
    .auth-submit__arrow {
        transition: none;
    }
}
