/* Color-only theme layer. Geometry, exported homework paper and brand assets stay independent. */
html[data-theme="light"]{color-scheme:light}
html[data-theme="dark"]{
 color-scheme:dark;
 --canvas:#10151d;--ink:#e4ebf5;--muted:#9cabc0;--line:#303b4b;
 --white:#181f29;--navy:#c1d6f0;--accent:#a8c8f1;--soft:#263347;--green:#93cdb0;
 --menu-ink:#d2e3fa;--menu-muted:#a3b2c6;
 --surface:#181f29;--surface-raised:#202a37;--surface-input:#131b25;
 --dark-border:#303b4b;--dark-soft:#263347;--dark-hover:#222e3d;
 background:var(--canvas);
}
html[data-theme="dark"] body{background:var(--canvas);color:var(--ink)}
html[data-theme="dark"] :is(input,select,textarea){background:var(--surface-input);color:var(--ink);border-color:#3b485c;accent-color:#abcdf7}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#8d9db2;opacity:1}
html[data-theme="dark"] :is(input,select,textarea):focus{outline-color:#86acd9}
html[data-theme="dark"] :is(button,a):focus-visible{outline-color:#a2c6f3}
html[data-theme="dark"] :is(.app-sidebar,.topbar,.lesson-stack,.lesson-row,.today-card,.calendar-shell,.calendar-day,.weekday,.calendar-footer,.student-card,.student-profile,.settings-list,.settings-card,.tuition-dashboard,.tuition-grid,.tuition-item,.hw-context,.hw-book,.hw-preview-panel,.hw-saved-list,.hw-draft-list){background:var(--surface);border-color:var(--line);box-shadow:none}
html[data-theme="dark"] #app .selected-day{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .app-sidebar .brand{color:var(--ink)}
html[data-theme="dark"] .brand-mark{background:#142b4a;color:#fff}
html[data-theme="dark"] .app-sidebar .sync-status{color:var(--muted);border-color:var(--line)}
html[data-theme="dark"] .app-sidebar .sync-status.attention{color:#e4b97f}
html[data-theme="dark"] #nav.app-menu a{color:var(--menu-muted);background:transparent}
html[data-theme="dark"] #nav.app-menu a.active{background:#293a50;color:var(--menu-ink);box-shadow:none}
html[data-theme="dark"] :is(.button.primary,.primary){background:#244d7c;border-color:#3e699b;color:#f5f8fd}
html[data-theme="dark"] :is(.button.secondary,.secondary,.today-button){background:var(--surface-raised);border-color:#3b4a60;color:#d1e0f3}
html[data-theme="dark"] :is(.icon-button,.back-link,.text-button,.load-more .button){color:#b1caeb}
html[data-theme="dark"] :is(.page-title h1,.section-heading h2,.lesson-heading strong,.student-open strong,.profile-heading h2,.setting-name h2,.settings-card h2,.tuition-heading h2,.tuition-date time,.tuition-person strong,.today-date time,.today-count strong,.month-picker h2 b,.modal-heading h2,.lesson-modal-title strong,.student-exams h2){color:var(--ink)}
html[data-theme="dark"] :is(.date-heading h3,.lesson-hour,.today-line>span,.info-block>div,.info-block a,.schedule-line time,.legacy-hours,.schedule-editor-heading h3,.connection-instructions h3,.connection-instructions b,.title-example code,.form-field input){color:#cbdaf0}
html[data-theme="dark"] :is(.lesson-hour small,.lesson-context,.lesson-school,.lesson-location,.date-heading>span,.student-open small,.student-card-fields>div>span,.student-card-fields p,.student-card-bottom>span,.profile-school,.info-label,.info-label svg,.info-block .placeholder,.schedule-line .schedule-days,.tuition-basis,.tuition-count,.tuition-date small,.tuition-person>span,.tuition-footer .text-button,.tuition-empty,.today-date>span,.today-line time,.today-line small,.today-count>span,.today-card>p,.empty-state h3,.empty-state p,.month-picker h2,.month-controls .icon-button,.calendar-more,.calendar-footer,.selected-day .eyebrow,.selected-day .section-heading>.muted,.form-field,.lesson-modal-title>div span,.modal-note,.setting-description,.calendar-feedback,.connection-instructions p,.connection-instructions>span,.last-sync,.simple-details summary,.simple-details p,.title-example small,.deleted-students,.schedule-row-heading>span,.time-pair label,.range-separator,.schedule-legacy){color:var(--muted)}
html[data-theme="dark"] .lesson-place.with-school::before,html[data-theme="dark"] :is(.tuition-dot,.schedule-line .time-dash){color:#73859e}
html[data-theme="dark"] .info-block a{text-decoration-color:#607590}
html[data-theme="dark"] :is(.lesson-row,.today-count,.today-line,.tuition-heading,.tuition-footer,.calendar-grid,.weekday,.calendar-day,.calendar-footer,.selected-day .section-heading,.student-card-bottom,.info-block,.setting-row,.modal-footer,#schedule-editor,.simple-details,.student-delete-action,.deleted-students,.deleted-students>div,.hw-dates,.hw-notes,.hw-generator,.hw-image-options,.hw-export,.hw-saved-row){border-color:var(--line)}
html[data-theme="dark"] .tuition-item{box-shadow:1px 0 0 var(--line),0 1px 0 var(--line)}
html[data-theme="dark"] .segmented{background:#202a38}
html[data-theme="dark"] .segmented button{color:#aabbd0}
html[data-theme="dark"] .segmented button.selected{background:#34435a;color:#edf5ff;box-shadow:0 1px 3px #0003}
html[data-theme="dark"] .segmented button span{color:inherit}
html[data-theme="dark"] :is(.avatar,.empty-icon,.setting-name .service-icon,.service-icon){background:#263347;color:#b8d0ef}
html[data-theme="dark"] :is(.session-badge,.prediction-badge,.today-tag,.exam-badge,.hw-history>summary>span){background:#293b52;color:#c6ddf9;border-color:#455f80}
html[data-theme="dark"] .status-pill{background:#213a32;color:#acd8bf}
html[data-theme="dark"] .status-pill.ended{background:#2b3443;color:#bac7d9}
html[data-theme="dark"] .status-text{color:#a6d0b7}
html[data-theme="dark"] .calendar-day.outside{background:#141b24}
html[data-theme="dark"] .calendar-day.is-selected{background:#202e40;box-shadow:inset 0 0 0 1.5px #5f7da3}
html[data-theme="dark"] .day-select{color:#b6c7dd}
html[data-theme="dark"] .calendar-day.outside .day-select>span:first-child{color:#6b7b90}
html[data-theme="dark"] .weekday.sun{color:#e5a2ae}
html[data-theme="dark"] .weekday.sat{color:#a4c0e5}
html[data-theme="dark"] :is(.is-today,.is-selected) .day-select>span:first-child{background:#b6cff0;color:#122238}
html[data-theme="dark"] .calendar-event{background:#283b53;color:#c3dafa}
html[data-theme="dark"] .calendar-event strong{color:#d9e8fc}
html[data-theme="dark"] :is(.calendar-event time,.calendar-event .event-session){color:#afc4df}
html[data-theme="dark"] :is(.legend-dot,.mobile-dots i){background:#9cbfe8}
html[data-theme="dark"] .c0{--color:#a4c6ee;--tint:#283b53}
html[data-theme="dark"] .schedule-edit-row{background:#202a37;border-color:#38475c}
html[data-theme="dark"] .weekday-option{background:#151e2a;border-color:#425169;color:#b6c7dd}
html[data-theme="dark"] .weekday-option.selected{background:#315d8d;border-color:#6e97c8;color:#fff}
html[data-theme="dark"] .time-pair select{background:var(--surface-input);border-color:#425169;color:var(--ink)}
html[data-theme="dark"] .schedule-legacy{background:#233044}
html[data-theme="dark"] #modal{background:var(--surface);color:var(--ink);border-color:#3c4b60;box-shadow:0 20px 80px #0008}
html[data-theme="dark"] #modal::backdrop{background:#02070dbb}
html[data-theme="dark"] .modal-footer{background:var(--surface)}
html[data-theme="dark"] :is(.form-error,.danger-text,.hw-error){color:#f0afb1}
html[data-theme="dark"] .hw-delete{color:#edb0b4!important}
html[data-theme="dark"] :is(.sync-notice,.inline-notice){background:#3a2c1e;color:#ecc99b;border-color:#705336}
html[data-theme="dark"] .sync-notice .text-button{color:#f4d7af}
html[data-theme="dark"] #toast{background:#dde9f8;color:#14263e;box-shadow:0 6px 28px #0005}
html[data-theme="dark"] .skip-link{background:var(--surface);color:var(--ink)}
html[data-theme="dark"] .loading-line{background:#2b3b50}
html[data-theme="dark"] .loading-line:after{background:#9bbde6}
/* The editor follows the theme; image pixels always remain black on white. */
html[data-theme="dark"] :is(.hw-field input,.hw-field select,.hw-field textarea,.hw-day-heading input,.hw-day-row textarea,.search-field input,.student-select select){background:var(--surface-input);color:var(--ink);border-color:#3b485c}
html[data-theme="dark"] .hw-book-heading>input{background:transparent;color:var(--ink)}
html[data-theme="dark"] .hw-layout summary{color:#bdcfe6}
html[data-theme="dark"] .hw-mode button{border-color:#41516a;color:#b3c3d9;background:transparent}
html[data-theme="dark"] .hw-mode button[aria-pressed=true]{background:#2b4360;border-color:#5b7fa8;color:#e3efff}
html[data-theme="dark"] :is(.hw-local-status,.hw-preview-empty,#hw-page-count,.hw-preview-toggle>svg,.hw-day-heading>.icon-button){color:#a8b9ce}
html[data-theme="dark"] .hw-preview{background:#0d131c;border-color:var(--line)}
html[data-theme="dark"] .hw-image-page{background:#fff;border-color:#435167;box-shadow:0 3px 12px #0005}
html[data-theme="dark"] .hw-image-page>img{background:#fff;color-scheme:light}
html[data-theme="dark"] .hw-image-page figcaption{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .hw-export{background:var(--surface);border-color:var(--line)}
@media(hover:hover){
 html[data-theme="dark"] :is(.lesson-row:hover,.student-open:hover,.tuition-item:hover,.icon-button:hover){background:var(--dark-hover)}
 html[data-theme="dark"] #nav.app-menu a:hover{background:#26354a;color:#d7e6fa}
 html[data-theme="dark"] #nav.app-menu a.active:hover{background:#31465f;color:#e8f2ff}
 html[data-theme="dark"] .calendar-event:hover{background:#334f70;outline:none}
 html[data-theme="dark"] :is(.button.secondary:hover,.today-button:hover){background:#2a3a50;border-color:#7896bc;color:#e4efff}
 html[data-theme="dark"] .button.primary:hover{background:#315f93;border-color:#7496c1}
 html[data-theme="dark"] .weekday-option:not(.selected):hover{background:#283b52;border-color:#7898c0}
 html[data-theme="dark"] .student-card:hover{border-color:#607d9f}
 html[data-theme="dark"] .info-block a:hover{text-decoration-color:#bbd4f6}
}
@media(max-width:680px),(max-width:960px) and (pointer:coarse) and (max-height:600px){
 html[data-theme="dark"] .app-sidebar{background:var(--canvas)}
 html[data-theme="dark"] #nav.app-menu{background:rgba(28,37,51,.88);border-color:rgba(175,199,229,.21);box-shadow:0 8px 30px #0006,0 2px 8px #0003,inset 0 1px 0 #d8e7ff21,inset 0 -1px 0 #7c99bd12}
 html[data-theme="dark"] #nav.app-menu a{color:#a9bbd2;background:transparent}
 html[data-theme="dark"] #nav.app-menu a.active{background:rgba(153,191,239,.18);color:#e4efff;box-shadow:inset 0 1px 0 #d2e4ff28,0 1px 3px #0002}
 html[data-theme="dark"] #nav.app-menu a.active .nav-icon{background:transparent;color:inherit}
 html[data-theme="dark"] .hw-export{background:rgba(28,37,51,.96);border-color:rgba(175,199,229,.21);box-shadow:0 4px 20px #0005}
 html[data-theme="dark"] :is(.calendar-day,.calendar-day.outside,.calendar-day.is-selected){background:var(--surface);box-shadow:none}
 html[data-theme="dark"] .is-selected .day-select{background:#293c54}
 html[data-theme="dark"] .is-today .day-select>span:first-child{background:#2d425d;color:#d3e6ff}
 html[data-theme="dark"] .is-selected .day-select>span:first-child{background:#b6cff0;color:#122238}
}
@media(prefers-reduced-transparency:reduce){html[data-theme="dark"] :is(#nav.app-menu,.hw-export){background:#1c2533;-webkit-backdrop-filter:none;backdrop-filter:none}}
/* A single compact appearance preference in Settings. */
.theme-switch{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;padding:4px;background:#edf0f5;border:1px solid #e1e6ee;border-radius:11px;min-width:245px;max-width:100%}
.theme-choice{min-width:0;min-height:36px;padding:8px 12px;border-radius:7px;color:#61728b;font-size:12px;font-weight:500;line-height:1.4;white-space:nowrap;transition:background .15s,color .15s,box-shadow .15s}
.theme-choice[aria-pressed="true"]{background:#fff;color:#142b4a;font-weight:650;box-shadow:0 1px 3px #142b4a12}
html[data-theme="dark"] .theme-switch{background:#111924;border-color:#364358}
html[data-theme="dark"] .theme-choice{color:#aebed3}
html[data-theme="dark"] .theme-choice[aria-pressed="true"]{background:#34465f;color:#edf5ff;box-shadow:0 1px 3px #0004}
@media(max-width:680px),(max-width:960px) and (pointer:coarse) and (max-height:600px){
 .appearance-setting{align-items:stretch;flex-direction:column;gap:16px}
 .appearance-setting .setting-name{min-height:35px}
 .theme-switch{width:100%;min-width:0;gap:3px}
 .theme-choice{min-height:40px;padding:9px 6px;font-size:12px}
}
@media(prefers-reduced-motion:reduce){.theme-choice{transition:none}}

/* Paint the root and scroll boundary as well as the content surface. */
html{min-height:100%;background:var(--canvas,#f5f6f8);overscroll-behavior-y:none}
body{min-height:100dvh;background:var(--canvas,#f5f6f8);overscroll-behavior-y:none}
