.app-page {
    --app-page-font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --app-page-title-font-family: 'Sora', 'Inter', 'Segoe UI', sans-serif;
    --app-page-bg: #f4f7fb;
    --app-page-ink: #06245d;
    --app-page-muted: #557097;
    --app-page-border: #dbe7f6;
    --app-page-card-bg: #fff;
    --app-page-radius: 8px;
    --app-page-shadow: 0 12px 30px rgba(16, 42, 84, .05);
    min-height: calc(100vh / var(--jump-zoom, 1) - 72px);
    padding: 4px 12px 10px;
    position: relative;
    background: var(--app-page-bg);
    color: var(--app-page-ink);
    font-family: var(--app-page-font-family);
}

.app-page-topbar,
.app-page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.app-page-topbar {
    position: absolute;
    top: 6px;
    right: 12px;
    left: 12px;
    z-index: 120;
}

.app-page-hero {
    min-height: 78px;
    margin-top: 0;
    padding-top: 4px;
    align-items: start;
}

.app-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.app-page-tools {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
    z-index: 130;
}

.app-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
    gap: 10px;
    align-items: start;
}

.app-page-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.app-page-side-rail {
    position: sticky;
    top: calc(var(--jump-page-header-height, 0px) + 10px);
    display: grid;
    gap: 10px;
}

/*
 * Pinned EntityHeader (EntityHeader IsSticky, on by default). The tab panel (.atrans-tab-panel) is
 * the scroll container, and a sticky box can never leave its parent: when the header is the only
 * content of a DxGridLayoutItem or of a "*-header-shell" wrapper, that parent is exactly as tall as
 * the header and pinning the header alone does nothing. The wrapper is pinned instead. The page's
 * other sticky elements offset themselves by --jump-page-header-height (published by
 * window.jumpStickyHeader in site.js). The header's own rule lives in EntityHeader.razor.css.
 * See specs/devexpress-internals-specs.md.
 */
.dxbl-gridlayout-item:has(> .page-header--sticky),
.dxbl-gridlayout-item:has(> [class*="-header-shell"] > .page-header--sticky) {
    position: sticky;
    top: 0;
    /* Above the page's own content (which goes up to ~140), below the DevExpress and MudBlazor
       popups and modals (1000+), so a dialog still covers the pinned header. */
    z-index: 900;
}

/* A soft shadow under the header only while it is pinned, so the rows passing underneath read as
   going under it. The pinned box is the scroll-state container and the shadow is drawn by a
   descendant (a container query never matches the container itself): the header when it is pinned
   itself, the wrapper when the wrapper is. Browsers without scroll-state queries pin the header all
   the same, just without the shadow. */
.page-header--sticky,
.dxbl-gridlayout-item:has(> .page-header--sticky),
.dxbl-gridlayout-item:has(> [class*="-header-shell"] > .page-header--sticky) {
    container-type: scroll-state;
}

.dxbl-gridlayout-item > .page-header--sticky,
.dxbl-gridlayout-item > [class*="-header-shell"] > .page-header--sticky {
    container-type: normal;
}

.page-header--sticky .page-header-hero::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    height: 10px;
    background: linear-gradient(rgba(16, 42, 84, .10), rgba(16, 42, 84, 0));
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}

@container scroll-state(stuck: top) {
    .page-header--sticky .page-header-hero::after {
        opacity: 1;
    }
}

@media (max-width: 1400px) {
    .app-page-layout {
        grid-template-columns: 1fr;
    }

    .app-page-side-rail {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-page-topbar,
    .app-page-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .app-page-actions {
        margin-left: auto;
        justify-content: flex-start;
        align-items: flex-end;
    }

    .app-page-side-rail {
        grid-template-columns: 1fr;
    }
}
