:root {
    --blue-950: #041f4e;
    --blue-900: #062b67;
    --blue-800: #083d8f;
    --blue-700: #0a54b3;
    --blue-500: #2f80d6;
    --gold-700: #9c7415;
    --gold-500: #c9a227;
    --gold-300: #e4c65d;
    --white: #ffffff;
    --ink: #19324f;
    --muted: #6c7f95;
    --border: #d9e5f1;
    --danger-bg: #fff2f2;
    --danger-text: #a12a2a;
    --shadow: 0 22px 52px rgba(4, 43, 103, .17);
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    overflow: hidden;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 78% 18%, rgba(47,128,214,.16), transparent 30%),
        radial-gradient(circle at 62% 82%, rgba(201,162,39,.05), transparent 26%),
        linear-gradient(135deg, #f8fbff 0%, #eaf4ff 100%);
}

button, input { font: inherit; }

a {
    color: var(--blue-700);
    text-decoration: none;
}

a:hover { color: var(--gold-700); }

.page-watermark {
    position: fixed;
    z-index: 0;
    left: 55%;
    top: 50%;
    width: min(78vw, 1040px);
    max-height: 92vh;
    object-fit: contain;
    opacity: .038;
    transform: translate(-50%, -50%) rotate(-4deg);
    filter: grayscale(1) contrast(.82);
    pointer-events: none;
}

.login-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 41% 59%;
}

.brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 38px 48px;
    color: var(--white);
    background:
        radial-gradient(circle at 38% 40%, rgba(52,132,225,.33), transparent 40%),
        linear-gradient(145deg, rgba(4,31,78,.99), rgba(8,61,143,.97) 55%, rgba(10,84,179,.96));
    clip-path: polygon(0 0, 92% 0, 100% 100%, 0 100%);
}

.brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .18;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
    background-size: 20px 20px;
}

.brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(110deg, transparent 0 72%, rgba(255,255,255,.055) 72% 73%, transparent 73%);
}

.brand-content {
    position: relative;
    z-index: 2;
    width: min(100%, 560px);
    text-align: center;
}

.brand-logo {
    width: min(460px, 94%);
    max-height: 350px;
    object-fit: contain;
    margin-bottom: 12px;
    filter:
        drop-shadow(0 18px 34px rgba(0,0,0,.24))
        drop-shadow(0 0 20px rgba(255,255,255,.05));
}

.gold-line {
    width: 92px;
    height: 3px;
    margin: 0 auto 17px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold-500), #f3dc85, var(--gold-500));
}

.eyebrow, .card-kicker {
    margin: 0 0 9px;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.eyebrow { color: #f3dc85; }

.motto {
    margin: 15px auto 0;
    max-width: 540px;
    color: #f7dfa0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.15rem, 1.7vw, 1.48rem);
    font-style: italic;
    line-height: 1.45;
    text-shadow: 0 2px 10px rgba(0,0,0,.12);
}

.systems {
    margin: 24px 0 0;
    color: rgba(255,255,255,.78);
    font-size: .9rem;
    letter-spacing: .04em;
}

.systems span {
    margin: 0 7px;
    color: var(--gold-300);
}

.form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 30px;
}

.login-card {
    position: relative;
    width: min(100%, 480px);
    overflow: hidden;
    padding: 31px 40px 24px;
    border: 1px solid rgba(217,229,241,.92);
    border-radius: 22px;
    background: rgba(255,255,255,.965);
    box-shadow: var(--shadow);
    backdrop-filter: blur(7px);
}

.card-accent {
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--gold-700), var(--gold-300), var(--gold-700));
}

.card-header { margin-bottom: 19px; }

.card-kicker { color: var(--gold-700); }

.card-header h1 {
    margin: 0;
    color: var(--blue-900);
    font-size: clamp(1.65rem, 2.4vw, 2.08rem);
    line-height: 1.15;
}

.card-header p:last-child {
    margin: 7px 0 0;
    color: var(--muted);
}

.alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 11px;
    font-size: .9rem;
}

.alert-error {
    border: 1px solid #f0c5c5;
    background: var(--danger-bg);
    color: var(--danger-text);
}

.field-group { margin-bottom: 13px; }

.field-group label {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--blue-900);
    font-size: .9rem;
    font-weight: 700;
}

.input-shell {
    min-height: 47px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfdff;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input-shell:focus-within {
    border-color: var(--blue-500);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(47,128,214,.13);
}

.field-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201,162,39,.48);
    border-radius: 50%;
    background: rgba(201,162,39,.09);
    color: var(--gold-700);
    font-size: .76rem;
    font-weight: 900;
}

.lock-icon {
    font-size: .54rem;
}

.input-shell input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.input-shell input::placeholder { color: #9aabba; }

.toggle-password {
    border: 0;
    background: transparent;
    color: var(--blue-700);
    font-size: .8rem;
    font-weight: 800;
    cursor: pointer;
}

.toggle-password:hover { color: var(--gold-700); }

.caps-warning {
    margin-top: 6px;
    color: var(--gold-700);
    font-size: .8rem;
    font-weight: 700;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 1px 0 16px;
    font-size: .83rem;
}

.remember-option {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    margin: 0 !important;
    color: var(--muted) !important;
    font-weight: 600 !important;
    cursor: pointer;
}

.remember-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--blue-700);
}

.submit-button {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201,162,39,.88);
    border-radius: 12px;
    background:
        linear-gradient(135deg, #0a4ba6 0%, #0a5abd 55%, #084694 100%);
    color: var(--white);
    box-shadow:
        0 11px 24px rgba(8,61,143,.24),
        inset 0 1px 0 rgba(255,255,255,.18);
    font-weight: 800;
    letter-spacing: .03em;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.submit-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow:
        0 15px 30px rgba(8,61,143,.28),
        0 0 0 3px rgba(201,162,39,.08);
}

.submit-button:active { transform: translateY(0); }

.submit-button[disabled] {
    cursor: wait;
    opacity: .84;
}

.button-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.submit-button.is-loading .button-label { display: none; }
.submit-button.is-loading .button-loader { display: block; }

.first-access {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--muted);
    font-size: .85rem;
}

.first-access a { font-weight: 800; }

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #edf2f7;
    color: #8b9bad;
    font-size: .74rem;
}

.login-footer strong {
    color: var(--gold-700);
    letter-spacing: .08em;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 920px) {
    body { overflow: auto; }

    .login-page { grid-template-columns: 1fr; }

    .brand-panel {
        min-height: auto;
        padding: 28px 22px;
        clip-path: none;
    }

    .brand-logo {
        width: min(330px, 80%);
        max-height: 210px;
        margin-bottom: 10px;
    }

    .systems { margin-top: 17px; }

    .form-panel { padding: 22px 16px 34px; }
}

@media (max-height: 720px) and (min-width: 921px) {
    .brand-panel { padding: 20px 38px; }

    .brand-logo {
        width: min(385px, 88%);
        max-height: 255px;
    }

    .motto {
        margin-top: 10px;
        font-size: 1.12rem;
    }

    .systems { margin-top: 16px; }

    .login-card { padding: 26px 36px 20px; }

    .card-header { margin-bottom: 15px; }

    .field-group { margin-bottom: 11px; }

    .login-footer {
        margin-top: 14px;
        padding-top: 12px;
    }
}

@media (max-width: 560px) {
    .login-card {
        padding: 29px 19px 22px;
        border-radius: 18px;
    }

    .form-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .first-access {
        align-items: center;
        flex-direction: column;
    }

    .login-footer {
        flex-direction: column;
        gap: 4px;
    }
}
