:root {
    --bg: #07090d;
    --surface: #12161d;
    --surface-soft: #171c25;
    --line: rgba(255, 255, 255, .1);
    --text: #f7f9fc;
    --muted: #8f99a8;
    --green: #27b566;
    --green-light: #43d681;
    --green-soft: rgba(39, 181, 102, .14);
    --danger: #ff6973;
    --font: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

.login-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 22%, rgba(39, 181, 102, .11), transparent 32%),
        radial-gradient(circle at 89% 82%, rgba(38, 95, 154, .12), transparent 31%),
        linear-gradient(135deg, #05070a 0%, #0a0d12 52%, #080b10 100%);
}

.login-grid {
    position: absolute;
    inset: 0;
    opacity: .32;
    background-image:
        linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.glow {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: .14;
}

.glow-one { top: -210px; left: 38%; background: #3ddb82; }
.glow-two { right: -180px; bottom: -220px; background: #347fbd; }

.login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 58fr) minmax(420px, 42fr);
    grid-template-rows: minmax(0, 1fr) auto;
}

.institutional {
    position: relative;
    grid-row: 1;
    min-width: 0;
    padding: clamp(30px, 4vw, 64px);
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, .055);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: .13em;
}

.brand-symbol {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--green-light);
    font-size: 1.45rem;
}

.institutional-content {
    position: relative;
    z-index: 2;
    width: min(590px, 90%);
    margin-top: clamp(100px, 15vh, 170px);
}

.eyebrow {
    margin: 0 0 20px;
    color: var(--green-light);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .19em;
}

.institutional h1 {
    max-width: 650px;
    margin: 0;
    font-size: clamp(2.35rem, 4.25vw, 4.8rem);
    font-weight: 680;
    line-height: 1.06;
    letter-spacing: -.055em;
}

.institutional-copy {
    max-width: 510px;
    margin: 26px 0 0;
    color: #aab2be;
    font-size: clamp(.92rem, 1.2vw, 1.05rem);
    line-height: 1.75;
}

.platform-features {
    display: grid;
    gap: 14px;
    margin: 38px 0 0;
    padding: 0;
    list-style: none;
}

.platform-features li {
    display: flex;
    align-items: center;
    gap: 13px;
    color: #d8dde5;
    font-size: .88rem;
    font-weight: 600;
}

.platform-features li > span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--green-light);
    border: 1px solid rgba(67, 214, 129, .18);
    border-radius: 9px;
    background: rgba(39, 181, 102, .07);
}

.network-visual {
    position: absolute;
    right: 2.5%;
    bottom: 4%;
    width: min(43%, 390px);
    height: 270px;
    opacity: .42;
}

.network-line {
    position: absolute;
    height: 1px;
    transform-origin: left center;
    background: linear-gradient(90deg, transparent, rgba(67, 214, 129, .9), transparent);
}

.line-a { top: 90px; left: 20px; width: 295px; transform: rotate(16deg); }
.line-b { top: 202px; left: 40px; width: 275px; transform: rotate(-24deg); }

.network-node, .network-hub {
    position: absolute;
    display: grid;
    place-items: center;
    color: #a7b1bf;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(12, 17, 23, .76);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .26);
}

.network-node {
    width: 66px;
    height: 66px;
    border-radius: 15px;
}

.network-node i { color: #59ce89; font-size: 1.15rem; }
.network-node small { font-size: .48rem; letter-spacing: .08em; }
.node-gate { left: 0; top: 54px; }
.node-camera { right: 0; top: 9px; }
.node-terminal { right: 7px; bottom: 0; }

.network-hub {
    left: 42%;
    top: 39%;
    width: 92px;
    height: 92px;
    border-color: rgba(67, 214, 129, .22);
    border-radius: 50%;
    color: #e5eaf0;
    font-size: .62rem;
}

.network-hub i { color: var(--green-light); font-size: 1.5rem; }

.login-area {
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(28px, 4.5vw, 72px);
}

.mobile-brand { display: none; }

.auth-card {
    width: min(430px, 100%);
    padding: clamp(28px, 3vw, 38px);
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(24, 29, 38, .97), rgba(15, 19, 25, .97));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .45), inset 0 1px rgba(255, 255, 255, .025);
    animation: card-in .48s ease-out both;
}

.auth-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.auth-mark {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--green-light);
    border: 1px solid rgba(67, 214, 129, .2);
    border-radius: 12px;
    background: var(--green-soft);
    font-size: 1.15rem;
}

.auth-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.34rem;
    font-weight: 720;
    letter-spacing: -.025em;
}

.auth-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.45;
}

.login-alert {
    display: flex;
    gap: 11px;
    margin: -5px 0 20px;
    padding: 13px 14px;
    color: #ffc4c8;
    border: 1px solid rgba(255, 105, 115, .28);
    border-radius: 11px;
    background: rgba(255, 105, 115, .075);
    font-size: .77rem;
    line-height: 1.45;
}

.login-alert > i { margin-top: 1px; color: var(--danger); font-size: 1rem; }
.login-alert strong, .login-alert span { display: block; }
.login-alert strong { margin-bottom: 2px; color: #fff; font-size: .82rem; }

.field { margin-bottom: 17px; }

.field label {
    display: block;
    margin: 0 0 8px;
    color: #cbd1da;
    font-size: .76rem;
    font-weight: 650;
}

.input-shell { position: relative; }

.input-shell > i {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    transform: translateY(-50%);
    color: #758091;
    font-size: 1rem;
    pointer-events: none;
}

.input-shell input {
    width: 100%;
    height: 49px;
    padding: 0 46px 0 42px;
    color: #fff;
    caret-color: var(--green-light);
    border: 1px solid #2a313d;
    border-radius: 11px;
    outline: none;
    background: #0d1117;
    font-size: .86rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.input-shell input::placeholder { color: #596372; }

.input-shell input:hover { border-color: #3a4452; }

.input-shell input:focus {
    border-color: rgba(67, 214, 129, .72);
    background: #0f141b;
    box-shadow: 0 0 0 3px rgba(39, 181, 102, .12);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    transform: translateY(-50%);
    color: #828c9b;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover, .password-toggle:focus-visible {
    color: #fff;
    outline: none;
    background: rgba(255, 255, 255, .06);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 22px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #aab2bf;
    font-size: .77rem;
    cursor: pointer;
    user-select: none;
}

.remember input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--green);
}

.login-button {
    position: relative;
    width: 100%;
    height: 51px;
    overflow: hidden;
    color: #06130b;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(105deg, var(--green), var(--green-light));
    box-shadow: 0 12px 30px rgba(39, 181, 102, .2);
    font-size: .79rem;
    font-weight: 850;
    letter-spacing: .09em;
    cursor: pointer;
    transition: filter .18s ease, transform .15s ease, box-shadow .18s ease;
}

.login-button::after {
    position: absolute;
    top: -100%;
    left: -45%;
    width: 30%;
    height: 300%;
    content: "";
    transform: rotate(24deg);
    background: rgba(255, 255, 255, .18);
    transition: left .55s ease;
}

.login-button:hover {
    filter: brightness(1.06);
    box-shadow: 0 15px 34px rgba(39, 181, 102, .27);
}

.login-button:hover::after { left: 120%; }
.login-button:active { transform: translateY(1px); }
.login-button:focus-visible { outline: 3px solid rgba(67, 214, 129, .28); outline-offset: 3px; }
.login-button:disabled { cursor: wait; filter: saturate(.75); }

.button-idle, .button-progress, .button-success {
    position: relative;
    z-index: 1;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.button-idle { display: inline-flex; }
.button-progress, .button-success { display: none; }
.login-button.is-loading .button-idle { display: none; }
.login-button.is-loading .button-progress { display: inline-flex; }
.login-button.is-success .button-idle, .login-button.is-success .button-progress { display: none; }
.login-button.is-success .button-success { display: inline-flex; }

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(6, 19, 11, .28);
    border-top-color: #06130b;
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

.forgot-link {
    display: block;
    width: fit-content;
    margin: 18px auto 0;
    color: #8e98a7;
    font-size: .76rem;
    text-decoration: none;
    transition: color .15s ease;
}

.forgot-link:hover, .forgot-link:focus-visible { color: var(--green-light); }

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    padding-top: 21px;
    color: #778292;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.security-note > i { color: var(--green-light); font-size: .9rem; }
.security-note span, .security-note small { display: block; }
.security-note strong { color: #aeb6c1; font-size: .7rem; font-weight: 650; }
.security-note small { margin-top: 2px; font-size: .6rem; }

.login-footer {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(24px, 4vw, 64px) 18px;
    color: #626c7a;
    border-top: 1px solid rgba(255, 255, 255, .045);
    background: rgba(5, 7, 10, .32);
    font-size: .65rem;
}

.login-footer b { margin: 0 4px; color: var(--green); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 4, 7, .78);
    backdrop-filter: blur(8px);
}

.modal-backdrop.is-visible { display: flex; }

.device-modal {
    width: min(410px, 100%);
    padding: 34px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #151a22;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
    animation: card-in .3s ease-out both;
}

.modal-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 18px;
    place-items: center;
    color: #ffc55c;
    border: 1px solid rgba(255, 197, 92, .24);
    border-radius: 15px;
    background: rgba(255, 197, 92, .09);
    font-size: 1.4rem;
}

.device-modal h2 { margin: 0 0 12px; font-size: 1.18rem; }
.device-modal p { margin: 0; color: #c3cad4; font-size: .83rem; line-height: 1.6; }
.device-modal .modal-detail { margin-top: 10px; color: #838e9d; font-size: .74rem; }
.device-modal button {
    width: 100%;
    height: 45px;
    margin-top: 25px;
    color: #07130c;
    border: 0;
    border-radius: 10px;
    background: var(--green-light);
    font-size: .74rem;
    font-weight: 850;
    letter-spacing: .08em;
    cursor: pointer;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
    .login-shell { grid-template-columns: minmax(300px, 38fr) minmax(410px, 62fr); }
    .institutional { padding: 34px; }
    .institutional-content { width: 100%; margin-top: 18vh; }
    .institutional h1 { font-size: clamp(2rem, 4vw, 3rem); }
    .institutional-copy { display: none; }
    .network-visual { right: -65px; bottom: 3%; width: 300px; transform: scale(.82); }
}

@media (max-width: 720px) {
    .login-shell {
        display: flex;
        min-height: 100vh;
        min-height: 100dvh;
        flex-direction: column;
    }

    .institutional { display: none; }

    .login-area {
        width: 100%;
        flex: 1;
        flex-direction: column;
        padding: max(24px, env(safe-area-inset-top)) 16px 26px;
    }

    .mobile-brand {
        display: block;
        width: min(430px, 100%);
        margin-bottom: 22px;
    }

    .mobile-brand p {
        margin: 9px 0 0 45px;
        color: #8e98a7;
        font-size: .72rem;
    }

    .auth-card { padding: 26px 22px; border-radius: 18px; }

    .login-footer {
        width: 100%;
        flex-direction: column;
        gap: 5px;
        padding: 14px 16px max(16px, env(safe-area-inset-bottom));
        text-align: center;
    }
}

@media (max-width: 380px) {
    .auth-header { align-items: flex-start; }
    .auth-mark { display: none; }
    .auth-card { padding: 24px 18px; }
}

@media (max-height: 720px) and (min-width: 721px) {
    .login-area { padding-top: 22px; padding-bottom: 22px; }
    .auth-card { padding-top: 25px; padding-bottom: 25px; }
    .auth-header { margin-bottom: 20px; }
    .security-note { margin-top: 19px; padding-top: 16px; }
    .institutional-content { margin-top: 10vh; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
