/* The existing main element remains the scroll owner. No scroll listeners. */
:root {
    --app-header-height: 56px;
    --app-content-padding: 12px;
    --app-mobile-brand-height: 56px;
    --app-bottom-navigation-height: 64px;
}
.app-main { min-height: 0; scroll-padding-top: calc(var(--app-header-height) + 12px); }
.app-top-header {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: var(--app-header-height);
    padding: 5px 12px;
    gap: 8px;
    background: var(--theme-menu-surface, #0f172a) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.app-top-header > :first-child { flex: 1 1 auto; min-width: 0; gap: 4px; }
.app-top-header h1 { flex: 1 1 auto; min-width: 0; max-width: none; }
.app-top-header > :last-child { gap: 4px; }
.app-top-header :is(#globalCommandPaletteTrigger, #quickChatNavbarButton,
    #themeMenuButton, #bellNotificationButton) {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}
.app-top-header button:focus-visible {
    outline: 2px solid var(--text-main, #f8fafc);
    outline-offset: 2px;
}
.app-main :is([id], input, select, textarea) {
    scroll-margin-top: calc(var(--app-header-height) + 12px);
}
.app-top-header #quickChatDropdown {
    position: fixed;
    inset: auto 12px auto auto;
    top: calc(var(--app-header-height) + var(--app-mobile-brand-height) + 8px);
    width: min(420px, calc(100vw - 24px));
    max-height: calc(100dvh - var(--app-header-height) - var(--app-mobile-brand-height) - 24px);
    margin-top: 0;
}
@media (max-width: 639px) {
    .app-top-header #themeMenuDropdown {
        top: calc(var(--app-header-height) + var(--app-mobile-brand-height) + 8px);
        margin-top: 0;
    }
}
@media (min-width: 640px) {
    :root { --app-content-padding: 16px; }
    .app-top-header { padding-inline: 16px; }
    .app-top-header > :last-child { gap: 12px; }
}
@media (min-width: 768px) {
    :root {
        --app-content-padding: 24px;
        --app-mobile-brand-height: 0px;
        --app-bottom-navigation-height: 0px;
    }
    .app-top-header { padding-inline: 24px; }
    .app-top-header #quickChatDropdown { width: min(420px, calc(100vw - 280px)); }
}
/* The sidebar consumes 256px; icon controls leave room for the page title. */
@media (min-width: 768px) and (max-width: 1199px) {
    .app-top-header :is(#globalCommandPaletteTrigger, #quickChatNavbarButton,
        #themeMenuButton, #bellNotificationButton) > :is(span, kbd) { display: none; }
    .app-top-header :is(#quickChatUnreadBadge, #bellNotificationBadge,
        #navbarNotificationStatusDot):not(.hidden) { display: inline-flex; }
    .app-top-header > :last-child { gap: 4px; }
}
