
    /* Layout - using CSS Grid for reliable sizing */
    .appContainer {
      display: grid;
      grid-template-columns: auto 4px 1fr;
      height: 100%;
      width: 100%;
      min-width: 0;
      overflow: hidden;
    }

    /* Main Content area — grid item that holds all mode panels */
    .mainContent {
      flex: 1;
      min-height: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    /* Sidebar */
    .sidebar {
      width: 210px;
      background: var(--sur);
      border-right: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      transition: width 0.2s;
      overflow: hidden;
      position: relative;
    }
    .sidebar.collapsed {
      width: 0 !important;
      min-width: 0 !important;
      border-right: none;
    }
    .sidebar.collapsed .sidebarContent {
      display: none;
    }

    /* Sidebar Collapse Button - HIDDEN (using inline button now) */
    .sidebarCollapseBtn {
      display: none !important; /* Replaced by inline collapse button */
    }

    /* Inline collapse button in sidebar header */
    .sidebarCollapseInline {
      width: 24px;
      height: 24px;
      background: transparent;
      border: 1px solid var(--border-color, #30363d);
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      color: var(--text-secondary, #8b949e);
      transition: all 0.15s ease;
      opacity: 0.6;
    }
    .sidebarCollapseInline:hover {
      opacity: 1;
      background: var(--bg-tertiary, #262d38);
      color: var(--text-primary, #e0e0e0);
      border-color: var(--border-color-hover, #6b7280);
    }

    /* Header actions container (wraps + and collapse buttons) */
    .header-actions {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* Sidebar Expand Button (shown via JS when sidebar is collapsed) */
    .sidebarExpandBtn {
      display: none; /* JS controls visibility */
      position: absolute;
      left: 36px; /* 48px (activity bar) - 12px (half button) */
      top: 20px; /* At header level */
      width: 24px;
      height: 24px;
      background: var(--accent);
      border: 2px solid var(--bg-primary);
      border-radius: 50%;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      font-size: 0.75rem;
      color: white;
      z-index: 20;
      box-shadow: 0 2px 8px rgba(0,0,0,0.3);
      transition: transform 0.2s, background 0.2s;
    }
    .sidebarExpandBtn:hover {
      background: var(--accent-hover, #2563eb);
      transform: scale(1.1);
    }

    .sidebar.resizing { transition: none; }  /* Disable transition during drag */
    /* Sidebar Resize Handle */
    .sidebarResizeHandle {
      width: 4px;
      background: transparent;
      cursor: ew-resize;
      position: relative;
      z-index: 10;
    }
    .sidebarResizeHandle:hover,
    .sidebarResizeHandle.active {
      background: var(--accent);
    }
    .sidebarResizeHandle::before {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: -4px;
      right: -4px;
    }
    .sidebarHeader {
      padding: 14px 12px;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      height: 56px;
      box-sizing: border-box;
    }
    .sidebarHeader h2 { font-size: 0.875rem; font-weight: 600; margin: 0; flex: 1; line-height: 1.5; }
    .sidebarActions { display: flex; gap: 4px; }
    .sidebarActionBtn {
      width: 26px;
      height: 26px;
      border: none;
      border-radius: 4px;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      transition: background 0.15s, color 0.15s;
    }
    .sidebarActionBtn:hover {
      background: var(--accent);
      color: white;
    }
    .sidebarCompactHeader {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-bottom: 1px solid var(--border-color);
    }
    .sidebarSearchInput {
      flex: 1;
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid var(--border-color);
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.8rem;
      min-width: 0;
    }
    .sidebarSearchInput::placeholder { color: var(--text-muted); }
    /* Sidebar status dots (small, inline next to name) */
    .sb-dot {
      display: inline-block; width: 6px; height: 6px; border-radius: 50%;
      flex-shrink: 0; margin-right: 2px;
    }
    .sb-dot-linked { background: #22c55e; }
    .sb-dot-classified { background: #f59e0b; }
    .sb-dot-new { background: var(--text-muted); opacity: 0.3; }
    .sidebarItem .itemName {
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
      font-size: 0.88rem;
    }
    .sidebarSearch {
      padding: 8px 12px;
      border-bottom: 1px solid var(--border-color);
    }
    .sidebarSearch input {
      width: 100%;
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid var(--border-color);
      background: var(--bg-primary);
      color: var(--text-primary);
      font-size: 0.8rem;
    }
    .sidebarSearch input::placeholder { color: var(--text-muted); }
    .sidebarList {
      flex: 1;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 8px 0 40px 0; /* Bottom padding for sidebar footer */
    }
    .sidebarListFooter {
      flex-shrink: 0;
      padding: 8px 12px;
      border-top: 1px solid var(--border);
    }
    .sidebarFooterBtn {
      width: 100%;
      padding: 7px 12px;
      border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
      border-radius: 6px;
      background: transparent;
      color: var(--text-secondary);
      font-size: 0.82rem;
      cursor: pointer;
      transition: background 0.15s, color 0.15s, border-color 0.15s;
    }
    .sidebarFooterBtn:hover {
      background: color-mix(in srgb, var(--accent) 10%, transparent);
      color: var(--accent);
      border-color: var(--accent);
    }
    .sidebarGroup {
      padding: 4px 12px;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .sidebarItem {
      padding: 4px 10px 3px;
      cursor: pointer;
      border-left: 2px solid transparent;
      transition: background 0.1s, border-color 0.1s;
    }
    .sidebarItem:hover { background: var(--hover); }
    .sidebarItem.active {
      background: var(--active);
      /* border-left-color: var(--accent); */
    }
    .sidebarItem .itemRow {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 0.88rem;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
    }
    .sidebarItem .itemTitle {
      font-size: 0.9rem;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sidebarItem .itemMeta {
      font-size: 0.78rem;
      color: var(--text-muted);
      font-weight: 400;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      padding-left: 12px;
      line-height: 1.3;
      margin-top: 1px;
    }

    /* Sidebar folder hierarchy */
    .sidebarFolder {
      margin-bottom: 2px;
    }
    .folderHeader {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 10px;
      cursor: pointer;
      border-radius: 4px;
      transition: background 0.15s;
    }
    .folderHeader:hover {
      background: var(--hover);
    }
    .folderChevron {
      font-size: 0.7rem;
      color: var(--text-muted);
      width: 12px;
    }
    .folderIcon {
      font-size: 0.85rem;
    }
    .folderName {
      font-size: 0.85rem;
      font-weight: 500;
    }
    .folderCount {
      font-size: 0.7rem;
      color: var(--text-muted);
      background: var(--bg-secondary);
      padding: 2px 6px;
      border-radius: 10px;
    }
    .folderContents {
      margin-left: 18px;
      border-left: 1px solid var(--border-color);
      padding-left: 4px;
    }
    .folderContents .sidebarItem {
      padding: 6px 10px;
    }
    .container-badge {
      display: inline-block;
      font-size: 0.7rem;
      color: var(--text-muted);
      background: var(--bg-tertiary);
      padding: 1px 6px;
      border-radius: 8px;
      margin-left: 6px;
      vertical-align: middle;
    }
