/* Kids4Health design system
   Used by the public site, respondent sign-in, the assessment runner and account pages.
   The admin back office uses MudBlazor with a theme built from the same tokens (see Admin/K4hTheme.cs). */

@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand */
    --k4h-navy: #16324F;
    --k4h-navy-700: #0F2438;
    --k4h-teal: #0E7C86;
    --k4h-teal-600: #0B6670;
    --k4h-teal-50: #E8F5F5;
    --k4h-teal-100: #CDEBEA;
    --k4h-coral: #F4845F;
    --k4h-coral-50: #FEF0EB;

    /* Neutrals */
    --k4h-ink: #1C2B39;
    --k4h-muted: #5B6B7B;
    --k4h-line: #DCE3EA;
    --k4h-surface: #FFFFFF;
    --k4h-bg: #F5F8FA;

    /* Status */
    --k4h-success: #1E8E5A;
    --k4h-success-50: #E7F5EE;
    --k4h-warning: #B26A00;
    --k4h-warning-50: #FFF4E0;
    --k4h-danger: #C0392B;
    --k4h-danger-50: #FCECEA;

    --k4h-radius: 12px;
    --k4h-radius-sm: 8px;
    --k4h-shadow: 0 1px 2px rgba(22, 50, 79, .06), 0 4px 16px rgba(22, 50, 79, .06);
    --k4h-shadow-lg: 0 10px 40px rgba(22, 50, 79, .12);
    --k4h-font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --k4h-max: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--k4h-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--k4h-ink);
    background: var(--k4h-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--k4h-navy); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 3vw + 1rem, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 1.5vw + 1rem, 1.85rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
h1:focus { outline: none; }
p { margin: 0 0 1em; }
a { color: var(--k4h-teal); text-underline-offset: 2px; }
a:hover { color: var(--k4h-teal-600); }
small, .text-muted { color: var(--k4h-muted); }
.lead { font-size: 1.15rem; color: var(--k4h-muted); }

:focus-visible { outline: 3px solid var(--k4h-coral); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--k4h-max); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; }
.stack > * + * { margin-top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--k4h-navy); color: #fff; padding: 8px 14px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ---------- Site header ---------- */
.site-header {
    background: var(--k4h-surface);
    border-bottom: 1px solid var(--k4h-line);
    position: sticky; top: 0; z-index: 20;
}
.site-header .container { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 40px; width: auto; display: block; }
.site-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.site-nav a {
    color: var(--k4h-ink); text-decoration: none; font-weight: 600; font-size: .95rem;
    padding: 8px 12px; border-radius: 8px;
}
.site-nav a:hover { background: var(--k4h-teal-50); color: var(--k4h-teal-600); }
.site-nav a.active { color: var(--k4h-teal); background: var(--k4h-teal-50); }
.site-nav .btn { margin-left: 8px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--k4h-line); border-radius: 8px; padding: 6px; line-height: 0; color: var(--k4h-navy); cursor: pointer; }
.nav-toggle:hover { background: var(--k4h-teal-50); color: var(--k4h-teal-600); }
.nav-toggle-close, .site-header.open .nav-toggle-open { display: none; }
.site-header.open .nav-toggle-close { display: inline; }

@media (max-width: 860px) {
    .nav-toggle { display: inline-block; }
    .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .site-header .container { flex-wrap: wrap; }
    .site-header.open .site-nav { display: flex; }
    .site-nav .btn { margin: 8px 0 0; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--k4h-navy); color: #C9D6E2; margin-top: 64px; padding: 48px 0 28px; font-size: .92rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { color: #fff; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 6px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 32px; padding-top: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(244,132,95,.18), transparent 60%),
        linear-gradient(135deg, #0B5E73 0%, #0E7C86 55%, #16A3A0 100%);
    color: #fff; padding: 72px 0 88px;
}
.hero h1 { color: #fff; max-width: 15ch; }
.hero .lead { color: rgba(255,255,255,.88); max-width: 52ch; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.hero-card { background: #fff; color: var(--k4h-ink); border-radius: 16px; box-shadow: var(--k4h-shadow-lg); padding: 28px; }
.hero-card h2 { font-size: 1.25rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 48px 0 56px; } }

.page-header { background: var(--k4h-surface); border-bottom: 1px solid var(--k4h-line); padding: 40px 0 32px; }
.page-header .lead { margin: 0; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--k4h-coral); margin-bottom: 8px; }
.hero .eyebrow { color: #FFD3C2; }

.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }

/* ---------- Cards and grids ---------- */
.card {
    background: var(--k4h-surface); border: 1px solid var(--k4h-line); border-radius: var(--k4h-radius);
    box-shadow: var(--k4h-shadow); padding: 24px;
}
.card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.icon-badge {
    width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center;
    background: var(--k4h-teal-50); color: var(--k4h-teal); flex: none;
}
.icon-badge svg { width: 22px; height: 22px; }
.icon-badge.coral { background: var(--k4h-coral-50); color: #D2603A; }
.icon-badge.navy { background: #E6ECF3; color: var(--k4h-navy); }

.choice-card {
    display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.choice-card:hover { border-color: var(--k4h-teal); box-shadow: var(--k4h-shadow-lg); transform: translateY(-2px); color: inherit; }
.choice-card h3 { margin-bottom: 4px; }
.choice-card p { margin: 0; color: var(--k4h-muted); font-size: .95rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 700; font-size: .95rem; line-height: 1;
    padding: 12px 20px; border-radius: 10px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-primary { background: var(--k4h-teal); color: #fff; }
.btn-primary:hover { background: var(--k4h-teal-600); color: #fff; }
.btn-accent { background: var(--k4h-coral); color: #3A1206; }
.btn-accent:hover { background: #EF7046; color: #3A1206; }
.btn-light { background: #fff; color: var(--k4h-navy); }
.btn-light:hover { background: var(--k4h-teal-50); color: var(--k4h-navy); }
.btn-outline { background: #fff; color: var(--k4h-navy); border-color: var(--k4h-line); }
.btn-outline:hover { border-color: var(--k4h-teal); color: var(--k4h-teal); }
.btn-ghost { background: transparent; color: var(--k4h-teal); padding-left: 8px; padding-right: 8px; }
.btn-danger { background: var(--k4h-danger); color: #fff; }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--k4h-teal); cursor: pointer; text-decoration: underline; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.actions.between { justify-content: space-between; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr; } }
.field label, .form-label { display: block; font-weight: 650; font-size: .92rem; margin-bottom: 6px; color: var(--k4h-navy); }
.field .hint { display: block; font-size: .85rem; color: var(--k4h-muted); margin-top: 4px; }
.form-control, .form-select, input[type=text].form-control, input[type=password].form-control {
    width: 100%; font: inherit; font-size: 1rem; color: var(--k4h-ink);
    padding: 11px 14px; border: 1px solid #C7D2DC; border-radius: 10px; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--k4h-teal); box-shadow: 0 0 0 4px rgba(14,124,134,.15); }
textarea.form-control { min-height: 110px; resize: vertical; }
.form-check { display: flex; gap: 10px; align-items: flex-start; }
.form-check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--k4h-teal); }
.validation-message, .field-error { color: var(--k4h-danger); font-size: .86rem; margin-top: 4px; display: block; }
.validation-errors { margin: 0 0 16px; padding: 12px 16px 12px 36px; background: var(--k4h-danger-50); border-radius: 10px; color: var(--k4h-danger); }
.invalid { border-color: var(--k4h-danger) !important; }
.text-danger { color: var(--k4h-danger); }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; padding: 14px 16px; border: 1px solid transparent; display: flex; gap: 12px; align-items: flex-start; }
.alert > :last-child { margin-bottom: 0; }
.alert-info { background: var(--k4h-teal-50); border-color: var(--k4h-teal-100); color: #0A4F57; }
.alert-success { background: var(--k4h-success-50); border-color: #BFE3D0; color: #135C3B; }
.alert-warning { background: var(--k4h-warning-50); border-color: #F4D9A6; color: #6E4100; }
.alert-danger { background: var(--k4h-danger-50); border-color: #F2C3BD; color: #8A2A1F; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--k4h-line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--k4h-muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ---------- Respondent / assessment shell ---------- */
.assess-shell { min-height: 100vh; display: flex; flex-direction: column; }
.assess-header { background: #fff; border-bottom: 1px solid var(--k4h-line); }
.assess-header .container { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.assess-header .brand img { height: 34px; }
.assess-header .who { margin-left: auto; font-size: .9rem; color: var(--k4h-muted); text-align: right; }
.assess-main { flex: 1; padding: 32px 0 48px; }

.progress { margin: 0 0 24px; }
.progress-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--k4h-muted); font-weight: 600; margin-bottom: 8px; }
.progress-track { height: 8px; background: #E3EAF0; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--k4h-teal), #16A3A0); border-radius: 99px; transition: width .3s; }

.save-status { font-size: .85rem; color: var(--k4h-muted); display: inline-flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--k4h-success); }
.save-status[data-state=saving]::before { background: var(--k4h-warning); }
.save-status[data-state=error]::before { background: var(--k4h-danger); }

.instructions { background: var(--k4h-teal-50); border-left: 4px solid var(--k4h-teal); border-radius: 0 10px 10px 0; padding: 14px 18px; margin-bottom: 20px; }
.instructions > :last-child { margin-bottom: 0; }

.question-group { margin-bottom: 28px; }
.question-group > h2 { font-size: 1.15rem; margin-bottom: 4px; }

.q-item { background: #fff; border: 1px solid var(--k4h-line); border-radius: var(--k4h-radius); padding: 16px 18px; margin-bottom: 12px; }
.q-item.missing { border-color: var(--k4h-danger); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.q-item legend, .q-text { font-weight: 600; color: var(--k4h-ink); padding: 0; margin-bottom: 12px; display: flex; gap: 10px; }
.q-item fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-num { color: var(--k4h-teal); font-weight: 800; min-width: 1.8em; }

/* Response scale as segmented pills */
.scale { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.scale label {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; min-height: 52px; padding: 8px 6px; border: 1px solid #C7D2DC; border-radius: 10px;
    cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--k4h-ink); background: #fff;
    transition: border-color .12s, background-color .12s, color .12s;
}
.scale label:hover { border-color: var(--k4h-teal); }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale input:focus-visible + span { outline: 3px solid var(--k4h-coral); outline-offset: 4px; border-radius: 4px; }
.scale label:has(input:checked) { background: var(--k4h-teal); border-color: var(--k4h-teal); color: #fff; }
.scale .val { font-size: .75rem; opacity: .7; font-weight: 700; }
@media (max-width: 640px) {
    .scale { grid-auto-flow: row; grid-auto-columns: auto; }
    .scale label { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 46px; padding: 10px 14px; text-align: left; }
}

.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check-list label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #C7D2DC; border-radius: 10px; cursor: pointer; background: #fff; font-weight: 500; }
.check-list label:has(input:checked) { border-color: var(--k4h-teal); background: var(--k4h-teal-50); }
.check-list input { width: 18px; height: 18px; accent-color: var(--k4h-teal); }

.assess-nav { position: sticky; bottom: 0; background: rgba(245,248,250,.94); backdrop-filter: blur(6px); border-top: 1px solid var(--k4h-line); padding: 14px 0; margin-top: 24px; }
.assess-nav .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--k4h-line); }

.done-hero { text-align: center; padding: 24px 0; }
.done-hero .check { width: 72px; height: 72px; border-radius: 50%; background: var(--k4h-success-50); color: var(--k4h-success); display: inline-grid; place-items: center; margin-bottom: 16px; }

.timeout-warning { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 50; max-width: 520px; width: calc(100% - 32px); box-shadow: var(--k4h-shadow-lg); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-card .logo img { height: 44px; }

/* ---------- Misc ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--k4h-teal-50); color: var(--k4h-teal-600); }
.badge-coral { background: var(--k4h-coral-50); color: #B4471F; }
.divider { border: 0; border-top: 1px solid var(--k4h-line); margin: 24px 0; }
.region-list h3 { margin-top: 24px; padding-bottom: 6px; border-bottom: 2px solid var(--k4h-teal-100); }
.clinic { padding: 12px 0; border-bottom: 1px solid var(--k4h-line); }
.clinic strong { color: var(--k4h-navy); }
.clinic-description { margin-top: 6px; font-size: .95rem; }
.clinic-description p, .clinic-description div { margin: 0 0 .4em; }
.clinic-description ul, .clinic-description ol { margin: 0 0 .4em; padding-left: 1.4em; }

#blazor-error-ui {
    background: var(--k4h-warning-50); color: #6E4100; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 3rem .7rem 1.25rem; position: fixed; width: 100%;
    z-index: 2000; /* above the staff portal's menu drawer, which otherwise hid the start of the message */
}
#blazor-error-ui .reload { font-weight: 700; margin-left: .5rem; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media print {
    .site-header, .site-footer, .assess-nav, .no-print { display: none !important; }
    body { background: #fff; }
}

/* ---------- Account (Identity) pages: maps the template's utility classes onto the design system ---------- */
.account-page { max-width: 980px; margin: 0 auto; padding: 40px 20px 24px; }
.account-page h1 { font-size: 1.8rem; }
.account-page h2 { font-size: 1.15rem; color: var(--k4h-muted); font-weight: 600; }
.account-page h3 { font-size: 1.1rem; }
.account-page hr { border: 0; border-top: 1px solid var(--k4h-line); margin: 16px 0; }
.account-page .row { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.account-page section, .account-page .account-card { background: #fff; border: 1px solid var(--k4h-line); border-radius: var(--k4h-radius); box-shadow: var(--k4h-shadow); padding: 28px; }
.account-page .col-md-4, .account-page .col-lg-6, .account-page .col-xl-6, .account-page .col-lg-4 { max-width: 520px; }
.form-floating { display: flex; flex-direction: column-reverse; margin-bottom: 16px; }
.form-floating > .form-label { margin-bottom: 6px; font-weight: 650; font-size: .92rem; color: var(--k4h-navy); }
.mb-3 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.w-100 { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.text-secondary { color: var(--k4h-muted); }
.checkbox label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-check-input { width: 18px; height: 18px; accent-color: var(--k4h-teal); }
.list { padding-left: 20px; }
.recovery-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; background: var(--k4h-teal-50); padding: 2px 8px; border-radius: 6px; margin-right: 6px; display: inline-block; margin-bottom: 6px; }
.glyphicon { display: none; }
.manage-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.manage-nav { display: flex; flex-direction: column; gap: 4px; list-style: none; padding: 10px; margin: 0; background: #fff; border: 1px solid var(--k4h-line); border-radius: var(--k4h-radius); }
.manage-nav .nav-link { display: block; padding: 10px 12px; border-radius: 8px; color: var(--k4h-ink); text-decoration: none; font-weight: 600; font-size: .94rem; }
.manage-nav .nav-link:hover { background: var(--k4h-teal-50); }
.manage-nav .nav-link.active { background: var(--k4h-teal); color: #fff; }
@media (max-width: 760px) { .manage-grid { grid-template-columns: 1fr; } }
.site-nav a.btn-primary, .site-nav a.btn-primary:hover { color: #fff; }
.site-nav a.btn-primary:hover { background: var(--k4h-teal-600); }
.k4h-icon { flex: none; display: inline-block; vertical-align: -0.15em; }
.alert > .k4h-icon { margin-top: 2px; }
