/* A quiet navigation rail; all navigation shares one scroll area. */
.sidebar {
  --sidebar-text: #d6d6d3;
  --sidebar-muted: #a1a19c;
  padding: 18px 12px 10px;
  background: #252523;
  color: var(--sidebar-text);
  border-right: 1px solid #393936;
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sidebar-head { flex: 0 0 auto; min-height: 40px; padding: 0 10px 12px; }
.sidebar .mini-brand { gap: 9px; color: #f1f1ee; }
.sidebar .mini-brand strong { font-size: 20px; font-weight: 650; letter-spacing: -.5px; }
.sidebar .brand-mark.small { display: none; }
.sidebar .version { border: 0; color: #94948e; font-size: 13px; }
.sidebar .sidebar-collapse { width: 32px; height: 32px; color: var(--sidebar-muted); }
.sidebar-content { min-height: 0; flex: 1; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4c4c47 transparent; overscroll-behavior: contain; padding-bottom: 12px; }
.sidebar-content::-webkit-scrollbar { width: 5px; }
.sidebar-content::-webkit-scrollbar-thumb { background: #4c4c47; border-radius: 8px; }
.sidebar-content::-webkit-scrollbar-button { display: none; }
.sidebar .patient-card { min-height: 48px; padding: 6px 10px; border: 0; border-radius: 0; background: transparent; gap: 10px; }
.sidebar .patient-card .avatar { width: 28px; height: 28px; border-radius: 50%; font-size: 10px; background: #4a5450; color: #e0e8e3; }
.sidebar .patient-card small { font-size: 10px; letter-spacing: 0; text-transform: none; color: var(--sidebar-muted); }
.sidebar .patient-card strong { margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--sidebar-text); }
.sidebar .patient-card .chevron { display: none; }
.sidebar .space-nav { margin-top: 12px; gap: 2px; }
.sidebar .utility-nav { margin-top: 10px; padding-top: 10px; gap: 2px; border-color: #ffffff0d; }
.sidebar .nav-item { min-height: 36px; padding: 7px 10px; gap: 11px; border-radius: 7px; color: var(--sidebar-text); font-size: 14px; font-weight: 400; line-height: 1.4; }
.sidebar .nav-item:hover { background: #ffffff09; color: #f5f5f1; }
.sidebar .nav-item.active { background: #3a3a36; color: #f5f5f1; box-shadow: none; }
.sidebar .nav-icon { display: grid; place-items: center; width: 18px; flex: 0 0 18px; color: #a9a9a3; }
.sidebar .nav-icon svg { width: 18px; height: 18px; stroke-width: 1.6; stroke-linecap: round; }
.sidebar .nav-item.active .nav-icon { color: #e1e1dc; }
.sidebar .sidebar-section-head { margin: 20px 8px 5px 10px; color: var(--sidebar-muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.sidebar .sidebar-section-head .sidebar-new-chat { width: 28px; height: 28px; color: var(--sidebar-muted); }
.sidebar .sidebar-chats { overflow: visible; padding: 0; gap: 2px; scrollbar-gutter: auto; }
.sidebar .chat-list-item { min-height: 36px; padding: 8px 10px; color: var(--sidebar-text); font-size: 14px; }
.sidebar .chat-list-item:hover { background: #ffffff09; color: #f5f5f1; }
.sidebar .chat-list-item.is-current { background: #3a3a36; color: #f5f5f1; }
.sidebar .chat-list-empty { color: var(--sidebar-muted); }
.sidebar .sidebar-footer { flex: 0 0 auto; margin-top: 0; padding-top: 8px; border-color: #ffffff10; }
.sidebar .api-budget { margin-bottom: 4px; padding: 5px 10px 8px; background: transparent; border: 0; border-radius: 0; }
.sidebar .api-budget-head { color: var(--sidebar-muted); font-size: 10px; font-weight: 500; letter-spacing: .02em; }
.sidebar .api-budget-values { gap: 12px; margin-top: 4px; }
.sidebar .api-budget-values > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 5px; }
.sidebar .api-budget-values > div + div { border-color: #ffffff12; }
.sidebar .api-budget-values small { color: var(--sidebar-muted); font-size: 11px; }
.sidebar .api-budget-values strong { margin: 0; color: #dddeda; font-size: 12px; font-weight: 500; }
.sidebar .user-row { min-height: 48px; padding: 7px 10px; background: transparent; gap: 10px; }
.sidebar .user-row:hover { background: #ffffff09; }
.sidebar .user-row .avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.sidebar .user-row > span:nth-child(2) { min-width: 0; }
.sidebar .user-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; color: #ededE8; }
.sidebar .user-row small { font-size: 11px; color: var(--sidebar-muted); }
.sidebar .chevron { color: var(--sidebar-muted); }
.sidebar .logout-button { color: var(--sidebar-text); border-color: #ffffff14; }
.sidebar-resizer { display: none; }

@media (min-width: 901px) {
  .app-shell { grid-template-columns: min(var(--sidebar-width, 288px), 42vw) minmax(0, 1fr); }
  .app-shell .project-page { grid-template-columns: clamp(260px, var(--project-nav-width, 330px), min(680px, calc(100% - 368px))) 8px minmax(0, 1fr); }
  .sidebar { min-width: 0; }
  .sidebar-resizer { display: block; position: absolute; top: 0; right: 0; bottom: 0; z-index: 2; width: 7px; cursor: col-resize; touch-action: none; user-select: none; outline: none; }
  .sidebar-resizer::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 2px; background: transparent; transition: background .12s; }
  .sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, .sidebar-resizing .sidebar-resizer::after { background: #989c94; }
  .sidebar-resizer:focus-visible { background: #ffffff12; }
  .sidebar-resizing, .sidebar-resizing * { cursor: col-resize !important; user-select: none !important; }
}
@media (max-width: 900px) {
  .sidebar { width: min(320px, calc(100vw - 40px)); padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .sidebar .nav-item, .sidebar .chat-list-item { min-height: 44px; }
  .sidebar .sidebar-section-head .sidebar-new-chat { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-resizer::after { transition: none; }
}
