.auth-modal .modal-dialog {
    max-width: 560px;
}

.auth-modal.auth-register-active .modal-dialog {
    max-width: 620px;
}

.auth-modal .modal-content {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    background: var(--auth-surface, #241532);
    overflow: hidden;
    box-shadow: 0 1.5rem 4rem rgba(12, 3, 24, 0.52);
}

.auth-modal-shell {
    display: block;
}

.auth-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--auth-surface, #241532);
}

.auth-modal .modal-header {
    padding: 2.7rem 2.5rem 2.1rem;
    background: linear-gradient(115deg, #4b0d80 0%, #7620ad 50%, #c21467 100%);
}

.auth-modal-heading {
    min-width: 0;
}

.auth-modal .modal-title {
    color: var(--auth-heading, #ffffff);
    font-family: var(--auth-heading-font, "Montserrat"), sans-serif;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
}

.auth-modal-subtitle {
    max-width: 21rem;
    margin-top: 0.6rem;
    color: var(--auth-muted, #c4a9ce);
    font-family: var(--auth-body-font, "Montserrat"), sans-serif;
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.55;
}

.auth-modal .btn-close {
    --bs-btn-close-bg: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    width: 2.2rem;
    height: 2.2rem;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    opacity: 1;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-modal .btn-close::before {
    content: "×";
    transform: translateY(-1px);
}

.auth-modal .btn-close:hover,
.auth-modal .btn-close:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.24);
    box-shadow: none;
}

.auth-modal .modal-body {
    padding: 2.35rem 2.5rem 2.45rem;
}

.auth-modal [data-auth-title-register],
.auth-modal [data-auth-subtitle-register],
.auth-modal [data-auth-title-recovery],
.auth-modal [data-auth-subtitle-recovery] {
    display: none;
}

.auth-modal.auth-register-active [data-auth-title-login],
.auth-modal.auth-register-active [data-auth-subtitle-login],
.auth-modal.auth-recovery-active [data-auth-title-login],
.auth-modal.auth-recovery-active [data-auth-subtitle-login] {
    display: none;
}

.auth-modal.auth-register-active [data-auth-title-register],
.auth-modal.auth-register-active [data-auth-subtitle-register],
.auth-modal.auth-recovery-active [data-auth-title-recovery],
.auth-modal.auth-recovery-active [data-auth-subtitle-recovery] {
    display: inline;
}

.auth-modal .form-label {
    margin-bottom: 0.5rem;
    color: var(--auth-label, #e4d9eb) !important;
    font-family: var(--auth-body-font, "Montserrat"), sans-serif;
    font-size: 0.9rem;
    font-weight: 800 !important;
}

.auth-modal-field {
    flex-wrap: nowrap;
    min-height: 3.35rem;
    border: 1px solid var(--auth-border, rgba(255, 255, 255, 0.18));
    border-radius: 1rem;
    background: var(--auth-field, rgba(255, 255, 255, 0.07));
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-modal-field:focus-within {
    border-color: var(--auth-primary, #ed145b);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 0.22rem var(--auth-focus-ring, rgba(237, 20, 91, 0.12));
}

.auth-modal-field-icon {
    width: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-icon, #a994b5);
    font-size: 1rem;
}

.auth-modal-field .form-control {
    min-width: 0;
    min-height: 3.25rem;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--auth-heading, #ffffff);
    font-family: var(--auth-body-font, "Montserrat"), sans-serif;
    font-size: 0.98rem;
    font-weight: 600;
    box-shadow: none;
}

.auth-modal-field .form-control::placeholder {
    color: #8e789b;
    font-weight: 500;
}

.auth-modal-field .form-control:focus {
    box-shadow: none;
}

.auth-modal-field .form-control:autofill,
.auth-modal-field .form-control:-webkit-autofill,
.auth-modal-field .form-control:-webkit-autofill:hover,
.auth-modal-field .form-control:-webkit-autofill:focus {
    background: transparent !important;
    background-color: transparent !important;
    -webkit-box-shadow: 0 0 0 1000px var(--auth-field, rgba(255, 255, 255, 0.07)) inset !important;
    -webkit-text-fill-color: var(--auth-heading, #ffffff) !important;
    caret-color: var(--auth-heading, #ffffff);
    transition: background-color 9999s ease-out;
}

/* Keep the modal's single right-side control; hide browser-added password icons. */
.auth-modal input[type="password"]::-ms-reveal,
.auth-modal input[type="password"]::-ms-clear,
.auth-modal input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.auth-modal-field .auth-toggle-password {
    flex: 0 0 3.05rem;
    width: 3.05rem;
    border: 0;
    color: #a994b5;
    background: transparent;
    font-size: 1.05rem;
}

.auth-modal-field .auth-toggle-password:hover,
.auth-modal-field .auth-toggle-password:focus {
    color: var(--auth-primary, #ed145b);
    background: transparent;
    box-shadow: none;
}

.auth-modal-primary-btn {
    min-height: 3.8rem;
    margin-top: 0.35rem;
    border: 0 !important;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--auth-button-start, #ed145b), var(--auth-button-end, #c21467)) !important;
    color: var(--auth-button-text, #ffffff) !important;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 0.85rem 1.45rem var(--auth-button-shadow, rgba(237, 20, 91, 0.22)) !important;
}

.auth-modal-primary-btn:hover,
.auth-modal-primary-btn:focus {
    background: linear-gradient(135deg, var(--auth-button-hover-start, #cf114f), var(--auth-button-start, #ed145b)) !important;
    color: var(--auth-button-text, #ffffff) !important;
}

.auth-modal-primary-btn:disabled {
    opacity: 0.55;
}

.auth-modal .google-oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 2.75rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 0.7rem;
    background: #ffffff;
    color: #3c4043;
    font-family: var(--auth-body-font, "Montserrat"), sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: none;
}

.auth-modal .google-oauth-btn:hover,
.auth-modal .google-oauth-btn:focus {
    border-color: #ffffff;
    background: #f8fafd;
    color: #202124;
    text-decoration: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.12);
}

.auth-modal .google-oauth-icon,
.google-oauth-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
}

.auth-modal-footer-links,
.auth-modal-switch-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1.15rem;
    color: var(--auth-muted, #9f8aaa);
    font-family: var(--auth-body-font, "Montserrat"), sans-serif;
    font-size: 0.94rem;
    font-weight: 650;
    text-align: center;
}

#authLoginPane .auth-modal-footer-links {
    justify-content: flex-end;
    margin-top: 0.35rem;
    margin-bottom: 1.25rem;
}

.auth-modal-switch-copy {
    flex-wrap: wrap;
}

.auth-modal-link {
    color: var(--auth-primary, #ed145b) !important;
    font-weight: 900;
    text-decoration: none;
}

.auth-modal-link:hover,
.auth-modal-link:focus {
    color: var(--auth-link-hover, #b90f45) !important;
    text-decoration: none;
}

.auth-modal .form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.auth-modal .form-check-input {
    flex: 0 0 auto;
    margin-left: 0;
    margin-top: 0.18rem;
    border-color: #cdb9c8;
}

.auth-modal .form-check-input:checked {
    background-color: var(--auth-primary, #ed145b);
    border-color: var(--auth-primary, #ed145b);
}

.auth-modal .form-check-label {
    color: #4d4150 !important;
    font-size: 0.86rem;
    line-height: 1.45;
}

.auth-modal .form-check-label a {
    color: var(--auth-primary, #ed145b);
    font-weight: 900;
}

.auth-modal-recovery-icon {
    width: 4.2rem;
    height: 4.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    border-radius: 1.1rem;
    background: linear-gradient(135deg, var(--auth-pink-soft-strong, #ffe7ef), #e8f7f5);
    color: var(--auth-primary, #ed145b);
    font-size: 1.5rem;
}

.auth-modal .password-wrapper {
    position: relative;
    overflow: visible;
}

.auth-modal .password-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(280px, 100%);
    background: #ffffff;
    border: 1px solid #ead7e4;
    box-shadow: 0 0.65rem 1.45rem rgba(42, 11, 51, 0.14);
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    z-index: 1085;
    display: none;
    color: #473447;
    line-height: 1.45;
}

.auth-modal .password-popup::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 12px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #ffffff transparent;
}

.auth-modal .pw-crit {
    color: #dc2626;
    margin-bottom: 0.25rem;
}

.auth-modal .pw-crit:last-child {
    margin-bottom: 0;
}

.auth-modal .pw-crit.valid {
    color: #16803c;
}

.auth-modal .pw-crit-icon {
    display: inline-block;
    min-width: 1.1rem;
}

@media (max-width: 767.98px) {
    .auth-modal .modal-dialog {
        margin: 0.75rem;
        max-width: none;
    }

    .auth-modal-shell {
        display: block;
    }

    .auth-modal .btn-close {
        top: 0.85rem;
        right: 0.85rem;
        background: rgba(255, 255, 255, 0.9);
    }

    .auth-modal .modal-header {
        padding: 2.25rem 1.25rem 1.65rem;
    }

    .auth-modal .modal-body {
        padding: 1.75rem 1.25rem 1.65rem;
    }

    .auth-modal .modal-title {
        font-size: 1.55rem;
    }

    .auth-modal-subtitle {
        font-size: 0.92rem;
    }

    .auth-modal-field {
        min-height: 3.15rem;
    }

    .auth-modal-field-icon {
        width: 2.7rem;
    }

    .auth-modal-field .form-control {
        min-height: 3rem;
        font-size: 0.94rem;
    }

    .auth-modal-primary-btn {
        min-height: 3.2rem;
    }

    .auth-modal .password-popup {
        left: 0;
        right: auto;
        width: 100%;
    }
}
