/* Röseren Schulverwaltung
   Farben: Tannengrün (Struktur), Rose (Hinweise, «heute», ungelesen), Salbeigrau (Fläche). */
:root {
  /* Farben von roeseren.ch: Tanne, Sonne, Wiese, Papier */
  --bg: #F6F5F0;
  --panel: #FFFFFF;
  --panel-2: #FAF9F5;
  --ink: #3C3C3B;
  --ink-2: #6F6F6C;
  --ink-3: #9A9994;
  --line: #DCDBD3;
  --line-2: #E9E8E1;
  --forest: #00463B;
  --forest-2: #0A5246;
  --forest-deep: #00362D;
  --forest-ink: #E3EEEA;
  --forest-soft: #E1ECE8;
  --sonne: #FAB600;
  --sonne-soft: #FEF1CC;
  --sonne-ink: #7A5700;
  --wiese: #78BE20;
  --amber: #7A5700;
  --amber-soft: #FEF1CC;
  --ok: #4F7C15;
  --ok-soft: #EAF4DC;
  --bad: #B42318;
  --bad-soft: #FBE3DF;
  --sans: "Franz Sans", "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --display: "Franz Sans", "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --r: 8px;
  --r-lg: 14px;
  --sidebar: 236px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--forest-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.sidebar :focus-visible, .topbar :focus-visible, .login-side :focus-visible { outline-color: var(--sonne); }
.num, td.n, th.n { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Gerüst ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--forest);
  color: var(--forest-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 22px 14px 14px;
}
.wordmark { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 2px 8px 24px; color: #fff; text-decoration: none; }
.wordmark .wm { width: 132px; height: auto; display: block; color: #fff; }
.wordmark .wm-sub { display: block; font-size: 12.5px; color: #A9C4BB; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r);
  color: #D4E2DA; text-decoration: none; font-size: 14.5px;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--sonne); }
.nav a .badge { margin-left: auto; }
.nav .sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 8px; }
.userbox { border-top: 1px solid rgba(255,255,255,.12); padding: 12px 8px 2px; font-size: 13.5px; }
.userbox .who { color: #fff; font-weight: 600; }
.userbox .role { color: #A9C1B4; font-size: 12.5px; }
.userbox .links { display: flex; gap: 14px; margin-top: 8px; }
.userbox .links a, .userbox .links button { color: #D4E2DA; background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.userbox .links a:hover, .userbox .links button:hover { color: #fff; }

.topbar { display: none; }
.main { min-width: 0; padding: 30px 40px 60px; }
.page { max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font: 700 30px/1.15 var(--display); margin: 0; letter-spacing: -.4px; color: var(--forest); }
.page-head .sub { color: var(--ink-2); margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13.5px; margin-bottom: 8px; color: var(--ink-2); text-decoration: none; }
.back:hover { color: var(--forest); text-decoration: underline; }

/* ---------- Bausteine ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.panel-head .link { font-size: 13.5px; }
.panel-body { padding: 12px 18px 16px; }
.panel-body.flush { padding: 8px 0 4px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2 > div > .panel + .panel { margin-top: 18px; }
.stack > * + * { margin-top: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #BCC6BD; background: var(--panel-2); color: var(--ink); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.primary:hover { background: var(--forest-2); border-color: var(--forest-2); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #EBB8B0; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.icon-btn { width: 36px; padding: 0; }
.btn.small.icon-btn { width: 30px; }
.btn svg { flex: none; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  font-size: 12px; font-weight: 700; background: var(--sonne); color: var(--forest-deep); line-height: 1;
}
.badge.soft { background: var(--sonne-soft); color: var(--sonne-ink); }
.badge.grey { background: var(--line-2); color: var(--ink-2); }

.chip { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.chip.offen { background: var(--amber-soft); color: var(--amber); }
.chip.entschuldigt { background: var(--ok-soft); color: var(--ok); }
.chip.unentschuldigt { background: var(--bad-soft); color: var(--bad); }
.chip.neutral { background: var(--line-2); color: var(--ink-2); }
.chip.forest { background: var(--forest-soft); color: var(--forest); }
.chip.rose { background: var(--sonne-soft); color: var(--sonne-ink); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #FAFBF9; }
table.t td.n, table.t th.n { text-align: right; }
table.t td.c, table.t th.c { text-align: center; }
table.t td.actions { text-align: right; white-space: nowrap; }
table.t .sub-row td { padding-top: 0; color: var(--ink-2); font-size: 13px; border-bottom: 1px solid var(--line-2); }
table.t a.rowlink { color: var(--ink); text-decoration: none; font-weight: 500; }
table.t a.rowlink:hover { color: var(--forest); text-decoration: underline; }
.panel > .table-wrap > table.t th:first-child, .panel > .table-wrap > table.t td:first-child { padding-left: 18px; }
.panel > .table-wrap > table.t th:last-child, .panel > .table-wrap > table.t td:last-child { padding-right: 18px; }
tr.group td { background: var(--panel-2) !important; font-weight: 600; font-size: 13px; color: var(--ink-2); padding-top: 10px; }

.empty { padding: 26px 18px; color: var(--ink-2); text-align: center; }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.loading { padding: 40px; color: var(--ink-3); }

/* Formulare & Filter */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar.center { align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { font-size: 12.5px; color: var(--ink-3); }
.input, select.input, textarea.input {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; min-width: 0; width: 100%;
}
textarea.input { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--forest); outline: none; box-shadow: 0 0 0 3px rgba(36, 83, 63, .14); }
.toolbar .input { width: auto; min-width: 150px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--forest); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 9px 12px; border-radius: var(--r); font-size: 14px; margin-bottom: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 9px 14px; border: 0; background: none; cursor: pointer; text-decoration: none;
  color: var(--ink-2); font-size: 14.5px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .active { color: var(--forest); border-bottom-color: var(--sonne); border-bottom-width: 3px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--forest-soft); color: var(--forest); font-weight: 600; }

/* ---------- Startseite ---------- */
.greeting h1 { font: 700 34px/1.1 var(--display); margin: 0; letter-spacing: -.5px; color: var(--forest); }
.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.today-list li:last-child { border-bottom: 0; }
.today-list .time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.today-list .what { font-weight: 600; }
.today-list .what a { color: var(--ink); text-decoration: none; }
.today-list .what a:hover { color: var(--forest); text-decoration: underline; }
.today-list li.now .time { color: var(--sonne-ink); font-weight: 700; }
.today-list li.now { box-shadow: inset 4px 0 0 var(--sonne); padding-left: 10px; margin-left: -10px; }
.today-list li.past { opacity: .55; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: baseline; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .date { flex: none; width: 74px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list .title { font-weight: 500; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sonne); box-shadow: 0 0 0 1px #D49A00; margin-right: 6px; vertical-align: 1px; }
.figures { display: flex; gap: 28px; padding: 4px 0 2px; }
.figures div b { display: block; font: 600 26px/1.1 var(--display); }
.figures div span { font-size: 13px; color: var(--ink-2); }

/* ---------- Noten ---------- */
.grade-grid { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
.grade-grid th, .grade-grid td { border-bottom: 1px solid var(--line-2); padding: 0; }
.grade-grid thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.grade-grid .name { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 190px; padding: 0 14px 0 18px; text-align: left; white-space: nowrap; border-right: 1px solid var(--line-2); }
.grade-grid thead .name { z-index: 3; font-size: 13px; color: var(--ink-2); font-weight: 600; padding-bottom: 10px; }
.grade-grid td.name { height: 42px; }
.grade-grid td.name a { color: var(--ink); text-decoration: none; }
.grade-grid td.name a:hover { color: var(--forest); text-decoration: underline; }
.exam-head {
  display: block; width: 100%; min-width: 96px; max-width: 132px; padding: 10px 10px; border: 0; background: none;
  text-align: left; cursor: pointer; font-size: 12.5px; line-height: 1.3; color: var(--ink-2);
}
.exam-head:hover { background: var(--panel-2); }
.exam-head b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.exam-head .w { color: var(--forest); font-weight: 600; }
.exam-head.hidden-exam b::after { content: " (verborgen)"; font-weight: 400; color: var(--ink-3); }
.grade-grid td.cell { text-align: center; }
.note-input {
  width: 64px; height: 32px; margin: 5px auto; display: block; text-align: center;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  font: 600 15px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--ink);
}
.note-input:hover:not([disabled]) { border-color: var(--line); background: #fff; }
.note-input:focus { border-color: var(--forest); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(36, 83, 63, .14); }
.note-input.bad, .gval.bad { color: var(--bad); }
.note-input.invalid { border-color: var(--bad); background: var(--bad-soft); }
.note-input.saved { animation: saved 1s ease-out; }
@keyframes saved { 0% { background: var(--ok-soft); } 100% { background: transparent; } }
.note-input[disabled] { color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
.note-input.bad[disabled] { -webkit-text-fill-color: var(--bad); }
.grade-grid td.avg, .grade-grid th.avg { text-align: center; padding: 0 12px; background: var(--panel-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.grade-grid th.avg { font-size: 13px; color: var(--ink-2); font-weight: 600; padding-bottom: 10px; }
.grade-grid td.final { font: 600 17px/1 var(--display); }
.grade-grid tfoot td { background: var(--panel-2); color: var(--ink-2); font-size: 12.5px; text-align: center; padding: 8px 4px; font-variant-numeric: tabular-nums; border-bottom: 0; }
.grade-grid tfoot td.name { background: var(--panel-2); }
.gval { font-variant-numeric: tabular-nums; font-weight: 600; }
.gval.final { font: 600 17px/1 var(--display); }
.note-help { font-size: 13px; color: var(--ink-2); padding: 10px 18px 14px; border-top: 1px solid var(--line-2); }

.subject-list { list-style: none; margin: 0; padding: 0; }
.subject-list > li { border-bottom: 1px solid var(--line-2); }
.subject-list > li:last-child { border-bottom: 0; }
.subject-row { display: grid; grid-template-columns: 1fr 76px 76px 76px 24px; gap: 8px; align-items: center; width: 100%; padding: 11px 18px; background: none; border: 0; cursor: pointer; text-align: left; }
.subject-row:hover { background: var(--panel-2); }
.subject-row .fach { font-weight: 600; }
.subject-row .fach small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
.subject-row .v { text-align: center; }
.subject-row .chev { color: var(--ink-3); transition: transform .15s; }
.subject-list li.open .chev { transform: rotate(90deg); }
.subject-head { display: grid; grid-template-columns: 1fr 76px 76px 76px 24px; gap: 8px; padding: 8px 18px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); }
.subject-head span { text-align: center; }
.subject-head span:first-child { text-align: left; }
.exam-list { display: none; padding: 0 18px 12px; }
.subject-list li.open .exam-list { display: block; }
.exam-list table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.exam-list td { padding: 5px 8px; border-top: 1px solid var(--line-2); }
.exam-list td:first-child { padding-left: 0; width: 92px; color: var(--ink-2); }

.matrix td.gv, .matrix th.gv { text-align: center; padding: 8px 6px; }
.matrix td.gv { font-variant-numeric: tabular-nums; font-weight: 600; }
.matrix td.gv.bad { color: var(--bad); background: #FDF3F1; }

/* ---------- Absenzen ---------- */
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--forest-soft); border-bottom: 1px solid var(--line); font-size: 14px; }
.roll { list-style: none; margin: 0; padding: 0; }
.roll li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); }
.roll li:last-child { border-bottom: 0; }
.roll .who { font-weight: 500; }
.roll li.is-absent { background: var(--bad-soft); }
.roll li.is-late { background: var(--amber-soft); }
.roll .seg button { height: 32px; }
.roll .seg button.active.abs { background: var(--bad); color: #fff; }
.roll .seg button.active.late { background: var(--amber); color: #fff; }
.excuse { margin-top: 4px; font-size: 13px; color: var(--ink-2); background: var(--panel-2); border-left: 3px solid var(--sonne); padding: 4px 8px; border-radius: 0 4px 4px 0; }
.stat-row { display: flex; gap: 26px; flex-wrap: wrap; }
.stat-row div b { display: block; font: 600 24px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat-row div span { font-size: 13px; color: var(--ink-2); }

/* ---------- Stundenplan ---------- */
.timetable { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 720px; table-layout: fixed; }
.timetable th { font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 4px; text-align: left; }
.timetable th.today { color: var(--forest); }
.timetable th.lt { width: 84px; }
.timetable td.lt { font-size: 12.5px; color: var(--ink-2); vertical-align: top; padding: 6px 4px; font-variant-numeric: tabular-nums; }
.timetable td.lt b { display: block; color: var(--ink); font-size: 13px; }
.slot { height: 64px; border-radius: var(--r); background: var(--panel-2); border: 1px dashed transparent; padding: 7px 9px; font-size: 13px; line-height: 1.3; overflow: hidden; vertical-align: top; }
.slot.filled { background: var(--forest-soft); border: 1px solid #CADBD0; }
.slot.filled b { display: block; color: var(--forest); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .meta { color: var(--ink-2); font-size: 12.5px; }
.slot.editable { cursor: pointer; }
.slot.editable:hover { border: 1px dashed var(--forest); }
.slot.today-col { box-shadow: inset 0 3px 0 var(--sonne); }
.slot.now { background: var(--sonne-soft); border-color: #F1CF6E; }
.slot.now b { color: var(--sonne-ink); }
tr.break td { height: 10px; padding: 0; }

/* ---------- Agenda ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; }
.cal-head h2 { font: 600 22px/1 var(--display); margin: 0 6px; min-width: 176px; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel); border-radius: var(--r-lg); overflow: hidden; }
.calendar .dow { padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel-2); }
.calendar .day { min-height: 104px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.calendar .day.other { background: #F8F9F7; }
.calendar .day.other .dn { color: var(--ink-3); }
.calendar .day.weekend { background: #F7F8F5; }
.calendar .dn { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); padding: 0 4px 4px; }
.calendar .day.today .dn { color: var(--forest-deep); background: var(--sonne); border-radius: 10px; display: inline-block; padding: 0 7px; font-weight: 600; margin-bottom: 4px; }
.ev { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--forest-soft); color: var(--forest); }
.ev:hover { filter: brightness(.96); }
.ev.Ferien { background: #E7E4F3; color: #4B3F8A; }
.ev.Sitzung { background: var(--line-2); color: var(--ink-2); }
.ev.Elternkontakt { background: #E2EEF6; color: #1F5878; }
.ev.Ausflug { background: #EEF3DA; color: #556313; }
.ev.pruefung { background: var(--sonne-soft); color: var(--sonne-ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--forest-soft); }
.legend .Ferien::before { background: #E7E4F3; }
.legend .Sitzung::before { background: var(--line); }
.legend .Elternkontakt::before { background: #CFE2EE; }
.legend .Ausflug::before { background: #DDE7B5; }
.legend .pruefung::before { background: var(--sonne); }

/* ---------- Mitteilungen ---------- */
.msg { padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.msg:last-child { border-bottom: 0; }
.msg.unread { box-shadow: inset 4px 0 0 var(--sonne); background: #FFFCF3; }
.msg h3 { margin: 0 0 3px; font-size: 16px; font-weight: 600; }
.msg .meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.msg .body { margin-top: 8px; white-space: pre-wrap; max-width: 72ch; }
.msg .msg-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ---------- Schüler*in ---------- */
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 0; }
.dl dt { color: var(--ink-2); font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.dl dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line-2); white-space: pre-wrap; }
.journal { list-style: none; padding: 0; margin: 0; }
.journal li { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.journal li:last-child { border-bottom: 0; }
.journal .meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.journal .text { margin-top: 4px; white-space: pre-wrap; max-width: 75ch; }

/* ---------- Dialoge & Meldungen ---------- */
.overlay { position: fixed; inset: 0; background: rgba(23, 36, 30, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.dialog { background: var(--panel); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 18px 50px rgba(20, 35, 28, .28); animation: pop .14s ease-out; }
.dialog.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px; }
.dialog header h2 { font: 600 21px/1.2 var(--display); margin: 0; }
.dialog .content { padding: 12px 20px 6px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.dialog footer .left { margin-right: auto; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 14px; max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: pop .14s ease-out; }
.toast.err { background: var(--bad); }
.toast.warn { background: var(--amber); }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); }
.login-side { background: var(--forest); color: var(--forest-ink); padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-side .big { margin: 0; line-height: 0; }
.login-side .big .wm { width: clamp(220px, 30vw, 380px); height: auto; color: #fff; }
.login-side .big + p { font-size: 18px; color: #C5D7CD; margin: 14px 0 0; max-width: 34ch; }
.login-side .symbol { position: absolute; right: -40px; bottom: -70px; width: min(46vw, 440px); color: var(--sonne); pointer-events: none; }
.login-side .symbol svg { width: 100%; height: auto; display: block; }
.login-side .foot { font-size: 13px; color: #9FB8AB; position: relative; }
.login-form { padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; background: var(--panel); }
.login-form h2 { font: 600 26px/1.2 var(--display); margin: 0 0 6px; }
.login-form form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-form .btn { height: 42px; }
.demo-box { margin-top: 26px; font-size: 13.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 16px; }
.demo-box table { border-collapse: collapse; margin-top: 6px; width: 100%; }
.demo-box td { padding: 4px 8px 4px 0; }
.demo-box button { background: none; border: 0; padding: 0; color: var(--forest); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 13.5px; }

/* ---------- Notenausweis (Druck) ---------- */
.report { background: #fff; max-width: 820px; padding: 48px 56px; border: 1px solid var(--line); border-radius: 4px; }
.report .rhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--forest); padding-bottom: 14px; margin-bottom: 22px; }
.report .rhead .school { font: 600 26px/1.1 var(--display); color: var(--forest); }
.report .rhead .school .wm { width: 150px; height: auto; display: block; color: var(--forest); }
.report .rhead .school small { display: block; font: 13px/1.4 var(--sans); color: var(--ink-2); margin-top: 4px; white-space: pre-line; }
.report h1 { font: 600 24px/1.2 var(--display); margin: 0 0 4px; }
.report .person { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 16px 0 22px; font-size: 14.5px; }
.report .person span { color: var(--ink-2); }
.report table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.report th { text-align: left; border-bottom: 1px solid var(--ink); padding: 6px 4px; font-size: 13px; }
.report td { border-bottom: 1px solid var(--line); padding: 7px 4px; }
.report td.n, .report th.n { text-align: right; font-variant-numeric: tabular-nums; }
.report td.final { font: 600 17px/1 var(--display); text-align: right; }
.report .sig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 56px; font-size: 12.5px; color: var(--ink-2); }
.report .sig div { border-top: 1px solid var(--ink); padding-top: 6px; }
.report .disclaimer { margin-top: 22px; font-size: 12px; color: var(--ink-3); }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .report { border: 0; padding: 0; max-width: none; }
  .panel { border: 0; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Mobil ---------- */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 22px 22px 60px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--forest); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 30; }
  .topbar .wordmark { padding: 0; }
  .topbar .wordmark .wm { width: 104px; }
  .topbar .wordmark .wm-sub { display: none; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; height: 34px; padding: 0 12px; }
  .sidebar { position: fixed; inset: 0 22% 0 0; z-index: 40; height: 100%; transform: translateX(-102%); transition: transform .18s ease-out; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(23, 36, 30, .35); }
  .toolbar .field { flex: 1 1 140px; }
  .toolbar .field .input { width: 100%; min-width: 0; }
  .roll li { flex-direction: column; align-items: stretch; gap: 8px; }
  .roll .seg { display: flex; }
  .roll .seg button { flex: 1; }
  .page-head .actions { width: 100%; }
  .main { padding: 18px 14px 60px; }
  .page-head h1, .greeting h1 { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-side { padding: 34px 26px; min-height: 230px; }
  .login-side .big .wm { width: 200px; }
  .login-side .symbol { width: 200px; right: -30px; bottom: -40px; }
  .login-form { padding: 30px 24px; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .calendar .day { min-height: 70px; padding: 4px 2px; }
  .ev { font-size: 10.5px; padding: 1px 3px; }
  .subject-row, .subject-head { grid-template-columns: 1fr 52px 52px 52px 16px; padding-left: 14px; padding-right: 14px; }
  .report { padding: 22px; }
  .today-list li { grid-template-columns: 78px 1fr auto; gap: 8px; }
  .today-list .time { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
