/*
 * Schullaufbahn – Gestaltung
 * Ruhig, gut lesbar, große Tippflächen fürs iPad.
 * Bewusst ohne externe Schriften oder Dienste (Datenschutz, läuft auch ohne Internet im Schulnetz).
 */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --text: #1c2733;
    --muted: #5d6b79;
    --border: #dde3e9;
    --border-strong: #c5ced8;
    --accent: #1d5c8f;
    --accent-hover: #164a74;
    --accent-soft: #e7f0f8;
    --accent-text: #174a73;
    --conf: #6b4fa0;
    --conf-soft: #f2edf9;
    --fb: #1d6f66;
    --fb-hover: #155a52;
    --fb-soft: #e4f3f0;
    --good: #1f7a4a;
    --good-soft: #e6f4ec;
    --warn: #8a5a00;
    --warn-soft: #fff4dc;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .9em; }
mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 .1em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }

/* ---------- Kopfzeile ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .03em;
    flex: none;
}
.brand__mark--large { width: 56px; height: 56px; border-radius: 14px; font-size: 1.25rem; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text small { color: var(--muted); font-size: .75rem; }

.mainnav { display: flex; gap: .25rem; }
.mainnav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}
.mainnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mainnav a.is-active { color: var(--accent-text); background: var(--accent-soft); }
.mainnav a.mainnav__search { display: none; }

.topsearch { flex: 1; min-width: 180px; max-width: 320px; margin-left: auto; }
.usermenu { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.usermenu__name { font-weight: 600; }
.usermenu__logout { color: var(--muted); }

@media (max-width: 860px) {
    .topsearch { display: none; }
    .mainnav a.mainnav__search { display: inline-flex; }
    .usermenu { margin-left: auto; }
    .brand__text small { display: none; }
}
@media (max-width: 600px) {
    .topbar__inner { gap: .25rem .5rem; }
    .mainnav { order: 3; width: 100%; overflow-x: auto; }
}

/* ---------- Seitenaufbau ---------- */

.page { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.narrow { max-width: 720px; }
.pagehead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin: .25rem 0 1.25rem;
}
.pagehead h2 { margin: 0; }
.pagehead p { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.section-title { display: flex; align-items: center; gap: .5rem; margin: 1.75rem 0 .75rem; font-size: 1.05rem; }
.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }
@media (max-width: 900px) { .layout-split { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Knöpfe ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: var(--tap);
    padding: .55rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color .15s, border-color .15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-ghost { background: transparent; color: var(--danger); }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.btn--small { min-height: 36px; padding: .3rem .75rem; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.iconbtn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}
.iconbtn[disabled] { opacity: .3; cursor: default; }
form.inline { display: inline-flex; gap: .25rem; }

/* ---------- Formulare ---------- */

.field { margin-bottom: 1rem; }
.field > label { display: block; margin-bottom: .3rem; font-size: .9rem; font-weight: 600; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=file], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: .55rem .7rem;
    font: inherit;
    font-size: 16px; /* kleiner würde das iPad beim Antippen hineinzoomen */
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
input[type=file] { padding: .45rem; }
textarea { resize: vertical; line-height: 1.45; }
select {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235d6b79' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29, 92, 143, .18);
}
.field__help { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); }
.field__errors { list-style: none; margin: .35rem 0 0; padding: 0; color: var(--danger); font-size: .875rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: .6rem; margin: .5rem 0; cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--accent); }
.field--check { margin-bottom: .75rem; }
.field--check .field__help { margin-left: 1.9rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.form-actions:first-child { margin-top: 0; }

/* ---------- Karten, Hinweise ---------- */

.card {
    margin-bottom: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card__title { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin: 0 0 .75rem; font-size: 1.05rem; }
.card--link { display: block; color: var(--text); }
.card--link:hover { border-color: var(--accent); text-decoration: none; }
.card--link p { margin: 0; color: var(--muted); }
.card--form { border-color: #cbd9e8; background: linear-gradient(#f9fbfe, #fff 60%); }

.flash { margin-bottom: 1rem; padding: .75rem 1rem; border-radius: var(--radius-sm); font-weight: 500; }
.flash--success { background: var(--good-soft); color: var(--good); }
.flash--error { background: var(--danger-soft); color: var(--danger); }

.banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    border-radius: var(--radius);
}
.banner--conference { background: var(--conf-soft); border: 1px solid #ddd2f0; }
.banner--warning { background: var(--warn-soft); border: 1px solid #f0dca8; }

.callout { margin: 1rem 0; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: .95rem; }
.callout ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.callout--warning { background: var(--warn-soft); }
.callout--danger { background: var(--danger-soft); color: #7a1a12; }

.empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty h2 { color: var(--text); }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.checklist { margin: 0 0 1.25rem; padding-left: 1.2rem; }
.checklist li { margin-bottom: .3rem; }
.details summary { min-height: 32px; font-weight: 600; cursor: pointer; }
.details[open] summary { margin-bottom: .75rem; }

/* ---------- Kennzeichen ---------- */

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: .8rem;
    font-weight: 700;
    vertical-align: middle;
}
.tag {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: #eef1f4;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
a.tag:hover { text-decoration: none; filter: brightness(.96); }
.tag--conference { background: var(--conf-soft); color: var(--conf); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.count {
    display: inline-block;
    min-width: 1.6rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: #eef1f4;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
    text-align: center;
}

/* ---------- Klassen-Kacheln ---------- */

.gradegroup { margin-bottom: 1.25rem; }
.gradegroup__title, .sidebar__title {
    margin: 0 0 .6rem;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.tile {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-height: 76px;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
}
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile__name { font-size: 1.35rem; font-weight: 700; }
.tile__meta { color: var(--muted); font-size: .85rem; }
.tiles--students { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile--student .tile__name { font-size: 1rem; }

/* ---------- Listen ---------- */

.rowlist {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.rowlist li + li { border-top: 1px solid var(--border); }
.rowlist__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    padding: .8rem 1rem;
    color: var(--text);
}
.rowlist__item:hover { background: var(--surface-2); text-decoration: none; }
.rowlist__main { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.rowlist__aside { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.rowlist .empty { border: 0; border-radius: 0; }
.chevron { color: var(--border-strong); font-size: 1.4rem; line-height: 1; }
@media (max-width: 560px) { .rowlist__date { display: none; } }

.sidebar .muted { font-size: .9rem; }
.mini-entry {
    display: block;
    margin-bottom: .5rem;
    padding: .7rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}
.mini-entry:hover { border-color: var(--accent); text-decoration: none; }
.mini-entry__head { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.mini-entry__text { display: block; margin: .2rem 0; font-size: .875rem; }
.mini-entry__meta { display: block; color: var(--muted); font-size: .75rem; }

/* ---------- Schülerseite ---------- */

.pagehead--student h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.pager {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    padding: 2px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
.pager__btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 210px;
    min-height: 40px;
    padding: 0 .7rem;
    border-radius: 6px;
    color: var(--text);
    font-size: .9rem;
}
.pager__btn:hover { background: var(--surface-2); text-decoration: none; }
.pager__btn > span[aria-hidden] { color: var(--accent); font-size: 1.35rem; line-height: 1; }
.pager__btn.is-disabled { opacity: .35; }
.pager__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager__pos { padding: 0 .35rem; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .pager__name { display: none; } }

.entryform__actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.entryform__footer { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem 1rem; flex-wrap: wrap; }
.entryform__footer .field { width: 190px; margin-bottom: 0; }
.entryform__footer .form-actions { margin-top: 0; }
@media (max-width: 560px) {
    .entryform__footer .field { width: 100%; }
    .entryform__footer > .btn, .entryform__actions .btn { flex: 1; }
}

/* Kategorie-Auswahl als anklickbare Blöcke (Radio-Buttons, optisch ersetzt) */
.choice-chips {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .5rem;
}
.choice-chips input[type=radio] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.choice-chips label {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 52px;
    margin: 0;
    padding: .55rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .12s, border-color .12s;
}
.choice-chips label::before {
    content: "";
    flex: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
}
.choice-chips label:hover { border-color: var(--accent); background: var(--surface-2); }
.choice-chips input:checked + label {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
    color: var(--accent-text);
    font-weight: 600;
}
.choice-chips input:checked + label::before {
    border-color: var(--accent);
    background: radial-gradient(circle, var(--accent) 0 4px, var(--surface) 5px);
}
.choice-chips input:focus-visible + label { outline: 3px solid rgba(29, 92, 143, .35); outline-offset: 2px; }
.has-error .choice-chips label { border-color: var(--danger); }
@media (max-width: 420px) { .choice-chips { grid-template-columns: 1fr; } }

.category { padding: 0; overflow: hidden; scroll-margin-top: 80px; }
.category__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: .85rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.category__head h2 { margin: 0; font-size: 1.05rem; }
.category__hint { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }
.category__tools { display: flex; align-items: center; gap: .5rem; flex: none; }
.category__empty { margin: 0; padding: .85rem 1.25rem; color: var(--muted); font-size: .9rem; }
.category > .entry { padding: .9rem 1.25rem; }
.category > .entry + .entry { border-top: 1px solid var(--border); }

.entry { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 1rem; scroll-margin-top: 80px; }
.entry__date { display: flex; flex-direction: column; font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.entry__class { color: var(--muted); font-size: .8rem; font-weight: 400; }
.entry__text { overflow-wrap: anywhere; }
.entry__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .6rem;
    margin-top: .35rem;
    color: var(--muted);
    font-size: .8rem;
}
.entry__edit { margin-left: auto; font-weight: 600; }
.entry--conference { box-shadow: inset 3px 0 0 var(--conf); }
.result .entry--conference, .conf-entry .entry--conference { padding-left: .75rem; }
.entry:target { background: #fffbea; }
@media (max-width: 560px) {
    .entry { grid-template-columns: 1fr; gap: .2rem; }
    .entry__date { flex-direction: row; gap: .5rem; }
}

/* ---------- Konferenz-Modus ---------- */

.is-conference .topbar { position: static; }
.confbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin: -.25rem 0 1.25rem;
    padding: .6rem .75rem .6rem 1rem;
    background: var(--conf);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(60, 40, 100, .25);
}
.confbar__info { display: flex; flex-direction: column; line-height: 1.25; }
.confbar__label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.confbar__nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.confbar .btn--secondary { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.confbar .btn--secondary:hover { background: rgba(255, 255, 255, .24); }
.confbar__jump { width: auto; min-width: 210px; max-width: 280px; }
@media (max-width: 600px) { .confbar__jump { min-width: 0; flex: 1; } }

.conf-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); gap: 1.5rem; align-items: start; }
.conf-layout__side {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 110px);
    overflow: auto;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
@media (max-width: 900px) {
    .conf-layout { grid-template-columns: 1fr; }
    .conf-layout__side { position: static; max-height: none; }
}
.history { padding: .4rem 0; border-top: 1px solid var(--border); }
.history:first-of-type { border-top: 0; }
.history summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
    font-size: .9rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}
.history summary::-webkit-details-marker { display: none; }
.history__item { display: grid; grid-template-columns: 84px 1fr; gap: .5rem; padding: .3rem .25rem; font-size: .875rem; }
.history__item.is-current { background: var(--conf-soft); border-radius: 6px; }
.history__date { color: var(--muted); font-variant-numeric: tabular-nums; }
.conf-entry { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.conf-entry:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.conf-entry > .tag { margin-bottom: .4rem; }

/* ---------- Feedback-Modus ---------- */

.btn--feedback { background: var(--fb); color: #fff; }
.btn--feedback:hover { background: var(--fb-hover); }
.tag--feedback { background: var(--fb-soft); color: var(--fb); }
.plainlist { margin: 0; padding-left: 1.1rem; }
.plainlist li { margin: .25rem 0; }

.is-feedback .topbar { position: static; }
.fbbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin: -.25rem 0 1.25rem;
    padding: .6rem .75rem .6rem 1rem;
    background: var(--fb);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(20, 80, 70, .25);
}
.fbbar__info { display: flex; flex-direction: column; line-height: 1.25; }
.fbbar__label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.fbbar__nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.fbbar .btn--secondary { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.fbbar .btn--secondary:hover { background: rgba(255, 255, 255, .24); }
.fbbar__jump { width: auto; min-width: 210px; max-width: 280px; }
@media (max-width: 600px) { .fbbar__jump { min-width: 0; flex: 1; } }

.fbform__meta { display: grid; grid-template-columns: 220px 1fr; gap: 0 1.5rem; align-items: start; }
.fbform__meta .field { margin-bottom: 0; }
@media (max-width: 600px) { .fbform__meta { grid-template-columns: 1fr; gap: .75rem; } }

.fbsection { border-left: 4px solid var(--fb); }
.fbsection__title { display: flex; align-items: center; gap: .6rem; margin: 0 0 .25rem; font-size: 1.05rem; }
.fbsection__nr {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--fb-soft);
    color: var(--fb);
    font-size: .85rem;
    font-weight: 700;
}
.fbsection__prompt { margin: 0 0 .6rem; color: var(--muted); font-size: .92rem; }
.fbsection__closing { margin: 0 0 .75rem; font-weight: 500; }
.fbsignatures { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .fbsignatures { grid-template-columns: 1fr; } }

.fbactions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem 1rem;
    flex-wrap: wrap;
    margin: 0 -1rem;
    padding: .75rem 1rem;
    background: rgba(244, 246, 248, .94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(6px);
}
.fbactions .muted { margin-right: auto; }
.fbcard { border-left: 4px solid var(--fb); }

/* Schreibfläche */
.hw { margin-top: .5rem; }
.hw + .hw { margin-top: .9rem; }
.hw__label { margin-bottom: .25rem; font-size: .88rem; font-weight: 600; }
.hw__canvas {
    display: block;
    width: 100%;
    background: #fffef9;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.finger-writing .hw__canvas { touch-action: none; }
.hw.is-filled .hw__canvas { border-color: #b9c9d6; }
.hw__tools { display: flex; justify-content: flex-end; gap: .25rem; margin-top: .3rem; }
.hwbtn {
    min-height: 34px;
    padding: .2rem .6rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}
.hwbtn:hover { background: var(--surface-2); color: var(--text); }

/* Ausdruck des Protokolls */
.fbprint { margin-bottom: .7rem; padding: .4rem .6rem .2rem; border: 1px solid #999; break-inside: avoid; }
.fbprint h3 { margin: 0 0 .15rem; font-size: 10.5pt; }
.fbprint__prompt { margin: 0 0 .2rem; color: #444; font-size: 9pt; }
.fbprint__label { margin-top: .2rem; font-size: 9pt; font-weight: 600; }
.fbprint__closing { margin: .8rem 0 .4rem; }
.fbprint__signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; break-inside: avoid; }
.fbprint__signatures .hw-svg { border-bottom: 1px solid #333; }
.fbprint__name { color: #555; font-size: 8.5pt; }
.hw-svg { display: block; width: 100%; height: auto; }

/* ---------- Suche & Filter ---------- */

.searchform, .filterbar {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0 1rem;
    align-items: end;
}
.searchform .field, .filterbar .field { margin-bottom: 0; }
@media (max-width: 760px) {
    .searchform, .filterbar { grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
    .searchform__q, .searchform__submit, .filterbar .field:first-child, .filterbar__submit { grid-column: 1 / -1; }
}
.result { padding: .9rem 1.25rem; }
.result__head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* ---------- Verwaltung ---------- */

.subnav { display: flex; flex-wrap: wrap; gap: .25rem; margin: .5rem 0 1.25rem; border-bottom: 1px solid var(--border); }
.subnav a {
    margin-bottom: -1px;
    padding: .6rem .8rem;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 500;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0 1.25rem; }
.stat {
    display: flex;
    flex-direction: column;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
}
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat__value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--muted); font-size: .85rem; }
.stat--good .stat__value { color: var(--good); }
.stat--warn .stat__value { color: var(--warn); }

.tablewrap {
    overflow-x: auto;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th {
    padding: .65rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { color: var(--muted); }
.table tr.is-expired td { background: var(--danger-soft); }
.table__actions { text-align: right; white-space: nowrap; }
.table__order { width: 1%; white-space: nowrap; }
.table--compact th, .table--compact td { padding: .4rem .6rem; }

/* ---------- Anmeldung ---------- */

.is-login { background: linear-gradient(160deg, #e6eff8 0%, var(--bg) 65%); }
.is-login .page { display: grid; place-items: center; min-height: 100vh; }
.login { width: 100%; max-width: 380px; }
.login__brand { margin-bottom: 1.25rem; text-align: center; }
.login__brand h1 { margin-top: .75rem; }
.login__brand p { color: var(--muted); }
.login__card { padding: 1.5rem; }
.login__note { margin-top: 1rem; color: var(--muted); font-size: .85rem; text-align: center; }

/* ---------- Druckansicht ---------- */

.is-print { background: #e7eaee; }
.printbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem 1rem;
    flex-wrap: wrap;
    max-width: 210mm;
    margin: 0 auto 1rem;
}
.printbar .muted { order: 3; flex-basis: 100%; font-size: .85rem; }
.printdoc {
    max-width: 210mm;
    margin: 0 auto;
    padding: 16mm 15mm;
    background: #fff;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .12);
    font-size: 10.5pt;
    line-height: 1.4;
}
.printdoc__head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid #222;
}
.printdoc__school { color: #555; font-size: 9pt; }
.printdoc h1 { margin: .1rem 0; font-size: 16pt; }
.printdoc__sub { margin: 0; color: #444; font-size: 9.5pt; }
.printdoc__stamp { display: flex; flex-direction: column; color: #444; font-size: 8.5pt; text-align: right; }
.printdoc__stamp strong { color: #a11; letter-spacing: .08em; text-transform: uppercase; }
.printstudent { margin-bottom: 1.2rem; }
.printstudent h2 { margin: 1rem 0 .4rem; padding-bottom: .2rem; border-bottom: 1px solid #999; font-size: 13pt; break-after: avoid; }
.printsection { margin-bottom: .6rem; }
.printsection h3 { margin: .5rem 0 .25rem; font-size: 10.5pt; break-after: avoid; }
.printsection h3 span { color: #555; font-weight: 400; }
.printsection--student h3 { padding-bottom: .15rem; border-bottom: 1px solid #999; font-size: 11.5pt; }
.printsection__empty { margin: 0 0 .3rem; color: #888; }
.printentry {
    display: grid;
    grid-template-columns: 26mm 1fr;
    gap: 3mm;
    padding: .2rem 0;
    border-top: 1px solid #e3e3e3;
    break-inside: avoid;
}
.printentry__date { font-variant-numeric: tabular-nums; }
.printentry__date span { color: #666; font-size: 8.5pt; }
.printentry__meta { color: #666; font-size: 8.5pt; }

@media print {
    @page { size: A4; margin: 14mm 13mm; }
    body, .is-print { background: #fff; }
    .no-print, .topbar, .printbar, .flash, .card--form, .confbar, .fbbar, .fbactions { display: none !important; }
    .page { max-width: none; margin: 0; padding: 0; }
    .printdoc { max-width: none; padding: 0; box-shadow: none; }
    .card, .tablewrap, .rowlist { box-shadow: none; }
    a { color: inherit; }
}
