:root {
    --primary: #1e40af;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --text: #1e293b;
    --rand: #cbd5e1;
}

* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Anmeldung ---------- */
.login-body { align-items: center; justify-content: center; }
.login-karte {
    background: #fff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    width: min(420px, 92vw);
    margin: auto;
}
.login-karte h1 { margin: 0 0 .25rem; font-size: 1.35rem; color: var(--primary); }
.untertitel { margin: 0 0 1.25rem; color: #64748b; font-size: .875rem; }
.login-karte label { display: block; margin: .85rem 0 .25rem; font-size: .8rem; font-weight: 600; }
.login-karte input { width: 100%; }
.login-karte button { width: 100%; margin-top: 1.25rem; }

/* ---------- Kopf ---------- */
header { background: var(--primary); color: #fff; padding: .9rem 1rem; }
.kopf-inhalt {
    max-width: 1300px; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 1rem;
    justify-content: space-between; align-items: center;
}
header h1 { margin: 0; font-size: 1.2rem; }
.kopf-unterzeile { margin: .15rem 0 0; font-size: .8rem; opacity: .9; }
.kopf-rechts { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.benutzer { font-size: .8rem; }
.ansichten { display: flex; gap: .35rem; flex-wrap: wrap; }
.ansichten a {
    color: #fff; text-decoration: none; font-size: .78rem;
    padding: .35rem .6rem; border-radius: .4rem; background: rgba(255,255,255,.14);
}
.ansichten a.aktiv { background: #fff; color: var(--primary); font-weight: 600; }
.abmelden { color: #fff; font-size: .78rem; text-decoration: underline; }

/* ---------- Inhalt ---------- */
main { max-width: 1300px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem; flex-grow: 1; }

.filterleiste {
    background: #fff; border: 1px solid var(--rand); border-radius: .75rem;
    padding: .85rem 1rem; margin-bottom: 1rem;
    display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
}
.filterleiste label { font-size: .82rem; font-weight: 600; }
.zuruecksetzen { font-size: .8rem; color: var(--primary); }

select, input[type=text], input[type=password], button {
    font: inherit; font-size: .875rem;
    padding: .45rem .65rem; border: 1px solid var(--rand);
    border-radius: .45rem; background: #fff; color: var(--text);
}
select:focus, input:focus { outline: 2px solid rgba(30,64,175,.35); border-color: var(--primary); }
button { background: var(--primary); color: #fff; border: none; cursor: pointer; font-weight: 600; }
button:hover { background: var(--primary-hover); }

/* ---------- Tabelle ---------- */
.tabellen-rahmen {
    background: #fff; border: 1px solid var(--rand);
    border-radius: .75rem; overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .6rem .8rem; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
th {
    background: #f1f5f9; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .05em; color: #475569; white-space: nowrap;
}
th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }
tbody tr:hover { background: #f8fafc; }
td.name { font-weight: 600; }
td.oben { vertical-align: top; }
td.fach { color: var(--primary); font-weight: 600; }
td.fach-kl { color: #7c2d12; }
td.status { font-size: .72rem; color: #64748b; line-height: 1.35; }
td.leer { padding: 2.5rem; text-align: center; color: #94a3b8; }

.klassen-chip {
    background: #e2e8f0; padding: .1rem .45rem;
    border-radius: .3rem; font-size: .72rem; white-space: nowrap;
}

/* ---------- Ampel ---------- */
.ampel-zelle { display: flex; gap: .6rem; flex-wrap: wrap; }
.ampel {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ampel-rot   { color: #9f1239; }
.ampel-gelb  { color: #92400e; }
.ampel-gruen { color: #065f46; }
input.kommentar { width: 100%; min-width: 180px; font-size: .8rem; }

/* ---------- Übersichtskarten ---------- */
.karten { display: flex; flex-wrap: wrap; gap: .4rem; }
.karte {
    display: flex; flex-direction: column; gap: .1rem;
    border: 1px solid var(--rand); border-radius: .5rem;
    padding: .35rem .6rem; font-size: .75rem; max-width: 260px;
}
.karte-rot   { background: #ffe4e6; border-color: #fda4af; color: #9f1239; }
.karte-gelb  { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.karte-gruen { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.karte .klein { font-size: .68rem; opacity: .85; }
.kommentar-text { margin-top: .15rem; font-style: italic; overflow-wrap: anywhere; }

/* ---------- Aktionen & Meldungen ---------- */
.aktionsleiste { margin-top: 1rem; display: flex; justify-content: flex-end; }
.speichern { background: #059669; padding: .6rem 1.2rem; }
.speichern:hover { background: #047857; }

.meldung {
    padding: .8rem 1rem; border-radius: .5rem;
    font-size: .85rem; font-weight: 500; margin: 0 0 1rem;
}
.meldung-erfolg { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.meldung-fehler { background: #ffe4e6; color: #9f1239; border: 1px solid #fda4af; }
.meldung-info   { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

footer {
    background: #fff; border-top: 1px solid #e2e8f0;
    padding: .9rem; text-align: center; font-size: .72rem; color: #64748b;
}

@media (max-width: 640px) {
    .ampel-zelle { flex-direction: column; gap: .3rem; }
    th, td { padding: .5rem; }
}
