:root{--theme-accent:#ad2434;--theme-strong:#8a1c2b;--theme-soft:#fbf0f2;--theme-bg:#f3f5f7;--theme-surface:#fff;--theme-subtle:#f3f5f8;--theme-text:#263344;--theme-muted:#647183;--theme-line:#dfe5ec}
:root[data-theme=blue]{--theme-accent:#245fc1;--theme-strong:#184993;--theme-soft:#edf3ff;--theme-bg:#f0f4fa}
:root[data-theme=green]{--theme-accent:#147766;--theme-strong:#105b4e;--theme-soft:#eaf6f2;--theme-bg:#f0f5f3}
:root[data-theme=purple]{--theme-accent:#7051aa;--theme-strong:#563b87;--theme-soft:#f3eefb;--theme-bg:#f4f2f8}
:root[data-theme=graphite]{--theme-accent:#4e5e72;--theme-strong:#334155;--theme-soft:#edf0f4;--theme-bg:#f2f3f5}
:root[data-theme=night]{color-scheme:dark;--theme-accent:#91b5ff;--theme-strong:#b7cfff;--theme-soft:#283751;--theme-bg:#141b26;--theme-surface:#1d2735;--theme-subtle:#253142;--theme-text:#e6edf6;--theme-muted:#a6b4c7;--theme-line:#3a485c}
:root{--v2-accent:var(--theme-accent);--v2-soft:var(--theme-soft);--v2-bg:var(--theme-bg);--v2-surface:var(--theme-surface);--v2-text:var(--theme-text);--v2-muted:var(--theme-muted);--v2-line:var(--theme-line);--red:var(--theme-accent);--deep:var(--theme-strong);--ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-line);--paper:var(--theme-surface);--ui-accent:var(--theme-accent)}
.theme-entry{border:0!important;background:transparent!important;color:var(--theme-muted)!important;white-space:nowrap;padding:7px 10px!important;font-size:12px!important;cursor:pointer}
body.portal-home>.theme-entry{position:absolute;right:22px;top:20px}
.theme-dialog{width:min(560px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;padding:24px!important;border:1px solid var(--theme-line);border-radius:12px;background:var(--theme-surface);color:var(--theme-text)}
.theme-dialog::backdrop{background:#111a2b66}.theme-dialog header{display:flex;align-items:start;justify-content:space-between;gap:16px}.theme-dialog h2{margin:0;font-size:21px}.theme-dialog p{font-size:12px;color:var(--theme-muted);margin:6px 0 20px}.theme-close{background:transparent!important;border:0!important;color:var(--theme-muted)!important;font-size:24px!important;padding:0!important;min-width:32px;cursor:pointer}.theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.theme-options>button{display:grid;text-align:left;gap:7px;padding:10px!important;border:1px solid var(--theme-line)!important;background:var(--theme-surface)!important;color:var(--theme-text)!important;border-radius:8px!important;cursor:pointer}.theme-options>button[aria-pressed=true]{border:2px solid var(--theme-accent)!important;padding:9px!important}.theme-options strong{font-size:13px}.theme-options small{color:var(--theme-muted);font-size:11px}.theme-options>button[aria-pressed=true] small{font-size:0}.theme-options>button[aria-pressed=true] small:after{content:'当前主题';font-size:11px;color:var(--theme-accent)}.theme-sample{height:64px;display:flex;gap:7px;padding:9px;background:#eef1f6;border-radius:4px}.theme-sample>i{width:20%;background:var(--sample-accent);border-radius:3px}.theme-sample>span{flex:1;display:grid;gap:6px}.theme-sample b{background:#fff;border-radius:3px}.theme-sample-night{background:#141b26}.theme-sample-night b{background:#334155}.theme-dialog footer{margin-top:18px;color:var(--theme-muted);font-size:11px}
body.portal-home{background:var(--theme-bg)!important;color:var(--theme-text)}
body.portal-home :is(.login-card,.login-panel,.portal-card){background:var(--theme-surface)!important;color:var(--theme-text);border-color:var(--theme-line)!important}
body.portal-home input{background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
body.portal-home button[type=submit]{background:var(--theme-accent)!important;color:var(--theme-surface)!important}
body.workspace :is(.panel,.portal-topbar,.profile,.achievement-summary,.student-profile-panel,dialog,.theme-dialog){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-line)}
body.workspace .shell>nav>button.active{background:var(--theme-surface)!important}
body.workspace :is([data-homeroom-work-tabs],[data-teaching-work-tabs]){background:var(--theme-subtle);border-color:var(--theme-line)}
body.workspace :is([data-homeroom-work-tabs],[data-teaching-work-tabs])>button.active{background:var(--theme-surface)!important;color:var(--theme-accent)!important}
body.workspace #star-campus-teacher{--star-ink:var(--theme-text);--star-muted:var(--theme-muted);--star-line:var(--theme-line);--star-paper:var(--theme-surface);--star-canvas:var(--theme-subtle)}
body.workspace #star-campus-teacher :is(.star-form,.star-student-picker){background:var(--theme-surface);border-color:var(--theme-line)}
body.workspace #star-campus-teacher :is(.star-form fieldset,.star-student-picker-head,.star-selected-students,.star-award-split){background:var(--theme-subtle);border-color:var(--theme-line)}
@media(max-width:540px){.theme-options{grid-template-columns:repeat(2,minmax(0,1fr))}.theme-dialog{padding:18px!important}}
body.portal-home{--red:var(--theme-accent);--deep:var(--theme-strong);--ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-line)}
body.portal-home :is(.portal-topbar,.login-book,.book-page){background:var(--theme-surface)!important;border-color:var(--theme-line)!important;color:var(--theme-text)!important}
body.portal-home .bookmark-tabs{background:var(--theme-subtle)!important}
body.portal-home .bookmark-tabs button{background:transparent!important;color:var(--theme-muted)!important}
body.portal-home .bookmark-tabs button.active{background:var(--theme-surface)!important;color:var(--theme-accent)!important}
body.portal-home .login-submit{background:var(--theme-accent)!important;color:#fff!important}
body.portal-home :is(h1,h2,label){color:var(--theme-text)!important}
body.portal-home :is(h1 em,.forgot-link,.entry-links a){color:var(--theme-accent)!important}
body.portal-home .login-view>p{color:var(--theme-muted)!important}
html[data-theme=night] body.workspace :is(.panel,.profile,.achievement-card,.achievement-hero,.student-profile-dialog,.book-page,dialog,.roster-modal-content,.seat-personalize,.seat-save-panel,.seat-waiting){background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
html[data-theme=night] body.workspace :is(input,select,textarea,th,td){background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
html[data-theme=night] body.workspace :is(.ui-secondary,.ui-nav-action,.demo,.lessons article,.achievement-summary article,.seat-board-wrap,.student-profile-summary){background:var(--theme-subtle)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
html[data-theme=night] body.workspace :is(.ui-primary,.star-primary){background:var(--theme-accent)!important;color:#141b26!important}
html[data-theme=night] body.workspace :is(h1,h2,h3,.achievement-summary b){color:var(--theme-text)!important}
html[data-theme=night] body.workspace :is(.achievement-summary span,.theme-dialog p){color:var(--theme-muted)!important}
html[data-theme=night] body.portal-home .login-submit{color:#141b26!important}
body .theme-entry.ui-action{background:transparent!important;color:var(--theme-muted)!important;border:0!important;box-shadow:none!important}
body .theme-dialog>header,body .theme-dialog>footer{background:var(--theme-surface)!important;color:var(--theme-muted)!important;border-color:var(--theme-line)!important}
body .theme-dialog h2{color:var(--theme-text)!important}
html[data-theme=night] body.workspace .shell>nav>button{background:transparent!important;color:var(--theme-muted)!important}
html[data-theme=night] body.workspace .shell>nav>button.active{background:var(--theme-subtle)!important;color:var(--theme-accent)!important}
html[data-theme=night] body.workspace .portal-topbar{color:var(--theme-muted)}
html[data-theme=night] body.workspace .portal-topbar>div>span{color:var(--theme-muted)!important}
/* Preserve the transparent school mark and render its ink white at night. */
html[data-theme=night] .portal-topbar img[src*="school-logo"],html[data-theme=night] .portal-topbar img[src*="school-emblem"]{filter:brightness(0) invert(1)}
:root[data-theme=night]{--night-surface:var(--theme-surface);--night-ink:var(--theme-text)}
html[data-theme=night] body.workspace :is(.work-plan-day.active,.work-plan-day.today,.work-plan-week-day.active,.week-day.active){background:var(--theme-soft)!important;color:var(--theme-text)!important}
html[data-theme=night] body.workspace button:not(.star-primary):not(.ui-primary):not(.ui-danger):not(.seat-slot):not(.seat-aisle-toggle):not(.theme-options button){color:var(--theme-text)}
body.workspace .content :is([data-homeroom-work-tabs],[data-teaching-work-tabs]){display:none!important}
body.workspace .shell>nav>.workspace-nav-group{display:grid;gap:2px;margin:2px 0 10px;padding:2px 0 2px 12px;border-left:1px solid var(--theme-line)}
body.workspace .shell>nav>.workspace-nav-group[hidden]{display:none!important}
body.workspace .workspace-nav-group>button{width:100%;min-height:36px;padding:7px 10px!important;border:0!important;background:transparent!important;color:var(--theme-muted)!important;text-align:left;border-radius:5px!important;font-size:13px!important;white-space:nowrap}
body.workspace .workspace-nav-group>button.active{background:var(--theme-soft)!important;color:var(--theme-accent)!important;font-weight:600}
body.workspace .workspace-nav-parent{display:flex;align-items:center;justify-content:space-between;gap:5px}
body.workspace .workspace-nav-parent:after{content:'⌄';font-size:14px;transform:rotate(-90deg)}
body.workspace .workspace-nav-parent[aria-expanded=true]:after{transform:none}
@media(max-width:900px){body.workspace .shell>nav{flex-wrap:wrap;overflow:visible}body.workspace .shell>nav>.workspace-nav-group{flex:0 0 100%;display:flex;flex-wrap:wrap;gap:5px;border-left:0;padding:7px;background:var(--theme-subtle);border-radius:7px;margin:0 0 5px}body.workspace .workspace-nav-group>button{width:auto;flex:0 0 auto}}
@media(max-width:540px){body.workspace .portal-topbar img{width:156px}body.workspace .portal-topbar>div{display:flex;align-items:center;gap:4px;flex-wrap:nowrap}body.workspace .portal-topbar>div>span{display:none}body.workspace .portal-topbar a,body.workspace .portal-topbar .theme-entry{white-space:nowrap;font-size:11px!important}body.workspace .portal-topbar .theme-entry{padding:6px!important}}
:root[data-theme=night] body.workspace .shell>nav>.workspace-nav-group>button{background:transparent!important;color:var(--theme-muted)!important;border:0!important;box-shadow:none}
:root[data-theme=night] body.workspace .shell>nav>.workspace-nav-group>button.active{background:var(--theme-soft)!important;color:var(--theme-accent)!important}
/* Published allowances and daily work use the same theme surfaces as the workspace. */
body.workspace #allowance-publication :is(.allowance-public-status,.allowance-personal-summary article,.allowance-breakdown article,.allowance-teacher-daily-head,.allowance-day-list details,.allowance-day-list details>div){background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important;box-shadow:none}
body.workspace #allowance-publication :is(.allowance-personal-summary article:last-child,.allowance-day-list details[open] summary){background:var(--theme-subtle)!important}
body.workspace #allowance-publication :is(.allowance-public-status b,.allowance-personal-summary b,.allowance-breakdown b,.allowance-teacher-daily-head b,.allowance-teacher-daily-head span,.allowance-day-list strong){color:var(--theme-accent)!important}
body.workspace #allowance-publication :is(.allowance-public-status small,.allowance-breakdown small,.allowance-personal-summary small,.allowance-teacher-daily-head small){color:var(--theme-muted)!important}
body.workspace #allowance-publication .allowance-breakdown article.empty{opacity:1}
body.workspace :is(.allowance-publication-state,.allowance-lock-state){background:var(--theme-subtle)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
body.workspace .homework-class-options label{background:var(--theme-subtle)!important;color:var(--theme-text)!important}
body.workspace #discipline{--line:var(--theme-line);--muted:var(--theme-muted);--deep:var(--theme-text);--accent:var(--theme-accent)}
body.workspace .discipline-warning-list article{background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important;border-left-color:var(--theme-accent)!important}
body.workspace .discipline-warning-list article :is(b,strong,.discipline-student-link,.student-profile-link){color:var(--theme-text)!important}
body.workspace .discipline-warning-list article small{color:var(--theme-muted)!important}
body.workspace .discipline-warning-list article em{background:var(--theme-soft)!important;color:var(--theme-accent)!important}
body.workspace #discipline .discipline-sync-status span{background:var(--theme-subtle)!important;color:var(--theme-muted)!important;border-color:var(--theme-line)!important}
body.workspace .homeroom-evaluation{--eval-red:var(--theme-accent);--eval-ink:var(--theme-text);--eval-muted:var(--theme-muted);--eval-line:var(--theme-line);--eval-cream:var(--theme-subtle)}
body.workspace .evaluation-hero .evaluation-state{background:var(--theme-subtle)!important;border-color:var(--theme-line)!important}
body.workspace :is(.evaluation-toolbar-actions,.discipline-branch-tabs){background:transparent!important}
html[data-theme=night] body.workspace button.ui-danger{color:#ffb4bb!important;border-color:#b86d76!important;background:#422b35!important}
body.workspace :is(.achievement-loading,.achievement-error,.achievement-level-guide){background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-line)!important}
body.workspace :is(.achievement-card>p,.achievement-card header small,.achievement-metric>span,.achievement-metric>small,.achievement-level-guide small,.achievement-footnote,.achievement-loading small){color:var(--theme-muted)!important}
body.workspace .achievement-card header em{background:var(--theme-subtle)!important;color:var(--theme-muted)!important}
body.workspace .achievement-progress{background:var(--theme-line)!important}
body.workspace .achievement-progress i{background:var(--theme-accent)!important}
body.workspace .achievement-tiers span{background:var(--theme-subtle)!important;opacity:1;filter:none}
body.workspace .achievement-tiers span:not(.reached){color:var(--theme-muted)!important}
body.workspace .achievement-tiers small{color:var(--theme-muted)!important}
body.workspace .discipline-competition>summary>i{background:var(--theme-subtle)!important;color:var(--theme-accent)!important;border-color:var(--theme-line)!important}
body.workspace .evaluation-dialog{--eval-red:var(--theme-accent);--eval-ink:var(--theme-text);--eval-muted:var(--theme-muted);--eval-line:var(--theme-line)}
body.workspace .evaluation-toolbar-actions,body.workspace .evaluation-toolbar-actions button+button{border-color:var(--theme-line)!important}
html[data-theme=night] body.workspace .schedule-legend .morning{background:#403727;color:#f0cb7a}
html[data-theme=night] body.workspace .schedule-legend .daytime{background:#25354b;color:#b4d0f7}
html[data-theme=night] body.workspace .schedule-legend .evening{background:#36304a;color:#d3befa}
html[data-theme=night] body.workspace .schedule-legend .current{background:#253d37;color:#a5dfc2}

/* Compact source metadata and password visibility controls. */
body.workspace #discipline .discipline-sync-status{background:var(--theme-subtle)!important;color:var(--theme-muted)!important;border:1px solid var(--theme-line)!important;border-left:0!important;border-radius:6px;padding:10px 14px;gap:8px 24px;line-height:1.6}
body.workspace #discipline .discipline-sync-status span{background:transparent!important;border:0!important;flex-wrap:wrap}
body.workspace #discipline .discipline-sync-status b{color:var(--theme-text)!important;font-weight:600}
body.workspace .admin-demo-login .password-field input{padding-right:66px}
body.workspace .admin-demo-login [data-admin-password-toggle]{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:auto;min-width:44px;min-height:32px;padding:4px 8px;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important;color:var(--theme-muted)!important;font-size:12px;font-weight:500;white-space:nowrap}
body.workspace .admin-demo-login [data-admin-password-toggle]:hover{color:var(--theme-accent)!important}
body.workspace .admin-demo-login [data-admin-password-toggle]:focus-visible{outline:2px solid var(--theme-accent)!important;outline-offset:1px;border-radius:3px!important}
/* Audit: semantic survey states must remain legible on dark surfaces. */
html[data-theme=night] :is(.survey-state.done,.survey-status-chip.final,.survey-complete-badge){background:#203c32!important;color:#a2e8bf!important;border-color:#456b58!important}
html[data-theme=night] :is(.survey-state.pending,.survey-status-chip.draft){background:#403723!important;color:#f4d28b!important;border-color:#71613c!important}
html[data-theme=night] .survey-signature-status span{color:#a2e8bf!important}
/* Shared select affordance: consistent inset and text clearance across portal pages. */
html body select:not([multiple]):not([size]),html body select[size="1"]{
 -webkit-appearance:none!important;appearance:none!important;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5' fill='none' stroke='%23798596' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;
 background-repeat:no-repeat!important;background-position:right 13px center!important;background-size:12px 8px!important;padding-right:35px!important;
}
html[data-theme=night] body select:not([multiple]):not([size]),html[data-theme=night] body select[size="1"]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5' fill='none' stroke='%23b4bfce' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important}
@media(forced-colors:active){html body select:not([multiple]):not([size]),html body select[size="1"]{appearance:auto!important;background-image:none!important;padding-right:10px!important}}
