:root {
    --navy-950: #061729;
    --navy-900: #09243c;
    --navy-800: #103b5d;
    --blue-600: #087bd5;
    --blue-500: #1493e6;
    --cyan-400: #29d4ee;
    --ink-900: #09213c;
    --ink-700: #354c66;
    --ink-500: #6f8197;
    --line: #dbe6f0;
    --surface: #ffffff;
    --surface-muted: #f4f8fc;
    --danger: #c73d4d;
    --danger-bg: #fff1f3;
    --success: #59dd8b;
    --shadow-xl: 0 32px 80px rgba(2, 18, 35, 0.28);
    --shadow-button: 0 14px 30px rgba(8, 123, 213, 0.28);
    --radius-xl: 28px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--navy-950);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: clamp(12px, 2vw, 28px);
    display: grid;
    place-items: center;
    color: var(--ink-900);
    font-family: var(--font);
    background:
        radial-gradient(circle at 10% 0%, rgba(42, 181, 226, 0.18), transparent 32%),
        radial-gradient(circle at 90% 100%, rgba(20, 147, 230, 0.14), transparent 30%),
        linear-gradient(145deg, #061727 0%, #0a2b45 55%, #071c30 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

.portal-shell {
    position: relative;
    width: min(1180px, 100%);
    min-height: min(720px, calc(100dvh - clamp(24px, 4vw, 56px)));
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    animation: portalEnter 0.7s cubic-bezier(.2,.75,.25,1) both;
}

.brand-panel {
    position: relative;
    overflow: hidden;
    color: white;
    background:
        linear-gradient(155deg, rgba(7, 24, 42, 0.97), rgba(18, 72, 105, 0.92)),
        url('../images/login-bg.jpg') center / cover no-repeat;
}

.brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.12));
    pointer-events: none;
}

.brand-grid {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image:
        linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.brand-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(1px);
    opacity: 0.5;
}

.brand-glow-one {
    width: 420px;
    height: 420px;
    top: -145px;
    right: -120px;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: inset 0 0 0 56px rgba(255,255,255,.025), inset 0 0 0 112px rgba(255,255,255,.025);
}

.brand-glow-two {
    width: 340px;
    height: 340px;
    right: -110px;
    bottom: -90px;
    background: radial-gradient(circle at 30% 30%, rgba(32, 206, 235, .38), transparent 68%);
}

.brand-content {
    position: relative;
    z-index: 1;
    min-height: 100%;
    padding: clamp(40px, 6vw, 72px);
    display: flex;
    flex-direction: column;
}

.logo-card {
    width: fit-content;
    min-width: 210px;
    padding: 18px 24px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.36);
    border-radius: 19px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 18px 35px rgba(0,0,0,.15);
}

.brand-logo {
    display: block;
    width: min(175px, 28vw);
    height: auto;
}

.brand-copy {
    margin-top: auto;
    padding-top: 58px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--blue-600);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: .22em;
}

.eyebrow-light {
    color: var(--cyan-400);
}

.brand-copy h1 {
    margin: 0;
    font-size: clamp(3rem, 5vw, 5.35rem);
    line-height: .98;
    letter-spacing: -.055em;
}

.brand-description {
    max-width: 520px;
    margin: 26px 0 0;
    color: rgba(235, 246, 255, .82);
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.8;
}

.service-grid {
    margin-top: 36px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.service-item {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    color: rgba(245,250,255,.9);
    background: rgba(255,255,255,.055);
    backdrop-filter: blur(10px);
    font-size: .86rem;
    font-weight: 650;
}

.service-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    border-radius: 8px;
    background: rgba(41,212,238,.12);
}

.service-icon svg,
.input-icon svg,
.welcome-icon svg,
.password-toggle svg,
.button-arrow svg,
.note-icon svg,
.alert-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-footer {
    margin-top: auto;
    padding-top: 42px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    color: rgba(225,239,250,.74);
    font-size: .78rem;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(89,221,139,.12), 0 0 18px rgba(89,221,139,.65);
}

.locations {
    text-align: right;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: clamp(36px, 6vw, 74px);
    background:
        radial-gradient(circle at 90% 10%, rgba(20,147,230,.06), transparent 28%),
        var(--surface);
}

.login-wrap {
    width: min(410px, 100%);
}

.mobile-logo {
    display: none;
}

.login-header {
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: start;
    gap: 16px;
    margin-bottom: 34px;
}

.welcome-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: var(--blue-600);
    background: #eaf5fe;
}

.welcome-icon svg {
    width: 23px;
    height: 23px;
}

.login-header h2 {
    margin: 0;
    color: var(--ink-900);
    font-size: clamp(2.05rem, 4vw, 2.65rem);
    line-height: 1.04;
    letter-spacing: -.045em;
}

.login-subtitle {
    margin: 11px 0 0;
    color: var(--ink-500);
    font-size: .93rem;
}

.alert-message {
    margin: -12px 0 22px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #f3c6cc;
    border-radius: 12px;
    color: var(--danger);
    background: var(--danger-bg);
    font-size: .86rem;
    font-weight: 650;
}

.alert-icon {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
}

.login-form {
    display: grid;
    gap: 20px;
}

.field-group label {
    display: block;
    margin: 0 0 8px;
    color: var(--ink-900);
    font-size: .82rem;
    font-weight: 750;
}

.input-shell {
    position: relative;
    display: flex;
    align-items: center;
}

.input-shell input {
    width: 100%;
    min-height: 56px;
    padding: 0 52px 0 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    outline: none;
    color: var(--ink-900);
    background: var(--surface-muted);
    font-size: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease;
    -webkit-appearance: none;
}

.input-shell input::placeholder {
    color: #94a4b7;
}

.input-shell input:focus {
    border-color: var(--blue-500);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(20,147,230,.14), 0 10px 24px rgba(18,74,115,.08);
}

.input-icon {
    position: absolute;
    left: 17px;
    z-index: 1;
    display: grid;
    place-items: center;
    color: #6f849a;
    pointer-events: none;
}

.password-toggle {
    position: absolute;
    right: 8px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: #6f849a;
    background: transparent;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--blue-600);
    background: #e8f3fc;
    outline: none;
}

.eye-closed {
    display: none;
}

.password-toggle.is-visible .eye-open {
    display: none;
}

.password-toggle.is-visible .eye-closed {
    display: block;
}

.sign-in-button {
    position: relative;
    min-height: 58px;
    margin-top: 4px;
    padding: 0 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 11px;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-md);
    color: #fff;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    box-shadow: var(--shadow-button);
    font-size: .95rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.sign-in-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
    transform: translateX(-120%);
    transition: transform .6s ease;
}

.sign-in-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(8,123,213,.35);
    filter: saturate(1.08);
}

.sign-in-button:hover::before {
    transform: translateX(120%);
}

.sign-in-button:active {
    transform: translateY(0);
}

.sign-in-button:focus-visible {
    outline: 4px solid rgba(20,147,230,.2);
    outline-offset: 3px;
}

.button-arrow {
    display: grid;
    place-items: center;
}

.button-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.sign-in-button.is-loading .button-arrow {
    display: none;
}

.sign-in-button.is-loading .button-spinner {
    display: block;
}

.sign-in-button:disabled {
    cursor: wait;
    opacity: .9;
}

.autofill-note {
    margin-top: 26px;
    padding: 0 2px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--ink-500);
    font-size: .8rem;
    line-height: 1.45;
}

.autofill-note p {
    margin: 0;
}

.note-icon {
    margin-top: 1px;
    display: grid;
    place-items: center;
    flex: 0 0 18px;
    color: #1b9e63;
}

.note-icon svg {
    width: 17px;
    height: 17px;
}

.login-footer {
    margin-top: 46px;
    padding-top: 22px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #e5edf4;
    color: #8a99ab;
    font-size: .73rem;
}

.version {
    white-space: nowrap;
}

@keyframes portalEnter {
    from { opacity: 0; transform: translateY(18px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@media (max-width: 960px) {
    body {
        padding: 0;
        place-items: stretch;
    }

    .portal-shell {
        width: 100%;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        border: 0;
        border-radius: 0;
    }

    .brand-panel {
        display: none;
    }

    .login-panel {
        min-height: 100dvh;
        padding: max(30px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
        background:
            radial-gradient(circle at 100% 0%, rgba(20,147,230,.11), transparent 33%),
            radial-gradient(circle at 0% 100%, rgba(41,212,238,.08), transparent 35%),
            #fff;
    }

    .login-wrap {
        width: min(440px, 100%);
    }

    .mobile-logo {
        width: fit-content;
        margin: 0 auto 42px;
        padding: 14px 20px;
        display: grid;
        place-items: center;
        border: 1px solid #e4ebf2;
        border-radius: 17px;
        background: #fff;
        box-shadow: 0 14px 30px rgba(11,39,67,.09);
    }

    .mobile-logo img {
        display: block;
        width: 150px;
        height: auto;
    }

    .login-header {
        margin-bottom: 28px;
    }
}

@media (max-width: 520px) {
    .login-panel {
        place-items: start center;
        padding-top: max(24px, env(safe-area-inset-top));
    }

    .mobile-logo {
        margin-bottom: 30px;
    }

    .login-header {
        grid-template-columns: 48px 1fr;
        gap: 13px;
    }

    .welcome-icon {
        width: 48px;
        height: 48px;
        border-radius: 15px;
    }

    .login-header h2 {
        font-size: 2rem;
    }

    .login-subtitle {
        font-size: .86rem;
    }

    .input-shell input {
        min-height: 58px;
    }

    .sign-in-button {
        min-height: 60px;
    }

    .login-footer {
        margin-top: 34px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
