:root {
    --gruen: #1e8e5a;
    --gruen-dunkel: #156b43;
    --rot: #c0392b;
    --rot-dunkel: #992d22;
    --blau: #2563eb;
    --blau-dunkel: #1e4fbf;
    --grau-hell: #f4f5f7;
    --grau-mittel: #6b7280;
    --grau-dunkel: #1f2937;
    --rand: #e2e5e9;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--grau-hell);
    color: var(--grau-dunkel);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.container {
    width: 100%;
    max-width: 480px;
}

.karte {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 8px;
}

.hinweistext {
    color: var(--grau-mittel);
    margin: 0 0 24px;
    font-size: 1rem;
}

.fehlertext {
    color: var(--rot);
    font-weight: 600;
    margin-bottom: 16px;
}

.start-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.veranstaltung-tag {
    display: inline-block;
    background: var(--grau-hell);
    color: var(--grau-mittel);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.admin-link, .zurueck-link, .logout-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--grau-mittel);
    text-decoration: none;
    font-size: 0.9rem;
}

.browser-hinweis {
    margin-top: 14px;
    font-size: 0.75rem;
    color: var(--grau-mittel);
    line-height: 1.4;
}

.admin-link:hover, .zurueck-link:hover, .logout-link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    text-decoration: none;
    border: none;
    border-radius: 14px;
    padding: 18px 24px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.05s ease, opacity 0.2s ease;
    color: #fff;
}

.btn:active { transform: scale(0.97); }

.btn-gross {
    width: 100%;
    padding: 22px;
    font-size: 1.3rem;
}

.btn-gruen { background: var(--gruen); }
.btn-gruen:hover { background: var(--gruen-dunkel); }

.btn-rot { background: var(--rot); }
.btn-rot:hover { background: var(--rot-dunkel); }

.btn-blau { background: var(--blau); }
.btn-blau:hover { background: var(--blau-dunkel); }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Numpad */
.anzeige {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    background: var(--grau-hell);
    border: 2px solid var(--rand);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.taste {
    padding: 20px 0;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--rand);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    color: var(--grau-dunkel);
    transition: background 0.1s ease;
}

.taste:active { background: var(--grau-hell); }

.taste-funktion {
    font-size: 1.2rem;
    color: var(--grau-mittel);
}

.btn-bestaetigen { margin-top: 4px; }

/* Bestätigungsseite */
.bestaetigung-karte { padding-top: 40px; }

.icon-erfolg, .icon-warnung {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0 auto 20px;
    color: #fff;
}

.icon-erfolg { background: var(--gruen); }
.icon-warnung { background: #d97706; }

/* Login */
.text-eingabe {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border: 2px solid var(--rand);
    border-radius: 12px;
    margin-bottom: 16px;
}

.flash-box {
    background: #fee2e2;
    color: var(--rot-dunkel);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* Admin-Übersicht (Shell) */
.container:has(.admin-shell) { max-width: 960px; }

.admin-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 18px;
    padding: 20px 26px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.admin-header-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-header h1 {
    font-size: 1.4rem;
    margin: 0;
}

.admin-badge {
    background: linear-gradient(135deg, var(--blau), #4f46e5);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
}

.logout-link {
    color: var(--grau-mittel);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.logout-link:hover {
    background: var(--grau-hell);
    text-decoration: none;
}

.breadcrumb-link {
    display: inline-block;
    color: var(--grau-mittel);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: -8px;
}

.breadcrumb-link:hover { text-decoration: underline; }

/* Bereichsauswahl */
.bereich-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.bereich-karte {
    background: #fff;
    border-radius: 18px;
    padding: 28px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.bereich-karte:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}

.bereich-kuerzel {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--blau), #4f46e5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}

.bereich-name {
    font-size: 0.85rem;
    color: var(--grau-mittel);
    font-weight: 500;
}

/* Veranstaltungen anlegen/auflisten */
.neu-veranstaltung-box { display: block; }

.neu-veranstaltung-form label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.neu-veranstaltung-zeile {
    display: flex;
    gap: 10px;
}

.neu-veranstaltung-zeile .text-eingabe {
    margin-bottom: 0;
}

.veranstaltung-liste {
    display: flex;
    flex-direction: column;
}

.veranstaltung-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px 4px 22px;
    border-bottom: 1px solid var(--rand);
    transition: background 0.1s ease;
}

.veranstaltung-zeile:last-child { border-bottom: none; }

.veranstaltung-zeile:hover { background: #fafbfc; }

.veranstaltung-zeile-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 16px 0;
    text-decoration: none;
    color: inherit;
}

.veranstaltung-zeile-name {
    font-weight: 600;
}

.veranstaltung-zeile-pfeil {
    color: var(--grau-mittel);
    margin-right: 16px;
}

.entfernen-form {
    display: inline-flex;
}

.entfernen-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 10px;
    color: var(--grau-mittel);
    transition: background 0.15s ease, color 0.15s ease;
}

.entfernen-btn:hover {
    background: #fee2e2;
    color: var(--rot);
}

/* Stat-Karten */
.stat-karten {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-karte {
    background: #fff;
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon-blau { background: linear-gradient(135deg, var(--blau), #4f46e5); }
.stat-icon-gruen { background: linear-gradient(135deg, var(--gruen), #22c55e); }

.stat-zahl {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--grau-mittel);
    font-weight: 500;
}

.stat-karte-live {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
}

/* QR-Info-Box */
.qr-info-box {
    background: #fff;
    border-radius: 18px;
    padding: 16px 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.qr-info-box summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
}

.qr-info-zeile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.qr-info-label {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 60px;
}

.qr-info-url {
    background: var(--grau-hell);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    word-break: break-all;
}

.qr-info-hinweis {
    margin: 14px 0 0;
    font-size: 0.8rem;
    color: var(--grau-mittel);
    line-height: 1.5;
}

.modus-schalter {
    background: #fff;
    border-radius: 18px;
    padding: 16px 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.modus-anzeige {
    font-size: 0.9rem;
    color: var(--grau-mittel);
}

.modus-anzeige strong {
    color: var(--grau-dunkel);
}

.qr-bilder-reihe {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.qr-bild-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-bild {
    width: 160px;
    height: 160px;
    background: #fff;
    border: 2px solid var(--rand);
    border-radius: 12px;
    padding: 8px;
}

.admin-toolbar {
    background: #fff;
    border-radius: 18px;
    padding: 16px 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-form label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--grau-mittel);
}

.filter-form input[type="date"] {
    padding: 10px 12px;
    border: 2px solid var(--rand);
    border-radius: 10px;
    font-size: 0.95rem;
}

.toolbar-aktionen {
    display: flex;
    gap: 10px;
}

.loesch-form {
    display: inline-flex;
}

.btn-klein {
    width: auto;
    padding: 10px 18px;
    font-size: 0.9rem;
    border-radius: 10px;
}

.tabellen-karte {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
}

.tabellen-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.92rem;
}

thead th {
    background: var(--grau-hell);
    color: var(--grau-mittel);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--rand);
}

tbody tr {
    border-bottom: 1px solid var(--rand);
    transition: background 0.1s ease;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: #fafbfc; }

.matrikel-zelle {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hinweis-zelle {
    color: var(--grau-mittel);
    font-size: 0.85rem;
}

.leer-hinweis {
    text-align: center;
    color: var(--grau-mittel);
    padding: 40px 0 !important;
}

.status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-fertig { background: #dcfce7; color: var(--gruen-dunkel); }
.status-offen { background: #dbeafe; color: var(--blau-dunkel); }
.status-warnung { background: #fef3c7; color: #92400e; }

.live-hinweis {
    color: var(--gruen);
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.live-hinweis.live-fehler {
    color: var(--rot);
}

.live-hinweis.live-fehler::before {
    content: "Verbindung verloren – ";
    font-weight: 600;
}

@media (max-width: 640px) {
    .admin-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-aktionen { justify-content: stretch; }
    .toolbar-aktionen .btn { flex: 1; text-align: center; }
    .neu-veranstaltung-zeile { flex-direction: column; }
}

/* ---------------------------------------------------------------------
   Dunkles Farbschema, ausschließlich für den Admin-Bereich.
   Die öffentlichen Scan-Seiten bleiben hell.
--------------------------------------------------------------------- */
body.admin-thema {
    background: #0f1117;
    color: #e5e7eb;
}

body.admin-thema .karte,
body.admin-thema .admin-header,
body.admin-thema .stat-karte,
body.admin-thema .admin-toolbar,
body.admin-thema .tabellen-karte,
body.admin-thema .bereich-karte,
body.admin-thema .qr-info-box,
body.admin-thema .modus-schalter {
    background: #1a1d27;
    box-shadow: 0 4px 24px rgba(0,0,0,0.45);
    color: #e5e7eb;
}

body.admin-thema h1 {
    color: #f3f4f6;
}

body.admin-thema .hinweistext,
body.admin-thema .stat-label,
body.admin-thema .filter-form label,
body.admin-thema .hinweis-zelle,
body.admin-thema .bereich-name,
body.admin-thema .qr-info-hinweis,
body.admin-thema .modus-anzeige {
    color: #8b91a3;
}

body.admin-thema .modus-anzeige strong {
    color: #f3f4f6;
}

body.admin-thema thead th {
    background: #20232f;
    color: #8b91a3;
    border-bottom-color: #2a2e3d;
}

body.admin-thema tbody tr,
body.admin-thema .veranstaltung-zeile {
    border-bottom-color: #2a2e3d;
}

body.admin-thema tbody tr:hover,
body.admin-thema .veranstaltung-zeile:hover {
    background: #20232f;
}

body.admin-thema .matrikel-zelle {
    color: #f3f4f6;
}

body.admin-thema .text-eingabe,
body.admin-thema .filter-form input[type="date"] {
    background: #20232f;
    border-color: #2a2e3d;
    color: #e5e7eb;
    color-scheme: dark;
}

body.admin-thema .logout-link,
body.admin-thema .zurueck-link,
body.admin-thema .breadcrumb-link {
    color: #8b91a3;
}

body.admin-thema .logout-link:hover {
    background: #20232f;
}

body.admin-thema .flash-box {
    background: #3b1d1d;
    color: #fca5a5;
}

body.admin-thema .status-fertig { background: #123a24; color: #4ade80; }
body.admin-thema .status-offen { background: #142a4d; color: #60a5fa; }
body.admin-thema .status-warnung { background: #3d2e0a; color: #fbbf24; }

body.admin-thema .leer-hinweis {
    color: #8b91a3;
}

body.admin-thema .qr-info-url {
    background: #20232f;
    color: #e5e7eb;
}

body.admin-thema .veranstaltung-zeile-pfeil {
    color: #8b91a3;
}

body.admin-thema .entfernen-btn {
    color: #8b91a3;
}

body.admin-thema .entfernen-btn:hover {
    background: #3b1d1d;
    color: #fca5a5;
}
