:root {
    --navy: #0b1f5e;
    --blue: #2478ff;
    --blue-soft: #eaf2ff;
    --text: #17233f;
    --muted: #6d7890;
    --border: #dfe6f1;
    --surface: #ffffff;
    --background: #f4f7fc;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.portal-shell { min-height: 100vh; padding-bottom: 72px; }
.portal-header {
    height: 76px; padding: 0 max(24px, calc((100% - 1120px) / 2)); background: #fff;
    border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
}
.portal-brand img { display: block; width: 190px; height: 54px; object-fit: contain; }
.portal-user { display: flex; align-items: center; gap: 18px; color: var(--navy); font-weight: 700; }
.link-button { padding: 0; color: var(--blue); background: none; border: 0; cursor: pointer; }
.portal-content { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0; }
.mobile-navigation {
    position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; height: 66px; padding: 0 20px;
    background: #fff; border-top: 1px solid var(--border); display: flex; justify-content: center; gap: 8px;
}
.mobile-navigation a { min-width: 130px; padding: 21px 18px; color: var(--muted); text-align: center; font-size: .88rem; font-weight: 700; }
.mobile-navigation a.active { color: var(--blue); border-top: 3px solid var(--blue); padding-top: 18px; }

.welcome-heading, .page-heading { margin-bottom: 30px; }
.welcome-heading h1, .page-heading h1 { margin: 4px 0 7px; color: var(--navy); font-size: clamp(2rem, 5vw, 3rem); }
.welcome-heading p, .page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 20px; }
.feature-card {
    min-height: 190px; padding: 26px; background: #fff; border: 1px solid var(--border); border-radius: 20px;
    box-shadow: 0 10px 35px rgba(11, 31, 94, .05); display: flex; flex-direction: column; justify-content: flex-end;
}
.feature-card:hover { border-color: #a9c8ff; transform: translateY(-2px); }
.feature-card strong { margin: 12px 0 4px; color: var(--navy); font-size: 1.7rem; }
.feature-card span:last-child { color: var(--muted); font-size: .9rem; }
.primary-card { color: #fff; background: linear-gradient(135deg, var(--navy), #1257cd); border: 0; }
.primary-card strong, .primary-card span:last-child { color: #fff; }
.card-label { color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.primary-card .card-label { color: #9fc4ff; }

.document-list { display: grid; gap: 13px; }
.document-card { padding: 18px 20px; background: #fff; border: 1px solid var(--border); border-radius: 15px; display: flex; align-items: center; gap: 18px; }
.document-card:hover { border-color: #9fc4ff; box-shadow: 0 8px 25px rgba(11, 31, 94, .06); }
.document-period { width: 56px; height: 56px; color: #fff; background: var(--navy); border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.document-period strong { font-size: 1.15rem; }
.document-period span { font-size: .68rem; }
.document-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.document-info strong { color: var(--navy); }
.document-info span { color: var(--muted); font-size: .88rem; }
.document-action, .back-link { color: var(--blue); font-weight: 700; }

.actions-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.payslip-document { padding: 36px; background: #fff; border: 1px solid var(--border); border-radius: 18px; }
.payslip-header { padding-bottom: 24px; border-bottom: 2px solid var(--navy); display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.payslip-header div { display: flex; flex-direction: column; gap: 5px; }
.payslip-header span, .payslip-header small { color: var(--muted); }
.payslip-header strong { color: var(--navy); font-size: 1.15rem; }
.payslip-meta { margin: 0; padding: 24px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.payslip-meta div { display: flex; flex-direction: column; gap: 5px; }
.payslip-meta dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.payslip-meta dd { margin: 0; font-weight: 700; }
.payslip-lines { padding-top: 18px; }
.payslip-lines > div { padding: 10px 0; display: flex; justify-content: space-between; }
.payslip-total { margin-top: 12px; padding: 20px !important; color: #fff; background: var(--navy); border-radius: 12px; font-size: 1.12rem; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 42%) 1fr; }
.auth-brand { padding: 54px; color: #fff; background: linear-gradient(145deg, #071a4e, #0b2d7a 65%, #176dff 140%); display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand img { width: min(100%, 390px); padding: 18px; background: #fff; border-radius: 16px; }
.auth-brand h1 { max-width: 450px; margin-bottom: 12px; font-size: clamp(2rem, 4vw, 3.2rem); }
.auth-brand p { max-width: 450px; color: #d8e5ff; }
.auth-content { padding: 36px; display: flex; align-items: center; justify-content: center; }
.auth-card { width: min(100%, 460px); padding: 38px; background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 55px rgba(7, 26, 78, .09); }
.auth-icon { width: 58px; height: 58px; border-radius: 14px; }
.auth-card h2 { margin: 20px 0 8px; color: var(--navy); }
.auth-card > p { margin: 0 0 26px; color: var(--muted); line-height: 1.55; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; margin-bottom: 7px; color: var(--navy); font-weight: 700; }
.form-field input { width: 100%; padding: 12px 13px; border: 1px solid #cbd5e4; border-radius: 9px; }
.form-field input:focus { outline: 3px solid #d7e6ff; border-color: var(--blue); }
.form-field small { display: block; margin-top: 6px; color: var(--muted); }
.checkbox-field { margin-bottom: 22px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.primary-button, .secondary-button { padding: 12px 18px; border-radius: 9px; font-weight: 800; cursor: pointer; }
.primary-button { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.secondary-button { color: var(--blue); background: #fff; border: 1px solid #a9c8ff; }
.full-width { width: 100%; }
.alert, .empty-card, .loading-card { margin: 20px 0; padding: 20px; border-radius: 12px; }
.alert.error { color: #8f1d2c; background: #fff0f2; border: 1px solid #f3c8cf; }
.empty-card, .loading-card { background: #fff; border: 1px solid var(--border); text-align: center; }
.empty-card { padding: 50px 24px; }
.empty-card h2 { color: var(--navy); }
.empty-card p { max-width: 570px; margin: 0 auto; color: var(--muted); }
.empty-icon { width: 70px; border-radius: 16px; }

@media (max-width: 800px) {
    .portal-header { height: 66px; padding: 0 18px; }
    .portal-brand img { width: 145px; }
    .portal-user > span { display: none; }
    .portal-content { width: min(100% - 28px, 1120px); padding: 28px 0; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .feature-card { min-height: 155px; }
    .mobile-navigation { justify-content: space-around; }
    .mobile-navigation a { min-width: 0; flex: 1; padding-right: 4px; padding-left: 4px; }
    .document-action { display: none; }
    .actions-heading { align-items: flex-start; flex-direction: column; }
    .payslip-document { padding: 22px 18px; }
    .payslip-header, .payslip-meta { grid-template-columns: 1fr 1fr; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-content { padding: 22px; }
    .auth-card { padding: 28px 24px; }
}

@media print {
    .portal-header, .mobile-navigation, .print-hidden, .back-link { display: none !important; }
    .portal-content { width: 100%; padding: 0; }
    .page-heading { margin-bottom: 20px; }
    .payslip-document { border: 0; }
}
