.bap-auth-page {
    --auth-accent: #aad6d3;
    --auth-accent-strong: #5d9fa0;
    --auth-ink: #24313f;
    --auth-muted: #657383;
    --auth-border: #dce5e6;
    --auth-surface: #ffffff;
    position: relative;
    isolation: isolate;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 7rem);
    padding: clamp(2rem, 5vw, 4.5rem) 1.25rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 9% 10%, rgba(170, 214, 211, 0.3), transparent 24rem),
        radial-gradient(circle at 92% 86%, rgba(93, 159, 160, 0.12), transparent 22rem),
        #f7faf9;
}

.bap-auth-page::before,
.bap-auth-page::after {
    position: absolute;
    z-index: -1;
    content: "";
    pointer-events: none;
    transform: rotate(45deg);
    border-radius: 2rem;
}

.bap-auth-page::before {
    top: 7rem;
    left: -8rem;
    width: 19rem;
    height: 19rem;
    border: 3.5rem solid rgba(170, 214, 211, 0.12);
}

.bap-auth-page::after {
    right: -7rem;
    bottom: 4rem;
    width: 16rem;
    height: 16rem;
    border: 2.5rem solid rgba(55, 65, 81, 0.05);
}

.bap-auth-shell {
    align-self: flex-start;
    width: min(39rem, 100%);
    overflow: hidden;
    background: var(--auth-surface);
    border: 1px solid rgba(55, 65, 81, 0.1);
    border-radius: 1.35rem;
    box-shadow: 0 1.5rem 4.5rem rgba(36, 49, 63, 0.14);
}

.bap-auth-page--wide .bap-auth-shell {
    width: min(66rem, 100%);
}

.bap-auth-brand {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 5.75rem;
    padding: 1.15rem 1.75rem;
    overflow: hidden;
    border-bottom: 1px solid var(--auth-border);
    background: linear-gradient(105deg, #ffffff 0%, #f4f9f8 62%, #eaf4f3 100%);
}

.bap-auth-brand-logo {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: min(13.5rem, 42%);
    line-height: 0;
}

.bap-auth-brand-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 3.2rem;
    object-fit: contain;
    object-position: left center;
}

.bap-auth-brand-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.2rem;
    margin-left: 1.35rem;
    padding-left: 1.35rem;
    border-left: 1px solid #cddadb;
}

.bap-auth-brand-copy span {
    color: #40505f;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bap-auth-brand-copy small {
    color: #73808d;
    font-size: 0.72rem;
    line-height: 1.4;
}

.bap-auth-brand-mark {
    position: absolute;
    top: -3.25rem;
    right: -2.25rem;
    width: 8.5rem;
    height: 8.5rem;
    transform: rotate(45deg);
    border: 1.35rem solid rgba(93, 159, 160, 0.14);
    border-radius: 1.3rem;
}

.bap-auth-panel {
    padding: clamp(2rem, 5vw, 3.4rem);
    background: var(--auth-surface);
}

.bap-auth-page--wide .bap-auth-panel {
    padding-right: clamp(2rem, 5vw, 4rem);
    padding-left: clamp(2rem, 5vw, 4rem);
}

.bap-auth-card {
    width: 100%;
    margin: 0 auto;
}

.bap-auth-heading {
    margin-bottom: 1.75rem;
}

.bap-auth-heading--center {
    text-align: center;
}

.bap-auth-kicker {
    display: inline-flex;
    align-items: center;
    margin: 0 0 0.5rem;
    color: var(--auth-accent-strong);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.bap-auth-heading--center .bap-auth-kicker {
    justify-content: center;
}

.bap-auth-title {
    margin: 0;
    color: var(--auth-ink);
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    line-height: 1.18;
}

.bap-auth-subtitle {
    max-width: 44rem;
    margin: 0.7rem 0 0;
    color: var(--auth-muted);
    font-size: 0.92rem;
    line-height: 1.65;
}

.bap-auth-heading--center .bap-auth-subtitle {
    margin-right: auto;
    margin-left: auto;
}

.bap-auth-form,
.bap-auth-form-grid {
    display: grid;
    gap: 1rem;
}

.bap-auth-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.2rem;
}

.bap-auth-field--full,
.bap-auth-form-actions,
.bap-auth-form > .bap-auth-alert {
    grid-column: 1 / -1;
}

.bap-auth-field label {
    display: block;
    margin-bottom: 0.42rem;
    color: var(--auth-ink);
    font-size: 0.84rem;
    font-weight: 600;
}

.bap-auth-required {
    color: #c94444;
}

.bap-auth-field input,
.bap-auth-field textarea,
.bap-auth-field select {
    width: 100%;
    min-height: 3rem;
    margin: 0;
    padding: 0.7rem 0.9rem;
    color: var(--auth-ink);
    border: 1px solid #cad5d8;
    border-radius: 0.65rem;
    background: #ffffff;
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.bap-auth-field input:hover,
.bap-auth-field textarea:hover,
.bap-auth-field select:hover {
    border-color: #9eb7ba;
}

.bap-auth-field input:focus,
.bap-auth-field textarea:focus,
.bap-auth-field select:focus {
    outline: none;
    border-color: var(--auth-accent-strong);
    box-shadow: 0 0 0 0.22rem rgba(170, 214, 211, 0.38);
}

.bap-auth-field input[aria-invalid="true"],
.bap-auth-field textarea[aria-invalid="true"],
.bap-auth-field select[aria-invalid="true"] {
    border-color: #c94444;
    box-shadow: 0 0 0 0.18rem rgba(201, 68, 68, 0.12);
}

.bap-auth-help,
.bap-auth-help ul {
    margin: 0.45rem 0 0;
    padding: 0;
    color: var(--auth-muted);
    font-size: 0.72rem;
    line-height: 1.5;
    list-style: none;
}

.bap-auth-help li {
    position: relative;
    padding-left: 0.85rem;
}

.bap-auth-help li::before {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--auth-accent-strong);
    content: "•";
}

.bap-auth-error-list,
.bap-auth-field .errorlist {
    margin: 0.4rem 0 0;
    padding: 0;
    color: #b42318;
    font-size: 0.76rem;
    line-height: 1.4;
    list-style: none;
}

.bap-auth-alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    color: #842029;
    border: 1px solid #f1b8bd;
    border-radius: 0.7rem;
    background: #fff1f2;
    font-size: 0.82rem;
}

.bap-auth-alert .errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bap-auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.15rem;
    padding: 0.75rem 1.25rem;
    color: #263741;
    border: 1px solid var(--auth-accent);
    border-radius: 0.7rem;
    background: var(--auth-accent);
    box-shadow: 0 0.6rem 1.5rem rgba(93, 159, 160, 0.2);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.bap-auth-button:hover {
    color: #1f3037;
    border-color: #91c9c6;
    background: #91c9c6;
    box-shadow: 0 0.85rem 1.75rem rgba(93, 159, 160, 0.26);
    text-decoration: none;
    transform: translateY(-1px);
}

.bap-auth-button:focus-visible,
.bap-auth-link:focus-visible,
.google-signin-btn:focus-visible {
    outline: 3px solid rgba(93, 159, 160, 0.45);
    outline-offset: 3px;
}

.bap-auth-meta,
.bap-auth-switch {
    margin: 1.05rem 0 0;
    color: var(--auth-muted);
    font-size: 0.83rem;
    text-align: center;
}

.bap-auth-link {
    color: #397e83;
    font-weight: 600;
    text-decoration: none;
}

.bap-auth-link:hover {
    color: #275f63;
    text-decoration: underline;
}

.bap-auth-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.35rem 0 0.95rem;
    color: var(--auth-muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bap-auth-divider::before,
.bap-auth-divider::after {
    flex: 1;
    height: 1px;
    content: "";
    background: var(--auth-border);
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.7rem 1.2rem;
    color: #3c4043;
    border: 1px solid #d6dcdf;
    border-radius: 0.7rem;
    background: #ffffff;
    box-shadow: 0 0.25rem 0.75rem rgba(36, 49, 63, 0.05);
    font-family: "Montserrat", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.google-signin-btn:hover {
    color: #263741;
    border-color: #aebdc0;
    box-shadow: 0 0.55rem 1.25rem rgba(36, 49, 63, 0.1);
    text-decoration: none;
    transform: translateY(-1px);
}

.bap-auth-status-icon {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1.2rem;
    place-items: center;
    color: #2f696d;
    border: 1px solid rgba(93, 159, 160, 0.35);
    border-radius: 50%;
    background: rgba(170, 214, 211, 0.28);
    font-size: 1.2rem;
}

html[data-theme="dark"] .bap-auth-page {
    --auth-ink: #f3f4f6;
    --auth-muted: #bdc8d2;
    --auth-border: #3c4a5d;
    --auth-surface: #1f2937;
    background:
        radial-gradient(circle at 9% 10%, rgba(93, 159, 160, 0.2), transparent 24rem),
        radial-gradient(circle at 92% 86%, rgba(170, 214, 211, 0.07), transparent 22rem),
        #111827;
}

html[data-theme="dark"] .bap-auth-shell {
    border-color: #374151;
    box-shadow: 0 1.5rem 4.5rem rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .bap-auth-brand {
    border-color: #3c4a5d;
    background: linear-gradient(105deg, #263344 0%, #263746 68%, #294449 100%);
}

html[data-theme="dark"] .bap-auth-brand-logo {
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(170, 214, 211, 0.16);
    border-radius: 0.55rem;
    background: rgba(170, 214, 211, 0.07);
}

html[data-theme="dark"] .bap-auth-brand-copy {
    border-color: #506071;
}

html[data-theme="dark"] .bap-auth-brand-copy span {
    color: #e5eeee;
}

html[data-theme="dark"] .bap-auth-brand-copy small {
    color: #b8c7cf;
}

html[data-theme="dark"] .bap-auth-field input,
html[data-theme="dark"] .bap-auth-field textarea,
html[data-theme="dark"] .bap-auth-field select {
    color: #f3f4f6;
    border-color: #4b5563;
    background: #111827;
    color-scheme: dark;
}

html[data-theme="dark"] .bap-auth-field input:hover,
html[data-theme="dark"] .bap-auth-field textarea:hover,
html[data-theme="dark"] .bap-auth-field select:hover {
    border-color: #7c9297;
}

html[data-theme="dark"] .bap-auth-field input[aria-invalid="true"],
html[data-theme="dark"] .bap-auth-field textarea[aria-invalid="true"],
html[data-theme="dark"] .bap-auth-field select[aria-invalid="true"] {
    border-color: #f87171;
}

html[data-theme="dark"] .bap-auth-alert {
    color: #fecaca;
    border-color: #7f1d1d;
    background: rgba(127, 29, 29, 0.28);
}

html[data-theme="dark"] .bap-auth-link {
    color: #aad6d3;
}

html[data-theme="dark"] .bap-auth-link:hover {
    color: #d0ecea;
}

/*
 * Keep account forms comfortable at 100% browser zoom on shorter desktop
 * viewports. This changes vertical density only; mobile layouts continue to
 * use their natural document flow and remain scrollable.
 */
@media (min-width: 721px) and (max-height: 900px) {
    .bap-auth-page {
        min-height: calc(100vh - 7rem);
        padding-top: 1rem !important;
        padding-bottom: 1.5rem;
    }

    .bap-auth-brand {
        min-height: 4.7rem;
        padding-top: 0.8rem;
        padding-bottom: 0.8rem;
    }

    .bap-auth-panel,
    .bap-auth-page--wide .bap-auth-panel {
        padding-top: 1.65rem;
        padding-bottom: 1.65rem;
    }

    .bap-auth-page--wide .bap-auth-panel {
        padding-top: 1.4rem;
        padding-bottom: 1.4rem;
    }

    .bap-auth-heading {
        margin-bottom: 1.15rem;
    }

    .bap-auth-kicker {
        margin-bottom: 0.3rem;
    }

    .bap-auth-subtitle {
        margin-top: 0.4rem;
        line-height: 1.45;
    }

    .bap-auth-form,
    .bap-auth-form-grid {
        gap: 0.7rem;
    }

    .bap-auth-field label {
        margin-bottom: 0.3rem;
    }

    .bap-auth-field input,
    .bap-auth-field textarea,
    .bap-auth-field select {
        min-height: 2.65rem;
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .bap-auth-help,
    .bap-auth-help ul {
        margin-top: 0.3rem;
        line-height: 1.35;
    }

    .bap-auth-error-list,
    .bap-auth-field .errorlist {
        margin-top: 0.25rem;
    }

    .bap-auth-button,
    .google-signin-btn {
        min-height: 2.75rem;
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .bap-auth-meta,
    .bap-auth-switch {
        margin-top: 0.7rem;
    }

    .bap-auth-divider {
        margin-top: 0.85rem;
        margin-bottom: 0.7rem;
    }
}

@media (min-width: 721px) and (max-height: 800px) {
    .bap-auth-page {
        padding-top: 0.7rem !important;
        padding-bottom: 0.7rem;
    }

    .bap-auth-brand {
        min-height: 4.25rem;
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }

    .bap-auth-panel,
    .bap-auth-page--wide .bap-auth-panel {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .bap-auth-heading {
        margin-bottom: 0.5rem;
    }

    .bap-auth-title {
        font-size: 1.8rem;
    }

    .bap-auth-subtitle {
        font-size: 0.84rem;
    }

    .bap-auth-help,
    .bap-auth-help ul {
        font-size: 0.66rem;
        line-height: 1.2;
    }

    .bap-auth-form,
    .bap-auth-form-grid {
        gap: 0.4rem;
    }

    .bap-auth-field input,
    .bap-auth-field textarea,
    .bap-auth-field select {
        min-height: 2.25rem;
    }

    .bap-auth-button,
    .google-signin-btn {
        min-height: 2.35rem;
    }

    .bap-auth-meta,
    .bap-auth-switch {
        margin-top: 0.5rem;
    }
}

@media (max-width: 720px) {
    .bap-auth-page {
        min-height: auto;
        padding: 1.25rem 0.85rem 2.5rem;
    }

    .bap-auth-shell {
        border-radius: 1rem;
    }

    .bap-auth-brand {
        min-height: 4.8rem;
        padding: 1rem 1.25rem;
    }

    .bap-auth-brand-logo {
        width: min(11.5rem, 52%);
    }

    .bap-auth-brand-copy {
        margin-left: 1rem;
        padding-left: 1rem;
    }

    .bap-auth-brand-copy small {
        display: none;
    }

    .bap-auth-panel,
    .bap-auth-page--wide .bap-auth-panel {
        padding: 1.75rem 1.35rem 2rem;
    }

    .bap-auth-form-grid {
        grid-template-columns: 1fr;
    }

    .bap-auth-field--full,
    .bap-auth-form-actions {
        grid-column: auto;
    }

    .bap-auth-page ~ #ai-chat-widget,
    .bap-auth-page ~ #click_to_call {
        display: none !important;
    }
}

@media (max-width: 430px) {
    .bap-auth-brand-copy {
        display: none;
    }

    .bap-auth-brand-logo {
        width: 11.5rem;
    }

    .bap-auth-title {
        font-size: 1.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bap-auth-button,
    .google-signin-btn,
    .bap-auth-field input,
    .bap-auth-field textarea,
    .bap-auth-field select {
        transition: none;
    }
}
