/* ============================================================
   SIDEBAR — Elite SaaS sidebar  (Vercel / Linear level)
   ============================================================ */

/* ── Timing tokens ──────────────────────────────────────────── */
:root {
  --sb-ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --sb-spring:    cubic-bezier(0.34, 1.12, 0.64, 1);
  --sb-dur:       0.26s;
  --sb-dur-fast:  0.16s;
  --sb-dur-slow:  0.36s;
}

/* ── Base shell ─────────────────────────────────────────────── */
.side-bar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;

  /* Glassmorphism surface */
  background: rgba(252, 253, 255, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);

  /* Invisible border — depth without weight */
  border-right: 1px solid rgba(0, 0, 0, 0.065);

  /* Lateral depth shadow — replaces heavy border */
  

  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  font-family: "Inter", "Roboto", sans-serif;
  overflow: hidden;

  transition:
    width        var(--sb-dur) var(--sb-ease),
    min-width    var(--sb-dur) var(--sb-ease),
    transform    var(--sb-dur) var(--sb-ease),
    box-shadow   var(--sb-dur) var(--sb-ease);
}

/* Suppress transitions while drag-resizing */
.side-bar.is-resizing {
  transition: none !important;
  user-select: none;
}

/* ── Resize handle ──────────────────────────────────────────── */
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}

.sidebar-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: transparent;
  border-radius: 2px;
  transition: background var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.is-dragging::after {
  background: rgba(var(--color-accent-rgb), 0.30);
}

/* ── HEAD: logo + collapse button ───────────────────────────── */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between ;
  
 
  padding: 7px 16px 7px 18px;
  
  /* Subtle separator — barely visible */
  flex-shrink: 0;
  height: 70px;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-logo img {
  width: 26px;
  height: 26px;
  display: block;
  border-radius: 7px;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background     var(--sb-dur-fast) var(--sb-ease),
    border-color   var(--sb-dur-fast) var(--sb-ease),
    color          var(--sb-dur-fast) var(--sb-ease),
    box-shadow     var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-collapse-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--color-text-secondary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sidebar-collapse-btn svg {
  width: 13px;
  height: 13px;
  transition: transform var(--sb-dur) var(--sb-ease);
}

/* ── INNER SCROLL AREA ──────────────────────────────────────── */
/* All sections live inside a flex column with proper padding */
.sidebar-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 10px 12px;
  overflow: hidden;
}

/* If no .sidebar-inner exists, apply padding to .side-bar children directly */
.side-bar > .sidebar-new-wrap,
.side-bar > .sidebar-section,
.side-bar > .sidebar-logout {
  padding-left: 10px;
  padding-right: 10px;
}

/* ── NEW PROJECT button ─────────────────────────────────────── */
.sidebar-new-wrap {
  padding: 12px 10px 8px;
  flex-shrink: 0;
}

.sidebar-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 9px;

  /* Premium gradient CTA */
  background: linear-gradient(135deg, #5E6AD2 0%, #515CC0 100%);
  box-shadow:
    0 1px 3px rgba(94, 106, 210, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);

  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.012em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;

  transition:
    background     var(--sb-dur-fast) var(--sb-ease),
    box-shadow     var(--sb-dur-fast) var(--sb-ease),
    transform      var(--sb-dur-fast) var(--sb-ease),
    opacity        var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-new-btn:hover {
  background: linear-gradient(135deg, #515CC0 0%, #4651AF 100%);
  box-shadow:
    0 4px 14px rgba(94, 106, 210, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.sidebar-new-btn:active {
  transform: translateY(0);
  box-shadow:
    0 1px 4px rgba(94, 106, 210, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sidebar-new-btn.is-disabled {
  opacity: 0.48;
  pointer-events: none;
}

.sidebar-new-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ── SECTION clusters ───────────────────────────────────────── */
.sidebar-section {
  display: flex;
  flex-direction: column;
  /* Vertical breathing room between clusters */
  margin-top: 6px;
}

.sidebar-section--grow {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Section header toggle — label-only, no icon in expanded mode */
.sidebar-section-hdr {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-faint);
  transition: color var(--sb-dur-fast) var(--sb-ease);
  text-align: left;
  margin-bottom: 2px;
  border-radius: 6px;
}

.sidebar-section-hdr:hover {
  color: var(--color-text-muted);
  background: var(--color-surface-2);
}

.sidebar-section-label {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: inherit;
  line-height: 1;
}

.sidebar-section-chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.40;
  transition: transform var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-section-hdr[aria-expanded="false"] .sidebar-section-chevron {
  transform: rotate(-90deg);
}

/* Icon container — exact sizing for crisp alignment */
.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-nav-icon svg {
  width: 15px;
  height: 15px;
  /* Light outline stroke — inherits from parent color */
}

/* ── Section bodies — animated expand/collapse ──────────────── */
.sidebar-section-body {
  display: grid;
  overflow: hidden;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--sb-dur) var(--sb-ease);
}

.sidebar-section-body.is-collapsed {
  grid-template-rows: 0fr;
}

.sidebar-section:not(.sidebar-section--grow) .sidebar-section-body > * {
  overflow: hidden;
}

/* Grow (History) section */
.sidebar-section--grow .sidebar-section-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  grid-template-rows: unset;
  transition: none;
  overflow: hidden;
}

.sidebar-section--grow .sidebar-section-body.is-collapsed {
  display: none;
}

.sidebar-section-body--scroll {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.10) transparent;
}

.sidebar-section-body ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}

/* ── NAV LINKS — the heart of the UI ───────────────────────── */
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 440;
  color: var(--color-text-secondary);
  letter-spacing: 0.008em;
  line-height: 1.45;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  position: relative;

  transition:
    background   var(--sb-dur-fast) var(--sb-ease),
    color        var(--sb-dur-fast) var(--sb-ease),
    box-shadow   var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-nav-link .sidebar-nav-icon {
  color: var(--color-text-faint);
  transition: color var(--sb-dur-fast) var(--sb-ease);
}

/* Hover — neutral pill tint, NOT accent (keeps it clean) */
.sidebar-nav-link:hover {
  background: rgba(0, 0, 0, 0.045);
  color: var(--color-text);
}

.sidebar-nav-link:hover .sidebar-nav-icon {
  color: var(--color-text-muted);
}

/* Active — 3px left accent line (the "anchor") + soft bg */
.sidebar-nav-link.is-active {
  background: rgba(var(--color-accent-rgb), 0.08);
  color: var(--color-accent);
  font-weight: 590;
  /* Left edge accent: 3px inset, no layout shift */
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.sidebar-nav-link.is-active .sidebar-nav-icon {
  color: var(--color-accent);
}

/* ── TEXT — fades cleanly on collapse ───────────────────────── */
.sidebar-link-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  max-width: 240px;
  transition:
    opacity     var(--sb-dur-fast) var(--sb-ease) 0.04s,
    max-width   var(--sb-dur)      var(--sb-ease);
}

/* ── LOGOUT ─────────────────────────────────────────────────── */
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 440;
  color: var(--color-text-faint);
  letter-spacing: 0.008em;
  /* Breathing room above with a hairline separator */
  margin-top: 8px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background   var(--sb-dur-fast) var(--sb-ease),
    color        var(--sb-dur-fast) var(--sb-ease);
}

/* Separator line — hairline above logout */
.sidebar-logout::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -10px;
  right: -10px;
  height: 1px;
  background: rgba(0, 0, 0, 0.055);
}

.sidebar-logout:hover {
  background: rgba(184, 56, 67, 0.07);
  color: var(--color-danger);
}

/* ── COLLAPSED — icon control rail ─────────────────────────── */
.side-bar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  align-items: center;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.05);
}

/* Head */
.side-bar.collapsed .sidebar-head {
  width: 100%;
  justify-content: center;
  padding: 0;
}

.side-bar.collapsed .sidebar-logo {
  display: none;
}

.side-bar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* New Project — icon-only pill */
.side-bar.collapsed .sidebar-new-wrap {
  width: 100%;
  padding: 10px 0 8px;
  display: flex;
  justify-content: center;
}

.side-bar.collapsed .sidebar-new-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  gap: 0;
  justify-content: center;
  transform: none !important;
}

/* Section clusters */
.side-bar.collapsed .sidebar-section {
  width: 100%;
  margin-top: 4px;
}

/* Section header — collapse to a tiny divider icon centered */
.side-bar.collapsed .sidebar-section-hdr {
  width: 36px;
  height: 20px;
  padding: 0;
  justify-content: center;
  margin: 2px auto;
  gap: 0;
  pointer-events: none;
  opacity: 0.30;
}

/* Grow section */
.side-bar.collapsed .sidebar-section--grow {
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hide text */
.side-bar.collapsed .sidebar-link-text {
  max-width: 0;
  opacity: 0;
  transition:
    opacity   var(--sb-dur-fast) var(--sb-ease),
    max-width var(--sb-dur)      var(--sb-ease);
  overflow: hidden;
  pointer-events: none;
}

/* Hide section bodies (no expand in collapsed) */
.side-bar.collapsed .sidebar-section-body {
  display: none !important;
}

/* Nav links — perfectly isolated 36×36 squares */
.side-bar.collapsed .sidebar-nav-link {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  justify-content: center;
  margin: 0 auto;
  /* Strip left-border indicator (asymmetric in icon rail) */
  box-shadow: none;
  border-radius: 8px;
}

.side-bar.collapsed .sidebar-nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.side-bar.collapsed .sidebar-nav-link.is-active {
  background: rgba(var(--color-accent-rgb), 0.10);
  box-shadow: none;
}

.side-bar.collapsed .sidebar-nav-link.is-active .sidebar-nav-icon {
  color: var(--color-accent);
}

/* Logout — icon-only centered */
.side-bar.collapsed .sidebar-logout {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  justify-content: center;
  margin: 4px auto 0;
  border-radius: 8px;
}

.side-bar.collapsed .sidebar-logout::before {
  display: none;
}

/* ── PROJECT LIST ───────────────────────────────────────────── */
.sidebar-project-list {
  display: grid;
  gap: 1px;
  padding: 2px 0;
}

.sidebar-project-empty {
  padding: 16px 12px;
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin: 4px 2px;
}

.sidebar-project-empty__icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  margin-bottom: 2px;
}

.sidebar-project-empty__icon svg {
  width: 22px;
  height: 22px;
}

.sidebar-project-empty strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

.sidebar-project-empty span {
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-text-faint);
  max-width: 160px;
}

.sidebar-project-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 8px;
  gap: 4px;
  transition: background var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-project-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-project-item.is-active {
  background: rgba(var(--color-accent-rgb), 0.07);
}

.sidebar-project-item.is-menu-open {
  z-index: 6;
}

.sidebar-project-button {
  width: 100%;
  min-height: 36px;
  border: none;
  border-radius: 7px;
  background: transparent;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  padding: 5px 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.sidebar-project-button__thumb {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  background: linear-gradient(160deg, #fff 0%, #f0f2f6 100%);
  background-size: cover;
  background-position: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.sidebar-project-button__thumb.has-image {
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
  overflow: hidden;
}

.sidebar-project-button__thumb svg,
.sidebar-project-menu-trigger svg,
.sidebar-project-menu__icon svg {
  width: 14px;
  height: 14px;
}

.sidebar-project-button__thumb-overlay {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.36);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.sidebar-project-button__copy {
  min-width: 0;
  display: grid;
  gap: 0;
}

.sidebar-project-button__title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-project-button__copy strong {
  min-width: 0;
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
  letter-spacing: 0.005em;
}

.sidebar-project-button__meta,
.sidebar-project-button__pin-badge {
  display: none;
}

.sidebar-project-menu-trigger {
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  flex-shrink: 0;
  transition:
    opacity        var(--sb-dur-fast) var(--sb-ease),
    background     var(--sb-dur-fast) var(--sb-ease),
    border-color   var(--sb-dur-fast) var(--sb-ease),
    color          var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-project-item:hover .sidebar-project-menu-trigger,
.sidebar-project-item:focus-within .sidebar-project-menu-trigger,
.sidebar-project-menu-trigger[aria-expanded="true"] {
  opacity: 1;
}

.sidebar-project-menu-trigger:hover,
.sidebar-project-menu-trigger[aria-expanded="true"] {
  background: var(--color-accent-soft);
  border-color: rgba(var(--color-accent-rgb), 0.14);
  color: var(--color-accent);
}

/* Context menu */
.sidebar-project-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 190px;
  padding: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 10px 30px rgba(0, 0, 0, 0.09);
  z-index: 12;
  display: grid;
  gap: 1px;
}

.sidebar-project-menu__item {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.006em;
  text-align: left;
  cursor: pointer;
  transition:
    background   var(--sb-dur-fast) var(--sb-ease),
    color        var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-project-menu__item:hover,
.sidebar-project-menu__item.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.sidebar-project-menu__item.is-danger {
  color: var(--color-danger);
}

.sidebar-project-menu__item.is-danger:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger-hover, #9e2e38);
}

.sidebar-project-menu__icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-project-menu--confirm {
  width: 214px;
  gap: 10px;
  padding: 12px;
}

.sidebar-project-menu--confirm p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.sidebar-project-menu__confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sidebar-project-menu__confirm-btn {
  min-width: 64px;
  height: 28px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-project-menu__confirm-btn.is-danger {
  border-color: rgba(184, 56, 67, 0.25);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

/* Rename inline */
.sidebar-project-rename {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 2px 0 0 35px;
}

.sidebar-project-rename input {
  width: 100%;
  height: 32px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--sb-dur-fast) var(--sb-ease), box-shadow var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-project-rename input:focus {
  border-color: rgba(var(--color-accent-rgb), 0.30);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.09);
}

.sidebar-project-rename__actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.sidebar-project-rename__save,
.sidebar-project-rename__cancel {
  height: 28px;
  border-radius: 7px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-project-rename__save {
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: #ffffff;
  padding: 0 10px;
  transition: background var(--sb-dur-fast) var(--sb-ease);
}

.sidebar-project-rename__save:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.sidebar-project-rename__cancel {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  padding: 0 6px;
}

/* ── COLLAPSED project items ────────────────────────────────── */
.side-bar.collapsed .sidebar-project-empty {
  display: none;
}

.side-bar.collapsed .sidebar-project-list {
  width: 100%;
  justify-items: center;
  gap: 2px;
}

.side-bar.collapsed .sidebar-project-item {
  grid-template-columns: 1fr;
  width: 100%;
  justify-items: center;
  background: transparent;
}

.side-bar.collapsed .sidebar-project-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  grid-template-columns: 1fr;
  gap: 0;
  justify-items: center;
  border-radius: 8px;
  background: transparent;
}

.side-bar.collapsed .sidebar-project-button__thumb {
  width: 24px;
  height: 24px;
}

.side-bar.collapsed .sidebar-project-button__copy,
.side-bar.collapsed .sidebar-project-rename {
  display: none;
}

.side-bar.collapsed .sidebar-project-menu-trigger {
  position: absolute;
  top: -2px;
  right: 0;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--color-surface);
  opacity: 0;
  pointer-events: none;
}

.side-bar.collapsed .sidebar-project-item:hover .sidebar-project-menu-trigger,
.side-bar.collapsed .sidebar-project-item:focus-within .sidebar-project-menu-trigger,
.side-bar.collapsed .sidebar-project-item.is-menu-open .sidebar-project-menu-trigger {
  pointer-events: auto;
}

.side-bar.collapsed .sidebar-project-menu {
  top: 0;
  right: calc(-1 * 190px - 8px);
}

/* ── OVERLAY ────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
}

/* ── DARK MODE ──────────────────────────────────────────────── */
[data-theme="dark"] .side-bar {
  background: rgba(18, 21, 28, 0.97);
  border-right-color: rgba(255, 255, 255, 0.07);
  box-shadow: 4px 0 28px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .sidebar-head {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.055);
}

[data-theme="dark"] .sidebar-project-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

[data-theme="dark"] .sidebar-project-empty {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .sidebar-project-menu {
  background: rgba(22, 25, 32, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.40);
}

[data-theme="dark"] .sidebar-project-rename input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--color-text);
}

[data-theme="dark"] .sidebar-logout::before {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .side-bar.collapsed {
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.30);
}

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-resize-handle {
    display: none;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.40);
    backdrop-filter: blur(3px);
    z-index: 49;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity    var(--sb-dur) var(--sb-ease),
      visibility var(--sb-dur) var(--sb-ease);
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  .side-bar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    transform: translateX(-100%);
    z-index: 50;
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
    align-items: flex-start !important;
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.10) !important;
  }

  .side-bar.open {
    transform: translateX(0);
  }

  /* ── Restore all collapsed overrides inside mobile open state ── */
  .side-bar.open .sidebar-logo { display: inline-flex !important; }

  .side-bar.open .sidebar-head {
    padding: 0 16px 0 18px !important;
    justify-content: space-between !important;
  }

  .side-bar.open .sidebar-new-wrap {
    width: 100% !important;
    padding: 12px 10px 8px !important;
    display: block !important;
  }

  .side-bar.open .sidebar-new-btn {
    width: 100% !important;
    height: 34px !important;
    padding: 0 14px !important;
    gap: 7px !important;
    border-radius: 9px !important;
    justify-content: center !important;
    transform: none !important;
  }

  .side-bar.open .sidebar-section {
    width: 100% !important;
    margin-top: 6px !important;
  }

  .side-bar.open .sidebar-section-hdr {
    width: 100% !important;
    height: 26px !important;
    padding: 0 4px !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    margin: 0 0 2px !important;
    pointer-events: auto !important;
    opacity: 1 !important;
  }

  .side-bar.open .sidebar-link-text {
    max-width: 240px !important;
    opacity: 1 !important;
    transition: none !important;
  }

  .side-bar.open .sidebar-section-body { display: grid !important; }
  .side-bar.open .sidebar-section--grow .sidebar-section-body { display: flex !important; }
  .side-bar.open .sidebar-section-body.is-collapsed { grid-template-rows: 0fr !important; }
  .side-bar.open .sidebar-section--grow .sidebar-section-body.is-collapsed { display: none !important; }

  .side-bar.open .sidebar-nav-link {
    width: 100% !important;
    height: 36px !important;
    padding: 0 10px !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    gap: 10px !important;
    box-shadow: none !important;
  }

  .side-bar.open .sidebar-nav-link.is-active {
    box-shadow: inset 3px 0 0 var(--color-accent) !important;
  }

  .side-bar.open .sidebar-logout {
    width: 100% !important;
    height: 36px !important;
    padding: 0 10px !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 8px !important;
  }

  .side-bar.open .sidebar-project-item {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .side-bar.open .sidebar-project-button {
    width: 100% !important;
    min-height: 36px !important;
    height: auto !important;
    padding: 5px 8px !important;
    grid-template-columns: 26px minmax(0, 1fr) !important;
    gap: 9px !important;
    justify-items: start !important;
  }

  .side-bar.open .sidebar-project-button__copy { display: grid !important; }
  .side-bar.open .sidebar-project-button__thumb { width: 26px !important; height: 26px !important; }

  .side-bar.open .sidebar-project-menu-trigger {
    position: static !important;
    width: 26px !important;
    height: 26px !important;
    opacity: 0 !important;
    pointer-events: auto !important;
  }

  .side-bar.open .sidebar-project-item:hover .sidebar-project-menu-trigger,
  .side-bar.open .sidebar-project-item:focus-within .sidebar-project-menu-trigger {
    opacity: 1 !important;
  }

  .side-bar.open .sidebar-project-menu {
    right: 0 !important;
    top: calc(100% + 4px) !important;
  }
}
