@font-face {
  font-family: 'IRANSansWeb';
  src: url('../fonts/IRANSansWeb.ttf') format('truetype');
  font-weight: normal; font-style: normal; font-display: swap;
}

/* Mobile polish: keep header compact + make badge readable */
@media (max-width: 520px) {
  .main-header { padding: 0 12px; height: 60px; }
  .header-left { gap: 10px; }
  .header-search { width: 100%; }
  /* smaller height on mobile (requested) */
  .live-search { width: 100%; border-radius: 16px; padding: 6px 10px; font-size: 13px; height: 34px; }
  .unread-badge { --ub-size: 20px; font-size: 12px; }
}

:root {
  --bg-deep: #1c3341;
  --bg-elevated: #2a4759;
  --glass: rgba(42, 71, 89, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --text: #f8fafc;
  --text-muted: #9baec1;
  --primary: #007aff;
  --incoming: var(--bg-elevated);
  --outgoing: #26365B;
  --accent: #38bdf8;
  --danger: #ef4444;
  
  /* Secondary Profile Colors */
  --sec-bg: #1e293b;
  --sec-border: rgba(255, 255, 255, 0.08);
  --sec-label: #94a3b8;
  --sec-link: #3b82f6;

  --font: "IRANSansWeb", Tahoma, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.room-item, .user-item, .msg-row, .msg-bubble, .pop-btn, .icon-btn, .story-chip, .story-nav, .pinned-chip, .ls-item {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg-deep); }
body { font-family: var(--font); color: var(--text); display: flex; flex-direction: column; position: absolute; inset: 0; -webkit-font-smoothing: antialiased; }
:root { --app-vh: 100vh; }
@supports (height: 100dvh) {
  :root { --app-vh: 100dvh; }
}

.app-toast{
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  min-width: min(320px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  padding: 12px 16px;
  border-radius: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(15,23,42,0.92);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 32px rgba(0,0,0,0.30);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 12000;
  font-size: 13px;
  line-height: 1.6;
}
.app-toast.success{ background: rgba(8, 122, 74, 0.94); }
.app-toast.error{ background: rgba(127, 29, 29, 0.96); }
.app-toast.show{ display:flex; animation: toastIn .18s ease-out; }
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(8px);} to { opacity:1; transform:translateX(-50%) translateY(0);} }

.install-pwa-btn{
  position: fixed;
  left: 50%;
  bottom: 156px;
  transform: translateX(-50%);
  z-index: 11990;
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #2aabee, #1d4ed8);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(29,78,216,0.28);
}

.app-confirm{
  position: fixed;
  inset: 0;
  z-index: 13000;
  background: linear-gradient(180deg, rgba(2,6,23,0.34) 0%, rgba(2,6,23,0.58) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.app-confirm-card{
  position: relative;
  width:min(420px, calc(100vw - 28px));
  border-radius:30px;
  padding:26px 22px 20px;
  background: linear-gradient(180deg, rgba(7,18,37,0.97) 0%, rgba(10,21,43,0.98) 100%);
  border:1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 60px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
}
.app-confirm-card::before{
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(239,68,68,0.18) 0%, rgba(244,63,94,0.95) 50%, rgba(239,68,68,0.18) 100%);
}
.app-confirm-text{
  font-size: 18px;
  color: #f8fafc;
  line-height: 2;
  margin-bottom: 18px;
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.app-confirm-actions{
  display:flex;
  gap:12px;
  justify-content:center;
}
.app-confirm-actions .btn-secondary,
.app-confirm-actions .btn-danger{
  min-width: 126px;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: 18px;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(2,6,23,0.22);
}
.app-confirm-actions .btn-secondary{
  background: linear-gradient(180deg, rgba(36,48,76,0.96) 0%, rgba(27,39,65,0.98) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  color: #f8fafc;
}
.app-confirm-actions .btn-danger{
  background: linear-gradient(180deg, #ff5a5f 0%, #ef4444 100%);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  box-shadow: 0 14px 30px rgba(239,68,68,0.30);
}
.app-confirm-actions .btn-secondary:active,
.app-confirm-actions .btn-danger:active{
  transform: scale(0.97);
}
@media (max-width: 520px){
  .app-confirm-card{
    width: min(390px, calc(100vw - 24px));
    border-radius: 26px;
    padding: 24px 18px 18px;
  }
  .app-confirm-text{
    font-size: 16px;
  }
  .app-confirm-actions .btn-secondary,
  .app-confirm-actions .btn-danger{
    min-width: 110px;
    min-height: 48px;
    font-size: 16px;
    border-radius: 16px;
  }
}

.view-main { flex: 1; display: flex; flex-direction: column; height: 100%; width: 100%; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; background: var(--bg-deep); }
.view-chat { min-height: var(--app-vh); position: absolute; inset: 0; z-index: 200; display: flex; flex-direction: column; background: var(--bg-deep); height: 100%; width: 100%; animation: chatSlideIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
@keyframes chatSlideIn { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
body.chat-open .bottom-nav { display: none !important; }

.page-content { flex: 1 0 auto; overflow: visible; padding-bottom: 90px; display: none; opacity: 0; }
.page-content.active-page { display: block; animation: pageFadeSlide 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
@keyframes pageFadeSlide { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

.ui-icon { width: 24px; height: 24px; display: block; object-fit: contain; filter: brightness(0) invert(1); }
.ui-icon-small { width: 16px; height: 16px; display: inline-block; object-fit: contain; vertical-align: middle; margin: 0 4px; filter: brightness(0) invert(1); }

.main-header { height: 64px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; background: transparent; flex-shrink: 0; flex-direction: row-reverse; }
.chat-header { height: 64px; padding: 0 16px; display: flex; align-items: center; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--glass-border); flex-shrink: 0; position: relative; z-index: 1000; width: 100%; }

.header-content { display: flex; align-items: center; width: 100%; height: 100%; gap: 8px; overflow: visible; min-width: 0; }
.chat-header-actions { position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; flex-shrink: 0; }
.chat-search-header-btn { color: #fff; }
.chat-search-header-btn:hover { background: rgba(255,255,255,0.08); }
.chat-header-search-svg { width: 24px; height: 24px; display: block; fill: none; stroke: currentColor; stroke-width: 2.15; stroke-linecap: round; stroke-linejoin: round; }
.chat-menu-btn .dots-icon { font-size: 22px; line-height: 1; color: var(--text); transform: translateY(-1px); }
.chat-popup-menu { top: calc(100% - 4px); right: 0; width: 210px; }
.chat-search-panel { display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; background: var(--glass); border-bottom: 1px solid var(--glass-border); }
.message-selection-bar { display:flex; align-items:center; gap:12px; padding: 10px 14px; background: rgba(10,16,28,0.88); border-bottom: 1px solid rgba(255,255,255,0.08); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); position: relative; z-index: 910; }
.message-selection-close { width: 38px; height: 38px; border-radius: 12px; color: var(--text); font-size: 17px; flex-shrink: 0; }
.message-selection-copy { min-width: 0; flex: 1; display:flex; flex-direction:column; gap:2px; }
.message-selection-label { font-size: 11px; font-weight: 800; color: var(--primary); }
.message-selection-count { font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-selection-select-all { width:auto; min-width: 86px; padding: 10px 14px; border-radius: 12px; font-size: 13px; flex-shrink: 0; }
.chat-search-input { flex: 1; min-width: 0; border: 1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.04); color: var(--text); border-radius: 14px; padding: 10px 12px; outline: none; font-family: inherit; font-size: 14px; }
.chat-search-input:focus { border-color: rgba(42,171,238,0.45); box-shadow: 0 0 0 3px rgba(42,171,238,0.10); }
.chat-search-side { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-search-count { min-width: 56px; text-align: center; font-size: 12px; color: var(--text-muted); font-weight: 700; }
.chat-search-nav-btn { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-size: 13px; }
.chat-meta-click { display: flex; align-items: center; gap: 12px; flex: 1; height: 100%; cursor: pointer; overflow: hidden; padding: 4px; }
.chat-avatar { width: 42px; height: 42px; min-width: 42px; border-radius: 50%; background: transparent; display: flex; align-items: center; justify-content: center; overflow: visible; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.chat-avatar .avatar-media { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--bg-elevated); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.chat-info { display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0; align-items: flex-start; }
.chat-name, .chat-type { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; direction: rtl; }
.chat-name { font-weight: 700; font-size: 15px; color: var(--text); }
.chat-type { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.brand-text { font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: 0.5px; -webkit-text-stroke: 0.3px var(--text); }

/* Live search in header */
.header-left { display:flex; align-items:center; gap:12px; flex: 1; min-width: 0; }
.header-search { position: relative; display:flex; align-items:center; flex: 1; min-width: 0; margin-top: 10px; }
.live-search {
  /* full width on desktop header area (requested) */
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  border-radius: 14px;
  /* smaller height on desktop too */
  /* a bit shorter (requested) */
  padding: 6px 10px;
  box-sizing: border-box;
  height: 36px;
  outline: none;
  font-family: inherit;
  font-size: 13px;
}
.live-search:focus { border-color: rgba(255,255,255,0.22); }
.live-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(14,18,24,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
}
.ls-item { display:flex; align-items:center; gap:10px; padding: 10px 12px; cursor:pointer; }
.ls-item:hover { background: rgba(255,255,255,0.06); }
.ls-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.08); overflow:hidden; display:flex; align-items:center; justify-content:center; font-weight:800; }
.ls-avatar img { width:100%; height:100%; object-fit:cover; }
.ls-meta { display:flex; flex-direction:column; min-width:0; }
.ls-title { font-weight:700; font-size: 13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ls-sub { font-size: 12px; color: var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Sections in chats list */
.room-section-title {
  padding: 10px 16px;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.stories-pull-hint {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  transition: height .18s ease;
  flex-shrink: 0; /* این خط اضافه شد */
}

.stories-pull-hint.show{ height: 24px; }
.stories-rail-wrap{
  padding: 12px 14px 6px;
  max-height: 0;
  overflow: hidden;
  background: var(--bg-deep);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: max-height .22s ease, opacity .18s ease, padding .18s ease;
}
.inline-stories{ position: relative; z-index: 1; }
.stories-rail-head{ display:none; }
.stories-rail-wrap.revealed{
  max-height: 200px;
  opacity: 1;
  visibility: visible;
}

.stories-rail-wrap {
  padding: 0 14px; /* پدینگ بالا و پایین صفر شد تا هیچی بیرون نزند */
  max-height: 0;
  overflow: hidden;
  background: var(--bg-deep);
  border-bottom: 1px solid transparent; /* خط زیرین هم در حالت بسته مخفی می‌شود */
  transition: max-height .22s ease, opacity .18s ease, padding .22s ease;
  flex-shrink: 0;
  opacity: 0; /* در حالت بسته کاملاً نامرئی می‌شود */
  visibility: hidden;
}

.stories-rail-wrap.revealed {
  padding: 12px 14px 6px; /* پدینگ‌ها فقط وقتی استوری باز است برمی‌گردند */
  max-height: 200px;
  opacity: 1;
  visibility: visible;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}


.stories-title{
  font-size:14px;
  font-weight:800;
  color:var(--text);
}
.stories-rail{
  display:flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap:12px;
  overflow-x:auto;
  padding-bottom:4px;
  scrollbar-width:none;
  direction: rtl;
  align-items: flex-start;
}
.stories-rail::-webkit-scrollbar{display:none;}
.story-chip{
  border:0;
  background:transparent;
  color:var(--text);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  min-width:72px;
  cursor:pointer;
}
.story-avatar-ring{
  width:72px;
  height:72px;
  border-radius:50%;
  padding:3px;
  background:linear-gradient(135deg,#2aabee,#7c3aed,#f43f5e);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
}
.story-avatar-ring.seen{ background: linear-gradient(135deg, rgba(148,163,184,0.65), rgba(100,116,139,0.45)); }
.story-avatar-ring.unseen{ background: linear-gradient(135deg,#2aabee,#7c3aed,#f43f5e); }
.story-avatar-inner{
  width:100%;
  height:100%;
  border-radius:50%;
  overflow:hidden;
  background:var(--bg-elevated);
  border:3px solid var(--bg-deep);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}
.story-avatar-inner img{ width:100%; height:100%; object-fit:cover; display:block; }
.story-chip-name{
  font-size:12px;
  max-width:74px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.story-chip.uploading .story-chip-name{ color:#fff; opacity:.95; }
.story-plus{
  position:absolute;
  left:2px;
  bottom:2px;
  width:22px;
  height:22px;
  border-radius:50%;
  background:#2aabee;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  font-weight:700;
  border:2px solid var(--bg-deep);
}
.story-viewer{
  position:fixed;
  inset:0;
  z-index:5000;
  background:#000;
  display:none;
  flex-direction:column;
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
  overscroll-behavior:none;
}
.story-viewer-top, .story-viewer-bottom{
  position:absolute;
  left:0; right:0;
  z-index:2;
  padding:14px 14px 0;
}
.story-viewer-top{ top:0; padding:14px 14px 0; }
.story-viewer-bottom{ bottom:18px; }
.story-progress{
  display:flex;
  gap:6px;
  width:calc(100vw - 28px);
  max-width:calc(100vw - 28px);
  justify-content:stretch;
  align-items:center;
  direction:ltr;
}
.story-progress-seg{ flex:1 1 0; min-width:0; height:4px; background:rgba(255,255,255,0.22); border-radius:999px; overflow:hidden; }
.story-progress-seg i{ display:block; width:0; height:100%; background:#fff; }
.story-progress-seg.done i{ width:100%; }
@keyframes storyFill { from{ width:0; } to{ width:100%; } }
.story-stage{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; touch-action:none; }
.story-media{ width:100%; height:100%; object-fit:contain; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; -webkit-user-drag:none; pointer-events:none; touch-action:none; }
.story-author-row{ display:flex; align-items:center; gap:10px; }
.story-author-avatar{ width:42px; height:42px; border-radius:50%; overflow:hidden; background:rgba(255,255,255,0.14); display:flex; align-items:center; justify-content:center; }
.story-author-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.story-author-name{ font-size:14px; font-weight:800; color:#fff; }
.story-author-time{ font-size:12px; color:rgba(255,255,255,0.75); margin-top:2px; }
.story-author-actions{ margin-inline-start:auto; display:flex; align-items:center; gap:8px; }
.story-seen-count, .story-delete-btn, .story-like-btn, .story-download-btn{
  border-radius:999px;
  min-height:38px;
  padding:8px 12px;
  background:rgba(0,0,0,0.34);
  border:1px solid rgba(255,255,255,0.12);
  color:#fff;
  font-size:13px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  gap:8px;
}
.story-delete-btn, .story-like-btn{ cursor:pointer; }
.story-like-btn{ min-width:68px; }
.story-action-svg{ width:18px; height:18px; display:block; flex:0 0 auto; }
.story-action-count{ display:inline-flex; align-items:center; line-height:1; }
.story-dot{ opacity:.55; margin:0 2px; }
.story-caption{ margin-top:12px; color:#fff; background:rgba(0,0,0,0.32); border-radius:16px; padding:10px 12px; font-size:14px; line-height:1.6; max-width:min(92vw,560px); }
.story-nav{ position:absolute; top:0; bottom:0; width:28%; background:transparent; border:0; z-index:1; }
.story-nav-prev{ left:0; right:auto; }
.story-nav-next{ right:0; left:auto; }
body.story-open{ overflow:hidden; }

.filter-tabs { display: flex; padding: 0 20px; gap: 24px; height: 56px; align-items: center; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 900; flex-shrink: 0; }
.filter-btn { background: none; border: none; color: var(--text-muted); font-family: inherit; font-weight: 600; font-size: 14px; padding: 16px 0; cursor: pointer; position: relative; transition: color 0.2s ease; }
.filter-btn.active { color: var(--text); font-weight: 700; }
.filter-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: var(--primary); border-radius: 4px 4px 0 0; }

.room-item, .user-item { display: flex; align-items: center; padding: 12px 20px; cursor: pointer; height: 76px; transition: background 0.2s ease; }
.room-item:active, .user-item:active { background: rgba(255,255,255,0.05); }
.room-avatar, .user-avatar { position: relative; width: 50px; height: 50px; border-radius: 50%; background: transparent; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; margin-left: 14px; flex-shrink: 0; overflow: visible; color: var(--text); }
.room-avatar .avatar-media, .user-avatar .avatar-media { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--bg-elevated); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; }
.room-avatar img, .user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-info, .user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid rgba(255,255,255,0.03); padding-bottom: 14px; padding-top: 14px; height: 100%; }
.part-name { font-weight: 700; font-size: 16px; color: var(--text); margin-bottom: 4px; }
.part-bio { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-media span { display:flex; align-items:center; justify-content:center; width:100%; height:100%; }
.saved-avatar-icon { width: 58% !important; height: 58% !important; object-fit: contain !important; }
.presence-dot {
  position: absolute;
  left: -4px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
  border: 2px solid var(--bg-deep);
}
.presence-dot--room, .presence-dot--user { width: 11px; height: 11px; left: -4px; bottom: -1px; }
.presence-dot--chat { width: 11px; height: 11px; left: -4px; bottom: -1px; }
.presence-dot--profile { width: 14px; height: 14px; left: -5px; bottom: -1px; }
.presence-dot.is-online { background: #22c55e; box-shadow: 0 0 0 1px rgba(20,32,44,0.22), 0 0 8px rgba(34,197,94,0.48); animation: presencePulse 1.8s ease-in-out infinite; }
.presence-dot.is-offline { background: #ff3045; box-shadow: 0 0 0 1px rgba(20,32,44,0.18), 0 0 7px rgba(255,48,69,0.24); }
@keyframes presencePulse { 0%, 100% { transform: scale(1); opacity: .88; } 50% { transform: scale(1.08); opacity: 1; } }

.contacts-page-head { padding: 14px 16px 8px; }
.contacts-search-wrap { position: sticky; top: 0; z-index: 2; }
.contacts-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
  font-family: inherit;
  font-size: 14px;
}
.contacts-search-input::placeholder { color: var(--text-muted); }
.contacts-search-input:focus { border-color: rgba(42,171,238,0.45); box-shadow: 0 0 0 3px rgba(42,171,238,0.10); }
.contacts-search-results {
  margin-top: 10px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
}
.contacts-search-results .user-info { border-bottom-color: rgba(255,255,255,0.04); }
.contacts-search-results .user-item:last-child .user-info { border-bottom-color: transparent; }
.contacts-search-empty,
.contacts-empty-state {
  padding: 22px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.9;
}
.contacts-empty-state { padding-top: 36px; }
.user-item-search { min-height: 72px; height: auto; }
.user-item-contact { min-height: 84px; height: auto; }
.user-item-contact .user-info { gap: 2px; }
.part-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.part-handle, .part-presence { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-presence.is-online { color: var(--primary); font-weight: 700; }
.room-top { display: flex; justify-content: space-between; margin-bottom: 6px; align-items: center; }
.room-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-name { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-kind-icon{ width:14px; height:14px; vertical-align:-2px; margin-left:6px; opacity:0.9; }

.room-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.room-msg { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 12px; }

/* Ensure unread badge is always visible (fix: badge could be pushed out in RTL/desktop) */
.room-msg { flex: 1; min-width: 0; }
.room-meta-pack { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.room-badge { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; }
.room-top { gap: 10px; align-items: center; }

/* Telegram-like unread badge (minimal + responsive) */
.unread-badge {
  --ub-size: 18px;
  min-width: var(--ub-size);
  height: var(--ub-size);
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,79,79,0.96), rgba(220,36,36,0.96));
  box-shadow: 0 6px 16px rgba(220, 36, 36, 0.18);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1px;
  line-height: 1;
  flex-shrink: 0;
}

.unread-badge.pulse { animation: unreadPulse 360ms ease-out; }
@keyframes unreadPulse { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }

.badge { background: var(--primary); color: #fff; font-size: 11px; min-width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: 11px; font-weight: 800; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4); }
.room-badge:not(:empty) { margin-right: 8px; }

/* Bottom nav labels: keep in one line on desktop (fix: "پنل ادمین" wrapping) */
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 900px){
  .bottom-nav .nav-label { font-size: 11px; }
}

.messages-area { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior-y: contain; }
.view-chat.selecting .messages-area { padding-bottom: 108px; }
.view-chat.selecting .scroll-down-fab { bottom: 108px; }
.view-chat.selecting .composer-wrapper { opacity: 0.24; pointer-events: none; filter: saturate(0.7); }
.message-selection-actions { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); z-index: 950; display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 10px; border-radius: 22px; background: rgba(11,17,32,0.82); border: 1px solid rgba(255,255,255,0.10); box-shadow: 0 16px 40px rgba(0,0,0,0.28); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.message-selection-action { flex:1; min-width:0; border: 0; border-radius: 16px; padding: 13px 12px; background: rgba(255,255,255,0.08); color: var(--text); font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer; transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease; }
.message-selection-action:active { transform: scale(0.97); }
.message-selection-action:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.message-selection-action.danger { background: rgba(239,68,68,0.16); color: #ffd6d6; }
.history-loader{
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.msg-date-separator {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 8px 0 10px;
}

.msg-date-separator span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}

.msg-row { width: 100%; display: flex; margin-bottom: 4px; position: relative; }
.msg-row.selected::after { content: ''; position: absolute; inset: -2px 0; border-radius: 22px; background: rgba(0,122,255,0.08); pointer-events: none; }
html[dir="rtl"] .msg-row.me { justify-content: flex-start; direction: rtl; } 
html[dir="rtl"] .msg-row.other { justify-content: flex-start; direction: ltr; } 

html[dir="rtl"] .msg-row.other .msg-container { direction: rtl; text-align: right; } 
html[dir="rtl"] .msg-row.other .mavatar { margin-left: 0; margin-right: 10px; align-self: flex-end; } 

.msg-container { max-width: 82%; display: flex; flex-direction: column; }
.msg-bubble { padding: 10px 14px; position: relative; min-width: 70px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); cursor: pointer; word-wrap: break-word; font-size: 15px; line-height: 1.5; }
.view-chat.selecting .msg-bubble { transition: box-shadow 0.18s ease, transform 0.18s ease, outline-color 0.18s ease; }
.msg-row.selected .msg-bubble { outline: 2px solid rgba(66,153,225,0.85); box-shadow: 0 0 0 4px rgba(66,153,225,0.12), 0 12px 28px rgba(12,74,110,0.18); transform: translateY(-1px); }
.msg-row.selected .msg-bubble::after { content: '✓'; position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, rgba(37,99,235,0.98), rgba(14,165,233,0.96)); color: #fff; font-size: 13px; font-weight: 900; display:flex; align-items:center; justify-content:center; box-shadow: 0 8px 18px rgba(2,132,199,0.30); border: 2px solid rgba(255,255,255,0.92); }

html[dir="rtl"] .msg-row.me .msg-bubble { background: var(--outgoing); color: #fff; border-radius: 18px 18px 4px 18px; }
html[dir="rtl"] .msg-row.other .msg-bubble { background: var(--incoming); color: var(--text); border-radius: 18px 18px 18px 4px; border: 1px solid rgba(255,255,255,0.05); }

.mavatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-elevated); overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; border: 1px solid var(--glass-border); }
.mavatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.is-dm .msg-row.other .mavatar { display: none; }
.msg-row.me .mavatar { display: none; }

.msg-name-row { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.msg-row.me .msg-name-row { margin-left: auto; }
.msg-name { font-size: 12px; color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.msg-admin-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 16px; padding: 1px 5px; border-radius: 5px; background: #f59e0b; color: #2563eb; font-size: 9px; font-weight: 700; line-height: 1; border: 1px solid rgba(255,255,255,0.12); white-space: nowrap; letter-spacing: 0; animation: adminBadgeBlink 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes adminBadgeBlink {
  0%, 100% { color: #2563eb; opacity: 0.96; box-shadow: 0 0 0 rgba(245,158,11,0); text-shadow: 0 0 0 rgba(37,99,235,0); }
  50% { color: #dc2626; opacity: 0.9; box-shadow: 0 0 8px rgba(245,158,11,0.16); text-shadow: 0 0 4px rgba(220,38,38,0.10); }
}
@media (prefers-reduced-motion: reduce) {
  .msg-admin-badge { animation: none; }
}
.admin-msg .mavatar { border-color: rgba(245,158,11,0.6); box-shadow: 0 0 0 2px rgba(245,158,11,0.18); }
html[dir="rtl"] .msg-row.other .msg-bubble.admin-bubble { border-color: rgba(245,158,11,0.55); box-shadow: 0 4px 16px rgba(245,158,11,0.18); }
html[dir="rtl"] .msg-row.me .msg-bubble.admin-bubble { box-shadow: 0 4px 16px rgba(245,158,11,0.22); outline: 1px solid rgba(245,158,11,0.45); }
.msg-body { white-space: pre-wrap; margin-bottom: 2px; }
.msg-search-hit .msg-bubble { box-shadow: 0 0 0 1px rgba(56,189,248,0.45), 0 8px 22px rgba(56,189,248,0.10); }
.current-search-hit .msg-bubble { box-shadow: 0 0 0 2px rgba(56,189,248,0.75), 0 10px 28px rgba(56,189,248,0.18); }
.chat-empty-state { margin: auto; padding: 18px 20px; border-radius: 18px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--text-muted); font-size: 14px; text-align: center; }
.msg-meta { font-size: 10px; color: rgba(255,255,255,0.6); float: left; margin-top: 6px; margin-right: 12px; display: flex; align-items: center; gap: 4px; line-height: 1; direction: ltr; }
.ticks { font-size: 12px; color: #fff; letter-spacing: -1px; margin-left: 2px; }
.ticks.read { color: rgba(60, 255, 140, 0.95); }

/* minimal badges for pinned/saved inside message meta */
.msg-badges { display:inline-flex; align-items:center; gap:6px; margin-left: 6px; }
.msg-badge-icon {
  width: 14px;
  height: 14px;
  opacity: 0.92;
  filter: brightness(0) invert(1);
  transform: translateY(0.5px);
}
.msg-badge-icon.soft { opacity: 0.7; }

/* pinned bar (Telegram-like glass) */
.pinned-wrap {
  display: none;
  position: sticky;
  top: 64px;
  z-index: 899;
  padding: 8px 12px 0;
}
.pinned-wrap.active { display:block; }
.pinned-bar {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 78px;
  padding: 10px 12px;
  border-radius: 24px;
  background: linear-gradient(90deg, rgba(3, 115, 170, 0.16) 0%, rgba(5, 54, 93, 0.08) 48%, rgba(135, 52, 183, 0.16) 100%);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.08);
  backdrop-filter: blur(7px) saturate(120%);
  -webkit-backdrop-filter: blur(7px) saturate(120%);
  overflow: hidden;
  isolation: isolate;
}
.pinned-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02) 38%, rgba(255,255,255,0));
  pointer-events: none;
}
.pinned-rail {
  position: relative;
  width: 5px;
  min-width: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 1px 0;
}
.pinned-panel-rail { display:none; }
.pinned-rail-piece,
.pinned-panel-rail-piece {
  display: block;
  width: 100%;
  min-height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(33,213,255,0.98), rgba(0,153,255,0.88));
  box-shadow: 0 0 0 1px rgba(88,224,255,0.18), 0 0 8px rgba(0,183,255,0.22);
}
.pinned-main {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: right;
  color: inherit;
  cursor: pointer;
}
.pinned-copy { min-width: 0; width: 100%; }
.pinned-title {
  color: #27c7ff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-snippet {
  color: rgba(255,255,255,0.96);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-menu-btn {
  width: 40px;
  height: 40px;
  align-self: center;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pinned-menu-btn:hover,
.pinned-menu-btn[aria-expanded="true"] {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.14);
}
.pinned-menu-btn:active { transform: scale(.97); }
.pinned-menu-svg { width: 18px; height: 18px; }
.pinned-panel {
  display: none;
  position: relative;
  margin-top: 8px;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(90deg, rgba(3, 115, 170, 0.14) 0%, rgba(5, 54, 93, 0.07) 48%, rgba(135, 52, 183, 0.14) 100%);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 10px 28px rgba(0,0,0,0.06);
  backdrop-filter: blur(7px) saturate(118%);
  -webkit-backdrop-filter: blur(7px) saturate(118%);
  max-height: min(42vh, 360px);
  overflow: hidden;
}
.pinned-panel::before {
  content:'';
  position:absolute;
  inset:0;
  border-radius:inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 38%, rgba(255,255,255,0));
  pointer-events:none;
}
.pinned-panel.open { display: block; }
.pinned-panel-list {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-height: calc(min(42vh, 360px) - 20px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,170,255,.86) rgba(255,255,255,.04);
}
.pinned-panel-list::-webkit-scrollbar { width: 6px; }
.pinned-panel-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 999px; }
.pinned-panel-list::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(25,214,255,0.96), rgba(0,153,255,0.82)); border-radius: 999px; }
.pinned-chip {
  min-width: 0;
  text-align: right;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pinned-chip:hover { background: rgba(255,255,255,0.055); border-color: rgba(255,255,255,0.08); }
.pinned-chip:active { transform: scale(.986); }
.pinned-chip.active { background: rgba(53,200,255,0.05); border-color: rgba(53,200,255,0.14); }
.pinned-chip .pc-title {
  font-weight: 800;
  font-size: 13px;
  color: #27c7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-chip .pc-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.84);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  direction: rtl;
}
@media (max-width: 640px) {
  .pinned-wrap { padding: 7px 10px 0; }
  .pinned-bar { min-height: 74px; padding: 9px 10px; gap: 9px; border-radius: 22px; }
  .pinned-title { font-size: 13px; }
  .pinned-snippet { font-size: 12px; }
  .pinned-menu-btn { width: 38px; height: 38px; border-radius: 13px; }
  .pinned-panel { margin-top: 7px; border-radius: 20px; max-height: min(44vh, 320px); }
  .pinned-panel-list { max-height: calc(min(44vh, 320px) - 20px); }
}
.edited-text { font-size: 10px; font-style: italic; color: rgba(255,255,255,0.6); padding-right: 4px; }

.reply-embed { border-right: 3px solid #fff; background: rgba(0,0,0,0.15); padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; cursor: pointer; overflow: hidden; transition: background 0.2s; }
.forward-embed { border-right: 3px solid rgba(25,214,255,0.92); background: rgba(11,17,32,0.22); padding: 7px 10px; border-radius: 10px; margin-bottom: 8px; display:flex; flex-direction:column; gap:2px; }
.forward-embed-title { font-size: 12px; font-weight: 800; color: var(--primary); }
.forward-embed-name { font-size: 13px; font-weight: 700; color: var(--text); }
.forward-picker { display:flex; flex-direction:column; gap:14px; }
.forward-source-list { display:flex; flex-direction:column; gap:8px; }
.forward-source-item { padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; line-height: 1.5; }
.forward-source-more { color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 2px 4px 0; }
.forward-source-card { padding: 12px 14px; border:1px solid var(--glass-border); border-radius: 16px; background: rgba(255,255,255,0.04); }
.forward-source-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.forward-source-body { font-size: 14px; line-height: 1.6; color: var(--text); word-break: break-word; }
.forward-picker-actions { display:flex; gap:10px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.forward-picker-count { font-size: 12px; color: var(--text-muted); }
.forward-search-input { width:100%; border:none; outline:none; border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,0.06); color: var(--text); }
.forward-targets { display:flex; flex-direction:column; gap:10px; max-height: min(52vh, 420px); overflow:auto; padding-left:2px; }
.forward-section-title { font-size: 12px; font-weight: 800; color: var(--text-muted); padding: 4px 2px 0; }
.forward-item { display:flex; align-items:center; gap:12px; width:100%; border:none; cursor:pointer; text-align:right; border-radius: 16px; padding: 10px 12px; background: rgba(255,255,255,0.03); color: var(--text); border:1px solid transparent; }
.forward-item:hover { background: rgba(255,255,255,0.055); }
.forward-item.selected { border-color: rgba(25,214,255,0.42); background: rgba(25,214,255,0.08); }
.forward-item-avatar { width:44px; height:44px; border-radius:50%; overflow:hidden; flex:0 0 44px; display:flex; align-items:center; justify-content:center; background: rgba(255,255,255,0.08); font-weight:800; }
.forward-item-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.forward-item-copy { min-width:0; flex:1; display:flex; flex-direction:column; gap:3px; }
.forward-item-title { font-size: 14px; font-weight: 700; color: var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.forward-item-sub { font-size: 12px; color: var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.forward-item-check { width:22px; height:22px; border-radius:50%; border:1px solid rgba(255,255,255,0.18); display:flex; align-items:center; justify-content:center; font-size:13px; color: transparent; flex:0 0 22px; }
.forward-item.selected .forward-item-check { color: #fff; background: linear-gradient(180deg, rgba(25,214,255,0.96), rgba(0,153,255,0.82)); border-color: transparent; }
.forward-empty { padding: 16px 10px; text-align:center; color: var(--text-muted); font-size: 13px; }
.forward-send-btn[disabled] { opacity:.65; cursor:not-allowed; }
.modal.forward-modal-active { padding: 0; align-items: stretch; justify-content: stretch; }
.modal.forward-modal-active .modal-backdrop { background: rgba(7,12,22,0.28); }
.modal.forward-modal-active .modal-card { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; border: none; box-shadow: none; background: var(--bg); }
.modal.forward-modal-active .modal-header { position: sticky; top: 0; z-index: 5; padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px 16px; background: rgba(7,18,37,0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.modal.forward-modal-active .modal-body { flex: 1; padding: 0; overflow: hidden; }
.forward-picker-fullscreen { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 0; }
.forward-picker-top { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 12px; }
.forward-picker-fullscreen .forward-targets { min-height: 0; max-height: none; overflow: auto; padding: 0 16px 16px; scroll-padding-bottom: 120px; }
.forward-picker-footer { margin-top: 0; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); background: rgba(7,18,37,0.88); border-top: 1px solid var(--glass-border); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); position: relative; z-index: 4; }
.forward-picker-footer .forward-picker-count { font-size: 13px; font-weight: 700; }
.forward-picker-footer .forward-send-btn { min-height: 56px; min-width: min(100%, 420px); font-size: 22px; font-weight: 900; border-radius: 18px; flex: 1 1 100%; }
@media (max-width: 640px) {
  .forward-picker-top { padding: 12px 12px 10px; }
  .forward-picker-fullscreen .forward-targets { padding: 0 12px 12px; }
  .forward-picker-footer { padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 12px); }
}

.chat-thumbnail { max-width: 180px; max-height: 180px; min-width: 80px; min-height: 80px; object-fit: cover; border-radius: 12px; cursor: pointer; display: block; margin-top: 6px; background-color: var(--bg-deep); border: 1px solid var(--glass-border); }
.voice-player { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.15); padding: 6px 12px; border-radius: 20px; margin-top: 4px; min-width: 200px; }
.vp-play { width: 36px; height: 36px; border-radius: 50%; border: none; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.vp-play .ui-icon-small { filter: none; } 
html[dir="rtl"] .msg-row.other .vp-play { background: var(--primary); }
html[dir="rtl"] .msg-row.other .vp-play .ui-icon-small { filter: brightness(0) invert(1); }
.vp-waveform { flex: 1; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; position: relative; overflow: hidden; cursor: pointer; direction: ltr; }
.vp-progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: #fff; border-radius: 2px; transition: width 0.1s linear; pointer-events: none; }
html[dir="rtl"] .msg-row.other .vp-progress { background: var(--primary); }
.vp-time { font-size: 11px; font-weight: 700; min-width: 32px; text-align: center; color: var(--text); opacity: 0.8; direction: ltr; }

.composer-wrapper { background: transparent; padding: 8px 16px 16px 16px; position: sticky; bottom: 0; z-index: 201; display: flex; flex-direction: column; pointer-events: none; }
.composer-inner, .composer-context, .read-only-banner { pointer-events: auto; }
.read-only-banner { background: var(--bg-elevated); color: var(--text-muted); text-align: center; padding: 12px; border-radius: 16px; font-size: 14px; font-weight: 600; border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); }
.composer-inner { display: flex; align-items: flex-end; background: var(--bg-elevated); border-radius: 28px; padding: 6px; border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); }
.composer-context { background: var(--bg-elevated); margin-bottom: 8px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; border-radius: 16px; border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); }
.action-btn, .attach-btn { border: none; flex-shrink: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s, opacity 0.2s; width: 44px; height: 44px; border-radius: 50%; }
.input-container { flex: 1; display: flex; align-items: center; background: transparent; min-height: 44px; padding-bottom: 2px; margin-left: 12px; transition: margin 0.3s ease; position: relative; }
.emoji-btn { position: absolute; left: 6px; bottom: 6px; width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease; z-index: 2; }
.emoji-btn:hover { background: rgba(255,255,255,0.12); }
.emoji-btn:active { transform: scale(0.94); }
#msgInput { width: 100%; background: transparent; border: none; color: #fff; resize: none; outline: none; padding: 10px 12px 10px 48px; font-family: inherit; font-size: 16px !important; max-height: 120px; line-height: 1.5; }
.emoji-picker { position: absolute; left: 0; bottom: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); max-height: 320px; overflow: hidden; padding: 10px; border-radius: 18px; display: none; flex-direction: column; gap: 10px; z-index: 25; }
.emoji-picker-top { display: flex; align-items: center; }
.emoji-search-input { width: 100%; min-height: 38px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.06); color: #fff; border-radius: 12px; padding: 0 12px; font-family: inherit; outline: none; }
.emoji-search-input::placeholder { color: var(--text-muted); }
.emoji-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.emoji-tab { border: none; min-height: 34px; border-radius: 10px; background: rgba(255,255,255,0.06); color: #fff; cursor: pointer; font-size: 18px; transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease; }
.emoji-tab.active { background: rgba(255,255,255,0.16); }
.emoji-tab:active { transform: scale(0.95); }
.emoji-body { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-left: 2px; }
.emoji-body::-webkit-scrollbar { width: 6px; }
.emoji-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 999px; }
.emoji-group { display: flex; flex-direction: column; gap: 8px; }
.emoji-group-title { font-size: 12px; color: var(--text-muted); padding: 0 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.emoji-item { border: none; background: rgba(255,255,255,0.06); min-height: 38px; border-radius: 12px; cursor: pointer; font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: transform 0.16s ease, background 0.16s ease; }
.emoji-item:hover { background: rgba(255,255,255,0.12); }
.emoji-item:active { transform: scale(0.92); }
.emoji-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 12px 8px 4px; }
#msgInput::placeholder { color: var(--text-muted); }
.send-btn, .mic-btn { background-color: var(--primary) !important; width: 44px; height: 44px; border-radius: 50% !important; box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4); }
.send-btn:not(:disabled):active, .mic-btn:active { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; background-color: var(--bg-elevated) !important; }

.bottom-nav { position: fixed; bottom: 20px; left: 50%; right: auto; transform: translateX(-50%); width: min(322px, calc(100vw - 20px)); max-width: calc(100vw - 20px); height: 60px; padding: 0 8px; border-radius: 30px; background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: flex; align-items: center; z-index: 90; border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); flex-direction: row-reverse; justify-content: space-between; gap: 2px; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); text-decoration: none; border: none; background: none; cursor: pointer; transition: color 0.2s, transform 0.2s, background 0.2s, box-shadow 0.2s; padding: 6px 10px; border-radius: 999px; min-width: 58px; flex: 1 1 0; position: relative; z-index: 1; }
.nav-item.active { color: var(--text); background: linear-gradient(180deg, rgba(125,211,252,0.18) 0%, rgba(125,211,252,0.10) 100%); box-shadow: 0 0 0 1px rgba(125,211,252,0.12) inset, 0 10px 24px rgba(125,211,252,0.10); }
.nav-item.active::before { content: ''; position: absolute; top: -4px; bottom: -4px; left: -6px; right: -6px; border-radius: 999px; background: radial-gradient(ellipse at center, rgba(125,211,252,0.18) 0%, rgba(125,211,252,0.10) 48%, rgba(125,211,252,0.03) 68%, rgba(125,211,252,0.00) 82%); pointer-events: none; z-index: -1; }
.nav-item:active { transform: scale(0.94); }
.nav-label { font-size: 11px; font-weight: 700; margin-top: 4px; font-family: var(--font); }
.nav-avatar { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); color: #fff; font-size: 12px; border: 1px solid var(--glass-border); position: relative; z-index: 1; }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.icon-btn { background: none; border: none; padding: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background 0.2s; width: 44px; height: 44px; }
.icon-btn:hover { background: rgba(255,255,255,0.05); }
.icon-btn-small { background: none; border: none; padding: 6px; cursor: pointer; border-radius: 50%; transition: background 0.2s; }
.icon-btn-small:hover { background: rgba(255,255,255,0.05); }
.popup-menu { position: absolute; top: 60px; right: 20px; background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: 16px; width: 220px; padding: 8px; display: flex; flex-direction: column; z-index: 99999; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.popup-item, a.popup-item { text-decoration: none !important; background: transparent; border: 0; color: var(--text); text-align: right; padding: 12px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 500; transition: background 0.2s; display: flex; align-items: center; gap: 8px; }
.popup-item:hover { background: rgba(255,255,255,0.05); }

.popup-item.admin-popup-item { justify-content: flex-start; }
.menu-inline-badge {
  margin-right: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(239,68,68,.35);
}
.login-secondary-btn {
  margin-top: 14px;
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}
.login-secondary-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}
.login-secondary-btn:active { transform: scale(.98); }
.login-subcard {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.request-type-chip {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:22px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.08);
}
.request-type-chip.signup { background: rgba(14,165,233,.14); color: #38bdf8; }
.request-type-chip.password-reset { background: rgba(245,158,11,.14); color: #fbbf24; }
.msg-popover { position: fixed; background: var(--bg-elevated); border: 1px solid var(--glass-border); border-radius: 12px; padding: 6px; z-index: 99999; box-shadow: var(--glass-shadow); display: flex; flex-direction: column; }
.pop-btn { background: transparent; border: 0; color: var(--text); padding: 12px 16px; border-radius: 8px; font-family: inherit; font-size: 14px; text-align: right; cursor: pointer; }
.pop-btn:hover { background: rgba(255,255,255,0.05); }
.text-danger { color: var(--danger) !important; }

.modal, .full-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.modal-backdrop, .full-modal { background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); }
.modal-card { width: 90%; max-width: 400px; background: var(--bg-deep); border-radius: 20px; border: 1px solid var(--glass-border); display: flex; flex-direction: column; max-height: 80vh; z-index: 1001; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }

.full-modal-card { width: 90%; max-width: 380px; background: var(--bg-elevated); border-radius: 24px; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; position: relative; border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); }
.full-modal-close { position: absolute; top: 16px; left: 16px; background: rgba(255,255,255,0.05); width: 36px; height: 36px; border: none; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.full-modal-close { z-index: 4; }
.full-modal-avatar { width: 110px; height: 110px; min-height: 110px; border-radius: 50%; overflow: visible; margin-bottom: 20px; background: transparent; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; font-size: 32px; font-weight: bold; position: relative; }
.full-modal-avatar .avatar-media { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 3px solid var(--primary); background: var(--bg-deep); display: flex; align-items: center; justify-content: center; }
.full-modal-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.full-modal-name { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 8px; width: 100%; text-align: center; }
.full-modal-bio { font-size: 14px; color: var(--text-muted); text-align: center; width: 100%; }

#pageProfile { padding: 0; display: flex; flex-direction: column; height: 100%; }
.profile-static-wrapper { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 30px 20px 100px 20px; width: 100%; max-width: 440px; margin: 0 auto; }

.ps-avatar { width: 130px; height: 130px; border-radius: 50%; background: transparent; margin-bottom: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: bold; color: #fff; box-shadow: none; border: 0; flex-shrink: 0; position: relative; }
.ps-avatar .avatar-media { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--bg-elevated); box-shadow: 0 8px 24px rgba(0,0,0,0.3); border: 2px solid var(--glass-border); display: flex; align-items: center; justify-content: center; }
.ps-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

.ps-name { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 20px; text-align: center; }

.pb-box { width: 100%; background: var(--sec-bg); border: 1px solid var(--sec-border); border-radius: 20px; padding: 8px 20px; margin-bottom: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.pb-row { display: flex; flex-direction: column; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.pb-row:last-child { border-bottom: none; }
.pb-label { font-size: 13px; color: var(--sec-label); font-weight: 600; margin-bottom: 6px; }
.pb-value { font-size: 15px; color: var(--text); font-weight: 700; word-break: break-word; }
.pb-link-val { color: var(--sec-link); direction: ltr; text-align: right; }

.copyable-link { cursor: pointer; transition: opacity 0.2s; }
.copyable-link:active { opacity: 0.6; }

.pb-edit-btn { width: 100%; min-height: 52px; background: var(--primary); color: #fff; font-size: 16px; font-weight: 800; font-family: inherit; border: none; border-radius: 16px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3); flex-shrink: 0; }
.pb-edit-btn:active { transform: scale(0.96); box-shadow: 0 2px 10px rgba(0, 122, 255, 0.2); }

.scroll-down-fab { position: absolute; bottom: 85px; right: 16px; width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0,0,0,0.4); z-index: 150; cursor: pointer; backdrop-filter: blur(10px); }
.badge-counter { position: absolute; top: -4px; left: -4px; background: var(--primary); color: white; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

@keyframes pulse-mic { 0% { transform: scale(1); } 50% { transform: scale(1.1); background-color: var(--danger); border-radius: 50%; } 100% { transform: scale(1); } }
.mic-btn.recording { animation: pulse-mic 1s infinite; background-color: var(--danger) !important; }


/* =========================================================
    استایل صفحه تنضیمات همون پروفایل
   ========================================================= */

.admin-body {
  background: var(--bg-deep);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admin-shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
  scroll-behavior: smooth;
}

.admin-top {
  position: relative;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: transparent;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.admin-top .brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px 20px;
  margin: 0 16px 20px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.card h3 {
  margin-top: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.card hr {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin: 24px 0;
}

.row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.avatar.big {
  width: 110px;
  height: 110px;
  min-width: 110px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: bold;
  background: var(--bg-deep);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  margin: 0 auto;
}

.avatar.big img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar.big + div {
  width: 100%;
  flex: none !important;
}

label {
  display: block;
  font-size: 13px;
  color: var(--sec-label);
  margin-bottom: 6px;
  font-weight: 600;
}

input:not([type="file"]):not([type="checkbox"]), select {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:not([type="file"]):not([type="checkbox"]):focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
  margin-bottom: 16px;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.hint b {
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 14px 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.btn-secondary:active {
  transform: scale(0.96);
}

.profile-action-btn {
  width: auto;
  min-width: 148px;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 10px;
}

.profile-action-btn.is-static,
.profile-action-btn:disabled {
  opacity: 0.72;
  cursor: default;
  box-shadow: none;
}

.menu {
  position: relative;
}

.pill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-dropdown {
  position: absolute;
  top: 50px;
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  padding: 8px;
  min-width: 160px;
  z-index: 105;
  display: flex;
  flex-direction: column;
}

.menu-dropdown .menu-item {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-align: right;
  transition: background 0.2s;
}

.menu-dropdown .menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
}



/* =========================================================
   استایل صفحه ادمین
   ========================================================= */

.grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 16px;
  font-weight: 600;
}

label.check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.members-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.member-chip:hover, .member-chip:active {
  background: rgba(255, 255, 255, 0.08);
}

.gm-check {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.table {
  width: 100%;
  overflow-x: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 16px;
}

.table::-webkit-scrollbar { height: 6px; }
.table::-webkit-scrollbar-track { background: transparent; }
.table::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.thead, .trow {
  display: flex;
  min-width: max-content;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  align-items: center;
}

.thead {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  font-size: 12px;
  color: var(--sec-label);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trow {
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.trow:hover { background: rgba(255, 255, 255, 0.02); }
.trow:last-child { border-bottom: none; }

.thead > div, .trow > div {
  flex: 1 0 90px; 
  padding: 0 8px;
  word-break: break-word;
}

.thead > div:last-child, .trow > div:last-child {
  flex: 0 0 180px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end; /* Align buttons to right */
}

.pill.small {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  height: auto;
  width: auto;
}

.pill.small:hover, .pill.small:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.96);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.mono {
  font-family: monospace;
  direction: ltr;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.meta {
  color: var(--text-muted);
  font-size: 12px;
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: opacity 0.2s;
}

.link:active { opacity: 0.7; }



/* =========================================================
   استایل فوق حرفه‌ای فرم لاگین
   ========================================================= */

@keyframes premiumBg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes floatOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -40px) scale(1.1); }
}

@keyframes floatOrb2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-40px, 40px) scale(1.15); }
}

.login-body {
    background: linear-gradient(-45deg, #0b1220, #0f172a, #1e1b4b, #082f49);
    background-size: 300% 300%;
    animation: premiumBg 12s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

/* هاله‌های نورانی شناور در پس زمینه */
.login-body::before, .login-body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    z-index: 0;
    pointer-events: none;
}
.login-body::before {
    width: 350px; height: 350px;
    background: #38bdf8;
    top: -50px; left: -50px;
    animation: floatOrb1 8s ease-in-out infinite alternate;
}
.login-body::after {
    width: 400px; height: 400px;
    background: #8b5cf6;
    bottom: -100px; right: -50px;
    animation: floatOrb2 10s ease-in-out infinite alternate;
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(15, 23, 42, 0.40);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    padding: 48px 32px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    animation: slideUpLogin 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    margin: auto;
}

@keyframes slideUpLogin {
    from { opacity: 0; transform: translateY(50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .brand {
    font-size: 34px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(255,255,255,0.1);
}

.login-card .subtitle {
    font-size: 14px;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 36px;
    font-weight: 500;
}

.login-card .alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    animation: shakeAlert 0.4s ease-in-out;
}

.login-card form {
    display: flex;
    flex-direction: column;
}

.login-card label {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 8px;
    font-weight: 600;
    padding-right: 4px;
}

.login-card input:not([type="checkbox"]) {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 20px;
    outline: none;
}

.login-card input:not([type="checkbox"]):focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
    transform: translateY(-2px);
}

.login-card .btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #4f46e5 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
    border-radius: 16px;
    height: 56px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    cursor: pointer;
}

/* افکت براق بودن روی دکمه */
.login-card .btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.login-card .btn-primary:hover::after {
    left: 150%;
}

.login-card .btn-primary:hover {
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px);
}

.login-card .btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.login-card .hint {
    text-align: center;
    margin-top: 28px;
    margin-bottom: 0;
    color: #64748b;
    font-size: 12px;
}

/* =========================================================
   استایل لودینگ حرفه‌ای 
   ========================================================= */
.elegant-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.elegant-loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: #38bdf8;
    border-right-color: #8b5cf6;
    animation: spinRing 1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

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

.loader-text {
    margin-top: 24px;
    font-size: 15px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.5px;
    animation: pulseText 1.5s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 12px rgba(255,255,255,0.4); }
}



::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* =========================================================
   فیکس سازی دسکتاپ
   ========================================================= */
@media (min-width: 860px) {
  
  body:not(.admin-body):not(.login-body) {
    display: flex !important;
    flex-direction: row !important;
  }

  .view-main {
    width: 380px !important;
    min-width: 380px !important;
    max-width: 380px !important;
    flex: none !important;
    border-left: 1px solid var(--glass-border);
    display: flex !important;
    position: relative;
    height: 100vh !important;
    background: var(--bg-deep);
    z-index: 10;
  }

  .view-main {
    padding-bottom: 92px !important;
  }

  .bottom-nav {
    position: fixed !important;
    bottom: 20px !important;
    right: 31px !important;
    left: auto !important;
    transform: none !important;
    width: 318px !important;
    max-width: 318px !important;
    height: 58px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    z-index: 1000 !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 2px !important;
  }

  body.chat-open .bottom-nav {
    display: flex !important;
  }

  .view-chat { min-height: var(--app-vh);
    flex: 1 !important;
    display: flex !important;
    position: relative;
    height: 100vh !important;
    animation: none !important;
    background: radial-gradient(circle at 50% 50%, #202b36 0%, var(--bg-deep) 100%);
  }

  #backBtn { display: none !important; }

  body:not(.chat-open) .view-chat::after {
    content: 'یک گفتگو را برای شروع انتخاب کنید';
    position: absolute;
    inset: 0;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 600;
  }

  .admin-body .admin-shell {
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 30px 50px !important;
    display: block !important;
  }

  .admin-body .grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
  }

  .composer-wrapper {
    max-width: 850px;
    margin: 0 auto;
    width: 100%;
    padding: 10px 20px 30px 20px;
  }
}

/* Saved Messages avatar icon */
.saved-avatar-icon{ width:60%; height:60%; object-fit:contain; opacity:0.95; }
.chat-avatar.is-saved-header .avatar-media{ background: transparent; border: 0; overflow: visible; }
.saved-header-avatar-media{ background: transparent !important; border: 0 !important; }
.saved-header-avatar-svg{ width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 18px rgba(42,168,255,0.28)); }
.view-chat.is-saved-chat .chat-search-header-btn{ display: inline-flex; }


/* Reaction picker (iPhone-like quick emojis) */
.reaction-picker{
  position: fixed;
  z-index: 99999;
  background: rgba(25,25,25,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  border-radius: 16px;
  padding: 8px;
  display:flex;
  gap:6px;
  align-items:center;
  backdrop-filter: blur(10px);
}
.reaction-picker button{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 0;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.reaction-picker button:hover{ background: rgba(255,255,255,0.14); }
.reaction-picker button:active{ transform: scale(0.96); }

body.light-theme .reaction-picker{
  background: rgba(255,255,255,0.98);
  border-color: rgba(15,23,42,0.10);
  box-shadow: 0 16px 38px rgba(15,23,42,0.16);
}
body.light-theme .reaction-picker button{
  background: rgba(15,23,42,0.05);
  color: var(--text);
}
body.light-theme .reaction-picker button:hover{ background: rgba(15,23,42,0.10); }

.rx-bar{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:6px;
}
.rx-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 13px;
  cursor: pointer;
  user-select:none;
}
.msg-row.me .rx-pill{ background: rgba(0,0,0,0.22); }
.rx-pill b{ font-weight:800; }
.rx-pill.mine{
  border-color: rgba(42,171,238,0.65);
  box-shadow: 0 0 0 2px rgba(42,171,238,0.14) inset;
}

.mention{
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}
.msg-link{
  color: var(--primary);
  text-decoration: underline;
}



/* ===== Admin group members modal fix ===== */
.admin-members-backdrop{
  position: fixed !important;
  inset: 0 !important;
  z-index: 30000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  background: rgba(0,0,0,0.68) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.admin-members-modal{
  width: min(100%, 520px) !important;
  max-width: 520px !important;
  max-height: min(86vh, 760px) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-elevated) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45) !important;
  padding: 18px !important;
}

.admin-members-modal .modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-members-modal .modal-title{
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.admin-members-modal .modal-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap: wrap;
}

.admin-members-modal .admin-modal-save{
  width: auto !important;
  min-width: 92px;
  padding: 10px 16px;
}

.admin-members-box{
  flex: 1 1 auto !important;
  min-height: 180px;
  max-height: min(56vh, 420px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 8px !important;
  margin-top: 8px;
  margin-bottom: 8px;
}

.admin-members-modal .member-chip{
  min-height: 44px;
  justify-content: flex-start;
}

.admin-members-modal .mm-check{
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

@media (max-width: 640px){
  .admin-members-backdrop{
    align-items: flex-end !important;
    padding: 10px !important;
  }
  .admin-members-modal{
    width: 100% !important;
    max-width: 100% !important;
    max-height: 78vh !important;
    border-radius: 20px 20px 14px 14px !important;
    padding: 14px !important;
  }
  .admin-members-box{
    max-height: 48vh !important;
  }
}

/* keep buttons visible in admin tables on narrow widths */
.thead > div:last-child, .trow > div:last-child {
  min-width: 180px;
}


/* ===== more Telegram-like multi reaction layout ===== */
.rx-bar{
  display:flex !important;
  flex-wrap:wrap !important;
  gap:4px !important;
  max-width:100% !important;
  margin-top:6px !important;
  margin-bottom:4px !important;
}

.rx-pill{
  display:inline-flex !important;
  align-items:center !important;
  gap:4px !important;
  padding:3px 7px !important;
  min-height:26px !important;
  border-radius:14px !important;
  font-size:12px !important;
  white-space:nowrap !important;
  max-width:max-content !important;
}

.rx-pill b{
  font-size:11px !important;
}

.msg-bubble{
  max-width:100%;
}


/* ==============================
   Theme switch
==============================*/

.theme-switch-row{
  justify-content: space-between;
  user-select: none;
}

.theme-switch-label{
  font-weight: 700;
}

.theme-switch{
  display: inline-flex;
  align-items: center;
  direction: ltr;
}

.theme-switch-track{
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.10);
  position: relative;
  transition: background .25s ease, border-color .25s ease;
}

.theme-switch-thumb{
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: transform .25s ease, background .25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

body.light-theme .theme-switch-track{
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.10);
}

body.light-theme .theme-switch-thumb{
  transform: translateX(-26px);
  background: #ffffff;
}


/* ==============================
   Light theme text/icon fixes
==============================*/

body.light-theme{
  --bg-deep: #f3f6fb;
  --bg-elevated: #ffffff;
  --glass: rgba(255,255,255,0.85);
  --glass-border: rgba(0,0,0,0.08);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4fae63;
  --incoming: #ffffff;
  --outgoing: #e7f7df;
  --accent: #0ea5e9;
  --danger: #ef4444;
  --sec-bg: #ffffff;
  --sec-border: rgba(0,0,0,0.08);
  --sec-label: #64748b;
  --sec-link: #2563eb;
}

body.light-theme,
body.light-theme html{
  background: var(--bg-deep);
}

body.light-theme .view-main,
body.light-theme .view-chat{
  background: var(--bg-deep);
}

body.light-theme,
body.light-theme .brand-text,
body.light-theme .room-name,
body.light-theme .part-name,
body.light-theme .chat-name,
body.light-theme .pb-value,
body.light-theme .ps-name,
body.light-theme .full-modal-name,
body.light-theme .modal-header,
body.light-theme .card h3,
body.light-theme .thead,
body.light-theme .trow,
body.light-theme .popup-item,
body.light-theme .pop-btn{
  color: var(--text);
}

body.light-theme .part-presence.is-online { color: #0f9d58; }
body.light-theme .room-msg,
body.light-theme .part-bio,
body.light-theme .chat-type,
body.light-theme .room-time,
body.light-theme .meta,
body.light-theme .hint,
body.light-theme .pb-label,
body.light-theme .full-modal-bio,
body.light-theme .ls-sub,
body.light-theme .pc-sub,
body.light-theme .edited-text{
  color: var(--text-muted);
}

body.light-theme .ui-icon,
body.light-theme .ui-icon-small,
body.light-theme .msg-badge-icon,
body.light-theme .pinned-bar .pin-ico{
  filter: none;
  opacity: 0.9;
}

body.light-theme input:not([type="file"]):not([type="checkbox"]),
body.light-theme select,
body.light-theme .live-search{
  background: rgba(255,255,255,0.95);
  color: var(--text);
  border-color: rgba(0,0,0,0.10);
}

body.light-theme input::placeholder,
body.light-theme #msgInput::placeholder{
  color: var(--text-muted);
  opacity: 1;
}

body.light-theme #msgInput{
  color: var(--text);
}

body.light-theme .popup-menu,
body.light-theme .msg-popover,
body.light-theme .modal-card,
body.light-theme .full-modal-card,
body.light-theme .card,
body.light-theme .pb-box,
body.light-theme .admin-members-modal,
body.light-theme .composer-inner,
body.light-theme .composer-context,
body.light-theme .read-only-banner{
  background: var(--bg-elevated);
  color: var(--text);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

body.light-theme .msg-row.other .msg-bubble{
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.08);
}

body.light-theme .msg-row.other .msg-bubble.admin-bubble{
  border-color: rgba(245,158,11,0.72);
  box-shadow: 0 6px 18px rgba(245,158,11,0.18);
}

body.light-theme .msg-row.me .msg-bubble.admin-bubble{
  border-color: rgba(245,158,11,0.72);
  box-shadow: 0 6px 18px rgba(245,158,11,0.18);
}

body.light-theme .msg-date-separator span{
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.08);
  color: #475569;
  box-shadow: 0 6px 18px rgba(15,23,42,0.08);
}

body.light-theme .msg-row.me .msg-bubble{
  background: var(--outgoing);
  color: #204127;
  border: 1px solid rgba(79,174,99,0.18);
  box-shadow: 0 3px 10px rgba(79,174,99,0.10);
}

body.light-theme .msg-row.me .msg-body{
  color: #204127;
}

body.light-theme .msg-row.me .msg-meta{
  color: rgba(32,65,39,0.72);
}

body.light-theme .msg-meta{
  color: rgba(15,23,42,0.65);
}

body.light-theme .ticks{
  color: #4b5563;
}

body.light-theme .ticks.read{
  color: #16a34a;
}

body.light-theme .filter-tabs,
body.light-theme .chat-header,
body.light-theme .bottom-nav,
body.light-theme .pinned-bar{
  background: var(--glass);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .filter-btn{
  color: var(--text-muted);
}

body.light-theme .filter-btn.active,
body.light-theme .nav-item.active{
  color: var(--text);
}

body.light-theme .nav-item{
  color: var(--text-muted);
}

body.light-theme .nav-item.active{
  background: linear-gradient(180deg, rgba(125,211,252,0.20) 0%, rgba(125,211,252,0.12) 100%);
  box-shadow: 0 0 0 1px rgba(125,211,252,0.12) inset, 0 10px 24px rgba(125,211,252,0.12);
}

body.light-theme .nav-item.active::before{
  background: radial-gradient(ellipse at center, rgba(125,211,252,0.20) 0%, rgba(125,211,252,0.10) 48%, rgba(125,211,252,0.03) 68%, rgba(125,211,252,0.00) 82%);
}

body.light-theme .room-info,
body.light-theme .user-info{
  border-bottom-color: rgba(15,23,42,0.10);
}

body.light-theme .room-list .room-item:last-child .room-info,
body.light-theme .user-list .user-item:last-child .user-info,
body.light-theme .contacts-search-results .user-item:last-child .user-info{
  border-bottom-color: transparent;
}

body.light-theme .contacts-search-results .user-info{
  border-bottom-color: rgba(15,23,42,0.08);
}

body.light-theme .room-avatar,
body.light-theme .user-avatar,
body.light-theme .chat-avatar,
body.light-theme .mavatar,
body.light-theme .nav-avatar,
body.light-theme .ps-avatar,
body.light-theme .full-modal-avatar{
  background: #e2e8f0;
  color: var(--text);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .reply-embed,
body.light-theme .voice-player,
body.light-theme .pinned-chip,
body.light-theme .members-box,
body.light-theme .table{
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .rx-pill{
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.10);
  color: var(--text);
}

body.light-theme .msg-row.me .rx-pill{
  background: rgba(255,255,255,0.22);
  color: #fff;
}

body.light-theme .live-search-results{
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.08);
}

body.light-theme .ls-item:hover,
body.light-theme .popup-item:hover,
body.light-theme .pop-btn:hover,
body.light-theme .icon-btn:hover,
body.light-theme .icon-btn-small:hover{
  background: rgba(0,0,0,0.05);
}

/* Upload progress and rich file previews */
.upload-meta{margin-top:8px;font-size:12px;color:var(--text-muted);font-weight:700}
.upload-progress{width:100%;height:8px;border-radius:999px;background:rgba(127,127,127,0.18);overflow:hidden;margin-top:8px}
.upload-progress-bar{height:100%;width:0%;background:var(--primary);transition:width .18s ease}
.ctx-file-preview{margin-top:10px;border-radius:14px;overflow:hidden;border:1px solid var(--glass-border);background:rgba(0,0,0,0.08);max-height:min(38vh,300px)}
.ctx-file-preview img,.ctx-file-preview video{display:block;width:100%;height:100%;max-height:min(28vh,180px);object-fit:contain;background:#000}
.ctx-file-preview iframe{display:block;width:100%;height:min(28vh,180px);border:0;background:#fff}
.pending-file-card{display:flex;flex-direction:column;gap:10px;padding:10px;background:var(--bg-elevated);max-width:100%}
.pending-file-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.pending-file-info{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.pending-file-type-icon,.chat-generic-file-icon{width:42px;height:42px;display:inline-flex;align-items:center;justify-content:center;border-radius:12px;background:rgba(0,122,255,0.12);font-size:20px;flex-shrink:0}
.pending-file-texts,.chat-generic-file-meta{display:flex;flex-direction:column;min-width:0;gap:2px;flex:1}
.pending-file-name,.chat-generic-file-name{font-size:13px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;direction:ltr;text-align:right;color:var(--text);max-width:100%}
.pending-file-sub,.chat-generic-file-type{font-size:12px;color:var(--text-muted);font-weight:700}
.pending-file-remove{border:1px solid rgba(255,59,48,0.2);background:rgba(255,59,48,0.12);color:#ff3b30;padding:8px 12px;border-radius:10px;font-weight:800;cursor:pointer;flex-shrink:0;line-height:1}
.pending-file-media-wrap{border-radius:12px;overflow:hidden;background:rgba(15,23,42,0.06);display:flex;align-items:center;justify-content:center;max-height:min(28vh,180px)}
.pending-preview-media{cursor:zoom-in;object-position:center center}
.pending-preview-frame{display:block;width:100%;height:min(28vh,180px);border:0;background:#fff}
.pending-file-fallback{display:flex;align-items:center;justify-content:center;gap:10px;padding:20px 14px;color:var(--text-muted);font-weight:700;text-align:center}
.pending-file-emoji{font-size:28px;line-height:1}
.chat-generic-file-card{margin-top:8px;border:1px solid var(--glass-border);border-radius:14px;background:rgba(0,0,0,0.14);max-width:min(320px,100%);overflow:hidden}
.chat-generic-file-link{display:flex;align-items:center;gap:10px;padding:10px 12px;text-decoration:none;color:inherit}
.chat-video{display:block;width:min(320px,100%);max-width:100%;max-height:260px;margin-top:8px;border-radius:14px;background:#000;border:1px solid var(--glass-border)}
.chat-pdf-card{margin-top:8px;border:1px solid var(--glass-border);border-radius:14px;overflow:hidden;background:rgba(0,0,0,0.12);max-width:min(360px,100%)}
.chat-pdf-frame{display:block;width:100%;height:260px;border:0;background:#fff}
.chat-file-actions{display:flex;gap:8px;align-items:center;justify-content:space-between;padding:10px 12px}
.chat-file-link{color:var(--primary);font-weight:700;text-decoration:none}
.file-preview-body{width:min(94vw,900px);max-height:90vh;display:flex;align-items:center;justify-content:center}
.file-preview-body img,.file-preview-body video,.file-preview-body iframe{max-width:100%;max-height:88vh;border-radius:14px;border:0;background:#000}
.file-preview-body iframe{width:min(94vw,900px);height:min(88vh,1000px);background:#fff}
.attach-btn{border:0 !important; background:transparent !important; box-shadow:none !important}
body.light-theme .attach-btn{background:transparent !important;border:0 !important;box-shadow:none !important}
body.light-theme .attach-btn .ui-icon{opacity:1}
body.light-theme .send-btn{box-shadow:0 6px 18px rgba(0,122,255,0.28)}
body.light-theme #pageProfile,.light-theme .profile-static-wrapper,.light-theme .profile-tab-wrapper{background:transparent;color:var(--text)}
body.light-theme.admin-body{
  background: linear-gradient(180deg, #f7fafc 0%, #eef4f8 100%);
  color: var(--text);
}
body.light-theme .admin-shell,
body.light-theme .admin-top,
body.light-theme .admin-top .brand,
body.light-theme .card,
body.light-theme .card h3,
body.light-theme label,
body.light-theme .hint,
body.light-theme .menu-dropdown,
body.light-theme .menu-dropdown .menu-item,
body.light-theme .pill,
body.light-theme .avatar.big{
  color: var(--text);
}
body.light-theme .card{
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 14px 34px rgba(15,23,42,0.08);
}
body.light-theme .admin-top{
  background: transparent;
}
body.light-theme .card h3,
body.light-theme .card hr,
body.light-theme .pb-row,
body.light-theme .thead,
body.light-theme .trow{
  border-color: rgba(15,23,42,0.08);
}
body.light-theme .pill{
  background: #ffffff;
  border: 1px solid rgba(15,23,42,0.08);
}
body.light-theme .pill:hover{
  background: #f8fafc;
}
body.light-theme .menu-dropdown{
  background: #ffffff;
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}
body.light-theme .menu-dropdown .menu-item:hover{
  background: rgba(15,23,42,0.05);
}
body.light-theme .avatar.big{
  background: #eef6f0;
  border-color: rgba(79,174,99,0.30);
  box-shadow: 0 10px 24px rgba(79,174,99,0.12);
}
body.light-theme .ps-avatar{box-shadow:0 8px 24px rgba(15,23,42,0.08)}
body.light-theme .full-modal{background:rgba(241,245,249,0.78)}
body.light-theme .ctx-file-preview{background:#f8fafc;border-color:rgba(15,23,42,0.08)}
body.light-theme .chat-pdf-card{background:#fff}
body.light-theme .pending-file-card{background:#fff}
body.light-theme .pending-file-remove{background:rgba(255,59,48,0.08)}
body.light-theme .pending-file-type-icon,
body.light-theme .chat-generic-file-icon{background:rgba(0,122,255,0.1)}
body.light-theme .chat-generic-file-card{background:#fff;border-color:rgba(15,23,42,0.08)}

.send-btn .ui-icon,.mic-btn .ui-icon{filter:brightness(0) invert(1) !important;opacity:1 !important}
body.light-theme .send-btn,body.light-theme .mic-btn{background:var(--primary) !important;border:1px solid rgba(255,255,255,0.24)}
body.light-theme .mic-btn.recording{background:var(--danger) !important;border-color:rgba(255,255,255,0.34) !important;box-shadow:0 4px 16px rgba(255,59,48,0.36) !important}
body.light-theme .send-btn .ui-icon,body.light-theme .mic-btn .ui-icon{filter:brightness(0) invert(1) !important}
body.light-theme .composer-context{align-items:flex-start}
body.light-theme .pending-file-remove{border-color:rgba(255,59,48,0.16);background:#fff;color:#d92d20;box-shadow:0 1px 2px rgba(15,23,42,0.05)}
@media (max-width: 640px){
  .composer-wrapper{padding:8px 10px 10px 10px}
  .message-selection-actions { left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); border-radius: 18px; }
  .message-selection-action { font-size: 13px; padding: 12px 10px; }
  .message-selection-select-all { min-width: 78px; padding: 9px 12px; }
  .composer-context{padding:10px 12px;border-radius:14px;gap:10px}
  .context-content{min-width:0;flex:1}
  .ctx-file-preview{max-height:220px}
  .pending-file-card{padding:8px}
  .pending-file-top{align-items:flex-start}
  .pending-file-remove{padding:7px 10px;font-size:12px}
  .pending-file-media-wrap,.ctx-file-preview img,.ctx-file-preview video,.ctx-file-preview iframe,.pending-preview-frame{max-height:140px;height:140px}
  .emoji-picker{
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-width: 100%;
    height: min(46vh, 360px);
    border-radius: 18px 18px 0 0;
    z-index: 3000;
    box-shadow: 0 -12px 30px rgba(0,0,0,0.22);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }
  .emoji-picker::before{
    content: '';
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.28);
    display: block;
    margin: 8px auto 6px;
    flex: 0 0 auto;
  }
}

body.light-theme .emoji-btn{background:#eef4ff;border:1px solid rgba(0,122,255,0.15)}
body.light-theme .emoji-picker{background:rgba(255,255,255,0.96);border:1px solid rgba(13,110,253,0.12)}
body.light-theme .emoji-item{background:rgba(13,110,253,0.06)}
body.light-theme .emoji-item:hover{background:rgba(13,110,253,0.12)}


/* Dark mode fix: emoji picker background */
.emoji-picker{
  background: rgba(20,24,35,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px);
}



/* ==============================
   Light mode pinned messages fix
============================== */
body.light-theme .pinned-bar {
    background: linear-gradient(90deg, #C0E6FF 0%, #F5F5F5 50%, #EAD3FF 100%) !important;
    border: 1px solid #0EA5E9 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
}

body.light-theme .pinned-bar::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.25) 40%, rgba(255,255,255,0)) !important;
}

body.light-theme .pinned-title,
body.light-theme .pinned-chip .pc-title {
    color: #05668D !important;
    font-weight: 600 !important;
}

body.light-theme .pinned-snippet,
body.light-theme .pinned-chip .pc-sub {
    color: #334155 !important;
}

body.light-theme .pinned-menu-btn {
    background: rgba(255,255,255,0.85) !important;
    border-color: rgba(14,165,233,0.3) !important;
    color: #0f172a !important;
}

body.light-theme .pinned-menu-btn:hover,
body.light-theme .pinned-menu-btn[aria-expanded="true"] {
    background: rgba(255,255,255,1) !important;
    border-color: rgba(14,165,233,0.4) !important;
}

body.light-theme .pinned-panel {
    background: rgba(245,245,245,0.95) !important;
    border-color: rgba(14,165,233,0.2) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 10px 20px rgba(0,0,0,0.08) !important;
}

body.light-theme .pinned-panel::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.2) 40%, rgba(255,255,255,0)) !important;
}

body.light-theme .pinned-chip {
    background: rgba(255,255,255,0.65) !important;
    border-color: rgba(14,165,233,0.2) !important;
}

body.light-theme .pinned-chip:hover {
    background: rgba(255,255,255,0.85) !important;
    border-color: rgba(14,165,233,0.28) !important;
}

body.light-theme .pinned-chip.active {
    background: rgba(14,165,233,0.1) !important;
    border-color: rgba(14,165,233,0.28) !important;
}
/* =========================================================
   اصلاح سایز منوی پایین برای پشتیبانی از ۵ آیتم
   ========================================================= */

/* کاهش جزئی سایز آیکون‌ها */
.bottom-nav .ui-icon, 
.bottom-nav .nav-icon svg {
    width: 22px !important;
    height: 22px !important;
}

/* کاهش پدینگ و حداقل عرض دکمه‌ها برای جا شدن در گوشی‌های کوچک */
.nav-item {
    padding: 6px 9px !important;
    min-width: 58px !important;
}

/* کوچکتر کردن فونت متن زیر آیکون */
.nav-label {
    font-size: 10px !important;
    margin-top: 3px !important;
}

/* جلوگیری از بیرون زدن هاله آبی رنگ در تب فعال */
.nav-item.active::before {
    top: -3px !important;
    bottom: -3px !important;
    left: -4px !important;
    right: -4px !important;
}

/* تنظیم مجدد حاشیه برای آیکون‌های SVG سفارشی */
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .contacts-search-input { background: rgba(15,23,42,0.035); border-color: rgba(15,23,42,0.10); }
body.light-theme .contacts-search-results { background: rgba(15,23,42,0.03); border-color: rgba(15,23,42,0.06); }
body.light-theme .btn-secondary { background: rgba(15,23,42,0.06); border-color: rgba(15,23,42,0.10); }

body.light-theme .chat-search-input { background: rgba(15,23,42,0.035); border-color: rgba(15,23,42,0.10); }
body.light-theme .chat-empty-state { background: rgba(15,23,42,0.035); border-color: rgba(15,23,42,0.08); }
body.light-theme .chat-menu-btn .dots-icon,
body.light-theme .chat-search-nav-btn { color: var(--text); }

body.light-theme .presence-dot { border-color: #f8fafc; }

/* Group profile modal */
.group-profile-modal{
  width:min(92vw, 430px);
  max-height:calc(100dvh - 32px);
  padding:18px 16px 16px;
  align-items:center;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable both-edges;
}
.group-profile-modal::-webkit-scrollbar{width:6px;}
.group-profile-modal::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.14);border-radius:999px;}
.group-profile-modal[data-profile-kind="group"] #fpStatusRow{
  display:none !important;
}
.group-profile-avatar{
  width:92px !important;
  height:92px !important;
  min-height:92px !important;
  margin-top:6px !important;
  margin-bottom:12px !important;
  border-radius:50% !important;
}
.group-profile-avatar .avatar-media{
  border-radius:50% !important;
}
.group-profile-box{
  width:100% !important;
  margin-top:0 !important;
  margin-bottom:0 !important;
  display:flex;
  flex-direction:column;
  min-height:0;
  max-height:none;
  overflow:visible;
}
.group-profile-box .pb-row{
  padding:12px 0;
}
.group-members-wrap{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-top:14px;
  min-height:0;
  flex:1 1 auto;
}
.group-members-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.group-members-head .pb-label{
  margin-bottom:0;
  font-size:14px;
}
.group-members-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:1 1 auto;
  min-height:180px;
  max-height:320px;
  overflow-y:auto;
  padding-inline-end:4px;
}
.group-members-list::-webkit-scrollbar{width:6px;}
.group-members-list::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.14);border-radius:999px;}
.group-member-card{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.025);
  border-radius:16px;
  padding:10px 12px;
  cursor:pointer;
  transition:transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  box-shadow:0 6px 18px rgba(0,0,0,0.14);
}
.group-member-card:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,0.14);
  background:rgba(255,255,255,0.045);
  box-shadow:0 10px 24px rgba(0,0,0,0.18);
}
.group-member-avatar{
  width:56px;
  height:56px;
  flex:0 0 56px;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
}
.group-member-avatar .avatar-media,
.group-member-avatar .avatar-media img,
.group-member-avatar .avatar-media span{
  width:56px;
  height:56px;
  border-radius:50%;
}
.group-member-avatar .avatar-media{
  overflow:hidden;
  background:var(--bg-deep);
  border:2px solid rgba(255,255,255,0.08);
}
.group-member-avatar .presence-dot{
  transform:scale(.9);
}
.group-member-info{
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.group-member-name{
  display:flex;
  align-items:center;
  gap:4px;
  font-size:14px;
  font-weight:800;
  color:var(--text);
}
.group-member-handle{
  direction:ltr;
  text-align:left;
  font-size:12px;
  color:var(--text-muted);
}
.group-member-empty{
  color:var(--text-muted);
  text-align:center;
  padding:18px 10px 8px;
  font-size:14px;
}
body.light-theme .group-member-card{
  background:rgba(15,23,42,0.03);
  border-color:rgba(15,23,42,0.08);
}
body.light-theme .group-member-card:hover{
  background:rgba(15,23,42,0.05);
  border-color:rgba(15,23,42,0.12);
}
body.light-theme .group-member-avatar .avatar-media{
  border-color:rgba(15,23,42,0.08);
}
/* جلوگیری از زوم خودکار کیبورد آیفون در موبایل */
@media screen and (max-width: 768px) {
  input, textarea, select, 
  #msgInput, 
  .chat-search-input, 
  .contacts-search-input, 
  .live-search {
    font-size: 16px !important;
  }
}
/* =========================================================
   استایل اختصاصی و ریسپانسیو بخش تاریخ تولد پروفایل
   ========================================================= */
.birth-date-val {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* برای گوشی‌های خیلی کوچک که متن روی هم نیفتد */
  gap: 10px;
  direction: rtl; /* هماهنگ با کل سایت */
  width: 100%;
}

.bd-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px; /* فاصله‌گذاری زیبا برای اعداد تاریخ */
}

.bd-age {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08); /* یک پس‌زمینه شیشه‌ای شیک */
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* هماهنگی با تم روشن (Light Mode) */
body.light-theme .bd-age {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.05);
}

.room-profile-edit-btn{
  position:absolute;
  top:max(16px, env(safe-area-inset-top, 0px));
  right:max(16px, env(safe-area-inset-right, 0px));
  left:auto;
  width:42px;
  height:42px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.04);
  color:var(--text);
  display:none;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow:0 8px 24px rgba(0,0,0,0.16);
  z-index:3;
}
.room-profile-edit-btn:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.16);
}
.room-profile-edit-btn svg{
  width:18px;
  height:18px;
}
.room-editor-panel{
  display:none;
  flex-direction:column;
  gap:14px;
  margin-top:8px;
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  max-height:min(70vh, 680px);
  overflow:hidden;
}
.room-editor-panel.is-open{display:flex;}
.room-editor-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.room-editor-head-main{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
  flex:1;
}
.room-editor-title{
  font-size:14px;
  font-weight:800;
}
.room-editor-subtitle{
  font-size:12px;
  color:var(--text-muted);
}
.room-editor-section{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.room-editor-section-manage{
  min-height:0;
  flex:1 1 auto;
}
.room-editor-section-title{
  font-size:13px;
  font-weight:800;
  color:var(--text);
}
.room-editor-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
.room-editor-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.room-editor-field label,
.room-editor-field span{
  font-size:12px;
  color:var(--text-muted);
}
.room-editor-input,
.room-editor-textarea,
.room-manage-search,
.room-manage-role{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.05);
  color:var(--text);
  padding:10px 12px;
  outline:none;
}
.room-editor-textarea{
  min-height:82px;
  resize:vertical;
}
.room-manage-summary{
  font-size:12px;
  font-weight:700;
  color:var(--text);
  opacity:.9;
}
.room-manage-hint{
  font-size:12px;
  color:var(--text-muted);
  line-height:1.8;
}
.room-edit-legend{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}
.room-edit-chip{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  font-size:12px;
}
.room-edit-chip b{font-size:12px;color:var(--text);}
.room-edit-chip span{color:var(--text-muted);text-align:left;direction:rtl;}
.room-edit-chip-admin{border-color:rgba(59,130,246,0.22);}
.room-edit-chip-member{border-color:rgba(16,185,129,0.18);}
.room-edit-chip-remove{border-color:rgba(239,68,68,0.18);}
.room-manage-toolbar{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.room-manage-label{
  font-size:12px;
  font-weight:700;
  color:var(--text-muted);
}
.room-manage-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:220px;
  flex:1 1 auto;
  overflow:auto;
  padding-inline-end:4px;
}
.room-manage-list::-webkit-scrollbar{width:6px;}
.room-manage-list::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.14);border-radius:999px;}
.room-manage-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.025);
}
.room-manage-row[hidden]{display:none !important;}
.room-manage-meta{
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.room-manage-name{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  font-weight:700;
}
.room-manage-handle{
  direction:ltr;
  text-align:left;
  font-size:11px;
  color:var(--text-muted);
}
.room-manage-actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:8px;
}
.room-manage-check{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--text-muted);
}
.room-editor-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
  position:sticky;
  bottom:0;
  padding-top:10px;
  background:linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,0.92) 40%);
}
.room-editor-actions .profile-action-btn{
  min-width:132px;
}
.room-editor-panel [data-room-editor-close]:not(.room-editor-actions [data-room-editor-close]){
  display:none !important;
}
.group-member-role{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:46px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  background:rgba(59,130,246,0.16);
  color:#93c5fd;
}
.group-member-role.member{
  background:rgba(148,163,184,0.12);
  color:var(--text-muted);
}
@media (max-width: 640px){
  .full-modal{align-items:flex-start; overflow-y:auto;}
  .group-profile-modal{width:min(94vw, 430px); max-height:calc(100dvh - 18px); margin:auto;}
  .room-profile-edit-btn{top:max(16px, env(safe-area-inset-top, 0px)); right:max(16px, env(safe-area-inset-right, 0px));}
  .room-editor-panel{max-height:none; overflow:visible;}
  .room-manage-list{max-height:42vh;}
  .room-editor-actions{position:sticky; bottom:-2px;}
}

body.light-theme .room-profile-edit-btn,
body.light-theme .room-editor-panel,
body.light-theme .room-manage-row,
body.light-theme .room-editor-input,
body.light-theme .room-editor-textarea,
body.light-theme .room-manage-search,
body.light-theme .room-manage-role{
  border-color:rgba(15,23,42,0.1);
  background:rgba(15,23,42,0.03);
}
body.light-theme .room-profile-edit-btn:hover{
  background:rgba(15,23,42,0.06);
  border-color:rgba(15,23,42,0.15);
}

body.light-theme .forward-embed,
body.light-theme .forward-source-card{background:rgba(13,110,253,0.04);border-color:rgba(13,110,253,0.1)}
body.light-theme .forward-search-input{background:rgba(255,255,255,0.96);border:1px solid rgba(13,110,253,0.12)}
body.light-theme .forward-item{background:rgba(255,255,255,0.9);border-color:rgba(15,23,42,0.04)}
body.light-theme .forward-item:hover{background:rgba(248,250,252,0.96)}
body.light-theme .forward-item.selected{background:rgba(13,110,253,0.08);border-color:rgba(13,110,253,0.22)}
body.light-theme .forward-item-avatar{background:rgba(13,110,253,0.08)}
body.light-theme .modal.forward-modal-active .modal-card{background:var(--bg)}
body.light-theme .modal.forward-modal-active .modal-header,
body.light-theme .forward-picker-footer{background:rgba(255,255,255,0.84);border-color:rgba(15,23,42,0.08)}

body.light-theme .login-secondary-btn { background: rgba(15,23,42,0.04); color: #334155; border-color: rgba(15,23,42,0.08); }
body.light-theme .login-secondary-btn:hover { background: rgba(15,23,42,0.08); }
body.light-theme .menu-inline-badge { box-shadow: 0 4px 12px rgba(239,68,68,.22); }


body.light-theme .message-selection-bar{
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(248,250,252,0.92) 100%);
  border-bottom: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 12px 28px rgba(15,23,42,0.08);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
body.light-theme .message-selection-label{
  color: #0f9d58;
}
body.light-theme .message-selection-count{
  color: #0f172a;
}
body.light-theme .message-selection-close{
  background: rgba(15,23,42,0.04);
  color: #0f172a;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 6px 16px rgba(15,23,42,0.06);
}
body.light-theme .message-selection-close:hover,
body.light-theme .message-selection-close:active{
  background: rgba(15,23,42,0.08);
}
body.light-theme .message-selection-select-all{
  background: rgba(79,174,99,0.10);
  color: #166534;
  border: 1px solid rgba(79,174,99,0.18);
  box-shadow: 0 8px 18px rgba(79,174,99,0.08);
}
body.light-theme .message-selection-actions{
  background: linear-gradient(180deg, rgba(255,255,255,0.68) 0%, rgba(248,250,252,0.82) 100%);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 20px 44px rgba(15,23,42,0.14);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}
body.light-theme .message-selection-action{
  background: rgba(255,255,255,0.72);
  color: #0f172a;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 8px 20px rgba(15,23,42,0.06);
}
body.light-theme .message-selection-action:hover,
body.light-theme .message-selection-action:active{
  background: rgba(255,255,255,0.92);
}
body.light-theme #multiForwardBtn{
  background: linear-gradient(180deg, rgba(59,130,246,0.14) 0%, rgba(59,130,246,0.10) 100%);
  border-color: rgba(59,130,246,0.18);
  color: #1d4ed8;
}
body.light-theme #multiCopyBtn{
  background: linear-gradient(180deg, rgba(15,23,42,0.06) 0%, rgba(15,23,42,0.045) 100%);
  border-color: rgba(15,23,42,0.10);
  color: #0f172a;
}
body.light-theme #multiDeleteBtn,
body.light-theme .message-selection-action.danger{
  background: linear-gradient(180deg, rgba(239,68,68,0.18) 0%, rgba(239,68,68,0.12) 100%);
  border-color: rgba(239,68,68,0.16);
  color: #b42318;
}

/* =========================================================
   Forward fullscreen overlay refresh
   ========================================================= */
body.forward-open{
  overflow:hidden;
}

.forward-screen{
  position:fixed;
  inset:0;
  z-index:30050;
  display:none;
  direction:rtl;
  background:linear-gradient(180deg, rgba(4,16,30,0.98), rgba(7,24,43,0.98) 42%, rgba(7,20,37,0.99) 100%);
}
.forward-screen::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(420px 260px at 92% 8%, rgba(34,211,238,0.12), transparent 70%),
    radial-gradient(360px 220px at 8% 0%, rgba(59,130,246,0.10), transparent 72%),
    radial-gradient(460px 260px at 50% 100%, rgba(139,92,246,0.10), transparent 76%);
}
.forward-screen-shell{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  height:100%;
  width:100%;
}
.forward-screen-header,
.forward-screen-footer,
.forward-source-wrap,
.forward-search-wrap{
  backdrop-filter:blur(20px) saturate(135%);
  -webkit-backdrop-filter:blur(20px) saturate(135%);
}
.forward-screen-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:calc(env(safe-area-inset-top, 0px) + 14px) 16px 14px;
  background:rgba(7,18,37,0.58);
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.forward-screen-title-wrap{
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
}
.forward-screen-kicker{
  font-size:11px;
  font-weight:800;
  color:var(--text-muted);
}
.forward-screen-title{
  margin:0;
  color:var(--text);
  font-size:clamp(21px, 5.4vw, 32px);
  font-weight:900;
  letter-spacing:-0.5px;
}
.forward-screen-close{
  flex-shrink:0;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.10);
}
.forward-screen-body{
  min-height:0;
  overflow:auto;
  padding:12px 12px 120px;
  display:flex;
  flex-direction:column;
  gap:12px;
  scrollbar-width:thin;
}
.forward-source-wrap,
.forward-search-wrap{
  border:1px solid rgba(255,255,255,0.10);
  border-radius:24px;
  background:rgba(10,22,39,0.44);
  box-shadow:0 12px 32px rgba(0,0,0,0.16);
}
.forward-source-wrap{
  padding:12px 14px;
}
.forward-source-wrap .forward-source-card{
  padding:0;
  margin:0;
  border:none;
  background:transparent;
}
.forward-source-wrap .forward-source-label{
  font-size:12px;
  font-weight:800;
}
.forward-source-wrap .forward-source-body,
.forward-source-wrap .forward-source-item{
  line-height:1.7;
}
.forward-source-wrap .forward-source-item{
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.06);
  background:rgba(255,255,255,0.04);
}
.forward-search-wrap{
  position:sticky;
  top:0;
  z-index:4;
  padding:10px 14px;
}
.forward-search-input-screen{
  width:100%;
  background:transparent;
  border:none;
  outline:none;
  padding:4px 0;
  font-size:16px;
  color:var(--text);
}
.forward-search-input-screen::placeholder{
  color:var(--text-muted);
}
.forward-targets-list{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:0;
}
.forward-section{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.forward-section-title{
  padding:2px 6px;
  font-size:12px;
  font-weight:900;
  color:var(--text-muted);
}
.forward-section-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.forward-target-row{
  width:100%;
  border:none;
  display:flex;
  align-items:center;
  gap:12px;
  padding:13px 14px;
  border-radius:24px;
  text-align:right;
  cursor:pointer;
  color:var(--text);
  background:rgba(255,255,255,0.055);
  border:1px solid rgba(255,255,255,0.08);
  box-shadow:0 12px 28px rgba(0,0,0,0.14);
  transition:transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.forward-target-row:active{
  transform:scale(0.985);
}
.forward-target-row.selected{
  background:linear-gradient(180deg, rgba(8,48,83,0.78), rgba(11,67,103,0.62));
  border-color:rgba(56,189,248,0.45);
  box-shadow:0 14px 32px rgba(14,165,233,0.16);
}
.forward-target-avatar{
  width:54px;
  height:54px;
  border-radius:50%;
  flex:0 0 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:rgba(255,255,255,0.08);
  color:var(--text);
  font-weight:900;
}
.forward-target-avatar .avatar-media{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.04);
}
.forward-target-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.forward-target-copy{
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.forward-target-top,
.forward-target-bottom{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-width:0;
}
.forward-target-name{
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:16px;
  font-weight:800;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.forward-target-meta{
  font-size:11px;
  color:var(--text-muted);
  white-space:nowrap;
  flex-shrink:0;
}
.forward-target-sub{
  flex:1;
  min-width:0;
  font-size:13px;
  color:var(--text-muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.forward-target-chip{
  flex-shrink:0;
  border-radius:999px;
  padding:4px 10px;
  font-size:11px;
  font-weight:900;
  color:var(--text);
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.08);
}
.forward-target-check{
  width:24px;
  height:24px;
  flex:0 0 24px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:transparent;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.18);
}
.forward-target-row.selected .forward-target-check{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(180deg, rgba(25,214,255,0.98), rgba(0,153,255,0.88));
  box-shadow:0 8px 18px rgba(14,165,233,0.24);
}
.forward-empty{
  padding:20px 16px;
  border-radius:22px;
  text-align:center;
  color:var(--text-muted);
  font-size:14px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.04);
}
.forward-screen-footer{
  position:sticky;
  bottom:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background:rgba(7,18,37,0.58);
  border-top:1px solid rgba(255,255,255,0.08);
}
.forward-screen-footer-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.forward-footer-label{
  font-size:12px;
  font-weight:800;
  color:var(--text-muted);
}
.forward-screen-footer .forward-picker-count{
  font-size:14px;
  font-weight:800;
  color:var(--text);
}
.forward-send-fab{
  width:56px;
  height:56px;
  flex:0 0 56px;
  border:none;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--primary);
  box-shadow:0 12px 28px rgba(0,122,255,0.30);
  transition:transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}
.forward-send-fab:active:not(:disabled){
  transform:scale(0.94);
}
.forward-send-fab:disabled{
  opacity:0.48;
  box-shadow:none;
}
.forward-send-fab .ui-icon{
  filter:brightness(0) invert(1);
}
.forward-send-spinner{
  width:20px;
  height:20px;
  border-radius:50%;
  border:2.5px solid rgba(255,255,255,0.34);
  border-top-color:#fff;
  animation:forwardSendSpin 0.8s linear infinite;
}
@keyframes forwardSendSpin{
  to{ transform:rotate(360deg); }
}

body.light-theme .forward-screen{
  background:linear-gradient(180deg, rgba(245,250,255,0.98), rgba(235,244,252,0.98) 52%, rgba(240,246,251,0.99) 100%);
}
body.light-theme .forward-screen::before{
  background:
    radial-gradient(400px 240px at 92% 6%, rgba(59,130,246,0.10), transparent 72%),
    radial-gradient(360px 220px at 8% 0%, rgba(56,189,248,0.10), transparent 72%),
    radial-gradient(420px 250px at 50% 100%, rgba(14,165,233,0.08), transparent 76%);
}
body.light-theme .forward-screen-header,
body.light-theme .forward-screen-footer,
body.light-theme .forward-source-wrap,
body.light-theme .forward-search-wrap{
  background:rgba(255,255,255,0.74);
  border-color:rgba(15,23,42,0.08);
  box-shadow:0 12px 28px rgba(15,23,42,0.05);
}
body.light-theme .forward-screen-close{
  background:rgba(148,163,184,0.12);
  border-color:rgba(15,23,42,0.08);
}
body.light-theme .forward-target-row{
  background:rgba(255,255,255,0.88);
  border-color:rgba(15,23,42,0.08);
  box-shadow:0 10px 24px rgba(15,23,42,0.05);
}
body.light-theme .forward-target-row.selected{
  background:linear-gradient(180deg, rgba(255,255,255,0.98), rgba(231,244,255,0.98));
  border-color:rgba(14,165,233,0.34);
  box-shadow:0 12px 28px rgba(14,165,233,0.10);
}
body.light-theme .forward-target-avatar{
  background:rgba(148,163,184,0.12);
}
body.light-theme .forward-target-avatar .avatar-media{
  border-color:rgba(15,23,42,0.08);
  background:rgba(255,255,255,0.92);
}
body.light-theme .forward-target-chip{
  color:#0f172a;
  border-color:rgba(13,110,253,0.10);
  background:rgba(13,110,253,0.08);
}
body.light-theme .forward-target-check{
  background:rgba(255,255,255,0.82);
  border-color:rgba(15,23,42,0.12);
}
body.light-theme .forward-source-wrap .forward-source-item,
body.light-theme .forward-empty{
  background:rgba(255,255,255,0.86);
  border-color:rgba(15,23,42,0.08);
}
body.light-theme .forward-search-input-screen,
body.light-theme .forward-screen-title,
body.light-theme .forward-screen-footer .forward-picker-count,
body.light-theme .forward-target-name{
  color:var(--text);
}


/* =========================================================
   Forward screen: match main app matte theme
   ========================================================= */
.forward-screen{
  background: var(--bg-deep);
}
.forward-screen::before{
  display:none;
}
.forward-screen-header,
.forward-screen-footer,
.forward-source-wrap,
.forward-search-wrap{
  background: rgba(42, 71, 89, 0.96);
  border-color: rgba(255,255,255,0.08);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.forward-screen-header{
  background: rgba(28, 51, 65, 0.98);
}
.forward-screen-footer{
  background: rgba(28, 51, 65, 0.98);
}
.forward-search-wrap{
  border-radius: 20px;
}
.forward-search-input-screen{
  font-size: 15px;
}
.forward-source-wrap .forward-source-item,
.forward-empty{
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
  box-shadow: none;
}
.forward-target-row{
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.05);
  box-shadow: none;
  border-radius: 20px;
}
.forward-target-row:hover,
.forward-target-row:active{
  background: rgba(255,255,255,0.035);
}
.forward-target-row.selected{
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: none;
}
.forward-target-avatar{
  background: rgba(255,255,255,0.04);
}
.forward-target-avatar .avatar-media{
  background: var(--bg-elevated);
  border-color: rgba(255,255,255,0.08);
}
.forward-target-chip{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.06);
}
.forward-target-check{
  background: rgba(255,255,255,0.02);
}
.forward-send-fab{
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.24);
}

body.light-theme .forward-screen{
  background: var(--bg);
}
body.light-theme .forward-screen::before{
  display:none;
}
body.light-theme .forward-screen-header,
body.light-theme .forward-screen-footer,
body.light-theme .forward-source-wrap,
body.light-theme .forward-search-wrap{
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.08);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.light-theme .forward-target-row{
  background: rgba(255,255,255,0.98);
  border-color: rgba(15,23,42,0.06);
  box-shadow: none;
}
body.light-theme .forward-target-row:hover,
body.light-theme .forward-target-row:active{
  background: rgba(248,250,252,0.98);
}
body.light-theme .forward-target-row.selected{
  background: rgba(13,110,253,0.08);
  border-color: rgba(13,110,253,0.18);
  box-shadow: none;
}
body.light-theme .forward-target-avatar{
  background: rgba(15,23,42,0.04);
}
body.light-theme .forward-target-avatar .avatar-media{
  background: #fff;
  border-color: rgba(15,23,42,0.08);
}
body.light-theme .forward-source-wrap .forward-source-item,
body.light-theme .forward-empty{
  background: rgba(248,250,252,0.92);
  border-color: rgba(15,23,42,0.08);
}

@media (max-width: 640px){
  .forward-screen-header{
    padding:calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px;
  }
  .forward-screen-body{
    padding:10px 10px 116px;
  }
  .forward-source-wrap,
  .forward-search-wrap,
  .forward-target-row,
  .forward-empty{
    border-radius:20px;
  }
  .forward-target-row{
    padding:12px;
  }
  .forward-target-avatar{
    width:50px;
    height:50px;
    flex-basis:50px;
  }
  .forward-screen-footer{
    padding:10px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  }
}

/* Saved hub page */
.saved-page {
  padding: 18px 0 108px;
}
.saved-hub {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 14px;
}
.saved-self-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  border-radius: 26px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: right;
  box-shadow: 0 16px 38px rgba(3,8,20,0.16);
}
.saved-self-card:active { transform: scale(0.995); }
.saved-self-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.saved-self-avatar .avatar-media,
.saved-feed-avatar .avatar-media {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.saved-self-star-media {
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.1) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}
.saved-star-svg {
  width: 58%;
  height: 58%;
  display: block;
  fill: #ffffff;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.16));
}
.saved-self-star {
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.saved-feed-star {
  font-size: 22px;
}
.saved-self-content,
.saved-feed-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.saved-self-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.5;
}
.saved-self-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-feed-head {
  padding: 2px 4px 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}
.saved-feed-list {
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
}
.saved-feed-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: var(--text);
  text-align: right;
  cursor: pointer;
}
.saved-feed-item:last-child { border-bottom: 0; }
.saved-feed-item:active { background: rgba(255,255,255,0.035); }
.saved-feed-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.saved-feed-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.saved-feed-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-feed-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.saved-feed-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-feed-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-feed-empty {
  margin: 0;
}

body.light-theme .saved-self-card {
  background: rgba(255,255,255,0.86);
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 16px 34px rgba(15,23,42,0.10);
}
body.light-theme .saved-feed-list {
  background: rgba(255,255,255,0.78);
  border-color: rgba(15,23,42,0.08);
}
body.light-theme .saved-feed-item {
  border-bottom-color: rgba(15,23,42,0.08);
}
body.light-theme .saved-self-avatar .avatar-media,
body.light-theme .saved-feed-avatar .avatar-media {
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.08);
}
body.light-theme .saved-self-star-media,
body.light-theme .saved-feed-avatar .saved-self-star-media {
  background: #edf2f7 !important;
  border-color: rgba(15,23,42,0.08) !important;
  box-shadow: none !important;
}
body.light-theme .saved-self-star,
body.light-theme .saved-feed-star,
body.light-theme .saved-star-svg {
  color: #0f172a !important;
  fill: #0f172a !important;
  text-shadow: none !important;
  filter: none !important;
}

@media (min-width: 900px) {
  .saved-page {
    padding-top: 24px;
  }
  .saved-hub {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 18px;
  }
}
