/* Shared app sidebar (9.5b, 2026-09-24): Files / Population dashboard / Annotation, the signed-in
   user, Sign out, and a collapse toggle. Loaded by index.html, dashboard.html and annotation.html;
   uses each page's colour tokens (with fallbacks). Collapsed = a 64 px icon rail. */
:root { --qh-sb-w: 228px; --qh-sb-w-min: 64px; }
body { padding-left: var(--qh-sb-w); }
html.qh-sb-collapsed body { padding-left: var(--qh-sb-w-min); }
body.qh-sidebar-off { padding-left: 0 !important; }
body.qh-sidebar-off .qh-sidebar { display: none; }
html.qh-sb-anim body, html.qh-sb-anim .qh-sidebar { transition: padding-left .2s ease, width .2s ease; }
html.qh-sb-anim .qh-label { transition: opacity .15s ease; }

.qh-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: var(--qh-sb-w);
  display: flex; flex-direction: column; gap: 12px; padding: 14px 10px; overflow: hidden;
  background: var(--surface, #fff); border-right: 1px solid var(--border, #e4e6ea);
}
html.qh-sb-collapsed .qh-sidebar { width: var(--qh-sb-w-min); }

.qh-brand { display: flex; align-items: center; gap: 10px; padding: 2px 7px 12px; border-bottom: 1px solid var(--grid, #eceef1); }
.qh-brand .logo { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: var(--accent, #2a78d6); color: #fff; display: grid; place-items: center; }
.qh-brand .logo svg { width: 18px; height: 18px; }
.qh-brand .name { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; color: var(--ink, #16181d); white-space: nowrap; }
.qh-brand .qh-env { font-size: 10.5px; font-weight: 600; color: #9a6b00; white-space: nowrap; }

.qh-nav { display: flex; flex-direction: column; gap: 2px; }
.qh-nav a, .qh-foot button {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: 9px;
  color: var(--ink-2, #4b5058); text-decoration: none; white-space: nowrap;
  font: inherit; font-size: 13.5px; font-weight: 500;
}
.qh-nav a svg, .qh-foot button svg { flex: 0 0 18px; width: 18px; height: 18px; }
.qh-nav a:hover, .qh-foot button:hover { background: var(--wash, #f3f4f6); color: var(--ink, #16181d); }
.qh-nav a[aria-current="page"] { background: var(--accent-soft, #eaf2fc); color: var(--accent, #2a78d6); font-weight: 650; }
.qh-nav a:focus-visible, .qh-foot button:focus-visible { outline: 2px solid var(--accent, #2a78d6); outline-offset: 1px; }

.qh-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--grid, #eceef1); }
.qh-foot button { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font-size: 13px; }
.qh-user { padding: 2px 12px 8px; min-height: 36px; }
.qh-user .email { font-size: 12.5px; color: var(--ink, #16181d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qh-user .org { font-size: 11.5px; color: var(--muted, #8a8f98); white-space: nowrap; }

html.qh-sb-collapsed .qh-label { opacity: 0; pointer-events: none; }
html.qh-sb-collapsed .qh-collapse svg { transform: rotate(180deg); }

/* Idle sign-out (sidebar.js): the notice for the last minute, and the blank page while the
   sign-out runs - nothing stays readable once the limit is reached. */
.qh-idle-notice {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60;
  max-width: min(560px, 90vw); padding: 10px 16px; border-radius: 10px;
  background: #fff7e0; border: 1px solid #e6c15a; color: #5b4300;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}
body.qh-leaving > :not(.qh-idle-notice) { visibility: hidden; }

/* Narrow screens: always the icon rail. */
@media (max-width: 760px) {
  body, html.qh-sb-collapsed body { padding-left: var(--qh-sb-w-min); }
  .qh-sidebar { width: var(--qh-sb-w-min); }
  .qh-label { opacity: 0; pointer-events: none; }
  .qh-collapse { display: none !important; }
}
