:root {
    color-scheme: light;
    --auth-navy: #0b2038;
    --auth-navy-soft: #163a5d;
    --auth-blue: #1769aa;
    --auth-blue-dark: #0e5189;
    --auth-cyan: #55c8d6;
    --auth-green: #1f9d73;
    --auth-text: #17212f;
    --auth-muted: #647184;
    --auth-border: #d9e2ec;
    --auth-surface: #ffffff;
    --auth-background: #f3f7fb;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.auth-page {
    margin: 0;
    background: var(--auth-background);
    color: var(--auth-text);
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(420px, 1.05fr) minmax(480px, .95fr);
    min-height: 100vh;
    min-height: 100svh;
}

.auth-brand-panel {
    position: relative;
    display: flex;
    min-height: 100%;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 5rem);
    color: #fff;
    background:
        radial-gradient(circle at 12% 12%, rgba(85, 200, 214, .23), transparent 30%),
        linear-gradient(145deg, #081a2e 0%, var(--auth-navy) 48%, #123f63 100%);
}

.auth-brand-panel::before {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    content: "";
    mask-image: linear-gradient(to bottom right, #000, transparent 75%);
}

.brand-decoration {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 50%;
    pointer-events: none;
}

.brand-decoration-one {
    right: -150px;
    bottom: -170px;
    width: 460px;
    height: 460px;
    box-shadow: 0 0 0 70px rgba(255, 255, 255, .025), 0 0 0 140px rgba(255, 255, 255, .018);
}

.brand-decoration-two {
    top: 28%;
    right: 8%;
    width: 90px;
    height: 90px;
    background: rgba(85, 200, 214, .06);
}

.brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    max-width: 670px;
}

.brand-link,
.mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: .85rem;
}

.brand-link {
    width: fit-content;
    color: #fff;
    text-decoration: none;
}

.brand-link:focus-visible {
    outline: 3px solid rgba(85, 200, 214, .75);
    outline-offset: 6px;
    border-radius: 10px;
}

.brand-mark {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(85, 200, 214, .3), rgba(255, 255, 255, .08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
    color: #fff;
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1;
    overflow: hidden;
}

.brand-mark.has-logo {
    padding: .32rem;
    background: rgba(255, 255, 255, .94);
}

.brand-mark.has-logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.brand-link .brand-mark.has-logo {
    flex-basis: 52px;
    width: 52px;
    height: 52px;
    padding: .42rem;
    border-radius: 16px;
}

.brand-name {
    font-size: 1.42rem;
    font-weight: 850;
    letter-spacing: .025em;
}

.brand-copy {
    max-width: 600px;
    margin: auto 0;
    padding: 4rem 0;
}

.brand-eyebrow {
    margin: 0 0 1rem;
    color: #85d7e1;
    font-size: .78rem;
    font-weight: 750;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.brand-copy h1 {
    max-width: 580px;
    margin: 0;
    font-size: clamp(2.3rem, 4.4vw, 4.4rem);
    line-height: 1.05;
    letter-spacing: -.045em;
}

.brand-description {
    max-width: 560px;
    margin: 1.6rem 0 0;
    color: rgba(236, 247, 255, .73);
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.75;
}

.security-points {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.35rem;
    margin: 0;
    padding: 0;
    color: rgba(236, 247, 255, .76);
    font-size: .86rem;
    list-style: none;
}

.security-points li {
    display: inline-flex;
    align-items: center;
    gap: .48rem;
}

.security-check {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    background: rgba(85, 200, 214, .15);
    color: #85d7e1;
    font-size: .68rem;
    font-weight: 800;
}

.auth-form-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 5rem);
    background:
        radial-gradient(circle at 90% 5%, rgba(23, 105, 170, .08), transparent 27%),
        var(--auth-background);
}

.login-card {
    width: min(100%, 520px);
    padding: clamp(1.6rem, 3.5vw, 2.75rem);
    border: 1px solid rgba(217, 226, 236, .88);
    border-radius: 24px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 28px 70px rgba(31, 55, 82, .12), 0 3px 10px rgba(31, 55, 82, .05);
}

.mobile-brand {
    display: none;
    max-width: 100%;
    margin-bottom: 1.8rem;
    color: var(--auth-navy);
}

.brand-mobile-copy {
    display: grid;
    gap: .1rem;
    min-width: 0;
}

.brand-mobile-subtitle {
    color: var(--auth-muted);
    font-size: .76rem;
    font-weight: 750;
    line-height: 1.25;
    max-width: 280px;
}

.mobile-brand .brand-mark {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
    background: linear-gradient(145deg, var(--auth-navy), var(--auth-blue));
}

.mobile-brand .brand-mark.has-logo {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
    padding: .32rem;
    background: #fff;
    border-color: rgba(11, 32, 56, .18);
}

.mobile-brand .brand-name {
    font-size: 1.12rem;
    line-height: 1.15;
}

.pwa-install {
    align-items: center;
    background: #f2f7fc;
    border: 1px solid #cfe0ef;
    border-radius: 14px;
    display: grid;
    gap: .3rem .75rem;
    grid-template-columns: auto 1fr auto;
    margin: -0.35rem 0 1.25rem;
    padding: .85rem;
    text-align: left;
}

.pwa-install-icon {
    align-items: center;
    background: var(--auth-navy);
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-size: 1.25rem;
    grid-row: 1;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.pwa-install-copy {
    display: grid;
    gap: .1rem;
}

.pwa-install-copy strong {
    color: var(--auth-navy);
    font-size: .9rem;
}

.pwa-install-copy > span {
    color: var(--auth-muted);
    font-size: .77rem;
    line-height: 1.35;
}

.pwa-install-button {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(11, 32, 56, .2);
    border-radius: 12px;
    color: var(--auth-navy);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    gap: .5rem;
    justify-content: center;
    min-height: 44px;
    padding: .65rem 1rem;
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.pwa-install-button:hover {
    background: #f2f6fa;
    border-color: rgba(11, 32, 56, .42);
}

.pwa-install-button:active {
    transform: translateY(1px);
}

.pwa-install-button:focus-visible {
    outline: 3px solid rgba(21, 90, 145, .22);
    outline-offset: 2px;
}

.pwa-ios-help {
    color: var(--auth-muted);
    font-size: .82rem;
    grid-column: 1 / -1;
    line-height: 1.45;
    margin: .45rem 0 0;
}

@media (max-width: 480px) {
    .pwa-install {
        grid-template-columns: auto 1fr;
    }

    .pwa-install-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .login-semester-grid {
        grid-template-columns: 1fr;
    }

    .login-semester-head {
        display: grid;
    }

    .login-semester-badge {
        width: fit-content;
    }
}

.login-header {
    margin-bottom: 1.8rem;
}

.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: .48rem;
    margin-bottom: 1.15rem;
    padding: .4rem .68rem;
    border: 1px solid #ccebdc;
    border-radius: 999px;
    background: #effaf5;
    color: #187555;
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .02em;
}

.secure-badge > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--auth-green);
    box-shadow: 0 0 0 4px rgba(31, 157, 115, .12);
}

.login-header h2 {
    margin: 0;
    color: var(--auth-text);
    font-size: clamp(1.75rem, 3vw, 2.2rem);
    line-height: 1.16;
    letter-spacing: -.035em;
}

.login-header p {
    margin: .72rem 0 0;
    color: var(--auth-muted);
    line-height: 1.6;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin-bottom: 1.25rem;
    padding: .82rem .9rem;
    border: 1px solid;
    border-radius: 12px;
    font-size: .88rem;
    line-height: 1.45;
}

.alert-danger {
    border-color: #f1c2c5;
    background: #fff3f4;
    color: #9d2630;
}

.alert-success {
    border-color: #bfe5d3;
    background: #effaf5;
    color: #176f52;
}

.alert-icon {
    display: grid;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 800;
}

.form-field + .form-field {
    margin-top: 1.15rem;
}

.form-field label {
    display: block;
    margin-bottom: .48rem;
    color: #344256;
    font-size: .88rem;
    font-weight: 700;
}

.control-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.control-wrap:focus-within {
    border-color: var(--auth-blue);
    box-shadow: 0 0 0 4px rgba(23, 105, 170, .12);
}

.control-wrap.is-invalid {
    border-color: #d44452;
    background: #fffafa;
}

.control-wrap.is-invalid:focus-within {
    box-shadow: 0 0 0 4px rgba(212, 68, 82, .11);
}

.control-icon {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #77869a;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    pointer-events: none;
}

.control-wrap input,
.control-wrap select {
    width: 100%;
    min-width: 0;
    height: 50px;
    padding: 0 1rem 0 3rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--auth-text);
    font-size: .95rem;
}

.control-wrap select {
    appearance: none;
    cursor: pointer;
    padding-right: 2.75rem;
}

.control-wrap-select::after {
    position: absolute;
    right: 1rem;
    width: .58rem;
    height: .58rem;
    border-right: 2px solid #77869a;
    border-bottom: 2px solid #77869a;
    content: "";
    pointer-events: none;
    transform: rotate(45deg) translateY(-2px);
}

.control-wrap-password input {
    padding-right: 4.8rem;
}

.control-wrap input::placeholder {
    color: #9aa6b5;
    opacity: 1;
}

.password-toggle {
    position: absolute;
    right: .58rem;
    min-width: 55px;
    padding: .48rem .58rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-blue-dark);
    cursor: pointer;
    font-size: .78rem;
    font-weight: 750;
}

.password-toggle:hover {
    background: #edf5fb;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--auth-blue);
    outline-offset: 1px;
}

.field-error,
.caps-lock {
    margin: .42rem 0 0;
    font-size: .8rem;
    line-height: 1.4;
}

.field-error {
    color: #bd303d;
}

.caps-lock {
    color: #976115;
}

.login-semester-card {
    margin-top: 1.15rem;
    padding: .9rem;
    border: 1px solid #d8e8f6;
    border-radius: 16px;
    background: linear-gradient(180deg, #f7fbff 0%, #fff 100%);
}

.login-semester-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.login-semester-head strong,
.login-semester-head span {
    display: block;
}

.login-semester-head strong {
    color: var(--auth-navy);
    font-size: .94rem;
}

.login-semester-head div > span {
    margin-top: .12rem;
    color: var(--auth-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.login-semester-badge {
    flex: 0 0 auto;
    padding: .28rem .48rem;
    border: 1px solid #ccebdc;
    border-radius: 999px;
    background: #effaf5;
    color: #187555;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.login-semester-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(150px, .85fr) minmax(190px, 1.15fr);
}

.form-field-compact + .form-field-compact {
    margin-top: 0;
}

.form-field-compact label {
    font-size: .78rem;
}

.form-field-compact .control-wrap {
    min-height: 46px;
    border-radius: 12px;
}

.form-field-compact .control-wrap input,
.form-field-compact .control-wrap select {
    height: 44px;
    font-size: .88rem;
}

.form-field-compact .control-wrap select {
    min-width: 0;
    padding-right: 2.35rem;
}

.login-semester-empty {
    margin: 0;
    color: var(--auth-muted);
    font-size: .84rem;
    line-height: 1.45;
}

.login-submit {
    display: block;
    width: 100%;
    min-height: 52px;
    margin-top: 1.55rem;
    padding: .85rem 1.1rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-blue), var(--auth-blue-dark));
    box-shadow: 0 10px 22px rgba(23, 105, 170, .2);
    color: #fff;
    cursor: pointer;
    font-weight: 750;
    letter-spacing: .01em;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 13px 28px rgba(23, 105, 170, .26);
    filter: brightness(1.04);
}

.login-submit:focus-visible {
    outline: 3px solid rgba(23, 105, 170, .28);
    outline-offset: 3px;
}

.login-submit:disabled {
    cursor: wait;
    opacity: .78;
}

.button-arrow {
    display: inline-block;
    margin-left: .4rem;
    transition: transform .18s ease;
}

.login-submit:hover .button-arrow {
    transform: translateX(3px);
}

.button-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: .48rem;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: auth-spin .7s linear infinite;
}

.login-help {
    margin: 1.35rem 0 0;
    color: var(--auth-muted);
    font-size: .8rem;
    line-height: 1.55;
    text-align: center;
}

[hidden] {
    display: none !important;
}

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

@media (max-width: 940px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: 100vh;
        min-height: 100svh;
        padding: 1.25rem;
    }

    .mobile-brand {
        display: inline-flex;
    }
}

@media (max-width: 520px) {
    .auth-form-panel {
        align-items: flex-start;
        padding: 0;
        background: #fff;
    }

    .login-card {
        min-height: 100vh;
        min-height: 100svh;
        padding: 1.6rem 1.25rem 2rem;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

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