/* Buildiario v8: small-screen sidebar navigation fix.
   The complete drawer scrolls; the support card follows (never overlays) the links.
   CSS only — keeps authentication, form handlers, Cloudflare routes and downloads unchanged. */
@media (max-width:730px) {
  #sidebar.sidebar {
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    height:100vh;
    height:100dvh;
    max-height:100dvh;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
    scrollbar-color:rgba(168,208,244,.50) transparent;
    padding-bottom:calc(18px + env(safe-area-inset-bottom,0px));
    z-index:110;
  }
  #sidebar .brand-section {
    position:sticky;
    top:-16px;
    z-index:4;
    flex-shrink:0;
    margin:-16px -14px 12px;
    padding:16px 14px 13px;
    min-height:70px;
    background:linear-gradient(180deg,#102b49 0%,#0e2947 90%,#0e2947 100%);
    border-bottom:1px solid rgba(181,217,249,.22);
    box-shadow:0 8px 14px rgba(1,18,39,.15);
  }
  #sidebar .mobile-close {flex-shrink:0;z-index:5;min-width:44px;min-height:44px}
  #sidebar .workspace-badge {flex-shrink:0}
  #sidebar .nav-label {flex-shrink:0}
  #sidebar .sidebar-nav {
    display:flex !important;
    flex-direction:column;
    flex:0 0 auto !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
    padding-bottom:8px;
    gap:9px;
  }
  #sidebar .sidebar-nav .nav-link {
    display:flex;
    flex:0 0 auto;
    min-height:52px;
    width:100%;
    overflow:hidden;
    touch-action:manipulation;
  }
  #sidebar .sidebar-bottom {
    display:block;
    flex:0 0 auto;
    position:static !important;
    margin:18px 0 0;
    padding-top:12px;
    border-top:1px solid rgba(166,210,250,.14);
  }
  .mobile-overlay.show {z-index:100 !important}
  /* Mobile floating chat should not sit on top of an open navigation drawer. */
  body:has(#sidebar.open) .ai-launcher,
  body:has(#sidebar.open) .ai-panel {
    visibility:hidden;
    pointer-events:none;
  }
  body:has(#sidebar.open) {overflow:hidden}
}
@media (max-width:730px) and (max-height:620px) {
  #sidebar .workspace-badge {display:none}
  #sidebar .nav-label {margin-top:14px;margin-bottom:10px}
  #sidebar .brand-section {margin-bottom:9px}
  #sidebar .sidebar-nav .nav-link {min-height:49px}
}
@media (max-width:360px) {
  #sidebar .brand strong {font-size:17px}
  #sidebar .brand small {font-size:7px;letter-spacing:1.1px}
  #sidebar .brand img {width:41px;height:41px}
  #sidebar .brand-section {gap:8px}
  #sidebar .sidebar-nav .nav-link {padding-inline:8px}
}
