/* ============================================================
   Gen R Web Dashboard — Stylesheet (gen-r.in)
   Dark Slate Charcoal + Gen R Orange (#FF7A2F) + 6 Dynamic Themes
   ============================================================ */

:root {
  --bg: #0B0E14;
  --surface: #131822;
  --surface-elevated: #1A2230;
  --surface-hover: #222C3D;
  --border: #1F2937;
  --text: #F3F6FA;
  --text-muted: #94A3B8;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --emerald: #10B981;
  --emerald-hover: #059669;
  --emerald-soft: rgba(16, 185, 129, 0.16);
  --bubble-out: #2563EB;
  --bubble-out-text: #FFFFFF;
  --bubble-in: #18202E;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  --radius-card: 20px;
}

/* Light Mode */
[data-mode="light"] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-elevated: #F0F2F5;
  --surface-hover: #EAECEF;
  --border: #E2E6EC;
  --text: #161B22;
  --text-muted: #657382;
  --bubble-in: #FFFFFF;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
}

/* Dynamic App-Wide Accent & Surface Themes */
[data-theme="obsidian-blue"] {
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --bubble-out: #2563EB;
}
[data-theme="genr-orange"] {
  --primary: #FF7A2F;
  --primary-hover: #FF6414;
  --primary-soft: rgba(255, 122, 47, 0.16);
  --bubble-out: #FF7A2F;
}
[data-theme="amoled-black"][data-mode="dark"] {
  --bg: #000000;
  --surface: #0D0F12;
  --surface-elevated: #15181E;
  --surface-hover: #1D212A;
  --border: #20242D;
  --bubble-in: #15181E;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: rgba(59, 130, 246, 0.18);
  --bubble-out: #2563EB;
}
[data-theme="sunset-gold"] {
  --primary: #F59E0B;
  --primary-hover: #D97706;
  --primary-soft: rgba(245, 158, 11, 0.18);
  --bubble-out: #D97706;
}
[data-theme="emerald-night"] {
  --primary: #10B981;
  --primary-hover: #059669;
  --primary-soft: rgba(16, 185, 129, 0.18);
  --bubble-out: #059669;
}
[data-theme="ocean-slate"] {
  --primary: #38BDF8;
  --primary-hover: #0284C7;
  --primary-soft: rgba(56, 189, 248, 0.18);
  --bubble-out: #0284C7;
}
[data-theme="crimson-spark"] {
  --primary: #F43F5E;
  --primary-hover: #E11D48;
  --primary-soft: rgba(244, 63, 94, 0.18);
  --bubble-out: #E11D48;
}
[data-theme="ruby-red"] {
  --primary: #E53935;
  --primary-hover: #C62828;
  --primary-soft: rgba(229, 57, 53, 0.18);
  --bubble-out: #D32F2F;
}
[data-theme="rose-pink"] {
  --primary: #EC4899;
  --primary-hover: #DB2777;
  --primary-soft: rgba(236, 72, 153, 0.18);
  --bubble-out: #DB2777;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  max-width: 100vw;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.22s ease, color 0.22s ease;
  overflow: hidden;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code, pre {
  font-family: "JetBrains Mono", monospace;
}

.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ==================== QR LOGIN SCREEN ==================== */
.qr-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, var(--primary-soft), transparent 45%),
    var(--bg);
}

.qr-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: fadeSlideUp 280ms ease-out;
}

.qr-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.qr-brand h1 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.brand-domain {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

.qr-frame-wrap {
  position: relative;
  padding: 14px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.qr-code-box {
  width: 210px;
  height: 210px;
  display: grid;
  place-items: center;
}

.qr-code-box img, .qr-code-box canvas {
  width: 210px !important;
  height: 210px !important;
  border-radius: 8px;
}

.qr-center-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 4px solid #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
}

.qr-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
}

.qr-steps {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.qr-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qr-steps strong { color: var(--text); }

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.pairing-box {
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.pairing-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pairing-timer { color: var(--primary); font-weight: 600; }

.pairing-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pairing-code {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.4px;
}

.qr-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 22px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 140ms ease, background 150ms ease;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost, .btn-ghost-sm {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 18px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.btn-ghost:hover, .btn-ghost-sm:hover { background: var(--surface-hover); }

.btn-danger-sm {
  border: none;
  background: rgba(240, 84, 84, 0.16);
  color: var(--danger);
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-sm:hover { background: rgba(240, 84, 84, 0.28); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 140ms ease, color 140ms ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.active { color: var(--primary); background: var(--primary-soft); }

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard {
  height: 100vh;
  display: flex;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: 340px;
  min-width: 300px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  opacity: 0.65;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  padding: 0 14px 0 34px;
  font-size: 13.5px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 56px;
  left: 12px;
  width: 230px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu-item:hover { background: var(--surface-hover); }
.menu-danger { color: var(--danger); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 8px; }

.menu-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-orange { background: #FF7A2F; }
.dot-green { background: #22C55E; }
.dot-indigo { background: #6366F1; }
.dot-amber { background: #F59E0B; }
.dot-teal { background: #14B8A6; }
.dot-red { background: #F05454; }

/* Folder Tabs */
.folder-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 12px 10px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.folder-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.folder-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Archived Banner */
.archived-banner {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}
.archived-banner:hover { background: var(--surface-hover); }
.archived-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.archived-title { font-size: 14px; font-weight: 600; }
.archived-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archived-view-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  background: var(--surface-elevated);
}

/* Chat List Rows */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 80px;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 120ms ease;
  user-select: none;
}
.chat-row:hover { background: var(--surface-hover); }
.chat-row.selected { background: var(--primary-soft); }

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-group { background: #22C55E; }
.avatar-channel { background: #6366F1; }
.avatar-bot { background: #F59E0B; }
.avatar-archive { background: var(--surface-elevated); color: var(--primary); }

.chat-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row-top, .chat-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.chat-row-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-row-title {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-row-time { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }
.chat-row-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-row-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.bot-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  letter-spacing: 0.3px;
}

.unread-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.unread-badge.muted { background: var(--surface-hover); color: var(--text-muted); }

.fab-btn {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 22px rgba(255, 122, 47, 0.38);
  cursor: pointer;
  transition: transform 150ms ease;
}
.fab-btn:hover { transform: scale(1.06); }

/* ==================== CHAT PANE ==================== */
.chat-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 22px 22px;
}

.chat-header {
  height: 64px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.chat-header-text { min-width: 0; }
.chat-header-title-row { display: flex; align-items: center; gap: 7px; }
.chat-header-text h2 {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-text p { font-size: 12.5px; color: var(--text-muted); }
.chat-header-actions { display: flex; align-items: center; gap: 4px; }

.inchat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
}
.inchat-search-bar input {
  flex: 1;
  height: 36px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.pinned-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.pinned-accent, .context-accent {
  width: 3px;
  height: 32px;
  border-radius: 4px;
  background: var(--primary);
}
.pinned-copy, .context-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pinned-label, .context-title { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.pinned-text, .context-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  position: relative;
}
.msg-row.out { align-self: flex-end; align-items: flex-end; }
.msg-row.in { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.2px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.msg-row.out .msg-bubble {
  background: var(--bubble-out);
  color: var(--bubble-out-text);
  border-bottom-right-radius: 5px;
}
.msg-row.in .msg-bubble {
  background: var(--bubble-in);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

.msg-reply-quote {
  border-left: 3px solid rgba(255, 255, 255, 0.65);
  padding: 3px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 6px;
}

.msg-photo {
  max-width: 260px;
  max-height: 240px;
  border-radius: 12px;
  margin-bottom: 6px;
  display: block;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.78;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.reaction-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}

.msg-actions {
  display: none;
  gap: 3px;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 5px;
}
.msg-row:hover .msg-actions { display: flex; }

.msg-act-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 8px;
  cursor: pointer;
}
.msg-act-btn:hover { background: var(--surface-hover); color: var(--text); }

/* Composer */
.composer-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.composer-input {
  flex: 1;
  height: 42px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  outline: none;
}
.composer-input:focus { border-color: var(--primary); }

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
}
.send-btn:hover { background: var(--primary-hover); }

.emoji-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: var(--surface-elevated);
  border-top: 1px solid var(--border);
}
.emoji-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.emoji-btn:hover { background: var(--surface-hover); }

/* ==================== RIGHT INSPECTOR PANEL ==================== */
.inspector {
  width: 330px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inspector-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.inspector-hero .avatar { width: 76px; height: 76px; font-size: 28px; }

.info-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-card h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
}
.code-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
}
.info-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==================== CONTEXT MENU & MODALS ==================== */
.context-menu {
  position: fixed;
  min-width: 185px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeSlideUp 180ms ease-out;
}
.modal-wide { max-width: 520px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.modal-footer .btn-primary { width: auto; }

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.field-label input, .field-label textarea {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.field-label input:focus, .field-label textarea:focus { border-color: var(--primary); }

.dp-picker-row { display: flex; align-items: center; gap: 14px; }
.dp-circle-picker {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px dashed var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.dp-circle-picker img { width: 100%; height: 100%; object-fit: cover; }
.modal-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

/* Settings Modal */
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
}
.setting-row, .device-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.setting-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.pill-toggle {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.theme-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.theme-chip.active { border-color: var(--primary); background: var(--primary-soft); }
.theme-swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--primary);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 200;
}

.mobile-only { display: none; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .inspector {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 768px) {
  .mobile-only { display: grid; }
  .desktop-nav-rail { display: none !important; }
  .sidebar { width: 100%; min-width: 100%; max-width: 100vw; }
  .sidebar-bottom-dock { display: grid !important; }
  .dashboard.mobile-chat-open .sidebar { display: none; }
  .dashboard:not(.mobile-chat-open) .chat-pane { display: none; }
  .dashboard.mobile-chat-open .chat-pane { width: 100%; max-width: 100vw; }
  .composer-bar { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* ==================== STRICTLY 2-OPTION PASSWORDLESS AUTH STYLES ==================== */
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  width: 100%;
  border-radius: 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  margin: 4px 0 6px;
}
.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.auth-tab.active {
  background: var(--primary);
  color: #fff;
}
.auth-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}
.auth-secondary-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
}
.secret-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.auth-error {
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fb7185;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 500;
}
.waiting-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--primary);
  text-align: center;
}
.countdown-pill {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.countdown-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 99px;
}
.secret-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.secret-code-input {
  flex: 1;
  min-width: 140px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  padding: 9px 12px;
  font-size: 13.5px;
}
.linked-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.approval-modal-card {
  border-color: var(--primary);
}
.approval-copy {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
}
.approval-actions {
  justify-content: space-between;
}

/* ==================== PHONE-PARITY PC UI UPGRADES ==================== */
.sidebar-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.sidebar-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}
.sidebar-pane-header h2 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 18px;
  font-weight: 800;
}
.pane-search-wrap {
  padding: 4px 12px 10px;
}
.sidebar-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar-bottom-dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px 8px;
  background: var(--surface-elevated);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.dock-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.dock-tab:hover { background: var(--surface-hover); color: var(--text); }
.dock-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.dock-tab-center.active {
  background: var(--primary);
  color: #fff;
}
.dock-icon { font-size: 16px; line-height: 1.1; }
.dock-label { font-size: 10.5px; font-weight: 600; }

.fab-btn {
  bottom: 16px;
}

.settings-sidebar-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-setting-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}
.sidebar-setting-row:last-child { border-bottom: none; }
.sidebar-setting-row:hover { background: var(--surface-hover); }
.setting-chevron { color: var(--text-muted); font-size: 14px; font-weight: 600; }

.btn-danger-full {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(240, 84, 84, 0.35);
  background: rgba(240, 84, 84, 0.14);
  color: var(--danger);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease;
}
.btn-danger-full:hover { background: rgba(240, 84, 84, 0.24); }

/* Profile Hero & Media Gallery */
.profile-hero-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.profile-dp-wrap {
  position: relative;
  margin-bottom: 4px;
}
.avatar-lg {
  width: 78px;
  height: 78px;
  font-size: 28px;
  cursor: pointer;
}
.dp-camera-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  cursor: pointer;
}
.profile-bio-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.upload-pill {
  font-size: 11.5px;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
}
.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.profile-media-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #11151d;
  cursor: pointer;
}
.profile-media-tile img, .profile-media-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile-video-badge {
  position: absolute;
  left: 5px;
  bottom: 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 6px;
}
.tile-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}

/* Slimmer Grouped Bubbles, Borderless Media Bubbles, IST Date Dividers & Empty Welcome Card */
.msg-row {
  width: 100%;
  max-width: 100%;
  padding: 1.5px 6px;
  border-radius: 12px;
  transition: background 120ms ease;
}
.msg-row.selected-row {
  background: var(--primary-soft);
}
.msg-row .msg-bubble {
  max-width: 72%;
  padding: 6px 10px;
  border-radius: 16px;
  cursor: pointer;
}
.msg-row.out.grouped-prev .msg-bubble { border-top-right-radius: 5px; }
.msg-row.out.grouped-next .msg-bubble { border-bottom-right-radius: 5px; }
.msg-row.in.grouped-prev .msg-bubble { border-top-left-radius: 5px; }
.msg-row.in.grouped-next .msg-bubble { border-bottom-left-radius: 5px; }

.msg-bubble.photo-bubble,
.msg-bubble.video-bubble {
  padding: 0 !important;
  border: none !important;
  border-radius: 14px !important;
  overflow: hidden;
  background: transparent;
}
.msg-bubble.photo-bubble.has-caption,
.msg-bubble.video-bubble.has-caption {
  background: var(--surface-elevated);
}
.msg-photo-wrap,
.msg-video-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}
.msg-photo {
  max-width: 290px;
  max-height: 280px;
  width: 100%;
  object-fit: cover;
  border-radius: 0;
  margin-bottom: 0;
  display: block;
  cursor: zoom-in;
}
.msg-video {
  max-width: 290px;
  max-height: 256px;
  width: 100%;
  border-radius: 0;
  display: block;
  background: #000;
}
.floating-media-meta {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.56);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}
.photo-caption-wrap {
  padding: 6px 10px 5px;
}

.chat-date-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0 6px;
  width: 100%;
}
.chat-date-divider span {
  background: rgba(11, 14, 20, 0.78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}
.floating-date-pill {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  z-index: 25;
  background: rgba(11, 14, 20, 0.88);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 13px;
  border-radius: 999px;
  pointer-events: none;
  will-change: transform, opacity;
  transition: opacity 180ms ease;
}
.empty-room-welcome-card {
  margin: auto;
  max-width: 310px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  background: rgba(19, 24, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-room-welcome-card h4 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
}
.empty-room-welcome-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}
.empty-room-welcome-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Video Player Settings Menu */
.mv-video-settings-menu {
  min-width: 210px;
  padding: 6px 0;
}
.mv-loop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13.5px;
  color: #fff;
  cursor: pointer;
}
.mv-speed-heading {
  padding: 4px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.6);
}
.mv-speed-opt {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}
.mv-speed-opt.active {
  color: var(--primary) !important;
  font-weight: 700;
}

/* Selection Top & Bottom Bars */
.selection-top-bar {
  background: var(--surface-elevated);
}
.selection-count {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  padding-left: 6px;
}
.danger-icon { color: var(--danger); }
.selection-bottom-bar {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.selection-pill-btn {
  flex: 1;
  height: 44px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.selection-pill-btn:hover { background: var(--surface-hover); border-color: var(--primary); }

/* Floating Message Tap Popup (Screenshot 7) */
.msg-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.msg-popup-stack {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: fadeSlideUp 140ms ease-out;
}
.msg-popup-reactions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.popup-react-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.popup-react-btn:hover { background: var(--surface-hover); transform: scale(1.14); }
.msg-popup-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.popup-read-row {
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.popup-action-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.popup-action-btn:hover { background: var(--surface-hover); }
.popup-action-btn.danger { color: var(--danger); }

/* Fullscreen Photo/Video Viewer + Canvas Editor (Screenshots 3, 6, 8) */
.media-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 150;
  display: flex;
  flex-direction: column;
}
.media-viewer-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.25));
  z-index: 2;
}
.light-icon { color: #fff; }
.light-icon:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.light-pill { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.mv-title-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.mv-title-col strong { font-size: 15px; }
.mv-title-col span { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.mv-actions { display: flex; align-items: center; gap: 4px; position: relative; }
.mv-menu-wrap { position: relative; }
.mv-dropdown {
  top: 44px;
  left: auto;
  right: 0;
  width: 210px;
}
.mv-counter-pill {
  align-self: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 14px;
  margin-top: 6px;
}
.mv-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 14px;
}
.mv-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 180ms ease;
}
.mv-image.zoomed {
  transform: scale(1.75);
  cursor: zoom-out;
}
.mv-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}
.mv-caption {
  text-align: center;
  color: #fff;
  padding: 10px 18px 16px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 14px;
}
.mv-all-grid {
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  align-self: flex-start;
}
.mv-grid-item {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}
.mv-grid-item.active { border-color: var(--primary); }
.mv-grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Canvas Photo Editor */
.pe-canvas-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
}
.pe-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.pe-controls {
  background: rgba(16, 18, 24, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pe-palette-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pe-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.pe-color-dot.active { border: 3px solid #fff; transform: scale(1.15); }
.pe-text-row {
  display: flex;
  gap: 8px;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.pe-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.pe-tabs { display: flex; gap: 14px; }
.pe-tab {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
}
.pe-tab.active {
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.14);
}
.pe-confirm-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #38BDF8;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== MULTI-ACCOUNT SWITCHER & LOADING OVERLAY ==================== */
.account-switcher-toggle {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.account-switcher-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}
.switcher-chevron {
  transition: transform 160ms ease;
}
.account-switcher-toggle[aria-expanded="true"] .switcher-chevron {
  transform: rotate(180deg);
}
.account-switcher-drawer {
  width: 100%;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.saved-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.saved-account-row {
  width: 100%;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.saved-account-row:hover {
  background: var(--surface-hover);
}
.saved-account-row.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.saved-account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.saved-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.saved-account-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.saved-account-meta strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-account-meta span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-account-check {
  color: #22c55e;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.saved-account-add-btn {
  width: 100%;
  border: 1px dashed var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.saved-account-add-btn:hover {
  background: var(--primary-soft);
}
.saved-account-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.max-accounts-note {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  margin: 2px 0 0;
}
.switching-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(11, 14, 20, 0.94);
  display: grid;
  place-items: center;
  padding: 20px;
}
.switching-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 32px;
  max-width: 340px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.switching-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: genrSpin 0.8s linear infinite;
}
@keyframes genrSpin {
  to { transform: rotate(360deg); }
}

/* ==================== CONTACTS QUICK ACTIONS & QR MODALS ==================== */
.contacts-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px 6px;
}
.contact-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.contact-quick-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}
.contact-quick-btn .quick-icon {
  font-size: 17px;
  line-height: 1;
}
.empty-contacts-card {
  margin: 14px 12px;
  padding: 18px 14px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: var(--surface-elevated);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empty-contacts-card h4 {
  font-size: 14.5px;
  color: var(--text);
}
.empty-contacts-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.profile-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}
.profile-link-chip {
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qr-contact-card {
  max-width: 390px;
}
.qr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.qr-owner-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.scan-video-frame {
  width: 100%;
  min-height: 160px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  text-align: center;
  overflow: hidden;
}
.scan-qr-video {
  width: 100%;
  max-height: 240px;
  border-radius: 10px;
  object-fit: cover;
}

/* ==================== HYBRID OFFICIAL BOT SYSTEM & POLLS ==================== */
.segmented-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}
.seg-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.seg-tab.active {
  background: var(--primary);
  color: #fff;
}
.bot-dir-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 4px 0 8px;
}
.bot-dir-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  margin-bottom: 8px;
}
.bot-dir-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bot-dir-info {
  flex: 1;
  min-width: 0;
}
.bot-dir-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.bot-dir-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.official-bot-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.16);
  color: #3b82f6;
  letter-spacing: 0.03em;
}
.bot-compat-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text-muted);
}
.bot-dir-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.bot-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
}
.bot-badge-inline {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
}
.bot-mention-hl {
  font-weight: 700;
  color: var(--primary);
}
.poll-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}
.poll-question {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.poll-meta-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}
.poll-option-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.poll-option-btn.voted {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.poll-option-btn:disabled {
  cursor: default;
  opacity: 0.88;
}
.poll-option-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.poll-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}
.poll-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 180ms ease;
}
.placeholder-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}
.placeholder-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--primary);
  cursor: pointer;
}
.placeholder-chip:hover {
  border-color: var(--primary);
}

/* ==================== OBSIDIAN DARK + ANDROID-PARITY WEB UPGRADES ==================== */
.desktop-nav-rail {
  width: 74px;
  flex-shrink: 0;
  background: #0B0E14;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  gap: 12px;
  z-index: 15;
}
[data-mode="light"] .desktop-nav-rail {
  background: #EEF1F6;
}
.rail-brand {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #1D4ED8);
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.32);
}
.rail-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.rail-btn {
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 120ms ease;
}
.rail-btn:hover {
  background: var(--surface-elevated);
  color: var(--text);
}
.rail-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.rail-icon { font-size: 18px; line-height: 1; }
.rail-label { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }

@media (min-width: 769px) {
  .sidebar-bottom-dock {
    display: none;
  }
}

.google-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  min-height: 48px;
}
.google-g-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  color: #1D4ED8;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.mono-code-field {
  font-family: "JetBrains Mono", monospace !important;
  font-size: 17px !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.btn-approve-green {
  min-height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 12px;
  background: var(--emerald, #10B981);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  flex: 1;
  transition: background 140ms ease, opacity 140ms ease;
}
.btn-approve-green:hover { background: var(--emerald-hover, #059669); }
.btn-approve-green:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-danger-solid {
  min-height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 12px;
  background: var(--danger, #EF4444);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  flex: 1;
  transition: background 140ms ease, opacity 140ms ease;
}
.btn-danger-solid:hover { background: var(--danger-hover, #DC2626); }

/* Guest Public Preview Card */
.guest-preview-card {
  max-width: 460px;
}
.guest-preview-hero {
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.guest-preview-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.guest-preview-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}
.verified-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--emerald-soft, rgba(16, 185, 129, 0.16));
  color: var(--emerald, #10B981);
}

/* Explore Global Search Filter Pills */
.explore-filter-pills {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.explore-filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.filter-pill:hover {
  border-color: var(--primary);
  color: var(--text);
}
.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

/* Live Limit Counter Pill */
.limit-banner-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

/* Bot Search Keywords Tag Chips */
.kw-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 12px;
  font-weight: 600;
}
.kw-chip-del {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.kw-add-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* Suspended Account Card */
.suspended-card {
  max-width: 400px;
  border-color: rgba(239, 68, 68, 0.55) !important;
}
.suspended-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 4px;
  background: rgba(239, 68, 68, 0.16);
  color: #EF4444;
  font-size: 26px;
  display: grid;
  place-items: center;
}
.handle-ok { color: var(--emerald, #10B981) !important; font-weight: 600; }
.handle-bad { color: var(--danger, #EF4444) !important; font-weight: 600; }

/* Official Gen R System Chat (Verified Badge, Non-Clickable Header & Read-Only Footer) */
.verified-official-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #60A5FA;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.chat-header-info.non-clickable {
  cursor: default !important;
  pointer-events: none;
  user-select: text;
}
.system-readonly-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}
.verified-official-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3B82F6;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ==================== GEN R LANDING + LEGAL SUITE POLISH ==================== */
.landing-auth-view {
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px;
}
.landing-auth-card {
  max-width: 448px;
  width: 100%;
}
.landing-hero-copy {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
}
.landing-tagline {
  margin: 0 0 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.landing-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.landing-pillar {
  font-size: 11.5px;
  font-weight: 600;
  color: #93C5FD;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 999px;
  padding: 3px 9px;
}
.landing-download-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.play-store-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  background: #0F172A;
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #F8FAFC;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 120ms ease;
}
.play-store-btn:hover {
  background: #172236;
  border-color: rgba(59, 130, 246, 0.6);
  text-decoration: none;
  transform: translateY(-1px);
}
.play-store-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #10B981 0%, #3B82F6 100%);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.play-store-copy {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}
.play-store-copy small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.play-store-copy strong {
  font-size: 14px;
  font-weight: 700;
  color: #F8FAFC;
}
.landing-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.landing-footer a {
  color: #93C5FD;
  text-decoration: none;
  font-weight: 500;
}
.landing-footer a:hover {
  text-decoration: underline;
  color: #BFDBFE;
}

/* Mandatory Onboarding Policy Agreement Checkbox */
.onboarding-terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  cursor: pointer;
}
.onboarding-terms-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary, #3B82F6);
  cursor: pointer;
  flex-shrink: 0;
}
.onboarding-terms-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.onboarding-terms-link {
  color: #60A5FA;
  font-weight: 600;
  text-decoration: underline;
}
.onboarding-terms-link:hover {
  color: #93C5FD;
}
#onboarding-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Settings Privacy Policy & Terms Row */
.settings-legal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.settings-legal-row:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.08);
  text-decoration: none;
}
.settings-legal-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.16);
  color: #34D399;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.settings-legal-copy {
  flex: 1;
  min-width: 0;
}
.settings-legal-copy strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}
.settings-legal-arrow {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
}

/* ==================== DATA & STORAGE + TAP-TO-DOWNLOAD MEDIA ==================== */
.autodl-group-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.autodl-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.autodl-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.tap-download-box {
  position: relative;
  width: 240px;
  min-height: 158px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.tap-download-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(16px) brightness(0.68);
  transform: scale(1.14);
  pointer-events: none;
}
.tap-download-overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
}
.tap-download-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  background: rgba(11, 14, 20, 0.84);
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 700;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: transform 140ms ease, opacity 140ms ease;
}
.tap-download-box:hover .tap-download-circle {
  transform: scale3d(1.06, 1.06, 1);
  background: rgba(11, 14, 20, 0.94);
}
.tap-download-circle.is-loading {
  border-color: var(--primary);
  animation: genrSpinPulse 1.1s ease-in-out infinite;
}
@keyframes genrSpinPulse {
  0% { transform: scale3d(1, 1, 1); opacity: 1; }
  50% { transform: scale3d(1.08, 1.08, 1); opacity: 0.78; }
  100% { transform: scale3d(1, 1, 1); opacity: 1; }
}
.tap-download-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.tap-download-badge {
  background: rgba(11, 14, 20, 0.86);
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.voice-note-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 196px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}
.voice-note-pill audio {
  height: 30px;
  max-width: 210px;
}
#voice-record-btn.recording {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.18);
  border-radius: 50%;
}
.msg-uploading-pill {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ==================== ZERO-FIRESTORE D1 SYNC PILL, VIEWS & LOW-RAM LITE MODE ==================== */
.genr-sync-status-pill {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: opacity 180ms ease;
}
.genr-sync-status-pill.hidden {
  display: none;
}
.msg-view-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  opacity: 0.82;
  margin-right: 4px;
}
.virtual-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
}
.virtual-load-more-btn {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.virtual-load-more-btn:hover {
  color: var(--text);
  border-color: rgba(96, 165, 250, 0.5);
}

/* Low-RAM Lite Mode (1–3 GB RAM mobile smoothness — preserves dark UI & gradient bubbles) */
html[data-lite-mode="true"] *,
body.genr-lite-mode * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html[data-lite-mode="true"] .msg-bubble,
body.genr-lite-mode .msg-bubble,
html[data-lite-mode="true"] .modal-card,
body.genr-lite-mode .modal-card,
html[data-lite-mode="true"] .info-card,
body.genr-lite-mode .info-card {
  box-shadow: none !important;
}
html[data-lite-mode="true"] .tap-download-circle.is-loading,
body.genr-lite-mode .tap-download-circle.is-loading {
  animation: none !important;
}
html[data-lite-mode="true"] .msg-row,
body.genr-lite-mode .msg-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}

/* =====================================================================
   ULTRA-SLIM TELEGRAM REACTION PILLS & CHANNEL POST CARDS
   ===================================================================== */
.msg-bubble-row-wrap {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}
.msg-row.out .msg-bubble-row-wrap {
  flex-direction: row-reverse;
}
.msg-bubble.channel-post-card {
  background: #212429 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.channel-share-fab {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 20, 26, 0.78);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.channel-share-fab:hover {
  background: rgba(78, 116, 249, 0.25);
  color: #ffffff;
  transform: scale(1.06);
}

.msg-footer-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 5px;
}
.msg-footer-line .msg-meta {
  margin-top: 0;
  margin-left: auto;
  white-space: nowrap;
}
.msg-reactions-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.reaction-pill {
  height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.reaction-pill:hover {
  transform: scale(1.04);
}
.reaction-pill.is-active {
  background: rgba(255, 255, 255, 0.28);
}
.reaction-pill.channel-pill {
  background: rgba(255, 255, 255, 0.10);
  color: #e2e8f0;
}
.reaction-pill.channel-pill.is-active {
  background: #4E74F9;
  color: #ffffff;
}
.reaction-pill-emoji {
  font-size: 13px;
  line-height: 1;
}
.reaction-pill-avatars {
  display: inline-flex;
  align-items: center;
}
.reaction-pill-avatar {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, #4E74F9, #8B5CF6);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 18, 24, 0.65);
}
.reaction-pill-avatar + .reaction-pill-avatar {
  margin-left: -4px;
}
.reaction-pill-count {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.95;
}

/* Lightweight zero-lag quick reaction bar */
.msg-popup-reactions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #1c2026;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.popup-react-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
}
.popup-react-btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

/* =====================================================================
   ULTRA-SLIM TELEGRAM SETTINGS & CHANNEL / GROUP SETTINGS UI
   ===================================================================== */
#settings-modal .modal-card,
#inspector-panel {
  background: #14171c;
}
#settings-modal .modal-header,
#sidebar-pane-settings .sidebar-pane-header,
#inspector-panel .inspector-header {
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#settings-modal .modal-header h3,
#sidebar-pane-settings .sidebar-pane-header h2,
#inspector-panel .inspector-header h3 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0;
}
#settings-modal .modal-body {
  padding: 0 0 18px;
  gap: 0;
}
#settings-modal .settings-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  gap: 0;
  border-bottom: 6px solid rgba(0, 0, 0, 0.32);
}
#settings-modal .settings-section h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #6ea8fe;
  padding: 10px 14px 4px;
  margin: 0;
}
#settings-modal .setting-row,
#settings-modal .device-card,
#settings-modal .settings-legal-row,
#sidebar-pane-settings .sidebar-setting-row,
#inspector-body .slim-setting-row {
  min-height: 44px;
  padding: 8px 14px;
  margin: 0 !important;
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#settings-modal .setting-row strong,
#settings-modal .device-card strong,
#settings-modal .settings-legal-row strong,
#sidebar-pane-settings .sidebar-setting-row span:first-child,
#inspector-body .slim-setting-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}
#settings-modal .setting-sub,
#inspector-body .slim-setting-sub {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text-muted);
  margin: 2px 0 0;
}
#sidebar-pane-settings .settings-sidebar-card,
#settings-modal .autodl-group-card,
#inspector-body .info-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 !important;
  box-shadow: none;
  border-bottom: 6px solid rgba(0, 0, 0, 0.28);
}
#inspector-body .info-card h4 {
  font-size: 12px;
  font-weight: 600;
  color: #6ea8fe;
  padding: 10px 14px 4px;
  margin: 0;
}
#settings-modal .autodl-group-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #8b9bb4;
  padding: 8px 14px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#settings-modal .autodl-toggle-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#settings-modal .autodl-toggle-grid .slim-switch-row,
#inspector-body .slim-switch-row {
  min-height: 44px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
#settings-modal .secret-code-row {
  padding: 8px 14px 12px;
}
#settings-modal #theme-grid {
  padding: 6px 14px 12px;
}

/* Compact 36px × 20px Telegram Switch */
.slim-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 36px;
  height: 20px;
  min-width: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  outline: none;
  transition: background 0.16s ease;
  margin: 0;
  flex-shrink: 0;
}
.slim-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #e2e8f0;
  transition: transform 0.16s ease, background 0.16s ease;
}
.slim-switch:checked {
  background: #4E74F9;
  border-color: #4E74F9;
}
.slim-switch:checked::after {
  transform: translateX(16px);
  background: #ffffff;
}
.slim-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(78, 116, 249, 0.18);
  color: #93b4ff;
}
.slim-link-btn {
  color: #6ea8fe;
  font-size: 12.5px;
  text-decoration: none;
  word-break: break-all;
}
.slim-link-btn:hover {
  text-decoration: underline;
}

/* =====================================================================
   60FPS TELEGRAM GPU & LOW-RAM PERFORMANCE ENGINE
   ===================================================================== */
button,
.chat-row,
.reaction-pill,
.channel-share-fab,
.slim-switch,
.popup-react-btn,
.popup-action-btn,
.folder-tab,
.nav-btn,
.icon-btn,
.virtual-load-more-btn {
  touch-action: manipulation;
}

/* Eliminate layout thrashing on message feeds & chat lists across all RAM tiers */
.msg-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
  contain: layout style paint;
}
.msg-bubble {
  contain: layout style;
  box-shadow: none;
}
.chat-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 62px;
  contain: layout style paint;
}
#messages-container,
#chat-list {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.genr-sync-status-pill {
  transform: translate3d(-50%, 0, 0);
  box-shadow: none;
  will-change: transform, opacity;
}
.modal-backdrop,
.msg-popup-backdrop,
.drawer-panel,
.inspector-panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.modal-card,
.msg-popup-card,
.msg-popup-reactions {
  will-change: transform, opacity;
}

/* =====================================================================
   LIGHTWEIGHT GPU-ONLY STARTUP SPLASH & SLIM TOP STATUS STRIP (3-4s)
   Zero backdrop-filter, zero heavy shadows, transform + opacity only
   ===================================================================== */
.genr-startup-splash {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0b0e14 0%, #10151f 50%, #0b0e14 100%);
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.34s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
  contain: layout style paint;
}
.genr-startup-splash.is-exiting {
  opacity: 0;
  transform: translate3d(0, -18px, 0);
  pointer-events: none;
}
.genr-startup-splash.is-gone {
  display: none;
}
.genr-startup-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: genrStartupLockupIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.genr-startup-logo-mark {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #2b6bff 0%, #1d4ed8 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transform: translate3d(0, 0, 0);
}
.genr-startup-wordmark {
  margin-top: 16px;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f3f6fb;
}
.genr-startup-tagline {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}
.genr-startup-progress {
  margin-top: 20px;
  width: 120px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
  position: relative;
}
.genr-startup-progress-bar {
  display: block;
  width: 44px;
  height: 3px;
  border-radius: 999px;
  background: #4e74f9;
  animation: genrStartupBarSlide 1.15s ease-in-out infinite;
  will-change: transform;
}

.genr-startup-status-strip {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  z-index: 9995;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(21, 26, 35, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
  transition: opacity 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
  contain: layout style paint;
}
.genr-startup-status-strip.is-exiting {
  opacity: 0;
  transform: translate3d(-50%, -18px, 0);
}
.genr-startup-status-strip.is-gone {
  display: none;
}
.genr-startup-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4e74f9;
  animation: genrStartupDotPulse 0.85s ease-in-out infinite alternate;
  will-change: opacity;
}
.genr-startup-status-strip.is-ready .genr-startup-status-dot {
  background: #22c55e;
  animation: none;
  opacity: 1;
}

html[data-lite-mode="true"] .genr-startup-progress-bar,
html[data-lite-mode="true"] .genr-startup-status-dot,
body.genr-lite-mode .genr-startup-progress-bar,
body.genr-lite-mode .genr-startup-status-dot,
body.lite-mode .genr-startup-progress-bar,
body.lite-mode .genr-startup-status-dot {
  animation: none;
}
html[data-lite-mode="true"] .genr-startup-progress-bar,
body.genr-lite-mode .genr-startup-progress-bar,
body.lite-mode .genr-startup-progress-bar {
  transform: translate3d(38px, 0, 0);
}

@keyframes genrStartupLockupIn {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale3d(0.94, 0.94, 1);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }
}
@keyframes genrStartupBarSlide {
  0% { transform: translate3d(-44px, 0, 0); }
  100% { transform: translate3d(120px, 0, 0); }
}
@keyframes genrStartupDotPulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}



