.auth-page {
    background: #eeecf0;
    min-height: 100vh;
}

.auth-layout {
    display: grid;
    min-height: 100vh;
    padding: clamp(1.25rem, 4vw, 4rem);
    place-items: center;
}

.auth-layout > div {
    max-width: 56rem;
    width: 100%;
}

.auth-card {
    background: var(--ew-surface);
    border: 1px solid #d7d1dc;
    border-radius: 0.5rem;
    box-shadow: 0 18px 50px rgba(35, 26, 44, 0.12);
    display: grid;
    grid-template-columns: 15.5rem minmax(22rem, 1fr);
    max-width: 56rem;
    min-height: 34rem;
    overflow: hidden;
    width: 100%;
}

.auth-brand {
    background-color: #4e137c;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.75rem;
    position: relative;
}

.auth-brand::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 2rem 2rem;
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-logo {
    background: #fff;
    border-radius: 0.25rem;
    box-shadow: none;
    height: auto;
    max-width: 12rem;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

.auth-product {
    border-left: 2px solid rgba(255, 255, 255, 0.5);
    display: grid;
    gap: 0.2rem;
    padding-left: 1rem;
}

.auth-product span,
.auth-product small {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.76rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-product strong {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-panel {
    align-items: center;
    display: flex;
    padding: clamp(2.5rem, 7vw, 5rem);
}

.auth-panel-inner {
    margin: auto;
    max-width: 26rem;
    width: 100%;
}

.auth-title {
    font-size: clamp(1.65rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0 0 0.5rem;
}

.auth-intro {
    color: var(--ew-ink-600);
    line-height: 1.55;
    margin-bottom: 2.25rem;
}

.auth-login-feedback {
    margin-bottom: 1.25rem;
}

.auth-field {
    margin-bottom: 1rem;
}

.auth-field--last {
    margin-bottom: 1.5rem;
}

.auth-field-head {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.auth-field-head .ew-label {
    margin-bottom: 0;
}

.auth-control {
    border-radius: 0.3rem;
    min-height: 3.15rem;
}

.auth-submit {
    border-radius: 0.3rem;
    font-weight: 700;
    min-height: 3.1rem;
}

.auth-secondary-action {
    color: var(--ew-brand-700);
    font-weight: 650;
    text-decoration: none;
}

.auth-secondary-action:hover {
    text-decoration: underline;
}

.auth-footer {
    color: #6d6575;
    font-size: 0.86rem;
    margin-top: 1.25rem;
    text-align: center;
}

.auth-footer a {
    color: #4e137c;
}

.auth-status-card {
    background: var(--ew-surface-subtle);
    border: 1px solid var(--ew-border);
    border-left: 3px solid var(--ew-brand-700);
    border-radius: 0.25rem;
    padding: 1.25rem;
}

.auth-status-card--center {
    text-align: center;
}

.auth-status-copy {
    margin: 0 0 1rem;
}

.auth-form-help {
    color: var(--ew-ink-600);
    font-size: 0.86rem;
    line-height: 1.45;
    margin: 0 0 1.5rem;
}

.auth-spinner {
    animation: auth-spin 700ms linear infinite;
    border: 3px solid rgba(78, 19, 124, 0.18);
    border-radius: 50%;
    border-top-color: var(--ew-brand-700);
    height: 2rem;
    margin: 0 auto 1rem;
    width: 2rem;
}

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

.auth-legal-copy {
    color: var(--ew-ink-800);
    line-height: 1.65;
}

.auth-dialog {
    background: transparent;
    border: 0;
    color: var(--ew-ink-900);
    max-height: calc(100dvh - 2rem);
    max-width: calc(100vw - 2rem);
    overflow: visible;
    padding: 0;
    width: min(32rem, calc(100vw - 2rem));
}

.auth-dialog::backdrop {
    background: rgba(27, 20, 32, 0.62);
    backdrop-filter: blur(2px);
}

.auth-dialog-frame {
    background: var(--ew-surface);
    border: 1px solid #d8d2dc;
    border-radius: 0.55rem;
    box-shadow: 0 24px 70px rgba(28, 18, 34, 0.28);
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
}

.auth-dialog-head,
.auth-dialog-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
}

.auth-dialog-head {
    border-bottom: 1px solid var(--ew-border);
}

.auth-dialog-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.auth-dialog-close {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    color: var(--ew-ink-600);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.75rem;
    height: 2.4rem;
    justify-content: center;
    line-height: 1;
    padding: 0 0 0.15rem;
    width: 2.4rem;
}

.auth-dialog-close:hover {
    background: var(--ew-surface-subtle);
    color: var(--ew-ink-900);
}

.auth-dialog-close:focus-visible {
    border-color: var(--ew-brand-500);
    box-shadow: 0 0 0 0.2rem rgba(92, 30, 126, 0.16);
    outline: 0;
}

.auth-dialog-body {
    min-height: 0;
    overflow-y: auto;
    padding: 1.4rem;
}

.auth-dialog-body > p:first-child {
    color: var(--ew-ink-600);
    margin-top: 0;
}

.auth-dialog-actions {
    border-top: 1px solid var(--ew-border);
    justify-content: flex-end;
}

.auth-terms-dialog {
    width: min(58rem, calc(100vw - 2rem));
}

.auth-terms-dialog .auth-dialog-body {
    padding-block: 1.15rem;
}

.auth-terms-dialog .auth-legal-copy p:last-child {
    margin-bottom: 0;
}

@media (max-width: 820px) {
    .auth-page {
        background: var(--ew-surface);
    }

    .auth-layout {
        padding: 0;
    }

    .auth-card {
        border-radius: 0;
        grid-template-columns: 1fr;
        min-height: 100vh;
    }

    .auth-brand {
        align-items: center;
        flex-direction: row;
        min-height: 7.5rem;
        padding: 1.5rem;
    }

    .auth-logo {
        max-width: 11rem;
    }

    .auth-product {
        text-align: left;
    }

    .auth-panel {
        align-items: flex-start;
        padding: 2rem 1.5rem 3rem;
    }

    .auth-footer {
        display: none;
    }

    .auth-panel-inner {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .auth-brand {
        min-height: 6rem;
        padding: 1rem 1.25rem;
    }

    .auth-logo {
        max-width: 9.5rem;
    }

    .auth-product span,
    .auth-product small {
        display: none;
    }

    .auth-panel {
        padding: 2.25rem 1.25rem 3rem;
    }

    .auth-dialog {
        max-height: calc(100dvh - 1rem);
        max-width: calc(100vw - 1rem);
        width: calc(100vw - 1rem);
    }

    .auth-dialog-frame {
        max-height: calc(100dvh - 1rem);
    }

    .auth-dialog-head,
    .auth-dialog-body,
    .auth-dialog-actions {
        padding-inline: 1rem;
    }

    .auth-dialog-actions .ew-button {
        flex: 1 1 0;
    }
}
