        /* (оставляем все стили без изменений) */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            background: #010101;
            color: #e0e0e0;
            font-family: 'Inter', sans-serif;
            line-height: 1.5;
            font-weight: 400;
            -webkit-text-size-adjust: 100%;
        }
        html {
            font-size: clamp(14px, 0.35vw + 12px, 16px);
        }
        img, video {
            max-width: 100%;
        }
        body::before {
            content: "";
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: 
                linear-gradient(rgba(80, 0, 255, 0.02) 1px, transparent 1px),
                linear-gradient(90deg, rgba(80, 0, 255, 0.02) 1px, transparent 1px);
            background-size: 40px 40px;
            pointer-events: none;
            z-index: -1;
        }
        .card {
            background: #0b0b0f;
            border: 1px solid #1f1f2a;
            transition: 0.2s ease;
        }
        .card:hover {
            border-color: #b77eff;
            box-shadow: 0 0 0 1px #b77eff30;
        }
        .btn {
            display: inline-block;
            padding: 8px 20px;
            font-family: 'Space Mono', monospace;
            font-weight: 500;
            font-size: 0.85rem;
            letter-spacing: -0.2px;
            background: transparent;
            border: 1px solid #2a2a35;
            color: #ddd;
            cursor: pointer;
            transition: 0.15s;
            text-transform: uppercase;
        }
        .btn-primary {
            background: #7c3aed;
            border-color: #7c3aed;
            color: white;
            box-shadow: 0 0 4px #7c3aed80;
        }
        .btn-primary:hover {
            background: #9b4dff;
            border-color: #9b4dff;
            box-shadow: 0 0 8px #9b4dff;
        }
        .btn-outline {
            border-color: #3a3a4a;
        }
        .btn-outline:hover {
            border-color: #b77eff;
            color: #b77eff;
        }
        .btn-sm {
            padding: 4px 12px;
            font-size: 0.7rem;
        }
        .navbar {
            border-bottom: 1px solid #1f1f2a;
            background: #010101cc;
            backdrop-filter: blur(8px);
            position: sticky;
            top: 0;
            z-index: 50;
        }
        .nav-container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 1rem 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            flex-wrap: wrap;
            gap: 12px;
        }
        .logo {
            font-family: 'Space Mono', monospace;
            font-size: 1.6rem;
            font-weight: 700;
            letter-spacing: -1px;
            text-decoration: none;
            color: inherit;
        }
        .logo span {
            color: #b77eff;
        }
        .nav-links {
            display: flex;
            gap: 2rem;
            font-family: 'Space Mono', monospace;
            font-size: 0.85rem;
            text-transform: uppercase;
        }
        .nav-links a {
            color: #aaa;
            text-decoration: none;
        }
        .nav-links a:hover {
            color: #b77eff;
        }
        .nav-buttons {
            display: flex;
            gap: 12px;
            align-items: center;
        }
        .user-greeting {
            font-family: 'Space Mono', monospace;
            font-size: 0.8rem;
            background: #111116;
            padding: 4px 12px;
            border: 1px solid #2a2a35;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        @media (max-width: 768px) {
            .nav-links { display: none; }
            .mobile-menu-btn { display: block; }
            .user-greeting span { display: none; }
        }
        @media (min-width: 769px) {
            .mobile-menu-btn { display: none; }
        }
        .mobile-menu {
            display: none;
            flex-direction: column;
            background: #050507;
            border-top: 1px solid #1f1f2a;
            padding: 1rem 1.5rem;
        }
        .mobile-menu a {
            color: #ccc;
            padding: 0.5rem 0;
            text-decoration: none;
            font-family: monospace;
        }
        .section-view {
            display: none;
        }
        #messagesSection {
            --messages-viewport-offset: 170px;
            min-height: 0;
            overflow-x: hidden;
        }
        #messagesSection .hero {
            padding: 0.6rem 0 0.45rem;
            margin-bottom: 0.7rem;
            flex: 0 0 auto;
        }
        #messagesSection .hero h1 {
            font-size: clamp(1.25rem, 1.6vw, 1.9rem);
        }
        .hero {
            padding: 2rem 0 1rem 0;
            border-bottom: 1px solid #1f1f2a;
            margin-bottom: 2rem;
        }
        .hero h1 {
            font-family: 'Space Mono', monospace;
            font-size: 2.4rem;
            font-weight: 700;
            letter-spacing: -1px;
        }
        .hero h1 span {
            color: #b77eff;
        }
        .two-col {
            display: flex;
            flex-wrap: wrap;
            gap: 2rem;
            margin: 2rem 0;
        }
        .nav-search {
            min-width: 260px;
            flex: 1;
            max-width: 460px;
            display: flex;
            gap: 8px;
            align-items: center;
        }
        .nav-search input {
            height: 36px;
            padding: 8px 12px;
            font-size: 0.78rem;
        }
        .mobile-create-btn {
            display: none;
            width: 36px;
            height: 36px;
            min-width: 36px;
            padding: 0;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            line-height: 1;
        }
        .search-open-btn {
            display: none;
            white-space: nowrap;
        }
        .feed {
            flex: 2;
            min-width: 240px;
        }
        .sidebar {
            flex: 1;
            min-width: 220px;
        }
        .post {
            border: 1px solid #1f1f2a;
            background: #08080c;
            padding: 1.2rem;
            margin-bottom: 1.2rem;
        }
        .post-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }
        .post-title {
            font-family: 'Space Mono', monospace;
            font-size: 1rem;
            margin-bottom: 8px;
            color: #f0f0f5;
            line-height: 1.3;
            overflow-wrap: anywhere;
            word-break: break-word;
        }
        .post-content-click {
            cursor: pointer;
        }
        .post-body-text {
            white-space: pre-wrap;
            overflow-wrap: anywhere;
            word-break: break-word;
        }
        .read-more-btn {
            margin-top: 8px;
            font-size: 0.78rem;
            color: #b77eff;
            cursor: pointer;
            display: inline-block;
            font-family: 'Space Mono', monospace;
        }
        .read-more-btn:hover {
            text-decoration: underline;
        }
        .avatar {
            width: 40px;
            height: 40px;
            background: #b77eff;
            color: black;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: monospace;
            text-transform: uppercase;
            outline: 2px solid var(--avatar-outline-color, rgba(255, 255, 255, 0.95));
            outline-offset: 3px;
        }
        .post-actions {
            display: flex;
            gap: 1.5rem;
            margin-top: 1rem;
            font-size: 0.8rem;
            color: #777;
        }
        .post-actions .action-btn {
            cursor: pointer;
        }
        .post-actions .action-btn:hover {
            color: #b77eff;
        }
        .post-media {
            display: grid;
            gap: 10px;
            margin-top: 12px;
        }
        .post-media img,
        .post-media video {
            width: 100%;
            border: 1px solid #1f1f2a;
            background: #000;
            max-height: 340px;
            object-fit: contain;
            object-position: center;
            display: block;
        }
        .post-media img {
            cursor: zoom-in;
        }
        .feed-post-media {
            display: grid;
            gap: 10px;
            margin-top: 12px;
            cursor: pointer;
        }
        .feed-post-media.single {
            grid-template-columns: 1fr;
        }
        .feed-post-media.two {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .feed-post-media.three {
            grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
            grid-template-rows: repeat(2, minmax(130px, 1fr));
        }
        .feed-media-item {
            position: relative;
            overflow: hidden;
            min-height: 130px;
            border: 1px solid #1f1f2a;
            background: #050507;
        }
        .feed-post-media.single .feed-media-item {
            min-height: 300px;
        }
        .feed-post-media.two .feed-media-item {
            min-height: 220px;
        }
        .feed-post-media.three .feed-media-item.item-1 {
            grid-row: 1 / span 2;
            min-height: 270px;
        }
        .feed-post-media.three .feed-media-item.item-2,
        .feed-post-media.three .feed-media-item.item-3 {
            min-height: 130px;
        }
        .feed-media-item img {
            width: 100%;
            height: 100%;
            max-height: none;
            object-fit: cover;
            object-position: center;
            display: block;
            border: none;
            cursor: pointer;
        }
        .feed-media-overlay {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.45);
            color: #fff;
            font-family: 'Space Mono', monospace;
            font-size: 1.25rem;
            font-weight: 700;
            letter-spacing: -0.4px;
            pointer-events: none;
        }
        .post-media-more-hint {
            margin-top: 8px;
            font-size: 0.72rem;
            color: #a8a8b6;
            font-family: 'Space Mono', monospace;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }
        .feed-video-preview {
            position: relative;
            cursor: pointer;
            border: 1px solid #1f1f2a;
            background: #000;
            overflow: hidden;
        }
        .feed-video-preview video {
            border: none;
            display: block;
            filter: brightness(0.78);
        }
        .feed-video-watermark {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 14px;
            color: #fff;
            font-family: 'Space Mono', monospace;
            font-size: 0.75rem;
            line-height: 1.3;
            background: linear-gradient(to top, rgba(0,0,0,0.58), rgba(0,0,0,0.08));
            pointer-events: none;
            text-transform: uppercase;
            letter-spacing: .2px;
        }
        .media-help {
            margin-top: 8px;
            font-size: 0.7rem;
            color: #888;
            font-family: monospace;
        }
        .like-btn {
            cursor: pointer;
            user-select: none;
        }
        .liked {
            color: #ff4d6d;
        }
        .feed-switch {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
            flex-wrap: wrap;
        }
        .feed-switch .btn.active {
            background: #7c3aed;
            border-color: #7c3aed;
            color: #fff;
        }
        .search-summary {
            font-size: 0.78rem;
            color: #9a9aa8;
            margin-bottom: 10px;
            font-family: 'Space Mono', monospace;
        }
        .upload-toast {
            position: fixed;
            top: 14px;
            right: 14px;
            width: min(320px, calc(100vw - 28px));
            background: #0f0f16;
            border: 1px solid #2a2a35;
            box-shadow: 0 8px 24px rgba(0,0,0,0.45);
            z-index: 2000;
            padding: 10px 12px;
            display: none;
        }
        .upload-toast-title {
            font-family: 'Space Mono', monospace;
            font-size: 0.76rem;
            margin-bottom: 6px;
            color: #ddd;
            text-transform: uppercase;
        }
        .upload-toast-meta {
            font-size: 0.72rem;
            color: #9a9aa8;
            margin-bottom: 8px;
        }
        .upload-toast-progress {
            width: 100%;
            height: 8px;
            background: #1a1a24;
            border: 1px solid #2a2a35;
            overflow: hidden;
        }
        .upload-toast-progress-bar {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #7c3aed, #b77eff);
            transition: width 0.12s linear;
        }
        input, textarea {
            background: #0a0a0e;
            border: 1px solid #2a2a35;
            padding: 10px 14px;
            width: 100%;
            color: white;
            font-family: monospace;
            font-size: 0.85rem;
        }
        textarea {
            resize: vertical;
        }
        input:focus, textarea:focus {
            outline: none;
            border-color: #b77eff;
        }
        .error-msg {
            color: #ff7777;
            font-size: 0.7rem;
            margin-top: 6px;
            font-family: monospace;
        }
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.95);
            backdrop-filter: blur(5px);
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        .modal-content {
            background: #0c0c12;
            border: 1px solid #2a2a35;
            padding: 2rem;
            max-width: 400px;
            width: 90%;
        }
        #profileModal .modal-content {
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .image-viewer {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.96);
            z-index: 1200;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 16px;
        }
        .image-viewer-stage {
            width: min(1200px, 100%);
            height: calc(100vh - 110px);
            overflow: hidden;
            border: 1px solid #2a2a35;
            background: #050507;
            touch-action: none;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .image-viewer-image {
            max-width: 100%;
            max-height: 100%;
            transform-origin: center center;
            will-change: transform;
            user-select: none;
            -webkit-user-drag: none;
            cursor: grab;
        }
        .image-viewer-toolbar {
            width: min(1200px, 100%);
            margin-top: 10px;
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }
        .image-viewer-toolbar .btn {
            min-width: 110px;
        }
        .post-detail-view {
            display: none;
        }
        .post-detail-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
        }
        .comments-wrap {
            border: 1px solid #1f1f2a;
            background: #08080c;
            padding: 1rem;
            margin-top: 1rem;
        }
        .comment-item {
            border-top: 1px solid #1a1a22;
            padding: 10px 0;
        }
        .comment-item:first-child {
            border-top: none;
            padding-top: 0;
        }
        .comment-meta {
            font-size: 0.75rem;
            color: #8b8b98;
            margin-bottom: 4px;
        }
        #profilePostsList {
            flex: 1;
            min-height: 0;
            max-height: none;
            overflow-y: auto;
            padding-right: 6px;
        }
        .edit-media-grid {
            display: grid;
            gap: 10px;
            margin-top: 10px;
        }
        .edit-media-item {
            border: 1px solid #1f1f2a;
            background: #0a0a0e;
            padding: 8px;
        }
        .edit-media-item img,
        .edit-media-item video {
            width: 100%;
            max-height: 180px;
            object-fit: contain;
            background: #000;
            border: 1px solid #1f1f2a;
        }
        .edit-media-item .btn {
            margin-top: 8px;
            width: 100%;
        }
        .files-toolbar {
            display: grid;
            gap: 10px;
        }
        .files-layout {
            display: flex;
            gap: 1rem;
            align-items: flex-start;
        }
        .files-main {
            flex: 2;
            min-width: 260px;
        }
        .files-side {
            flex: 1;
            min-width: 240px;
            position: sticky;
            top: 90px;
        }
        .files-upload-card {
            margin-bottom: 12px;
        }
        .files-grid {
            display: block;
        }
        .file-card {
            border: 1px solid #1f1f2a;
            background: #09090d;
            padding: 10px;
            margin-bottom: 8px;
            border-radius: 6px;
        }
        .file-preview {
            width: 72px;
            min-width: 72px;
            height: 72px;
            border: 1px solid #1f1f2a;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #050507;
            overflow: hidden;
            border-radius: 4px;
        }
        .file-preview img,
        .file-preview video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .file-row {
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }
        .file-info {
            flex: 1;
            min-width: 0;
        }
        .file-title {
            font-size: 0.9rem;
            line-height: 1.2;
            margin-bottom: 2px;
            word-break: break-word;
        }
        .file-meta {
            font-size: 0.72rem;
            color: #8f8f9a;
            margin-bottom: 4px;
        }
        .file-caption {
            font-size: 0.78rem;
            color: #c4c4cf;
            line-height: 1.3;
            margin-bottom: 6px;
            word-break: break-word;
        }
        .file-actions {
            display: flex;
            gap: 12px;
            font-size: 0.76rem;
            color: #8d8d99;
        }
        .file-actions .action-btn {
            cursor: pointer;
        }
        .file-actions .action-btn:hover {
            color: #b77eff;
        }
        .messages-layout {
            --messages-panel-height: calc(100dvh - var(--messages-viewport-offset));
            display: grid;
            grid-template-columns: 250px minmax(260px, 320px) minmax(0, 1fr);
            gap: 1rem;
            align-items: stretch;
            min-height: 360px;
            height: var(--messages-panel-height);
            max-height: var(--messages-panel-height);
        }
        .messages-users-pane {
            display: flex;
            flex-direction: column;
            min-height: 0;
        }
        .messages-list {
            border: 1px solid #1f1f2a;
            background: #0a0a0e;
            flex: 1 1 auto;
            height: auto;
            max-height: none;
            min-height: 0;
            overflow: auto;
        }
        .message-user-item {
            padding: 10px;
            border-bottom: 1px solid #1a1a22;
            cursor: pointer;
        }
        .message-user-item:hover,
        .message-user-item.active {
            background: #151523;
        }
        .chat-panel {
            border: 1px solid #1f1f2a;
            background: #0a0a0e;
            display: flex;
            flex-direction: column;
            height: auto;
            min-height: 0;
            overflow: hidden;
        }
        .chat-header {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
        #chatHeaderTitle {
            flex: 1;
            min-width: 0;
            font-weight: 700;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        #chatRefreshBtn {
            display: none;
        }
        .chat-fullscreen-mode .messages-layout {
            grid-template-columns: minmax(0, 1fr);
        }
        .chat-fullscreen-mode .messages-layout > .left-rail,
        .chat-fullscreen-mode #messagesUsersPane {
            display: none;
        }
        .chat-fullscreen-mode #messagesChatPane {
            height: 100%;
            min-height: 0;
        }

        .chat-actions-menu {
            position: absolute;
            right: 0;
            top: 100%;
            background: #0b0b0f;
            border: 1px solid #1f1f2a;
            z-index: 100;
            min-width: 200px;
            padding: 8px 0;
            border-radius: 4px;
            margin-top: 4px;
        }

        .chat-actions-menu button {
            display: block;
            width: 100%;
            text-align: left;
            padding: 8px 12px;
            margin-bottom: 4px;
        }

        .chat-actions-menu button:hover {
            background: #1a1a24;
        }

        .group-info-panel {
            background: #08080c;
            border: 1px solid #1f1f2a;
            padding: 12px;
            margin-bottom: 8px;
            border-radius: 6px;
        }

        .group-info-panel h3 {
            margin: 0;
            font-size: 1rem;
            color: #ddd;
        }

        .group-info-panel .avatar {
            width: 28px;
            height: 28px;
            font-size: 0.7rem;
        }

        .group-info-panel input[type="text"] {
            background: #0a0a0e;
            border: 1px solid #2a2a35;
            color: #ddd;
            padding: 6px;
            font-size: 0.75rem;
        }
        #messagesSection.chat-fullscreen-mode .hero {
            display: none;
        }
        #messagesSection.chat-fullscreen-mode .messages-layout {
            height: calc(100dvh - 96px);
            max-height: calc(100dvh - 96px);
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .chat-bubble {
            max-width: min(78%, 560px);
            width: auto;
            min-width: 0;
            display: table;
            flex: 0 0 auto;
            align-self: flex-start;
            padding: 8px 10px;
            border: 1px solid #2a2a35;
            font-size: 0.86rem;
            line-height: 1.35;
            background: #101018;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
            word-break: break-word;
        }
        .chat-bubble.me {
            align-self: flex-end;
            margin-left: auto;
            background: #2d1658;
            border-color: #4a2a80;
        }
        .chat-media {
            margin-top: 6px;
            border: 1px solid #2a2a35;
            background: #050507;
            width: auto;
            display: inline-block;
            max-width: min(100%, 360px);
            overflow: hidden;
        }
        .chat-media img,
        .chat-media video {
            display: block;
            width: auto;
            max-width: 100%;
            max-height: 280px;
            object-fit: contain;
            background: #000;
        }
        .chat-link {
            color: #9fc5ff;
            text-decoration: underline;
            word-break: break-all;
        }
        .chat-status-line {
            min-height: 18px;
            font-size: 0.74rem;
            color: #9a9aa8;
            padding: 0 12px 8px;
        }
        .chat-status-line.chat-status-new {
            color: #ff6b9f;
            font-weight: 700;
            animation: chatNewMessageBlink 0.85s steps(1, end) infinite;
        }
        @keyframes chatNewMessageBlink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0.2; }
        }
        .chat-input-wrap {
            border-top: 1px solid #1f1f2a;
            padding: 10px;
            display: grid;
            gap: 8px;
            grid-template-columns: 1fr auto auto;
            align-items: end;
        }
        .chat-action-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            min-width: 44px;
            height: 44px;
            padding: 0 10px;
        }
        .chat-action-label {
            display: inline;
        }
        .chat-input-wrap textarea {
            min-height: 44px;
            max-height: 120px;
        }
        .chat-attachments-preview {
            grid-column: 1 / -1;
            display: none;
            gap: 8px;
        }
        .chat-attachment-item {
            display: flex;
            align-items: center;
            gap: 8px;
            border: 1px solid #2a2a35;
            background: #0f0f16;
            padding: 6px;
        }
        .chat-attachment-thumb {
            width: 48px;
            height: 48px;
            border: 1px solid #2a2a35;
            background: #000;
            object-fit: cover;
        }
        .chat-attachment-caption {
            grid-column: 1 / -1;
        }
        .chat-group-grid {
            display: inline-grid;
            gap: 6px;
            margin-top: 6px;
            width: fit-content;
            max-width: min(100%, 360px);
        }
        .chat-group-item {
            position: relative;
            border: 1px solid #2a2a35;
            background: #050507;
            min-height: 78px;
            cursor: pointer;
            overflow: hidden;
        }
        .chat-group-item img,
        .chat-group-item video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        .chat-group-overlay {
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,.48);
            color: #fff;
            font-family: 'Space Mono', monospace;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
        }
        .messages-users-pane,
        .messages-chat-pane {
            min-width: 0;
            min-height: 0;
        }
        footer {
            border-top: 1px solid #1f1f2a;
            margin-top: 3rem;
            padding: 2rem;
            text-align: center;
            font-size: 0.75rem;
            color: #555;
        }
        .container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 1.5rem;
        }
        .text-mono {
            font-family: 'Space Mono', monospace;
        }
        .text-purple {
            color: #b77eff;
        }
        hr {
            border-color: #1f1f2a;
            margin: 1rem 0;
        }
        .mb-2 { margin-bottom: 0.8rem; }
        .mb-3 { margin-bottom: 1.2rem; }
        .mt-3 { margin-top: 1rem; }
        .flex-between { display: flex; justify-content: space-between; align-items: center; }
        @media (max-width: 640px) {
            .hero h1 { font-size: 1.8rem; }
            .container { padding: 0 1rem; }
            .files-layout {
                flex-direction: column;
            }
            .files-side {
                position: static;
                width: 100%;
            }
            .file-preview {
                width: 60px;
                min-width: 60px;
                height: 60px;
            }
        }
        .two-col {
            display: grid;
            grid-template-columns: 250px minmax(0, 1fr) 320px;
            gap: 1rem;
            align-items: start;
        }
        .left-rail {
            padding: 1rem;
            position: sticky;
            top: 90px;
            border: 1px solid #1f1f2a;
            background: #0b0b0f;
        }
        .left-rail .rail-title {
            font-size: 0.75rem;
            color: #8f8f9a;
            margin-bottom: 0.7rem;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: .4px;
        }
        .left-rail a {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            text-decoration: none;
            color: #ddd;
            border-radius: 4px;
            font-size: 0.9rem;
            font-weight: 600;
            margin-bottom: 4px;
        }
        .left-rail a:hover {
            background: #111116;
            color: #b77eff;
        }
        .left-rail a.active {
            background: #171725;
            color: #b77eff;
            border: 1px solid #352552;
        }
        .mobile-menu a.active {
            color: #b77eff;
        }
        .feed { min-width: 0; }
        .sidebar {
            position: sticky;
            top: 90px;
        }
        .files-layout {
            display: grid;
            grid-template-columns: 250px minmax(0, 1fr) 300px;
            gap: 1rem;
            align-items: start;
        }
        .files-side {
            position: sticky;
            top: 90px;
        }
        @media (max-width: 1100px) {
            .two-col {
                grid-template-columns: minmax(0, 1fr) 300px;
            }
            .left-rail {
                display: none;
            }
        }
        @media (max-width: 1024px) {
            .messages-layout {
                grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
            }
            .messages-layout .left-rail {
                display: none;
            }
        }
        @media (max-width: 900px) {
            #messagesSection {
                --messages-viewport-offset: 150px;
            }
            .two-col,
            .files-layout,
            .messages-layout {
                grid-template-columns: 1fr;
            }
            .sidebar,
            .files-side {
                position: static;
            }
            .messages-layout .left-rail {
                display: none;
            }
            .messages-users-pane.mobile-hidden,
            .messages-chat-pane.mobile-hidden {
                display: none;
            }
            .messages-users-pane,
            .messages-chat-pane {
                min-height: 0;
            }
            #chatHeader {
                padding: 8px;
            }
            #chatMobileBackBtn {
                padding: 3px 8px;
                font-size: 0.65rem;
            }
            .chat-input-wrap {
                grid-template-columns: minmax(0, 1fr) auto auto;
            }
            .chat-action-btn {
                width: 40px;
                min-width: 40px;
                height: 40px;
                padding: 0;
            }
            .chat-action-label {
                display: none;
            }
            .chat-fullscreen-mode #messagesChatPane {
                height: calc(100dvh - 110px);
                min-height: calc(100dvh - 110px);
            }
        }
        @media (max-width: 768px) {
            #messagesSection {
                --messages-viewport-offset: 138px;
            }
            .container { padding: 0 0.8rem; }
            .nav-container {
                padding: 0.7rem 0.8rem;
                align-items: center;
                gap: 8px;
            }
            .logo { font-size: 1.35rem; }
            .nav-search {
                order: 3;
                min-width: 100%;
                max-width: 100%;
            }
            .nav-search input {
                height: 40px;
                font-size: 0.9rem;
            }
            .mobile-create-btn {
                display: inline-flex;
                width: 40px;
                height: 40px;
                min-width: 40px;
                font-size: 1.2rem;
            }
            .hero {
                padding: 1rem 0 0.7rem;
                margin-bottom: 1rem;
            }
            .hero h1 { font-size: 1.55rem; }
            .two-col { margin: 1rem 0; gap: 0.8rem; }
            .feed-switch { gap: 6px; }
            .feed-switch .btn {
                flex: 1 1 calc(50% - 6px);
                min-height: 36px;
                padding: 6px 8px;
            }
            .post {
                padding: 0.9rem;
                margin-bottom: 0.9rem;
            }
            .post-title { font-size: 0.95rem; }
            .post-actions {
                flex-wrap: wrap;
                gap: 0.8rem;
                font-size: 0.78rem;
            }
            .post-media img,
            .post-media video {
                max-height: 52vh;
            }
            .feed-post-media.two .feed-media-item {
                min-height: 170px;
            }
            .feed-post-media.three {
                grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
                grid-template-rows: repeat(2, minmax(90px, 1fr));
            }
            .feed-post-media.three .feed-media-item.item-1 {
                min-height: 190px;
            }
            .feed-post-media.three .feed-media-item.item-2,
            .feed-post-media.three .feed-media-item.item-3 {
                min-height: 90px;
            }
            .card { border-radius: 8px; }
            .files-layout { gap: 0.8rem; }
            .file-row { gap: 8px; }
            .file-preview {
                width: 56px;
                min-width: 56px;
                height: 56px;
            }
            .modal-content {
                width: min(96vw, 720px);
                max-height: 90vh;
                overflow: auto;
                padding: 1rem;
            }
            #profileModal .modal-content {
                max-height: 92vh;
            }
            .image-viewer-stage {
                height: calc(100vh - 150px);
            }
            .image-viewer-toolbar .btn {
                min-width: 94px;
                padding: 6px 10px;
            }
        }
        @media (max-width: 420px) {
            #messagesSection {
                --messages-viewport-offset: 124px;
            }
            .container { padding: 0 0.55rem; }
            .btn {
                padding: 7px 10px;
                font-size: 0.72rem;
            }
            .mobile-create-btn {
                width: 38px;
                height: 38px;
                min-width: 38px;
            }
            .feed-switch .btn { flex: 1 1 100%; }
            .user-greeting {
                padding: 3px 8px;
                font-size: 0.72rem;
            }
            .post-actions {
                gap: 0.55rem;
                font-size: 0.73rem;
            }
        }
        @media (min-width: 1600px) {
            .container,
            .nav-container {
                max-width: 1480px;
            }
        }
        @media (max-height: 760px) {
            #messagesSection {
                --messages-viewport-offset: 132px;
            }
            #messagesSection .hero {
                padding: 0.35rem 0 0.25rem;
                margin-bottom: 0.45rem;
            }
        }
    
