:root {
  --bg-dark: #0e1621;
  --chat-bg: #17212b;
  --chat-bg-soft: #1f2c38;
  --panel-bg: rgba(23, 33, 43, 0.92);
  --bubble-sent: #2b5278;
  --bubble-received: #182533;
  --accent-color: #54a9eb;
  --accent-strong: #2f8dd6;
  --text-primary: #eef6fd;
  --text-muted: #8ea2b3;
  --line-soft: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.36);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.telegram-theme {
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top left, rgba(84, 169, 235, 0.2), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(47, 141, 214, 0.13), transparent 30rem),
    linear-gradient(135deg, #09111b 0%, var(--bg-dark) 42%, #101c29 100%);
  font-family: "Vazirmatn", "Tahoma", sans-serif;
}

.tg-app {
  width: min(1460px, calc(100vw - 28px));
  height: 100vh;
  min-height: 680px;
  margin: 14px auto;
  display: flex;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 30px;
  background: rgba(14, 22, 33, 0.84);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

@media (max-width: 768px) {
  .tg-app {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    flex-direction: column;
  }

  .tg-sidebar {
    width: 100%;
    height: auto;
    max-height: 40vh;
    border-left: none;
    border-bottom: 1px solid var(--line-soft);
  }

  .tg-chat-main {
    height: calc(100vh - 40vh);
  }
}

.tg-sidebar {
  width: 330px;
  min-width: 290px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-soft);
  background: rgba(23, 33, 43, 0.94);
}

.tg-sidebar-top {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.tg-search {
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: #253341;
  border-radius: 999px;
  padding: 11px 16px;
}

.tg-icon-button,
.tg-send-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--text-primary);
  background: #253341;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.tg-icon-button:hover,
.tg-send-button:hover {
  transform: translateY(-1px);
  background: var(--accent-color);
  color: #07111b;
}

.tg-chat-list {
  padding: 10px;
  overflow-y: auto;
}

.tg-chat-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.tg-chat-item:hover,
.tg-chat-item.is-active {
  background: #253341;
  transform: translateX(-2px);
}

.tg-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #54a9eb, #38d4b1);
  box-shadow: 0 8px 24px rgba(84, 169, 235, 0.18);
}

.tg-avatar.is-small {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  font-size: 0.82rem;
}

.tg-chat-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(15, 24, 35, 0.88), rgba(15, 24, 35, 0.88)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 24px);
}

.tg-chat-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(23, 33, 43, 0.96);
}

.tg-peer {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.tg-peer-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-peer-subtitle {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.tg-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tg-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cdeeff;
  background: rgba(84, 169, 235, 0.16);
  border: 1px solid rgba(84, 169, 235, 0.22);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
}

.tg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #47d16c;
  box-shadow: 0 0 0 5px rgba(71, 209, 108, 0.12);
}

.tg-status-online {
  color: #6ee88e;
}

.tg-status-offline {
  color: var(--text-muted);
}

.tg-empty {
  margin: auto;
  max-width: 360px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  background: rgba(23, 33, 43, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}

.tg-composer {
  position: relative;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(23, 33, 43, 0.96);
}

.tg-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.tg-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 48px;
  padding: 5px 8px;
  border-radius: 24px;
  background: #253341;
  border: 1px solid transparent;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.tg-input-wrap:focus-within {
  border-color: rgba(84, 169, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(84, 169, 235, 0.1);
}

.tg-textarea {
  flex: 1;
  min-height: 38px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
  padding: 9px 4px;
  line-height: 1.7;
}

.tg-textarea::placeholder,
.tg-search::placeholder {
  color: #7f95a8;
}

.tg-send-button {
  background: var(--accent-color);
  color: #06111c;
  font-weight: 900;
}

.tg-emoji-panel,
.tg-attach-preview {
  position: absolute;
  right: 18px;
  bottom: 76px;
  z-index: 10;
  width: min(330px, calc(100vw - 48px));
  padding: 12px;
  border-radius: 20px;
  background: #202d39;
  border: 1px solid var(--line-soft);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.tg-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.tg-emoji-grid button {
  border: 0;
  border-radius: 12px;
  padding: 6px;
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
}

.tg-emoji-grid button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tg-file-input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.tg-attach-preview {
  right: auto;
  left: 18px;
  color: var(--text-muted);
}

.tg-typing {
  position: absolute;
  right: 24px;
  top: -30px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 7px 12px;
  color: var(--text-muted);
  background: rgba(23, 33, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.tg-typing.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tg-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-color);
  animation: tgBounce 1s infinite ease-in-out;
}

.tg-typing i:nth-child(2) {
  animation-delay: 120ms;
}

.tg-typing i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes tgBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 900px) {
  .tg-app {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  .tg-sidebar {
    display: none;
  }

  .tg-chat-header {
    padding: 11px 12px;
  }

  .tg-badge {
    display: none;
  }
}

/* Telegram polish layer: denser surfaces, clearer hierarchy, better mobile feel. */
:root {
  --tg-sidebar: #17212b;
  --tg-header: #17212b;
  --tg-input: #242f3d;
  --tg-input-active: #2b3a49;
  --tg-hover: rgba(255, 255, 255, 0.06);
  --tg-active: #2b5278;
  --tg-green: #4dd06d;
  --tg-danger: #ff6b7a;
  --tg-wallpaper-line: rgba(255, 255, 255, 0.026);
}

body.telegram-theme {
  background:
    radial-gradient(circle at 12% 8%, rgba(84, 169, 235, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 92%, rgba(56, 212, 177, 0.08), transparent 26rem),
    linear-gradient(135deg, #09111b 0%, #0e1621 50%, #111d2a 100%);
  overflow-x: hidden;
  overflow-y: auto;
}

body.telegram-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255,255,255,0.055) 0 1px, transparent 1px),
    radial-gradient(circle at 70px 72px, rgba(84,169,235,0.06) 0 1px, transparent 1px);
  background-size: 96px 96px;
}

.tg-app {
  isolation: isolate;
  border-color: rgba(134, 166, 190, 0.14);
  background: rgba(14, 22, 33, 0.94);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255,255,255,0.04);
}

.tg-app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.tg-sidebar {
  background: linear-gradient(180deg, rgba(23,33,43,0.99), rgba(18,28,38,0.99));
}

.tg-sidebar-top {
  min-height: 74px;
  padding: 14px 16px;
  background: rgba(23,33,43,0.98);
}

.tg-search {
  height: 42px;
  padding-inline-start: 42px;
  background:
    linear-gradient(90deg, transparent, transparent),
    var(--tg-input);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.tg-search:focus {
  background: var(--tg-input-active);
  box-shadow: inset 0 0 0 1px rgba(84,169,235,0.36), 0 0 0 4px rgba(84,169,235,0.08);
}

.tg-sidebar-top::after {
  content: "⌕";
  position: absolute;
  right: 76px;
  color: #7f95a8;
  font-size: 1.05rem;
  pointer-events: none;
}

.tg-icon-button,
.tg-send-button {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  background: transparent;
  color: #9fb3c5;
  font-size: 1.05rem;
  transform: translateZ(0);
}

.tg-icon-button:hover {
  background: rgba(255,255,255,0.08);
  color: #dff4ff;
}

.tg-send-button {
  background: linear-gradient(135deg, #54a9eb, #37b5f4);
  color: #06111c;
  box-shadow: 0 12px 28px rgba(84,169,235,0.24);
}

.tg-send-button:active,
.tg-icon-button:active {
  transform: scale(0.94);
}

.tg-ripple {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: translate(-50%, -50%) scale(0);
  animation: tgRipple 520ms ease-out;
  pointer-events: none;
}

.tg-chat-list {
  padding: 8px;
}

.tg-chat-item {
  position: relative;
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 14px;
}

.tg-chat-item::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.tg-chat-item:hover {
  background: var(--tg-hover);
  transform: none;
}

.tg-chat-item.is-active {
  background: rgba(43, 82, 120, 0.66);
  transform: none;
}

.tg-chat-item.is-active::before {
  background: #64c4ff;
}

.tg-avatar {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), transparent 42%),
    linear-gradient(135deg, #4aa8ff, #2bc3a6);
  text-shadow: 0 1px 8px rgba(0,0,0,0.22);
}

.tg-avatar.is-online {
  position: relative;
}

.tg-avatar.is-online::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--tg-sidebar);
  border-radius: 50%;
  background: var(--tg-green);
}

.tg-chat-main {
  background:
    linear-gradient(rgba(15, 24, 35, 0.88), rgba(15, 24, 35, 0.9)),
    radial-gradient(circle at 22% 18%, rgba(84,169,235,0.12), transparent 23rem),
    repeating-linear-gradient(45deg, var(--tg-wallpaper-line) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(-45deg, rgba(84,169,235,0.018) 0 1px, transparent 1px 34px);
}

.tg-chat-header {
  min-height: 70px;
  background: rgba(23, 33, 43, 0.985);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 10px 28px rgba(0,0,0,0.12);
  z-index: 5;
}

.tg-peer:hover .tg-peer-title {
  color: #d9f3ff;
}

.tg-peer-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.tg-badge {
  background: rgba(84,169,235,0.11);
  border-color: rgba(84,169,235,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.tg-composer {
  padding: 11px 16px 14px;
  background: rgba(23, 33, 43, 0.985);
  box-shadow: 0 -12px 30px rgba(0,0,0,0.13);
  z-index: 6;
}

.tg-input-wrap {
  min-height: 46px;
  border-radius: 23px;
  background: var(--tg-input);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.tg-input-wrap:focus-within {
  background: var(--tg-input-active);
}

.tg-textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(142,162,179,0.4) transparent;
}

.tg-emoji-panel,
.tg-attach-preview,
.tg-more-menu {
  backdrop-filter: blur(18px);
  background: rgba(32, 45, 57, 0.96);
  border-color: rgba(255,255,255,0.095);
  transform-origin: bottom right;
  animation: tgPanelIn 160ms ease both;
}

.tg-emoji-grid button {
  transition: transform 140ms ease, background 140ms ease;
}

.tg-emoji-grid button:hover {
  transform: scale(1.18);
}

.tg-attach-preview {
  min-height: 46px;
  max-width: min(360px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  gap: 10px;
}

.tg-attach-preview[hidden] {
  display: none;
}

.tg-attach-thumb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
}

.tg-attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dbeaf5;
}

.tg-attach-size {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.tg-more-menu {
  position: absolute;
  top: 62px;
  left: 16px;
  z-index: 20;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0,0,0,0.38);
}

.tg-more-menu[hidden] {
  display: none;
}

.tg-more-menu a,
.tg-more-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-primary);
  background: transparent;
  text-decoration: none;
  text-align: start;
}

.tg-more-menu a:hover,
.tg-more-menu button:hover {
  background: rgba(255,255,255,0.08);
}

.tg-drop-active .tg-input-wrap,
.tg-drop-active .tg-composer-row {
  outline: 2px dashed rgba(84,169,235,0.62);
  outline-offset: 4px;
}

@keyframes tgRipple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(11);
  }
}

@keyframes tgPanelIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  body.telegram-theme {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .tg-chat-header {
    min-height: 62px;
  }

  .tg-peer-title {
    max-width: 46vw;
  }

  .tg-header-actions {
    gap: 2px;
  }
}

@media (max-width: 520px) {
  .tg-composer-row {
    gap: 6px;
  }

  .tg-input-wrap {
    padding-inline: 6px;
  }

.tg-reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin-bottom: 8px;
}

.reply-content {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.reply-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.reply-cancel:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Telegram shell hardening: safer mobile viewport and richer interactions. */
.tg-app {
  max-height: calc(100dvh - 28px);
  position: relative;
}

.tg-sidebar,
.tg-chat-main,
.tg-messages,
.tg-chat-list {
  min-height: 0;
}

.tg-icon-button,
.tg-send-button,
.tg-chat-item,
.tg-more-menu a,
.tg-more-menu button {
  user-select: none;
}

.tg-icon-button:focus-visible,
.tg-send-button:focus-visible,
.tg-textarea:focus-visible,
.tg-search:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(84, 169, 235, 0.14);
}

.tg-textarea {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tg-textarea:disabled,
.tg-send-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.tg-composer.is-sending .tg-send-button {
  pointer-events: none;
  opacity: 0.8;
}

.tg-composer.is-sending .tg-send-button::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
  animation: tgSpin 720ms linear infinite;
}

@keyframes tgSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .tg-app {
    min-height: 100dvh;
    height: auto;
    max-height: none;
  }

  .tg-chat-main {
    min-height: 100dvh;
  }

  .tg-composer {
    position: sticky;
    bottom: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* ============================================================
   Friend system styles (RTL-friendly)
   ============================================================ */

/* Friend avatar */
.fa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent-color, #54a9eb);
}

.fa-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-strong, #2f8dd6), var(--accent-color, #54a9eb));
  flex-shrink: 0;
}

/* Online/offline dot on avatar */
.fa-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.fa-online-dot,
.fa-offline-dot {
  position: absolute;
  bottom: 0;
  inset-inline-end: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--chat-bg, #17212b);
}

.fa-online-dot {
  background: #2ecc71;
}

.fa-offline-dot {
  background: #95a5a6;
}

/* Friend list item */
.fa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(134, 155, 187, 0.12);
  background: rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fa-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

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

.fa-item-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fa-item-meta {
  font-size: 0.78rem;
  color: var(--muted, #6c7a8a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fa-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fa-item-actions .btn {
  padding: 4px 10px;
  font-size: 0.82rem;
  border-radius: 10px;
}

/* Friend list section container */
.friend-list-section {
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 0 16px 12px;
}

.friend-list-section::-webkit-scrollbar {
  width: 5px;
}

.friend-list-section::-webkit-scrollbar-track {
  background: transparent;
}

.friend-list-section::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
}

/* Empty state for friend lists */
.empty-state-sm {
  text-align: center;
  color: var(--muted, #8ea2b3);
  font-size: 0.88rem;
  padding: 16px 0;
}

/* Loading state */
.fa-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  color: var(--muted, #8ea2b3);
  font-size: 0.9rem;
}

/* Search hints */
.friend-search-hints {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* Verified badge */
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3390ec;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-inline-start: 4px;
  vertical-align: middle;
}

/* Sidebar friend count badge */
.friend-count-badge {
  font-size: 11px;
  padding: 2px 8px;
}

/* Navbar friend badge */
.navbar-friend-badge {
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Friends in room badge */
.friends-in-room {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* Dark theme overrides */
.telegram-theme .fa-item {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.telegram-theme .fa-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.telegram-theme .fa-item-meta {
  color: var(--text-muted, #8ea2b3);
}

.telegram-theme .empty-state-sm,
.telegram-theme .fa-loading,
.telegram-theme .friend-search-hints {
  color: var(--text-muted, #8ea2b3);
}

.telegram-theme .fa-online-dot,
.telegram-theme .fa-offline-dot {
  border-color: var(--chat-bg, #17212b);
}
