:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #18212b;
  --muted: #5d6874;
  --line: #d7dde3;
  --primary: #245f3f;
  --primary-strong: #17482f;
  --success-bg: #e8f4ec;
  --success: #245f3f;
  --danger-bg: #fff0f0;
  --danger: #982c2c;
  --warning-bg: #fff4df;
  --warning: #7d5000;
  --shadow: 0 8px 28px rgba(20, 33, 45, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, textarea { font: inherit; }

button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 750;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active { background: var(--primary-strong); }

.btn-secondary {
  background: #edf2f5;
  color: var(--text);
  border-color: var(--line);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #efc5c5;
}

.page-shell {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 34px);
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1.3rem;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
}

.dev-badge {
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #fff5d9;
  color: #735400;
  white-space: nowrap;
}

.lead {
  color: var(--muted);
  line-height: 1.5;
}

.camera-wrap {
  position: relative;
  margin: 1.2rem 0;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  min-height: 260px;
  display: grid;
  place-items: center;
}

#camera-video {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: cover;
  background: #111;
}

.scan-guide {
  position: absolute;
  width: min(72%, 360px);
  aspect-ratio: 1 / 1;
  border: 4px solid rgba(255,255,255,0.95);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.20);
  pointer-events: none;
}

.scan-state {
  min-height: 1.5em;
  margin: 0.7rem 0;
  text-align: center;
  font-weight: 750;
  color: var(--muted);
}

.scan-state.good { color: var(--success); }
.scan-state.bad { color: var(--danger); }
.scan-state.warning { color: var(--warning); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1rem;
}

.result-banner {
  margin: 1rem 0 1.4rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 1.12rem;
  font-weight: 850;
  text-align: center;
}

.details-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.5fr);
  gap: 0.7rem 1rem;
  margin: 1.3rem 0;
}

.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }

.big-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.3rem 0;
}

.metric {
  background: #f5f7f8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 0.7rem;
  text-align: center;
}

.metric .value {
  display: block;
  font-size: 1.7rem;
  font-weight: 850;
}

.metric .label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.2rem;
}

.integrity-ok {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--success-bg);
  color: var(--success);
  font-weight: 750;
}

.integrity-bad {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 750;
}

.dev-zone {
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px dashed #c7cfd6;
}

.dev-zone summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.dev-zone textarea {
  width: 100%;
  min-height: 130px;
  margin: 0.8rem 0;
  border: 1px solid #aeb8c2;
  border-radius: 10px;
  padding: 0.7rem;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-root.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14,22,28,0.56);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 52px rgba(0,0,0,0.28);
  padding: 24px;
}

.modal-card h2 { margin-top: 0; }

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

.hidden { display: none !important; }

@media (max-width: 560px) {
  .page-shell { padding-left: 12px; padding-right: 12px; }
  .brand { align-items: flex-start; }
  .details-list { grid-template-columns: 1fr; gap: 0.25rem; }
  .details-list dd { margin-bottom: 0.55rem; }
  .big-result { grid-template-columns: 1fr; }
}


.summary-row {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.summary-box {
  min-width: 130px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f7f8;
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 850;
}

.summary-label {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.results-section {
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.results-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 1rem 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.results-table th,
.results-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.results-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  background: #f7f9fa;
}

.number-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.scan-state.good {
  background: var(--success-bg);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.scan-state.warning {
  background: var(--warning-bg);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.scan-state.bad {
  background: var(--danger-bg);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

@media (max-width: 560px) {
  .results-header {
    align-items: stretch;
    flex-direction: column;
  }

  .results-header button {
    width: 100%;
  }
}


.setup-card {
  max-width: 620px;
  margin: 5vh auto 0;
}

.setup-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.setup-form label {
  font-weight: 800;
}

.setup-form input,
.modal-number-input {
  width: 100%;
  min-height: 54px;
  border: 1px solid #aeb8c2;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 1.1rem;
}

.setup-error {
  min-height: 1.4em;
  font-weight: 700;
}

.setup-error.bad {
  color: var(--danger);
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 1.1rem 0;
}

.progress-box {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f7f8;
  text-align: center;
}

.progress-value {
  display: block;
  font-size: 1.85rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.progress-label {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.completion-banner {
  margin: 1rem 0 1.3rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--success-bg);
  color: var(--success);
  text-align: center;
  font-size: 1.08rem;
  font-weight: 850;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.1rem 0;
}

@media (max-width: 560px) {
  .progress-grid {
    grid-template-columns: 1fr 1fr;
  }

  .session-actions {
    flex-direction: column;
  }

  .session-actions button {
    width: 100%;
  }
}


.test-reference {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
  display: grid;
  gap: 0.3rem;
}

.test-reference.pending {
  color: var(--muted);
  font-style: italic;
}

.summary-results {
  margin-top: 1.4rem;
}

.summary-results .results-table {
  min-width: 560px;
}


.scan-confirmation-card {
  min-height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}

.scan-confirmation-check {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success-bg);
  color: var(--success);
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
}

.scan-confirmation-name {
  font-size: clamp(2.1rem, 8vw, 4.4rem);
  font-weight: 900;
  line-height: 1.08;
  color: var(--success);
}

.scan-confirmation-progress {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}


.scanner-page {
  padding-top: max(6px, env(safe-area-inset-top));
}

.scanner-card {
  padding-top: 8px;
}

.scanner-camera-top {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.scan-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f7f8;
  font-variant-numeric: tabular-nums;
}

.scan-progress-main {
  font-size: 1.15rem;
  font-weight: 850;
}

.scan-progress-missing {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

.scanner-info-block {
  margin-top: 1.25rem;
}

.scanner-brand {
  margin-top: 0;
}

@media (max-width: 560px) {
  .scanner-page {
    padding-left: 6px;
    padding-right: 6px;
  }

  .scanner-card {
    padding: 6px 8px 18px;
  }

  .scan-progress-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    text-align: center;
  }

  .scan-progress-main {
    font-size: 1.12rem;
  }

  .scan-progress-missing {
    font-size: 0.95rem;
  }
}


.evaluation-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 1.2rem 0 1.6rem;
}

.evaluation-box {
  min-width: 0;
  padding: 1rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f7f8;
  text-align: center;
}

.evaluation-value {
  display: block;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.15;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.evaluation-label {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.evaluation-header {
  align-items: center;
}

.sort-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sort-button {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
}

.sort-button.active {
  border-color: var(--primary);
  background: var(--success-bg);
  color: var(--primary);
}

.evaluation-table tbody tr:hover {
  background: #f8faf9;
}

@media (max-width: 760px) {
  .evaluation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .evaluation-box:first-child {
    grid-column: 1 / -1;
  }

  .evaluation-header {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-controls {
    width: 100%;
  }

  .sort-button {
    flex: 1 1 auto;
  }
}

@media (max-width: 420px) {
  .evaluation-grid {
    grid-template-columns: 1fr;
  }

  .evaluation-box:first-child {
    grid-column: auto;
  }
}


.setup-secondary-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.archive-action-panel {
  margin: 1.5rem 0 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  align-items: center;
}

.archive-status {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--success-bg);
  color: var(--success);
  font-weight: 800;
}

.archive-table td {
  vertical-align: middle;
}

.archive-open-button {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .archive-action-panel {
    flex-direction: column;
  }

  .archive-action-panel button,
  .setup-secondary-actions button {
    width: 100%;
  }
}


.scan-class-line,
.class-reference {
  margin: 0 0 0.8rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef4f0;
  color: var(--primary);
  text-align: center;
  font-weight: 850;
}

.class-reference {
  margin: 1rem 0;
  text-align: left;
}

.setup-form input[type="text"] {
  width: 100%;
  min-height: 54px;
  border: 1px solid #aeb8c2;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 1.1rem;
}


.archive-backup-panel {
  margin-top: 1.6rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f9fa;
}

.archive-backup-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.archive-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

@media (max-width: 560px) {
  .archive-backup-actions {
    flex-direction: column;
  }

  .archive-backup-actions button {
    width: 100%;
  }
}


.btn-small {
  min-height: 36px;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

.delete-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.archived-results-table td {
  vertical-align: middle;
}

@media (max-width: 560px) {
  .archived-results-table .btn-small {
    width: auto;
  }
}


.detail-cell {
  width: 1%;
  white-space: nowrap;
}

.student-detail-summary,
.student-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 1rem;
  margin: 1rem 0 1.4rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
}

.detail-muted {
  margin: 0.8rem 0 1.3rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: #f3f5f6;
  color: var(--muted);
}

.answer-correct {
  color: #176b3a;
}

.answer-wrong {
  color: #a52626;
}

.answer-unanswered {
  color: var(--muted);
}

.detail-answer-table td {
  vertical-align: middle;
}

@media (max-width: 560px) {
  .student-detail-summary,
  .student-detail-meta {
    grid-template-columns: 1fr;
  }
}


.teacher-nav {
  display: flex;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f6f7;
}

.teacher-nav-button {
  flex: 1 1 0;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.teacher-nav-button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tests-loading {
  padding: 1.2rem;
  text-align: center;
  color: var(--muted);
}

.tests-overview {
  display: grid;
  gap: 1rem;
}

.test-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.test-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.test-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.test-topic {
  margin-top: 0.25rem;
  color: var(--muted);
  font-weight: 700;
}

.test-description {
  margin: 0.8rem 0 1rem;
  color: var(--muted);
}

.test-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.test-status-active {
  background: var(--success-bg);
  color: var(--success);
}

.test-status-inactive {
  background: #f1f2f3;
  color: var(--muted);
}

.test-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.test-meta-grid > div {
  padding: 0.7rem;
  border-radius: 10px;
  background: #f7f9fa;
}

.test-meta-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.test-code-box {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.test-code {
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.copy-code-fallback {
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.08em;
}

@media (max-width: 680px) {
  .test-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .test-code-box {
    align-items: stretch;
    flex-direction: column;
  }

  .test-code-box button {
    width: 100%;
  }
}


.test-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.preview-code-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin: 0.8rem 0 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
}

.preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.preview-meta-grid > div {
  padding: 0.75rem;
  border-radius: 10px;
  background: #f7f9fa;
}

.preview-task-prompt {
  font-size: 1.05rem;
  font-weight: 800;
}

.preview-solution {
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.preview-table td {
  vertical-align: middle;
}

@media (max-width: 680px) {
  .test-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .test-card-actions button {
    flex: 1 1 auto;
  }

  .preview-code-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-code-panel button {
    width: 100%;
  }

  .preview-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.test-run-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.test-run-info strong {
  color: var(--text);
}

.test-run-info span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}


/* P8.3 – Lehrerprofile, Klassen und strukturierte Testübersicht */
.teacher-context {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.9rem;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #f4f7f8;
  color: var(--muted);
  font-size: 0.84rem;
}

.teacher-context strong {
  color: var(--text);
}

.profile-gate-card {
  max-width: 760px;
  margin-inline: auto;
}

.teacher-profile-list {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.teacher-profile-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.teacher-profile-choice:hover {
  border-color: var(--primary);
}

.teacher-profile-choice span {
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-security-note {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #fff7e8;
  color: #6e4c00;
  font-size: 0.84rem;
}

.profile-current-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
}

.profile-current-card strong {
  font-size: 1.15rem;
}

.profile-id-line {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.profile-section {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.class-profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.class-profile-button {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}

.class-profile-button.active {
  border-color: var(--primary);
  background: #e9f4ed;
  color: #176b3a;
}

.profile-inline-form {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.profile-inline-form input {
  flex: 1 1 auto;
  min-width: 0;
}

.test-overview-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
}

.test-overview-toolbar label {
  display: block;
  margin-bottom: 0.35rem;
}

.test-overview-toolbar select {
  min-width: 180px;
}

.test-overview-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.test-overview-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.test-topic-section {
  margin-top: 1.6rem;
}

.test-topic-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--line);
}

.test-topic-section-head h2 {
  margin: 0;
}

.test-topic-section-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.test-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.test-usage {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-size: 0.84rem;
}

.test-usage span {
  color: var(--muted);
}

.test-usage-never {
  background: #f4f5f6;
}

.test-usage-used {
  background: #e9f4ed;
  color: #176b3a;
}

@media (max-width: 700px) {
  .profile-inline-form,
  .test-overview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .test-overview-summary {
    align-items: flex-start;
  }

  .test-overview-toolbar select {
    width: 100%;
    min-width: 0;
  }

  .teacher-profile-choice {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* P8.3.1 – wichtige Aktionen in der Abschlussübersicht sichtbar halten */
.summary-sticky-actions {
  position: sticky;
  top: 0.5rem;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.9rem 0 1rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.09);
  backdrop-filter: blur(6px);
}

.summary-sticky-actions button {
  min-height: 42px;
}

.summary-sticky-actions button:disabled {
  opacity: 1;
  cursor: default;
}

.archive-reminder {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #fff7e8;
  color: #6e4c00;
  font-weight: 800;
}

@media (max-width: 560px) {
  .summary-sticky-actions {
    top: 0.25rem;
    align-items: stretch;
    flex-direction: column;
  }

  .summary-sticky-actions button {
    width: 100%;
  }
}


/* P8.3.2 – PWA-Aktualisierung */
.pwa-update-notice {
  position: fixed;
  left: max(0.75rem, env(safe-area-inset-left));
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  max-width: 920px;
  margin: 0 auto;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 10px 34px rgba(20,33,45,0.18);
}

.pwa-update-notice > div {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.pwa-update-notice span {
  color: var(--muted);
  font-size: 0.82rem;
}

.pwa-update-notice button {
  min-height: 40px;
  padding: 0.55rem 0.75rem;
}

@media (max-width: 700px) {
  .pwa-update-notice {
    grid-template-columns: 1fr 1fr;
  }

  .pwa-update-notice > div {
    grid-column: 1 / -1;
  }
}


/* P8.3.3 – Branding Lehrer-PWA */
.brand {
  align-items: center;
}

.brand h1 {
  flex: 1 1 auto;
}

.app-brand-logo {
  width: clamp(64px, 8vw, 88px);
  height: clamp(64px, 8vw, 88px);
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 18px;
}

.scanner-brand .app-brand-logo {
  width: clamp(58px, 7vw, 78px);
  height: clamp(58px, 7vw, 78px);
}

@media (max-width: 620px) {
  .brand {
    flex-wrap: wrap;
    align-items: center;
  }

  .app-brand-logo {
    width: 62px;
    height: 62px;
  }

  .brand h1 {
    min-width: calc(100% - 80px);
    font-size: clamp(1.4rem, 5.8vw, 1.95rem);
  }
}

/* P8.3.2c – Mobile Lehrer-Navigation: alle vier Reiter bleiben sichtbar */
.teacher-nav {
  width: 100%;
  min-width: 0;
}

.teacher-nav-button {
  flex: 1 1 25%;
  min-width: 0;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .teacher-nav {
    gap: 0.2rem;
    padding: 0.25rem;
  }

  .teacher-nav-button {
    min-height: 40px;
    padding: 0.6rem 0.3rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 360px) {
  .teacher-nav-button {
    padding-inline: 0.2rem;
    font-size: 0.82rem;
  }
}


/* P8.3.2d – eindeutiger Abschluss nach dem Archivieren */
.archive-completion-card {
  max-width: 820px;
}

.archive-completion-success {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #b8dfc8;
  border-radius: 14px;
  background: #edf9f2;
  color: #185b35;
}

.archive-completion-success > div {
  display: grid;
  gap: 0.2rem;
}

.archive-completion-success strong {
  font-size: 1.08rem;
}

.archive-completion-success span:not(.archive-completion-check) {
  color: #356e4f;
}

.archive-completion-check {
  display: grid;
  place-items: center;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: #267047;
  color: white;
  font-size: 1.45rem;
  font-weight: 900;
}

.archive-completion-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.archive-completion-meta > div {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fa;
}

.archive-completion-hint {
  margin: 1.25rem 0 0.75rem;
  color: var(--muted);
}

.archive-completion-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.archive-completion-actions button {
  min-height: 48px;
}

.archive-completion-actions button:disabled {
  opacity: 1;
  cursor: default;
}

.archive-completion-feedback {
  min-height: 1.5rem;
  margin-top: 0.8rem;
  font-weight: 700;
}

.archive-completion-feedback.good {
  color: #185b35;
}

@media (max-width: 700px) {
  .archive-completion-meta,
  .archive-completion-actions {
    grid-template-columns: 1fr;
  }

  .archive-completion-actions button {
    width: 100%;
  }
}


/* P8.3.2e – Startseite mit direkter Klassenauswahl */
.class-home-card {
  max-width: 820px;
  margin-inline: auto;
}

.class-home-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.8rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 11px;
  background: #f4f7f8;
  color: var(--muted);
}

.class-home-profile strong {
  color: var(--text);
}

.class-home-session-note {
  margin: 0.8rem 0 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #cfe2d6;
  border-radius: 11px;
  background: #edf7f1;
  color: #245f3f;
}

.class-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.1rem;
}

.class-home-button {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.class-home-button strong {
  font-size: 1.35rem;
}

.class-home-button span {
  color: var(--muted);
  font-size: 0.84rem;
}

.class-home-button:hover,
.class-home-button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 95, 63, 0.08);
}

.class-home-button.last-used {
  border-color: #bdd8c8;
  background: #f5fbf7;
}

.class-home-button.has-open-session {
  border-color: var(--primary);
  background: #edf7f1;
}

.class-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.4rem;
}

.teacher-context-class {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.teacher-context-class:hover,
.teacher-context-class:focus-visible {
  text-decoration: underline;
}

@media (max-width: 560px) {
  .class-home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .class-home-button {
    min-height: 86px;
    padding: 0.85rem;
  }

  .class-home-actions {
    flex-direction: column;
  }

  .class-home-actions button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .class-home-grid {
    grid-template-columns: 1fr;
  }
}

/* P9.1 – Aufgabenpool-Grundlage */
.task-pool-panel {
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f9fa;
}

.task-pool-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.task-pool-title-row h2 {
  margin: 0;
}

.task-pool-counts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  white-space: nowrap;
}

.task-pool-counts span {
  color: var(--muted);
  font-size: 0.84rem;
}

.pool-lead {
  margin-bottom: 1rem;
}

.pool-domain + .pool-domain {
  margin-top: 1.3rem;
}

.pool-family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.pool-family-card {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.pool-family-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.pool-family-head strong {
  color: var(--primary);
  font-size: 0.9rem;
}

.pool-family-card h3 {
  margin: 0.4rem 0 0.25rem;
  font-size: 1rem;
}

.pool-family-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.pool-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.pool-examples span {
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: #f2f5f3;
  font-size: 0.78rem;
  font-weight: 750;
}

.existing-tests-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.existing-tests-divider::before,
.existing-tests-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

@media (max-width: 700px) {
  .task-pool-title-row {
    flex-direction: column;
  }

  .task-pool-counts {
    align-items: flex-start;
  }

  .pool-family-grid {
    grid-template-columns: 1fr;
  }
}
