/* ==========================================================================
   SecureChat Pro - Mobile Bottom Nav vs Desktop Left Rail Architecture
   Plus Chat Pinning, Muting, Starred Favorites & Unified Deep-Dark Palette
   ========================================================================== */

:root,
[data-theme="obsidian"] {
  /* Unified Deep-Dark Theme Palette (WeChat Dark + Telegram + WhatsApp) */
  --palette-deep-bg: #0b0e14;
  --palette-rail-bg: #0e131d;
  --palette-sidebar-bg: #121722;
  --palette-chat-bg: #090c12;
  --palette-card-bg: #161c2a;
  --palette-card-hover: #1c2436;
  --palette-border: rgba(255, 255, 255, 0.08);
  --palette-border-glow: rgba(59, 130, 246, 0.25);
  --palette-text-primary: #f1f5f9;
  --palette-text-secondary: #94a3b8;
  --palette-text-muted: #64748b;
  --palette-accent-blue: #3b82f6;
  --palette-accent-emerald: #10b981;
  --palette-accent-amber: #f59e0b;
  --palette-accent-rose: #ef4444;
  --tg-bar-bg: rgba(18, 23, 34, 0.88);
  --tg-bar-border: rgba(255, 255, 255, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="light"] {
  /* Warm Apple & WeChat System Light Theme (纯净高质感白底，绝无色块断层) */
  --palette-deep-bg: #f6f6f6;
  --palette-rail-bg: #f2f2f7;
  --palette-sidebar-bg: #ffffff;
  --palette-chat-bg: #efeae2;
  --palette-card-bg: #ffffff;
  --palette-card-hover: #f7f7f9;
  --palette-border: rgba(60, 60, 67, 0.12);
  --palette-border-glow: rgba(0, 122, 255, 0.2);
  --palette-text-primary: #111b21;
  --palette-text-secondary: #4b5563;
  --palette-text-muted: #8e8e93;
  --palette-accent-blue: #007aff;
  --palette-accent-emerald: #00a884;
  --palette-accent-amber: #ff9500;
  --palette-accent-rose: #ff3b30;
  --tg-bar-bg: rgba(246, 246, 246, 0.98);
  --tg-bar-border: rgba(60, 60, 67, 0.15);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="obsidian"]) {
    --palette-deep-bg: #f6f6f6;
    --palette-rail-bg: #f2f2f7;
    --palette-sidebar-bg: #ffffff;
    --palette-chat-bg: #efeae2;
    --palette-card-bg: #ffffff;
    --palette-card-hover: #f7f7f9;
    --palette-border: rgba(60, 60, 67, 0.12);
    --palette-border-glow: rgba(0, 122, 255, 0.2);
    --palette-text-primary: #111b21;
    --palette-text-secondary: #4b5563;
    --palette-text-muted: #8e8e93;
    --palette-accent-blue: #007aff;
    --palette-accent-emerald: #00a884;
    --palette-accent-amber: #ff9500;
    --palette-accent-rose: #ff3b30;
    --tg-bar-bg: rgba(246, 246, 246, 0.98);
    --tg-bar-border: rgba(60, 60, 67, 0.15);
  }
}

/* ==========================================================================
   1. DESKTOP LEFT VERTICAL ICON RAIL (>= 768px)
   ========================================================================== */
.desktop-left-rail {
  width: 68px;
  min-width: 68px;
  height: 100%;
  background: var(--palette-rail-bg);
  border-right: 1px solid var(--palette-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 14px;
  z-index: 25;
  flex-shrink: 0;
  user-select: none;
}

.rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.rail-avatar-box {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.rail-avatar-box:hover {
  transform: scale(1.05);
}

.rail-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--palette-accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.rail-status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--palette-rail-bg);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.rail-item {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: var(--palette-text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.rail-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--palette-text-primary);
}

.rail-item.active {
  background: rgba(59, 130, 246, 0.16);
  color: var(--palette-accent-blue);
}

.rail-item.active svg {
  stroke: var(--palette-accent-blue);
}

.rail-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-label {
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
  line-height: 1;
}

.rail-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--palette-accent-rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
  border: 2px solid var(--palette-rail-bg);
}

.rail-badge.badge-warning {
  background: var(--palette-accent-amber);
  color: #000;
}

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.rail-tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--palette-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rail-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--palette-text-primary);
}

/* ==========================================================================
   2. MOBILE NATIVE BOTTOM NAVIGATION BAR (< 768px, PURE MODERN SOCIAL ICON BAR)
   ========================================================================== */
.mobile-bottom-nav {
  display: flex !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 56px !important;
  max-height: 56px !important;
  min-height: 56px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  border-top: 0.5px solid rgba(60, 60, 67, 0.15) !important;
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.03);
  z-index: 1000 !important;
  justify-content: space-around !important;
  align-items: center !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
  box-sizing: border-box !important;
}

[data-theme="obsidian"] .mobile-bottom-nav {
  background: #0f172a !important;
  border-top: 0.5px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.2);
}

/* 每个导航按钮严格等分，图标放大50% */
.mobile-nav-btn {
  flex: 1 !important;
  width: 25% !important;
  max-width: 25% !important;
  height: 56px !important;
  max-height: 56px !important;
  min-height: 56px !important;
  background: transparent !important;
  border: none !important;
  color: #8e8e93 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  gap: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  position: relative !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
  box-sizing: border-box !important;
}

.mobile-nav-btn .mobile-nav-icon-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 40px !important;
  margin: 0 !important;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}

/* 36px 高清社交图标 (放大50%更清晰大气) */
.mobile-nav-btn svg,
.mobile-nav-btn .tg-tab-icon {
  width: 36px !important;
  height: 36px !important;
  stroke: #8e8e93 !important;
  stroke-width: 2.1 !important;
  transition: stroke 0.2s ease, fill 0.2s ease, transform 0.15s ease;
}

.mobile-nav-btn:active .mobile-nav-icon-box {
  transform: scale(0.88);
}

.mobile-nav-btn.active {
  color: #007aff !important;
}

.mobile-nav-btn.active svg,
.mobile-nav-btn.active .tg-tab-icon {
  stroke: #007aff !important;
}

.mobile-nav-btn.active[data-tab="chats"] svg path {
  fill: #007aff;
  fill-opacity: 0.18;
}

.mobile-nav-btn.active[data-tab="favorites"] svg polygon {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.mobile-nav-btn.active[data-tab="contacts"] svg circle {
  fill: #007aff;
  fill-opacity: 0.25;
}

.mobile-nav-btn.active[data-tab="settings"] svg circle {
  fill: #007aff;
  fill-opacity: 0.25;
}

/* 激活状态专属微型指示胶囊 */
.mobile-nav-active-pill {
  display: block;
  width: 4px;
  height: 2px;
  border-radius: 50%;
  background: transparent;
  margin-top: 1px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.mobile-nav-btn.active .mobile-nav-active-pill {
  background: #007aff;
  width: 10px;
  height: 2px;
  border-radius: 99px;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.4);
}

.mobile-nav-label {
  display: none !important;
}

.mobile-nav-btn .mobile-nav-icon-box,
.mobile-nav-btn .mobile-nav-label {
  align-self: center !important;
}

/* 导航图标：大幅放大至 30px */
.mobile-nav-btn .mobile-nav-icon-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  height: 38px !important;
  margin: 0 !important;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}

.mobile-nav-btn svg,
.mobile-nav-btn .tg-tab-icon {
  width: 34px !important;
  height: 34px !important;
  stroke: #8e8e93 !important;
  stroke-width: 2.2 !important;
  transition: stroke 0.2s ease, fill 0.2s ease, transform 0.15s ease;
}

.mobile-nav-btn:active .mobile-nav-icon-box {
  transform: scale(0.9);
}

.mobile-nav-btn.active {
  color: #007aff !important;
}

.mobile-nav-btn.active svg,
.mobile-nav-btn.active .tg-tab-icon {
  stroke: #007aff !important;
}

.mobile-nav-btn.active[data-tab="chats"] svg path {
  fill: #007aff;
  fill-opacity: 0.2;
}

.mobile-nav-btn.active[data-tab="favorites"] svg polygon {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.mobile-nav-btn.active[data-tab="contacts"] svg circle {
  fill: #007aff;
  fill-opacity: 0.25;
}

.mobile-nav-btn.active[data-tab="settings"] svg circle {
  fill: #007aff;
  fill-opacity: 0.25;
}

/* 配合的中文字：大幅放大至 14px~15px 加粗，沉底置于最下边缘 */
.mobile-nav-label {
  font-size: 14.5px !important;
  font-weight: 800 !important;
  letter-spacing: -0.2px !important;
  line-height: 1.05 !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif !important;
  color: #64748b !important;
  transition: color 0.15s ease, font-weight 0.15s ease;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center;
  white-space: nowrap;
}

.mobile-nav-btn.active .mobile-nav-label {
  color: #007aff !important;
  font-weight: 800 !important;
}

.mobile-nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--palette-accent-rose, #ff3b30);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  line-height: 19px;
  padding: 0 5px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
  border: 1.5px solid var(--palette-sidebar-bg);
  animation: tgBadgePop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tgBadgePop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.mobile-nav-badge.badge-warning {
  background: var(--palette-accent-amber);
  color: #000;
}

/* ==========================================================================
   3. RESPONSIVE TRANSITIONS (MOBILE VS DESKTOP)
   ========================================================================== */
@media screen and (max-width: 767px) {
  /* Hide Desktop Rail */
  .desktop-left-rail {
    display: none !important;
  }

  /* Show Mobile Bottom Nav */
  .mobile-bottom-nav {
    display: flex !important;
  }

  /* Smoothly slide out bottom nav when entering a chat */
  .main-wrapper.in-chat .mobile-bottom-nav {
    transform: translateY(100%);
    pointer-events: none;
    opacity: 0;
  }

  /* Give sidebar content space above bottom nav */
  .sidebar-content {
    padding-bottom: 58px !important;
  }

  /* On Mobile (< 768px): Hide desktop user profile bar to eliminate any status bar clipping / ghost reflections */
  .user-profile-bar {
    display: none !important;
  }

  /* Native Mobile Header: Permanently removed per user specification (Clean zero-blur interface) */
  .mobile-top-header {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }

  .mobile-top-title {
    display: none !important;
  }

  [data-theme="obsidian"] .mobile-top-title {
    color: #f8fafc !important;
  }

  .mobile-top-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--palette-accent-blue, #007aff);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
  }

  /* Hide Desktop Keyboard Shortcut (Cmd+K) on Mobile Touch Devices */
  .search-shortcut-badge,
  #btn-search-shortcut {
    display: none !important;
  }

  /* Mobile Top Sticky Bar: Extends from y=0 through the notch/island with 100% solid background (zero blur, zero frosted glass) */
  .mobile-top-bar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    z-index: 500 !important;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.1) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
  }

  /* Safari Browser Mode on iPhone: Snug 8px padding under Safari URL/status bar */
  .mode-browser .mobile-top-bar {
    padding-top: 8px !important;
    padding-bottom: 6px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Standalone PWA Mode on iPhone: Extends through notch (44-48px) or Dynamic Island (54-59px) */
  .mode-standalone .mobile-top-bar {
    padding-top: max(8px, env(safe-area-inset-top, 8px)) !important;
    padding-bottom: 6px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  [data-theme="obsidian"] .mobile-top-bar {
    background: #0f172a !important;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1) !important;
  }

  .sidebar:has(#tab-settings.active) .mobile-top-bar,
  .sidebar:has(#tab-favorites.active) .mobile-top-bar {
    display: none !important;
  }

  /* Mobile iOS Search Box Refinement (Thicker 48px, snug right below Dynamic Island) */
  .mobile-top-bar .search-box,
  .search-box {
    margin: 0 !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 13px !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 12px !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .search-box input {
    height: 100% !important;
    font-size: 15.5px !important;
    font-weight: 500 !important;
  }

  .search-box svg {
    width: 20px !important;
    height: 20px !important;
    stroke-width: 2.2 !important;
  }

  /* Automatically hide search box on Settings and Favorites */
  .sidebar:has(#tab-settings.active) .search-box,
  .sidebar:has(#tab-favorites.active) .search-box {
    display: none !important;
  }

  .sidebar:has(#tab-settings.active) #tab-settings {
    padding-top: 14px !important;
  }
  .sidebar:has(#tab-favorites.active) #tab-favorites {
    padding-top: 0 !important;
  }

  .chats-list-footer-note {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px 16px 4px 16px !important;
    color: #8e8e93 !important;
    font-size: 11.5px !important;
    user-select: none !important;
    opacity: 0.85 !important;
  }

  [data-theme="obsidian"] .chats-list-footer-note {
    color: #64748b !important;
  }

  /* Quick Workspace Deck: Transforms bottom blank void into high-utility iOS command cards */
  .chats-workspace-deck {
    margin: 6px 12px 14px 12px !important;
    padding: 12px 10px !important;
    background: #f8fafc !important;
    border-radius: 16px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02) !important;
  }

  [data-theme="obsidian"] .chats-workspace-deck {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  }

  .workspace-deck-title {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    letter-spacing: 0.3px !important;
    margin-bottom: 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    text-transform: uppercase !important;
  }

  [data-theme="obsidian"] .workspace-deck-title {
    color: #94a3b8 !important;
  }

  .workspace-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .workspace-card {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 8px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02) !important;
    cursor: pointer !important;
    transition: transform 0.12s ease, background 0.12s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .workspace-card:active {
    transform: scale(0.97) !important;
    background: #f1f5f9 !important;
  }

  [data-theme="obsidian"] .workspace-card {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
  }

  [data-theme="obsidian"] .workspace-card:active {
    background: #1e293b !important;
  }

  .ws-icon-box {
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .ws-icon-green { background: rgba(34, 197, 94, 0.12) !important; color: #16a34a !important; }
  .ws-icon-blue { background: rgba(14, 165, 233, 0.12) !important; color: #0284c7 !important; }
  .ws-icon-amber { background: rgba(245, 158, 11, 0.12) !important; color: #d97706 !important; }
  .ws-icon-purple { background: rgba(168, 85, 247, 0.12) !important; color: #9333ea !important; }

  .ws-card-info {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .ws-card-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  [data-theme="obsidian"] .ws-card-title {
    color: #f8fafc !important;
  }

  .ws-card-desc {
    font-size: 10px !important;
    color: #94a3b8 !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .workspace-security-pill {
    margin-top: 10px !important;
    padding: 7px 10px !important;
    background: rgba(241, 245, 249, 0.8) !important;
    border-radius: 100px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 10.5px !important;
    color: #64748b !important;
  }

  [data-theme="obsidian"] .workspace-security-pill {
    background: rgba(15, 23, 42, 0.6) !important;
    color: #94a3b8 !important;
  }

  .ws-sec-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .ws-sec-divider {
    width: 1px !important;
    height: 9px !important;
    background: rgba(148, 163, 184, 0.4) !important;
  }

  .ws-sec-dot {
    width: 5.5px !important;
    height: 5.5px !important;
    border-radius: 50% !important;
  }

  .ws-sec-dot-green { background: #22c55e !important; }
  .ws-sec-dot-blue { background: #0ea5e9 !important; }

  [data-theme="obsidian"] .search-box,
  html[data-theme="obsidian"] .search-box {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
  }

  .search-box svg {
    width: 19px !important;
    height: 19px !important;
    stroke-width: 2.2 !important;
    color: #8e8e93 !important;
    flex-shrink: 0;
  }

  /* Mobile Conversation List Item Typography (Enlarged Legibility) */
  .chat-conv-item .item-name,
  .item-name {
    font-size: 18.5px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
    color: var(--palette-text-primary, #ffffff) !important;
  }

  .chat-conv-item .item-preview,
  .item-preview {
    font-size: 15px !important;
    line-height: 1.45 !important;
    color: var(--palette-text-secondary, #94a3b8) !important;
  }

  .chat-conv-item .item-time,
  .item-time {
    font-size: 13px !important;
    color: var(--palette-text-muted, #64748b) !important;
  }

  /* Chat Message Bubbles: 17.5px iOS standard typography */
  .msg-bubble {
    font-size: 17.5px !important;
    line-height: 1.55 !important;
    padding: 13px 18px !important;
  }

  /* Mobile Search Box */
  .search-box input {
    font-size: 16.5px !important;
    font-weight: 400 !important;
    color: inherit !important;
  }

  .search-box input::placeholder {
    font-size: 15.5px !important;
    color: #8e8e93 !important;
  }

  /* Mobile Settings Rows - Apple HIG Large Typography */
  .settings-item-row {
    padding: 16px 18px !important;
    font-size: 17px !important;
    min-height: 54px !important;
  }

  .settings-item-left span {
    font-size: 17px !important;
    font-weight: 500 !important;
  }

  .settings-item-right span {
    font-size: 14.5px !important;
  }

  .settings-nickname {
    font-size: 23px !important;
    font-weight: 700 !important;
  }

  /* Ensure legacy top navigation tabs are permanently hidden across all screen sizes on mobile */
  .nav-tabs {
    display: none !important;
  }

  /* Ensure PWA banner and voice recorder never display inside active chat window */
  .main-wrapper.in-chat #pwa-install-banner,
  .main-wrapper.in-chat .pwa-banner-wrapper,
  .main-wrapper.in-chat #wa-voice-hud,
  .main-wrapper.in-chat .wa-voice-hud {
    display: none !important;
  }

  /* ==========================================================================
     Pure Mobile WhatsApp / Apple Messages Hybrid Specification
     ========================================================================== */

  /* 1. WhatsApp Clean Chat Header (100% Solid background, zero blur, zero transparency) */
  .chat-header.wa-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: max(10px, env(safe-area-inset-top, 10px)) !important;
    padding-bottom: 6px !important;
    padding-left: 6px !important;
    padding-right: 10px !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-sizing: border-box !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    will-change: auto !important;
  }

  .mode-standalone .chat-header.wa-header {
    padding-top: max(44px, env(safe-area-inset-top, 44px)) !important;
  }

  html[data-theme="obsidian"] .chat-header.wa-header,
  body[data-theme="obsidian"] .chat-header.wa-header,
  [data-theme="obsidian"] .chat-header.wa-header {
    background: #0f172a !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1) !important;
  }

  html[data-theme="light"] .chat-header.wa-header,
  body[data-theme="light"] .chat-header.wa-header,
  [data-theme="light"] .chat-header.wa-header {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12) !important;
  }

  .wa-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .wa-back-btn {
    background: transparent !important;
    border: none !important;
    color: #00a884 !important;
    padding: 6px 4px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    justify-content: center !important;
  }

  [data-theme="obsidian"] .wa-back-btn {
    color: #e9edef !important;
  }

  .wa-avatar {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
  }

  .wa-info {
    min-width: 0 !important;
  }

  .chat-header-title,
  .wa-title,
  #chat-target-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #000000 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 200px !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    will-change: auto !important;
  }

  [data-theme="obsidian"] .chat-header-title,
  [data-theme="obsidian"] .wa-title,
  [data-theme="obsidian"] #chat-target-title {
    color: #f8fafc !important;
  }

  .wa-subtitle,
  #chat-target-sub {
    font-size: 12px !important;
    color: #64748b !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    text-shadow: none !important;
  }

  [data-theme="obsidian"] .wa-subtitle,
  [data-theme="obsidian"] #chat-target-sub {
    color: #94a3b8 !important;
  }

  /* WhatsApp Header Right Icons (Monochrome black/charcoal) */
  .wa-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .wa-action-btn {
    background: transparent !important;
    border: none !important;
    color: #1c1c1e !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  [data-theme="obsidian"] .wa-action-btn {
    color: #aebac1 !important;
  }

  /* 2. WhatsApp / Apple Messages Warm Chat Wallpaper & Messages Stream */
  .wa-messages-container {
    background-color: #efeae2 !important; /* WhatsApp iconic soft warm grey-beige */
    background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px) !important;
    background-size: 20px 20px !important;
    padding: 6px 8px calc(56px + env(safe-area-inset-bottom, 8px)) 8px !important;
    overflow-y: auto !important;
  }

  [data-theme="obsidian"] .wa-messages-container {
    background-color: #0b141a !important;
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px) !important;
  }

  .messages-list {
    gap: 3px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* WhatsApp E2EE Security Card - Hidden per user directive for pure clean message list */
  .wa-security-card {
    display: none !important;
  }

  /* 3. WhatsApp Message Bubbles: Compact, High-Density Ergonomics */
  .msg-row {
    margin-bottom: 2px !important;
    max-width: 86% !important;
    gap: 6px !important;
  }

  /* Direct 1-on-1 Chat: Hide avatars completely on both sides (WhatsApp authentic standard) */
  .main-wrapper.in-chat[data-chat-type="direct"] .msg-avatar {
    display: none !important;
  }
  .main-wrapper.in-chat[data-chat-type="direct"] .msg-sender {
    display: none !important;
  }

  /* Group Chat: Compact 28px avatar for incoming, hidden for outgoing */
  .main-wrapper.in-chat[data-chat-type="group"] .msg-row.other .msg-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 11px !important;
    margin-top: 1px !important;
    flex-shrink: 0 !important;
  }
  .main-wrapper.in-chat[data-chat-type="group"] .msg-row.me .msg-avatar {
    display: none !important;
  }
  .main-wrapper.in-chat[data-chat-type="group"] .msg-sender {
    font-size: 11px !important;
    line-height: 1.1 !important;
    margin-bottom: 1px !important;
    color: #8e8e93 !important;
    font-weight: 600 !important;
  }

  .msg-row.me {
    justify-content: flex-end !important;
  }

  .msg-bubble {
    padding: 5px 9px !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    max-width: 84vw !important;
    box-shadow: 0 1px 1.5px rgba(11, 20, 26, 0.08) !important;
    position: relative !important;
  }

  .msg-inner-content {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    gap: 2px 6px !important;
    max-width: 100% !important;
  }

  .msg-content-body {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    letter-spacing: -0.1px !important;
  }

  .msg-inline-meta {
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
    opacity: 0.6 !important;
    margin-left: 5px !important;
    align-self: flex-end !important;
    user-select: none !important;
    white-space: nowrap !important;
  }

  .msg-inline-status {
    font-size: 10.5px !important;
    color: #8696a0 !important;
  }

  [data-theme="obsidian"] .msg-inline-status {
    color: #8696a0 !important;
  }

  /* My Bubble: WhatsApp signature soft pale green with tail notch */
  .msg-row.me .msg-bubble {
    background: #d9fdd3 !important;
    color: #111b21 !important;
    border: none !important;
    border-radius: 12px 12px 2px 12px !important;
    box-shadow: 0 1px 1.5px rgba(11, 20, 26, 0.1) !important;
  }

  [data-theme="obsidian"] .msg-row.me .msg-bubble {
    background: #005c4b !important;
    color: #e9edef !important;
    border-radius: 12px 12px 2px 12px !important;
    box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.2) !important;
  }

  /* Other Bubble: Clean soft white with tail notch */
  .msg-row.other .msg-bubble {
    background: #ffffff !important;
    color: #111b21 !important;
    border: none !important;
    border-radius: 12px 12px 12px 2px !important;
    box-shadow: 0 1px 1.5px rgba(11, 20, 26, 0.1) !important;
  }

  [data-theme="obsidian"] .msg-row.other .msg-bubble {
    background: #202c33 !important;
    color: #e9edef !important;
    border-radius: 12px 12px 12px 2px !important;
    box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.2) !important;
  }

  .msg-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 11.5px !important;
  }

  .msg-time {
    display: none !important;
  }

  /* 4. WhatsApp / Apple Messages Clean Solid Floating Input Bar */
  /* iOS frosted glass blur spec reference: backdrop-filter: blur(25px) */
  .wa-floating-footer,
  #message-input-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 6px !important;
    padding: 4px 6px max(4px, env(safe-area-inset-bottom, 4px)) 6px !important;
    margin: 0 !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    border-top: 0.5px solid rgba(60, 60, 67, 0.15) !important;
    z-index: 50 !important;
    box-sizing: border-box !important;
  }

  [data-theme="obsidian"] .wa-floating-footer,
  html[data-theme="obsidian"] .wa-floating-footer,
  [data-theme="obsidian"] #message-input-container,
  html[data-theme="obsidian"] #message-input-container {
    background: #0f172a !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1) !important;
  }

  /* WhatsApp Floating Pill */
  .wa-pill-input-box {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    padding: 2px 6px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    box-sizing: border-box !important;
    min-height: 38px !important;
  }

  [data-theme="obsidian"] .wa-pill-input-box {
    background: #2a3942 !important;
  }

  .wa-pill-btn {
    background: transparent !important;
    border: none !important;
    color: #54656f !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  [data-theme="obsidian"] .wa-pill-btn {
    color: #8696a0 !important;
  }

  .wa-pill-input-box textarea#message-input {
    flex: 1 !important;
    min-width: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    color: #111b21 !important;
    padding: 5px 4px !important;
    max-height: 100px !important;
    resize: none !important;
    box-sizing: border-box !important;
  }

  [data-theme="obsidian"] .wa-pill-input-box textarea#message-input {
    color: #e9edef !important;
  }

  /* WhatsApp Floating Green Action Circle */
  .wa-floating-action-circle {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: #00a884 !important; /* WhatsApp Green */
    box-shadow: 0 2px 6px rgba(0, 168, 132, 0.3) !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, background-color 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .wa-floating-action-circle:active {
    transform: scale(0.92) !important;
  }

  /* WhatsApp/WeChat Mobile Emoji Popover Docking */
  .emoji-popover {
    position: fixed !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 12px)) !important;
    left: 12px !important;
    right: 12px !important;
    max-width: 440px !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 12px !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid rgba(60, 60, 67, 0.15) !important;
    z-index: 60 !important;
  }

  [data-theme="obsidian"] .emoji-popover {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5) !important;
  }

  .emoji-item {
    font-size: 24px !important;
    padding: 6px !important;
    border-radius: 8px !important;
  }
}

/* ==========================================================================
   Pure Mobile Universal Layout (Desktop Rail Completely Disabled)
   ========================================================================== */
.desktop-left-rail {
  display: none !important;
}

.mobile-top-header {
  display: none !important;
}

.mobile-bottom-nav {
  display: flex !important;
}

.user-profile-bar {
  display: none !important;
}

.profile-actions {
  display: none !important;
}

/* ==========================================================================
   4. CHAT PINNING & MUTING ENHANCEMENTS
   ========================================================================== */
.chat-conv-item {
  position: relative;
  transition: background 0.2s ease, border 0.2s ease;
}

/* Pinned Conversation Item */
.chat-conv-item.is-pinned {
  background: rgba(59, 130, 246, 0.08) !important;
  border-left: 3px solid var(--palette-accent-blue) !important;
}

.chat-conv-item.is-pinned:hover {
  background: rgba(59, 130, 246, 0.12) !important;
}

.item-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--palette-accent-amber);
  margin-left: 4px;
  font-size: 12px;
  line-height: 1;
}

.item-mute-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--palette-text-muted);
  margin-left: 4px;
  font-size: 12px;
  line-height: 1;
}

/* Mark as Unread indicator dot */
.item-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--palette-accent-rose);
  display: inline-block;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* Conversation More Options Trigger */
.btn-conv-more {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--palette-text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.chat-conv-item:hover .btn-conv-more,
.chat-conv-item:focus-within .btn-conv-more {
  opacity: 1;
}

.btn-conv-more:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--palette-text-primary);
}

/* Floating Conversation Context Menu */
.conv-context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--palette-card-bg);
  border: 1px solid var(--palette-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 6px;
  min-width: 170px;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  animation: contextMenuPop 0.12s ease-out;
}

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

.conv-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--palette-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.conv-menu-item:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}

.conv-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.conv-menu-divider {
  height: 1px;
  background: var(--palette-border);
  margin: 4px 6px;
}

/* ==========================================================================
   5. STARRED / FAVORITE MESSAGES TAB & CARDS
   ========================================================================== */
#tab-favorites {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

#tab-favorites.active {
  display: flex;
}

.favorites-header {
  padding: 8px 12px 10px 12px !important;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

[data-theme="obsidian"] .favorites-header,
html[data-theme="obsidian"] .favorites-header {
  background: #0f172a !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1) !important;
}

/* Favorites Search Box: 100% Exact Match with Chats & Contacts search box (48px height, 15.5px font) */
.favorites-search-box {
  margin: 0 !important;
  height: 48px !important;
  min-height: 48px !important;
  border-radius: 13px !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  color: var(--palette-text-primary) !important;
}

[data-theme="obsidian"] .favorites-search-box,
html[data-theme="obsidian"] .favorites-search-box {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

.favorites-search-box input {
  height: 100% !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: inherit !important;
  font-size: 15.5px !important;
  font-weight: 500 !important;
  width: 100% !important;
  padding: 0 !important;
}

.favorites-search-box svg {
  width: 20px !important;
  height: 20px !important;
  stroke-width: 2.2 !important;
  color: #8e8e93 !important;
  flex-shrink: 0 !important;
}

.favorites-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.fav-chip {
  background: var(--palette-card-bg);
  border: 1px solid var(--palette-border);
  border-radius: 9999px;
  color: var(--palette-text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.fav-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.fav-chip.active {
  background: var(--palette-accent-blue);
  border-color: var(--palette-accent-blue);
  color: #fff;
}

.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.favorite-card {
  background: var(--palette-card-bg);
  border: 1px solid var(--palette-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  cursor: default;
}

.favorite-card:hover {
  border-color: var(--palette-border-glow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.fav-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fav-card-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fav-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

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

.fav-sender-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--palette-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-origin-tag {
  font-size: 11px;
  color: var(--palette-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-card-time {
  font-size: 11px;
  color: var(--palette-text-muted);
  flex-shrink: 0;
}

.fav-card-content {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--palette-text-primary);
  word-break: break-word;
  max-height: 150px;
  overflow-y: auto;
}

.fav-card-content img.fav-thumb {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  cursor: pointer;
  object-fit: cover;
}

.fav-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.fav-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--palette-border);
  border-radius: 6px;
  color: var(--palette-text-secondary);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fav-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.fav-action-btn.btn-jump-chat {
  color: var(--palette-accent-blue);
  border-color: rgba(59, 130, 246, 0.3);
}

.fav-action-btn.btn-jump-chat:hover {
  background: rgba(59, 130, 246, 0.18);
}

.fav-action-btn.btn-unstar:hover {
  color: var(--palette-accent-rose);
  border-color: rgba(239, 68, 68, 0.3);
}

.favorites-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--palette-text-muted);
  gap: 12px;
}

.favorites-empty svg {
  stroke: var(--palette-text-muted);
  opacity: 0.6;
}

/* Message Hover Action Star button */
.msg-act-btn.btn-act-fav.is-favorited {
  color: var(--palette-accent-amber);
  background: rgba(245, 158, 11, 0.15);
}

/* ==========================================================================
   6. CONTACTS SUB-TABS & SETTINGS PANE
   ========================================================================== */
.contacts-segmented-control {
  display: flex;
  margin: 12px 16px 8px;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

[data-theme="obsidian"] .contacts-segmented-control,
html[data-theme="obsidian"] .contacts-segmented-control {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

.contacts-sub-tab {
  flex: 1;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--palette-text-muted, #64748b);
  font-size: 14.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.contacts-sub-tab.active {
  background: var(--palette-card-bg, #ffffff) !important;
  color: var(--palette-text-primary, #0f172a) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

[data-theme="light"] .contacts-sub-tab.active {
  background: #ffffff !important;
  color: #007aff !important; /* 鲜明苹果蓝字在纯白卡片上，高对比度绝对清晰 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .contacts-sub-tab {
  color: #4b5563;
}

/* Settings Pane Styling */
#tab-settings {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 16px 14px;
  gap: 16px;
}

#tab-settings.active {
  display: flex;
}

.settings-profile-card {
  position: relative !important;
  background: var(--palette-card-bg);
  border: 1px solid var(--palette-border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-theme-quick-toggle {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  border: 1px solid #334155 !important;
  background: #1e293b !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 0.15s ease, background 0.2s ease !important;
  z-index: 10 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

[data-theme="light"] .btn-theme-quick-toggle,
html[data-theme="light"] .btn-theme-quick-toggle {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}

.btn-theme-quick-toggle:active {
  transform: scale(0.9) !important;
}

.settings-avatar-big {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--palette-accent-blue);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.settings-user-meta {
  flex: 1;
  min-width: 0;
}

.settings-nickname {
  font-size: 16px;
  font-weight: 700;
  color: var(--palette-text-primary);
}

.settings-handle {
  font-size: 12px;
  color: var(--palette-text-muted);
  margin-top: 2px;
}

.settings-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 6px;
  color: var(--palette-accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: 9999px;
}

.settings-group {
  background: var(--palette-card-bg);
  border: 1px solid var(--palette-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--palette-border);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  color: var(--palette-text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
  text-align: left;
}

.settings-item-row:last-child {
  border-bottom: none;
}

.settings-item-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-left svg {
  color: var(--palette-text-secondary);
}

.settings-item-right {
  color: var(--palette-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   5. Safari Browser Mode vs PWA Standalone Mode Adaptive Geometry Rules
   ========================================================================== */

/* Standalone PWA Root Viewport Stretch: Edge-to-edge lock, NEVER clamp with dvh */
html.mode-standalone,
html.mode-standalone body,
.mode-standalone #app,
.mode-standalone .main-wrapper,
#app,
.main-wrapper {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Base Bottom Nav: Anchored to physical bottom (0px gap), compressed thickness */
#mobile-bottom-nav,
.mobile-bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  justify-content: space-around !important;
  z-index: 1000 !important;
  background: #ffffff !important;
  border-top: 0.5px solid rgba(60, 60, 67, 0.12) !important;
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.03) !important;
}

/* Browser Mode: Sits flush above Safari toolbar, balanced 56px height */
html.mode-browser #mobile-bottom-nav,
.mode-browser .mobile-bottom-nav {
  height: 56px !important;
  max-height: 56px !important;
  min-height: 56px !important;
  padding: 0 !important;
  align-items: center !important;
}

/* Standalone PWA Mode (Safari 桌面 App): 56px interactive icon zone + Home Indicator safe area for all iPhone全面屏 (X ~ 17 Pro Max) */
html.mode-standalone #mobile-bottom-nav,
.mode-standalone #mobile-bottom-nav,
:root[data-standalone="true"] #mobile-bottom-nav {
  height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  min-height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  box-sizing: border-box !important;
  align-items: flex-start !important;
}

[data-theme="obsidian"].mode-browser #mobile-bottom-nav,
[data-theme="obsidian"].mode-standalone #mobile-bottom-nav,
[data-theme="obsidian"] .mobile-bottom-nav {
  background: #0f172a !important;
  border-top: 0.5px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Navigation Buttons: 56px height with centered icons */
.mode-browser .mobile-nav-btn {
  flex: 1 !important;
  width: 25% !important;
  max-width: 25% !important;
  height: 56px !important;
  max-height: 56px !important;
  min-height: 56px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
}

.mode-standalone .mobile-nav-btn,
.mobile-nav-btn {
  flex: 1 !important;
  width: 25% !important;
  max-width: 25% !important;
  height: 56px !important;
  max-height: 56px !important;
  min-height: 56px !important;
  padding: 0 0 2px 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
}

.mobile-nav-btn .mobile-nav-icon-box {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 40px !important;
  border-radius: 10px !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

.mobile-nav-btn:active .mobile-nav-icon-box {
  transform: scale(0.92) !important;
  background: rgba(142, 142, 147, 0.12) !important;
}

/* 36px High-Def Social Icon (Enlarged by 50%) */
.mobile-nav-btn .tg-tab-icon {
  width: 36px !important;
  height: 36px !important;
  stroke: #8e8e93 !important;
  stroke-width: 2.1 !important;
  transition: stroke 0.2s ease, transform 0.2s ease !important;
}

.mobile-nav-btn.active .tg-tab-icon {
  stroke: #007aff !important;
  transform: scale(1.04) !important;
}

[data-theme="obsidian"] .mobile-nav-btn.active .tg-tab-icon {
  stroke: #38bdf8 !important;
}

/* Active Indicator Pill under icon */
.mobile-nav-active-pill {
  display: block !important;
  width: 22px !important;
  height: 3.5px !important;
  border-radius: 99px !important;
  background: transparent !important;
  margin-top: 3px !important;
  transition: background 0.2s ease !important;
}

.mobile-nav-btn.active .mobile-nav-active-pill {
  background: #007aff !important;
}

[data-theme="obsidian"] .mobile-nav-btn.active .mobile-nav-active-pill {
  background: #38bdf8 !important;
}

/* Explicitly hide any residual Chinese text labels in nav */
.mobile-nav-label {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

.mode-browser .sidebar-content {
  padding-bottom: 64px !important;
}

.mode-standalone .sidebar-content {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Standalone top safe area: snug directly under Dynamic Island with 48px thicker height */
.mode-standalone .mobile-top-bar .search-box,
.mode-standalone .search-box {
  margin: 0 !important;
  height: 48px !important;
  min-height: 48px !important;
}

.mode-standalone .sidebar:has(#tab-settings.active) #tab-settings {
  padding-top: 14px !important;
}
.mode-standalone .sidebar:has(#tab-favorites.active) #tab-favorites {
  padding-top: 0 !important;
}

.mode-standalone .chat-header.wa-header {
  padding-top: max(44px, env(safe-area-inset-top, 44px)) !important;
}

/* Standalone chat footer: Safe area bottom padding for Home Indicator */
html.mode-standalone .wa-floating-footer,
html.mode-standalone #message-input-container,
.mode-standalone .wa-floating-footer,
.mode-standalone #message-input-container {
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px)) !important;
}

html.mode-browser .wa-floating-footer,
html.mode-standalone .wa-floating-footer,
.mode-browser .wa-floating-footer,
.mode-standalone .wa-floating-footer,
.wa-floating-footer,
html.mode-browser #message-input-container,
html.mode-standalone #message-input-container,
.mode-browser #message-input-container,
.mode-standalone #message-input-container,
#message-input-container {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 !important;
  padding: 5px 8px 3px 8px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: flex-end !important;
}

/* Strictly suppress any residual PWA install banner, voice recording HUD bar, or debug cards */
.pwa-banner-wrapper,
#pwa-install-banner,
.voice-recorder-bar,
#voice-recorder-bar,
.main-wrapper.in-chat .pwa-banner-wrapper,
.main-wrapper.in-chat #pwa-install-banner,
.main-wrapper.in-chat .voice-recorder-bar,
.main-wrapper.in-chat #voice-recorder-bar {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   6. PHYSICAL ELIMINATION OF ALL TOP BLUR AND HAZE ARTIFACTS
   100% Pure Solid Backgrounds, Zero Backdrop-Filter Bleed, Vector-Sharp Typography
   ========================================================================== */

/* Universal font-smoothing and razor-sharp text rendering across every single DOM node */
*,
*::before,
*::after {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

/* 1. All Full-Screen Modals, Overlays, Floating Banners and Toasts
   MUST be display: none !important; backdrop-filter: none !important;
   when not active, completely purging WebKit blur scratch buffers. */
.modal-backdrop:not(.show):not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.device-settings-modal:not(.show):not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.pattern-modal-backdrop:not(.show):not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.whiteboard-backdrop:not(.open):not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.lightbox-backdrop:not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.omni-palette-backdrop:not(.active):not([style*="display: flex"]):not([style*="display: block"]),
.ios-guide-modal:not(.show):not(.active):not([style*="display: flex"]):not([style*="display: block"]),
#in-app-notification:not(.show):not([style*="display: block"]),
.in-app-notification:not(.show):not([style*="display: block"]),
.message-select-toast:not(.show):not([style*="display: flex"]):not([style*="display: block"]),
.sticky-audio-player:not(.visible):not(.show),
.connection-status-banner:not(.banner-visible),
.pwa-banner-wrapper,
#app-floating-toast:not(.show) {
  display: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 2. Absolute eradication of all backdrop-filter blur across every component */
.modal-backdrop,
.modal-card,
.device-settings-modal,
.pattern-modal-backdrop,
.pattern-lock-overlay,
.whiteboard-backdrop,
.whiteboard-window,
.lightbox-backdrop,
.lightbox-header,
.lightbox-filmstrip-bar,
.lightbox-nav-btn,
.lightbox-toast,
.omni-palette-backdrop,
.omni-palette-card,
.ios-guide-modal,
.in-app-notification,
#in-app-notification,
.message-select-toast,
.message-select-bar,
.sticky-audio-player,
.connection-status-banner,
.pwa-banner-card,
.pwa-banner-wrapper,
.conv-context-menu,
.auth-card,
.call-control-bar,
.voice-recorder-bar,
.wb-floating-card,
.wb-text-input-overlay,
#app-floating-toast,
.wa-floating-footer {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

/* 3. Pure 100% Solid Opaque Top Headers & Backgrounds Across All Pages (Light #ffffff / Dark #0f172a) */
/* Light Theme Top Elements */
html[data-theme="light"] .sidebar,
body[data-theme="light"] .sidebar,
[data-theme="light"] .sidebar,
html:not([data-theme="obsidian"]):not([data-theme-setting="obsidian"]) .sidebar {
  background: #ffffff !important;
}

html[data-theme="light"] .chat-header.wa-header,
body[data-theme="light"] .chat-header.wa-header,
[data-theme="light"] .chat-header.wa-header {
  background: #ffffff !important;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12) !important;
}

html[data-theme="light"] .favorites-header,
body[data-theme="light"] .favorites-header,
[data-theme="light"] .favorites-header {
  background: #ffffff !important;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12) !important;
}

html[data-theme="light"] .settings-profile-card,
body[data-theme="light"] .settings-profile-card,
[data-theme="light"] .settings-profile-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .search-box,
body[data-theme="light"] .search-box,
[data-theme="light"] .search-box,
html[data-theme="light"] .contacts-segmented-control,
body[data-theme="light"] .contacts-segmented-control,
[data-theme="light"] .contacts-segmented-control,
html[data-theme="light"] .favorites-search-box,
body[data-theme="light"] .favorites-search-box,
[data-theme="light"] .favorites-search-box,
html[data-theme="light"] .btn-theme-quick-toggle,
body[data-theme="light"] .btn-theme-quick-toggle,
[data-theme="light"] .btn-theme-quick-toggle {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}

/* Dark Theme Top Elements */
html[data-theme="obsidian"] .sidebar,
body[data-theme="obsidian"] .sidebar,
[data-theme="obsidian"] .sidebar {
  background: #0f172a !important;
}

html[data-theme="obsidian"] .chat-header.wa-header,
body[data-theme="obsidian"] .chat-header.wa-header,
[data-theme="obsidian"] .chat-header.wa-header {
  background: #0f172a !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="obsidian"] .favorites-header,
body[data-theme="obsidian"] .favorites-header,
[data-theme="obsidian"] .favorites-header {
  background: #0f172a !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="obsidian"] .settings-profile-card,
body[data-theme="obsidian"] .settings-profile-card,
[data-theme="obsidian"] .settings-profile-card {
  background: #161b29 !important;
  border: 1px solid #232a3d !important;
}

html[data-theme="obsidian"] .search-box,
body[data-theme="obsidian"] .search-box,
[data-theme="obsidian"] .search-box,
html[data-theme="obsidian"] .contacts-segmented-control,
body[data-theme="obsidian"] .contacts-segmented-control,
[data-theme="obsidian"] .contacts-segmented-control,
html[data-theme="obsidian"] .favorites-search-box,
body[data-theme="obsidian"] .favorites-search-box,
[data-theme="obsidian"] .favorites-search-box,
html[data-theme="obsidian"] .btn-theme-quick-toggle,
body[data-theme="obsidian"] .btn-theme-quick-toggle,
[data-theme="obsidian"] .btn-theme-quick-toggle {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

/* 4. Ensure header titles, search placeholders, contact names are razor-sharp vector glyphs */
.chat-header.wa-header,
.chat-header-title,
.wa-title,
#chat-target-title,
.search-box input,
.contacts-sub-tab,
.favorites-search-box input,
.settings-nickname,
.settings-handle,
.item-name {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
  text-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ==========================================================================
   7. Group Creation Button & Contacts Entry Card (WeChat / WhatsApp Style)
   ========================================================================== */
.btn-top-create-group {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(0, 122, 255, 0.1) !important;
  color: #007aff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: transform 0.15s ease, background-color 0.15s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  margin-left: 2px !important;
}

.btn-top-create-group:active {
  transform: scale(0.92) !important;
  background: rgba(0, 122, 255, 0.22) !important;
}

[data-theme="obsidian"] .btn-top-create-group {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #38bdf8 !important;
}

.contacts-action-card {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 9px 12px !important;
  margin: 8px 12px 10px 12px !important;
  background: #ffffff !important;
  border-radius: 12px !important;
  border: 0.5px solid rgba(60, 60, 67, 0.12) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  cursor: pointer !important;
  transition: transform 0.12s ease, background 0.12s ease !important;
  -webkit-tap-highlight-color: transparent !important;
}

.contacts-action-card:active {
  transform: scale(0.98) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="obsidian"] .contacts-action-card {
  background: #1e293b !important;
  border: 0.5px solid rgba(255, 255, 255, 0.08) !important;
}

.contacts-action-icon {
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
  background: #10b981 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.contacts-action-info {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  min-width: 0 !important;
}

.contacts-action-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  line-height: 1.2 !important;
}

[data-theme="obsidian"] .contacts-action-title {
  color: #f1f5f9 !important;
}

.contacts-action-desc {
  font-size: 11.5px !important;
  color: #8e8e93 !important;
  margin-top: 1px !important;
}

.contacts-action-arrow {
  font-size: 18px !important;
  color: #c7c7cc !important;
  margin-right: 4px !important;
}

/* ==============================================================================
   DESKTOP PC WEB LAYOUT (STRICTLY ISOLATED & SCOPED)
   用户指令：电脑网页不用优化，检测到电脑网页你就排版稍微改一下左右两边让空间更大一点就行了；
   【铁律】：千万不要影响任何 iPhone 手机端与伪装网页 App！
   本段样式仅在 html 拥有 .device-desktop 且屏幕宽度 >= 1024px 时生效，iPhone 绝对不加载！
   ============================================================================== */
@media screen and (min-width: 1024px) and (pointer: fine) {
  html.device-desktop body {
    background: #eef2f6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  [data-theme="obsidian"].device-desktop body {
    background: #090d16 !important;
  }

  /* 电脑端居中容器：左右留出宽裕空间，空间更大更舒适 */
  html.device-desktop #app {
    position: relative !important;
    inset: auto !important;
    width: 88vw !important;
    max-width: 1160px !important;
    height: 92vh !important;
    max-height: 920px !important;
    margin: 0 auto !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(60, 60, 67, 0.12) !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  [data-theme="obsidian"].device-desktop #app {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
  }

  html.device-desktop .main-wrapper {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 18px !important;
    display: flex !important;
    flex-direction: row !important;
  }

  /* 电脑端双栏排版：左侧会话 360px，右侧聊天视窗自适应展开 */
  html.device-desktop .sidebar {
    position: relative !important;
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
    height: 100% !important;
    border-right: 1px solid rgba(60, 60, 67, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  [data-theme="obsidian"].device-desktop .sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  html.device-desktop #chat-area {
    display: flex !important;
    flex: 1 !important;
    width: calc(100% - 360px) !important;
    height: 100% !important;
    position: relative !important;
  }

  html.device-desktop #mobile-bottom-nav,
  html.device-desktop .mobile-bottom-nav,
  html.device-desktop .pwa-feed-install-card {
    display: none !important;
  }
}



