:root {
    color-scheme: dark;
    --corex-night: #020617;
    --corex-slate: #0f172a;
    --corex-panel: #111c31;
    --corex-line: rgba(148, 163, 184, .19);
    --corex-cyan: #22d3ee;
    --corex-cyan-soft: rgba(34, 211, 238, .12);
    --corex-ink: #f1f5f9;
    --corex-muted: #a1adbf;
    --corex-subtle: #718096;
    --corex-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--corex-ink);
    background: var(--corex-night);
    font-family: var(--corex-font);
    -webkit-font-smoothing: antialiased;
}

.login-wrapper {
    width: 100%;
    min-height: calc(100vh - 70px);
    min-height: calc(100dvh - 70px);
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr);
}

.left-section {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 650px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(34px, 5vw, 76px) clamp(34px, 7vw, 112px);
    background:
        radial-gradient(ellipse at 76% 62%, rgba(8, 145, 178, .14), transparent 43%),
        linear-gradient(135deg, #020617 0%, #071226 60%, #0b1b2e 100%);
}

.section-art {
    position: absolute;
    z-index: -2;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 62% center;
    opacity: .82;
    pointer-events: none;
}

.left-section::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: 1;
    background-image:
        linear-gradient(90deg, rgba(2, 6, 23, .58) 0%, rgba(2, 6, 23, .37) 45%, rgba(2, 6, 23, .12) 100%),
        linear-gradient(0deg, rgba(2, 6, 23, .45) 0%, transparent 58%),
        linear-gradient(rgba(148, 163, 184, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px);
    background-size: auto, auto, 64px 64px, 64px 64px;
    pointer-events: none;
}

.left-section::after {
    position: absolute;
    z-index: -1;
    right: -170px;
    bottom: 9%;
    width: 430px;
    height: 430px;
    border: 1px solid rgba(34, 211, 238, .14);
    border-radius: 50%;
    box-shadow: 0 0 0 48px rgba(34, 211, 238, .025), 0 0 0 96px rgba(34, 211, 238, .02);
    content: "";
    pointer-events: none;
}

.brand-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.brand-symbol { width: 44px; height: 44px; display: block; }
.brand-wordmark { display: flex; flex-direction: column; line-height: 1; }
.brand-name { color: #f8fafc; font-size: 1.22rem; font-weight: 750; letter-spacing: .035em; }
.brand-name > span { color: var(--corex-cyan); }
.brand-name b { font-weight: 650; }
.brand-division { margin-top: 5px; color: #94a3b8; font-size: .57rem; font-weight: 700; letter-spacing: .29em; }

.brand-content {
    position: relative;
    width: min(100%, 680px);
    margin: auto 0;
    padding: 88px 0 80px;
    animation: corex-reveal .65s cubic-bezier(.2,.75,.3,1) both;
}

.brand-kicker {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0 0 25px;
    color: #8ca5b8;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .18em;
    line-height: 1.6;
}

.brand-kicker::before { width: 26px; height: 1px; flex: 0 0 auto; background: var(--corex-cyan); content: ""; }
.brand-title {
    max-width: 660px;
    margin: 0;
    color: #f8fafc;
    font-size: clamp(2.7rem, 5.15vw, 5.15rem);
    font-weight: 650;
    line-height: 1.04;
    letter-spacing: -.062em;
}
.brand-title span { color: var(--corex-cyan); }
.brand-subtitle {
    max-width: 480px;
    margin: 25px 0 0;
    color: #b2bfce;
    font-size: clamp(.97rem, 1.25vw, 1.08rem);
    line-height: 1.75;
}
.brand-rule {
    margin-top: 44px;
    padding-left: 17px;
    border-left: 1px solid rgba(34, 211, 238, .55);
    color: #e2e8f0;
    font-size: .9rem;
    font-weight: 550;
    line-height: 1.8;
    letter-spacing: .015em;
}
.brand-bottom {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #8b9bad;
    font-size: .72rem;
    letter-spacing: .025em;
}
.status-indicator {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--corex-cyan);
    box-shadow: 0 0 12px rgba(34, 211, 238, .55);
}

.right-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(38px, 6vw, 96px);
    border-left: 1px solid rgba(148, 163, 184, .12);
    background:
        radial-gradient(ellipse at 100% 0%, rgba(34, 211, 238, .075), transparent 42%),
        #0a1222;
}

.login-form-container {
    position: relative;
    z-index: 1;
    width: min(100%, 410px);
    animation: corex-reveal .72s .08s cubic-bezier(.2,.75,.3,1) both;
}
.login-overline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--corex-cyan);
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.login-overline::before { width: 6px; height: 6px; border-radius: 50%; background: var(--corex-cyan); content: ""; }
.login-header { margin-bottom: 37px; }
.login-title {
    margin: 0 0 10px;
    color: #f8fafc;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 630;
    line-height: 1.12;
    letter-spacing: -.05em;
}
.login-subtitle { margin: 0; color: var(--corex-muted); font-size: .94rem; line-height: 1.7; }
.login-form-container form { margin: 0; }
.input-with-icon { position: relative; margin-bottom: 22px; }
.field-label { display: block; margin: 0 0 9px; color: #d6dfeb; font-size: .81rem; font-weight: 600; }
.input-icon {
    position: absolute;
    z-index: 2;
    top: 42px;
    left: 16px;
    color: #8091a7;
    font-size: .98rem;
    pointer-events: none;
    transition: color .18s ease;
}
.form-control {
    width: 100%;
    height: 54px;
    padding: 0 15px 0 45px;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 7px;
    color: #f1f5f9;
    background: rgba(15, 23, 42, .72);
    font-family: inherit;
    font-size: .92rem;
    box-shadow: none;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.form-control::placeholder { color: #728197; opacity: 1; }
.form-control:hover { border-color: rgba(148, 163, 184, .48); }
.form-control:focus {
    border-color: var(--corex-cyan);
    outline: 0;
    color: #f8fafc;
    background: #0f1c30;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
}
.input-with-icon:focus-within .input-icon { color: var(--corex-cyan); }
.forgot-row { display: flex; justify-content: flex-end; margin: -2px 0 24px; }
.forgot-row a, .register-link a {
    color: var(--corex-cyan);
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 4px;
    transition: color .18s ease;
}
.forgot-row a:hover, .register-link a:hover { color: #a5f3fc; text-decoration: underline; }
.forgot-row a:focus-visible, .register-link a:focus-visible, .footer-links a:focus-visible {
    outline: 2px solid var(--corex-cyan);
    outline-offset: 4px;
    border-radius: 3px;
}
.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    width: 100%;
    min-height: 54px;
    padding: 13px 20px;
    border: 1px solid var(--corex-cyan);
    border-radius: 7px;
    color: #04202b;
    background: var(--corex-cyan);
    font-family: inherit;
    font-size: .91rem;
    font-weight: 750;
    letter-spacing: .015em;
    box-shadow: 0 8px 22px rgba(8, 145, 178, .12);
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.btn-login:hover, .btn-login:focus { color: #041a23; border-color: #67e8f9; background: #67e8f9; box-shadow: 0 11px 26px rgba(8, 145, 178, .2); }
.btn-login:hover { transform: translateY(-1px); }
.btn-login:focus-visible { outline: 3px solid rgba(34, 211, 238, .35); outline-offset: 3px; }
.btn-login:active { transform: translateY(0); }
.divider { display: flex; align-items: center; gap: 15px; margin: 30px 0 18px; color: #8a98aa; font-size: .76rem; white-space: nowrap; }
.divider::before, .divider::after { height: 1px; flex: 1; background: var(--corex-line); content: ""; }
.divider span { color: #94a3b8; }
.register-link { color: #aab7c8; font-size: .86rem; text-align: center; }
.register-link a { margin-left: 4px; }

.footer { position: relative; z-index: 2; min-height: 70px; padding: 16px clamp(22px, 5vw, 76px); border-top: 1px solid rgba(148, 163, 184, .12); color: #4ade80; background: #020617; }
.footer-content { width: min(100%, 1440px); min-height: 36px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 25px; }
.footer-links a { display: inline-flex; align-items: center; gap: 8px; color: #4ade80; font-size: .76rem; font-weight: 500; text-decoration: none; transition: color .18s ease; }
.footer-links a i { color: #4ade80; }
.footer-links a:hover { color: #86efac; }
.footer-copyright { color: #4ade80; font-size: .73rem; text-align: right; }

.alert { margin: 0 0 22px; padding: 13px 15px; border: 1px solid transparent; border-radius: 7px; font-size: .86rem; }
.alert-success { color: #bbf7d0; border-color: rgba(74, 222, 128, .3); background: rgba(22, 101, 52, .22); }
.alert-danger { color: #fecaca; border-color: rgba(248, 113, 113, .32); background: rgba(127, 29, 29, .24); }
.alert-warning { color: #fde68a; border-color: rgba(251, 191, 36, .3); background: rgba(120, 53, 15, .22); }
.alert-info { color: #bae6fd; border-color: rgba(56, 189, 248, .3); background: rgba(12, 74, 110, .24); }
.alert .btn-close { padding: 16px; filter: invert(1) grayscale(1); }

.policy-modal .modal-content { overflow: hidden; color: #dce5ef; border: 1px solid rgba(148, 163, 184, .24); border-radius: 10px; background: #0f172a; }
.policy-modal .modal-header { padding: 18px 24px; color: #f8fafc; background: #111c31; border-bottom: 1px solid rgba(34, 211, 238, .35); }
.policy-modal .modal-title { color: #f8fafc; font-family: var(--corex-font); font-size: 1.08rem; font-weight: 650; }
.policy-modal .modal-title i { color: var(--corex-cyan); }
.policy-modal .modal-body { max-height: 60vh; padding: 24px; overflow-y: auto; }
.policy-modal .modal-body h5 { margin: 20px 0 9px; color: #e2e8f0; font-size: .98rem; font-weight: 700; }
.policy-modal .modal-body h5:first-child { margin-top: 0; }
.policy-modal .modal-body p, .policy-modal .modal-body li { color: #aab7c8; font-size: .9rem; line-height: 1.75; }
.policy-modal .btn-close { filter: invert(1) grayscale(1); }
.modal-backdrop.show { opacity: .78; }

@keyframes corex-reveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .login-wrapper { grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr); }
    .left-section { padding-inline: 40px; }
    .right-section { padding-inline: 42px; }
    .brand-title { font-size: clamp(2.55rem, 5.3vw, 4rem); }
}

@media (max-width: 700px) {
    .login-wrapper { display: flex; flex-direction: column; min-height: auto; }
    .left-section { min-height: 345px; padding: 25px 25px 26px; }
    .brand-symbol { width: 39px; height: 39px; }
    .brand-name { font-size: 1.1rem; }
    .brand-content { padding: 43px 0 35px; }
    .brand-kicker { margin-bottom: 14px; font-size: .59rem; letter-spacing: .15em; }
    .brand-title { max-width: 500px; font-size: clamp(2.35rem, 9vw, 3.7rem); }
    .brand-subtitle { max-width: 490px; margin-top: 14px; font-size: .9rem; line-height: 1.6; }
    .brand-rule, .brand-bottom { display: none; }
    .section-art { object-position: 67% 48%; opacity: .72; }
    .left-section::before {
        background-image:
            linear-gradient(90deg, rgba(2, 6, 23, .56) 0%, rgba(2, 6, 23, .3) 58%, rgba(2, 6, 23, .16) 100%),
            linear-gradient(0deg, rgba(2, 6, 23, .48) 0%, rgba(2, 6, 23, .06) 66%),
            linear-gradient(rgba(148, 163, 184, .04) 1px, transparent 1px),
            linear-gradient(90deg, rgba(148, 163, 184, .04) 1px, transparent 1px);
    }
    .left-section::after { right: -240px; bottom: -135px; width: 360px; height: 360px; }
    .right-section { min-height: 470px; flex: 1; align-items: flex-start; padding: 45px 25px 54px; border-top: 1px solid rgba(148, 163, 184, .12); border-left: 0; }
    .login-form-container { max-width: 440px; margin: auto; }
    .login-header { margin-bottom: 28px; }
    .footer { padding: 17px 22px; }
    .footer-content { flex-direction: column; justify-content: center; gap: 12px; }
    .footer-links { justify-content: center; gap: 21px; }
    .footer-copyright { text-align: center; font-size: .7rem; }
}

@media (max-width: 380px) {
    .left-section { min-height: 325px; padding-inline: 20px; }
    .right-section { padding-inline: 20px; }
    .brand-kicker { font-size: .54rem; }
    .footer-links { gap: 15px; }
    .footer-links a { font-size: .72rem; }
}

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