:root{color-scheme:light}
:root[data-theme="dark"]{color-scheme:dark;--ink:#e0eae8;--muted:#a6b8b4;--paper:#151d21;--card:#202b30;--green:#85c9b1;--mint:#29483e;--orange:#f2a485;--line:#3b494e;--purple:#c1abdc}
.theme-toggle{flex-shrink:0;width:auto;margin:0;padding:8px 12px;border:1px solid #85958c;border-radius:20px;background:transparent;color:inherit;font:600 12px system-ui;cursor:pointer;white-space:nowrap}
.theme-toggle:focus-visible{outline:3px solid #77a998;outline-offset:3px}
.theme-floating{position:fixed;right:20px;top:20px;width:auto}
[data-theme="dark"] body{background:var(--ui-bg);color:var(--ui-text)}
[data-theme="dark"] .shell{background:var(--ui-bg)}
[data-theme="dark"] .topbar{background:var(--ui-surface);border-color:var(--line)}
[data-theme="dark"] :is(aside,.checkin-card,.mistake-panel){background:var(--card);border-color:var(--line)}
[data-theme="dark"] .time-card{background:#233a33;border-color:#406054}
[data-theme="dark"] .time-card.is-open{background:#413329;border-color:#755845}
[data-theme="dark"] .progress-card{background:#233e38;color:#eaf4f0}
[data-theme="dark"] :is(.subject.active,.subject:hover){background:#2b443b;border-color:#496d5d}
[data-theme="dark"] :is(.subject>span,.subject.active>span,.mode-switch,.task-check span,.week-dots i){background:var(--ui-surface-muted);color:var(--ui-muted)}
[data-theme="dark"] .mode-switch button.active{background:var(--ui-accent-soft);color:var(--ui-accent)}
[data-theme="dark"] :is(.subject-pill,.mistake-list article>span){background:var(--ui-accent-soft);color:var(--ui-accent)}
[data-theme="dark"] .scene-pill{background:#49402e;color:#eed5a5}
[data-theme="dark"] :is(.task textarea,.reflection textarea,.mistake-panel textarea,.mistake-panel select,.grade-form input,.grade-form select,.grade-form textarea,.history-heading select,.calendar-mode select){background:var(--ui-bg);color:var(--ink);border-color:var(--line)}
[data-theme="dark"] :is(.checkin-head,.task,.week-card,.choice-row label,.mistake-list article,footer){border-color:var(--line)}
[data-theme="dark"] :is(.task.done .task-check span,.week-dots .complete i,.save-button,.brand-mark,.calendar-day.is-today time){background:var(--ui-accent);color:var(--ui-on-accent)}
[data-theme="dark"] .parent-panel{background:#332e29;border-color:#5c4e41}
[data-theme="dark"] .parent-panel button{background:#48382f;color:#fac4a8;border-color:#7d5c48}
[data-theme="dark"] .parent-icon{background:#634735;color:#ffd7bf}
[data-theme="dark"] :is(.calendar-toolbar button,#paperViewer){background:var(--ui-surface);color:var(--ink)}
[data-theme="dark"] :is(.calendar-day.outside-month,.calendar-toolbar button:disabled){background:var(--ui-surface-muted);color:var(--ui-muted)}
[data-theme="dark"] #gradeRows tr:focus{background:var(--ui-accent-soft)}
[data-theme="dark"] :is(.calendar-subject.math,.calendar-subject.rate-high){background:#2b523c;color:#beecc9}
[data-theme="dark"] :is(.calendar-subject.chinese,.calendar-subject.rate-low){background:#633d36;color:#ffd1c7}
[data-theme="dark"] :is(.calendar-subject.social,.calendar-subject.rate-middle){background:#554c2b;color:#f6e0a1}
[data-theme="dark"] .calendar-subject.english{background:#2f4d67;color:#c5e1ff}
[data-theme="dark"] .calendar-subject.science{background:#4e3e62;color:#e6d2ff}
[data-theme="dark"] :is(.brand small,.aside-label,.task-body>label small,.form-footer p,.checkin-head p,.reflection small,.subject small,.subject-status,footer,.empty,.week-dots small){color:var(--ui-muted)}
[data-theme="dark"] :is(.parent-panel p,.time-card small,.time-card p){color:var(--ui-muted)!important}
[data-theme="dark"] textarea::placeholder,[data-theme="dark"] input::placeholder{color:#94a49f}
[data-theme="dark"] body>main{background:var(--ui-surface);border-color:var(--ui-border)}
[data-theme="dark"] body>main :is(p,label){color:var(--ui-muted)}
[data-theme="dark"] body>main input{background:var(--ui-bg);color:var(--ui-text);border-color:var(--ui-border)}
[data-theme="dark"] #message{color:#ffb7a7}
@media(max-width:650px){.topbar{height:auto;min-height:82px;flex-wrap:wrap;gap:10px;padding-top:12px;padding-bottom:12px}.topbar .date-block{margin-left:auto}}
