/*
 * Erscheinungsbild „frisch und leicht“ – übernommen aus ITC-Tickets: Schrift Sora, weiße Fläche, helle Seitenleiste,
 * runde Kapseln, Flieder als Akzent, große leichte Überschriften. Diese Datei stellt nur Variablen und Bauteile aus
 * app.css um; alle Seiten folgen ohne eigene Änderung.
 */

@font-face { font-family: "Sora"; font-style: normal; font-weight: 300; font-display: swap; src: url("fonts/sora-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/sora-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/sora-latin-600-normal.woff2") format("woff2"); }
/* Ersatzschrift mit den Maßen von Sora, damit beim Nachladen nichts springt */
@font-face { font-family: "Sora Fallback"; src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Helvetica"); size-adjust: 112.24%; ascent-override: 86.43%; descent-override: 25.84%; line-gap-override: 0%; }

:root,
.theme-light {
    --ink: #15171c;
    --paper: #f5f6fa;
    --line: #e4e6ee;
    --peri: #8c9ee8;
    --peri-soft: #c8d1f6;
    --peri-tint: #e9edfc;
    --peri-ink: #2e3e8f;

    --sys-blue: #3460d6;
    --sys-green: #2f9d63;
    --sys-red: #c8342a;
    --sys-orange: #e8973d;
    --sys-gray: #8a90a0;
    --tint-text: #2447a8;

    --label: var(--ink);
    --label-2: #5a6070;
    --label-3: #9aa0b0;
    --bg: #ffffff;
    --bg-2: #ffffff;
    --bg-3: var(--paper);
    --fill: #f0f1f6;
    --fill-strong: #e2e5ee;
    --separator: var(--line);
    --sidebar: var(--paper);
    --bar: rgba(255, 255, 255, 0.94);

    --radius-s: 10px;
    --radius: 14px;
    --radius-l: 20px;

    --bs-body-font-family: "Sora", "Sora Fallback", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-body-line-height: 1.55;
    --bs-link-color-rgb: 36, 71, 168;
    --bs-link-hover-color-rgb: 36, 71, 168;
    --bs-primary-rgb: 52, 96, 214;
    --bs-success-rgb: 47, 157, 99;
    --bs-danger-rgb: 200, 52, 42;
    --bs-warning-rgb: 232, 151, 61;
    --bs-focus-ring-color: rgba(52, 96, 214, 0.22);
}

@media screen and (prefers-color-scheme: dark) {
    :root:not(.theme-light) {
        --ink: #f1f2f6;
        --paper: #1a1c22;
        --line: #2c2f3a;
        --peri-soft: #2b3566;
        --peri-tint: #222a4d;
        --peri-ink: #c8d1f6;

        --sys-blue: #6f8fee;
        --tint-text: #a3b6f5;
        --label: var(--ink);
        --label-2: #a4a9b8;
        --label-3: #6c7182;
        --bg: #111318;
        --bg-2: #171920;
        --bg-3: #1f222b;
        --fill: #22252f;
        --fill-strong: #2e323e;
        --separator: var(--line);
        --sidebar: #0d0f13;
        --bar: rgba(17, 19, 24, 0.94);

        --bs-link-color-rgb: 163, 182, 245;
        --bs-link-hover-color-rgb: 163, 182, 245;
        --bs-primary-rgb: 111, 143, 238;
        --bs-focus-ring-color: rgba(111, 143, 238, 0.35);
    }
}

/* ---------- Schrift: große, leichte Überschriften ---------- */
h1, .h1 { font-size: 2.25rem; font-weight: 300; letter-spacing: -0.015em; line-height: 1.15; }
h2, .h2 { font-size: 1.375rem; font-weight: 400; letter-spacing: 0; }
h3, .h3 { font-size: 1.0625rem; font-weight: 600; }
h4, .h4, h5, .h5 { font-size: 1rem; font-weight: 600; }
h6, .h6 { font-size: 0.9375rem; font-weight: 600; }
@media (max-width: 640.98px) {
    h1, .h1 { font-size: 1.75rem; }
}
b, strong, th, .fw-medium, .fw-semibold, .fw-bold { font-weight: 600 !important; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.btn:hover, .list-group-item:hover, .card:hover, .nav-link:hover { text-decoration: none; }

/* ---------- Flächen: weiß mit feiner Linie statt Schatten ---------- */
.card { box-shadow: none; border: 1px solid var(--line); --bs-card-spacer-y: 1.125rem; --bs-card-spacer-x: 1.25rem; }
a.card { transition: border-color 0.15s, box-shadow 0.15s; }
a.card:hover { border-color: var(--peri); box-shadow: 0 6px 18px rgba(46, 62, 143, 0.1); }
.card.bg-light { border-color: transparent; }
.list-group { box-shadow: none; border: 1px solid var(--line); overflow: hidden; }
.list-group-item { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.table { box-shadow: none; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; }
.table > :not(caption) > * > * { padding: 0.75rem 1rem; border-bottom-width: 1px; }
.table-sm > :not(caption) > * > * { padding: 0.45rem 0.75rem; }
.table > thead th { font-weight: 400; color: var(--label-2); border-bottom-color: var(--line); }
.table > tbody > tr:nth-child(even) > * { background-color: color-mix(in srgb, var(--paper) 60%, var(--bg-2)); }
.table > tbody > tr:hover > * { background-color: var(--peri-tint); }
.stat { font-size: 2rem; font-weight: 300; letter-spacing: -0.02em; }

/* ---------- Knöpfe: Kapseln ---------- */
.btn {
    --bs-btn-font-weight: 400;
    --bs-btn-border-radius: 999px;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 1.25rem;
}
.btn-sm { --bs-btn-border-radius: 999px; --bs-btn-padding-y: 0.3rem; --bs-btn-padding-x: 0.875rem; }
.btn-lg { --bs-btn-border-radius: 999px; --bs-btn-padding-x: 1.75rem; }
.btn-primary, .btn-danger, .btn-success { --bs-btn-font-weight: 600; }
[class*="btn-outline-"] {
    --bs-btn-bg: var(--bg-2);
    --bs-btn-hover-bg: var(--bg-2);
    --bs-btn-active-bg: var(--fill);
    --bs-btn-disabled-bg: var(--bg-2);
    border: 1px solid #dadde6;
}
[class*="btn-outline-"]:hover { border-color: var(--ink); }
.btn-outline-primary { --bs-btn-color: var(--tint-text); --bs-btn-hover-color: var(--tint-text); }
.btn-outline-danger:hover { border-color: var(--sys-red); }
.btn-check:checked + [class*="btn-outline-"], [class*="btn-outline-"].active { background-color: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-link { --bs-btn-padding-x: 0.5rem; }
.btn-group { border-radius: 999px; padding: 4px; background: var(--paper); }
.btn-group > .btn { border-radius: 999px !important; border: 0; }
.btn-group > .btn.btn-secondary, .btn-group > .btn.active, .btn-group > .btn-check:checked + .btn { box-shadow: 0 1px 2px rgba(21, 23, 28, 0.08); font-weight: 600; }

/* ---------- Eingabefelder: getönte Fläche, Rand erst beim Fokus ---------- */
.form-control, .form-select {
    background-color: var(--paper);
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: none;
    padding: 0.5rem 0.75rem;
}
.form-select { padding-right: 2rem; background-position: right 0.6rem center; }
input[type="date"].form-control, input[type="time"].form-control { padding-inline: 0.5rem 0.25rem; font-size: 0.875rem; }
.form-control-sm, .form-select-sm { border-radius: 10px; padding: 0.35rem 0.7rem; }
.form-control:hover, .form-select:hover { border-color: #dadde6; }
.form-control:focus, .form-select:focus { background-color: var(--bg-2); border-color: var(--sys-blue); box-shadow: 0 0 0 3px var(--peri-tint); }
.form-label { font-weight: 400; }
.card.bg-light .form-control, .card.bg-light .form-select, .bg-light .form-control { background-color: var(--bg-2); }
.form-switch .form-check-input:checked { background-color: var(--sys-blue); }
input[type="search"].form-control { border-radius: 999px; padding-left: 1.125rem; }

/* ---------- Hinweise und Abzeichen ---------- */
.alert { border: 0; border-radius: var(--radius); }
.alert-success { background: var(--peri-tint); color: var(--label); }
.badge { font-weight: 400; border-radius: 999px; padding: 0.3em 0.75em; }

/* ---------- Seitenleiste des Personals ---------- */
.page > .sidebar { backdrop-filter: none; -webkit-backdrop-filter: none; border-right: 0 !important; }
.sidebar nav a.nav-link, .sidebar nav .nav-link { border-radius: 12px !important; min-height: 2.5rem; color: #4b5162; }
.sidebar nav a.nav-link:hover { background-color: rgba(255, 255, 255, 0.7) !important; color: var(--ink); }
.sidebar nav a.nav-link.active { background-color: var(--bg-2) !important; color: var(--ink) !important; font-weight: 600 !important; }
.sidebar nav a.nav-link.active .nav-icon { color: var(--ink) !important; filter: none !important; }
.page .top-row { backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0 !important; }
.page .top-row .avatar { background: var(--peri) !important; color: #10183d !important; font-weight: 600; }
@media screen and (prefers-color-scheme: dark) {
    :root:not(.theme-light) .sidebar nav a.nav-link { color: var(--label-2); }
    :root:not(.theme-light) .sidebar nav a.nav-link:hover { background-color: var(--fill) !important; }
}

/* ---------- Begrüßungsbereich der Startseiten ---------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem 2.5rem;
    background: var(--peri-tint);
    border-radius: 36px 36px 36px 96px;
    padding: 2.25rem 2.25rem 2.25rem 2.75rem;
    margin: 0.5rem 0 1.75rem;
}
.hero::before { content: ""; position: absolute; z-index: -1; right: -5.5rem; top: -7.5rem; width: 21rem; height: 21rem; border-radius: 50%; background: var(--peri-soft); }
.hero-text { display: grid; gap: 0.375rem; min-width: 0; }
.hero-hello { margin: 0; color: var(--peri-ink); font-size: 1rem; }
.hero h1 { margin: 0; font-size: clamp(2.25rem, 5vw, 3.75rem); line-height: 1.05; font-weight: 300; letter-spacing: -0.02em; }
.hero-sub { margin: 0; color: var(--label-2); }
.hero-tiles { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero .tile {
    display: grid; gap: 0.125rem; min-width: 9.5rem; padding: 1rem 1.125rem;
    background: var(--bg-2); border-radius: 18px; color: var(--label); text-decoration: none;
    transition: box-shadow 0.15s;
}
.hero a.tile:hover { box-shadow: 0 6px 18px rgba(46, 62, 143, 0.14); text-decoration: none; }
.hero .tile .n { font-size: 1.875rem; font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .tile .l { font-size: 0.8125rem; color: var(--label-2); overflow-wrap: anywhere; hyphens: auto; }
.hero .tile.warn .n { color: #8a4500; }
.hero .tile.bad .n { color: var(--sys-red); }
@media (max-width: 640.98px) {
    .hero { padding: 1.5rem 1.25rem 1.5rem 1.5rem; border-radius: 28px 28px 28px 64px; gap: 1.125rem; }
    .hero::before { width: 12rem; height: 12rem; right: -4rem; top: -5rem; }
    .hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 0.5rem; }
    .hero .tile { min-width: 0; padding: 0.75rem 0.875rem; border-radius: 16px; }
    .hero .tile .n { font-size: 1.5rem; }
}

/* ---------- Elternportal ---------- */
.parent-shell { max-width: 720px; padding-bottom: 6rem; }
.parent-header { background: var(--bar); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0; }
.parent-title { font-weight: 300; font-size: 1.125rem; display: inline-flex; align-items: center; gap: 0.625rem; }
.parent-title::before {
    content: "E"; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--ink); color: var(--bg);
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.8125rem; font-weight: 600; flex: none;
}
.parent-nav a { padding: 0.5rem 1rem; background: var(--bg-2); border: 1px solid #dadde6; color: #4b5162; font-weight: 400; }
.parent-nav a:hover { background: var(--bg-2); border-color: var(--ink); color: var(--ink); }
.parent-nav a.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.parent-shell h1, .parent-shell h1.h3, .parent-shell h1.h4 { font-size: 1.75rem; font-weight: 300; letter-spacing: -0.015em; }
.parent-shell .hero h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); }
.parent-greeting { color: var(--peri-ink); font-size: 1rem; }
.section-title { font-size: 1.125rem; font-weight: 400; color: var(--label); margin: 0 0 0.625rem 0; }
.child-avatar { background: var(--peri) !important; color: #10183d !important; font-weight: 600; }
.action-tile { border: 1px solid var(--line); border-radius: var(--radius-l) !important; box-shadow: none !important; }
.action-tile:hover { border-color: var(--peri); box-shadow: 0 6px 18px rgba(46, 62, 143, 0.1) !important; }
.data-card { border: 1px solid var(--line); border-radius: 24px; padding: 1.5rem; }
.data-card-title { font-size: 1.25rem; font-weight: 400; }
/* Schmal: „Mehr“ bleibt am rechten Rand stehen, auch wenn die Reihe scrollt */
/* Handy (Sammelliste Nr. 108): nichts scrollt und nichts ist verdeckt. Mit „Mehr“ stehen nur Übersicht, der offene
   Bereich und „Mehr“ in der Leiste, in fester Reihenfolge; alle Bereiche stehen unter „Mehr“. Ohne „Mehr“ bricht die Leiste um. */
@media (max-width: 760px) {
    .parent-nav { -webkit-mask-image: none; mask-image: none; padding-right: 0; flex-wrap: wrap; overflow: visible; }
    .parent-nav:has(.nav-more) a:not(:first-child):not(.active):not(.nav-more) { display: none; }
    .parent-nav a.nav-more { margin-left: auto; }
}
/* Sprungleiste der Schülerakte */
.jump-bar { display: flex; gap: 0.375rem; overflow-x: auto; padding: 0.5rem 0; margin: 0.5rem 0 0; background: var(--bg); scrollbar-width: none; }
.jump-bar a { flex: none; padding: 0.3rem 0.875rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); color: var(--label); font-size: 0.8125rem; white-space: nowrap; }
.jump-bar a:hover { text-decoration: none; border-color: var(--peri); }
.jump-target { scroll-margin-top: 1rem; }
.jump-up { margin-left: 0.375rem; font-size: 0.875rem; color: var(--label-2); text-decoration: none; }
.jump-up:hover { color: var(--label); text-decoration: none; }
.hero h1 a.hero-link { color: inherit; text-decoration: none; }
.hero h1 a.hero-link:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }
.child-hint { color: var(--peri-ink); font-size: 0.8125rem; }
/* Finger statt Maus: Tippflächen im Elternportal mindestens 44 px hoch */
@media (pointer: coarse), (max-width: 760px) {
    .parent-shell .btn, .parent-nav a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .parent-header .btn-link { padding-inline: 0.5rem !important; }
    .parent-shell .form-check:not(.form-switch) .form-check-input { width: 1.375rem; height: 1.375rem; }
    .parent-shell .form-switch { padding-left: 3.25rem; min-height: 1.5rem; }
    .parent-shell .form-switch .form-check-input { width: 2.75rem; height: 1.5rem; margin-left: -3.25rem; margin-top: 0; }
}
.parent-shell .badge { font-size: 0.75rem; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover { text-decoration: underline; }
.th-sort:focus-visible { outline: 2px solid var(--sys-blue); outline-offset: 2px; border-radius: 4px; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.5rem; }
.area-tile { display: flex; align-items: center; gap: 0.5rem; min-height: 48px; padding: 0.625rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); color: var(--label); }
.area-tile:hover { text-decoration: none; border-color: var(--peri); color: var(--label); }
.area-tile:focus-visible { outline: 2px solid var(--sys-blue); outline-offset: 2px; }
.child-toggle { display: flex; align-items: center; gap: 0.875rem; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 12px; }
.child-toggle:disabled { cursor: default; color: inherit; }
.child-toggle:focus-visible { outline: 2px solid var(--sys-blue); outline-offset: 4px; }
.child-chevron { color: var(--label-2); font-size: 1.125rem; }
.data-card-sub { font-size: 0.9375rem; font-weight: 600; color: var(--label); }
@media (max-width: 480px) {
    .data-card { padding: 1.125rem; border-radius: 20px; }
    .parent-title { font-size: 0; gap: 0; } /* nur das Zeichen, damit Sprache und Abmelden Platz haben */
}

/* Rückmeldung nach dem Speichern bleibt sichtbar, auch wenn weiter unten gespeichert wurde */
.parent-shell .alert[role="status"], .parent-shell .alert[role="alert"] {
    position: sticky; top: 4.25rem; z-index: 9; box-shadow: 0 8px 24px rgba(21, 23, 28, 0.12);
}
/* Erfolgsmeldungen verschwinden nach einigen Sekunden, damit sie beim Scrollen nichts verdecken (Sammelliste Nr. 103).
   Fehlermeldungen bleiben stehen. */
.parent-shell .alert[role="status"] { animation: alert-leave 0.4s ease 7s forwards; overflow: hidden; }
@keyframes alert-leave {
    to { opacity: 0; visibility: hidden; max-height: 0; padding-block: 0; margin-block: 0; box-shadow: none; }
}
.in-app .parent-shell .alert[role="status"], .in-app .parent-shell .alert[role="alert"] { top: 0.5rem; }

/* Terminliste: Datum in fester Spalte, Uhrzeit darunter (Sammelliste Nr. 126); am Handy schmaler */
.event-when { flex: none; width: 8.75rem; white-space: nowrap; }
@media (max-width: 480px) { .event-when { width: 5.75rem; white-space: normal; } }

/* Zähler in Listen nicht in die Höhe ziehen (Sammelliste Nr. 105) */
.parent-shell .list-group-item .d-flex > .badge { align-self: center; flex: none; }
/* Auswahlpunkte und Häkchen: ganze Zeile als Tippfläche, mindestens 44 px hoch */
.parent-shell .form-check:not(.form-switch):not(.form-check-inline) {
    display: flex; align-items: center; gap: 0.625rem; min-height: 44px; padding-left: 0;
}
.parent-shell .form-check:not(.form-switch):not(.form-check-inline) .form-check-input { float: none; margin: 0; flex: none; }
.parent-shell .form-check:not(.form-switch):not(.form-check-inline) .form-check-label { flex: 1; padding-block: 0.625rem; cursor: pointer; }

/* In der App: Kopfzeile der Anmeldeseite scrollt mit, statt durchscheinend über dem Text zu stehen (Sammelliste Nr. 120) */
.in-app .parent-header { position: static; }

.testmode-banner strong { margin-right: 0.3em; }
.testmode-banner { background: #fff1df; color: #8a4500; border-radius: 999px; padding: 0.4rem 1rem; }
@media screen and (prefers-color-scheme: dark) {
    :root:not(.theme-light) .testmode-banner { background: #3a2a14; color: #f3c58c; }
}

@media print {
    .hero { background: none; padding: 0; border-radius: 0; }
    .hero::before { display: none; }
}

/* ---------- Handy: breite Tabellen scrollen in sich, nicht die ganze Seite ---------- */
@media (max-width: 760px) {
    .table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table > :not(caption) > * > * { padding: 0.6rem 0.75rem; }
    .table td, .table th { white-space: nowrap; }
    .table td.text-wrap, .table td .text-wrap { white-space: normal; }
    main, article.content { min-width: 0; max-width: 100vw; overflow-x: clip; }
}

/* ---------- Tablet und schmale Fenster: Was breiter ist als der Inhaltsbereich, scrollt dort – nicht die ganze Seite ---------- */
.page > main { min-width: 0; }
@media (min-width: 760.02px) {
    .page > main > article.content { overflow-x: auto; }
}

/* ---------- Dunkelmodus: lesbare Navigation und Kennzahlen ---------- */
@media screen and (prefers-color-scheme: dark) {
    :root:not(.theme-light) .parent-nav a { color: var(--label-2); border-color: var(--line); }
    :root:not(.theme-light) .parent-nav a:hover { color: var(--label); border-color: var(--label-2); }
    :root:not(.theme-light) .parent-nav a.active { color: var(--bg); background: var(--ink); border-color: var(--ink); }
    :root:not(.theme-light) .hero .tile.warn .n { color: #f3c58c; }
    :root:not(.theme-light) [class*="btn-outline-"] { border-color: var(--line); }
    :root:not(.theme-light) [class*="btn-outline-"]:hover { border-color: var(--label-2); }
    :root:not(.theme-light) .form-control:hover, :root:not(.theme-light) .form-select:hover { border-color: var(--line); }
}

/* Planversuch (Sammelliste Nr. 131): Stunde liegt an einem anderen Platz als heute */
.plan-moved { background: #fff3cd; border-radius: .25rem; }
