/* Progressive enhancement: pages keep their existing layout without sidebar.js. */
.app-shell > .sidebar.sidebar-enhanced {
  flex: 0 0 240px;
  width: 240px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-enhanced > .nav {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px;
  scrollbar-gutter: stable;
}

.sidebar-enhanced .sidebar-header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  background: #f6fdf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sidebar-enhanced .sidebar-brand { min-width: 0; }
.sidebar-enhanced .nav-link { gap: 10px; }
.sidebar-link-icon { display: inline-flex; flex: 0 0 20px; width: 20px; height: 20px; }
.sidebar-link-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-link-label { min-width: 0; }
.sidebar-enhanced .nav-link:focus-visible { outline: 2px solid var(--accent, #0f9d58); outline-offset: 2px; }
.sidebar-enhanced .sidebar-header > [hidden],
.sidebar-enhanced > .nav[hidden] { display: none !important; }

.sidebar-enhanced .sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 7px;
  border: 1px solid #cce6d5;
  border-radius: 10px;
  background: var(--bg-2, #f7fff9);
  color: var(--accent-2, #0b8043);
  cursor: pointer;
}

.sidebar-enhanced .sidebar-toggle:hover { background: #e0f3e7; }
.sidebar-enhanced .sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent, #0f9d58);
  outline-offset: 3px;
}
.sidebar-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.sidebar-toggle-chevron { transform-origin: 14.5px 12px; }
.sidebar-collapsed .sidebar-toggle-chevron { transform: rotate(180deg); }

.app-shell > .sidebar.sidebar-collapsed {
  /* Leave room for 40px icons plus a non-overlay Windows scrollbar. */
  flex-basis: 80px;
  width: 80px;
  padding: 32px 6px;
}
.sidebar-collapsed .sidebar-header { justify-content: center; }
.sidebar-collapsed > .nav { align-items: center; gap: 8px; }
.sidebar-collapsed .nav-group,
.sidebar-collapsed .nav-footer { width: 100%; align-items: center; gap: 8px; padding-top: 8px; }
.sidebar-collapsed .nav-group-title,
.sidebar-collapsed .sidebar-link-label { display: none; }
.sidebar-collapsed .nav-link {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 9px;
  justify-content: center;
  border-radius: 12px;
}

@media (max-width: 960px) {
  .app-shell > .sidebar.sidebar-enhanced {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .sidebar-enhanced .sidebar-header { width: 100%; }
  .sidebar-enhanced > .nav { min-width: 0; width: 100%; overflow: visible; scrollbar-gutter: auto; }
  .sidebar-collapsed .sidebar-header { justify-content: flex-start; }
  .sidebar-collapsed > .nav { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding: 4px; }
  .sidebar-collapsed .nav-group,
  .sidebar-collapsed .nav-footer { display: contents; }
}
