.portal-header { position: sticky; top: 0; z-index: 8; display: flex; gap: 16px; align-items: center; min-height: 68px; background: white; border-bottom: 1px solid var(--line); padding: 10px var(--space); }
.account { margin-left: auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segment { font-weight: 670; color: var(--brand-deep); }
.icon-button, .quiet-button { border: 0; border-radius: 10px; padding: 8px 12px; min-width: 44px; min-height: 44px; font-weight: 650; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100dvh - 68px); }
#sidebar { position: sticky; top: 68px; height: calc(100dvh - 68px); padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
#navigation { display: grid; gap: 6px; }
.nav-item { display: flex; text-align: left; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; }
.nav-item:hover { background: var(--page); }
.nav-item[aria-current="page"] { font-weight: 730; color: var(--brand-deep); background: var(--accent); }
.nav-icon { display: inline-grid; place-items: center; min-width: 20px; font-size: 1.1rem; }
.compact .workspace { grid-template-columns: 70px minmax(0, 1fr); }
.compact .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#main { min-width: 0; width: min(100%, 1440px); margin-inline: auto; padding: var(--space); }
.signed-out .workspace { display: block; }
.signed-out #main { width: min(100%, 600px); padding-block: clamp(32px, 10vh, 110px); }
.panel, .activity, .question, .chart-panel { background: white; border: 1px solid var(--line); padding: var(--space); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel, .question + .question { margin-top: 14px; }
.page-heading { margin-bottom: var(--space); }
.page-heading p, .muted, small { color: var(--muted); }
.kicker { color: var(--brand-deep); font-weight: 750; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }
.notice:empty { display: none; }
.notice { margin-bottom: 12px; color: var(--attention); font-weight: 650; }
label { display: block; font-weight: 650; margin: .85rem 0 .35rem; }
input:not([type="checkbox"]), textarea, select { display: block; width: 100%; max-width: 760px; min-height: 44px; margin-top: .3rem; border: 1px solid #929fb8; border-radius: 8px; color: var(--ink); padding: .6rem .75rem; background: white; }
textarea { min-height: 105px; resize: vertical; }
input[type="checkbox"] { accent-color: var(--strong); }
form button, .primary-button { margin: .65rem .25rem .25rem 0; }
button:disabled { cursor: wait; opacity: .65; }
details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-top: 12px; background: white; }
summary { cursor: pointer; font-weight: 680; color: var(--brand-deep); }
details form, details p, .inbox-text { margin-top: 10px; overflow-wrap: anywhere; }
.private-note { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 12px; background: #e8edff; color: #243762; }
.private-note p { margin: 0; }
.score-list, .activities, .kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.score { border-left: 4px solid currentColor; padding: 12px; border-radius: 8px; }
.score strong, .score span { display: block; }
.strong { color: var(--strong); background: var(--strong-bg); }
.attention { color: var(--attention); background: var(--attention-bg); }
.alert { color: var(--alert); background: var(--alert-bg); }
.activity { padding: 20px; box-shadow: none; align-self: start; }
.activity h3 { margin-top: .5rem; }
.activity-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.activity-actions a { font-weight: 650; }
.complete { margin: 0; min-height: 44px; display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.complete input { appearance: none; position: relative; display: grid; place-items: center; width: 25px; height: 25px; margin: 0; border: 1px solid #74839e; background: #ecf0f7; border-radius: 6px; cursor: pointer; transition: background .2s, transform .2s; }
.complete input:checked { background: var(--strong); border-color: var(--strong); transform: scale(1.06); }
.complete input:checked::after { content: ""; width: 10px; height: 5px; border: solid white; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
progress { display: block; accent-color: var(--strong); width: 100%; margin-bottom: 20px; }
.chart-panel { margin: 16px 0; }
.chart-panel canvas { display: block; width: min(100%, 570px); height: auto; margin: auto; }
.kpi { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.kpi b { display: block; font-size: 1.8rem; color: var(--brand-deep); }
.chart-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 12px; align-items: center; margin: 10px 0; }
.bar-track { display: block; height: 12px; border-radius: 8px; background: var(--accent); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.heatmap { overflow-x: auto; }
.heatmap table { border-collapse: collapse; min-width: 500px; width: 100%; text-align: left; }
.heatmap th, .heatmap td { padding: .6rem; border-bottom: 1px solid var(--line); }
.inbox-text { white-space: pre-wrap; }
@media (max-width: 760px) {
  .workspace, .compact .workspace { display: block; }
  #sidebar { position: fixed; top: 68px; bottom: 0; left: 0; z-index: 7; width: min(275px, 85vw); visibility: hidden; transform: translateX(-100%); transition: transform .25s, visibility .25s; }
  .menu-open #sidebar { visibility: visible; transform: none; }
  .compact .nav-label { position: static; width: auto; height: auto; clip-path: none; }
  .overlay { position: fixed; z-index: 6; inset: 68px 0 0; border: 0; background: #17234890; }
  .account { display: none; }
  #exit { margin-left: auto; }
}
.plan-chart { display: flex; align-items: center; gap: 18px; }
.plan-chart p { margin: 0; }
.plan-ring { flex: 0 0 76px; height: 76px; border-radius: 50%; background: conic-gradient(var(--strong) var(--share), var(--accent) 0); display: grid; place-items: center; }
.plan-ring::after { content: ""; width: 74%; height: 74%; border-radius: 50%; background: white; }
@media (max-width: 440px) {
  .portal-header { gap: 8px; padding-inline: 12px; }
  .portal-header .wordmark img { width: 94px; }
  .segment { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chart-row { grid-template-columns: minmax(0, 1fr) minmax(0, .75fr) auto; overflow-wrap: anywhere; }
}

/* The form fits normal mobile and desktop viewports. Zoom and very small heights can scroll naturally. */
.signed-out .workspace { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100svh - 68px); place-items: center; }
.signed-out #main { margin: 0; max-width: 490px; padding: 16px; }
.signed-out .account { display: none; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(15px, 3.5vw, 29px); box-shadow: var(--shadow); }
.login-heading h1 { font-size: clamp(1.65rem, 4.5vw, 2.1rem); margin-bottom: 7px; }
.login-heading p { margin-bottom: 8px; }
.login-card label { margin: 11px 0 4px; }
.login-card [type="submit"] { display: flex; width: 100%; margin: 8px 0 0; }
.password-visibility { min-height: 38px; padding: 3px 0; margin: 0; border: 0; color: var(--brand-deep); background: transparent; text-decoration: underline; font-size: .86rem; }
@media (max-height: 480px) {
  .signed-out .portal-header { min-height: 50px; padding-block: 4px; }
  .signed-out .workspace { min-height: calc(100svh - 50px); }
  .signed-out #main { padding-block: 8px; }
  .login-card { padding-block: 12px; }
  .login-heading .muted, .login-heading .kicker { display: none; }
  .login-heading h1 { font-size: 1.3rem; margin-bottom: 4px; }
}
body[data-segment="kids"][data-role="participant"] { --page: #fff8ee; --brand: #6744ac; --brand-deep: #422779; --accent: #ede0fd; --line: #e5d9ef; }
body[data-segment="teen"][data-role="participant"] { --page: #f3f4fc; --brand: #5140a7; --brand-deep: #39297e; --accent: #e8e5ff; }
.welcome-panel p { max-width: 650px; }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.welcome-panel:has(.buddy-team) { background: linear-gradient(145deg, #fff, #f7ecff); }
.buddy-team { display: flex; gap: 12px; margin-bottom: 18px; }
.buddy { --fur: #ef8c68; --face: #ffb58c; position: relative; flex: 0 0 auto; width: 58px; height: 56px; color: #43254b; animation: buddy-hello 1.25s ease-out 2; }
.buddy-bear { --fur: #9973be; --face: #c7a9e7; animation-delay: .12s; }
.buddy-rabbit { --fur: #479e93; --face: #9ed7c9; animation-delay: .23s; }
.buddy .ear { position: absolute; top: 3px; z-index: 0; width: 23px; height: 24px; border: 4px solid var(--fur); background: #ffe5f3; border-radius: 55% 55% 28% 28%; }
.buddy .ear.left { left: 2px; transform: rotate(-20deg); }
.buddy .ear.right { right: 2px; transform: rotate(20deg); }
.buddy-fox .ear { border-radius: 70% 20% 40% 20%; }
.buddy-rabbit .ear { height: 32px; top: -4px; width: 19px; }
.buddy-face { position: absolute; inset: 14px 0 0; border-radius: 48% 48% 48% 48%; border: 3px solid var(--fur); background: var(--face); }
.buddy .eye { position: absolute; top: 13px; width: 5px; height: 8px; border-radius: 50%; background: currentColor; }
.buddy .eye.left { left: 13px; }
.buddy .eye.right { right: 13px; }
.buddy .nose { position: absolute; top: 21px; left: 50%; width: 8px; height: 5px; background: currentColor; border-radius: 50%; transform: translateX(-50%); }
@keyframes buddy-hello { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-8px) rotate(-6deg); } 68% { transform: translateY(-1px) rotate(5deg); } }

.assessment-wizard { --step: #24768f; max-width: 740px; margin: 14px auto 0; }
.assessment-step { margin-bottom: 5px; font-weight: 700; color: var(--muted); }
.assessment-progress { height: 9px; margin: 0 0 14px; accent-color: var(--step); }
.assessment-note { color: var(--muted); }
.assessment-content { border-radius: var(--radius); border: 1px solid var(--line); background: white; padding: clamp(16px, 3vw, 32px); }
.assessment-topic { display: inline-block; margin-bottom: 14px; padding: 5px 11px; border-radius: 100px; background: #e9f4f7; color: #164f61; font-weight: 700; font-size: .85rem; }
.assessment-question { margin: 0 0 20px; font-family: var(--sans); font-size: clamp(1.25rem, 3vw, 1.65rem); line-height: 1.35; }
.assessment-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0; gap: 8px; border: 0; margin: 0; min-inline-size: 0; }
.assessment-choice { min-width: 0; position: relative; display: grid; justify-items: center; gap: 6px; min-height: 74px; padding: 8px 3px; margin: 0; border: 1px solid #a9bfca; border-radius: 10px; font-size: .87rem; text-align: center; cursor: pointer; }
.assessment-choice:has(:checked) { border-color: var(--step); box-shadow: inset 0 0 0 1px var(--step); background: #e9f4f7; color: #164f61; }
.assessment-choice:has(:focus-visible) { outline: 3px solid var(--step); outline-offset: 2px; }
.assessment-choice input { position: absolute; width: 1px; min-height: 0; height: 1px; opacity: 0; margin: 0; padding: 0; }
.assessment-number { font-weight: 800; line-height: 1.05; }
.assessment-label { overflow-wrap: anywhere; }
.assessment-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.assessment-error { margin: 4px 0 0; color: var(--alert); font-weight: 650; }
.assessment-kids, .assessment-teen { --step: var(--brand); }
.assessment-kids .buddy { margin: 3px 0 12px; }
.assessment-kids .assessment-content { border: 2px solid #e0cef7; background: #fffcff; box-shadow: 0 10px 0 #f1e5fa; }
.assessment-kids .assessment-topic, .assessment-teen .assessment-topic { background: var(--accent); color: var(--brand-deep); }
.assessment-kids .assessment-choices, .assessment-teen .assessment-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.assessment-kids .assessment-choice, .assessment-teen .assessment-choice { min-height: 50px; align-items: center; align-content: center; font-size: 1rem; padding: 8px; }
.assessment-kids .assessment-choice:has(:checked), .assessment-teen .assessment-choice:has(:checked) { background: var(--accent); color: var(--brand-deep); border-color: var(--brand); }
.assessment-kids .assessment-number, .assessment-teen .assessment-number { display: none; }
.assessment-kids .assessment-controls { margin-top: 10px; }
.assessment-teen .assessment-content { border-left: 5px solid var(--brand); }
.assessment-teen .assessment-choices { grid-template-columns: 1fr; }
.assessment-teen .assessment-choice { display: flex; justify-content: flex-start; text-align: left; min-height: 44px; padding-inline: 14px; }
.result-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-block: 18px; }
.result-summary .panel { margin: 0; }
.result-summary ul { padding-left: 1.1em; margin-bottom: 0; }
.domain-section { margin: 22px 0 15px; }
.domain-card { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 14px 16px; }
.domain-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.domain-title h3 { font-family: var(--sans); font-size: .96rem; color: var(--ink); line-height: 1.35; }
.domain-title strong { white-space: nowrap; }
.domain-track { height: 7px; border-radius: 99px; overflow: hidden; background: #edf1f7; margin: 6px 0 12px; }
.domain-track > span { display: block; height: 100%; background: currentColor; border-radius: inherit; }
.domain-tag { color: inherit; background: var(--accent); border-radius: 99px; padding: 3px 8px; font-weight: 680; }
.domain-card.strong .domain-tag { background: var(--strong-bg); }
.domain-card.attention .domain-tag { background: var(--attention-bg); }
.domain-card.alert .domain-tag { background: var(--alert-bg); }
.result-radar { display: block; width: min(100%, 520px); height: auto; margin-inline: auto; }
@media (max-width: 510px) {
  .assessment-choices, .result-summary { grid-template-columns: 1fr; }
  .assessment-choice { grid-template-columns: 18px 1fr; align-items: center; justify-items: start; min-height: 44px; text-align: left; padding: 8px 12px; font-size: .95rem; }
  .assessment-kids .assessment-choice, .assessment-teen .assessment-choice { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
