:root {
    --brand-primary: #0F1F3A;
    --brand-accent: #2DD4BF;
    --portal-surface: #f5f7fb;
    --portal-border: #e3e8f0;
    --portal-muted: #64748b;
    --portal-text: #1e293b;
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--portal-text);
    background: var(--portal-surface);
}

a { color: var(--brand-primary); }

h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 1rem; }

.portal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: var(--brand-primary); color: #fff; padding: 0.7rem 1.5rem;
}

.portal-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.portal-brand img { max-height: 36px; max-width: 180px; }

.portal-mark {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.5rem;
    background: var(--brand-accent); color: var(--brand-primary);
}

.portal-account { display: flex; align-items: center; gap: 0.9rem; }

.portal-language {
    background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.4rem; padding: 0.15rem 0.4rem;
}
.portal-language option { color: #000; }

.portal-menu { position: relative; }

.portal-initials {
    width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.6);
    background: var(--brand-accent); color: var(--brand-primary); font-weight: 700;
}

.portal-menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px;
    background: #fff; color: var(--portal-text); border: 1px solid var(--portal-border);
    border-radius: 0.6rem; box-shadow: 0 10px 30px rgba(15, 31, 58, 0.15); overflow: hidden;
}
.portal-menu-who { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--portal-border); }
.portal-menu-list form { margin: 0; }
.portal-menu-item { width: 100%; text-align: left; border: 0; background: #fff; padding: 0.6rem 0.9rem; }
.portal-menu-item:hover { background: var(--portal-surface); }

.portal-body { display: flex; min-height: calc(100vh - 56px); }

.portal-nav {
    width: 210px; flex-shrink: 0; padding: 1.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.2rem;
    border-right: 1px solid var(--portal-border); background: #fff;
}
.portal-nav a {
    display: block; padding: 0.55rem 0.8rem; border-radius: 0.45rem; color: var(--portal-text);
    text-decoration: none; font-weight: 500;
}
.portal-nav a.active {
    background: color-mix(in srgb, var(--brand-accent) 18%, white);
    box-shadow: inset 3px 0 0 var(--brand-accent);
}

.portal-main { flex: 1; min-width: 0; padding: 1.75rem; max-width: 1200px; }

.portal-empty {
    background: #fff; border: 1px dashed var(--portal-border); border-radius: 0.75rem;
    padding: 2.5rem 1rem; text-align: center; color: var(--portal-muted);
}

.portal-back { display: inline-block; margin-bottom: 0.75rem; font-size: 0.875rem; text-decoration: none; }

.portal-button, .btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.25rem; }

.course-card {
    display: flex; flex-direction: column; background: #fff; border: 1px solid var(--portal-border);
    border-radius: 0.8rem; overflow: hidden; box-shadow: 0 2px 6px rgba(15, 31, 58, 0.05);
}
.course-card-head {
    background: var(--brand-primary); color: #fff; padding: 1.1rem 1rem; min-height: 92px;
    display: flex; align-items: flex-end;
}
.course-card-head h2 { font-size: 1.05rem; font-weight: 650; margin: 0; }
.course-card-body { padding: 0.9rem 1rem; flex: 1; }
.course-card-body dl {
    display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem;
    margin: 0.7rem 0 0.4rem; font-size: 0.875rem;
}
.course-card-body dt { color: var(--portal-muted); font-weight: 500; }
.course-card-body dd { margin: 0; }
.course-card-body dd.overdue { color: #b91c1c; font-weight: 600; }
.course-minutes { font-size: 0.8rem; color: var(--portal-muted); }

.course-status {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem;
    font-weight: 700; background: #fef3c7; color: #92400e;
}
.course-status.progress { display: inline-block; height: auto; overflow: visible; background: #e0f2fe; color: #075985; }
.course-status.danger { background: #fee2e2; color: #991b1b; }

.attempts-banner {
    margin-top: 0.6rem; background: #fef3c7; color: #92400e; border-radius: 0.4rem;
    padding: 0.35rem 0.6rem; font-size: 0.8rem; font-weight: 600;
}
.attempts-banner.danger { background: #fee2e2; color: #991b1b; }

.course-card-button {
    display: block; text-align: center; background: var(--brand-accent); color: var(--brand-primary);
    font-weight: 700; padding: 0.65rem; text-decoration: none;
}
.course-card-scheduled {
    text-align: center; background: #f1f5f9; color: #475569; font-weight: 600; padding: 0.65rem;
}
.course-card-button:hover { filter: brightness(0.95); color: var(--brand-primary); }

.completed-list { display: flex; flex-direction: column; gap: 0.6rem; }
.completed-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center;
    background: #fff; border: 1px solid var(--portal-border); border-radius: 0.7rem; padding: 0.85rem 1rem;
}

.player { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.player-steps ol {
    list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--portal-border);
    border-radius: 0.7rem; overflow: hidden;
}
.player-step {
    display: flex; gap: 0.6rem; align-items: center; width: 100%; text-align: left; border: 0;
    border-bottom: 1px solid var(--portal-border); background: #fff; padding: 0.65rem 0.8rem;
}
.player-step.active { background: color-mix(in srgb, var(--brand-accent) 15%, white); }
.player-step:disabled { color: var(--portal-muted); }
.player-check {
    display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; flex-shrink: 0;
    border-radius: 50%; border: 2px solid var(--portal-border); font-size: 0.75rem; font-weight: 700;
}
.player-check.done { background: #16a34a; border-color: #16a34a; color: #fff; }
.player-content { background: #fff; border: 1px solid var(--portal-border); border-radius: 0.7rem; padding: 1.4rem 1.6rem; }
.player-content h2 { font-size: 1.25rem; font-weight: 650; }
.player-video { width: 100%; border-radius: 0.5rem; background: #000; }
.player-text { line-height: 1.7; max-width: 720px; }
.player-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }
.player-question { border: 1px solid var(--portal-border); border-radius: 0.6rem; padding: 0.8rem 1rem; margin-bottom: 0.9rem; }
.player-question legend { font-size: 1rem; font-weight: 600; float: none; width: auto; padding: 0 0.3rem; }
.player-result { border-radius: 0.6rem; padding: 1.2rem 1.4rem; }
.player-result.pass { background: #dcfce7; }
.player-result.fail { background: #fef3c7; }

.company-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.company-table { background: #fff; border: 1px solid var(--portal-border); }

.portal-sign-in {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
    background: linear-gradient(160deg, #0F1F3A 0%, #183056 100%);
}
.portal-sign-in-card {
    width: 100%; max-width: 440px; background: #fff; border-radius: 1rem; padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.portal-sign-in-card:has(.certificate) { max-width: 1060px; padding: 1.25rem; }

.dev-signin { border: 1px dashed #cbd5e1; border-radius: 0.75rem; padding: 0.9rem; }
.demo-account {
    display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left;
    background: #fff; border: 1px solid var(--portal-border); border-radius: 0.5rem;
    padding: 0.5rem 0.8rem; margin-bottom: 0.4rem;
}


@media print {
    .no-print { display: none; }
    .portal-sign-in { background: #fff; min-height: auto; }
    .portal-sign-in-card { box-shadow: none; max-width: none; }
}

@media (max-width: 760px) {
    .portal-body, .player { display: block; }
    .portal-nav { width: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--portal-border); padding: 0.5rem; }
    .player-steps { margin-bottom: 1rem; }
    .completed-row { grid-template-columns: 1fr; }
    .portal-greeting { display: none; }
}

#blazor-error-ui { background: #fef3c7; bottom: 0; display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.player-document { width: 100%; height: 70vh; border: 1px solid #e3e8ef; border-radius: 0.5rem; background: #fff; }
.player-acknowledge { margin-top: 1rem; padding: 0.75rem 1rem; border: 1px solid #e3e8ef; border-radius: 0.5rem; background: #f8fafc; }
.player-resources { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e3e8ef; }

/* Help */
.help-list { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.help-card { display: block; padding: 0.9rem 1rem; border: 1px solid var(--bs-border-color); border-radius: 0.75rem; background: var(--bs-body-bg); color: inherit; text-decoration: none; }
.help-card:hover { border-color: var(--bs-primary); }
.help-article { max-width: 46rem; line-height: 1.6; }
.help-article h2 { font-size: 1.15rem; margin-top: 1.5rem; }
.help-article table { width: 100%; margin: 0.75rem 0; border-collapse: collapse; }
.help-article th, .help-article td { border-bottom: 1px solid var(--bs-border-color); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
.help-article blockquote { margin: 1rem 0; padding: 0.6rem 0.9rem; border-left: 4px solid var(--bs-warning); background: var(--bs-warning-bg-subtle); border-radius: 0.25rem; }
.help-article blockquote p:last-child { margin-bottom: 0; }

/* First-visit guide on To complete */
.welcome-steps { background: #fff; border: 1px solid var(--portal-border); border-left: 4px solid var(--bs-primary); border-radius: 0.75rem; padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.welcome-steps h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.welcome-steps ol { margin-bottom: 0.5rem; padding-left: 1.25rem; }

/* Completion certificate: cream paper, a double frame in the MSP's colours, corner diamonds and a seal. */
.certificate {
    --cert-paper: #fbf8f1; --cert-ink: #3f4a55;
    position: relative; aspect-ratio: 11 / 8.5; background: var(--cert-paper); color: var(--cert-ink);
    border: 12px solid var(--brand-primary); padding: 10px; text-align: center;
    font-family: Cambria, Georgia, "Times New Roman", serif;
}
.cert-inner {
    position: relative; height: 100%; border: 2px solid var(--brand-accent); outline: 1px solid var(--brand-accent); outline-offset: -8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.2rem 3rem 1.4rem;
}
.cert-corner { position: absolute; width: 26px; height: 26px; background: var(--brand-accent); transform: rotate(45deg); z-index: 1; }
.cert-corner.tl { top: -19px; left: -19px; } .cert-corner.tr { top: -19px; right: -19px; }
.cert-corner.bl { bottom: -19px; left: -19px; } .cert-corner.br { bottom: -19px; right: -19px; }
.cert-logo { max-height: 44px; margin-bottom: 0.6rem; }
.cert-orgs { font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--brand-primary); }
.cert-orgs span { margin: 0 0.9rem; }
.cert-label { font-family: system-ui, sans-serif; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.55em; text-transform: uppercase; color: var(--brand-accent); margin-top: 1.1rem; }
.cert-course { font-size: clamp(1.8rem, 4vw, 2.9rem); font-weight: 700; color: var(--brand-primary); margin: 0.6rem 0 0.4rem; line-height: 1.15; }
.cert-presented { font-style: italic; font-size: 1.1rem; color: #6b7280; margin-top: 0.6rem; }
.cert-name { font-size: clamp(2rem, 4.5vw, 3rem); color: var(--brand-primary); opacity: 0.9; padding: 0.3rem 3rem 0.4rem; border-bottom: 1px solid #9aa4ad; margin: 0.4rem 0 0.9rem; min-width: 60%; }
.cert-text { font-family: system-ui, sans-serif; font-size: 1rem; max-width: 46rem; margin-bottom: 0.9rem; }
.cert-stars { display: flex; gap: 0.6rem; margin-bottom: 0.4rem; }
.cert-stars svg { width: 34px; height: 34px; fill: #e5e1d8; }
.cert-stars svg.on { fill: var(--brand-accent); }
.cert-date { font-family: system-ui, sans-serif; font-size: 0.85rem; color: #6b7280; }
.cert-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 2rem; width: 100%; margin-top: 0.6rem; }
.cert-sign { border-top: 1px solid var(--cert-ink); padding-top: 0.4rem; font-family: system-ui, sans-serif; font-size: 0.85rem; display: flex; flex-direction: column; margin-bottom: 1.4rem; }
.cert-sign small { color: #6b7280; }
.cert-seal svg { width: 112px; height: 140px; display: block; }
.cert-seal .ring { fill: var(--brand-accent); }
.cert-seal .core { fill: var(--brand-primary); }
.cert-seal .ribbon { fill: var(--brand-primary); opacity: 0.85; }
.cert-seal .cap { fill: var(--brand-accent); }
.cert-seal .tassel { stroke: var(--brand-accent); stroke-width: 3; fill: none; }
.cert-foot { font-style: italic; font-size: 0.8rem; color: #6b7280; margin-top: 0.4rem; }

/* Printing: the certificate keeps its screen size and is scaled to fit one landscape page, corner
   diamonds included, so it never spills onto extra pages. */
@media print {
    @page { size: letter landscape; margin: 0.35in; }
    html, body { margin: 0; padding: 0; background: #fff; }
    .portal-sign-in:has(.certificate) { display: block; min-height: 0; padding: 0; background: #fff; }
    .portal-sign-in-card:has(.certificate) { padding: 0; margin: 0; border-radius: 0; box-shadow: none; max-width: none; width: auto; }
    .certificate {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
        box-sizing: border-box; width: 1020px; aspect-ratio: 11 / 8.5; margin: 22px auto 0;
        zoom: 0.88; break-inside: avoid; page-break-inside: avoid;
    }
}

.my-account { max-width: 28rem; }
.portal-menu-list a.portal-menu-item { display: block; text-decoration: none; color: inherit; }

/* Save and error messages sit in a compact bar at the top, so they never push the page down. */
.portal-main .alert-success,
.portal-main .alert-danger {
    position: fixed;
    top: 0.6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    width: max-content;
    max-width: min(720px, 92vw);
    max-height: 40vh;
    overflow: auto;
    margin: 0;
    padding: 0.45rem 2rem 0.45rem 0.9rem;
    box-shadow: 0 6px 20px rgba(15, 31, 58, 0.18);
    cursor: pointer;
}

.portal-main .alert-success::after,
.portal-main .alert-danger::after {
    content: "×";
    position: absolute;
    top: 0.3rem;
    right: 0.7rem;
    font-size: 1.1rem;
    line-height: 1.2;
}

.notice-hidden {
    display: none !important;
}

.view-as-banner {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
}
