:root {
    color-scheme: light;
    --background: #fafafa;
    --surface: #ffffff;
    --text: #25313c;
    --muted: #64717d;
    --border: #dce2e7;
    --brand: #337ab7;
    --brand-dark: #286090;
    --accent: #ffc000;
    --accent-soft: #fffbd8;
    --success-bg: #e8f5ea;
    --success-text: #28713a;
    --danger-bg: #fbe8e7;
    --danger-text: #a43531;
    --shadow: 0 16px 38px rgba(28, 47, 63, .1);
}

* { box-sizing: border-box; }

body.portal-body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.portal-body h1, .portal-body h2, .portal-body h3, .portal-body p { margin-top: 0; }

.portal-header {
    border-top: 4px solid var(--accent);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.portal-header__content, .portal-main {
    width: min(1080px, calc(100% - 40px));
    margin: 0 auto;
}

.portal-header__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 0;
}

.portal-header h1 { margin-bottom: 4px; font-size: clamp(1.65rem, 3vw, 2.15rem); }
.portal-brand { display: flex; align-items: center; gap: 20px; }
.brand-logo { display: block; width: auto; object-fit: contain; }
.brand-logo--header { height: 76px; }
.brand-logo--login { height: 112px; max-width: 100%; margin: 0 auto 24px; }
.eyebrow { margin-bottom: 4px; color: #a67900; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.session-label { margin-bottom: 0; color: var(--muted); }
.portal-main { padding: 42px 0 64px; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin-bottom: 4px; font-size: 1.35rem; }
.section-heading p { margin-bottom: 0; color: var(--muted); }

.application-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px;
}

.application-card {
    display: flex;
    flex-direction: column;
    min-height: 270px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(28, 47, 63, .06);
}

.application-card__heading { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.application-card__heading h3 { margin-bottom: 0; font-size: 1.35rem; }
.application-icon {
    display: inline-grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 10px;
    color: #9b7200;
    border: 1px solid #f0dc87;
    background: var(--accent-soft);
    font-size: 1.25rem;
    font-weight: 700;
}

.application-description { flex: 1; color: var(--muted); }
.status-badge { display: inline-block; padding: 5px 10px; border-radius: 999px; color: var(--success-text); background: var(--success-bg); font-size: .82rem; font-weight: 700; }
.status-badge--maintenance { color: #895f00; background: #fff4cd; }
.status-badge--upcoming { color: #5f6972; background: #edf0f2; }

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button--primary { color: #fff; background: var(--brand); }
.button--primary:hover { background: var(--brand-dark); }
.button--secondary { color: var(--brand-dark); border-color: #b8cad5; background: #fff; }
.button--secondary:hover { background: #edf4f7; }
.button--card { width: 100%; margin-top: 10px; }
.button--disabled { color: #7c8790; border-color: var(--border); background: #edf0f2; cursor: not-allowed; }
.button:focus-visible, input:focus-visible { outline: 3px solid rgba(46, 125, 168, .28); outline-offset: 2px; }

.alert { padding: 12px 14px; border-radius: 6px; }
.alert--error { color: var(--danger-text); border: 1px solid #efc5c2; background: var(--danger-bg); }
.alert--info { color: var(--brand-dark); border: 1px solid #c9dde8; background: #eaf5fa; }

.portal-body--login { display: grid; place-items: center; padding: 32px 20px; border-top: 4px solid var(--accent); }
.login-shell { width: min(100%, 440px); }
.login-card { padding: 38px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 8px; font-size: 2rem; }
.intro { margin-bottom: 20px; color: var(--muted); }
.environment-note { padding: 10px 12px; border-radius: 6px; color: var(--success-text); background: var(--success-bg); font-size: .86rem; }
.environment-note span { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #4d9d5e; }
.login-form { display: grid; gap: 9px; margin-top: 22px; }
.login-form label { margin-top: 6px; font-size: .9rem; font-weight: 700; }
.login-form input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #b8c2ca; border-radius: 6px; background: #fff; font: inherit; }
.login-form .button { margin-top: 14px; }

@media (max-width: 600px) {
    .portal-header__content { align-items: flex-start; flex-direction: column; }
    .portal-header__content form, .portal-header__content .button { width: 100%; }
    .portal-main { padding-top: 30px; }
    .portal-brand { align-items: flex-start; }
    .brand-logo--header { height: 58px; }
    .login-card { padding: 28px 24px; }
}
