:root {
    --bg: #f6f7fb;
    --card-bg: #ffffff;
    --border: #e2e5ec;
    --text: #26293a;
    --text-muted: #767c93;
    --primary: #4F86C6;
    --primary-dark: #3a6aa3;
    --danger: #e0645b;
    --success: #5fa88a;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 22, 40, 0.08), 0 1px 2px rgba(20,22,40,0.06);
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }

.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.app-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.app-logo { font-weight: 700; font-size: 17px; color: var(--text); }
.app-nav a {
    margin-left: 18px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
}
.app-nav a.active, .app-nav a:hover { color: var(--primary); border-bottom-color: var(--primary); }

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

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 10px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #eef0f6; color: var(--text); }
.btn.secondary:hover { background: #e3e6ee; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c9483f; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

/* ---------- Kalender ---------- */
.kalender-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.kalender-toolbar-links { display: flex; align-items: center; gap: 10px; }
.kalender-titel { font-size: 18px; font-weight: 700; min-width: 190px; text-align: center; }
.ansicht-umschalter { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ansicht-umschalter button {
    background: var(--card-bg); border: none; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.ansicht-umschalter button.active { background: var(--primary); color: #fff; }

.monat-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.monat-wochentag {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    padding-bottom: 4px;
}
.monat-tag {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 92px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.monat-tag.heute { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.monat-tag.ausserhalb { opacity: 0.4; }
.monat-tag-nummer { font-size: 12px; font-weight: 700; color: var(--text-muted); }

.termin-block {
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.termin-block.abgesagt { text-decoration: line-through; opacity: 0.55; }

.klausur-badge {
    background: #fff4e5;
    border: 1px solid #f0c48a;
    color: #8a5a13;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 6px;
}

/* Benutzerdefinierte Termine: pale magenta mit Streifen, kräftig oranger Rahmen */
.termin-block.custom, .woche-termin-block.custom {
    background-image: repeating-linear-gradient(45deg, #f6d9ec, #f6d9ec 7px, #fbeaf5 7px, #fbeaf5 14px);
    border: 2px solid #ff8a00 !important;
    color: #7a2058 !important;
}

/* Notizen mit Fälligkeitsdatum: pale mint mit Streifen, oranger Rahmen */
.termin-block.notiz, .woche-termin-block.notiz {
    background-image: repeating-linear-gradient(45deg, #d6f0e3, #d6f0e3 7px, #eaf8f0 7px, #eaf8f0 14px);
    border: 2px solid #ff8a00 !important;
    color: #14603f !important;
}

/* Auswahl-Modal für neuen Kalendereintrag */
.eintrag-wahl { display: flex; flex-direction: column; gap: 10px; }
.eintrag-wahl button {
    text-align: left;
    padding: 14px 16px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}
.eintrag-wahl button:hover { background: #f8f9fc; }
.eintrag-wahl button .beschreibung { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-muted); margin-top:2px; }

.woche-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.woche-tag {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    min-height: 140px;
}
.woche-tag.heute { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.woche-tag-kopf {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.woche-termin-block {
    border-radius: 6px;
    padding: 6px 8px;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    cursor: pointer;
}
.woche-termin-block .zeit { display: block; font-size: 11px; opacity: 0.9; font-weight: 700; }
.woche-termin-block.abgesagt { text-decoration: line-through; opacity: 0.55; }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,22,40,0.45);
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 100;
}
.modal-overlay.offen { display: flex; }
.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.modal-schliessen { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

.feld { margin-bottom: 14px; }
.feld label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--text-muted); }
.feld input[type=text], .feld input[type=date], .feld input[type=time], .feld input[type=url], .feld select, .feld textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
}
.feld textarea { min-height: 70px; resize: vertical; }
.feld-reihe { display: flex; gap: 12px; }
.feld-reihe .feld { flex: 1; }
.checkbox-feld { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.checkbox-feld input { width: 16px; height: 16px; }
.checkbox-feld label { font-size: 14px; font-weight: 600; margin: 0; color: var(--text); }

.hausaufgabe-hinweis {
    background: #fff8e6;
    border: 1px solid #f0dca0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    color: #7a5b00;
}

.modal-aktionen { display: flex; justify-content: space-between; margin-top: 18px; gap: 10px; flex-wrap: wrap; }
.modal-aktionen-rechts { display: flex; gap: 8px; }

details.erweitert { margin-bottom: 12px; }
details.erweitert summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }

/* ---------- Schüler ---------- */
.schueler-liste { display: flex; flex-direction: column; gap: 10px; }
.schueler-zeile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.schueler-info { display: flex; align-items: center; gap: 12px; }
.farb-punkt { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.schueler-name { font-weight: 700; }
.schueler-meta { font-size: 12.5px; color: var(--text-muted); }
.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    background: #eef0f6;
    color: var(--text-muted);
    margin-left: 6px;
}

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

.profil-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
@media (max-width: 800px) { .profil-grid { grid-template-columns: 1fr; } }

.termin-liste { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.termin-eintrag {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; font-size: 13px;
}
.termin-eintrag:hover { background: #f8f9fc; }
.termin-eintrag .hausaufgabe-marker { color: #b8860b; font-size: 12px; }
.termin-eintrag.abgesagt { text-decoration: line-through; opacity: 0.55; }

.leer-hinweis { color: var(--text-muted); font-size: 13.5px; padding: 12px 0; }

.zoom-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 600; }

/* ---------- Tabs (Schülerprofil) ---------- */
.tab-leiste { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.badge-zahl {
    display: inline-block;
    background: #ff8a00;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 7px;
    margin-left: 4px;
}
.btn.danger.small { background: #fff0ee; color: #b3261e; border: 1px solid #f3c8c2; }
.badge-zahl.badge-antwort { background: #ffb020; color: #4a3200; }
.archiv-toggle {
    display: inline-block;
    margin: 8px 0;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.nachricht-eintrag.von-tutor { background: #f3f6fb; }

/* ---------- Notizen ---------- */
.notiz-liste { display: flex; flex-direction: column; gap: 10px; }
.notiz-karte {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
}
.notiz-karte:hover { background: #f8f9fc; }
.notiz-karte.erledigt { opacity: 0.55; }
.notiz-karte.erledigt .notiz-titel { text-decoration: line-through; }
.notiz-titel { font-weight: 700; margin-bottom: 4px; }
.notiz-inhalt { font-size: 13px; color: var(--text-muted); white-space: pre-wrap; }
.notiz-faellig {
    display: inline-block;
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #14603f;
    background: #eaf8f0;
    border: 1px solid #b8e2c9;
    border-radius: 6px;
    padding: 2px 7px;
}
