:root {
  --tinte: #1c2733;
  --grau: #5b6b7b;
  --linie: #e3e9ef;
  --flaeche: #f4f7fa;
  --karte: #ffffff;
  --akzent: #2563eb;
  --akzent-hell: #eaf1fe;
  --warn: #b45309;
  --warn-hell: #fef3c7;
  --rot: #b91c1c;
  --gruen: #15803d;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--flaeche); color: var(--tinte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.verborgen { display: none !important; }

/* ---------- Login ---------- */
.login-hintergrund {
  position: fixed; inset: 0; background: var(--flaeche);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.login-box {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 32px; width: min(360px, 90vw); text-align: center;
  box-shadow: 0 8px 30px rgba(28,39,51,.08);
}
.login-box h1 { margin: 0 0 8px; font-size: 22px; }
.login-box p { color: var(--grau); margin: 0 0 16px; }
.login-box input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px;
  font-size: 15px; margin-bottom: 12px;
}
.login-box button { width: 100%; }
.login-spalte { display: flex; flex-direction: column; gap: 18px; width: min(400px, 92vw); }
.login-spalte .login-box { width: 100%; }
.demo-auswahl {
  background: #f6f4ec; border: 1px solid #e7e3d5; border-radius: 12px;
  padding: 16px 18px; text-align: center;
}
.demo-auswahl-titel { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: #57544a; }
.demo-auswahl-knoepfe { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.demo-knopf {
  background: #fff; color: var(--tinte); border: 1px solid #e7e3d5; border-radius: 10px;
  padding: 10px 8px; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  box-shadow: 0 2px 0 #e7e3d5;
}
.demo-knopf:hover { filter: none; border-color: var(--warn); box-shadow: 0 2px 0 var(--warn); }
.demo-knopf strong { font-size: 14px; }
.demo-knopf span { font-size: 11.5px; color: var(--grau); line-height: 1.3; }
.demo-auswahl .neben { margin: 0; font-size: 12px; }

/* ---------- Grundgerüst: Sidebar + Inhalt ---------- */
.app { display: flex; min-height: 100vh; }

/* Sidebar im Schulordner-Stil: warmer Papier-Canvas, farbige Registermarken,
   der aktive Eintrag liegt als weißes „Blatt" leicht erhaben auf. */
.sidebar {
  --papier: #f6f4ec;
  --papier-linie: #e7e3d5;
  --papier-hover: #eeebe0;
  --papier-tinte: #57544a;
  width: 232px; flex-shrink: 0; background: var(--papier);
  border-right: 1px solid var(--papier-linie);
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px 14px; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.logo-zeichen { width: 26px; height: 26px; color: var(--tinte); flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-titel {
  display: flex; align-items: center; gap: 8px;
  color: #a29c89; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; padding: 16px 8px 6px;
}
.nav-titel::after { content: ''; flex: 1; height: 1px; background: var(--papier-linie); }
.nav-punkt {
  display: flex; align-items: center; gap: 11px; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 8px 11px; font-size: 14px; font-weight: 500;
  color: var(--papier-tinte); cursor: pointer;
  transition: background .12s ease, box-shadow .12s ease;
}
.nav-punkt .marke {
  width: 4px; height: 17px; border-radius: 3px; flex-shrink: 0;
  background: currentColor; opacity: .35;
  transition: opacity .12s ease, height .12s ease;
}
.nav-punkt[data-seite="stundenplan"] .marke   { background: #3b82f6; }
.nav-punkt[data-seite="unterricht"] .marke    { background: #22c55e; }
.nav-punkt[data-seite="klassen"] .marke       { background: #f59e0b; }
.nav-punkt[data-seite="lehrer"] .marke        { background: #8b5cf6; }
.nav-punkt[data-seite="faecher"] .marke       { background: #ec4899; }
.nav-punkt[data-seite="raeume"] .marke        { background: #14b8a6; }
.nav-punkt[data-seite="zugaenge"] .marke      { background: #f97316; }
.nav-punkt[data-seite="einstellungen"] .marke { background: #94a3b8; }
.nav-punkt:hover { background: var(--papier-hover); color: var(--tinte); filter: none; }
.nav-punkt:hover .marke { opacity: .8; }
.nav-punkt.aktiv {
  background: #fff; color: var(--tinte); font-weight: 650;
  border-color: var(--papier-linie);
  box-shadow: 0 1px 2px rgba(28,39,51,.07), 0 3px 8px rgba(28,39,51,.05);
}
.nav-punkt.aktiv .marke { opacity: 1; height: 20px; }
.sidebar-fuss { display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 0; border-top: 1px solid var(--papier-linie); }
.wer { margin: 0; text-align: center; color: #8b8574; font-size: 12.5px; }
#logout {
  background: none; border: none; color: #a29c89; font-size: 13px;
  padding: 4px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #d8d3c2;
}
#logout:hover { color: var(--tinte); filter: none; }

.inhalt-bereich { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: var(--karte); border-bottom: 1px solid var(--linie);
}
.topbar h1 { font-size: 19px; margin: 0; }
main { max-width: 1250px; width: 100%; margin: 0 auto; padding: 24px 28px 60px; }
.nur-mobil { display: none; }

/* ---------- Karten & Listen ---------- */
.karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: 0 1px 3px rgba(28,39,51,.04);
}
.karte h2 { margin: 0 0 4px; font-size: 16px; }
.karte .hinweis { color: var(--grau); font-size: 13px; margin: 0 0 12px; }
.breit { grid-column: 1 / -1; }

ul.liste { list-style: none; margin: 0 0 12px; padding: 0; }
ul.liste li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--linie); }
ul.liste li:last-child { border-bottom: none; }
ul.liste .name { flex: 1; }
ul.liste .neben { color: var(--grau); font-size: 13px; }
.neben { color: var(--grau); font-size: 13px; }

button {
  background: var(--akzent); color: #fff; border: none; border-radius: 9px;
  padding: 9px 15px; font-size: 14px; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.leise { background: none; color: var(--grau); border: 1px solid var(--linie); }
button.leise:hover { color: var(--tinte); background: var(--flaeche); filter: none; }
button.mini { padding: 3px 9px; font-size: 12.5px; }
button.rot { background: none; border: none; color: var(--grau); font-size: 16px; padding: 2px 6px; }
button.rot:hover { color: var(--rot); background: none; }

form.zeile { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.zeile input, form.zeile select, .editor input, .editor select, .steuer select, .steuer input {
  padding: 8px 10px; border: 1px solid var(--linie); border-radius: 8px; font-size: 14px; background: #fff;
}
form.zeile input[type=text] { flex: 1; min-width: 120px; }
input.schmal { width: 74px; }
input[type=time].schmal { width: 116px; }

/* ---------- Lehrer-Editor ---------- */
.editor { border-top: 1px dashed var(--linie); margin-top: 10px; padding-top: 12px; display: grid; gap: 10px; }
.editor .felder { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips label { border: 1px solid var(--linie); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; user-select: none; }
.chips input { display: none; }
.chips label:has(input:checked) { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent); }

table.verf { border-collapse: collapse; font-size: 12.5px; }
table.verf th, table.verf td { border: 1px solid var(--linie); padding: 2px 6px; text-align: center; }
table.verf td { cursor: pointer; min-width: 34px; }
table.verf td.an { background: #dcfce7; color: var(--gruen); }
table.verf td.aus { background: #fee2e2; color: var(--rot); }

/* ---------- Unterricht ---------- */
table.daten { border-collapse: collapse; width: 100%; font-size: 14px; }
table.daten th, table.daten td { border-bottom: 1px solid var(--linie); padding: 8px 10px; text-align: left; }
table.daten th { color: var(--grau); font-weight: 600; font-size: 13px; }
.summe { color: var(--grau); font-size: 13px; }
.summe.zuviel { color: var(--rot); font-weight: 600; }

/* ---------- Stundenplan-Ansicht ---------- */
.steuer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.steuer .abstand { flex: 1; }

.banner { padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; }
.banner.warnung { background: var(--warn-hell); color: var(--warn); }
.banner.fehlerliste { background: #fee2e2; color: var(--rot); }
.banner ul { margin: 6px 0 0; padding-left: 20px; }

.plan-karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 18px; overflow-x: auto; box-shadow: 0 1px 3px rgba(28,39,51,.04);
}
.plan-titel { font-weight: 700; font-size: 16px; margin: 0 0 12px; }

table.raster { border-collapse: separate; border-spacing: 6px 6px; width: 100%; min-width: 760px; }
table.raster th { font-weight: 600; font-size: 13.5px; padding: 4px 6px; }
table.raster thead .tag { color: var(--tinte); }
table.raster thead .tag small { display: block; color: var(--grau); font-weight: 500; font-size: 11.5px; }
table.raster thead .tag.heute { color: var(--akzent); }
table.raster thead .tag.heute small { color: var(--akzent); }
table.raster .zeit {
  color: var(--grau); font-size: 12px; font-weight: 600; white-space: nowrap;
  text-align: right; vertical-align: middle; padding-right: 10px; line-height: 1.35;
}
table.raster .zeit small { display: block; font-weight: 400; }
table.raster td.zelle { width: 19%; padding: 0; vertical-align: stretch; }
.frei {
  border: 1px dashed var(--linie); border-radius: 10px; min-height: 58px; height: 100%;
}
.stunde-karte {
  border-radius: 10px; padding: 8px 10px; min-height: 58px;
  font-size: 13px; line-height: 1.35; position: relative;
}
.stunde-karte .fach { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stunde-karte .fach .symbol { margin-left: auto; font-size: 14px; opacity: .85; }
.stunde-karte .detail { opacity: .85; font-size: 12.5px; }

.leer-hinweis {
  background: var(--karte); border: 1px dashed var(--linie); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--grau);
}

/* Fachfarben (werden per Klasse f0..f9 vergeben) */
.f0 { background: #e0edff; color: #1d4ed8; }
.f1 { background: #dcfce7; color: #15803d; }
.f2 { background: #fef9c3; color: #a16207; }
.f3 { background: #ede9fe; color: #6d28d9; }
.f4 { background: #fce7f3; color: #be185d; }
.f5 { background: #ccfbf1; color: #0f766e; }
.f6 { background: #ffedd5; color: #c2410c; }
.f7 { background: #fee2e2; color: #b91c1c; }
.f8 { background: #e0e7ff; color: #4338ca; }
.f9 { background: #ecfccb; color: #4d7c0f; }

/* ---------- Ebenen-Umschalter & Demo-Banner ---------- */
.ebenen {
  display: flex; gap: 5px; padding: 4px;
  background: #ebe8db; border: 1px solid #e0dccb; border-radius: 12px;
}
.ebenen .ebene {
  flex: 1; background: none; color: #8b8574; border: none; border-radius: 8px;
  padding: 6px 10px; font-size: 13px; font-weight: 600;
}
.ebenen .ebene:hover:not(.aktiv) { background: #f2efe4; filter: none; color: var(--tinte); }
.ebenen .ebene.aktiv {
  background: var(--akzent); color: #fff;
  box-shadow: 0 2px 0 #1a45a8;
}
#ebene-demo.aktiv { background: var(--warn); box-shadow: 0 2px 0 #7c3a06; }
.demo-banner {
  background: var(--warn-hell); color: var(--warn);
  padding: 8px 28px; font-size: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid #f2e2b3;
}
.demo-banner button { margin-left: auto; color: var(--warn); border-color: #ecd9a0; }

/* ---------- Schnellstart-Assistent ---------- */
.schnellstart { display: grid; gap: 12px; justify-items: center; padding: 48px 24px; }
.schnellstart-titel { font-size: 19px; font-weight: 700; color: var(--tinte); margin: 0; }
.schnellstart p { margin: 0; max-width: 480px; }
.schnellstart button { padding: 12px 24px; font-size: 15px; }

.assistent-schritte { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.assistent-schritte .schritt {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--grau); padding: 7px 14px 7px 8px; border-radius: 999px;
  background: var(--karte); border: 1px solid var(--linie);
}
.assistent-schritte .schritt.aktiv { color: var(--akzent); border-color: var(--akzent); background: var(--akzent-hell); }
.assistent-schritte .schritt.fertig { color: var(--gruen); }
.schritt-nr {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px;
  background: var(--flaeche); border: 1px solid var(--linie);
}
.schritt.aktiv .schritt-nr { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.schritt.fertig .schritt-nr { background: #dcfce7; border-color: #bbe7c8; color: var(--gruen); }

.assistent-karte { display: grid; gap: 14px; }
.assistent-karte h2 { font-size: 18px; }
.auswahl-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.auswahl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--tinte);
}
.auswahl-chip.vorschlag { background: #fff; color: var(--grau); font-weight: 500; cursor: pointer; border-style: dashed; }
.auswahl-chip.vorschlag:hover { color: var(--akzent); border-color: var(--akzent); filter: none; background: var(--akzent-hell); }
.chip-x { background: none; border: none; color: inherit; opacity: .55; font-size: 15px; padding: 0 2px; cursor: pointer; }
.chip-x:hover { opacity: 1; filter: none; }
.assistent-lehrer { display: grid; gap: 10px; }
.assistent-lehrer-zeile {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px;
}
.assistent-lehrer-zeile strong { min-width: 120px; }
.assistent-lehrer-zeile .chips { flex: 1; }
.assistent-aktionen { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--linie); padding-top: 14px; }
.assistent-aktionen .abstand { flex: 1; }

/* ---------- Gefahrenzone & Warn-Dialog ---------- */
.gefahr-karte { border-color: #f3c6c6; }
button.gefahr { background: var(--rot); }
button.gefahr:disabled { opacity: .6; cursor: wait; }
.modal-hintergrund {
  position: fixed; inset: 0; background: rgba(28,39,51,.45); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--karte); border-radius: var(--radius); padding: 24px 26px;
  width: min(460px, 100%); box-shadow: 0 20px 60px rgba(28,39,51,.3);
}
.modal h2 { margin: 0 0 10px; font-size: 17px; }
.modal p { margin: 0 0 10px; }
.modal ul { margin: 0 0 10px; padding-left: 20px; }
.modal li { margin-bottom: 4px; }
.modal-knoepfe { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Meldung ---------- */
.meldung {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--tinte); color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 14px; z-index: 60; max-width: 90vw;
}
.fehler { color: var(--rot); font-size: 14px; min-height: 1em; margin: 10px 0 0; }

/* ---------- Mobil ---------- */
@media (max-width: 860px) {
  .nur-mobil { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-105%);
    transition: transform .18s ease; box-shadow: 12px 0 40px rgba(28,39,51,.18);
  }
  .app.menue-offen .sidebar { transform: none; }
  main { padding: 18px 14px 60px; }
  .topbar { padding: 12px 14px; }
  .demo-banner { padding: 8px 14px; }
}

/* ---------- Druck ---------- */
@media print {
  .sidebar, .topbar, .steuer, .banner, .demo-banner, #meldung { display: none !important; }
  body { background: #fff; }
  main { max-width: none; margin: 0; padding: 0; }
  .plan-karte { border: none; box-shadow: none; padding: 0; page-break-after: always; }
  table.raster { min-width: 0; }
}
