/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base: #000000;
  --bg-panel: #08090a;
  --bg-card: #0d0d0d;
  --bg-input: #111111;
  --bg-hover: #151515;
  --border: #222325;
  --border-subtle: #1a1a1a;
  --text-primary: #e0e0e0;
  --text-secondary: #8a8d91;
  --text-muted: #555555;
  --accent: #9d8ef0;
  --accent-hover: #b8acff;
  --accent-bg: #1a1333;
  --accent-border: #2a1f4a;
  --green: #44cc44;
  --red: #ff4444;
  --orange: #ff8800;
  --bubble-own: #1a1333;
  --bubble-own-border: #2a1f4a;
  --bubble-other: #0d0d0d;
  --bubble-other-border: #1a1a1a;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%; width: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  font-size: 14px;
}

.screen { height: 100%; width: 100%; }

/* === LOGIN === */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
}
.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 340px;
  text-align: center;
}
.login-box h1 { font-size: 24px; margin-bottom: 4px; color: var(--accent); }
.login-subtitle { color: var(--text-secondary); margin-bottom: 24px; font-size: 13px; }
.login-box input {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 14px;
  outline: none; font-family: var(--font);
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
  width: 100%; padding: 10px; background: var(--accent);
  color: #fff; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: background 0.15s;
}
.login-box button:hover { background: var(--accent-hover); }
.error-msg { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }

/* === NAVBAR === */
.g-nav {
  display: flex; align-items: center; height: 42px; padding: 0 16px;
  background: #08090a; border-bottom: 1px solid #222325; gap: 16px;
}
.g-nav__logo img { height: 30px; border-radius: 4px; object-fit: contain; }
.g-nav__tabs { display: flex; align-items: center; gap: 2px; height: 100%; }
.g-nav__tab {
  display: inline-flex; align-items: center; gap: 6px; height: 100%;
  padding: 0 14px; color: #8a8d91; font-size: 13px; font-weight: 600;
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.g-nav__tab:hover { color: #e4e6eb; }
.g-nav__tab--active { color: #e4e6eb; border-bottom-color: #e4e6eb; }
.g-nav__tab--messenger { color: #9d8ef0; }
.g-nav__tab--messenger:hover { color: #b8acff; border-bottom-color: #9d8ef0; }
.g-nav__tab--spy { color: #44cc44; }
.g-nav__tab--spy:hover { color: #66ee66; border-bottom-color: #44cc44; }
.g-nav__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.g-nav__user { color: var(--text-secondary); font-size: 13px; }
.g-nav__logout {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 4px;
}
.g-nav__logout:hover { color: var(--red); }
.g-nav__tab svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* === APP CONTAINER === */
.app-container {
  display: flex; height: calc(100% - 42px);
}

/* === SIDEBAR === */
.sidebar {
  width: 300px; min-width: 300px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header { padding: 10px; }
.search-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 13px;
  outline: none; font-family: var(--font);
}
.search-input:focus { border-color: var(--accent); }

.chat-list { flex: 1; overflow-y: auto; }
.chat-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}
.chat-list-item:hover { background: var(--bg-hover); }
.chat-list-item.active { background: var(--bg-hover); }

.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: #fff;
  flex-shrink: 0; position: relative;
}
.chat-avatar .online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--bg-panel);
}

.chat-info { flex: 1; min-width: 0; }
.chat-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-last-msg {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 11px; color: var(--text-muted); }
.chat-badge {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
  display: inline-block; margin-top: 4px;
  min-width: 18px; text-align: center;
}

.new-chat-btn {
  margin: 10px; padding: 10px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  font-family: var(--font); transition: background 0.15s;
}
.new-chat-btn:hover { background: var(--accent-border); }

/* === CHAT AREA === */
.chat-area {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-base); min-width: 0;
}

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* Chat header */
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: var(--bg-panel);
  border-bottom: 1px solid var(--border); min-height: 52px;
}
.back-btn {
  display: none; background: none; border: none;
  color: var(--accent); font-size: 20px; cursor: pointer;
  padding: 4px 8px;
}
.chat-header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: #fff;
}
.chat-header-name { font-size: 14px; font-weight: 600; }
.chat-header-status { font-size: 12px; color: var(--text-secondary); }

/* Messages */
.messages-container {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column;
}
.messages-list {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: auto;
}

.message-wrapper { display: flex; margin-bottom: 2px; max-width: 100%; }
.message-wrapper.own { justify-content: flex-end; }
.message-wrapper.other { justify-content: flex-start; }

.message-bubble {
  max-width: 65%; padding: 8px 12px;
  border-radius: 12px; position: relative;
  word-wrap: break-word; cursor: default;
}
.message-wrapper.own .message-bubble {
  background: var(--bubble-own);
  border: 1px solid var(--bubble-own-border);
  border-bottom-right-radius: 4px;
}
.message-wrapper.other .message-bubble {
  background: var(--bubble-other);
  border: 1px solid var(--bubble-other-border);
  border-bottom-left-radius: 4px;
}

.message-sender {
  font-size: 12px; font-weight: 600; margin-bottom: 2px;
  color: var(--accent);
}

.message-reply {
  background: rgba(157, 142, 240, 0.1);
  border-left: 3px solid var(--accent);
  padding: 4px 8px; margin-bottom: 4px;
  border-radius: 0 4px 4px 0; font-size: 12px;
  cursor: pointer;
}
.message-reply-name { font-weight: 600; color: var(--accent); font-size: 11px; }
.message-reply-text { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.message-text { line-height: 1.45; white-space: pre-wrap; }

.message-file { margin-top: 4px; }
.message-file img {
  max-width: 320px; max-height: 320px; border-radius: 8px;
  cursor: pointer; display: block;
}
.message-file video {
  max-width: 320px; max-height: 240px; border-radius: 8px;
  cursor: pointer; display: block;
}
.message-file audio { max-width: 280px; margin-top: 4px; }
.message-file-generic {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg-input);
  border-radius: 8px; cursor: pointer; text-decoration: none;
  color: var(--text-primary);
}
.message-file-generic:hover { background: var(--bg-hover); }
.message-file-icon { font-size: 24px; }
.message-file-info { min-width: 0; }
.message-file-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.message-file-size { font-size: 11px; color: var(--text-muted); }

.message-meta {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 2px;
}
.message-edited { font-size: 10px; color: var(--text-muted); font-style: italic; }
.message-time { font-size: 10px; color: var(--text-muted); }
.message-status { font-size: 12px; color: var(--text-muted); letter-spacing: -2px; }
.message-status.read { color: #5ca5e0; }

.message-reactions {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
}
.reaction-pill {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 6px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 12px; cursor: pointer; transition: background 0.15s;
}
.reaction-pill:hover { background: var(--bg-hover); }
.reaction-pill.own { border-color: var(--accent-border); background: var(--accent-bg); }
.reaction-count { font-size: 11px; color: var(--text-secondary); }

/* Message actions on hover */
.message-actions {
  display: none; position: absolute;
  top: -8px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 2px; gap: 0;
}
.message-wrapper.own .message-actions { left: -8px; }
.message-wrapper.other .message-actions { right: -8px; }
.message-bubble:hover .message-actions { display: flex; }
.message-action-btn {
  background: none; border: none; padding: 4px 6px;
  cursor: pointer; font-size: 14px; border-radius: 4px;
  transition: background 0.1s;
}
.message-action-btn:hover { background: var(--bg-hover); }

/* Date separator */
.date-separator {
  text-align: center; padding: 8px 0; color: var(--text-muted);
  font-size: 12px; position: relative;
}
.date-separator span {
  background: var(--bg-base); padding: 0 12px;
  position: relative; z-index: 1;
}
.date-separator::before {
  content: ''; position: absolute; top: 50%; left: 10%; right: 10%;
  height: 1px; background: var(--border-subtle);
}

/* Typing indicator */
.typing-indicator {
  padding: 4px 16px; font-size: 12px;
  color: var(--text-secondary); font-style: italic;
}

/* Reply bar */
.reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; background: var(--bg-panel);
  border-top: 1px solid var(--border); border-left: 3px solid var(--accent);
  margin: 0 16px;
}
.reply-bar-content { min-width: 0; }
.reply-bar-label { font-size: 12px; color: var(--text-secondary); }
.reply-bar-name { font-size: 12px; font-weight: 600; color: var(--accent); }
.reply-bar-text {
  display: block; font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 400px;
}
.reply-bar-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 4px;
}

/* Input area */
.input-area {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 16px; background: var(--bg-panel);
  border-top: 1px solid var(--border);
}
.attach-btn {
  font-size: 20px; cursor: pointer; padding: 4px;
  color: var(--text-secondary); transition: color 0.15s;
  flex-shrink: 0; align-self: flex-end; margin-bottom: 4px;
}
.attach-btn:hover { color: var(--accent); }
.input-wrapper {
  flex: 1; position: relative; display: flex; align-items: flex-end;
}
.message-input {
  flex: 1; padding: 8px 36px 8px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-primary); font-size: 14px;
  resize: none; outline: none; font-family: var(--font);
  max-height: 120px; line-height: 1.4;
}
.message-input:focus { border-color: var(--accent); }
.emoji-btn {
  position: absolute; right: 6px; bottom: 6px;
  background: none; border: none; font-size: 20px;
  cursor: pointer; padding: 2px; opacity: 0.5;
  transition: opacity 0.15s;
}
.emoji-btn:hover { opacity: 1; }

/* Emoji Picker */
.emoji-picker {
  position: absolute; bottom: 60px; right: 16px;
  width: 320px; max-height: 340px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; z-index: 80;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.emoji-picker-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 4px 4px 0; gap: 0; overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none; -ms-overflow-style: none;
}
.emoji-picker-tabs::-webkit-scrollbar { display: none; }
.emoji-picker-tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  font-size: 18px; padding: 6px 8px; cursor: pointer;
  opacity: 0.5; transition: opacity 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.emoji-picker-tabs button:hover { opacity: 0.8; }
.emoji-picker-tabs button.active { opacity: 1; border-bottom-color: var(--accent); }
.emoji-picker-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 2px; padding: 8px; overflow-y: auto;
  flex: 1;
}
.emoji-picker-grid span {
  font-size: 22px; text-align: center; cursor: pointer;
  padding: 4px; border-radius: 6px; transition: background 0.1s;
  line-height: 1.3;
}
.emoji-picker-grid span:hover { background: var(--bg-hover); }

.send-btn {
  background: var(--accent); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.send-btn:hover { background: var(--accent-hover); }

/* === MODAL === */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-content {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; width: 360px;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 18px;
}
.group-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 12px; cursor: pointer;
}
.group-name-input {
  width: 100%; padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 13px;
  outline: none; font-family: var(--font);
}
.users-list { margin-bottom: 12px; }
.user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.1s;
}
.user-item:hover { background: var(--bg-hover); }
.user-item.selected { background: var(--accent-bg); }
.user-item-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff;
}
.user-item-name { font-size: 13px; }
.user-item-check {
  margin-left: auto; width: 18px; height: 18px;
  border: 2px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--accent);
}
.user-item.selected .user-item-check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.create-chat-btn {
  width: 100%; padding: 10px; background: var(--accent);
  color: #fff; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font);
}
.create-chat-btn:hover { background: var(--accent-hover); }

/* === LIGHTBOX === */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.95);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: #fff;
  font-size: 28px; cursor: pointer; z-index: 201;
}
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  font-size: 36px; cursor: pointer; padding: 8px 16px;
  border-radius: 8px; z-index: 201;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.2); }
.lightbox-content { max-width: 90vw; max-height: 85vh; }
.lightbox-content img {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border-radius: 4px;
}
.lightbox-content video {
  max-width: 90vw; max-height: 85vh; outline: none;
}
.lightbox-info {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%); color: var(--text-secondary);
  font-size: 12px; background: rgba(0,0,0,0.6);
  padding: 4px 12px; border-radius: 8px;
}

/* === CONTEXT MENU === */
.context-menu {
  position: fixed; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; z-index: 150; min-width: 160px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.context-menu-item {
  padding: 8px 12px; font-size: 13px; cursor: pointer;
  border-radius: 4px; transition: background 0.1s;
}
.context-menu-item:hover { background: var(--bg-hover); }

/* === REACTION PICKER === */
.reaction-picker {
  position: fixed; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 8px; z-index: 160;
  display: flex; gap: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.reaction-emoji {
  font-size: 20px; cursor: pointer; padding: 4px;
  border-radius: 50%; transition: background 0.1s;
}
.reaction-emoji:hover { background: var(--bg-hover); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === PROFILE EDIT === */
.g-nav__edit-profile {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 4px; color: var(--text-muted);
  transition: color 0.15s;
}
.g-nav__edit-profile:hover { color: var(--accent); }

.profile-avatar-section {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 16px;
}
.profile-avatar-preview {
  width: 80px; height: 80px; border-radius: 50%;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.profile-avatar-upload-label {
  font-size: 12px; color: var(--accent); cursor: pointer;
  transition: color 0.15s;
}
.profile-avatar-upload-label:hover { color: var(--accent-hover); }

.avatar-img {
  border-radius: 50%; object-fit: cover;
}

/* === CHAT SETTINGS === */
.chat-settings-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text-secondary); font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
  transition: background 0.1s;
}
.chat-settings-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.chat-settings-content { width: 380px; }

.chat-settings-avatar-section { margin-bottom: 12px; }

.chat-settings-members-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
}
.chat-settings-add-btn {
  background: none; border: 1px solid var(--accent-border);
  color: var(--accent); font-size: 12px; padding: 4px 10px;
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  transition: background 0.15s;
}
.chat-settings-add-btn:hover { background: var(--accent-bg); }

.role-badge {
  font-size: 10px; color: var(--accent); background: var(--accent-bg);
  border: 1px solid var(--accent-border); border-radius: 4px;
  padding: 1px 5px; margin-left: 4px;
}

.member-remove-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
  padding: 4px 6px; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.member-remove-btn:hover { color: var(--red); background: rgba(255,68,68,0.1); }

.chat-settings-leave-btn {
  width: 100%; padding: 10px; margin-top: 12px;
  background: none; border: 1px solid var(--red);
  color: var(--red); border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  transition: background 0.15s;
}
.chat-settings-leave-btn:hover { background: rgba(255,68,68,0.1); }

/* === CHANNEL === */
.channel-readonly {
  padding: 16px; text-align: center;
  color: var(--text-muted); font-size: 13px;
  background: var(--bg-panel); border-top: 1px solid var(--border);
}

.chat-type-icon { margin-right: 4px; }

/* === SIDEBAR FOOTER === */
.sidebar-footer {
  display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border);
}
.sidebar-footer .new-chat-btn { flex: 1; margin: 0; text-align: center; }
.new-channel-btn { background: rgba(255,136,0,0.1) !important; color: var(--orange) !important; border-color: rgba(255,136,0,0.3) !important; }
.new-channel-btn:hover { background: rgba(255,136,0,0.2) !important; }

/* === AVATAR WRAP === */
.chat-avatar-wrap {
  width: 42px; height: 42px; border-radius: 50%;
  flex-shrink: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.chat-avatar-wrap .online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--bg-panel);
}

/* === CHAT HEADER CLICKABLE === */
.chat-header-info { cursor: pointer; flex: 1; }
.chat-header-info:hover .chat-header-name { color: var(--accent); }

/* === MOBILE === */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-width: 100%; }
  .chat-area { position: absolute; inset: 0; top: 42px; z-index: 50; display: none; background: var(--bg-base); }
  .chat-area.visible { display: flex; }
  .back-btn { display: block; }
  .app-container { position: relative; overflow: hidden; }
  .message-bubble { max-width: 85%; }

  /* Hide tab text on mobile, show only icons */
  .g-nav__tab { padding: 0 8px; font-size: 0; gap: 0; }
  .g-nav__tab svg { width: 18px; height: 18px; }
  .g-nav { padding: 0 8px; gap: 8px; }
  .g-nav__logo img { height: 24px; }

  /* Sidebar footer buttons */
  .sidebar-footer { flex-direction: row; padding: 8px; }
  .sidebar-footer .new-chat-btn { font-size: 13px; padding: 10px 8px; }

  /* Modal full width on mobile */
  .modal-content { width: calc(100vw - 32px); max-width: 400px; max-height: 85vh; }
  .chat-settings-content { width: calc(100vw - 32px); max-width: 400px; }

  /* Users list scrollable */
  .users-list { max-height: 50vh; overflow-y: auto; }

  /* Message actions always visible on mobile */
  .message-actions {
    display: flex !important; position: static;
    background: none; border: none; padding: 0; margin-top: 4px;
  }

  /* Input area mobile */
  .input-area { padding: 8px; gap: 6px; }
  .message-input { font-size: 16px; } /* prevent zoom on iOS */

  /* Emoji picker full width */
  .emoji-picker { width: calc(100vw - 16px); right: 8px; bottom: 56px; max-height: 280px; }

  /* Profile button smaller */
  .g-nav__edit-profile { font-size: 12px; }
  .g-nav__user { display: none; }
  .g-nav__right { gap: 6px; }
}

/* === FORWARDED === */
.message-forwarded {
  font-size: 11px; color: var(--accent); margin-bottom: 4px;
  font-style: italic;
}

/* === PINNED BAR === */
.pinned-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 16px; background: var(--accent-bg);
  border-bottom: 1px solid var(--accent-border);
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  width: 100%;
}
.pinned-bar:hover { background: var(--accent-border); }
.pinned-bar-icon { font-size: 14px; }
.pinned-bar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === CHAT SEARCH === */
.chat-search-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-bottom: 1px solid var(--accent);
  color: var(--text-primary); font-size: 13px;
  outline: none; font-family: var(--font);
}

/* === MARKDOWN === */
.msg-code-block {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; margin: 4px 0;
  font-family: monospace; font-size: 12px;
  overflow-x: auto; white-space: pre;
}
.msg-code {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 4px;
  font-family: monospace; font-size: 12px;
}
.msg-link {
  color: var(--accent); text-decoration: none;
  word-break: break-all;
}
.msg-link:hover { text-decoration: underline; }

/* === VOICE === */
.voice-btn {
  background: none; border: none; font-size: 20px;
  cursor: pointer; padding: 4px 6px; opacity: 0.5;
  transition: opacity 0.15s; flex-shrink: 0;
  align-self: flex-end; margin-bottom: 4px;
}
.voice-btn:hover { opacity: 1; }
.voice-btn.recording { opacity: 1; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === DRAG & DROP === */
.chat-area.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: var(--accent-bg) !important;
}
