#for_clients.af-auth-modal-wrap {
    width: min(500px, calc(100vw - 32px));
    max-width: 500px;
    padding: 0 !important;
    border-radius: 20px;
    background: #fefefe;
    overflow: hidden;
    box-shadow: 0 22px 70px rgba(38, 37, 35, .22);
}

#for_clients.af-auth-modal-wrap .fancybox-close-small {
    top: 13px;
    right: 13px;
    width: 42px;
    height: 42px;
    padding: 8px;
    border-radius: 50%;
    color: #515151;
    background: rgba(150, 175, 215, .16);
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

#for_clients.af-auth-modal-wrap .fancybox-close-small:hover {
    color: #14326e;
    background: rgba(150, 175, 215, .28);
    transform: rotate(4deg);
}

.af-auth-modal {
    --af-auth-blue: #14326e;
    --af-auth-blue-mid: #47639a;
    --af-auth-blue-light: #96afd7;
    --af-auth-graphite: #262523;
    --af-auth-gray: #515151;
    --af-auth-light-gray: #909091;
    --af-auth-white: #fefefe;
    width: 100%;
    color: var(--af-auth-graphite);
    background: var(--af-auth-white);
    font-family: Montserrat, Arial, sans-serif;
}

.af-auth-modal__header {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 112px;
    padding: 25px 68px 24px 28px;
    border-bottom: 1px solid rgba(144, 144, 145, .18);
    background: linear-gradient(135deg, rgba(150, 175, 215, .18) 0%, rgba(254, 254, 254, 1) 58%);
}

.af-auth-modal__icon {
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    color: var(--af-auth-white);
    background: var(--af-auth-blue);
    box-shadow: 0 9px 24px rgba(20, 50, 110, .24);
    font-size: 21px;
}

.af-auth-modal__heading {
    min-width: 0;
}

.af-auth-modal__title {
    margin: 0;
    color: var(--af-auth-graphite);
    font-size: 25px;
    font-weight: 750;
    line-height: 1.18;
}

.af-auth-modal__subtitle {
    margin: 6px 0 0;
    color: var(--af-auth-gray);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.af-auth-modal__form {
    padding: 27px 28px 28px;
}

.af-auth-modal__field {
    margin-bottom: 18px;
}

.af-auth-modal__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.af-auth-modal__label {
    display: block;
    margin: 0 0 8px;
    color: var(--af-auth-graphite);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.af-auth-modal__forgot {
    margin: 0 0 8px;
    color: var(--af-auth-blue-mid);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    text-decoration: none;
    transition: color .2s ease;
}

.af-auth-modal__forgot:hover {
    color: var(--af-auth-blue);
    text-decoration: underline;
}

.af-auth-modal__control {
    position: relative;
}

.af-auth-modal__field-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    width: 18px;
    color: var(--af-auth-light-gray);
    font-size: 15px;
    text-align: center;
    pointer-events: none;
    transition: color .2s ease;
}

.af-auth-modal__input {
    display: block;
    box-sizing: border-box !important;
    width: 100%;
    height: 50px;
    padding: 0 16px 0 52px !important;
    text-indent: 0 !important;
    border: 1px solid rgba(144, 144, 145, .46);
    border-radius: 12px;
    outline: none;
    color: var(--af-auth-graphite);
    background: var(--af-auth-white);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

/* Захист від legacy-стилів полів: текст завжди починається праворуч від іконки. */
#for_clients.af-auth-modal-wrap .af-auth-modal__control > input.af-auth-modal__input {
    padding-left: 52px !important;
    padding-right: 16px !important;
}

.af-auth-modal__input::placeholder {
    color: var(--af-auth-light-gray);
    opacity: 1;
}

.af-auth-modal__input:hover {
    border-color: var(--af-auth-blue-light);
}

.af-auth-modal__input:focus {
    border-color: var(--af-auth-blue);
    background: #fefefe;
    box-shadow: 0 0 0 3px rgba(20, 50, 110, .10);
}

.af-auth-modal__control:focus-within .af-auth-modal__field-icon {
    color: var(--af-auth-blue);
}

.af-auth-modal__alerts {
    margin-top: -4px;
}

.af-auth-modal__alerts #ajax_alert_block {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 0;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
}

.af-auth-modal__alerts #ajax_alert_block.alert-danger {
    color: #8b2f2f;
    background: #fff0f0;
}

.af-auth-modal__alerts #ajax_alert_block.alert-success {
    color: #2f6a45;
    background: #edf8f1;
}

.af-auth-modal__alerts #ajax_alert_list p {
    padding: 0 !important;
    color: inherit !important;
}

.af-auth-modal__alerts #ajax_alert_list p + p {
    margin-top: 4px;
}

.af-auth-modal__remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 20px;
    color: var(--af-auth-gray);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.35;
    cursor: pointer;
    user-select: none;
}

.af-auth-modal__remember input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.af-auth-modal__check {
    flex: 0 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(144, 144, 145, .62);
    border-radius: 6px;
    color: transparent;
    background: var(--af-auth-white);
    font-size: 10px;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.af-auth-modal__remember input:checked + .af-auth-modal__check {
    border-color: var(--af-auth-blue);
    color: var(--af-auth-white);
    background: var(--af-auth-blue);
}

.af-auth-modal__remember input:focus-visible + .af-auth-modal__check {
    box-shadow: 0 0 0 3px rgba(20, 50, 110, .12);
}

.af-auth-modal__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 50px;
    padding: 12px 22px;
    border: 1px solid var(--af-auth-blue);
    border-radius: 12px;
    color: var(--af-auth-white);
    background: var(--af-auth-blue);
    box-shadow: 0 9px 22px rgba(20, 50, 110, .18);
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.af-auth-modal__submit:hover {
    border-color: var(--af-auth-blue-mid);
    background: var(--af-auth-blue-mid);
    box-shadow: 0 11px 25px rgba(20, 50, 110, .22);
    transform: translateY(-1px);
}

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

.af-auth-modal__submit:disabled {
    cursor: wait;
    opacity: .75;
    transform: none;
}

.af-auth-modal__submit-loading {
    display: none;
}

.af-auth-modal__submit.is-loading .af-auth-modal__submit-loading {
    display: inline-flex;
}

.af-auth-modal__submit.is-loading .af-auth-modal__submit-text {
    opacity: .82;
}

.af-auth-modal__divider {
    display: flex;
    align-items: center;
    margin: 22px 0 17px;
}

.af-auth-modal__divider span {
    display: block;
    width: 100%;
    height: 1px;
    background: rgba(144, 144, 145, .22);
}

.af-auth-modal__register {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 15px;
    border: 1px solid rgba(71, 99, 154, .30);
    border-radius: 12px;
    color: var(--af-auth-blue);
    background: rgba(150, 175, 215, .10);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}

.af-auth-modal__register:hover {
    border-color: var(--af-auth-blue-mid);
    color: var(--af-auth-blue);
    background: rgba(150, 175, 215, .18);
    transform: translateY(-1px);
}

.af-auth-modal__register > i:first-child {
    font-size: 15px;
    text-align: center;
}

.af-auth-modal__register-arrow {
    justify-self: end;
    font-size: 11px;
}

@media (max-width: 767px) {
    #for_clients.af-auth-modal-wrap {
        width: calc(100vw - 20px);
        max-width: none;
        border-radius: 16px;
    }

    .af-auth-modal__header {
        min-height: 98px;
        gap: 12px;
        padding: 20px 58px 19px 20px;
    }

    .af-auth-modal__icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
        font-size: 18px;
    }

    .af-auth-modal__title {
        font-size: 21px;
    }

    .af-auth-modal__subtitle {
        margin-top: 4px;
        font-size: 12px;
    }

    .af-auth-modal__form {
        padding: 21px 20px 22px;
    }

    .af-auth-modal__field {
        margin-bottom: 15px;
    }

    .af-auth-modal__input {
        height: 48px;
        border-radius: 11px;
    }

    .af-auth-modal__submit {
        min-height: 48px;
        border-radius: 11px;
    }

    .af-auth-modal__divider {
        margin: 18px 0 14px;
    }
}

@media (max-width: 420px) {
    .af-auth-modal__label-row {
        align-items: flex-start;
    }

    .af-auth-modal__forgot {
        max-width: 52%;
        text-align: right;
    }
}

/* Auth modal panels: login <-> registration without page navigation. */
.af-auth-modal__panel[hidden] {
    display: none !important;
}

#for_clients.af-auth-modal-wrap.is-registration {
    width: min(760px, calc(100vw - 32px));
    max-width: 760px;
}

.af-auth-modal__panel {
    width: 100%;
}

.af-auth-modal__back {
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-right: -4px;
    padding: 0;
    border: 1px solid rgba(71, 99, 154, .22);
    border-radius: 11px;
    color: var(--af-auth-blue, #14326e);
    background: rgba(150, 175, 215, .12);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.af-auth-modal__back:hover {
    border-color: rgba(71, 99, 154, .44);
    background: rgba(150, 175, 215, .22);
    transform: translateX(-1px);
}

.af-auth-modal__register {
    width: 100%;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.af-auth-modal__form--registration {
    padding-top: 24px;
}

.af-auth-modal__registration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
    row-gap: 0;
}

.af-auth-modal__field--full {
    grid-column: 1 / -1;
}

.af-auth-modal__login-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 17px;
    color: var(--af-auth-gray, #515151);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.af-auth-modal__login-hint button {
    padding: 0;
    border: 0;
    color: var(--af-auth-blue, #14326e);
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    font-weight: 750;
    cursor: pointer;
}

.af-auth-modal__login-hint button:hover {
    text-decoration: underline;
}

#for_clients.af-auth-modal-wrap.is-registration .af-auth-modal__header {
    padding-left: 24px;
}

#for_clients.af-auth-modal-wrap.is-registration .af-auth-modal__form {
    max-height: calc(100vh - 190px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (max-width: 767px) {
    #for_clients.af-auth-modal-wrap.is-registration {
        width: calc(100vw - 20px);
        max-width: none;
    }

    #for_clients.af-auth-modal-wrap.is-registration .af-auth-modal__header {
        gap: 10px;
        padding-left: 16px;
    }

    .af-auth-modal__back {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 12px;
    }

    .af-auth-modal__registration-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .af-auth-modal__field--full {
        grid-column: auto;
    }

    #for_clients.af-auth-modal-wrap.is-registration .af-auth-modal__form {
        max-height: calc(100vh - 165px);
    }
}
