* { box-sizing: border-box; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #222;
    margin: 0;
    padding: 0 0 40px 0;
}
.hauptnav {
    background: #2c3e50;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hauptnav a { color: #fff; }
h1 { padding: 0 24px; margin-top: 24px; }

.login-box {
    max-width: 380px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
}
.login-box input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.login-box button {
    background: #2c3e50;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.fehler { color: #c0392b; font-weight: bold; }
.erfolg { color: #27ae60; font-weight: bold; }

.filterleiste {
    padding: 0 24px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.filterleiste input, .filterleiste select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.button-neu {
    background: #27ae60;
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
}

.personen-tabelle {
    width: calc(100% - 48px);
    margin: 0 24px;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.personen-tabelle th, .personen-tabelle td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.personen-tabelle th { background: #ecf0f1; }
.personen-tabelle tr.gesperrt { background: #dcdcdc; color: #666; }
.personen-tabelle tr.gesperrt:hover { background: #cfcfcf; }

.kopfzeile-mit-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}
.kopfzeile-mit-button h1 { padding: 0; }
.button-zurueck {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.seiten-layout {
    display: flex;
    gap: 20px;
    padding: 0 24px;
    align-items: flex-start;
}
.gruppen-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 16px;
}
.gruppen-sidebar h3 { margin-top: 0; font-size: 1em; }
.gruppen-sidebar ul { list-style: none; padding: 0; margin: 0 0 16px 0; }
.gruppen-sidebar li { margin-bottom: 6px; }
.gruppen-sidebar a { text-decoration: none; color: #2c3e50; }
.gruppen-sidebar a.aktiv { font-weight: bold; color: #e67e22; }
.inhalt-bereich { flex: 1; min-width: 0; }

form { padding: 0 24px; max-width: 900px; }
fieldset {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
}
.status-fieldset { border-color: #e67e22; }
legend { font-weight: bold; padding: 0 8px; }
.formzeile {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.formzeile label {
    display: flex;
    flex-direction: column;
    font-size: 0.85em;
    color: #555;
    flex: 1;
    min-width: 180px;
}
.formzeile input, .formzeile select, .formzeile textarea {
    margin-top: 4px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}
.berechnet-feld input { background: #f0f0f0; color: #777; }
.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
}
.info-klein { font-size: 0.85em; color: #777; }
.hinweis-gesperrt {
    margin: 0 24px 16px 24px;
    padding: 12px 16px;
    background: #fdecea;
    border-left: 4px solid #c0392b;
    border-radius: 4px;
}
.button-speichern {
    background: #2c3e50;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}
.button-abbrechen {
    margin-left: 12px;
    color: #555;
}

/* --- Layout mit Sidebar (Übersicht) --- */
.layout-mit-sidebar {
    display: flex;
    gap: 20px;
    padding: 0 24px;
    align-items: flex-start;
}
.hauptbereich { flex: 1; min-width: 0; }
.hauptbereich h1 { padding: 0; margin: 0 0 16px; }

/* --- Werkzeugleiste der Übersicht sitzt als übergeordnetes Element über der
   ganzen Breite (Sidebar + Tabelle), nicht innerhalb von .layout-mit-sidebar -
   deshalb eigener Seitenrand wie bei .hauptnav. Der Titel der aktuellen
   Gruppe/des Filters erscheint stattdessen als Überschrift über der Tabelle
   (siehe .hauptbereich h1). --- */

/* --- Werkzeugleiste der Übersicht (Suche, Spalten, Export, Import, Gruppen) ---
   Eine einzige Karte statt mehrerer separater Zeilen/Boxen, damit die Übersicht
   nicht durcheinander wirkt. */
.uebersicht-werkzeuge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 10px 16px;
    margin: 0 24px 16px;
}
.werkzeuge-suchgruppe {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.werkzeuge-live-filter {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.werkzeuge-suche {
    display: flex;
    gap: 8px;
    padding: 0;
    max-width: none;
}
.werkzeuge-suche input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.werkzeuge-suche-button {
    background: #ecf0f1;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 1em;
    line-height: 1;
}
.werkzeuge-suche-button:hover { background: #dfe4e6; }

/* "Öffnen"/"Löschen" wirken auf die in der Tabelle ausgewählte Zeile -
   grau/nicht anwählbar ohne Auswahl, schwarz/anwählbar sobald eine
   Zeile angeklickt wurde (siehe Zeilenauswahl-Skript). */
.werkzeuge-auswahl-button {
    background: #ecf0f1;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 0.95em;
    color: #000;
    cursor: pointer;
}
.werkzeuge-auswahl-button:hover:not(:disabled) { background: #dfe4e6; }
.werkzeuge-auswahl-button:disabled {
    color: #aaa;
    background: #f4f5f7;
    cursor: not-allowed;
}
.werkzeuge-hinweis {
    color: #999;
    font-size: 1.15em;
    cursor: help;
}

/* Spalten/Export als Popover-Menü (natives <details>, kein JS nötig) */
.werkzeuge-dropdown { position: relative; }
.werkzeuge-dropdown summary { list-style: none; }
.werkzeuge-dropdown summary::-webkit-details-marker { display: none; }
.werkzeuge-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 10;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    padding: 14px 16px;
    min-width: 240px;
}
.werkzeuge-popover form { padding: 0; max-width: none; }
.werkzeuge-popover-liste {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}
.werkzeuge-popover-liste a {
    color: #2c3e50;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 4px;
    white-space: nowrap;
}
.werkzeuge-popover-liste a:hover { background: #ecf0f1; }
.werkzeuge-neue-gruppe {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.werkzeuge-neue-gruppe input {
    flex: 1;
    min-width: 160px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.werkzeuge-popover-link {
    display: block;
    color: #2c3e50;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 4px;
    border-top: 1px solid #eee;
    padding-top: 12px;
    white-space: nowrap;
}
.werkzeuge-popover-link:hover { background: #ecf0f1; }

.spalten-checkboxen {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 0 0 12px;
}
.spalten-checkboxen label { font-size: 0.9em; }

.button-sekundaer {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
}

/* --- Formular-Kopfzeile mit Zurück-Button --- */
.formular-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}
.formular-kopf h1 { padding: 0; }

/* --- Gruppen-Checkboxen im Personenformular --- */
.gruppen-checkboxen {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 4px;
}
.gruppen-checkboxen .checkbox-label { min-width: auto; }

/* --- Import-Seite --- */
.info-box {
    margin: 0 24px 16px 24px;
    padding: 14px 18px;
    background: #eef4fb;
    border-left: 4px solid #2c3e50;
    border-radius: 4px;
}
.info-box p { margin: 6px 0; }
.import-form {
    margin: 0 24px 16px 24px;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0;
    max-width: none;
}

/* --- Kleiner Link-Button (z.B. Gruppe löschen) --- */
.link-button {
    background: none;
    border: none;
    color: #c0392b;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 1em;
}

/* --- Reiter-Navigation (Allgemein / Aufnahmeprozess / Ämter) --- */
.reiter-nav {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    margin: 16px 0 20px 0;
    border-bottom: 2px solid #ddd;
}
.reiter-nav a, .reiter-nav button.reiter-tab, .reiter-nav .reiter-deaktiviert, .reiter-nav span.aktiv {
    padding: 10px 18px;
    text-decoration: none;
    color: #2c3e50;
    border-radius: 6px 6px 0 0;
    font-size: 0.95em;
}
.reiter-nav button.reiter-tab {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.reiter-nav a:hover, .reiter-nav button.reiter-tab:hover { background: #ecf0f1; }
.reiter-nav a.aktiv, .reiter-nav button.reiter-tab.aktiv, .reiter-nav span.aktiv {
    background: #2c3e50;
    color: #fff;
    font-weight: bold;
}
.reiter-nav .reiter-deaktiviert {
    color: #aaa;
    cursor: not-allowed;
}

/* --- Datei-Upload-Hinweis (Bewerbung PDF) --- */
.datei-vorhanden {
    margin-top: 8px;
    font-size: 0.85em;
    color: #555;
}
.datei-vorhanden a { color: #2c3e50; }

/* --- Sortier-/filter-/breitenverstellbare Übersichtstabelle --- */
/* Wrapper übernimmt Rand/Schatten der Tabelle und scrollt horizontal,
   sobald die Spalten (Mindestbreiten oder manuell gezogen) nicht mehr
   in die verfügbare Breite passen - Spalten werden dadurch nie mehr
   zusammengequetscht oder überlagern sich. */
/* #spaltenFilterForm ist nur ein struktureller Wrapper um die Tabelle (keine
   Eingabezeile wie andere Formulare) - die allgemeine form-Regel (Innenabstand,
   max-width) würde die Tabelle unnötig einrücken und auf 900px begrenzen. */
#spaltenFilterForm {
    padding: 0;
    max-width: none;
}
.tabellen-scroll-wrapper {
    margin: 0;
    overflow-x: auto;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    background: #fff;
}
.tabellen-scroll-wrapper .personen-tabelle-anpassbar {
    margin: 0;
    box-shadow: none;
}
.personen-tabelle-anpassbar {
    table-layout: fixed;
    width: auto;
    min-width: 100%; /* füllt den Wrapper, kann aber darüber hinaus wachsen (-> Scrollbalken) */
}
.personen-tabelle-anpassbar th {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 90px; /* verhindert, dass Spalten beim Ziehen kollabieren/überlagern */
}
.spalten-titel-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: bold;
    display: block;
}
.spalten-titel-link:hover { text-decoration: underline; }
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
}
.resize-handle:hover { background: #bbb; }
/* "Öffnen"/"Löschen" sind in die Werkzeugleiste gewandert, dafür wird
   die passend ausgewählte Tabellenzeile hervorgehoben. */
.personen-tabelle-anpassbar tbody tr[data-id] { cursor: pointer; }
.personen-tabelle-anpassbar tbody tr.zeile-ausgewaehlt { background: #dbe9ff; }
.personen-tabelle-anpassbar tbody tr.zeile-ausgewaehlt:hover { background: #cfe0fa; }
.personen-tabelle-anpassbar tbody tr.gesperrt.zeile-ausgewaehlt { background: #c9d6e8; }
.personen-tabelle-anpassbar th.spalte-checkbox,
.personen-tabelle-anpassbar td.spalte-checkbox { width: 36px; min-width: 36px; text-align: center; }
.spalte-checkbox input[type="checkbox"] { cursor: pointer; }

/* --- Löschen-Bereich im Personenformular --- */
.loeschen-bereich {
    padding: 0 24px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.button-loeschen {
    background: #fff;
    color: #c0392b;
    border: 1px solid #c0392b;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}
.button-loeschen:hover { background: #fdecea; }

/* --- Passwort-Reset (Benutzerverwaltung) --- */
.passwort-reset summary { cursor: pointer; }
.passwort-reset-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    padding: 0;
    max-width: none;
}
.passwort-reset-form input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 160px;
}
