/* Grouping under one family name: 'gg sans' */

@font-face {
  font-family: 'gg sans';
  src: local('gg sans'), url('./assets/font/gg sans Regular.woff') format('woff');
  font-weight: 400; /* Normal */
  font-style: normal;
}

@font-face {
  font-family: 'gg sans';
  src: local('gg sans Medium'), url('./assets/font/gg sans Medium.woff') format('woff');
  font-weight: 500; /* Medium */
  font-style: normal;
}

@font-face {
  font-family: 'gg sans';
  src: local('gg sans Semibold'), url('./assets/font/gg sans Semibold.woff') format('woff');
  font-weight: 600; /* Semibold */
  font-style: normal;
}

@font-face {
  font-family: 'gg sans';
  src: local('gg sans Bold'), url('./assets/font/gg sans Bold.woff') format('woff');
  font-weight: 700; /* Bold */
  font-style: normal;
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-normal);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-image: url('https://discord.com/assets/f9e794909795f472.svg');
  background-size: cover;
  background-position: center;
}

.auth-box {
  background-color: var(--bg-secondary);
  padding: 32px;
  border-radius: 5px;
  width: 480px;
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
}

.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-header h2 {
  color: var(--header-primary);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--header-secondary);
  font-size: 16px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: var(--header-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 10px;
  background-color: var(--input-background);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  color: var(--text-normal);
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--brand-experiment);
  outline: none;
}

.auth-button {
  width: 100%;
  padding: 12px;
  background-color: var(--brand-experiment);
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-button:hover {
  background-color: var(--brand-experiment-hover);
}

.auth-footer {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--brand-experiment);
  text-decoration: none;
}

/* Sidebar */
.sidebar {
  width: 312px;
  min-width: 312px;
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
}

.server-list {
  width: 72px;
  border-right: 1px solid var(--div-border);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.ownerIcon {
    color: var(--text-feedback-warning);
    margin-inline-start: 4px;
}

.server-icon {
  width: 48px;
  height: 48px;
  background-color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-normal);
  cursor: pointer;
  transition: border-radius 0.15s ease, background-color 0.15s ease;
  overflow: hidden;
  font-weight: 600;
  font-size: 18px;
}

.server-icon:hover,
.server-icon.active {
  border-radius: 16px;
  background-color: var(--brand-experiment);
  color: white;
}

.channel-list {
  flex: 1;
  background-color: var(--bg-secondary);
}

.channel-header {
  padding: 0 8px;
  margin-bottom: 16px;
  font-weight: 700;
  color: var(--header-primary);
  text-transform: uppercase;
  font-size: 12px;
}

.channel-item {
  padding: 8px;
  margin: 4px;
  border-radius: 8px;
  color: var(--interactive-normal);
  font-weight: 500;
  cursor: pointer;
}

.channel-item:hover {
  background-color: var(--background-modifier-hover);
  color: var(--interactive-hover);
}

.channel-item.active {
  background-color: var(--background-modifier-selected);
  color: var(--interactive-active);
}

/* Chat Area */
.app-container {
  display: flex;
  height: calc(100vh - 32px);
  width: 100vw;
  overflow: hidden;
}

.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.chat-content {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

.chat-area {
  flex: 1;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  /* CRITICAL: Allows flex item to shrink below content size */
}

.messages-list {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 0 0 0;
  display: flex;
  flex-direction: column-reverse;
}

.messages-list::-webkit-scrollbar {
  width: 8px;
  background-color: var(--bg-primary);
}

.messages-list::-webkit-scrollbar-thumb {
  background-color: #666770;
  border-radius: 4px;
}

.message-item {
  display: flex;
  flex-wrap: wrap;
  padding: 2px 16px;
  margin-top: 17px;
}

.message-item:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.message-grouped {
  margin-top: 2px;
}

.grouped-timestamp-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  width: 40px;
  margin-right: 16px;
}

.grouped-timestamp {
  display: none;
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.375rem;
}

.message-grouped:hover .grouped-timestamp {
  display: block;
}

.message-avatar-wrapper {
  width: 40px;
  margin-right: 16px;
  margin-top: 2px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: white;
  font-size: 18px;
  user-select: none;
}

.message-body {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.username {
  font-size: 1rem;
  font-weight: 500;
  margin-right: 0.25rem;
  cursor: pointer;
}

.username:hover {
  text-decoration: underline;
}

.timestamp {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0.25rem;
  font-weight: 400;
}

.message-content {
  color: var(--text-normal);
  font-size: 1rem;
  line-height: 1.375rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Markdown Styles Tweaks */
.message-content strong {
  font-weight: 700;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  border-bottom: none;
  font-weight: 700;
  color: var(--header-primary);
}

.message-content ul,
.message-content ol {
  list-style-type: disc;
}

.message-content a {
  color: var(--text-link);
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message-content blockquote {
  border-left: 4px solid var(--text-muted);
  margin: 4px 0 4px 0;
  padding: 0 8px 0 12px;
  color: var(--header-secondary);
  background-color: transparent;
}

.message-content code {
  background-color: var(--embed-background);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
}

.message-content pre {
  background-color: var(--embed-background) !important;
  border-radius: 4px;
  border: 1px solid var(--bg-tertiary);
  padding: 8px !important;
  margin: 8px 0 !important;
  max-width: 100%;
  overflow-x: auto;
}

.chat-input-form {
  padding: 0 8px 8px;
  margin-top: 24px;
  background-color: var(--bg-primary);
}

.chat-input-wrapper {
  background-color: var(--channeltextarea-background);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 56px;
}

.chat-input-file-btn {
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  padding: 0 16px 0 0;
  display: flex;
  align-items: center;
  height: 24px;
  align-self: center;
}

.chat-input-file-btn:hover {
  color: var(--text-normal);
}

.chat-input-form textarea {
  flex: 1;
  padding: 11px 0;
  background-color: transparent;
  border: none;
  color: var(--text-default);
  font-size: 16px;
  font-family: inherit;
  height: 44px;
  resize: none;
  overflow: hidden;
  line-height: 1.375rem;
  box-sizing: border-box;
}

.chat-input-form textarea:focus {
  outline: none;
}

.chat-input-form textarea::placeholder {
  color: var(--text-muted);
}

.chat-input-icons {
  display: flex;
  align-items: center;
  padding: 0 0 0 10px;
  align-self: center;
  height: 100%;
}

.chat-input-icon-btn {
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  padding: 4px;
  margin-left: 4px;
  display: flex;
  align-items: center;
}

.chat-input-icon-btn:hover {
  color: var(--text-normal);
}

/* Link Previews */
.link-preview {
  display: flex;
  background-color: var(--embed-background);
  border-left: 4px solid var(--bg-tertiary);
  border-radius: 4px;
  padding: 10px;
  margin-top: 8px;
  max-width: 520px;
  width: 100%;
  gap: 16px;
  overflow: hidden;
  /* Ensure content stays inside */
  box-sizing: border-box;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.preview-site-name {
  font-size: 12px;
  color: var(--header-secondary);
  margin-bottom: 4px;
}

.preview-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-link);
  text-decoration: none;
  margin-bottom: 4px;
  display: block;
  word-wrap: break-word;
  /* Ensure long words don't overflow */
}

.preview-title:hover {
  text-decoration: underline;
}

/* .messages-content-wrapper */
.messages-content-wrapper {
  display: flex;
  flex-direction: column;
}

/* ... existing styles ... */

.preview-description {
  font-size: 14px;
  color: var(--text-normal);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-image-container {
  flex-shrink: 0;
  position: relative;
}

.preview-image {
  max-width: 150px;
  max-height: 150px;
  border-radius: 4px;
  object-fit: cover;
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Preview author line */
.preview-author {
  font-size: 13px;
  color: var(--header-primary);
  font-weight: 500;
  margin-bottom: 2px;
}

/* Provider-branded previews */
.twitter-preview {
  border-left-color: #1da1f2 !important;
}

.twitter-preview .preview-description {
  -webkit-line-clamp: 6;
  line-clamp: 6;
}

.spotify-preview {
  border-left-color: #1db954 !important;
}

.reddit-preview {
  border-left-color: #ff4500 !important;
}

/* Large image layout: image below content at full width */
.large-image-layout {
  flex-direction: column;
  gap: 8px;
}

.large-image-layout .preview-image-container.large-image {
  width: 100%;
  max-width: 400px;
}

.large-image-layout .preview-image-container.large-image .preview-image {
  width: 100%;
  max-width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.youtube-preview {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.youtube-preview .preview-image-container {
  width: 100%;
  max-width: 400px;
  position: relative;
}

.youtube-preview .preview-image {
  width: 100%;
  max-width: 100%;
  max-height: none;
  aspect-ratio: 16 / 9;
}

.youtube-video-wrapper {
  margin-top: 8px;
  position: relative;
  width: 100%;
  max-width: 560px;
  /* Standard YouTube embed width or max for chat */
  padding-bottom: 56.25%;
  /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  background-color: black;
}

.youtube-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 16px 8px 16px;
  position: relative;
}

.date-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border-subtle);
  z-index: 1;
}

.date-divider span {
  background-color: var(--bg-primary);
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  z-index: 2;
}

.verification-failed {
  display: flex;
  align-items: center;
  margin-right: 0.25rem;
  cursor: help;
}

/* Loading spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--brand-experiment);
    animation: spin 0.8s linear infinite;
}

/* Channel beginning indicator */
.channel-beginning {
    padding: 16px 16px 8px;
    margin-bottom: 8px;
}

.channel-beginning-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: var(--background-surface-highest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    color: var(--header-primary);
    margin-bottom: 8px;
}

.channel-beginning-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--header-primary);
    margin: 8px 0 4px;
}

.channel-beginning-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
}

/* Utility to hide scrollbar but allow scrolling */
.no-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ============================================
   TITLEBAR
   ============================================ */
.titlebar {
  height: 32px;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  -webkit-app-region: drag;
  z-index: 10000;
  flex-shrink: 0;
}

.titlebar-drag-region {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.titlebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.titlebar-buttons {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  display: flex;
  -webkit-app-region: no-drag;
}

.titlebar-btn {
  width: 46px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  transition: background-color 0.1s;
}

.titlebar-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.titlebar-close:hover {
  background-color: var(--danger);
  color: var(--header-primary);
}

/* ============================================
   CHAT HEADER
   ============================================ */
.chat-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background-color: var(--bg-primary);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-icon {
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 700;
}

.chat-header-name {
  color: var(--header-primary);
  font-weight: 700;
  font-size: 16px;
}

.chat-header-status-text {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 8px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-btn {
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.1s;
}

.chat-header-btn:hover {
  color: var(--text-normal);
}

.chat-header-btn.active {
  color: var(--header-primary);
}

.chat-header-search-wrapper {
  margin-left: 4px;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-header-search-icon {
  position: absolute;
  left: 8px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}

.chat-header-search {
  width: 214px;
  height: 28px;
  background-color: #17171a;
  border: 1px solid color-mix(in oklab,hsl(240 calc(1*4%) 60.784% /0.2) 100%,hsl(0 0% 0% /0.2) 0%);
  border-radius: 4px;
  color: color-mix(in oklab, hsl(240 calc(1*6.667%) 94.118% /1) 100%, #000 0%);
  padding: 0 28px 0 28px;
  font-size: 13px;
  outline: none;
  transition: width 0.25s ease;
  font-family: inherit;
}

.chat-header-search::placeholder {
  color: var(--text-muted);
}

.chat-header-search.focused {
  width: 240px;
}

.chat-header-search-clear {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 2px;
}

.chat-header-search-clear:hover {
  color: var(--header-primary);
}

/* ============================================
   MEMBERS LIST
   ============================================ */
.members-list {
  width: 240px;
  min-width: 240px;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px 8px;
  flex-shrink: 0;
}

.members-list::-webkit-scrollbar {
  width: 6px;
}

.members-list::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-auto-thumb);
  border-radius: 3px;
}

.members-role-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 16px 8px 4px;
}

.member-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.member-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.member-avatar-wrapper {
  position: relative;
  margin-right: 10px;
  flex-shrink: 0;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.member-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.member-info {
  min-width: 0;
}

.member-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-voice-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #3ba55c;
  font-size: 12px;
  font-weight: 500;
}

.member-voice-indicator svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.member-screen-sharing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #3ba55c;
  font-size: 12px;
  font-weight: 500;
}

.member-screen-sharing-indicator img {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ============================================
   REPLY SYSTEM
   ============================================ */
.reply-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--channeltextarea-background);
  border-left: 4px solid var(--brand-experiment);
  padding: 8px 12px;
  margin: 0 8px;
  border-radius: 4px 4px 0 0;
}

.reply-preview-content {
  font-size: 14px;
  color: var(--header-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reply-preview-content strong {
  color: var(--header-primary);
}

.reply-preview-text {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.reply-preview-close {
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 0 4px;
  line-height: 1;
}

.reply-preview-close:hover {
  color: var(--header-primary);
}

.message-reply-context {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 32px;
  padding: 2px 0;
  position: relative;
}

.reply-spine {
  position: absolute;
  top: 50%;
  left: -16px;
  width: 33px;
  height: 13px;
  border-left: 2px solid var(--text-muted);
  border-top: 2px solid var(--text-muted);
  border-top-left-radius: 6px;
  box-sizing: border-box;
}

.reply-avatar {
  flex-shrink: 0;
  border-radius: 50%;
  margin-left: 20px;
}

.message-reply-context .reply-author {
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
  cursor: pointer;
}

.message-reply-context .reply-author:hover {
  text-decoration: underline;
}

.message-reply-context .reply-text {
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-reply-context:hover .reply-text {
  color: var(--text-normal);
}

/* ============================================
   MESSAGE EDIT
   ============================================ */
.message-editing {
  margin: 4px 0;
}

.message-edit-textarea {
  width: 100%;
  background-color: var(--channeltextarea-background);
  border: none;
  border-radius: 8px;
  color: var(--text-normal);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.375rem;
  padding: 11px 16px;
  resize: none;
  outline: none;
  min-height: 44px;
  box-sizing: border-box;
}

.message-edit-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.message-edit-hint span {
  color: var(--text-link);
  cursor: pointer;
}

.message-edit-hint span:hover {
  text-decoration: underline;
}

.edited-indicator {
  color: var(--text-muted);
  font-size: 0.625rem;
  margin-left: 4px;
  user-select: none;
}

/* ============================================
   MESSAGE TOOLBAR
   ============================================ */
.message-toolbar {
  position: absolute;
  top: -40px;
  right: 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  box-shadow: 0 1px 5px 0 rgba(0,0,0,0.28);
  display: flex;
  align-items: center;
  z-index: 10;
  padding: 2px;
}

.icon-button:hover {
  background-color: var(--background-modifier-hover);
  border-radius: 4px;
}

/* ============================================
   CONTEXT MENU
   ============================================ */
.context-menu {
  position: fixed;
  background-color: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid var(--app-frame-border);
  box-shadow: 0 8px 16px rgba(0,0,0,0.24);
  z-index: 9999;
  min-width: 188px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: contextMenuFadeIn 0.1s ease;
}

@keyframes contextMenuFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-normal);
  justify-content: space-between;
  white-space: nowrap;
  border-radius: 8px;
  transition: background-color 0.1s;
}

.context-menu-item:hover {
  background-color: hsla(240, 4%, 60.784%, 0.078);
}

.context-menu-item-danger {
  color: hsl(1.353, 82.609%, 68.431%);
}

.context-menu-item-danger:hover {
  background-color: hsla(355.636, 64.706%, 50%, 0.078);
}

.context-menu-checkbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.context-menu-checkbox {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.context-menu-checkbox-indicator {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--header-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.context-menu-checkbox-indicator.checked {
  background-color: hsl(235, 86%, 65%);
  border-color: hsl(235, 86%, 65%);
}

.context-menu-separator {
  height: 1px;
  background-color: var(--bg-primary);
  margin: 4px 0;
}

/* ============================================
   CONTEXT MENU VOLUME SLIDER
   ============================================ */
.context-menu-volume {
  padding: 8px 12px;
}

.context-menu-volume-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--header-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.context-menu-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.context-menu-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.context-menu-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.context-menu-volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: transparent;
}

/* ============================================
   MENTION MENU
   ============================================ */
.mention-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--background-surface-high, var(--embed-background));
  border-radius: 5px;
  box-shadow: 0 10px 16px rgba(0,0,0,0.24);
  z-index: 100;
  margin: 8px;
}

.mention-menu-header {
  padding: 12px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--header-secondary);
}

.mention-menu-section-header {
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--header-secondary);
}

.mention-menu-role-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.mention-menu-scroller {
  max-height: 490px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.mention-menu-scroller::-webkit-scrollbar {
  width: 6px;
}

.mention-menu-scroller::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-auto-thumb, var(--bg-tertiary));
  border-radius: 3px;
}

.mention-menu-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
  cursor: pointer;
}

.mention-menu-row:hover,
.mention-menu-row.selected {
  background-color: var(--interactive-background-hover, rgba(255,255,255,0.06));
}

.mention-menu-row-primary {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-normal);
}

.mention-menu-row-secondary {
  font-size: 12px;
  margin-left: auto;
  color: var(--interactive-text-default, var(--text-muted));
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
  background-color: var(--background-base-lowest);
  color: var(--text-normal);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.tooltip-arrow {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--background-base-lowest);
  transform: rotate(45deg);
}

.tooltip-arrow-top {
  bottom: -4px;
  left: calc(50% - 4px);
}

.tooltip-arrow-bottom {
  top: -4px;
  left: calc(50% - 4px);
}

.tooltip-arrow-left {
  right: -4px;
  top: calc(50% - 4px);
}

.tooltip-arrow-right {
  left: -4px;
  top: calc(50% - 4px);
}

/* ============================================
   SERVER STRIP
   ============================================ */
.server-separator {
  width: 32px;
  height: 2px;
  background-color: var(--bg-primary);
  border-radius: 1px;
  margin: 4px 0 8px;
}

.server-item-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 8px;
}

.server-pill {
  position: absolute;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background-color: var(--header-primary);
  height: 0;
  transition: height 0.2s ease;
}

.server-item-wrapper:hover .server-pill {
  height: 20px;
}

.server-pill.active {
  height: 40px;
}

/* ============================================
   STATUS MENU
   ============================================ */
.status-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background-color: var(--background-base-lowest);
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  padding: 6px 8px;
  z-index: 100;
  margin-bottom: 4px;
}

.status-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
  border-radius: 2px;
  transition: background-color 0.1s;
}

.status-menu-item:hover {
  background-color: rgba(255,255,255,0.06);
}

.status-menu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-control-info {
  display: flex;
  align-items: center;
  margin-right: auto;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.1s;
  overflow: hidden;
}

.user-control-info:hover {
  background-color: rgba(255,255,255,0.05);
}

/* ============================================
   PINNED MESSAGES PANEL
   ============================================ */
.pinned-panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: 420px;
  max-height: calc(100% - 48px);
  background-color: var(--embed-background);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-radius: 0 0 0 8px;
}

.pinned-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.pinned-panel-header h3 {
  margin: 0;
  color: var(--header-primary);
  font-size: 16px;
}

.pinned-panel-close {
  background: none;
  border: none;
  color: var(--header-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.pinned-panel-close:hover {
  color: var(--header-primary);
}

.pinned-panel-content {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
}

.pinned-panel-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

.pinned-message-card {
  background-color: var(--bg-primary);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.pinned-message-card .message-item {
  padding: 8px 12px 4px;
}

.pinned-message-card .message-toolbar {
  display: none !important;
}

.pinned-message-card .message-content img,
.pinned-message-card .message-content video {
  max-width: 100%;
}

.pinned-message-actions {
  display: flex;
  gap: 8px;
  padding: 4px 12px 10px 68px;
}

.pinned-action-btn {
  background: none;
  border: 1px solid var(--text-muted);
  color: var(--header-secondary);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 13px;
  transition: all 0.1s;
}

.pinned-action-btn:hover {
  background-color: rgba(255,255,255,0.06);
  color: var(--header-primary);
}

.pinned-action-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.pinned-action-danger:hover {
  background-color: rgba(237, 66, 69, 0.1);
}

/* ============================================
   USER PROFILE POPUP
   ============================================ */
.user-profile-popup {
  width: 300px;
  background-color: var(--background-base-lowest);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  overflow: hidden;
}

.user-profile-banner {
  height: 60px;
}

.user-profile-body {
  padding: 0 16px 16px;
}

.user-profile-avatar-wrapper {
  position: relative;
  margin-top: -32px;
  margin-bottom: 8px;
  width: fit-content;
}

.user-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--background-base-lowest);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 24px;
}

.user-profile-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--background-base-lowest);
}

.user-profile-name {
  color: var(--header-primary);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}

.user-profile-status-text {
  color: var(--header-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.user-profile-divider {
  height: 1px;
  background-color: var(--bg-primary);
  margin: 8px 0;
}

.user-profile-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--header-primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.user-profile-about {
  color: var(--header-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.user-profile-message-btn {
  width: 100%;
  background-color: var(--brand-experiment);
  color: var(--header-primary);
  border: none;
  border-radius: 3px;
  padding: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.user-profile-message-btn:hover {
  background-color: var(--brand-experiment-hover);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  background-color: var(--embed-background);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  gap: 12px;
}

.toast-enter {
  animation: toastSlideIn 0.3s ease;
}

.toast-exit {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.toast-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  color: var(--text-normal);
  font-size: 14px;
}

.toast-preview {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.toast-close:hover {
  color: var(--text-normal);
}

/* ============================================
   MESSAGE HIGHLIGHT
   ============================================ */
@keyframes messageHighlight {
  0% { background-color: rgba(88, 101, 242, 0.2); }
  100% { background-color: transparent; }
}

.message-highlight {
  animation: messageHighlight 2s ease;
}

/* ============================================
   SYSTEM MESSAGES
   ============================================ */
.system-message-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
}

.system-message-text {
  color: var(--text-muted);
  font-size: 14px;
}

.system-message-time {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.7;
}

/* ============================================
   FRIENDS VIEW
   ============================================ */
.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.1s;
}

.friend-item:hover {
  background-color: rgba(255,255,255,0.04);
}

.friend-action-btn {
  padding: 8px;
  background-color: var(--embed-background);
  border-radius: 50%;
  cursor: pointer;
  color: var(--header-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s, color 0.1s;
}

.friend-action-btn:hover {
  background-color: var(--bg-primary);
  color: var(--text-normal);
}

.friends-tab {
  transition: background-color 0.1s;
}

.friends-tab:hover {
  background-color: rgba(255,255,255,0.04) !important;
}

/* ============================================
   DM LIST
   ============================================ */

.dm-search-wrapper {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--app-frame-border);
  flex-shrink: 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--header-primary);
  gap: 8px;
  margin-bottom: 8px;
}

.dm-search-input {
  width: 100%;
  height: 28px;
  background-color: var(--bg-tertiary);
  border: none;
  border-radius: 4px;
  color: var(--text-normal);
  padding: 0 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.dm-search-input::placeholder {
  color: var(--text-muted);
}

.dm-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--embed-background);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.dm-search-result {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
}

.dm-search-result:hover {
  background-color: rgba(255,255,255,0.06);
}

.dm-picker-user {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-normal);
  transition: background-color 0.1s;
}

.dm-picker-user:hover {
  background-color: rgba(255,255,255,0.06);
}

.dm-friends-btn {
  margin: 8px;
  display: flex;
  align-items: center;
  padding: 10px 8px;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  transition: background-color 0.1s;
}

.dm-friends-btn:hover {
  background-color: rgba(255,255,255,0.02);
}

.dm-friends-btn.active {
  background-color: rgba(255,255,255,0.04);
  color: var(--header-primary);
}

.dm-item {
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color 0.1s;
  position: relative;
  margin-bottom: 4px;
}

.dm-item:hover {
  background-color: rgba(255,255,255,0.04);
}

.dm-item-active {
  background-color: rgba(255,255,255,0.06);
  color: var(--header-primary);
}

.dm-item-status {
  font-size: 12px;
  color: var(--header-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-close-btn {
  opacity: 0;
  color: var(--header-secondary);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.1s;
}

.dm-item:hover .dm-close-btn {
  opacity: 1;
}

.dm-close-btn:hover {
  color: var(--text-normal);
}

/* ============================================
   MODAL SHADOWS
   ============================================ */
.auth-box,
.pinned-panel,
.context-menu,
.user-profile-popup,
.message-toolbar {
  box-shadow: 0 2px 10px 0 rgba(0,0,0,0.2);
}

/* ============================================
   CHANNEL ITEM HOVER TRANSITIONS
   ============================================ */
.channel-item {
  transition: background-color 0.1s ease;
}

.channel-settings-icon {
  transition: opacity 0.2s;
  opacity: 0;
}

.channel-item:hover .channel-settings-icon,
.channel-item.active .channel-settings-icon {
  opacity: 1;
}

/* ============================================
   SERVER HEADER
   ============================================ */
.server-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--app-frame-border);
  flex-shrink: 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--header-primary);
  gap: 8px;
}

.server-header-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 4px;
  transition: background-color 0.1s;
}

.server-header-name:hover {
  background-color: var(--background-modifier-hover);
}

.server-header-invite {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--interactive-normal);
  transition: color 0.15s, background-color 0.15s;
}

.server-header-invite:hover {
  color: var(--interactive-hover);
  background-color: var(--background-modifier-hover);
}

.server-header-invite img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(0.7);
}

.server-header-invite:hover img {
  filter: brightness(0) invert(0.9);
}

/* ============================================
   CHANNEL CATEGORIES
   ============================================ */
.channel-category-header {
  display: flex;
  align-items: center;
  padding: 16px 8px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  user-select: none;
}

.channel-category-header:hover {
  color: var(--interactive-hover);
}

.category-chevron {
  margin-left: 4px;
  font-size: 10px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.category-chevron.collapsed {
  transform: rotate(-90deg);
}

.category-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-add-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--interactive-normal);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.1s;
  display: flex;
  align-items: center;
}

.channel-category-header:hover .category-add-btn {
  opacity: 1;
}

.category-add-btn:hover {
  color: var(--interactive-hover);
}

/* ============================================
   CHAT HEADER ADDITIONS
   ============================================ */
.chat-header-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-subtle);
  margin: 0 8px;
  flex-shrink: 0;
}

.chat-header-topic {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.chat-header-topic:hover {
  color: var(--interactive-hover);
}

/* ============================================
   TITLEBAR NAV BUTTONS
   ============================================ */
.titlebar-nav {
  position: absolute;
  left: 8px;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  -webkit-app-region: no-drag;
}

.titlebar-nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--interactive-normal);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}

.titlebar-nav-btn:hover {
  color: var(--interactive-hover);
}

/* ============================================
   USER PROFILE ROLE BADGES
   ============================================ */
.user-profile-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.user-profile-role-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--panel-bg);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-normal);
  font-weight: 500;
}

.user-profile-role-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-profile-note-input {
  width: 100%;
  background-color: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 0;
  outline: none;
  font-family: inherit;
  resize: none;
}

.user-profile-note-input:focus {
  color: var(--text-normal);
}

/* ============================================
   USER BADGE (OWNER etc.)
   ============================================ */
.user-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--brand-experiment);
  color: var(--header-primary);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* ============================================
   VOICE TIMER
   ============================================ */
.voice-timer {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   NEW MESSAGES DIVIDER
   ============================================ */
.new-messages-divider {
  display: flex;
  align-items: center;
  margin: 8px 16px;
  position: relative;
}

.new-messages-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--danger);
  z-index: 1;
}

.new-messages-divider span {
  background-color: var(--bg-primary);
  padding: 0 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  z-index: 2;
  margin-left: auto;
}

/* ============================================
   THEME SELECTOR
   ============================================ */
.theme-selector-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.theme-selector-modal {
  background-color: var(--modal-background);
  border-radius: 8px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.theme-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.theme-selector-header h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 700;
}

.theme-selector-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.theme-selector-close:hover {
  color: var(--text-default);
}

.theme-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 20px;
}

.theme-card {
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  overflow: hidden;
}

.theme-card:hover {
  border-color: var(--border-normal);
}

.theme-card.active {
  border-color: var(--control-primary-background-default);
}

.theme-preview {
  height: 80px;
  display: flex;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.theme-preview-sidebar {
  width: 35%;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.theme-preview-channel {
  height: 6px;
  border-radius: 3px;
  width: 80%;
}

.theme-preview-chat {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.theme-preview-message {
  height: 8px;
  border-radius: 4px;
  width: 85%;
}

.theme-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-default);
  font-size: 14px;
  font-weight: 500;
}

.theme-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.theme-radio.active {
  border-color: var(--control-primary-background-default);
}

.theme-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--control-primary-background-default);
}

/* ============================================
   USER SETTINGS - AVATAR OVERLAY
   ============================================ */
.user-settings-avatar-wrapper {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
}

.user-settings-avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.user-settings-avatar-wrapper:hover .user-settings-avatar-overlay {
  opacity: 1;
}

/* Server icon upload (settings) */
.server-icon-upload-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.server-icon-upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.server-icon-upload-wrapper:hover .server-icon-upload-overlay {
  opacity: 1;
}

/* ============================================
   AVATAR CROP MODAL
   ============================================ */
.avatar-crop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.avatar-crop-dialog {
  width: 440px;
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.avatar-crop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.avatar-crop-area {
  position: relative;
  height: 300px;
  background-color: #000;
}

.avatar-crop-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.avatar-crop-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.avatar-crop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--header-primary);
  cursor: pointer;
  border: none;
}

.avatar-crop-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--header-primary);
  cursor: pointer;
  border: none;
}

.avatar-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 20px 20px;
}

/* ============================================
   USER SETTINGS - MIC LEVEL METER
   ============================================ */
.mic-level-bar {
  flex: 1;
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.mic-level-fill {
  height: 100%;
  background-color: #3ba55c;
  border-radius: 4px;
  transition: width 0.05s ease;
}

/* ============================================
   USER SETTINGS - VOICE SLIDER
   ============================================ */
.voice-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.voice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--header-primary);
  cursor: pointer;
  border: none;
}

.voice-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--header-primary);
  cursor: pointer;
  border: none;
}

/* ============================================
   UNREAD MESSAGES DIVIDER
   ============================================ */
.unread-divider {
  border-top: 1px solid var(--danger);
  margin: 0 16px 8px;
  position: relative;
  height: 0;
}

.unread-pill {
  position: absolute;
  top: -7px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px 1px 0;
  border-radius: 0 4px 4px 0;
  line-height: 13px;
  display: flex;
  align-items: center;
}

.unread-pill-cap {
  color: var(--danger);
  margin-left: -7px;
}

/* ============================================
   SIDEBAR UNREAD INDICATOR
   ============================================ */
.channel-unread-indicator {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--header-primary);
}

/* ============================================
   DM SERVER STRIP NOTIFICATIONS
   ============================================ */
.dm-server-icon {
  position: relative;
  padding: 0;
  overflow: visible;
}

.dm-server-icon img,
.dm-server-icon > div:first-child {
  width: 48px;
  height: 48px;
  border-radius: inherit;
}

.dm-notification-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background-color: #f23f42;
  border: 3px solid var(--bg-tertiary);
  border-radius: 50%;
  z-index: 1;
}

/* ============================================
   CREATE CHANNEL MODAL
   ============================================ */
.create-channel-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.create-channel-modal {
  width: 440px;
  max-width: 90vw;
  background-color: var(--bg-primary);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.create-channel-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 12px;
}

.create-channel-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.create-channel-modal-close:hover {
  color: var(--text-normal);
}

.channel-type-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--bg-secondary);
  margin-bottom: 8px;
  transition: background-color 0.1s;
}

.channel-type-option:hover {
  background-color: var(--background-modifier-hover);
}

.channel-type-option.selected {
  background-color: var(--background-modifier-selected);
}

.channel-type-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--interactive-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.channel-type-radio.selected {
  border-color: var(--brand-experiment);
}

.channel-type-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--brand-experiment);
}

.create-channel-name-input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  padding: 8px 12px;
}

.create-channel-name-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-normal);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  padding: 0;
}

.create-channel-name-input::placeholder {
  color: var(--text-muted);
}

.create-channel-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px;
  background-color: var(--bg-secondary);
  gap: 12px;
}

.create-channel-cancel-btn {
  background: none;
  border: none;
  color: var(--text-normal);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  font-family: inherit;
}

.create-channel-cancel-btn:hover {
  text-decoration: underline;
}

.create-channel-submit-btn {
  background-color: var(--brand-experiment);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s;
}

.create-channel-submit-btn:hover {
  background-color: var(--brand-experiment-hover);
}

.create-channel-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   CATEGORY TOGGLE SWITCH (visual only)
   ============================================ */
.category-toggle-switch {
  width: 40px;
  height: 24px;
  background-color: var(--interactive-normal);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.5;
}

.category-toggle-knob {
  width: 18px;
  height: 18px;
  background-color: var(--header-primary);
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
}

/* ============================================
   DRAG OVERLAY
   ============================================ */
.drag-overlay-channel {
  display: flex;
  align-items: center;
  padding: 8px;
  background-color: var(--background-modifier-selected);
  border-radius: 4px;
  color: var(--interactive-active);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: grabbing;
  opacity: 0.9;
  width: 200px;
}

/* ============================================
   FORCED UPDATE MODAL (Flatpak)
   ============================================ */
.forced-update-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
}

.forced-update-modal {
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.forced-update-modal h2 {
  color: var(--header-primary);
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}

.forced-update-modal p {
  color: var(--header-secondary);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.4;
}

.forced-update-btn {
  background-color: var(--brand-experiment);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s;
}

.forced-update-btn:hover {
  background-color: var(--brand-experiment-hover);
}

/* ============================================
   VOICE USER ITEM (sidebar)
   ============================================ */
.voice-user-item {
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  margin-right: 4px;
}

.voice-user-item:hover {
  background-color: var(--background-modifier-hover);
}

.drag-overlay-category {
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: grabbing;
  opacity: 0.9;
  width: 200px;
}

/* ============================================
   VOICE USER DRAG & DROP
   ============================================ */
.drag-overlay-voice-user {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--background-modifier-selected);
  border-radius: 8px;
  color: var(--interactive-active);
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: grabbing;
}

.voice-drop-target {
  background-color: rgba(88, 101, 242, 0.15) !important;
  outline: 2px dashed var(--brand-experiment);
  border-radius: 4px;
}

/* ============================================
   MOBILE BACK BUTTON
   ============================================ */
.mobile-back-btn {
  background: none;
  border: none;
  color: var(--header-secondary);
  cursor: pointer;
  padding: 4px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.mobile-back-btn:hover {
  color: var(--header-primary);
}

/* ============================================
   MOBILE RESPONSIVE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
  /* App container: full dynamic viewport, no titlebar gap */
  .app-container.is-mobile {
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }

  /* Sidebar fills entire screen on mobile */
  .is-mobile .sidebar {
    width: 100vw;
    min-width: 100vw;
  }

  /* Hide members list on mobile (also enforced in JS) */
  .is-mobile .members-list {
    display: none !important;
  }

  /* Auth box responsive */
  .auth-box {
    width: calc(100vw - 32px);
    max-width: 480px;
  }

  /* Pinned panel full-width on mobile */
  .is-mobile .pinned-panel {
    width: 100vw;
    right: 0;
    border-radius: 0;
  }

  /* Toast container centered on mobile */
  .is-mobile .toast-container {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
  }

  .is-mobile .toast {
    min-width: 260px;
  }

  /* Responsive modals */
  .create-channel-modal {
    width: calc(100vw - 32px);
  }

  .theme-selector-modal {
    width: calc(100vw - 32px);
  }

  .avatar-crop-dialog {
    width: calc(100vw - 32px);
  }

  .forced-update-modal {
    width: calc(100vw - 32px);
  }

  /* Chat container takes full width */
  .is-mobile .chat-container {
    width: 100vw;
  }

  /* Channel topic - hide on very small screens (also hidden via JS) */
  .is-mobile .chat-header-topic {
    display: none;
  }

  /* FriendsView takes full width */
  .is-mobile .friends-view {
    width: 100vw;
  }

  /* Search panel full-width on mobile */
  .is-mobile .search-panel {
    width: 100vw;
    right: 0;
    border-radius: 0;
  }
}

/* ============================================
   SEARCH DROPDOWN (appears below header input)
   ============================================ */
.search-dropdown {
  position: fixed;
  z-index: 10001;
  background-color: #111214;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: searchDropdownIn 0.15s ease;
}

@keyframes searchDropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-dropdown-scrollable {
  max-height: 500px;
  overflow-y: auto;
  padding: 8px 0;
}

.search-dropdown-scrollable::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown-scrollable::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-auto-thumb, var(--bg-tertiary));
  border-radius: 3px;
}

.search-dropdown-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--header-secondary);
  text-transform: uppercase;
  padding: 8px 16px 4px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
  transition: background-color 0.1s;
}

.search-dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-dropdown-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-dropdown-item-label {
  font-weight: 600;
  color: var(--header-primary);
}

.search-dropdown-item-desc {
  color: var(--text-muted);
  font-size: 13px;
}

.search-dropdown-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.search-dropdown-member:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-dropdown-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
  object-fit: cover;
}

img.search-dropdown-avatar {
  object-fit: cover;
}

.search-dropdown-member-name {
  color: var(--text-normal);
  font-size: 14px;
  font-weight: 500;
}

.search-dropdown-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
  transition: background-color 0.1s;
}

.search-dropdown-channel:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-dropdown-channel-hash {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.search-dropdown-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-dropdown-clear-all {
  background: none;
  border: none;
  color: var(--text-link);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.search-dropdown-clear-all:hover {
  text-decoration: underline;
}

.search-dropdown-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.search-dropdown-history-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-dropdown-history-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-dropdown-history-text {
  flex: 1;
  color: var(--text-normal);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-dropdown-history-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.1s;
  line-height: 1;
}

.search-dropdown-history-item:hover .search-dropdown-history-delete {
  opacity: 1;
}

.search-dropdown-history-delete:hover {
  color: var(--header-primary);
}

.search-dropdown-empty {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ============================================
   SEARCH PANEL (results)
   ============================================ */
.search-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  height: 100%;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

.search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-panel-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result-count {
  color: var(--header-secondary);
  font-size: 13px;
  font-weight: 600;
}

.search-panel-sort-wrapper {
  position: relative;
}

.search-panel-sort-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--text-link);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
}

.search-panel-sort-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-panel-sort-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background-color: #111214;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10;
  overflow: hidden;
  min-width: 120px;
}

.search-panel-sort-option {
  padding: 8px 12px;
  color: var(--text-normal);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.search-panel-sort-option:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.search-panel-sort-option.active {
  color: var(--text-link);
}

.search-panel-close {
  background: none;
  border: none;
  color: var(--header-secondary);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.search-panel-close:hover {
  color: var(--header-primary);
}

.search-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 16px;
}

.search-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: var(--brand-experiment);
  color: white;
  font-size: 12px;
  font-weight: 500;
}

.search-panel-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.search-panel-results::-webkit-scrollbar {
  width: 6px;
}

.search-panel-results::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-auto-thumb, var(--bg-tertiary));
  border-radius: 3px;
}

.search-panel-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-channel-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--header-secondary);
  text-transform: uppercase;
  padding: 8px 8px 4px;
  letter-spacing: 0.02em;
}

.search-result {
  background-color: var(--bg-primary);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background-color 0.1s;
  display: flex;
  gap: 12px;
}

.search-result:hover {
  background-color: var(--bg-mod-faint);
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.search-result-username {
  color: var(--header-primary);
  font-size: 1rem;
  font-weight: 600;
}

.search-result-time {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0;
}

.search-result-content {
  color: var(--text-normal);
  font-size: 0.9375rem;
  line-height: 1.375;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.search-result-content mark {
  background-color: rgba(250, 166, 26, 0.3);
  color: var(--text-normal);
  border-radius: 2px;
  padding: 0 1px;
}

.search-result-link {
  color: #00b0f4;
  text-decoration: none;
  cursor: pointer;
}
.search-result-link:hover {
  text-decoration: underline;
}

.search-result-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 3px;
  margin-top: 4px;
  margin-right: 4px;
  text-transform: uppercase;
}

/* DM Call Styles */
.dm-call-stage {
  height: 45%;
  min-height: 200px;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid var(--bg-tertiary);
  overflow: hidden;
  position: relative;
}

.dm-call-expand-btn {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 5;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--interactive-normal);
  opacity: 0.7;
  transition: opacity 0.15s;
}

.dm-call-expand-btn:hover {
  opacity: 1;
  color: var(--interactive-hover);
}

.dm-call-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 5;
}

.dm-call-resize-handle:hover {
  background: var(--interactive-normal);
  opacity: 0.3;
}

.dm-call-idle-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  padding: 32px 16px;
  gap: 8px;
  min-height: 200px;
  height: 45%;
  max-height: 80%;
  border-bottom: 2px solid var(--bg-tertiary);
}

.dm-call-idle-username {
  color: var(--text-normal);
  font-size: 18px;
  font-weight: 600;
  margin-top: 8px;
}

.dm-call-idle-status {
  color: var(--text-muted);
  font-size: 14px;
}

.dm-call-join-btn {
  background-color: #3ba55c;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.dm-call-join-btn:hover {
  background-color: #2d7d46;
}

/* Incoming call UI */
.incoming-call-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  padding: 32px 16px;
  gap: 12px;
  flex: 1;
  min-height: 260px;
}

.incoming-call-avatar-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.incoming-call-avatar-ring::before {
  content: '';
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid #3ba55c;
  animation: call-ring-pulse 1.5s ease-out infinite;
}

@keyframes call-ring-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.incoming-call-username {
  color: var(--text-normal);
  font-size: 20px;
  font-weight: 600;
}

.incoming-call-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.incoming-call-buttons {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.incoming-call-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: filter 0.15s;
}

.incoming-call-btn:hover {
  filter: brightness(1.15);
}

.incoming-call-btn.join {
  background-color: #3ba55c;
}

.incoming-call-btn.reject {
  background-color: #ed4245;
}

.voice-connecting-icon {
  animation: voiceConnectingPulse 1.5s ease-in-out infinite;
}

@keyframes voiceConnectingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}