/**
 * Sidebar + mobile drawer — loaded with ourb-design.css + styles.css token bridge.
 * brand-104: extracted from styles.css to keep main sheet under 600 lines.
 */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 168px;
  background: var(--ourb-white);
  border-right: 1px solid var(--ourb-grey-100);
  display: flex;
  flex-direction: column;
  padding: var(--ourb-space-5) 0;
  z-index: 50;
  transition: width var(--ourb-transition-base);
}
.app-nav--collapsed {
  width: 56px;
}
.nav-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--ourb-space-3) var(--ourb-space-4);
  border-bottom: 1px solid var(--ourb-grey-100);
  margin-bottom: var(--ourb-space-3);
}
.nav-brand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ourb-space-3);
  width: 100%;
  min-height: 44px;
  padding: var(--ourb-space-1) 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.nav-brand-btn:focus-visible {
  outline: 2px solid var(--ourb-accent);
  outline-offset: 2px;
}
.nav-brand-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.nav-brand-text {
  font-family: var(--ourb-font-display);
  font-size: var(--ourb-text-base);
  font-weight: 600;
  color: var(--ourb-black);
}
.app-nav--collapsed .nav-brand-btn {
  flex-direction: column;
  gap: 0;
}
.app-nav--collapsed .nav-brand-img {
  width: 44px;
  height: 44px;
}
.app-nav--collapsed .nav-brand-text {
  display: none;
}
.nav-links {
  display: flex;
  flex-direction: column;
  gap: var(--ourb-space-1);
  padding: 0 var(--ourb-space-3);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nav-link {
  font-family: var(--ourb-font-primary);
  font-size: var(--ourb-text-sm);
  font-weight: 400;
  color: var(--ourb-grey-500);
  text-decoration: none;
  padding: var(--ourb-space-3);
  min-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border-radius: var(--ourb-radius-md);
  transition: background var(--ourb-transition-fast), color var(--ourb-transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-link.ourb-body-sm {
  color: var(--ourb-grey-500);
}
.nav-link:hover {
  background: var(--ourb-grey-50);
  color: var(--ourb-grey-700);
}
.nav-link--active {
  background: var(--ourb-grey-100);
  color: var(--ourb-black);
  font-weight: 500;
}
.nav-link-short {
  display: none;
}
.app-nav .nav-divider.ourb-divider {
  margin: var(--ourb-space-3);
  flex-shrink: 0;
  background: var(--ourb-grey-200);
}
.app-nav--collapsed .nav-divider.ourb-divider {
  margin: var(--ourb-space-2) var(--ourb-space-1);
}
.app-nav--collapsed .nav-links {
  padding: 0 var(--ourb-space-2);
}
.app-nav--collapsed .nav-link {
  display: block;
  color: transparent !important;
  padding: var(--ourb-space-4) 0;
  min-height: 44px;
  box-sizing: border-box;
  position: relative;
  text-align: center;
}
.app-nav--collapsed .nav-link::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--ourb-grey-400);
  opacity: 0.5;
}
.app-nav--collapsed .nav-link--active::after {
  background: var(--ourb-accent);
  opacity: 1;
}
.app-nav--collapsed .nav-link-long,
.app-nav--collapsed .nav-link-short {
  display: none !important;
}
body.has-nav {
  padding-left: calc(168px + env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  transition: padding-left var(--ourb-transition-base);
}
body.has-nav.nav-collapsed {
  padding-left: calc(56px + env(safe-area-inset-left, 0px));
}
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--ourb-transition-base), visibility var(--ourb-transition-base);
}
body.nav-drawer-open .nav-drawer-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.nav-mobile-trigger {
  display: none;
  position: fixed;
  top: calc(var(--ourb-space-3) + env(safe-area-inset-top, 0px));
  left: calc(var(--ourb-space-3) + env(safe-area-inset-left, 0px));
  z-index: 100;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: var(--ourb-radius-lg);
  background: var(--ourb-white);
  box-shadow: var(--ourb-shadow-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-mobile-trigger:focus-visible {
  outline: 2px solid var(--ourb-accent);
  outline-offset: 2px;
}
.nav-mobile-trigger-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}
@media (max-width: 767px) {
  body.has-nav,
  body.has-nav.nav-collapsed {
    padding-left: env(safe-area-inset-left, 0px);
  }
  body.has-nav main {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
  }
  .nav-mobile-trigger {
    display: flex;
  }
  .app-nav {
    width: min(280px, 85vw) !important;
    max-width: min(280px, 85vw);
    padding-top: calc(var(--ourb-space-5) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--ourb-space-5) + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    transform: translateX(-100%);
    transition: transform var(--ourb-transition-base);
    z-index: 95;
    box-shadow: var(--ourb-shadow-md);
  }
  body.nav-drawer-open .app-nav {
    transform: translateX(0);
  }
  .app-nav .nav-divider.ourb-divider {
    margin: var(--ourb-space-4) 0;
  }
  .app-nav .nav-link-long {
    display: inline !important;
  }
  .app-nav .nav-link-short {
    display: none !important;
  }
  .app-nav .nav-link {
    color: var(--ourb-grey-500) !important;
    padding: 12px var(--ourb-space-3);
    min-height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }
  .app-nav .nav-link--active {
    color: var(--ourb-black) !important;
  }
  .app-nav .nav-link::after {
    display: none !important;
  }
  .app-nav .nav-brand-btn {
    min-height: 48px;
    padding: var(--ourb-space-1) var(--ourb-space-2);
  }
  .app-nav--collapsed .nav-brand-text {
    display: inline;
  }
  .app-nav--collapsed .nav-brand-btn {
    flex-direction: row;
    gap: var(--ourb-space-3);
  }
  .app-nav--collapsed .nav-brand-img {
    width: 40px;
    height: 40px;
  }
}
/* Nav spacer pushes theme panel to bottom */
.nav-spacer {
  display: none;
}

.nav-auth-slot {
  padding: var(--ourb-space-3);
  border-top: 1px solid var(--ourb-grey-100);
  flex-shrink: 0;
}
.nav-auth-slot[hidden] {
  display: none;
}
.app-nav .site-auth {
  position: static;
  z-index: auto;
  top: auto;
  right: auto;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--ourb-space-2);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.app-nav .site-auth-user {
  width: 100%;
}
.app-nav .site-auth-name {
  max-width: 104px;
  font-size: var(--ourb-text-xs);
}
.app-nav .site-auth-out {
  width: 100%;
  min-height: 32px;
  background: var(--ourb-grey-50);
}
.app-nav--collapsed .nav-auth-slot {
  padding: var(--ourb-space-2);
}
.app-nav--collapsed .site-auth {
  align-items: center;
}
.app-nav--collapsed .site-auth-user {
  justify-content: center;
}
.app-nav--collapsed .site-auth-avatar {
  width: 28px;
  height: 28px;
}
.app-nav--collapsed .site-auth-name {
  display: none;
}
.app-nav--collapsed .site-auth-out {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 0;
}
.app-nav--collapsed .site-auth-out::before {
  content: 'Out';
  font-size: 10px;
  font-weight: 600;
}

/* Theme toggle panel at bottom of nav */
.nav-theme-panel {
  padding: var(--ourb-space-2);
  border-top: 1px solid var(--ourb-grey-100);
  display: flex;
  flex-direction: column;
  gap: var(--ourb-space-1);
  flex-shrink: 0;
}
.nav-theme-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: var(--ourb-space-1);
}
.nav-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  height: 32px;
  box-sizing: border-box;
  border: 1px solid var(--ourb-grey-200);
  border-radius: var(--ourb-radius-md);
  background: var(--ourb-white);
  color: var(--ourb-grey-500);
  font-family: var(--ourb-font-primary);
  font-size: var(--ourb-text-xs);
  font-weight: 400;
  cursor: pointer;
  transition: background var(--ourb-transition-fast), border-color var(--ourb-transition-fast), color var(--ourb-transition-fast);
}
.nav-theme-btn:hover {
  background: var(--ourb-grey-50);
  border-color: var(--ourb-grey-300);
  color: var(--ourb-grey-700);
}
.nav-theme-btn:focus-visible {
  outline: 2px solid var(--ourb-accent);
  outline-offset: 2px;
}
.nav-theme-btn.active {
  background: var(--ourb-grey-100);
  border-color: var(--ourb-accent);
  color: var(--ourb-black);
  font-weight: 500;
}
.nav-theme-icon {
  font-size: 16px;
  line-height: 1;
}
.nav-theme-label {
  display: none;
}
.nav-theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--ourb-grey-300);
  flex-shrink: 0;
}
.nav-theme-swatch--silver {
  background: #9CA3AF;
}
.nav-theme-swatch--brass {
  background: #B8A888;
}

/* Collapsed nav: hide labels, show icons/swatches only */
.app-nav--collapsed .nav-theme-panel {
  padding: var(--ourb-space-2);
}
.app-nav--collapsed .nav-theme-row {
  gap: var(--ourb-space-1);
}
.app-nav--collapsed .nav-theme-btn {
  padding: 0;
  height: 32px;
  box-sizing: border-box;
  justify-content: center;
}
.app-nav--collapsed .nav-theme-label {
  display: none;
}
.app-nav--collapsed .nav-theme-icon {
  font-size: 16px;
}
.app-nav--collapsed .nav-theme-swatch {
  width: 16px;
  height: 16px;
}

/* Dark mode overrides */
[data-theme="dark"] .app-nav,
[data-theme="dark-brass"] .app-nav {
  background: var(--ourb-white);
  border-color: var(--ourb-grey-100);
}
[data-theme="dark"] .nav-theme-panel,
[data-theme="dark-brass"] .nav-theme-panel {
  border-color: var(--ourb-grey-100);
}
[data-theme="dark"] .nav-theme-btn,
[data-theme="dark-brass"] .nav-theme-btn {
  background: var(--ourb-grey-50);
  border-color: var(--ourb-grey-200);
}
[data-theme="dark"] .nav-theme-btn:hover,
[data-theme="dark-brass"] .nav-theme-btn:hover {
  background: var(--ourb-grey-100);
}
[data-theme="dark"] .nav-theme-btn.active,
[data-theme="dark-brass"] .nav-theme-btn.active {
  background: var(--ourb-grey-200);
}

/* Mobile drawer theme panel */
@media (max-width: 767px) {
  .nav-theme-panel {
    padding: var(--ourb-space-4) var(--ourb-space-3);
  }
  .nav-theme-label {
    display: inline !important;
  }
  .nav-theme-btn {
    height: 44px;
    box-sizing: border-box;
    font-size: var(--ourb-text-sm);
    gap: var(--ourb-space-2);
    padding: 0 var(--ourb-space-2);
  }
  .app-nav--collapsed .nav-theme-btn {
    height: 44px;
    padding: 0 var(--ourb-space-2);
  }
  .nav-auth-slot {
    padding: var(--ourb-space-4) var(--ourb-space-3);
  }
  .app-nav--collapsed .site-auth {
    align-items: stretch;
  }
  .app-nav--collapsed .site-auth-user {
    justify-content: flex-start;
  }
  .app-nav--collapsed .site-auth-name {
    display: inline;
  }
  .app-nav--collapsed .site-auth-out {
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 0 var(--ourb-space-3);
    font-size: var(--ourb-text-sm);
  }
  .app-nav--collapsed .site-auth-out::before {
    content: none;
  }
}
