/*
 * WorqNET app shell, loaded on every page through the ThemeHead view component.
 *
 * Layout (large screens): the top bar sits on the page background; below it the page content is
 * one white box with a soft rounded top-left corner, a thin border, a small gap from the sidebar,
 * running off the right and bottom edges of the screen. The box is made of
 * the elements after the top bar (.wn-topbar): an optional sub-navigation strip, then the
 * scrolling content area (.flex-1.overflow-y-auto).
 *
 * Colours come from the active theme's --wn-* variables (ThemeHeadRenderer); the fallbacks are
 * the built-in look. Selectors start with "html" and use !important because the Tailwind CDN
 * injects its own styles after this file.
 */

/* ── Ambient background gradient ─────────────────────────────────────────────────────────────
   A soft wash of the WorqNET mark's own colours (indigo, coral) in the corners of the viewport.
   The sidebar and the white content box sit on top of it and stay fully opaque, so within the app
   shell it only shows through the thin gap around those panels; on pages with no boxed layout of
   their own (sign-in, sign-up, the public marketing pages) the full wash is visible. */
html {
    background-color: var(--wn-page-bg, #F9FAFB);
    background-image: var(--wn-ambient-gradient);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

:root {
    --wn-ambient-gradient:
        radial-gradient(48rem circle at 100% 100%, color-mix(in srgb, #FF6B4A 20%, transparent), transparent 60%),
        radial-gradient(40rem circle at 0% 0%, color-mix(in srgb, #4338CA 18%, transparent), transparent 60%),
        radial-gradient(36rem circle at 100% 0%, color-mix(in srgb, #7C6FF0 14%, transparent), transparent 55%);

    /* The WorqNET mark's own two colours (shared by every inline copy of the mark via the
       wn-mark-ink/wn-mark-accent classes below), so a dark-mode page can swap them for a pair
       that still reads against a dark sidebar without touching every SVG that uses them. */
    --wn-mark-ink: #2B2E33;
    --wn-mark-accent: #1D9A6C;
}

.wn-mark-ink { fill: var(--wn-mark-ink); }
.wn-mark-accent { fill: var(--wn-mark-accent); }

/* While a top-bar menu (account, language) is open, lift the bar above the Worqi panel (fixed, z-46),
   which starts right under the bar; otherwise the menu opens behind the panel and can't be clicked. */
html .wn-topbar:has(details[open]),
html .wn-topbar:has(#notif-panel:not(.hidden)) {
    position: relative;
    z-index: 60 !important;
}

@media (min-width: 1024px) {
    html body:has(.wn-topbar),
    html :has(> .wn-topbar) {
        /* --wn-shell-bg is set when the sidebar colour carries on across the top bar.
           No gradient here: the sidebar and content box leave only a sliver of this background
           exposed, too small for a gradient to read as anything but a stray colour patch. */
        /* Without a theme frame colour (the default WorqNET look) the frame follows the sidebar, which is
           the Content Area colour (bg-white), so the sidebar and top bar read as one panel. */
        background-color: var(--wn-shell-bg, var(--wn-surface, #FFFFFF)) !important;
        background-image: none !important;
    }

    html .wn-topbar {
        background-color: var(--wn-header-bg, transparent) !important;
        border-bottom-color: transparent !important;
        box-shadow: none !important;
    }

    html body:has(.wn-topbar) .wn-sidebar {
        border-right-color: transparent !important;
    }

    /* Every piece of the box: the first element under the top bar (the breadcrumb strip on organization
       pages), what directly follows the breadcrumb (e.g. a tabs strip) and the scrolling content area. */
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute),
    html .wn-breadcrumb + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute),
    html .wn-topbar ~ :is(div, main, section).flex-1.overflow-y-auto {
        background-color: var(--wn-surface, #FFFFFF) !important;
        border-left: 1px solid var(--wn-border, #E5E7EB) !important;
        margin-left: .25rem;
    }
    /* Anything else between them (e.g. Staff's "Just added" ribbon) keeps its own colour but lines up
       with the box's left edge. */
    html .wn-breadcrumb ~ :is(div, main, nav, section)[class]:not(.fixed):not(.absolute) {
        border-left: 1px solid var(--wn-border, #E5E7EB) !important;
        margin-left: .25rem;
    }

    /* Top edge and its curve. */
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute) {
        border-top: 1px solid var(--wn-border, #E5E7EB) !important;
        border-top-left-radius: 1rem !important;
    }

    /* The box runs down to the bottom of the screen, with only a small space under the last card.
       Its bottom-left corner is rounded to match the top-left one, so the left edge reads as one
       continuous curve instead of rounded at the top and square at the bottom. */
    html .wn-topbar ~ :is(div, main, section).flex-1.overflow-y-auto {
        margin-bottom: 0;
        padding-bottom: 1rem !important;
        border-bottom-left-radius: 1rem !important;
    }
    /* Pages whose content box is a full-height wrapper that scrolls inside (the project Board, Backlog and
       Releases) round its bottom-left corner the same way. */
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, section).flex-1[class]:not(.fixed):not(.absolute) {
        border-bottom-left-radius: 1rem !important;
    }

    /* A sub-navigation strip under the top bar keeps only its divider towards the content. */
    html :is(.wn-topbar, .wn-topbar + script) + :is(div, nav)[class].border-b:not(.overflow-y-auto) {
        border-bottom-color: var(--wn-border, #E5E7EB) !important;
    }
    /* Wide pages use the whole box instead of a centred column with empty space on both sides.
       Narrow forms (max-w-2xl, max-w-3xl) and anything inside dialogs and pop-ups stay as they are. */
    html .wn-topbar ~ * :is(.max-w-4xl, .max-w-5xl, .max-w-6xl, .max-w-7xl).mx-auto:not(.fixed *):not(.absolute *):not([role="dialog"] *) {
        max-width: none !important;
    }
}

/* ── Phones and tablets (below 1024px): the same frame, drawn all the way round ───────────────
   The top bar sits on the themed frame and the page content is one rounded, bordered box inset a
   few pixels from the left, right and bottom edges, as in GitLab's mobile layout. The navigation
   is a drawer (the sidebar, slid in from the left) with rounded right corners over a dimmed page;
   tapping the dimmed page closes it (shell.js). */

@media (max-width: 1023.98px) {
    html body:has(.wn-topbar),
    html :has(> .wn-topbar) {
        background-color: var(--wn-shell-bg, var(--wn-surface, #FFFFFF)) !important;
        background-image: none !important;
    }

    html .wn-topbar {
        background-color: var(--wn-header-bg, transparent) !important;
        border-bottom-color: transparent !important;
        box-shadow: none !important;
    }

    /* Every piece of the box, as on large screens, but with a border and a gap on both sides. */
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute),
    html .wn-breadcrumb + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute),
    html .wn-topbar ~ :is(div, main, section).flex-1.overflow-y-auto {
        background-color: var(--wn-surface, #FFFFFF) !important;
        border-left: 1px solid var(--wn-border, #E5E7EB) !important;
        border-right: 1px solid var(--wn-border, #E5E7EB) !important;
        margin-left: .375rem;
        margin-right: .375rem;
    }
    html .wn-breadcrumb ~ :is(div, main, nav, section)[class]:not(.fixed):not(.absolute) {
        border-left: 1px solid var(--wn-border, #E5E7EB) !important;
        border-right: 1px solid var(--wn-border, #E5E7EB) !important;
        margin-left: .375rem;
        margin-right: .375rem;
    }

    /* Top edge and its curves. */
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, nav, section)[class]:not(.fixed):not(.absolute) {
        border-top: 1px solid var(--wn-border, #E5E7EB) !important;
        border-top-left-radius: .75rem !important;
        border-top-right-radius: .75rem !important;
    }

    /* Bottom edge: a small gap under the box, and its lower corners curved. */
    html .wn-topbar ~ :is(div, main, section).flex-1.overflow-y-auto,
    html :is(.wn-topbar, .wn-topbar + script, .wn-topbar + script + script) + :is(div, main, section).flex-1[class]:not(.fixed):not(.absolute) {
        margin-bottom: .375rem;
        border-bottom: 1px solid var(--wn-border, #E5E7EB) !important;
        border-bottom-left-radius: .75rem !important;
        border-bottom-right-radius: .75rem !important;
    }
    html .wn-topbar ~ :is(div, main, section).flex-1.overflow-y-auto {
        padding-bottom: 1rem !important;
    }

    /* A sub-navigation strip under the top bar keeps only its divider towards the content. */
    html :is(.wn-topbar, .wn-topbar + script) + :is(div, nav)[class].border-b:not(.overflow-y-auto) {
        border-bottom-color: var(--wn-border, #E5E7EB) !important;
    }

    /* The drawer. */
    html .wn-sidebar[data-collapsible] {
        border-right-width: 0 !important;
        border-top-right-radius: 1rem;
        border-bottom-right-radius: 1rem;
        box-shadow: 0 12px 32px rgb(15 23 42 / .22);
        overscroll-behavior: contain;
    }
    html .wn-sidebar[data-collapsible]:not(.\!translate-x-0) {
        box-shadow: none;
    }
    /* The page behind an open drawer is dimmed. Pages put the "open" state on the sidebar as the
       !translate-x-0 class. The dim layer sits under the drawer (z-50; Worqi z-46) and above the top bar (z-35). */
    html body:has(.wn-sidebar.\!translate-x-0)::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 45;
        background-color: rgb(15 23 42 / .45);
        animation: wn-drawer-dim .2s ease;
    }

    /* Worqi (_AiChatPanel): a rounded sheet inset by the same gap as the content box, instead of a
       square full-screen slab, over a dimmed page. The ids beat the panel's own utility classes. */
    /* Sized to the visual viewport (--wn-vv-top / --wn-vv-h, kept up to date by _AiChatPanel) so the
       on-screen keyboard shrinks the sheet instead of covering or scrolling it. */
    html #ai-chat-drawer {
        top: calc(var(--wn-vv-top, 0px) + .375rem);
        bottom: auto;
        height: calc(100vh - .75rem);
        height: calc(var(--wn-vv-h, 100dvh) - .75rem);
        left: .375rem;
        right: .375rem;
        width: auto;
        border: 1px solid var(--wn-border, #E5E7EB) !important;
        border-radius: 1rem !important;
        overflow: hidden;
        box-shadow: 0 12px 32px rgb(15 23 42 / .22);
        overscroll-behavior: contain;
    }
    html #ai-chat-backdrop {
        background-color: rgb(15 23 42 / .45);
    }
    html #ai-chat-drawer > .h-12 {
        height: 3.25rem;
    }
    /* Larger touch targets for the header buttons. */
    html #ai-chat-drawer > .h-12 button {
        width: 2.5rem;
        height: 2.5rem;
    }
    /* 16px keeps iOS from zooming the page when the message box is focused; the bar clears the home indicator. */
    html #ai-chat-input {
        font-size: 16px;
    }
    html #ai-chat-input-bar {
        padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    }
    html #ai-chat-messages {
        overscroll-behavior: contain;
    }
}
/* ── Top bar on phones (below 640px) ──────────────────────────────────────────────────────────
   The bar keeps the AI button, the bell and the avatar; language and theme moved into the account
   menu (_UserMenu). The notification list and the account menu open as sheets the width of the screen,
   hanging from the bottom edge of the bar, instead of narrow panels anchored to their own button
   (the 20rem notification panel did not fit beside a button in the middle of a 320px bar). Their
   wrappers lose their own positioning so the bar (position: relative) is the box they hang from. */

@media (max-width: 639.98px) {
    html .wn-topbar details.relative,
    html .wn-topbar div.relative:has(> #notif-panel) {
        position: static;
    }
    html .wn-topbar :is(details[data-user-menu] > div.absolute, #notif-panel) {
        position: absolute;
        top: 100%;
        left: .375rem;
        right: .375rem;
        width: auto;
        margin-top: .25rem;
        max-height: calc(100vh - 5rem);
        max-height: calc(100dvh - 5rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: .75rem !important;
        box-shadow: 0 12px 32px rgb(15 23 42 / .22) !important;
    }
    html .wn-topbar #notif-list {
        max-height: none;
    }
    /* Tighter bar: the icons sit closer together, the title gets the room. */
    html .wn-topbar [data-testid="user-menu-bar"] {
        gap: .125rem;
    }
    html .wn-topbar summary[aria-label] {
        padding-right: .25rem;
    }
}
@keyframes wn-drawer-dim {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── No loading skeletons ─────────────────────────────────────────────────────────────────
   Pages show pulsing grey placeholder boxes (animate-pulse) while their data loads; they are hidden,
   so the page stays empty for that moment and the content appears when it is ready. */

html .animate-pulse {
    display: none !important;
}

/* ── Page switches without flicker ─────────────────────────────────────────────────────────
   Every page switch is a full page load. The browser keeps the old page on screen until the new one
   is ready and cross-fades them (cross-document view transitions; browsers without them just load
   the page as before). The sidebar and top bar are matched between the two pages, so they stay put
   instead of fading. Transitions are off while a page loads (.wn-loading, set in the head by
   ThemeHead and removed after load), so nothing slides into place as its styles arrive. */

@view-transition {
    navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .12s;
}
html .wn-sidebar[data-collapsible] {
    view-transition-name: wn-sidebar;
}
html .wn-topbar {
    view-transition-name: wn-topbar;
    /* view-transition-name makes the top bar its own stacking context, so its dropdowns (search
       results, menus) can only stack as high as the bar itself. Lift the bar above page content
       such as the board's z-30 filter bar, staying below the sidebar (z-40) and modals (z-50). */
    position: relative;
    z-index: 35;
}
html.wn-loading *,
html.wn-loading *::before,
html.wn-loading *::after {
    transition: none !important;
}

/* ── While a page's Vue app starts (v-cloak) ────────────────────────────────────────────────
   Many pages put the whole screen (sidebar, top bar and content box) inside their Vue app and hide
   it with v-cloak until the app has started, so every page load began with an empty screen. The frame
   is shown straight away instead; only what is inside the content box (not yet filled in) and any
   pop-ups, menus and dialogs (all drawn at once before Vue decides which to show) stay hidden. The
   per-page "[v-cloak] { display: none !important }" rules lose to this more specific one. */

html body [v-cloak].flex:has(.wn-topbar, .wn-sidebar) {
    display: flex !important;
}
html body [v-cloak]:has(.wn-topbar, .wn-sidebar) :is(.wn-topbar ~ * > *, .fixed:not(.wn-sidebar), .absolute) {
    visibility: hidden !important;
}
/* Before Vue starts, conditional parts (banners, ribbons, empty states, dialogs) still carry their
   raw v-if / v-else / v-show attributes and would all show at once, e.g. Staff's amber "Just added"
   ribbon flashing on every visit. Vue removes these attributes when it renders. */
html body [v-cloak] :is([v-if], [v-else-if], [v-else], [v-show]) {
    display: none !important;
}

/* ── Cards (wn-card: people, requests, policies, documents): one size everywhere ─────────────
   At least the height of a full Staff card, so a card with less inside (e.g. Users) is the same
   size, and its last part (the View Profile / View Details buttons) sits at the bottom. */

html .wn-card {
    display: flex;
    flex-direction: column;
    min-height: 13.75rem;
}
html .wn-card > :last-child {
    margin-top: auto !important;
}

/* ── Breadcrumb: the top strip of the content box, right under the top bar (ThemeHead wnAddBreadcrumb);
   it stays put while the content below it scrolls ── */

.wn-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    padding: 1rem 1rem .25rem;
    font-size: .75rem;
    line-height: 1rem;
    font-weight: 700;
    color: var(--wn-text-muted, #9CA3AF);
}
@media (min-width: 640px) {
    .wn-breadcrumb {
        padding: 1.25rem 2rem .25rem;
    }
}
.wn-breadcrumb a {
    color: inherit;
    text-decoration: none;
}
.wn-breadcrumb a:hover {
    color: var(--wn-primary, #2563EB);
}

/* ── AI assistant button in the top bar (_AiChatButton): shown once AI is on for the organization ── */

html.wn-ai-enabled .wn-ai-chat-btn {
    display: inline-flex !important;
}

/* ── Worqi docked, not floating on top ───────────────────────────────────────────────────────
   The panel (_AiChatPanel) is a fixed drawer at the right edge; on its own that overlaps whatever
   the page is showing, which reads as a modal popup rather than a docked side panel. Reserving its
   width on the CONTENT BOX specifically -- the same element the rules above already give a white
   background and rounded corners -- reflows the page's own content beside it. This must not be done
   on body/html: that would shrink the top bar too (it's a sibling of the content box in the same
   flex column), squeezing its search box and icons down to nothing. The top bar, and everything
   inside it, must stay exactly as wide as it always is regardless of Worqi's state. Both this and
   the drawer's own width read --wn-ai-chat-width, so dragging its resize handle grows or shrinks the
   reserved space in lockstep with the panel. Below sm: the drawer is full-width and sits over the
   page like a mobile sheet, so nothing needs to make room. */
:root {
    --wn-ai-chat-width: 24rem;
}
@media (min-width: 1024px) {
    /* Every piece of the content box -- whatever follows the top bar: the breadcrumb strip, tabs,
       ribbons and the content itself, however a page nests its scrolling area -- steps in by Worqi's
       width, so no page has content under the panel. Pop-ups (fixed/absolute) and scripts are left alone. */
    html.wn-ai-chat-open .wn-topbar ~ :not(script):not(style):not(.fixed):not(.absolute) {
        margin-right: var(--wn-ai-chat-width, 24rem) !important;
    }
    html:not(.wn-ai-chat-resizing) .wn-topbar ~ :not(script):not(style):not(.fixed):not(.absolute) {
        transition: margin-right .3s ease;
    }

    /* Matches the content box's own top-left treatment (border-top-left-radius: 1rem, above), so the
       two read as one continuous rounded frame instead of the content box being a card and Worqi a
       separate, borderless, flush-to-the-screen-edge slab beside it. A plain rule on the drawer's own
       id, not Tailwind utility classes on the element (rounded-tr-[1rem] and friends): those weren't
       taking effect, and every other piece of this frame is already done exactly this way. */
    html #ai-chat-drawer {
        border-top: 1px solid var(--wn-border, #E5E7EB) !important;
        border-top-right-radius: 1rem !important;
        border-bottom-right-radius: 1rem !important;
    }
}

/* ── Worqi's start page (Worqi/Index) ─────────────────────────────────────────────────────────
   The same panel drawn inline and full height instead of as a drawer or a phone sheet, so none of
   the drawer rules above apply (the attribute makes these win over them at every width). The
   conversation reads as a centred column, like a document, instead of stretching across a wide screen. */
html #ai-chat-drawer[data-mode="page"] {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    transform: none;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none;
}
html #ai-chat-drawer[data-mode="page"] :is(#ai-chat-messages, #ai-chat-history, #ai-chat-typing) {
    padding-inline: max(1rem, calc((100% - 48rem) / 2));
}
/* Flow mode (the Organizations page): no box of its own to scroll; the page scrolls, and the message box
   stays at the bottom of the window. */
html #ai-chat-drawer[data-mode="page"][data-flow] {
    overflow: visible;
}
html #ai-chat-drawer[data-mode="page"][data-flow] :is(#ai-chat-messages, #ai-chat-history) {
    flex: 1 0 auto;
    overflow: visible;
}
html #ai-chat-drawer[data-mode="page"][data-flow] #ai-chat-input-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: var(--wn-surface, #fff);
}
.wn-worqi-page-column {
    width: 100%;
    max-width: 48rem;
    margin-inline: auto;
}

/* ── Sidebar menu text: a touch bolder (medium), the selected item semibold ─────────────────── */

html .wn-sidebar[data-collapsible] nav :is(a, summary) {
    font-weight: 500;
}
html .wn-sidebar[data-collapsible] nav a.bg-blue-50 {
    font-weight: 600;
}
/* A short bar on the sidebar's left edge, beside the selected item, marks it, in the item's text colour
   so it follows the theme (blue by default, the theme's Sidebar Active Text otherwise). The nav is the
   positioning box, so the bar sits at the panel edge for sub-items too; with no top set it takes the
   item's static position, which its flex centring puts level with the item's middle. */
html .wn-sidebar[data-collapsible] nav {
    position: relative;
}
html .wn-sidebar[data-collapsible] nav a.bg-blue-50::before {
    content: "";
    position: absolute;
    left: 0;
    width: 4px;
    height: 1.25rem;
    border-radius: 0 4px 4px 0;
    background-color: currentColor;
}

/* ── Sidebar density: compact rows (about 32px) and tighter section breaks ─────────────────── */

html .wn-sidebar[data-collapsible] .wn-sidebar-head {
    height: 3rem;
}

/* ── Top bar density: match the sidebar header's height and give its right edge less padding ── */
/* Shorter than the sidebar rows below it, trading top-bar height for more room in the page itself. */

/* Keep the top bar flexible so wrapped project nav content can grow without overflowing the header.
   We still preserve the compact 52px visual rhythm and align it with the sidebar header. */
html .wn-topbar {
    min-height: 3rem !important;
    height: auto !important;
    padding-top: .25rem !important;
    padding-bottom: .25rem !important;
}
html .wn-topbar > .min-h-16 {
    height: auto !important;
    min-height: 3.25rem !important;
}
html .wn-topbar:has(> .min-h-16) {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
html .wn-sidebar[data-collapsible] .wn-sidebar-head {
    height: 3.25rem;
}
@media (min-width: 640px) {
    html .wn-topbar {
        padding-right: 1.25rem !important;
    }
}
html .wn-sidebar[data-collapsible] nav {
    padding-top: .25rem;
    padding-bottom: .5rem;
}
html .wn-sidebar[data-collapsible] nav > :is(a, details, div) + :is(a, details) {
    margin-top: 1px;
}
html .wn-sidebar[data-collapsible] :is(nav a, nav summary, .wn-sidebar-foot a, .wn-sidebar-collapse) {
    padding-top: .375rem;
    padding-bottom: .375rem;
    line-height: 1.25rem;
}
/* The icons' own line height (text-lg: 28px) was what made each row tall. */
html .wn-sidebar[data-collapsible] :is(nav, .wn-sidebar-foot) .mdi {
    line-height: 1.25rem;
}
/* Group titles (Main, Work, Account / Plan, Tools, Settings). */
html .wn-sidebar[data-collapsible] nav > div:not(:first-child) {
    padding-top: .75rem;
}
html .wn-sidebar[data-collapsible] nav > div {
    padding-bottom: .25rem;
}
/* People's sub-items. */
html .wn-sidebar[data-collapsible] details > div > a {
    padding-top: .3rem;
    padding-bottom: .3rem;
}
html .wn-sidebar[data-collapsible] details > div > a + a {
    margin-top: 1px;
}
html .wn-sidebar[data-collapsible] .wn-sidebar-foot {
    padding: .5rem .75rem;
}

/* ── Collapsible sidebar (_OrgSidebar, _ProjectTopNav; large screens) ─────────────────────── */

/* "Collapse sidebar" at the foot of the sidebar (_SidebarCollapseButton) puts .wn-sidebar-collapsed on
   <html>, shrinking the sidebar to an icon rail: the logo, the menu icons and an "expand" icon. Menu
   labels are bare text beside their icon, so they are hidden with font-size 0 while the icons keep
   their own size. */
html .wn-sidebar-collapse .wn-when-collapsed,
html.wn-sidebar-collapsed .wn-sidebar-collapse .wn-when-open {
    display: none;
}
html.wn-sidebar-collapsed .wn-sidebar-collapse .wn-when-collapsed {
    display: inline;
}

@media (min-width: 1024px) {
    /* 14rem fits the longest menu name ("Organization Profile") without empty space on the right. */
    html .wn-sidebar[data-collapsible] {
        width: 14rem !important;
        transition: width .2s ease, transform .3s;
    }
    /* The menu scrolls without a permanent scrollbar eating into the width; it shows on hover. */
    html .wn-sidebar[data-collapsible] nav {
        scrollbar-width: none;
    }
    html .wn-sidebar[data-collapsible] nav:hover {
        scrollbar-width: thin;
    }
    html .wn-sidebar[data-collapsible] nav::-webkit-scrollbar {
        width: 0;
    }
    html .wn-sidebar[data-collapsible] nav:hover::-webkit-scrollbar {
        width: 6px;
    }
    /* The project sidebar (_ProjectTopNav) is fixed, so the page steps aside for it. */
    html body:has(> .wn-project-sidebar) {
        padding-left: 14rem;
        transition: padding-left .2s ease;
    }
    html.wn-sidebar-collapsed body:has(> .wn-project-sidebar) {
        padding-left: 4.5rem;
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] {
        width: 4.5rem !important;
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] .wn-sidebar-head {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }
    /* Collapsed: the logo stays (without "WorqNET"); the project picker, group titles and sub-items go. */
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] :is(.wn-sidebar-label, .wn-sidebar-brand, nav > div, details > div, summary > i + i) {
        display: none !important;
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] :is(nav a, nav summary, .wn-sidebar-foot a, .wn-sidebar-collapse) {
        font-size: 0;
        gap: 0;
        justify-content: center;
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] :is(nav, nav:hover) {
        scrollbar-width: none;
    }

    /* Flyout: a group's pages (People, Settings) beside the icon rail after its icon is clicked (_OrgSidebar's script
       opens the group and sets --wn-flyout-top level with its row). Fixed, so the scrolling menu does not
       clip it; the sidebar (transformed) is its containing block, so 4.5rem is the rail's right edge. */
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] details.wn-flyout > div {
        display: block !important;
        position: fixed;
        z-index: 60;
        left: calc(4.5rem - 1px);
        top: var(--wn-flyout-top, 0);
        min-width: 13rem;
        max-height: calc(100vh - 1rem);
        overflow-y: auto;
        margin: 0 !important;
        padding: 0 0 .375rem !important;
        border: 1px solid color-mix(in srgb, var(--wn-sidebar-text, #6B7280) 18%, transparent) !important;
        border-radius: .75rem;
        background-color: var(--wn-sidebar-bg, #FFFFFF);
        box-shadow: 0 12px 32px rgb(15 23 42 / .14);
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] details.wn-flyout > div::before {
        content: attr(data-flyout-title);
        display: block;
        margin-bottom: .375rem;
        padding: .625rem 1rem;
        border-bottom: 1px solid color-mix(in srgb, var(--wn-sidebar-text, #6B7280) 15%, transparent);
        font-size: .8125rem;
        font-weight: 700;
        color: var(--wn-sidebar-text, #374151);
    }
    html.wn-sidebar-collapsed .wn-sidebar[data-collapsible] details.wn-flyout > div > a {
        margin: 1px .375rem 0;
        padding: .45rem .625rem;
        font-size: .875rem;
        gap: .625rem;
        justify-content: flex-start;
        white-space: nowrap;
    }
}

/* ── Scrollbars: thin, no track background, no arrow buttons ─────────────────────────────── */

html, html * {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--wn-text-muted, #6B7280) 35%, transparent) transparent;
}

html ::-webkit-scrollbar { width: 6px; height: 6px; background: transparent; }
html ::-webkit-scrollbar-track { background: transparent; }
html ::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--wn-text-muted, #6B7280) 35%, transparent);
    border-radius: 9999px;
}
html ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* ── Search box: pill shaped with a "/" key hint ─────────────────────────────────────────── */

/* Rendered by _UserMenu inside the top bar and centred in it; shown on wide screens in the top bar of
   pages with a sidebar (the Organizations list's site header has none to search). */
.wn-search {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 40;
    width: min(26rem, 32vw);
    transform: translate(-50%, -50%);
    display: none;
    /* It re-centers over the top bar (shell.js) whenever that bar's own width changes -- opening or
       resizing Worqi included. Without this it visibly jumps to the new position; with it, it slides. */
    transition: left .2s ease;
}
html .wn-topbar:has(.wn-search) {
    position: relative;
}

@media (min-width: 1280px) {
    html body:has(.wn-sidebar) .wn-topbar .wn-search { display: block; }
}

.wn-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.wn-search-field > .mdi {
    position: absolute;
    left: .85rem;
    font-size: 1.05rem;
    color: var(--wn-text-muted, #6B7280);
    pointer-events: none;
}

html .wn-search-input,
html #project-search-input {
    width: 100%;
    height: 2.25rem;
    padding: 0 1rem 0 2.25rem !important;
    border: 1px solid var(--wn-border, #E5E7EB) !important;
    border-radius: 9999px !important;
    background-color: var(--wn-surface, #FFFFFF) !important;
    color: var(--wn-text, #111827) !important;
    font-size: .875rem;
    outline: none;
    box-shadow: none !important;
}

html .wn-search-input::placeholder,
html #project-search-input::placeholder {
    color: var(--wn-text-muted, #6B7280);
    opacity: 1;
}

html .wn-search-input:focus,
html #project-search-input:focus {
    border-color: var(--wn-primary, #2563EB) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wn-primary, #2563EB) 18%, transparent) !important;
}

.wn-search-results {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    max-height: 22rem;
    overflow-y: auto;
    padding: .35rem;
    border: 1px solid var(--wn-border, #E5E7EB);
    border-radius: .5rem;
    background-color: var(--wn-surface, #FFFFFF);
    box-shadow: 0 8px 24px rgb(15 23 42 / .08);
}

.wn-search-results[hidden] { display: none; }

.wn-search-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .65rem;
    border-radius: .375rem;
    color: var(--wn-text, #111827);
    font-size: .875rem;
    text-decoration: none;
}

.wn-search-item .mdi { color: var(--wn-text-muted, #6B7280); font-size: 1.05rem; }

.wn-search-item-group { margin-left: auto; color: var(--wn-text-muted, #6B7280); font-size: .75rem; }

.wn-search-item[aria-selected="true"],
.wn-search-item:hover {
    background-color: color-mix(in srgb, var(--wn-text, #111827) 6%, transparent);
}

.wn-search-empty { padding: .6rem .65rem; color: var(--wn-text-muted, #6B7280); font-size: .875rem; }

/* ── Inside the box: flat cards and buttons ──────────────────────────────────────────────── */

/* Depth comes from borders; floating menus and dialogs keep a faint shadow. */
html :is(.shadow-sm, .shadow, .shadow-md, .shadow-inner, .hover\:shadow-sm:hover, .hover\:shadow-md:hover) {
    box-shadow: none !important;
}
html :is(.shadow-lg, .hover\:shadow-lg:hover) {
    box-shadow: 0 2px 6px rgb(15 23 42 / .06) !important;
}
html :is(.shadow-xl, .shadow-2xl, .hover\:shadow-xl:hover, .hover\:shadow-2xl:hover) {
    box-shadow: 0 8px 24px rgb(15 23 42 / .08) !important;
}

/* Cards: gently rounded, smaller than the box corner. Buttons and inputs: small corners. */
html :is(.rounded-\[2\.5rem\], .rounded-\[2rem\], .rounded-3xl, .rounded-\[1\.5rem\], .rounded-2xl) {
    border-radius: .5rem !important;
}
html .rounded-t-3xl { border-top-left-radius: .5rem !important; border-top-right-radius: .5rem !important; }
html .rounded-xl { border-radius: .375rem !important; }
html .rounded-lg { border-radius: .25rem !important; }
