/* Sidebar Navigation and Chat Management */

/* ── Team Context Bar (mode panel inline indicator) ── */
.team-context-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md, 10px);
  background: var(--bg-input, #F0EDE8);
  border: 1.5px solid var(--border-light, #EBE9E3);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.team-context-bar svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.tcb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  background: var(--accent);
}
.tcb-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, var(--ink));
  flex: 1;
}
.tcb-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
  white-space: nowrap;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm, 6px);
  transition: all var(--transition, 0.2s);
}
.tcb-hint:hover {
  color: var(--text-secondary, #6B6D7B);
  background: var(--bg-card, #FFFFFF);
}

/* ── Sidebar dark-theme scope ── */
/* CSS variable overrides apply to all children for computed values */
.sidebar,
.sidebar *,
.sb-avatar-popover,
.sb-avatar-popover * {
  --panel: var(--sidebar-bg);
  --ink: var(--sidebar-text);
  --muted: var(--sidebar-muted);
  --line: var(--sidebar-border);
  --hover: var(--sidebar-hover);
  --ink-dim: var(--sidebar-muted);
  --text: var(--sidebar-text);
  --text-muted: var(--sidebar-muted);
}
/* Base text color on containers only — children inherit naturally,
   so .team-name picks up .sb-team-item's muted gray instead of bright white */
.sidebar,
.sb-avatar-popover {
  color: var(--sidebar-text);
}

/* ── Sidebar Container ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  padding: 0;
  height: 100vh;
  position: relative;
  z-index: 10;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar Header ── */
.sb-header {
  padding: 24px 22px 20px;
  min-height: 81px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-left: -24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* .sb-logo is directly on the <img> element in live HTML */
.sb-logo {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
}

.sb-brand {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.01em;
}
.sb-brand span {
  color: inherit;
}

/* ── New Chat Button ── */
.sb-new-chat {
  margin: 16px 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-md, 10px);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition, 0.2s);
}
.sb-new-chat:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.16);
}
.sb-new-chat i,
.sb-new-chat svg {
  width: 16px;
  height: 16px;
}

/* ── Sidebar Sections ── */
.sb-section {
  padding: 16px 12px 8px;
}

/* ── Section Titles ── */
.sb-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-on-dark-muted, var(--sidebar-muted));
  padding: 0 10px;
  margin-top: 16px;
  margin-bottom: 8px;
}
/* Quick Access title is now inside sb-scrollable, no special padding needed */

/* Section containers add bottom padding to match mockup .sidebar-section padding */
#sb-teams-section,
.sb-groups-section {
  padding-bottom: 8px;
}
.sb-add-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-dim, #9ca3af);
  font-size: 14px;
  line-height: 1;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.sb-add-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ── Quick Access ── */
/* Quick Access is inside sb-scrollable (which has padding: 0 12px), so no extra horizontal padding */
.sidebar .sb-list.sb-quick-access {
  padding: 0;
  margin-bottom: 8px;
}

/* ── List item resets (live app uses <ul><li><button> structure) ── */
.sidebar .sb-list > li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar .sb-list > li > .sb-item {
  width: 100%;
}

/* ── Sidebar Items ── */
.sidebar .sb-item,
.sidebar .project-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-radius: var(--radius-md, 10px);
  box-shadow: none;
  color: var(--text-on-dark, var(--sidebar-text));
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition, 0.2s);
  text-decoration: none;
  position: relative;
}
.sidebar .sb-item:hover,
.sidebar .project-toggle:hover {
  background: var(--bg-sidebar-hover, var(--sidebar-hover));
}
.sidebar .sb-item.active {
  background: rgba(212, 168, 67, 0.12);
  color: var(--discovery-accent);
}
.sidebar .sb-item svg,
.sidebar .sb-item .icon,
.sidebar .project-toggle svg,
.sidebar .project-toggle .icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}
.sidebar .sb-item.active svg,
.sidebar .sb-item.active .icon {
  opacity: 1;
}
.sidebar .sb-item > span,
.sidebar .project-toggle > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Scrollable Area ── */
.sb-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 0 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sb-scrollable:hover {
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sb-scrollable::-webkit-scrollbar { width: 4px; }
.sb-scrollable::-webkit-scrollbar-track { background: transparent; }
.sb-scrollable::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; transition: background 0.2s; }
.sb-scrollable:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* ── Team Items ── */
.sb-team-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-on-dark-muted, #8A8C98);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition, 0.2s);
  margin: 0 12px;
  position: relative;
  flex-wrap: wrap;
}
.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition, 0.2s);
}
.sb-team-item:hover .team-dot {
  transform: scale(1.15);
}
.sb-team-item:hover {
  color: var(--text-on-dark, #E8E6E1);
  background: var(--bg-sidebar-hover, #282A38);
}
.sb-team-item.active {
  color: var(--team-color, var(--discovery-accent));
  background: transparent;
}
/* Highlight only the team row (dot + name + badge), not the expanded chat list */
.sb-team-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  background: color-mix(in srgb, var(--team-color, var(--discovery-accent)) 12%, transparent);
  border-radius: var(--radius-sm, 6px);
  pointer-events: none;
}
.sb-team-item.active .team-name {
  color: var(--team-color, var(--accent));
}
.sb-team-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.5;
  flex-shrink: 0;
}
.sb-team-item.active svg {
  opacity: 1;
}

/* Team name — inherits font-size 13px from .sb-team-item */
.team-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Team badge */
.team-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: var(--text-on-dark-muted, #8A8C98);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.sb-team-item.active .team-badge {
  background: color-mix(in srgb, var(--team-color, var(--discovery-accent)) 20%, transparent);
  color: var(--team-color, var(--discovery-accent));
}

/* ── Chat List (under a team) ── */
.sb-team-item > .sb-chat-list {
  display: none;
  width: 100%;
  padding: 2px 0;
}
.sb-team-item > .sb-chat-list.open {
  display: block;
}

/* ── Chat Items ── */
.sb-chat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 14px;
  font-size: 12px;
  color: var(--text-on-dark-muted, #8A8C98);
  cursor: pointer;
  transition: all var(--transition, 0.2s);
  margin: 0 0 0 12px;
  border-radius: var(--radius-sm, 6px);
}
.sb-chat-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-chat-item:hover {
  color: var(--text-on-dark, #E8E6E1);
  background: var(--bg-sidebar-hover, #282A38);
}

/* ── Chat Action Buttons (Delete, Pin) ── */
.sb-delete-btn,
.sb-pin-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition, 0.2s);
  color: var(--text-on-dark-muted, #8A8C98);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.sb-delete-btn svg,
.sb-pin-btn svg { width: 13px; height: 13px; }

.sb-chat-item:hover .sb-pin-btn,
.sb-chat-item:hover .sb-delete-btn { opacity: 0.5; }
.sb-chat-item:hover .sb-pin-btn:hover {
  opacity: 1;
  color: var(--discovery-accent);
  background: rgba(255,255,255,0.08);
}
.sb-chat-item:hover .sb-delete-btn:hover {
  opacity: 1;
  color: #ef4444;
  background: none;
}
.sb-chat-item:hover .sb-delete-btn:hover svg {
  fill: #ef4444;
}
.sb-chat-pinned .sb-pin-btn { opacity: 0.8; color: var(--discovery-accent); }

/* Pinned chat styling — pin icon stays visible (see .sb-chat-pinned .sb-pin-btn) */

/* ── Pin Divider ── */
.sb-pin-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0 4px 36px;
}

/* ── Group Items ── */
.sb-group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
  flex-wrap: wrap;
}
.sb-group-item:hover { background: rgba(255, 255, 255, 0.06); }
.sb-group-item.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sb-group-item.active .group-name { color: var(--accent); }

.sb-group-icon { opacity: 0.5; font-size: 14px; flex-shrink: 0; }
.group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-badge {
  font-size: 11px;
  color: var(--ink-dim, #9ca3af);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Group chat list */
.sb-group-item > .sb-chat-list {
  display: none;
  width: 100%;
  padding-left: 8px;
}
.sb-group-item > .sb-chat-list.open {
  display: block;
}

.sb-groups-section {
  margin-top: 4px;
}

/* Empty states */
.sb-chat-empty {
  font-size: 12px;
  color: var(--text-on-dark-muted, #8A8C98);
  padding: 4px 8px 4px 26px;
  font-style: italic;
}
.sb-empty {
  font-size: 12px;
  color: var(--text-on-dark-muted, #8A8C98);
  padding: 8px 4px;
  font-style: italic;
}

/* No-team item */
.sb-no-team {
  cursor: pointer;
}
.sb-no-team > i,
.sb-no-team > svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

/* ── Sidebar Footer ── */
.sb-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  position: relative;
}
.sb-footer-items {
  display: flex;
  gap: 4px;
  flex: 1;
}
.sb-footer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-on-dark-muted, #8A8C98);
  font-size: 12px;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition, 0.2s);
  background: none;
  border: none;
}
.sb-footer-item:hover {
  color: var(--text-on-dark, #E8E6E1);
  background: var(--bg-sidebar-hover, #282A38);
}
.sb-footer-item svg,
.sb-footer-item i svg {
  width: 16px;
  height: 16px;
}

/* Legacy footer btn (compat) */
.sb-footer-btn {
  background: none;
  border: none;
  color: var(--sidebar-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.sb-footer-btn:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}
.sb-footer-btn i,
.sb-footer-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Help button ── */
.sb-help-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  color: var(--text-on-dark-muted, #9B9DA8);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.sb-help-btn:hover {
  background: var(--bg-sidebar-hover, #282A38);
  color: var(--text-on-dark, #E8E6E1);
  border-color: rgba(255,255,255,0.4);
}

/* ── Avatar ── */
.sb-avatar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--discovery-accent), #E8C76A);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* ── Avatar Popover ── */
.sb-avatar-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-sidebar, #1C1E2A);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  padding: 8px 0;
  display: none;
  z-index: 100;
}
.sb-avatar-popover.open {
  display: block;
}

.sb-avatar-info {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 4px;
}
.sb-avatar-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.sb-avatar-email {
  font-size: 12px;
  color: var(--text-on-dark-muted, #8A8C98);
  margin-top: 2px;
}
.sb-avatar-divider {
  display: none;
}

.sb-avatar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  background: none;
  border: none;
  color: var(--text-on-dark, #E8E6E1);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition, 0.2s);
}
.sb-avatar-action:hover {
  background: var(--bg-sidebar-hover, #282A38);
}
.sb-avatar-action i,
.sb-avatar-action svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}
.sb-avatar-action i svg {
  width: 16px;
  height: 16px;
}

/* Hide Account/Organization (mockup only shows Log out) */
#sb-avatar-account,
#sb-avatar-org {
  display: none;
}

.sb-avatar-logout {
  color: #E57373;
}
.sb-avatar-logout i,
.sb-avatar-logout svg,
.sb-avatar-logout i svg {
  color: #E57373;
}

/* ── Avatar Wrapper (relative context for popover positioning) ── */
.avatar-wrapper {
  position: relative;
  margin-left: auto;
}

/* ── Dropdown Menus (project, chat, prompt) ── */
.project-header {
  display: flex;
  align-items: center;
  position: relative;
}
.project-header .project-toggle {
  flex: 1;
  min-width: 0;
}
.project-menu-container,
.prompt-menu-container {
  position: relative;
  margin-left: auto;
}
.project-menu-btn,
.prompt-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
}
.project:hover .project-menu-btn,
.prompt-nav-row:hover .prompt-menu-btn,
.prompt-library-item--with-menu:hover .project-menu-btn {
  opacity: 1;
}
.project-menu-btn:hover,
.prompt-menu-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}

.project-dropdown-menu,
.prompt-menu-dropdown {
  position: absolute;
  top: 0;
  left: calc(100% + 4px);
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 4px 0;
  white-space: nowrap;
}
.project-dropdown-menu.hidden,
.prompt-menu-dropdown.hidden {
  display: none;
}
.project-dropdown-menu .dropdown-item.delete-item,
.prompt-menu-dropdown .dropdown-item.delete-item {
  color: #ef4444;
}
.project-dropdown-menu .dropdown-item.delete-item:hover,
.prompt-menu-dropdown .dropdown-item.delete-item:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Chat dropdown menu */
.chat-menu-container {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
}
.chat-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s ease;
}
.chat:hover .chat-menu-btn {
  opacity: 1;
}
.chat-menu-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}
.chat-dropdown-menu {
  position: absolute;
  top: 0;
  left: calc(100% + 4px);
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999999;
  padding: 4px 0;
  white-space: nowrap;
}
.chat-dropdown-menu.hidden {
  display: none;
}
.chat-dropdown-menu .dropdown-item.delete-item {
  color: #ef4444;
}
.chat-dropdown-menu .dropdown-item.delete-item:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Dropdown items (shared) */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  transition: background-color 0.15s ease;
}
.dropdown-item:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.dropdown-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Legacy lists / sublists (kept for JS compat) ── */
.sidebar .sb-list,
.sidebar .sb-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar .project {
  display: grid;
  gap: 6px;
}
.sidebar .chat {
  display: grid;
  gap: 6px;
  position: relative;
}

/* ── Unfiled Chats ── */
#unfiled-chats {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Chat Tooltips ── */
.chat-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: normal;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 300px;
  word-wrap: break-word;
}
.chat-tooltip.show {
  opacity: 1;
}

/* ── Prompt Library Sidebar ── */
.prompt-library-panel {
  margin-top: 4px;
  padding: 0;
  list-style: none;
}
.prompt-library-panel .prompt-library-message {
  padding: 8px 12px;
  color: var(--ink-dim);
}
.prompt-library-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.prompt-library-category {
  margin: 0;
  padding: 0;
}
.prompt-library-spacer {
  display: none;
}
.prompt-library-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.prompt-library-toggle {
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--text-on-dark-muted, #8A8C98);
  padding: 5px 8px 5px 14px;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-transform: none;
  border-radius: var(--radius-sm, 6px);
  transition: all var(--transition, 0.2s);
}
.prompt-library-toggle:hover {
  color: var(--text-on-dark, #E8E6E1);
  background: var(--bg-sidebar-hover, #282A38);
}
.prompt-library-sublist {
  list-style: none;
  margin: 0;
  padding: 2px 0 4px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.prompt-library-item {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
}
.prompt-library-link {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 12px;
  font-family: inherit;
  font-weight: 400;
  color: var(--text-on-dark-muted, #8A8C98);
  padding: 5px 8px 5px 24px;
  background: none;
  border: none;
  cursor: pointer;
  flex: 1 1 auto;
  border-radius: var(--radius-sm, 6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--transition, 0.2s);
}
.prompt-library-link:hover,
.prompt-library-link:focus {
  text-decoration: none;
  color: var(--text-on-dark, #E8E6E1);
  background: rgba(255,255,255,0.06);
}
.prompt-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.prompt-nav-row > .sb-item {
  flex: 1;
}

/* ── Toolbox Panel ── */
.toolbox-panel {
  list-style: none;
  padding: 0;
}
.toolbox-list {
  list-style: none;
  margin: 0;
  padding: 2px 0 4px 0;
  display: flex;
  flex-direction: column;
}
.toolbox-list li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toolbox-tool {
  display: flex;
  align-items: center;
  padding: 5px 8px 5px 24px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 400;
  color: var(--text-on-dark-muted, #8A8C98);
  cursor: pointer;
  transition: all var(--transition, 0.2s);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--radius-sm, 6px);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.toolbox-tool:hover {
  color: var(--text-on-dark, #E8E6E1);
  background: rgba(255,255,255,0.06);
}

/* Remove focus outline for sidebar items */
.sidebar button:focus {
  outline: none;
}

/* ── Sidebar Overlay (responsive) ── */
#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2;
}
#sb-overlay.open {
  display: block;
}

/* Legacy overlay class compat */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2;
}
.sb-overlay.open {
  display: block;
}

/* ── Responsive Sidebar Collapse ── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 72px;
    min-width: 72px;
    border-radius: 0;
    overflow: hidden;
    z-index: 100;
    cursor: pointer;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.expanded {
    width: 260px;
    min-width: 260px;
    cursor: default;
  }

  /* Hide labels/lists when collapsed */
  .sidebar:not(.expanded) .sb-brand,
  .sidebar:not(.expanded) .sb-item span,
  .sidebar:not(.expanded) .sb-section-title,
  .sidebar:not(.expanded) .sb-team-item span,
  .sidebar:not(.expanded) .sb-footer-item span,
  .sidebar:not(.expanded) .sb-chat-item,
  .sidebar:not(.expanded) .sb-chat-list,
  .sidebar:not(.expanded) .sb-pin-divider,
  .sidebar:not(.expanded) .sb-scrollable,
  .sidebar:not(.expanded) .team-badge,
  .sidebar:not(.expanded) .team-name,
  .sidebar:not(.expanded) .group-name,
  .sidebar:not(.expanded) .group-badge,
  .sidebar:not(.expanded) .sb-new-chat span { display: none; }

  .sidebar:not(.expanded) .sb-new-chat { padding: 11px; justify-content: center; margin: 16px 8px 0; }
  .sidebar:not(.expanded) .sb-item { justify-content: center; padding: 10px; margin: 0 8px; }
  .sidebar:not(.expanded) .sb-item svg { margin: 0; }
  .sidebar:not(.expanded) .sb-team-item { justify-content: center; padding: 7px; margin: 0 8px; }
  .sidebar:not(.expanded) .sb-footer { flex-direction: column; gap: 4px; padding: 8px; align-items: center; }
  .sidebar:not(.expanded) .sb-footer-items { justify-content: center; }
  .sidebar:not(.expanded) .sb-footer-item { padding: 8px; justify-content: center; }
  .sidebar:not(.expanded) .sb-avatar { margin-left: 0; }
  .sidebar:not(.expanded) .sb-section { padding: 16px 0 8px; }
  .sidebar:not(.expanded) .sb-header { justify-content: center; padding: 24px 18px 20px; }
}

/* ── Sidebar mobile overlay ── */
#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}
#sb-overlay.open { display: block; }
