.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-shell {
    position: relative;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    overflow: hidden;
    background: linear-gradient(145deg, var(--color-bg) 0%, var(--color-bg-elevated) 45%, var(--color-surface-warm) 100%);
}

.auth-glow {
    position: absolute;
    inset: auto auto 10% -10%;
    width: min(42rem, 80vw);
    height: min(42rem, 80vw);
    border-radius: var(--radius-pill);
    background: radial-gradient(circle, var(--color-badge-accent-bg) 0%, transparent 70%);
    pointer-events: none;
}

.auth-glow::after {
    content: "";
    position: absolute;
    top: -20%;
    right: -40%;
    width: min(36rem, 70vw);
    height: min(36rem, 70vw);
    border-radius: var(--radius-pill);
    background: radial-gradient(circle, var(--color-badge-primary-bg) 0%, transparent 72%);
}

.auth-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 26rem);
    gap: var(--space-10);
    align-items: center;
    width: min(100%, var(--container-xl));
    margin-inline: auto;
    padding: var(--space-6);
}

.auth-brand-panel {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-8);
}

.auth-logo-mark {
    display: grid;
    place-items: center;
    width: var(--space-16);
    height: var(--space-16);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, var(--color-accent-soft) 0%, var(--color-accent) 100%);
    color: var(--color-accent-contrast);
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    box-shadow: var(--shadow-premium);
}

.auth-logo-word {
    margin: var(--space-0);
    color: var(--color-accent);
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.14em;
}

.auth-logo-sub {
    margin: calc(var(--space-2) * -1) var(--space-0) var(--space-0);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-brand-panel h1 {
    margin: var(--space-0);
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: clamp(var(--font-size-xl), 4vw, var(--font-size-3xl));
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

.auth-lead {
    margin: var(--space-0);
    color: var(--color-text-muted);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
}

.auth-feature-list {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-4) var(--space-0) var(--space-0);
    padding: var(--space-0);
    list-style: none;
}

.auth-feature-list li {
    position: relative;
    padding-left: var(--space-6);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.auth-feature-list li::before {
    content: "";
    position: absolute;
    left: var(--space-0);
    top: 0.55em;
    width: var(--space-2);
    height: var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--color-accent);
}

.auth-card {
    padding: var(--space-8);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-2xl);
    background: linear-gradient(180deg, var(--color-surface-raised) 0%, var(--color-surface-warm) 100%);
    box-shadow: var(--shadow-lg);
}

.auth-card-header h2 {
    margin: var(--space-0);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

.auth-form .field input {
    min-height: var(--space-12);
    border-radius: var(--radius-lg);
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-sm);
}

.auth-submit {
    width: 100%;
    margin-top: var(--space-2);
}

.password-toggle {
    align-self: center;
}

@media (max-width: 64rem) {
    .auth-shell {
        align-items: flex-start;
        padding: var(--space-4);
        padding-top: max(var(--space-8), env(safe-area-inset-top));
        padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
    }

    .auth-layout {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        padding: var(--space-0);
    }

    .auth-brand-panel {
        padding: var(--space-4);
        text-align: center;
    }

    .auth-logo-mark {
        margin-inline: auto;
    }

    .auth-feature-list {
        display: none;
    }

    .auth-card {
        width: min(100%, 26rem);
        margin-inline: auto;
        padding: var(--space-6);
    }
}

@media (min-width: 48rem) and (max-width: 64rem) and (min-height: 40rem) {
    .auth-shell {
        align-items: center;
    }
}

/* Mobile login — Solina V4 compact (phones only; desktop >= 48rem unchanged) */
@media (max-width: 47.99rem) {
    html:has(.auth-page) {
        height: 100%;
        overflow: hidden;
    }

    .auth-page {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        overflow: hidden;
        overscroll-behavior: none;
        background: var(--solina-bg);
    }

    .auth-shell {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        height: 100%;
        max-height: 100dvh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: max(0.5rem, env(safe-area-inset-top)) 1rem max(0.5rem, env(safe-area-inset-bottom));
        overflow: hidden;
        box-sizing: border-box;
        background: var(--solina-bg);
    }

    .auth-glow {
        display: none;
    }

    .auth-layout {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        align-items: stretch;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        max-width: 22.5rem;
        margin: 0 auto;
        padding: 0;
        max-height: 100%;
    }

    .auth-brand-panel {
        flex: 0 0 auto;
        gap: 0.15rem;
        padding: 0 0.5rem;
        text-align: center;
    }

    .auth-brand-lockup {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.1rem;
    }

    .auth-logo-mark {
        display: none;
    }

    .auth-logo-word {
        font-size: 1.125rem;
        letter-spacing: 0.12em;
        line-height: 1.1;
    }

    .auth-logo-sub {
        margin: 0;
        font-size: 0.625rem;
        letter-spacing: 0.1em;
    }

    .auth-brand-panel h1 {
        display: none;
    }

    .auth-lead {
        margin: 0.1rem 0 0;
        font-size: 0.6875rem;
        line-height: 1.3;
        color: var(--solina-text-muted);
    }

    .auth-feature-list {
        display: none;
    }

    .auth-card {
        flex: 0 0 auto;
        width: 100%;
        margin: 0;
        padding: 0.875rem 1rem 1rem;
        border: 1px solid var(--solina-border);
        border-radius: var(--solina-radius-lg);
        background: var(--solina-card);
        box-shadow: var(--solina-shadow-md);
    }

    .auth-card-header {
        margin-bottom: 0;
    }

    .auth-card-header h2 {
        font-size: 1rem;
        font-weight: 700;
        color: var(--solina-brown);
    }

    .auth-form.form-stack {
        gap: 0.5rem;
    }

    .auth-form .field {
        gap: 0.3rem;
    }

    .auth-form .field > span {
        font-size: 0.6875rem;
        font-weight: 600;
        color: var(--solina-text-muted);
    }

    .auth-form .field input {
        min-height: 2.625rem;
        padding: 0.4375rem 0.75rem;
        border: 1px solid rgb(201 164 106 / 0.45);
        border-radius: var(--solina-radius-md);
        background: var(--solina-surface);
        color: var(--solina-text);
        box-shadow: none;
        -webkit-appearance: none;
        appearance: none;
    }

    .auth-form .field input::placeholder {
        color: var(--solina-text-faint);
    }

    .auth-form .field input:focus-visible {
        border-color: var(--solina-gold);
        outline: none;
        box-shadow: 0 0 0 2px rgb(212 160 23 / 0.18);
    }

    .auth-form .field input:-webkit-autofill,
    .auth-form .field input:-webkit-autofill:hover,
    .auth-form .field input:-webkit-autofill:focus {
        -webkit-box-shadow: 0 0 0 1000px var(--solina-surface) inset;
        -webkit-text-fill-color: var(--solina-text);
        caret-color: var(--solina-text);
        border-color: rgb(201 164 106 / 0.45);
    }

    [data-theme="dark"] .auth-form .field input:-webkit-autofill,
    [data-theme="dark"] .auth-form .field input:-webkit-autofill:hover,
    [data-theme="dark"] .auth-form .field input:-webkit-autofill:focus {
        -webkit-box-shadow: 0 0 0 1000px var(--solina-card) inset;
        -webkit-text-fill-color: var(--solina-text);
    }

    .auth-password-wrap.password-field {
        display: block;
        position: relative;
        grid-template-columns: none;
    }

    .auth-password-wrap input {
        width: 100%;
        padding-right: 2.75rem;
    }

    .auth-password-toggle {
        position: absolute;
        top: 50%;
        right: 0.375rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: var(--solina-radius-sm);
        background: transparent;
        color: var(--solina-gold-dark);
        cursor: pointer;
        transform: translateY(-50%);
    }

    .auth-password-toggle:focus-visible {
        outline: 2px solid var(--solina-gold);
        outline-offset: 1px;
    }

    .auth-password-toggle-icon--hide {
        display: none;
    }

    .auth-password-toggle.is-pressed .auth-password-toggle-icon--show {
        display: none;
    }

    .auth-password-toggle.is-pressed .auth-password-toggle-icon--hide {
        display: block;
    }

    .auth-form .choice {
        grid-template-columns: auto 1fr;
        gap: 0.4rem;
        align-items: center;
        margin-top: 0.125rem;
        font-size: 0.75rem;
        color: var(--solina-text-muted);
    }

    .auth-form .choice input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        min-height: 0;
        margin: 0;
        accent-color: var(--solina-gold);
    }

    .auth-form .choice span {
        line-height: 1.2;
    }

    .auth-submit.button-primary {
        min-height: 2.625rem;
        margin-top: 0.125rem;
        padding: 0 1rem;
        border: 1px solid transparent;
        border-radius: var(--solina-radius-md);
        background: linear-gradient(180deg, var(--solina-gold-soft), var(--solina-gold));
        color: var(--solina-brown-dark);
        font-size: 0.875rem;
        font-weight: 600;
        box-shadow: var(--solina-shadow-sm);
    }

    .auth-submit.button-primary:hover {
        opacity: 0.95;
        box-shadow: var(--solina-shadow-md);
    }

    .auth-submit.button-primary:focus-visible {
        outline: 2px solid var(--solina-gold);
        outline-offset: 2px;
        box-shadow: var(--solina-shadow-md);
    }

    .auth-card .theme-toggle {
        width: 2.25rem;
        height: 2.25rem;
        border-color: rgb(201 164 106 / 0.35);
        border-radius: var(--solina-radius-md);
        background: var(--solina-surface);
        color: var(--solina-gold-dark);
    }

    .password-toggle {
        display: none;
    }

    /* Very short viewports: allow inner scroll only when content truly overflows */
    @media (max-height: 36rem) {
        .auth-shell {
            justify-content: flex-start;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .auth-page {
            overflow: hidden;
        }
    }
}
