/* ================================================
   Stitch Design System
   Light-first theme with dark mode alternate
   ================================================ */

/* ========== Design Tokens — Light Mode (default) ========== */
:root, [data-theme="light"] {
  --background: #f7f9fb;
  --foreground: #191c1e;
  --card: #ffffff;
  --card-foreground: #191c1e;
  --primary: #000000;
  --primary-foreground: #ffffff;
  --secondary: #f2f4f6;
  --secondary-foreground: #191c1e;
  --muted: #eceef0;
  --muted-foreground: #45464d;
  --accent: #e6e8ea;
  --accent-foreground: #191c1e;
  --destructive: #ba1a1a;
  --destructive-foreground: #ffffff;
  --border: #c6c6cd;
  --input: #eceef0;
  --ring: #3755c3;
  --radius: 0.125rem;
  --surface-tint: #3755c3;
  --accent-blue: #3755c3;
  --accent-blue-hover: #2a44a0;
  --online: #22c55e;
  --away: #eab308;
  --offline: #76777d;
  --sidebar-bg: #f1f5f9;
  --sidebar-hover: rgba(226, 232, 240, 0.5);
  --sidebar-active: #e2e8f0;
  --message-hover: #f2f4f6;
}

/* ========== Dark Mode ========== */
[data-theme="dark"] {
  --background: #0f1115;
  --foreground: #e0e3e5;
  --card: #1a1d23;
  --card-foreground: #e0e3e5;
  --primary: #e0e3e5;
  --primary-foreground: #191c1e;
  --secondary: #1e2128;
  --secondary-foreground: #e0e3e5;
  --muted: #1e2128;
  --muted-foreground: #8b8d93;
  --accent: #252830;
  --accent-foreground: #e0e3e5;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --border: #2e3138;
  --input: #252830;
  --ring: #607cec;
  --surface-tint: #607cec;
  --accent-blue: #607cec;
  --accent-blue-hover: #7b93f5;
  --sidebar-bg: #111318;
  --sidebar-hover: rgba(51, 65, 85, 0.5);
  --sidebar-active: #334155;
  --message-hover: #161920;
}

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

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Manrope', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
}

/* ========== Login Page ========== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--background);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(55, 85, 195, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(55, 85, 195, 0.03) 0%, transparent 50%);
}

[data-theme="dark"] .login-page {
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(96, 124, 236, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(96, 124, 236, 0.04) 0%, transparent 50%);
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 400px;
  padding: 3rem 2.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.06);
}

[data-theme="dark"] .login-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 1.5rem;
  background: var(--secondary);
  border-radius: 12px;
  color: var(--foreground);
}

.login-card h1 {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
  margin-bottom: 0.25rem;
  color: var(--foreground);
}

.login-card p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

/* ========== Alert (flash / error) ========== */
.alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-top: 1rem;
}

.alert-destructive {
  background: rgba(186, 26, 26, 0.08);
  border: 1px solid rgba(186, 26, 26, 0.2);
  color: var(--destructive);
}

[data-theme="dark"] .alert-destructive {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.25);
  color: #f87171;
}

.alert-destructive svg {
  flex-shrink: 0;
  color: var(--destructive);
}

[data-theme="dark"] .alert-destructive svg {
  color: #f87171;
}

.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #16a34a;
}

[data-theme="dark"] .alert-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
  color: #4ade80;
}

/* Flash messages */
.flash {
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.875rem;
}

.flash-error {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.flash-success {
  background: var(--online);
  color: #ffffff;
}

/* Legacy support */
.error-text {
  color: var(--destructive);
  margin-top: 1rem;
  font-size: 0.875rem;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.625rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  outline: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

.btn-destructive:hover {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-google {
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn-google:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-google svg {
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: background 150ms ease, color 150ms ease;
  text-decoration: none;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.btn-icon svg {
  flex-shrink: 0;
}

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

.btn-danger:hover {
  opacity: 0.85;
}

/* ========== Chat Layout ========== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== Sidebar ========== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: none;
}

.sidebar-header {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  height: 3.5rem;
}

[data-theme="dark"] .sidebar-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.sidebar-header h2 {
  font-size: 1rem;
  letter-spacing: -0.025em;
}

#sidebar-close {
  display: none;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.category {
  margin-bottom: 0.25rem;
}

.category-header {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  -webkit-user-select: none;
  user-select: none;
  color: var(--muted-foreground);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
}

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

.category-chevron {
  display: inline-flex;
  transition: transform 0.15s ease;
}

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

.channel-item {
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  color: var(--muted-foreground);
  display: flex;
  -webkit-user-select: none;
  user-select: none;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  margin: 1px 0.5rem;
  transition: background 150ms ease, color 150ms ease;
}

.channel-item:hover {
  background: var(--sidebar-hover);
  color: var(--foreground);
}

.channel-item.active {
  background: var(--sidebar-active);
  color: var(--foreground);
  font-weight: 600;
}

.channel-hash {
  color: var(--muted-foreground);
  font-weight: 500;
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.dm-section {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0.5rem 0;
}

[data-theme="dark"] .dm-section {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dm-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.dm-avatar-wrap .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border: 1.5px solid #e2e8f0;
}

[data-theme="dark"] .dm-avatar-wrap .status-dot {
  border-color: #0f172a;
}

.dm-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

/* DM user picker modal */
.dm-user-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.1s;
}

.dm-user-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .dm-user-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dm-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dm-user-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.dm-user-email {
  font-size: 0.75rem;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-user-option.selected {
  background: hsl(var(--accent));
}

.dm-user-check {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: hsl(var(--primary));
}

.dm-selected-bar {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.dm-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: hsl(var(--accent));
  font-size: 0.8rem;
  font-weight: 500;
}

.dm-chip-remove {
  border: none;
  background: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
}

.dm-chip-remove:hover {
  color: hsl(var(--destructive));
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
  letter-spacing: 0.1em;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sidebar-bg);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--background);
}

.channel-header {
  padding: 0 1rem;
  height: 3.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--secondary);
  flex-shrink: 0;
}

[data-theme="dark"] .channel-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.channel-info {
  flex: 1;
  min-width: 0;
}

.channel-info h3 {
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.channel-topic {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-actions {
  display: flex;
  gap: 0.125rem;
}

.mobile-menu {
  display: none;
}

/* ========== Messages ========== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.messages-container.drag-over {
  background: rgba(55, 85, 195, 0.04);
  outline: 2px dashed var(--accent-blue);
  outline-offset: -4px;
  border-radius: var(--radius);
}

[data-theme="dark"] .messages-container.drag-over {
  background: rgba(96, 124, 236, 0.04);
}

.message {
  display: flex;
  flex-direction: column;
  padding: 0.375rem 0.5rem;
  position: relative;
  border-radius: var(--radius);
  transition: background 150ms ease;
}

.message-row {
  display: flex;
  gap: 0.75rem;
}

.message:hover {
  background: var(--message-hover);
}

.message:hover .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm {
  width: 28px;
  height: 28px;
}

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

.message-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.message-author {
  font-weight: 600;
  font-size: 0.875rem;
}

.message-time {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.edited {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-style: italic;
}

.pinned {
  font-size: 0.75rem;
}

.message-content {
  line-height: 1.625;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 0.875rem;
  color: var(--foreground);
}

.message-content code {
  background: var(--secondary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius);
  font-size: 0.8125em;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--foreground);
}

.message-content pre {
  background: var(--muted);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.5rem 0;
}

[data-theme="dark"] .message-content pre {
  background: #111318;
}

.message-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--foreground);
}

.message-content a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: var(--accent-blue-hover);
}

.message-actions {
  position: absolute;
  top: -0.5rem;
  right: 0.5rem;
  opacity: 0;
  pointer-events: none;
  display: flex;
  gap: 0.125rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.125rem;
  transition: opacity 150ms ease;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.06);
}

[data-theme="dark"] .message-actions {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.message-actions .btn-icon {
  padding: 0.25rem;
}

/* ========== Reactions ========== */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.375rem;
}

.reaction {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background 150ms ease, border-color 150ms ease;
  line-height: 1.5;
}

.reaction:hover {
  background: var(--accent);
  border-color: var(--muted-foreground);
}

.reaction.active {
  background: rgba(55, 85, 195, 0.1);
  border-color: rgba(55, 85, 195, 0.35);
  color: var(--accent-blue);
}

[data-theme="dark"] .reaction.active {
  background: rgba(96, 124, 236, 0.12);
  border-color: rgba(96, 124, 236, 0.4);
}

.reaction-picker {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  display: flex;
  gap: 0.125rem;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.1);
}

[data-theme="dark"] .reaction-picker {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.reaction-option {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: background 150ms ease;
  line-height: 1;
}

.reaction-option:hover {
  background: var(--accent);
}

/* ========== Attachments & Gallery ========== */
.attachment-gallery {
  display: grid;
  gap: 4px;
  margin-top: 0.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 500px;
}

.attachment-single {
  display: block;
}

.attachment-single .gallery-img {
  max-width: 400px;
  max-height: 300px;
  border-radius: var(--radius);
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}

.grid-3 .gallery-img:first-child {
  grid-column: 1 / -1;
}

.grid-4plus {
  grid-template-columns: 1fr 1fr;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 150ms ease;
  border: 1px solid var(--border);
  min-height: 80px;
  max-height: 200px;
}

.gallery-img:hover {
  opacity: 0.85;
}

/* ========== File Preview (upload queue) ========== */
.file-preview {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
}

.file-preview-item {
  position: relative;
  flex-shrink: 0;
}

.file-preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.file-preview-file {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.file-preview-name {
  font-size: 0.65rem;
  text-align: center;
  padding: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  color: var(--muted-foreground);
}

.file-preview-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--destructive);
  color: white;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ========== Lightbox ========== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  z-index: 5001;
  opacity: 0.7;
  transition: opacity 150ms ease;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  opacity: 0.6;
  transition: opacity 150ms ease, background 150ms ease;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.attachment-video {
  max-width: 400px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent-blue);
  margin-top: 0.5rem;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 150ms ease, border-color 150ms ease;
}

.attachment-file:hover {
  background: var(--accent);
  border-color: var(--muted-foreground);
}

/* ========== Message Input ========== */
.typing-indicator {
  height: 1.25rem;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-style: italic;
  display: flex;
  align-items: center;
}

.message-input-container {
  display: block;
  padding: 1.5rem;
  background: var(--background);
  flex-shrink: 0;
}

.input-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px -4px rgba(25, 28, 30, 0.06);
}

[data-theme="dark"] .input-wrapper {
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.3);
}

.input-toolbar {
  display: flex;
  gap: 0.125rem;
  border-bottom: 1px solid var(--border);
}

#message-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  outline: none;
  line-height: 1.5;
}

#message-input::placeholder {
  color: var(--muted-foreground);
}

#message-input:focus {
  border: none;
  box-shadow: none;
  outline: none;
}

.send-btn {
  background: var(--primary);
  color: var(--primary-foreground);
  transition: opacity 150ms ease;
}

.send-btn:hover {
  opacity: 0.9;
}

/* ========== Edit Mode ========== */
.edit-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  min-height: 60px;
  outline: none;
  line-height: 1.5;
  transition: box-shadow 150ms ease;
}

.edit-input:focus {
  box-shadow: 0 0 0 2px rgba(55, 85, 195, 0.15);
}

[data-theme="dark"] .edit-input:focus {
  box-shadow: 0 0 0 2px rgba(96, 124, 236, 0.2);
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.save-edit {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: opacity 150ms ease;
}

.save-edit:hover {
  opacity: 0.9;
}

.cancel-edit {
  background: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}

.cancel-edit:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

/* ========== User List Panel ========== */
.user-list-panel {
  width: 256px;
  min-width: 256px;
  background: var(--secondary);
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0;
  overflow-y: auto;
}

[data-theme="dark"] .user-list-panel {
  border-left-color: rgba(255, 255, 255, 0.05);
}

.user-list-panel h3 {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.user-list-panel.open {
  right: 0;
}

.member-group-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 0.75rem 0 0.375rem;
  letter-spacing: 0.1em;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  border-radius: var(--radius);
  transition: background 150ms ease;
  position: relative;
  cursor: pointer;
}

.member-item:hover {
  background: var(--accent);
}

.member-item .avatar-sm {
  position: relative;
}

.member-item .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  border: 2px solid var(--sidebar-bg);
}

.member-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.member-avatar-wrap .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  border: 2px solid var(--secondary);
}

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

.status-online {
  background: var(--online);
}

.status-away {
  background: var(--away);
}

.status-offline {
  background: var(--offline);
}

/* ========== Context Menu ========== */
.context-menu {
  position: fixed;
  z-index: 2000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
  min-width: 180px;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.1);
}

[data-theme="dark"] .context-menu {
  background: var(--card);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.context-menu-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: none;
  border: none;
  color: var(--foreground);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 100ms ease;
}

.context-menu-item:hover {
  background: var(--accent);
}

.context-menu-header {
  padding: 0.4rem 0.75rem 0.25rem;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.context-menu-separator {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0.5rem;
}

.context-menu-danger {
  color: var(--destructive);
}

.context-menu-danger:hover {
  background: rgba(186, 26, 26, 0.08);
}

[data-theme="dark"] .context-menu-danger:hover {
  background: rgba(220, 38, 38, 0.15);
}

/* ========== Modals ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.1);
}

[data-theme="dark"] .modal {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-lg {
  width: 560px;
}

.modal-wide {
  width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-description {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ========== Forms ========== */
.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 10px;
  color: var(--muted-foreground);
  margin-bottom: 0.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.form-input {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 150ms ease;
}

[data-theme="dark"] .form-input {
  background: var(--input);
  border-color: var(--border);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(55, 85, 195, 0.1);
}

[data-theme="dark"] .form-input:focus {
  box-shadow: 0 0 0 2px rgba(96, 124, 236, 0.15);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-select {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
}

/* ========== Toggle Switch ========== */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 200ms ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 200ms ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-blue);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

/* ========== Channel Settings Modal (Discord-style) ========== */
.channel-settings-modal {
  width: 960px;
  max-width: 95vw;
  height: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: row;
  padding: 0;
}

.cs-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--secondary);
  border-right: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

[data-theme="dark"] .cs-sidebar {
  background: #111318;
  border-color: var(--border);
}

.cs-channel-name {
  padding: 0 1rem 0.75rem;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.cs-nav {
  display: flex;
  flex-direction: column;
  padding: 0 0.5rem;
  flex: 1;
}

.cs-nav-item {
  padding: 0.4rem 0.75rem;
  background: none;
  border: none;
  color: var(--muted-foreground);
  text-align: left;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 100ms ease, color 100ms ease;
}

.cs-nav-item:hover {
  background: var(--accent);
  color: var(--foreground);
}

[data-theme="dark"] .cs-nav-item:hover {
  background: var(--accent);
}

.cs-nav-item.active {
  background: var(--sidebar-active);
  color: var(--foreground);
}

[data-theme="dark"] .cs-nav-item.active {
  background: var(--accent);
}

.cs-sidebar-bottom {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
}

.cs-delete-btn {
  width: 100%;
  padding: 0.4rem 0.75rem;
  background: none;
  border: none;
  color: var(--destructive);
  text-align: left;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 100ms ease;
}

.cs-delete-btn:hover {
  background: rgba(186, 26, 26, 0.08);
}

[data-theme="dark"] .cs-delete-btn:hover {
  background: rgba(220, 38, 38, 0.15);
}

.cs-main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.cs-header h2 {
  font-size: 1.15rem;
}

.cs-desc {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 1.25rem;
}

.cs-private-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .cs-private-toggle {
  background: var(--muted);
  border-color: var(--border);
}

.cs-private-toggle strong {
  font-size: 0.95rem;
}

.cs-private-toggle p {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}

/* Permissions layout */
.cs-permissions-layout {
  display: flex;
  gap: 1px;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

.cs-role-list {
  width: 180px;
  min-width: 180px;
  background: var(--secondary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

[data-theme="dark"] .cs-role-list {
  background: #111318;
}

.cs-role-list-header {
  padding: 0.6rem 0.75rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}

.cs-role-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: background 100ms ease, color 100ms ease;
}

.cs-role-item:hover {
  background: var(--accent);
  color: var(--foreground);
}

[data-theme="dark"] .cs-role-item:hover {
  background: var(--accent);
}

.cs-role-item.active {
  background: var(--sidebar-active);
  color: var(--foreground);
}

[data-theme="dark"] .cs-role-item.active {
  background: var(--accent);
}

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

.cs-perm-panel {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.cs-perm-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.cs-perm-category {
  margin-bottom: 1.25rem;
}

.cs-perm-category-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.cs-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--muted);
}

[data-theme="dark"] .cs-perm-row {
  border-color: var(--border);
}

.cs-perm-info {
  flex: 1;
  min-width: 0;
}

.cs-perm-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.cs-perm-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}

.cs-perm-toggles {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-left: 1rem;
}

.cs-perm-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms ease, color 100ms ease;
  background: var(--muted);
  color: var(--muted-foreground);
}

[data-theme="dark"] .cs-perm-btn {
  background: var(--accent);
}

.cs-perm-btn:hover {
  background: var(--accent);
}

[data-theme="dark"] .cs-perm-btn:hover {
  background: #2e3138;
}

.cs-perm-deny.active {
  background: #b91c1c;
  color: white;
}

.cs-perm-inherit.active {
  background: var(--muted-foreground);
  color: white;
}

.cs-perm-allow.active {
  background: #16a34a;
  color: white;
}

.cs-sync-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: hsl(var(--accent));
  border: 1px solid hsl(var(--border));
}

/* ========== Search Panel ========== */
.search-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 150ms ease;
}

.search-input:focus {
  border-color: var(--accent-blue);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result {
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 0.25rem;
  transition: background 150ms ease;
}

.search-result:hover {
  background: var(--accent);
}

.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.search-result-content {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}

.search-result-content em {
  color: var(--accent-blue);
  font-style: normal;
  font-weight: 600;
}

.search-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
}

/* ========== Drag & Drop ========== */
.channel-item.dragging {
  opacity: 0.4;
}

.channel-item[draggable="true"] {
  cursor: grab;
}

.channel-item[draggable="true"]:active {
  cursor: grabbing;
}

.category.drag-target {
  outline: 2px dashed rgba(55, 85, 195, 0.4);
  outline-offset: -2px;
  border-radius: 4px;
}

[data-theme="dark"] .category.drag-target {
  outline-color: rgba(96, 124, 236, 0.4);
}

/* ========== Server Settings — Create Role ========== */
.ss-create-role {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* ========== Member list enhancements ========== */
.member-role-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.member-role-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 150ms ease;
}

.member-role-toggle:hover {
  background: var(--accent);
}

/* ========== Admin Pages ========== */
.admin-page {
  overflow: auto;
}

.admin-container {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
}

.admin-nav-item {
  padding: 0.5rem 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 150ms ease, color 150ms ease;
}

.admin-nav-item:hover {
  background: var(--accent);
  color: var(--foreground);
}

.admin-nav-item.active {
  background: rgba(55, 85, 195, 0.1);
  color: var(--accent-blue);
}

[data-theme="dark"] .admin-nav-item.active {
  background: rgba(96, 124, 236, 0.15);
  color: var(--accent-blue);
}

.admin-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.admin-main h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.03);
}

[data-theme="dark"] .admin-card {
  box-shadow: none;
}

.admin-card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.admin-table th {
  color: var(--muted-foreground);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ========== Badges ========== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

[data-theme="dark"] .badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.badge-warning {
  background: rgba(234, 179, 8, 0.12);
  color: #a16207;
}

[data-theme="dark"] .badge-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.badge-danger {
  background: rgba(186, 26, 26, 0.1);
  color: #b91c1c;
}

[data-theme="dark"] .badge-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

.badge-muted {
  background: var(--muted);
  color: var(--muted-foreground);
}

/* ========== Checkbox Grid ========== */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--foreground);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  transition: background 150ms ease;
  text-transform: capitalize;
}

.checkbox-grid label:hover {
  background: var(--accent);
}

/* ========== Custom Checkbox ========== */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 150ms ease, border-color 150ms ease;
}

input[type="checkbox"]:hover {
  border-color: var(--muted-foreground);
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--primary-foreground);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* ========== Custom Select ========== */
select,
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  transition: border-color 150ms ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2345464d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

[data-theme="dark"] select,
[data-theme="dark"] .form-select {
  background-color: var(--input);
  border-color: var(--border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8d93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

select:hover,
.form-select:hover {
  border-color: var(--muted-foreground);
}

select:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(55, 85, 195, 0.1);
}

[data-theme="dark"] select:focus,
[data-theme="dark"] .form-select:focus {
  box-shadow: 0 0 0 2px rgba(96, 124, 236, 0.15);
}

/* ========== Custom Color Input ========== */
input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 3px;
  background: var(--input);
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 1px;
}

/* ========== Custom Number Input ========== */
input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

/* ========== Permission Override Form ========== */
.perm-override-form {
  font-size: 0.875rem;
}

/* ========== Scrollbars ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(69, 70, 77, 0.2);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(69, 70, 77, 0.35);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(139, 141, 147, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 141, 147, 0.35);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(69, 70, 77, 0.2) transparent;
}

[data-theme="dark"] * {
  scrollbar-color: rgba(139, 141, 147, 0.2) transparent;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 300ms ease;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  [data-theme="dark"] .sidebar.open {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  #sidebar-close {
    display: flex;
  }

  .mobile-menu {
    display: flex;
  }

  .user-list-panel {
    position: fixed;
    right: -256px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: right 300ms ease;
    box-shadow: none;
  }

  .user-list-panel.open {
    right: 0;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  }

  [data-theme="dark"] .user-list-panel.open {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .channel-header {
    padding: 0 0.75rem;
  }

  .message-input-container {
    padding: 0.5rem 0.75rem 0.75rem;
  }

  .attachment-img {
    max-width: 100%;
  }

  .attachment-video {
    max-width: 100%;
  }

  .channel-settings-modal {
    flex-direction: column;
    height: 90vh;
  }

  .cs-sidebar {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    border-radius: 12px 12px 0 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }

  .cs-channel-name {
    display: none;
  }

  .cs-nav {
    flex-direction: row;
  }

  .cs-sidebar-bottom {
    border-top: none;
    border-left: 1px solid var(--border);
  }

  .cs-permissions-layout {
    flex-direction: column;
  }

  .cs-role-list {
    width: 100%;
    min-width: unset;
    max-height: 120px;
  }

  /* Mobile bottom tab bar — in document flow, not fixed */
  .mobile-tab-bar {
    display: flex !important;
    flex-shrink: 0;
    height: 60px;
    background: hsl(var(--card));
    border-top: 1px solid hsl(var(--border));
    align-items: center;
    justify-content: space-around;
    padding: 0 0.25rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: color 150ms ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab .material-symbols-outlined {
    font-size: 22px;
    transition: color 150ms ease;
  }

  .mobile-tab-label {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .mobile-tab.active {
    color: hsl(var(--primary));
  }

  .mobile-tab:active {
    color: hsl(var(--primary));
    opacity: 0.8;
  }

  /* Social sidebar drawer */
  .social-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    width: 240px;
    transition: left 300ms ease;
  }

  .social-sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  [data-theme="dark"] .social-sidebar.open {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .social-sidebar.open #social-sidebar-close {
    display: flex !important;
  }

  /* Make body a flex column so tab bar sits below app content */
  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .app-container {
    flex: 1;
    min-height: 0;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .user-list-panel {
    width: 200px;
    min-width: 200px;
  }
}

/* ========== Mobile Tab Bar ========== */

/* ========== Calendar ========== */
.rail-page[data-page="calendar"] {
  width: 100%;
}

.cal-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card);
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.cal-view-tabs {
  display: flex;
  background: var(--muted);
  border-radius: var(--radius);
  padding: 2px;
}

.cal-view-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--muted-foreground);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 150ms ease;
}

.cal-view-btn:hover {
  color: var(--foreground);
}

.cal-view-btn.active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.cal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: var(--background);
}

/* Month view */
.cal-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 1fr);
  height: 100%;
  min-height: 100%;
}

.cal-weekday-header {
  padding: 0.5rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.cal-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.25rem;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
  transition: background 100ms ease;
}

.cal-day:nth-child(7n) {
  border-right: none;
}

.cal-day:hover {
  background: var(--accent);
}

.cal-day.other-month {
  opacity: 0.35;
  background: #f0f0f2;
}

[data-theme="dark"] .cal-day.other-month {
  opacity: 0.35;
  background: #0a0c10;
}

.cal-day.today {
  background: #eef1ff;
}

[data-theme="dark"] .cal-day.today {
  background: #1a1e30;
}

.cal-day.today .cal-day-number {
  background: var(--accent-blue);
  color: #fff;
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cal-day-number {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 2px;
  display: inline-block;
  padding: 1px 4px;
}

.cal-event {
  font-size: 0.7rem;
  padding: 1px 4px;
  margin-bottom: 1px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.4;
  transition: filter 100ms ease;
}

.cal-event:hover {
  filter: brightness(1.15);
}

.cal-event-timed {
  background: hsl(217 91% 60%);
  color: #fff;
}

.cal-event-allday {
  background: hsl(217 91% 60% / 0.2);
  color: hsl(217 91% 45%);
  font-weight: 600;
}

[data-theme="dark"] .cal-event-allday {
  background: hsl(217 80% 55% / 0.25);
  color: hsl(217 80% 75%);
  font-weight: 600;
}

.cal-event-more {
  font-size: 0.65rem;
  color: var(--muted-foreground);
  padding: 0 4px;
  cursor: pointer;
}

.cal-event-more:hover {
  color: var(--foreground);
}

/* Week view */
.cal-week {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  height: 100%;
  overflow: auto;
}

.cal-week-header {
  display: contents;
}

.cal-week-header-cell {
  padding: 0.5rem 0.25rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
}

.cal-week-header-cell .cal-week-day-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.cal-week-header-cell.today .cal-week-day-num {
  background: var(--accent-blue);
  color: #fff;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-week-time-gutter {
  font-size: 0.65rem;
  color: var(--muted-foreground);
  text-align: right;
  padding: 0 6px 0 0;
  border-right: 1px solid var(--border);
  height: 48px;
  position: relative;
}

.cal-week-time-gutter span {
  position: relative;
  top: -0.5em;
}

.cal-week-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 48px;
  position: relative;
}

.cal-week-cell:nth-child(8n) {
  border-right: none;
}

.cal-week-event {
  position: absolute;
  left: 2px;
  right: 2px;
  background: hsl(217 91% 60%);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 4px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  line-height: 1.3;
}

.cal-week-event:hover {
  filter: brightness(1.15);
}

/* Day view */
.cal-day-view {
  display: grid;
  grid-template-columns: 60px 1fr;
  overflow: auto;
  height: 100%;
}

.cal-day-header {
  grid-column: 1 / -1;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
}

.cal-day-time-gutter {
  font-size: 0.65rem;
  color: var(--muted-foreground);
  text-align: right;
  padding: 0 6px 0 0;
  border-right: 1px solid var(--border);
  height: 48px;
  position: relative;
}

.cal-day-time-gutter span {
  position: relative;
  top: -0.5em;
}

.cal-day-slot {
  border-bottom: 1px solid var(--border);
  height: 48px;
  position: relative;
}

.cal-day-event {
  position: absolute;
  left: 4px;
  right: 4px;
  background: hsl(217 91% 60%);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
}

.cal-day-event:hover {
  filter: brightness(1.15);
}

/* Event popover */
.cal-event-popover {
  position: fixed;
  z-index: 1000;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  overflow: hidden;
}

.cal-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.cal-popover-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
}

.cal-popover-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cal-popover-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.cal-popover-row .material-symbols-outlined {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.cal-popover-gcal-link {
  margin-top: 0.5rem;
  text-align: center;
  text-decoration: none;
  font-size: 0.8rem;
}

.cal-popover-close {
  font-size: 1.2rem;
}

/* ========== PWA Install & Notification Banners ========== */
.pwa-install-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 4000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-width: 480px;
  width: calc(100% - 2rem);
  transition: transform 0.3s ease;
}

.pwa-install-banner.visible {
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .pwa-install-banner {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pwa-install-text strong {
  font-size: 0.85rem;
}

.pwa-install-text span {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.pwa-install-dismiss {
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* ========== Unread Indicators (Discord-style) ========== */
.channel-item {
  position: relative;
}

.channel-item .channel-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* White unread dot — left pill indicator */
.channel-item.has-unread::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--foreground);
  transition: height 0.15s ease;
}

.channel-item.has-unread:hover::before {
  height: 16px;
}

.channel-item.active::before {
  height: 24px;
}

/* Bold text for unread channels */
.channel-item.has-unread {
  font-weight: 600;
  color: var(--foreground);
}

/* Red mention badge */
.mention-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ed4245;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
}

/* Muted channel styling */
.channel-item.muted {
  opacity: 0.4;
}

.channel-item.muted.has-unread::before {
  display: none;
}

.channel-item.muted .mention-badge {
  opacity: 0.5;
}

/* ========== @Mention Autocomplete ========== */
.mention-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 4px;
  z-index: 100;
  display: none;
}

[data-theme="dark"] .mention-popup {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.mention-item:hover,
.mention-item.selected {
  background: var(--accent);
}

.mention-item .avatar {
  flex-shrink: 0;
}

/* ========== Slash Command Popup ========== */
.slash-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 4px;
  z-index: 100;
  display: none;
}

[data-theme="dark"] .slash-popup {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

.slash-popup-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 100ms ease;
}

.slash-popup-item:hover,
.slash-popup-item.active {
  background: hsl(var(--accent));
}

.slash-popup-name {
  font-weight: 600;
  color: hsl(var(--foreground));
  min-width: 80px;
}

.slash-popup-desc {
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

/* ========== Ephemeral Messages ========== */
.ephemeral-message {
  padding: 0.3rem 1.5rem;
  opacity: 0.7;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  animation: ephemeral-fade 10s ease-out forwards;
}

@keyframes ephemeral-fade {
  0%, 80% { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ========== Command Modal Extras ========== */
.poll-option-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.poll-option-row .form-input {
  flex: 1;
}

.poll-remove-opt {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-size: 1.1rem;
}

.poll-remove-opt:hover {
  background: hsl(var(--destructive));
  color: white;
}

/* ========== @Mention Highlights in Messages ========== */
.mention {
  background: rgba(55, 85, 195, 0.15);
  color: var(--accent-blue);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
  cursor: default;
}

.mention-me {
  background: rgba(55, 85, 195, 0.25);
}

.mention-everyone {
  background: rgba(250, 175, 0, 0.15);
  color: #d97706;
}

[data-theme="dark"] .mention {
  background: rgba(55, 85, 195, 0.3);
}

[data-theme="dark"] .mention-me {
  background: rgba(55, 85, 195, 0.45);
}

[data-theme="dark"] .mention-everyone {
  background: rgba(250, 175, 0, 0.25);
  color: #fbbf24;
}

/* ========== Reply Styles ========== */
/* Reply reference — compact original message above */
.reply-reference {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0 0.25rem 3.25rem;
  margin-bottom: 0.1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
  position: relative;
}

/* Curved connector: starts at avatar center, goes up and right to the reply text */
.reply-ref-connector {
  position: absolute;
  left: 1.25rem;
  bottom: 0;
  width: 1.5rem;
  height: 50%;
  border-left: 2px solid var(--border);
  border-top: 2px solid var(--border);
  border-top-left-radius: 6px;
  pointer-events: none;
}

.reply-reference:hover {
  color: var(--foreground);
}

.reply-reference:hover .reply-ref-connector {
  border-color: var(--muted-foreground);
}

.avatar-xxs {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.reply-author {
  font-weight: 600;
  color: var(--accent-blue);
  flex-shrink: 0;
  font-size: 0.75rem;
}

.reply-snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 0.75rem;
}

.reply-reference:hover .reply-snippet {
  color: var(--foreground);
}

.reply-count-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0;
  margin-top: 0.15rem;
}

.reply-count-btn:hover {
  text-decoration: underline;
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--secondary);
  border-radius: 6px 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  border-bottom: 2px solid var(--accent-blue);
}

.reply-preview strong {
  color: var(--foreground);
}

.reply-preview-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  opacity: 0.7;
}

.reply-cancel {
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  margin-left: auto;
  line-height: 1;
}

.reply-cancel:hover {
  color: var(--foreground);
}

.message.highlight {
  background: rgba(55, 85, 195, 0.1);
  transition: background 0.3s ease;
}

[data-theme="dark"] .message.highlight {
  background: rgba(55, 85, 195, 0.2);
}

/* ========== Profile Card ========== */
.profile-card {
  position: fixed;
  z-index: 3500;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

[data-theme="dark"] .profile-card {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.profile-card-banner {
  height: 48px;
  opacity: 0.8;
}

.profile-card-body {
  position: relative;
  z-index: 1;
  padding: 0 1rem 1rem;
  margin-top: -24px;
}

.profile-card-avatar {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--card);
  object-fit: cover;
}

.profile-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.25rem 0 0;
}

.profile-card-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}

.profile-card-status .status-dot {
  position: static;
  width: 8px;
  height: 8px;
}

.profile-card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.profile-card-role {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border: 1.5px solid;
  border-radius: 4px;
  background: transparent;
}

.profile-card-status-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-style: italic;
  margin-top: 0.15rem;
}

.profile-card-status-edit {
  margin-top: 0.4rem;
}

.profile-card-meta {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

/* ========== Quick Switcher (Cmd+K) ========== */
.quick-switcher {
  align-items: flex-start;
  padding-top: 15vh;
}

.quick-switcher-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 480px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

[data-theme="dark"] .quick-switcher-box {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.quick-switcher-box .form-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: transparent;
}

.qs-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.qs-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.qs-item:hover,
.qs-item.selected {
  background: var(--accent);
}

.qs-icon {
  width: 20px;
  text-align: center;
  opacity: 0.6;
}

.qs-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}
