/* ══════════════════════════════════════════
   SIDEBAR & APP LAYOUT
══════════════════════════════════════════ */

.app-layout {
  margin-left: var(--sidebar-w);
}

.sidebar {
  position: fixed;
  left: 0;
  top: var(--nav-h);
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  overflow: hidden;            /* the nav list scrolls, not the whole sidebar */
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

/* mobile drawer action footer (hidden on desktop) */
.sidebar-actions { display: none; flex-direction: column; gap: 8px; padding: 14px; margin-top: auto; border-top: 1px solid var(--border); }
.sidebar-act { background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: background .15s, border-color .15s; }
.sidebar-act:hover { border-color: var(--border-hover); background: var(--surface3); }
.sidebar-act.danger { color: #f87171; }

/* off-canvas backdrop (used on mobile) */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 9999998; }
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

.sidebar-user {
  padding: 18px 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(252, 76, 2, .04), transparent);
}

.sidebar-user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--orange-dim);
}

.sidebar-user-info { min-width: 0; flex: 1; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  line-height: 1.3;
}

.sidebar-user-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 4px #4ade8066;
}

.sidebar-nav {
  padding: 6px 0 20px;
  display: flex;
  flex-direction: column;
  /* this list is the scroll area: fill the space below the profile and scroll
     its own overflow. min-height:0 is required so a flex child can shrink and
     actually scroll instead of overflowing its parent. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav.locked { pointer-events: none; opacity: .35; }

.sidebar-group-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 16px 5px;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 14px;
  flex-shrink: 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  width: calc(100% - 16px);
  transition: background .14s, color .14s;
}

.sidebar-nav .nav-link .nav-icon {
  width: 15px;
  height: 15px;
  opacity: .55;
  flex-shrink: 0;
  transition: opacity .14s;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav .nav-link:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav .nav-link:hover .nav-icon { opacity: .9; }
.sidebar-nav .nav-link.active { background: var(--orange-dim); color: var(--orange); font-weight: 600; }
.sidebar-nav .nav-link.active .nav-icon { opacity: 1; }
