/* jp-shell-fix v1 (2026-11-22): dashboard header + sidebar alignment.
   Scoped to the logged-in dashboard shell only (.dash-body .dash-app). Rollback: remove the <link> to this file. */

/* 1. Let the window be the only scroll container so sticky header/sidebar work. */
html body .dash-body,
html body .dash-body .dash-app { overflow: visible !important; overflow-x: clip !important; }
html body .dash-body .dash-app .dash-main { min-width: 0 !important; }

/* 2. Header: always sticky on top of content, same height as the sidebar brand cell. */
html body .dash-body .dash-app .dash-topbar {
  position: sticky !important; top: 0 !important; z-index: 60 !important;
  height: 64px !important; min-height: 64px !important; box-sizing: border-box !important;
}

@media (min-width: 768px) {
  html body .dash-body .dash-app { align-items: start !important; }

  /* 3. Sidebar: full-height sticky column, flush to the edge, no floating card. */
  html body .dash-body .dash-app .dash-sidebar {
    position: sticky !important; inset: auto !important; top: 0 !important;
    align-self: start !important;
    height: 100vh !important; height: 100dvh !important; min-height: 0 !important; max-height: 100dvh !important;
    width: auto !important; margin: 0 !important; border-radius: 0 !important;
    border: 0 !important; border-right: 1px solid rgba(19, 0, 154, 0.09) !important;
    box-shadow: none !important; overflow: hidden !important;
    display: flex !important; flex-direction: column !important; z-index: 70 !important;
  }

  /* 4. Brand cell lines up with the top bar: same height, same bottom border. */
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__brand {
    flex: 0 0 64px !important; height: 64px !important; min-height: 64px !important;
    box-sizing: border-box !important; margin: 0 !important;
    border-bottom: 1px solid rgba(19, 0, 154, 0.09) !important;
  }

  /* 5. Menu scrolls inside the sidebar; footer stays pinned and never overlaps it. */
  html body .dash-body .dash-app .dash-sidebar .dash-nav,
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__nav {
    flex: 1 1 auto !important; min-height: 0 !important;
    overflow-y: auto !important; overflow-x: hidden !important; overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__foot {
    flex: 0 0 auto !important; margin-top: 0 !important;
    border-top: 1px solid rgba(19, 0, 154, 0.09) !important;
    background: inherit !important;
  }
}

/* 6. Mobile drawer: menu scrolls inside, footer pinned, no sideways overflow. */
@media (max-width: 767px) {
  html body .dash-body .dash-app .dash-sidebar { overflow: hidden !important; display: flex !important; flex-direction: column !important; border: 0 !important; }
  html body .dash-body .dash-app .dash-sidebar .dash-nav,
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__nav { flex: 1 1 auto !important; min-height: 0 !important; overflow-y: auto !important; overscroll-behavior: contain; }
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__foot { flex: 0 0 auto !important; margin-top: 0 !important; }
  html body .dash-body .dash-app .dash-sidebar .dash-sidebar__brand { flex: 0 0 64px !important; height: 64px !important; box-sizing: border-box !important; }
}

/* 7. Build Proxy / Partner Program are <button>s: match the other menu links. */
html body .dash-body .dash-app .dash-sidebar button.dash-nav__link {
  font: inherit !important; font-size: 0.9rem !important; line-height: inherit !important;
  width: 100% !important; text-align: left !important; min-height: 0 !important;
  -webkit-appearance: none; appearance: none;
}
html body .dash-body .dash-app .dash-sidebar .dash-nav__link { box-sizing: border-box !important; }

/* Dark theme: same structure, dark borders matching the top bar. */
html.dark body .dash-body .dash-app .dash-sidebar,
html[data-theme="dark"] body .dash-body .dash-app .dash-sidebar { border-right-color: rgba(200, 196, 255, 0.14) !important; }
html.dark body .dash-body .dash-app .dash-sidebar .dash-sidebar__brand,
html[data-theme="dark"] body .dash-body .dash-app .dash-sidebar .dash-sidebar__brand,
html.dark body .dash-body .dash-app .dash-sidebar .dash-sidebar__foot,
html[data-theme="dark"] body .dash-body .dash-app .dash-sidebar .dash-sidebar__foot { border-color: rgba(200, 196, 255, 0.14) !important; }

/* 8. Phone header: everything fits on one row (logo mark only, compact buttons). */
@media (max-width: 560px) {
  html body .dash-body .dash-app .dash-topbar { padding: 0 0.6rem !important; gap: 0.4rem !important; }
  html body .dash-body .dash-app .dash-topbar .dash-topbar__brand .jp-brand__wordmark { display: none !important; }
  html body .dash-body .dash-app .dash-topbar .dash-topbar__brand .jp-logo { width: 36px !important; height: 36px !important; }
  html body .dash-body .dash-app .dash-topbar .dash-topbar__brand { flex: 0 0 auto !important; height: auto !important; }
  html body .dash-body .dash-app .dash-topbar .dash-topbar__actions { gap: 0.35rem !important; margin-left: auto !important; min-width: 0 !important; flex-wrap: nowrap !important; }
  html body .dash-body .dash-app .dash-topbar .dash-iconbtn { width: 36px !important; height: 36px !important; min-width: 36px !important; padding: 0 !important; justify-content: center !important; }
  html body .dash-body .dash-app .dash-topbar .dash-userbtn { padding: 3px !important; height: 38px !important; }
  html body .dash-body .dash-app .dash-topbar .dash-userbtn > :not(:first-child) { display: none !important; }
  html body .dash-body .dash-app .dash-topbar .dash-topbar__menu { min-width: 40px !important; min-height: 40px !important; }
}
