.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.app-header .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    line-height: 1.2;
}

.app-header .brand-organisation {
    font-size: 0.8rem;
    font-weight: 400;
}

.app-header .user-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.app-body {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 0;
    align-items: stretch;
}

.app-sidebar {
    border-right: 1px solid #e5e7eb;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-self: stretch;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.25s ease;
    width: 100%;
}

@media (min-width: 901px) {
    body.sidebar-context-open .app-body {
        grid-template-columns: 450px minmax(0, 1fr);
    }
}

.app-main {
    padding: 1rem 1.25rem 1.5rem;
    display: grid;
    gap: 1rem;
    align-content: start;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 0.9rem;
    background: #f9fafb;
}

.dev-diagnostics {
    margin: 0 1rem 1rem 1rem;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: 8px;
}

.page-header {
    display: grid;
    gap: 0.35rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 900px) {
    .app-body {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
        max-height: 55vh;
    }

    body.sidebar-context-open .app-body {
        grid-template-columns: 1fr;
    }
}
