/* EDU product chrome is light-only. Loaded after the older role/workspace
   styles, whose dormant dark selectors are no longer activated by the app.
   The 3D viewport retains its own rendering background. */
html[data-theme="light"] {
  color-scheme: only light;
}

/* Teachers own their palette and shell in teacher-foundation.css. */
html[data-theme="light"] body:not(.edu-role-teacher) {
  --bg: #f6f8fb;
  --surface: #fff;
  --surface-2: #f1f5f9;
  --border: #d8e1eb;
  --text: #101828;
  --text-soft: #475569;
  --text-mute: #526175;
  --muted: #526175;
  --edu-bg: var(--bg);
  --edu-surface: var(--surface);
  --edu-surface-subtle: #f9fafb;
  --edu-text-primary: var(--text);
  --edu-text-secondary: var(--text-soft);
  --edu-text-tertiary: var(--text-mute);
  --edu-border: var(--border);
  --brand-700: #0e7490;
  --ok: #15803d;
  --warn: #92400e;
  --err: #b42318;
  color-scheme: only light;
  color: var(--text);
  background: var(--bg);
}

html[data-theme="light"] body .edu-sidebar,
html[data-theme="light"] body .edu-topbar {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

html[data-theme="light"] body .edu-main { background: var(--bg); }
html[data-theme="light"] body .brand,
html[data-theme="light"] body .sidebar-footer { border-color: var(--border); }
html[data-theme="light"] body .brand-title,
html[data-theme="light"] body .topbar-title,
html[data-theme="light"] body .topbar-user-name { color: var(--text); }
html[data-theme="light"] body .brand-sub,
html[data-theme="light"] body .sidebar-footer-credit,
html[data-theme="light"] body .topbar-user-sub { color: var(--text-soft); }
html[data-theme="light"] body:not(.edu-role-teacher) .nav-item,
html[data-theme="light"] body:not(.edu-role-teacher) .sidebar-collapse-btn { color: var(--text-soft); }
html[data-theme="light"] body:not(.edu-role-teacher) .nav-item:hover,
html[data-theme="light"] body:not(.edu-role-teacher) .nav-item.active,
html[data-theme="light"] body:not(.edu-role-teacher) .sidebar-collapse-btn:hover {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}
html[data-theme="light"] body .nav-item .nav-icon { color: currentColor; }
html[data-theme="light"] body .sidebar-footer { background: var(--surface); }
html[data-theme="light"] body .brand-title span { color: #0e7490 !important; }

html[data-theme="light"] body :is(input, select, textarea) {
  color-scheme: only light;
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--border);
}
html[data-theme="light"] body :is(input, textarea)::placeholder { color: var(--text-mute); opacity: 1; }
html[data-theme="light"] body :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}
html[data-theme="light"] body dialog {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  color-scheme: only light;
}

html[data-theme="light"] .login-brand-cyan { color: #0e7490; }
html[data-theme="light"] .login-logo { background: #1d4ed8; }
html[data-theme="light"] .login-inline-submit { background: #1d4ed8; color: #fff; }
html[data-theme="light"] .login-inline-submit:hover { background: #1e40af; }
html[data-theme="light"] .system-health-header {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}
html[data-theme="light"] .system-health-header h1 { color: var(--text); }
html[data-theme="light"] .system-health-header p,
html[data-theme="light"] .system-health-latency { color: var(--text-soft); }

/* The legacy role heroes and training buttons use !important. Keep these
   narrowly scoped overrides at the same priority; layout is unchanged. */
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-hero,
html[data-theme="light"] .action-card-dark {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-hero .hero-title { color: var(--text) !important; }
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-hero .hero-sub { color: var(--text-soft) !important; }
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-hero .hero-eyebrow { color: #0e7490 !important; }
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-metric {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
}
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-metric span { color: var(--text-soft) !important; }
html[data-theme="light"] :is(.admin-role-shell, .teacher-role-shell) .role-metric strong { color: #0e7490 !important; }

html[data-theme="light"] body .sim-lite-toolbar {
  background: var(--surface);
  border-color: var(--border);
}
html[data-theme="light"] body .sim-lite-toolbar :is(.h3, label) { color: var(--text); }
html[data-theme="light"] body .sim-lite-toolbar .sim-scenario-select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] body :is(.sim-viewport-floating-toolbar, .sim-lite-state, .k1-hud) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
html[data-theme="light"] body :is(.sim-camera-label, .k1-hud__toggle,
  .k1-hud__heading strong, .k1-hud__metrics b) { color: var(--text); }
html[data-theme="light"] body .sim-viewport-floating-toolbar {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}
html[data-theme="light"] body .sim-cam-btn { color: var(--text-soft) !important; }
html[data-theme="light"] body .sim-cam-btn:hover { color: #1d4ed8 !important; background: #eff6ff !important; }
html[data-theme="light"] body :is(.k1-hud__compact-state, .k1-hud__details summary,
  .k1-hud__toggle > span:last-child, .k1-hud__heading small) { color: #0e7490; }
html[data-theme="light"] body :is(.k1-hud__status, .k1-hud__details, .k1-hud__metrics small) { color: var(--text-soft); }
html[data-theme="light"] body :is(.k1-hud__metrics > span, .k1-hud__mode) { background: var(--surface-2); color: var(--text-soft); }
html[data-theme="light"] body .k1-hud__mode.active { background: #dbeafe; color: #1e40af; }
html[data-theme="light"] body .k1-hud__lock { color: #92400e; }
html[data-theme="light"] body .mc-status-pill.ready { background: #ecfdf3; color: #166534; }
html[data-theme="light"] body .mc-status-pill.active { background: #ecfeff; color: #0e7490; }
html[data-theme="light"] body .mc-status-pill.warn { background: #fffaeb; color: #92400e; }
html[data-theme="light"] body .mc-status-pill.danger { background: #fef3f2; color: #b42318; }
html[data-theme="light"] body .mc-status-pill.locked { background: #f5f3ff; color: #6b21a8; }
html[data-theme="light"] body .sim-training-btn {
  background: var(--surface-2) !important;
  color: var(--text-soft) !important;
  border-color: var(--border) !important;
}
html[data-theme="light"] body .sim-training-btn:is(:hover, :focus-visible, .active) {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

/* Physical-robot panels: presentation only. Safety states and disabled controls
   retain their behavior and distinct success/warning/danger meaning. */
html[data-theme="light"] .k1-control-page {
  --k1-bg: var(--bg);
  --k1-surface: var(--surface);
  --k1-surface-2: var(--surface-2);
  --k1-line: var(--border);
  --k1-text: var(--text);
  --k1-muted: var(--text-soft);
  --k1-cyan: #0e7490;
  --k1-blue: #1d4ed8;
  --k1-green: #15803d;
  --k1-amber: #92400e;
  --k1-red: #b42318;
  background: var(--bg);
}
html[data-theme="light"] :is(.k1-commandbar, .k1-robot-rail, .k1-status-strip, .k1-tabs,
  .k1-joint-detail, .k1-camera-modes, .k1-camera-stage, .k1-camera-empty, .k1-editor,
  .k1-log-console, .admin-k1-wave-demo) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
html[data-theme="light"] :is(.k1-commandbar h1, .k1-status-strip strong, .k1-tab.is-active,
  .k1-panel-title h2, .k1-editor-toolbar h2, .k1-joint-detail-head h3,
  .k1-joint-metrics strong, .k1-camera-empty strong, .k1-panel dd,
  .k1-stream-row strong, .k1-recording-summary strong, .k1-meta-grid strong,
  .admin-k1-wave-demo .h3) { color: var(--text); }
html[data-theme="light"] :is(.k1-panel th, .k1-joint-metrics span, .k1-panel dl div,
  .k1-camera-mode, .k1-stream-row, .k1-recording-streams label, .k1-recording-summary,
  .k1-confirm, .k1-path-row, .k1-panel pre, .admin-wave-sequence > span,
  .admin-wave-connection-grid > span) {
  background: var(--surface-2);
  color: var(--text-soft);
  border-color: var(--border);
}
html[data-theme="light"] :is(.k1-panel td, .k1-checklist label, .k1-log-row,
  .k1-stream-row em, .admin-k1-wave-demo .muted, .admin-wave-check,
  .admin-wave-checklist > summary, .admin-wave-check-hint) {
  color: var(--text-soft);
  border-color: var(--border);
}
html[data-theme="light"] :is(.k1-doc-link, .k1-editor-help code, .k1-panel-copy code,
  .k1-path-row code, .admin-wave-eyebrow) { color: #0e7490; }
html[data-theme="light"] :is(.k1-panel tbody tr:hover, .k1-joints-panel tbody tr.is-selected,
  .k1-camera-mode.is-active) { background: #eff6ff; color: #1d4ed8; }
html[data-theme="light"] .k1-badge.is-neutral { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
html[data-theme="light"] :is(.k1-badge.is-ok, .admin-wave-status.ready) { background: #ecfdf3; color: #166534; border-color: #abefc6; }
html[data-theme="light"] :is(.k1-btn.is-stop, .k1-badge.is-warning, .k1-confirm.is-critical,
  .admin-wave-status.blocked),
html[data-theme="light"] #k1-safety-reasons { background: #fffaeb; color: #92400e; border-color: #fedf89; }
html[data-theme="light"] :is(.k1-log-row.is-error) { color: #b42318; }
html[data-theme="light"] :is(.k1-log-row.is-success, .admin-wave-connection-grid > .ok) { color: #166534; }
html[data-theme="light"] .admin-wave-connection-grid > .blocked { color: #92400e; }

/* The separate Code Studio has its own legacy palette. Only the embedded 3D
   viewport keeps a rendering background; editors and tool panels stay light. */
html[data-theme="light"] .code-studio {
  --ide-bg: var(--surface);
  --ide-bg-soft: var(--surface-2);
  --ide-panel: var(--surface);
  --ide-panel-2: var(--surface-2);
  --ide-border: var(--border);
  --ide-text: var(--text);
  --ide-muted: var(--text-soft);
  --ide-blue: #1d4ed8;
  --ide-cyan: #0e7490;
  --ide-green: #15803d;
  border-color: var(--border);
  box-shadow: none;
}
html[data-theme="light"] :is(.code-studio__commandbar, .code-studio__select,
  .code-studio__activity, .code-studio__sidebar, .code-studio__level-tabs,
  .code-studio__editor-header, .code-studio__editor-host, .code-studio__block-palette,
  .code-studio__blocks-stage, .code-studio__block-canvas, .code-studio__generated-preview,
  .code-studio__generated-preview > header, .code-studio__bottom, .code-studio__statusbar,
  .code-studio__sim-placeholder, .code-studio__sim-error, .code-studio__sim-skeleton) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] :is(.code-studio__sidebar-splitter, .code-studio__workspace-splitter,
  .code-studio__workspace-splitter span, .code-studio__bottom-splitter,
  .code-studio__line-numbers, .code-studio__action, .code-studio__file.active,
  .code-studio__level-tab.active, .code-studio__path-step > span,
  .code-studio__k1-summary, .code-studio__k1-mode, .code-studio__k1-capabilities > div,
  .code-studio__k1-capabilities small, .code-studio__generated-preview header button) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] :is(.code-studio__project-heading, .code-studio__file,
  .code-studio__outline strong, .code-studio__mission-card h2,
  .code-studio__side-section > strong, .code-studio__path-step strong,
  .code-studio__k1-summary > strong, .code-studio__k1-mode b,
  .code-studio__k1-modes > strong, .code-studio__k1-pipeline > strong,
  .code-studio__k1-capabilities > strong, .code-studio__k1-pipeline b,
  .code-studio__breadcrumbs .current, .code-studio__generated-preview header strong,
  .code-studio__sim-placeholder strong, .code-studio__sim-error strong,
  .code-studio__learning-row strong, .code-studio__status-project,
  .code-studio__bottom-tabs button.active) { color: var(--text); }
html[data-theme="light"] :is(.code-studio__sidebar-title, .code-studio__outline,
  .code-studio__mission-card p, .code-studio__hint p, .code-studio__ark-note p,
  .code-studio__goal, .code-studio__side-intro, .code-studio__path-step,
  .code-studio__k1-summary p, .code-studio__k1-mode small,
  .code-studio__k1-pipeline small, .code-studio__block-palette-title,
  .code-studio__breadcrumbs, .code-studio__terminal, .code-studio__terminal-command,
  .code-studio__bottom-tabs button, .code-studio__activity-button,
  .code-studio__level-tab, .code-studio__editor-actions button) { color: var(--text-soft); }
html[data-theme="light"] :is(.code-studio__eyebrow, .code-studio__mission-meta,
  .code-studio__k1-summary > span, .code-studio__language-badge,
  .code-studio__generated-preview pre, .code-studio__learning-row a,
  .code-studio__editor-actions .code-studio__simulator-focus-button) { color: #0e7490; }
html[data-theme="light"] :is(.code-studio__action:hover, .code-studio__layout-action.active,
  .code-studio__file:hover, .code-studio__level-tab:hover,
  .code-studio__activity-button:is(:hover, .active),
  .code-studio__editor-actions button:hover) { background: #eff6ff; color: #1d4ed8; }
html[data-theme="light"] :is(.code-studio__target-badge, .code-studio__target-badge small,
  .code-studio__target-badge strong, .code-studio__save-state,
  .code-studio__ark-note strong, .code-studio__empty-state,
  .code-studio__terminal .log-success, .code-studio__terminal-command span:first-child,
  .code-studio__k1-capabilities .status-ready small) { color: #166534; }
html[data-theme="light"] :is(.code-studio__save-state.dirty, .code-studio__hint strong,
  .code-studio__terminal .log-warn, .code-studio__k1-capabilities .status-beta small) { color: #92400e; }
html[data-theme="light"] :is(.code-studio__terminal .log-error, .code-studio__problems,
  .code-studio__problems > div > span:first-child, .code-studio__statusbar .has-errors) { color: #b42318; }
html[data-theme="light"] .code-studio__textarea { caret-color: var(--text); }
html[data-theme="light"] .code-studio__level-number { background: #dbeafe; color: #1e40af; }
html[data-theme="light"] .code-studio__file-icon.lang-python { color: #92400e; }
html[data-theme="light"] .code-studio__file-icon.lang-cpp { color: #1d4ed8; }
html[data-theme="light"] .code-studio__file-icon.lang-blocks { color: #7e22ce; }
html[data-theme="light"] .code-studio__file-icon.lang-yaml { color: #b42318; }

/* Training CSS is lazy-loaded after this file. Theme-qualified selectors keep
   the challenge browser, briefing and results light regardless of load order. */
html[data-theme="light"] :is(.training-challenge-browser, .training-objectives-hud,
  .training-briefing, .training-leaderboard, .training-replay-player, .tso-card) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] :is(.tcb-card, .toh-obj, .tso-breakdown, .tso-feedback,
  .tso-btn, .tb-objectives li, .tb-param, .tb-hints, .tb-code, .tl-entry--top,
  .tl-myrank, .toh-progress-bar) {
  background: var(--surface-2);
  color: var(--text-soft);
  border-color: var(--border);
}
html[data-theme="light"] :is(.tcb-title, .tcb-card-title, .tso-title, .tso-score-value,
  .tso-breakdown-label, .tb-title, .tb-section h3, .tb-param strong, .tl-name) { color: var(--text); }
html[data-theme="light"] :is(.tcb-subtitle, .tcb-card-desc, .tcb-stats-row, .toh-timer,
  .toh-metric, .tso-percentage, .tso-breakdown-detail, .tb-back, .tb-desc,
  .tb-param span, .tb-hints li, .tl-time, .trp-time) { color: var(--text-soft); }
html[data-theme="light"] :is(.tcb-card:hover, .tso-btn:hover, .tso-btn--retry:hover) { background: #eff6ff; color: #1d4ed8; }
html[data-theme="light"] :is(.tcb-card--passed, .toh-obj--done, .tso-btn--next:hover) { background: #ecfdf3; }
html[data-theme="light"] :is(.tcb-passed, .toh-obj--done .toh-obj-icon,
  .tso-breakdown-score, .tso-btn--next) { color: #166534; }
html[data-theme="light"] :is(.toh-timer--warning, .toh-obj-pts, .tb-obj-pts, .tl-score) { color: #92400e; }
html[data-theme="light"] .tso-neg { color: #b42318; }
html[data-theme="light"] :is(.tso-btn--retry, .tb-code) { color: #1d4ed8; }
/* Assignment context is product UI, independent of simulator controls. */
.robotlab-assignment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #172b4d;
}
.robotlab-assignment p { margin: .35rem 0 0; }
.robotlab-assignment [role="alert"] { color: #991b1b; }
.robotlab-assignment button:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.robotlab-assignment button:disabled { cursor: default; opacity: .65; }
