:root {
    --login-navy: #0f172a;
    --login-blue: #3b82f6;
    --login-blue-dark: #2563eb;
    --login-green: #34d399;
    --login-text: #1e293b;
    --login-muted: #64748b;
    --login-border: #dce5f0;
    --login-canvas: #f3f6fb;
}

* { box-sizing: border-box; }

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

html { min-width: 320px; }

body {
    color: var(--login-text);
    background: var(--login-canvas);
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button,
a,
input,
label { -webkit-tap-highlight-color: transparent; }

.login-page {
    position: relative;
    display: grid;
    width: 100%;
    height: 100vh;
    min-height: 0;
    padding: 12px 20px;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 15%, rgba(59, 130, 246, .08), transparent 35%),
        radial-gradient(circle at 92% 85%, rgba(124, 58, 237, .07), transparent 36%),
        var(--login-canvas);
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(70px);
}

.login-orb-one {
    top: -150px;
    left: -120px;
    width: 390px;
    height: 390px;
    background: rgba(59, 130, 246, .1);
}

.login-orb-two {
    right: -130px;
    bottom: -170px;
    width: 420px;
    height: 420px;
    background: rgba(99, 102, 241, .08);
}

.login-shell {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(1080px, 100%);
    height: min(680px, calc(100vh - 24px));
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #ffffff;
    box-shadow: 0 24px 55px rgba(15, 23, 42, .1), 0 0 0 1px rgba(255, 255, 255, .65);
}

/* Left portal identity */
.login-intro {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    padding: 28px 38px 24px;
    flex-direction: column;
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(circle at 50% 34%, rgba(59, 108, 255, .25), transparent 34%),
        linear-gradient(145deg, #07152f 0%, #111d46 54%, #20184b 100%);
}

.login-intro::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 38%;
    background: linear-gradient(to top, rgba(3, 9, 24, .5), transparent);
    content: '';
    pointer-events: none;
}

.intro-pattern {
    position: absolute;
    z-index: 0;
    inset: 0;
    opacity: .045;
    background-image:
        linear-gradient(rgba(255, 255, 255, .9) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .9) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

.intro-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(75px);
    pointer-events: none;
}

.intro-glow-top {
    top: -120px;
    right: -90px;
    width: 280px;
    height: 280px;
    background: rgba(79, 70, 229, .28);
}

.intro-glow-bottom {
    bottom: -140px;
    left: -100px;
    width: 280px;
    height: 280px;
    background: rgba(16, 185, 129, .13);
}

.portal-badge {
    position: relative;
    z-index: 5;
    display: inline-flex;
    align-self: flex-start;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, .92);
    background: rgba(255, 255, 255, .08);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--login-green);
    animation: portal-pulse 2s infinite;
}

.portal-visual {
    position: relative;
    z-index: 3;
    display: grid;
    width: min(390px, 100%);
    min-height: 0;
    margin: auto;
    flex: 1;
    place-items: center;
}

.portal-visual::before {
    position: absolute;
    width: 245px;
    height: 245px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(75, 121, 255, .2), rgba(75, 121, 255, .04) 60%, transparent 72%);
    content: '';
}

.portal-orbit {
    position: absolute;
    border: 1px solid rgba(147, 197, 253, .17);
    border-radius: 50%;
}

.portal-orbit-one {
    width: 255px;
    height: 255px;
    animation: portal-orbit 20s linear infinite;
}

.portal-orbit-two {
    width: 315px;
    height: 315px;
    border-color: rgba(167, 139, 250, .15);
    border-style: dashed;
    animation: portal-orbit-reverse 28s linear infinite;
}

.portal-emblem {
    position: relative;
    z-index: 6;
    display: flex;
    width: 220px;
    height: 235px;
    padding: 27px 20px 23px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 38px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05));
    box-shadow: 0 26px 50px rgba(2, 6, 23, .34), 0 0 42px rgba(59, 130, 246, .13), inset 0 1px 0 rgba(255, 255, 255, .15);
    backdrop-filter: blur(12px);
}

.portal-emblem-icon {
    display: grid;
    width: 90px;
    height: 90px;
    margin-bottom: 17px;
    border-radius: 28px;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(145deg, #2563eb, #4f46e5);
    box-shadow: 0 17px 32px rgba(37, 99, 235, .34), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.portal-emblem-icon i { font-size: 43px; }

.portal-emblem strong {
    color: #ffffff;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
}

.portal-emblem > span {
    margin-top: 7px;
    color: rgba(255, 255, 255, .58);
    max-width: 160px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    line-height: 1.4;
    text-align: center;
    text-transform: uppercase;
}

.portal-bubble {
    position: absolute;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .28), rgba(255, 255, 255, .08) 38%, rgba(255, 255, 255, .02) 70%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .12), 0 16px 36px rgba(2, 6, 23, .2);
    backdrop-filter: blur(8px);
}

.portal-bubble::after {
    position: absolute;
    top: 18%;
    left: 22%;
    width: 28%;
    height: 28%;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    content: '';
    filter: blur(3px);
}

.portal-bubble-one {
    top: 15%;
    left: 3%;
    width: 78px;
    height: 78px;
    animation: portal-float-one 7s ease-in-out infinite;
}

.portal-bubble-two {
    top: 27%;
    right: 5%;
    width: 58px;
    height: 58px;
    animation: portal-float-two 6.5s ease-in-out infinite;
}

.portal-bubble-three {
    right: 0;
    bottom: 8%;
    width: 98px;
    height: 98px;
    opacity: .85;
    animation: portal-float-three 8s ease-in-out infinite;
}

.portal-bubble-four {
    bottom: 12%;
    left: 10%;
    width: 43px;
    height: 43px;
    animation: portal-float-two 5.8s ease-in-out infinite;
}

.portal-particle {
    position: absolute;
    z-index: 4;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
    box-shadow: 0 0 11px rgba(96, 165, 250, .24);
    animation: portal-twinkle 4.5s ease-in-out infinite;
}

.portal-particle-one { top: 24%; left: 27%; width: 6px; height: 6px; }
.portal-particle-two { top: 41%; right: 2%; width: 7px; height: 7px; }
.portal-particle-three { bottom: 23%; left: 2%; width: 5px; height: 5px; }

.portal-quote {
    position: relative;
    z-index: 5;
    width: min(100%, 420px);
    margin: 0 auto;
    padding: 17px 27px 0;
    border-top: 1px solid rgba(255, 255, 255, .12);
    text-align: center;
}

.portal-quote::before {
    position: absolute;
    top: -1px;
    left: 50%;
    width: 66px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--login-green), transparent);
    content: '';
    transform: translateX(-50%);
}

.portal-quote p {
    margin: 0;
    color: rgba(255, 255, 255, .94);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
    letter-spacing: -.02em;
    text-wrap: balance;
}

.quote-mark {
    position: absolute;
    top: 8px;
    left: 4px;
    color: rgba(96, 165, 250, .7);
    font-family: Georgia, serif;
    font-size: 34px;
    line-height: 1;
}

.quote-mark-end {
    top: auto;
    right: 4px;
    bottom: -10px;
    left: auto;
    color: rgba(52, 211, 153, .65);
}

/* Right login form */
.login-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    padding: 42px 52px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #ffffff;
}

.login-panel > * {
    width: min(100%, 420px);
    min-width: 0;
}
.mobile-brand { display: none; }

.login-header > span {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--login-blue-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.login-header h2 {
    margin: 0;
    color: var(--login-navy);
    font-size: clamp(25px, 2.3vw, 31px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.035em;
}

.login-header p {
    margin: 8px 0 0;
    color: var(--login-muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.login-alert {
    display: flex;
    margin-top: 18px;
    padding: 11px 12px;
    border: 1px solid #fecaca;
    border-radius: 11px;
    align-items: flex-start;
    gap: 8px;
    color: #991b1b;
    background: #fff7f7;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
}

.login-alert i { margin-top: 1px; font-size: 16px; }

.login-form {
    display: grid;
    margin-top: 26px;
    gap: 16px;
}

.field-group label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.input-shell {
    position: relative;
    display: flex;
    align-items: center;
}

.input-shell > i {
    position: absolute;
    left: 15px;
    z-index: 2;
    color: #94a3b8;
    font-size: 17px;
    pointer-events: none;
    transition: color .2s ease;
}

.input-shell input {
    width: 100%;
    height: 50px;
    padding: 0 46px 0 43px;
    border: 1.5px solid var(--login-border);
    border-radius: 12px;
    outline: none;
    color: var(--login-navy);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input-shell input::placeholder { color: #b7c2d2; font-weight: 400; }
.input-shell input:hover { border-color: #c3cfdf; }

.input-shell input:focus {
    border-color: var(--login-blue);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .12);
}

.input-shell:focus-within > i { color: var(--login-blue); }

.password-toggle {
    position: absolute;
    right: 9px;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    place-items: center;
    color: #8190a7;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--login-blue-dark);
    background: #eff6ff;
    outline: none;
}

.password-toggle i { font-size: 17px; }

.form-options {
    display: flex;
    margin-top: 1px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.remember-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 500;
    cursor: pointer;
}

.remember-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--login-blue);
}

.form-options a {
    color: var(--login-blue-dark);
    font-size: 10.5px;
    font-weight: 700;
    text-decoration: none;
}

.form-options a:hover,
.form-options a:focus-visible { text-decoration: underline; }

.login-button {
    display: flex;
    min-height: 50px;
    margin-top: 2px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #ffffff;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.login-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    box-shadow: 0 11px 24px rgba(15, 23, 42, .24);
    transform: translateY(-1px);
}

.login-button:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .2);
    outline-offset: 3px;
}

.login-button:disabled { cursor: wait; opacity: .82; }
.login-button.is-loading i { animation: login-spin .8s linear infinite; }

.login-help {
    margin: 20px 0 0;
    color: #94a3b8;
    font-size: 9.5px;
    line-height: 1.55;
    text-align: center;
}

/* Compact SweetAlert2 feedback for login success and errors. */
.swal2-popup.login-swal-popup {
    width: min(360px, calc(100vw - 28px)) !important;
    padding: 21px !important;
    border-radius: 20px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22) !important;
}

.login-swal-popup .swal2-icon {
    width: 62px !important;
    height: 62px !important;
    margin: 0 auto 13px !important;
    font-size: 12px !important;
}

.login-swal-popup .swal2-title,
.login-swal-title {
    padding: 0 !important;
    color: var(--login-navy) !important;
    font-size: 19px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}

.login-swal-popup .swal2-html-container,
.login-swal-message {
    margin: 8px 0 0 !important;
    color: var(--login-muted) !important;
    font-size: 11.5px !important;
    line-height: 1.55 !important;
}

.login-swal-popup .swal2-actions {
    margin: 16px 0 0 !important;
}

.login-swal-popup .swal2-styled,
.login-swal-confirm {
    min-height: 39px !important;
    min-width: 100px !important;
    margin: 0 !important;
    padding: 8px 15px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    font-family: inherit !important;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .2) !important;
}

.login-swal-popup .swal2-timer-progress-bar {
    background: linear-gradient(90deg, var(--login-blue), var(--login-green)) !important;
}

@keyframes portal-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
    70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes portal-orbit { to { transform: rotate(360deg); } }
@keyframes portal-orbit-reverse { to { transform: rotate(-360deg); } }

@keyframes portal-float-one {
    0%, 100% { transform: translate(0); }
    50% { transform: translate(4px, -9px); }
}

@keyframes portal-float-two {
    0%, 100% { transform: translate(0); }
    50% { transform: translate(-4px, 7px); }
}

@keyframes portal-float-three {
    0%, 100% { transform: translate(0); }
    50% { transform: translate(-5px, -10px); }
}

@keyframes portal-twinkle {
    0%, 100% { opacity: .25; transform: scale(1); }
    50% { opacity: .95; transform: scale(1.35); }
}

@keyframes login-spin { to { transform: rotate(360deg); } }

/* Compact desktop layout for short browser windows. */
@media (min-width: 861px) and (max-height: 620px) {
    .login-intro { padding: 20px 32px 18px; }
    .portal-badge { padding: 6px 11px; font-size: 8.5px; }
    .portal-orbit-one { width: 215px; height: 215px; }
    .portal-orbit-two { width: 265px; height: 265px; }
    .portal-emblem { width: 184px; height: 194px; border-radius: 31px; }
    .portal-emblem-icon { width: 74px; height: 74px; margin-bottom: 12px; border-radius: 22px; }
    .portal-emblem-icon i { font-size: 35px; }
    .portal-emblem strong { font-size: 18px; }
    .portal-bubble-one { width: 60px; height: 60px; }
    .portal-bubble-three { width: 75px; height: 75px; }
    .portal-quote { padding-top: 12px; }
    .portal-emblem > span { max-width: 165px; font-size: 9.5px; }
    .portal-quote p { font-size: 12.5px; line-height: 1.48; }
    .login-panel { padding: 24px 46px; }
    .login-header h2 { font-size: 25px; }
    .login-form { margin-top: 18px; gap: 11px; }
    .input-shell input,
    .login-button { height: 44px; min-height: 44px; }
    .login-help { margin-top: 13px; }
}

/* Tablet and mobile: focus on the form and hide the decorative panel. */
@media (max-width: 860px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .login-page {
        display: block;
        height: auto;
        min-height: 100vh;
        padding: 14px;
    }

    .login-shell {
        display: block;
        width: min(560px, 100%);
        height: auto;
        min-height: calc(100vh - 28px);
        margin: 0 auto;
        border-radius: 22px;
    }

    .login-intro { display: none; }

    .login-panel {
        min-height: calc(100vh - 30px);
        padding: 34px 30px;
    }

    .mobile-brand {
        display: flex;
        margin-bottom: 34px;
        align-items: center;
        gap: 12px;
    }

    .mobile-brand img {
        width: 92px;
        max-height: 49px;
        object-fit: contain;
    }

    .mobile-brand span {
        padding-left: 12px;
        border-left: 1px solid var(--login-border);
        color: #64748b;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: .08em;
        line-height: 1.45;
        text-transform: uppercase;
    }
}

@media (max-width: 430px) {
    .login-page { padding: 0; background: #ffffff; }

    .login-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-panel {
        min-height: 100vh;
        padding: 24px 18px;
        align-items: stretch;
    }

    .mobile-brand {
        margin-bottom: 23px;
        gap: 10px;
    }

    .mobile-brand img {
        width: 82px;
        max-height: 44px;
    }

    .mobile-brand span {
        padding-left: 10px;
        font-size: 8px;
    }

    .login-header h2 { font-size: 24px; }
    .login-header p { font-size: 10.5px; }
    .login-form { margin-top: 20px; gap: 14px; }

    .input-shell input,
    .login-button {
        height: 48px;
        min-height: 48px;
    }

    .remember-option,
    .form-options a {
        font-size: 9.5px;
    }

    .form-options {
        align-items: center;
        gap: 10px;
    }

    .login-help { margin-top: 15px; }

    .swal2-popup.login-swal-popup {
        width: calc(100vw - 24px) !important;
        padding: 18px !important;
    }
}

@media (max-width: 430px) and (max-height: 680px) {
    .login-panel {
        padding-top: 18px;
        padding-bottom: 18px;
        justify-content: flex-start;
    }

    .mobile-brand { margin-bottom: 18px; }
    .login-form { margin-top: 17px; gap: 11px; }
    .login-help { margin-top: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
