:root {
    --color-bg: #0f1420;
    --color-surface: #1a2233;
    --color-surface-alt: #222c42;
    --color-border: #2f3a52;
    --color-text: #e8ecf4;
    --color-text-muted: #9aa5ba;
    --color-primary: #4f8cff;
    --color-primary-hover: #6ba0ff;
    --color-danger: #ff5d6c;
    --color-success: #3ecf8e;
    --radius: 8px;
    --max-width: 960px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
}

.topbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand { font-weight: 700; font-size: 1.1rem; color: var(--color-text); }

.main-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.state-switch select {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
}

.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.auth-box {
    max-width: 380px;
    margin: 3rem auto;
    padding: 1.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.auth-box h1, .page h1 { font-size: 1.4rem; margin-top: 0; }

form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    height: 2.6rem;
    margin-top: 0.35rem;
    padding: 0.6rem 0.7rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 1rem;
}

textarea {
    height: auto; /* Textareas sollen weiterhin ihre eigene rows-Hoehe behalten */
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Spinner-Pfeile bei Zahlenfeldern ausblenden (z.B. Truppen-/Rallygröße im Anmeldeformular) */
input.no-spinner::-webkit-outer-spin-button,
input.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input.no-spinner {
    -moz-appearance: textfield;
    appearance: textfield;
}

button, .btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.1rem;
    font-size: 1rem;
    cursor: pointer;
}

button:hover, .btn:hover { background: var(--color-primary-hover); }

.btn-danger { background: var(--color-danger); }
.btn-secondary { background: var(--color-surface-alt); border: 1px solid var(--color-border); color: var(--color-text); }

/* Für Buttons/Links, die neben beschrifteten Formularfeldern in einer
   flex-end-Reihe stehen (z.B. Filterleisten) - gleicher unterer Rand wie
   ein <label>, damit sie auf derselben Höhe wie die Eingabefelder sitzen. */
.form-inline-btn {
    margin-bottom: 1rem;
}

.error {
    background: rgba(255, 93, 108, 0.15);
    border: 1px solid var(--color-danger);
    color: #ffb3ba;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.success {
    background: rgba(62, 207, 142, 0.15);
    border: 1px solid var(--color-success);
    color: #b6f3d6;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    word-break: break-word;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.92rem;
}

th { color: var(--color-text-muted); font-weight: 600; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.inline-form { display: inline; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}
.badge-over {
    background: rgba(255, 93, 108, 0.15);
    border-color: var(--color-danger);
    color: #ffb3ba;
}

.qr-box { text-align: center; margin: 1rem 0; }
.qr-box img { background: #fff; padding: 8px; border-radius: var(--radius); }

/* Eigene Dropdown-Checkbox-Liste als Ersatz für <select multiple>,
   damit Passwortmanager-Erweiterungen sie nicht als Login-Feld erkennen */
.dropdown-check {
    position: relative;
    margin-top: 0.35rem;
    margin-bottom: 1rem;
}
.dropdown-check > summary {
    list-style: none;
    cursor: pointer;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem;
    color: var(--color-text);
    font-size: 1rem;
}
.dropdown-check > summary::-webkit-details-marker { display: none; }
.dropdown-check > summary::after { content: "\25BE"; float: right; color: var(--color-text-muted); }
.dropdown-check[open] > summary::after { content: "\25B4"; }
.dropdown-check-list {
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--color-surface-alt);
    max-height: 220px;
    overflow-y: auto;
    padding: 0.4rem 0.2rem;
}
.dropdown-check-list .checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text);
    cursor: pointer;
}
.dropdown-check-list .checkbox-row:hover { background: rgba(255,255,255,0.06); }
.dropdown-check-list input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Bild-Auswahl mit Vorschaubild statt nichtssagendem <select> */
.image-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.4rem 0 1rem;
}
.image-picker-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 120px;
    padding: 0.5rem;
    background: var(--color-surface-alt);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    text-align: center;
}
.image-picker-option:has(input:checked) {
    border-color: var(--color-primary);
}
.image-picker-option img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}
.image-picker-placeholder {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}
.image-picker-option input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Mobile: Tabellen horizontal scrollbar statt Umbruch-Chaos */
@media (max-width: 600px) {
    .table-scroll { overflow-x: auto; }
    .topbar-inner { flex-direction: column; align-items: flex-start; }
}

/* Nav-Dropdown: schwebt ueber dem Inhalt statt die Kopfzeile zu verschieben */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown > summary {
    cursor: pointer;
    list-style: none;
    color: var(--color-text-muted);
    padding: 0.3rem 0;
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary::after { content: "\25BE"; margin-left: 0.3rem; }
.nav-dropdown[open] > summary::after { content: "\25B4"; }
.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.4rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.35rem;
    min-width: 140px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.nav-dropdown-content a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    color: var(--color-text);
}
.nav-dropdown-content a:hover { background: rgba(255,255,255,0.08); }
