/* Authenticated application shell alignment. Keep public and Survey surfaces out of scope. */

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .workflow-beta-banner-menu-item {
    flex: 0 1 25%;
    max-width: 25%;
    min-width: 0;
    height: 100%;
    align-items: center;
    margin-right: var(--fmd-space-1);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner {
    position: relative;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: var(--fmd-space-2) !important;
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--bs-app-header-height, 3.75rem) - var(--fmd-space-2));
    margin: 0 !important;
    padding: var(--fmd-space-1) var(--fmd-space-2) !important;
    line-height: 1.15;
    white-space: nowrap;
    overflow: visible;
    cursor: help;
    border-color: color-mix(in srgb, var(--fmd-status-info) 55%, var(--fmd-border-default)) !important;
    box-shadow: var(--fmd-shadow-card);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner > div:first-child {
    min-width: 0;
    overflow: visible;
    white-space: nowrap;
}
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .workflow-beta-banner-extra {
    display: none;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner .workflow-beta-banner-extra {
    position: absolute;
    top: calc(100% + var(--fmd-space-1));
    right: 0;
    z-index: var(--fmd-z-shell-popover);
    display: flex;
    flex-direction: column;
    gap: var(--fmd-space-2);
    width: max-content;
    max-width: min(var(--fmd-menu-width-beta), calc(100vw - (var(--fmd-space-4) * 2)));
    padding: var(--fmd-space-2) var(--fmd-space-3);
    color: var(--fmd-text-primary);
    background: var(--fmd-bg-surface);
    border: var(--fmd-border-width) solid color-mix(in srgb, var(--fmd-status-info) 35%, var(--fmd-border-default));
    border-radius: var(--fmd-radius-sm);
    box-shadow: var(--fmd-shadow-card);
    font-size: var(--fmd-font-size-xs);
    line-height: 1.3;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--fmd-motion-instant) ease, visibility var(--fmd-motion-instant) ease;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner:hover .workflow-beta-banner-extra,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner:focus .workflow-beta-banner-extra,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner:focus-within .workflow-beta-banner-extra {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner .workflow-beta-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fmd-space-1);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .workflow-beta-banner .btn {
    flex: 0 0 auto;
    padding: var(--fmd-space-1) var(--fmd-space-2);
    font-size: var(--fmd-font-size-xs);
    line-height: 1.1;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .workflow-beta-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    inline-size: var(--fmd-icon-size-shell);
    block-size: var(--fmd-icon-size-shell);
    margin-left: var(--fmd-space-1);
    color: var(--fmd-status-info);
    cursor: help;
    font-size: var(--fmd-font-size-xs);
    line-height: 1;
    vertical-align: middle;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .workflow-beta-menu-badge:focus {
    outline: var(--fmd-focus-ring-width) solid color-mix(in srgb, var(--fmd-action-primary) var(--fmd-focus-ring-opacity), transparent);
    outline-offset: 2px;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar-minified .workflow-beta-menu-badge {
    display: none;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .workflow-beta-menu-badge {
    margin-left: var(--fmd-space-1);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item .menu-img.server-status-online::before,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item .menu-img.server-status-offline::before {
    content: "";
    position: absolute;
    width: var(--fmd-status-indicator-size);
    height: var(--fmd-status-indicator-size);
    bottom: var(--fmd-space-1);
    right: var(--fmd-space-1);
    border-radius: var(--fmd-radius-pill);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item .menu-img.server-status-online::before {
    background-color: var(--fmd-status-success);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item .menu-img.server-status-offline::before {
    background-color: var(--fmd-status-danger);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) {
    font-family: var(--fmd-font-family-sans);
    font-size: var(--fmd-font-size-body);
    line-height: var(--fmd-line-height-body);
    --fmd-shell-divider: var(--fmd-border-width) solid var(--fmd-border-default);
    --fmd-shell-divider-shadow: 0 var(--fmd-border-width) 0 var(--fmd-border-default);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content {
    color: var(--fmd-text-primary);
}

/* Shared first-party logo only. It never targets organization or user images. */
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .brand .fmd-brand-link {
    display: inline-grid;
    place-items: center;
    inline-size: var(--fmd-control-height-touch);
    block-size: var(--fmd-control-height-touch);
    border-radius: var(--fmd-radius-sm);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .brand .fmd-brand-link:focus-visible {
    outline: var(--fmd-focus-ring-width) solid var(--fmd-input-border-focus);
    outline-offset: 3px;
}

.fmd-brand-logo,
.fmd-brand-logo__art,
.fmd-brand-logo__compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Keep intrinsic SVG dimensions from expanding the fixed header brand slot. */
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .brand .fmd-brand-logo {
    flex: 0 0 var(--fmd-control-height-touch, 2.75rem);
    inline-size: var(--fmd-control-height-touch, 2.75rem);
    block-size: var(--fmd-control-height-touch, 2.75rem);
    overflow: hidden;
}

.fmd-brand-logo__art > .fmd-brand-logo__dark,
.fmd-brand-logo__compact > .fmd-brand-logo__dark,
.fmd-brand-logo__compact,
.fmd-brand-logo__forced-text {
    display: none;
}

.fmd-brand-logo__art > img,
.fmd-brand-logo__compact > img {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
}

.fmd-brand-logo[data-logo-layout="mark"] .fmd-brand-logo__art {
    flex: 0 0 var(--fmd-control-height-touch, 2.75rem);
    inline-size: var(--fmd-control-height-touch, 2.75rem);
    block-size: var(--fmd-control-height-touch, 2.75rem);
    overflow: hidden;
}

.fmd-brand-logo[data-logo-layout="mark"] .fmd-brand-logo__art > img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
}

.fmd-brand-logo[data-logo-layout="horizontal"] .fmd-brand-logo__art {
    inline-size: clamp(12.5rem, 22vw, 18.75rem);
}

.fmd-brand-logo[data-logo-layout="stacked"] .fmd-brand-logo__art {
    inline-size: min(100%, 18.75rem);
}

.fmd-brand-logo[data-logo-surface="dark"] .fmd-brand-logo__light,
html[data-bs-theme="dark"] .fmd-brand-logo[data-logo-surface="auto"] .fmd-brand-logo__light {
    display: none;
}

.fmd-brand-logo[data-logo-surface="dark"] .fmd-brand-logo__dark,
html[data-bs-theme="dark"] .fmd-brand-logo[data-logo-surface="auto"] .fmd-brand-logo__dark {
    display: block;
}

@media (max-width: 40rem) {
    .fmd-brand-logo[data-logo-layout="horizontal"] .fmd-brand-logo__art {
        display: none;
    }

    .fmd-brand-logo[data-logo-layout="horizontal"] .fmd-brand-logo__compact {
        display: inline-flex;
        inline-size: var(--fmd-control-height-touch);
        block-size: var(--fmd-control-height-touch);
    }

    .fmd-brand-logo[data-logo-layout="horizontal"] .fmd-brand-logo__compact > img {
        inline-size: 100%;
        block-size: 100%;
    }

    .fmd-brand-logo[data-logo-layout="horizontal"][data-logo-surface="dark"] .fmd-brand-logo__compact .fmd-brand-logo__light,
    html[data-bs-theme="dark"] .fmd-brand-logo[data-logo-layout="horizontal"][data-logo-surface="auto"] .fmd-brand-logo__compact .fmd-brand-logo__light {
        display: none;
    }

    .fmd-brand-logo[data-logo-layout="horizontal"][data-logo-surface="dark"] .fmd-brand-logo__compact .fmd-brand-logo__dark,
    html[data-bs-theme="dark"] .fmd-brand-logo[data-logo-layout="horizontal"][data-logo-surface="auto"] .fmd-brand-logo__compact .fmd-brand-logo__dark {
        display: block;
    }
}

@media (forced-colors: active) {
    .fmd-brand-logo__art,
    .fmd-brand-logo__compact {
        display: none !important;
    }

    .fmd-brand-logo__forced-text {
        display: inline;
        color: CanvasText;
        font-family: system-ui, sans-serif;
        font-size: .875rem;
        font-weight: 700;
        line-height: 1.2;
    }
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content > :is(h1, .page-header),
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content .page-header,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content :where(h1.h2, h1.h3) {
    margin-bottom: var(--fmd-space-2);
    color: var(--fmd-text-primary);
    font-size: var(--fmd-font-size-page-title);
    font-weight: var(--fmd-font-weight-heading);
    letter-spacing: var(--fmd-letter-spacing-tight);
    line-height: var(--fmd-line-height-heading);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content > :is(.breadcrumb, .page-header + .breadcrumb),
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-content .breadcrumb {
    margin-bottom: var(--fmd-space-3);
    color: var(--fmd-text-muted);
    font-size: var(--fmd-font-size-meta);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header {
    --bs-app-header-bg: var(--fmd-bg-surface);
    --bs-app-header-color: var(--fmd-text-primary);
    --bs-app-header-input-bg: var(--fmd-bg-elevated);
    --bs-app-header-input-border-color: var(--fmd-border-default);
    --bs-app-header-box-shadow: var(--fmd-shell-divider-shadow);
    --bs-app-header-menu-link-padding-y: var(--fmd-space-3);
    --bs-app-header-menu-link-padding-x: var(--fmd-space-3);
    --bs-app-header-menu-link-sm-padding-y: var(--fmd-space-2);
    --bs-app-header-menu-link-sm-padding-x: var(--fmd-space-2);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar {
    background-color: var(--fmd-bg-surface);
    color: var(--fmd-text-primary);
    --bs-app-sidebar-border-color: var(--fmd-border-default);
    --bs-app-sidebar-content-mobile-bg: var(--fmd-bg-surface);
    --bs-app-sidebar-content-padding-y: var(--fmd-space-3);
    --bs-app-sidebar-menu-link-border-radius: var(--fmd-radius-sm);
    --bs-app-sidebar-menu-link-padding-y: var(--fmd-space-1);
    --bs-app-sidebar-menu-link-padding-x: var(--fmd-space-2);
    --bs-app-sidebar-menu-link-color: var(--fmd-text-secondary);
    --bs-app-sidebar-menu-link-hover-bg: var(--fmd-bg-elevated);
    --bs-app-sidebar-menu-link-active-bg: color-mix(in srgb, var(--fmd-action-primary) 10%, transparent);
    --bs-app-sidebar-menu-link-active-color: var(--fmd-action-primary);
    --bs-app-sidebar-menu-header-color: var(--fmd-text-muted);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-item .menu-icon,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-item .menu-icon,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item .menu-icon {
    inline-size: var(--fmd-icon-size-shell);
    min-inline-size: var(--fmd-icon-size-shell);
    block-size: var(--fmd-icon-size-shell);
    margin-inline: 0;
    font-size: var(--fmd-icon-size-shell);
    line-height: 1;
    text-align: center;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-item {
    display: flex;
    align-items: center;
    min-height: var(--fmd-shell-control-height);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-header .menu .menu-link,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-link,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-link {
    min-height: var(--fmd-shell-control-height);
    font-size: var(--fmd-shell-menu-font-size);
    line-height: 1.25;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-link {
    align-items: center;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-item form > .menu-link,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-item form > .menu-link {
    color: var(--fmd-text-secondary);
    transition: background-color var(--fmd-motion-fast) ease, color var(--fmd-motion-fast) ease;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-item form > .menu-link {
    padding: var(--fmd-space-1) var(--fmd-space-2);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-item form > .menu-link {
    padding: var(--fmd-space-2) var(--fmd-space-3);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-item .menu-icon + .menu-text {
    margin-inline-start: var(--fmd-space-2);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-item .menu-icon + .menu-text {
    margin-inline-start: var(--fmd-space-3);
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-item form > .menu-link:hover,
body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav .menu .menu-item form > .menu-link:hover {
    color: var(--fmd-text-primary);
    background-color: var(--fmd-bg-elevated) !important;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu .menu-link:focus-visible {
    outline: var(--fmd-focus-ring-width) solid color-mix(in srgb, var(--fmd-action-primary) var(--fmd-focus-ring-opacity), transparent);
    outline-offset: -2px;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar .menu-header {
    margin-top: var(--fmd-space-3);
    margin-bottom: var(--fmd-space-1);
    font-size: var(--fmd-font-size-meta);
    font-weight: var(--fmd-font-weight-emphasis);
    letter-spacing: var(--fmd-letter-spacing-label);
    text-transform: uppercase;
}

body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-top-nav {
    background-color: var(--fmd-bg-surface);
    color: var(--fmd-text-primary);
    --bs-app-top-nav-bg: var(--fmd-bg-surface);
    --bs-app-top-nav-box-shadow: var(--fmd-shell-divider-shadow);
    --bs-app-top-nav-menu-link-active-color: var(--fmd-action-primary);
    --bs-app-top-nav-menu-link-color: var(--fmd-text-secondary);
    --bs-app-top-nav-menu-link-hover-color: var(--fmd-text-primary);
    --bs-app-top-nav-menu-submenu-bg: var(--fmd-bg-surface);
}

@media (min-width: 992px) {
    body[data-user-authenticated="true"]:not([data-controller="Landing"]):not([data-controller="Survey"]):not([data-controller="Surveys"]) .app-sidebar {
        border-inline-end: var(--fmd-shell-divider);
    }
}

/* Expanded navigation must accommodate long activity and workspace names. */
.app:not(.app-sidebar-minified) .app-sidebar .menu-link .menu-text {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.app-header [data-current-workspace-name] {
    min-width: 0;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .app-header [data-current-workspace-name] { max-width: 9rem; }
}
