/* CS Judge — teacher dashboard */

body.teacher-dashboard-active.login-view-active::before,
body.teacher-view-active::before {
  display: none;
}

.teacher-view {
  width: 100%;
}

.teacher-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  text-align: left;
}

.teacher-shell-header h2 {
  margin: 0 0 0.35rem;
}

.teacher-shell-header .subtitle {
  margin: 0 0 0.85rem;
}

#teacher-login-block {
  padding: 2rem;
  text-align: center;
}

#teacher-login-block h2 {
  position: relative;
  z-index: 1;
  margin-top: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.teacher-course-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}

.teacher-course-header {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.teacher-hub-panel {
  margin-bottom: 0.85rem;
}

.teacher-hub-lead {
  margin: 0 0 1rem;
}

.teacher-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.teacher-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.teacher-hub-card:hover,
.teacher-hub-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  outline: none;
}

.teacher-hub-card-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.35;
}

.teacher-hub-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.teacher-hub-card-stat {
  margin: 0;
  font-size: 0.92rem;
}

.teacher-hub-card-action {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.teacher-course-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.teacher-course-tab.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(99, 102, 241, 0.1);
}

.teacher-login-form {
  margin-top: 1rem;
  flex-direction: column;
}

.teacher-login-form input[type="password"] {
  width: 100%;
}

.teacher-login-form .primary {
  width: 100%;
  margin-top: 0;
}

.teacher-stats-panel {
  margin-bottom: 1rem;
}

.teacher-stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.teacher-stats-header h3 {
  margin: 0;
}

.teacher-stats-updated {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.teacher-stats-refresh-btn {
  font-size: 0.88rem;
  padding: 0.3rem 0.65rem;
  flex-shrink: 0;
}

.teacher-stats-section + .teacher-stats-section {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.teacher-stats-section-title {
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.teacher-stats-services {
  margin-bottom: 0;
}

.teacher-stats-services-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.teacher-stats-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.teacher-stats-pill--ok {
  border-color: var(--verdict-pass-border);
  background: var(--verdict-pass-bg);
  color: var(--pass);
}

.teacher-stats-pill--warn {
  border-color: var(--verdict-pending-border);
  background: var(--verdict-pending-bg);
  color: var(--pending);
}

.teacher-stats-pill--down {
  border-color: var(--verdict-fail-border);
  background: var(--verdict-fail-bg);
  color: var(--fail);
}

.teacher-stats-services-issues {
  margin: 0.55rem 0 0;
  color: var(--fail);
  font-size: 0.82rem;
}

.teacher-model-control {
  margin-top: 0.9rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--chip-bg);
}

.teacher-model-control-header {
  margin-bottom: 0.65rem;
}

.teacher-model-control .teacher-stats-section-title {
  margin-bottom: 0.25rem;
}

.teacher-model-help {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.teacher-model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
}

.teacher-model-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 11rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.teacher-model-field--grow {
  flex: 1 1 12rem;
  min-width: 12rem;
}

.teacher-model-select,
.teacher-model-custom {
  min-height: 2.25rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel, var(--bg));
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.teacher-model-custom {
  width: 100%;
}

.teacher-model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.teacher-model-status {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
}

@media (max-width: 720px) {
.teacher-model-row {
    flex-direction: column;
    align-items: stretch;
  }
.teacher-model-field,
  .teacher-model-field--grow {
    min-width: 0;
    width: 100%;
  }
.teacher-model-actions {
    width: 100%;
  }
.teacher-model-actions .primary,
  .teacher-model-actions .ghost-btn {
    flex: 1 1 auto;
  }
}

.teacher-stats-progress-card {
  margin-bottom: 0.85rem;
}

.teacher-stats-progress-top {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.teacher-stats-progress-top strong {
  font-size: 2rem;
  line-height: 1;
}

.teacher-stats-progress-track {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.teacher-stats-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-mid), var(--pass));
}

.stat-card--down .teacher-stats-progress-fill {
  background: linear-gradient(90deg, var(--pending), var(--fail));
}

.teacher-stats-bar {
  margin-bottom: 0;
}

.teacher-stat-detail {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.teacher-stats-pending-wrap {
  margin-top: 0.75rem;
}

.teacher-stats-pending-label {
  margin: 0 0 0.35rem;
}

.teacher-stats-pending-list {
  margin: 0;
  padding: 0.65rem 0.85rem 0.65rem 1.35rem;
  border: 1px solid var(--verdict-pending-border);
  border-radius: 8px;
  background: var(--verdict-pending-bg);
  font-size: 0.86rem;
}

.teacher-stats-pending-list li + li {
  margin-top: 0.25rem;
}

.teacher-stats-pending-more {
  color: var(--muted);
  font-style: italic;
}

.teacher-stats-pending-empty {
  margin: 0;
}

.teacher-search-panel label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.teacher-student-search {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.teacher-search-meta {
  margin: 0.4rem 0 0;
}

.teacher-share-panel,
.teacher-share-qr-panel,
.teacher-roster-notice {
  margin-bottom: 1rem;
}

.teacher-public-access-row .teacher-share-panel,
.teacher-public-access-row .teacher-share-qr-panel {
  margin-bottom: 0;
}

.teacher-public-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.teacher-public-access-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.teacher-public-access-header h3 {
  margin: 0;
}

.teacher-share-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0;
  min-width: 12.5rem;
}

.teacher-share-qr-panel h3 {
  margin: 0 0 0.25rem;
  align-self: stretch;
  text-align: left;
}

.teacher-share-qr-panel > .meta:first-of-type {
  align-self: stretch;
  text-align: left;
  margin: 0 0 0.65rem;
}

.teacher-share-qr-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-sizing: border-box;
}

.teacher-share-qr-frame img,
.teacher-share-qr-frame canvas,
.teacher-share-qr-frame table {
  display: block;
  max-width: 100%;
  height: auto;
}

.teacher-share-qr-caption {
  margin: 0.55rem 0 0;
  max-width: 14rem;
  font-size: 0.72rem;
  line-height: 1.35;
  word-break: break-all;
  color: var(--muted);
}

@media (min-width: 900px) {
  .teacher-public-access-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.teacher-tunnel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}

.teacher-tunnel-help,
.teacher-tunnel-message {
  margin: 0.35rem 0 0;
}

.teacher-tunnel-message:not([hidden]) {
  color: var(--warn, #b45309);
  font-weight: 600;
}

@media (max-width: 640px) {
  .teacher-tunnel-actions .primary,
  .teacher-tunnel-actions .ghost-btn {
    flex: 1 1 calc(50% - 0.5rem);
  }
}

.teacher-roster-notice {
  border-left: 4px solid var(--pending);
  background: var(--verdict-pending-bg);
}

.teacher-roster-notice--compact {
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.teacher-roster-compact {
  margin: 0 0 0.75rem;
}

.teacher-server-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
}

.teacher-server-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}

.teacher-server-status--ok {
  color: var(--pass);
  border-color: var(--verdict-pass-border);
  background: var(--verdict-pass-bg);
}

.teacher-server-status--ok::before {
  background: var(--pass);
}

.teacher-server-status--warn {
  color: var(--pending);
  border-color: var(--verdict-pending-border);
  background: var(--verdict-pending-bg);
}

.teacher-server-status--warn::before {
  background: var(--pending);
}

.teacher-server-status--down {
  color: var(--fail);
  border-color: var(--verdict-fail-border);
  background: var(--verdict-fail-bg);
}

.teacher-server-status--down::before {
  background: var(--fail);
}

.teacher-search-meta {
  margin: 0.4rem 0 0;
}

.teacher-actions-col {
  white-space: nowrap;
}

.teacher-reset-pin-btn {
  font-size: 0.82rem;
  padding: 0.2rem 0.55rem;
}

.matrix-cell-manual {
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.teacher-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.teacher-share-input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.92rem;
}

.matrix-cell-wrap {
  padding: 0;
}

.matrix-cell-btn {
  width: 100%;
  min-width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0;
}

.matrix-cell-btn:hover,
.matrix-cell-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.matrix-cell-fail {
  background: var(--badge-fail-bg);
  color: var(--fail);
}

.matrix-cell-pending {
  background: var(--badge-pending-bg);
  color: var(--pending);
}

.teacher-recent-row {
  cursor: pointer;
}

.teacher-recent-row:hover {
  background: var(--surface-hover);
}

.teacher-recent-action {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
}

.teacher-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.teacher-modal[hidden] {
  display: none;
}

.teacher-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 22, 0.55);
}

.teacher-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85vh, 900px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.35rem;
}

.teacher-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.teacher-modal-section {
  margin-top: 1rem;
  text-align: left;
}

.teacher-modal-meta {
  margin: 0.35rem 0 0.85rem;
}

.teacher-override-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.teacher-hint-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.teacher-teaching-note {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel, var(--bg));
  color: var(--text);
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
  resize: vertical;
}

.teacher-hint-save-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
}

.teacher-hint-save-row input {
  margin-top: 0.2rem;
}

.teacher-hints-panel {
  margin-top: 0.75rem;
}

.teacher-hints-result {
  margin-top: 0.75rem;
}

.teacher-hints-summary {
  margin: 0 0 0.75rem;
}

.teacher-hints-permanent h4,
.teacher-hints-list-wrap h4 {
  margin: 0.5rem 0 0.4rem;
  font-size: 0.95rem;
}

.teacher-grading-notes-preview {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel, var(--bg)) 92%, var(--muted) 8%);
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.45;
  max-height: 10rem;
  overflow: auto;
}

.teacher-hints-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.teacher-hint-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel, var(--bg));
}

.teacher-hint-item--inactive {
  opacity: 0.72;
}

.teacher-hint-item-main {
  flex: 1 1 16rem;
  min-width: 0;
}

.teacher-hint-note {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  line-height: 1.4;
}

.teacher-hint-meta {
  margin: 0;
}

.teacher-hint-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.teacher-hint-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel, var(--bg)) 88%, var(--muted) 12%);
}

.teacher-hint-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.teacher-hint-delete-btn {
  color: var(--danger, #b42318);
}

.teacher-view-submission-btn {
  margin-top: 0.75rem;
}

.teacher-source-name {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.92rem;
  text-align: left;
}

.teacher-source-code {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  text-align: left;
  white-space: pre;
  tab-size: 4;
  -moz-tab-size: 4;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.45;
}

.teacher-attention-panel {
  margin-bottom: 0;
}

.teacher-attention-panel--calm {
  border-style: dashed;
}

.teacher-attention-header {
  margin-bottom: 0.75rem;
}

.teacher-attention-header h3 {
  margin: 0 0 0.2rem;
}

.teacher-attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
}

.teacher-attention-col {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
}

.teacher-attention-col--ok {
  opacity: 0.92;
}

.teacher-attention-col-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.teacher-attention-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.teacher-attention-list li + li {
  margin-top: 0.35rem;
}

.teacher-attention-list .meta {
  display: block;
  font-size: 0.8rem;
}

.teacher-attention-student-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.25rem 0.35rem;
  margin: 0 -0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.teacher-attention-student-btn:hover,
.teacher-attention-student-btn:focus-visible {
  background: var(--panel, var(--bg));
  outline: none;
}

.teacher-attention-student-btn strong {
  display: block;
}

.teacher-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.teacher-actions .matrix-export-btn {
  width: auto;
  margin-top: 0;
}

.completion-matrix-panel {
  margin-bottom: 1.25rem;
}

.completion-matrix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.completion-matrix-header h3 {
  margin: 0;
}

.matrix-export-btn {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.matrix-legend {
  margin: 0 0 0.75rem;
}

.matrix-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.5rem;
}

.matrix-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.matrix-filter-field span {
  color: var(--muted);
  font-weight: 500;
}

.matrix-filter-select {
  min-width: 12rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.matrix-filter-summary {
  margin: 0;
  align-self: center;
}

.matrix-filter-note {
  margin: 0 0 0.75rem;
}

.completion-matrix-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 8px;
}

body.teacher-dashboard-active main {
  max-width: min(1880px, calc(100vw - 2rem));
  padding: 0.85rem 1rem 1.25rem;
}

body.teacher-dashboard-active #login-view.login-panel,
body.teacher-dashboard-active #teacher-view .teacher-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1rem 1.15rem 1.25rem;
  text-align: left;
}

body.teacher-dashboard-active #teacher-login-block h2 {
  font-size: 1.45rem;
}

body.teacher-dashboard-active #teacher-login-block .subtitle {
  margin-bottom: 0.65rem;
}

body.teacher-dashboard-active .teacher-login-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  max-width: 36rem;
}

body.teacher-dashboard-active .teacher-login-form input[type="password"] {
  flex: 1 1 14rem;
  width: auto;
  margin: 0;
}

body.teacher-dashboard-active .teacher-login-form .primary {
  width: auto;
  margin-top: 0;
}

body.teacher-dashboard-active .teacher-actions {
  margin: 0.5rem 0 0.85rem;
}

body.teacher-dashboard-active #teacher-content .panel {
  padding: 1rem 1.1rem;
}

body.teacher-dashboard-active #teacher-content .panel h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.teacher-dashboard-hero {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.teacher-review-panel {
  margin-bottom: 0;
}

.teacher-review-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.teacher-review-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
}

.teacher-review-field > span {
  font-weight: 600;
  color: var(--muted);
}

.teacher-review-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.teacher-review-result {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 0.85rem 1rem;
  max-height: 28rem;
  overflow: auto;
  text-align: left;
}

.teacher-review-result .teacher-modal-section {
  text-align: left;
}

.teacher-review-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.teacher-review-header h4 {
  margin: 0 0 0.25rem;
}

.teacher-review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.teacher-override-actions--inline {
  margin: 0;
}

.teacher-review-manual-note {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--manual-accent);
  background: color-mix(in srgb, var(--badge-manual-bg) 55%, transparent);
  border-radius: 0 8px 8px 0;
}

@media (max-width: 720px) {
.teacher-review-controls {
    grid-template-columns: 1fr;
  }
.teacher-override-actions--inline {
    width: 100%;
  }
}

.teacher-dashboard-columns {
  display: grid;
  gap: 0.85rem;
}

.teacher-table-panel {
  margin-bottom: 0;
}

.teacher-table-wrap {
  overflow: auto;
  max-height: 16rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.teacher-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.teacher-data-table th,
.teacher-data-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.teacher-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.teacher-data-table tbody tr:last-child td {
  border-bottom: none;
}

@media (min-width: 1280px) {
body.teacher-dashboard-active main {
    max-width: min(1240px, calc(100vw - 1.5rem));
    padding: 0.75rem 0.85rem 1rem;
  }
body.teacher-dashboard-active #login-view.login-panel,
  body.teacher-dashboard-active #teacher-view .teacher-shell {
    padding: 0.9rem 1rem 1.1rem;
  }
body.teacher-dashboard-active #teacher-login-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem;
    align-items: start;
  }
body.teacher-dashboard-active #teacher-login-block h2,
  body.teacher-dashboard-active .teacher-shell-header {
    grid-column: 1;
    margin: 0 0 0.2rem;
  }
body.teacher-dashboard-active #teacher-login-block .subtitle,
  body.teacher-dashboard-active .teacher-shell-header .subtitle {
    grid-column: 1;
    margin: 0 0 0.5rem;
  }
body.teacher-dashboard-active #teacher-server-status {
    grid-column: 1;
    margin-bottom: 0.65rem;
  }
body.teacher-dashboard-active #teacher-login-form-landing {
    grid-column: 1;
    max-width: 28rem;
  }
body.teacher-dashboard-active #teacher-actions-login {
    grid-column: 2;
    grid-row: 1 / span 6;
    align-self: center;
    justify-self: end;
    margin: 0;
  }
body.teacher-dashboard-active #teacher-content {
    grid-column: 1 / -1;
  }
body.teacher-dashboard-active #teacher-course-picker,
  body.teacher-dashboard-active #teacher-course-header {
    grid-column: 1;
  }
.teacher-dashboard-hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(16rem, 0.9fr);
    align-items: stretch;
  }
.teacher-dashboard-hero .teacher-review-panel {
    grid-column: 1 / -1;
  }
.teacher-dashboard-hero .teacher-public-access-row {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }
.teacher-dashboard-hero .teacher-share-panel,
  .teacher-dashboard-hero .teacher-share-qr-panel,
  .teacher-dashboard-hero .teacher-search-panel,
  .teacher-dashboard-hero .teacher-review-panel {
    margin-bottom: 0;
  }
.teacher-stats-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
.teacher-dashboard-columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
body.teacher-dashboard-active .completion-matrix-wrap {
    max-height: min(52vh, calc(1024px - 28rem));
  }
body.teacher-dashboard-active .matrix-student-name {
    min-width: 5.5rem;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
body.teacher-dashboard-active .completion-matrix {
    font-size: 0.78rem;
  }
body.teacher-dashboard-active .matrix-assignment-header {
    max-height: 6rem;
    font-size: 0.7rem;
  }
}

@media (min-width: 1600px) {
body.teacher-dashboard-active main {
    max-width: min(1840px, calc(100vw - 2rem));
  }
body.teacher-dashboard-active .completion-matrix-wrap {
    max-height: min(58vh, calc(1080px - 24rem));
  }
.teacher-stats-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
.teacher-table-wrap {
    max-height: 18rem;
  }
}

@media (min-width: 1280px) and (max-height: 900px) {
body.teacher-dashboard-active .completion-matrix-wrap {
    max-height: min(46vh, calc(100vh - 22rem));
  }
.teacher-table-wrap {
    max-height: 13rem;
  }
body.teacher-dashboard-active #teacher-content .panel {
    padding: 0.85rem 0.95rem;
  }
}

.completion-matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.completion-matrix th,
.completion-matrix td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: center;
  white-space: nowrap;
}

.completion-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.completion-matrix--grouped .matrix-group-row th {
  top: 0;
  z-index: 2;
}

.completion-matrix--grouped .matrix-assignment-row th {
  top: 1.75rem;
}

.matrix-group-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 0.25rem 0.35rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  writing-mode: horizontal-tb;
  transform: none;
}

.matrix-corner-cell {
  z-index: 4;
}

.matrix-student-id,
.matrix-student-name {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  text-align: left;
}

.matrix-student-name {
  left: 4.5rem;
  min-width: 6rem;
}

.completion-matrix thead .matrix-student-id,
.completion-matrix thead .matrix-student-name {
  z-index: 3;
}

.matrix-assignment-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 7rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.matrix-cell {
  font-weight: 600;
  color: var(--muted);
}

.matrix-cell-pass {
  background: #22c55e;
  color: #052e16;
}

[data-theme="dark"] .matrix-cell-pass {
  background: #166534;
  color: #dcfce7;
}

.matrix-cell-other {
  background: var(--surface);
}

#bsod-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 2147483647;
  margin: 0;
  padding: 0;
  background: #0078d7;
}

#bsod-overlay img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.bsod-hint {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.95rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

body.bsod-active {
  overflow: hidden;
}

html:fullscreen #bsod-overlay,
html:-webkit-full-screen #bsod-overlay {
  width: 100%;
  height: 100%;
}
