/* Global navigation drawer: the work area stays full width until navigation is requested. */
:root {
  --global-nav-drawer-width: 272px;
  /* Page workspaces such as audit interview sit around z-index 2200. Keep the
   * app navigation above every workspace, but below protected modal layers
   * (which start at 9000 in the current shell). */
  --global-nav-scrim-z: 7990;
  --global-nav-drawer-z: 8000;
}

html body .app-layout,
html body.is-program-workbar-collapsed .app-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}

html body .app-layout > .sidebar,
html body[data-active-view].is-program-workbar-collapsed .app-layout > .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--global-nav-drawer-z);
  display: flex !important;
  width: var(--global-nav-drawer-width) !important;
  max-width: min(88vw, var(--global-nav-drawer-width));
  height: 100dvh;
  transform: translate3d(-104%, 0, 0);
  visibility: hidden;
  box-shadow: 18px 0 48px color-mix(in srgb, var(--visual-ink, #0b1b2f) 18%, transparent);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), visibility 0s linear .22s;
  will-change: transform;
  isolation: isolate;
}

html body .app-layout > .sidebar.open,
html body[data-active-view].is-program-workbar-collapsed .app-layout > .sidebar.open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  transition-delay: 0s;
}

html body :is(.program-sidebar-resizer, .program-sidebar-reopen) {
  display: none !important;
}

html body :is(.project-toolbar, .breadcrumb, .main-content),
html body.is-program-workbar-collapsed :is(.project-toolbar, .breadcrumb, .main-content),
html body[data-active-view] :is(.project-toolbar, .breadcrumb, .main-content) {
  grid-column: 1 !important;
}

html body .project-bar-inner,
html body .breadcrumb,
html body .main-content {
  width: 100%;
  max-width: none;
}

html body .project-bar-inner {
  position: relative;
  padding-left: 0;
}

.project-shell-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-shell-nav #project-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding-inline: 13px;
  border-radius: var(--visual-radius-sm, 10px);
  white-space: nowrap;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--global-nav-scrim-z);
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--visual-ink, #0b1b2f) 38%, transparent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: default;
  transition: opacity .18s ease-out, visibility 0s linear .18s;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

body.is-global-nav-open {
  overflow: hidden;
}

.global-nav-toggle {
  position: static;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  width: auto !important;
  padding: 0 12px;
  border: 1px solid var(--visual-line, #d8e1ee);
  border-radius: var(--visual-radius-sm, 10px);
  background: var(--visual-surface, #fff);
  color: var(--visual-copy, #334155);
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: var(--visual-shadow-soft, 0 2px 8px rgba(15, 23, 42, .05));
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.global-nav-toggle:hover,
.global-nav-toggle[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--visual-accent, #2458d3) 44%, var(--visual-line, #d8e1ee));
  background: var(--visual-accent-soft, #f2f7ff);
  color: var(--visual-accent-deep, #1d4ed8);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--visual-accent, #2458d3) 12%, transparent);
}

.global-nav-toggle svg {
  width: 17px;
  height: 17px;
}

.sidebar-brand {
  position: relative;
  padding-right: 54px !important;
}

.sidebar-close {
  position: absolute;
  top: 20px;
  right: 14px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--visual-nav-line, #20314a);
  border-radius: 11px;
  background: color-mix(in srgb, var(--visual-accent-soft, #e7efff) 48%, transparent);
  color: var(--visual-nav-muted, #8ea0b8);
  cursor: pointer;
  pointer-events: auto;
}

.sidebar-close:hover {
  border-color: color-mix(in srgb, var(--visual-accent, #2458d3) 45%, var(--visual-nav-line, #20314a));
  background: var(--visual-accent-soft, #e7efff);
  color: var(--visual-accent-deep, #173f9f);
}

.sidebar-close svg {
  width: 17px;
  height: 17px;
}

html[data-theme="dark"] .global-nav-toggle {
  border-color: #314158;
  background: #172235;
  color: #d8e1ee;
  box-shadow: none;
}

html[data-theme="dark"] .global-nav-toggle:hover,
html[data-theme="dark"] .global-nav-toggle[aria-expanded="true"] {
  border-color: #4b6e9b;
  background: #1c3150;
  color: #bfdbfe;
}

@media (max-width: 768px) {
  html body .project-bar-inner {
    padding-left: 0;
  }

  .project-shell-nav {
    display: none;
  }

  html body .app-layout > .sidebar,
  html body[data-active-view].is-program-workbar-collapsed .app-layout > .sidebar {
    width: min(292px, 88vw) !important;
    max-width: 88vw;
  }

  .sidebar-close {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .app-layout > .sidebar,
  .sidebar-overlay {
    transition: none;
  }
}
