/* Course Learning setup dashboard (course-dashboard.js). Tokens: tokens.css; components: ui.css. */
.course-page-title{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:var(--weight-semibold) var(--text-md)/1.4 var(--font-sans);text-decoration:none;color:var(--color-text-secondary)}
.course-dashboard{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,320px);column-gap:var(--space-4);align-items:end;width:min(100%,var(--container));margin:0 auto;padding:var(--space-8) var(--gutter) var(--space-16);font-family:var(--font-sans);color:var(--color-text)}
.course-dashboard>*{grid-column:1/-1;min-width:0}
.course-dashboard :is(h1,h2,h3,strong,button,input,select,small){font-family:inherit}
.course-dashboard h1,.course-dashboard h2{margin:0;font-size:var(--text-xl);line-height:var(--leading-xl);font-weight:var(--weight-bold);letter-spacing:var(--tracking-snug)}
.course-dashboard h1,.course-dashboard>:where(.course-section-heading) h2{font-size:var(--text-2xl);line-height:var(--leading-2xl)}
.course-dashboard svg{width:20px;height:20px;flex-shrink:0}

/* Search and examination scope form one filter bar. */
.course-search{grid-column:1;display:flex;align-items:center;gap:var(--space-3);width:100%;height:52px;margin:0 0 var(--space-10);padding:0 var(--space-2) 0 var(--space-4);border:1px solid var(--color-border-control);border-radius:var(--radius-md);background:var(--color-surface);box-shadow:var(--shadow-low);transition:border-color var(--duration-fast) var(--ease-standard),box-shadow var(--duration-fast) var(--ease-standard)}
.course-search:hover{border-color:var(--color-text-tertiary)}
.course-search:focus-within{border-color:var(--color-focus-ring);box-shadow:0 0 0 1px var(--color-focus-ring)}
.course-search>svg{color:var(--color-text-tertiary)}
.course-search input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:none;font-size:var(--text-md);color:var(--color-text);text-overflow:ellipsis}
.course-search input::placeholder{color:var(--color-text-tertiary)}
.course-search:focus-within input{box-shadow:none}
.course-year{display:flex;align-items:center;gap:var(--space-1);height:36px;padding-left:var(--space-3);border-left:1px solid var(--color-border);color:var(--color-text-tertiary);font-size:var(--text-xs);font-weight:var(--weight-semibold);white-space:nowrap}
.course-year select{height:36px;padding:0 var(--space-6) 0 var(--space-2);border:0;border-radius:var(--radius-sm);background-color:transparent;color:var(--color-brand-strong);font-size:var(--text-sm);font-weight:var(--weight-semibold);cursor:pointer}
.course-year select:hover{background-color:var(--color-action-neutral-hover)}
/* One chevron for every select on this page (drawn with currentColor, no image asset). */
.course-exam-selection select,.course-year select{appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);background-position:calc(100% - 18px) 52%,calc(100% - 13px) 52%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}
.course-year select{background-position:calc(100% - 13px) 52%,calc(100% - 8px) 52%}
.course-exam-selection{grid-column:2;display:flex;flex-wrap:wrap;gap:var(--space-3) var(--space-4);margin:0 0 var(--space-10);padding:0;border:0;background:none}
.course-exam-selection:has(#teaching-tier){grid-column:1/-1;margin-top:calc(-1 * var(--space-6))}
/* With three science scope selects on their own row, the search bar spans the full width above them. */
.course-dashboard:has(#teaching-tier) .course-search{grid-column:1/-1}
.course-exam-selection label{display:flex;flex:1 1 200px;flex-direction:column;gap:var(--space-1);min-width:0;color:var(--color-text-secondary);font-size:var(--text-xs);font-weight:var(--weight-semibold);letter-spacing:.02em}
.course-exam-selection:has(#teaching-tier) label{max-width:360px}
.course-exam-selection select{width:100%;max-width:100%;height:52px;min-height:44px;padding:0 var(--space-10) 0 var(--space-3);border:1px solid var(--color-border-control);border-radius:var(--radius-md);background-color:var(--color-surface);color:var(--color-text);font:inherit;font-size:var(--text-sm);font-weight:var(--weight-medium);letter-spacing:0;cursor:pointer}
.course-exam-selection:has(#teaching-tier) select{height:44px;border-radius:var(--radius-sm)}
.course-exam-selection select:disabled{background:var(--color-surface-subtle);color:var(--color-text-disabled);cursor:not-allowed}

/* Coursebooks. */
.course-section-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--space-4);margin:0 0 var(--space-4)}
.course-section-heading a{display:inline-flex;align-items:center;min-height:32px;font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-text-link);text-decoration:none;white-space:nowrap}
.course-section-heading a:hover{color:var(--color-text-link-hover);text-decoration:underline;text-underline-offset:3px}
.course-section-heading span{display:block;margin-top:var(--space-1);font-size:var(--text-sm);color:var(--color-text-tertiary)}
.course-shelf{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));gap:var(--space-4);margin-bottom:var(--space-10)}
.coursebook-card{display:grid;grid-template-columns:56px minmax(0,1fr);grid-template-rows:auto 1fr;column-gap:var(--space-4);row-gap:var(--space-1);align-items:start;min-height:112px;padding:var(--space-5);text-align:left;color:var(--color-text);font-weight:inherit;background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);transition:border-color var(--duration-base) var(--ease-standard),box-shadow var(--duration-base) var(--ease-standard),transform var(--duration-base) var(--ease-standard)}
.coursebook-card:hover{background:var(--color-surface);border-color:var(--color-border-strong);box-shadow:var(--shadow-mid);transform:translateY(-2px)}
.coursebook-card.selected,.coursebook-card[aria-pressed=true]{background:var(--color-brand-faint);border-color:var(--color-brand);box-shadow:inset 0 0 0 1px var(--color-brand)}
/* Covers are deliberate fixed-colour books (subject primitives) with white lettering in both themes;
   --color-text-inverse turns dark in the dark theme, so the lettering is pinned to white. */
.coursebook-cover{grid-row:1/3;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);width:56px;height:72px;margin:0;border-left:4px solid var(--green-900);border-radius:4px var(--radius-sm) var(--radius-sm) 4px;background:var(--green-700);color:var(--neutral-0)}
.coursebook-cover.physics{background:var(--blue-700);border-left-color:var(--blue-800)}
.coursebook-cover.chemistry{background:var(--amber-700);border-left-color:var(--amber-800)}
.coursebook-cover span{font-size:var(--text-xs);line-height:1;font-weight:var(--weight-bold);letter-spacing:.04em;font-variant-numeric:tabular-nums}
.coursebook-cover svg{width:22px;height:22px}
.coursebook-card strong{grid-column:2;font-size:var(--text-md);line-height:1.4;font-weight:var(--weight-bold);color:var(--color-text)}
.coursebook-card small{grid-column:2;color:var(--color-text-secondary);font-size:var(--text-sm);font-weight:var(--weight-regular);line-height:var(--leading-sm)}
/* Cards that do not match the search recede without dropping their text below AA contrast. */
.coursebook-card[data-search-dimmed=true]{background:var(--color-surface-subtle);border-color:var(--color-border)}
.coursebook-card[data-search-dimmed=true] .coursebook-cover{opacity:.4}
.coursebook-card[data-search-dimmed=true] :is(strong,small){color:var(--color-text-tertiary)}
.course-empty{padding:var(--space-5) 0;color:var(--color-text-secondary);font-size:var(--text-sm);font-weight:var(--weight-regular)}
.course-shelf>.course-empty{grid-column:1/-1;padding:var(--space-6);border:1px dashed var(--color-border-strong);border-radius:var(--radius-md);background:var(--color-surface);text-align:center}
.course-empty a{font-weight:var(--weight-semibold)}

/* Syllabus topic picker. */
.syllabus-panel{position:relative;margin-bottom:var(--space-10);padding:var(--space-6) var(--space-6) 0;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);scroll-margin-top:calc(var(--topbar-height) + var(--space-4))}
.syllabus-panel[hidden]{display:none}
.syllabus-panel:not([hidden]){animation:syllabus-reveal var(--duration-base) var(--ease-enter)}
.syllabus-panel>.course-section-heading{flex-wrap:wrap;align-items:flex-start;margin-bottom:var(--space-5)}
.syllabus-panel>.course-section-heading>div:first-child{flex:1 1 220px;min-width:0}
.syllabus-panel-actions{display:flex;align-items:center;gap:var(--space-3)}
#close-syllabus{display:grid;place-items:center;width:40px;height:40px;min-height:40px;padding:0;border:0;border-radius:50%;background:var(--color-surface-subtle);color:var(--color-text-secondary);font-size:var(--text-2xl);font-weight:var(--weight-regular);line-height:1}
#close-syllabus:hover{background:var(--color-surface-sunken);color:var(--color-text)}
@keyframes syllabus-reveal{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.syllabus-component{border-top:1px solid var(--color-border)}
.syllabus-component>summary,.syllabus-chapter>summary{display:flex;align-items:center;list-style:none;cursor:pointer}
.syllabus-component>summary::-webkit-details-marker,.syllabus-chapter>summary::-webkit-details-marker{display:none}
.syllabus-component>summary{gap:var(--space-3);min-height:64px;padding:var(--space-3) var(--space-1);font-size:var(--text-md);font-weight:var(--weight-semibold)}
.syllabus-component>summary:after,.syllabus-chapter>summary:after{content:"";flex:none;width:8px;height:8px;margin:0 var(--space-2) 4px var(--space-3);border:solid var(--color-text-tertiary);border-width:0 2px 2px 0;transform:rotate(45deg);transition:transform var(--duration-fast) var(--ease-standard)}
.syllabus-component[open]>summary:after,.syllabus-chapter[open]>summary:after{margin-bottom:-4px;transform:rotate(-135deg)}
.syllabus-component>summary:hover,.syllabus-chapter>summary:hover{color:var(--color-brand-strong)}
.component-number{display:grid;place-items:center;flex:none;min-width:36px;height:36px;padding:0 var(--space-1);border-radius:var(--radius-sm);background:var(--color-brand-subtle);color:var(--color-brand-subtle-text);font-size:var(--text-sm);font-weight:var(--weight-bold)}
.syllabus-component>summary>strong,.syllabus-chapter>summary>strong{margin-right:auto}
.chapter-count{color:var(--color-text-tertiary);font-size:var(--text-sm);font-weight:var(--weight-medium);white-space:nowrap}
.syllabus-chapter{margin:0 0 var(--space-2) 48px;border:1px solid var(--color-border);border-radius:var(--radius-sm);background:var(--color-surface)}
.syllabus-component[open]>div{padding-bottom:var(--space-4)}
.syllabus-chapter>summary{gap:var(--space-3);min-height:52px;padding:var(--space-2) var(--space-2) var(--space-2) var(--space-4);font-size:var(--text-sm)}
.syllabus-chapter>summary>span{flex:none;color:var(--color-text-tertiary);font-size:var(--text-sm);font-variant-numeric:tabular-nums}
.syllabus-chapter>summary strong{min-width:0;font-weight:var(--weight-semibold);color:var(--color-text)}
.syllabus-chapter[open]{border-color:var(--color-border-strong)}
.select-chapter{flex:none;min-height:32px;padding:0 var(--space-3);border:1px solid var(--color-border-strong);border-radius:var(--radius-full);background:var(--color-surface);color:var(--color-brand-strong);font-size:var(--text-xs);font-weight:var(--weight-semibold);white-space:nowrap}
.course-dashboard .select-chapter{min-height:32px;font-size:var(--text-xs)}
.select-chapter[aria-pressed=true]{background:var(--color-brand-subtle);border-color:var(--color-brand);color:var(--color-brand-subtle-text)}
.syllabus-topics{padding:0 var(--space-2) var(--space-2)}
.syllabus-topic{display:flex;align-items:flex-start;gap:var(--space-3);min-height:44px;padding:var(--space-3);border-radius:var(--radius-sm);cursor:pointer;font-size:15px;line-height:1.5;font-weight:var(--weight-regular)}
.syllabus-topic:hover{background:var(--color-surface-subtle)}
.syllabus-topic:has(input:checked){background:var(--color-brand-faint);box-shadow:inset 3px 0 var(--color-brand)}
.syllabus-topic input{flex-shrink:0;width:18px;height:18px;margin-top:3px;padding:0;accent-color:var(--color-brand)}
.syllabus-requirement{display:block;margin-top:var(--space-1);font-size:13px;color:var(--color-text-tertiary);font-weight:var(--weight-regular);line-height:1.55;overflow-wrap:anywhere}
.topic-selection{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;gap:var(--space-3);margin:var(--space-4) calc(-1 * var(--space-6)) 0;padding:var(--space-4) var(--space-6);border-top:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);background:var(--color-surface)}
/* With no topics to choose (scope not chosen, no match), the bar must not stick over the explanation above it. */
.syllabus-panel:not(:has(.syllabus-topic)) .topic-selection{position:static}
.topic-selection>span{margin-right:auto;font-size:var(--text-sm);color:var(--color-text-secondary)}
.topic-selection button{min-height:44px;padding:0 var(--space-5);font-size:var(--text-sm)}
#clear-topics{border-color:transparent;background:transparent;color:var(--color-text-secondary)}
#clear-topics:hover:not(:disabled){background:var(--color-action-neutral-hover);color:var(--color-text)}
#clear-topics:disabled{opacity:.5;cursor:not-allowed}

/* Recall suggestions. */
.recall-due{margin:0 0 var(--space-10);padding:var(--space-6);border:1px solid var(--color-brand-border);border-radius:var(--radius-md);background:var(--color-brand-faint)}
.recall-due h2{margin:0}
.recall-due .small{margin:var(--space-1) 0 var(--space-4)}
.recall-due button{display:block;width:100%;max-width:100%;min-height:48px;margin:0 0 var(--space-2);padding:var(--space-3) var(--space-4);border-color:var(--color-border);text-align:left;white-space:normal;overflow-wrap:anywhere;font-size:var(--text-sm)}
.recall-due button:last-child{margin-bottom:0}

/* Learning records: tabs, filter chips and rows. */
.learning-library{border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);overflow:hidden}
.library-tabs{display:flex;gap:var(--space-6);padding:0 var(--space-6);border-bottom:1px solid var(--color-border);overflow-x:auto;scrollbar-width:none}
.library-tabs::-webkit-scrollbar{display:none}
.library-tabs button{position:relative;display:flex;align-items:center;gap:var(--space-2);flex:none;min-height:52px;padding:0 var(--space-1);border:0;border-radius:0;background:none;color:var(--color-text-secondary);font-size:var(--text-sm);font-weight:var(--weight-semibold);white-space:nowrap}
.library-tabs button:hover{background:none;color:var(--color-text)}
.library-tabs button:focus-visible{outline-offset:-2px;border-radius:var(--radius-xs)}
.library-tabs button[aria-selected=true]{color:var(--color-brand-strong)}
.library-tabs button[aria-selected=true]::after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;border-radius:3px 3px 0 0;background:var(--color-brand)}
.library-tabs svg{width:18px;height:18px}
#learning-records{padding:var(--space-5) var(--space-6) var(--space-6)}
.history-filters{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-bottom:var(--space-4)}
.course-dashboard .history-filters button{min-height:32px;padding:0 var(--space-3);border:1px solid var(--color-border-strong);border-radius:var(--radius-full);background:var(--color-surface);color:var(--color-text-secondary);font-size:var(--text-sm);font-weight:var(--weight-medium)}
.course-dashboard .history-filters button:hover{border-color:var(--color-border-control);color:var(--color-text)}
.course-dashboard .history-filters button[aria-pressed=true]{border-color:var(--color-brand);background:var(--color-brand-subtle);color:var(--color-brand-subtle-text);font-weight:var(--weight-semibold)}
.course-history-row{display:flex;align-items:center;gap:var(--space-4);width:100%;min-height:64px;padding:var(--space-3) var(--space-2);text-align:left;color:var(--color-text);font-weight:inherit;border:0;border-bottom:1px solid var(--color-border);border-radius:0;background:transparent}
.course-history-row:hover{background:var(--color-surface-subtle)}
.course-history-row>svg{box-sizing:content-box;padding:var(--space-2);border-radius:var(--radius-sm);background:var(--color-surface-subtle);color:var(--color-brand-strong)}
.course-history-row>span:nth-child(2){flex:1;min-width:0}
.course-history-row strong{display:block;font-size:var(--text-md);line-height:1.4;font-weight:var(--weight-semibold)}
.course-history-row small{display:block;margin-top:2px;font-size:var(--text-sm);line-height:var(--leading-sm);color:var(--color-text-tertiary);font-weight:var(--weight-regular)}
.course-history-row>span:last-child{flex:none;color:var(--color-text-tertiary)}
.course-state{display:inline-flex;align-items:center;flex:none;min-height:24px;padding:0 var(--space-2);border-radius:6px;background:var(--color-surface-subtle);color:var(--color-text-secondary);font-size:var(--text-xs);font-weight:var(--weight-semibold);white-space:nowrap}
.error-summary{display:flex;align-items:center;justify-content:space-between;gap:var(--space-4)}
.error-summary h2{font-size:var(--text-lg)}
.error-summary button{min-height:40px;padding:0 var(--space-4)}
.error-categories{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-3);margin:var(--space-5) 0}
.error-categories>div{display:flex;flex-direction:column;gap:var(--space-1);padding:var(--space-4);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface-subtle)}
.error-categories strong{font-size:var(--text-2xl);line-height:1.1;font-weight:var(--weight-bold);font-variant-numeric:tabular-nums}
.error-categories span{font-size:var(--text-sm);color:var(--color-text-secondary)}
.topic-record-list button{display:flex;align-items:center;justify-content:space-between;gap:var(--space-4);width:100%;min-height:56px;padding:var(--space-3) var(--space-2);text-align:left;color:var(--color-text);font-size:15px;font-weight:var(--weight-semibold);border:0;border-top:1px solid var(--color-border);border-radius:0;background:transparent}
.topic-record-list button:hover{background:var(--color-surface-subtle)}
.topic-record-list small{display:block;font-weight:var(--weight-regular);font-size:var(--text-sm);color:var(--color-text-tertiary)}
.knowledge-key{margin:0 0 var(--space-4);font-size:var(--text-sm);color:var(--color-text-secondary)}
.knowledge-component{border-top:1px solid var(--color-border)}
.knowledge-component summary{min-height:52px;padding:var(--space-3) 0;font-size:var(--text-md);font-weight:var(--weight-semibold);cursor:pointer}
.knowledge-unit{display:flex;align-items:center;gap:var(--space-3);min-height:48px;padding:var(--space-2) 0 var(--space-2) var(--space-5);border-top:1px solid var(--color-border);font-size:var(--text-sm)}
.knowledge-unit strong{flex:1;font-weight:var(--weight-medium)}
.knowledge-unit>span{color:var(--color-text-tertiary);white-space:nowrap}
.course-dashboard .knowledge-unit button{min-height:32px;padding:0 var(--space-3);font-size:var(--text-xs)}

@media(max-width:1000px){.chapter-count{display:none}}
@media(max-width:900px){
 .course-dashboard{grid-template-columns:minmax(0,1fr)}
 .course-search,.course-exam-selection{grid-column:1}
 .course-search{margin-bottom:var(--space-4)}
 .course-exam-selection,.course-exam-selection:has(#teaching-tier){margin:0 0 var(--space-8)}
 .course-exam-selection label,.course-exam-selection:has(#teaching-tier) label{max-width:none}
}
@media(max-width:600px){
 .course-dashboard{padding-top:var(--space-5)}
 .course-section-heading a{min-height:44px}
 .course-search{gap:var(--space-2);padding-left:var(--space-3)}
 .course-year{font-size:0;padding-left:var(--space-1)}
 .course-year,.course-year select{height:44px}
 .course-year select{font-size:var(--text-sm)}
 .course-search input{font-size:var(--text-md)}
 .course-exam-selection label{flex-basis:100%}
 .course-exam-selection select{height:48px}
 .course-section-heading h1,.course-section-heading h2{font-size:var(--text-xl)}
 .coursebook-card{min-height:0;padding:var(--space-4)}
 .course-shelf{gap:var(--space-3)}
 .syllabus-panel{padding:var(--space-4) var(--space-4) 0}
 .syllabus-chapter{margin-left:0}
 .syllabus-component>summary{gap:var(--space-2);font-size:15px}
 .syllabus-chapter>summary{flex-wrap:wrap;gap:var(--space-1) var(--space-2);padding:var(--space-3)}
 .syllabus-chapter>summary strong{flex:1 1 60%}
 .syllabus-chapter>summary>span:last-of-type{display:none}
 .select-chapter{margin-left:auto}
 .topic-selection{flex-wrap:wrap;margin-inline:calc(-1 * var(--space-4));padding:var(--space-3) var(--space-4)}
 .topic-selection>span{width:100%;font-size:13px}
 .topic-selection .primary{flex:1}
 .library-tabs{gap:var(--space-4);padding:0 var(--space-4)}
 .library-tabs button{min-height:48px}
 .library-tabs svg{display:none}
 #learning-records{padding:var(--space-4)}
 .error-categories{gap:var(--space-2)}
 .error-categories>div{padding:var(--space-3)}
 .error-categories span{font-size:var(--text-xs)}
 .knowledge-unit{flex-wrap:wrap;padding-left:var(--space-1)}
 .knowledge-unit strong{flex-basis:100%}
 .course-history-row{gap:var(--space-3)}
 .course-state{max-width:110px;white-space:normal;line-height:1.3;padding-block:var(--space-1)}
 .course-history-row>svg{display:none}
 .course-dashboard .knowledge-unit button,.course-dashboard .history-filters button,.error-summary button{min-height:44px}
 .course-dashboard .select-chapter{min-height:44px}
 #close-syllabus{position:absolute;top:var(--space-3);right:var(--space-3);width:44px;height:44px}
 .syllabus-panel>.course-section-heading>div:first-child{flex-basis:100%;padding-right:var(--space-12)}
}
@media(prefers-reduced-motion:reduce){.course-search{transition:none}.syllabus-panel:not([hidden]){animation:none}.coursebook-card{transition:none}.coursebook-card:hover{transform:none}}
