/* Buddy AI: signed-in left navigation and accessible auth dialog.
   Scoped repair only. The public homepage, clay palette, logo and feature cards
   deliberately retain their existing design and dimensions. */

/* Keep the signed-in navigation docked on the LEFT on desktop. */
#appShell:not(.hidden) #workspaceMenu {
  position:fixed!important;
  top:92px!important;
  bottom:14px!important;
  left:14px!important;
  right:auto!important;
  width:250px!important;
  max-width:calc(100vw - 28px)!important;
  max-height:calc(100dvh - 106px)!important;
  padding:13px!important;
  display:flex!important;
  flex-direction:column;
  overflow-x:hidden;
  overflow-y:auto;
  z-index:105;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
  transform:none!important;
  transition:none!important;
  border-radius:24px!important;
}
#appShell:not(.hidden) #workspaceMenu .workspace-menu-head {
  position:sticky;
  top:-13px;
  z-index:1;
}
#appShell #workspaceMenu #appNav {
  display:flex!important;
  flex-direction:column!important;
  grid-template-columns:none!important;
  gap:4px;
  width:100%;
}
#appShell #workspaceMenu #appNav .nav-item {
  width:100%;
  min-height:43px;
  margin:0!important;
  padding:10px 12px!important;
  font-size:12px!important;
  text-align:left;
  overflow-wrap:anywhere;
  border-radius:13px!important;
}
#appShell #workspaceMenu .sidebar-bottom {margin-top:auto!important}
#appShell #workspaceMenu #workspaceMenuClose {display:none!important}
#appShell #mobileNav {display:none!important}
#appShell #pageContent {
  margin-left:278px;
  width:auto;
  min-width:0;
}
#appShell .work-header.clay-workbar {z-index:90}

/* Compact displays use a LEFT-side drawer, never a right-side dropdown.
   The menu control is only shown at the far-left of the header on mobile. */
@media(max-width:1050px) {
  #appShell #pageContent {margin-left:0}
  #appShell .work-header.clay-workbar {
    display:flex;
    align-items:center;
    gap:8px;
  }
  #appShell #mobileNav {
    display:grid!important;
    place-items:center;
    width:36px;
    height:36px;
    min-width:36px;
    flex:0 0 36px;
    margin:0 4px 0 0;
    border-radius:12px;
    font-size:20px;
  }
  #appShell:not(.hidden) #workspaceMenu {
    top:0!important;
    bottom:0!important;
    left:0!important;
    right:auto!important;
    width:min(292px,88vw)!important;
    max-width:88vw!important;
    max-height:100dvh!important;
    padding:15px!important;
    z-index:150;
    border-radius:0 24px 24px 0!important;
    transform:translateX(-105%)!important;
    visibility:hidden!important;
    opacity:0!important;
    pointer-events:none!important;
    transition:transform .2s ease,visibility .2s ease,opacity .2s ease!important;
  }
  #appShell:not(.hidden) #workspaceMenu.open {
    transform:translateX(0)!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:auto!important;
  }
  #appShell #workspaceMenu #workspaceMenuClose {display:grid!important}
  #appShell #workspaceMenu .workspace-menu-head {top:-15px}
  #appShell:has(#workspaceMenu.open)::before {
    content:"";
    position:fixed;
    inset:0;
    z-index:135;
    background:rgba(23,22,28,.43);
  }
}
@media(max-width:600px) {
  #appShell .work-header.clay-workbar {gap:5px}
  #appShell #mobileNav {width:33px;height:33px;min-width:33px;flex-basis:33px}
}
@media(prefers-reduced-motion:reduce) {
  #appShell:not(.hidden) #workspaceMenu {transition:none!important}
}

/* Auth must cover the landing page's sticky header and keep ALL form fields
   reachable even on a short viewport. Fixes header overlapping the dialog. */
#authModal:not(.hidden) {
  position:fixed!important;
  inset:0!important;
  z-index:500!important;
  display:flex!important;
  align-items:safe center;
  justify-content:center;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:clamp(12px,3dvh,28px) 14px;
}
#authModal .modal-card {
  flex:0 0 auto;
  margin:auto;
  width:min(100%,465px);
  max-height:none!important;
  overflow:visible!important;
}
body:has(#authModal:not(.hidden)) {overflow:hidden}
@media(max-width:550px) {
  #authModal:not(.hidden) {padding:12px 9px}
  #authModal .modal-card {max-width:100%;padding:24px 20px}
}
