.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;min-height:36px;padding:8px 12px;border:1px solid var(--line,#dce3ef);border-radius:10px;background:var(--surface,#fff);color:var(--ink,#21314a);font:500 12px/1.4 Inter,Arial,sans-serif;cursor:pointer;}
.landing-nav>.theme-toggle{order:3;margin-left:auto;}
html[data-theme=dark],html[data-theme=dark] body,html[data-theme=dark] #app{color-scheme:dark;--bg:#101724;--surface:#192335;--surface-soft:#1e2a3f;--surface-tint:#23314b;--ink:#e6edf9;--muted:#a7b5cd;--line:#34435c;--line-soft:#2b3950;--accent:#93a6ff;--accent-strong:#b3c0ff;--accent-2:#71d5c5;--danger:#ff9cae;--dark:#0b1220;--shadow-sm:0 8px 22px #0002;--shadow-md:0 18px 48px #0003;}
html[data-theme=dark] body{color:var(--ink);background:var(--bg);}
html[data-theme=dark] .topbar{background:#141e30;border-color:var(--line);color:var(--ink);}
html[data-theme=dark] #app :is(.course-card,.course-open,.homework-card,.reader-card,.form-wrap,.submission-panel,.schedule-modal,.schedule-popover,.account-card,.lesson-side,.lesson-nav,.lesson-main,.task-topic,.topic-task-list,.task-card,.assignment-card,.lesson-card,.lesson-shell,.calendar-page,.calendar-toolbar,.student-schedule-list,.password-editor,.notice,.empty,.locked-task,.review-comment,.review-assigned-item,.ex-card,.ex-stats,.ex-stats-wrap,.progress-card,.statistics-card){background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] :is(.schedule-modal,.schedule-popover,.modal-head,dialog){background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] #app :is(h1,h2,h3,h4,label,.value,.reader-label,.task-description-text,.task-text,.schedule-detail-row,.section-head,.compact-head,.course-title,.course-description,.lesson-title){color:var(--ink);}
html[data-theme=dark] #app :is(.muted-text,.muted-line,.eyebrow,.homework-meta,.reader-label small,.schedule-event-time){color:var(--muted);}
html[data-theme=dark] body:not(.exam-open) :is(input:not([type=checkbox]):not([type=radio]):not([type=color]),textarea,select){background:var(--surface-soft);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] :is(input,textarea)::placeholder{color:var(--muted);opacity:1;}
html[data-theme=dark] :is(.ghost-button,.secondary-button,.link-button,.lesson-step-tab,.access-pill,.assigned-student-button){background:var(--surface-soft);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] :is(.primary-button,.landing-cta){background:#526be0;color:#fff;border-color:#526be0;}
html[data-theme=dark] :is(.danger-button,.error){color:#ffb2c1;background:#412334;border-color:#764052;}
html[data-theme=dark] :is(table,thead,tbody,tr,th,td){border-color:var(--line);}
html[data-theme=dark] #app :is(th,td){background:var(--surface);color:var(--ink);}
html[data-theme=dark] #app :is(.calendar-toolbar,.fc-scrollgrid,.fc-view-harness,.fc-daygrid-day,.fc-timegrid-col,.fc-timegrid-slot){background:var(--surface);border-color:var(--line);}
html[data-theme=dark] #app .fc{--fc-border-color:var(--line);--fc-page-bg-color:var(--surface);--fc-neutral-bg-color:var(--surface-soft);--fc-list-event-hover-bg-color:var(--surface-soft);--fc-today-bg-color:#34476c66;--fc-neutral-text-color:var(--muted);color:var(--ink);}
html[data-theme=dark] #app .fc :is(.fc-col-header-cell-cushion,.fc-daygrid-day-number,.fc-timegrid-axis-cushion,.fc-timegrid-slot-label-cushion){color:var(--muted);}
html[data-theme=dark] #app .landing-page{background:var(--bg);color:var(--ink);}
html[data-theme=dark] #app :is(.landing-login-card,.landing-feature,.landing-feature-card,.landing-teacher-card,.teacher-card,.teacher-profile,.teacher-dialog){background:var(--surface);border-color:var(--line);color:var(--ink);}
html[data-theme=dark] #app :is(.landing-name,.landing-nav-link,.landing-teachers-link,.landing-login-link,.landing-intro h1,.landing-login-card h2,.landing-feature h3,.landing-teacher-card h3,.teacher-profile h2,.teacher-profile h3){color:var(--ink);}
html[data-theme=dark] #app :is(.landing-description,.landing-login-description,.landing-kicker,.landing-footer,.landing-login-card label,.landing-login-card p,.landing-feature p,.landing-teacher-card p,.teacher-profile p,.teacher-profile li){color:var(--muted);}
html[data-theme=dark] #app :is(.landing-intro h1 em,.landing-name span,.landing-login-link){color:#a7b7ff;}
html[data-theme=dark] #app :is(.landing-nav,.landing-footer,.landing-subjects span){border-color:var(--line);}
html[data-theme=dark] #app :is(.landing-card-icon,.landing-subjects span){background:var(--surface-soft);color:var(--muted);}
html[data-theme=dark] #toast{background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] #app svg text{fill:var(--muted);}
html[data-theme=dark] #app{color:var(--ink);}
html[data-theme=dark] #userBadge{color:var(--muted);}
html[data-theme=dark] #app :is(.workspace-hero,.summary-card,.calendar-sidebar,.fullcalendar-shell,.calendar-view-switch,.calendar-help,.calendar-empty-state,.calendar-student,.calendar-student.active,.section-hint,.landing-feature-grid>article,.teacher-profile-content,.teacher-profile-facts>div,.teacher-profile-close,.payment-card){background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] #app :is(.home-tab.active,.calendar-view-switch button.active,.lesson-step-tab.active){background:var(--surface-tint);color:var(--accent);border-color:var(--line);}
html[data-theme=dark] #app :is(.home-tab,.calendar-toolbar button,.calendar-sidebar strong,.calendar-sidebar h3,.payment-balance strong,.summary-card strong,.landing-section-heading h2,.landing-teacher-name,.teacher-profile-content h2,.teacher-profile-content h3){color:var(--ink);}
html[data-theme=dark] #app :is(.home-tab strong,.calendar-view-switch button,.calendar-help,.landing-feature-icon){background:var(--surface-soft);color:var(--muted);}
html[data-theme=dark] #app .calendar-toolbar button{background:var(--surface-soft);border-color:var(--line);color:var(--ink);}
html[data-theme=dark] #app .calendar-toolbar button.active{background:var(--surface-tint);color:var(--accent);}
html[data-theme=dark] #app .calendar-empty-state strong{color:var(--ink);}
html[data-theme=dark] #app :is(.teacher-profile-subjects,.teacher-profile-eyebrow,.landing-teachers-description,.landing-teacher-subject,.payment-balance span){color:var(--muted);}
html[data-theme=dark] #app .fullcalendar-host .fc :is(.fc-scrollgrid,.fc-view-harness,.fc-daygrid-day,.fc-timegrid-col,.fc-timegrid-slot,.fc-col-header-cell,th,td){background:var(--surface)!important;color:var(--ink);border-color:var(--line)!important;}
html[data-theme=dark] #app .fc :is(.fc-col-header-cell,th,td){background:var(--surface)!important;border-color:var(--line)!important;}
html[data-theme=dark] #app :is(input:not([type=checkbox]):not([type=radio]):not([type=color]),textarea,select){background:var(--surface-soft)!important;color:var(--ink)!important;border-color:var(--line)!important;}
html[data-theme=dark] #app :is(.ex-panel,.ex-task-editor,.ex-stats-tooltip,.ex-stat-tooltip){background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] #app :is(.ex-score,.ex-label,.ex-muted,.ex-upload){color:var(--muted);}
html[data-theme=dark] #app .ex-statistics,html[data-theme=dark] .ex-stat-tooltip{background:var(--surface);color:var(--ink);border-color:var(--line);}
html[data-theme=dark] #app .ex-stat-table td.ex-stat-correct{background:#28583e;color:#d8f9e2;}
html[data-theme=dark] #app .ex-stat-table td.ex-stat-partial{background:#645026;color:#ffedbd;}
html[data-theme=dark] #app .ex-stat-table td.ex-stat-wrong{background:#67323d;color:#ffe0e7;}
/* Exam paper remains in its familiar exam palette. Never recolor images/canvas. */
html[data-theme=dark] .exam-screen{color-scheme:light;--bg:#e8eef9;--surface:#fff;--ink:#202522;--muted:#707872;--line:#dde2dc;--accent:#3157d4;--danger:#b85c6a;}
html[data-theme=dark] body.embed-code{--cs-code-bg:#192335;color:#e6edf9;background:#192335;}
html[data-theme=dark] body.embed-code :is(.code-panel,.code-head,.output-head,.output-section,.CodeMirror,.python-editor){background:#192335;color:#e6edf9;border-color:#34435c;}
html[data-theme=dark] body.embed-code :is(.code-head span,.output-head span,.file-row label,.file-row input,.file-list){color:#a7b5cd;}
html[data-theme=dark] body.embed-code :is(.file-row,.CodeMirror-gutters){background:#141e30;border-color:#34435c;color:#a7b5cd;}
html[data-theme=dark] body.embed-code .CodeMirror-cursor{border-color:#e6edf9;}
html[data-theme=dark] body.embed-code .CodeMirror-selected{background:#3b4b72;}
html[data-theme=dark] body.embed-code :is(.cm-keyword,.cm-atom){color:#c5a6ff;}
html[data-theme=dark] body.embed-code .cm-string{color:#a2d5ae;}
html[data-theme=dark] body.embed-code .cm-number{color:#f2bd85;}
html[data-theme=dark] body.embed-code .cm-comment{color:#9cacc8;}
html[data-theme=dark] body:not(.embed-code) :is(.call-topbar,.call-status,#meet){background:#101724;color:#e6edf9;border-color:#34435c;}
@media(max-width:640px){.landing-nav>.theme-toggle{order:0;}.theme-toggle{padding:7px 9px;font-size:11px;}}
