:root {
  --green: #2f6f4f;
  --green-dark: #1f4d36;
  --bg: #f6f7f5;
  --card: #ffffff;
  --border: #e1e4e0;
  --text: #1c1f1d;
  --muted: #6b7268;
  --yellow: #caa53d;
  --red: #b5473f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header.topbar {
  background: var(--green-dark);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

nav.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav.tabs a {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0.85;
}

nav.tabs a.active, nav.tabs a:hover {
  background: rgba(255,255,255,0.18);
  opacity: 1;
}

main {
  padding: 20px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.stat .num { font-size: 26px; font-weight: 700; color: var(--green-dark); }
.stat .label { font-size: 12px; color: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

tr:hover td { background: #fafbfa; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

button, .btn {
  background: var(--green);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

button.secondary { background: #e7e9e5; color: var(--text); }
button.danger { background: var(--red); }
button:hover { filter: brightness(1.08); }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.gray { background: #e7e9e5; color: #555; }
.pill.blue { background: #dceafe; color: #1d4ed8; }
.pill.green { background: #dcf3e3; color: #1e6b3a; }
.pill.yellow { background: #fbf0d2; color: #8a6d1c; }
.pill.red { background: #fbdedb; color: #9c2c22; }

.actions button { margin-right: 6px; padding: 4px 10px; font-size: 12px; }

/* Modal form */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal {
  background: white; border-radius: 10px; padding: 20px 22px;
  width: 100%; max-width: 640px;
}
.modal h3 { margin-top: 0; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input[type=text], .field input[type=number], .field input[type=email],
.field input[type=date], .field input[type=datetime-local], .field select, .field textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
  font-family: inherit;
}
.field textarea { min-height: 60px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.multi-options label { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; color: var(--muted); }

/* Auth-Seiten (Admin-Login / Schueler-Portal-Login) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px; margin-bottom: 12px; text-align: center;
  letter-spacing: 1px; box-sizing: border-box;
}
.auth-card button { width: 100%; padding: 10px; font-size: 14px; }
.auth-error { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 16px; }
.auth-switch { margin-top: 18px; font-size: 13px; }
.auth-switch a { color: var(--green-dark); }

/* Landing-Seite */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}
.landing-page h1 { font-size: 26px; margin: 0; }
.landing-choices { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.landing-choice {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px 28px; width: 220px; text-decoration: none; color: var(--text);
}
.landing-choice:hover { border-color: var(--green); }
.landing-choice .emoji { font-size: 32px; display: block; margin-bottom: 8px; }
.landing-choice .title { font-weight: 700; margin-bottom: 4px; }
.landing-choice .desc { font-size: 12px; color: var(--muted); }

/* Schueler-Portal */
.portal-content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.content-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fafbfa; }
.content-card h3 { margin: 0 0 6px; font-size: 15px; }
.content-card p { margin: 0 0 8px; font-size: 13px; color: var(--text); white-space: pre-wrap; }
.content-card a { font-size: 12px; }
.star-select { display: flex; gap: 4px; margin-bottom: 12px; }
.star-select button {
  background: none; border: 1px solid var(--border); color: var(--yellow);
  width: 34px; height: 34px; border-radius: 6px; font-size: 16px; cursor: pointer;
}
.star-select button.selected { background: var(--yellow); color: white; border-color: var(--yellow); }
.feedback-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
.feedback-item:last-child { border-bottom: none; }
.feedback-item .response { margin-top: 6px; padding: 8px 10px; background: #f0f5f1; border-radius: 6px; font-size: 13px; }

/* Kalender */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px 8px 0 0; overflow: hidden; }
#calendar-grid.calendar-grid { border-radius: 0 0 8px 8px; }
.calendar-weekday { background: #f0f1ee; padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); text-align: center; }
.calendar-day { background: white; min-height: 92px; padding: 6px; cursor: pointer; }
.calendar-day:hover { background: #fafbfa; }
.calendar-day.other-month { background: #f7f8f6; }
.calendar-day.other-month .cal-day-num { color: var(--muted); }
.calendar-day.today .cal-day-num { background: var(--green); color: white; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-day-num { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event { font-size: 11px; padding: 2px 5px; border-radius: 4px; background: #dcf3e3; color: #1e6b3a; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.blue { background: #dceafe; color: #1d4ed8; }
.cal-event:hover { filter: brightness(0.95); }
@media (max-width: 700px) {
  .calendar-day { min-height: 56px; padding: 4px; }
  .cal-event { font-size: 10px; }
}
