/*
 * WISEcode Intelligence — Sidebar (floating navigation)
 *
 * Restyles the EXISTING #sidebar markup (Components/Layout/Sidebar.razor) to
 * match the ip-b2b design-system navigation (.menu-nav-* in pages/agent-page.css):
 * a floating, rounded panel with a linen→white gradient, full-pill rows with
 * circular tinted icon discs, a soft (tinted) hover/active state shared by both
 * — instead of a solid blue fill — and an icon-rail collapse.
 *
 * This file ONLY changes look & feel — the nav content, structure and C# logic
 * are owned by Sidebar.razor and are intentionally untouched (see the
 * "2026-06-22 Arthur Color & Design" notes: match the look/feel/collapse, keep
 * the content).
 *
 * Loaded LAST in Components/App.razor: every rule here is scoped under the
 * #sidebar id so it wins on specificity over the older utility/component rules
 * baked into components.css and design-system.css (many of which use
 * !important). Keep selectors id-anchored so that ordering stays robust.
 */

:root {
  /* Geometry, from the design's #menu-panel (ip-b2b wiseai.html, measured 2026-11-15). The rail is its 68px icon
     column (wise.css --nav-rail-w), flush on the page's field, with every icon centred 36px from the edge. The open
     nav is its 260px card (.menu-inner), 4px in from the window, so the nav takes 264px of the page. The card's
     inset (--sidebar-card-*) keeps the window's frame around it: 12px above, 16px below, and 22px of field beside it
     before the next module (the design's chat module starts at 286px). The gap is the mobile drawer's breathing room
     from the viewport edges. */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 68px;
  --sidebar-card-gutter: 22px;
  --sidebar-card-left: 4px;
  --sidebar-card-top: 12px;
  --sidebar-card-bottom: 16px;
  --sidebar-gap: 12px;
  --sidebar-radius: 16px;
  /* The nav's width as the page sees it: the rail, or the labelled nav while the member has it open (the toggle under
     the logo; js/wci/wci-sidebar-nav.js paints html[data-wci-nav="open"]). Everything right of the nav (the page, the
     WISEcode AI pane, History) starts past it. */
  --wci-nav-w: var(--sidebar-w-collapsed);
  /* History beside the nav (Shared/WISEai/ChatHistoryPanel): its width while open, else 0. */
  --wci-history-w: 0px;
  /* The page's own gap past the nav (and History): 16px beside the rail. The open nav that pushes the page already
     carries the field beside its card (--sidebar-card-gutter), so there it is 0 and the page starts where the design's
     first module does, 22px past the card. */
  --wci-nav-gap: 16px;
}
/* Registered so they can ease: the page, the pane and History glide with the nav and History instead of jumping, and
   History's card grows out from under the pane's edge as that edge moves (ChatHistoryPanel.razor.css). */
@property --wci-nav-w {
  syntax: "<length>";
  inherits: true;
  initial-value: 68px;
}
@property --wci-history-w {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}
@property --wci-nav-gap {
  syntax: "<length>";
  inherits: true;
  initial-value: 16px;
}
/* The WISEcode AI pane's width (wci-modules.css): 380px, or the minimized strip. Eased here with the others so the page
   sheet stays joined to the pane as it minimizes (it used to ease margin-left on its own). */
@property --wci-chat-dock-w {
  syntax: "<length>";
  inherits: true;
  initial-value: 380px;
}
/* An open nav takes its width from the page only where the page still fits beside it: the open nav's 286px (its 264px
   card and the 22px gutter beside it), the 380px
   WISEcode AI pane and History's 230px leave a narrower window with the pane's controls past its right edge. Below
   1280px the open nav floats over the page instead (below), and the page keeps the rail's offset. The page's share
   includes the field beside the card (--sidebar-card-gutter); the shell itself stops at the card (below). */
@media (min-width: 1280px) {
  html[data-wci-nav="open"] body {
    --wci-nav-w: calc(var(--sidebar-w) + var(--sidebar-card-gutter));
    --wci-nav-gap: 0px;
  }
}
@media (min-width: 769px) {
  /* History's conceal (0.3s, ip-b2b js/chat-history.js concealDocked) and the nav's own ease. */
  body {
    transition:
      --wci-nav-w 0.22s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-nav-gap 0.22s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-history-w 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-chat-dock-w 0.5s ease-in-out;
  }
  /* The design's docked History (wiseai.html, measured 2026-11-13): the page starts 230px past the nav, the panel
     showing 226px of it beside a 4px gap (INTEL-1087; it was 300px). Its reveal is the design's 0.44s. */
  body:has(.wci-history-panel.is-open) {
    --wci-history-w: 230px;
    transition:
      --wci-nav-w 0.22s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-nav-gap 0.22s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-history-w 0.44s cubic-bezier(0.4, 0, 0.2, 1),
      --wci-chat-dock-w 0.5s ease-in-out;
  }
  /* The History card is square on the side the WISEcode AI pane joins (ChatHistoryPanel.razor.css). With no pane
     beside it, it is a whole card. */
  body:not(:has(.wci-chat-dock.wiseai-dock-open)):not(:has(.wci-agent-shell)) .wci-history-panel .wci-history-inner {
    border-right: 1px solid var(--border);
    border-radius: 16px;
  }
}
@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
  body,
  body:has(.wci-history-panel.is-open) { transition: none; }
}

/* ============================================================
   Floating container
   ============================================================ */
#sidebar.sidebar-shell {
  position: fixed;
  top: var(--sidebar-gap);
  left: var(--sidebar-gap);
  height: calc(100vh - (var(--sidebar-gap) * 2));
  /* The design's card (#menu-panel .menu-inner): white settling to linen on a 165deg diagonal, a brand-blue hairline
     (--border is primary at 16%) and the card shadow. The page behind it (body bg-oyster-100) is the linen field the
     panel floats on. */
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--sidebar-radius);
  box-shadow: var(--shadow-card);
  transition:
    width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

/* The user menu (WciMenuPopover) is a fixed card inside the sidebar, so it can only paint as high as
   the sidebar's own stacking layer (z-40). The WISEcode AI dock pane is z-45, so with the sidebar
   collapsed the card ran underneath it and read as cut off. Lift the whole sidebar while the menu is
   open; closed, the sidebar keeps its usual layer. */
#sidebar.sidebar-shell:has(.wise-popover.open) { z-index: 100; }

/* The nav is the icon rail or, while the member has it open, the labelled nav (the toggle under the logo; the design's
   Nav & History icons, ip-b2b js/nav-modules.js). The state is html[data-wci-nav="open"], painted by
   js/wci/wci-sidebar-nav.js, and the shell takes --wci-nav-w, which eases between the two. */
/* The shell eases with the page's share but stops at the card's edge, so the field beside the card stays the page's
   to click. */
#sidebar.sidebar-shell { width: min(var(--wci-nav-w), var(--sidebar-w)); }

/* Main-content offset follows the nav's right edge (and History's, while it is open) plus a gap: an open nav pushes
   the page, as the design's labelled nav does. Higher specificity (id) than the plain .main-content rules in
   design-system.css, so this wins without !important. The mobile block below zeroes it for the drawer. */
body:has(#sidebar.sidebar-shell) .main-content {
  margin-left: calc(var(--wci-nav-w) + var(--wci-history-w) + var(--wci-nav-gap));
}
/* The margin follows variables that ease themselves (above), so the page's older margin-left transitions
   (components.css, design-system.css) would only make it trail the nav and History. */
@media (min-width: 769px) {
  body:has(#sidebar.sidebar-shell) .main-content { transition: none; }
}

/* The signed-out split (AuthSplit) has no AI pane to come out of, so it is the design's lone module beside the
   collapsed rail (ip-b2b login.html, wise.css): the card keeps 2px from the rail (the design's --nav-rail-gap), the
   page's 12px frame top and bottom, and the frame plus the modules row's 2px shadow gutter on the right
   (.menu-brand-integrated #modules-row). The frame's height (AuthSplit.razor.css --auth-frame-h) follows the 12px
   frame here and only here. The layout's own gaps (16px margin and p-8) stacked 48px of empty linen there instead.
   Not while the AI pane or History is open: a signed-in member reaching one of these pages (AccessDenied, SignOut)
   keeps the sheet or History layout. The phone block below still zeroes the margin for the drawer. */
@media (min-width: 769px) {
  body:has(#sidebar.sidebar-shell):has(.auth-module):not(:has(.wci-chat-dock.wiseai-dock-open)):not(:has(.wci-history-panel.is-open)) .main-content {
    margin-left: calc(var(--wci-nav-w) + 2px);
  }
  body:has(#sidebar.sidebar-shell):has(.auth-module):not(:has(.wci-chat-dock.wiseai-dock-open)):not(:has(.wci-history-panel.is-open)) .main-content > .p-8 {
    padding: 12px 14px 12px 0;
  }
  body:has(#sidebar.sidebar-shell):has(.auth-module):not(:has(.wci-chat-dock.wiseai-dock-open)):not(:has(.wci-history-panel.is-open)) .auth-module {
    --auth-frame-h: max(560px, calc(100dvh - 24px));
  }
}

/* Every page in the sign-in shell (AuthSplit: sign-in, create account and their message pages): the frame around
   the card and the nav rail sit on a light brand blue, for every visitor; the card itself keeps its look (ip-b2b wise.css 37969-37974,
   INTEL-1251). Like the rules above, not while the AI pane or History is open. */
html:not(.dark) body:has(#sidebar.sidebar-shell):has(.auth-module):not(:has(.wci-chat-dock.wiseai-dock-open)):not(:has(.wci-history-panel.is-open)) {
  background: color-mix(in srgb, var(--primary) 9%, #FFFFFF) !important;
}

/* ============================================================
   Header / logo
   ============================================================ */
/* The design's brand strip has no rule under it, in the rail, the card or the phone drawer. The border stays (transparent)
   so the header keeps its height. */
#sidebar .sidebar-header-content {
  border-bottom: 1px solid transparent;
}
/* The brand lockup: the wordmark with its tagline and Beta badge, at the design's size (ip-b2b wiseai.html, measured
   2026-11-14: svg.tl-full 102px wide, 16px tall). Its owl, the wordmark's first 193 of 656 units, is then 30px: the
   rail's owl (svg.tl-bug, 30px) at the same size and place, so the rail only clips the words away (below), and nothing
   is swapped in or waits on the circuit. */
#sidebar .sidebar-logo-full .sidebar-wordmark {
  width: 102px;
  height: auto;
}

/* The nav's own controls under the logo (Sidebar.razor .sidebar-chrome): the toggle, History and New chat, rows like
   the nav's, in the same column with the same 4px rhythm, so they line up with the destinations below open or closed. */
#sidebar .sidebar-chrome {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 0;
}
#sidebar .sidebar-chrome > * { margin: 0 !important; }
/* New chat is the design's filled blue circle (.menu-modules-new, wise.css 7517-7552), in the rail and the open nav
   alike. .sidebar-chrome lifts each selector above the rail's bare-glyph rules below, which would otherwise win by
   coming later. */
html #sidebar.sidebar-shell .sidebar-chrome .menu-nav-item.sidebar-new-chat .menu-nav-icon,
html #sidebar.sidebar-shell .sidebar-chrome .menu-nav-item.sidebar-new-chat:hover .menu-nav-icon {
  background: var(--primary);
  box-shadow: none;
}
html #sidebar.sidebar-shell .sidebar-chrome .menu-nav-item.sidebar-new-chat .menu-nav-icon .material-symbols-outlined,
html #sidebar.sidebar-shell .sidebar-chrome .menu-nav-item.sidebar-new-chat:hover .menu-nav-icon .material-symbols-outlined {
  color: var(--color-white);
  opacity: 1;
}
html #sidebar.sidebar-shell .sidebar-chrome .menu-nav-item.sidebar-new-chat:hover .menu-nav-icon { filter: brightness(1.06); }
/* Add Product and Edit: their own chat's New conversation is in its menu (Sidebar.razor IsProductChatPage). */
#sidebar .sidebar-new-chat.is-off { visibility: hidden; }

/* "INTELLIGENCE™" tagline under the wordmark — right-aligned to the wordmark's
   right edge (the parent span is flex-col items-end). Mirrors the ip-b2b
   portfolio.html lockup: .topbar-tagline / .tagline-tm. */
#sidebar .sidebar-tagline {
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-oyster-600);
  line-height: 1;
  margin-top: 3px;
  white-space: nowrap;
}
#sidebar .sidebar-tagline .sidebar-tagline-tm {
  font-size: 0.65em;
  letter-spacing: 0;
  vertical-align: super;
  margin-left: 1px;
}

/* BETA badge pinned above the wordmark's top-right corner (ip-b2b wise.css .menu-brand-beta, 18ca5ad). */
#sidebar .sidebar-logo-full { position: relative; }
#sidebar .sidebar-beta {
  position: absolute;
  top: -9px;
  right: -22px;
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--primary);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  pointer-events: none;
}

/* Scroll area — comfortable insets, slimmer when collapsed. A uniform 4px
   vertical rhythm between every row (ip-b2b .menu-nav gap) replaces the markup's
   mixed margins, so groups and single rows sit on the same grid. The rows
   themselves are WciNavItem (INTEL-389; a group is a row with child rows), styled by its own
   scoped sheet; this file only lays the column out. */
#sidebar > nav { padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
#sidebar > nav > * { margin: 0 !important; }

/* Flat sections (Portfolio / Studio / Account): an inert uppercase label over
   always-visible full-size rows — no chevron, no expand state. */
#sidebar .nav-section { display: flex; flex-direction: column; gap: 4px; }
#sidebar .nav-section-label {
  padding: 10px 10px 2px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text);               /* the design's .menu-nav-section: full-strength text, not the subtle grey */
  user-select: none;
}

/* ============================================================
   Remaining .nav-item rows: the footer account trigger and the
   signed-out Sign In / Register links. Values mirror the ip-b2b
   design-system nav: full-pill rows, 44px tall, 600-weight neutral labels,
   12px (0.75rem) text, 10px icon→label gap.
   ============================================================ */
#sidebar .nav-item {
  border-radius: 9999px !important; /* full pill (ip-b2b --radius-pill), not a rounded rect */
  padding: 8px 10px !important;
  min-height: 44px;
  gap: 10px !important;             /* icon ↔ label (overrides markup gap-3 = 12px) */
  color: #111827;                   /* ip-b2b --text (neutral near-black, not oyster) */
  font-size: 0.75rem;               /* ip-b2b --fs-ui */
  font-weight: 600;                 /* ip-b2b nav item weight (was 500) */
  letter-spacing: 0.01em;
}

/* Labels: 12px to match --fs-ui (markup carries text-sm = 14px). */
#sidebar .nav-label:not(.material-icons) { font-size: 0.75rem !important; }

/* A nav row's icon sits in a circular tinted disc (ip-b2b .menu-nav-icon):
   a 28px primary-soft circle + inset primary ring, black glyph at rest. */
#sidebar .nav-item > .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: var(--color-primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 18%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px !important;       /* glyph size (overrides text-xl) */
  color: #111827 !important;        /* ip-b2b --text — black glyph at rest */
  line-height: 1 !important;
}
#sidebar .nav-item:hover > .nav-icon {
  color: var(--color-primary) !important;
}

/* Hover: a primary-soft pill with primary text + icon. Overrides the markup's
   hover:bg-oyster-100. */
#sidebar .nav-item:hover {
  background: var(--color-primary-soft) !important;
  color: var(--color-primary) !important;
}

/* ============================================================
   The icon rail and the open nav
   The nav always renders the whole menu (labels, groups, the wordmark); on a wide window it SHOWS as
   the rail until the member opens it with the toggle (html[data-wci-nav="open"], js/wci/wci-sidebar-nav.js).
   So most rules here are the rail: a wide window, nav not open. Labels are visually hidden, not
   display:none, so every icon keeps its accessible name. A narrow window is the mobile drawer, which
   always shows the whole menu and never matches this block.
   ============================================================ */
@media (min-width: 769px) {
  /* The rail lies flat on the field, flush to the viewport's top, left and bottom, as the design's #menu-panel
     rail (wise.css 5606-5611: no fill, border, rounding or shadow). The open nav grows from the same edge and
     the same top, so no row moves when it opens; it is the card (below). */
  #sidebar.sidebar-shell {
    top: 0;
    left: 0;
    height: 100vh;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    /* The card's shadow (::before, below) reaches past the shell, so the shell does not clip. Its regions do instead:
       the open nav's labels outrun them while the width eases (--wci-nav-w). The nav clips its own (it scrolls). */
    overflow: visible;
    /* Its width follows --wci-nav-w, which eases itself; the card's look is the ::before's (below). */
    transition: none;
  }
  #sidebar.sidebar-shell > * { overflow-x: clip; }

  /* The open nav is the design's card (#menu-panel .menu-inner): 260px, 4px in from the window's left edge, 12px down
     from its top and 16px up from its bottom, every corner rounded, with the drawer's gradient, hairline and shadow
     (above). It is drawn behind the nav's content rather than by the shell, so the shell keeps the rail's box and no
     row moves as the nav opens. It takes its width from the page (--wci-nav-w), so it covers nothing. */
  #sidebar.sidebar-shell::before {
    content: "";
    position: absolute;
    top: var(--sidebar-card-top);
    bottom: var(--sidebar-card-bottom);
    left: var(--sidebar-card-left);
    right: 0;
    z-index: -1;
    border-radius: var(--sidebar-radius);
    background: linear-gradient(165deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  }
  html[data-wci-nav="open"] #sidebar.sidebar-shell::before { opacity: 1; }
  /* Below 1280px the open nav floats over the page, above the AI pane (z 45) and History (z 46) and below every modal
     (WciModal 2200 and up): --wci-nav-w stays the rail's (above), so the page, the pane and History keep their places,
     and the shell takes its open width itself. A floating card lifts further off the page. */
  @media (max-width: 1279.98px) {
    html[data-wci-nav="open"] #sidebar.sidebar-shell {
      width: var(--sidebar-w);
      z-index: 100;
    }
    html[data-wci-nav="open"] #sidebar.sidebar-shell::before {
      box-shadow: 0 2px 4px rgba(17, 24, 39, 0.06), 0 16px 40px rgba(17, 24, 39, 0.16);
    }
    #sidebar.sidebar-shell { transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
  }
  @media (max-width: 1279.98px) and (prefers-reduced-motion: reduce) {
    #sidebar.sidebar-shell { transition: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    #sidebar.sidebar-shell::before { transition: none; }
  }

  /* Every icon sits at the SAME x in the rail and the open nav (Kevin, 2026-10-23): the rail centres its 36px
     rows on the 68px column's icon line, 36px from the edge, as the design's rail does; the open nav's rows carry
     10px of inset before their 28px disc (WciNavItem), so its column starts 12px in (8px inside the card) to put
     that disc's centre at 36px too. The toggle, History and New chat above and the footer follow the same line. */
  html[data-wci-nav="open"] #sidebar.sidebar-shell > nav { padding: 18px 12px; }
  html[data-wci-nav="open"] #sidebar.sidebar-shell .sidebar-chrome { padding: 12px 12px 0; }
  /* Closed, everything stays anchored LEFT at the same x, never centred: the state flips at once but the panel's
     width eases (--wci-nav-w), so centring in a panel still 264px wide threw every icon to the middle and back.
     A rail row is a 36px box with its disc centred, so it starts 18px in to put the disc at 22px, where the open
     row's 10px inset puts it from 12px in. */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .sidebar-chrome { padding: 12px 14px 0 18px; align-items: flex-start; }
  /* The toggle's glyph faces the way the nav will go: dock_to_right opens it, its mirror (the design's dock_to_left)
     closes it. Off the painted state, so it is right before the circuit starts. */
  html[data-wci-nav="open"] #sidebar .sidebar-nav-toggle .menu-nav-icon .material-symbols-outlined { transform: scaleX(-1); }
  /* The footer starts where the card does, so its hairline stays inside the card (the design's .menu-footer), and
     ends clear of the card's bottom edge. Its 34px chip, 4px + 8px + 7px (19px) in, is centred on the 36px icon line. Open and
     closed alike, so the chip never moves. */
  #sidebar.sidebar-shell > .border-t {
    margin-left: var(--sidebar-card-left);
    padding: 16px 12px 24px 8px !important;
  }
  #sidebar.sidebar-shell .user-avatar-btn { padding: 4px 10px 4px 7px !important; }
  /* The signed-out footer rows (Sign In, Create Account, Forgot Password) start 12px in like the open nav's rows, so
     their discs sit on the 36px line open; a closed rail row is a 36px box with its disc centred, so it starts 6px
     further in, as the nav's do (18px). */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell > .border-t .menu-nav-item { margin-left: 6px; }

  /* Every row sits at the SAME height in the rail and the open nav (Kevin, 2026-10-16): the toggle stays under
     the pointer that pressed it, and every row stays where the member last saw it. So the header is one fixed
     height whichever logo shows, the nav's top inset is the same, rail rows are the open rows' 36px, and
     a section label keeps its line in the rail (invisible) instead of collapsing. Only widths change. */
  #sidebar.sidebar-shell .sidebar-header-content {
    box-sizing: border-box;
    height: 81px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex;
    align-items: center;
  }
  #sidebar.sidebar-shell .sidebar-header-row { width: 100%; }

  #sidebar.sidebar-shell .nav-section-label { white-space: nowrap; overflow: hidden; }

  /* The logo starts 21px in, open or closed, so the 30px owl (above) is centred on the icon column (21 + 15 = 36).
     Closed, a clip keeps only the owl: the owl is the wordmark's first 193 of 656 units (WISEcode-logo-vertical.svg,
     the same drawing as WISEcode-bug.svg), so 70.6% is clipped from the right. The tagline and Beta fade. The owl
     keeps its size and place throughout, as the design's does; only the words come and go. */
  #sidebar.sidebar-shell .sidebar-header-content { padding-left: 21px !important; padding-right: 12px !important; }
  /* The lockup keeps its open size in the rail (the clip, not the box, hides the words): Tailwind's preflight
     max-width: 100% would otherwise squeeze the 102px wordmark into the rail and distort the owl. */
  #sidebar.sidebar-shell .sidebar-logo-full { flex: 0 0 auto; }
  #sidebar.sidebar-shell .sidebar-logo-full img {
    max-width: none;
    transition: clip-path 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 0 0 0);
  }
  #sidebar.sidebar-shell .sidebar-tagline,
  #sidebar.sidebar-shell .sidebar-beta { transition: opacity 0.16s ease; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .sidebar-logo-full img {
    clip-path: inset(0 70.6% 0 0);
  }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .sidebar-tagline,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .sidebar-beta { opacity: 0; }
  @media (prefers-reduced-motion: reduce) {
    #sidebar.sidebar-shell .sidebar-logo-full img,
    #sidebar.sidebar-shell .sidebar-tagline,
    #sidebar.sidebar-shell .sidebar-beta { transition: none; }
  }
  /* The member row is one shape in the rail and the open nav: the same 34px chip (its centre on 36px) and
     the same height, so only its name goes. */
  #sidebar.sidebar-shell .user-avatar-btn { min-height: 52px; }

  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell > nav { padding: 18px 14px 18px 18px !important; align-items: flex-start; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .nav-section { align-items: flex-start; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .nav-section-label { visibility: hidden; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .sidebar-footer-text { display: none !important; }

  /* A label and the user's name: out of sight, still in the accessibility tree. */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-label,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .nav-label,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .user-avatar-btn .user-info {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-chevron,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-lock { display: none; }
  /* A group shows as its one icon row; its rows wait for the open nav (and stay out of the tab order). */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-children { display: none; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-group { align-items: flex-start; }

  /* The rail row: a 36px icon box, 18px in (above; the component sets no margin of its own). It is the open row's
     36px, not the design's 32px rail box (wise.css 6028-6036), so rows do not drift when the nav opens. */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item {
    position: relative;
    justify-content: center;
    gap: 0;
    padding: 0;
    width: 36px;
    height: 36px;
    min-height: 36px;
  }
  /* Disc only on the lit row, so the icon-only chrome surfaces exactly one lit item (wise.css 5475-5511). */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item .menu-nav-icon { background: transparent; box-shadow: none; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item .menu-nav-icon .material-symbols-outlined { color: var(--text); opacity: 0.6; }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item:hover .menu-nav-icon,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item.is-active .menu-nav-icon {
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
  }
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item:hover .menu-nav-icon .material-symbols-outlined,
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .menu-nav-item.is-active .menu-nav-icon .material-symbols-outlined {
    color: var(--primary);
    opacity: 1;
  }

  /* The footer account trigger keeps its inset and chip (above, open and closed alike), so the chip never moves; only
     its gap to the hidden name goes. */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .user-avatar-btn {
    justify-content: flex-start !important;
    gap: 0 !important;
  }
  /* Same 28px disc + 16px glyph as the open nav (the base disc rule supplies the disc). */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell .nav-icon {
    margin: 0 !important;
    font-size: 16px !important;
  }

  /* The lock hint's text would overflow the rail. */
  html:not([data-wci-nav="open"]) #sidebar.sidebar-shell.sidebar-locked .sidebar-lock-hint { display: none; }
}

/* ============================================================
   Footer
   ============================================================ */
/* The design's .menu-footer hairline: the card's own brand-blue border. */
#sidebar .border-t {
  border-top: 1px solid var(--border);
}

/* ============================================================
   Mobile shell
   ============================================================ */
.mobile-header {
  display: none;
}

.mobile-menu-backdrop {
  display: none;
}

@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-top: 64px;
  }

  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 10px 14px;
    background: rgba(253, 252, 248, 0.94);
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    backdrop-filter: blur(14px);
  }

  .mobile-header-logo {
    display: inline-flex;
    align-items: center;
    min-width: 0;
  }

  .mobile-header-logo img {
    display: block;
    width: auto;
    height: 30px;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 9999px;
    background: #fff;
    color: var(--color-primary);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  }

  .mobile-menu-button .material-icons {
    font-size: 22px;
    line-height: 1;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(17, 24, 39, 0.34);
    backdrop-filter: blur(2px);
  }

  #sidebar.sidebar-shell {
    z-index: 60;
    top: 76px;
    left: 10px;
    width: min(calc(100vw - 20px), 318px) !important;
    height: calc(100dvh - 88px);
    max-height: calc(100vh - 88px);
    transform: translateX(calc(-100% - 24px));
    transition:
      transform 0.28s ease,
      box-shadow 0.3s ease;
  }

  /* The drawer always shows the whole menu, so it has nothing to toggle. */
  #sidebar .sidebar-nav-toggle { display: none; }

  #sidebar.sidebar-shell.sidebar-mobile-open {
    transform: translateX(0);
    box-shadow: 0 18px 44px rgba(17, 24, 39, 0.22);
  }

  body:has(#sidebar.sidebar-shell) .main-content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    margin-left: 0 !important;
  }

  .main-content > .p-8 {
    padding: 1rem !important;
  }
}

/* ── Locked state (onboarding brand research in progress) ──────────────────────
   The sidebar stays fully visible so a just-signed-up user is oriented, but every
   destination is inert: pointer-events:none on the nav and footer disables
   both hrefs and @onclick. It's a UI lock only (typing a URL still works). A dimmed
   look plus the lock hint above the nav make the inertness read as intentional. */
#sidebar.sidebar-locked .sidebar-lock-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 16px 0;
  padding: 10px 12px;
  border: 1px dashed var(--oyster-200, #e2ddd3);
  border-radius: 12px;
  background: var(--oyster-50, #faf8f4);
  color: var(--oyster-600, #6b6357);
  font-size: 0.75rem;
  line-height: 1.3;
}
#sidebar.sidebar-locked .sidebar-lock-hint-ico {
  font-size: 16px;
  line-height: 1.3;
  flex-shrink: 0;
}
/* Every destination is inert while locked: disable all links (nav, logo, user-menu) and the
   footer button that opens the user menu. The mobile menu toggle stays live (harmless, no nav).
   Sidebar.razor also puts `inert` on the nav and the footer while locked, which is
   what stops keyboard activation and assistive technology; this rule covers the pointer (and the
   logo link, which stays reachable by keyboard as the way home). */
#sidebar.sidebar-locked a,
#sidebar.sidebar-locked nav button,
#sidebar.sidebar-locked .user-avatar-btn {
  pointer-events: none;
}
/* Dim the working regions so the inertness reads as intentional; leave the logo at full strength. */
#sidebar.sidebar-locked nav,
#sidebar.sidebar-locked .user-avatar-btn {
  opacity: 0.5;
}
