/* Shared desktop header and project arrangement. Existing typography,
   controls and lower hover tools are retained. Portfolio changes only its
   shared header alignment; public views are excluded. */
@media (min-width:900px) {
    /* Apply the shared band before JavaScript initializes, including Portfolio.
       Portfolio keeps its title/X and all existing content/toolbar positions. */
    body.projects-dashboard > main.layout {margin-top:0;height:100dvh}
    body.projects-dashboard .project-header-sticky {top:0;height:70px;min-height:70px;padding:11px 0;box-sizing:border-box}
    body.projects-dashboard:is(.dashboard-project-workspace-open,.portfolio-page-route) .project-header-sticky {top:0}
    body.projects-dashboard .project-header-sticky::after {top:0;height:0}
    /* Continue the existing beige surface to Portfolio's unchanged 87px root. */
    body.projects-dashboard.portfolio-page-route .project-header-sticky::after {top:100%;height:17px}
    body.projects-dashboard .project-header-sticky .topbar {min-height:48px;margin:0}
    body.projects-dashboard .project-header-sticky .topbar-actions {margin-top:0}
    body.projects-dashboard.dashboard-project-workspace-open:not(.dashboard-notes-preview-open) > .dashboard-project-workspace:not(.is-background) {top:70px}
    body.projects-dashboard .dashboard-primary-nav-dot {display:none}
    body.projects-dashboard .dashboard-shell-brand-nav {flex:0 0 auto}
    body.projects-dashboard #dashboard-activity-dot,
    body.projects-dashboard #dashboard-activity-btn::before {width:14px;height:14px}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover {max-height:calc(100dvh - 72px);overflow-y:auto}
    body.projects-dashboard.dashboard-pill-header #dashboard-project-header-context {display:none!important}
    /* Keep the original controls and listeners in their header home. Only
       the three dashboard controls disappear when a project is opened. */
    body.projects-dashboard.dashboard-pill-header .dashboard-shell-control-cluster {display:inline-flex!important}
    body.projects-dashboard.dashboard-pill-header .dashboard-shell-control-cluster > :not(#dashboard-activity-btn):not(.dashboard-menu) {display:none!important}
    body.projects-dashboard.dashboard-pill-header .dashboard-shell-control-cluster > #dashboard-activity-btn {border-right:0;border-radius:14px}
    /* Compact dashboard header. Keep the workspace band and content offsets. */
    body.projects-dashboard .project-header-sticky .topbar {gap:24px}
    body.projects-dashboard .dashboard-shell-brand-nav {gap:22px}
    body.projects-dashboard .dashboard-shell-brand-nav .dashboard-brand-title-row {gap:24px}
    body.projects-dashboard .dashboard-shell-brand-nav .brand-logo {height:40px;max-width:166px}
    body.projects-dashboard .dashboard-shell-brand-nav .dashboard-title-divider {height:40px;background:#b9bdc0}
    body.projects-dashboard .dashboard-primary-nav {gap:22px}

    /* Independent controls; retain the group as the menu positioning anchor. */
    body.projects-dashboard .dashboard-shell-control-cluster {
        align-items:center;height:48px;gap:6px;border:0;border-radius:0;background:transparent;box-shadow:none;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .soft-btn,
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-view-menu > .soft-btn,
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .soft-btn {
        width:40px;min-width:40px;height:40px;min-height:40px;padding:0;border:0;border-radius:0;
        background:transparent;box-shadow:none;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-view-menu > .soft-btn {width:48px;min-width:48px}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu {min-width:40px}
    body.projects-dashboard .dashboard-shell-control-cluster:is(.is-dashboard-menu-open),
    body.projects-dashboard .dashboard-shell-control-cluster.is-dashboard-menu-open .dashboard-activity-btn,
    body.projects-dashboard .dashboard-shell-control-cluster.is-dashboard-menu-open > .dashboard-menu > .dashboard-menu-btn {
        border-radius:0;background:transparent;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .soft-btn:hover,
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-view-menu > .soft-btn:is(:hover,[aria-expanded="true"]),
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .soft-btn:is(:hover,[aria-expanded="true"]) {
        background:transparent;color:#12202f;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .soft-btn:focus-visible,
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-view-menu > .soft-btn:focus-visible,
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .soft-btn:focus-visible {
        outline:1px solid #a9adb0;outline-offset:2px;background:transparent;
    }
    body.projects-dashboard.dashboard-pill-header .dashboard-shell-control-cluster > #dashboard-activity-btn {border:0;border-radius:0}
    body.projects-dashboard #dashboard-activity-badge {
        box-sizing:border-box;width:auto;min-width:24px;height:24px;padding:0 6px;
        border:1px solid #d0d2d3;border-radius:999px;background:#fff;color:#111;font-size:12px;box-shadow:none;
    }

    /* Quiet idle state: a white center with a thin gray outline. */
    body.projects-dashboard .dashboard-activity-dot {
        display: block;
        box-sizing: border-box;
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        border: 1px solid #d0d2d3;
        border-radius: 50%;
        background: #fff;
        box-shadow: none;
        animation: none;
    }

    /* Dropdown dimensions remain independent of the smaller header controls. */
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover {
        top:100%;left:auto;right:0;width:250px!important;max-width:calc(100vw - 32px);
        padding:0;gap:0;border:0;border-radius:0 0 12px 12px;
        background:#f2f0eb;box-shadow:0 12px 28px rgba(38,57,76,.07);
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-link,
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-language-menu .dashboard-language-switch {
        box-sizing:border-box;width:100%;max-width:100%;min-height:44px;height:44px;
        margin:0;padding:0 16px;border:0;border-bottom:1px solid #d5d5d2;border-radius:0;
        background:transparent;box-shadow:none;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > .dashboard-menu-link:last-child {border-bottom:0}
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-menu-section-panel {gap:0;padding:0}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-section-panel .dashboard-menu-link {
        min-height:40px;height:40px;padding:0 22px;font-size:.86rem;
    }
    body.projects-dashboard .dashboard-view-menu-popover {
        top:calc(100% + 4px);left:50%;transform:translateX(-50%);width:96px;
        padding:0;border:0;border-radius:0 0 10px 10px;
        background:#f2f0eb;box-shadow:0 12px 28px rgba(38,57,76,.07);
    }
    body.projects-dashboard .dashboard-view-menu-option {min-height:44px}
    body.projects-dashboard .dashboard-view-menu-option + .dashboard-view-menu-option {border-top:1px solid #d5d5d2}
    body.projects-dashboard .dashboard-menu-modules-section .modules-menu-popover,
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-language-list {border-color:#d5d5d2}
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-language-more {border-top-color:#d5d5d2}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-link:is(:hover,:focus-visible,[aria-expanded="true"]),
    body.projects-dashboard .dashboard-view-menu-option:is(:hover,:focus-visible),
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-language-switch:is(:hover,:focus-visible,[aria-expanded="true"]),
    body.projects-dashboard .dashboard-shell-control-cluster .dashboard-language-option:is(:hover,:focus-visible,.is-active) {
        border-color:#d5d5d2;background:#f8f5f1;color:#233c55;
    }

    .pill-header-upload {display:flex;align-items:center;gap:10px;min-width:0;width:480px;max-width:calc(100% - 680px);margin-left:auto;font:inherit;color:#6d84a0}
    .pill-header-upload[hidden] {display:none!important}
    .pill-upload-details {display:flex;position:relative;align-items:center;gap:9px;min-width:0;flex:1;padding:3px 0 5px;white-space:nowrap;font-size:13px}
    .pill-upload-name {flex:1;min-width:40px;overflow:hidden;text-overflow:ellipsis;color:#23364b}
    .pill-upload-line {position:absolute;left:0;bottom:0;height:2px;background:#111;max-width:100%}
    body.projects-dashboard.dashboard-pill-header .pill-header-upload .pill-upload-cancel {display:inline-flex;align-items:center;justify-content:center;flex:0 0 22px;width:22px;height:22px!important;min-height:22px!important;padding:0!important;border-radius:13px!important}
    .pill-upload-cancel svg {width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round}

    body.review-admin.project-pill-layout {--pill-control-height:40px}
    body.review-admin.project-pill-layout:is([data-project-mode="audio"],[data-project-mode="blog"]) {--pill-control-height:42px}
    body.review-admin.project-pill-layout[data-dashboard-embedded-workspace="1"] .project-header-sticky .topbar-actions {
        display:grid!important;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)!important;grid-template-rows:auto;
        align-items:center!important;justify-content:normal!important;column-gap:16px!important;row-gap:14px!important;
        position:relative;min-height:42px;padding:0!important;margin:0!important;width:100%;flex-wrap:nowrap!important;
    }
    body.review-admin.project-pill-layout[data-dashboard-embedded-workspace="1"] .topbar-actions > .pill-left {grid-column:1!important;grid-row:1!important;display:flex;align-items:center;justify-self:start;min-width:0;max-width:100%;margin:0!important}
    body.review-admin.project-pill-layout[data-dashboard-embedded-workspace="1"] .topbar-actions > .pill-actions {
        grid-column:2!important;grid-row:1!important;justify-self:center!important;display:flex!important;align-items:center;
        flex-wrap:nowrap!important;gap:0!important;width:max-content;max-width:none!important;margin:0!important;order:0!important;
    }
    body.review-admin.project-pill-layout .pill-actions > * {order:0!important}
    body.review-admin.project-pill-layout[data-dashboard-embedded-workspace="1"] .project-header-sticky .topbar-actions > #dropzone.topbar-upload-dropzone {display:none!important}
    body.review-admin.project-pill-layout #project-pill-actions button.pill-upload-button {
        display:inline-flex;align-items:center;justify-content:center;flex:0 0 52px;width:52px;
        height:var(--pill-control-height)!important;min-height:var(--pill-control-height)!important;padding:0!important;
        border:1px solid #ccd9e6;border-right:0!important;border-radius:13px 0 0 13px!important;background:#fff;color:#23364b;
    }
    body.review-admin.project-pill-layout .pill-upload-button svg {width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
    body.review-admin.project-pill-layout .pill-upload-button:hover {background:#edf4fb;color:#1f3f5c}
    body.review-admin.project-pill-layout .pill-upload-button:focus-visible {outline:2px solid #9fb8d1;outline-offset:2px}
    body.review-admin.project-pill-layout .pill-upload-button:disabled {opacity:.4;cursor:default}
    body.review-admin.project-pill-layout[data-project-mode="audio"] .audio-connected-actions .site-present-audio-mode-btn:first-child,
    body.review-admin.project-pill-layout[data-project-mode="files"] .files-connected-actions > #files-sync-goodybag-btn.files-connected-temp-folder,
    body.review-admin.project-pill-layout #project-pill-actions :is(#show-favorites-btn,#add-layout-spacer-btn,#video-grid-scale-toggle-btn,#photo-grid-rows-btn) {border-radius:0!important}
    body.review-admin.project-pill-layout .pill-project-context {grid-column:3;grid-row:1;justify-self:end;display:flex;align-items:center;justify-content:flex-end;gap:20px;min-width:0;max-width:260px;width:100%}
    body.review-admin.project-pill-layout .pill-project-name {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font:var(--workspace-name-font);color:var(--ink)}
    body.review-admin.project-pill-layout .project-header-sticky .topbar-actions > .pill-project-context > button.pill-project-close {
        display:inline-flex;align-items:center;justify-content:center;flex:0 0 42px;width:42px;min-width:42px;
        height:var(--pill-control-height)!important;min-height:var(--pill-control-height)!important;margin:0;padding:0!important;border-radius:13px!important;
        color:#5d7590;
    }
    body.review-admin.project-pill-layout .pill-project-close svg {flex:0 0 20px;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
    /* On narrow desktops, preserve the control sizes on a centered second row. */
    body.review-admin.project-pill-layout.pill-toolbar-stacked[data-dashboard-embedded-workspace="1"] .project-header-sticky .topbar-actions {grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
    body.review-admin.project-pill-layout.pill-toolbar-stacked .topbar-actions > .pill-actions {grid-column:1/-1!important;grid-row:2!important}
    body.review-admin.project-pill-layout.pill-toolbar-stacked .pill-project-context {grid-column:2;grid-row:1}
    body.review-admin.project-pill-layout[data-project-mode="audio"][data-dashboard-embedded-workspace="1"] .project-header-sticky .topbar-actions {margin-top:4px!important}

    /* Join Notes' existing editor and zoom/preview/share groups. */
    body.review-admin.project-pill-layout[data-project-mode="blog"] .project-header-sticky {padding-top:20px;padding-bottom:19px}
    body.review-admin.project-pill-layout .pill-actions .nc-editor-bar {display:flex;flex-wrap:nowrap!important;gap:0;padding:0;margin:0;border:0;background:transparent;width:auto!important;order:0!important}
    body.review-admin.project-pill-layout .pill-actions .nc-editor-bar button {height:42px;min-height:42px;border-radius:0;border-right:0}
    body.review-admin.project-pill-layout .pill-actions .nc-editor-bar button:first-child {border-radius:13px 0 0 13px}
    body.review-admin.project-pill-layout .pill-actions .blog-project-right-controls {margin:0!important;flex:0 0 auto}
    body.review-admin.project-pill-layout .pill-actions .nc-zoom-pill select.nc-zoom {border-radius:0!important}
    body.review-admin.project-pill-layout .pill-actions .nc-save-indicator {position:absolute;top:100%;left:50%;transform:translateX(-50%);white-space:nowrap}
    body.review-admin.project-pill-layout .nc-upload-panel:is([data-phase="preparing"],[data-phase="uploading"],[data-phase="finishing"],[data-phase="canceling"]) {display:none!important}
    body.review-admin.project-pill-layout .upload-item .progress-fill,
    body.projects-dashboard.dashboard-pill-header .upload-activity-wrap .progress-fill {background:#111!important}
    body.review-admin.project-pill-layout .upload-item .progress-track {height:2px}
    html[data-theme="dark"] body.review-admin.project-pill-layout .pill-project-name {color:#e8eef7}
    @media(max-width:1100px) {
        .pill-header-upload {max-width:calc(100% - 600px)}
        .pill-upload-details {gap:6px}
        .pill-upload-size,.pill-upload-phase {display:none}
    }
}

/* Activity button, desktop: the word "Activity" is shown; unread items appear as a
   red badge with a white number; with nothing new, no empty circle. A new item
   makes the badge pulse once. */
@media (min-width:900px) {
    body.projects-dashboard #dashboard-activity-btn,
    body.projects-dashboard.dashboard-pill-header .dashboard-shell-control-cluster > #dashboard-activity-btn {
        display:inline-flex;align-items:center;gap:8px;
        flex:0 0 auto;width:auto;min-width:0;padding:0 6px;
    }
    body.projects-dashboard .dashboard-project-header-context > #dashboard-activity-btn {margin-right:14px}
    body.projects-dashboard #dashboard-activity-btn .dashboard-activity-label,
    body.projects-dashboard .dashboard-shell-control-cluster #dashboard-activity-btn .dashboard-activity-label {
        display:inline;position:static;width:auto;height:auto;overflow:visible;clip:auto;clip-path:none;
        font-size:13.12px;font-weight:400;line-height:1;color:rgb(67, 91, 115);white-space:nowrap;
    }
    body.projects-dashboard #dashboard-activity-btn.has-unread .dashboard-activity-label {color:#12202f}
    body.projects-dashboard #dashboard-activity-btn .dashboard-activity-dot {display:none !important}
    body.projects-dashboard #dashboard-activity-badge {
        min-width:20px;height:20px;padding:0 6px;border:0;
        background:#cf2e42;color:#ffffff;font-size:11.5px;font-weight:600;line-height:20px;
    }
    body.projects-dashboard #dashboard-activity-badge.is-pulsing {animation:dashboard-activity-pulse 900ms ease-out 1}
}
@keyframes dashboard-activity-pulse {
    0% {transform:scale(1);box-shadow:0 0 0 0 rgba(207, 46, 66, 0.35)}
    40% {transform:scale(1.18);box-shadow:0 0 0 6px rgba(207, 46, 66, 0)}
    100% {transform:scale(1);box-shadow:0 0 0 0 rgba(207, 46, 66, 0)}
}
@media (prefers-reduced-motion: reduce) {
    body.projects-dashboard #dashboard-activity-badge.is-pulsing {animation:none}
}

/* Download all in Video, Photo and Audio (same look as the Files download button).
   Only inside the toolbar pill; anywhere else it stays hidden. */
body.review-admin:not(.project-pill-layout) .project-download-control {display:none!important}
body.review-admin.project-pill-layout #project-pill-actions > .project-download-control {position:relative;display:inline-flex;flex:0 0 52px;width:52px;min-width:52px}
body.review-admin.project-pill-layout #project-pill-actions .project-download-btn {
    display:inline-flex;align-items:center;justify-content:center;width:52px;min-width:52px;
    height:var(--pill-control-height)!important;min-height:var(--pill-control-height)!important;margin:0!important;padding:0!important;
    border:1px solid #ccd9e6!important;border-right-width:0!important;border-radius:0!important;background:#fff!important;color:#23364b;
    box-shadow:none!important;overflow:hidden;font-size:0!important;line-height:0;
}
body.review-admin.project-pill-layout #project-pill-actions .project-download-btn::before {content:"";display:block;width:22px;height:22px;margin:auto;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d7590' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m7.5 10.5 4.5 4.5 4.5-4.5'/%3E%3Cpath d='M4 20h16'/%3E%3C/svg%3E") center/contain no-repeat}
body.review-admin.project-pill-layout #project-pill-actions .project-download-btn:is(:hover,:focus-visible) {background:#edf4fb!important;color:#1f3f5c!important;outline:none}
body.review-admin.project-pill-layout #project-pill-actions .project-download-btn:disabled {opacity:.5;cursor:default}
body.review-admin.project-pill-layout #project-pill-actions .project-download-progress {position:absolute;top:calc(100% + 8px);left:-52px;z-index:40;width:280px;box-sizing:border-box;box-shadow:0 12px 30px rgba(56,78,101,.16);line-height:1.2}

/* Header order: Reel · Search · Activity · menu. In an open project Reel and Search
   hide, so Activity and the menu keep their places. Desktop only. */
@media (min-width:900px) {
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-view-menu {order:1}
    body.projects-dashboard .dashboard-shell-control-cluster > #open-media-search-btn {order:2}
    body.projects-dashboard .dashboard-shell-control-cluster > #dashboard-activity-btn {order:3}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu {order:4}
}

/* Menu order and open sections (desktop). The menu HTML is unchanged; phones keep their menu. */
@media (min-width:900px) {
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover:not([hidden]) {display:flex;flex-direction:column}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > .dashboard-menu-modules-section {order:1}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > .dashboard-menu-section:has(#dashboard-system-settings-menu-btn) {order:2}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > .dashboard-language-menu {order:3}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > #dashboard-tutorials-link {order:4}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > #dashboard-tools-link {order:5}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > #dashboard-sharepoints-btn {order:6}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > #dashboard-import-portfolio-btn {order:7}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > :is(.dashboard-backup-progress,.dashboard-backup-status) {order:8}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover > a.dashboard-menu-link:last-child {order:9}
    /* Open section: tinted block, line on the left, closing line, bold heading. */
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-section-toggle[aria-expanded="true"] {font-weight:600}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-section-panel:not([hidden]),
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-modules-section .modules-menu-popover:not([hidden]) {
        padding:4px 0 6px;background:#e8e5de;border:0;border-bottom:1px solid #d5d5d2;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-section-panel .dashboard-menu-link {
        min-height:36px;height:36px;border-bottom:0;font-size:.86rem;color:#4a5a6b;
    }
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-section-panel .dashboard-menu-link:is(:hover,:focus-visible) {background:#f2f0eb;color:#233c55}
    body.projects-dashboard .dashboard-shell-control-cluster > .dashboard-menu > .dashboard-menu-popover .dashboard-menu-modules-section .modules-menu-option {min-height:38px;font-size:.86rem;color:#4a5a6b}
}
