/* AppKit auth pages: the messages js/rm-forms.js adds to a form[data-rm-async]. The script marks them .rm-acc__err / .rm-acc__alert (account.css styles those on
   the account pages); on the auth pages they are dressed like the server-rendered .auth-error / .auth-alert. Colour tokens only. */

.auth-card .rm-acc__alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 13px;
    margin-bottom: 16px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.auth-card .rm-acc__alert[hidden] {
    display: none;
}

.auth-card .rm-acc__alert i {
    flex: none;
    margin-top: 2px;
}

.auth-card .rm-acc__alert--error {
    background-color: var(--auth-err-soft);
    color: var(--auth-err);
    font-weight: 500;
}

.auth-card .rm-acc__alert--success {
    background-color: var(--success-soft);
    color: var(--text-strong);
}

.auth-card .rm-acc__alert--success i {
    color: var(--success);
}

/* rm-forms appends a field message to the input's parent (.auth-control, position: relative): it hangs just under the box, the field makes room for it. */
.auth-control .rm-acc__err {
    position: absolute;
    top: 100%;
    left: 2px;
    right: 2px;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 18px;
    font-weight: 500;
    color: var(--auth-err);
    overflow-wrap: anywhere;
}

.auth-field:has(.rm-acc__err) {
    margin-bottom: 40px;
}

.auth-control input.form-control[aria-invalid="true"] {
    border-color: var(--auth-err) !important;
}

/* The async "send a new code" form looks like the plain link it replaces. */
form.auth-resend .auth-link-btn {
    padding: 0;
    color: var(--auth-accent-text);
    font-weight: 700;
    text-decoration: none;
}

form.auth-resend .rm-acc__alert {
    text-align: left;
}

/* The busy button (rm-forms sets .is-busy and disables it while the request runs). */
.auth-submit.is-busy {
    opacity: 0.8;
    cursor: progress;
}

.auth-submit.is-busy::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: auth-async-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .auth-submit.is-busy::after {
        animation: none;
        border-right-color: currentColor;
    }
}
