:root {
    --bg: #1a1a1a;
    --bg-panel: #232323;
    --bg-panel-alt: #2e2e2e;
    --border: #3d3d3d;
    --text: #e8e8e8;
    --text-muted: #a0a0a0;
    --gold: #c9a227;
    --gold-hover: #e0b930;
    --danger: #d9534f;
    --success: #4caf50;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

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

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

.icon { flex-shrink: 0; }

/* Oeffentliche/nicht eingeloggte Seiten: schlichte Kopfzeile */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.navbar-brand a {
    display: block;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--gold);
}

.navbar-brand img {
    display: block;
    height: 40px;
    width: auto;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

/* Eingeloggter Bereich: Sidebar-Layout */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 0.65rem 1.5rem;
    font-size: 1.15rem;
    font-weight: bold;
}

.sidebar-brand a { display: block; }

.sidebar-brand img {
    display: block;
    height: 56px;
    width: auto;
}

.sidebar-brand a { color: var(--gold); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.sidebar-section-label {
    margin-top: 1rem;
    padding: 0.5rem 0.65rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--bg-panel-alt);
    color: var(--text);
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(201, 162, 39, 0.15);
    color: var(--gold);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-user {
    padding: 0 0.65rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.sidebar-user strong { color: var(--text); }

.app-content {
    flex: 1;
    min-width: 0;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.panel-narrow {
    max-width: 420px;
    margin: 3rem auto;
}

h1, h2, h3 { color: var(--gold); }

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

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:hover td { background: var(--bg-panel-alt); }

.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 720px; }

.actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    white-space: nowrap;
}

.text-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 600;
    color: var(--danger);
    cursor: pointer;
    text-decoration: none;
}

.text-button:hover { color: #ff6b66; text-decoration: underline; }

form { display: flex; flex-direction: column; gap: 1rem; }

label { font-weight: 600; font-size: 0.9rem; }

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: var(--text);
    font-size: 1rem;
    width: 100%;
}

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

.field-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

.checkbox-grid input { width: auto; }

.button, button {
    display: inline-block;
    background: var(--gold);
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    width: fit-content;
    transition: background 0.15s ease;
}

.button:hover, button:hover { background: var(--gold-hover); text-decoration: none; }

.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { background: #c9302c; }

.button-secondary { background: var(--bg-panel-alt); color: var(--text); border: 1px solid var(--border); }
.button-secondary:hover { background: #30304a; }

.inline-form { display: inline; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-panel-alt);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-active { border-color: var(--success); color: var(--success); }
.badge-disabled { border-color: var(--danger); color: var(--danger); }

.badge-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.flash-success { background: rgba(76, 175, 80, 0.15); border: 1px solid var(--success); color: var(--success); }
.flash-error { background: rgba(217, 83, 79, 0.15); border: 1px solid var(--danger); color: var(--danger); }

.text-muted { color: var(--text-muted); }

.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(201, 162, 39, 0.15);
    color: var(--gold);
    flex-shrink: 0;
}

.stat-card h3 { margin: 0 0 0.15rem; color: var(--text); font-size: 1rem; }
.stat-card p { margin: 0; }

@media (max-width: 860px) {
    .app-shell {
        flex-direction: column;
        min-height: 0;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
        overflow-x: auto;
    }

    .sidebar-brand { padding: 0 0.75rem 0 0; }
    .sidebar-brand img { height: 32px; }

    .sidebar-nav {
        flex-direction: row;
        flex: none;
    }

    .sidebar-section-label { display: none; }

    .sidebar-link .label { display: none; }

    .sidebar-footer {
        flex-direction: row;
        align-items: center;
        margin-top: 0;
        margin-left: auto;
        padding-top: 0;
        padding-left: 0.75rem;
        border-top: none;
        border-left: 1px solid var(--border);
    }

    .sidebar-user { display: none; }
}
