:root {
    --login-navy: #102a43;
    --login-navy-2: #173f5f;
    --login-blue: #2369a6;
    --login-accent: #2f855a;
    --login-bg: #f3f6f9;
    --login-surface: #ffffff;
    --login-text: #243b53;
    --login-muted: #6b7c8f;
    --login-line: #dbe4ec;
    --login-soft: #edf3f7;
    --login-danger: #b42318;
    --login-danger-bg: #fff4f2;
    --login-shadow: 0 22px 60px rgba(16, 42, 67, .14);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body.mgest-login-page {
    margin: 0;
    min-height: 100vh;
    background: var(--login-bg);
    color: var(--login-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr);
}

.login-brand-panel {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: 34px clamp(34px, 5vw, 76px) 28px;
    display: flex;
    flex-direction: column;
    color: #fff;
    background:
        radial-gradient(circle at 15% 12%, rgba(255,255,255,.09), transparent 27%),
        radial-gradient(circle at 87% 78%, rgba(47,133,90,.34), transparent 32%),
        linear-gradient(145deg, #0d2438 0%, var(--login-navy) 48%, var(--login-navy-2) 100%);
}

.login-brand-panel::before,
.login-brand-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
    pointer-events: none;
}
.login-brand-panel::before { width: 520px; height: 520px; right: -250px; top: -170px; }
.login-brand-panel::after { width: 360px; height: 360px; left: -190px; bottom: -140px; }

.brand-topline, .brand-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    font-size: 12px;
    letter-spacing: .02em;
}
.brand-system { font-weight: 700; }
.brand-system i { margin-right: 8px; opacity: .9; }
.brand-status { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,.72); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #69d39c; box-shadow: 0 0 0 4px rgba(105,211,156,.12); }

.brand-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 720px;
    margin: auto 0;
    padding: 50px 0 42px;
}
.institution-mark { display: flex; align-items: center; gap: 18px; margin-bottom: 54px; }
.institution-logo-wrap {
    width: 74px;
    height: 74px;
    padding: 7px;
    flex: 0 0 74px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.institution-logo { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.institution-eyebrow { display: block; margin-bottom: 5px; color: rgba(255,255,255,.62); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; }
.institution-mark h1 { margin: 0; max-width: 470px; color: #fff; font-size: clamp(18px, 2vw, 25px); line-height: 1.27; font-weight: 650; }

.brand-message { max-width: 650px; }
.brand-message h2 { margin: 0 0 16px; color: #fff; font-size: clamp(29px, 3.5vw, 46px); line-height: 1.08; letter-spacing: -.035em; font-weight: 650; }
.brand-message p { margin: 0; max-width: 570px; color: rgba(255,255,255,.7); font-size: 14px; line-height: 1.75; }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 34px; }
.feature-item {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 14px;
    background: rgba(255,255,255,.045);
    backdrop-filter: blur(4px);
}
.feature-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.09); color: #cfe8ff; font-size: 14px; }
.feature-item strong, .feature-item small { display: block; }
.feature-item strong { color: #f6f9fb; font-size: 12px; font-weight: 650; }
.feature-item small { margin-top: 3px; color: rgba(255,255,255,.52); font-size: 10.5px; }
.brand-footer { color: rgba(255,255,255,.48); font-size: 10.5px; }

.login-form-panel {
    min-height: 100vh;
    padding: 36px clamp(26px, 5vw, 74px);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(rgba(255,255,255,.78), rgba(255,255,255,.78)),
        radial-gradient(circle at 80% 20%, rgba(35,105,166,.08), transparent 25%),
        var(--login-bg);
}
.login-card { width: 100%; max-width: 440px; }
.mobile-brand { display: none; }
.login-heading { margin-bottom: 28px; }
.login-kicker { display: inline-block; margin-bottom: 8px; color: var(--login-blue); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.login-heading h2 { margin: 0 0 8px; color: var(--login-navy); font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; }
.login-heading p { margin: 0; max-width: 405px; color: var(--login-muted); font-size: 12.5px; line-height: 1.7; }

.login-alert {
    display: flex;
    gap: 11px;
    margin-bottom: 20px;
    padding: 12px 13px;
    border: 1px solid #ffd3cc;
    border-radius: 11px;
    background: var(--login-danger-bg);
    color: var(--login-danger);
}
.alert-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(180,35,24,.08); }
.login-alert strong, .login-alert span { display: block; }
.login-alert strong { margin-bottom: 2px; font-size: 11.5px; }
.login-alert div > span { color: #8d2920; font-size: 10.5px; line-height: 1.45; }

.login-form { margin: 0; }
.field-group { margin-bottom: 17px; }
.field-group label { display: block; margin: 0 0 7px; color: #334e68; font-size: 11px; font-weight: 700; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.secure-label { margin-bottom: 6px; color: #8295a8; font-size: 9.5px; }
.secure-label i { margin-right: 4px; }
.input-shell { position: relative; }
.input-shell input {
    width: 100%;
    height: 47px;
    padding: 0 44px 0 42px;
    border: 1px solid var(--login-line);
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: var(--login-text);
    font-size: 12.5px;
    box-shadow: 0 1px 2px rgba(16,42,67,.02);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input-shell input::placeholder { color: #9aabb9; }
.input-shell input:hover { border-color: #c6d4df; }
.input-shell input:focus { border-color: #4b8fc6; box-shadow: 0 0 0 3px rgba(35,105,166,.10); }
.input-icon { position: absolute; z-index: 2; left: 15px; top: 50%; transform: translateY(-50%); color: #7f94a7; font-size: 13px; pointer-events: none; }
.password-toggle {
    position: absolute;
    z-index: 3;
    right: 8px;
    top: 50%;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    outline: 0;
    background: transparent;
    color: #71879b;
    cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus { background: var(--login-soft); color: var(--login-blue); }

.login-submit {
    width: 100%;
    height: 47px;
    margin-top: 5px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--login-navy), #1d527a);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 9px 22px rgba(16,42,67,.17);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(16,42,67,.22); }
.login-submit:focus { outline: 3px solid rgba(35,105,166,.16); outline-offset: 2px; }
.login-submit:disabled { opacity: .74; cursor: wait; transform: none; }
.login-submit.is-loading i { animation: loginPulse 1s infinite alternate; }
@keyframes loginPulse { to { transform: translateX(4px); opacity: .55; } }

.login-support {
    display: flex;
    gap: 11px;
    margin-top: 27px;
    padding-top: 21px;
    border-top: 1px solid var(--login-line);
}
.support-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 9px; background: #edf6f1; color: var(--login-accent); font-size: 12px; }
.login-support strong, .login-support span { display: block; }
.login-support strong { margin-bottom: 3px; color: #334e68; font-size: 10.5px; }
.login-support div > span { color: var(--login-muted); font-size: 9.8px; line-height: 1.5; }
.login-privacy { margin: 18px 0 0; color: #8798a8; font-size: 9.4px; line-height: 1.55; }
.login-privacy i { margin-right: 4px; color: #6f879a; }

@media (max-width: 980px) {
    .login-shell { grid-template-columns: minmax(350px, .9fr) minmax(400px, 1.1fr); }
    .feature-grid { grid-template-columns: 1fr; }
    .feature-item:nth-child(n+3) { display: none; }
    .institution-mark { margin-bottom: 38px; }
    .brand-message h2 { font-size: 31px; }
}

@media (max-width: 760px) {
    body.mgest-login-page { background: #fff; }
    .login-shell { display: block; min-height: 100vh; }
    .login-brand-panel { display: none; }
    .login-form-panel { min-height: 100vh; padding: 28px 22px; background: #fff; align-items: flex-start; }
    .login-card { max-width: 480px; margin: auto; padding-top: max(12px, env(safe-area-inset-top)); }
    .mobile-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 46px; }
    .mobile-logo { width: 50px; height: 50px; padding: 4px; object-fit: contain; border: 1px solid #e0e8ee; border-radius: 12px; background: #fff; }
    .mobile-brand strong, .mobile-brand span { display: block; }
    .mobile-brand strong { max-width: 260px; color: var(--login-navy); font-size: 11.5px; line-height: 1.35; }
    .mobile-brand span { margin-top: 2px; color: var(--login-muted); font-size: 9.5px; }
    .login-heading h2 { font-size: 25px; }
}

@media (max-width: 420px) {
    .login-form-panel { padding-left: 18px; padding-right: 18px; }
    .login-heading { margin-bottom: 24px; }
    .mobile-brand { margin-bottom: 38px; }
    .input-shell input, .login-submit { height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
