html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --theme-page: #101010;
  --theme-surface: #181818;
  --theme-surface-muted: #242424;
  --theme-border: #3a3a3a;
  --theme-text: #eeeeee;
  --theme-muted: #adadad;
  --theme-accent: #eeeeee;
  --theme-primary: #2c2c2c;
  --theme-chrome: #222222;
  --theme-on-primary: #f2f2f2;
  --theme-success: #dddddd;
  --theme-success-surface: #242424;
  --theme-warning: #dddddd;
  --theme-warning-surface: #242424;
  --theme-danger: #eeeeee;
  --theme-danger-surface: #242424;
  --theme-selected: #ffffff1a;
  --theme-shadow: #00000066;
}
theme-toggle { display: inline-flex; align-items: center; flex: 0 0 auto; }
theme-toggle .theme-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-height: 44px; padding: 10px;
  border: 1px solid var(--theme-border, #cfdae2); border-radius: 8px;
  background: var(--theme-surface, #fff); color: var(--theme-text, #172e43);
  cursor: pointer; touch-action: manipulation;
}
theme-toggle .theme-button:hover { background: var(--theme-surface-muted, #edf6fb); }
theme-toggle .theme-button:focus-visible { outline: 3px solid var(--theme-accent, #006daa); outline-offset: 3px; }
theme-toggle svg { display: block; pointer-events: none; }
.login-page > theme-toggle { position: absolute; right: 24px; top: 24px; }
.login-page { padding-top: 88px; padding-bottom: 88px; }
.topbar > theme-toggle { margin-left: auto; margin-right: 14px; }
.staff-topbar > theme-toggle { margin-left: auto; }
.admin-header > theme-toggle { margin-left: auto; }
.exam-demo-nav > theme-toggle .theme-button { width: 36px; height: 36px; min-height: 36px; padding: 7px; }
.exam-demo-nav { min-height: 56px; }
.account-exam .exam-demo-nav { min-height: 56px; }
html[data-theme="dark"] body { background-color: var(--theme-page); color: var(--theme-text); }
html[data-theme="dark"] :is(input, select, textarea) { color-scheme: dark; background-color: var(--theme-surface); color: var(--theme-text); }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--theme-muted); opacity: 1; }
html[data-theme="dark"] .button.primary { background: #e5e5e5; color: #161616; }
html[data-theme="dark"] .button.primary:hover { background: #fff; }
html[data-theme="dark"] .brand-mark { background: var(--theme-primary); }
html[data-theme="dark"] .brand-mark span { background: var(--theme-on-primary); }
html[data-theme="dark"] .explanation-button { background-image: none; width: auto; padding: 2px 8px; border: 1px solid var(--theme-border); border-radius: 4px; color: var(--theme-text); font: 12px "Segoe UI", sans-serif; }
html[data-theme="dark"] .explanation-button::before { content: 'Answer explanation'; }
html[data-theme="dark"] .footer-image-button { background-image: none !important; font-size: 12px; width: auto; padding: 0 8px !important; }
html[data-theme="dark"] .sprite-button { background-image: none; font-size: 13px; color: var(--theme-text); background-color: var(--theme-primary); }
html[data-theme="dark"] :is(.exam-header img, .exam-toolbar img, #exam-footer img, .dialog-titlebar img, .message-content > img, .review-flag) { filter: grayscale(1); }
html[data-theme="dark"] .trend-chart line { stroke: var(--theme-border); }
html[data-theme="dark"] .trend-chart text { fill: var(--theme-muted); }
html[data-theme="dark"] .trend-chart polyline { stroke: var(--theme-accent); }
html[data-theme="dark"] .trend-chart circle { fill: var(--theme-accent); }
@media (max-width: 760px) {
  .topbar > theme-toggle { margin-right: 0; }
  .staff-topbar { align-items: center; }
  .staff-topbar > .muted { order: 1; flex-basis: 100%; }
  .admin-header { flex-wrap: wrap; }
  .admin-header > div { flex-basis: 100%; }
  .exam-demo-nav { gap: 8px; }
  .exam-demo-nav > span { display: none; }
  .login-page > theme-toggle { right: 16px; top: 16px; }
}
:root .ui-icon{width:20px;height:20px;display:inline-block;vertical-align:middle;flex-shrink:0;pointer-events:none}
.button .ui-icon{width:17px;height:17px;margin-right:7px}
.button .ui-icon.trailing-icon{margin-right:0}
.nav-icon .ui-icon{display:block}
.badge .ui-icon{width:15px;height:15px;margin-right:6px}
.subject-number .ui-icon{width:27px;height:27px}
.portal-page .empty-mark.ui-icon{width:34px;height:34px;margin:0 auto 12px;color:var(--muted)}
.portal-page .feature-decoration.ui-icon{width:112px;height:112px;opacity:.16;transform:rotate(-12deg)}
.staff-sidebar nav a .ui-icon,.sidebar-foot a .ui-icon,.admin-nav a .ui-icon{margin-right:10px;width:18px;height:18px}
.staff-sidebar nav a{justify-content:flex-start}
.staff-sidebar nav a.advanced-link>span{margin-left:auto}
.desk-totals dt .ui-icon{width:18px;height:18px;margin-right:7px;color:var(--theme-accent,#006daa)}
.staff-shell .empty-state .ui-icon{display:block;margin:0 auto 10px;color:var(--theme-muted,#667788);width:27px;height:27px}
.staff-token-login{margin-top:24px;font-size:13px;color:var(--theme-text,#333)}
.staff-token-login summary{cursor:pointer;padding:10px 0}
.staff-token-login p{line-height:1.6}
#staff-token-create{display:grid;gap:14px;max-width:400px;margin:20px 0}
#staff-token-output:not(:empty){margin:18px 0}
