.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;

    display: flex;
    flex-direction: column;

    width: var(--sidebar-width);
    min-height: 100vh;

    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.sidebar-header {
    min-height: var(--topbar-height);
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;

    color: var(--color-text);
    text-decoration: none;
}

.brand:hover {
    color: var(--color-text);
}

.brand-mark {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);

    background: var(--color-surface-muted);
    color: var(--color-primary);

    font-size: 0.9rem;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-text strong {
    font-size: 1rem;
    line-height: 1.2;
}

.brand-text small {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.main-navigation {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section {
    margin-top: 18px;
}

.nav-section-title {
    padding: 0 10px 6px;
    color: var(--color-text-light);

    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;

    min-height: 38px;
    padding: 8px 10px;
    margin-bottom: 2px;

    border-left: 3px solid transparent;
    border-radius: var(--radius-small);

    color: var(--color-text);
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.nav-link.active {
    border-left-color: var(--color-primary);
    background: #edf3fa;
    color: #173f73;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 0.75rem;
}

/* Hauptbereich */

.app-content {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    min-height: var(--topbar-height);
    padding: 12px 24px;

    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-left p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.topbar-right {
    flex-shrink: 0;
}

.menu-button {
    display: none;

    width: 38px;
    height: 36px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);

    background: var(--color-secondary);
    color: var(--color-text);
}

.privacy-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 6px 9px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);

    background: var(--color-surface-muted);
    color: var(--color-text-muted);

    font-size: 0.76rem;
    white-space: nowrap;
}

.privacy-indicator::before {
    content: "";
    width: 8px;
    height: 8px;

    border-radius: 50%;
    background: var(--color-success);
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1260px;
    padding: 24px;
    margin: 0 auto;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 12px 24px;

    border-top: 1px solid var(--color-border);
    background: var(--color-surface);

    color: var(--color-text-light);
    font-size: 0.72rem;
}

.app-footer > div:first-child {
    display: flex;
    gap: 8px;
}

/* Tablet und Smartphone */

@media (max-width: 850px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        transition: transform 140ms ease;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    body.navigation-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(0, 0, 0, 0.25);
    }

    .app-content {
        min-height: 100vh;
    }

    .menu-button {
        display: inline-grid;
        place-items: center;
    }

    .main-content {
        padding: 16px;
    }

    .topbar {
        padding: 10px 16px;
    }

    .topbar-right {
        display: none;
    }

    .app-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 16px;
    }
}