html, body.teacher-body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body.teacher-body {
  display: flex;
  flex-direction: column;
}

#teacher-toolbar {
  height: var(--toolbar-height);
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  flex: 0 0 auto;
}

#teacher-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#teacher-toolbar a,
#teacher-toolbar button {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

#teacher-toolbar a:hover,
#teacher-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.teacher-count {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

#teacher-main {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
  position: relative;
}

.teacher-student-admin {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.teacher-student-admin h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.teacher-student-admin p {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.teacher-student-admin-row {
  display: flex;
  gap: 6px;
}

.teacher-student-admin-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 12px;
}

.teacher-student-admin-row button {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.teacher-student-admin-row button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.teacher-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 64px 16px;
}
.teacher-empty-hint { font-size: 12px; margin-top: 8px; }
.teacher-empty.hidden { display: none; }

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.student-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.student-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.student-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.student-tile-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.student-tile-status {
  font-size: 11px;
  color: var(--green);
}

.student-tile-status.offline {
  color: var(--text-muted);
}

.student-tile-blockly {
  width: 100%;
  height: 200px;
  position: relative;
  background: var(--bg-primary);
}

.student-tile-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

#teacher-hidden-ws {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 800px;
  height: 600px;
}

#student-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#student-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  width: 900px;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.student-modal-preview {
  flex: 1 1 auto;
  min-height: 420px;
  height: 60vh;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.student-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.student-modal-actions button {
  background: var(--accent);
  color: var(--bg-toolbar);
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.student-modal-actions button:hover:not(:disabled) { background: var(--accent-hover); }
.student-modal-actions button:disabled { opacity: 0.6; cursor: default; }
