﻿* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #313338;
  color: white;
}

/* ========== AUTH SCREENS ========== */

#register-screen,
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: #313338;
  padding: 16px;
}

.auth-box {
  background: #2b2d31;
  padding: 24px;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  margin-bottom: 20px;
  color: white;
  text-align: center;
  font-size: 22px;
}

.auth-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-box input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.avatar-picker {
  margin-bottom: 16px;
}

.avatar-picker p {
  color: #b5bac1;
  margin-bottom: 8px;
  font-size: 13px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.color-option,
.group-color-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-option:hover,
.group-color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-option:active,
.group-color-option:active {
  transform: scale(0.95);
}

.color-option.selected,
.group-color-option.selected {
  border-color: white;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

#register-btn,
#login-btn {
  width: 100%;
  padding: 14px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#register-btn:hover,
#login-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

#register-btn:active,
#login-btn:active {
  background: #3c45a5;
  transform: scale(0.98);
}

.auth-switch {
  text-align: center;
  color: #b5bac1;
  font-size: 13px;
}

.auth-switch a {
  color: #5865f2;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-switch a:hover {
  color: #7983f5;
  text-decoration: underline;
}

.error-msg {
  color: #f23f43;
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
}

/* ========== APP LAYOUT ========== */

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ========== SIDEBAR ========== */

.sidebar {
  width: 240px;
  background: #2b2d31;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-settings-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  border: none;
  color: #b5bac1;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  font-size: 20px;
  display: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mobile-settings-icon:hover {
  background: #35363c;
  color: white;
}

.mobile-settings-icon:active {
  background: #404249;
  color: white;
  transform: scale(0.92);
}

#add-friend-btn {
  flex: 1;
  padding: 12px;
  background: #1e1f22;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease;
}

#add-friend-btn:hover {
  background: #35363c;
  color: white;
}

#add-friend-btn:active {
  background: #404249;
  transform: scale(0.98);
}

/* ========== TABS ========== */

.tabs {
  display: flex;
  padding: 8px;
  gap: 4px;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease;
}

.tab.active {
  background: #404249;
  color: white;
}

.tab:hover:not(.active) {
  background: #35363c;
  color: #dbdee1;
}

.tab:active {
  transform: scale(0.96);
}

/* ========== CONVERSATIONS LIST ========== */

.conversations {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px;
  -webkit-overflow-scrolling: touch;
}

.tab-content {
  display: none;
}

.tab-content.active-tab {
  display: block;
}

.conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
  min-height: 56px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.conversation:hover {
  background: #35363c;
}

.conversation:active {
  transform: scale(0.98);
}

.conversation.active {
  background: #404249;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.conversation:hover .conversation-avatar {
  transform: scale(1.08);
}

.group-avatar {
  border-radius: 12px;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-size: 15px;
  font-weight: 500;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-username {
  font-size: 13px;
  color: #b5bac1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== EMPTY STATES ========== */

.empty-state {
  padding: 20px;
  text-align: center;
  color: #b5bac1;
  animation: empty-appear 0.4s ease;
}

@keyframes empty-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== FRIEND REQUESTS ========== */

.friend-request {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: #35363c;
  min-height: 56px;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.3s ease, max-height 0.3s ease;
  overflow: hidden;
}

.friend-request:hover {
  background: #3e3f45;
}

.accept-btn {
  background: #57f287;
  color: #1e1f22;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.accept-btn:hover {
  background: #3ba55d;
  box-shadow: 0 2px 6px rgba(87, 242, 135, 0.3);
}

.accept-btn:active {
  transform: scale(0.93);
}

/* ========== USER PANEL ========== */

.user-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #232428;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  min-height: 64px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-username {
  font-size: 12px;
  color: #b5bac1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-icon {
  background: transparent;
  border: none;
  color: #b5bac1;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.3s ease;
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

.settings-icon:hover {
  background: #35363c;
  color: white;
  transform: rotate(60deg);
}

.settings-icon:active {
  transform: rotate(120deg) scale(0.9);
}

/* ========== PROFILE PANEL (Mobile) ========== */

.profile-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #313338;
  z-index: 150;
  display: none;
}

.profile-panel.active {
  display: flex;
}

.profile-main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.profile-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  z-index: 10;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.profile-back-btn:active {
  opacity: 0.6;
  transform: translateX(-4px);
}

.profile-content-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
  color: white;
  margin-bottom: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-avatar-large:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.profile-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.profile-username {
  font-size: 18px;
  color: #b5bac1;
  text-align: center;
}

.profile-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-action-btn {
  width: 52px;
  height: 52px;
  background: #5865f2;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.profile-action-btn:hover {
  background: #4752c4;
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

.profile-action-btn:active {
  background: #3c45a5;
  transform: scale(0.92);
}

/* ========== CHAT AREA ========== */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

#chat-title {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.chat-title-username {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-count {
  font-size: 12px;
  color: #b5bac1;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.group-member-count:hover {
  color: white;
}

.unadd-btn {
  background: transparent;
  border: 1px solid #f23f43;
  color: #f23f43;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.unadd-btn:hover {
  background: #f23f43;
  color: white;
  box-shadow: 0 2px 8px rgba(242, 63, 67, 0.3);
}

.unadd-btn:active {
  background: #d83639;
  color: white;
  transform: scale(0.95);
}

/* ========== MESSAGES ========== */

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.message {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  margin-bottom: 8px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.message.message-append-soft {
  animation: message-append-soft 0.18s ease-out;
}

@keyframes message-append-soft {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message:hover {
  background: rgba(46, 48, 53, 0.5);
  margin: 0 -16px;
  padding: 4px 16px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.message:hover .message-avatar {
  transform: scale(1.06);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-sender {
  font-weight: 500;
  font-size: 15px;
}

.message-time {
  font-size: 11px;
  color: #949ba4;
  transition: color 0.15s ease;
}

.message:hover .message-time {
  color: #b5bac1;
}

.message-text {
  font-size: 15px;
  color: #dbdee1;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: image-load 0.4s ease;
}

@keyframes image-load {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.message-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.message-image:active {
  transform: scale(0.98);
}

/* ========== READ RECEIPTS ========== */

.read-receipt {
  font-size: 11px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.7;
  animation: receipt-appear 0.3s ease;
}

@keyframes receipt-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.7; transform: translateY(0); }
}

.read-receipt .checkmarks {
  font-size: 12px;
  letter-spacing: -3px;
  margin-right: 2px;
}

.read-receipt.read {
  color: #5865f2;
  animation: receipt-read 0.4s ease;
}

@keyframes receipt-read {
  0% { color: #949ba4; transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { color: #5865f2; transform: scale(1); }
}

.read-receipt.delivered {
  color: #949ba4;
}

/* ========== INPUT AREA ========== */

.input-area {
  padding: 16px;
  flex-shrink: 0;
  background: #313338;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.input-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-btn {
  background: #5865f2;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.image-btn:hover {
  background: #4752c4;
  transform: scale(1.1);
  box-shadow: 0 2px 10px rgba(88, 101, 242, 0.4);
}

.image-btn:active {
  background: #3c45a5;
  transform: scale(0.92);
}

#message-input {
  flex: 1;
  padding: 12px 14px;
  background: #383a40;
  border: 2px solid transparent;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  box-sizing: border-box;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#message-input:focus {
  outline: none;
  background: #40444b;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

#message-input.sending,
#message-input.send-flash {
  animation: input-send-soft 0.26s ease;
}

@keyframes input-send-soft {
  0% {
    background: #383a40;
    box-shadow: 0 0 0 0 rgba(88, 101, 242, 0);
  }
  45% {
    background: #3d4047;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.12);
  }
  100% {
    background: #383a40;
    box-shadow: 0 0 0 0 rgba(88, 101, 242, 0);
  }
}

/* ========== MODALS ========== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal.active {
  display: flex;
  animation: modal-backdrop-in 0.3s ease forwards;
}

@keyframes modal-backdrop-in {
  from { background: rgba(0, 0, 0, 0); }
  to { background: rgba(0, 0, 0, 0.85); }
}

.modal-content {
  background: #313338;
  padding: 24px;
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

#friend-search-input,
#group-name-input {
  width: 100%;
  padding: 14px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  margin-bottom: 12px;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#friend-search-input:focus,
#group-name-input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

#search-results {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.user-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 4px;
  background: #2b2d31;
  margin-bottom: 10px;
  min-height: 60px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.user-search-result:hover {
  background: #35363c;
  transform: translateX(4px);
}

.add-btn {
  background: #5865f2;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.add-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.add-btn:active {
  transform: scale(0.93);
}

.add-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.add-btn.sent {
  background: #57f287;
  color: #1e1f22;
  animation: btn-sent 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes btn-sent {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ========== GROUP SPECIFIC ========== */

.create-group-trigger {
  width: 100%;
  padding: 10px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.create-group-trigger:hover {
  background: #4752c4;
  box-shadow: 0 2px 10px rgba(88, 101, 242, 0.4);
}

.create-group-trigger:active {
  background: #3c45a5;
  transform: scale(0.97);
}

.group-friend-picker {
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #2b2d31;
  border-radius: 4px;
  padding: 4px;
}

.friend-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #dbdee1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.friend-pick-item:hover {
  background: #35363c;
}

.friend-pick-item:active {
  transform: scale(0.98);
}

.friend-pick-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5865f2;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.friend-pick-item input[type="checkbox"]:checked {
  transform: scale(1.15);
}

.group-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  background: #2b2d31;
  margin-bottom: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.group-member-item:hover {
  background: #35363c;
  transform: translateX(4px);
}

.owner-badge {
  font-size: 11px;
  color: #fee75c;
  background: rgba(254, 231, 92, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 600;
  animation: badge-glow 2s ease-in-out infinite alternate;
}

@keyframes badge-glow {
  from { box-shadow: 0 0 4px rgba(254, 231, 92, 0.1); }
  to { box-shadow: 0 0 8px rgba(254, 231, 92, 0.25); }
}

/* ========== SETTINGS ========== */

.settings-section {
  margin-bottom: 20px;
}

.settings-section h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.settings-section p {
  font-size: 14px;
  line-height: 1.5;
}

/* ========== BUTTONS ========== */

.primary-btn {
  background: #5865f2;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
  width: 100%;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  background: #4752c4;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

.primary-btn:active {
  background: #3c45a5;
  transform: scale(0.98);
}

.danger-btn {
  background: #f23f43;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
  width: 100%;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.danger-btn:hover {
  background: #d83639;
  box-shadow: 0 2px 8px rgba(242, 63, 67, 0.4);
}

.danger-btn:active {
  background: #c02e31;
  transform: scale(0.98);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-actions button {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  background: #2b2d31;
  color: white;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.modal-actions button:hover {
  background: #35363c;
}

.modal-actions button:active {
  transform: scale(0.96);
}

.modal-actions-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  background: #2b2d31;
  color: white;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.modal-actions-btn:hover {
  background: #35363c;
}

.modal-actions-btn:active {
  transform: scale(0.96);
}

/* ========== SETTINGS CATEGORIES ========== */

.settings-modal-content {
  max-width: 500px;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #1e1f22;
  border-radius: 6px;
  padding: 4px;
}

.settings-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.settings-tab.active {
  background: #404249;
  color: white;
}

.settings-tab:hover:not(.active) {
  color: white;
  background: rgba(64, 66, 73, 0.5);
}

.settings-tab:active {
  transform: scale(0.96);
}

.settings-category {
  display: none;
}

.settings-category.active {
  display: block;
}

.settings-desc {
  color: #b5bac1;
  margin: 8px 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* ========== ANIMATION PICKER ========== */

.anim-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.anim-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #b5bac1;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.anim-option:hover {
  background: #35363c;
  color: white;
  transform: translateY(-2px);
}

.anim-option:active {
  transform: translateY(0) scale(0.96);
}

.anim-option.active {
  border-color: #5865f2;
  color: white;
  background: #35363c;
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.2);
}

.anim-preview {
  width: 40px;
  height: 30px;
  background: #1e1f22;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.anim-box {
  width: 16px;
  height: 20px;
  background: #5865f2;
  border-radius: 2px;
  position: absolute;
  top: 5px;
  left: 12px;
}

.anim-option:hover .anim-preview-slide .anim-box {
  animation: preview-slide 0.6s ease;
}

.anim-option:hover .anim-preview-fade .anim-box {
  animation: preview-fade 0.6s ease;
}

.anim-option:hover .anim-preview-scale .anim-box {
  animation: preview-scale 0.6s ease;
}

.anim-option:hover .anim-preview-flip .anim-box {
  animation: preview-flip 0.6s ease;
}

.anim-option:hover .anim-preview-none .anim-box {
  animation: preview-blink 0.4s step-end;
}

@keyframes preview-slide {
  0% { transform: translateX(-20px); }
  100% { transform: translateX(0); }
}

@keyframes preview-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes preview-scale {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes preview-flip {
  0% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

@keyframes preview-blink {
  0% { opacity: 0; }
  50% { opacity: 0; }
  51% { opacity: 1; }
}

/* ========== TRANSITION ANIMATIONS ========== */

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slide-out-right {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes slide-in-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slide-out-down {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(30px); opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scale-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes scale-out {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.85); opacity: 0; }
}

@keyframes flip-in {
  from { transform: perspective(600px) rotateY(-90deg); opacity: 0; }
  to { transform: perspective(600px) rotateY(0); opacity: 1; }
}

@keyframes flip-out {
  from { transform: perspective(600px) rotateY(0); opacity: 1; }
  to { transform: perspective(600px) rotateY(90deg); opacity: 0; }
}

/* Chat/Panel animations */
.anim-slide-chat-enter.anim-enter-active,
.anim-slide-panel-enter.anim-enter-active {
  animation: slide-in-right 0.3s ease forwards;
}

.anim-slide-chat-exit,
.anim-slide-panel-exit {
  animation: slide-out-right 0.25s ease forwards;
}

.anim-fade-chat-enter.anim-enter-active,
.anim-fade-panel-enter.anim-enter-active {
  animation: fade-in 0.25s ease forwards;
}

.anim-fade-chat-exit,
.anim-fade-panel-exit {
  animation: fade-out 0.2s ease forwards;
}

.anim-scale-chat-enter.anim-enter-active,
.anim-scale-panel-enter.anim-enter-active {
  animation: scale-in 0.3s ease forwards;
}

.anim-scale-chat-exit,
.anim-scale-panel-exit {
  animation: scale-out 0.25s ease forwards;
}

.anim-flip-chat-enter.anim-enter-active,
.anim-flip-panel-enter.anim-enter-active {
  animation: flip-in 0.4s ease forwards;
}

.anim-flip-chat-exit,
.anim-flip-panel-exit {
  animation: flip-out 0.3s ease forwards;
}

/* Modal content animations */
.modal-slide-in { animation: slide-in-up 0.3s ease forwards; }
.modal-slide-out { animation: slide-out-down 0.2s ease forwards; }
.modal-fade-in { animation: fade-in 0.25s ease forwards; }
.modal-fade-out { animation: fade-out 0.2s ease forwards; }
.modal-scale-in { animation: scale-in 0.3s ease forwards; }
.modal-scale-out { animation: scale-out 0.2s ease forwards; }
.modal-flip-in { animation: flip-in 0.4s ease forwards; }
.modal-flip-out { animation: flip-out 0.3s ease forwards; }

/* ========== DESKTOP CHAT TRANSITION ========== */

.messages.chat-switching {
  animation: chat-content-switch 0.3s ease;
}

@keyframes chat-content-switch {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.chat-header.header-switching {
  animation: header-switch 0.25s ease;
}

@keyframes header-switch {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ========== PROFILE VIEWER ========== */

.profile-viewer-content {
  padding: 0;
  overflow: hidden;
}

.pv-banner {
  height: 80px;
  width: 100%;
  position: relative;
}

.pv-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -30px;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.pv-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: white;
  border: 4px solid #313338;
  flex-shrink: 0;
  cursor: default;
}

.pv-avatar.has-border {
  border-width: 3px;
}

.pv-avatar.effect-glow {
  box-shadow: 0 0 15px rgba(88, 101, 242, 0.5);
}

.pv-avatar.effect-pulse {
  animation: pulse-effect 2s ease-in-out infinite;
}

.pv-avatar.effect-shimmer {
  animation: shimmer-effect 2s ease infinite;
}

.pv-avatar.effect-rainbow {
  animation: rainbow-border 3s linear infinite;
}

@keyframes pulse-effect {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(88, 101, 242, 0); }
}

@keyframes shimmer-effect {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

@keyframes rainbow-border {
  0% { border-color: #f23f43; }
  17% { border-color: #f26522; }
  33% { border-color: #fee75c; }
  50% { border-color: #57f287; }
  67% { border-color: #5865f2; }
  83% { border-color: #eb459e; }
  100% { border-color: #f23f43; }
}

.pv-badge {
  font-size: 11px;
  color: white;
  background: #5865f2;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  display: none;
}

.pv-badge.visible {
  display: inline-block;
}

.pv-name {
  padding: 12px 24px 0;
  font-size: 22px;
  font-weight: 700;
}

.pv-name.style-bold { font-weight: 900; }
.pv-name.style-italic { font-style: italic; }
.pv-name.style-underline { text-decoration: underline; }
.pv-name.style-mono { font-family: 'Courier New', monospace; }

.pv-username {
  padding: 2px 24px;
  font-size: 14px;
  color: #b5bac1;
}

.pv-pronouns {
  padding: 2px 24px;
  font-size: 12px;
  color: #949ba4;
  display: none;
}

.pv-pronouns.visible {
  display: block;
}

.pv-status {
  padding: 8px 24px 0;
  font-size: 13px;
  color: #dbdee1;
  display: none;
}

.pv-status.visible {
  display: block;
}

.pv-bio {
  padding: 8px 24px;
  font-size: 13px;
  color: #b5bac1;
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 10px;
  display: none;
}

.pv-bio.visible {
  display: block;
}

.pv-actions {
  padding: 0 24px 16px;
  display: flex;
  gap: 8px;
}

/* ========== SETTINGS INPUTS ========== */

.settings-input {
  width: 100%;
  padding: 12px;
  background: #1e1f22;
  border: 2px solid transparent;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  margin-top: 8px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.settings-textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
}

.profile-option-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-opt-btn {
  padding: 8px 14px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 6px;
  color: #b5bac1;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.profile-opt-btn:hover {
  background: #35363c;
  color: white;
}

.profile-opt-btn.active {
  border-color: #5865f2;
  color: white;
  background: #35363c;
}

.emoji-opt-btn {
  padding: 6px 10px;
  font-size: 20px;
  background: #2b2d31;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.emoji-opt-btn:hover {
  background: #35363c;
  transform: scale(1.15);
}

.emoji-opt-btn.active {
  border-color: #5865f2;
  background: #35363c;
}

/* ========== UNADD ALL BUTTON ========== */

.unadd-all-trigger {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed #f23f43;
  border-radius: 4px;
  color: #f23f43;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.unadd-all-trigger:hover {
  background: rgba(242, 63, 67, 0.1);
}

/* ========== GROUP MEMBER ACTIONS ========== */

.gm-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.gm-add-btn {
  padding: 4px 10px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.gm-add-btn:hover {
  background: #4752c4;
}

.gm-add-btn.sent {
  background: #57f287;
  color: #1e1f22;
}

.gm-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gm-avatar-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gm-avatar-clickable:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== CALL BUTTON ========== */

.call-btn {
  background: #57f287;
  border: none;
  color: #1e1f22;
  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 ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.call-btn:hover {
  background: #3ba55d;
  transform: scale(1.12);
  box-shadow: 0 2px 10px rgba(87, 242, 135, 0.4);
}

.call-btn:active {
  transform: scale(0.92);
}

/* ========== CALL OVERLAYS ========== */

.call-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}

.call-overlay.active {
  display: flex;
  animation: call-overlay-in 0.3s ease forwards;
}

@keyframes call-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Incoming call card */
.call-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  position: relative;
}

.call-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin-top: -100px;
  margin-left: -60px;
  border-radius: 50%;
  border: 3px solid rgba(87, 242, 135, 0.4);
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

.call-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  color: white;
  position: relative;
  z-index: 1;
}

.call-avatar-active {
  width: 80px;
  height: 80px;
  font-size: 32px;
}

.call-name {
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.call-status {
  font-size: 14px;
  color: #b5bac1;
  animation: status-blink 1.5s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.call-status.connected {
  color: #57f287;
  animation: none;
}

.call-actions {
  display: flex;
  gap: 32px;
  margin-top: 20px;
}

.call-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.call-action-btn:hover {
  transform: scale(1.12);
}

.call-action-btn:active {
  transform: scale(0.92);
}

.call-accept-btn {
  background: #57f287;
  color: #1e1f22;
  animation: accept-bounce 1s ease-in-out infinite;
}

@keyframes accept-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.call-accept-btn:hover {
  animation: none;
  box-shadow: 0 0 20px rgba(87, 242, 135, 0.5);
}

.call-decline-btn {
  background: #f23f43;
  color: white;
}

.call-decline-btn:hover {
  box-shadow: 0 0 20px rgba(242, 63, 67, 0.5);
}

/* Active call */
.call-active-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
}

.call-timer {
  font-size: 36px;
  font-weight: 300;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.call-wave {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 30px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.call-wave.active {
  opacity: 1;
}

.call-wave span {
  display: block;
  width: 4px;
  height: 8px;
  background: #57f287;
  border-radius: 2px;
  animation: wave-bar 0.8s ease-in-out infinite;
}

.call-wave span:nth-child(1) { animation-delay: 0s; }
.call-wave span:nth-child(2) { animation-delay: 0.1s; }
.call-wave span:nth-child(3) { animation-delay: 0.2s; }
.call-wave span:nth-child(4) { animation-delay: 0.3s; }
.call-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-bar {
  0%, 100% { height: 8px; opacity: 0.5; }
  50% { height: 24px; opacity: 1; }
}

.call-controls {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.call-control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #404249;
  color: white;
  transition: transform 0.2s ease, background 0.15s ease, box-shadow 0.2s ease;
}

.call-control-btn:hover {
  background: #4e5058;
  transform: scale(1.08);
}

.call-control-btn:active {
  transform: scale(0.92);
}

.call-control-btn.muted {
  background: #f23f43;
}

.call-hangup-btn {
  background: #f23f43;
  transform: rotate(135deg);
}

.call-hangup-btn:hover {
  background: #d83639;
  box-shadow: 0 0 20px rgba(242, 63, 67, 0.4);
  transform: rotate(135deg) scale(1.08);
}

.call-hangup-btn:active {
  transform: rotate(135deg) scale(0.92);
}

/* ========== SCROLLBAR ========== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1e1f22;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #35363c;
}

/* ========== MOBILE ========== */

@media (max-width: 768px) {
  #app {
    height: 100dvh;
  }

  .sidebar {
    width: 100vw;
  }

  .mobile-settings-icon {
    display: block;
  }

  .settings-icon {
    display: none;
  }

  .chat-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 100;
    background: #313338;
    display: none;
  }

  .chat-area.active {
    display: flex;
  }

  .tab {
    padding: 12px 8px;
  }

  .tab:active {
    background: #404249;
  }

  .conversation:active {
    background: #404249;
  }

  .conversation:hover {
    background: transparent;
  }

  .conversation:hover .conversation-avatar {
    transform: none;
  }

  .conversation.active,
  .conversation.active:hover {
    background: #404249;
  }

  .message:hover {
    background: transparent;
    margin: 0;
    padding: 4px 0;
  }

  .message:hover .message-avatar {
    transform: none;
  }

  .message-image {
    max-width: 80vw;
  }

  .accept-btn:active {
    background: #3ba55d;
  }

  .friend-pick-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .anim-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .anim-option {
    padding: 10px 4px;
    font-size: 11px;
  }

  .anim-option:hover {
    transform: none;
  }

  .anim-option:active {
    transform: scale(0.95);
  }

  .settings-tabs {
    gap: 2px;
  }

  .settings-tab {
    padding: 10px 8px;
    font-size: 13px;
  }

  .user-search-result:hover {
    transform: none;
  }
  
  .group-member-item:hover {
    transform: none;
  }

  .settings-icon:hover {
    transform: none;
  }
}

/* ========== COMMUNITIES ========== */

.community-header {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #2a2a3a;
  gap: 8px;
}

.community-back-btn {
  background: none;
  border: none;
  color: #b5bac1;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.community-back-btn:hover { background: #2a2a3a; color: #fff; }

.community-view-title {
  flex: 1;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-settings-trigger {
  background: none;
  border: none;
  color: #b5bac1;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.community-settings-trigger:hover { background: #2a2a3a; color: #fff; }

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.channel-category {
  margin-bottom: 4px;
}

.channel-category-name {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #72767d;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  margin: 1px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #8e9297;
  font-size: 14px;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}

.channel-item:hover {
  background: #2a2a3a;
  color: #dcddde;
}

.channel-item.channel-active {
  background: #3a3a4a;
  color: #fff;
}

.channel-icon {
  font-size: 16px;
  min-width: 20px;
  text-align: center;
  color: #72767d;
}

.channel-item.channel-active .channel-icon { color: #fff; }

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-footer {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid #2a2a3a;
}

.community-invite-btn,
.community-members-btn {
  flex: 1;
  background: #2a2a3a;
  border: none;
  color: #b5bac1;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.community-invite-btn:hover,
.community-members-btn:hover {
  background: #3a3a4a;
  color: #fff;
}

/* Channel header in chat */
.channel-header-icon {
  color: #72767d;
  font-size: 20px;
  font-weight: 700;
  margin-right: 4px;
}

.channel-topic {
  color: #72767d;
  font-size: 12px;
  margin-left: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.6;
}

.pin-btn:hover { opacity: 1; background: #2a2a3a; }

/* Community messages with avatars */
.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.message-sender {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.message-sender:hover { text-decoration: underline; }

.message-time {
  font-size: 11px;
  color: #72767d;
}

.edited-tag {
  font-size: 10px;
  color: #72767d;
  font-style: italic;
}

.pinned-tag { font-size: 12px; }

/* Role tags */
.role-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 4px;
}

.role-owner { background: #fee75c; color: #000; }
.role-admin { background: #ed4245; color: #fff; }
.role-mod { background: #57f287; color: #000; }
.role-member { background: #4f545c; color: #b5bac1; }

/* Invite code display */
.invite-code-display {
  background: #1a1a2e;
  color: #5865f2;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 16px;
  letter-spacing: 1px;
  display: inline-block;
  user-select: all;
}

/* Member management */
.members-mgmt-list {
  max-height: 400px;
  overflow-y: auto;
}

.member-mgmt-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.member-mgmt-item:hover { background: #2a2a3a; }

.member-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.role-select {
  background: #1a1a2e;
  color: #b5bac1;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.small-btn {
  background: #4f545c;
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.small-btn:hover { background: #5865f2; }

.danger-small {
  background: #ed4245;
}

.danger-small:hover { background: #c03537; }

/* Channel management */
.channel-mgmt-list {
  max-height: 200px;
  overflow-y: auto;
}

.channel-mgmt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  background: #1a1a2e;
  margin-bottom: 4px;
  color: #b5bac1;
  font-size: 13px;
}

/* Community settings tabs */
.comm-settings-tab {
  background: none;
  border: none;
  color: #b5bac1;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.comm-settings-tab.active {
  color: #fff;
  border-bottom-color: #5865f2;
}

.comm-settings-category {
  display: none;
}

.comm-settings-category.active {
  display: block;
}

/* Pinned messages */
.pinned-list {
  max-height: 400px;
  overflow-y: auto;
}

.pinned-message-item {
  padding: 10px;
  background: #1a1a2e;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid #5865f2;
}

.pinned-message-item .message-text {
  color: #dcddde;
  font-size: 13px;
  margin-top: 4px;
}

/* Community channels view layout fix */
#community-channels-view {
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#community-channels-view .channel-list {
  flex: 1;
  overflow-y: auto;
}

/* Make community message display more Discord-like */
.message[data-msg-id] {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  align-items: flex-start;
}

.message[data-msg-id] .message-content {
  flex: 1;
  min-width: 0;
}

.message-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: 6px;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .member-actions { flex-direction: column; gap: 2px; }
  .role-select { font-size: 10px; }
  .channel-topic { display: none; }
}

/* ========== CONTEXT MENU ========== */

.ctx-menu {
  position: fixed;
  z-index: 99999;
  min-width: 200px;
  max-width: 280px;
  background: #111214;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.ctx-menu.ctx-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

.ctx-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: #dcddde;
  font-size: 13px;
  gap: 10px;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}

.ctx-item:hover {
  background: #5865f2;
  color: #fff;
}

.ctx-item.ctx-danger {
  color: #ed4245;
}

.ctx-item.ctx-danger:hover {
  background: #ed4245;
  color: #fff;
}

.ctx-icon {
  font-size: 15px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ctx-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctx-hint {
  font-size: 11px;
  color: #72767d;
  margin-left: auto;
  flex-shrink: 0;
}

.ctx-item:hover .ctx-hint {
  color: rgba(255,255,255,0.5);
}

.ctx-separator {
  height: 1px;
  background: #2a2a3a;
  margin: 4px 8px;
}

/* ========== TOAST ========== */

.ctx-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #18191c;
  color: #dcddde;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  border: 1px solid #2a2a3a;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ctx-toast.ctx-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hover highlight on messages for context menu */
.message[data-msg-id]:hover {
  background: rgba(255,255,255,0.02);
}

/* Category right-click cursor */
.channel-category-header {
  cursor: context-menu;
}

/* ========== NOTIFICATION BELL ========== */

.notif-bell-btn {
  background: none;
  border: none;
  color: #b5bac1;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.notif-bell-btn:hover {
  background: #2a2a3a;
  color: #fff;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ed4245;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid #1a1a2e;
}

/* ========== NOTIFICATION SETTINGS MODAL ========== */

.notif-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.notif-option + .notif-option {
  border-top: 1px solid #2a2a3a;
}

.notif-option-info {
  flex: 1;
  min-width: 0;
}

.notif-option-title {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.notif-option-desc {
  color: #72767d;
  font-size: 12px;
  line-height: 1.4;
}

.notif-permission-msg {
  font-size: 12px;
  padding: 4px 0;
  min-height: 16px;
}

/* ========== TOGGLE BUTTON ========== */

.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.toggle-track {
  display: flex;
  align-items: center;
  width: 44px;
  height: 24px;
  background: #4f545c;
  border-radius: 12px;
  padding: 2px;
  transition: background 0.2s ease;
  position: relative;
}

.toggle-thumb {
  display: block;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-btn.toggle-on .toggle-track {
  background: #5865f2;
}

.toggle-btn.toggle-on .toggle-thumb {
  transform: translateX(20px);
}

/* ========== IN-APP NOTIFICATION POPUPS ========== */

.notif-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
  width: 100%;
}

.notif-popup {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e1f22;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: all;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  cursor: default;
}

.notif-popup-visible {
  opacity: 1;
  transform: translateX(0);
}

.notif-popup-out {
  opacity: 0;
  transform: translateX(100%);
}

.notif-popup-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.notif-popup-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.notif-popup-title {
  font-weight: 600;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-popup-body {
  color: #b5bac1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.notif-popup-close {
  background: none;
  border: none;
  color: #72767d;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.notif-popup-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ========== COLOR DOT (for border options) ========== */

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
}

.rainbow-dot {
  background: linear-gradient(135deg, #ed4245, #fee75c, #57f287, #5865f2, #eb459e);
}

/* ========== ICON ALIGNMENT IN BUTTONS ========== */

.ctx-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pv-btn-icon {
  display: flex;
  align-items: center;
  gap: 6px;
}

.call-btn svg, .settings-icon svg, .mobile-settings-icon svg,
.community-settings-trigger svg, .community-back-btn svg,
.profile-back-btn svg, .profile-action-btn svg,
.image-btn svg, .pin-btn svg, .notif-bell-btn svg {
  display: block;
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.community-invite-btn, .community-members-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.channel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkmarks {
  display: inline-flex;
  align-items: center;
}

.checkmarks svg {
  display: block;
}

/* ========== LONG PRESS VISUAL FEEDBACK ========== */

.message[data-msg-id] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.conversation[data-ctx], .channel-item[data-ctx] {
  -webkit-touch-callout: none;
}

@media (max-width: 768px) {
  .notif-container {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
  .notif-popup {
    padding: 10px 12px;
  }
}

/* ========== COMMUNITY BANNER ========== */

.community-banner-area {
  position: relative;
  width: 100%;
  height: 100px;
  overflow: hidden;
  flex-shrink: 0;
}

.community-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-banner-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, #1a1a2e);
}

/* ========== UPGRADED COMMUNITY HEADER ========== */

.community-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.community-view-desc {
  font-size: 11px;
  color: #72767d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* ========== COLLAPSIBLE CATEGORIES ========== */

.channel-category-header {
  display: flex;
  align-items: center;
  padding: 10px 12px 4px;
  cursor: pointer;
  gap: 4px;
  user-select: none;
}

.channel-category-header:hover .channel-category-name {
  color: #dcddde;
}

.category-chevron {
  transition: transform 0.2s ease;
  color: #72767d;
  flex-shrink: 0;
}

.channel-category.collapsed .category-chevron {
  transform: rotate(-90deg);
}

.channel-category-name {
  font-size: 11px;
  font-weight: 700;
  color: #72767d;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex: 1;
  padding: 0;
}

.channel-category-count {
  font-size: 10px;
  color: #4f545c;
  background: #2a2a3a;
  border-radius: 8px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.channel-category-channels {
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 500px;
}

.channel-category.collapsed .channel-category-channels {
  max-height: 0;
}

/* ========== UPGRADED CHANNEL ITEMS ========== */

.channel-item {
  display: flex;
  align-items: center;
  padding: 7px 12px 7px 24px;
  margin: 1px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #72767d;
  font-size: 14px;
  gap: 8px;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  position: relative;
}

.channel-item:hover {
  background: rgba(255,255,255,0.04);
  color: #dcddde;
}

.channel-item.channel-active {
  background: rgba(88,101,242,0.15);
  color: #fff;
}

.channel-item.channel-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #5865f2;
  border-radius: 0 3px 3px 0;
}

.channel-item.channel-active .channel-icon {
  color: #5865f2;
}

.channel-icon {
  font-size: 16px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #72767d;
  transition: color 0.12s;
}

.channel-voice .channel-icon { color: #57f287; }
.channel-announcement .channel-icon { color: #fee75c; }

.channel-badge-voice {
  font-size: 9px;
  color: #57f287;
  background: rgba(87,242,135,0.1);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
  margin-left: auto;
}

/* ========== BANNER SETTINGS PREVIEW ========== */

.comm-banner-preview {
  width: 100%;
  height: 80px;
  background: #1a1a2e;
  border: 2px dashed #3a3a4a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.comm-banner-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comm-banner-placeholder {
  color: #4f545c;
  font-size: 13px;
}

.comm-banner-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ========== INLINE EDIT ========== */

.inline-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline-edit-input {
  width: 100%;
  background: #1a1a2e;
  border: 1px solid #5865f2;
  border-radius: 6px;
  color: #dcddde;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  outline: none;
}

.inline-edit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-edit-hint {
  font-size: 11px;
  color: #72767d;
  flex: 1;
}

.inline-edit-save, .inline-edit-cancel {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.inline-edit-save {
  color: #57f287;
}

.inline-edit-save:hover {
  background: rgba(87,242,135,0.15);
}

.inline-edit-cancel {
  color: #ed4245;
}

.inline-edit-cancel:hover {
  background: rgba(237,66,69,0.15);
}

/* ========== CHANNEL LIST SCROLL ========== */

.channel-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 8px;
  scroll-behavior: smooth;
}

.channel-list::-webkit-scrollbar {
  width: 4px;
}

.channel-list::-webkit-scrollbar-track {
  background: transparent;
}

.channel-list::-webkit-scrollbar-thumb {
  background: #2a2a3a;
  border-radius: 4px;
}

.channel-list::-webkit-scrollbar-thumb:hover {
  background: #3a3a4a;
}

/* ========== FIX TABS OVERFLOW (PENDING) ========== */

.tabs {
  display: flex;
  padding: 8px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== PROFILE IMAGE UPLOADS ========== */

.profile-img-upload-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-img-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  border: 2px solid #3a3a4a;
}

.profile-img-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-img-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
}

.profile-img-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-banner-img-preview {
  width: 100%;
  height: 72px;
  background: #1a1a2e;
  border: 2px dashed #3a3a4a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.profile-banner-img-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-banner-img-placeholder {
  color: #4f545c;
  font-size: 13px;
}

/* ========== PROFILE VIEWER AVATAR IMAGE ========== */

.pv-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-panel-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-avatar {
  overflow: hidden;
}

/* ========== MULTI-SELECT DELETE MODE ========== */

.delete-select-mode .message {
  padding-left: 36px;
  position: relative;
}

.delete-select-mode .message.mine {
  opacity: 1;
}

.delete-select-mode .message:not(.mine) {
  opacity: 0.4;
  pointer-events: none;
}

.msg-select-checkbox {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #72767d;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.msg-select-checkbox:hover {
  color: #dcddde;
}

.msg-select-checkbox.selected {
  color: #57f287;
}

/* ========== DELETE SELECT BAR ========== */

.delete-select-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e1f22;
  border: 1px solid #3a3a4a;
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 99997;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.delete-select-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.delete-bar-count {
  color: #b5bac1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.delete-bar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.delete-bar-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.delete-bar-delete {
  background: #ed4245;
  color: #fff;
}

.delete-bar-delete:hover {
  background: #c03537;
}

.delete-bar-cancel {
  background: #4f545c;
  color: #fff;
}

.delete-bar-cancel:hover {
  background: #5d6269;
}

/* ========== UX ENHANCEMENT PACK ========== */

:root {
  --font-scale: 1;
  --bg-a: #111315;
  --bg-b: #1a1f24;
  --surface-1: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text-1: #f4f7fb;
  --text-2: #a8b3c2;
  --accent: #5ea9ff;
  --accent-2: #43d1b0;
  --danger: #ff5d6c;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.35);
}

body {
  font-size: calc(14px * var(--font-scale));
  font-family: "Manrope", "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 900px at -5% -10%, #1f2733, transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, #102236, transparent 55%),
    linear-gradient(140deg, var(--bg-a), var(--bg-b));
  color: var(--text-1);
  transition: background 0.6s ease, color 0.35s ease;
}

body::before,
body::after {
  content: '';
  position: fixed;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  z-index: 0;
  opacity: 0.16;
  animation: ux-float 20s ease-in-out infinite;
}

body::before {
  top: -180px;
  left: -140px;
  background: #4ea1ff;
}

body::after {
  right: -140px;
  bottom: -220px;
  background: #38d5be;
  animation-delay: -8s;
}

@keyframes ux-float {
  0% { transform: translate(0, 0); }
  50% { transform: translate(24px, 18px); }
  100% { transform: translate(0, 0); }
}

#app, .ux-dock, .ux-cmd, .ux-shortcuts, .ux-stats, .ux-bookmarks, .ux-toast {
  position: relative;
  z-index: 1;
}

/* Keep functional overlays truly modal/fixed so clicks route correctly */
.modal {
  position: fixed !important;
  inset: 0;
  z-index: 2000;
}

.call-overlay {
  position: fixed !important;
  inset: 0;
  z-index: 5000;
}

.sidebar, .chat-area, .modal-content, .community-header, .user-panel, .input-area {
  backdrop-filter: blur(12px);
  background: linear-gradient(160deg, rgba(20, 24, 29, 0.86), rgba(18, 21, 26, 0.72));
  border: 1px solid var(--line);
}

.sidebar, .chat-area {
  box-shadow: var(--shadow-soft);
}

.conversation, .friend-request, .message, .channel-item, .tab, .add-btn, .primary-btn, .danger-btn, .small-btn {
  transition: transform 0.2s ease, background 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.conversation:hover, .friend-request:hover, .message:hover, .channel-item:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: linear-gradient(135deg, rgba(94, 169, 255, 0.2), rgba(67, 209, 176, 0.17));
  border: 1px solid rgba(94, 169, 255, 0.35);
}

.message {
  border-radius: 10px;
}

.message:hover {
  background: rgba(255, 255, 255, 0.04);
}

.message-text a {
  color: #82c4ff;
  text-decoration: none;
  border-bottom: 1px dotted rgba(130, 196, 255, 0.55);
}

.message-text a:hover {
  color: #b4ddff;
  border-bottom-style: solid;
}

.messages::-webkit-scrollbar,
.conversations::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 7px;
}

.messages::-webkit-scrollbar-thumb,
.conversations::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(153, 178, 205, 0.26);
  border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb:hover,
.conversations::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(153, 178, 205, 0.4);
}

/* Themes */
body[data-theme='graphite'] {
  --bg-a: #111315;
  --bg-b: #1a1f24;
  --accent: #5ea9ff;
  --accent-2: #43d1b0;
}

body[data-theme='ocean'] {
  --bg-a: #0a1a26;
  --bg-b: #122637;
  --accent: #48b8ff;
  --accent-2: #3be0c3;
}

body[data-theme='aurora'] {
  --bg-a: #171326;
  --bg-b: #221e33;
  --accent: #79a3ff;
  --accent-2: #5de3c8;
}

/* Modes */
body.focus-mode .sidebar {
  width: 76px;
}

body.focus-mode .sidebar .conversation-name,
body.focus-mode .sidebar .conversation-username,
body.focus-mode .sidebar .tab,
body.focus-mode .sidebar .user-info,
body.focus-mode .sidebar #add-friend-btn {
  opacity: 0;
  pointer-events: none;
}

body.compact-mode .conversation {
  min-height: 46px;
  padding: 8px 6px;
}

body.compact-mode .message {
  gap: 8px;
  margin-bottom: 3px;
}

body.compact-mode .message-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

body.zen-mode .chat-header,
body.zen-mode .input-area,
body.zen-mode .sidebar {
  opacity: 0.08;
  transition: opacity 0.25s ease;
}

body.zen-mode .chat-header:hover,
body.zen-mode .input-area:hover,
body.zen-mode .sidebar:hover {
  opacity: 1;
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 1ms !important;
  transition-duration: 1ms !important;
}

body.dock-hidden .ux-dock {
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
}

/* Floating dock */
.ux-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 9500;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.ux-dock-btn {
  background: linear-gradient(130deg, rgba(94, 169, 255, 0.22), rgba(67, 209, 176, 0.15));
  color: var(--text-1);
  border: 1px solid rgba(126, 189, 244, 0.4);
  border-radius: 12px;
  min-width: 86px;
  height: 38px;
  padding: 0 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ux-dock-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(130deg, rgba(94, 169, 255, 0.35), rgba(67, 209, 176, 0.25));
}

/* Command palette */
.ux-cmd {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  background: rgba(8, 10, 13, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9600;
}

.ux-cmd.open {
  display: flex;
}

.ux-cmd-card {
  width: min(720px, 92vw);
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(22, 27, 33, 0.98), rgba(15, 19, 24, 0.96));
  border: 1px solid rgba(165, 197, 226, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: ux-rise 0.22s ease;
}

@keyframes ux-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ux-cmd-input {
  width: 100%;
  height: 56px;
  border: 0;
  outline: 0;
  background: rgba(255, 255, 255, 0.03);
  color: #eaf3ff;
  padding: 0 16px;
  font-size: 16px;
}

.ux-cmd-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}

.ux-cmd-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d7e5f8;
  border: 1px solid transparent;
  border-radius: 10px;
  height: 40px;
  padding: 0 12px;
  cursor: pointer;
}

.ux-cmd-item:hover,
.ux-cmd-item[data-active='1'] {
  background: rgba(94, 169, 255, 0.12);
  border-color: rgba(94, 169, 255, 0.28);
}

/* Search bar */
.ux-searchbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.ux-searchbar input {
  flex: 1;
  height: 30px;
  border: 1px solid rgba(159, 183, 210, 0.26);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 0 10px;
  color: #e8f2ff;
}

.ux-searchbar button {
  height: 30px;
  border: 1px solid rgba(159, 183, 210, 0.28);
  background: rgba(255, 255, 255, 0.03);
  color: #cae0fb;
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
}

.ux-searchbar button:hover {
  background: rgba(94, 169, 255, 0.14);
}

/* Composer metrics */
.ux-composer-meta {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.ux-composer-meter {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ux-composer-meter > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.ux-composer-text {
  color: var(--text-2);
  font-size: 11px;
}

/* Conversation filter */
.ux-conv-filter {
  padding: 0 8px 8px;
}

.ux-conv-filter input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(159, 183, 210, 0.26);
  background: rgba(255, 255, 255, 0.03);
  color: #e8f2ff;
  padding: 0 10px;
}

/* Message states */
.ux-msg-enter {
  animation: ux-enter 0.28s ease both;
  animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes ux-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ux-hit {
  background: rgba(255, 223, 134, 0.2);
  border-radius: 6px;
}

.ux-hit-active {
  outline: 2px solid rgba(255, 223, 134, 0.8);
  box-shadow: 0 0 0 6px rgba(255, 223, 134, 0.18);
}

.ux-bookmarked {
  box-shadow: inset 3px 0 0 rgba(255, 200, 88, 0.95);
}

/* Scroll rail + progress */
.ux-scroll-rail {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 8px;
  z-index: 9490;
}

.ux-scroll-rail button {
  width: 62px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(159, 183, 210, 0.3);
  background: rgba(20, 25, 31, 0.8);
  color: #cee5ff;
  cursor: pointer;
}

.ux-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 9480;
}

.ux-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Overlays */
.ux-shortcuts,
.ux-stats,
.ux-bookmarks {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 12, 0.72);
  backdrop-filter: blur(4px);
  z-index: 9650;
}

.ux-shortcuts.open,
.ux-stats.open,
.ux-bookmarks.open {
  display: flex;
}

.ux-shortcuts-card,
.ux-stats-card,
.ux-bookmarks-card {
  width: min(760px, 92vw);
  max-height: 86vh;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(157, 189, 223, 0.24);
  background: linear-gradient(150deg, rgba(18, 23, 28, 0.95), rgba(14, 18, 23, 0.95));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  padding: 16px;
}

.ux-shortcuts-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.ux-shortcuts-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(157, 189, 223, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e1efff;
}

.ux-shortcuts-grid kbd {
  border: 1px solid rgba(157, 189, 223, 0.34);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
}

.ux-stats-head,
.ux-bookmark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ux-stats-head button,
.ux-bookmark-head button {
  border: 1px solid rgba(157, 189, 223, 0.28);
  background: rgba(255, 255, 255, 0.03);
  color: #d8e9ff;
  border-radius: 8px;
  height: 32px;
  padding: 0 12px;
  cursor: pointer;
}

.ux-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ux-stat-grid > div {
  border: 1px solid rgba(157, 189, 223, 0.2);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.ux-stat-grid strong {
  font-size: 28px;
}

.ux-stat-grid span {
  color: #aac2de;
  font-size: 12px;
}

.ux-density {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.ux-density span {
  color: #aac2de;
  font-size: 12px;
}

.ux-density > div {
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.ux-density i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.ux-bookmark-list {
  display: grid;
  gap: 8px;
}

.ux-bookmark-item {
  display: grid;
  text-align: left;
  gap: 4px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(157, 189, 223, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: #e5f1ff;
  padding: 10px 12px;
  cursor: pointer;
}

.ux-bookmark-item span {
  color: #9fbbd9;
  font-size: 11px;
}

.ux-bookmark-item p {
  color: #cadff9;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-empty {
  color: #9bb4d0;
  font-size: 13px;
  border: 1px dashed rgba(157, 189, 223, 0.22);
  border-radius: 10px;
  padding: 16px;
}

/* Toast */
.ux-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  border-radius: 10px;
  border: 1px solid rgba(157, 189, 223, 0.3);
  background: rgba(14, 18, 24, 0.94);
  color: #dbeafc;
  padding: 10px 14px;
  z-index: 9700;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.ux-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.typing-indicator {
  padding: 6px 16px 8px;
  color: #9fb4cb;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 920px) {
  .ux-scroll-rail {
    display: none;
  }

  .ux-dock {
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .ux-dock-btn {
    min-width: 74px;
    height: 34px;
    font-size: 12px;
  }

  .ux-stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .ux-searchbar {
    padding: 0 10px;
    gap: 6px;
    overflow-x: auto;
  }

  .ux-searchbar input {
    min-width: 140px;
  }

  .typing-indicator {
    padding: 5px 12px 6px;
  }
}

/* ========== CLEAN LAYOUT MODES ========== */

body.clean-layout .sidebar-header,
body.clean-layout .chat-header,
body.clean-layout .input-area,
body.clean-layout .user-panel {
  border-color: rgba(255, 255, 255, 0.08);
}

body.clean-layout .tabs {
  gap: 6px;
  padding: 10px;
}

body.clean-layout .tab {
  border-radius: 10px;
}

body.clean-layout .conversation {
  border-radius: 10px;
  margin-bottom: 6px;
}

body.clean-layout .message {
  border-radius: 12px;
}

body.clean-layout .message:hover {
  margin: 0 -8px;
  padding: 6px 8px;
}

body.compact-sidebar .sidebar {
  width: 210px;
}

body.dense-messages .messages {
  padding: 10px;
}

body.dense-messages .message {
  margin-bottom: 2px;
  padding: 2px 0;
}

body.dense-messages .message-avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

body.dense-messages .message-text {
  font-size: 13px;
}

body.bigger-input #message-input {
  min-height: 46px;
  border-radius: 12px;
}

@media (max-width: 768px) {
  body.compact-sidebar .sidebar {
    width: 100%;
  }

  body.clean-layout .chat-header {
    min-height: 52px;
    padding: 0 12px;
  }

  body.clean-layout .input-area {
    padding: 10px;
  }
}

/* ========== APP REVAMP OVERRIDES ========== */

#app {
  gap: 10px;
  padding: 10px;
  background: radial-gradient(1200px 600px at 5% 0%, rgba(72, 141, 255, 0.09), transparent 45%),
    radial-gradient(900px 500px at 95% 0%, rgba(65, 221, 184, 0.08), transparent 45%),
    linear-gradient(180deg, #101418, #0f1216);
}

.sidebar,
.chat-area {
  border-radius: 16px;
  overflow: hidden;
}

.sidebar {
  width: 280px;
}

.chat-header {
  min-height: 58px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.03);
}

.input-area {
  background: rgba(255, 255, 255, 0.02);
}

.messages {
  padding: 18px;
}

.conversation {
  border: 1px solid transparent;
}

.conversation:hover,
.conversation.active {
  border-color: rgba(131, 176, 229, 0.24);
}

.message {
  border: 1px solid transparent;
  padding: 6px 8px;
}

.message:hover {
  border-color: rgba(131, 176, 229, 0.18);
}

.auth-box,
.modal-content {
  border: 1px solid rgba(164, 196, 227, 0.18);
  border-radius: 14px;
}

body.high-contrast {
  --text-1: #ffffff;
  --text-2: #d7e6f7;
}

body.high-contrast .conversation-username,
body.high-contrast .message-time,
body.high-contrast .settings-desc {
  color: #c9dbef;
}

body.wide-layout .sidebar {
  width: 320px;
}

@media (max-width: 768px) {
  #app {
    padding: 0;
    gap: 0;
    background: #0f1216;
  }

  .sidebar,
  .chat-area {
    border-radius: 0;
  }

  .sidebar {
    width: 100%;
  }

  .messages {
    padding: 12px;
  }
}

/* ========== FULL LAYOUT REVAMP V3 ========== */

:root {
  --shell-gap: 12px;
  --shell-pad: 12px;
  --panel-bg: linear-gradient(170deg, rgba(19, 24, 30, 0.94), rgba(14, 18, 24, 0.92));
  --panel-border: rgba(155, 186, 219, 0.17);
  --panel-radius: 18px;
  --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#app {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  gap: var(--shell-gap);
  padding: var(--shell-pad);
}

.sidebar,
.chat-area {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
}

.sidebar {
  width: 100%;
}

.sidebar-header {
  padding: 14px;
}

.tabs {
  padding: 10px;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab {
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.chat-header {
  min-height: 62px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.messages {
  padding: 20px;
}

.message {
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 8px 10px;
}

.message:hover {
  border-color: rgba(120, 168, 221, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
}

.input-container {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(143, 179, 216, 0.2);
  border-radius: 14px;
  padding: 6px;
}

#message-input {
  background: transparent;
  border: none;
  box-shadow: none;
}

#message-input:focus {
  background: rgba(255, 255, 255, 0.02);
  border: none;
  box-shadow: none;
}

.conversation {
  border: 1px solid transparent;
  border-radius: 10px;
}

.conversation:hover,
.conversation.active {
  border-color: rgba(126, 170, 219, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.modal-content {
  border-radius: 16px;
  border: 1px solid rgba(160, 193, 226, 0.2);
}

/* Notification center */
.notif-center-content {
  max-width: 620px;
}

.notif-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.notif-center-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.notif-center-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.notif-filter-btn.active {
  background: #5865f2;
}

.notif-center-list {
  max-height: 52vh;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.notif-center-item {
  border: 1px solid rgba(151, 182, 216, 0.2);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.notif-center-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-center-title {
  font-size: 13px;
  font-weight: 700;
  color: #edf4ff;
}

.notif-center-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.notif-center-type.type-message {
  color: #95d4ff;
  background: rgba(88, 169, 255, 0.16);
  border-color: rgba(88, 169, 255, 0.35);
}

.notif-center-type.type-social {
  color: #8ff0c8;
  background: rgba(67, 209, 176, 0.16);
  border-color: rgba(67, 209, 176, 0.35);
}

.notif-center-type.type-call {
  color: #ffd18f;
  background: rgba(240, 178, 50, 0.16);
  border-color: rgba(240, 178, 50, 0.35);
}

.notif-center-type.type-system {
  color: #ff9fa8;
  background: rgba(237, 66, 69, 0.16);
  border-color: rgba(237, 66, 69, 0.35);
}

.notif-center-body {
  color: #c6d8ec;
  font-size: 12px;
  line-height: 1.35;
}

.notif-center-time {
  color: #8ea6bf;
  font-size: 11px;
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .sidebar,
  .chat-area {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .notif-center-content {
    max-width: 100%;
    width: 100%;
  }
}

/* ========== SITE REDESIGN V5 (GLOBAL CLEAN LAYOUT) ========== */

:root {
  --v5-bg-0: #0b1016;
  --v5-bg-1: #111824;
  --v5-bg-2: #17212f;
  --v5-surface-1: rgba(18, 25, 35, 0.92);
  --v5-surface-2: rgba(22, 31, 43, 0.92);
  --v5-line: rgba(159, 188, 221, 0.18);
  --v5-text-1: #eaf2fc;
  --v5-text-2: #9fb3c8;
  --v5-accent-1: #4ea2ff;
  --v5-accent-2: #39d2b2;
  --v5-danger: #ef5358;
  --v5-radius-xl: 20px;
  --v5-radius-lg: 14px;
  --v5-radius-md: 10px;
  --v5-shadow-lg: 0 26px 80px rgba(0, 0, 0, 0.45);
  --v5-shadow-md: 0 10px 34px rgba(0, 0, 0, 0.32);
}

body {
  color: var(--v5-text-1);
  background:
    radial-gradient(1100px 600px at -6% -12%, rgba(78, 162, 255, 0.18), transparent 50%),
    radial-gradient(900px 540px at 108% 0%, rgba(57, 210, 178, 0.15), transparent 48%),
    linear-gradient(170deg, var(--v5-bg-0), var(--v5-bg-1) 48%, var(--v5-bg-2));
}

/* Auth */
#register-screen,
#login-screen {
  background:
    radial-gradient(700px 400px at 12% 8%, rgba(78, 162, 255, 0.18), transparent 60%),
    radial-gradient(600px 360px at 92% 0%, rgba(57, 210, 178, 0.14), transparent 58%),
    linear-gradient(175deg, #0d131b, #0f1722 52%, #111b28);
}

.auth-box {
  background: linear-gradient(165deg, rgba(18, 26, 36, 0.96), rgba(14, 21, 31, 0.96));
  border: 1px solid var(--v5-line);
  border-radius: var(--v5-radius-xl);
  box-shadow: var(--v5-shadow-lg);
  padding: 28px;
}

.auth-box h1 {
  font-size: 26px;
  letter-spacing: 0.2px;
}

.auth-box input {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(159, 188, 221, 0.18);
  color: var(--v5-text-1);
}

.auth-box input:focus {
  border-color: rgba(78, 162, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(78, 162, 255, 0.18);
}

#register-btn,
#login-btn {
  border-radius: 10px;
  background: linear-gradient(120deg, #4a9eff, #46c9da);
  box-shadow: 0 8px 24px rgba(64, 159, 255, 0.28);
}

#register-btn:hover,
#login-btn:hover {
  background: linear-gradient(120deg, #5ba9ff, #55d7e7);
}

/* Shell */
#app {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  height: 100vh;
}

/* Override inline style set by JS login flow */
#app {
  display: grid !important;
}

.sidebar,
.chat-area {
  background: linear-gradient(165deg, var(--v5-surface-1), var(--v5-surface-2));
  border: 1px solid var(--v5-line);
  border-radius: var(--v5-radius-xl);
  box-shadow: var(--v5-shadow-md);
  overflow: hidden;
}

.sidebar {
  width: 100%;
}

.sidebar-header {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

#add-friend-btn {
  border-radius: 10px;
  border: 1px solid rgba(159, 188, 221, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

#add-friend-btn:hover {
  background: rgba(78, 162, 255, 0.1);
  border-color: rgba(78, 162, 255, 0.34);
}

.tabs {
  padding: 10px;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tab {
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #adc1d6;
}

.tab.active {
  background: linear-gradient(130deg, rgba(78, 162, 255, 0.26), rgba(57, 210, 178, 0.2));
  border: 1px solid rgba(115, 183, 248, 0.42);
  color: #f2f8ff;
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
}

.conversations {
  padding: 10px;
}

.conversation,
.friend-request,
.user-search-result {
  border-radius: var(--v5-radius-md);
  border: 1px solid transparent;
  background: transparent;
  margin-bottom: 6px;
}

.conversation:hover,
.conversation.active,
.friend-request:hover,
.user-search-result:hover {
  border-color: rgba(122, 176, 233, 0.26);
  background: rgba(255, 255, 255, 0.03);
}

.conversation-name,
.message-sender {
  color: #ecf4ff;
}

.conversation-username,
.message-time,
.settings-desc {
  color: var(--v5-text-2);
}

.user-panel {
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 12px;
}

.settings-icon,
.mobile-settings-icon {
  border-radius: 8px;
}

/* Chat */
.chat-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  min-height: 62px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

.messages {
  padding: 20px;
}

.message {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 10px;
}

.message:hover {
  border-color: rgba(122, 176, 233, 0.24);
  background: rgba(255, 255, 255, 0.03);
  margin: 0;
}

.message-text {
  color: #d8e7f7;
}

.input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  padding: 14px;
}

.input-container {
  border: 1px solid rgba(142, 181, 219, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px;
}

#message-input {
  border: none;
  box-shadow: none;
  background: transparent;
  color: #eaf3ff;
}

#message-input:focus {
  border: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.02);
}

.image-btn,
.call-btn,
.pin-btn,
.notif-bell-btn {
  border-radius: 10px;
}

/* Modal system */
.modal {
  background: rgba(4, 7, 10, 0.72);
  backdrop-filter: blur(6px);
}

.modal-content {
  background: linear-gradient(165deg, rgba(18, 25, 36, 0.98), rgba(14, 20, 31, 0.98));
  border: 1px solid rgba(159, 188, 221, 0.24);
  border-radius: 16px;
  box-shadow: var(--v5-shadow-lg);
}

.modal-actions button,
.primary-btn,
.add-btn,
.small-btn,
.danger-btn {
  border-radius: 10px;
}

/* Notification center harmony */
.notif-center-content {
  max-width: 700px;
}

/* Mobile */
@media (max-width: 980px) {
  #app {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .sidebar,
  .chat-area {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .sidebar {
    width: 100%;
  }
}

@media (max-width: 768px) {
  #app {
    height: 100dvh;
  }

  .chat-area {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
  }

  .chat-area.active,
  .chat-area.mobile-active {
    display: flex;
  }

  .sidebar.hidden {
    display: none;
  }

  .chat-header {
    min-height: 56px;
    padding: 0 12px;
  }

  .messages {
    padding: 12px;
  }

  .input-area {
    padding: 10px;
  }
}

/* ========== REFRESH UPDATE PACK (30 FEATURES) ========== */

.ru-update-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.ru-update-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.ru-update-card {
  width: min(920px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid rgba(118, 148, 193, 0.28);
  border-radius: 14px;
  background: linear-gradient(170deg, rgba(16, 24, 37, 0.98), rgba(13, 20, 32, 0.98));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.ru-update-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ru-update-head h2 {
  margin: 0;
  font-size: 22px;
  color: #f4f8ff;
}

#ru-close-update-x,
#ru-close-update,
#ru-enable-desktop-alerts {
  border: 1px solid rgba(140, 173, 219, 0.32);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #e7effa;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

#ru-close-update-x:hover,
#ru-close-update:hover,
#ru-enable-desktop-alerts:hover {
  background: rgba(95, 153, 240, 0.2);
  border-color: rgba(95, 153, 240, 0.5);
}

#ru-close-update-x:active,
#ru-close-update:active,
#ru-enable-desktop-alerts:active {
  transform: scale(0.98);
}

.ru-update-sub {
  color: #abc0d9;
  margin: 0 0 12px;
  font-size: 13px;
}

.ru-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ru-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid rgba(133, 165, 214, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  color: #dce8f6;
  font-size: 13px;
}

.ru-feature-item > span:first-child {
  color: #7fb4ff;
  font-weight: 700;
}

.ru-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ru-toggle-btn {
  border: 1px solid rgba(140, 173, 219, 0.3);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: #d9e8fb;
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.ru-toggle-btn.active {
  border-color: rgba(87, 242, 135, 0.52);
  background: rgba(87, 242, 135, 0.14);
}

.ru-update-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ru-send-btn {
  border: none;
  border-radius: 8px;
  background: linear-gradient(120deg, #4f8ff5, #46c2da);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  min-width: 76px;
  transition: filter 0.16s ease, transform 0.12s ease;
}

.ru-send-btn:hover {
  filter: brightness(1.07);
}

.ru-send-btn:active {
  transform: scale(0.98);
}

.ru-composer-meta {
  margin-top: 8px;
  color: #99b4d2;
  font-size: 12px;
}

.ru-template-bar {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ru-template-chip {
  border: 1px solid rgba(140, 173, 219, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #dbe9fb;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.ru-template-chip:hover {
  border-color: rgba(95, 153, 240, 0.5);
  background: rgba(95, 153, 240, 0.14);
}

.ru-keyword-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

#ru-keyword-input {
  flex: 1;
  border: 1px solid rgba(132, 161, 200, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #e9f2ff;
  padding: 8px 10px;
}

#ru-keyword-input:focus {
  outline: none;
  border-color: rgba(91, 150, 240, 0.56);
}

#ru-keyword-clear {
  border: 1px solid rgba(132, 161, 200, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #d5e4f7;
  padding: 8px 11px;
  cursor: pointer;
}

#ru-keyword-clear:hover {
  background: rgba(91, 150, 240, 0.15);
}

.ru-jump-latest {
  position: fixed;
  right: 18px;
  bottom: 88px;
  border: 1px solid rgba(130, 165, 210, 0.36);
  border-radius: 999px;
  background: rgba(15, 22, 33, 0.92);
  color: #ebf3ff;
  padding: 10px 14px;
  cursor: pointer;
  z-index: 1200;
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.ru-jump-latest.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ru-scroll-progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
}

.ru-scroll-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4d90f7, #46c2da);
  transition: width 0.08s linear;
}

.ru-header-tools {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.ru-chip {
  border: 1px solid rgba(140, 173, 219, 0.3);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: #d5e4f8;
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.ru-chip.offline {
  border-color: rgba(242, 63, 67, 0.45);
  color: #ffc8ca;
  background: rgba(242, 63, 67, 0.12);
}

.message.ru-filtered-out {
  display: none !important;
}

.message.ru-mention-hit {
  border-left: 2px solid rgba(87, 242, 135, 0.8);
  background: rgba(87, 242, 135, 0.08);
}

.message.ru-collapsed .message-avatar {
  opacity: 0;
}

.message.ru-collapsed .message-header .message-sender {
  font-size: 0;
}

.message.ru-collapsed .message-header .message-time,
.message.ru-collapsed .ru-rel-time {
  margin-left: 0;
}

.ru-rel-time {
  font-size: 10px;
  color: #7f99b6;
}

body.ru-hide-avatars .message-avatar {
  display: none;
}

body.ru-hide-avatars .message {
  gap: 0;
}

body.ru-hide-timestamps .message-time,
body.ru-hide-timestamps .ru-rel-time {
  display: none !important;
}

body.ru-dense-chat .message {
  margin-bottom: 4px;
  padding-top: 2px;
  padding-bottom: 2px;
}

body.ru-comfy-chat .message {
  margin-bottom: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

body.ru-bubble-lift .message {
  border: 1px solid rgba(127, 157, 202, 0.2);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

body.ru-bubble-lift .message:hover {
  border-color: rgba(127, 157, 202, 0.3);
}

body.ru-wide-text .message-content {
  max-width: min(900px, 98%);
}

body.ru-pack-reduced-motion *,
body.ru-pack-reduced-motion *::before,
body.ru-pack-reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (max-width: 900px) {
  .ru-feature-grid {
    grid-template-columns: 1fr;
  }

  .ru-toggle-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ru-jump-latest {
    right: 10px;
    bottom: 76px;
  }

  .ru-header-tools {
    display: none;
  }
}

/* ========== COMPLETE LAYOUT REVAMP LAYER ========== */

:root {
  --rev-bg-0: #06121b;
  --rev-bg-1: #0c1f2f;
  --rev-bg-2: #142b3f;
  --rev-panel: rgba(10, 22, 35, 0.82);
  --rev-panel-strong: rgba(11, 25, 40, 0.94);
  --rev-card: rgba(255, 255, 255, 0.035);
  --rev-card-strong: rgba(255, 255, 255, 0.07);
  --rev-line: rgba(150, 183, 218, 0.24);
  --rev-line-strong: rgba(150, 183, 218, 0.42);
  --rev-text-1: #ecf6ff;
  --rev-text-2: #b5cbe0;
  --rev-text-3: #8fa8c1;
  --rev-accent: #4eb8ff;
  --rev-accent-2: #41d7b7;
  --rev-danger: #ff6377;
  --rev-ok: #57f287;
  --rev-shadow-lg: 0 22px 58px rgba(0, 0, 0, 0.5);
  --rev-shadow-md: 0 12px 32px rgba(0, 0, 0, 0.34);
  --rev-radius-xl: 22px;
  --rev-radius-lg: 16px;
  --rev-radius-md: 12px;
}

body {
  font-family: "Sora", "Avenir Next", "Trebuchet MS", sans-serif !important;
  color: var(--rev-text-1) !important;
  background:
    radial-gradient(1000px 560px at -8% -20%, rgba(78, 184, 255, 0.22), transparent 54%),
    radial-gradient(820px 500px at 106% 6%, rgba(65, 215, 183, 0.18), transparent 52%),
    linear-gradient(165deg, var(--rev-bg-0) 0%, var(--rev-bg-1) 46%, var(--rev-bg-2) 100%) !important;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  filter: blur(0.2px);
}

body::before {
  width: 56vw;
  height: 56vw;
  left: -24vw;
  top: -24vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(78, 184, 255, 0.22), rgba(78, 184, 255, 0));
}

body::after {
  width: 48vw;
  height: 48vw;
  right: -20vw;
  bottom: -20vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(65, 215, 183, 0.16), rgba(65, 215, 183, 0));
}

#register-screen,
#login-screen {
  background:
    radial-gradient(760px 420px at 10% 0%, rgba(78, 184, 255, 0.16), transparent 62%),
    radial-gradient(780px 460px at 95% 12%, rgba(65, 215, 183, 0.14), transparent 58%),
    linear-gradient(172deg, #08131f, #0d1f32 58%, #13293e) !important;
}

.auth-box {
  border: 1px solid var(--rev-line) !important;
  border-radius: var(--rev-radius-xl) !important;
  background: linear-gradient(165deg, rgba(12, 25, 39, 0.96), rgba(10, 20, 32, 0.96)) !important;
  box-shadow: var(--rev-shadow-lg) !important;
}

.auth-box h1 {
  font-size: 26px !important;
  letter-spacing: 0.2px;
}

.auth-box input {
  border-radius: 11px !important;
  border: 1px solid rgba(148, 183, 221, 0.24) !important;
  background: rgba(255, 255, 255, 0.035) !important;
  color: var(--rev-text-1) !important;
}

.auth-box input:focus {
  border-color: rgba(78, 184, 255, 0.58) !important;
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.14) !important;
}

#register-btn,
#login-btn {
  border-radius: 11px !important;
  background: linear-gradient(120deg, #4aa9ff, #47d1bb) !important;
  box-shadow: 0 10px 24px rgba(57, 163, 255, 0.34) !important;
  color: #f7fbff !important;
}

#register-btn:hover,
#login-btn:hover {
  filter: brightness(1.06);
}

#app {
  display: grid !important;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) !important;
  gap: 14px !important;
  padding: 14px !important;
  height: 100vh !important;
  width: 100vw !important;
}

#app > .sidebar,
#app > .chat-area {
  min-height: 0;
  animation: rev-panel-in 0.42s ease both;
}

@keyframes rev-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sidebar,
.chat-area {
  border-radius: var(--rev-radius-xl) !important;
  border: 1px solid var(--rev-line) !important;
  background: linear-gradient(165deg, var(--rev-panel), var(--rev-panel-strong)) !important;
  box-shadow: var(--rev-shadow-md) !important;
}

.sidebar {
  width: 100% !important;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
}

.sidebar-header {
  padding: 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(8px);
}

#add-friend-btn,
#notif-bell-btn,
.mobile-settings-icon,
.settings-icon {
  border-radius: 10px !important;
  border: 1px solid rgba(143, 179, 219, 0.24) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #d9e8f8 !important;
}

#add-friend-btn:hover,
#notif-bell-btn:hover,
.mobile-settings-icon:hover,
.settings-icon:hover {
  border-color: rgba(78, 184, 255, 0.52) !important;
  background: rgba(78, 184, 255, 0.14) !important;
}

.tabs {
  padding: 10px !important;
  gap: 6px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

.tab {
  border-radius: 11px !important;
  border: 1px solid transparent !important;
  color: var(--rev-text-2) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px;
}

.tab.active {
  color: #f3f9ff !important;
  border-color: rgba(113, 175, 245, 0.46) !important;
  background: linear-gradient(125deg, rgba(78, 184, 255, 0.28), rgba(65, 215, 183, 0.2)) !important;
}

.tab:hover:not(.active) {
  color: #ebf4ff !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.conversations,
#community-channels-view {
  padding: 10px !important;
}

.conversation,
.friend-request,
.community-item,
.channel-item {
  border-radius: 14px !important;
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.02) !important;
  margin-bottom: 7px !important;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease !important;
}

.conversation:hover,
.friend-request:hover,
.community-item:hover,
.channel-item:hover {
  border-color: rgba(130, 171, 218, 0.34) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  transform: translateY(-1px);
}

.conversation.active,
.channel-item.active {
  border-color: rgba(78, 184, 255, 0.56) !important;
  background: linear-gradient(125deg, rgba(78, 184, 255, 0.2), rgba(65, 215, 183, 0.12)) !important;
}

.conversation-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05) inset !important;
}

.conversation-name,
.message-sender,
.user-name {
  color: var(--rev-text-1) !important;
}

.conversation-username,
.message-time,
.settings-desc,
.user-username {
  color: var(--rev-text-3) !important;
}

.user-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.035) !important;
  backdrop-filter: blur(10px);
}

.chat-area {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

.chat-header {
  min-height: 62px !important;
  padding: 0 18px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(10px);
}

#chat-title {
  font-size: 16px !important;
  font-weight: 700 !important;
}

.messages {
  padding: 16px 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    transparent !important;
}

.messages::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(150, 183, 218, 0.34);
}

.messages::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 183, 218, 0.52);
}

.message {
  border: 1px solid rgba(140, 176, 216, 0.18) !important;
  border-radius: var(--rev-radius-md) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  margin-bottom: 10px !important;
  padding: 9px 11px !important;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease !important;
}

.message:hover {
  border-color: rgba(140, 176, 216, 0.36) !important;
  background: rgba(255, 255, 255, 0.055) !important;
  transform: translateY(-1px);
  margin: 0 0 10px 0 !important;
  padding: 9px 11px !important;
}

.message-avatar {
  width: 38px !important;
  height: 38px !important;
}

.message-header {
  gap: 9px !important;
  margin-bottom: 5px !important;
}

.message-text {
  color: #d8e8f8 !important;
  line-height: 1.46 !important;
}

.message-image {
  border-radius: 11px !important;
  border: 1px solid rgba(145, 183, 226, 0.26);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.input-area {
  padding: 12px 14px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.input-container {
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(139, 175, 214, 0.27) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  padding: 6px !important;
}

.image-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(139, 175, 214, 0.27) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.image-btn:hover {
  background: rgba(78, 184, 255, 0.14) !important;
  border-color: rgba(78, 184, 255, 0.5) !important;
}

#message-input {
  padding: 11px 12px !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--rev-text-1) !important;
  font-size: 15px !important;
}

#message-input:focus {
  border-color: rgba(78, 184, 255, 0.56) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.12) !important;
}

.primary-btn,
.add-btn,
.danger-btn,
.small-btn,
.modal-actions button,
.modal-actions-btn {
  border-radius: 10px !important;
  border: 1px solid rgba(139, 175, 214, 0.28) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e6f1ff !important;
}

.primary-btn,
.add-btn {
  background: linear-gradient(120deg, #4aa9ff, #46d1bb) !important;
  border-color: rgba(70, 193, 221, 0.6) !important;
  color: #f8fbff !important;
  font-weight: 700;
}

.danger-btn,
.danger-small {
  background: linear-gradient(120deg, #ff6f7f, #ff8a60) !important;
  border-color: rgba(255, 138, 96, 0.58) !important;
  color: #fff5f6 !important;
}

.primary-btn:hover,
.add-btn:hover,
.danger-btn:hover,
.small-btn:hover,
.modal-actions button:hover {
  filter: brightness(1.07);
}

.modal {
  background: rgba(5, 10, 15, 0.74) !important;
  backdrop-filter: blur(8px);
}

.modal-content {
  border-radius: 18px !important;
  border: 1px solid rgba(145, 181, 221, 0.28) !important;
  background: linear-gradient(165deg, rgba(12, 24, 38, 0.97), rgba(10, 19, 31, 0.97)) !important;
  box-shadow: var(--rev-shadow-lg) !important;
  color: var(--rev-text-1) !important;
}

.modal-content h2 {
  color: #f1f8ff !important;
  letter-spacing: 0.2px;
}

.settings-modal-content,
.notif-center-content {
  max-width: 900px !important;
}

.settings-tabs {
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(145, 181, 221, 0.24) !important;
  padding: 6px !important;
}

.settings-tab,
.comm-settings-tab {
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  color: var(--rev-text-2) !important;
  font-weight: 700;
}

.settings-tab.active,
.comm-settings-tab.active {
  color: #f2f9ff !important;
  border-color: rgba(104, 170, 243, 0.45) !important;
  background: linear-gradient(120deg, rgba(78, 184, 255, 0.25), rgba(65, 215, 183, 0.18)) !important;
}

.settings-section,
.notif-option,
.channel-mgmt-item,
.member-mgmt-item,
.friend-pick-item,
.saved-item,
.pinned-message-item,
.notif-center-item {
  border-radius: 12px !important;
  border: 1px solid rgba(145, 181, 221, 0.2) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.settings-input,
select.settings-input,
textarea.settings-input,
#friend-search-input,
#group-name-input,
#community-name-input,
#community-desc-input,
#invite-code-input {
  border-radius: 10px !important;
  border: 1px solid rgba(145, 181, 221, 0.26) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #e7f2ff !important;
}

.settings-input:focus,
#friend-search-input:focus,
#group-name-input:focus,
#community-name-input:focus,
#community-desc-input:focus,
#invite-code-input:focus {
  border-color: rgba(78, 184, 255, 0.56) !important;
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.12) !important;
}

.ctx-menu {
  border-radius: 12px !important;
  border: 1px solid rgba(145, 181, 221, 0.3) !important;
  background: rgba(11, 22, 35, 0.96) !important;
  box-shadow: var(--rev-shadow-md) !important;
}

.call-overlay {
  background: rgba(4, 10, 15, 0.74) !important;
}

.call-card,
.call-active-card {
  border-radius: 20px !important;
  border: 1px solid rgba(145, 181, 221, 0.28) !important;
  background: linear-gradient(165deg, rgba(12, 24, 38, 0.98), rgba(10, 19, 31, 0.98)) !important;
  box-shadow: var(--rev-shadow-lg) !important;
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: minmax(270px, 310px) minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
  }
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  .chat-header {
    min-height: 58px !important;
    padding: 0 12px !important;
  }

  .messages {
    padding: 12px !important;
  }
}

@media (max-width: 768px) {
  #app {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
    height: 100dvh !important;
  }

  .sidebar,
  .chat-area {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }

  .sidebar {
    width: 100% !important;
    min-height: 100dvh;
  }

  .chat-area {
    position: fixed !important;
    inset: 0 !important;
    z-index: 120 !important;
    display: none !important;
  }

  .chat-area.active,
  .chat-area.mobile-active {
    display: grid !important;
  }

  .sidebar.hidden {
    display: none !important;
  }

  .input-container {
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
  }
}

/* ========== COMPLETE LAYOUT REVAMP LAYER V2 (NEO-PAPER) ========== */

:root {
  --rev2-ink: #121826;
  --rev2-paper: #fffdf7;
  --rev2-paper-soft: #f8f5ea;
  --rev2-panel: #ffffff;
  --rev2-line: #1f2937;
  --rev2-muted: #4b5563;
  --rev2-accent: #2563eb;
  --rev2-accent-2: #14b8a6;
  --rev2-hot: #f43f5e;
  --rev2-warn: #f59e0b;
}

body {
  font-family: "Manrope", "Segoe UI", "Trebuchet MS", sans-serif !important;
  color: var(--rev2-ink) !important;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(720px 420px at 100% 8%, rgba(20, 184, 166, 0.11), transparent 56%),
    repeating-linear-gradient(
      0deg,
      #f7f4ea 0px,
      #f7f4ea 28px,
      #f0ebdd 29px
    ) !important;
}

body::before,
body::after {
  content: none !important;
}

#register-screen,
#login-screen {
  background:
    linear-gradient(150deg, #f8f4e8 0%, #f2ecdc 48%, #ece5d3 100%) !important;
}

.auth-box {
  background: var(--rev2-panel) !important;
  border: 2px solid var(--rev2-line) !important;
  border-radius: 20px !important;
  box-shadow: 8px 8px 0 var(--rev2-line) !important;
}

.auth-box h1 {
  color: var(--rev2-ink) !important;
  font-weight: 900 !important;
  letter-spacing: 0.2px;
}

.auth-box input {
  border: 2px solid #cfd6e3 !important;
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
}

.auth-box input:focus {
  border-color: var(--rev2-accent) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

#register-btn,
#login-btn {
  background: var(--rev2-ink) !important;
  color: #f8fbff !important;
  border: 2px solid var(--rev2-ink) !important;
  border-radius: 12px !important;
  box-shadow: 4px 4px 0 #1f2937 !important;
}

#register-btn:hover,
#login-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 #1f2937 !important;
}

#app {
  display: grid !important;
  grid-template-columns: 320px minmax(0, 1fr) !important;
  gap: 20px !important;
  padding: 20px !important;
  height: 100vh !important;
  width: 100vw !important;
}

.sidebar,
.chat-area {
  background: var(--rev2-panel) !important;
  border: 2px solid var(--rev2-line) !important;
  border-radius: 22px !important;
  box-shadow: 10px 10px 0 var(--rev2-line) !important;
  color: var(--rev2-ink) !important;
}

.sidebar {
  width: 100% !important;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
}

.sidebar-header {
  background: linear-gradient(180deg, #ffffff, #f4f8ff) !important;
  border-bottom: 2px solid var(--rev2-line) !important;
  padding: 10px !important;
}

#add-friend-btn,
#notif-bell-btn,
.mobile-settings-icon,
.settings-icon {
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
  border: 2px solid var(--rev2-line) !important;
  border-radius: 12px !important;
  box-shadow: 3px 3px 0 var(--rev2-line) !important;
}

#add-friend-btn:hover,
#notif-bell-btn:hover,
.mobile-settings-icon:hover,
.settings-icon:hover {
  background: #eaf1ff !important;
  transform: translate(-1px, -1px);
}

.tabs {
  padding: 10px !important;
  gap: 8px !important;
  border-bottom: 2px dashed #c7d2e5 !important;
  background: #f9fbff !important;
}

.tab {
  border: 2px solid transparent !important;
  border-radius: 12px !important;
  color: var(--rev2-muted) !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase;
}

.tab.active {
  color: #ffffff !important;
  border-color: var(--rev2-line) !important;
  background: var(--rev2-ink) !important;
}

.tab:hover:not(.active) {
  color: var(--rev2-ink) !important;
  border-color: #c8d2e6 !important;
  background: #ffffff !important;
}

.conversations,
#community-channels-view {
  padding: 10px !important;
}

.conversation,
.friend-request,
.community-item,
.channel-item {
  border: 2px solid #d7dfec !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  margin-bottom: 8px !important;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.08);
}

.conversation:hover,
.friend-request:hover,
.community-item:hover,
.channel-item:hover {
  border-color: #8ea6d3 !important;
  background: #f7faff !important;
}

.conversation.active,
.channel-item.active {
  border-color: var(--rev2-line) !important;
  background: linear-gradient(120deg, #e9f1ff, #e2fff8) !important;
  box-shadow: 4px 4px 0 var(--rev2-line) !important;
}

.conversation-name,
.message-sender,
.user-name,
#chat-title {
  color: var(--rev2-ink) !important;
}

.conversation-username,
.message-time,
.settings-desc,
.user-username {
  color: var(--rev2-muted) !important;
}

.user-panel {
  background: #f9fbff !important;
  border-top: 2px solid var(--rev2-line) !important;
}

.chat-area {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
}

.chat-header {
  min-height: 64px !important;
  border-bottom: 2px solid var(--rev2-line) !important;
  background:
    linear-gradient(90deg, #ffffff, #f3f8ff 55%, #eefcf8) !important;
  padding: 0 18px !important;
}

.messages {
  padding: 16px !important;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(31, 41, 55, 0.03) 0px,
      rgba(31, 41, 55, 0.03) 1px,
      transparent 1px,
      transparent 34px
    ),
    var(--rev2-paper) !important;
}

.messages::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 11px;
}

.messages::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: #b2bfd8 !important;
  border: 2px solid #eef2f8;
  border-radius: 999px;
}

.message {
  border: 2px solid var(--rev2-line) !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 4px 4px 0 var(--rev2-line) !important;
  padding: 10px 12px !important;
  margin-bottom: 11px !important;
}

.message:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--rev2-line) !important;
  margin: 0 0 11px 0 !important;
  padding: 10px 12px !important;
}

.message-avatar {
  width: 36px !important;
  height: 36px !important;
  border: 2px solid var(--rev2-line);
}

.message-text {
  color: #1f2937 !important;
  line-height: 1.5 !important;
}

.message-image {
  border: 2px solid var(--rev2-line) !important;
  border-radius: 10px !important;
  box-shadow: 4px 4px 0 rgba(17, 24, 39, 0.35);
}

.message.ru-mention-hit {
  background: #fff8d9 !important;
  border-left: 6px solid var(--rev2-warn) !important;
}

.input-area {
  border-top: 2px solid var(--rev2-line) !important;
  background: linear-gradient(180deg, #ffffff, #f5f9ff) !important;
  padding: 12px !important;
}

.input-container {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 8px;
  background: #ffffff !important;
  border: 2px solid var(--rev2-line) !important;
  border-radius: 14px !important;
  box-shadow: 4px 4px 0 var(--rev2-line) !important;
  padding: 7px !important;
}

.image-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  border: 2px solid var(--rev2-line) !important;
  background: #f5f9ff !important;
  color: var(--rev2-ink) !important;
}

.image-btn:hover {
  background: #e5eeff !important;
}

#message-input {
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
  border: 2px solid transparent !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

#message-input:focus {
  border-color: var(--rev2-accent) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}

.primary-btn,
.add-btn,
.danger-btn,
.small-btn,
.modal-actions button,
.modal-actions-btn {
  border: 2px solid var(--rev2-line) !important;
  border-radius: 11px !important;
  box-shadow: 3px 3px 0 var(--rev2-line) !important;
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
  font-weight: 800 !important;
}

.primary-btn,
.add-btn {
  background: #dbeafe !important;
}

.danger-btn,
.danger-small {
  background: #ffe1e7 !important;
  color: #7f1d1d !important;
}

.primary-btn:hover,
.add-btn:hover,
.danger-btn:hover,
.small-btn:hover,
.modal-actions button:hover {
  transform: translate(-1px, -1px);
}

.modal {
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--rev2-panel) !important;
  color: var(--rev2-ink) !important;
  border: 2px solid var(--rev2-line) !important;
  border-radius: 18px !important;
  box-shadow: 9px 9px 0 var(--rev2-line) !important;
}

.modal-content h2 {
  color: var(--rev2-ink) !important;
  font-weight: 900;
}

.settings-tabs {
  border: 2px solid #d4ddec !important;
  background: #f7faff !important;
  border-radius: 12px !important;
}

.settings-tab,
.comm-settings-tab {
  border: 2px solid transparent !important;
  border-radius: 9px !important;
  color: var(--rev2-muted) !important;
}

.settings-tab.active,
.comm-settings-tab.active {
  border-color: var(--rev2-line) !important;
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
}

.settings-section,
.notif-option,
.channel-mgmt-item,
.member-mgmt-item,
.friend-pick-item,
.saved-item,
.pinned-message-item,
.notif-center-item {
  border: 2px solid #d7dfec !important;
  border-radius: 12px !important;
  background: #ffffff !important;
}

.settings-input,
select.settings-input,
textarea.settings-input,
#friend-search-input,
#group-name-input,
#community-name-input,
#community-desc-input,
#invite-code-input {
  border: 2px solid #d1dae9 !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
}

.settings-input:focus,
#friend-search-input:focus,
#group-name-input:focus,
#community-name-input:focus,
#community-desc-input:focus,
#invite-code-input:focus {
  border-color: var(--rev2-accent) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}

.ctx-menu {
  border: 2px solid var(--rev2-line) !important;
  border-radius: 12px !important;
  box-shadow: 6px 6px 0 var(--rev2-line) !important;
  background: #ffffff !important;
  color: var(--rev2-ink) !important;
}

.call-overlay {
  background: rgba(17, 24, 39, 0.35) !important;
}

.call-card,
.call-active-card {
  border: 2px solid var(--rev2-line) !important;
  border-radius: 20px !important;
  background: #ffffff !important;
  box-shadow: 9px 9px 0 var(--rev2-line) !important;
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 12px !important;
  }
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) !important;
    gap: 9px !important;
    padding: 9px !important;
  }
}

@media (max-width: 768px) {
  #app {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
    height: 100dvh !important;
  }

  .sidebar,
  .chat-area {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }

  .sidebar {
    width: 100% !important;
    min-height: 100dvh;
  }

  .chat-area {
    position: fixed !important;
    inset: 0 !important;
    z-index: 120 !important;
    display: none !important;
  }

  .chat-area.active,
  .chat-area.mobile-active {
    display: grid !important;
  }

  .sidebar.hidden {
    display: none !important;
  }
}

/* ========== MOBILE HARDENING LAYER ========== */
@media (max-width: 768px) {
  html,
  body {
    height: 100dvh;
  }

  #app {
    height: 100dvh !important;
    padding: 0 !important;
  }

  .workspace-panel {
    display: none !important;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(15, 24, 39, 0.92) !important;
    backdrop-filter: blur(10px);
  }

  .tabs {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 35;
    background: rgba(14, 22, 35, 0.95) !important;
  }

  .tab {
    min-height: 44px;
    display: flex !important;
    align-items: center;
  }

  .sidebar-content-switcher {
    height: calc(100dvh - 132px - env(safe-area-inset-top));
    overflow-y: auto;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .conversation,
  .friend-request,
  .community-item,
  .channel-item {
    min-height: 56px;
  }

  .chat-area {
    inset: 0 !important;
    min-height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }

  .chat-header {
    min-height: calc(56px + env(safe-area-inset-top)) !important;
    padding-top: calc(6px + env(safe-area-inset-top)) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .messages {
    padding: 10px 12px !important;
  }

  .input-area {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
  }

  .input-container {
    grid-template-columns: 40px minmax(0, 1fr) auto !important;
  }

  #message-input,
  .settings-input,
  #friend-search-input,
  #group-name-input,
  #community-name-input,
  #community-desc-input,
  #invite-code-input {
    font-size: 16px !important;
  }

  .home-screen {
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom)) !important;
  }

  .home-grid {
    grid-template-columns: 1fr !important;
  }

  .modal {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
  }

  .modal-content {
    width: min(96vw, 720px) !important;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  }

  .profile-panel {
    z-index: 3000;
  }
}

/* ========== REVAMP POLISH FIXES + HOME SCREEN ========== */

.app-topbar-actions {
  min-width: 0;
}

.app-topbar-left #add-friend-btn,
.app-topbar-actions #add-friend-btn,
.app-topbar-actions #notif-bell-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.sidebar-content-switcher,
.sidebar-content-switcher > .tab-content,
.sidebar-content-switcher > #community-channels-view {
  min-height: 0;
}

.home-screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  overflow: auto;
  background:
    radial-gradient(600px 320px at -6% -20%, rgba(64, 162, 255, 0.14), transparent 62%),
    radial-gradient(520px 300px at 106% -4%, rgba(54, 212, 195, 0.11), transparent 58%),
    linear-gradient(165deg, rgba(10, 16, 25, 0.9), rgba(13, 22, 34, 0.92));
}

.chat-area.home-active .home-screen {
  display: flex;
}

.chat-area.home-active .messages {
  display: none !important;
}

.chat-area.home-active .typing-indicator {
  display: none !important;
}

.home-hero {
  border: 1px solid rgba(153, 188, 235, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.home-hero h2 {
  margin: 0 0 6px;
  color: #f1f8ff;
  font-size: 22px;
  font-weight: 700;
}

.home-hero p {
  margin: 0;
  color: #b3c7df;
  font-size: 13px;
  line-height: 1.45;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-card-btn {
  text-align: left;
  border: 1px solid rgba(153, 188, 235, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #e8f2ff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.home-card-btn:hover {
  border-color: rgba(64, 162, 255, 0.56);
  background: rgba(64, 162, 255, 0.12);
  transform: translateY(-1px);
}

.home-card-title {
  display: block;
  color: #f2f8ff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.home-card-desc {
  display: block;
  color: #a7bed9;
  font-size: 12px;
  line-height: 1.4;
}

/* Patch remaining white surfaces from previous layers */
.workspace-card,
.user-search-result,
.friend-pick-item,
.group-friend-picker .friend-pick-item,
.saved-item,
.pinned-message-item,
.notif-center-item,
.settings-section,
.notif-option,
.channel-mgmt-item,
.member-mgmt-item {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(149, 184, 229, 0.24) !important;
  color: #e8f2ff !important;
}

.workspace-card h3,
.workspace-card p,
.notif-center-title,
.notif-center-body,
.notif-center-time {
  color: #d9e9fb !important;
}

.settings-input,
select.settings-input,
textarea.settings-input,
#friend-search-input,
#group-name-input,
#community-name-input,
#community-desc-input,
#invite-code-input {
  background: rgba(255, 255, 255, 0.03) !important;
  color: #e7f2ff !important;
}

@media (max-width: 980px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== COMPLETE LAYOUT REVAMP LAYER V3 (RESTRUCTURED SHELL) ========== */

:root {
  --rev3-bg-0: #070b12;
  --rev3-bg-1: #0f1724;
  --rev3-bg-2: #121f33;
  --rev3-panel: #0f1827;
  --rev3-panel-soft: #172338;
  --rev3-border: rgba(162, 193, 239, 0.24);
  --rev3-border-strong: rgba(162, 193, 239, 0.42);
  --rev3-text: #e6f0ff;
  --rev3-muted: #9eb0ca;
  --rev3-accent: #40a2ff;
  --rev3-accent-2: #36d4c3;
  --rev3-danger: #ff6d82;
  --rev3-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
}

body {
  font-family: "Outfit", "Segoe UI", sans-serif !important;
  color: var(--rev3-text) !important;
  background:
    radial-gradient(760px 420px at -6% -10%, rgba(64, 162, 255, 0.24), transparent 58%),
    radial-gradient(760px 460px at 108% 10%, rgba(54, 212, 195, 0.18), transparent 58%),
    linear-gradient(160deg, var(--rev3-bg-0), var(--rev3-bg-1) 44%, var(--rev3-bg-2)) !important;
}

body::before,
body::after {
  content: none !important;
}

#register-screen,
#login-screen {
  background:
    linear-gradient(165deg, #09101a, #121d2e 55%, #18263d) !important;
}

.auth-box {
  background: linear-gradient(170deg, rgba(13, 22, 36, 0.97), rgba(11, 19, 31, 0.97)) !important;
  border: 1px solid var(--rev3-border-strong) !important;
  border-radius: 18px !important;
  box-shadow: var(--rev3-shadow) !important;
}

.auth-box h1 {
  color: #eff6ff !important;
  font-weight: 700 !important;
}

.auth-box input {
  background: rgba(255, 255, 255, 0.035) !important;
  border: 1px solid rgba(151, 183, 227, 0.24) !important;
  color: #e8f2ff !important;
  border-radius: 10px !important;
}

.auth-box input:focus {
  border-color: rgba(64, 162, 255, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(64, 162, 255, 0.14) !important;
}

#register-btn,
#login-btn {
  background: linear-gradient(120deg, #4097ff, #35c8d9) !important;
  border: 1px solid rgba(103, 177, 255, 0.7) !important;
  color: #f7fbff !important;
  border-radius: 10px !important;
}

#app {
  display: grid !important;
  grid-template-columns: 290px minmax(0, 1fr) 280px !important;
  grid-template-areas: "sidebar chat utility" !important;
  gap: 12px !important;
  padding: 12px !important;
  height: 100vh !important;
  width: 100vw !important;
}

.sidebar {
  grid-area: sidebar !important;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  border: 1px solid var(--rev3-border) !important;
  border-radius: 18px !important;
  background: linear-gradient(170deg, rgba(13, 23, 37, 0.95), rgba(12, 20, 32, 0.95)) !important;
  box-shadow: var(--rev3-shadow) !important;
  width: 100% !important;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-wordmark {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wordmark-main {
  color: #f0f7ff;
  font-size: 13px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 800;
  line-height: 1.1;
}

.wordmark-sub {
  color: var(--rev3-muted);
  font-size: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#add-friend-btn,
#notif-bell-btn,
.mobile-settings-icon,
.settings-icon {
  border: 1px solid rgba(154, 188, 234, 0.3) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.035) !important;
  color: #deecff !important;
}

#add-friend-btn:hover,
#notif-bell-btn:hover,
.mobile-settings-icon:hover,
.settings-icon:hover {
  border-color: rgba(64, 162, 255, 0.56) !important;
  background: rgba(64, 162, 255, 0.13) !important;
}

#add-friend-btn {
  padding: 9px 11px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  flex: 0 0 auto !important;
}

.tabs {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 6px !important;
  padding: 10px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.tab {
  width: 100% !important;
  text-align: left !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  color: var(--rev3-muted) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px;
  padding: 10px 12px !important;
  background: transparent !important;
}

.tab.active {
  color: #eff7ff !important;
  border-color: rgba(64, 162, 255, 0.5) !important;
  background: linear-gradient(120deg, rgba(64, 162, 255, 0.2), rgba(54, 212, 195, 0.14)) !important;
}

.tab:hover:not(.active) {
  color: #e6f1ff !important;
  border-color: rgba(150, 185, 231, 0.3) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.conversations,
#community-channels-view {
  padding: 10px !important;
}

.sidebar-content-switcher {
  min-height: 0;
  overflow: hidden;
  display: block;
}

.sidebar-content-switcher > .tab-content {
  height: 100%;
  overflow-y: auto;
}

.sidebar-content-switcher > .tab-content:not(.active-tab) {
  display: none !important;
}

.sidebar-content-switcher > #community-channels-view {
  height: 100%;
  overflow-y: auto;
}

.conversation,
.friend-request,
.community-item,
.channel-item {
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  margin-bottom: 7px !important;
}

.conversation:hover,
.friend-request:hover,
.community-item:hover,
.channel-item:hover {
  border-color: rgba(152, 188, 236, 0.35) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.conversation.active,
.channel-item.active {
  border-color: rgba(64, 162, 255, 0.56) !important;
  background: linear-gradient(120deg, rgba(64, 162, 255, 0.2), rgba(54, 212, 195, 0.14)) !important;
}

.conversation-name,
.message-sender,
.user-name {
  color: #eaf4ff !important;
}

.conversation-username,
.message-time,
.settings-desc,
.user-username {
  color: var(--rev3-muted) !important;
}

.chat-area {
  grid-area: chat !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  border: 1px solid var(--rev3-border) !important;
  border-radius: 18px !important;
  background: linear-gradient(170deg, rgba(13, 22, 36, 0.94), rgba(12, 20, 32, 0.94)) !important;
  box-shadow: var(--rev3-shadow) !important;
  overflow: hidden !important;
}

.chat-header {
  min-height: 62px !important;
  padding: 0 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: rgba(255, 255, 255, 0.025) !important;
}

#chat-title {
  color: #eef6ff !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

.messages {
  padding: 14px 16px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    transparent !important;
}

.messages::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(157, 188, 230, 0.36);
}

.message {
  border: 1px solid rgba(149, 184, 229, 0.24) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  padding: 9px 10px !important;
  margin-bottom: 9px !important;
}

.message:hover {
  border-color: rgba(149, 184, 229, 0.42) !important;
  background: rgba(255, 255, 255, 0.055) !important;
  margin: 0 0 9px 0 !important;
  padding: 9px 10px !important;
}

.message-avatar {
  width: 36px !important;
  height: 36px !important;
}

.message-text {
  color: #d8e8fb !important;
}

.message-image {
  border: 1px solid rgba(149, 184, 229, 0.3) !important;
  border-radius: 10px !important;
}

.input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  padding: 11px 12px !important;
}

.input-container {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
  background: rgba(255, 255, 255, 0.025) !important;
  border: 1px solid rgba(149, 184, 229, 0.3) !important;
  border-radius: 12px !important;
  padding: 6px !important;
}

.image-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 9px !important;
  border: 1px solid rgba(149, 184, 229, 0.28) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

#message-input {
  border-radius: 9px !important;
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.02) !important;
  color: #e7f2ff !important;
}

#message-input:focus {
  border-color: rgba(64, 162, 255, 0.58) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 0 0 3px rgba(64, 162, 255, 0.14) !important;
}

.workspace-panel {
  grid-area: utility !important;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--rev3-border) !important;
  border-radius: 18px !important;
  background: linear-gradient(170deg, rgba(13, 22, 36, 0.94), rgba(12, 20, 32, 0.94)) !important;
  box-shadow: var(--rev3-shadow) !important;
  overflow: hidden;
}

.workspace-panel-scroll {
  padding: 10px;
  overflow: auto;
}

.workspace-card {
  border: 1px solid rgba(149, 184, 229, 0.24);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 10px;
}

.workspace-card h3 {
  margin: 0 0 7px;
  color: #eef6ff;
  font-size: 14px;
}

.workspace-card p {
  margin: 0;
  color: var(--rev3-muted);
  font-size: 12px;
  line-height: 1.45;
}

.user-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.primary-btn,
.add-btn,
.small-btn,
.danger-btn,
.modal-actions button,
.modal-actions-btn {
  border-radius: 10px !important;
  border: 1px solid rgba(149, 184, 229, 0.3) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e7f2ff !important;
}

.primary-btn,
.add-btn {
  background: linear-gradient(120deg, #4097ff, #35c8d9) !important;
  color: #f8fbff !important;
  border-color: rgba(110, 185, 255, 0.65) !important;
}

.danger-btn,
.danger-small {
  background: linear-gradient(120deg, #ff6d82, #ff8b63) !important;
  border-color: rgba(255, 145, 112, 0.64) !important;
}

.modal {
  background: rgba(4, 8, 13, 0.76) !important;
  backdrop-filter: blur(8px);
}

.modal-content {
  border-radius: 16px !important;
  border: 1px solid var(--rev3-border-strong) !important;
  background: linear-gradient(170deg, rgba(13, 22, 36, 0.98), rgba(12, 20, 32, 0.98)) !important;
  color: #e8f2ff !important;
}

.settings-tabs {
  border-radius: 12px !important;
  border: 1px solid rgba(149, 184, 229, 0.25) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.settings-tab,
.comm-settings-tab {
  border-radius: 9px !important;
  border: 1px solid transparent !important;
  color: var(--rev3-muted) !important;
}

.settings-tab.active,
.comm-settings-tab.active {
  border-color: rgba(64, 162, 255, 0.5) !important;
  background: linear-gradient(120deg, rgba(64, 162, 255, 0.2), rgba(54, 212, 195, 0.14)) !important;
  color: #eff7ff !important;
}

.settings-section,
.notif-option,
.channel-mgmt-item,
.member-mgmt-item,
.friend-pick-item,
.saved-item,
.pinned-message-item,
.notif-center-item {
  border: 1px solid rgba(149, 184, 229, 0.22) !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

.settings-input,
select.settings-input,
textarea.settings-input,
#friend-search-input,
#group-name-input,
#community-name-input,
#community-desc-input,
#invite-code-input {
  border-radius: 9px !important;
  border: 1px solid rgba(149, 184, 229, 0.25) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #e7f2ff !important;
}

.settings-input:focus,
#friend-search-input:focus,
#group-name-input:focus,
#community-name-input:focus,
#community-desc-input:focus,
#invite-code-input:focus {
  border-color: rgba(64, 162, 255, 0.56) !important;
  box-shadow: 0 0 0 3px rgba(64, 162, 255, 0.14) !important;
}

.ctx-menu {
  border-radius: 12px !important;
  border: 1px solid rgba(149, 184, 229, 0.34) !important;
  background: rgba(12, 20, 31, 0.97) !important;
  color: #e7f2ff !important;
}

@media (max-width: 1280px) {
  #app {
    grid-template-columns: 270px minmax(0, 1fr) 240px !important;
  }
}

@media (max-width: 1024px) {
  #app {
    grid-template-columns: 260px minmax(0, 1fr) !important;
    grid-template-areas: "sidebar chat" !important;
  }

  .workspace-panel {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #app {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
    height: 100dvh !important;
  }

  .workspace-panel {
    display: none !important;
  }

  .sidebar,
  .chat-area {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }

  .sidebar {
    width: 100% !important;
    min-height: 100dvh;
  }

  .chat-area {
    position: fixed !important;
    inset: 0 !important;
    z-index: 120 !important;
    display: none !important;
  }

  .chat-area.active,
  .chat-area.mobile-active {
    display: grid !important;
  }

  .sidebar.hidden {
    display: none !important;
  }
}

/* ========== MOBILE EOF LOCK V2 (ABSOLUTE LAST) ========== */
@media (max-width: 768px) {
  html,
  body {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    position: relative !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  #app {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
  }

  .workspace-panel {
    display: none !important;
  }

  .sidebar {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }

  .app-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    min-height: calc(56px + env(safe-area-inset-top)) !important;
    padding-top: calc(8px + env(safe-area-inset-top)) !important;
  }

  .tabs {
    position: sticky !important;
    top: calc(56px + env(safe-area-inset-top)) !important;
    z-index: 45 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding: 8px 10px !important;
  }

  .tab {
    flex: 0 0 auto !important;
    min-width: 92px !important;
    min-height: 42px !important;
    text-align: center !important;
  }

  .sidebar-content-switcher {
    height: calc(100dvh - 120px - env(safe-area-inset-top)) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .chat-area {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    z-index: 120 !important;
    display: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    overflow: hidden !important;
  }

  .chat-area.active,
  .chat-area.mobile-active {
    display: grid !important;
  }

  .chat-header {
    min-height: calc(56px + env(safe-area-inset-top)) !important;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px !important;
  }

  #chat-title {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  .messages {
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .input-area {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 3 !important;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
  }

  #message-input,
  .settings-input,
  #friend-search-input,
  #group-name-input,
  #community-name-input,
  #community-desc-input,
  #invite-code-input {
    font-size: 16px !important;
  }

  .home-grid {
    grid-template-columns: 1fr !important;
  }

  .modal {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
  }

  .modal-content {
    width: min(96vw, 680px) !important;
    max-height: calc(100dvh - 18px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
  }

  .profile-panel {
    width: 100% !important;
    height: 100dvh !important;
    z-index: 3000 !important;
  }

  .sidebar.hidden {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .wordmark-sub {
    display: none !important;
  }

  #add-friend-btn {
    padding: 8px 10px !important;
    font-size: 11px !important;
  }
}

/* ========== PROFILE SETTINGS REVAMP ========== */
#settings-profile {
  padding: 0 !important;
}

.profile-settings-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.profile-settings-main {
  display: grid;
  gap: 12px;
}

.profile-settings-card {
  padding: 14px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(152, 186, 232, 0.3) !important;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02)) !important;
}

.profile-settings-card h3 {
  margin: 0 0 6px !important;
  font-size: 14px !important;
  letter-spacing: 0.2px;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.profile-field {
  min-width: 0;
}

.profile-field-full {
  grid-column: 1 / -1;
}

.profile-field-label {
  display: block;
  color: #b7c9df;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-media-block {
  border: 1px solid rgba(149, 184, 229, 0.22);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.profile-media-block h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #d9e9fd;
}

.profile-upload-btn {
  cursor: pointer;
}

.profile-banner-btns {
  margin-top: 8px;
}

.profile-inline-block {
  margin-top: 10px;
}

.profile-style-list {
  display: grid;
  gap: 10px;
}

.profile-style-row {
  display: grid;
  gap: 6px;
}

.profile-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-opt-btn {
  padding: 8px 12px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(149, 184, 229, 0.24) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #c5d8ef !important;
  font-size: 12px !important;
  font-weight: 600;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease !important;
}

.profile-opt-btn:hover {
  border-color: rgba(64, 162, 255, 0.5) !important;
  background: rgba(64, 162, 255, 0.12) !important;
  color: #eef6ff !important;
  transform: translateY(-1px);
}

.profile-opt-btn.active {
  border-color: rgba(64, 162, 255, 0.7) !important;
  background: linear-gradient(120deg, rgba(64, 162, 255, 0.22), rgba(54, 212, 195, 0.18)) !important;
  color: #f1f8ff !important;
}

.emoji-opt-btn {
  min-width: 38px;
  min-height: 38px;
  padding: 7px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(149, 184, 229, 0.24) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #dcebff;
}

.emoji-opt-btn:hover {
  transform: translateY(-1px) scale(1.05) !important;
}

.emoji-opt-btn.active {
  border-color: rgba(64, 162, 255, 0.7) !important;
  background: linear-gradient(120deg, rgba(64, 162, 255, 0.22), rgba(54, 212, 195, 0.18)) !important;
}

.profile-settings-preview-pane {
  position: sticky;
  top: 8px;
  display: grid;
  gap: 10px;
}

.profile-settings-preview-card {
  border: 1px solid rgba(149, 184, 229, 0.32);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(16, 25, 40, 0.98), rgba(10, 17, 30, 0.98));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.profile-settings-preview-banner {
  height: 74px;
  width: 100%;
  background: #5865f2;
}

.profile-settings-preview-avatar-wrap {
  padding: 0 12px;
  margin-top: -28px;
}

.profile-settings-preview-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #0f1a2b;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.profile-settings-preview-name {
  margin: 8px 12px 0;
  padding: 0;
  color: #f0f7ff;
  font-weight: 700;
  font-size: 14px;
}

.profile-settings-preview-username {
  margin: 2px 12px 0;
  color: #9eb4ce;
  font-size: 12px;
}

.profile-settings-preview-pronouns,
.profile-settings-preview-status,
.profile-settings-preview-bio {
  margin: 8px 12px 0;
  color: #d7e8fd;
  font-size: 12px;
  display: none;
}

.profile-settings-preview-pronouns.visible,
.profile-settings-preview-status.visible,
.profile-settings-preview-bio.visible {
  display: block;
}

.profile-settings-preview-badge {
  margin: 9px 12px 12px;
  display: none;
  align-self: flex-start;
  width: fit-content;
  border: 1px solid rgba(64, 162, 255, 0.5);
  border-radius: 999px;
  padding: 4px 9px;
  color: #dff0ff;
  font-size: 11px;
  background: rgba(64, 162, 255, 0.15);
}

.profile-settings-preview-badge.visible {
  display: inline-flex;
}

.profile-settings-preview-avatar.has-border {
  border-width: 3px;
}

.profile-settings-preview-avatar.effect-glow {
  box-shadow: 0 0 15px rgba(88, 101, 242, 0.45);
}

.profile-settings-preview-avatar.effect-pulse {
  animation: pulse-effect 2s ease-in-out infinite;
}

.profile-settings-preview-avatar.effect-shimmer {
  animation: shimmer-effect 2s ease infinite;
}

.profile-settings-preview-avatar.effect-rainbow {
  animation: rainbow-border 3s linear infinite;
}

.profile-settings-actions {
  display: grid;
  gap: 8px;
}

.profile-settings-actions #save-profile-btn,
.profile-settings-actions #profile-open-self-btn,
.profile-settings-actions #preview-profile-btn {
  width: 100%;
}

#profile-save-msg {
  min-height: 20px;
  margin-top: 2px;
  text-align: left;
}

#current-user-avatar,
#current-user-name,
#current-user-username,
.profile-open-trigger {
  cursor: pointer;
}

.profile-open-trigger:hover {
  filter: brightness(1.08);
}

.pv-avatar-inset {
  width: calc(100% - 6px) !important;
  height: calc(100% - 6px) !important;
  margin: 3px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-avatar {
  box-sizing: border-box;
  border: 1px solid rgba(149, 184, 229, 0.28) !important;
  overflow: hidden;
}

.user-avatar.has-image {
  padding: 2px !important;
}

.user-avatar.has-image .user-panel-avatar-img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 1px solid rgba(10, 18, 30, 0.82);
}

.user-panel-avatar-inset {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1100px) {
  .profile-settings-shell {
    grid-template-columns: 1fr;
  }

  .profile-settings-preview-pane {
    position: static;
    order: -1;
  }
}

@media (max-width: 768px) {
  .profile-form-grid,
  .profile-media-grid {
    grid-template-columns: 1fr;
  }

  .profile-settings-preview-card {
    display: none;
  }

  .profile-settings-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 8px;
    border: 1px solid rgba(149, 184, 229, 0.22);
    border-radius: 12px;
    background: rgba(10, 18, 30, 0.9);
    backdrop-filter: blur(4px);
  }

  .profile-opt-btn,
  .emoji-opt-btn {
    transition: none !important;
  }
}

/* Settings > Updates */
#recent-updates-panel {
  display: grid;
  gap: 12px;
}

.updates-settings-actions {
  margin-top: 14px;
}

.recent-updates-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-updates-version {
  color: #f1f6ff;
  font-size: 14px;
  font-weight: 700;
}

.recent-updates-date {
  color: #9bb1cd;
  font-size: 12px;
  margin-top: 2px;
}

.recent-updates-badge {
  border: 1px solid rgba(120, 170, 255, 0.45);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c9dcfb;
  background: rgba(88, 132, 210, 0.2);
}

.recent-updates-panel-title {
  color: #eef4ff;
  font-size: 18px;
  font-weight: 700;
}

.recent-updates-panel-summary {
  margin: 0;
  color: #adbfdb;
  font-size: 13px;
  line-height: 1.45;
}

.recent-updates-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recent-updates-panel-card {
  text-align: left;
  border: 1px solid rgba(138, 172, 221, 0.24);
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(20, 31, 49, 0.9), rgba(17, 27, 42, 0.9));
  color: inherit;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.12s ease, background 0.16s ease;
}

.recent-updates-panel-card:hover {
  border-color: rgba(146, 187, 245, 0.46);
  background: linear-gradient(140deg, rgba(28, 41, 62, 0.95), rgba(23, 35, 53, 0.95));
}

.recent-updates-panel-card:active {
  transform: scale(0.99);
}

.recent-updates-panel-card-title {
  color: #f0f6ff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.recent-updates-panel-card-item {
  color: #a8bddc;
  font-size: 12px;
  line-height: 1.4;
}

.recent-updates-modal-content {
  width: min(820px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.recent-updates-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recent-updates-modal-head h2 {
  margin: 0;
}

.recent-updates-modal-meta {
  color: #93abc9;
  font-size: 12px;
  margin-top: 4px;
}

.recent-updates-modal-summary {
  margin: 12px 0 14px;
  color: #a9bedb;
  font-size: 13px;
  line-height: 1.5;
}

.recent-updates-category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.recent-updates-category-tab {
  border: 1px solid rgba(145, 178, 223, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: #c0d4ef;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.recent-updates-category-tab:hover {
  border-color: rgba(130, 176, 236, 0.45);
  background: rgba(82, 132, 206, 0.2);
}

.recent-updates-category-tab.active {
  border-color: rgba(96, 167, 246, 0.62);
  background: linear-gradient(120deg, rgba(57, 110, 188, 0.45), rgba(49, 138, 186, 0.45));
  color: #eff6ff;
}

.recent-updates-category-body {
  border: 1px solid rgba(140, 173, 220, 0.22);
  border-radius: 12px;
  padding: 12px;
  background: rgba(11, 20, 32, 0.86);
}

.recent-updates-section-title {
  color: #edf4ff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.recent-updates-item-list {
  display: grid;
  gap: 8px;
}

.recent-updates-item {
  border-left: 3px solid rgba(108, 164, 239, 0.62);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #c2d4ee;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .recent-updates-panel-grid {
    grid-template-columns: 1fr;
  }

  .recent-updates-modal-content {
    width: min(96vw, 96vw);
  }

  .recent-updates-category-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}

/* ========== PRESENCE + MOTION LAYER ========== */

:root {
  --presence-online: #57f287;
  --presence-idle: #f0b232;
  --presence-offline: #747f8d;
}

.conversation-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.conversation-avatar-wrap .conversation-avatar {
  width: 100%;
  height: 100%;
}

.presence-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #2b2d31;
  display: inline-flex;
  flex-shrink: 0;
  position: relative;
  transform: translateZ(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.presence-dot.presence-online {
  background: var(--presence-online);
  box-shadow: 0 0 0 2px rgba(87, 242, 135, 0.2);
}

.presence-dot.presence-idle {
  background: var(--presence-idle);
  box-shadow: 0 0 0 2px rgba(240, 178, 50, 0.2);
}

.presence-dot.presence-offline {
  background: var(--presence-offline);
  box-shadow: 0 0 0 2px rgba(116, 127, 141, 0.15);
}

.presence-dot.presence-online::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(87, 242, 135, 0.45);
  animation: presence-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

.presence-state-bump {
  animation: presence-bump 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.conversation-presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
}

.conversation-presence-line {
  margin-top: 2px;
  min-height: 14px;
}

.conversation-presence-text,
.dm-header-presence-text,
.profile-live-presence-text,
.pv-live-presence-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #9aa5b1;
  transition: color 0.16s ease;
}

.presence-label-online {
  color: #7bf7ac;
}

.presence-label-idle {
  color: #ffd17a;
}

.presence-label-offline {
  color: #9ca5b0;
}

.dm-header-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.dm-header-presence-dot {
  width: 10px;
  height: 10px;
  border-width: 2px;
  border-color: #2b2d31;
}

#current-user-avatar {
  position: relative;
}

.self-presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border-width: 3px;
  border-color: #232428;
  z-index: 2;
}

.profile-live-presence,
.pv-live-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-live-presence {
  margin-top: 8px;
  color: #b8c1cd;
  font-size: 12px;
}

.profile-live-presence-dot {
  width: 10px;
  height: 10px;
}

.pv-live-presence {
  justify-content: center;
  margin-top: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pv-live-presence.visible {
  opacity: 1;
  transform: translateY(0);
}

.pv-live-presence-dot {
  width: 11px;
  height: 11px;
  border-color: #232a3a;
}

@keyframes presence-pulse {
  0% { transform: scale(0.8); opacity: 0.75; }
  80% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

@keyframes presence-bump {
  0% { transform: scale(0.84); }
  65% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Broad extra motion for interactive surfaces */
body[data-animation]:not([data-animation="none"]) .conversation,
body[data-animation]:not([data-animation="none"]) .friend-request,
body[data-animation]:not([data-animation="none"]) .tab,
body[data-animation]:not([data-animation="none"]) .channel-item,
body[data-animation]:not([data-animation="none"]) .community-item,
body[data-animation]:not([data-animation="none"]) button,
body[data-animation]:not([data-animation="none"]) .message {
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

body[data-animation]:not([data-animation="none"]) .conversation:hover,
body[data-animation]:not([data-animation="none"]) .friend-request:hover,
body[data-animation]:not([data-animation="none"]) .channel-item:hover,
body[data-animation]:not([data-animation="none"]) .community-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

body[data-animation]:not([data-animation="none"]) button:hover,
body[data-animation]:not([data-animation="none"]) .tab:hover {
  transform: translateY(-1px);
}

.tap-pulse {
  animation: tap-pulse 0.2s ease-out;
}

.ripple-host {
  position: relative !important;
  overflow: hidden;
  isolation: isolate;
}

.fx-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0) 100%);
  transform: scale(0.16);
  animation: ripple-wave 0.55s ease-out forwards;
}

@keyframes tap-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

@keyframes ripple-wave {
  0% {
    opacity: 0.45;
    transform: scale(0.16);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* Animate-everything entrance layer */
:root {
  --fx-enter-duration: 0.28s;
  --fx-enter-distance: 10px;
}

body[data-animation]:not([data-animation="none"]) .fx-anim-target {
  opacity: 0.001;
  transform: translateY(var(--fx-enter-distance)) scale(0.992);
  transition: opacity var(--fx-enter-duration) cubic-bezier(0.2, 0.8, 0.2, 1), transform var(--fx-enter-duration) cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

body[data-animation]:not([data-animation="none"]) .fx-anim-target.fx-in-view {
  opacity: 1;
  transform: none;
}

body[data-animation]:not([data-animation="none"]) .fx-anim-target:focus-visible {
  transform: translateY(-1px);
}

body[data-animation="none"] .fx-anim-target,
body.reduced-motion .fx-anim-target,
body.low-motion .fx-anim-target {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* Keep motion mobile-safe */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
  :root {
    --fx-enter-duration: 0.2s;
    --fx-enter-distance: 5px;
  }

  body[data-animation]:not([data-animation="none"]) .conversation:hover,
  body[data-animation]:not([data-animation="none"]) .friend-request:hover,
  body[data-animation]:not([data-animation="none"]) .channel-item:hover,
  body[data-animation]:not([data-animation="none"]) .community-item:hover,
  body[data-animation]:not([data-animation="none"]) button:hover,
  body[data-animation]:not([data-animation="none"]) .tab:hover {
    transform: none;
    box-shadow: none;
  }

  .fx-ripple {
    animation-duration: 0.38s;
  }

  .presence-dot.presence-online::after {
    animation-duration: 2.3s;
  }
}

/* ========== SETTINGS SUGGESTIONS + COMPACT TABS ========== */
#settings-modal .settings-modal-content {
  width: min(960px, 96vw) !important;
}

#settings-modal .settings-tabs {
  display: flex;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 6px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

#settings-modal .settings-tab {
  flex: 0 0 auto !important;
  min-width: 106px;
  white-space: nowrap;
}

#settings-suggestions {
  padding: 0 !important;
}

.suggestions-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
  align-items: start;
}

.suggestions-compose-card,
.suggestions-history-card,
.suggestions-hub-card {
  margin: 0 !important;
  padding: 14px !important;
  border-radius: 14px !important;
}

.dev-classification-banner {
  grid-column: 1 / -1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(143, 177, 223, 0.34);
  background: rgba(255, 255, 255, 0.03);
  color: #d2e3fa;
}

.dev-classification-banner.is-dev {
  border-color: rgba(87, 242, 135, 0.45);
  background: rgba(87, 242, 135, 0.14);
  color: #d8ffe5;
}

.dev-classification-banner.is-user {
  border-color: rgba(142, 177, 224, 0.34);
  background: rgba(255, 255, 255, 0.03);
  color: #d2e3fa;
}

.suggestions-hub-card {
  grid-column: 1 / -1;
}

.suggestions-hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.suggestions-hub-role-badge {
  border-radius: 999px;
  border: 1px solid rgba(145, 180, 224, 0.36);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #d2e4fb;
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.suggestions-hub-role-badge.is-dev {
  border-color: rgba(87, 242, 135, 0.5);
  color: #d8ffe5;
  background: rgba(87, 242, 135, 0.16);
}

.suggestions-hub-role-badge.is-user {
  border-color: rgba(145, 180, 224, 0.36);
  color: #d2e4fb;
  background: rgba(255, 255, 255, 0.04);
}

.suggestions-compose-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 8px;
}

#suggestion-char-count {
  color: #9eb4cf;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 0.18s ease;
}

#suggestion-char-count.near-limit {
  color: #f0b232;
}

.suggestions-compose-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.suggestions-compose-actions .primary-btn {
  width: auto !important;
  min-width: 190px;
  margin-top: 0 !important;
}

.suggestion-submit-msg {
  min-height: 20px;
  margin-top: 8px;
  color: #f23f43;
  font-size: 13px;
  text-align: left;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.suggestion-submit-msg.info {
  color: #9ec8ff;
}

.suggestion-submit-msg.ok {
  color: #57f287;
}

.suggestions-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.suggestions-hub-list {
  max-height: 560px;
}

.suggestions-empty {
  border: 1px dashed rgba(142, 177, 224, 0.35);
  border-radius: 11px;
  padding: 16px 14px;
  background: rgba(255, 255, 255, 0.02);
  color: #abc0db;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.suggestions-error {
  color: #f3b0b2;
  border-color: rgba(242, 63, 67, 0.45);
  background: rgba(242, 63, 67, 0.08);
}

.suggestions-loading {
  animation: suggestions-pulse 1s ease-in-out infinite;
}

.suggestion-item {
  border: 1px solid rgba(142, 177, 224, 0.26);
  border-radius: 12px;
  padding: 11px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  display: grid;
  gap: 7px;
  animation: suggestion-card-in 0.28s ease both;
  animation-delay: var(--suggestion-enter-delay, 0s);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.suggestion-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.suggestion-item-title {
  color: #eff6ff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.suggestion-item-meta {
  color: #8fa8c8;
  font-size: 11px;
  letter-spacing: 0.01em;
}

.suggestion-item-body {
  color: #c4d5eb;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.suggestion-dev-reply-view {
  border-top: 1px solid rgba(148, 182, 227, 0.22);
  padding-top: 8px;
  display: grid;
  gap: 6px;
}

.suggestion-dev-reply-meta {
  color: #9fc6ff;
  font-size: 11px;
  font-weight: 700;
}

.suggestion-dev-reply-body {
  color: #d7e9ff;
  font-size: 12px;
  line-height: 1.45;
}

.suggestion-dev-editor {
  border-top: 1px solid rgba(148, 182, 227, 0.2);
  padding-top: 8px;
}

.suggestion-dev-editor summary {
  list-style: none;
  cursor: pointer;
  color: #c5daf7;
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}

.suggestion-dev-editor summary::-webkit-details-marker {
  display: none;
}

.suggestion-dev-editor summary::before {
  content: '>';
  display: inline-flex;
  margin-right: 8px;
  transition: transform 0.18s ease;
}

.suggestion-dev-editor[open] summary::before {
  transform: rotate(90deg);
}

.suggestion-dev-editor-grid {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.suggestion-dev-field-label {
  color: #9db6d7;
  font-size: 11px;
  font-weight: 700;
}

.suggestion-dev-input,
.suggestion-dev-textarea,
.suggestion-dev-select {
  margin-top: 0 !important;
}

.suggestion-dev-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.suggestion-dev-save {
  margin: 0 !important;
  width: auto !important;
}

.suggestion-dev-action-msg {
  min-height: 18px;
  font-size: 12px;
  color: #f3b0b2;
}

.suggestion-dev-action-msg.ok {
  color: #57f287;
}

.suggestion-dev-action-msg.info {
  color: #9ec8ff;
}

.suggestion-status-badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(153, 186, 230, 0.35);
  background: rgba(109, 158, 232, 0.15);
  color: #d7e7ff;
  white-space: nowrap;
}

.suggestion-status-badge.is-submitted {
  border-color: rgba(153, 186, 230, 0.35);
  background: rgba(109, 158, 232, 0.15);
  color: #d7e7ff;
}

.suggestion-status-badge.is-reviewing {
  border-color: rgba(245, 193, 94, 0.42);
  background: rgba(245, 193, 94, 0.16);
  color: #ffe8b0;
}

.suggestion-status-badge.is-planned {
  border-color: rgba(118, 194, 255, 0.42);
  background: rgba(118, 194, 255, 0.14);
  color: #d6f0ff;
}

.suggestion-status-badge.is-implemented {
  border-color: rgba(87, 242, 135, 0.46);
  background: rgba(87, 242, 135, 0.16);
  color: #d4ffe2;
}

.suggestion-status-badge.is-closed {
  border-color: rgba(133, 144, 160, 0.5);
  background: rgba(133, 144, 160, 0.18);
  color: #d3dae3;
}

.suggestions-pagination {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.suggestions-page-number-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.suggestions-page-btn {
  border: 1px solid rgba(146, 182, 227, 0.34);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: #d3e3f9;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.suggestions-page-btn:hover:not(:disabled) {
  border-color: rgba(117, 174, 244, 0.62);
  background: rgba(117, 174, 244, 0.2);
  transform: translateY(-1px);
}

.suggestions-page-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.suggestions-page-btn.active {
  border-color: rgba(103, 170, 248, 0.74);
  background: linear-gradient(120deg, rgba(65, 147, 245, 0.45), rgba(54, 212, 195, 0.26));
  color: #f2f8ff;
}

.suggestions-page-gap {
  color: #8ea7c8;
  font-size: 12px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.suggestions-page-indicator {
  margin-left: auto;
  color: #95abca;
  font-size: 12px;
  white-space: nowrap;
}

@keyframes suggestion-card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes suggestions-pulse {
  0% { opacity: 0.62; }
  50% { opacity: 1; }
  100% { opacity: 0.62; }
}

body[data-animation]:not([data-animation="none"]) #settings-suggestions .settings-input,
body[data-animation]:not([data-animation="none"]) #settings-suggestions .primary-btn,
body[data-animation]:not([data-animation="none"]) #settings-suggestions .suggestions-page-btn,
body[data-animation]:not([data-animation="none"]) #settings-suggestions .suggestion-item {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

body[data-animation]:not([data-animation="none"]) #settings-suggestions .suggestion-item:hover {
  transform: translateY(-2px);
  border-color: rgba(121, 175, 244, 0.58);
  box-shadow: 0 10px 24px rgba(3, 9, 16, 0.25);
}

body[data-animation="none"] #settings-suggestions .suggestion-item,
body.reduced-motion #settings-suggestions .suggestion-item,
body.low-motion #settings-suggestions .suggestion-item {
  animation: none !important;
  transform: none !important;
}

@media (max-width: 980px) {
  .suggestions-shell {
    grid-template-columns: 1fr;
  }

  .suggestions-list {
    max-height: none;
  }
}

@media (max-width: 768px) {
  #settings-modal .settings-tab {
    min-width: 92px;
    padding: 9px 10px;
    font-size: 12px;
  }

  .suggestions-compose-card,
  .suggestions-history-card,
  .suggestions-hub-card {
    padding: 12px !important;
  }

  .suggestions-hub-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .suggestions-compose-actions .primary-btn {
    width: 100% !important;
    min-width: 0;
  }

  .suggestions-pagination {
    gap: 6px;
  }

  .suggestions-page-indicator {
    margin-left: 0;
    width: 100%;
  }

  .suggestion-item {
    padding: 10px;
    gap: 6px;
  }

  .suggestion-item-title {
    font-size: 13px;
  }

  .suggestion-item-body {
    font-size: 12px;
  }

  .suggestion-dev-actions {
    align-items: stretch;
  }

  .suggestion-dev-save {
    width: 100% !important;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 768px) {
  body[data-animation]:not([data-animation="none"]) #settings-suggestions .suggestion-item:hover,
  .suggestions-page-btn:hover:not(:disabled) {
    transform: none;
    box-shadow: none;
  }
}

/* ========== DM PROFILE VISUALS + IMAGE LIGHTBOX ========== */

.message-avatar.has-image {
  overflow: hidden;
  color: transparent;
  padding: 0;
}

.message-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

#chat-title .dm-header-main {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#chat-title .dm-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#chat-title .dm-header-avatar.has-image {
  color: transparent;
}

#chat-title .dm-header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#chat-title .dm-header-meta {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

#chat-title .dm-header-username {
  min-width: 0;
  max-width: 100%;
  flex: unset;
}

#chat-title .dm-header-presence {
  margin-left: 0;
  gap: 5px;
}

#chat-title .dm-header-banner {
  width: 68px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

#chat-title .dm-header-banner.has-image {
  background: #1f2023;
}

#chat-title .dm-header-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#chat-title .dm-header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.image-lightbox-modal {
  z-index: 9500;
  padding: 0;
}

.image-lightbox-content {
  background: rgba(18, 19, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 52px 18px 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox-img {
  display: block;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 72px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.image-lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox-close:hover {
  background: rgba(0, 0, 0, 0.68);
}

@media (max-width: 768px) {
  #chat-title .dm-header-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  #chat-title .dm-header-banner {
    width: 50px;
    height: 24px;
  }

  #chat-title .dm-header-actions {
    gap: 6px;
  }

  .image-lightbox-content {
    padding: 40px 8px 8px;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .image-lightbox-img {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 56px);
  }
}

@media (max-width: 520px) {
  #chat-title .dm-header-banner {
    display: none;
  }

  #chat-title .dm-header-presence-text {
    display: none;
  }
}

/* ========== MODERATION CONTROL CENTER ========== */

.tab-mod-center {
  background: linear-gradient(135deg, rgba(235, 69, 158, 0.14), rgba(88, 101, 242, 0.14));
  border: 1px solid rgba(235, 69, 158, 0.2);
}

.tab-mod-center.active {
  background: linear-gradient(135deg, rgba(235, 69, 158, 0.26), rgba(88, 101, 242, 0.22));
  color: #fdf7ff;
}

.mod-tab-shell {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.mod-tab-hero {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(88, 101, 242, 0.25);
  background: linear-gradient(145deg, rgba(17, 21, 35, 0.95), rgba(24, 28, 44, 0.92));
}

.mod-tab-hero h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #f6f7fb;
}

.mod-tab-hero p {
  margin: 0;
  font-size: 12px;
  color: #bfc4d4;
}

.mod-tab-community {
  border: 1px solid rgba(87, 242, 135, 0.2);
  background: rgba(87, 242, 135, 0.08);
  color: #d8ffe7;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.mod-tab-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-tab-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mod-tab-grid .small-btn {
  text-align: left;
  padding: 8px 10px;
}

.mod-tab-events {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.24);
  border-radius: 8px;
  padding: 8px;
}

.mod-tab-events-title {
  font-size: 12px;
  color: #b8bdd1;
  margin-bottom: 6px;
}

.mod-tab-events-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.mod-tab-event-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 8px;
}

.mod-tab-event-title {
  color: #edf0fb;
  font-size: 12px;
}

.mod-tab-event-meta {
  color: #98a0b8;
  font-size: 11px;
  margin-top: 2px;
}

.mod-center-modal-content {
  width: min(1360px, 96vw);
  max-width: min(1360px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mod-center-modal-content .small-btn {
  font-size: 12px;
  padding: 7px 11px;
}

.mod-center-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mod-center-head h2 {
  margin: 0;
}

.mod-center-tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 2px;
}

.mod-center-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #c7ccdb;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.18s ease;
}

.mod-center-tab.active {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.25), rgba(87, 242, 135, 0.2));
  color: #ffffff;
  border-color: rgba(88, 101, 242, 0.45);
}

.mod-center-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.mod-center-panel.active {
  display: block;
}

.mod-center-summary {
  border: 1px solid rgba(88, 101, 242, 0.2);
  background: rgba(88, 101, 242, 0.08);
  color: #dbe2ff;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.mod-center-section-title {
  font-size: 11px;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  color: #8f98b4;
  margin: 6px 0 8px;
}

.mod-center-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mod-users-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.mod-users-column {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  padding: 10px;
  min-height: 0;
}

.mod-users-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.mod-users-bulk-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  margin-bottom: 6px;
}

.mod-user-bulk-meta {
  font-size: 11px;
  color: #aeb8d6;
  margin-bottom: 8px;
}

.mod-users-toolbar .settings-input {
  margin: 0;
  min-width: 0;
  flex: 1;
}

.mod-users-bulk-toolbar .small-btn {
  width: 100%;
}

.mod-user-list {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
}

.mod-user-item {
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px 9px;
  cursor: pointer;
  transition: 0.16s ease;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.mod-user-item:hover {
  border-color: rgba(88, 101, 242, 0.48);
  background: rgba(88, 101, 242, 0.12);
}

.mod-user-item.active {
  border-color: rgba(87, 242, 135, 0.48);
  background: rgba(87, 242, 135, 0.12);
}

.mod-user-item.bulk-selected {
  border-color: rgba(88, 101, 242, 0.58);
}

.mod-user-item-body {
  flex: 1;
  min-width: 0;
}

.mod-user-select-toggle {
  position: relative;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mod-user-select-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
}

.mod-user-select-ui {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  transition: 0.14s ease;
}

.mod-user-select-toggle input:checked + .mod-user-select-ui {
  background: #5865f2;
  border-color: rgba(88, 101, 242, 0.95);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.mod-user-item-name {
  color: #edf1ff;
  font-size: 13px;
}

.mod-user-item-username {
  color: #a8b2cf;
  font-size: 12px;
  margin-top: 2px;
}

.mod-user-item-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mod-user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dfe5f7;
  font-size: 10px;
  padding: 1px 7px;
}

.mod-user-pill.is-online {
  border-color: rgba(87, 242, 135, 0.45);
  background: rgba(87, 242, 135, 0.13);
  color: #e7ffe8;
}

.mod-user-pill.is-banned {
  border-color: rgba(237, 66, 69, 0.45);
  background: rgba(237, 66, 69, 0.13);
  color: #ffd7da;
}

.mod-user-selected-meta {
  border: 1px solid rgba(88, 101, 242, 0.2);
  background: rgba(88, 101, 242, 0.08);
  color: #d7deff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.mod-user-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mod-user-field-grid .settings-input {
  margin: 0;
}

.mod-user-field-grid textarea.settings-input {
  grid-column: 1 / -1;
  resize: vertical;
}

.mod-user-selected-status {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  color: #b7c1dd;
  font-size: 12px;
  padding: 8px 10px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.mod-user-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mod-user-actions-grid .small-btn {
  width: 100%;
}

.mod-session-lab {
  border: 1px solid rgba(87, 242, 135, 0.2);
  background: linear-gradient(150deg, rgba(87, 242, 135, 0.08), rgba(88, 101, 242, 0.06));
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.mod-session-lab-head {
  margin-bottom: 8px;
}

.mod-session-lab-title {
  color: #ecf4ff;
  font-size: 13px;
  margin-bottom: 2px;
}

.mod-session-lab-desc {
  color: #aab5d1;
  font-size: 12px;
  line-height: 1.35;
}

.mod-session-status {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  color: #d7e2ff;
  font-size: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.mod-session-actions {
  margin-bottom: 0;
}

.mod-card-groups {
  display: grid;
  gap: 10px;
}

.mod-card-group {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  padding: 10px;
}

.mod-card-group-title {
  color: #cad3ea;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  margin-bottom: 8px;
}

.mod-card-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mod-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  border-radius: 10px;
  padding: 10px;
}

.mod-card-title {
  color: #eff2ff;
  font-size: 13px;
  margin-bottom: 4px;
}

.mod-card-desc {
  color: #a8afc2;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 8px;
}

.mod-devlab-guide {
  border: 1px solid rgba(88, 101, 242, 0.22);
  background: rgba(88, 101, 242, 0.09);
  color: #d7deff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.mod-center-dev-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mod-center-dev-head .settings-input {
  margin: 0;
  min-width: 180px;
}

.mod-command-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b6bfd8;
  font-size: 12px;
  white-space: nowrap;
}

.mod-command-toggle input {
  accent-color: #5865f2;
}

.mod-command-count {
  color: #9ea6be;
  font-size: 12px;
  min-width: 190px;
  margin-left: auto;
  text-align: left;
}

.mod-command-groups {
  display: grid;
  gap: 10px;
  max-height: 100%;
}

.mod-command-group {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.mod-command-group-toggle {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.mod-command-group-title {
  font-size: 12px;
  color: #d4dbef;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.mod-command-group-meta {
  color: #9fa8c4;
  font-size: 11px;
}

.mod-command-group .mod-command-grid {
  padding: 10px;
}

.mod-command-group.collapsed .mod-command-grid {
  display: none;
}

.mod-command-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1500px) {
  .mod-center-modal-content {
    width: min(1540px, 97vw);
    max-width: min(1540px, 97vw);
  }

  .mod-command-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.mod-command-btn {
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px 9px;
  color: #e6eaf6;
  cursor: pointer;
  transition: 0.18s ease;
  min-height: 88px;
  display: grid;
  align-content: start;
  gap: 4px;
}

.mod-command-btn:hover {
  border-color: rgba(88, 101, 242, 0.48);
  background: rgba(88, 101, 242, 0.14);
}

.mod-command-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mod-command-btn.is-disabled {
  border-color: rgba(255, 255, 255, 0.08);
}

.mod-command-label {
  font-size: 13px;
  margin-bottom: 4px;
}

.mod-command-desc {
  font-size: 11px;
  color: #a8b0c7;
}

.mod-command-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.mod-command-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.14);
  color: #dce2ff;
  font-size: 10px;
  padding: 1px 7px;
}

.mod-command-note {
  font-size: 10px;
  color: #f0b8be;
}

.mod-command-empty {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 12px;
  color: #b5bed9;
  font-size: 12px;
}

.mod-system-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.mod-system-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #cad1e3;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.mod-system-tab.active {
  border-color: rgba(87, 242, 135, 0.4);
  background: rgba(87, 242, 135, 0.16);
  color: #e9ffef;
}

.mod-system-panel {
  display: none;
}

.mod-system-panel.active {
  display: block;
}

.guardian-risk-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(24, 27, 42, 0.9), rgba(12, 14, 24, 0.92));
  padding: 12px;
  margin-bottom: 10px;
}

.guardian-risk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.guardian-risk-label {
  font-size: 13px;
  color: #dce2f5;
}

.guardian-risk-score {
  font-size: 18px;
  color: #fff;
  font-weight: 700;
}

.guardian-risk-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 8px;
}

.guardian-risk-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #57f287, #f0b232, #ed4245);
}

.guardian-alerts {
  display: grid;
  gap: 8px;
}

.guardian-alert-item {
  border: 1px solid rgba(240, 178, 50, 0.25);
  background: rgba(240, 178, 50, 0.08);
  color: #ffecc6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.mod-policy-editor {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.mod-policy-editor .settings-input {
  flex: 1 1 260px;
  margin: 0;
}

.policy-rule-list,
.policy-results,
.snapshot-list,
.snapshot-diff,
.mod-timeline-list {
  display: grid;
  gap: 8px;
}

.policy-rule-item,
.policy-result-item,
.snapshot-item,
.timeline-item,
.snapshot-diff-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px 10px;
}

.policy-rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.policy-rule-value {
  color: #d7ddf2;
  font-size: 12px;
  word-break: break-word;
}

.policy-hit-meta,
.timeline-meta,
.snapshot-meta {
  font-size: 11px;
  color: #98a2be;
  margin-top: 4px;
}

.timeline-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dee3f2;
}

.timeline-type.type-critical {
  border-color: rgba(237, 66, 69, 0.5);
  color: #ffd5d7;
  background: rgba(237, 66, 69, 0.14);
}

.timeline-type.type-warning {
  border-color: rgba(240, 178, 50, 0.45);
  color: #ffe4b3;
  background: rgba(240, 178, 50, 0.12);
}

.timeline-type.type-info {
  border-color: rgba(88, 101, 242, 0.45);
  color: #dce0ff;
  background: rgba(88, 101, 242, 0.12);
}

.mod-settings-bridge {
  margin-bottom: 14px;
}

/* ========== RELAY CALL FALLBACK ========== */

.relay-call-panel {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
}

.relay-call-log {
  max-height: 120px;
  overflow: auto;
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.relay-call-item {
  border-radius: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: #e4e8f5;
}

.relay-call-item.mine {
  border-color: rgba(87, 242, 135, 0.35);
  background: rgba(87, 242, 135, 0.12);
}

.relay-call-meta {
  font-size: 10px;
  color: #9ba6c5;
  margin-top: 2px;
}

.relay-call-compose {
  display: flex;
  gap: 6px;
}

.relay-call-compose input {
  flex: 1;
  min-width: 0;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f5f7ff;
  padding: 7px 8px;
}

.relay-call-compose input:focus {
  outline: none;
  border-color: rgba(88, 101, 242, 0.58);
}

.call-control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .mod-users-workspace {
    grid-template-columns: 1fr;
  }

  .mod-user-field-grid {
    grid-template-columns: 1fr;
  }

  .mod-users-bulk-toolbar,
  .mod-user-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mod-card-group-grid,
  .mod-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .mod-users-toolbar:not(.mod-users-bulk-toolbar) {
    flex-direction: column;
    align-items: stretch;
  }

  .mod-users-bulk-toolbar,
  .mod-user-actions-grid {
    grid-template-columns: 1fr;
  }

  .mod-tab-grid,
  .mod-card-group-grid,
  .mod-command-grid {
    grid-template-columns: 1fr;
  }

  .mod-center-dev-head {
    flex-direction: column;
    align-items: stretch;
  }

  .mod-command-count {
    text-align: left;
    margin-left: 0;
  }
}

/* ========== KNOWLEDGE HUB ========== */

.knowledge-hub-card,
.knowledge-actions-card {
  display: grid;
  gap: 12px;
}

.knowledge-hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-count-badge {
  border: 1px solid rgba(149, 184, 229, 0.36);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #d6e7fc;
  background: rgba(64, 162, 255, 0.14);
  white-space: nowrap;
}

.knowledge-controls {
  display: grid;
  grid-template-columns: 1.35fr minmax(150px, 0.85fr) auto;
  gap: 8px;
  align-items: center;
}

.knowledge-daily-tip {
  border: 1px solid rgba(149, 184, 229, 0.3);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  color: #d8e8fb;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 12px;
}

.knowledge-list,
.knowledge-action-list {
  display: grid;
  gap: 8px;
}

.knowledge-list {
  max-height: 320px;
  overflow-y: auto;
}

.knowledge-action-list {
  max-height: 360px;
  overflow-y: auto;
}

.knowledge-item,
.knowledge-action-item {
  border: 1px solid rgba(149, 184, 229, 0.26);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 11px;
}

.knowledge-item-head,
.knowledge-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.knowledge-item-title,
.knowledge-action-title {
  color: #f0f7ff;
  font-size: 13px;
  font-weight: 700;
}

.knowledge-item-category {
  border: 1px solid rgba(149, 184, 229, 0.32);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  color: #c5dcf9;
  background: rgba(88, 101, 242, 0.12);
  white-space: nowrap;
}

.knowledge-item-body,
.knowledge-action-body {
  color: #b8cee8;
  font-size: 12px;
  line-height: 1.45;
}

.knowledge-action-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.knowledge-action-btn {
  width: auto !important;
  margin: 0 !important;
  min-width: 86px;
  padding: 7px 10px !important;
}

@media (max-width: 768px) {
  .knowledge-controls {
    grid-template-columns: 1fr;
  }

  .knowledge-hub-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .knowledge-action-actions {
    flex-direction: column;
  }

  .knowledge-action-btn {
    width: 100% !important;
  }
}

/* ========== APPEARANCE SETTINGS HARDENING ========== */

body.clean-layout .app-topbar,
body.clean-layout .chat-header,
body.clean-layout .input-container,
body.clean-layout .workspace-card,
body.clean-layout .settings-section,
body.clean-layout .mod-card,
body.clean-layout .mod-center-card {
  border-radius: 12px !important;
  box-shadow: none !important;
}

body.clean-layout .conversation,
body.clean-layout .friend-request,
body.clean-layout .community-item,
body.clean-layout .channel-item,
body.clean-layout .message {
  border-radius: 10px !important;
}

body.clean-layout .message:hover {
  margin: 0 0 9px 0 !important;
  padding: 9px 10px !important;
}

body.dense-messages .messages {
  padding: 8px 10px !important;
}

body.dense-messages .message {
  padding: 6px 8px !important;
  margin-bottom: 6px !important;
  gap: 8px !important;
}

body.dense-messages .message-avatar {
  width: 30px !important;
  height: 30px !important;
  font-size: 12px !important;
}

body.dense-messages .message-text {
  font-size: 13px !important;
  line-height: 1.35 !important;
}

body.bigger-input #message-input {
  min-height: 50px !important;
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  border-radius: 12px !important;
}

body.high-contrast {
  color: #f7fbff !important;
}

body.high-contrast .conversation-name,
body.high-contrast .message-sender,
body.high-contrast .user-name,
body.high-contrast .chat-title-username {
  color: #ffffff !important;
}

body.high-contrast .conversation-username,
body.high-contrast .message-time,
body.high-contrast .settings-desc,
body.high-contrast .user-username,
body.high-contrast .home-card-desc,
body.high-contrast .recent-updates-panel-summary {
  color: #d8e6f7 !important;
}

body.high-contrast .message,
body.high-contrast .conversation,
body.high-contrast .friend-request,
body.high-contrast .community-item,
body.high-contrast .channel-item,
body.high-contrast .settings-section,
body.high-contrast .workspace-card {
  border-color: rgba(220, 236, 255, 0.42) !important;
}

@media (min-width: 769px) {
  body.compact-sidebar #app {
    grid-template-columns: 236px minmax(0, 1fr) 250px !important;
  }

  body.wide-layout #app {
    grid-template-columns: 340px minmax(0, 1fr) 320px !important;
  }

  body.wide-layout .messages {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

body[data-theme='graphite'] {
  background:
    radial-gradient(720px 420px at -6% -10%, rgba(94, 169, 255, 0.22), transparent 58%),
    radial-gradient(760px 460px at 108% 10%, rgba(67, 209, 176, 0.18), transparent 58%),
    linear-gradient(160deg, #0b121b, #121b28 44%, #1a2635) !important;
}

body[data-theme='ocean'] {
  background:
    radial-gradient(720px 420px at -6% -10%, rgba(72, 184, 255, 0.26), transparent 58%),
    radial-gradient(760px 460px at 108% 10%, rgba(59, 224, 195, 0.2), transparent 58%),
    linear-gradient(160deg, #071722, #0d2433 44%, #153044) !important;
}

body[data-theme='aurora'] {
  background:
    radial-gradient(720px 420px at -6% -10%, rgba(121, 163, 255, 0.24), transparent 58%),
    radial-gradient(760px 460px at 108% 10%, rgba(93, 227, 200, 0.18), transparent 58%),
    linear-gradient(160deg, #161125, #221a34 44%, #2a2140) !important;
}

.ux-searchbar.core-searchbar {
  margin-top: 8px;
  border-radius: 12px;
}

.workspace-quick-actions-card {
  display: grid;
  gap: 10px;
}

.workspace-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workspace-quick-btn {
  border: 1px solid rgba(149, 184, 229, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e7f2ff;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.workspace-quick-btn:hover {
  border-color: rgba(149, 184, 229, 0.52);
  background: rgba(255, 255, 255, 0.1);
}

.workspace-quick-btn.active {
  border-color: rgba(64, 162, 255, 0.58);
  background: rgba(64, 162, 255, 0.22);
}

.core-quick-dock {
  display: none !important;
}

@media (max-width: 768px) {
  .workspace-quick-actions-card {
    display: none !important;
  }
}

/* ========== MOBILE UI CLEANUP PATCH (FINAL) ========== */
@media (max-width: 768px) {
  .app-topbar {
    min-height: calc(52px + env(safe-area-inset-top)) !important;
    padding: calc(7px + env(safe-area-inset-top)) 10px 7px !important;
    gap: 8px !important;
    background: rgba(8, 14, 22, 0.82) !important;
    backdrop-filter: blur(10px);
  }

  .app-topbar-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .app-wordmark {
    max-width: 140px !important;
  }

  .wordmark-main {
    font-size: 12px !important;
    letter-spacing: 0.45px !important;
  }

  .wordmark-sub {
    display: none !important;
  }

  .app-topbar-actions {
    gap: 6px !important;
    flex: 0 0 auto !important;
  }

  .app-topbar-left #add-friend-btn,
  .app-topbar-actions #add-friend-btn {
    min-height: 34px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    border-radius: 9px !important;
  }

  .app-topbar-actions #notif-bell-btn,
  .mobile-settings-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 9px !important;
  }

  .tabs {
    top: calc(52px + env(safe-area-inset-top)) !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    background: rgba(8, 14, 22, 0.82) !important;
    backdrop-filter: blur(10px);
  }

  .tab {
    min-width: 84px !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 11px !important;
    border-radius: 9px !important;
  }

  .sidebar-content-switcher {
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  }

  .conversations,
  #community-channels-view {
    padding: 8px !important;
  }

  .conversation,
  .friend-request,
  .community-item,
  .channel-item {
    margin-bottom: 6px !important;
    border-radius: 10px !important;
  }

  .chat-header {
    min-height: calc(52px + env(safe-area-inset-top)) !important;
    padding: calc(7px + env(safe-area-inset-top)) 10px 7px !important;
  }

  #chat-title {
    font-size: 14px !important;
  }

  .messages {
    padding: 10px !important;
  }

  .message {
    border-radius: 10px !important;
    padding: 8px 9px !important;
    margin-bottom: 7px !important;
    gap: 8px !important;
  }

  .message:hover {
    margin: 0 0 7px 0 !important;
    padding: 8px 9px !important;
  }

  .message-avatar {
    width: 32px !important;
    height: 32px !important;
  }

  .input-area {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom)) !important;
    background: linear-gradient(180deg, rgba(6, 11, 18, 0.1), rgba(6, 11, 18, 0.76)) !important;
    backdrop-filter: blur(8px);
  }

  .input-container {
    grid-template-columns: 36px minmax(0, 1fr) auto !important;
    gap: 6px !important;
    padding: 5px !important;
    border-radius: 10px !important;
  }

  .image-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }

  #message-input {
    min-height: 38px !important;
    padding: 9px 10px !important;
  }

  .ru-send-btn {
    min-width: 64px !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
  }

  .ru-composer-meta {
    margin-top: 6px !important;
    font-size: 11px !important;
  }

  .ru-template-bar {
    margin-top: 6px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 2px !important;
    -webkit-overflow-scrolling: touch;
  }

  .ru-template-chip {
    white-space: nowrap !important;
    font-size: 11px !important;
    padding: 4px 9px !important;
  }

  .ru-keyword-row {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  #ru-keyword-input,
  #ru-keyword-clear {
    min-height: 34px !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
  }

  .home-screen {
    padding: 12px !important;
    gap: 12px !important;
  }

  .home-hero {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .home-hero h2 {
    font-size: 19px !important;
  }

  .home-grid {
    gap: 8px !important;
  }

  .home-card-btn {
    padding: 11px !important;
    border-radius: 10px !important;
  }

  .home-card-title {
    font-size: 13px !important;
    margin-bottom: 4px !important;
  }

  .home-card-desc {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  .ru-jump-latest {
    right: 10px !important;
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    padding: 8px 10px !important;
    font-size: 11px !important;
  }

  .modal {
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom)) !important;
  }

  .modal-content {
    width: min(97vw, 680px) !important;
    border-radius: 12px !important;
  }
}

@media (max-width: 420px) {
  .app-wordmark {
    max-width: 110px !important;
  }

  .app-topbar-left #add-friend-btn,
  .app-topbar-actions #add-friend-btn {
    padding: 0 8px !important;
    font-size: 10.5px !important;
  }

  .tab {
    min-width: 78px !important;
  }

  #ru-keyword-clear {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}

/* ========== HAV BRANDING TOPBAR LOCK (ABSOLUTE LAST) ========== */
.app-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: relative !important;
}

.app-topbar-left {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  min-width: 44px !important;
  flex: 0 0 auto !important;
}

.app-wordmark.app-wordmark-center {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  text-align: center !important;
  max-width: calc(100% - 300px) !important;
  pointer-events: none !important;
}

.app-wordmark.app-wordmark-center .wordmark-main {
  font-size: 16px !important;
  letter-spacing: 1px !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
}

.app-wordmark.app-wordmark-center .wordmark-sub {
  font-size: 10px !important;
  letter-spacing: 0.35px !important;
}

.app-topbar-actions {
  min-width: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.app-topbar-left #add-friend-btn {
  min-height: 34px !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}

@media (max-width: 768px) {
  .app-topbar-left {
    min-width: 40px !important;
  }

  .app-wordmark.app-wordmark-center {
    max-width: calc(100% - 210px) !important;
  }

  .app-wordmark.app-wordmark-center .wordmark-main {
    font-size: 14px !important;
    letter-spacing: 0.75px !important;
  }

  .app-wordmark.app-wordmark-center .wordmark-sub {
    display: none !important;
  }

  .app-topbar-left #add-friend-btn {
    min-height: 32px !important;
    padding: 0 9px !important;
    font-size: 10.5px !important;
  }
}

@media (max-width: 420px) {
  .app-wordmark.app-wordmark-center {
    max-width: calc(100% - 176px) !important;
  }

  .app-topbar-left {
    gap: 6px !important;
  }

  .app-topbar-left #add-friend-btn {
    padding: 0 8px !important;
    font-size: 10px !important;
  }
}


