:root {
    color-scheme: light;
    --page-bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --text: #172135;
    --muted: #526078;
    --border: #dde4ee;
    --brand: #143f75;
    --brand-hover: #103864;
    --accent: #ffd75a;
    --input-bg: #ffffff;
    --shadow: rgb(31 53 82 / 8%);
    --content-width: 1080px;
    --page-gutter: 32px;
    --section-padding: 28px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--page-bg);
    font-synthesis: none;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #141414;
    --surface: #1f1f1f;
    --surface-soft: #292929;
    --text: #edf3fa;
    --muted: #b7c4d3;
    --border: #3b3b3b;
    --brand: #143f75;
    --brand-hover: #1b538f;
    --input-bg: #181818;
    --shadow: rgb(0 0 0 / 28%);
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        color-scheme: dark;
        --page-bg: #141414;
        --surface: #1f1f1f;
        --surface-soft: #292929;
        --text: #edf3fa;
        --muted: #b7c4d3;
        --border: #3b3b3b;
        --brand: #143f75;
        --brand-hover: #1b538f;
        --input-bg: #181818;
        --shadow: rgb(0 0 0 / 28%);
    }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--page-bg); }
.site-header { height: 72px; padding: 0 max(calc(var(--page-gutter) / 2), calc((100vw - var(--content-width)) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #fff; background: var(--brand); border-bottom: 1px solid var(--brand); }
.portal-title { color: #fff; font-weight: 800; text-decoration: none; }
.portal-title:hover { color: var(--accent); }
.theme-toggle { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; color: #fff; background: transparent; border: 1px solid rgb(255 255 255 / 45%); border-radius: 50%; }
.theme-toggle:hover { color: var(--accent); background: rgb(255 255 255 / 10%); }
.theme-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-auto path { fill: currentColor; stroke: none; }
.theme-light, .theme-dark { display: none; }
:root[data-theme="light"] .theme-auto, :root[data-theme="dark"] .theme-auto { display: none; }
:root[data-theme="light"] .theme-light { display: inline; }
:root[data-theme="dark"] .theme-dark { display: inline; }
.page-shell { width: min(var(--content-width), calc(100% - var(--page-gutter))); margin: 56px auto; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.4rem; }
.eyebrow { margin-bottom: 8px; color: #3368a5; font-weight: 750; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.lead, .muted { color: var(--muted); }
.lead { font-size: 1.1rem; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.summary-card, .report-card, .login-card { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 14px 36px var(--shadow); }
.summary-card { padding: 24px var(--section-padding); margin-bottom: 24px; }
.summary-number { margin-right: 8px; font-size: 2rem; font-weight: 800; }
.summary-card p { margin: 10px 0 0; color: var(--muted); }
.progress-track { height: 10px; margin-top: 16px; overflow: hidden; background: var(--border); border-radius: 999px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #1d5f9f, #2f8a70); border-radius: inherit; }
.report-heading { padding: 26px var(--section-padding) 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.trainee-id { padding: 8px 12px; color: #4c5d74; background: #eff3f8; border-radius: 999px; font-size: .86rem; font-weight: 700; }
.table-wrap { overflow-x: auto; border-radius: 0 0 18px 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 18px var(--section-padding); text-align: left; border-top: 1px solid var(--border); }
th { color: var(--muted); background: var(--surface-soft); font-size: .82rem; letter-spacing: .03em; text-transform: uppercase; }
.status { display: inline-flex; align-items: center; gap: 7px; min-width: 76px; font-weight: 750; }
.status span { width: 24px; height: 24px; display: inline-grid; place-items: center; color: #fff; border-radius: 50%; }
.complete { color: #1d6b52; }
.complete span { background: #218568; }
.incomplete { color: #a24444; }
.incomplete span { background: #bd5151; }
button { padding: 12px 18px; color: #fff; background: var(--brand); border: 0; border-radius: 9px; font: inherit; font-weight: 750; cursor: pointer; }
button:hover { background: var(--brand-hover); }
.button-link { margin-top: 22px; padding: 12px 18px; display: block; color: #fff; background: var(--brand); border-radius: 9px; font-weight: 750; text-align: center; text-decoration: none; }
.button-link:hover { color: var(--accent); background: var(--brand-hover); }
.reset-note { margin-top: 18px; font-size: .9rem; }
button.secondary { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.login-card { max-width: 440px; margin: 80px auto; padding: 36px; }
.login-card h1 { font-size: 2rem; }
.field { margin-top: 20px; }
label { display: block; margin-bottom: 7px; font-weight: 700; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; padding: 12px 13px; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.login-card button { width: 100%; margin-top: 24px; }
.account-links { margin-top: 20px; padding-top: 18px; display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); }
.account-links a, .text-link { color: #2467a9; font-weight: 700; text-decoration: none; }
.account-links a:hover, .text-link:hover { color: #174d82; text-decoration: underline; }
:root[data-theme="dark"] .account-links a, :root[data-theme="dark"] .text-link { color: #8fc2f0; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .account-links a, :root[data-theme="auto"] .text-link { color: #8fc2f0; } }
.primary-link { width: 100%; margin-top: 22px; padding: 12px 18px; display: block; color: #fff; background: var(--brand); border-radius: 9px; font-weight: 750; text-align: center; text-decoration: none; }
.primary-link:hover { color: var(--accent); background: var(--brand-hover); }
.form-errors { margin: 16px 0; color: #a24444; }
.password-help { color: var(--muted); font-size: .9rem; }
.password-help ul { padding-left: 20px; }
.alert { padding: 12px 14px; margin: 20px 0; color: #822f2f; background: #fff0f0; border: 1px solid #efc4c4; border-radius: 8px; }
.help-text { margin: 20px 0 0; padding-top: 18px; color: var(--muted); border-top: 1px solid var(--border); font-size: .85rem; }
.preview-banner { margin-bottom: 28px; padding: 16px var(--section-padding); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #573f08; background: #fff6d8; border: 1px solid #e4ca74; border-radius: 12px; }
.preview-banner strong, .preview-banner span { display: block; }
.preview-banner span { margin-top: 3px; font-size: .9rem; }
.preview-return { padding: 9px 12px; color: #40310d; background: #fff; border: 1px solid #d4b757; border-radius: 7px; font-weight: 700; text-decoration: none; white-space: nowrap; }

@media (max-width: 650px) {
    :root { --page-gutter: 24px; --section-padding: 16px; }
    .page-shell { margin-top: 32px; }
    .welcome-row { display: block; }
    .welcome-row form { margin-top: 18px; }
    .report-heading { align-items: flex-start; flex-direction: column; }
    th, td { padding-block: 14px; }
    .login-card { margin-top: 32px; padding: 26px; }
    .preview-banner { align-items: flex-start; flex-direction: column; }
    .account-links { align-items: flex-start; flex-direction: column; }
}
