.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 28, 30, 0.55);
    animation: auth-modal-fade 0.22s ease;
}

.auth-modal__dialog {
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    background: #fff;
    border-radius: 28px;
    clip-path: inset(0 round 28px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
    padding: 28px 8px 28px 0;
    box-sizing: border-box;
    animation: auth-modal-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal__scroll {
    max-height: calc(100vh - 48px - 56px);
    overflow: auto;
    padding: 0 14px 0 22px;
    scrollbar-width: thin;
    scrollbar-color: #c5cad3 transparent;
}

.auth-modal__scroll::-webkit-scrollbar {
    width: 8px;
}

.auth-modal__scroll::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

.auth-modal__scroll::-webkit-scrollbar-track {
    background: transparent;
    margin: 6px 0;
}

.auth-modal__scroll::-webkit-scrollbar-thumb {
    background: #c5cad3;
    border: 2px solid #fff;
    border-radius: 999px;
}

.auth-modal__scroll::-webkit-scrollbar-thumb:hover {
    background: #9faabc;
}

.auth-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b5b5b5;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-modal__close:hover {
    color: #6e6e6e;
}

.auth-modal__title {
    margin: 0;
    text-align: center;
    color: #1c1c1e;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.auth-modal__subtitle,
.auth-modal__done {
    margin: 8px 0 18px;
    text-align: center;
    color: #8e8e93;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
}

.auth-modal__done {
    margin-bottom: 8px;
    color: #3a3a3c;
}

.auth-modal__field {
    display: block;
    position: relative;
    margin: 0 0 12px;
}

.auth-modal__input {
    display: block;
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid #e3e3e6;
    border-radius: 12px;
    background: #fff;
    color: #1c1c1e;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    box-shadow: none;
}

.auth-modal__input::placeholder {
    color: #c4c4c8;
}

.auth-modal__input:focus {
    border-color: #c8c8cc;
}

.auth-modal__field--password .auth-modal__input {
    padding-right: 48px;
}

.auth-modal__input--error {
    border-color: #ff3b30;
}

.auth-modal__input--good {
    border-color: #50AA32;
}

.auth-modal__message {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.3;
}

.auth-modal__message[hidden],
.auth-modal__restore[hidden],
[data-register-password][hidden],
.auth-modal [hidden] {
    display: none !important;
}

.auth-modal__message--error {
    color: #ff3b30;
}

.auth-modal__message--good {
    color: #50AA32;
}

.auth-modal__issues {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    color: #ff3b30;
    font-size: 13px;
    line-height: 1.35;
}

.auth-modal__issues li + li {
    margin-top: 2px;
}

.auth-modal__restore {
    display: inline-block;
    margin-top: 4px;
    color: #3d6df2;
    font-size: 14px;
    text-decoration: none;
}

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

.auth-modal__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 16px;
}

.auth-modal__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #2e2e2e;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    cursor: pointer;
}

.auth-modal__check input {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 20px;
    border: 1px solid #E0E8F5;
    border-radius: 6px;
    background: #F5F8FD;
    display: grid;
    place-content: center;
    cursor: pointer;
}

.auth-modal__check input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.4 10.2 L8.4 13.2 L14.7 6.8' fill='none' stroke='%239FAABC' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
}

.auth-modal__link {
    color: #2e2e2e;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
}

.auth-modal__link:hover {
    color: #3d6df2;
}

button.auth-modal__link,
button.auth-modal__restore {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.auth-modal__rules {
    margin: 0 0 12px;
    color: #8e8e93;
    font-size: 13px;
    line-height: 1.4;
}

.auth-modal__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    margin-top: 10px;
    border: 0;
    border-radius: 14px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.auth-modal__btn--primary {
    background: #50AA32;
    color: #fff;
}

.auth-modal__btn--primary:hover:not(:disabled):not(.is-disabled) {
    background: linear-gradient(90deg, #AEC90B 0%, #51AD32 100%);
}

.auth-modal__btn--primary:disabled,
.auth-modal__btn--primary.is-disabled {
    background: #e4e6ea;
    color: #a3a7ae;
    cursor: default;
}

.auth-modal__btn--secondary {
    background: #f2f3f5;
    color: #1c1c1e;
}

.auth-modal__btn--secondary:hover {
    background: #e8eaee;
}

.auth-modal__eye {
    position: absolute;
    top: 0;
    right: 8px;
    width: 40px;
    height: 52px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-modal__eye-closed {
    display: none;
}

.auth-modal__eye.is-open .auth-modal__eye-open {
    display: none;
}

.auth-modal__eye.is-open .auth-modal__eye-closed {
    display: block;
}

.auth-modal__legal {
    margin: 16px 8px 0;
    text-align: center;
    color: #b0b0b4;
    font-size: 12px;
    line-height: 1.4;
}

.auth-modal__legal a {
    color: inherit;
    text-decoration: underline;
}

.auth-modal__resend {
    display: block;
    margin: 2px 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8e8e93;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.auth-modal__resend:disabled {
    cursor: default;
}

.auth-modal__btn--primary:disabled,
.auth-modal__btn--secondary:disabled {
    cursor: default;
}

.auth-modal__btn--secondary:disabled {
    background: #f7f8fa;
    color: #c5c8ce;
}

.auth-modal__btn.is-loading,
.auth-modal__btn--primary:disabled.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.auth-modal__btn.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid #d5d8de;
    border-top-color: #50aa32;
    border-radius: 50%;
    animation: auth-modal-spin 0.7s linear infinite;
}

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

@keyframes auth-modal-fade {
    from {
        opacity: 0;
    }
}

@keyframes auth-modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal__backdrop,
    .auth-modal__dialog {
        animation: none;
    }
}

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

.register-done {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.register-done[hidden] {
    display: none !important;
}

.register-done__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 28, 30, 0.55);
}

.register-done__dialog {
    position: relative;
    width: min(392px, 100%);
    padding: 28px 24px 26px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
    text-align: center;
    box-sizing: border-box;
}

.register-done__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b5b5b5;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.register-done__close:hover {
    color: #6e6e6e;
}

.register-done__title {
    margin: 0 24px 10px;
    color: #1c1c1e;
    font-family: Montserrat, sans-serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
}

.register-done__text {
    margin: 0;
    color: #1c1c1e;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
}

.password-toast {
    position: absolute;
    left: 50%;
    top: 18px;
    z-index: 5;
    transform: translateX(-50%);
    margin: 0;
    padding: 16px 36px 16px 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(28, 28, 30, 0.12);
    color: #1c1c1e;
    font-family: Montserrat, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    animation: password-toast-in 0.2s ease-out;
}

.password-toast::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #50AA32;
}

.password-toast--fixed {
    position: fixed;
    top: 86px;
    z-index: 10040;
}

.password-toast--hide {
    opacity: 0;
    transition: opacity 0.25s ease;
}

@keyframes password-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
