# Stack Context
## Paste this at the start of every Claude Code session

---

## Project: CollabSpace
Enterprise collaboration module (co-browse + screen share) for a 40-module ERP suite.
Standalone Angular feature module. Zero hard dependencies on other app modules.

## Tech Stack
- **Angular**: 20+ with Signals. NO NgRx. Standalone components only. No NgModules.
- **Realtime**: `@microsoft/signalr` v8
- **Overlay/Dialog**: `@angular/cdk` (Dialog, Overlay, DragDrop)
- **HTTP**: Angular `HttpClient` → `Observable<T>` → `toSignal()` at service layer
- **Dates**: `date-fns`
- **Types**: TypeScript strict mode. Zero `any`.
- **Tests**: Jest
- **Backend**: ASP.NET Core 8 — already built. See `@specs/api_reference.md`

## Mandatory Conventions

### Dependency Injection
```typescript
// ALWAYS use inject()
private readonly svc = inject(MyService);
// NEVER use constructor params
```

### Template Syntax
```html
<!-- ALWAYS Angular 20 control flow -->
@if (show()) { <div>...</div> }
@for (item of list(); track item.id) { <div>{{ item.name }}</div> }
@switch (mode()) { @case ('a') { ... } @default { ... } }
<!-- NEVER *ngIf *ngFor *ngSwitch -->
```

### Signals Pattern
```typescript
// Private writable — public readonly
private readonly _items = signal<Item[]>([]);
readonly items   = this._items.asReadonly();          // Signal<Item[]>
readonly count   = computed(() => this._items().length); // computed

// Mutations only via explicit methods
setItems(items: Item[]): void { this._items.set(items); }
addItem(item: Item): void     { this._items.update(i => [...i, item]); }
```

### Subscription Cleanup
```typescript
// ALWAYS use takeUntilDestroyed()
source$.pipe(takeUntilDestroyed()).subscribe(...)
// Or store DestroyRef for manual use
private readonly destroyRef = inject(DestroyRef);
```

### Component Declaration
```typescript
@Component({
  standalone: true,          // ALWAYS
  changeDetection: ChangeDetectionStrategy.OnPush, // ALWAYS
  imports: [ /* only what this component needs */ ],
})
```

### No Magic Strings
```typescript
// ALWAYS use enums
status === SessionStatus.Active  // ✅
status === 'active'              // ❌
```

## File Location
All collaboration module code lives under:
`src/app/modules/collaboration/`

Public exports (other modules only import from here):
`src/app/modules/collaboration/index.ts`

## Key Interfaces to Know
- `CollabBridgeService` — the ONLY thing other modules import
- `CollabContext` — { moduleCode, recordId, recordLabel, currentRoute }
- `SessionState` / `ParticipantState` / `CollabUiState` — the three signal stores

## What NOT to Generate
- No placeholder comments (`// TODO`, `// implement later`)
- No `console.log` in production code (use injected Logger service)
- No barrel re-exports of internal implementation details
- No `any` type — use `unknown` if type is truly unknown
