/* R8 CSS-only: use palette tokens for the reviewed Settings/Teacher/Studio surfaces. */
:root[data-appearance] :is(.settings-title, .settings-panel label,
  .teacher-lab__brand strong, .teacher-lab__mobile-brand,
  .teacher-lab__nav a.active, .teacher-lab__mobile-nav a.active) {
  color: var(--text-primary);
}
:root[data-appearance] :is(.settings-subtitle, .settings-hint,
  .analytics-hud-nav-group summary, .teacher-lab__nav a,
  .teacher-lab__mobile-nav a, .teacher-lab__mobile-user small,
  .studio-muted, .studio-ui-brand__sub, .studio-ui-card__head p,
  .studio-ui-topbar p, .studio-ui-user span, .studio-metric__label,
  .teacher-lab-card span) {
  color: var(--text-secondary);
}
:root[data-appearance] :is(.teacher-lab__brand span, .teacher-lab__logo,
  .teacher-lab__nav-icon, .studio-metric__trend) {
  color: var(--accent-soft);
}
:root[data-appearance] :is(.teacher-lab__nav a.active,
  .teacher-lab__mobile-nav a.active, .studio-chip-list a,
  .studio-chip-list span, .studio-metric) {
  background: var(--bg-panel-alt);
  border-color: var(--border-soft);
  color: var(--text-primary);
}
:root[data-appearance] .teacher-lab__select select {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
:root[data-appearance] :is(.teacher-lab-panel, .teacher-lab__topbar) {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
:root[data-appearance] :is(.teacher-lab-panel h2,
  .teacher-lab__profile strong, .teacher-lab__role strong,
  .teacher-lab-card strong) {
  color: var(--text-primary);
}
:root[data-appearance] :is(.teacher-lab-empty, .teacher-lab-row span,
  .teacher-lab-activity span, .teacher-lab-assignment span,
  .teacher-lab__profile span, .teacher-lab__role span,
  .teacher-lab__select span, .teacher-lab__period span) {
  color: var(--text-secondary);
}
:root[data-appearance] .teacher-lab__period button {
  background: var(--bg-panel-alt);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
:root[data-appearance] .teacher-lab__period button.active {
  background: var(--accent-main);
  color: var(--bg-app);
}
:root[data-appearance] :is(.teacher-lab-row a, .teacher-lab-panel > a,
  .teacher-lab-assignment a, .teacher-lab-actions a) {
  color: var(--accent-soft);
}
:root[data-appearance] .studio-metric__label { color: var(--text-secondary); }
.settings-panel .settings-row:has(> .glass) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px;
  margin-top: 15px;
}
:root[data-appearance] .studio-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
}
:root[data-appearance] :is(.teacher-lab__main, .studio-ui-main,
  .studio-ui-content, .studio-grid-2 > *) { min-width: 0; }
:root[data-appearance] .nt-mode-switch { flex-wrap: wrap; max-width: 100%; }
:root[data-appearance] .nt-mode-link {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 1050px) {
  :root[data-appearance] .teacher-lab__mobile-nav {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  :root[data-appearance] .teacher-lab__mobile-nav a {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
@media (max-width: 600px) {
  .settings-panel .settings-row:has(> .glass) { grid-template-columns: minmax(0, 1fr) !important; }
}
:root[data-appearance] .teacher-lab__metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
}
:root[data-theme="light"] .teacher-lab { color-scheme: light; }
:root[data-theme="dark"] .teacher-lab { color-scheme: dark; }

:root[data-appearance] .settings-panel .hud-select {
  background: var(--bg-panel) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-soft) !important;
  min-width: 0;
  max-width: 100%;
}
:root[data-appearance] .teacher-lab__select select {
  color: var(--text-primary) !important;
  min-width: 0;
  max-width: 100%;
}

/* R7 screenshot review: preserve full metric values and readable shared controls. */
:root[data-appearance] .teacher-lab-card strong {
  font-size: clamp(24px, 4vw, 26px);
  overflow-wrap: anywhere;
}
:root[data-appearance] :is(.analytics-hud-status, .teacher-lab__avatar,
  .studio-ui-search, .studio-ui-user, .studio-ui-nav button,
  .studio-ui-sidebar__foot button, .studio-icon-button) {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
:root[data-appearance] .studio-ui-nav button.active {
  background: var(--bg-panel-alt);
  color: var(--text-primary);
  border-color: var(--accent-main);
  font-weight: 700;
}

/* R8 narrow-card label finding; retain the full label text. */
:root[data-appearance] .teacher-lab-card span { overflow-wrap: anywhere; }
