:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6f6f6f;
  --line: #deded8;
  --soft: #f1f1ec;
  --danger: #8b1e1e;
  --danger-soft: #fff1f1;
  --accent: #15165e;
  --accent2: #222477;
  --accent-soft: #eef0ff;
  --success: #246b43;
  --success-soft: #eefaf2;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button, input, textarea, select { font: inherit; }
button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .08s ease, opacity .12s ease, background .12s ease;
}
button:hover { transform: translateY(-1px); }
button.secondary { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; }
.app-shell { max-width: 1180px; margin: 0 auto; padding: 18px; }
.topbar {
  display:flex; align-items:flex-start; justify-content:space-between; gap: 18px;
  padding: 14px 0 22px;
}
.brand { display:flex; flex-direction:column; gap:2px; }
.brand-logo {
  display:block;
  width: min(220px, 100%);
  height: auto;
  margin: 0 0 8px;
  border-radius: 6px;
}
.brand-login { align-items: flex-start; margin-bottom: 6px; }
.brand h1 { margin:0; font-size: 23px; letter-spacing: -.035em; line-height:1.1; }
.brand span { color: var(--muted); font-size: 13px; }
.userbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; padding-top: 4px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(20,20,20,.035);
}
.grid { display:grid; gap: 16px; }
.grid.two { grid-template-columns: 340px 1fr; align-items:start; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.form-two { grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display:flex; gap: 10px; align-items:center; flex-wrap:wrap; }
.space { justify-content: space-between; }
.field { display:grid; gap:6px; margin-bottom: 12px; }
label { font-weight: 700; font-size: 13px; }
input, textarea, select {
  width:100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background:#fff; color:var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent2); }
textarea { min-height: 84px; resize: vertical; }
.small { font-size: 13px; color: var(--muted); }
.warning { color: #755100; background: #fff9e8; border: 1px solid #f1dfaa; padding: 12px; border-radius: 12px; }
.error { color: var(--danger); background: var(--danger-soft); border: 1px solid #f1caca; padding: 12px; border-radius: 12px; }
.success { color: var(--success); background: var(--success-soft); border: 1px solid #c7ead3; padding: 12px; border-radius: 12px; }
.list { display:grid; gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: 13px; padding: 12px; background:#fff;
  display:grid; gap: 8px;
}
.item.active { outline: 2px solid var(--accent); outline-offset: 0; }
.item h3 { margin: 0; font-size: 16px; }
.item p { margin: 0; color: var(--muted); font-size: 13px; }

.student-controls {
  display:grid;
  gap: 10px;
  margin: 10px 0 14px;
}
.student-list-item, .lesson-list-item {
  text-align:left;
  color:var(--ink);
  background:#fff;
  border:1px solid var(--line);
  border-radius:13px;
  width:100%;
}
.student-list-item.inactive {
  opacity: .74;
  background: #fbfbf8;
}
.student-list-item.inactive h3 {
  color: var(--muted);
}

.student-meta {
  display:grid;
  gap: 5px;
  margin: 10px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbf8;
  color: var(--muted);
  font-size: 13px;
}
.edit-panel {
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfbf8;
}
.badge { display:inline-flex; align-items:center; border-radius:999px; padding:4px 8px; background:var(--soft); color:var(--accent2); font-size:12px; font-weight:700; }
.badge.on { background: #e5f7ec; color:#246b43; }
.badge.off { background: #f8dddd; color:#8b1e1e; }
.tabs { display:flex; gap: 8px; flex-wrap:wrap; margin-bottom: 14px; }
.tabs button { background: var(--soft); color: var(--ink); border:1px solid var(--line); }
.tabs button.active { background: var(--accent); color:#fff; }
.materials { display:grid; gap: 12px; }
.material-card { border:1px solid var(--line); border-radius: 13px; padding: 12px; background:#fff; }
.material-card header { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; margin-bottom: 10px; }
.video-wrap { max-width: 390px; background:#000; border-radius: 14px; overflow:hidden; }
video { width:100%; display:block; max-height: 680px; background:#000; }
.pdf-frame { width:100%; min-height: 430px; border:1px solid var(--line); border-radius: 12px; }
.login { max-width: 540px; margin: 7vh auto; }
.login h1 { letter-spacing: -.04em; margin-bottom: 6px; }
.kpi { padding: 14px; background:#fff; border:1px solid var(--line); border-radius:13px; }
.kpi strong { display:block; font-size:24px; color: var(--accent); }
.footer-note { margin-top: 16px; color: var(--muted); font-size: 12px; }
hr { border:0; border-top:1px solid var(--line); margin: 16px 0; }
.hidden { display:none !important; }
@media (max-width: 820px) {
  .app-shell { padding: 12px; }
  .grid.two, .grid.three, .grid.form-two { grid-template-columns: 1fr; }
  .topbar { align-items:flex-start; flex-direction:column; }
  .userbar { justify-content:flex-start; }
  .card { padding: 14px; }
  button { width: auto; }
  .row.stack-mobile { flex-direction:column; align-items:stretch; }
  .brand-logo { width: min(200px, 100%); }
}

.password-display {
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.password-actions {
  margin-top: 6px;
}
.password-panel .small {
  margin-top: -4px;
}

/* Status / News */
.status-card { margin-bottom: 16px; }
.active-status { display: grid; gap: 10px; }
.status-media {
  max-width: 420px;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--line);
}
.status-media img,
.status-media video {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  background: #111;
}
.status-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
}
@media (max-width: 820px) {
  .status-media { max-width: 100%; }
}


/* Schülerbereich: Kopfbereich bleibt beim Scrollen sichtbar */
.student-shell {
  max-width: 1280px;
}
.student-sticky-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 247, 244, .96);
  border-bottom: 1px solid var(--line);
  margin: 0 -18px 22px;
  padding: 14px 18px 16px;
  box-shadow: 0 8px 20px rgba(20,20,20,.035);
}
.student-sticky-topbar .brand-logo {
  width: min(220px, 45vw);
}
@media (max-width: 820px) {
  .student-sticky-topbar {
    margin: 0 -12px 18px;
    padding: 10px 12px 12px;
  }
  .student-sticky-topbar .brand-logo {
    width: min(170px, 55vw);
  }
  .student-sticky-topbar .brand h1 {
    font-size: 20px;
  }
}

.upload-grid {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.upload-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}
.upload-box h4 {
  margin: 0 0 4px;
}
@media (max-width: 820px) {
  .upload-grid { grid-template-columns: 1fr; }
}

.student-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.student-details > span {
  display: block;
}


.student-email {
  margin-top: 8px;
  margin-bottom: 4px;
}

.student-email + .student-details {
  margin-top: 0;
}

/* Weitere Schülerdaten – Klappmenü */
.student-optional-details {
  margin: 24px 0 30px;
  border: 1px solid #deddd8;
  border-radius: 16px;
  background: #f8f8f6;
  overflow: hidden;
}

.student-optional-details summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  color: #171717;
}

.student-optional-details summary::-webkit-details-marker {
  display: none;
}

.student-optional-details summary::before {
  content: "＋";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: #171466;
  color: white;
  font-size: 18px;
  line-height: 1;
}

.student-optional-details[open] summary::before {
  content: "−";
}

.student-optional-details[open] summary {
  border-bottom: 1px solid #deddd8;
}

.student-optional-content {
  padding: 20px 18px 4px;
}

.student-optional-details + button {
  margin-top: 4px;
}

@media (max-width: 700px) {
  .student-optional-details {
    margin-bottom: 24px;
  }

  .student-optional-details summary {
    padding: 15px;
  }

  .student-optional-content {
    padding: 18px 15px 2px;
  }
}



/* Chrome: zusätzliches Download-Menü im Audio-Player ausblenden */
audio::-webkit-media-controls-overflow-button {
  display: none !important;
}


.additional-materials {
  margin: 0;
}

.additional-materials summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.additional-materials[open] summary {
  margin-bottom: 10px;
}

@media (min-width: 821px) {
  .additional-materials summary {
    display: none;
  }

  .additional-materials[open] summary {
    margin-bottom: 0;
  }
}


.lesson-list-entry {
  display: grid;
  gap: 8px;
}

.lesson-video-button {
  width: 100%;
}

@media (min-width: 821px) {
  .lesson-video-button {
    display: none;
  }
}

@media (max-width: 820px) {
  .lesson-list-entry {
    margin-bottom: 12px;
  }
}


/* Mobile Lehreransicht: nur Unterrichtskarten anzeigen */
@media (max-width: 820px) {
  .mobile-teacher-student-header,
  .mobile-teacher-lesson-tools {
    display: none !important;
  }
}


/* Mobile Lehreransicht: ausschließlich Video-Upload */
@media (max-width: 820px) {
  /* Unterrichtskarte selbst öffnet keine Detailansicht mehr */
  .lesson-list-item {
    pointer-events: none;
  }

  /* Nur der separate Video-Button bleibt bedienbar */
  .lesson-video-button {
    pointer-events: auto;
  }

  /* Unterrichtsdetails und vorhandenes Material mobil ausblenden */
  .lesson-detail-info,
  .lesson-detail-desktop-only,
  .mobile-lesson-placeholder,
  .additional-materials,
  .mobile-upload-heading {
    display: none !important;
  }

  /* Uploadbereich ohne zusätzlichen Abstand anzeigen */
  #lessonDetailMount,
  .lesson-upload-section {
    margin: 0;
  }

  .lesson-upload-section .upload-grid {
    display: block;
  }
}


/* Video-Upload direkt unter der Unterrichtseinheit */
.lesson-inline-upload {
  display: none;
}

@media (max-width: 820px) {
  .lesson-inline-upload {
    display: block;
  }

  .lesson-inline-upload:empty {
    display: none;
  }

  .lesson-inline-upload .lesson-upload-section {
    margin-top: 0;
  }

  .lesson-inline-upload .upload-box {
    margin-top: 0;
  }
}


/* Mobile Lehreransicht: Backup-Funktionen ausblenden */
@media (max-width: 820px) {
  .teacher-backup-controls {
    display: none !important;
  }
}


/* Lokale Test-Backup-Funktionen vorerst vollständig ausblenden */
.teacher-backup-controls {
  display: none !important;
}

/* =========================================================
   Designschritt 2: Logo ausblenden und Kennzahlen gliedern
   ========================================================= */

/* Logo im Kopfbereich entfernen */
.brand-logo {
  display: none !important;
}

/* Kopfbereich kompakter gestalten */
.topbar {
  align-items: center;
  padding-top: 4px;
  padding-bottom: 18px;
}

.brand {
  gap: 4px;
}

.brand h1 {
  font-size: 28px;
  line-height: 1.08;
}

.userbar {
  padding-top: 0;
}

/* Kennzahlenkarten freundlicher und klar unterscheidbar */
.kpi {
  min-height: 94px;
  padding: 18px;
  border-width: 1px;
  box-shadow: 0 5px 16px rgba(23, 33, 58, .04);
}

.grid.three > .kpi:nth-child(1) {
  background: var(--organizer-blue);
  border-color: #cddff1;
}

.grid.three > .kpi:nth-child(2) {
  background: var(--organizer-green);
  border-color: #d3e3d1;
}

.grid.three > .kpi:nth-child(3) {
  background: var(--organizer-sand);
  border-color: #eadcc4;
}

.kpi strong {
  margin-bottom: 5px;
  font-size: 29px;
  line-height: 1;
  color: var(--ink);
}

.kpi .small {
  color: #606875;
}

@media (max-width: 820px) {
  .brand h1 {
    font-size: 23px;
  }

  .kpi {
    min-height: auto;
    padding: 15px;
  }
}

/* Designschritt 3: Logo ersetzt die Textüberschrift */
.brand-logo {
  display: block !important;
  width: min(270px, 100%);
  height: auto;
  margin: 0 0 8px;
  border-radius: 0;
}

.brand h1 {
  display: none !important;
}

.topbar {
  align-items: flex-start;
}

@media (max-width: 820px) {
  .brand-logo {
    width: min(210px, 72vw);
  }
}

/* =========================================================
   Designschritt 4: Status / News
   ========================================================= */

.status-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-color: #d8dfe8;
  background: var(--panel);
}

.status-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 100%;
  background: #789fc9;
}

.status-card h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 25px;
  letter-spacing: -.025em;
}

.status-card > p,
.status-card .small {
  color: var(--muted);
  line-height: 1.5;
}

.status-card hr {
  margin: 18px 0;
  border-color: #e4e3de;
}

.status-card .field {
  margin-bottom: 14px;
}

.status-card label {
  color: var(--ink);
  font-size: 14px;
}

.status-card input[type="file"] {
  padding: 7px;
  background: #faf9f5;
  border-color: #d8d7d1;
}

.status-card input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border: 1px solid #cfd5df;
  border-radius: 9px;
  background: var(--organizer-blue);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.status-card input[type="text"] {
  min-height: 48px;
  background: #fffefa;
}

.status-card button {
  min-height: 44px;
  padding-left: 20px;
  padding-right: 20px;
}

@media (max-width: 820px) {
  .status-card {
    padding: 18px 16px 18px 20px;
  }

  .status-card h2 {
    font-size: 22px;
  }

  .status-card button {
    width: 100%;
  }
}

/* =========================================================
   Designschritt 5: Schüler- und Unterrichtsbereich
   ========================================================= */

.grid.two {
  gap: 18px;
}

/* Linke Schülerkarte */
.grid.two > .card:first-child {
  background: #fbfcfe;
  border-color: #d9e1eb;
}

.grid.two > .card:first-child h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 24px;
  letter-spacing: -.025em;
}

/* Rechte Hauptkarte */
.grid.two > .card:last-child {
  background: var(--panel);
  border-color: #d8dfe8;
}

.grid.two > .card:last-child > h2,
.grid.two > .card:last-child h2 {
  letter-spacing: -.025em;
}

/* Such- und Filterbereiche */
.student-controls {
  gap: 14px;
  margin: 14px 0 18px;
}

.student-controls .field {
  margin-bottom: 0;
}

.student-controls input,
.student-controls select {
  min-height: 44px;
  background: #fff;
}

/* Schülerkarten */
.student-list-item {
  padding: 14px;
  border-radius: 13px;
  transition:
    border-color .12s ease,
    background .12s ease,
    box-shadow .12s ease,
    transform .12s ease;
}

.student-list-item:hover {
  transform: translateY(-1px);
  border-color: #b9c9dc;
  background: #fff;
}

.student-list-item.active {
  background: #f5f9ff;
  border-color: #5f8fc5;
  box-shadow: 0 0 0 3px rgba(83, 137, 199, .12);
}

.student-list-item h3 {
  color: var(--ink);
  font-size: 17px;
}

.student-list-item p {
  line-height: 1.4;
}

/* Schülerstatus */
.student-meta {
  padding: 14px;
  border-radius: 13px;
  background: #f7f8fa;
}

/* Unterrichtsliste */
.lesson-list-item {
  padding: 14px;
  border-radius: 13px;
  transition:
    border-color .12s ease,
    background .12s ease,
    box-shadow .12s ease,
    transform .12s ease;
}

.lesson-list-item:hover {
  transform: translateY(-1px);
  border-color: #b9c9dc;
  background: #fff;
}

.lesson-list-item.active {
  background: #f5f9ff;
  border-color: #5f8fc5;
  box-shadow: 0 0 0 3px rgba(83, 137, 199, .12);
}

.lesson-list-item h3 {
  color: var(--ink);
}

/* Unterrichtsdetails */
.lesson-detail-info,
.lesson-detail-desktop-only {
  border-radius: 14px;
}

.lesson-detail-info h2,
.lesson-detail-info h3,
.lesson-detail-desktop-only h2,
.lesson-detail-desktop-only h3 {
  color: var(--ink);
  letter-spacing: -.02em;
}

/* Material- und Uploadbereich */
.materials {
  gap: 14px;
}

.material-card {
  padding: 14px;
  background: #fffefa;
  border-color: #dddcd6;
}

.upload-grid {
  gap: 16px;
}

.upload-box {
  padding: 16px;
  background: #fbfcfe;
  border-color: #d9e1eb;
}

.upload-box h4 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 17px;
}

@media (max-width: 820px) {
  .grid.two {
    gap: 14px;
  }

  .student-list-item,
  .lesson-list-item {
    padding: 13px;
  }

  .upload-box {
    padding: 14px;
  }
}

/* =========================================================
   Designschritt 6: Breitere Unterrichtsansicht und Uploads
   ========================================================= */

.grid.two {
  grid-template-columns: 305px minmax(0, 1fr);
}

.upload-grid {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  align-items: start;
}

.upload-box {
  min-width: 0;
  padding: 18px;
  border-color: #d5deea;
  background: #f9fbfd;
  box-shadow: 0 4px 12px rgba(23, 33, 58, .035);
}

.upload-box p {
  line-height: 1.4;
}

.upload-box input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 7px;
  background: #fff;
}

.upload-box input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 11px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  background: var(--organizer-blue);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.upload-box button {
  margin-top: 8px;
  min-height: 42px;
}

.lesson-detail-desktop-only {
  min-width: 0;
}

@media (max-width: 980px) and (min-width: 821px) {
  .grid.two {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }
}

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

  .upload-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Designschritt 7: Dateiauswahl übersichtlich darstellen
   ========================================================= */

.upload-box input[type="file"],
.status-card input[type="file"] {
  font-size: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.upload-box input[type="file"]::file-selector-button,
.status-card input[type="file"]::file-selector-button {
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.upload-box button {
  width: 100%;
}

.upload-box .small {
  display: block;
  min-height: 20px;
  margin-top: 8px;
  line-height: 1.4;
}

@media (max-width: 820px) {
  .upload-box input[type="file"],
  .status-card input[type="file"] {
    min-height: 46px;
  }
}

/* =========================================================
   Designschritt 8: Unterrichtsdetails klar gliedern
   ========================================================= */

.lesson-detail-info {
  padding: 16px;
  border: 1px solid #d9e1eb;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(23, 33, 58, .035);
}

.lesson-detail-info .row {
  gap: 12px;
}

.lesson-detail-info h2,
.lesson-detail-info h3 {
  margin-top: 0;
  margin-bottom: 4px;
}

.lesson-detail-desktop-only {
  margin-top: 18px;
}

.lesson-detail-desktop-only > h3,
.lesson-detail-desktop-only > h2 {
  margin-top: 0;
}

.materials {
  margin-top: 10px;
}

.materials:empty::before {
  content: "Noch keine Materialien vorhanden.";
  display: block;
  padding: 16px;
  border: 1px dashed #cfd7e2;
  border-radius: 12px;
  background: #fafbfc;
  color: var(--muted);
}

.lesson-upload-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #e2e1dc;
}

.lesson-upload-section > h3,
.lesson-upload-section > h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 21px;
  letter-spacing: -.02em;
}

.upload-grid {
  margin-top: 10px;
}

@media (max-width: 820px) {
  .lesson-detail-info {
    padding: 14px;
  }

  .lesson-upload-section {
    margin-top: 14px;
    padding-top: 14px;
  }
}

/* =========================================================
   Ausgewählten Schüler deutlicher hervorheben
   ========================================================= */

.student-list-item {
  position: relative;
  overflow: hidden;
}

.student-list-item.active {
  background: #eef5ff;
  border-color: #2f67ad;
  box-shadow:
    0 0 0 3px rgba(47, 103, 173, .14),
    0 8px 18px rgba(23, 63, 120, .08);
  transform: translateY(-1px);
}

.student-list-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: #2f67ad;
}

.student-list-item.active h3 {
  color: #173f78;
}

.student-list-item.active p {
  color: #4f5f73;
}

.student-list-item.active .badge {
  background: #dff3e6;
  color: #246b43;
}

@media (max-width: 820px) {
  .student-list-item.active {
    box-shadow:
      0 0 0 3px rgba(47, 103, 173, .12),
      0 5px 14px rgba(23, 63, 120, .06);
  }

  .student-list-item.active::before {
    width: 5px;
  }
}

/* =========================================================
   Materialkarten nach Dateityp unterscheiden
   Video blau, PDF rot, GPX grün, Audio lila
   ========================================================= */

.material-card {
  position: relative;
  overflow: hidden;
  border-left-width: 6px;
}

.material-card::before {
  content: "DATEI";
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .055em;
}

/* Video – Blau */
.material-card.material-type-video {
  border-left-color: #4f86c6;
  background: #f3f8fd;
}

.material-card.material-type-video::before {
  content: "VIDEO";
  color: #23558f;
  background: #dceaf8;
}

/* PDF – Rot */
.material-card.material-type-pdf {
  border-left-color: #c85b58;
  background: #fff6f5;
}

.material-card.material-type-pdf::before {
  content: "PDF";
  color: #963f3c;
  background: #f7dfdd;
}

/* GPX / Guitar Pro – Grün */
.material-card.material-type-gpx {
  border-left-color: #579568;
  background: #f4faf5;
}

.material-card.material-type-gpx::before {
  content: "GPX";
  color: #347047;
  background: #dfeee2;
}

/* MP3 / Audio – Lila */
.material-card.material-type-audio {
  border-left-color: #8068b0;
  background: #f8f5fc;
}

.material-card.material-type-audio::before {
  content: "AUDIO";
  color: #624a91;
  background: #e8e0f3;
}

/* Sonstige Dateien */
.material-card.material-type-file {
  border-left-color: #9298a1;
  background: #fafafa;
}

.material-card.material-type-file::before {
  color: #626872;
  background: #e9eaec;
}

.material-card header {
  margin-bottom: 12px;
}

@media (max-width: 820px) {
  .material-card {
    border-left-width: 5px;
  }
}

/* =========================================================
   Designschritt 9: Mobile Unterrichtskarten
   ========================================================= */

@media (max-width: 820px) {
  .lesson-list-entry {
    padding: 0;
    margin-bottom: 16px;
    border: 1px solid #d8e0ea;
    border-radius: 15px;
    background: #fffefa;
    box-shadow:
      0 2px 4px rgba(23, 33, 58, .035),
      0 8px 18px rgba(23, 33, 58, .045);
    overflow: hidden;
  }

  .lesson-list-entry .lesson-list-item {
    margin: 0;
    padding: 15px 16px;
    border: 0;
    border-radius: 0;
    background: #fffefa;
    box-shadow: none;
  }

  .lesson-list-entry .lesson-list-item.active {
    background: #f3f8fd;
    border: 0;
    box-shadow: none;
  }

  .lesson-list-entry .lesson-list-item h3 {
    margin-bottom: 5px;
    font-size: 17px;
    line-height: 1.3;
    color: var(--ink);
  }

  .lesson-list-entry .lesson-list-item p {
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
  }

  .lesson-video-button {
    width: calc(100% - 24px);
    min-height: 46px;
    margin: 0 12px 12px;
    padding: 11px 16px;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 750;
    box-shadow:
      0 2px 0 rgba(10, 35, 70, .15),
      0 6px 13px rgba(23, 63, 120, .13);
  }

  .lesson-video-button:hover,
  .lesson-video-button:focus {
    background: var(--accent2);
  }

  .lesson-inline-upload {
    padding: 0 12px 12px;
    background: #fffefa;
  }

  .lesson-inline-upload .upload-box {
    padding: 14px;
    border-radius: 12px;
    background: #f7f9fc;
  }

  .lesson-inline-upload .upload-box h4 {
    font-size: 16px;
  }
}

/* =========================================================
   Designschritt 10: Mobile Unterrichtskarte vereinfachen
   ========================================================= */

@media (max-width: 820px) {
  .lesson-list-entry {
    border: 1px solid #ccd9e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(23, 63, 120, .07);
  }

  .lesson-list-entry .lesson-list-item,
  .lesson-list-entry .lesson-list-item.active {
    padding: 17px 18px;
    background: #f3f7fc;
    border: 0;
    border-bottom: 1px solid #d8e1ec;
    border-radius: 0;
    box-shadow: none;
  }

  .lesson-list-entry .lesson-list-item.active::before {
    display: none;
  }

  .lesson-list-entry .lesson-list-item h3 {
    color: #173f78;
  }

  .lesson-video-button,
  .lesson-list-entry .lesson-video-button {
    display: block;
    width: calc(100% - 24px);
    min-height: 48px;
    margin: 12px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow:
      0 2px 0 rgba(10, 35, 70, .16),
      0 6px 14px rgba(23, 63, 120, .14);
  }

  .lesson-video-button:hover,
  .lesson-video-button:focus,
  .lesson-video-button:active {
    background: var(--accent2) !important;
    color: #fff !important;
  }

  .lesson-inline-upload {
    margin: 0;
    padding: 4px 12px 14px;
    background: #fff;
  }

  .lesson-inline-upload .lesson-upload-section {
    margin: 0;
    padding: 14px 0 0;
    border-top: 1px solid #e0e4e8;
  }

  .lesson-inline-upload .upload-box {
    margin: 0;
    padding: 16px;
    border: 1px solid #d5deea;
    border-radius: 13px;
    background: #f7f9fc;
    box-shadow: none;
  }

  .lesson-inline-upload .upload-box button {
    min-height: 48px;
  }
}

/* =========================================================
   Designschritt 11: Status / News als Klappmenü
   ========================================================= */

.status-panel-details {
  padding: 0;
}

.status-panel-details::before {
  display: none;
}

.status-panel-summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 82px;
  padding: 20px 58px 20px 26px;
  border-left: 7px solid #789fc9;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.status-panel-summary::-webkit-details-marker {
  display: none;
}

.status-panel-summary span {
  display: grid;
  gap: 5px;
}

.status-panel-summary strong {
  color: var(--ink);
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.status-panel-summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.status-panel-summary::after {
  content: "＋";
  position: absolute;
  top: 50%;
  right: 24px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #cbd7e5;
  border-radius: 50%;
  background: var(--organizer-blue);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-50%);
}

.status-panel-details[open] .status-panel-summary {
  border-bottom: 1px solid #e1e5ea;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.status-panel-details[open] .status-panel-summary::after {
  content: "−";
}

.status-panel-content {
  padding: 22px 26px 24px 33px;
  border-left: 7px solid #789fc9;
}

.status-panel-description {
  margin-top: 0;
  margin-bottom: 22px;
}

@media (max-width: 820px) {
  .status-panel-summary {
    min-height: 72px;
    padding: 16px 52px 16px 18px;
    border-left-width: 6px;
  }

  .status-panel-summary strong {
    font-size: 20px;
  }

  .status-panel-summary::after {
    right: 16px;
    width: 30px;
    height: 30px;
  }

  .status-panel-content {
    padding: 18px 16px 20px 22px;
    border-left-width: 6px;
  }
}

/* =========================================================
   Designschritt 12: Video-Buttons funktional unterscheiden
   ========================================================= */

/* Unterrichtskarte: Uploadbereich öffnen/schließen */
.lesson-video-button,
.lesson-list-entry .lesson-video-button {
  background: #eaf2fb !important;
  color: #173f78 !important;
  border: 1px solid #b9cee5 !important;
  box-shadow:
    0 2px 0 rgba(47, 103, 173, .08),
    0 5px 12px rgba(47, 103, 173, .07) !important;
}

.lesson-video-button:hover,
.lesson-video-button:focus {
  background: #dceaf8 !important;
  color: #123763 !important;
  border-color: #8eb1d6 !important;
}

/* Geöffnete Unterrichtseinheit deutlicher kennzeichnen */
.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) .lesson-video-button {
  background: #dfeaf6 !important;
  color: #173f78 !important;
  border-color: #7ea5ce !important;
}

/* Eigentlicher Speichervorgang bleibt Primäraktion */
.lesson-inline-upload .upload-box button[type="submit"],
.lesson-upload-section .upload-box button[type="submit"] {
  background: var(--accent) !important;
  color: #fff !important;
  border: 1px solid var(--accent) !important;
  box-shadow:
    0 2px 0 rgba(10, 35, 70, .16),
    0 7px 15px rgba(23, 63, 120, .14) !important;
}

.lesson-inline-upload .upload-box button[type="submit"]:hover,
.lesson-inline-upload .upload-box button[type="submit"]:focus,
.lesson-upload-section .upload-box button[type="submit"]:hover,
.lesson-upload-section .upload-box button[type="submit"]:focus {
  background: var(--accent2) !important;
  border-color: var(--accent2) !important;
}

/* Alternative Absicherung, falls der Button keinen type-Wert besitzt */
.lesson-inline-upload .upload-box form > button:not(.secondary):not(.ghost):not(.danger),
.lesson-upload-section .upload-box form > button:not(.secondary):not(.ghost):not(.danger) {
  background: var(--accent) !important;
  color: #fff !important;
}

@media (max-width: 820px) {
  .lesson-video-button,
  .lesson-list-entry .lesson-video-button {
    min-height: 48px;
    font-weight: 750;
  }

  .lesson-inline-upload .upload-box button[type="submit"],
  .lesson-upload-section .upload-box button[type="submit"] {
    min-height: 50px;
    font-size: 16px;
  }
}

/* =========================================================
   Designschritt 13: Video-Buttons farblich klar trennen
   ========================================================= */

/* Öffnen / vorbereiten – Salbeigrün */
.lesson-video-button,
.lesson-list-entry .lesson-video-button {
  background: #e7f2e9 !important;
  color: #2f6b46 !important;
  border: 1px solid #a8c9b2 !important;
  box-shadow:
    0 2px 0 rgba(47, 107, 70, .08),
    0 5px 12px rgba(47, 107, 70, .07) !important;
}

.lesson-video-button:hover,
.lesson-video-button:focus {
  background: #d9eadc !important;
  color: #285d3c !important;
  border-color: #85b394 !important;
}

/* Geöffneter Uploadbereich */
.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) .lesson-video-button {
  background: #dcecdf !important;
  color: #285d3c !important;
  border-color: #79aa88 !important;
}

/* Speichern – Marineblau bleibt Primäraktion */
.lesson-inline-upload .upload-box button[type="submit"],
.lesson-upload-section .upload-box button[type="submit"],
.lesson-inline-upload .upload-box form > button:not(.secondary):not(.ghost):not(.danger),
.lesson-upload-section .upload-box form > button:not(.secondary):not(.ghost):not(.danger) {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.lesson-inline-upload .upload-box button[type="submit"]:hover,
.lesson-upload-section .upload-box button[type="submit"]:hover,
.lesson-inline-upload .upload-box button[type="submit"]:focus,
.lesson-upload-section .upload-box button[type="submit"]:focus {
  background: var(--accent2) !important;
  border-color: var(--accent2) !important;
}

/* =========================================================
   Designschritt 14: Upload und vorhandenes Material trennen
   ========================================================= */

@media (min-width: 821px) {
  .lesson-upload-section {
    margin-bottom: 34px;
    padding-bottom: 30px;
    border-bottom: 2px solid #dfe5ec;
  }

  .lesson-upload-section + .lesson-detail-desktop-only {
    margin-top: 0;
  }

  .lesson-upload-section + hr.lesson-detail-desktop-only {
    display: none;
  }

  .lesson-upload-section ~ h3.lesson-detail-desktop-only {
    margin-top: 0;
    padding-top: 2px;
    font-size: 24px;
    letter-spacing: -.025em;
  }

  .materials.lesson-detail-desktop-only {
    margin-top: 14px;
    padding-top: 4px;
  }
}

/* Materialbereich näher an die Trennlinie rücken */
@media (min-width: 821px) {
  .lesson-upload-section {
    margin-bottom: 22px;
    padding-bottom: 22px;
  }

  .lesson-upload-section ~ h3.lesson-detail-desktop-only {
    margin-top: 0;
    margin-bottom: 12px;
    padding-top: 0;
  }

  .materials.lesson-detail-desktop-only {
    margin-top: 0;
  }
}

/* =========================================================
   Designschritt 15: Mobile Lehreransicht auf Schüler fokussieren
   ========================================================= */

.mobile-selected-student-bar {
  display: none;
}

@media (max-width: 820px) {
  .mobile-selected-student-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px 15px;
    border: 1px solid #cbd9e8;
    border-radius: 14px;
    background: #f3f7fc;
    box-shadow: 0 5px 14px rgba(23, 63, 120, .055);
  }

  .mobile-selected-student-bar > div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-selected-student-bar strong {
    overflow: hidden;
    color: #173f78;
    font-size: 17px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-selected-student-bar button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    color: #173f78;
    background: #fff;
    border-color: #b9c9dc;
    box-shadow: none;
  }

  /* Nach Schülerauswahl nur den relevanten Arbeitsbereich zeigen */
  .app-shell:has(.mobile-selected-student-bar) .teacher-stats,
  .app-shell:has(.mobile-selected-student-bar) .status-panel-details,
  .app-shell:has(.mobile-selected-student-bar) .teacher-student-sidebar {
    display: none !important;
  }

  .app-shell:has(.mobile-selected-student-bar) .grid.two {
    display: block;
  }

  .app-shell:has(.mobile-selected-student-bar) .teacher-main-panel {
    padding: 14px;
  }
}

/* =========================================================
   Designschritt 16: Mobiler Schülerwechsel mit Suche
   ========================================================= */

@media (max-width: 820px) {
  /* Normalzustand: Schülerliste ausgeblendet */
  .app-shell:has(.mobile-selected-student-bar)
  .teacher-student-sidebar {
    display: none !important;
  }

  /* Wechsler geöffnet: Schülerliste mit Suche anzeigen */
  .app-shell:has(.mobile-selected-student-bar.picker-open)
  .teacher-student-sidebar {
    display: block !important;
    margin-bottom: 14px;
  }

  /* Während der Auswahl den Unterrichtsbereich ausblenden */
  .app-shell:has(.mobile-selected-student-bar.picker-open)
  .teacher-main-panel {
    display: none !important;
  }

  .app-shell:has(.mobile-selected-student-bar.picker-open)
  .grid.two.mobile-student-picker-open {
    display: block;
  }

  .mobile-selected-student-bar.picker-open {
    background: #edf5ec;
    border-color: #b8d3bf;
  }

  .mobile-selected-student-bar.picker-open button {
    color: #2f6b46;
    border-color: #a8c9b2;
    background: #fff;
  }

  .teacher-student-sidebar .student-controls {
    display: grid !important;
  }

  .teacher-student-sidebar #studentForm:not(.hidden) {
    display: block;
  }

  .teacher-student-sidebar .list {
    margin-top: 14px;
  }
}

/* =========================================================
   Mobile Unterrichtskarte öffnet und schließt den Video-Upload
   ========================================================= */

@media (max-width: 820px) {
  /* Unterrichtskarte wieder direkt bedienbar machen */
  .lesson-list-item {
    pointer-events: auto !important;
    cursor: pointer;
  }

  /* Separater Button bleibt ebenfalls bedienbar */
  .lesson-video-button {
    pointer-events: auto !important;
  }

  /* Geöffnete Einheit optisch kennzeichnen */
  .lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
    border-color: #79aa88;
    box-shadow:
      0 0 0 3px rgba(87, 149, 104, .11),
      0 8px 18px rgba(23, 63, 120, .06);
  }

  .lesson-list-entry:has(.lesson-inline-upload:not(:empty))
  .lesson-list-item {
    background: #f1f7f2;
    border-bottom-color: #c9ddcf;
  }
}

/* =========================================================
   Designschritt 17: Mobiler Kopfbereich kompakter
   ========================================================= */

@media (max-width: 820px) {
  .app-shell {
    padding-top: 8px;
  }

  .topbar {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0 10px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
  }

  .brand-logo {
    width: min(155px, 43vw);
    margin: 0;
  }

  /* Cloud-Testhinweis mobil ausblenden */
  .brand > span {
    display: none;
  }

  .userbar {
    flex: 0 1 55%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    padding-top: 0;
  }

  .userbar button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.15;
  }

  .userbar .small {
    font-size: 12px;
  }

  .mobile-selected-student-bar {
    margin-top: 2px;
    margin-bottom: 12px;
  }
}

@media (max-width: 390px) {
  .brand-logo {
    width: min(138px, 40vw);
  }

  .userbar {
    gap: 5px;
  }

  .userbar button {
    padding: 7px 8px;
    font-size: 11px;
  }
}

/* =========================================================
   Designschritt 18: Mobile Abstände und Unterrichtskarten
   ========================================================= */

@media (max-width: 820px) {
  /* Abstand unter dem Kopfbereich reduzieren */
  .topbar {
    margin-bottom: 0;
    padding-bottom: 6px;
  }

  .topbar + * {
    margin-top: 0;
  }

  .mobile-selected-student-bar {
    margin-top: 0;
    margin-bottom: 10px;
    padding: 12px 14px;
  }

  .mobile-selected-student-bar strong {
    font-size: 16px;
  }

  .mobile-selected-student-bar button {
    min-height: 38px;
    padding: 7px 11px;
    font-size: 14px;
  }

  /* Unterrichtsbereich kompakter */
  .teacher-main-panel {
    padding: 12px !important;
  }

  .lesson-list-entry {
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .lesson-list-entry .lesson-list-item,
  .lesson-list-entry .lesson-list-item.active {
    padding: 13px 15px;
  }

  .lesson-list-entry .lesson-list-item h3 {
    margin-bottom: 3px;
    font-size: 16px;
    line-height: 1.25;
  }

  .lesson-list-entry .lesson-list-item p {
    margin-top: 4px;
    margin-bottom: 0;
  }

  .lesson-upload-hint {
    margin-top: 8px !important;
    font-size: 12px !important;
    line-height: 1.3;
  }

  /* Testhinweis am Seitenende zurücknehmen */
  .footer-note {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.35;
    opacity: .75;
  }
}

/* =========================================================
   Schüler speichern – eigenständige Aktionsfarbe
   ========================================================= */

#newStudentForm > button:first-of-type,
form[onsubmit^="saveStudentEdit"] .row > button:first-child {
  background: #2f6b46 !important;
  color: #fff !important;
  border: 1px solid #285d3c !important;
  box-shadow:
    0 2px 0 rgba(32, 82, 52, .16),
    0 6px 14px rgba(47, 107, 70, .14);
}

#newStudentForm > button:first-of-type:hover,
#newStudentForm > button:first-of-type:focus,
form[onsubmit^="saveStudentEdit"] .row > button:first-child:hover,
form[onsubmit^="saveStudentEdit"] .row > button:first-child:focus {
  background: #285d3c !important;
  border-color: #234f34 !important;
}

/* =========================================================
   Schülerstatus: aktiv blau, inaktiv rot
   ========================================================= */

.student-list-item .badge.on {
  background: #e5effb !important;
  color: #173f78 !important;
  border: 1px solid #bfd2e8;
}

.student-list-item .badge.off {
  background: #fbe7e7 !important;
  color: #9a2929 !important;
  border: 1px solid #e5bcbc;
}

/* Auch beim ausgewählten Schüler Statusfarbe beibehalten */
.student-list-item.active .badge.on {
  background: #dceafb !important;
  color: #173f78 !important;
  border-color: #acc6e3;
}

.student-list-item.active .badge.off {
  background: #f9dddd !important;
  color: #922525 !important;
  border-color: #dfa9a9;
}

/* =========================================================
   Schülerbereich: ruhiger Seitenhintergrund
   ========================================================= */

body:has(.student-shell) {
  background: #f3f5f1;
}

.student-shell {
  background: transparent;
}

.student-sticky-topbar {
  background: rgba(243, 245, 241, .96);
}

/* =========================================================
   Schülerkopf: Benutzerleiste etwas tiefer positionieren
   ========================================================= */

.student-sticky-topbar .userbar {
  margin-top: 18px;
}

@media (max-width: 820px) {
  .student-sticky-topbar .userbar {
    margin-top: 10px;
  }
}

/* =========================================================
   Schülerkopf: einheitliche Größe und Marineblau
   ========================================================= */

.student-sticky-topbar .userbar {
  align-items: center;
  gap: 12px;
}

.student-sticky-topbar .userbar .badge,
.student-sticky-topbar .userbar strong,
.student-sticky-topbar .userbar button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #101a67 !important;
}

.student-sticky-topbar .userbar .badge {
  background: #f4f4f1;
  border: 1px solid #e1e1dc;
}

.student-sticky-topbar .userbar strong {
  background: #f4f4f1;
  border: 1px solid #e1e1dc;
}

.student-sticky-topbar .userbar button {
  background: #f4f4f1 !important;
  border: 1px solid #d9d9d3 !important;
  box-shadow: none !important;
}

.student-sticky-topbar .userbar button:hover,
.student-sticky-topbar .userbar button:focus {
  background: #ecece7 !important;
  color: #101a67 !important;
}

@media (max-width: 820px) {
  .student-sticky-topbar .userbar {
    gap: 8px;
  }

  .student-sticky-topbar .userbar .badge,
  .student-sticky-topbar .userbar strong,
  .student-sticky-topbar .userbar button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 15px;
  }
}

/* =========================================================
   Schülerkopf: Bereich und Vorname in einem Rahmen
   ========================================================= */

.student-sticky-topbar .student-area-group {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid #d9d9d3;
  border-radius: 999px;
  background: #f4f4f1;
  color: #101a67;
}

.student-sticky-topbar .student-area-group span,
.student-sticky-topbar .student-area-group strong {
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #101a67 !important;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.student-sticky-topbar .userbar > button {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 18px;
}

@media (max-width: 820px) {
  .student-sticky-topbar .student-area-group {
    gap: 9px;
    min-height: 38px;
    padding: 8px 12px;
  }

  .student-sticky-topbar .student-area-group span,
  .student-sticky-topbar .student-area-group strong {
    font-size: 15px;
  }

  .student-sticky-topbar .userbar > button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 15px;
  }
}

/* =========================================================
   Einheitliche Containerbreite in Lehrer- und Schülerbereich
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.app-shell,
.student-shell {
  width: 100%;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 18px;
  padding-right: 18px;
}

/* Kopfbereich nicht mehr über die Außenkante hinausziehen */
.topbar,
.student-sticky-topbar {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Direkte Hauptbereiche immer bündig zur Shell */
.app-shell > .card,
.app-shell > .grid,
.app-shell > .teacher-stats,
.app-shell > .status-card,
.app-shell > .status-panel-details,
.student-shell > .card,
.student-shell > .grid,
.student-shell > .status-card,
.student-shell > .status-panel-details {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* Schülerbereich: Such- und Unterrichtscontainer bündig halten */
.student-shell .student-lessons-shell,
.student-shell .student-lesson-card,
.student-shell .student-search-card {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 820px) {
  .app-shell,
  .student-shell {
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar,
  .student-sticky-topbar {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .app-shell > .card,
  .app-shell > .grid,
  .app-shell > .teacher-stats,
  .app-shell > .status-card,
  .app-shell > .status-panel-details,
  .student-shell > .card,
  .student-shell > .grid,
  .student-shell > .status-card,
  .student-shell > .status-panel-details {
    width: 100%;
  }
}

/* =========================================================
   Einheitliche Textfarben mit Marineblau als Markenfarbe
   ========================================================= */

:root {
  --brand-navy: #101a67;
  --text-main: #202638;
  --text-muted: #687184;
  --text-soft: #8a91a0;
}

/* Haupttext */
body {
  color: var(--text-main);
}

/* Überschriften und wichtige Bezeichnungen */
h1,
h2,
h3,
h4,
.brand,
.userbar,
.student-list-item h3,
.lesson-list-item h3,
.student-area-group,
.status-panel-summary strong,
.kpi strong {
  color: var(--brand-navy);
}

/* Buttons mit heller oder neutraler Fläche */
button.secondary,
button.ghost,
.student-sticky-topbar .userbar button,
.student-sticky-topbar .student-area-group {
  color: var(--brand-navy) !important;
}

/* Normaler Fließtext */
p,
.student-details,
.student-email,
.material-card,
.lesson-detail-info {
  color: var(--text-main);
}

/* Sekundäre Informationen */
.small,
.footer-note,
.status-panel-summary small,
.kpi .small,
.lesson-list-item .small,
.student-list-item p {
  color: var(--text-muted);
}

/* Formularbeschriftungen */
label {
  color: var(--text-main);
}

/* Platzhalter bewusst heller */
input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
  opacity: 1;
}

/* Statusfarben nicht überschreiben */
.badge.on {
  color: #173f78 !important;
}

.badge.off,
.error,
.danger {
  color: #922525;
}

.success {
  color: #246b43;
}

/* =========================================================
   Desktoplayout breiter und seitenfüllender
   ========================================================= */

.app-shell,
.student-shell {
  width: min(1480px, calc(100% - 32px));
  max-width: 1480px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 18px;
  padding-right: 18px;
}

/* Lehrerbereich: Hauptspalten besser ausnutzen */
@media (min-width: 1100px) {
  .grid.two {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .teacher-main-panel {
    min-width: 0;
  }
}

/* Große Bildschirme */
@media (min-width: 1600px) {
  .app-shell,
  .student-shell {
    width: min(1560px, calc(100% - 48px));
    max-width: 1560px;
  }
}

/* Tablet */
@media (max-width: 1099px) {
  .app-shell,
  .student-shell {
    width: calc(100% - 24px);
    max-width: none;
  }
}

/* Mobil */
@media (max-width: 820px) {
  .app-shell,
  .student-shell {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* =========================================================
   Layout-Finalisierung: klare Ebenen statt Karten-in-Karten
   ========================================================= */

:root {
  --page-bg: #eef1ed;
  --workspace-bg: #ffffff;
  --subtle-bg: #f7f8f6;
  --line-soft: #dde2dc;
  --line-active: #244a9b;
  --shadow-soft: 0 8px 24px rgba(25, 36, 58, .05);
  --shadow-active: 0 8px 20px rgba(36, 74, 155, .10);
}

/* Seitenfläche */
body {
  background: var(--page-bg);
}

/* Hauptarbeitsfläche */
.app-shell,
.student-shell {
  background: transparent;
}

/* Hauptkarten */
.card,
.teacher-main-panel,
.teacher-student-sidebar,
.status-panel-details,
.status-card {
  background: var(--workspace-bg);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

/* Verschachtelte Karten ruhiger halten */
.card .card,
.teacher-main-panel .card,
.teacher-student-sidebar .card,
.lesson-detail-info,
.student-meta,
.edit-panel,
.upload-box,
.material-card,
.lesson-list-entry,
.student-list-item,
.lesson-list-item,
.kpi {
  box-shadow: none;
}

/* KPI-Karten als flache Übersicht */
.kpi {
  border-radius: 14px;
  border-color: var(--line-soft);
  background: var(--subtle-bg);
}

/* Statusbereich kompakter */
.status-panel-details,
.status-card {
  overflow: hidden;
}

.status-panel-summary {
  min-height: 60px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.status-panel-content {
  background: var(--workspace-bg);
}

/* Linke Schülernavigation */
.teacher-student-sidebar {
  padding: 16px;
}

.student-list-item {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
}

.student-list-item:hover {
  border-color: #c9d1ca;
  background: #fafbf9;
}

.student-list-item.active {
  border-color: var(--line-active);
  background: #f1f5fb;
  box-shadow: var(--shadow-active);
}

/* Hauptbereich */
.teacher-main-panel {
  padding: 18px;
}

/* Unterrichtslisten */
.lesson-list-entry {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
}

.lesson-list-entry .lesson-list-item,
.lesson-list-entry .lesson-list-item.active {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
  border-color: var(--line-active);
  background: #f4f7fb;
  box-shadow: var(--shadow-active);
}

/* Unterrichtsdetail flacher */
.lesson-detail-info {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
}

/* Uploadboxen */
.upload-box {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
}

.upload-box:hover {
  border-color: #cbd3cc;
}

/* Materialkarten */
.material-card {
  border-radius: 12px;
  border-top-color: var(--line-soft);
  border-right-color: var(--line-soft);
  border-bottom-color: var(--line-soft);
}

/* Eingabefelder */
input,
textarea,
select {
  border-color: #d8ddd7;
  border-radius: 10px;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--line-active);
  outline: 2px solid rgba(36, 74, 155, .10);
}

/* Trennlinien dezenter */
hr {
  border-top-color: var(--line-soft);
}

/* Footer zurücknehmen */
.footer-note {
  opacity: .72;
}

/* Desktop: linke und rechte Arbeitsfläche als Einheit */
@media (min-width: 821px) {
  .grid.two {
    gap: 16px;
  }

  .teacher-student-sidebar,
  .teacher-main-panel {
    min-height: 100%;
  }
}

/* Mobil: weniger Kartenrahmen, klare Flächen */
@media (max-width: 820px) {
  body {
    background: var(--page-bg);
  }

  .card,
  .teacher-main-panel,
  .teacher-student-sidebar,
  .status-panel-details,
  .status-card {
    border-radius: 14px;
    box-shadow: 0 5px 16px rgba(25, 36, 58, .045);
  }

  .teacher-main-panel,
  .teacher-student-sidebar {
    padding: 12px;
  }

  .lesson-list-entry,
  .student-list-item,
  .upload-box,
  .material-card,
  .lesson-detail-info {
    border-radius: 11px;
  }

  .lesson-list-entry {
    margin-bottom: 10px;
  }

  .status-panel-summary {
    min-height: 54px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* =========================================================
   Markenabgleich mit kaistuffel.de
   Warme Creme-, Sand- und Marineblau-Palette
   ========================================================= */

:root {
  --brand-navy: #101a67;
  --brand-navy-hover: #18257d;

  --page-bg: #f1eee7;
  --workspace-bg: #fffdfa;
  --subtle-bg: #f7f4ee;

  --text-main: #252737;
  --text-muted: #6d6b67;
  --text-soft: #918d86;

  --line-soft: #ded8cd;
  --line-active: #101a67;

  --sage-soft: #e5eee4;
  --sage-strong: #416d50;

  --sand-soft: #eee4d3;
  --warm-accent: #b46f42;

  --shadow-soft: 0 8px 24px rgba(47, 39, 28, .055);
  --shadow-active: 0 8px 22px rgba(16, 26, 103, .12);
}

/* Gesamte Seitenfläche */
body {
  background: var(--page-bg);
  color: var(--text-main);
}

/* Lehrer- und Schülerbereich */
.app-shell,
.student-shell {
  background: transparent;
}

/* Hauptflächen */
.card,
.teacher-main-panel,
.teacher-student-sidebar,
.status-panel-details,
.status-card {
  background: var(--workspace-bg);
  border-color: var(--line-soft);
  box-shadow: var(--shadow-soft);
}

/* Ruhige Unterflächen */
.kpi,
.lesson-detail-info,
.student-meta,
.edit-panel,
.upload-box {
  background: var(--subtle-bg);
  border-color: var(--line-soft);
}

/* KPI-Karten warm differenzieren */
.grid.three > .kpi:nth-child(1) {
  background: #f4f7fb;
  border-color: #d5dfec;
}

.grid.three > .kpi:nth-child(2) {
  background: var(--sage-soft);
  border-color: #ccdccc;
}

.grid.three > .kpi:nth-child(3) {
  background: var(--sand-soft);
  border-color: #dfd0b9;
}

/* Überschriften und zentrale Bezeichnungen */
h1,
h2,
h3,
h4,
.brand,
.userbar,
.student-area-group,
.status-panel-summary strong,
.kpi strong,
.student-list-item h3,
.lesson-list-item h3 {
  color: var(--brand-navy);
}

/* Fließtext */
p,
label,
input,
textarea,
select,
.student-details,
.student-email,
.material-card,
.lesson-detail-info {
  color: var(--text-main);
}

/* Sekundäre Informationen */
.small,
.footer-note,
.status-panel-summary small,
.kpi .small,
.lesson-list-item .small,
.student-list-item p {
  color: var(--text-muted);
}

/* Eingaben */
input,
textarea,
select {
  background: #fffefa;
  border-color: #d9d3c8;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-navy);
  outline: 2px solid rgba(16, 26, 103, .10);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
  opacity: 1;
}

/* Primärbuttons */
button:not(.secondary):not(.ghost):not(.danger) {
  background: var(--brand-navy);
  color: #fff;
}

button:not(.secondary):not(.ghost):not(.danger):hover,
button:not(.secondary):not(.ghost):not(.danger):focus {
  background: var(--brand-navy-hover);
}

/* Sekundäre Buttons */
button.secondary,
button.ghost {
  background: #f7f5f0;
  color: var(--brand-navy) !important;
  border-color: #d8d3c9;
}

button.secondary:hover,
button.secondary:focus,
button.ghost:hover,
button.ghost:focus {
  background: #efece5;
  border-color: #c9c2b7;
}

/* Vorbereitende Aktionen */
.lesson-video-button,
.lesson-list-entry .lesson-video-button {
  background: var(--sage-soft) !important;
  color: var(--sage-strong) !important;
  border-color: #aec7b3 !important;
}

/* Schülerliste */
.student-list-item {
  background: #fffefa;
  border-color: var(--line-soft);
}

.student-list-item:hover {
  background: #faf7f1;
  border-color: #cfc7bb;
}

.student-list-item.active {
  background: #f2f5fb;
  border-color: var(--brand-navy);
  box-shadow: var(--shadow-active);
}

/* Unterrichtskarten */
.lesson-list-entry {
  background: #fffefa;
  border-color: var(--line-soft);
}

.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
  background: #f3f5fb;
  border-color: var(--brand-navy);
  box-shadow: var(--shadow-active);
}

/* Uploadbereiche */
.upload-box {
  background: #faf7f1;
  border-color: #ddd5c8;
}

/* Status / News */
.status-panel-summary,
.status-card {
  background: var(--workspace-bg);
}

.status-panel-summary {
  border-left-color: #789fc9;
}

/* Schülerkopf */
.student-sticky-topbar {
  background: rgba(241, 238, 231, .96);
}

.student-sticky-topbar .student-area-group,
.student-sticky-topbar .userbar button {
  background: #f8f5ef !important;
  border-color: #d8d1c5 !important;
  color: var(--brand-navy) !important;
}

/* Statusfarben erhalten */
.badge.on {
  background: #e4edf8 !important;
  color: #173f78 !important;
  border-color: #bed0e5 !important;
}

.badge.off {
  background: #f8e1df !important;
  color: #922525 !important;
  border-color: #dfb1ac !important;
}

.success {
  background: #e8f1e7;
  color: #315f3d;
  border-color: #c5d8c6;
}

.error {
  background: #f8e3e0;
  color: #922525;
  border-color: #e3b9b4;
}

/* Materialfarben bleiben funktional, werden aber leicht erwärmt */
.material-card.material-type-video {
  background: #f3f6fb;
}

.material-card.material-type-gpx {
  background: #f0f5ee;
}

.material-card.material-type-pdf {
  background: #fbf1ef;
}

.material-card.material-type-audio {
  background: #f7f3f9;
}

/* Mobil */
@media (max-width: 820px) {
  body {
    background: var(--page-bg);
  }

  .card,
  .teacher-main-panel,
  .teacher-student-sidebar,
  .status-panel-details,
  .status-card {
    background: var(--workspace-bg);
  }

  .lesson-list-entry,
  .student-list-item,
  .upload-box,
  .lesson-detail-info {
    border-color: var(--line-soft);
  }

  .student-sticky-topbar {
    background: rgba(241, 238, 231, .97);
  }
}

/* =========================================================
   Korrektur: Kartenlesbarkeit und kompakter Kopfcontainer
   ========================================================= */

/* ---------------------------------------------------------
   1. Kopfbereich als zusammenhängender Container
   --------------------------------------------------------- */

.topbar,
.student-sticky-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  grid-template-areas:
    "brand user"
    "brandnote brandnote";
  align-items: start;
  gap: 10px 24px;
  padding: 20px 24px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--workspace-bg);
  box-shadow: var(--shadow-soft);
}

.topbar .brand,
.student-sticky-topbar .brand {
  display: contents;
}

.topbar .brand-logo,
.student-sticky-topbar .brand-logo {
  grid-area: brand;
  align-self: start;
  width: min(250px, 100%);
  margin: 0;
}

.topbar .brand > span,
.student-sticky-topbar .brand > span {
  grid-area: brandnote;
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.topbar .userbar,
.student-sticky-topbar .userbar {
  grid-area: user;
  align-self: start;
  justify-self: end;
  margin-top: 0;
  padding-top: 0;
}

/* ---------------------------------------------------------
   2. Nur echte Aktionsbuttons marineblau
   --------------------------------------------------------- */

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.lesson-list-item):not(.student-list-item) {
  background: var(--brand-navy);
  color: #fff;
}

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.lesson-list-item):not(.student-list-item):hover,
button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.lesson-list-item):not(.student-list-item):focus {
  background: var(--brand-navy-hover);
  color: #fff;
}

/* ---------------------------------------------------------
   3. Schülerkarten wieder hell und lesbar
   --------------------------------------------------------- */

.student-list-item,
button.student-list-item,
.item.student-list-item {
  background: #fffefa !important;
  color: var(--text-main) !important;
  border: 1px solid var(--line-soft) !important;
}

.student-list-item h3,
.student-list-item p {
  color: var(--text-main) !important;
}

.student-list-item:hover {
  background: #faf7f1 !important;
  border-color: #cfc7bb !important;
}

.student-list-item.active {
  background: #eef3fb !important;
  border-color: var(--brand-navy) !important;
  box-shadow: var(--shadow-active) !important;
}

.student-list-item.active h3 {
  color: var(--brand-navy) !important;
}

/* ---------------------------------------------------------
   4. Unterrichtskarten wieder hell und lesbar
   --------------------------------------------------------- */

.lesson-list-item,
button.lesson-list-item,
.item.lesson-list-item,
.lesson-list-entry .lesson-list-item,
.lesson-list-entry .lesson-list-item.active {
  background: #fffefa !important;
  color: var(--text-main) !important;
  border: 0 !important;
  box-shadow: none !important;
}

.lesson-list-item h3 {
  color: var(--brand-navy) !important;
}

.lesson-list-item p,
.lesson-list-item .small,
.lesson-upload-hint {
  color: var(--text-muted) !important;
}

.lesson-list-entry {
  background: #fffefa !important;
  border: 1px solid var(--line-soft) !important;
}

.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
  background: #f2f5fb !important;
  border-color: var(--brand-navy) !important;
  box-shadow: var(--shadow-active) !important;
}

.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) .lesson-list-item {
  background: #f2f5fb !important;
}

/* ---------------------------------------------------------
   5. Oberer Lehrerbereich kompakter
   --------------------------------------------------------- */

.topbar .userbar button,
.student-sticky-topbar .userbar button {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 15px;
}

/* ---------------------------------------------------------
   6. Mobile Anpassung
   --------------------------------------------------------- */

@media (max-width: 820px) {
  .topbar,
  .student-sticky-topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "user";
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
  }

  .topbar .brand-logo,
  .student-sticky-topbar .brand-logo {
    grid-area: brand;
    width: min(180px, 52vw);
  }

  .topbar .brand > span,
  .student-sticky-topbar .brand > span {
    display: none;
  }

  .topbar .userbar,
  .student-sticky-topbar .userbar {
    grid-area: user;
    width: 100%;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar .userbar button,
  .student-sticky-topbar .userbar button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .student-list-item,
  .lesson-list-item,
  .lesson-list-entry {
    background: #fffefa !important;
  }
}

/* =========================================================
   Markentext bündig zur Logobreite
   ========================================================= */

.topbar .brand-logo,
.student-sticky-topbar .brand-logo {
  width: min(250px, 100%);
}

.topbar .brand > span,
.student-sticky-topbar .brand > span {
  width: min(250px, 100%);
  margin: 8px 0 0;
  text-align: left;
  color: var(--brand-navy);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
}

@media (max-width: 820px) {
  .topbar .brand-logo,
  .student-sticky-topbar .brand-logo {
    width: min(180px, 52vw);
  }

  .topbar .brand > span,
  .student-sticky-topbar .brand > span {
    width: min(180px, 52vw);
    margin-top: 6px;
    font-size: 13px;
  }
}

/* =========================================================
   Dateien hinzufügen als Klappmenü
   ========================================================= */

.lesson-upload-details {
  margin-top: 18px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--workspace-bg);
  overflow: hidden;
}

.lesson-upload-summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 14px 56px 14px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--workspace-bg);
  color: var(--brand-navy);
}

.lesson-upload-summary::-webkit-details-marker {
  display: none;
}

.lesson-upload-summary span {
  display: grid;
  gap: 3px;
}

.lesson-upload-summary strong {
  color: var(--brand-navy);
  font-size: 20px;
  line-height: 1.2;
}

.lesson-upload-summary small {
  color: var(--text-muted);
  font-size: 13px;
}

.lesson-upload-summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #cfd5df;
  border-radius: 50%;
  color: var(--brand-navy);
  background: #fff;
  font-size: 22px;
  font-weight: 700;
}

.lesson-upload-details[open] .lesson-upload-summary {
  border-bottom: 1px solid var(--line-soft);
}

.lesson-upload-details[open] .lesson-upload-summary::after {
  content: "−";
}

.lesson-upload-content {
  padding: 18px;
  background: var(--subtle-bg);
}

.lesson-upload-content .upload-grid {
  margin-top: 0;
}

@media (max-width: 820px) {
  .lesson-upload-details {
    margin-top: 10px;
    border-radius: 12px;
  }

  .lesson-upload-summary {
    min-height: 56px;
    padding: 12px 48px 12px 14px;
  }

  .lesson-upload-summary strong {
    font-size: 17px;
  }

  .lesson-upload-summary small {
    font-size: 12px;
  }

  .lesson-upload-summary::after {
    right: 14px;
    width: 28px;
    height: 28px;
  }

  .lesson-upload-content {
    padding: 12px;
  }
}

/* =========================================================
   Mobile: gespeichertes Unterrichtsmaterial einklappbar
   ========================================================= */

.mobile-material-details {
  display: none;
}

@media (max-width: 820px) {
  .mobile-material-details {
    display: block;
    margin-top: 10px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--workspace-bg);
  }

  .mobile-material-summary {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 12px 48px 12px 14px;
    cursor: pointer;
    list-style: none;
    background: var(--workspace-bg);
  }

  .mobile-material-summary::-webkit-details-marker {
    display: none;
  }

  .mobile-material-summary span {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-material-summary strong {
    color: var(--brand-navy);
    font-size: 17px;
    line-height: 1.2;
  }

  .mobile-material-summary small {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
  }

  .mobile-material-summary::after {
    content: "+";
    position: absolute;
    right: 14px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid #cfd5df;
    border-radius: 50%;
    background: #fff;
    color: var(--brand-navy);
    font-size: 21px;
    font-weight: 700;
  }

  .mobile-material-details[open] .mobile-material-summary {
    border-bottom: 1px solid var(--line-soft);
  }

  .mobile-material-details[open] .mobile-material-summary::after {
    content: "−";
  }

  .mobile-material-content {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: var(--subtle-bg);
  }

  .mobile-material-content .material-card {
    margin: 0;
  }
}

/* =========================================================
   Einheitliches Button-System
   Lehrer-, Schüler- und Mobilansicht
   ========================================================= */

:root {
  --button-primary: #101a67;
  --button-primary-hover: #18257d;

  --button-preparatory-bg: #e5eee4;
  --button-preparatory-text: #315f3d;
  --button-preparatory-border: #b6cdb9;
  --button-preparatory-hover: #d9e7d8;

  --button-secondary-bg: #f7f5f0;
  --button-secondary-text: #25305f;
  --button-secondary-border: #d5d0c7;
  --button-secondary-hover: #ece9e2;

  --button-danger: #a33a3a;
  --button-danger-hover: #8c2e2e;
}

/* ---------------------------------------------------------
   Gemeinsame Grundform
   Nur echte Aktionsbuttons, keine Listen- oder Kartenbuttons
   --------------------------------------------------------- */

button:not(.item):not(.student-list-item):not(.lesson-list-item) {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  box-shadow: none;
  transition:
    background-color .14s ease,
    border-color .14s ease,
    color .14s ease,
    transform .08s ease,
    box-shadow .14s ease;
}

button:not(.item):not(.student-list-item):not(.lesson-list-item):hover {
  transform: translateY(-1px);
}

button:not(.item):not(.student-list-item):not(.lesson-list-item):active {
  transform: translateY(0);
}

button:not(.item):not(.student-list-item):not(.lesson-list-item):focus-visible {
  outline: 3px solid rgba(16, 26, 103, .16);
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   Primäraktionen – Marineblau
   --------------------------------------------------------- */

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item),
button[type="submit"]:not(.secondary):not(.ghost):not(.danger) {
  background: var(--button-primary) !important;
  color: #fff !important;
  border-color: var(--button-primary) !important;
  box-shadow: 0 5px 12px rgba(16, 26, 103, .13);
}

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item):hover,
button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item):focus,
button[type="submit"]:not(.secondary):not(.ghost):not(.danger):hover,
button[type="submit"]:not(.secondary):not(.ghost):not(.danger):focus {
  background: var(--button-primary-hover) !important;
  border-color: var(--button-primary-hover) !important;
}

/* ---------------------------------------------------------
   Vorbereitende Aktionen – Salbeigrün
   --------------------------------------------------------- */

.lesson-video-button,
.lesson-list-entry .lesson-video-button,
button.preparatory,
button[data-action="prepare"] {
  background: var(--button-preparatory-bg) !important;
  color: var(--button-preparatory-text) !important;
  border-color: var(--button-preparatory-border) !important;
  box-shadow: none !important;
}

.lesson-video-button:hover,
.lesson-video-button:focus,
button.preparatory:hover,
button.preparatory:focus,
button[data-action="prepare"]:hover,
button[data-action="prepare"]:focus {
  background: var(--button-preparatory-hover) !important;
  border-color: #98b99e !important;
}

/* ---------------------------------------------------------
   Sekundäre Aktionen – Neutral
   --------------------------------------------------------- */

button.secondary,
button.ghost {
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
  box-shadow: none !important;
}

button.secondary:hover,
button.secondary:focus,
button.ghost:hover,
button.ghost:focus {
  background: var(--button-secondary-hover) !important;
  color: var(--button-primary) !important;
  border-color: #bbb6ad !important;
}

/* Ghost etwas zurückhaltender */
button.ghost {
  background: transparent !important;
}

/* ---------------------------------------------------------
   Kritische Aktionen – Rot
   --------------------------------------------------------- */

button.danger,
button[onclick^="deleteStudent"],
button[onclick^="deleteLesson"],
button[onclick^="deleteMaterial"],
button[onclick^="removeStatusPost"] {
  background: var(--button-danger) !important;
  color: #fff !important;
  border-color: var(--button-danger) !important;
  box-shadow: 0 5px 12px rgba(163, 58, 58, .12) !important;
}

button.danger:hover,
button.danger:focus,
button[onclick^="deleteStudent"]:hover,
button[onclick^="deleteStudent"]:focus,
button[onclick^="deleteLesson"]:hover,
button[onclick^="deleteLesson"]:focus,
button[onclick^="deleteMaterial"]:hover,
button[onclick^="deleteMaterial"]:focus,
button[onclick^="removeStatusPost"]:hover,
button[onclick^="removeStatusPost"]:focus {
  background: var(--button-danger-hover) !important;
  border-color: var(--button-danger-hover) !important;
}

/* ---------------------------------------------------------
   Schülerbereich – konkrete Rollen
   --------------------------------------------------------- */

/* Schüler bearbeiten, Passwort ändern, Abbrechen */
button[onclick^="showStudentEditForm"],
button[onclick^="showPasswordEditForm"],
button[onclick^="hideStudentEditForm"],
button[onclick^="hidePasswordEditForm"],
button[onclick^="hideStudentForm"],
button[onclick^="hideLessonForm"],
button[onclick^="hideLessonEditForm"] {
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
}

/* Inaktiv setzen bleibt neutral, nicht rot */
button[onclick^="toggleStudentActive"] {
  background: #f5f1e8 !important;
  color: #6a5529 !important;
  border-color: #d8caa8 !important;
}

button[onclick^="toggleStudentActive"]:hover,
button[onclick^="toggleStudentActive"]:focus {
  background: #ece3d1 !important;
  border-color: #c8b681 !important;
}

/* Passwort zurücksetzen als Warnaktion, aber nicht Löschrot */
button[onclick^="resetStudentPassword"],
button[onclick^="resetTeacherPassword"] {
  background: #f8eee1 !important;
  color: #805522 !important;
  border-color: #dfc39b !important;
}

button[onclick^="resetStudentPassword"]:hover,
button[onclick^="resetStudentPassword"]:focus,
button[onclick^="resetTeacherPassword"]:hover,
button[onclick^="resetTeacherPassword"]:focus {
  background: #f1e1cc !important;
  border-color: #cfae7d !important;
}

/* ---------------------------------------------------------
   Kopfbereich
   --------------------------------------------------------- */

.topbar .userbar button,
.student-sticky-topbar .userbar button {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
}

.topbar .userbar button.secondary,
.student-sticky-topbar .userbar button.secondary {
  background: #f7f5f0 !important;
  color: var(--button-primary) !important;
  border-color: #d6d0c6 !important;
}

/* ---------------------------------------------------------
   Uploadbereiche
   --------------------------------------------------------- */

.upload-box button[type="submit"],
.lesson-upload-content button[type="submit"] {
  width: 100%;
  min-height: 46px;
}

.upload-box .upload-cancel {
  width: 100%;
  margin-top: 6px;
}

/* ---------------------------------------------------------
   Buttons innerhalb von Materialkarten
   --------------------------------------------------------- */

.material-card .row button {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 13px;
}

/* ---------------------------------------------------------
   Deaktivierter Zustand
   --------------------------------------------------------- */

button:disabled {
  opacity: .48;
  transform: none !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* ---------------------------------------------------------
   Mobil
   --------------------------------------------------------- */

@media (max-width: 820px) {
  button:not(.item):not(.student-list-item):not(.lesson-list-item) {
    min-height: 42px;
    padding: 9px 14px;
    font-size: 14px;
  }

  .topbar .userbar button,
  .student-sticky-topbar .userbar button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .upload-box button,
  .lesson-upload-content button {
    width: 100%;
  }

  .material-card .row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .material-card .row button {
    width: 100%;
    min-height: 40px;
  }

  .password-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

/* =========================================================
   Kennzahlen dezent am Ende des Lehrerbereichs
   ========================================================= */

.teacher-stats-footer {
  margin-top: 16px;
}

.teacher-stats-footer .teacher-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 253, 250, .72);
  box-shadow: none;
}

.teacher-stats-footer .kpi {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 0;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

.teacher-stats-footer .kpi:last-child {
  border-right: 0;
}

.teacher-stats-footer .kpi strong {
  display: inline;
  margin: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--brand-navy);
}

.teacher-stats-footer .kpi .small {
  display: inline;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-muted);
}

/* Alte große KPI-Darstellung innerhalb des Fußbereichs neutralisieren */
.teacher-stats-footer .grid.three {
  grid-template-columns: none;
}

/* Mobil noch kompakter und untereinander umbrechbar */
@media (max-width: 820px) {
  .teacher-stats-footer {
    margin-top: 12px;
  }

  .teacher-stats-footer .teacher-stats {
    flex-wrap: wrap;
    gap: 5px 0;
    padding: 8px 10px;
  }

  .teacher-stats-footer .kpi {
    padding: 0 8px;
  }

  .teacher-stats-footer .kpi strong {
    font-size: 14px;
  }

  .teacher-stats-footer .kpi .small {
    font-size: 10px;
  }
}

/* =========================================================
   Kompakte Kennzahlen unten mit bisherigen Farbcodes
   ========================================================= */

.teacher-stats-footer .teacher-stats {
  gap: 8px;
  padding: 8px;
  border: 0;
  background: transparent;
}

.teacher-stats-footer .kpi {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  box-shadow: none;
}

/* Schüler – Hellblau */
.teacher-stats-footer .kpi:nth-child(1) {
  background: #f1f5fb !important;
  border-color: #d4dfed;
}

/* Unterrichtseinheiten – Hellgrün */
.teacher-stats-footer .kpi:nth-child(2) {
  background: #e7f0e5 !important;
  border-color: #cdddc9;
}

/* Dateien – Sand / Beige */
.teacher-stats-footer .kpi:nth-child(3) {
  background: #efe5d3 !important;
  border-color: #deceb4;
}

.teacher-stats-footer .kpi strong {
  color: var(--brand-navy);
}

.teacher-stats-footer .kpi .small {
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .teacher-stats-footer .teacher-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .teacher-stats-footer .kpi {
    width: 100%;
    padding: 8px 10px;
  }
}

/* =========================================================
   Unterrichtsbereich: klarere Hierarchie und kompaktere Karten
   ========================================================= */

/* Unterrichtsliste */
.lesson-list-entry {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft) !important;
  border-radius: 12px;
  background: #fffefa !important;
  box-shadow: none !important;
}

.lesson-list-entry .lesson-list-item,
.lesson-list-entry .lesson-list-item.active {
  position: relative;
  width: 100%;
  min-height: 0;
  padding: 13px 15px;
  text-align: left;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.lesson-list-entry .lesson-list-item h3 {
  margin: 0;
  padding-right: 90px;
  color: var(--brand-navy) !important;
  font-size: 15px;
  line-height: 1.3;
}

.lesson-list-entry .lesson-list-item > p.small:first-of-type {
  position: absolute;
  top: 13px;
  right: 15px;
  margin: 0;
  color: var(--text-muted) !important;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}

.lesson-list-entry .lesson-upload-hint {
  margin: 7px 0 0 !important;
  color: var(--text-muted) !important;
  font-size: 11px !important;
  line-height: 1.3;
}

/* Aktive Einheit: ruhige Hervorhebung */
.lesson-list-entry:has(.lesson-list-item.active) {
  border-color: #b7c7df !important;
  background: #f4f7fb !important;
}

.lesson-list-entry:has(.lesson-list-item.active)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--brand-navy);
  z-index: 1;
}

.lesson-list-entry:has(.lesson-list-item.active) .lesson-list-item {
  padding-left: 18px;
}

/* Detailkopf */
.lesson-detail-info {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
  box-shadow: none;
}

.lesson-detail-info .row {
  align-items: flex-start;
  gap: 12px;
}

.lesson-detail-info h2,
.lesson-detail-info h3 {
  margin: 0 0 3px;
  color: var(--brand-navy);
  font-size: 18px;
  line-height: 1.25;
}

.lesson-detail-info p {
  margin: 3px 0 0;
}

/* Unterricht bearbeiten zurückhaltender */
.lesson-detail-info button.secondary,
button[onclick^="showLessonEditForm"] {
  min-height: 38px;
  padding: 8px 14px;
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
}

/* Weniger dominante Trennlinien */
.teacher-main-panel hr,
.lesson-detail-desktop-only {
  margin: 14px 0;
  border-top-color: var(--line-soft);
}

/* Upload- und Materialbereich klar gliedern */
.lesson-upload-details {
  margin-top: 14px;
}

.lesson-upload-details + hr {
  margin-top: 16px;
}

.teacher-main-panel > h3.lesson-detail-desktop-only {
  margin: 0 0 10px;
  color: var(--brand-navy);
  font-size: 18px;
}

/* Materialbereich ohne unnötige zusätzliche Fläche */
.materials {
  gap: 10px;
}

/* Mobil: Titel und Datum untereinander, größere Touch-Fläche */
@media (max-width: 820px) {
  .lesson-list-entry {
    border-radius: 12px;
  }

  .lesson-list-entry .lesson-list-item,
  .lesson-list-entry .lesson-list-item.active {
    min-height: 72px;
    padding: 14px 15px;
  }

  .lesson-list-entry .lesson-list-item h3 {
    padding-right: 0;
    font-size: 16px;
  }

  .lesson-list-entry .lesson-list-item > p.small:first-of-type {
    position: static;
    margin-top: 5px;
    font-size: 12px;
  }

  .lesson-list-entry .lesson-upload-hint {
    margin-top: 8px !important;
    font-size: 12px !important;
  }

  .lesson-list-entry:has(.lesson-list-item.active) .lesson-list-item {
    padding-left: 18px;
  }

  .lesson-detail-info {
    padding: 12px 14px;
  }
}

/* =========================================================
   Kopfbereich, Schülerkopf und Material kompakter
   ========================================================= */

/* ---------------------------------------------------------
   1. Hauptkopf verkleinern
   --------------------------------------------------------- */

.topbar,
.student-sticky-topbar {
  grid-template-columns: minmax(190px, 1fr) auto;
  gap: 8px 18px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border-radius: 15px;
}

.topbar .brand-logo,
.student-sticky-topbar .brand-logo {
  width: min(210px, 100%);
}

.topbar .brand > span,
.student-sticky-topbar .brand > span {
  width: min(210px, 100%);
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.2;
}

.topbar .userbar,
.student-sticky-topbar .userbar {
  gap: 8px;
}

.topbar .userbar button,
.student-sticky-topbar .userbar button {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 13px;
}

/* ---------------------------------------------------------
   2. Schülerkopf dichter zusammenführen
   --------------------------------------------------------- */

.mobile-teacher-student-header.row.space {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px 20px;
}

.mobile-teacher-student-header.row.space > div:first-child {
  min-width: 0;
}

.mobile-teacher-student-header h2 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.2;
}

.mobile-teacher-student-header .student-email,
.mobile-teacher-student-header .student-details {
  margin-top: 2px;
  line-height: 1.45;
}

.mobile-teacher-student-header > .row {
  justify-content: flex-end;
  align-self: start;
  gap: 8px;
}

.student-meta {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 11px;
}

.password-actions {
  margin-top: 7px;
  gap: 8px;
}

/* ---------------------------------------------------------
   3. Unterrichtsdetail und Upload kompakter
   --------------------------------------------------------- */

.lesson-detail-info {
  padding: 12px 14px;
}

.lesson-upload-details {
  margin-top: 10px;
}

.lesson-upload-summary {
  min-height: 56px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.lesson-upload-summary strong {
  font-size: 17px;
}

.lesson-upload-content {
  padding: 14px;
}

/* ---------------------------------------------------------
   4. Materialkarten kompakter
   --------------------------------------------------------- */

.material-card {
  padding: 11px;
}

.material-card::before {
  margin-bottom: 7px;
  padding: 3px 8px;
  font-size: 10px;
}

.material-card header {
  margin-bottom: 8px;
}

.material-card header strong {
  font-size: 15px;
}

.material-card .small {
  line-height: 1.35;
}

.material-card .row {
  margin-top: 8px !important;
  gap: 7px;
}

.material-card .row button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

/* ---------------------------------------------------------
   5. Videovorschau begrenzen
   --------------------------------------------------------- */

.material-card .video-wrap {
  width: 100%;
  max-width: 520px;
  border-radius: 11px;
}

.material-card video {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
}

/* ---------------------------------------------------------
   6. Desktopbreite sinnvoll nutzen
   --------------------------------------------------------- */

@media (min-width: 1100px) {
  .teacher-main-panel {
    padding: 16px;
  }

  .teacher-student-sidebar {
    padding: 14px;
  }
}

/* ---------------------------------------------------------
   7. Mobil
   --------------------------------------------------------- */

@media (max-width: 820px) {
  .topbar,
  .student-sticky-topbar {
    padding: 12px;
    margin-bottom: 10px;
  }

  .topbar .brand-logo,
  .student-sticky-topbar .brand-logo {
    width: min(165px, 48vw);
  }

  .mobile-teacher-student-header.row.space {
    display: block;
  }

  .mobile-teacher-student-header > .row {
    margin-top: 10px;
    justify-content: flex-start;
  }

  .student-meta {
    padding: 10px 11px;
  }

  .material-card video {
    max-height: 230px;
  }

  .material-card .video-wrap {
    max-width: 100%;
  }
}

/* =========================================================
   Abstand zwischen Status / News und Arbeitsbereich reduzieren
   ========================================================= */

.status-panel-details,
.status-card {
  margin-bottom: 8px !important;
}

.status-panel-details + br,
.status-card + br {
  display: none;
}

.status-panel-details + br + .mobile-selected-student-bar,
.status-card + br + .mobile-selected-student-bar,
.status-panel-details + br + .grid.two,
.status-card + br + .grid.two {
  margin-top: 0 !important;
}

.app-shell > .grid.two {
  margin-top: 8px;
}

@media (max-width: 820px) {
  .status-panel-details,
  .status-card {
    margin-bottom: 6px !important;
  }

  .app-shell > .grid.two {
    margin-top: 6px;
  }
}

/* =========================================================
   Desktop: Schülernavigation beim Scrollen erreichbar halten
   ========================================================= */

@media (min-width: 821px) {
  .app-shell > .grid.two {
    align-items: start;
  }

  .teacher-student-sidebar {
    position: sticky;
    top: 14px;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8c4bc transparent;
  }

  .teacher-student-sidebar::-webkit-scrollbar {
    width: 7px;
  }

  .teacher-student-sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .teacher-student-sidebar::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c8c4bc;
  }

  .teacher-student-sidebar::-webkit-scrollbar-thumb:hover {
    background: #aaa59d;
  }

  /* Überschrift und Schüler-anlegen-Button bleiben oben sichtbar */
  .teacher-student-sidebar > .row.space {
    position: sticky;
    top: -14px;
    z-index: 3;
    margin: -14px -14px 12px;
    padding: 14px 14px 10px;
    background: var(--workspace-bg);
    border-bottom: 1px solid var(--line-soft);
  }

  /* Such- und Filterbereich kompakter */
  .teacher-student-sidebar .student-controls {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
  }

  .teacher-student-sidebar .student-controls .field {
    margin-bottom: 0;
  }

  .teacher-student-sidebar .list {
    gap: 8px;
  }
}

/* Auf Mobil ausdrücklich keine Fixierung */
@media (max-width: 820px) {
  .teacher-student-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .teacher-student-sidebar > .row.space {
    position: static;
    margin: 0 0 12px;
    padding: 0;
    border-bottom: 0;
  }
}

/* =========================================================
   Dezente 3-D-Tiefenwirkung
   ========================================================= */

:root {
  --depth-page: #ece7de;
  --depth-surface: #fffdfa;
  --depth-soft: #f7f3ec;

  --shadow-level-1:
    0 1px 2px rgba(39, 31, 22, .05),
    0 8px 22px rgba(39, 31, 22, .06);

  --shadow-level-2:
    0 2px 4px rgba(39, 31, 22, .06),
    0 14px 34px rgba(39, 31, 22, .09);

  --shadow-level-3:
    0 3px 6px rgba(16, 26, 103, .10),
    0 16px 38px rgba(16, 26, 103, .13);
}

/* Hintergrundebene */
body {
  background:
    linear-gradient(
      180deg,
      #f3efe8 0%,
      var(--depth-page) 100%
    );
  background-attachment: fixed;
}

/* Hauptflächen */
.topbar,
.student-sticky-topbar,
.status-panel-details,
.status-card,
.teacher-student-sidebar,
.teacher-main-panel,
.student-shell > .card {
  background: var(--depth-surface);
  border: 1px solid rgba(205, 197, 185, .82);
  box-shadow: var(--shadow-level-2);
}

/* Flachere Unterebenen */
.kpi,
.student-meta,
.lesson-detail-info,
.lesson-upload-details,
.upload-box,
.material-card,
.edit-panel {
  background: var(--depth-soft);
  border-color: rgba(210, 202, 190, .82);
  box-shadow: var(--shadow-level-1);
}

/* Listen bleiben bewusst flacher */
.student-list-item,
.lesson-list-entry {
  box-shadow:
    0 1px 2px rgba(39, 31, 22, .04),
    0 4px 10px rgba(39, 31, 22, .045);
}

/* Aktive Auswahl deutlich angehoben */
.student-list-item.active,
.lesson-list-entry:has(.lesson-list-item.active),
.lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
  box-shadow: var(--shadow-level-3) !important;
  transform: translateY(-1px);
}

/* Primärbuttons leicht plastisch */
button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item) {
  box-shadow:
    0 2px 0 rgba(7, 13, 65, .22),
    0 7px 16px rgba(16, 26, 103, .16) !important;
}

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item):hover {
  transform: translateY(-2px);
  box-shadow:
    0 3px 0 rgba(7, 13, 65, .20),
    0 10px 20px rgba(16, 26, 103, .19) !important;
}

button:not(.secondary):not(.ghost):not(.danger):not(.item):not(.student-list-item):not(.lesson-list-item):active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(7, 13, 65, .20),
    0 4px 10px rgba(16, 26, 103, .13) !important;
}

/* Mobile: Schatten zurücknehmen */
@media (max-width: 820px) {
  .topbar,
  .student-sticky-topbar,
  .status-panel-details,
  .status-card,
  .teacher-student-sidebar,
  .teacher-main-panel,
  .student-shell > .card {
    box-shadow:
      0 1px 2px rgba(39, 31, 22, .04),
      0 7px 18px rgba(39, 31, 22, .06);
  }

  .student-list-item.active,
  .lesson-list-entry:has(.lesson-list-item.active),
  .lesson-list-entry:has(.lesson-inline-upload:not(:empty)) {
    transform: none;
  }
}

/* Bewegung reduzieren, wenn im System gewünscht */
@media (prefers-reduced-motion: reduce) {
  button,
  .student-list-item,
  .lesson-list-entry {
    transition: none !important;
    transform: none !important;
  }
}

/* =========================================================
   Unterricht anlegen: optionale Notizen und Hausaufgabe
   ========================================================= */

.lesson-optional-details {
  margin: 8px 0 14px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
  box-shadow: var(--shadow-level-1);
}

.lesson-optional-details > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 12px 48px 12px 14px;
  cursor: pointer;
  list-style: none;
  color: var(--brand-navy);
}

.lesson-optional-details > summary::-webkit-details-marker {
  display: none;
}

.lesson-optional-details > summary span {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lesson-optional-details > summary strong {
  color: var(--brand-navy);
  font-size: 15px;
  line-height: 1.25;
}

.lesson-optional-details > summary small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.lesson-optional-details > summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #d2cbc0;
  border-radius: 50%;
  background: #fffdfa;
  color: var(--brand-navy);
  font-size: 20px;
  font-weight: 700;
}

.lesson-optional-details[open] > summary {
  border-bottom: 1px solid var(--line-soft);
}

.lesson-optional-details[open] > summary::after {
  content: "−";
}

.lesson-optional-content {
  padding: 14px;
  background: #fffdfa;
}

.lesson-optional-content textarea {
  min-height: 92px;
}

.lesson-optional-content .field:last-child {
  margin-bottom: 0;
}

.lesson-form-actions {
  margin-top: 4px;
}

@media (max-width: 820px) {
  .lesson-optional-details {
    margin-bottom: 12px;
    border-radius: 11px;
  }

  .lesson-optional-details > summary {
    min-height: 50px;
    padding: 11px 44px 11px 12px;
  }

  .lesson-optional-details > summary span {
    display: grid;
    gap: 2px;
  }

  .lesson-optional-details > summary strong {
    font-size: 14px;
  }

  .lesson-optional-details > summary::after {
    right: 12px;
    width: 26px;
    height: 26px;
  }

  .lesson-optional-content {
    padding: 12px;
  }

  .lesson-optional-content textarea {
    min-height: 82px;
  }

  .lesson-form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lesson-form-actions button {
    width: 100%;
  }
}

/* =========================================================
   Unterrichtsdetail: nur noch Bearbeitungsaktion anzeigen
   ========================================================= */

.lesson-detail-actions-only {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 0;
  padding: 8px 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lesson-detail-actions-only button {
  min-height: 38px;
  padding: 8px 14px;
}

@media (max-width: 820px) {
  .lesson-detail-actions-only {
    justify-content: stretch;
    padding: 6px 0 8px;
  }

  .lesson-detail-actions-only button {
    width: 100%;
  }
}

/* =========================================================
   Unterrichtskarte: Uploadhinweis nur mobil anzeigen
   ========================================================= */

/* Desktop: Hinweis ausblenden */
@media (min-width: 821px) {
  .lesson-upload-hint {
    display: none !important;
  }
}

/* Mobil: Hinweis weiterhin sichtbar */
@media (max-width: 820px) {
  .lesson-upload-hint {
    display: block !important;
    margin-top: 8px !important;
    color: var(--text-muted) !important;
    font-size: 12px !important;
    line-height: 1.3;
  }
}

/* =========================================================
   Unterrichtskarte: Uploadhinweis nur mobil anzeigen
   ========================================================= */

/* Desktop: Hinweis ausblenden */
@media (min-width: 821px) {
  .lesson-upload-hint {
    display: none !important;
  }
}

/* Mobil: Hinweis weiterhin sichtbar */
@media (max-width: 820px) {
  .lesson-upload-hint {
    display: block !important;
    margin-top: 8px !important;
    color: var(--text-muted) !important;
    font-size: 12px !important;
    line-height: 1.3;
  }
}

/* =========================================================
   Unterrichtsdetail: flache Aktionsleiste
   Titel und Datum nur links in der Unterrichtsauswahl
   ========================================================= */

/* Rechten Titel-/Datumsblock ausblenden */
#lessonSummary .row.space > div:first-child,
#lessonSummary h3,
#lessonSummary p {
  display: none !important;
}

/* Umgebende Karte bewusst beibehalten, aber stark reduzieren */
#lessonSummary,
.lesson-detail-info,
.lesson-detail-actions-only {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 56px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
  box-shadow:
    0 1px 2px rgba(39, 31, 22, .035),
    0 5px 12px rgba(39, 31, 22, .045);
}

/* Eventuell vorhandene innere Zeile neutralisieren */
#lessonSummary .row.space {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}

/* Bearbeitungsbutton kompakt halten */
#lessonSummary button,
.lesson-detail-actions-only button,
button[onclick^="showLessonEditForm"] {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 15px;
  margin: 0;
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
  box-shadow: none !important;
}

/* Abstand zum folgenden Uploadbereich reduzieren */
#lessonSummary + hr,
.lesson-detail-actions-only + hr {
  display: none;
}

#lessonSummary + .lesson-upload-section,
#lessonSummary + .lesson-upload-details,
.lesson-detail-actions-only + .lesson-upload-section,
.lesson-detail-actions-only + .lesson-upload-details {
  margin-top: 0;
}

/* Mobile: Button über volle Breite, Leiste bleibt kompakt */
@media (max-width: 820px) {
  #lessonSummary,
  .lesson-detail-info,
  .lesson-detail-actions-only {
    min-height: 0;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 11px;
  }

  #lessonSummary button,
  .lesson-detail-actions-only button,
  button[onclick^="showLessonEditForm"] {
    width: 100%;
    min-height: 40px;
  }
}

/* =========================================================
   Unterricht bearbeiten: gleiche Kartenfarbe wie aktive Einheit
   ========================================================= */

#lessonSummary,
.lesson-detail-actions-only {
  background: #f4f7fb !important;
  border-color: #b7c7df !important;
}

#lessonSummary button,
.lesson-detail-actions-only button,
button[onclick^="showLessonEditForm"] {
  background: #fffefa !important;
  color: var(--brand-navy) !important;
  border-color: #c8d3e2 !important;
}

#lessonSummary button:hover,
#lessonSummary button:focus,
.lesson-detail-actions-only button:hover,
.lesson-detail-actions-only button:focus,
button[onclick^="showLessonEditForm"]:hover,
button[onclick^="showLessonEditForm"]:focus {
  background: #edf2f8 !important;
  border-color: #aebed3 !important;
}

/* =========================================================
   Korrektur: Aktionsleiste wie aktive Unterrichtseinheit
   Buttonfarbe bleibt unverändert
   ========================================================= */

/* Breite Karte rechts */
#lessonSummary,
.lesson-detail-actions-only {
  background: #f4f7fb !important;
  border-color: #b7c7df !important;
}

/* Letzte Änderung am Button zurücknehmen */
#lessonSummary button,
.lesson-detail-actions-only button,
button[onclick^="showLessonEditForm"] {
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
}

#lessonSummary button:hover,
#lessonSummary button:focus,
.lesson-detail-actions-only button:hover,
.lesson-detail-actions-only button:focus,
button[onclick^="showLessonEditForm"]:hover,
button[onclick^="showLessonEditForm"]:focus {
  background: var(--button-secondary-hover) !important;
  color: var(--button-primary) !important;
  border-color: #bbb6ad !important;
}

/* =========================================================
   Unterricht bearbeiten ohne umgebende Karte
   ========================================================= */

#lessonSummary,
.lesson-detail-info,
.lesson-detail-actions-only {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 0;
  margin: 0 0 10px;
  padding: 0 0 10px;
  border: 0 !important;
  border-bottom: 1px solid var(--line-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Innere Struktur neutralisieren */
#lessonSummary .row.space {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
}

/* Nur der Button bleibt sichtbar */
#lessonSummary .row.space > div:first-child,
#lessonSummary h3,
#lessonSummary p {
  display: none !important;
}

#lessonSummary button,
.lesson-detail-actions-only button,
button[onclick^="showLessonEditForm"] {
  min-height: 38px;
  margin: 0;
  padding: 8px 15px;
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
  box-shadow: none !important;
}

/* Uploadbereich direkt anschließen */
#lessonSummary + .lesson-upload-details,
.lesson-detail-actions-only + .lesson-upload-details {
  margin-top: 0;
}

@media (max-width: 820px) {
  #lessonSummary,
  .lesson-detail-actions-only {
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  #lessonSummary button,
  .lesson-detail-actions-only button {
    width: 100%;
  }
}

/* =========================================================
   Unterrichtstitel und Bearbeitungsaktion in einer Zeile
   ========================================================= */

#lessonSummary.lesson-detail-actions-only {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  margin: 0 0 10px;
  padding: 4px 0 10px;
  border: 0 !important;
  border-bottom: 1px solid var(--line-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#lessonSummary .lesson-action-title {
  display: block !important;
  min-width: 0;
  margin: 0;
  color: var(--brand-navy);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 750;
  overflow-wrap: anywhere;
}

#lessonSummary.lesson-detail-actions-only > button {
  flex: 0 0 auto;
  min-height: 40px;
  margin: 0;
  padding: 8px 16px;
}

/* Ältere Regeln dürfen die neue Überschrift nicht ausblenden */
#lessonSummary h2.lesson-action-title {
  display: block !important;
}

@media (max-width: 820px) {
  #lessonSummary.lesson-detail-actions-only {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: 10px;
  }

  #lessonSummary .lesson-action-title {
    font-size: 20px;
  }

  #lessonSummary.lesson-detail-actions-only > button {
    width: 100%;
  }
}

/* =========================================================
   Materialkarten: kompakter, klarer, konsistenter
   ========================================================= */

.material-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-left-width: 5px;
  border-radius: 14px;
  background: var(--workspace-bg);
  box-shadow: var(--shadow-level-1);
}

.material-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin: 0;
}

.material-card header > div {
  min-width: 0;
}

.material-card header strong {
  display: block;
  margin: 0 0 3px;
  color: var(--brand-navy);
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.material-card header .small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.material-card header .badge {
  align-self: start;
  min-height: 26px;
  padding: 5px 9px;
  font-size: 11px;
  white-space: nowrap;
}

/* Typkennzeichnung kompakter */
.material-card::before {
  width: fit-content;
  margin: 0;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  letter-spacing: .08em;
  font-weight: 800;
}

/* Vorschauen */
.material-card .video-wrap {
  width: min(100%, 620px);
  margin: 2px 0 0;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
}

.material-card video {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.material-card audio {
  margin-top: 4px;
}

.material-card .pdf-frame {
  width: 100%;
  min-height: 360px;
  max-height: 520px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
}

/* Beschreibung */
.material-card > p.small {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Aktionsbereich */
.material-card .row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px !important;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.material-card .row button {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 13px;
}

/* Sekundäre Aktionen zusammenhalten */
.material-card .row button.secondary,
.material-card .row button.ghost {
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
}

/* Löschen deutlich getrennt */
.material-card .row button.danger,
.material-card .row button[onclick^="deleteMaterial"] {
  margin-left: auto;
}

/* Typfarben subtiler */
.material-card.material-type-video {
  border-left-color: #5b96d4;
  background: #f5f8fc;
}

.material-card.material-type-gpx {
  border-left-color: #58a06b;
  background: #f3f8f2;
}

.material-card.material-type-pdf {
  border-left-color: #c86a62;
  background: #fbf4f2;
}

.material-card.material-type-audio {
  border-left-color: #9d72b8;
  background: #f8f4fa;
}

/* Leerer Materialzustand */
.materials > .small:only-child {
  display: block;
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
  color: var(--text-muted);
  text-align: center;
}

/* Mobil */
@media (max-width: 820px) {
  .material-card {
    padding: 12px;
    border-radius: 12px;
  }

  .material-card header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .material-card header .badge {
    justify-self: start;
  }

  .material-card .video-wrap {
    width: 100%;
  }

  .material-card video {
    max-height: 240px;
  }

  .material-card .pdf-frame {
    min-height: 300px;
  }

  .material-card .row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .material-card .row button {
    width: 100%;
  }

  .material-card .row button.danger,
  .material-card .row button[onclick^="deleteMaterial"] {
    margin-left: 0;
  }
}

/* =========================================================
   Markenfooter und ruhige Leerzustände
   ========================================================= */

/* Alter technischer Footer wird nicht mehr verwendet */
.footer-note {
  display: none;
}

/* Dezenter Abschluss der App */
.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 8px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.app-footer span:last-child {
  color: var(--brand-navy);
  font-weight: 700;
}

/* Leere Inhaltsbereiche nicht mehr als loser Text */
.materials > p.small:only-child,
.teacher-main-panel > p.small:only-child,
.teacher-main-panel .list > p.small:only-child,
.mobile-material-content > p.small:only-child {
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px;
  border: 1px dashed #d4cec3;
  border-radius: 12px;
  background: rgba(247, 244, 238, .72);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
}

/* Unterrichtsplatzhalter etwas kompakter */
.mobile-lesson-placeholder {
  margin: 0;
  padding: 14px;
  border: 1px dashed #d4cec3;
  border-radius: 12px;
  background: rgba(247, 244, 238, .72);
  color: var(--text-muted);
  text-align: center;
}

/* Kein Material: weniger dominante Höhe */
.materials > p.small:only-child {
  min-height: 54px;
  display: grid;
  place-items: center;
}

/* Mobil */
@media (max-width: 820px) {
  .app-footer {
    margin-top: 12px;
    padding: 10px 8px;
    font-size: 10px;
  }

  .materials > p.small:only-child,
  .teacher-main-panel > p.small:only-child,
  .teacher-main-panel .list > p.small:only-child,
  .mobile-material-content > p.small:only-child,
  .mobile-lesson-placeholder {
    padding: 13px;
    border-radius: 11px;
  }
}

/* =========================================================
   Materialüberschrift kompakter und besser zugeordnet
   ========================================================= */

.teacher-main-panel > h3.lesson-detail-desktop-only {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  color: var(--brand-navy);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 750;
}

.teacher-main-panel > h3.lesson-detail-desktop-only::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}

.materials.lesson-detail-desktop-only {
  margin-top: 0;
}

/* Mobil bleibt die Materialüberschrift im Klappmenü */
@media (max-width: 820px) {
  .teacher-main-panel > h3.lesson-detail-desktop-only {
    display: none;
  }
}

/* =========================================================
   Unterrichtskopf als kompakte gemeinsame Karte
   ========================================================= */

#lessonSummary.lesson-detail-actions-only {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft) !important;
  border-radius: 13px !important;
  background: var(--subtle-bg) !important;
  box-shadow: var(--shadow-level-1) !important;
}

/* Unterrichtstitel links */
#lessonSummary .lesson-action-title {
  display: block !important;
  min-width: 0;
  margin: 0;
  color: var(--brand-navy);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 750;
  overflow-wrap: anywhere;
}

/* Bearbeitungsbutton rechts */
#lessonSummary.lesson-detail-actions-only > button {
  flex: 0 0 auto;
  min-height: 40px;
  margin: 0;
  padding: 8px 16px;
  background: var(--button-secondary-bg) !important;
  color: var(--button-secondary-text) !important;
  border-color: var(--button-secondary-border) !important;
  box-shadow: none !important;
}

/* Überflüssige Trennlinien im Unterrichtsdetail entfernen */
#lessonSummary + hr,
.lesson-detail-actions-only + hr,
.lesson-detail-desktop-only {
  border: 0 !important;
}

.teacher-main-panel hr.lesson-detail-desktop-only {
  display: none !important;
}

/* Uploadbereich näher an den Unterrichtskopf rücken */
#lessonSummary + .lesson-upload-details,
.lesson-detail-actions-only + .lesson-upload-details {
  margin-top: 0;
}

/* Materialbereich enger anordnen */
.teacher-main-panel > h3.lesson-detail-desktop-only {
  margin-top: 12px;
  margin-bottom: 8px;
}

.materials.lesson-detail-desktop-only {
  margin-top: 0;
}

/* Mobil */
@media (max-width: 820px) {
  #lessonSummary.lesson-detail-actions-only {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    border-radius: 12px !important;
  }

  #lessonSummary .lesson-action-title {
    font-size: 19px;
  }

  #lessonSummary.lesson-detail-actions-only > button {
    width: 100%;
  }
}

/* =========================================================
   Design-Feinschliff:
   Kopf, Schülerstatus, Material, Auswahl und Kennzahlen
   ========================================================= */

/* ---------------------------------------------------------
   1. Kopfbereich etwas kompakter
   --------------------------------------------------------- */

.topbar,
.student-sticky-topbar {
  padding: 11px 15px;
  margin-bottom: 12px;
  gap: 6px 16px;
}

.topbar .brand-logo,
.student-sticky-topbar .brand-logo {
  width: min(190px, 100%);
}

.topbar .brand > span,
.student-sticky-topbar .brand > span {
  width: min(190px, 100%);
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.2;
}

.topbar .userbar,
.student-sticky-topbar .userbar {
  gap: 7px;
}

.topbar .userbar button,
.student-sticky-topbar .userbar button {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

/* ---------------------------------------------------------
   2. Schülerstatus und Passwortaktionen kompakter
   --------------------------------------------------------- */

.student-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px 14px;
  min-height: 0;
  margin-top: 9px;
  padding: 10px 12px;
}

.student-meta > span {
  flex: 0 0 auto;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.student-meta .password-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.student-meta .password-actions button {
  min-height: 35px;
  padding: 7px 12px;
  font-size: 12px;
}

/* ---------------------------------------------------------
   3. Materialkopf mit Dateianzahl
   --------------------------------------------------------- */

.material-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.material-section-heading h3 {
  margin: 0;
  color: var(--brand-navy);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 750;
}

.material-section-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #d7d1c7;
  border-radius: 999px;
  background: var(--subtle-bg);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

/* Alte Materialüberschrift-Regeln neutralisieren */
.teacher-main-panel > h3.lesson-detail-desktop-only {
  display: none !important;
}

/* ---------------------------------------------------------
   4. Aktive Schülerkarte weniger dominant
   --------------------------------------------------------- */

.student-list-item,
button.student-list-item,
.item.student-list-item {
  position: relative;
  overflow: hidden;
  box-shadow: none !important;
}

.student-list-item.active {
  transform: none !important;
  background: #f2f5fa !important;
  border-color: #c3cfe0 !important;
  box-shadow:
    0 1px 2px rgba(39, 31, 22, .035),
    0 5px 12px rgba(39, 31, 22, .045) !important;
}

.student-list-item.active::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand-navy);
}

.student-list-item.active h3,
.student-list-item.active p,
.student-list-item.active .badge {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------
   5. Kennzahlen am Seitenende weiter zurücknehmen
   --------------------------------------------------------- */

.teacher-stats-footer {
  margin-top: 12px;
}

.teacher-stats-footer .teacher-stats {
  gap: 6px;
  padding: 0;
}

.teacher-stats-footer .kpi {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 9px;
}

.teacher-stats-footer .kpi strong {
  font-size: 13px;
}

.teacher-stats-footer .kpi .small {
  font-size: 10px;
}

.app-footer {
  margin-top: 10px;
}

/* ---------------------------------------------------------
   Mobile Anpassungen
   --------------------------------------------------------- */

@media (max-width: 820px) {
  .topbar,
  .student-sticky-topbar {
    padding: 10px;
    margin-bottom: 9px;
  }

  .topbar .brand-logo,
  .student-sticky-topbar .brand-logo {
    width: min(155px, 46vw);
  }

  .student-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .student-meta .password-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .student-meta .password-actions button {
    width: 100%;
  }

  .material-section-heading {
    display: none;
  }

  .student-list-item.active::before {
    width: 4px;
  }

  .teacher-stats-footer .teacher-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .teacher-stats-footer .kpi {
    min-height: 30px;
    padding: 6px 9px;
  }
}

/* =========================================================
   Schülerkopf: Status-Badge und kompaktes Zugangsmenü
   ========================================================= */

/* Bisherige große Statusfläche neutralisieren */
.student-access-row {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Name und Status in einer Zeile */
.student-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 5px;
}

.student-title-row h2 {
  margin: 0;
}

.student-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 750;
}

.student-status-badge.is-active {
  color: #173f78;
  background: #e4edf8;
  border-color: #bed0e5;
}

.student-status-badge.is-inactive {
  color: #922525;
  background: #f8e1df;
  border-color: #dfb1ac;
}

/* Klappmenü */
.student-access-details {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--subtle-bg);
  box-shadow:
    0 1px 2px rgba(39, 31, 22, .03),
    0 4px 10px rgba(39, 31, 22, .04);
}

.student-access-details > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 9px 46px 9px 13px;
  cursor: pointer;
  list-style: none;
}

.student-access-details > summary::-webkit-details-marker {
  display: none;
}

.student-access-details > summary span {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.student-access-details > summary strong {
  color: var(--brand-navy);
  font-size: 13px;
  line-height: 1.2;
}

.student-access-details > summary small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
}

.student-access-details > summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid #d2cbc0;
  border-radius: 50%;
  background: #fffdfa;
  color: var(--brand-navy);
  font-size: 18px;
  font-weight: 750;
}

.student-access-details[open] > summary {
  border-bottom: 1px solid var(--line-soft);
}

.student-access-details[open] > summary::after {
  content: "−";
}

.student-access-content {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: #fffdfa;
}

.student-access-content button {
  min-height: 35px;
  padding: 7px 12px;
  font-size: 12px;
}

/* Alten großflächigen Metabereich aus früheren Regeln ausblenden */
.student-meta {
  min-height: 0;
}

/* Mobil */
@media (max-width: 820px) {
  .student-title-row {
    gap: 7px;
  }

  .student-status-badge {
    min-height: 22px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .student-access-details > summary {
    min-height: 44px;
    padding: 9px 44px 9px 12px;
  }

  .student-access-details > summary span {
    display: grid;
    gap: 2px;
  }

  .student-access-content {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .student-access-content button {
    width: 100%;
    min-height: 40px;
  }
}

/* =========================================================
   PDF-Material ohne eingebetteten Browser-Viewer
   ========================================================= */

.pdf-frame {
  display: none !important;
}

.pdf-download-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px dashed #dfbbb6;
  border-radius: 10px;
  background: rgba(255, 253, 250, .72);
}

.pdf-download-hint strong {
  flex: 0 0 auto;
  color: #9b3e38;
  font-size: 13px;
}

.pdf-download-hint span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 820px) {
  .pdf-download-hint {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
  }
}

/* =========================================================
   PDF als erkennbare kompakte Dokumentkarte
   ========================================================= */

.pdf-download-hint {
  display: none !important;
}

.pdf-document-preview {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid #e2c2bd;
  border-radius: 11px;
  background: rgba(255, 253, 250, .82);
}

.pdf-document-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 92px;
  border: 1px solid #d9aaa4;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 14px, #f3d8d4 14px 100%),
    #fff;
  box-shadow:
    0 1px 2px rgba(70, 30, 26, .06),
    0 5px 12px rgba(70, 30, 26, .07);
}

.pdf-document-icon::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-left: 1px solid #d9aaa4;
  border-bottom: 1px solid #d9aaa4;
  background: #f6e5e2;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.pdf-document-icon span {
  color: #a33a3a;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .06em;
}

.pdf-document-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.pdf-document-info strong {
  color: var(--brand-navy);
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pdf-document-info span {
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.4;
}

.pdf-document-info small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 820px) {
  .pdf-document-preview {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    min-height: 92px;
    padding: 12px;
  }

  .pdf-document-icon {
    width: 54px;
    height: 70px;
  }

  .pdf-document-icon span {
    font-size: 13px;
  }

  .pdf-document-info strong {
    font-size: 14px;
  }
}

/* =========================================================
   Echte PDF-Miniatur der ersten Seite
   ========================================================= */

.pdf-document-preview,
.pdf-download-hint,
.pdf-frame {
  display: none !important;
}

.pdf-real-preview {
  display: grid;
  grid-template-columns: minmax(190px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid #e2c2bd;
  border-radius: 11px;
  background: rgba(255, 253, 250, .84);
}

.pdf-page-thumbnail {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  max-height: 310px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid #d8d3cb;
  border-radius: 9px;
  background: #e9e8e5;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .55),
    0 5px 14px rgba(44, 35, 28, .08);
}

.pdf-page-canvas {
  display: none;
  max-width: 100%;
  max-height: 288px;
  border: 1px solid #cbc7c0;
  background: #fff;
  box-shadow: 0 4px 12px rgba(30, 25, 20, .12);
}

.pdf-page-thumbnail.pdf-preview-ready .pdf-page-canvas {
  display: block;
}

.pdf-preview-loading {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.pdf-preview-ready .pdf-preview-loading,
.pdf-preview-ready .pdf-preview-fallback {
  display: none;
}

.pdf-preview-fallback {
  display: none;
  max-width: 240px;
  color: #8d3b36;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.pdf-preview-error .pdf-preview-loading {
  display: none;
}

.pdf-preview-error .pdf-preview-fallback {
  display: block;
}

.pdf-preview-caption {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.pdf-preview-caption strong {
  color: var(--brand-navy);
  font-size: 15px;
  line-height: 1.25;
}

.pdf-preview-caption span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Mobil */
@media (max-width: 820px) {
  .pdf-real-preview {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 11px;
  }

  .pdf-page-thumbnail {
    min-height: 150px;
    max-height: 250px;
  }

  .pdf-page-canvas {
    max-height: 228px;
  }

  .pdf-preview-caption {
    gap: 3px;
  }
}

/* =========================================================
   PDF: kleine echte Vorschau und große Bildschirmansicht
   ========================================================= */

/* Frühere PDF-Ersatzdarstellungen ausblenden */
.pdf-document-preview,
.pdf-download-hint,
.pdf-frame {
  display: none !important;
}

/* ---------------------------------------------------------
   Kleine PDF-Vorschau innerhalb der Materialkarte
   --------------------------------------------------------- */

.pdf-thumbnail-button {
  display: grid !important;
  width: 100%;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #dfbbb6 !important;
  border-radius: 11px !important;
  background: #eceae6 !important;
  color: var(--brand-navy) !important;
  box-shadow:
    0 1px 2px rgba(50, 38, 31, .05),
    0 7px 18px rgba(50, 38, 31, .07) !important;
  text-align: left;
  cursor: zoom-in;
}

.pdf-thumbnail-button:hover,
.pdf-thumbnail-button:focus-visible {
  transform: translateY(-1px);
  border-color: #c98f88 !important;
  box-shadow:
    0 2px 4px rgba(50, 38, 31, .06),
    0 10px 24px rgba(50, 38, 31, .10) !important;
}

.pdf-thumbnail-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 230px;
  overflow: hidden;
  background: #ddd9d2;
}

.pdf-thumbnail-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  pointer-events: none;
}

.pdf-thumbnail-overlay {
  position: absolute;
  inset: auto 10px 10px auto;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 999px;
  background: rgba(16, 26, 103, .88);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 26, 103, .18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.pdf-thumbnail-overlay strong {
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.pdf-thumbnail-button:hover .pdf-thumbnail-overlay,
.pdf-thumbnail-button:focus-visible .pdf-thumbnail-overlay {
  opacity: 1;
  transform: translateY(0);
}

.pdf-thumbnail-caption {
  display: block;
  padding: 8px 11px;
  border-top: 1px solid #ded8cf;
  background: #fffdfa;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}

/* ---------------------------------------------------------
   Große PDF-Vorschau als Modal
   --------------------------------------------------------- */

body.pdf-preview-open {
  overflow: hidden;
}

.pdf-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(20, 22, 31, .74);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .16s ease;
}

.pdf-preview-overlay.is-visible {
  opacity: 1;
}

.pdf-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1100px, 96vw);
  height: min(900px, 94vh);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 16px;
  background: #f5f2ec;
  box-shadow:
    0 8px 24px rgba(0,0,0,.20),
    0 30px 80px rgba(0,0,0,.30);
}

.pdf-preview-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 12px 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #fffdfa;
}

.pdf-preview-dialog-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--brand-navy);
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-preview-close {
  flex: 0 0 auto;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 23px !important;
  line-height: 1 !important;
}

.pdf-preview-dialog-content {
  min-height: 0;
  padding: 12px;
  background: #d9d7d2;
}

.pdf-preview-dialog-content iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 9px;
  background: #fff;
}

/* ---------------------------------------------------------
   Mobil
   --------------------------------------------------------- */

@media (max-width: 820px) {
  .pdf-thumbnail-frame {
    height: 190px;
  }

  .pdf-thumbnail-overlay {
    opacity: 1;
    transform: none;
  }

  .pdf-preview-overlay {
    padding: 8px;
  }

  .pdf-preview-dialog {
    width: 100%;
    height: 96vh;
    border-radius: 12px;
  }

  .pdf-preview-dialog-header {
    min-height: 52px;
    padding: 8px 9px 8px 13px;
  }

  .pdf-preview-dialog-header strong {
    font-size: 14px;
  }

  .pdf-preview-dialog-content {
    padding: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pdf-preview-overlay,
  .pdf-thumbnail-overlay {
    transition: none;
  }
}

/* PDF-Vorschau kompakter und proportional */
.pdf-real-preview {
  grid-template-columns: 150px minmax(0, 1fr) !important;
  min-height: 0 !important;
  padding: 12px !important;
}

.pdf-page-thumbnail {
  width: 150px !important;
  min-height: 0 !important;
  max-height: 210px !important;
  padding: 7px !important;
}

.pdf-page-canvas {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 195px !important;
  object-fit: contain;
}

@media (max-width: 820px) {
  .pdf-real-preview {
    grid-template-columns: 110px minmax(0, 1fr) !important;
  }

  .pdf-page-thumbnail {
    width: 110px !important;
    max-height: 160px !important;
  }

  .pdf-page-canvas {
    max-height: 145px !important;
  }
}

/* PDF-Vorschau kompakter und proportional */
.pdf-real-preview {
  grid-template-columns: 150px minmax(0, 1fr) !important;
  min-height: 0 !important;
  padding: 12px !important;
}

.pdf-page-thumbnail {
  width: 150px !important;
  min-height: 0 !important;
  max-height: 210px !important;
  padding: 7px !important;
}

.pdf-page-canvas {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 195px !important;
  object-fit: contain;
}

@media (max-width: 820px) {
  .pdf-real-preview {
    grid-template-columns: 110px minmax(0, 1fr) !important;
  }

  .pdf-page-thumbnail {
    width: 110px !important;
    max-height: 160px !important;
  }

  .pdf-page-canvas {
    max-height: 145px !important;
  }
}

/* Unterrichtsbereich klarer vom Schülerkopf trennen */
.student-access-row {
  margin-bottom: 22px !important;
}

.teacher-content,
.teacher-workspace,
.lesson-workspace {
  gap: 22px !important;
}

.teacher-main-panel {
  padding-top: 4px;
}

#lessonSummary.lesson-detail-actions-only {
  margin-bottom: 18px !important;
}

@media (max-width: 820px) {
  .student-access-row {
    margin-bottom: 16px !important;
  }
}

/* =========================================================
   Design-Feinschliff: Bereiche, Unterricht und Material
   ========================================================= */

/* Schülerkopf klar vom Unterrichtsbereich trennen */
.student-access-row {
  margin-bottom: 24px !important;
}

.student-access-details {
  border-color: #d8d1c6 !important;
  box-shadow: 0 3px 10px rgba(39, 31, 22, .045) !important;
}

/* Unterrichtsarbeitsbereich */
.teacher-main-panel {
  min-width: 0;
  padding: 20px !important;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--workspace-bg);
  box-shadow: 0 5px 18px rgba(39, 31, 22, .055);
}

/* Unterrichtskopf ruhiger und klarer */
#lessonSummary.lesson-detail-actions-only {
  margin: 0 0 20px !important;
  padding: 16px 18px !important;
  border-color: #d9d2c7 !important;
  background: var(--subtle-bg) !important;
  box-shadow: 0 2px 8px rgba(39, 31, 22, .045) !important;
}

/* Uploadbereich absetzen */
.lesson-upload-details {
  margin-bottom: 20px !important;
  border: 1px solid #ddd6cc !important;
  border-radius: 13px !important;
  background: #fffdfa !important;
  box-shadow: 0 2px 8px rgba(39, 31, 22, .035);
}

/* Aktive Unterrichtseinheit klarer markieren */
.lesson-list-item,
button.lesson-list-item {
  border: 1px solid var(--line-soft) !important;
  border-radius: 12px !important;
  background: #fffdfa !important;
  box-shadow: none !important;
}

.lesson-list-item.active,
button.lesson-list-item.active {
  border-color: #aebddd !important;
  background: #f1f4fa !important;
  box-shadow: 0 4px 12px rgba(16, 26, 103, .08) !important;
}

/* Materialbereich */
.materials {
  display: grid;
  gap: 14px;
}

.material-card {
  padding: 16px !important;
  border-radius: 14px !important;
  box-shadow: 0 3px 10px rgba(39, 31, 22, .045) !important;
}

.material-card > header {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.material-card > header strong {
  display: block;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.material-card .small {
  display: block;
  margin-top: 5px;
  line-height: 1.4;
}

/* Aktionszeile gleichmäßiger */
.material-card > .row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.material-card > .row .danger {
  margin-left: auto;
}

/* PDF-Vorschau kompakt */
.pdf-real-preview {
  grid-template-columns: 145px minmax(0, 1fr) !important;
  gap: 16px !important;
  min-height: 0 !important;
  padding: 12px !important;
}

.pdf-page-thumbnail {
  width: 145px !important;
  min-height: 0 !important;
  max-height: 205px !important;
  padding: 7px !important;
}

.pdf-page-canvas {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 190px !important;
}

/* Mobil */
@media (max-width: 820px) {
  .student-access-row {
    margin-bottom: 16px !important;
  }

  .teacher-main-panel {
    padding: 12px !important;
    border-radius: 13px;
  }

  #lessonSummary.lesson-detail-actions-only {
    margin-bottom: 14px !important;
    padding: 13px !important;
  }

  .material-card {
    padding: 12px !important;
  }

  .material-card > .row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .material-card > .row button,
  .material-card > .row .danger {
    width: 100%;
    margin-left: 0;
  }

  .pdf-real-preview {
    grid-template-columns: 100px minmax(0, 1fr) !important;
    gap: 11px !important;
  }

  .pdf-page-thumbnail {
    width: 100px !important;
    max-height: 145px !important;
  }

  .pdf-page-canvas {
    max-height: 132px !important;
  }
}

/* =========================================================
   Unterrichtsliste und Detailbereich klar trennen
   ========================================================= */

.teacher-workspace,
.lesson-workspace,
.teacher-content {
  align-items: start;
  column-gap: 24px !important;
}

/* Linke Unterrichtsspalte */
.lesson-sidebar,
.teacher-lessons-panel {
  min-width: 0;
  padding: 16px !important;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--subtle-bg);
  box-shadow: 0 2px 8px rgba(39, 31, 22, .035);
}

.lesson-sidebar h2,
.teacher-lessons-panel h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

/* Suchfeld kompakter */
.lesson-sidebar input[type="search"],
.teacher-lessons-panel input[type="search"] {
  width: 100%;
  min-height: 42px;
  margin-bottom: 14px;
  border-radius: 10px;
}

/* Rechte Detailspalte */
.teacher-main-panel {
  min-width: 0;
  background: #fffdfa !important;
}

/* Sichtbare Trennung am Detailbereich */
.teacher-main-panel::before {
  content: "";
  display: block;
  height: 3px;
  margin: -20px -20px 18px;
  border-radius: 16px 16px 0 0;
  background: var(--brand-navy);
  opacity: .12;
}

/* Unterrichtskarten untereinander ruhiger */
.lesson-list {
  display: grid;
  gap: 9px;
}

.lesson-list-item {
  width: 100%;
  padding: 13px 14px !important;
  text-align: left;
}

.lesson-list-item h3 {
  margin: 0 0 5px;
  font-size: 14px;
  line-height: 1.3;
}

.lesson-list-item .small,
.lesson-list-item small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Aktive Einheit mit linker Markierung */
.lesson-list-item.active {
  position: relative;
  overflow: hidden;
}

.lesson-list-item.active::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand-navy);
}

/* Mobil wieder einspaltig */
@media (max-width: 820px) {
  .teacher-workspace,
  .lesson-workspace,
  .teacher-content {
    display: block !important;
  }

  .lesson-sidebar,
  .teacher-lessons-panel {
    margin-bottom: 14px;
    padding: 12px !important;
  }

  .teacher-main-panel::before {
    margin: -12px -12px 14px;
    border-radius: 13px 13px 0 0;
  }
}

/* =========================================================
   Mobile Feinschliff
   ========================================================= */

@media (max-width: 820px) {
  .topbar,
  .student-sticky-topbar {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .topbar .userbar,
  .student-sticky-topbar .userbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .student-title-row h2 {
    font-size: 22px;
    line-height: 1.2;
  }

  .student-access-details,
  .lesson-upload-details,
  .mobile-material-details {
    border-radius: 12px !important;
  }

  .student-access-details > summary,
  .lesson-upload-details > summary,
  .mobile-material-details > summary {
    min-height: 48px;
    padding: 10px 46px 10px 12px;
  }

  .lesson-sidebar,
  .teacher-lessons-panel {
    margin-bottom: 16px;
  }

  .lesson-list {
    gap: 8px;
  }

  .lesson-list-item,
  button.lesson-list-item {
    padding: 12px 13px !important;
  }

  .teacher-main-panel {
    margin-top: 0;
  }

  #lessonSummary .lesson-action-title {
    font-size: 18px;
  }

  .pdf-real-preview {
    grid-template-columns: 1fr !important;
  }

  .pdf-page-thumbnail {
    width: 100% !important;
    max-width: 180px;
    margin: 0 auto;
  }

  .pdf-preview-caption {
    text-align: center;
  }

  .material-card > header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .material-card > header .badge {
    align-self: start;
  }
}

@media (max-width: 480px) {
  .topbar .userbar button,
  .student-sticky-topbar .userbar button {
    flex: 1 1 auto;
  }

  .student-title-row {
    align-items: flex-start;
  }

  .teacher-main-panel {
    padding: 10px !important;
  }

  .material-card {
    padding: 11px !important;
  }

  .material-card > header {
    grid-template-columns: 1fr;
  }

  .material-card > header .badge {
    justify-self: start;
  }
}

/* =========================================================
   Schülerkarten wieder kompakt darstellen
   ========================================================= */

.student-list-item,
button.student-list-item,
.item.student-list-item {
  display: block !important;
  width: 100%;
  min-height: 0 !important;
  padding: 14px 16px !important;
  border-radius: 12px !important;
  text-align: left !important;
}

.student-list-item h3 {
  margin: 0 0 5px !important;
  font-size: 15px !important;
  line-height: 1.25 !important;
}

.student-list-item p,
.student-list-item .small {
  margin: 0 0 7px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.student-list-item .badge,
.student-list-item .student-status-badge {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 23px !important;
  padding: 4px 9px !important;
  font-size: 10px !important;
}

.student-list-item.active,
button.student-list-item.active {
  border-width: 1px !important;
  outline: none !important;
}

@media (max-width: 820px) {
  .student-list-item,
  button.student-list-item {
    padding: 12px 13px !important;
  }

  .student-list-item h3 {
    font-size: 14px !important;
  }
}

/* =========================================================
   Schülerbereich: bessere Lesebreite und kompaktere Karten
   ========================================================= */

/* Hauptinhalt auf angenehme Desktopbreite begrenzen */
.student-page,
.student-view,
.student-main,
.student-content {
  width: min(1180px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

/* Unterrichtsblock klarer gliedern */
.student-lesson,
.student-lesson-card,
.lesson-student-card {
  padding: 18px !important;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: var(--workspace-bg);
  box-shadow: 0 4px 14px rgba(39, 31, 22, .045);
}

.student-lesson > h2,
.student-lesson-card > h2,
.lesson-student-card > h2 {
  margin-bottom: 5px;
}

.student-lesson > .small,
.student-lesson-card > .small,
.lesson-student-card > .small {
  margin-bottom: 14px;
}

/* Materialkarten weniger gestreckt */
.student-page .material-card,
.student-view .material-card,
.student-main .material-card,
.student-content .material-card {
  max-width: 100%;
  padding: 15px !important;
}

/* PDF-Inhalt kompakter */
.student-page .pdf-real-preview,
.student-view .pdf-real-preview,
.student-main .pdf-real-preview,
.student-content .pdf-real-preview {
  grid-template-columns: 130px minmax(0, 360px) !important;
  justify-content: start;
  gap: 15px !important;
  padding: 11px !important;
}

.student-page .pdf-page-thumbnail,
.student-view .pdf-page-thumbnail,
.student-main .pdf-page-thumbnail,
.student-content .pdf-page-thumbnail {
  width: 130px !important;
  max-height: 185px !important;
}

.student-page .pdf-page-canvas,
.student-view .pdf-page-canvas,
.student-main .pdf-page-canvas,
.student-content .pdf-page-canvas {
  max-height: 172px !important;
}

/* Video nicht unnötig über volle Kartenbreite ziehen */
.student-page .video-wrap,
.student-view .video-wrap,
.student-main .video-wrap,
.student-content .video-wrap {
  width: min(720px, 100%);
}

.student-page .video-wrap video,
.student-view .video-wrap video,
.student-main .video-wrap video,
.student-content .video-wrap video {
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  background: #000;
}

/* Downloadzeile kompakter */
.student-page .material-card > .row,
.student-view .material-card > .row,
.student-main .material-card > .row,
.student-content .material-card > .row {
  justify-content: flex-start;
}

/* Mobil wieder volle Breite */
@media (max-width: 820px) {
  .student-page,
  .student-view,
  .student-main,
  .student-content {
    width: calc(100% - 20px);
  }

  .student-lesson,
  .student-lesson-card,
  .lesson-student-card {
    padding: 12px !important;
  }

  .student-page .pdf-real-preview,
  .student-view .pdf-real-preview,
  .student-main .pdf-real-preview,
  .student-content .pdf-real-preview {
    grid-template-columns: 1fr !important;
  }

  .student-page .pdf-page-thumbnail,
  .student-view .pdf-page-thumbnail,
  .student-main .pdf-page-thumbnail,
  .student-content .pdf-page-thumbnail {
    width: 100% !important;
    max-width: 170px;
    margin: 0 auto;
  }
}

/* =========================================================
   Schülerbereich: Unterrichtskopf und Materialhierarchie
   ========================================================= */

.student-view .lesson-header,
.student-page .lesson-header,
.student-main .lesson-header,
.student-content .lesson-header {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--subtle-bg);
}

.student-view .lesson-header h2,
.student-page .lesson-header h2,
.student-main .lesson-header h2,
.student-content .lesson-header h2 {
  margin: 0 0 5px;
  color: var(--brand-navy);
  font-size: 21px;
  line-height: 1.25;
}

.student-view .lesson-header .small,
.student-page .lesson-header .small,
.student-main .lesson-header .small,
.student-content .lesson-header .small {
  margin: 0;
  color: var(--text-muted);
}

/* Abstand zwischen Unterricht und Materialien */
.student-view .materials,
.student-page .materials,
.student-main .materials,
.student-content .materials {
  gap: 12px !important;
}

/* Materialkarten etwas flacher */
.student-view .material-card,
.student-page .material-card,
.student-main .material-card,
.student-content .material-card {
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(39, 31, 22, .04) !important;
}

/* Überschrift und Status sauber ausrichten */
.student-view .material-card > header,
.student-page .material-card > header,
.student-main .material-card > header,
.student-content .material-card > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

/* Downloadbereich weniger dominant */
.student-view .material-card > .row,
.student-page .material-card > .row,
.student-main .material-card > .row,
.student-content .material-card > .row {
  margin-top: 10px !important;
  padding-top: 10px;
}

@media (max-width: 820px) {
  .student-view .lesson-header,
  .student-page .lesson-header,
  .student-main .lesson-header,
  .student-content .lesson-header {
    padding: 12px;
  }

  .student-view .lesson-header h2,
  .student-page .lesson-header h2,
  .student-main .lesson-header h2,
  .student-content .lesson-header h2 {
    font-size: 18px;
  }
}

/* =========================================================
   Schülerbereich: Suche und Unterrichtsübersicht kompakter
   ========================================================= */

.student-page .panel,
.student-view .panel,
.student-main .panel,
.student-content .panel {
  border-radius: 14px;
}

/* Suchbereich flacher */
.student-page .search-panel,
.student-view .search-panel,
.student-main .search-panel,
.student-content .search-panel {
  padding: 16px !important;
}

.student-page .search-panel h2,
.student-view .search-panel h2,
.student-main .search-panel h2,
.student-content .search-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
}

.student-page input[type="search"],
.student-view input[type="search"],
.student-main input[type="search"],
.student-content input[type="search"] {
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
}

/* Unterrichtstitel und Datum enger zusammenführen */
.student-page .lesson-title,
.student-view .lesson-title,
.student-main .lesson-title,
.student-content .lesson-title {
  margin-bottom: 3px !important;
}

.student-page .lesson-date,
.student-view .lesson-date,
.student-main .lesson-date,
.student-content .lesson-date {
  margin-bottom: 12px !important;
  color: var(--text-muted);
  font-size: 12px;
}

/* Abstand zwischen Unterrichtsblöcken */
.student-page .lesson-block,
.student-view .lesson-block,
.student-main .lesson-block,
.student-content .lesson-block {
  margin-bottom: 18px;
}

/* Letzter Block ohne unnötigen Abstand */
.student-page .lesson-block:last-child,
.student-view .lesson-block:last-child,
.student-main .lesson-block:last-child,
.student-content .lesson-block:last-child {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .student-page .search-panel,
  .student-view .search-panel,
  .student-main .search-panel,
  .student-content .search-panel {
    padding: 12px !important;
  }

  .student-page .search-panel h2,
  .student-view .search-panel h2,
  .student-main .search-panel h2,
  .student-content .search-panel h2 {
    font-size: 18px;
  }
}

/* Schüleransprache im Kopf */
.student-area-group {
  display: grid !important;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: start;
  column-gap: 7px;
  row-gap: 2px;
  min-height: 0 !important;
  padding: 10px 18px !important;
  border-radius: 999px;
}

.student-area-group span:first-child {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-muted);
}

.student-area-group strong {
  font-size: 17px;
  font-weight: 800;
  color: var(--brand-navy);
}

.student-area-group span:last-child {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: .01em;
}

@media (max-width: 820px) {
  .student-area-group {
    padding: 9px 15px !important;
  }

  .student-area-group strong {
    font-size: 16px;
  }
}

/* Schüleransprache einzeilig */
.student-area-group {
  display: flex !important;
  align-items: center;
  gap: 7px;
  padding: 10px 18px !important;
  border-radius: 999px;
  white-space: nowrap;
}

.student-area-group span,
.student-area-group strong {
  font-size: 17px !important;
  line-height: 1.2;
  font-weight: 700 !important;
  color: var(--brand-navy) !important;
}

.student-area-group span:last-child::before {
  content: "· ";
}

@media (max-width: 820px) {
  .student-area-group {
    gap: 5px;
    padding: 9px 14px !important;
  }

  .student-area-group span,
  .student-area-group strong {
    font-size: 15px !important;
  }
}

/* Schüleransprache: saubere einzeilige Abstände */
.student-area-group {
  gap: 0 !important;
}

.student-area-group span:first-child::after {
  content: "\00a0";
}

.student-area-group strong::after {
  content: "\00a0·\00a0";
}

.student-area-group span:last-child::before {
  content: none !important;
}

/* =========================================================
   Schülerbereich: finaler visueller Feinschliff
   ========================================================= */

/* Unterrichtsblöcke kompakter */
.student-shell .card {
  border-color: #ded8cf;
}

.student-shell .lesson-card,
.student-shell .student-lesson,
.student-shell .lesson-block {
  padding: 16px !important;
  border-radius: 14px !important;
}

/* Titel und Datum enger zusammenführen */
.student-shell .lesson-card h2,
.student-shell .student-lesson h2,
.student-shell .lesson-block h2 {
  margin: 0 0 5px !important;
  font-size: 21px;
  line-height: 1.25;
}

.student-shell .lesson-card > .small,
.student-shell .student-lesson > .small,
.student-shell .lesson-block > .small {
  margin: 0 0 12px !important;
}

/* Materialkarten nicht unnötig überdehnen */
.student-shell .material-card {
  padding: 14px !important;
}

.student-shell .material-card > header {
  margin-bottom: 10px;
}

.student-shell .material-card > header strong {
  font-size: 15px;
}

/* PDF-Vorschau kompakter und besser ausbalanciert */
.student-shell .pdf-real-preview {
  grid-template-columns: 125px minmax(0, 300px) !important;
  min-height: 0 !important;
  justify-content: start;
  gap: 16px !important;
  padding: 10px !important;
}

.student-shell .pdf-page-thumbnail {
  width: 125px !important;
  max-height: 178px !important;
}

.student-shell .pdf-page-canvas {
  max-height: 165px !important;
}

/* Video auf sinnvolle Breite begrenzen */
.student-shell .video-wrap {
  width: min(680px, 100%) !important;
}

.student-shell .video-wrap video {
  max-height: 390px;
}

/* Leere Unterrichtseinheiten ruhiger darstellen */
.student-shell .materials > p.small,
.student-shell .empty-state,
.student-shell .empty {
  min-height: 54px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  border: 1px dashed #d8d1c7;
  border-radius: 10px;
  background: #faf8f4;
  color: var(--text-muted);
  text-align: center;
}

/* Passwortbereich weniger dominant */
.student-shell details {
  border-radius: 12px;
}

.student-shell details > summary {
  min-height: 44px;
  font-size: 13px;
}

/* Footer näher an den Inhalt */
.student-shell .app-footer {
  margin-top: 14px;
  padding-top: 6px;
}

/* Mobil */
@media (max-width: 820px) {
  .student-shell .lesson-card,
  .student-shell .student-lesson,
  .student-shell .lesson-block {
    padding: 12px !important;
  }

  .student-shell .lesson-card h2,
  .student-shell .student-lesson h2,
  .student-shell .lesson-block h2 {
    font-size: 18px;
  }

  .student-shell .pdf-real-preview {
    grid-template-columns: 1fr !important;
  }

  .student-shell .pdf-page-thumbnail {
    width: 100% !important;
    max-width: 165px;
    margin: 0 auto;
  }

  .student-shell .pdf-preview-caption {
    text-align: center;
  }
}

/* =========================================================
   Schülerkopf: Überlagerung verhindern
   ========================================================= */

.student-shell .student-sticky-topbar {
  position: relative !important;
  top: auto !important;
  z-index: auto !important;
  margin-bottom: 16px !important;
}

/* Materialvorschauen nicht unnötig breit darstellen */
.student-shell .pdf-real-preview {
  width: fit-content;
  max-width: 560px;
}

.student-shell .video-wrap {
  width: min(560px, 100%) !important;
}

.student-shell .material-card {
  overflow: hidden;
}

/* Nur mobil bleibt der Kopf optional angeheftet */
@media (max-width: 820px) {
  .student-shell .student-sticky-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    margin-bottom: 12px !important;
  }
}

/* =========================================================
   Schülerbereich: kompaktere Abschlussbereiche
   ========================================================= */

/* Passwortbereich deutlich flacher */
.student-shell details.password-details,
.student-shell .password-details,
.student-shell details:last-of-type {
  margin-top: 14px;
  border-radius: 12px !important;
  overflow: hidden;
}

.student-shell details.password-details > summary,
.student-shell .password-details > summary,
.student-shell details:last-of-type > summary {
  min-height: 42px !important;
  padding: 9px 14px !important;
  font-size: 13px !important;
  line-height: 1.2;
}

.student-shell details.password-details:not([open]),
.student-shell .password-details:not([open]),
.student-shell details:last-of-type:not([open]) {
  min-height: 0 !important;
}

/* Materialkarten weniger leer wirken lassen */
.student-shell .material-card {
  padding: 13px !important;
}

.student-shell .material-card > header {
  margin-bottom: 8px !important;
}

.student-shell .material-card .small {
  margin-top: 3px !important;
}

.student-shell .material-card > .row {
  margin-top: 9px !important;
  padding-top: 9px !important;
}

/* PDF-Bereich nur so breit wie nötig */
.student-shell .pdf-real-preview {
  width: min(520px, 100%) !important;
  grid-template-columns: 120px minmax(0, 280px) !important;
  gap: 14px !important;
}

/* Video kompakter */
.student-shell .video-wrap {
  width: min(520px, 100%) !important;
}

.student-shell .video-wrap video {
  max-height: 360px !important;
}

/* Footer etwas näher */
.student-shell .app-footer {
  margin-top: 10px !important;
  padding-top: 4px !important;
}

@media (max-width: 820px) {
  .student-shell .pdf-real-preview {
    width: 100% !important;
    grid-template-columns: 1fr !important;
  }

  .student-shell .video-wrap {
    width: 100% !important;
  }
}

/* Schülerbegrüßung ohne Button-Optik */
.student-area-group {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: default !important;
}

.student-area-group span,
.student-area-group strong {
  color: var(--brand-navy) !important;
}

.student-area-group:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Schülerbegrüßung mittig und präsenter */
.student-shell .topbar,
.student-shell .student-sticky-topbar {
  position: relative;
}

.student-shell .userbar {
  position: static !important;
}

.student-shell .student-area-group {
  position: absolute !important;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) !important;
  white-space: nowrap;
}

.student-shell .student-area-group span,
.student-shell .student-area-group strong {
  font-size: 19px !important;
  line-height: 1.2;
  font-weight: 750 !important;
}

.student-shell .userbar > button {
  margin-left: auto;
}

/* Mobil wieder normal anordnen */
@media (max-width: 820px) {
  .student-shell .student-area-group {
    position: static !important;
    transform: none !important;
    white-space: normal;
  }

  .student-shell .student-area-group span,
  .student-shell .student-area-group strong {
    font-size: 15px !important;
  }
}

/* Schülerbegrüßung zweizeilig */
.student-shell .student-area-group {
  display: grid !important;
  grid-template-columns: auto auto;
  justify-items: center;
  align-items: center;
  column-gap: 6px;
  row-gap: 4px;
  text-align: center;
  white-space: normal !important;
}

.student-shell .student-area-group span:first-child {
  grid-column: 1;
}

.student-shell .student-area-group strong {
  grid-column: 2;
}

.student-shell .student-area-group strong::after {
  content: none !important;
}

.student-shell .student-area-group span:first-child::after {
  content: none !important;
}

.student-shell .student-area-group span:last-child {
  grid-column: 1 / -1;
  display: block;
  font-size: 15px !important;
  font-weight: 650 !important;
  color: var(--text-muted) !important;
}

.student-shell .student-area-group span:last-child::before {
  content: none !important;
}

@media (max-width: 820px) {
  .student-shell .student-area-group {
    row-gap: 2px;
  }

  .student-shell .student-area-group span:last-child {
    font-size: 13px !important;
  }
}

/* Schülerbegrüßung zweizeilig kompakter */
.student-shell .student-area-group {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px !important;
  text-align: center;
}

.student-shell .student-area-group span:first-child,
.student-shell .student-area-group strong {
  display: inline;
  font-size: 18px !important;
  line-height: 1.15;
  font-weight: 750 !important;
  color: var(--brand-navy) !important;
}

.student-shell .student-area-group span:first-child::after {
  content: " ";
}

.student-shell .student-area-group strong::after {
  content: none !important;
}

.student-shell .student-area-group span:last-child {
  display: block;
  font-size: 13px !important;
  line-height: 1.2;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
}

.student-shell .student-area-group span:last-child::before {
  content: none !important;
}

/* Schülerbegrüßung: einheitliche Farbe, ohne Umrandung */
.student-shell .student-area-group,
.student-shell .student-area-group * {
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.student-shell .student-area-group span,
.student-shell .student-area-group strong {
  color: var(--brand-navy) !important;
}

.student-shell .student-area-group span:last-child {
  color: var(--brand-navy) !important;
}

/* Begrüßung: Name in erster Zeile, Bereich darunter */
.student-shell .student-area-group {
  display: grid !important;
  grid-template-columns: max-content max-content;
  justify-content: center;
  align-items: baseline;
  column-gap: 6px !important;
  row-gap: 3px !important;
  text-align: center;
}

.student-shell .student-area-group span:first-child,
.student-shell .student-area-group strong {
  display: block;
  font-size: 18px !important;
  line-height: 1.15;
  font-weight: 750 !important;
  color: var(--brand-navy) !important;
}

.student-shell .student-area-group span:first-child::after,
.student-shell .student-area-group strong::after {
  content: none !important;
}

.student-shell .student-area-group span:last-child {
  grid-column: 1 / -1;
  display: block;
  font-size: 14px !important;
  line-height: 1.2;
  font-weight: 650 !important;
  color: var(--brand-navy) !important;
}

.student-shell .student-area-group span:last-child::before {
  content: none !important;
}

/* Begrüßung enger zusammenführen */
.student-shell .student-area-group {
  width: max-content !important;
  grid-template-columns: auto auto !important;
  column-gap: 5px !important;
  justify-content: center !important;
  justify-items: center !important;
}

.student-shell .student-area-group span:first-child,
.student-shell .student-area-group strong {
  margin: 0 !important;
  padding: 0 !important;
}

/* =========================================================
   Begrüßung zurücksetzen: einzeilig neben Abmelden
   ========================================================= */

.student-shell .userbar {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  width: auto !important;
}

.student-shell .student-area-group {
  position: static !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  transform: none !important;
  white-space: nowrap !important;
  text-align: left !important;
  border: 0 !important;
  outline: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.student-shell .student-area-group span,
.student-shell .student-area-group strong {
  display: inline !important;
  grid-column: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--brand-navy) !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.student-shell .student-area-group span:first-child::after {
  content: "\00a0" !important;
}

.student-shell .student-area-group strong::after {
  content: "\00a0·\00a0" !important;
}

.student-shell .student-area-group span:last-child::before,
.student-shell .student-area-group span:last-child::after {
  content: none !important;
}

.student-shell .userbar > button {
  margin-left: 0 !important;
}

@media (max-width: 820px) {
  .student-shell .userbar {
    width: 100% !important;
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
  }

  .student-shell .student-area-group {
    white-space: normal !important;
  }

  .student-shell .student-area-group span,
  .student-shell .student-area-group strong {
    font-size: 14px !important;
  }
}

/* Begrüßung endgültig kompakt neben Abmelden */
.student-shell .topbar .userbar .student-area-group,
.student-shell .student-sticky-topbar .userbar .student-area-group {
  position: static !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: auto !important;
  transform: none !important;
  white-space: nowrap !important;
}

.student-shell .topbar .userbar .student-area-group span,
.student-shell .topbar .userbar .student-area-group strong,
.student-shell .student-sticky-topbar .userbar .student-area-group span,
.student-shell .student-sticky-topbar .userbar .student-area-group strong {
  display: inline !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.student-shell .student-area-group span:first-child::after {
  content: "\00a0" !important;
}

.student-shell .student-area-group strong::after {
  content: "\00a0·\00a0" !important;
}

.student-shell .student-area-group span:last-child::before,
.student-shell .student-area-group span:last-child::after {
  content: none !important;
}

/* Mobile: persönliche Ansprache exakt über Abmelden zentrieren */
@media (max-width: 700px) {
  .student-shell .topbar .userbar .student-area-group,
  .student-shell .student-sticky-topbar .userbar .student-area-group {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;

    align-self: stretch !important;
    justify-self: stretch !important;

    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;

    margin: 0.75rem 0 !important;
    padding: 0 !important;

    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    translate: none !important;
    transform: none !important;

    text-align: center !important;
    white-space: normal !important;
  }
}


/* =========================================================
   Social-Media-Leiste im Kopfbereich
   ========================================================= */

.topbar {
  position: relative;
}

.header-social-links {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;

  max-width: 46%;
  transform: translate(-50%, -50%);
}

.header-social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 2.15rem;
  padding: 0.42rem 0.72rem;

  border: 1px solid rgba(17, 37, 108, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);

  color: #11256c;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;

  box-shadow: 0 2px 7px rgba(17, 37, 108, 0.05);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.header-social-links a:hover {
  background: #ffffff;
  border-color: rgba(17, 37, 108, 0.3);
  box-shadow: 0 4px 10px rgba(17, 37, 108, 0.09);
  transform: translateY(-1px);
}

.header-social-links a:focus-visible {
  outline: 3px solid rgba(52, 111, 219, 0.28);
  outline-offset: 2px;
}

.header-social-links .google-review-link {
  background: rgba(255, 248, 221, 0.82);
  border-color: rgba(190, 139, 0, 0.22);
  color: #6c5000;
}


/* Bei mittleren Desktopbreiten etwas kompakter */
@media (min-width: 701px) and (max-width: 1250px) {
  .header-social-links {
    gap: 0.3rem;
    max-width: 43%;
  }

  .header-social-links a {
    padding: 0.4rem 0.55rem;
    font-size: 0.7rem;
  }
}


/* Mobile: unter dem Logo, oberhalb von Begrüßung und Abmelden */
@media (max-width: 700px) {
  .student-shell .topbar .header-social-links,
  .student-shell .student-sticky-topbar .header-social-links {
    position: static !important;
    inset: auto !important;

    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: none !important;
    margin: 0.35rem 0 0.15rem !important;
    padding: 0 !important;

    transform: none !important;
  }

  .student-shell .header-social-links a {
    min-height: 2.1rem;
    padding: 0.42rem 0.65rem;
    font-size: 0.73rem;
  }

  .student-shell .header-social-links .google-review-link {
    flex-basis: auto;
  }
}


/* =========================================================
   Social-Media-Links als dezente Icon-Buttons
   ========================================================= */

.header-social-links .social-icon-link {
  width: 2.55rem !important;
  height: 2.55rem !important;
  min-width: 2.55rem !important;
  min-height: 2.55rem !important;

  padding: 0 !important;
  border-radius: 50% !important;

  background: rgba(255, 255, 255, 0.78) !important;
  border: 1px solid rgba(17, 37, 108, 0.14) !important;

  box-shadow: 0 2px 8px rgba(17, 37, 108, 0.06) !important;
}

.header-social-links .social-icon-link svg {
  width: 1.18rem;
  height: 1.18rem;
  display: block;
  fill: currentColor;
}

.header-social-links .youtube-link {
  color: #e62117 !important;
}

.header-social-links .instagram-link {
  color: #b52d79 !important;
}

.header-social-links .facebook-link {
  color: #1877f2 !important;
}

.header-social-links .google-review-link {
  color: #d89b00 !important;
  background: rgba(255, 250, 232, 0.88) !important;
  border-color: rgba(216, 155, 0, 0.2) !important;
}

.header-social-links .social-icon-link:hover {
  background: #ffffff !important;
  border-color: currentColor !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 5px 13px rgba(17, 37, 108, 0.11) !important;
}

@media (max-width: 700px) {
  .student-shell .header-social-links .social-icon-link {
    width: 2.6rem !important;
    height: 2.6rem !important;
    min-width: 2.6rem !important;
    min-height: 2.6rem !important;
    padding: 0 !important;
    flex-basis: auto !important;
  }
}


/* =========================================================
   Lehrerbereich: Materialdarstellung vor Launch kompakter
   ========================================================= */

/* Nur Materialkarten innerhalb der rechten Lehrer-Arbeitsfläche */
.teacher-main-panel .material-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Lange Datei- und Materialnamen kontrolliert umbrechen */
.teacher-main-panel .material-card h3,
.teacher-main-panel .material-card .material-title,
.teacher-main-panel .material-card strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Videos auf Desktop sinnvoll begrenzen */
.teacher-main-panel .material-card video {
  display: block;
  width: min(100%, 32rem);
  max-width: 100%;
  height: auto;
  max-height: 22rem;
  object-fit: contain;
  background: #000;
}

/* PDF-Vorschau nicht unnötig breit oder hoch werden lassen */
.teacher-main-panel .material-card .pdf-real-preview,
.teacher-main-panel .material-card .pdf-document-preview,
.teacher-main-panel .material-card .pdf-thumbnail-button,
.teacher-main-panel .material-card .pdf-frame {
  width: min(100%, 34rem);
  max-width: 100%;
  box-sizing: border-box;
}

/* Canvas proportional innerhalb der Vorschau */
.teacher-main-panel .material-card .pdf-real-preview canvas,
.teacher-main-panel .material-card .pdf-document-preview canvas,
.teacher-main-panel .material-card .pdf-thumbnail-button canvas {
  display: block;
  max-width: 100%;
  height: auto !important;
}

/* Aktionsbereich unter allen Materialtypen gleichmäßiger */
.teacher-main-panel .material-card .material-actions,
.teacher-main-panel .material-card .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

/* Löschen weiterhin rechts, sofern genug Platz vorhanden ist */
.teacher-main-panel .material-card .material-actions .danger,
.teacher-main-panel .material-card .actions .danger {
  margin-left: auto;
}

/* Mittlere Bildschirmbreiten */
@media (max-width: 1100px) {
  .teacher-main-panel .material-card video {
    width: min(100%, 28rem);
    max-height: 20rem;
  }
}

/* Mobile Lehreransicht */
@media (max-width: 700px) {
  .teacher-main-panel .material-card video,
  .teacher-main-panel .material-card .pdf-real-preview,
  .teacher-main-panel .material-card .pdf-document-preview,
  .teacher-main-panel .material-card .pdf-thumbnail-button,
  .teacher-main-panel .material-card .pdf-frame {
    width: 100%;
    max-width: 100%;
  }

  .teacher-main-panel .material-card video {
    max-height: none;
  }

  .teacher-main-panel .material-card .material-actions,
  .teacher-main-panel .material-card .actions {
    width: 100%;
  }

  .teacher-main-panel .material-card .material-actions .danger,
  .teacher-main-panel .material-card .actions .danger {
    margin-left: 0;
  }
}


/* =========================================================
   Ruhiger Header-Hintergrund
   ========================================================= */

.topbar {
  background:
    linear-gradient(
      135deg,
      rgba(244, 247, 252, 0.98) 0%,
      rgba(248, 246, 241, 0.98) 100%
    ) !important;

  border-color: rgba(17, 37, 108, 0.12) !important;
}

/* Lehrerbereich etwas neutraler */
.app-shell:not(.student-shell) .topbar {
  background:
    linear-gradient(
      135deg,
      rgba(243, 247, 251, 0.98) 0%,
      rgba(247, 245, 240, 0.98) 100%
    ) !important;
}

/* Schülerbereich minimal wärmer */
.student-shell .topbar {
  background:
    linear-gradient(
      135deg,
      rgba(245, 247, 252, 0.98) 0%,
      rgba(250, 246, 243, 0.98) 100%
    ) !important;
}


/* =========================================================
   FINAL DESIGN: Lehrerbereich
   Ausschließlich auf angemeldete Lehreransicht begrenzt
   ========================================================= */

/* Grundlegende Flächenhierarchie */
.app-shell:not(.student-shell) .teacher-main-panel,
.app-shell:not(.student-shell) .lesson-sidebar {
  min-width: 0;
  box-sizing: border-box;
}

.app-shell:not(.student-shell) .teacher-main-panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(17, 37, 108, 0.09);
  border-radius: 1rem;
}

.app-shell:not(.student-shell) .lesson-sidebar {
  background: rgba(248, 250, 253, 0.88);
  border: 1px solid rgba(17, 37, 108, 0.09);
  border-radius: 1rem;
}


/* ---------------------------------------------------------
   Überschriften
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel h2,
.app-shell:not(.student-shell) .lesson-sidebar h2 {
  margin-top: 0;
  color: #10246d;
  line-height: 1.15;
}

.app-shell:not(.student-shell) .teacher-main-panel h3,
.app-shell:not(.student-shell) .lesson-sidebar h3 {
  color: #10246d;
  line-height: 1.25;
}


/* ---------------------------------------------------------
   Unterrichtsliste
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .lesson-sidebar .item,
.app-shell:not(.student-shell) .lesson-sidebar .lesson-list-item {
  box-sizing: border-box;
  min-width: 0;
  border-radius: 0.75rem;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.app-shell:not(.student-shell) .lesson-sidebar .item:hover,
.app-shell:not(.student-shell) .lesson-sidebar .lesson-list-item:hover {
  border-color: rgba(17, 37, 108, 0.2);
  background: rgba(255, 255, 255, 0.9);
}

.app-shell:not(.student-shell) .lesson-sidebar .item.active,
.app-shell:not(.student-shell) .lesson-sidebar .lesson-list-item.active {
  background: rgba(237, 242, 252, 0.94);
  border-color: rgba(39, 74, 171, 0.25);
  box-shadow: 0 5px 14px rgba(17, 37, 108, 0.08);
}

.app-shell:not(.student-shell) .lesson-sidebar .item strong,
.app-shell:not(.student-shell) .lesson-sidebar .lesson-list-item strong,
.app-shell:not(.student-shell) .lesson-sidebar .item h3,
.app-shell:not(.student-shell) .lesson-sidebar .lesson-list-item h3 {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* ---------------------------------------------------------
   Kopf der ausgewählten Unterrichtseinheit
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel .lesson-header,
.app-shell:not(.student-shell) .teacher-main-panel .lesson-detail-header {
  box-sizing: border-box;
  min-width: 0;
  border-radius: 0.85rem;
  background: rgba(248, 246, 241, 0.92);
  border: 1px solid rgba(126, 104, 62, 0.12);
}

.app-shell:not(.student-shell) .teacher-main-panel .lesson-header h2,
.app-shell:not(.student-shell) .teacher-main-panel .lesson-detail-header h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}


/* ---------------------------------------------------------
   Dateien-hinzufügen-Bereich
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel .upload-section,
.app-shell:not(.student-shell) .teacher-main-panel .upload-panel,
.app-shell:not(.student-shell) .teacher-main-panel .add-files-panel {
  box-sizing: border-box;
  min-width: 0;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(17, 37, 108, 0.1);
}


/* ---------------------------------------------------------
   Materialkarten
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel .material-card {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  border-radius: 0.9rem;
  box-shadow: none;
}

.app-shell:not(.student-shell) .teacher-main-panel .material-card + .material-card {
  margin-top: 0.75rem;
}

.app-shell:not(.student-shell) .teacher-main-panel .material-card h3,
.app-shell:not(.student-shell) .teacher-main-panel .material-card strong,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .material-title {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* Video weiterhin kompakt halten */
.app-shell:not(.student-shell) .teacher-main-panel .material-card video {
  display: block;
  width: min(100%, 31rem);
  max-width: 100%;
  height: auto;
  max-height: 21rem;
  object-fit: contain;
  background: #000;
  border-radius: 0.7rem;
}


/* PDF-Vorschau kontrolliert begrenzen */
.app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-real-preview,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-document-preview,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-thumbnail-button,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-frame {
  width: min(100%, 33rem);
  max-width: 100%;
  box-sizing: border-box;
}

.app-shell:not(.student-shell) .teacher-main-panel .material-card canvas {
  display: block;
  max-width: 100%;
  height: auto !important;
}


/* ---------------------------------------------------------
   Material-Aktionszeile
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel .material-actions,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
}

.app-shell:not(.student-shell) .teacher-main-panel .material-actions .danger,
.app-shell:not(.student-shell) .teacher-main-panel .material-card .actions .danger {
  margin-left: auto;
}


/* ---------------------------------------------------------
   Leere Zustände
   --------------------------------------------------------- */

.app-shell:not(.student-shell) .teacher-main-panel .empty-state,
.app-shell:not(.student-shell) .teacher-main-panel .empty-materials {
  box-sizing: border-box;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;

  color: rgba(32, 35, 48, 0.68);
  background: rgba(248, 246, 242, 0.72);
  border: 1px dashed rgba(79, 68, 52, 0.17);
  border-radius: 0.75rem;
}


/* ---------------------------------------------------------
   Buttons im Lehrerbereich
   --------------------------------------------------------- */

.app-shell:not(.student-shell) button,
.app-shell:not(.student-shell) .button {
  line-height: 1.15;
}

.app-shell:not(.student-shell) button:focus-visible,
.app-shell:not(.student-shell) .button:focus-visible {
  outline: 3px solid rgba(52, 111, 219, 0.26);
  outline-offset: 2px;
}


/* ---------------------------------------------------------
   Tablet und Mobile
   --------------------------------------------------------- */

@media (max-width: 900px) {
  .app-shell:not(.student-shell) .teacher-main-panel,
  .app-shell:not(.student-shell) .lesson-sidebar {
    width: 100%;
    max-width: 100%;
  }

  .app-shell:not(.student-shell) .teacher-main-panel .material-card video,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-real-preview,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-document-preview,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-thumbnail-button,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .pdf-frame {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .app-shell:not(.student-shell) .teacher-main-panel,
  .app-shell:not(.student-shell) .lesson-sidebar {
    border-radius: 0.85rem;
  }

  .app-shell:not(.student-shell) .teacher-main-panel .material-card video {
    max-height: none;
  }

  .app-shell:not(.student-shell) .teacher-main-panel .material-actions,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .actions {
    align-items: stretch;
  }

  .app-shell:not(.student-shell) .teacher-main-panel .material-actions .danger,
  .app-shell:not(.student-shell) .teacher-main-panel .material-card .actions .danger {
    margin-left: 0;
  }
}


/* =========================================================
   FINAL: Mobiler Schüler-Header
   ========================================================= */

@media (max-width: 700px) {
  .student-shell .topbar,
  .student-shell .student-sticky-topbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;

    position: static !important;
    inset: auto !important;

    padding: 1.15rem !important;
    overflow: visible !important;
  }

  /* Logo zentriert und als eigener Bereich */
  .student-shell .topbar .brand,
  .student-shell .student-sticky-topbar .brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;

    text-align: center !important;
  }

  .student-shell .topbar .brand-logo,
  .student-shell .student-sticky-topbar .brand-logo {
    display: block !important;
    max-width: min(100%, 17rem) !important;
    height: auto !important;
    margin: 0 auto !important;
  }

  .student-shell .topbar .brand h1,
  .student-shell .topbar .brand span,
  .student-shell .student-sticky-topbar .brand h1,
  .student-shell .student-sticky-topbar .brand span {
    display: none !important;
  }

  /* Social-Icons kontrolliert in einer Reihe */
  .student-shell .header-social-links,
  .student-shell .student-sticky-topbar .header-social-links {
    position: static !important;
    inset: auto !important;
    transform: none !important;

    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: 100% !important;
    margin: 0.1rem 0 0.15rem !important;
    padding: 0 !important;
    gap: 0.7rem !important;
  }

  .student-shell .header-social-links .social-icon-link {
    flex: 0 0 2.75rem !important;

    width: 2.75rem !important;
    height: 2.75rem !important;
    min-width: 2.75rem !important;
    min-height: 2.75rem !important;
    max-width: 2.75rem !important;

    margin: 0 !important;
    padding: 0 !important;
  }

  /* Nutzerbereich vollständig unter den Icons */
  .student-shell .topbar .userbar,
  .student-shell .student-sticky-topbar .userbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;
    gap: 0.75rem !important;

    position: static !important;
    inset: auto !important;
    transform: none !important;
  }

  /* Begrüßung als zusammenhängender zentrierter Text */
  .student-shell .topbar .userbar .student-area-group,
  .student-shell .student-sticky-topbar .userbar .student-area-group {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    justify-content: center !important;

    align-self: stretch !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    position: static !important;
    inset: auto !important;
    transform: none !important;
    translate: none !important;

    color: #10246d !important;
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .student-shell .student-area-group span,
  .student-shell .student-area-group strong {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
  }

  /* Bestehende Trennzeichen und Abstände kontrollieren */
  .student-shell .student-area-group span:first-child::after {
    content: "\00a0" !important;
  }

  .student-shell .student-area-group strong::after {
    content: "\00a0·\00a0" !important;
  }

  /* Abmelden über volle Kartenbreite */
  .student-shell .topbar .userbar > button,
  .student-shell .student-sticky-topbar .userbar > button,
  .student-shell .topbar .userbar .secondary,
  .student-shell .student-sticky-topbar .userbar .secondary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: 100% !important;
    min-height: 3.25rem !important;

    margin: 0 !important;
    padding: 0.75rem 1rem !important;

    box-sizing: border-box !important;
    text-align: center !important;
  }
}


/* Sehr schmale Geräte */
@media (max-width: 430px) {
  .student-shell .topbar,
  .student-shell .student-sticky-topbar {
    padding: 1rem !important;
  }

  .student-shell .header-social-links,
  .student-shell .student-sticky-topbar .header-social-links {
    gap: 0.55rem !important;
  }

  .student-shell .header-social-links .social-icon-link {
    flex-basis: 2.55rem !important;
    width: 2.55rem !important;
    height: 2.55rem !important;
    min-width: 2.55rem !important;
    min-height: 2.55rem !important;
    max-width: 2.55rem !important;
  }

  .student-shell .topbar .userbar .student-area-group,
  .student-shell .student-sticky-topbar .userbar .student-area-group {
    font-size: 0.98rem !important;
  }
}

/* Schülerbereich: alphabetische Unterrichtsübersicht */
.student-shell .student-lesson-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.student-shell .student-lesson-index {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.student-shell .student-lesson-index h2 {
  margin-top: 0;
}

.student-shell .student-lesson-index-group + .student-lesson-index-group {
  margin-top: 16px;
}

.student-shell .student-lesson-index-group h3 {
  margin: 0 0 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(17, 37, 108, 0.14);
  color: #10246d;
  font-size: 14px;
}

.student-shell .student-lesson-index-items {
  display: grid;
  gap: 4px;
}

.student-shell .student-lesson-index-item {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.student-shell .student-lesson-index-item:hover {
  background: rgba(237, 242, 252, 0.72);
}

.student-shell .student-lesson-index-item.active {
  background: rgba(225, 233, 250, 0.95);
  color: #10246d;
  font-weight: 700;
}

.student-shell .student-lesson-detail {
  min-width: 0;
}

@media (max-width: 820px) {
  .student-shell .student-lesson-layout {
    grid-template-columns: 1fr;
  }

  .student-shell .student-lesson-index {
    position: static;
    max-height: none;
  }
}

.download-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.download-status {
  display: block;
  min-height: 18px;
  color: var(--text-muted);
}

#passwordResetButton {
  margin-top: 18px;
}


.material-card > .row {
  align-items: flex-start !important;
  justify-content: flex-start;
}

.material-card > .row .danger,
.material-card > .row button[onclick^="deleteMaterial"] {
  margin-left: 0 !important;
}

.material-card > .row .download-control {
  position: relative;
  margin-top: 0 !important;
}

.material-card > .row .download-status {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-height: 0;
  white-space: nowrap;
}
