html.login-modern {
    color-scheme: light dark;
    --bg: #f3f0e8;
    --bg-strong: #e8e2d6;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-border: rgba(15, 17, 16, 0.08);
    --surface-muted: rgba(15, 17, 16, 0.04);
    --text: #101311;
    --muted: #66706a;
    --accent: #1b1f1c;
    --accent-strong: #131614;
    --success-bg: #edf8f1;
    --success-text: #0c6a43;
    --danger-bg: #fff0ec;
    --danger-text: #a33920;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.login-modern *,
html.login-modern *::before,
html.login-modern *::after {
    box-sizing: border-box;
}

html.login-modern body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.92), transparent 38%),
        linear-gradient(180deg, #faf8f3 0%, var(--bg) 50%, var(--bg-strong) 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

html.login-modern .login-layout {
    flex: 0 0 auto;
    display: grid;
    place-items: start center;
    padding: clamp(4.5rem, 14vw, 8.5rem) 1.5rem clamp(2.6rem, 8vw, 5.2rem);
}

html.login-modern .login-card {
    width: min(100%, 28rem);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 2rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    display: grid;
    gap: 1.5rem;
    box-shadow: 0 24px 60px rgba(17, 17, 17, 0.08);
    backdrop-filter: blur(14px);
}

html.login-modern .welcome-portal {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    gap: 0.55rem;
    padding: 1rem 1.05rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.16)),
        rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(18px) saturate(140%);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

html.login-modern .welcome-portal::before,
html.login-modern .welcome-portal::after {
    content: "";
    position: absolute;
    inset: -35%;
    z-index: -2;
    opacity: 0.95;
    filter: blur(34px);
    transform-origin: center;
    will-change: transform, opacity;
}

html.login-modern .welcome-portal::before {
    background:
        radial-gradient(circle at 18% 28%, rgba(255, 88, 88, 0.62), transparent 24%),
        radial-gradient(circle at 74% 20%, rgba(255, 186, 73, 0.52), transparent 26%),
        radial-gradient(circle at 82% 76%, rgba(81, 214, 255, 0.56), transparent 24%),
        radial-gradient(circle at 24% 80%, rgba(132, 92, 255, 0.52), transparent 28%);
    animation: migration-aurora-drift 16s ease-in-out infinite alternate;
}

html.login-modern .welcome-portal::after {
    inset: -28%;
    z-index: -1;
    opacity: 0.7;
    filter: blur(22px);
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.52), transparent 28%),
        radial-gradient(circle at 30% 56%, rgba(255, 105, 180, 0.2), transparent 30%),
        radial-gradient(circle at 72% 54%, rgba(71, 255, 209, 0.22), transparent 30%);
    animation: migration-aurora-pulse 9s ease-in-out infinite;
}

html.login-modern .welcome-portal > * {
    position: relative;
    z-index: 1;
}

html.login-modern .welcome-portal p {
    margin: 0;
    color: rgba(16, 19, 17, 0.8);
    line-height: 1.5;
    font-size: 1rem;
}

html.login-modern .welcome-portal .portal-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(16, 19, 17, 0.62);
}

html.login-modern .welcome-portal .portal-cta {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

html.login-modern .welcome-portal:hover,
html.login-modern .welcome-portal:focus-visible {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        0 12px 26px rgba(17, 19, 17, 0.08);
}

html.login-modern .welcome-portal a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

html.login-modern .welcome-portal a:hover {
    text-decoration: underline;
}

html.login-modern .login-form {
    display: grid;
    gap: 1rem;
}

html.login-modern .field {
    display: grid;
    gap: 0.55rem;
    position: relative;
}

html.login-modern .field-password {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

html.login-modern .field-password input {
    padding-right: 2.35rem;
}

html.login-modern .field-dot {
    position: absolute;
    right: 0.8rem;
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: rgba(16, 19, 17, 0.82);
    opacity: 0.72;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
    transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

html.login-modern .field-dot:hover,
html.login-modern .field-dot:focus-visible {
    opacity: 1;
    transform: scale(1.15);
}

html.login-modern .field-dot-top {
    top: 0.95rem;
}

html.login-modern .field-dot-bottom {
    bottom: 0.95rem;
}

html.login-modern input {
    width: 100%;
    border: 1px solid var(--surface-border);
    border-radius: 1rem;
    padding: 0.95rem 1rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font: inherit;
    min-height: 3.25rem;
}

html.login-modern input::placeholder {
    color: #8d9690;
}

html.login-modern input:focus {
    outline: none;
    border-color: rgba(17, 17, 17, 0.28);
    box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.06);
}

html.login-modern .alert {
    border-radius: 1rem;
    padding: 0.95rem 1rem;
    font-size: 0.94rem;
    line-height: 1.5;
}

html.login-modern .alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

html.login-modern .alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

html.login-modern .cta {
    width: 100%;
    min-height: 3.4rem;
    border: 1px solid rgba(17, 19, 17, 0.08);
    border-radius: 1.1rem;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.95rem 1.2rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

html.login-modern .cta:hover:not(:disabled) {
    background: var(--accent-strong);
    transform: translateY(-1px);
}

html.login-modern .cta:disabled {
    opacity: 0.72;
    cursor: wait;
}

html.login-modern .spinner {
    width: 1rem;
    height: 1rem;
    display: none;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: #ffffff;
}

html.login-modern .cta.is-loading .spinner {
    display: inline-block;
    animation: login-spin 0.8s linear infinite;
}

html.login-modern .brand-signature {
    --brand-signature-size: clamp(4rem, 18vw, 16rem);
    width: 100%;
    font-size: var(--brand-signature-size);
    padding: clamp(1.5rem, 4.2vw, 3.8rem) 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.1rem;
}

html.login-modern .brand-signature .brand-mark,
html.login-modern .brand-signature > a:first-child {
    font-size: 100%;
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1;
    color: inherit;
    opacity: 0.08;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

html.login-modern .brand-signature .brand-mark:hover,
html.login-modern .brand-signature .brand-mark:focus-visible,
html.login-modern .brand-signature > a:first-child:hover,
html.login-modern .brand-signature > a:first-child:focus-visible {
    opacity: 0.18;
    transform: translateY(-2px);
}

html.login-modern .brand-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 99%;
    max-width: calc(100vw - 3rem);
    font-size: clamp(2.15rem, 10vw, 5.4rem);
}

html.login-modern .brand-secondary-link {
    font-size: 100%;
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 0.98;
    color: inherit;
    opacity: 0.12;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

html.login-modern .brand-secondary-link:hover,
html.login-modern .brand-secondary-link:focus-visible {
    opacity: 0.22;
    transform: translateY(-1px);
}

html.login-modern .brand-secondary-copy {
    position: relative;
    flex: 0 0 auto;
    width: 3.12em;
    height: 3.12em;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.2;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

html.login-modern .brand-secondary-copy::before,
html.login-modern .brand-secondary-copy::after {
    content: "";
    position: absolute;
    width: 1.84em;
    height: 1.84em;
    border: 4px solid currentColor;
    border-radius: 0.96rem;
}

html.login-modern .brand-secondary-copy::before {
    top: 0.68em;
    left: 0.96em;
    background: transparent;
}

html.login-modern .brand-secondary-copy::after {
    top: 0;
    left: 0.32em;
    background: transparent;
}

html.login-modern .brand-secondary-copy:hover,
html.login-modern .brand-secondary-copy:focus-visible {
    opacity: 0.42;
    transform: translateY(-1px);
}

html.login-modern .brand-secondary-copy.is-copied {
    opacity: 0.58;
}

@media (max-width: 640px) {
    html.login-modern .login-layout {
        padding-top: 3.4rem;
        padding-bottom: 2.2rem;
    }

    html.login-modern .login-card {
        border-radius: 1.5rem;
        padding: 1.35rem;
    }

    html.login-modern .field-dot-top {
        top: 0.9rem;
    }

    html.login-modern .field-dot-bottom {
        bottom: 0.9rem;
    }

    html.login-modern .brand-signature {
        gap: 0.85rem;
    }

    html.login-modern .brand-secondary {
        gap: 0.35rem;
        width: 99%;
        max-width: calc(100vw - 2rem);
        font-size: clamp(1.85rem, 11.5vw, 3.5rem);
    }
}

@media (prefers-color-scheme: dark) {
    html.login-modern {
        --bg: #0f1110;
        --bg-strong: #080908;
        --surface: rgba(18, 20, 19, 0.88);
        --surface-border: rgba(255, 255, 255, 0.08);
        --surface-muted: rgba(255, 255, 255, 0.04);
        --text: #f2f3ef;
        --muted: #a1a8a2;
        --accent: #232825;
        --accent-strong: #2d342f;
        --success-bg: rgba(18, 69, 48, 0.34);
        --success-text: #91e4bb;
        --danger-bg: rgba(104, 40, 24, 0.36);
        --danger-text: #ffc3b3;
    }

    html.login-modern body {
        background:
            radial-gradient(circle at top, rgba(47, 52, 48, 0.4), transparent 34%),
            linear-gradient(180deg, #101211 0%, #0c0d0d 48%, #080908 100%);
    }

    html.login-modern input {
        background: rgba(11, 12, 12, 0.72);
    }

    html.login-modern .welcome-portal {
        border-color: rgba(255, 255, 255, 0.1);
        background:
            linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
            rgba(255, 255, 255, 0.04);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }

    html.login-modern .welcome-portal p {
        color: rgba(242, 243, 239, 0.78);
    }

    html.login-modern .welcome-portal .portal-title {
        color: rgba(242, 243, 239, 0.6);
    }

    html.login-modern .field-dot {
        background: rgba(242, 243, 239, 0.82);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
    }

    html.login-modern .welcome-portal:hover,
    html.login-modern .welcome-portal:focus-visible {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 16px 34px rgba(0, 0, 0, 0.22);
    }

    html.login-modern .cta {
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    html.login-modern input::placeholder {
        color: #6f7772;
    }

    html.login-modern input:focus {
        border-color: rgba(255, 255, 255, 0.18);
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
    }

    html.login-modern .brand-signature .brand-mark,
    html.login-modern .brand-signature > a:first-child {
        opacity: 0.12;
    }

    html.login-modern .brand-secondary-link {
        opacity: 0.16;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.login-modern .welcome-portal::before,
    html.login-modern .welcome-portal::after {
        animation: none;
    }
}

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

@keyframes migration-aurora-drift {
    0% {
        transform: translate3d(-2%, -3%, 0) scale(1) rotate(0deg);
    }

    50% {
        transform: translate3d(4%, 2%, 0) scale(1.08) rotate(8deg);
    }

    100% {
        transform: translate3d(-1%, 4%, 0) scale(0.98) rotate(-6deg);
    }
}

@keyframes migration-aurora-pulse {
    0%,
    100% {
        opacity: 0.58;
        transform: scale(0.98);
    }

    50% {
        opacity: 0.84;
        transform: scale(1.06);
    }
}
