/* =============================================
   Systemchen – Globales App CSS
   ============================================= */

:root {
    --green-dark: #2d5016;
    --green: #4a7c23;
    --green-light: #7ab648;
    --brown: #6b4226;
    --brown-light: #a67c52;
    --cream: #faf6ee;
    --cream-dark: #f0e8d8;
    --text: #2c2c2c;
    --text-light: #5a5a5a;
    --white: #ffffff;
    --red: #c0392b;
    --red-light: #fdecea;
    --blue: #2980b9;
    --blue-light: #ebf5fb;
    --orange: #e67e22;
    --orange-light: #fef5e7;
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--cream);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* App Header */
.app-header {
    background: var(--green-dark);
    color: var(--white);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-logo {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    color: var(--white);
    text-decoration: none;
}

.app-header-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.app-header-nav a {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 600;
}

.app-header-nav a:hover { color: var(--white); text-decoration: none; }

.app-header-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.app-header-user .user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.app-header-user .user-role {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--green);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--green-dark);
    text-decoration: none;
}

.btn-secondary {
    background: var(--cream-dark);
    color: var(--text);
}
.btn-secondary:hover { background: #e5dcc8; text-decoration: none; }

.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover { background: #a93226; text-decoration: none; }

.btn-sm {
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--green);
    color: var(--green);
}
.btn-outline:hover {
    background: var(--green);
    color: var(--white);
    text-decoration: none;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 10px var(--shadow);
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--cream-dark);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--green);
}

/* Passwort anzeigen (app/js/password-toggle.js) */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 3rem; }
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
}
.pw-toggle:hover { color: var(--green); background: var(--cream); }
.pw-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow);
}

th, td {
    padding: 0.8rem 1rem;
    text-align: left;
}

th {
    background: var(--green-dark);
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
}

tr:nth-child(even) {
    background: var(--cream);
}

tr:hover {
    background: var(--cream-dark);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.2);
}

.alert-success {
    background: #eafaf1;
    color: #1e8449;
    border: 1px solid rgba(30, 132, 73, 0.2);
}

.alert-info {
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid rgba(41, 128, 185, 0.2);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-admin { background: var(--red-light); color: var(--red); }
.badge-teacher { background: var(--blue-light); color: var(--blue); }
.badge-student { background: var(--orange-light); color: var(--orange); }
.badge-active { background: #eafaf1; color: #1e8449; }
.badge-inactive { background: var(--cream-dark); color: var(--text-light); }

/* Layout */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 1.8rem;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
}

.login-card h1 {
    color: var(--green-dark);
    margin-bottom: 0.3rem;
    font-size: 2rem;
}

.login-card .login-subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.login-card .form-group {
    text-align: left;
}

.login-card .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.login-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.login-footer a {
    color: var(--green);
}

/* Responsive */
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   Anmeldung (alle Rollen) – im Stil der Startseite
   ============================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 1rem;
    background:
        linear-gradient(135deg, rgba(45, 80, 22, 0.88) 0%, rgba(74, 124, 35, 0.78) 100%),
        url('../img/hero_waldschule_teich.jpg') center / cover no-repeat;
}
.auth-card {
    background: var(--white);
    border-radius: 18px;
    padding: 2.5rem 2.25rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.auth-brand { text-align: center; margin-bottom: 1.6rem; }
.auth-brand a { color: var(--green-dark); text-decoration: none; }
.auth-brand h1 { font-size: 2rem; color: var(--green-dark); margin-bottom: 0.2rem; }
.auth-brand p { color: var(--text-light); font-family: 'Lora', Georgia, serif; font-style: italic; }
.auth-card .form-group { text-align: left; }
.auth-card .btn-block { width: 100%; padding: 0.8rem; font-size: 1.05rem; margin-top: 0.4rem; }
.auth-steps { display: flex; gap: 6px; justify-content: center; margin: -0.6rem 0 1.2rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.auth-steps span { padding: 3px 10px; border-radius: 999px; background: var(--cream-dark); color: var(--text-light); font-weight: 700; }
.auth-steps span.now { background: var(--green); color: #fff; }
.auth-code { font-size: 1.8rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-note { font-size: 0.85rem; color: var(--text-light); line-height: 1.55; margin-top: 1.2rem; text-align: center; }
.auth-links { margin-top: 1.4rem; text-align: center; font-size: 0.9rem; }
.auth-links a { color: var(--green); font-weight: 600; }
.auth-legal { margin-top: 1.2rem; text-align: center; font-size: 0.85rem; }
.auth-legal a { color: rgba(255,255,255,0.85); margin: 0 0.4rem; }
.btn-link { background: none; border: none; color: var(--green); font-weight: 700; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.practice-banner { background: var(--orange-light); color: #8a4b0f; border-bottom: 2px solid var(--orange); padding: 0.5rem 1rem; text-align: center; font-weight: 700; font-size: 0.9rem; }
@media print {
    .no-print, .app-header, .legal-footer, #sc-feedback-btn { display: none !important; }
    body { background: #fff; }
    .print-sheet { box-shadow: none !important; }
}

/* =============================================
   Icons (Lucide, lokales Sprite app/img/icons.svg)
   ============================================= */
.icon {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    flex-shrink: 0;
    display: inline-block;
}
.icon-sm { width: 1em; height: 1em; vertical-align: -0.125em; }
.icon-lg { width: 1.5em; height: 1.5em; vertical-align: -0.35em; }
.icon-xl { width: 2em; height: 2em; vertical-align: -0.5em; }
.icon-2xl { width: 2.6em; height: 2.6em; }
.btn .icon { margin-right: 0.35em; }
.btn-icon .icon { margin-right: 0; }
.admin-ui .alert { display: flex; gap: 0.6rem; align-items: flex-start; }
.alert > .icon { margin-top: 0.2em; }

/* =============================================
   Lehrer*innen- und Admin-Oberflaeche (body.admin-ui)
   Ein Layout fuer beide: Kopfzeile, Seitentitel, Karten, Tabellen, Formulare.
   ============================================= */
.admin-ui {
    --bg: #f5f4ef;
    --surface: #ffffff;
    --surface-2: #f8f7f3;
    --border: #e4e1d8;
    --border-strong: #d3cfc2;
    --muted: #5f6368;
    --focus: #4a7c23;
    --r: 10px;
    background: var(--bg);
    font-size: 15px;
    display: flex;
    flex-direction: column;
}
.admin-ui h1, .admin-ui h2, .admin-ui h3, .admin-ui h4 { font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 800; }
.admin-ui :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.admin-ui .legal-footer { margin-top: auto; }

.skip-link { position: absolute; left: -9999px; top: 0; background: #fff; padding: 0.5rem 1rem; z-index: 200; }
.skip-link:focus { left: 1rem; top: 0.5rem; }

/* --- Kopfzeile --- */
.topbar { background: var(--green-dark); color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 0 rgba(0,0,0,0.08); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; height: 58px; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: #fff; font-family: 'Lora', Georgia, serif; font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-icon { width: 1.35em; height: 1.35em; color: #a8d47c; }
.brand-tag { font-family: 'Nunito', sans-serif; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(255,255,255,0.16); padding: 0.15rem 0.5rem; border-radius: 999px; }
.topbar-collapse { flex: 1; display: flex; align-items: center; gap: 1rem; min-width: 0; }
.topnav { display: flex; gap: 0.15rem; flex: 1; }
.topnav a { display: inline-flex; align-items: center; gap: 0.45rem; color: rgba(255,255,255,0.82); font-weight: 700; font-size: 0.92rem; padding: 0.5rem 0.8rem; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.topnav a.is-active { background: rgba(255,255,255,0.16); color: #fff; }
.topnav .icon { opacity: 0.9; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.nav-toggle { display: none; margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff; border-radius: 8px; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer; }
.nav-toggle .icon { width: 1.4em; height: 1.4em; }

.btn-practice { background: var(--orange); color: #fff; display: inline-flex; align-items: center; }
.btn-practice:hover, .btn-practice.is-active { background: #cf6d17; color: #fff; text-decoration: none; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; color: #fff; font-weight: 700; font-size: 0.92rem; padding: 0.45rem 0.7rem; border-radius: 8px; user-select: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: rgba(255,255,255,0.12); }
.user-menu-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,0.14); padding: 0.35rem; z-index: 120; }
.user-menu-head { padding: 0.55rem 0.75rem 0.6rem; border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; display: flex; flex-direction: column; }
.user-menu-head span { font-size: 0.78rem; color: var(--muted); }
.user-menu-panel a { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; border-radius: 6px; color: var(--text); font-weight: 600; }
.user-menu-panel a:hover { background: var(--surface-2); text-decoration: none; }

@media (max-width: 1020px) {
    .topbar-inner { height: auto; min-height: 58px; flex-wrap: wrap; gap: 0; }
    .nav-toggle { display: inline-flex; }
    .topbar-collapse { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 0.4rem 0 0.9rem; gap: 0.6rem; }
    .topbar.is-open .topbar-collapse { display: flex; }
    .topnav { flex-direction: column; }
    .topnav a { padding: 0.7rem 0.8rem; }
    .topbar-right { margin-left: 0; flex-direction: column; align-items: stretch; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 0.7rem; }
    .topbar-right .btn-practice { justify-content: center; padding: 0.6rem; }
    .user-menu-panel { position: static; margin-top: 0.4rem; box-shadow: none; }
}

/* --- Seite --- */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.75rem 1.25rem 2.5rem; flex: 1 0 auto; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.admin-ui .page-title { font-size: 1.6rem; color: var(--green-dark); margin: 0; display: flex; align-items: center; gap: 0.55rem; line-height: 1.25; }
.page-title .icon { color: var(--green); width: 1.05em; height: 1.05em; }
.page-lead { color: var(--muted); margin-top: 0.3rem; max-width: 70ch; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; }

/* --- Karten --- */
.admin-ui .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 1px 2px rgba(0,0,0,0.04); padding: 1.25rem 1.4rem; }
.card + .card, .section + .section { margin-top: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-title { font-size: 1.1rem; color: var(--text); margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.card-title .icon { color: var(--green); }
.card-sub { color: var(--muted); font-size: 0.88rem; }
.card-flush { padding: 0 !important; overflow: hidden; }
.card-flush > .card-head { padding: 1rem 1.4rem 0; }
.card-foot { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.card-danger { border-color: rgba(192, 57, 43, 0.35) !important; }
.section { margin-bottom: 1.5rem; }
.section-title { font-size: 1.15rem; color: var(--text); margin-bottom: 0.7rem; display: flex; align-items: center; gap: 0.5rem; }
.mt { margin-top: 1.25rem; }

.cols { display: grid; gap: 1.25rem; }
.cols + .cols, .cols + .card, .card + .cols { margin-top: 1.25rem; }
.cols > .card + .card { margin-top: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

/* Kennzahlen */
.stat { display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: #edf5e6; color: var(--green); flex-shrink: 0; }
.stat-icon .icon { width: 1.4em; height: 1.4em; }
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; color: var(--text); }
.stat-label { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.stat-blue .stat-icon { background: var(--blue-light); color: var(--blue); }
.stat-orange .stat-icon { background: var(--orange-light); color: #b9600f; }
.stat-brown .stat-icon { background: #f4ece4; color: var(--brown); }
a.stat-link { color: inherit; display: block; }
a.stat-link:hover { text-decoration: none; border-color: var(--border-strong); }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list-main { flex: 1; min-width: 0; }
.list-meta { color: var(--muted); font-size: 0.85rem; }
.icon-bubble { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--green); flex-shrink: 0; }
.quick-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-ui .quick-actions .btn { justify-content: flex-start; }

/* --- Buttons --- */
.admin-ui .btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0.55rem 1.1rem; font-size: 0.92rem; line-height: 1.3; border: 1px solid transparent; white-space: nowrap; }
.admin-ui .btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.admin-ui .btn-primary:hover { color: #fff; }
.admin-ui .btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.admin-ui .btn-secondary:hover { background: var(--surface-2); }
.admin-ui .btn-ghost { background: transparent; color: var(--text); }
.admin-ui .btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.admin-ui .btn-danger-outline { background: var(--surface); border-color: rgba(192,57,43,0.45); color: var(--red); }
.admin-ui .btn-danger-outline:hover { background: var(--red-light); text-decoration: none; }
.admin-ui .btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-icon { width: 34px; height: 34px; padding: 0 !important; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font: inherit; }
.btn-icon:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); text-decoration: none; }
.btn-icon.danger:hover { background: var(--red-light); border-color: rgba(192,57,43,0.3); color: var(--red); }
.btn-icon .icon { width: 1.15rem; height: 1.15rem; }

/* --- Tabellen --- */
.admin-ui .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.admin-ui .card .table-wrap { border: 0; border-radius: 0; margin: 0 -1.4rem; }
.admin-ui .card-flush .table-wrap { margin: 0; }
.admin-ui table { width: 100%; border-collapse: collapse; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; font-size: 0.92rem; }
.admin-ui th, .admin-ui td { padding: 0.65rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.admin-ui .card th:first-child, .admin-ui .card td:first-child { padding-left: 1.4rem; }
.admin-ui .card th:last-child, .admin-ui .card td:last-child { padding-right: 1.4rem; }
.admin-ui th { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.admin-ui tr { background: transparent; }
.admin-ui tbody tr:nth-child(even) { background: #fbfaf7; }
.admin-ui tbody tr:hover { background: #f2f6ee; }
.admin-ui tbody tr:last-child td { border-bottom: 0; }
.admin-ui td.num, .admin-ui th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-ui td.center, .admin-ui th.center { text-align: center; }
.admin-ui td.actions, .admin-ui th.actions { text-align: right; white-space: nowrap; width: 1%; }
.admin-ui td.nowrap { white-space: nowrap; }
.admin-ui td.wrap { white-space: pre-wrap; max-width: 420px; }
.admin-ui td.check, .admin-ui th.check { width: 1%; }
.admin-ui table.table-plain th { background: transparent; }
.row-actions { display: inline-flex; gap: 0.15rem; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline-flex; margin: 0; }
.admin-ui tr.row-danger, .admin-ui tr.row-danger:nth-child(even) { background: #fff6f5; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; padding: 0.8rem 1.4rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 800; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.admin-ui code { font-family: ui-monospace, Consolas, monospace; font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); padding: 0 0.3rem; border-radius: 4px; }

/* Aufklapp-Menue in Tabellenzeilen */
.popover { position: relative; display: inline-block; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 250px; background: #fff; border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,0.14); padding: 0.8rem; text-align: left; white-space: normal; }
.popover-panel form { display: flex; gap: 0.4rem; align-items: center; }
.popover-panel .stack { display: flex; flex-direction: column; gap: 0.5rem; }
.popover-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; margin-bottom: 0.4rem; }

/* --- Formulare --- */
.admin-ui .form-group { margin-bottom: 1rem; }
.admin-ui .form-group label, .admin-ui .label { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 0.3rem; color: var(--text); }
.admin-ui .form-control { border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.55rem 0.8rem; font-size: 0.95rem; }
.admin-ui .form-control:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,35,0.15); }
.admin-ui .form-control-sm { padding: 0.35rem 0.6rem; font-size: 0.88rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.form-hint { font-size: 0.84rem; color: var(--muted); margin-top: 0.3rem; line-height: 1.5; }
.form-inline { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.admin-ui .form-inline .form-group { margin: 0; flex: 1; min-width: 180px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; align-items: end; }
.admin-ui .filters .form-group { margin: 0; }

/* Schalter (an/aus) */
.switch { display: inline-flex; align-items: center; gap: 0.55rem; background: none; border: 0; padding: 0.2rem; cursor: pointer; font: inherit; font-weight: 700; font-size: 0.88rem; color: var(--text); }
.switch-track { width: 42px; height: 24px; border-radius: 999px; background: #cfcabd; position: relative; transition: background 0.2s; flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left 0.2s; }
.switch[aria-checked="true"] .switch-track { background: var(--green); }
.switch[aria-checked="true"] .switch-track::after { left: 21px; }
.switch.is-partial .switch-track { background: #b7d39a; }
.switch.is-partial .switch-track::after { left: 12px; }

/* --- Abzeichen / Status --- */
.admin-ui .badge { display: inline-flex; align-items: center; gap: 0.3rem; text-transform: none; letter-spacing: 0; font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.admin-ui .badge .icon { width: 0.95em; height: 0.95em; vertical-align: -0.1em; }
.badge-success { background: #e6f4ea; color: #1e7b3c; }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-info { background: var(--blue-light); color: #1f6b9c; }
.badge-warning { background: var(--orange-light); color: #a6560c; }
.badge-neutral { background: #eeece6; color: var(--muted); }
.yes { color: #1e7b3c; font-weight: 700; white-space: nowrap; }
.no { color: var(--red); font-weight: 700; white-space: nowrap; }
.dots { display: inline-flex; gap: 0.2rem; vertical-align: middle; }
.dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eeece6; color: var(--muted); }
.dot .icon { width: 0.85rem; height: 0.85rem; }
.dot-done { background: #e6f4ea; color: #1e7b3c; }
.stars { color: #c98a0b; display: inline-flex; gap: 1px; white-space: nowrap; }
.stars .icon { width: 0.95em; height: 0.95em; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.mod-chip { color: var(--mod, var(--green)); background: #fff; border-color: var(--mod, var(--green)); }

/* --- Meldungen --- */
.admin-ui .alert { font-weight: 600; border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1.1rem; }
.admin-ui .alert ul { margin: 0.3rem 0 0 1.2rem; font-weight: 400; }
.alert-warning { background: var(--orange-light); color: #8a4b0f; border: 1px solid rgba(230,126,34,0.3); }

/* --- Tabs / Segmente --- */
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1rem; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--green-dark); border-bottom-color: var(--green); }
.tabs .count { background: var(--red); color: #fff; font-size: 0.72rem; border-radius: 999px; padding: 0 0.45rem; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 1rem; }
.segmented a { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.85rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 700; font-size: 0.86rem; }
.segmented a:hover { text-decoration: none; background: var(--surface-2); }
.segmented a.is-active { background: var(--green); border-color: var(--green); color: #fff; }

/* Leerer Zustand */
.empty-state { text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
.empty-state .icon { color: #b9b4a6; margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 0.8rem; }
.empty-state p:last-child { margin-bottom: 0; }

/* Fortschrittsbalken */
.bar { height: 8px; background: #eeece6; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.bar-mid > span { background: var(--orange); }
.bar-low > span { background: var(--red); }

/* Zeitstrahl */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ''; position: absolute; left: 0.45rem; top: 0.3rem; bottom: 0.3rem; width: 2px; background: var(--border); }
.timeline-date { position: relative; font-weight: 800; margin: 1.2rem 0 0.5rem; }
.timeline-date:first-child { margin-top: 0; }
.timeline-date::before { content: ''; position: absolute; left: -1.43rem; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.timeline-event { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; padding: 0.45rem 0; border-bottom: 1px dashed var(--border); font-size: 0.92rem; }
.timeline-event .time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3rem; }

/* Diagramme */
.chart { width: 100%; height: 260px; display: block; }
.chart-lg { height: 350px; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; cursor: pointer; border: 1px solid var(--c, #999); background: #fff; user-select: none; font-family: inherit; color: var(--text); }
.legend-item.off { opacity: 0.35; }
.legend-swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #999); }

/* Chat (aeltere Module) */
.chat-thread { display: flex; flex-direction: column; gap: 0.6rem; }
.bubble { max-width: 80%; padding: 0.6rem 0.9rem; border-radius: 12px; font-size: 0.92rem; }
.bubble-student { background: var(--blue-light); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-open { border-left: 3px solid var(--red); }
.bubble-teacher { background: #eaf6ee; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.reply-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.reply-form .form-control { flex: 1; }

/* Modul-Kacheln (Uebungsmodus) */
.module-tile { display: flex; flex-direction: column; gap: 0.5rem; border-top: 4px solid var(--mod, var(--green)) !important; }
.tile-icon { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--mod, var(--green)); background: var(--mod-light, #edf5e6); flex-shrink: 0; }
.tile-icon .icon { width: 1.5em; height: 1.5em; }
.tile-icon-sm { width: 32px; height: 32px; border-radius: 8px; }
.tile-icon-sm .icon { width: 1.15em; height: 1.15em; }
.module-tile h3 { font-size: 1.1rem; margin: 0.2rem 0 0; }
.module-tile p { color: var(--muted); font-size: 0.9rem; flex: 1; }
.module-tile .meta { font-size: 0.82rem; color: var(--muted); }
.module-tile .btn { align-self: flex-start; }
.is-inactive { opacity: 0.75; }
.mod-name { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; }

/* Personen-Kopf */
.person { display: flex; align-items: center; gap: 0.9rem; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; flex-shrink: 0; }

/* Definitionsliste */
.dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 0.6rem 0; border-top: 1px solid var(--border); margin: 0; }
.dl dt { font-weight: 700; }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }

/* Zugangsdaten zum Ausdrucken */
.cred-sheet { background: #fff; border: 2px dashed var(--green-light); border-radius: var(--r); padding: 1.25rem 1.4rem; margin-bottom: 1.5rem; }
.cred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.cred-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; break-inside: avoid; page-break-inside: avoid; }
.cred-card .n { font-weight: 800; font-size: 1.1rem; color: var(--green-dark); display: flex; align-items: center; gap: 0.4rem; }
.cred-card .k { font-size: 0.8rem; color: var(--muted); }
.cred-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.6rem; margin-top: 0.4rem; }
.cred-card dt { font-size: 0.8rem; color: var(--muted); }
.cred-card dd { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; font-weight: 700; margin: 0; }
.cred-card .u { font-size: 0.7rem; color: var(--muted); margin-top: 0.4rem; word-break: break-all; }

.legal-footer { text-align: center; font-size: 0.85rem; color: #5a5a5a; padding: 1.5rem 1rem 2rem; }

@media print {
    .topbar, .skip-link { display: none !important; }
    body.print-creds .page > *:not(.cred-sheet) { display: none !important; }
    .cred-sheet { border: none; padding: 0; }
    .cred-card { border: 1px solid #999; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
form.inline { display: inline-flex; margin: 0; }
.btn-icon.is-on { color: var(--green); }
details.details-block { display: block; }
details.details-block > summary { list-style: none; display: inline-flex; }
details.details-block > summary::-webkit-details-marker { display: none; }
details.details-block[open] { background: var(--surface); }
details.details-block .table-wrap { border: 1px solid var(--border) !important; border-radius: var(--r) !important; margin: 0.8rem 0 0 !important; }
.card-body-pad { padding: 1.2rem 1.4rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.auth-leaf { color: var(--green); width: 0.95em; height: 0.95em; vertical-align: -0.12em; }
@media (max-width: 1400px) and (min-width: 1021px) {
    .topbar-inner { gap: 1rem; }
    .topnav .icon { display: none; }
    .topnav a { padding: 0.5rem 0.55rem; }
    .user-menu-name { max-width: 110px; }
}
@media (max-width: 480px) {
    .brand-tag { font-size: 0.6rem; padding: 0.1rem 0.4rem; }
    .brand { font-size: 1.05rem; }
    .topbar-inner { padding: 0 1rem; }
}
.class-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin: -0.4rem 0 1.25rem; }
.class-switch .segmented { margin: 0; }
.seg-count { font-size: 0.75rem; opacity: 0.75; font-weight: 700; }
.status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; max-width: 340px; }
.unpublished { display: flex; gap: 0.4rem; align-items: flex-start; background: var(--orange-light); color: #8a4b0f; border: 1px solid rgba(230,126,34,0.35); border-radius: 8px; padding: 0.4rem 0.6rem; font-size: 0.82rem; line-height: 1.4; }
.unpublished .icon { margin-top: 0.1em; color: var(--orange); }
.level-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.level-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.level-seg button { border: 0; border-left: 1px solid var(--border-strong); background: transparent; padding: 0.5rem 0.85rem; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 6.5rem; text-align: left; }
.level-seg button:first-child { border-left: 0; }
.level-seg button:hover { background: var(--surface-2); }
.level-seg .lv { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.level-seg .ln { font-weight: 700; font-size: 0.92rem; }
.level-seg button.is-on { background: #e6f1dc; }
.level-seg button.is-current { background: var(--green); color: #fff; }
.level-seg button.is-current .lv { color: rgba(255,255,255,0.85); }
.level-seg button:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.saved-note { display: inline-flex; align-items: center; gap: 0.3rem; color: #1e7b3c; font-weight: 700; font-size: 0.85rem; animation: saved-fade 3s ease forwards; }
@keyframes saved-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .saved-note { animation: none; } }
