/* ==========================================================================
   Design System & Tokens
   ========================================================================== */
:root {
  /* Surfaces & Elevations */
  --bg-base: #313338;        /* Main chat area (Elevation 0) */
  --bg-surface-1: #1e1f22;   /* Sidebar / Background frame (Elevation 1) */
  --bg-surface-2: #2b2d31;   /* Top nav / Cards / Channels (Elevation 2) */
  --bg-surface-3: #383a40;   /* Floating popovers / Hover cards (Elevation 3) */
  --bg-surface-hover: rgba(255, 255, 255, 0.05);
  --bg-surface-active: rgba(255, 255, 255, 0.09);

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Typography Colors */
  --text-primary: #f2f3f5;
  --text-secondary: #b5bac1;
  --text-muted: #80848e;
  --text-link: #00a8fc;

  /* Brand & Accents */
  --accent-primary: #5865f2;
  --accent-hover: #4752c4;
  --accent-soft: rgba(88, 101, 242, 0.16);

  /* Status Colors */
  --danger: #fa5252;
  --danger-soft: rgba(250, 82, 82, 0.12);
  --danger-border: rgba(250, 82, 82, 0.35);
  --success: #40c057;
  --success-soft: rgba(64, 192, 87, 0.15);
  --warning: #fcc419;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Fonts */
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;

  /* Dimensions */
  --sidebar-width: 290px;
  --header-height: 54px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-surface-1);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* Common Icon Utility */
.svg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Sidebar (Elevation 1)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-surface-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  user-select: none;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
}

.server-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  display: grid;
  place-items: center;
  color: #fff;
}

.server-icon-badge .svg-icon {
  width: 17px;
  height: 17px;
}

.server-meta {
  display: flex;
  flex-direction: column;
}

.server-name {
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
  letter-spacing: -0.2px;
}

/* Connection Status Pill */
.connection-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.conn-dot.live {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(64, 192, 87, 0.7);
  animation: pulseLive 2s infinite ease-in-out;
}

.conn-dot.reconnecting {
  background-color: var(--warning);
}

.conn-dot.offline {
  background-color: var(--danger);
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Metrics Strip */
.metrics-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid var(--border-subtle);
}

.metric-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.metric-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.metric-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1px;
}

.metric-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
}

.text-danger {
  color: var(--danger) !important;
}

/* Sidebar Search Button */
.sidebar-search-wrap {
  padding: 10px 12px 6px;
}

.sidebar-search-btn {
  width: 100%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-search-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.sidebar-search-btn span {
  flex: 1;
  text-align: left;
}

.shortcut-badge {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Channel Header in Sidebar */
.channel-section-header {
  padding: 14px 14px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.channel-count-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
}

/* Channel Navigation List */
.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
}

.channel-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
}

.channel-item.active {
  background-color: var(--bg-surface-active);
  color: #fff;
  font-weight: 600;
}

.channel-item.active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background-color: #fff;
}

.channel-icon {
  margin-right: 8px;
  opacity: 0.7;
}

.channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-badges-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  animation: pulseLive 1.2s infinite;
}

.badge-del-chip {
  background-color: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

.badge-total-chip {
  background-color: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Main View & Header (Elevation 0 & Elevation 2)
   ========================================================================== */
.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Top Header */
.top-nav {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
}

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

.channel-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hash-icon {
  color: var(--text-muted);
}

.channel-name-heading {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-stats-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Filter Chips */
.filter-chip {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-chip.active {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
  font-weight: 600;
}

.filter-chip.active-media {
  background: var(--accent-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.chip-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-size: 10.5px;
}

/* Active Filter Banner */
.active-filter-bar {
  background: rgba(250, 82, 82, 0.08);
  border-bottom: 1px solid var(--danger-border);
  padding: 7px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--danger);
}

.btn-clear-filters {
  background: none;
  border: none;
  color: var(--danger);
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Chat Messages Viewport
   ========================================================================== */
.messages-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}

.infinite-sentinel {
  height: 20px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.messages-stream {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Date Separator Pill */
.date-separator-row {
  display: flex;
  align-items: center;
  margin: 18px 16px 8px;
  position: relative;
  user-select: none;
}

.date-separator-row::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
}

.date-separator-pill {
  position: relative;
  margin: 0 auto;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   Message Row & Action Bar
   ========================================================================== */
.message-row {
  display: flex;
  padding: 4px 18px 4px 16px;
  position: relative;
  transition: background 0.1s ease;
  min-height: 28px;
}

.message-row:hover {
  background-color: rgba(0, 0, 0, 0.09);
}

/* Deleted Message Highlight */
.message-row.is-deleted {
  background-color: var(--danger-soft);
  border-left: 3px solid var(--danger);
  padding-left: 13px;
}

.message-row.highlight-pulse {
  animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
  0% { background-color: rgba(88, 101, 242, 0.4); }
  100% { background-color: transparent; }
}

/* Floating Action Bar on Message Hover */
.message-action-bar {
  position: absolute;
  top: -14px;
  right: 18px;
  background-color: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: none;
  align-items: center;
  padding: 2px;
  z-index: 10;
}

.message-row:hover .message-action-bar {
  display: flex;
}

.action-bar-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

.action-bar-btn .svg-icon {
  width: 15px;
  height: 15px;
}

/* Avatar Column */
.avatar-col {
  width: 40px;
  min-width: 40px;
  margin-right: 14px;
  display: flex;
  justify-content: center;
}

.author-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  display: block;
  object-fit: cover;
}

/* Compact Message Gutter Time */
.compact-gutter-time {
  font-size: 10px;
  color: var(--text-muted);
  width: 40px;
  text-align: right;
  margin-right: 14px;
  opacity: 0;
  user-select: none;
  line-height: 22px;
}

.message-row:hover .compact-gutter-time {
  opacity: 1;
}

/* Content Column */
.content-col {
  flex: 1;
  min-width: 0;
}

/* Reply Block */
.reply-quote-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
  cursor: pointer;
  user-select: none;
}

.reply-quote-bar:hover .reply-text {
  text-decoration: underline;
}

.reply-spine {
  width: 14px;
  height: 9px;
  border-left: 2px solid #585a62;
  border-top: 2px solid #585a62;
  border-top-left-radius: 5px;
  display: inline-block;
}

.reply-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.reply-author {
  font-weight: 600;
  color: var(--text-secondary);
}

.reply-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

/* Author Header */
.message-header-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 2px;
}

.author-username {
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}

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

/* Discord Clan / Primary Guild Badge Pill */
.clan-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 14px;
}

.clan-badge-icon {
  width: 12px;
  height: 12px;
  object-fit: contain;
}

/* Bot Badge */
.bot-badge-tag {
  background: var(--accent-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 12px;
}

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

.badge-tag-deleted {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.badge-tag-edited {
  font-size: 11px;
  color: var(--text-muted);
}

/* Message Markdown Body */
.message-body-text {
  word-wrap: break-word;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.45;
}

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

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

.message-body-text code {
  background: var(--bg-surface-1);
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e3e5e8;
}

.message-body-text pre {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
}

.message-body-text pre code {
  background: transparent;
  padding: 0;
}

.message-body-text blockquote {
  border-left: 3px solid #585a62;
  padding-left: 10px;
  margin: 4px 0;
  color: var(--text-secondary);
}

/* Spoiler pill */
.spoiler-pill {
  background: #202225;
  color: transparent;
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.spoiler-pill.revealed {
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  user-select: text;
}

/* Custom Emoji */
.custom-emoji-inline {
  width: 22px;
  height: 22px;
  vertical-align: -4px;
  object-fit: contain;
}

/* Mentions */
.mention-chip {
  background: var(--accent-soft);
  color: #c9cdfb;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}

/* Search Term Highlight */
mark.search-highlight {
  background: rgba(252, 196, 25, 0.35);
  color: #fff;
  border-radius: 2px;
  padding: 0 2px;
}

/* ==========================================================================
   Attachments & Embeds
   ========================================================================== */
.media-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.image-card-wrapper {
  max-width: 480px;
  max-height: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
}

.preview-media-img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.preview-media-img:hover {
  opacity: 0.94;
}

.preview-media-video {
  max-width: 480px;
  max-height: 360px;
  border-radius: var(--radius-md);
  background: #000;
  outline: none;
}

.preview-media-audio {
  width: 360px;
  max-width: 100%;
  margin-top: 4px;
}

/* File Box */
.file-card-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-width: 420px;
}

.file-icon-wrap {
  color: var(--text-muted);
}

.file-meta-col {
  flex: 1;
  min-width: 0;
}

.file-download-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-link);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size-text {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Embed Card */
.discord-embed-card {
  border-left: 4px solid var(--accent-primary);
  background: var(--bg-surface-2);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  margin-top: 6px;
  max-width: 520px;
}

.embed-title-text {
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
  margin-bottom: 4px;
}

.embed-desc-text {
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Reactions Bar */
.reactions-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.rxn-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12.5px;
  user-select: none;
}

.rxn-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   Typing Footer & Floating Pills
   ========================================================================== */
.typing-footer {
  min-height: 26px;
  padding: 4px 18px;
  background: var(--bg-base);
}

.typing-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.typing-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Floating Pills */
.floating-pill-btn {
  position: absolute;
  bottom: 34px;
  right: 28px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 14px;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 30;
  transition: transform 0.15s, background 0.15s;
}

.floating-pill-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* ==========================================================================
   Modals: Search Drawer & Lightbox
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 1000;
}

.search-dialog {
  width: min(640px, calc(100vw - 32px));
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.modal-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: #fff;
  font-family: inherit;
}

.search-operators-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-subtle);
}

.op-tag {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}

.op-tag:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.search-results-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.search-result-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-surface-hover);
}

.search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 3px;
}

.search-placeholder {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Lightbox Modal */
.lightbox-backdrop {
  align-items: center;
  padding-top: 0;
  cursor: zoom-out;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

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

.lightbox-toolbar {
  display: flex;
  gap: 10px;
}

.lightbox-action-btn {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lightbox-action-btn:hover {
  background: var(--bg-surface-3);
}

/* Toast Notifications */
.toast-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111214;
  border: 1px solid var(--border-strong);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 2000;
}

/* Skeletons */
.skeleton-row {
  opacity: 0.6;
}

.skeleton-pill {
  display: inline-block;
  height: 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  animation: shimmer 1.5s infinite;
}

.message-skeleton {
  display: flex;
  padding: 10px 18px;
  gap: 14px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  animation: shimmer 1.5s infinite;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.w-20 { width: 20%; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-80 { width: 80%; }

@keyframes shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}

/* Common Icon Button */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   Responsive & Accessibility
   ========================================================================== */
@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }
  .desktop-only {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
