/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--nav-bg);
  border-right: 1px solid rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: sticky;
  top: 0;
  overflow: hidden;
}

/* Desktop (>=1366px): brand lives in the topbar; this row is unused.
   Drawer widths (≤1365px, same as the hamburger): close button plus
   .sidebar-drawer-brand. */
.sidebar-header {
  display: none;
}

.sidebar-drawer-brand {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  border-radius: var(--r-sm);
}
.sidebar-drawer-brand:focus-visible {
  outline: 2px solid var(--brass-lo);
  outline-offset: 2px;
}
.sidebar-drawer-brand__image {
  display: block;
  height: 40px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--nav-border);
  border-radius: var(--r-sm);
  background: var(--nav-mid);
  color: var(--nav-text-hi);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-close:hover { color: var(--brass-hi); background: var(--nav-active); }


.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 8px 10px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.nav-group { margin-bottom: 22px; }
/* [#1205] .nav-group-label / .nav-subgroup-label were dropped with the
   grouped sidebar — seven flat destinations need no section headings, and
   nothing renders those classes any more. */

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--nav-text);
  font-weight: 500; font-size: 13.5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.nav-item:hover { background: var(--nav-mid); color: var(--nav-text-hi); }
.nav-item.active { background: var(--nav-active); color: var(--brass-hi); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px;
  background: var(--brass); border-radius: 0 3px 3px 0;
}
.nav-icon { width: 17px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--brass); color: #12223a;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; line-height: 1.5;
}
/* [#1205] Amber = a person is being waited on (pricing approvals, applicants).
   Brass = a plain count. Replaces the inline style the old sidebar carried. */
.nav-badge--alert {
  background: var(--amber, #f59e0b);
  color: #fff;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--nav-border);
  background: var(--nav-bg);
  flex-shrink: 0;
}
.user-tile {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer;
  transition: background 0.12s;
}
.user-tile:hover { background: var(--nav-mid); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--nav-mid); border: 2px solid var(--brass-lo);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--brass); flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--nav-text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-family: var(--font-mono); font-size: 12px; color: var(--nav-text); text-transform: uppercase; letter-spacing: 0.1em; }
.sidebar-utility-link {
  color: rgba(139,165,191,0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
}
.sidebar-utility-link:hover {
  color: var(--brass-hi);
  background: var(--nav-active);
}

/* ═══════════════════════════════════════════
   SIDEBAR — MOBILE
═══════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 998;
}

body.sidebar-is-open {
  overflow: hidden;
}

/* The full rail leaves too little working room on iPad portrait and compact
   laptops. Keep it as a drawer until the content area can stay comfortably
   wider than a tablet workspace. */
@media (max-width: 1365px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 999;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
  }
  .sidebar-overlay-visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-item { padding: 12px 14px; font-size: 14px; }
  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 12px 14px 12px 16px;
    flex-shrink: 0;
  }
  .sidebar-close { display: inline-flex; }
  .sidebar-drawer-brand {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-overlay {
    transition: none;
  }
}

@media (pointer: coarse) {
  .nav-item,
  .user-tile,
  .sidebar-utility-link {
    min-height: 44px;
  }
  .sidebar-utility-link {
    min-width: 44px;
  }
}
