/* One viewport navigation rule for application, account and terminal shells. */
:root { --navigation-height: 68px; --section-navigation-height: 0px; --work-menu-height: 0px; }

/* Hidden horizontal overflow creates a second scroll container and breaks sticky. */
@supports (overflow-x: clip) {
    html, body { overflow-x: clip; }
}

.topbar,
.platform-entry-body > .platform-entry-header,
.ae-header,
.pa-header,
.wt-admin-header,
.wt-kiosk-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Existing fixed client headers keep their original positioning and measured space. */
.topbar.is-client-account + main { padding-top: var(--topbar-height, 68px); }

.ae-header {
    display: block;
    width: 100%;
    margin: 0;
    padding: 20px max(32px, calc((100% - 1100px) / 2));
    background: #f6f8f7;
    border-bottom: 1px solid var(--ae-line, #d9e6e8);
}
.ae-header-brand-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; }
.ae-header .ae-account-nav { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--ae-line, #d9e6e8); border-bottom: 0; }
.pa-header { max-width: none; padding-inline: max(32px, calc((100% - 1088px) / 2)); background: #f5f8f7; border-bottom: 1px solid var(--pa-line, #dce5e8); }

.work-shell > .work-menu-bar {
    position: sticky;
    top: var(--navigation-height);
    z-index: 90;
    background: #fff;
}
.work-shell > .work-subnav {
    position: sticky;
    top: calc(var(--navigation-height) + var(--work-menu-height));
    z-index: 89;
    background: #fff;
}
.brokerage-shell > .brokerage-sidebar {
    position: sticky;
    top: calc(var(--navigation-height) + 12px);
    min-height: 0;
    max-height: calc(100dvh - var(--navigation-height) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 80;
}
.saas-admin-sidebar {
    position: sticky;
    top: var(--navigation-height);
    align-self: flex-start;
    min-height: 0;
    max-height: calc(100dvh - var(--navigation-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 80;
}
.saas-section-nav { top: calc(var(--navigation-height) + 8px); }

/* A zero-specificity default leaves existing case/anchor offsets in control. */
:where([id]) { scroll-margin-top: calc(var(--navigation-height) + var(--section-navigation-height) + 16px); }

@media (max-width: 760px) {
    .ae-header { padding: 14px 20px; }
    .ae-header .ae-account-nav { gap: 10px 20px; }
    .pa-header { padding-inline: 20px; }
}
@media (max-width: 380px) {
    .ae-header, .pa-header { padding-inline: 16px; }
}
@media print {
    .topbar, .platform-entry-body > .platform-entry-header, .ae-header, .pa-header,
    .wt-admin-header, .wt-kiosk-header, .work-menu-bar, .work-subnav,
    .brokerage-shell > .brokerage-sidebar, .saas-admin-sidebar { position: static; max-height: none; }
}
