/* Sidebar — full desktop column (.sb-full) + mobile icon rail (.sb-rail). */

/* avatars inside the sidebar */
#sidebar .avatar { display: inline-flex; flex: none; }
#sidebar .avatar.photo { border-radius: 50%; overflow: hidden; }

/* ===== full sidebar ====================================================== */
.sb-full { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.sb-top { display: flex; justify-content: flex-end; padding: 12px 12px 2px; flex: none; }

.sb-search {
  flex: none; margin: 4px 12px 8px; height: 40px;
  background: var(--bg-input); border-radius: var(--radius-input);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.sb-search .s-ic { display: inline-flex; color: var(--text-tertiary); flex: none; }
.sb-search input { flex: 1; min-width: 0; height: 100%; background: transparent; font-size: 15px; }

.sb-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 12px; }

/* pinned row */
.pin-row { display: flex; gap: 8px; padding: 2px 12px 8px; }
.pin-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  gap: 7px; padding: 10px 4px 9px; border-radius: 14px;
  border: 1px solid transparent; cursor: pointer;
}
.pin-item:hover { background: rgba(26, 26, 28, .6); }
.pin-item.selected { background: var(--bg-elev1); border-color: var(--hairline-strong); }
.pin-name {
  font-size: 12px; color: var(--text-primary); max-width: 10ch;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* "New chat" composing row */
.newchat-row {
  display: flex; align-items: center; gap: 12px; margin: 2px 8px 4px;
  padding: 10px; border-radius: 12px; background: var(--bg-elev1);
}
.nc-plus {
  width: 44px; height: 44px; border-radius: 50%; background: var(--bg-elev3);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-primary); flex: none;
}
.nc-label { font-size: 15px; font-weight: 600; }

/* section headers — clickable collapse toggles */
.sec-h {
  font-size: 13px; color: var(--text-tertiary);
  width: calc(100% - 16px); margin: 14px 8px 5px; padding: 4px 12px;
  border-radius: 8px; cursor: pointer; text-align: left;
  transition: background .12s ease, color .12s ease;
}
.sec-h:hover { background: rgba(26, 26, 28, .6); color: var(--text-secondary); }
.sec-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-chev {
  display: inline-flex; flex: none; color: var(--text-tertiary);
  transition: transform .18s ease;
}
.sec-h:hover .sec-chev { color: var(--text-secondary); }
.sec-group.collapsed .sec-chev { transform: rotate(-90deg); }
.sec-group.collapsed .chat-row { display: none; }

/* chat rows — 8px side margin so the selected highlight is inset */
.chat-row {
  display: flex; align-items: center; gap: 12px; height: 64px;
  margin: 0 8px; padding: 8px 10px; border-radius: 12px; cursor: pointer;
}
.chat-row:hover { background: rgba(26, 26, 28, .6); }
.chat-row.selected { background: var(--bg-elev1); }

.cr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-top { display: flex; align-items: baseline; gap: 8px; }
.cr-name {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-time { flex: none; font-size: 13px; color: var(--text-tertiary); }
.cr-bottom { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.cr-preview {
  flex: 1; min-width: 0; font-size: 14px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row.waiting .cr-preview { color: var(--orange); }
.cr-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.cr-dot.orange { background: var(--orange); }

/* bottom sticky: marketplace + profile */
.sb-bottom { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
.mkt-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 7px 8px; border-radius: 12px; font-size: 15px; color: var(--text-primary);
  cursor: pointer;
}
.mkt-row:hover { background: rgba(26, 26, 28, .6); }
.mkt-ic {
  width: 28px; height: 28px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--text-secondary); flex: none;
}
.profile-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 7px 8px; border-radius: 12px; cursor: pointer;
}
.profile-row:hover { background: rgba(26, 26, 28, .6); }
.pr-circle {
  width: 32px; height: 32px; border-radius: 50%; background: var(--m-teal);
  color: #fff; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.pr-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }

/* account menu + move-to submenu tweaks */
.popover.account-menu { min-width: 280px; }
.popover.submenu { min-width: 210px; }

/* ===== icon rail (mobile) — hidden by default; mobile.css flips it on ===== */
.sb-rail {
  display: none; /* mobile.css sets display:flex under its breakpoint */
  flex-direction: column; align-items: center;
  width: var(--rail-w); height: 100%; min-height: 0;
  background: var(--bg-sidebar); padding-top: 10px;
}
.rail-scroll {
  flex: 1; min-height: 0; width: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 2px 0 12px; scrollbar-width: none;
}
.rail-scroll::-webkit-scrollbar { display: none; }
.rail-div { flex: none; width: 32px; height: 1px; background: var(--hairline); }
.rail-av {
  position: relative; flex: none; width: 44px; height: 44px;
  border-radius: 50%; cursor: pointer; padding: 0;
}
.rail-av:hover { opacity: .85; }
.rail-av.selected { box-shadow: 0 0 0 2px var(--hairline-strong); }
.rail-av .avatar { width: 44px; height: 44px; }
.rail-dot {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--blue);
  border: 2px solid var(--bg-sidebar); box-sizing: content-box;
}
.rail-dot.orange { background: var(--orange); }
.rail-plus {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-elev1); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.rail-plus:hover { background: var(--bg-elev2); color: var(--text-primary); }
.rail-bottom {
  flex: none; width: 100%; display: flex; justify-content: center;
  position: sticky; bottom: 0; background: var(--bg-sidebar);
  border-top: 1px solid var(--hairline);
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.rail-profile {
  width: 36px; height: 36px; border-radius: 50%; background: var(--m-teal);
  color: #fff; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.rail-profile:hover { filter: brightness(1.1); }

.sec-h { display: flex; align-items: center; gap: 6px; }
.sec-count { margin-left: auto; color: var(--text-tertiary); font-size: 13px; padding-right: 4px; flex: none; }
