/* Auth Pages — pill design language (Dashboard / module-ui) */

:root {
    --auth-radius-pill: var(--mod-radius-pill, 1.5rem);
    --auth-field-bg: #ffffff;
    --auth-field-border: rgba(0, 0, 0, 0.1);
    --auth-text: #1a1a1a;
    --auth-muted: rgba(26, 26, 26, 0.72);
    --auth-link: #0b3d91;
    --auth-panel-bg: #ffffff;
    --auth-glass-bg: rgba(255, 255, 255, 0.82);
    --auth-glass-border: rgba(255, 255, 255, 0.45);
    --auth-form-surface: color-mix(in srgb, var(--accent-color, var(--bs-primary)) 16%, #ffffff 84%);
    --auth-form-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --auth-brand-text: #ffffff;
    --auth-brand-muted: rgba(255, 255, 255, 0.82);
}

[data-bs-theme="dark"] {
    --auth-field-bg: color-mix(in srgb, var(--bs-body-bg, #1a1a1a) 88%, #fff 12%);
    --auth-field-border: rgba(255, 255, 255, 0.16);
    --auth-text: var(--bs-body-color, #e9ecef);
    --auth-muted: rgba(233, 236, 239, 0.65);
    --auth-link: color-mix(in srgb, var(--accent-color, #6ea8fe) 70%, #fff);
    --auth-panel-bg: var(--bs-body-bg, #1a1a1a);
}

[data-oled-mode="true"] {
    --auth-field-bg: #0a0a0a;
    --auth-field-border: rgba(255, 255, 255, 0.14);
    --auth-text: #f5f5f5;
    --auth-muted: rgba(245, 245, 245, 0.62);
    --auth-link: color-mix(in srgb, var(--accent-color, #6ea8fe) 70%, #fff);
    --auth-panel-bg: #000000;
}

@keyframes auth-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes auth-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-panel-exit-left {
    to {
        opacity: 0;
        transform: translateX(-2.75rem) scale(0.97);
        filter: blur(2px);
    }
}

@keyframes auth-panel-exit-right {
    to {
        opacity: 0;
        transform: translateX(2.75rem) scale(0.97);
        filter: blur(2px);
    }
}

@keyframes auth-panel-enter-right {
    from {
        opacity: 0;
        transform: translateX(3rem) scale(0.97);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

@keyframes auth-panel-enter-left {
    from {
        opacity: 0;
        transform: translateX(-3rem) scale(0.97);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

@keyframes auth-brand-nudge-left {
    to {
        transform: translateX(-0.65rem);
        opacity: 0.92;
    }
}

@keyframes auth-brand-nudge-right {
    to {
        transform: translateX(0.65rem);
        opacity: 0.92;
    }
}

@keyframes auth-form-surface-shift {
    from { opacity: 0.72; }
    to { opacity: 1; }
}

/* Kill outer white/gray frame: html + body + main must match shell, no gaps */
html:has(.auth-container),
body:has(.auth-container),
body:has(.auth-container) main {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

body:has(.auth-container) main > .container-fluid {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
}

@media (min-width: 768px) {
    html:has(.auth-split-container),
    body:has(.auth-split-container),
    body:has(.auth-split-container) main {
        background-color: #667eea;
        background-image: var(--auth-form-bg);
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
    }

    body:has(.auth-split-container):not(:has(.auth-register)):not(:has(.auth-confirm-email)) {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }

    html:has(.auth-split-container):not(:has(.auth-register)):not(:has(.auth-confirm-email)) {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }

    body:has(.auth-split-container) main {
        min-height: 100vh !important;
        min-height: 100dvh !important;
        display: block !important;
    }

    body:has(.auth-split-container):not(:has(.auth-register)):not(:has(.auth-confirm-email)) main {
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
    }

    body:has(.auth-split-container) main > .container-fluid {
        height: 100% !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    body:has(.auth-split-container) .auth-split-container {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
    }

    .auth-split-container:not(.auth-register):not(.auth-confirm-email) {
        height: 100%;
        min-height: 100dvh;
    }

    .auth-split-container:not(.auth-register):not(.auth-confirm-email) .auth-split {
        height: 100%;
        min-height: 100dvh;
        max-height: 100dvh;
    }

    .auth-split-container:not(.auth-register):not(.auth-confirm-email) .auth-split-brand,
    .auth-split-container:not(.auth-register):not(.auth-confirm-email) .auth-split-form {
        height: 100%;
        min-height: 0;
    }

    /* Legacy centered auth (change_password, legal, etc.) */
    html:has(.auth-container:not(.auth-split-container)),
    body:has(.auth-container:not(.auth-split-container)),
    body:has(.auth-container:not(.auth-split-container)) main {
        background: var(--auth-page-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
        background-attachment: fixed !important;
        background-size: cover !important;
    }

    body:has(.auth-container:not(.auth-split-container)) {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }

    html:has(.auth-container:not(.auth-split-container)) {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
    }

    body:has(.auth-container:not(.auth-split-container)) main {
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
    }

    .auth-container:not(.auth-split-container) {
        min-height: 100vh;
        min-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--auth-page-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
        background-attachment: fixed !important;
        background-size: cover !important;
        margin: 0 !important;
        padding: 1.25rem !important;
        box-sizing: border-box;
        overflow: hidden;
        border: none !important;
    }
}

/* Never show PWA install toast on auth pages */
body:has(.auth-container) .pwa-install-prompt {
    display: none !important;
}

/* Shared shell layout defaults (overridden per breakpoint) */
.auth-container {
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    box-sizing: border-box;
    border: none !important;
}

.auth-split-container {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    display: block;
}

.auth-split {
    display: grid;
    grid-template-columns: minmax(280px, 42%) 1fr;
    grid-template-rows: 1fr;
    min-height: 100%;
    height: 100%;
    width: 100%;
}

/* Register: form left, brand right */
.auth-split--flipped {
    grid-template-columns: 1fr minmax(280px, 42%);
}

.auth-split--flipped .auth-split-brand {
    grid-column: 2;
    grid-row: 1;
}

.auth-split--flipped .auth-split-form {
    grid-column: 1;
    grid-row: 1;
}

.auth-container:not(.auth-split-container) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.auth-split-brand {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    color: var(--auth-brand-text);
    overflow: hidden;
}

.auth-split-brand-bg {
    position: absolute;
    inset: 0;
    background-color: var(--auth-brand-bg-color, #667eea);
    background-image: var(--auth-brand-bg-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.auth-split-brand-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.12) 0%,
        rgba(15, 23, 42, 0.28) 100%
    );
    pointer-events: none;
}

.auth-split-brand-stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    box-sizing: border-box;
}

.auth-split-brand-stage-inner {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    max-width: min(22rem, 88%);
}

.auth-brand-logo--top-left .auth-split-brand-stage-inner {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: start;
    align-items: flex-start;
    text-align: left;
}

.auth-brand-logo--top-center .auth-split-brand-stage-inner {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: start;
}

.auth-brand-logo--top-right .auth-split-brand-stage-inner {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    align-items: flex-end;
    text-align: right;
}

.auth-brand-logo--middle-left .auth-split-brand-stage-inner {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    align-self: center;
    align-items: flex-start;
    text-align: left;
}

.auth-brand-logo--middle-right .auth-split-brand-stage-inner {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    align-items: flex-end;
    text-align: right;
}

.auth-brand-logo--bottom-left .auth-split-brand-stage-inner {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    align-self: end;
    align-items: flex-start;
    text-align: left;
}

.auth-brand-logo--bottom-center .auth-split-brand-stage-inner {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
    align-self: end;
}

.auth-brand-logo--bottom-right .auth-split-brand-stage-inner {
    grid-column: 3;
    grid-row: 3;
    justify-self: end;
    align-self: end;
    align-items: flex-end;
    text-align: right;
}

.auth-split-brand-inner {
    animation: none;
}

.auth-split-container.auth-initial-mount .auth-split-brand-inner {
    animation: auth-fade-up 0.55s ease both;
}

.auth-split-brand-logo-img {
    max-height: clamp(64px, 12vh, 120px);
    max-width: min(240px, 72vw);
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.28));
}

.auth-split-brand-text {
    margin: 0;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.5;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
    white-space: pre-wrap;
}

.auth-split-form {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    padding-bottom: 3.5rem;
    background-color: #667eea;
    background-image: var(--auth-form-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.auth-split-form-center {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

.auth-split-form-stack {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.auth-split-container.auth-register .auth-split-form-stack,
.auth-split-container.auth-register .auth-split-form .auth-card {
    max-width: min(720px, 92%);
}

.auth-split-container.auth-initial-mount .auth-split-form .auth-card {
    animation: auth-fade-up 0.6s ease 0.08s both;
}

.auth-split-form .auth-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* Page switch: login <-> register (sides swap) */
.auth-split-container:not(.auth-register).auth-transition-exit-to-register .auth-split-form .auth-card {
    animation: auth-panel-exit-left 0.32s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

.auth-split-container.auth-register.auth-transition-exit-to-login .auth-split-form .auth-card {
    animation: auth-panel-exit-right 0.32s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

.auth-split-container:not(.auth-register).auth-transition-exit-to-register .auth-split-brand-inner {
    animation: auth-brand-nudge-left 0.32s ease forwards;
}

.auth-split-container.auth-register.auth-transition-exit-to-login .auth-split-brand-inner {
    animation: auth-brand-nudge-right 0.32s ease forwards;
}

.auth-split-container.auth-transition-enter-to-register .auth-split-form .auth-card {
    animation: auth-panel-enter-left 0.48s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.auth-split-container.auth-transition-enter-to-login .auth-split-form .auth-card {
    animation: auth-panel-enter-right 0.48s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.auth-split-container.auth-transition-enter-to-register .auth-split-brand-inner {
    animation: auth-panel-enter-right 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-split-container.auth-transition-enter-to-login .auth-split-brand-inner {
    animation: auth-panel-enter-left 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-split-container.auth-transition-done .auth-split-form .auth-card,
.auth-split-container.auth-transition-done .auth-split-brand-inner {
    animation: none !important;
    opacity: 1;
    transform: none;
    filter: none;
}

.auth-page-switch {
    position: relative;
    transition: color 0.2s ease;
}

.auth-page-switch::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.1rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-page-switch:hover::after,
.auth-page-switch:focus-visible::after {
    transform: scaleX(1);
}

.auth-form-header {
    margin-bottom: 1.35rem;
}

.auth-form-title {
    margin: 0 0 0.35rem;
    color: var(--auth-text);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-form-header .auth-subtitle {
    margin: 0 !important;
    color: var(--auth-muted) !important;
    font-size: 0.9rem;
    line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
    .auth-split-brand,
    .auth-split-brand-inner,
    .auth-split-form .auth-card,
    .auth-split-container.auth-transition-exit-to-register .auth-split-form .auth-card,
    .auth-split-container.auth-transition-exit-to-login .auth-split-form .auth-card,
    .auth-split-container.auth-transition-enter-to-register .auth-split-form .auth-card,
    .auth-split-container.auth-transition-enter-to-login .auth-split-form .auth-card,
    .auth-split-container.auth-transition-enter-to-register .auth-split-brand-inner,
    .auth-split-container.auth-transition-enter-to-login .auth-split-brand-inner {
        animation: none !important;
        filter: none !important;
        transform: none !important;
    }

    .auth-page-switch::after {
        display: none;
    }
}

.auth-card {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
}

.auth-legal-links {
    font-size: 0.875rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.auth-legal-links--corner {
    position: absolute;
    right: clamp(1rem, 2.5vw, 1.75rem);
    bottom: clamp(0.85rem, 2vh, 1.35rem);
    left: auto;
    margin: 0;
    text-align: right;
    white-space: nowrap;
    z-index: 2;
}

.auth-split-form .auth-legal-links a {
    color: var(--auth-muted);
    font-weight: 500;
}

.auth-legal-links a {
    color: rgba(108, 117, 125, 0.95);
    text-decoration: none;
}

.auth-legal-links a:hover,
.auth-legal-links a:focus {
    color: #6c757d;
    text-decoration: underline;
}

.auth-legal-sep {
    color: rgba(108, 117, 125, 0.7);
    margin: 0 0.45rem;
    user-select: none;
}

.auth-legal-card {
    max-width: 720px;
}

.auth-legal-heading {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.auth-legal-content {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--bs-body-color, #212529);
    max-height: min(65vh, 640px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

@media (min-width: 768px) {
    .auth-card {
        max-width: 520px;
        width: 100%;
    }

    .auth-split-form .auth-card {
        max-width: 440px;
    }

    .auth-split-container.auth-register .auth-split-form-stack,
    .auth-split-container.auth-register .auth-split-form .auth-card {
        max-width: min(720px, 88%);
    }

    .auth-split-container.auth-register .auth-split-form-center {
        place-items: center;
        min-height: 100%;
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .auth-split-container.auth-register .auth-split {
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        align-items: stretch;
    }

    .auth-split-container.auth-register .auth-split-brand {
        position: sticky;
        top: 0;
        align-self: start;
        min-height: 100vh;
        min-height: 100dvh;
        height: 100dvh;
    }

    .auth-split-container.auth-register .auth-split-form {
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow-y: visible;
        background-color: #667eea;
        background-image: var(--auth-form-bg);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    .auth-legal-card {
        max-width: 720px;
    }

    /* Taller auth flows (register / confirm / legal) — allow page scroll */
    body:has(.auth-register),
    html:has(.auth-register),
    body:has(.auth-confirm-email),
    html:has(.auth-confirm-email),
    body:has(.auth-legal),
    html:has(.auth-legal) {
        overflow-y: auto !important;
        height: auto !important;
        max-height: none !important;
    }

    body:has(.auth-register) main,
    body:has(.auth-confirm-email) main,
    body:has(.auth-legal) main {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }

    .auth-container.auth-register,
    .auth-container.auth-confirm-email,
    .auth-container.auth-legal,
    .auth-split-container.auth-register {
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow: visible;
    }
}

/* PC: white / glass pill panel for readability */
.auth-card .auth-panel,
.auth-card .card {
    border: none !important;
    border-radius: 2rem !important;
    box-shadow: 0 0.5rem 1.75rem rgba(0, 0, 0, 0.18) !important;
    background: var(--auth-panel-bg) !important;
    overflow: hidden;
}

.auth-card .auth-panel--glass {
    background: var(--auth-glass-bg) !important;
    border: 1px solid var(--auth-glass-border) !important;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.65) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
    backdrop-filter: blur(20px) saturate(1.15);
}

.auth-card .auth-panel-body,
.auth-card .card-body {
    padding: 2rem 1.75rem !important;
    background: transparent !important;
}

.auth-code-input {
    letter-spacing: 0.45em;
    font-size: 1.35rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
    padding-left: 1.25rem !important;
    padding-right: 0.85rem !important;
}

.auth-code-input::placeholder {
    letter-spacing: 0.35em;
    font-weight: 500;
    opacity: 0.45;
}

/* Soft inline hints (pill) — replaces heavy portal-msg cards inside auth panels */
.auth-card .auth-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--auth-radius-pill);
    border: 1px solid color-mix(in srgb, var(--auth-hint-accent, var(--accent-color, var(--bs-primary))) 22%, transparent);
    background: color-mix(in srgb, var(--auth-hint-accent, var(--accent-color, var(--bs-primary))) 8%, var(--auth-field-bg));
    color: var(--auth-text);
}

.auth-card .auth-hint > .bi {
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 1.05rem;
    color: var(--auth-hint-accent, var(--accent-color, var(--bs-primary)));
}

.auth-card .auth-hint__text {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--auth-muted);
}

.auth-card .auth-hint--info {
    --auth-hint-accent: var(--accent-color, var(--bs-primary));
}

.auth-card .auth-hint--warning {
    --auth-hint-accent: #e6a800;
}

/* Brand / titles */
.auth-card h1 {
    color: var(--auth-text);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.75rem !important;
}

.auth-card h1 img {
    height: 48px;
    margin-bottom: 0.5rem !important;
}

.auth-card h1 i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.35rem;
    color: var(--accent-color, var(--bs-primary));
}

.auth-card h5 {
    color: var(--auth-text);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 0.25rem !important;
}

.auth-card .auth-subtitle,
.auth-card p.text-center.text-muted {
    color: var(--auth-muted) !important;
    font-size: 0.9rem;
    line-height: 1.45;
    margin-bottom: 1.35rem !important;
}

.auth-form-header + * {
    margin-top: 0;
}

.auth-card .form-label {
    color: var(--auth-text);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.auth-card .form-text {
    color: var(--auth-muted);
    font-size: 0.78rem;
    margin-top: 0.35rem;
}

/* Pill inputs */
.auth-card .form-control,
.auth-card .form-select {
    border-radius: var(--auth-radius-pill) !important;
    background: var(--auth-field-bg) !important;
    border: 1px solid var(--auth-field-border) !important;
    padding: 0.7rem 1.15rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--auth-text);
    box-shadow: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.auth-card .form-control:focus,
.auth-card .form-select:focus {
    border-color: color-mix(in srgb, var(--accent-color, var(--bs-primary)) 55%, white) !important;
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent-color, var(--bs-primary)) 22%, transparent);
    background: var(--auth-field-bg) !important;
}

.auth-card .form-control::placeholder {
    color: color-mix(in srgb, var(--auth-text) 40%, transparent);
}

/* Password toggle — integrated pill */
.auth-card .input-group {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    border-radius: var(--auth-radius-pill);
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-field-border);
    overflow: hidden;
}

.auth-card .input-group:focus-within {
    border-color: color-mix(in srgb, var(--accent-color, var(--bs-primary)) 55%, white);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent-color, var(--bs-primary)) 22%, transparent);
    background: var(--auth-field-bg);
}

.auth-card .input-group .form-control {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.5rem;
}

.auth-card .input-group .form-control:focus {
    box-shadow: none !important;
    background: transparent !important;
}

.auth-card .input-group .password-toggle,
.auth-card .input-group .btn.password-toggle {
    border: none !important;
    background: transparent !important;
    color: var(--auth-muted) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0.55rem 1rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-card .input-group .password-toggle:hover,
.auth-card .input-group .password-toggle:focus {
    color: var(--accent-color, var(--bs-primary)) !important;
    background: transparent !important;
    opacity: 1;
}

/* Live password requirements (register) */
.auth-card .password-req-wrap {
    position: relative;
}

.auth-card .password-req-wrap .password-req-input {
    padding-right: 2.75rem;
}

.auth-card .password-req-icon {
    position: absolute;
    top: 50%;
    right: 0.95rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 1.15rem;
    line-height: 1;
    z-index: 2;
}

.auth-card .password-req-icon.is-invalid {
    color: #dc3545;
}

.auth-card .password-req-help.is-idle {
    color: var(--auth-muted) !important;
}

.auth-card .password-req-help.is-invalid {
    color: #dc3545 !important;
}

.auth-card .password-req-help.is-valid {
    color: #198754 !important;
}

/* Checkbox */
.auth-card .form-check-label {
    color: var(--auth-text);
    font-size: 0.875rem;
    line-height: 1.4;
}

.auth-card .form-check-input {
    border-radius: 0.35rem;
    border-color: color-mix(in srgb, var(--auth-text) 35%, transparent);
    background-color: var(--auth-field-bg);
}

.auth-card .form-check-input:checked {
    background-color: var(--accent-color, var(--bs-primary));
    border-color: var(--accent-color, var(--bs-primary));
}

/* Pill primary button */
.auth-card .btn-accent,
.auth-card .btn.btn-accent {
    border-radius: var(--auth-radius-pill) !important;
    font-weight: 650;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem !important;
    border: none !important;
    box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.18);
    letter-spacing: -0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.auth-card .btn-accent:hover,
.auth-card .btn-accent:focus {
    filter: brightness(1.08);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
}

/* Pill outline / secondary actions (resend etc.) */
.auth-card .btn-outline-secondary,
.auth-card .btn-outline-primary,
.auth-card .btn.btn-outline-secondary,
.auth-card .btn.btn-outline-primary {
    border-radius: var(--auth-radius-pill) !important;
    font-weight: 650;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem !important;
    letter-spacing: -0.01em;
    box-shadow: none;
}

.auth-login-actions {
    display: flex;
    align-items: stretch;
    gap: 0.65rem;
}

.auth-login-actions > .btn {
    width: auto;
    margin-bottom: 0 !important;
}

.auth-login-actions:not(.auth-login-actions--with-google) > .auth-login-submit-btn,
.auth-login-actions:not(.auth-login-actions--with-google) > .btn-accent {
    flex: 1 1 auto;
    width: 100%;
    font-size: 1rem;
    padding: 0.82rem 1.35rem !important;
}

.auth-login-actions--with-google > .auth-google-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.7rem 1rem !important;
}

.auth-login-actions--with-google > .auth-login-submit-btn,
.auth-login-actions--with-google > .btn-accent {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    padding: 0.82rem 1.35rem !important;
}

.auth-google-divider-inline {
    align-self: center;
    white-space: nowrap;
}

.auth-google-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--auth-muted);
    font-size: 0.85rem;
}

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

.auth-google-prefill {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--auth-field-border);
    border-radius: 0.85rem;
    background: var(--auth-field-bg, #fff);
}

.auth-google-prefill-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.auth-google-prefill-meta {
    min-width: 0;
}

.auth-register-avatar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.auth-register-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--auth-link, var(--accent-color, var(--bs-primary))) 12%, var(--auth-field-bg, #fff));
    color: var(--auth-link, var(--accent-color, var(--bs-primary)));
    border: 1px solid var(--auth-field-border);
    font-size: 1.85rem;
}

.auth-register-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-register-avatar-fields {
    min-width: 0;
    flex: 1;
}

.auth-register-avatar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.auth-register-avatar-actions .btn {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.85rem !important;
}

.auth-google-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.auth-google-logo {
    display: inline-flex;
    line-height: 0;
}

/* Links */
.auth-card a {
    color: var(--auth-link);
    font-weight: 600;
    text-decoration: none;
}

.auth-card a:hover,
.auth-card a:focus {
    text-decoration: underline;
    filter: brightness(0.9);
}

.auth-card a.text-muted {
    color: var(--auth-muted) !important;
    font-weight: 500;
}

.auth-card hr {
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--auth-text) 12%, transparent);
    margin: 1.25rem 0 !important;
    opacity: 1;
}

.auth-card p.text-center {
    color: var(--auth-text);
    font-size: 0.875rem;
    line-height: 1.45;
}

/* Auth alerts use shared portal-msg look from portal-msg.css */
.auth-card .alert:not(.portal-msg) {
    margin-bottom: 1rem;
}

.auth-card .mb-3 {
    margin-bottom: 1rem !important;
}

.auth-card .mb-4 {
    margin-bottom: 1.25rem !important;
}

.auth-card .row {
    margin-left: -0.4rem;
    margin-right: -0.4rem;
}

.auth-card .row > [class*="col-"] {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

/* ——— Mobile: form-first, compact logo header ——— */
@media (max-width: 767.98px) {
    html:has(.auth-split-container),
    body:has(.auth-split-container),
    body:has(.auth-split-container) main {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background-color: #667eea !important;
        background-image: var(--auth-page-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
        background-attachment: fixed !important;
        background-size: cover !important;
        background-position: center !important;
        overflow: auto !important;
        height: auto !important;
        max-height: none !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }

    body:has(.auth-split-container) main {
        height: auto !important;
        overflow: visible !important;
    }

    body:has(.auth-split-container) main > .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
        height: auto !important;
        background: transparent !important;
    }

    .auth-split-container {
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        padding: 0 !important;
        background: transparent !important;
        display: flex;
        flex-direction: column;
    }

    .auth-mobile-brand {
        flex: 0 0 auto;
        padding: max(0.85rem, env(safe-area-inset-top)) 1.25rem 0.35rem;
    }

    .auth-mobile-brand-logo {
        display: block;
        max-height: 40px;
        max-width: min(160px, 52vw);
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .auth-split {
        flex: 1 1 auto;
        display: block;
        grid-template-columns: 1fr;
        grid-template-rows: none;
        min-height: 0;
        height: auto;
        width: 100%;
    }

    .auth-split--flipped .auth-split-brand,
    .auth-split--flipped .auth-split-form {
        grid-column: auto;
        grid-row: auto;
    }

    .auth-split-form {
        padding: 0.5rem 1rem max(3.5rem, calc(0.85rem + env(safe-area-inset-bottom)));
        background: transparent !important;
        overflow: visible;
        height: auto;
        min-height: 0;
    }

    .auth-split-form-center {
        min-height: auto;
        place-items: center;
        padding-top: 0.25rem;
        padding-bottom: 0.5rem;
    }

    .auth-split-form-stack {
        max-width: 100%;
        width: 100%;
    }

    .auth-split-form .auth-card {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }

    .auth-legal-links--corner {
        position: fixed;
        right: 1rem;
        bottom: max(0.85rem, env(safe-area-inset-bottom));
        left: 1rem;
        text-align: center;
        white-space: normal;
        max-width: none;
    }

    .auth-legal-links--corner a {
        color: rgba(255, 255, 255, 0.88) !important;
    }

    .auth-legal-links--corner .auth-legal-sep {
        color: rgba(255, 255, 255, 0.55);
    }

    .auth-card .auth-panel--glass,
    .auth-card .auth-panel,
    .auth-card .card {
        border-radius: 1.35rem !important;
        box-shadow:
            0 10px 40px rgba(15, 23, 42, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
        background: rgba(255, 255, 255, 0.94) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.05);
        backdrop-filter: blur(16px) saturate(1.05);
    }

    .auth-card .auth-panel-body,
    .auth-card .card-body {
        padding: 1.25rem 1.1rem !important;
    }

    .auth-form-title {
        font-size: 1.35rem;
    }

    .auth-form-header {
        margin-bottom: 1.1rem;
    }

    .auth-form-header .auth-subtitle {
        font-size: 0.875rem;
        line-height: 1.45;
    }

    .auth-login-actions--with-google {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .auth-login-actions--with-google > .auth-google-btn,
    .auth-login-actions--with-google > .auth-login-submit-btn,
    .auth-login-actions--with-google > .btn-accent {
        width: 100%;
        flex: none;
        justify-content: center;
    }

    .auth-login-actions--with-google > .auth-google-btn {
        font-size: 0.9375rem;
        padding: 0.75rem 1.1rem !important;
    }

    .auth-login-actions--with-google > .auth-login-submit-btn,
    .auth-login-actions--with-google > .btn-accent {
        font-size: 1.02rem;
        padding: 0.85rem 1.15rem !important;
    }

    /* Legacy centered auth on mobile */
    html:has(.auth-container:not(.auth-split-container)),
    body:has(.auth-container:not(.auth-split-container)),
    body:has(.auth-container:not(.auth-split-container)) main {
        background: var(--auth-page-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
        background-attachment: fixed !important;
        background-size: cover !important;
    }

    .auth-container:not(.auth-split-container) {
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 1.25rem 1rem !important;
        background: transparent !important;
        overflow: visible;
    }

    .auth-container:not(.auth-split-container) .auth-card {
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    .auth-container:not(.auth-split-container) .auth-card .auth-panel,
    .auth-container:not(.auth-split-container) .auth-card .card {
        border-radius: var(--mod-radius-pill) !important;
        box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14) !important;
        background: var(--auth-glass-bg) !important;
        -webkit-backdrop-filter: blur(18px);
        backdrop-filter: blur(18px);
    }

    .auth-card .form-control,
    .auth-card .form-select {
        font-size: 0.9375rem;
        padding: 0.65rem 1.05rem;
        border-color: var(--auth-field-border) !important;
        background: var(--auth-field-bg) !important;
    }

    .auth-card .input-group {
        border-color: var(--auth-field-border);
        background: var(--auth-field-bg);
    }

    .auth-card .btn-accent,
    .auth-card .btn.btn-accent,
    .auth-card .btn-outline-secondary,
    .auth-card .btn-outline-primary,
    .auth-card .btn.btn-outline-secondary,
    .auth-card .btn.btn-outline-primary {
        padding: 0.7rem 1.1rem !important;
        font-size: 0.9375rem;
    }

    .auth-card .row {
        margin-left: 0;
        margin-right: 0;
    }

    .auth-card .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 0;
    }

    .auth-card .mb-3 {
        margin-bottom: 0.875rem !important;
    }

    .auth-card hr {
        margin: 1rem 0 !important;
    }
}

@media (max-width: 480px) {
    .auth-split-form {
        padding: 0 0.85rem 1rem;
    }

    .auth-split-brand {
        min-height: 24vh;
        padding: 1.15rem 1rem 1rem;
    }

    .auth-container:not(.auth-split-container) {
        padding: 1rem 0.85rem !important;
    }

    .auth-form-title {
        font-size: 1.15rem;
    }

    .auth-card .form-control,
    .auth-card .form-select {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .auth-card .btn-accent,
    .auth-card .btn.btn-accent,
    .auth-card .btn-outline-secondary,
    .auth-card .btn-outline-primary,
    .auth-card .btn.btn-outline-secondary,
    .auth-card .btn.btn-outline-primary {
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) and (orientation: landscape) {
    .auth-split-brand {
        min-height: auto;
    }

    .auth-split-brand-logo-img {
        max-height: 40px;
    }

    .auth-split-form {
        padding-top: 0.5rem;
    }

    .auth-card .mb-3 {
        margin-bottom: 0.65rem !important;
    }
}
