* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@view-transition {
    navigation: auto;
}

:root {
    --navy-950: #1A1A1A;
    --navy-900: #1A1A1A;
    --navy-800: #1A1A1A;
    --navy-700: #1A1A1A;
    --gold: #FDC913;
    --gold-dark: #8A6D00;
    --gold-tint: #FFF3D1;
    --gray-muted: #585858;
    --gray-light: #A0A0A0;
    --border-soft: #E5E5E5;
    --off-white: #FFFFFF;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--off-white);
    transition: opacity 0.45s ease;
}

body.page-transitioning {
    opacity: 0;
}

.split-screen {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

.brand-panel {
    position: relative;
    flex: 0 0 55%;
    max-width: 55%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-panel::before {
    content: "";
    position: absolute;
    inset: -3%;
    background-image: url('../../../assets/images/csma_campus.jpg');
    background-size: cover;
    background-position: center 28%;
    background-repeat: no-repeat;
    filter: contrast(1.15) saturate(1.12) brightness(0.92);
    transform: scale(1.03);
}

.brand-panel__overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 90% at 50% 20%, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.5) 55%, rgba(0, 0, 0, 0.82) 100%),
        linear-gradient(160deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.74) 55%, rgba(0, 0, 0, 0.88) 100%);
}

.brand-panel__content {
    position: relative;
    z-index: 1;
    max-width: 480px;
    padding: 2.5rem;
    text-align: center;
    color: #fff;
    animation: fadeSlideUp 0.6s cubic-bezier(0.2, 0.9, 0.4, 1.1) both;
}

.brand-seal {
    width: 148px;
    height: 148px;
    margin: 0 auto 1.6rem auto;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    overflow: hidden;
}

.brand-seal__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.brand-tagline {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #EDE9DF;
    margin-bottom: 0.85rem;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(1.7rem, 2.6vw, 2.5rem);
    line-height: 1.28;
    margin-bottom: 1.1rem;
}

.brand-mission {
    font-size: 0.86rem;
    line-height: 1.6;
    color: #B8B5AC;
    margin-bottom: 2rem;
}

.brand-meta {
    font-size: 0.8rem;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.brand-meta__gold {
    color: #EDE9DF;
    font-weight: 600;
}

.brand-meta__dot {
    color: #8f8c84;
}

.brand-meta__gray {
    color: #c9c6bf;
}

.form-panel {
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.8rem;
    background: var(--off-white);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #E8E6E0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 2.6rem 2.3rem 2.2rem 2.3rem;
    animation: fadeSlideUp 0.5s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-badge {
    display: inline-block;
    background: var(--gold-tint);
    color: var(--gold-dark);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    margin-bottom: 1.4rem;
}

.login-heading {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--navy-900);
    letter-spacing: -0.3px;
    margin-bottom: 0.35rem;
}

.login-subtext {
    font-size: 0.92rem;
    color: var(--gray-muted);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.3rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--navy-700);
    margin-bottom: 0.45rem;
}

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

.input-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    color: var(--gray-light);
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    padding: 0.85rem 1.1rem 0.85rem 2.7rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-soft);
    border-radius: 14px;
    background-color: #fff;
    color: var(--navy-900);
    font-weight: 500;
    font-family: inherit;
    transition: all 0.25s ease-in-out;
}

.input-wrap input#password {
    padding-right: 2.7rem;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12);
}

.input-wrap input::placeholder {
    color: #9C9A94;
    font-weight: 400;
}

.toggle-password {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.2rem;
    color: var(--gray-light);
    cursor: pointer;
    line-height: 0;
    transition: color 0.25s ease-in-out;
}

.toggle-password:hover {
    color: var(--navy-700);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--gray-light);
    margin-top: 0.45rem;
}

.field-error {
    display: none;
    color: #B0362A;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.6rem;
    animation: toastIn 0.35s ease-out;
}

.options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1.75rem 0;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--navy-700);
    font-weight: 500;
    font-size: 0.85rem;
}

.checkbox-label input {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--gold-dark);
}

.forgot-link {
    color: var(--gold-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s ease-in-out;
    border-bottom: 1px dotted transparent;
}

.forgot-link:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    background: #1A1A1A;
    border: none;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 10px 20px -6px rgba(0, 0, 0, 0.35);
    transition: all 0.25s;
}

.btn-primary:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 14px 26px -6px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.85;
    cursor: not-allowed;
}

.btn-primary:disabled:hover {
    transform: none;
}

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

.btn-primary:disabled .btn-spinner {
    display: inline-block;
}

.btn-primary:disabled .btn-arrow {
    display: none;
}

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

.login-divider {
    height: 1px;
    background: var(--border-soft);
    margin: 2.4rem 0 1.3rem 0;
}

.helpdesk-footer {
    text-align: center;
    font-size: 0.85rem;
}

.helpdesk-footer p {
    color: var(--gray-muted);
    font-weight: 500;
}

.support-link {
    color: var(--gold-dark);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px dashed rgba(150, 112, 10, 0.35);
    transition: all 0.2s;
}

.support-link:hover {
    color: var(--gold);
    border-bottom-style: solid;
    border-bottom-color: var(--gold);
}

.support-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    vertical-align: middle;
}
.support-link-icon { flex-shrink: 0; }

.copyright {
    font-size: 0.72rem;
    color: var(--gray-light);
    font-weight: 400;
    margin-top: 0.4rem;
}

form {
    margin: 0;
    width: 100%;
}

.input-wrap input:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.checkbox-label input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

.toggle-password:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 6px;
}

.forgot-link:focus-visible,
.support-link:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 3px;
}

.btn-primary:focus-visible {
    outline: 2px solid var(--navy-900);
    outline-offset: 3px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 1000;
    background: rgba(8, 20, 32, 0.6);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.is-open {
    opacity: 1;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 30px 60px -20px rgba(10, 30, 48, 0.35), 0 10px 24px rgba(10, 30, 48, 0.12);
    padding: 2.2rem 2rem 2rem;
    text-align: center;
    transform: scale(0.94) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.modal-overlay.is-open .modal-card {
    transform: scale(1) translateY(0);
}

.modal-card:focus {
    outline: none;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--off-white);
    color: var(--gray-muted);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: #ece8de;
    color: var(--navy-900);
}

.modal-close:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    background: var(--gold-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.modal-icon { color: var(--gold-dark); }
.modal-icon--success { background: #e3f6ea; color: #1f8f4e; }

.modal-icon--image img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy-900);
    letter-spacing: -0.2px;
    margin-bottom: 0.6rem;
}

.modal-body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--gray-muted);
    margin-bottom: 1.7rem;
}

.modal-body p + p {
    margin-top: 0.5rem;
}

.modal-body a {
    color: var(--gold-dark);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(150, 112, 10, 0.35);
}

.modal-body a:hover {
    color: var(--gold);
    border-bottom-style: solid;
    border-bottom-color: var(--gold);
}

.modal-body a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 3px;
}

.fp-card {
    max-width: 440px;
}

.fp-steps[hidden] {
    display: none;
}

.fp-steps {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.2rem 0 1.4rem;
}

.fp-step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-light);
    white-space: nowrap;
}

.fp-step + .fp-step::before {
    content: "";
    width: 18px;
    height: 1.5px;
    background: var(--border-soft);
    margin-right: 0.1rem;
}

.fp-step span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--border-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-light);
    background: #fff;
}

.fp-step.is-active {
    color: var(--navy-900);
}

.fp-step.is-active span {
    background: var(--gold);
    border-color: var(--gold);
    color: #1A1A1A;
}

.fp-step.is-done {
    color: var(--gold-dark);
}

.fp-step.is-done span {
    background: var(--gold-tint);
    border-color: var(--gold-tint);
    color: var(--gold-dark);
}

.fp-lead {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--gray-muted);
    margin-bottom: 1.2rem;
}

.fp-lead strong {
    color: var(--navy-900);
    word-break: break-all;
}

.fp-code-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border-soft);
    border-radius: 14px;
    background: #fff;
    color: var(--navy-900);
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.6em;
    text-indent: 0.6em;
    text-align: center;
    transition: all 0.25s ease-in-out;
}

.fp-code-input::placeholder {
    color: #CFCDC6;
}

.fp-code-input:focus {
    outline: none;
    border-color: var(--gold-dark);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12);
}

.fp-secondary {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--gray-muted);
    line-height: 1.7;
}

.fp-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--gold-dark);
    cursor: pointer;
    border-bottom: 1px dashed rgba(150, 112, 10, 0.35);
}

.fp-link:hover:not(:disabled) {
    border-bottom-style: solid;
}

.fp-link:disabled {
    color: var(--gray-light);
    border-bottom-color: transparent;
    cursor: default;
}

.fp-link:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 3px;
}

.fp-done-text {
    margin-bottom: 1.5rem;
}

@media (max-width: 400px) {
    .fp-step {
        font-size: 0.66rem;
    }
    .fp-step + .fp-step::before {
        width: 10px;
    }
}

@media (max-width: 480px) {
    .modal-card {
        padding: 1.8rem 1.4rem 1.6rem;
        border-radius: 20px;
    }
}

@media (max-width: 900px) {
    .split-screen {
        flex-direction: column;
    }
    .brand-panel {
        flex: 0 0 auto;
        max-width: 100%;
        min-height: 0;
    }
    .brand-panel::before {
        background-position: center 35%;
    }
    .brand-panel__content {
        max-width: 100%;
        padding: 2rem 1.5rem 1.75rem;
    }
    .brand-seal {
        width: 92px;
        height: 92px;
        margin-bottom: 0.9rem;
    }
    .brand-tagline,
    .brand-mission,
    .brand-meta {
        display: none;
    }
    .brand-name {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    .form-panel {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

@media (max-width: 520px) {
    .brand-panel__content {
        padding: 1.75rem 1.25rem 1.5rem;
    }
    .brand-seal {
        width: 76px;
        height: 76px;
        margin-bottom: 0.75rem;
    }
    .brand-name {
        font-size: 1.3rem;
    }
    .form-panel {
        padding: 1.5rem 1rem;
    }
    .login-card {
        padding: 2.1rem 1.5rem 1.8rem 1.5rem;
        border-radius: 22px;
    }
    .login-heading {
        font-size: 1.45rem;
    }
}

@media (min-width: 521px) and (max-width: 900px) {
    .brand-panel__content {
        padding: 1.5rem 1.5rem 1.35rem;
    }
    .brand-seal {
        width: 74px;
        height: 74px;
        margin-bottom: 0.7rem;
    }
    .brand-name {
        font-size: 1.35rem;
    }
    .form-panel {
        align-items: flex-start;
        padding: 1.6rem 1.5rem 2rem;
    }
    .login-card {
        margin: auto 0;
        max-width: 460px;
        padding: 1.9rem 1.9rem 1.6rem 1.9rem;
    }
    .portal-badge {
        margin-bottom: 1rem;
    }
    .login-heading {
        font-size: 1.5rem;
    }
    .login-subtext {
        margin-bottom: 1.35rem;
    }
    .input-group {
        margin-bottom: 1rem;
    }
    .options-row {
        margin: 1.1rem 0 1.25rem 0;
    }
    .login-divider {
        margin: 1.6rem 0 1rem 0;
    }
}

@media (min-width: 901px) and (max-height: 820px) {
    .brand-panel__content {
        padding: 1.75rem;
    }
    .brand-seal {
        width: 108px;
        height: 108px;
        margin-bottom: 1rem;
    }
    .brand-name {
        font-size: clamp(1.45rem, 2.2vw, 2rem);
        margin-bottom: 0.8rem;
    }
    .brand-mission {
        margin-bottom: 1.2rem;
    }
    .form-panel {
        padding: 1.5rem;
    }
    .login-card {
        padding: 1.9rem 1.9rem 1.6rem 1.9rem;
    }
    .login-subtext {
        margin-bottom: 1.35rem;
    }
    .input-group {
        margin-bottom: 1rem;
    }
    .options-row {
        margin: 1.1rem 0 1.25rem 0;
    }
    .login-divider {
        margin: 1.6rem 0 1rem 0;
    }
}

.fp-test-note {
    margin: -0.4rem 0 1.1rem;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    background: #FFF3D1;
    color: #8A6D00;
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: left;
}
.fp-test-note[hidden] { display: none; }
.fp-test-note code { font-size: 0.72rem; }
