:root {
    --color-primary: #104e8b;
    --color-primary-hover: #1565C0;
    --color-bg: #0e1117;
    --color-bg-card: #262730;
    --color-text: #e0e0e0;
    --color-text-muted: #ccc;
    --color-border: #3d3d4a;
    --color-link: #60b4ff;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --footer-height: 38px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding-bottom: 48px; /* Platz für fixierte Fusszeile */
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

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

/* --- Topbar (nur mobil sichtbar, enthält Hamburger) --- */
.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 16px;
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 200;
}

.topbar-brand { font-weight: 600; flex: 1; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.topbar-logo { height: 56px; width: auto; }
.topbar-brand-short { display: none; }
.topbar-user {
    font-size: 0.85em;
    color: var(--color-text-muted);
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 1.1em;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.topbar-logout:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--color-link);
    text-decoration: none;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.hamburger span {
    display: block;
    height: 2px;
    background-color: var(--color-text);
    border-radius: 1px;
}

/* --- Sidebar (Desktop: fest links, Mobile: Off-Canvas) --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--footer-height);
    width: var(--sidebar-width);
    background-color: var(--color-bg-card);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 150;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    justify-content: center;
    padding: 20px 16px 24px;
    flex-shrink: 0;
}
.sidebar-header img { max-height: 112px; width: auto; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95em;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background-color: rgba(96, 180, 255, 0.1);
    color: var(--color-link);
}

.nav-item.active a {
    background-color: rgba(16, 78, 139, 0.35);
    border-left-color: var(--color-primary-hover);
    color: white;
    font-weight: 600;
}

.nav-icon { width: 1.3em; text-align: center; }

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-settings-link {
    color: var(--color-text-muted);
    font-size: 0.9em;
}
.footer-settings-link:hover { color: var(--color-link); text-decoration: none; }
.footer-settings-link.active { color: white; font-weight: 600; }

.logout-link { color: var(--color-text-muted); font-size: 0.9em; }
.logout-link:hover { color: var(--color-link); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 140;
}

.content {
    margin-left: var(--sidebar-width);
    max-width: 1100px;
    padding: 32px 24px;
}

.content-full {
    margin-left: 0;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Mobile: Sidebar wird Off-Canvas, Hamburger/Topbar sichtbar --- */
@media (max-width: 900px) {
    .topbar { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease-in-out;
        top: 0;
        padding-top: var(--topbar-height);
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay.visible { display: block; }

    .content {
        margin-left: 0;
        padding: 20px 16px;
    }
}

@media (max-width: 420px) {
    .topbar-brand-full { display: none; }
    .topbar-brand-short { display: inline; }
}

.login-container {
    max-width: 380px;
    margin: 60px auto;
    padding: 24px;
    background-color: var(--color-bg-card);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label { margin-top: 10px; font-size: 0.9em; color: var(--color-text-muted); }

.login-form input {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: #1c1e26;
    color: var(--color-text);
}

.login-form button,
button,
.stButton {
    margin-top: 18px;
    padding: 10px 16px;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.login-form button:hover,
button:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.flash {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.flash-error { background-color: #4a1f1f; color: #ffb3b3; border: 1px solid #7a2e2e; }
.flash-success { background-color: #1f4a2b; color: #b3ffcb; border: 1px solid #2e7a45; }

.tab-list { line-height: 1.9; }

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background-color: var(--color-bg-card);
    color: var(--color-text-muted);
    text-align: center;
    padding: 8px 0;
    font-size: 1.0em;
    border-top: 1px solid var(--color-border);
    z-index: 999;
}

.footer a { color: var(--color-link); }

/* --- Daten-Tabellen (Personen etc.) --- */
.data-table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.data-table-wrapper::-webkit-scrollbar { height: 8px; }
.data-table-wrapper::-webkit-scrollbar-track { background: transparent; }
.data-table-wrapper::-webkit-scrollbar-thumb { background-color: var(--color-border); border-radius: 4px; }
.data-table-wrapper::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-muted); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

.data-table th, .data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

.data-table th { color: var(--color-text-muted); font-weight: 600; }
.data-table tr:hover td { background-color: rgba(255, 255, 255, 0.03); }

.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-cell a { font-size: 0.85em; }

.btn-danger-link { color: #ff8080; }

.btn-table {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.btn-table-open {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-table-open:hover { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-table-secondary {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-table-secondary:hover { border-color: var(--color-link); color: var(--color-link); }
.btn-table-danger {
    background-color: transparent;
    color: #ff8080;
    border-color: #ff8080;
}
.btn-table-danger:hover { background-color: #ff8080; color: #1a1a1a; }

.form-card {
    max-width: 640px;
    padding: 20px 24px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 24px;
}

.form-grid { display: flex; flex-direction: column; gap: 4px; }
.form-grid label { margin-top: 12px; font-size: 0.9em; color: var(--color-text-muted); }

.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="password"],
.form-grid input[type="date"],
.form-grid input[type="number"],
.form-grid textarea,
.form-grid select,
select {
    padding: 9px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: #1c1e26;
    color: var(--color-text);
    font-family: inherit;
}

.form-grid input[type="file"] { color: var(--color-text); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: 16px; height: 16px; }

.role-checkboxes { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.role-checkboxes label { display: flex; align-items: center; gap: 6px; font-size: 0.9em; color: var(--color-text); margin-top: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-secondary {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: transparent;
    color: var(--color-text);
}
.btn-secondary:hover { border-color: var(--color-link); color: var(--color-link); text-decoration: none; }

/* --- Segmented-Nav: Ersatz für Radiobuttons/Selectbox-Umschalter (Submenü-Stil) --- */
.segmented-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.segmented-nav a {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.88em;
    white-space: nowrap;
}
.segmented-nav a:hover { border-color: var(--color-link); color: var(--color-link); text-decoration: none; }
.segmented-nav a.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.field-group-label {
    font-size: 0.82em;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.gruppe-table input[type="number"] { width: 90px; }
.gruppe-table select { padding: 6px; }

/* --- Gruppen-Übersicht: farbige Zellen + sticky Namensspalte --- */
.gruppe-uebersicht-table { font-size: 0.85em; }
.gruppe-uebersicht-table th, .gruppe-uebersicht-table td { text-align: center; white-space: nowrap; }
.gruppe-uebersicht-table .sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--color-bg);
    text-align: left;
    font-weight: 600;
    z-index: 1;
}
.gruppe-uebersicht-table thead .sticky-col { z-index: 2; }

.cell-met  { background-color: rgba(76, 175, 80, 0.25); color: #a5d6a7; font-weight: 700; }
.cell-ilv  { background-color: rgba(33, 150, 243, 0.2); color: #90caf9; }
.cell-near { background-color: rgba(255, 235, 59, 0.15); color: #fff59d; }
.cell-miss { background-color: rgba(255, 152, 0, 0.15); color: #ffcc80; }
.cell-empty { color: var(--color-text-muted); }
.cell-no-lim { color: var(--color-text); }

.lim-lines { display: block; font-size: 0.78em; margin-top: 2px; }
.lim-lines .lim-ok { color: #81c784; font-weight: 600; }
.lim-lines .lim-ko { color: var(--color-text-muted); }
.lim-lines span { display: block; }

