Design a real-time chat system similar to Slack that supports 1:1 and group messaging (up to 500 members per group), persistent message history with search, read receipts, typing indicators, online/offline presence, push notifications for offline users, and file/image sharing. The system must serve 50 million daily active users sending 1 billion messages per day (≈ 12k msgs/s average, 36k msgs/s peak) with <200 ms end-to-end delivery latency, 99.99 % availability, guaranteed message ordering within a conversation, and at-least-once delivery with deduplication. Messages average 200 bytes; peak concurrent WebSocket connections are 50 million. Store messages forever for paid tiers and 90 days for free tiers. Support global users with multi-region deployment and end-to-end encryption as a stretch goal.