@font-face {
    font-family: 'IRANYekanXFaNum';
    src: url('/assets/fonts/IRANYekanXFaNum-Regular.woff2') format('woff2'),
         url('/assets/fonts/IRANYekanXFaNum-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANYekanXFaNum';
    src: url('/assets/fonts/IRANYekanXFaNum-Bold.woff2') format('woff2'),
         url('/assets/fonts/IRANYekanXFaNum-Bold.woff') format('woff');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-sans: 'IRANYekanXFaNum', Tahoma, Arial, system-ui, sans-serif;
    --bg-main: #0F0F11;
    --bg-secondary: #1A1A1E;
    --bg-sidebar: #151518;
    --bg-input: #1F1F23;
    --border-color: #2D2D33;
    --text-main: #E0E0E0;
    --text-muted: #888888;
    --accent: #3B82F6;
}

* { box-sizing: border-box; }
html, body, button, input, textarea, select { font-family: var(--font-sans) !important; }
body { background-color: var(--bg-main); color: var(--text-main); }
img { max-width: 100%; }
button { cursor: pointer; }

.rtl-flip { transform: scaleX(-1); }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

@keyframes messageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-message { animation: messageIn 0.3s ease-out forwards; }

.chat-pattern {
    background-image:
      radial-gradient(circle at 15% 25%, rgba(59,130,246,.08), transparent 22%),
      radial-gradient(circle at 85% 15%, rgba(99,102,241,.06), transparent 24%),
      linear-gradient(135deg, rgba(255,255,255,.025) 25%, transparent 25%),
      linear-gradient(225deg, rgba(255,255,255,.018) 25%, transparent 25%);
    background-size: 420px 420px, 520px 520px, 28px 28px, 28px 28px;
    background-repeat: repeat;
    opacity: 0.75;
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.dark-card { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 1.5rem; }
.dark-input { background-color: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-main); }
.dark-button-primary { background: linear-gradient(to top right, #3B82F6, #60A5FA); color: white; box-shadow: 0 10px 15px -3px rgba(30, 58, 138, 0.4); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(8px); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 780px; max-height: 92vh; overflow: auto; background: #1A1A1E; border: 1px solid #2D2D33; border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.hidden { display: none !important; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.media-tile { min-height: 96px; border: 1px solid #2D2D33; border-radius: 16px; overflow: hidden; background: #0F0F11; display: flex; align-items: center; justify-content: center; color: #94a3b8; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; }
.search-bar-chat { position: absolute; left: 18px; right: 18px; top: 78px; z-index: 45; background: #151518; border: 1px solid #2D2D33; border-radius: 18px; padding: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.search-result-chip { padding: 10px 12px; border-radius: 14px; border: 1px solid #2D2D33; background: rgba(255,255,255,.03); margin-top: 8px; font-size: 12px; }
.install-btn { position: fixed; left: 18px; bottom: 18px; z-index: 70; background: #2563eb; color: white; border: 1px solid rgba(255,255,255,.15); padding: 10px 14px; border-radius: 16px; box-shadow: 0 12px 36px rgba(37,99,235,.35); font-weight: 700; font-size: 12px; }
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.admin-table th { color: #94a3b8; font-size: 11px; text-align: right; padding: 8px; }
.admin-table td { background: #151518; border-top: 1px solid #2D2D33; border-bottom: 1px solid #2D2D33; padding: 10px 8px; font-size: 12px; }
.admin-table td:first-child { border-right: 1px solid #2D2D33; border-radius: 0 12px 12px 0; }
.admin-table td:last-child { border-left: 1px solid #2D2D33; border-radius: 12px 0 0 12px; }

@media (max-width: 768px) {
    .modal-card { max-height: 96vh; border-radius: 18px; }
    .install-btn { left: 12px; bottom: 12px; }
}

#message-input, input, textarea, select, button { touch-action: manipulation; }
@media (max-width: 768px) {
  input, textarea, select, button { font-size: 16px !important; }
}
.message-highlight { animation: msgPulse 2s ease; }
@keyframes msgPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(59,130,246,0); }
  15% { transform: scale(1.01); box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(59,130,246,0); }
}
.message-menu-list button {
  width: 100%; display:flex; align-items:center; gap:.9rem; padding:1rem 1.1rem;
  border-bottom:1px solid rgba(255,255,255,.06); color:#e5e7eb; font-size:.92rem; text-align:right;
}
.message-menu-list button:last-child { border-bottom:none; }
.message-menu-list button:hover { background:rgba(255,255,255,.04); }
.tg-profile-card { background:linear-gradient(180deg,#203146 0%,#0f1b29 36%,#0b1520 100%); border-radius:28px; padding:1.5rem; position:relative; overflow:hidden; }
.tg-profile-close { position:absolute; left:1rem; top:1rem; color:#cbd5e1; }
.tg-profile-avatar { width:96px; height:96px; border-radius:9999px; margin:0 auto; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#334155; border:4px solid rgba(255,255,255,.08); font-size:2rem; font-weight:900; }
.tg-profile-name { text-align:center; font-size:1.35rem; font-weight:900; margin-top:1rem; color:#fff; }
.tg-profile-status { text-align:center; font-size:.85rem; color:#93c5fd; margin-top:.25rem; }
.tg-profile-actions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.75rem; margin-top:1.5rem; }
.tg-action-btn { background:rgba(15,23,42,.55); border:1px solid rgba(255,255,255,.08); border-radius:16px; padding:.8rem .4rem; display:flex; flex-direction:column; align-items:center; gap:.45rem; font-size:.8rem; }
.tg-info-block, .tg-stats-block { background:rgba(7,13,20,.42); border-top:1px solid rgba(255,255,255,.07); border-bottom:1px solid rgba(255,255,255,.05); margin-top:1.3rem; }
.tg-info-row { padding:1rem .4rem; border-bottom:1px solid rgba(255,255,255,.05); }
.tg-info-row:last-child, .tg-stat-row:last-child { border-bottom:none; }
.tg-info-main { font-size:1rem; color:#fff; }
.tg-info-sub { font-size:.8rem; color:#94a3b8; margin-top:.25rem; }
.tg-stat-row { display:flex; align-items:center; gap:1rem; padding:1rem .3rem; border-bottom:1px solid rgba(255,255,255,.05); color:#f1f5f9; }
.tg-stat-row i { color:#cbd5e1; }
.admin-table td, .admin-table th { white-space: nowrap; }
.reply-quote {
  display:block; width:100%; text-align:right; border-right:3px solid rgba(96,165,250,.85);
  background:rgba(15,23,42,.28); border-radius:12px; padding:.45rem .65rem; margin-bottom:.55rem;
}
.reply-quote strong { display:block; color:#93c5fd; font-size:.72rem; margin-bottom:.15rem; }
.reply-quote span { display:block; color:#cbd5e1; font-size:.72rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Telegram-like composer and compact message UI */
#chat-footer { padding: 12px 14px !important; background: #0b0b0d !important; border-top: 1px solid rgba(255,255,255,.07) !important; }
.composer-shell { display:flex; align-items:flex-end; gap:10px; width:100%; direction:ltr; }
.composer-circle, .composer-send { width:54px; height:54px; min-width:54px; border-radius:9999px; display:flex; align-items:center; justify-content:center; font-size:28px; line-height:1; border:1px solid rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 6px 18px rgba(0,0,0,.28); transition: transform .12s ease, background .12s ease; }
.composer-circle { background:#17181a; color:#fff; }
.composer-circle:hover { background:#222326; }
.composer-circle:active, .composer-send:active { transform:scale(.94); }
.composer-input-wrap { flex:1; min-height:54px; border-radius:9999px; background:#1b1717; border:1px solid rgba(255,255,255,.16); display:flex; align-items:center; padding:0 18px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.03); direction:rtl; }
.composer-input { width:100%; min-height:28px; max-height:118px; resize:none; border:0; outline:0; background:transparent; color:#fff; font-size:21px !important; line-height:1.35; padding:9px 0; direction:rtl; }
.composer-input::placeholder { color:#8c8c92; opacity:1; direction:ltr; text-align:left; }
.composer-send { background:#3b82f6; color:white; border-color:rgba(255,255,255,.16); box-shadow:0 10px 24px rgba(59,130,246,.34); }
.composer-send:not(.composer-send-active) { display:none; }
.composer-voice { font-size:25px; }
@media (max-width: 768px) {
  #chat-footer { padding: 10px 10px !important; }
  .composer-shell { gap:8px; }
  .composer-circle, .composer-send { width:48px; height:48px; min-width:48px; font-size:25px; }
  .composer-input-wrap { min-height:48px; padding:0 14px; }
  .composer-input { font-size:18px !important; padding:7px 0; }
}
.message-row { margin-top: 6px !important; margin-bottom: 6px !important; }
.message-wrap { max-width: 58%; }
.message-bubble { padding: 8px 11px 6px; border-radius:16px; box-shadow:0 7px 18px rgba(0,0,0,.20); font-size:12.5px; line-height:1.55; user-select:none; -webkit-user-select:none; }
.message-me { background:rgba(37,99,235,.92); color:#fff; border:1px solid rgba(255,255,255,.10); border-bottom-right-radius:5px; }
.message-other { background:#17191d; color:#e5e7eb; border:1px solid rgba(255,255,255,.08); border-bottom-left-radius:5px; }
.message-text { font-size:12.5px; line-height:1.55; }
.message-meta { display:flex; align-items:center; justify-content:flex-end; gap:4px; margin-top:4px; opacity:.58; font-size:9px; font-family:monospace; }
.seen-mark { font-size:10px; letter-spacing:-2px; margin-right:2px; opacity:.75; }
.seen-mark.seen { color:#93c5fd; opacity:1; }
.file-message { display:flex; align-items:center; gap:10px; padding:8px; border-radius:12px; background:rgba(0,0,0,.18); border:1px solid rgba(255,255,255,.06); cursor:pointer; }
.pinned-message-bar { background:rgba(14,23,38,.96); border:1px solid rgba(59,130,246,.30); border-radius:16px; padding:8px 12px; display:flex; align-items:center; gap:10px; box-shadow:0 10px 28px rgba(0,0,0,.30); }
@media (max-width: 768px) { .message-wrap { max-width: 80%; } .message-bubble { font-size:12px; padding:7px 10px 5px; } .message-text { font-size:12px; } }

/* Context menu: fixed, dark, compact, readable */
.message-menu-overlay { position:fixed; inset:0; z-index:300; background:transparent; padding:0; }
.message-menu-card { position:fixed; width:224px; background:#121d2b; color:#f8fafc; border:1px solid rgba(148,163,184,.22); border-radius:14px; box-shadow:0 20px 55px rgba(0,0,0,.58); overflow:hidden; }
.message-menu-list button { width:100%; height:42px; display:flex; align-items:center; gap:12px; padding:0 14px; border-bottom:1px solid rgba(148,163,184,.12); color:#f8fafc !important; background:#121d2b !important; font-size:13px; font-weight:600; text-align:left; direction:ltr; }
.message-menu-list button:last-child { border-bottom:none; }
.message-menu-list button:hover { background:#1d2a3d !important; }

/* Real SVG icon helpers */
.ui-icon, .ui-icon-small, .composer-icon, .menu-icon { display:inline-block; object-fit:contain; filter: invert(1); opacity:.94; }
.ui-icon { width:22px; height:22px; }
.ui-icon-small { width:18px; height:18px; }
.composer-icon { width:30px; height:30px; }
.composer-send-icon { transform: rotate(-18deg); }
.menu-icon { width:21px; height:21px; min-width:21px; opacity:.92; }
.file-icon { width:36px; height:36px; min-width:36px; display:flex; align-items:center; justify-content:center; border-radius:10px; background:rgba(59,130,246,.16); }
.message-checkbox { width:28px; height:28px; min-width:28px; border-radius:8px; display:flex; align-items:center; justify-content:center; background:rgba(15,23,42,.9); border:1px solid rgba(148,163,184,.26); align-self:center; }
.message-checkbox.checked { border-color:rgba(96,165,250,.8); background:rgba(37,99,235,.25); }
.message-select-box { display:flex; align-items:center; justify-content:center; }
.message-menu-list button { gap:13px; color:#fff !important; }
.message-menu-list button span { color:#fff !important; }

/* Latest UX fixes */
.ui-icon-tiny { width: 14px; height: 14px; display:inline-block; object-fit:contain; filter: invert(1); opacity:.88; }
.seen-mark { display:inline-flex; align-items:center; margin-right:2px; opacity:.72; }
.seen-mark.seen { opacity:1; filter: drop-shadow(0 0 3px rgba(96,165,250,.45)); }
.seen-mark.seen .ui-icon-tiny { filter: invert(63%) sepia(79%) saturate(1483%) hue-rotate(186deg) brightness(104%) contrast(101%); }
.composer-input { max-height:66px !important; font-size:13px !important; line-height:1.55 !important; overflow-y:hidden; scrollbar-width:thin; }
.composer-input::-webkit-scrollbar { width:4px; }
.composer-input::-webkit-scrollbar-thumb { background:#4b5563; border-radius:999px; }
@media (max-width: 768px) { .composer-input { font-size:13px !important; max-height:66px !important; } }
.jump-new-btn { position:absolute; left:18px; bottom:104px; z-index:55; width:58px; height:58px; border-radius:9999px; background:#191919; border:1px solid rgba(255,255,255,.14); display:flex; align-items:center; justify-content:center; box-shadow:0 12px 36px rgba(0,0,0,.45); }
.jump-new-count { position:absolute; top:-14px; right:-3px; min-width:38px; height:30px; padding:0 9px; display:flex; align-items:center; justify-content:center; border-radius:9999px; background:#3b82f6; color:#fff; font-size:18px; font-weight:500; border:1px solid rgba(255,255,255,.22); }
.jump-new-icon { width:36px; height:36px; filter:invert(1); }
.avatar-history-thumb { width:54px; height:54px; min-width:54px; border-radius:16px; overflow:hidden; border:1px solid rgba(148,163,184,.25); background:#111827; display:flex; align-items:center; justify-content:center; }
.avatar-history-thumb img { width:100%; height:100%; object-fit:cover; }
.tg-avatar-history { margin-top:1.2rem; padding:1rem .4rem; background:rgba(7,13,20,.32); border-top:1px solid rgba(255,255,255,.06); border-bottom:1px solid rgba(255,255,255,.04); }
.message-checkbox { margin:0 4px; }
.message-menu-list button { justify-content:flex-start; }
.message-bubble img + .message-meta, .message-bubble video + .message-meta { margin-top:4px; }

/* Minimal Telegram-like chat header */
.chat-user-head { display:flex; align-items:center; gap:.75rem; min-width:0; max-width:70%; background:transparent !important; border:none !important; box-shadow:none !important; padding:0 !important; }
.chat-header-avatar { width:44px; height:44px; min-width:44px; min-height:44px; border-radius:9999px !important; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#2D2D33; color:#93c5fd; font-weight:800; border:none !important; box-shadow:none !important; }
.chat-header-name { font-size:.92rem; font-weight:800; color:#fff; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:52vw; }
.chat-header-status { margin-top:.15rem; font-size:.72rem; line-height:1.2; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:52vw; }
.online-status { color:#22c55e; }
.offline-status, .group-status { color:#94a3b8; }
.typing-status { color:#60a5fa; }
.chat-header-actions { display:flex; align-items:center; gap:.25rem; }
.chat-icon-btn { width:38px; height:38px; display:flex; align-items:center; justify-content:center; background:transparent !important; border:none !important; box-shadow:none !important; border-radius:9999px; opacity:.75; transition:opacity .15s, background-color .15s; }
.chat-icon-btn:hover { opacity:1; background:rgba(255,255,255,.06) !important; }
.chat-icon-btn img { width:21px; height:21px; filter:none; }
#status-dot { display:none !important; }
.tg-profile-card { background:#111923; border-radius:24px; padding:1.25rem; }
.tg-profile-actions, .tg-info-block, .tg-stats-block { display:none !important; }

/* Requested mobile/layout fixes */
html, body { height: 100%; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
body { min-height: 100dvh; }
#chat-window, #sidebar { min-height: 0; }
#messages-container { min-height: 0; }
@media (max-width: 768px) {
  body { height: 100dvh !important; min-height: 100dvh !important; }
  #chat-window { height: 100dvh; max-height: 100dvh; }
  #chat-header { padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px !important; min-height: 58px; }
  #messages-container { padding: 12px 10px 8px !important; }
  #chat-footer { padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px) !important; flex-shrink: 0; }
  .composer-shell { gap: 7px; align-items: flex-end; }
  .composer-circle, .composer-send { width: 44px !important; height: 44px !important; min-width: 44px !important; }
  .composer-input-wrap { min-height: 44px !important; padding: 0 12px !important; }
  .composer-input { font-size: 12.5px !important; max-height: 62px !important; line-height: 1.45 !important; }
  #mobile-back { top: calc(env(safe-area-inset-top, 0px) + 10px) !important; }
}

/* Profile-photo history viewer navigation */
.image-viewer-modal { position: fixed; }
.image-viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 140;
  width: 48px; height: 48px; border-radius: 999px; display:flex; align-items:center; justify-content:center;
  background: rgba(15,23,42,.78); border: 1px solid rgba(255,255,255,.2); color:#fff;
  font-size: 30px; line-height: 1; box-shadow: 0 12px 32px rgba(0,0,0,.45);
}
.image-viewer-prev { left: 22px; }
.image-viewer-next { right: 22px; }
.image-viewer-counter {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index:140;
  padding: 6px 12px; border-radius: 999px; background: rgba(15,23,42,.78); color:#fff; border:1px solid rgba(255,255,255,.18); font-size:12px;
}
@media (max-width: 768px) {
  .image-viewer-nav { width: 42px; height: 42px; font-size: 26px; }
  .image-viewer-prev { left: 10px; }
  .image-viewer-next { right: 10px; }
}

/* Final mobile and visual refinements */
@media (max-width: 768px) {
  #mobile-back { right: auto !important; left: 12px !important; top: calc(env(safe-area-inset-top, 0px) + 12px) !important; background: rgba(15,15,17,.72) !important; border-color: rgba(255,255,255,.08) !important; }
  #chat-header { padding-top: calc(env(safe-area-inset-top, 0px) + 12px) !important; min-height: calc(env(safe-area-inset-top, 0px) + 62px) !important; }
  #chat-footer { position: relative; bottom: auto; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px) !important; }
  #messages-container { padding-bottom: 10px !important; }
  .jump-new-btn { bottom: calc(env(safe-area-inset-bottom, 0px) + 78px) !important; left: 16px !important; }
  .message-wrap { max-width: 78% !important; }
}
#image-viewer { padding: 10px !important; }
#image-viewer-img { max-width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px) !important; width: auto !important; height: auto !important; object-fit: contain !important; }
.conversation-item { border-radius: 14px; border: 1px solid transparent; background: transparent !important; opacity: 1 !important; color: #e5e7eb !important; }
.conversation-item:hover { background: rgba(255,255,255,.035) !important; }
.conversation-item.active { background: rgba(37,99,235,.10) !important; border-color: rgba(59,130,246,.22); box-shadow: none !important; }
.user-search-row { background: transparent !important; border: none !important; border-radius: 14px; color: #fff; }
.user-search-row:hover { background: rgba(255,255,255,.045) !important; }
#admin-panel-btn img, #sidebar button img, .chat-icon-btn img, .composer-circle img, .composer-send img { filter: invert(1) !important; opacity: .96; }
#sidebar button { color: #fff !important; }
#user-search { background: rgba(255,255,255,.035) !important; border-color: rgba(255,255,255,.08) !important; }
#sidebar .bg-\[\#1F1F23\] { background: transparent; }
.message-bubble { max-width: 100%; }
.message-bubble video, .message-bubble img { max-width: min(100%, 72vw); max-height: 56vh; object-fit: contain; }
/* Admin/user list cleanup */
.admin-table td { background: transparent !important; border-color: rgba(255,255,255,.06) !important; }
.admin-table tr:hover td { background: rgba(255,255,255,.035) !important; }
.admin-table button, .admin-table a { color:#fff !important; }

/* Final cleanup: inline mobile back button and no gray option boxes */
.chat-header-left { display:flex; align-items:center; gap:.55rem; min-width:0; flex:1; }
.mobile-back-inline {
  position: static !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  display: none;
  align-items:center;
  justify-content:center;
  padding:0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius:999px;
}
.mobile-back-inline img { width:22px; height:22px; filter:invert(1); opacity:.95; }
@media (max-width: 768px) {
  #mobile-back:not(.hidden) { display:flex !important; }
  #mobile-back { position: static !important; left:auto !important; right:auto !important; top:auto !important; background: transparent !important; border:none !important; box-shadow:none !important; }
  .chat-user-head { max-width: calc(100vw - 150px) !important; gap:.55rem !important; }
  .chat-header-avatar { width:40px !important; height:40px !important; min-width:40px !important; min-height:40px !important; }
  #chat-header { gap:.5rem; align-items:center; }
  .chat-header-actions { min-width:max-content; }
}

/* Remove gray boxes from selectable UI/options across the app */
#sidebar button,
#sidebar a,
.chat-icon-btn,
.mobile-back-inline,
.message-menu-list button,
#selection-bar button,
#chat-search-box button,
#search-results button,
#group-search-results button,
#info-user-results button,
.user-search-row,
.conversation-item,
.tg-action-btn,
.media-tile,
#profile-modal button,
#group-modal button,
#info-modal button:not(.media-tile),
#forward-banner button {
  background: transparent !important;
  box-shadow: none !important;
}
#sidebar button,
.chat-icon-btn,
.message-menu-list button,
#selection-bar button,
#chat-search-box button,
#search-results button,
#group-search-results button,
#info-user-results button {
  color:#fff !important;
}
#sidebar button:hover,
.chat-icon-btn:hover,
.message-menu-list button:hover,
#selection-bar button:hover,
#chat-search-box button:hover,
#search-results button:hover,
#group-search-results button:hover,
#info-user-results button:hover,
.conversation-item:hover,
.user-search-row:hover {
  background: transparent !important;
}
#sidebar .bg-\[\#2D2D33\],
#sidebar .bg-\[\#1F1F23\],
#search-results,
#group-search-results,
#info-user-results,
.search-result-chip,
#selection-bar .bg-\[\#2D2D33\] {
  background: transparent !important;
  box-shadow: none !important;
}
#search-results,
#group-search-results,
#info-user-results { border-color: transparent !important; }
#selection-bar { background: rgba(8,13,22,.92) !important; }

/* Prevent delete-refresh from looking like the chat jumped too far on mobile */
#messages-container { overflow-anchor: auto; }
.message-row { overflow-anchor: auto; }

/* Admin page must scroll independently from the app shell rules. */
html:has(body.admin-body), body.admin-body {
  height: auto !important;
  min-height: 100dvh !important;
  overflow: auto !important;
  overscroll-behavior: auto !important;
}
body.admin-body { display: block !important; }

/* Keep mobile composer visible when keyboard opens. */
@media (max-width: 768px) {
  #chat-window { height: 100svh; max-height: 100svh; }
  #chat-footer { flex-shrink: 0 !important; }
  .composer-shell { padding-bottom: 0 !important; }
}
html.admin-html, html.admin-html body {
  height: auto !important;
  min-height: 100dvh !important;
  overflow: auto !important;
}

/* iPhone keyboard / visual viewport fix */
:root { --app-height: 100dvh; --vv-offset-top: 0px; }
@supports (height: 100dvh) {
  html, body { height: var(--app-height) !important; min-height: var(--app-height) !important; }
}
body { position: fixed; inset: 0; width: 100%; overflow: hidden; }
#chat-window, #sidebar { height: var(--app-height) !important; max-height: var(--app-height) !important; }
@media (max-width: 768px) {
  #chat-window { display:flex; flex-direction:column; overflow:hidden; }
  #chat-header { flex: 0 0 auto; padding-top: max(12px, env(safe-area-inset-top, 0px)) !important; transform: translateZ(0); }
  #messages-container { flex:1 1 auto; min-height:0; overflow-y:auto; -webkit-overflow-scrolling: touch; }
  #chat-footer { flex:0 0 auto; position:relative !important; bottom:auto !important; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important; transform: translateZ(0); }
  .composer-shell { max-width:100% !important; }
  .composer-input-wrap { flex:1 1 auto; min-width:0; }
}

/* Telegram-like full profile panel */
.tg-profile-full .tg-profile-actions,
.tg-profile-full .tg-info-block,
.tg-profile-full .tg-stats-block { display:grid !important; }
.tg-profile-full .tg-profile-actions { grid-template-columns:repeat(3,minmax(0,1fr)); gap:.75rem; margin-top:1.25rem; }
.tg-profile-full .tg-action-btn { background:rgba(15,23,42,.62) !important; border:1px solid rgba(255,255,255,.06); border-radius:14px; padding:.85rem .5rem; color:#fff !important; display:flex; flex-direction:column; align-items:center; gap:.4rem; font-size:.78rem; }
.tg-profile-full .tg-info-block,
.tg-profile-full .tg-stats-block { display:block !important; margin-top:1rem; background:rgba(5,12,20,.38); border-top:1px solid rgba(255,255,255,.05); border-bottom:1px solid rgba(255,255,255,.05); }
.tg-profile-full .tg-stat-row { width:100%; background:transparent !important; color:#fff !important; border:0; border-bottom:1px solid rgba(255,255,255,.055); }
.media-filter-panel { margin-top:1rem; padding:1rem; border-radius:18px; background:rgba(5,12,20,.42); border:1px solid rgba(255,255,255,.07); }
.member-row-clean { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.7rem 0; border-bottom:1px solid rgba(255,255,255,.055); }
.member-avatar-clean { width:40px; height:40px; min-width:40px; border-radius:999px; overflow:hidden; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.06); }
.role-select-clean, .dark-input-clean { background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08); border-radius:12px; color:#fff; padding:.55rem .75rem; font-size:.78rem; }


/* Upload/music/iOS final fixes */
.upload-queue { margin-bottom: 8px; display:flex; flex-direction:column; gap:6px; }
.upload-item { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:14px; background:rgba(15,23,42,.82); border:1px solid rgba(148,163,184,.16); color:#e5e7eb; direction:ltr; }
.upload-spinner { width:22px; height:22px; min-width:22px; border-radius:999px; border:3px solid rgba(148,163,184,.35); border-top-color:#3b82f6; animation:uploadSpin .8s linear infinite; }
.upload-spinner.done { border-color:#22c55e; animation:none; }
.upload-info { min-width:0; flex:1; }
.upload-name { font-size:12px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; direction:ltr; text-align:left; }
.upload-ext { font-size:10px; opacity:.65; margin-top:2px; }
.upload-percent { width:42px; text-align:center; font-size:11px; color:#93c5fd; }
.upload-error { border-color:rgba(239,68,68,.45); }
@keyframes uploadSpin { to { transform: rotate(360deg); } }
.music-message { display:flex; align-items:center; gap:10px; min-width:230px; max-width:310px; padding:7px 8px; border-radius:14px; background:#132033; cursor:pointer; direction:ltr; }
.music-cover { width:42px; height:42px; min-width:42px; border-radius:999px; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#3296d7; position:relative; }
.music-cover::after { content:''; position:absolute; left:50%; bottom:-5px; width:18px; height:18px; transform:translateX(-50%); border-radius:999px; background:#3296d7; }
.music-cover-icon { width:22px; height:22px; filter:invert(1); opacity:.95; z-index:1; }
.music-info { min-width:0; flex:1; text-align:left; direction:ltr; }
.music-title { font-size:12.5px; font-weight:900; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.music-artist { font-size:11px; color:#9cc8f7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.music-meta-line { font-size:10px; color:#8aa0b6; margin-top:3px; }
.music-download { filter:invert(1); opacity:.85; }
/* Requested bubble tails: sent = sharp left, received = sharp right */
.message-me { border-bottom-left-radius:5px !important; border-bottom-right-radius:16px !important; }
.message-other { border-bottom-right-radius:5px !important; border-bottom-left-radius:16px !important; }
@media (max-width:768px){
  html.ios-keyboard-open, html.ios-keyboard-open body { position:fixed !important; inset:0 !important; width:100% !important; height:100% !important; overflow:hidden !important; }
  html.ios-keyboard-open #chat-window { position:fixed !important; inset:0 !important; height:var(--vvh, 100dvh) !important; max-height:var(--vvh, 100dvh) !important; transform:translateY(var(--vv-offset-top,0px)); }
  html.ios-keyboard-open #chat-header { flex-shrink:0 !important; }
  html.ios-keyboard-open #messages-container { flex:1 1 auto !important; min-height:0 !important; padding-bottom:8px !important; }
  html.ios-keyboard-open #chat-footer { flex-shrink:0 !important; position:relative !important; bottom:auto !important; transform:none !important; }
  .music-message { max-width:78vw; min-width:210px; }
}

/* Send preview modal for images/files before upload */
.send-preview-card {
  width: min(560px, calc(100vw - 24px));
  max-height: min(86dvh, 760px);
  display:flex; flex-direction:column;
  background:#f8fafc; color:#0f172a; border-radius:18px; overflow:hidden;
  box-shadow:0 28px 90px rgba(0,0,0,.42);
  direction:rtl;
}
.send-preview-head { min-height:56px; display:flex; align-items:center; justify-content:center; position:relative; border-bottom:1px solid #e5e7eb; }
.send-preview-head h3 { font-size:16px; font-weight:900; }
.send-preview-x { position:absolute; right:16px; top:50%; transform:translateY(-50%); width:34px; height:34px; display:flex; align-items:center; justify-content:center; background:transparent !important; }
.send-preview-x img { filter:none !important; opacity:.75; }
.send-preview-grid { padding:12px; display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:6px; overflow:auto; max-height:46dvh; background:#fff; }
.send-preview-photo { position:relative; aspect-ratio:1/1; border-radius:8px; overflow:hidden; background:#e5e7eb; }
.send-preview-photo img { width:100%; height:100%; object-fit:cover; }
.send-preview-photo span { position:absolute; left:6px; top:6px; min-width:20px; height:20px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:rgba(15,23,42,.72); color:#fff; font-size:11px; }
.send-preview-file-list { padding:12px 16px; overflow:auto; max-height:46dvh; background:#fff; display:flex; flex-direction:column; gap:8px; }
.send-preview-file-row { direction:ltr; display:flex; align-items:center; gap:12px; padding:10px; border:1px solid #e5e7eb; border-radius:14px; background:#f8fafc; }
.send-preview-file-icon { width:42px; height:42px; min-width:42px; border-radius:999px; background:#e0f2fe; display:flex; align-items:center; justify-content:center; }
.send-preview-file-icon img { filter:none !important; opacity:.8; }
.send-preview-file-name { font-size:13px; font-weight:900; color:#0f172a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-align:left; }
.send-preview-file-meta { font-size:11px; color:#64748b; margin-top:3px; text-align:left; }
.send-caption-box { padding:12px 16px; background:#f8fafc; border-top:1px solid #e5e7eb; }
.send-caption-box textarea { width:100%; min-height:52px; max-height:104px; resize:none; border:1px solid #14b8a6; border-radius:14px; padding:12px 14px; outline:none; color:#0f172a; background:#fff; font-size:13px !important; line-height:1.55; }
.send-preview-actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:12px 16px 16px; background:#f8fafc; }
.send-preview-cancel, .send-preview-send { height:48px; border-radius:12px; font-weight:900; font-size:14px; }
.send-preview-cancel { border:1px solid #14b8a6; color:#0f766e !important; background:#fff !important; }
.send-preview-send { background:#14b8a6 !important; color:#fff !important; }
.media-caption { margin-top:7px; padding-top:6px; border-top:1px solid rgba(255,255,255,.08); }
@media (max-width:768px){
  .send-preview-card { width:calc(100vw - 16px); max-height:84dvh; border-radius:16px; }
  .send-preview-grid { grid-template-columns:repeat(2,minmax(0,1fr)); max-height:40dvh; }
}

/* Album media, lazy download, swipe reply, and internal music player */
.album-bubble { padding:4px !important; overflow:hidden; }
.album-grid { display:grid; gap:2px; border-radius:15px; overflow:hidden; min-width:220px; max-width:min(520px, 82vw); }
.album-grid.count-1 { grid-template-columns:1fr; }
.album-grid.count-2 { grid-template-columns:repeat(2,1fr); }
.album-grid.count-3 { grid-template-columns:2fr 1fr; }
.album-grid.count-4, .album-grid.count-5, .album-grid.count-6, .album-grid.count-7, .album-grid.count-8, .album-grid.count-9, .album-grid.count-10 { grid-template-columns:repeat(3,1fr); }
.album-tile { position:relative; min-height:96px; background:#101820; overflow:hidden; display:flex; align-items:center; justify-content:center; }
.album-tile-image, .album-tile-video { aspect-ratio:1/1; }
.album-tile-music, .album-tile-file { min-height:56px; grid-column:1/-1; }
.album-item-check, .album-parent-check { position:absolute; z-index:12; top:8px; right:8px; width:28px; height:28px; border-radius:999px; background:rgba(0,0,0,.48); display:flex; align-items:center; justify-content:center; }
.album-parent-check { position:relative; top:auto; right:auto; margin-inline:3px; align-self:center; }
.lazy-media { width:100%; height:100%; min-height:150px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg, rgba(59,130,246,.16), rgba(15,23,42,.92)); border:1px solid rgba(124,58,237,.7); position:relative; overflow:hidden; }
.lazy-media.small { min-height:98px; }
.lazy-media::before { content:''; position:absolute; inset:0; background:rgba(255,255,255,.04); filter:blur(10px); }
.lazy-download { position:relative; z-index:2; width:56px; height:56px; border-radius:999px; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; }
.lazy-download img { width:30px; height:30px; filter:invert(1); }
.album-img-loaded, .album-video-loaded { width:100%; height:100%; object-fit:cover; display:block; }
.reply-pop { position:absolute; right:-44px; top:50%; transform:translateY(-50%) scale(.4); opacity:0; width:34px; height:34px; border-radius:999px; background:#2b2437; display:flex; align-items:center; justify-content:center; transition:.18s ease; pointer-events:none; }
.swipe-reply-ready .reply-pop, .reply-pop-in .reply-pop { opacity:1; transform:translateY(-50%) scale(1); }
.message-bubble, .album-tile { transition:transform .18s ease; }
.music-player-bar { position:relative; z-index:35; min-height:34px; background:#132033; border-bottom:1px solid rgba(255,255,255,.06); display:flex; align-items:center; gap:8px; padding:5px 10px; direction:ltr; color:#dbeafe; }
.music-player-bar button { width:28px; height:28px; display:flex; align-items:center; justify-content:center; opacity:.85; }
.music-player-bar button.active img { filter: invert(56%) sepia(96%) saturate(1212%) hue-rotate(184deg) brightness(102%); }
.music-bar-title { flex:1 !important; width:auto !important; justify-content:flex-start !important; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:700; font-size:12px; color:#fff; }
.music-bar-time { font-size:11px; color:#8fb9e8; min-width:42px; text-align:center; }
.music-playlist-card { width:min(760px, calc(100vw - 24px)); max-height:86dvh; background:#1f1f22; border-radius:32px 32px 0 0; overflow:hidden; display:flex; flex-direction:column; direction:ltr; color:#f8fafc; box-shadow:0 -18px 80px rgba(0,0,0,.55); }
.music-playlist-handle { width:58px; height:7px; border-radius:999px; background:#9ca3af; margin:12px auto; opacity:.75; }
.music-playlist-list { flex:1; overflow:auto; padding:0 28px; }
.playlist-row { width:100%; display:flex; align-items:center; gap:16px; padding:11px 0; border-bottom:1px solid rgba(255,255,255,.07); text-align:left; }
.playlist-cover { width:56px; height:56px; min-width:56px; border-radius:999px; background:#080808; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.playlist-row.active .playlist-cover { background:#348cff; }
.playlist-cover img { width:30px; height:30px; filter:invert(1); }
.playlist-info { min-width:0; display:flex; flex-direction:column; }
.playlist-info b { font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.playlist-info span { color:#a1a1aa; font-size:15px; margin-top:2px; }
.music-playlist-now { display:flex; align-items:center; gap:14px; padding:18px 28px 10px; }
.music-now-cover { width:56px; height:56px; border-radius:13px; background:#e5e7eb; display:flex; align-items:center; justify-content:center; }
.music-now-cover img { filter:none !important; opacity:.55; }
.music-now-title { font-weight:900; font-size:17px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.music-now-artist { color:#a1a1aa; font-size:15px; margin-top:2px; }
.music-seek { padding:0 28px; }
.music-seek input { width:100%; accent-color:#e5e7eb; }
.music-seek div { display:flex; justify-content:space-between; color:#a1a1aa; font-size:14px; margin-top:6px; }
.music-controls-big { display:grid; grid-template-columns:repeat(5,1fr); gap:14px; padding:20px 28px 26px; align-items:center; }
.music-controls-big button { display:flex; align-items:center; justify-content:center; }
.music-controls-big .big { width:46px; height:46px; }
@media (max-width:768px){ .album-grid { max-width:78vw; } .music-playlist-card { width:100vw; max-height:82dvh; border-radius:28px 28px 0 0; } .playlist-info b{font-size:16px;} .playlist-info span{font-size:13px;} }

/* Final media-player/upload/lazy-preview fixes */
.music-player-bar {
  position: fixed !important;
  left: 10px !important;
  right: 10px !important;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 95 !important;
  min-height: 38px !important;
  border: 1px solid rgba(59,130,246,.22) !important;
  border-radius: 18px !important;
  background: rgba(14, 24, 38, .96) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.38) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(59,130,246,.22) !important;
  padding: 4px 8px !important;
}
.music-player-bar button,
.music-controls-big button,
.music-playlist-now button,
.playlist-row,
.tg-action-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.music-player-bar button { width: 28px !important; height: 28px !important; border-radius: 999px; }
.music-player-bar button:hover { background: rgba(255,255,255,.06) !important; }
.music-close { order: -10; }
.music-playlist-card {
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  width: auto !important;
  max-width: 520px !important;
  margin: 0 auto !important;
  max-height: min(58dvh, 520px) !important;
  border-radius: 24px !important;
  background: rgba(31,31,34,.98) !important;
  border: 1px solid rgba(255,255,255,.08);
}
.music-playlist-handle { display:none !important; }
.music-playlist-close {
  position: absolute; left: 12px; top: 10px; z-index: 4;
  width: 32px; height: 32px; display:flex; align-items:center; justify-content:center;
  background: transparent !important; border:0 !important; box-shadow:none !important;
}
.music-playlist-list { padding: 46px 18px 6px !important; max-height: 260px; flex: 0 1 auto !important; }
.playlist-row { gap: 10px !important; padding: 7px 0 !important; min-height: 48px; }
.playlist-cover { width: 38px !important; height: 38px !important; min-width: 38px !important; }
.playlist-cover img { width: 20px !important; height: 20px !important; }
.playlist-info b { font-size: 13px !important; line-height: 1.2; }
.playlist-info span { font-size: 11px !important; }
.music-playlist-now { padding: 8px 18px !important; gap: 10px !important; }
.music-now-cover { width: 42px !important; height: 42px !important; min-width: 42px; }
.music-now-title { font-size: 13px !important; }
.music-now-artist { font-size: 11px !important; }
.music-seek { padding: 0 18px !important; }
.music-seek div { font-size: 11px !important; margin-top: 3px !important; }
.music-controls-big { padding: 10px 18px 14px !important; gap: 8px !important; }
.music-controls-big .big { width: 34px !important; height: 34px !important; }
.music-controls-big img { filter: invert(1) !important; }
.upload-queue {
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 9996 !important;
  max-width: 620px !important;
  margin: 0 auto !important;
  pointer-events: none;
}
.upload-item { pointer-events:auto; background: rgba(15, 30, 48, .98) !important; }
#send-preview-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: max(10px, env(safe-area-inset-top,0px)) 10px max(10px, env(safe-area-inset-bottom,0px)) !important;
}
.send-preview-card {
  transform: none !important;
  max-height: min(86dvh, 720px) !important;
  overflow: hidden !important;
}
.lazy-media {
  background-size: cover !important;
  background-position: center !important;
  min-height: 120px !important;
}
.lazy-media.has-thumb .lazy-blur {
  position:absolute; inset:-14px;
  background: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(14px) saturate(.85);
  transform: scale(1.12);
  opacity: .88;
}
.lazy-media.loading .lazy-download img { animation: uploadSpin .8s linear infinite; }
.lazy-download { position:relative; z-index:2; width:58px; height:58px; border-radius:999px; background:rgba(10,10,12,.76); display:flex; align-items:center; justify-content:center; }
.lazy-media.loaded { border:0 !important; }
.album-img-loaded, .album-video-loaded { object-fit: cover !important; }
@media (max-width: 768px) {
  .music-player-bar { bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; left: 8px !important; right: 8px !important; }
  .music-playlist-card { left: 8px !important; right: 8px !important; bottom: calc(64px + env(safe-area-inset-bottom,0px)) !important; max-height: 54dvh !important; }
  .music-playlist-list { max-height: 220px !important; }
  .send-preview-card { width: calc(100vw - 16px) !important; max-height: 82dvh !important; }
}

/* Final requested fix: place music player under chat header, not at bottom */
.music-player-bar {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  width: auto !important;
  margin: 0 10px 8px !important;
  min-height: 38px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(59,130,246,.22) !important;
  background: rgba(14,24,38,.96) !important;
  z-index: 31 !important;
}
.music-player-bar.hidden { display: none !important; }
.music-player-bar button { background: transparent !important; border: 0 !important; box-shadow: none !important; }
@media (max-width:768px){
  .music-player-bar {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 8px 8px !important;
  }
}
.image-viewer-modal img,
#image-viewer-img {
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100dvh - 32px) !important;
  object-fit: contain !important;
}
#image-viewer-img.image-loading { opacity: .45; }
.lazy-media.loaded { cursor: zoom-in; }

/* Image viewer top controls */
.image-viewer-top-actions {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  z-index: 180;
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
}
.image-viewer-close-btn,
.image-viewer-download-btn {
  height: 36px;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(7,12,20,.78);
  color: #fff;
  border-radius: 999px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
}
.image-viewer-download-btn { direction: rtl; }
.image-viewer-close-btn:hover,
.image-viewer-download-btn:hover { background: rgba(30,41,59,.92); }
.download-icon { font-size: 18px; line-height: 1; font-weight: 900; }
@media (max-width: 768px) {
  .image-viewer-top-actions { top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; }
  .image-viewer-close-btn, .image-viewer-download-btn { height: 34px; padding: 0 11px; font-size: 11px; }
}

/* Mixed image/video viewer and offline chat cache fixes */
.offline-notice {
  position:absolute; top:calc(env(safe-area-inset-top,0px) + 74px); left:50%; transform:translateX(-50%);
  z-index:55; background:rgba(15,23,42,.92); border:1px solid rgba(59,130,246,.35);
  color:#bfdbfe; padding:6px 12px; border-radius:999px; font-size:11px; box-shadow:0 10px 30px rgba(0,0,0,.35);
}
.media-viewer-video {
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100dvh - 76px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 18px;
  background:#000;
  box-shadow:0 22px 70px rgba(0,0,0,.65);
  border:1px solid rgba(255,255,255,.12);
}
#image-viewer-img.hidden, #image-viewer-video.hidden { display:none !important; }
.image-viewer-modal { padding-top: calc(env(safe-area-inset-top,0px) + 54px) !important; }
.image-viewer-top-actions { direction:ltr; }

/* Keep media geometry stable before/after download, especially on iOS */
.lazy-media {
  height: auto !important;
  min-height: 0 !important;
  max-height: min(62dvh, 540px);
  border-radius: 15px;
}
.album-tile .lazy-media { max-height: none; }
.lazy-media.loaded { background: transparent !important; }
.lazy-media.loaded .album-img-loaded,
.lazy-media.loaded .album-video-loaded,
.album-img-loaded,
.album-video-loaded {
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  border-radius: inherit;
}
.message-bubble .lazy-media:not(.small) { width: min(320px, 72vw); }
.message-other .lazy-media:not(.small), .message-me .lazy-media:not(.small) { aspect-ratio: inherit; }
@media (max-width: 768px) {
  .message-bubble .lazy-media:not(.small) { width: min(280px, 70vw); }
  .media-viewer-video { max-height: calc(100dvh - 96px) !important; }
}


/* Final fixes: viewer controls, no blinking, reply close, video preview */
.no-message-animation .animate-message { animation: none !important; }
.no-message-animation .message-bubble, .no-message-animation .album-tile { transition: none !important; }
#reply-indicator { background: transparent !important; box-shadow: none !important; border-top: 0 !important; border-left: 0 !important; border-bottom: 0 !important; }
#reply-indicator button, #editing-indicator button { background: transparent !important; box-shadow: none !important; border: 0 !important; }
.image-viewer-top-actions { left: 14px !important; right: auto !important; top: calc(env(safe-area-inset-top, 0px) + 14px) !important; }
.image-viewer-close-btn, .image-viewer-download-btn { width: 40px !important; height: 40px !important; min-width: 40px !important; padding: 0 !important; border-radius: 999px !important; }
.viewer-control-icon { width: 22px; height: 22px; filter: invert(1); opacity: .96; }
.video-preview-ready { position:relative; z-index:2; width:64px; height:64px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:rgba(0,0,0,.62); }
.video-preview-ready img { width:34px; height:34px; filter:invert(1); }
.album-bubble .media-caption:empty { display:none; }
@media (max-width: 768px) {
  .image-viewer-top-actions { left: 10px !important; right: auto !important; }
  .image-viewer-close-btn, .image-viewer-download-btn { width: 38px !important; height: 38px !important; }
}

/* Final viewer quality/navigation/zoom refinements */
.image-viewer-close-btn,
.image-viewer-download-btn {
  font-size: 0 !important;
  line-height: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}
.image-viewer-close-btn img,
.image-viewer-download-btn img {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
}
.image-viewer-nav.disabled {
  opacity: .22 !important;
  pointer-events: none !important;
  filter: grayscale(1) !important;
}
#image-viewer-img,
#image-viewer-video {
  transform-origin: center center !important;
  transition: transform .18s ease, opacity .18s ease !important;
  touch-action: none !important;
  user-select: none !important;
}
.image-viewer-modal {
  overflow: hidden !important;
}

/* Final scroll, upload cancel and viewer pan fixes */
.jump-new-count.hidden { display: none !important; }
.upload-queue { position: relative; }
.upload-cancel-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(255,255,255,.14);
  z-index: 4;
}
.upload-cancelled {
  padding: 10px 14px;
  color: #fecaca;
  font-size: 12px;
  text-align: center;
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 14px;
  background: rgba(127,29,29,.18);
}
.image-viewer-modal { overflow: hidden !important; touch-action: none; }
#image-viewer-img,
#image-viewer-video {
  transition: transform .08s linear;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* Final fixes: stable selection without re-render, upload cancel, and clean status UI */
#messages-container:not(.select-mode) .message-checkbox,
#messages-container:not(.select-mode) .album-item-check,
#messages-container:not(.select-mode) .album-parent-check {
  display: none !important;
}
#messages-container.select-mode .message-checkbox,
#messages-container.select-mode .album-item-check,
#messages-container.select-mode .album-parent-check {
  display: flex !important;
}
.message-row.is-selected .message-bubble,
.album-tile:has(.album-item-check.checked) {
  outline: 2px solid rgba(59,130,246,.55);
  outline-offset: 2px;
}
.message-row,
.message-bubble,
.album-tile {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.upload-queue {
  pointer-events: auto !important;
}
.upload-cancel-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
  background: rgba(220,38,38,.92) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  z-index: 9999 !important;
}
.upload-cancel-btn img,
.upload-cancel-btn svg { filter: invert(1) !important; }
.typing-status { color: #60a5fa !important; }

/* Added fixes: preview removal, delete history, stable playlist controls */
.send-preview-photo { cursor: zoom-in; }
.send-preview-remove {
  position:absolute; right:6px; top:6px; width:24px; height:24px; border-radius:999px;
  display:flex; align-items:center; justify-content:center; background:rgba(15,23,42,.78) !important;
  border:1px solid rgba(255,255,255,.35); z-index:4;
}
.send-preview-remove.file { position:static; min-width:26px; width:26px; height:26px; background:rgba(15,23,42,.08) !important; border:0; }
.tg-danger-row {
  margin-top:12px; width:100%; display:flex; align-items:center; gap:12px; padding:13px 6px;
  color:#f87171; font-size:14px; font-weight:800; background:transparent !important;
  border-top:1px solid rgba(248,113,113,.12); border-bottom:1px solid rgba(248,113,113,.08);
}
.music-controls-big button.active img, .music-playlist-card button.active img { filter: invert(55%) sepia(94%) saturate(1572%) hue-rotate(191deg) brightness(102%) contrast(93%) !important; opacity:1 !important; }
.empty-chat-state { min-height:55vh; display:flex; align-items:center; justify-content:center; color:#64748b; font-size:13px; }

/* Contacts, glass menu, safe media bubble, notifications polish */
.chat-header-actions { position: relative; }
.glass-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 8px;
  padding: 10px;
  min-width: min(360px, calc(100vw - 32px));
  border-radius: 28px;
  background: rgba(28, 28, 31, .68);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
  backdrop-filter: blur(18px) saturate(140%);
}
.glass-menu button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; color:#f8fafc; padding:10px 8px; border-radius:20px; background:transparent; font-weight:700; font-size:12px; }
.glass-menu button:hover { background:rgba(255,255,255,.08); }
.glass-menu img { width:24px; height:24px; filter: brightness(0) invert(1); opacity:.95; }
.add-contact-prompt { z-index: 31; padding: 7px 14px; text-align:center; background: rgba(37,99,235,.10); border-bottom:1px solid rgba(59,130,246,.22); color:#93c5fd; font-size:12px; }
.add-contact-prompt button { color:#93c5fd; font-weight:800; }
.contacts-add-box { display:grid; gap:10px; padding:12px; border:1px solid rgba(255,255,255,.08); border-radius:20px; background:rgba(255,255,255,.025); }
.contact-input { width:100%; background:rgba(15,15,17,.8); border:1px solid rgba(255,255,255,.10); color:#e5e7eb; border-radius:14px; padding:11px 13px; outline:none; font-size:13px; }
.contact-add-btn { display:flex; align-items:center; justify-content:center; gap:8px; background:#2563eb; color:#fff; border-radius:14px; padding:11px; font-weight:800; }
.contacts-list { display:grid; gap:8px; max-height:48vh; overflow:auto; }
.contact-row { display:flex; align-items:center; gap:12px; width:100%; padding:10px 4px; color:#fff; text-align:right; background:transparent; border-bottom:1px solid rgba(255,255,255,.06); }
.contact-avatar { width:42px; height:42px; border-radius:50%; overflow:hidden; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.08); font-weight:900; }
.contact-info { min-width:0; display:flex; flex-direction:column; }
.contact-info b { font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.contact-info span { font-size:11px; color:#94a3b8; direction:ltr; text-align:right; }
.contacts-empty { text-align:center; color:#64748b; padding:28px 0; font-size:13px; }
.message-bubble, .album-bubble { overflow:hidden; }
.message-bubble img, .message-bubble video, .album-tile, .album-grid, .lazy-media-box { max-width:100%; overflow:hidden; }
.lazy-media-box img, .lazy-media-box video { max-width:100%; height:auto; object-fit:cover; display:block; }
@media (max-width: 768px) { .glass-menu { left: 8px; right: auto; min-width: calc(100vw - 24px); grid-template-columns: repeat(5, 1fr); } }

/* status/info fix: sidebar quick menu and cleaner conversation list */
.sidebar-quick-menu {
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 6px;
  padding: 10px 14px 6px;
  background: #151518;
}
.sidebar-quick-menu button {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:7px 2px;
  border:0;
  background:transparent;
  color:#e5e7eb;
  font-size:10px !important;
  border-radius:10px;
}
.sidebar-quick-menu button:hover { background: rgba(255,255,255,.035); }
.sidebar-quick-menu img { width:18px; height:18px; filter: brightness(0) invert(1); opacity:.9; }
.conversation-item-clean { min-height: 56px; border-radius: 14px; }
.conversation-item-clean.active { background: rgba(59,130,246,.10); }
.conversation-avatar { width:40px !important; height:40px !important; }
.conversation-title { font-size: 12.5px !important; line-height: 1.2; }
.conversation-preview { font-size: 9.5px !important; line-height: 1.15 !important; opacity:.82; }
.conversation-item-clean .font-mono { font-size: 8.5px !important; }

/* Fix avatar color/filter issues */
.conversation-item img,
.conversation-avatar img,
.chat-avatar img,
.user-avatar-mini,
.profile-avatar img,
#conversations-list img,
#conversation-list img,
img.user-avatar-mini,
img.avatar,
.avatar img {
    filter: none !important;
    mix-blend-mode: normal !important;
    opacity: 1 !important;
    -webkit-filter: none !important;
    background-color: transparent !important;
}

/* Final avatar color fix */
.conversation-item img,
.conversation-avatar img,
.chat-avatar img,
.user-avatar-mini,
.profile-avatar img,
#conversations-list img,
#conversation-list img,
img.user-avatar-mini,
img.avatar,
.avatar img {
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal !important;
    opacity: 1 !important;
    background-color: transparent !important;
}

/* Arpack final avatar image color fix */
#conversations-list img,
#conversation-list img,
.conversations-list img,
.conversation-list img,
.conversation-item img,
.conversation-avatar,
.conversation-avatar img,
.chat-avatar,
.chat-avatar img,
.user-avatar-mini,
img.user-avatar-mini,
img.avatar,
.avatar img,
.profile-avatar img {
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal !important;
    opacity: 1 !important;
    background-color: transparent !important;
    color-scheme: normal !important;
    forced-color-adjust: none !important;
}

/* Avatar real-color fix */
#conversations-list img,
#conversation-list img,
.conversation-item img,
.conversation-avatar img,
.chat-avatar img,
.user-avatar-mini,
.profile-avatar img,
img.user-avatar-mini,
img.avatar,
.avatar img,
img[src*="/uploads/avatars"],
img[src*="storage/uploads/avatars"],
img[src*="/avatars/"] {
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal !important;
    opacity: 1 !important;
    background-color: transparent !important;
    isolation: isolate !important;
}

/* v21 no-blink message rendering and cleaner chat bubbles */
:root {
  --bubble-me-1: #2563eb;
  --bubble-me-2: #1d4ed8;
  --bubble-other: rgba(24, 27, 32, .96);
  --bubble-border: rgba(255,255,255,.08);
}
.animate-message { animation: none !important; }
.new-message-soft .message-bubble,
.new-message-soft.album-row .message-bubble {
  animation: newMessageSoftIn .16s ease-out both;
}
@keyframes newMessageSoftIn {
  from { opacity: .92; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-date-pill {
  background: rgba(15,23,42,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  color: #b6c2d1;
  font-weight: 800;
  border: 1px solid rgba(148,163,184,.16);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.message-row { contain: layout paint; }
.message-wrap { min-width: 0; }
.message-bubble {
  position: relative;
  padding: 9px 12px 6px !important;
  border-radius: 18px !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.18) !important;
  border: 1px solid var(--bubble-border) !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  overflow-wrap: anywhere;
}
.message-me {
  background: linear-gradient(135deg, var(--bubble-me-1), var(--bubble-me-2)) !important;
  color: #fff !important;
  border-bottom-right-radius: 6px !important;
}
.message-other {
  background: linear-gradient(180deg, rgba(31,35,42,.98), var(--bubble-other)) !important;
  color: #edf2f7 !important;
  border-bottom-left-radius: 6px !important;
}
.message-text {
  font-size: 13px !important;
  line-height: 1.72 !important;
  letter-spacing: -.01em;
}
.message-meta {
  margin-top: 5px !important;
  font-size: 9.5px !important;
  opacity: .68 !important;
  gap: 5px !important;
}
.message-me .message-meta { color: rgba(255,255,255,.86); }
.message-other .message-meta { color: #9ca3af; }
.seen-mark.seen { color: #bfdbfe !important; }
.reply-quote {
  border-right-color: rgba(191,219,254,.9) !important;
  background: rgba(2,6,23,.20) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.message-me .reply-quote strong { color: #dbeafe !important; }
.message-me .reply-quote span { color: rgba(255,255,255,.86) !important; }
.file-message { background: rgba(0,0,0,.16) !important; }
#messages-container { scroll-behavior: auto; }
#messages-container.no-message-animation *,
#messages-container.no-message-animation *::before,
#messages-container.no-message-animation *::after {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}
@media (prefers-reduced-motion: reduce) {
  .new-message-soft .message-bubble { animation: none !important; }
  * { scroll-behavior: auto !important; }
}
@media (max-width: 768px) {
  .message-bubble { padding: 8px 11px 6px !important; }
  .message-text { font-size: 12.8px !important; line-height: 1.68 !important; }
}


/* ===== v22 stable chat UI / no blink / contacts / avatars ===== */
.message-me {
  background: linear-gradient(135deg, var(--bubble-me-1), var(--bubble-me-2)) !important;
  color: #fff !important;
  border-bottom-right-radius: 6px !important;
}
.message-other {
  background: var(--bubble-other) !important;
  color: #eef2f7 !important;
  border-bottom-left-radius: 6px !important;
}
#conversations-list { contain: layout paint; }
.conversation-item { transform: translateZ(0); backface-visibility: hidden; }
.conversation-item.is-updating { animation: none !important; }
.conversation-unread-badge {
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: #2563eb; color: #fff; display:inline-flex; align-items:center; justify-content:center;
  font-size: 10px; font-weight: 900; line-height: 1; box-shadow: 0 8px 18px rgba(37,99,235,.28);
}
.conversation-preview { max-width: 100%; }
.add-contact-prompt { display:flex; align-items:center; justify-content:center; gap:8px; }
.add-contact-prompt.hidden { display:none !important; }
.add-contact-prompt .add-contact-action {
  color:#bfdbfe; font-weight:900; padding:6px 10px; border-radius:10px; background:rgba(37,99,235,.16);
}
.add-contact-prompt .add-contact-close {
  width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:10px; color:#cbd5e1; background:rgba(255,255,255,.06);
}
.avatar-history-item { position:relative; width:54px; min-width:54px; height:54px; }
.avatar-history-item .avatar-history-thumb { width:54px; height:54px; min-width:54px; }
.avatar-history-delete {
  position:absolute; top:-7px; left:-7px; width:22px; height:22px; border-radius:999px;
  display:flex; align-items:center; justify-content:center; background:#ef4444; color:#fff;
  border:2px solid #111318; font-size:12px; font-weight:900; box-shadow:0 6px 16px rgba(0,0,0,.35);
}
.tg-action-btn.add-contact-info-action { background: rgba(37,99,235,.16) !important; color:#dbeafe !important; }
.avatar-img { object-fit: cover; width:100%; height:100%; }
.message-row, .message-bubble, .conversation-item { will-change: auto; }
@media (prefers-reduced-motion: no-preference) {
  .new-message-soft .message-bubble { animation: newMessageSoftIn .12s ease-out both; }
}

/* ===== v23 UX fixes ===== */
.message-row-me .message-bubble,
.message-me .message-bubble {
  border-bottom-left-radius: 6px !important;
  border-bottom-right-radius: 18px !important;
}
.message-row-other .message-bubble,
.message-other .message-bubble {
  border-bottom-right-radius: 6px !important;
  border-bottom-left-radius: 18px !important;
}
#my-avatar, .profile-summary-avatar {
  overflow: hidden !important;
  object-fit: cover;
}
#my-avatar img, .profile-summary-avatar img, .conversation-avatar img, .contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.quick-create-wrap {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.quick-create-fab {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 38px rgba(37,99,235,.38);
  border: 1px solid rgba(255,255,255,.18);
}
.quick-create-menu {
  min-width: 146px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(22,24,30,.96);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 18px 44px rgba(0,0,0,.38);
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(10px);
}
.quick-create-menu.hidden { display: none !important; }
.quick-create-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
}
.quick-create-menu button:hover { background: rgba(255,255,255,.06); }
.quick-create-menu-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 999px;
  background: rgba(37,99,235,.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#bug-report-text { resize: vertical; }
@media (max-width: 768px) {
  .quick-create-wrap { left: 12px; bottom: 12px; }
  .quick-create-fab { width: 52px; height: 52px; font-size: 30px; }
}

#sidebar { position: relative; }

/* ===== v24 UX / RTL bubble / voice recorder / header status ===== */
/* RTL chat layout: sender (blue/current user) is rendered with flex-row-reverse and must have the bottom-left corner flat. Receiver is flex-row and must have the bottom-right corner flat. */
.message-row.flex-row-reverse .message-bubble,
.message-row.flex-row-reverse .message-bubble.message-me,
.message-bubble.message-me {
  border-bottom-left-radius: 6px !important;
  border-bottom-right-radius: 18px !important;
}
.message-row.flex-row:not(.flex-row-reverse) .message-bubble,
.message-row.flex-row:not(.flex-row-reverse) .message-bubble.message-other,
.message-bubble.message-other {
  border-bottom-right-radius: 6px !important;
  border-bottom-left-radius: 18px !important;
}
.quick-create-wrap {
  right: 16px !important;
  left: auto !important;
  align-items: flex-end !important;
}
.quick-create-menu { transform-origin: bottom right; }
.app-connection-box {
  min-width: 120px;
  max-width: 160px;
  height: 42px;
  padding: 0 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.app-connection-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 999px;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100,116,139,.14);
}
.app-connection-dot.waiting { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.14); }
.app-connection-dot.updating { background: #38bdf8; box-shadow: 0 0 0 3px rgba(56,189,248,.14); animation: appStatusPulse 1s ease-in-out infinite; }
.app-connection-dot.connected { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.14); }
.app-connection-dot.offline { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.14); }
@keyframes appStatusPulse { 0%,100%{opacity:.45} 50%{opacity:1} }
.voice-record-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 230;
  height: 96px;
  background: #111416;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(18px, 6vw, 70px);
  box-shadow: 0 -20px 60px rgba(0,0,0,.48);
}
.voice-record-overlay.hidden { display: none !important; }
.voice-record-trash, .voice-record-send {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-record-trash { color: #ff5b5b; }
.voice-record-trash img { filter: invert(53%) sepia(75%) saturate(3085%) hue-rotate(327deg) brightness(102%) contrast(102%) !important; width: 40px; height: 40px; }
.voice-record-send img { filter: invert(52%) sepia(84%) saturate(1950%) hue-rotate(125deg) brightness(94%) contrast(91%) !important; width: 52px; height: 52px; transform: rotate(180deg); }
.voice-record-center {
  min-width: 170px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
  font-weight: 900;
}
.voice-record-time {
  direction: ltr;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 2px;
  color: #9ca3af;
}
.voice-record-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #7f1d1d;
  margin-inline-end: 8px;
  vertical-align: middle;
  animation: voiceDot 1s ease-in-out infinite;
}
@keyframes voiceDot { 0%,100%{opacity:.38} 50%{opacity:1} }
.voice-record-stop { font-size: 25px; color: #9ca3af; }
#my-avatar { border-radius: 999px !important; }
@media (max-width: 768px) {
  .app-connection-box { min-width: 96px; max-width: 132px; font-size: 10px; padding: 0 9px; }
  .voice-record-overlay { height: 88px; padding: 12px 24px; }
  .voice-record-time { font-size: 29px; }
}

/* ===== v25 polish: menu, profile readability, compact voice recorder ===== */
/* Bubble corners for RTL: current user/sender is on the left, receiver is on the right. */
#messages-container .message-row.flex-row-reverse > .message-wrap > .message-bubble,
#messages-container .message-row.flex-row-reverse > .message-wrap > .message-bubble.message-me,
#messages-container .message-bubble.message-me {
  border-radius: 18px !important;
  border-bottom-left-radius: 6px !important;
  border-bottom-right-radius: 18px !important;
}
#messages-container .message-row.flex-row > .message-wrap > .message-bubble,
#messages-container .message-row.flex-row > .message-wrap > .message-bubble.message-other,
#messages-container .message-bubble.message-other {
  border-radius: 18px !important;
  border-bottom-right-radius: 6px !important;
  border-bottom-left-radius: 18px !important;
}
/* Hide avatars in the conversation list completely. */
#conversations-list .conversation-avatar { display: none !important; }
#conversations-list .conversation-item { padding-inline: 14px !important; }

/* Three-dot chat menu: vertical list with icons. */
.glass-menu {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
  min-width: 230px !important;
  width: 230px !important;
  right: auto !important;
  left: 10px !important;
  padding: 8px !important;
  border-radius: 18px !important;
  background: rgba(18, 20, 26, .98) !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  gap: 4px !important;
}
.glass-menu.hidden { display: none !important; }
.glass-menu button {
  width: 100% !important;
  min-height: 46px !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 12px !important;
  border-radius: 13px !important;
  text-align: right !important;
  color: #f3f4f6 !important;
  font-size: 13px !important;
}
.glass-menu button:hover { background: rgba(255,255,255,.06) !important; }
.glass-menu button img { width: 20px !important; height: 20px !important; min-width: 20px !important; }

/* Profile modal readability. */
#profile-modal .modal-card { background: #1b1c22 !important; color: #e5e7eb !important; }
#profile-modal, #profile-modal * { color: #e5e7eb; }
#profile-modal input, #profile-modal textarea {
  color: #f8fafc !important;
  background: #17181e !important;
  border-color: rgba(255,255,255,.10) !important;
}
#profile-modal input::placeholder, #profile-modal textarea::placeholder { color: #8b93a3 !important; }
#profile-modal .text-gray-500 { color: #8b93a3 !important; }
#profile-modal .text-gray-400 { color: #a8b0be !important; }
.profile-logout-btn {
  background: #dc2626 !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: 0 10px 28px rgba(220,38,38,.24) !important;
}
.profile-modal-actions button { color: #fff !important; }
#admin-panel-btn:not(.hidden) { display: inline-flex !important; align-items:center; }

/* Pinned message close button should be black/readable. */
.pinned-message-bar > button:last-child {
  color: #111827 !important;
  background: #f8fafc !important;
  border-radius: 10px !important;
  width: 30px !important;
  height: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.pinned-message-bar > button:last-child img { filter: brightness(0) !important; opacity: 1 !important; }

/* Compact and clean voice recorder, not oversized. */
.voice-record-overlay {
  left: 12px !important;
  right: 12px !important;
  bottom: 12px !important;
  height: 74px !important;
  border-radius: 26px !important;
  padding: 10px 14px !important;
  background: rgba(17,20,24,.98) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: 0 18px 58px rgba(0,0,0,.50) !important;
}
.voice-record-trash, .voice-record-send {
  width: 48px !important;
  height: 48px !important;
  border-radius: 16px !important;
  background: rgba(255,255,255,.055) !important;
}
.voice-record-trash img { width: 26px !important; height: 26px !important; }
.voice-record-send img {
  width: 30px !important;
  height: 30px !important;
  transform: none !important;
  filter: invert(46%) sepia(93%) saturate(1379%) hue-rotate(126deg) brightness(96%) contrast(90%) !important;
}
.voice-record-center { min-width: 120px !important; gap: 5px !important; }
.voice-record-time { font-size: 22px !important; letter-spacing: 1px !important; }
.voice-record-dot { width: 9px !important; height: 9px !important; margin-inline-end: 6px !important; }
.voice-record-stop {
  font-size: 13px !important;
  padding: 5px 18px !important;
  border-radius: 999px !important;
  background: #f4f4f5 !important;
  color: #8b93a3 !important;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,.12) !important;
}
@media (max-width: 768px) {
  .glass-menu { left: 8px !important; right: auto !important; width: 220px !important; min-width: 220px !important; }
  .voice-record-overlay { left: 8px !important; right: 8px !important; height: 72px !important; bottom: 8px !important; }
}

/* ===== v26 SMS OTP + avatar color fix ===== */
#my-avatar,
#my-avatar * ,
#my-avatar img,
#profile-avatar-preview,
#profile-avatar-preview img,
.avatar-img,
img.avatar-img,
img[src*="/storage/uploads/avatars"],
img[src*="uploads/avatars"] {
  filter: none !important;
  -webkit-filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 1 !important;
  color-scheme: normal !important;
  forced-color-adjust: none !important;
}
#my-avatar {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: none !important;
}
#my-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  background: #fff !important;
}
.admin-input[dir="ltr"], #sms-otp-vars-map, #sms-unread-vars-map { text-align: left; direction: ltr; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* ===== v32 avatar restore + profile-card true color fix ===== */
/* Keep UI icons white, but never apply icon filters to real user avatars. */
#sidebar button #my-avatar img,
#sidebar button #my-avatar .avatar-img,
#sidebar .conversation-avatar img,
#sidebar .conversation-avatar .avatar-img,
#sidebar img.avatar-img,
#sidebar img[src*="/storage/"],
#sidebar img[src*="storage/uploads/avatars"],
#sidebar img[src*="uploads/avatars"],
#conversations-list .conversation-avatar img,
#conversations-list .conversation-avatar .avatar-img,
#conversations-list img.avatar-img {
  filter: none !important;
  -webkit-filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 1 !important;
  transform: none !important;
  background: transparent !important;
  color-scheme: normal !important;
  forced-color-adjust: none !important;
}
#my-avatar,
#sidebar #my-avatar {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: none !important;
}
#my-avatar img,
#sidebar button #my-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: inherit !important;
}
/* Restore conversation avatars; v25 hid them from the list. */
#conversations-list .conversation-avatar {
  display: flex !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255,255,255,.08) !important;
  color: #dbeafe !important;
  font-weight: 900 !important;
}
#conversations-list .conversation-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: inherit !important;
}
#conversations-list .conversation-item {
  gap: 10px !important;
  padding-inline: 10px !important;
}
#conversations-list .conversation-item.no-avatar-conversation {
  gap: 10px !important;
}

/* ===== v33 group permissions, tags, and group message style ===== */
.group-info-panel { display:flex; flex-direction:column; gap:18px; }
.group-media-stats { margin-top:2px; }
.group-manage-card { padding:16px; border-radius:20px; border:1px solid rgba(96,165,250,.22); background:rgba(15,23,42,.46); display:flex; flex-direction:column; gap:14px; }
.group-manage-card h3 { color:#dbeafe; font-weight:900; font-size:15px; }
.field-label { display:flex; flex-direction:column; gap:7px; color:#cbd5e1; font-size:12px; font-weight:800; }
.perm-box { padding:14px; border-radius:18px; background:#142131; border:1px solid rgba(96,165,250,.14); }
.perm-title { color:#f8fafc; font-weight:900; font-size:15px; margin-bottom:12px; }
.perm-subtitle { color:#7dd3fc; font-size:12px; margin-bottom:14px; }
.perm-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:9px 0; color:#eef2ff; font-size:13px; }
.perm-switch { width:34px; height:18px; border-radius:999px; position:relative; display:flex; align-items:center; transition:.18s ease; border:1px solid rgba(255,255,255,.08); }
.perm-switch span { width:15px; height:15px; border-radius:999px; background:#0f172a; position:absolute; top:1px; transition:.18s ease; box-shadow:0 2px 8px rgba(0,0,0,.35); }
.perm-switch.on { background:#5b93ca; }
.perm-switch.on span { right:17px; }
.perm-switch.off { background:#ef4444; }
.perm-switch.off span { right:2px; }
.group-save-btn, .btn-primary-dark-text { height:42px; padding:0 16px; border-radius:14px; background:#93c5fd !important; color:#061018 !important; font-weight:900; }
.btn-secondary { height:42px; padding:0 16px; border-radius:14px; background:rgba(255,255,255,.07); color:#e5e7eb; border:1px solid rgba(255,255,255,.1); }
.group-member-row { align-items:flex-start !important; }
.member-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; max-width:190px; }
.member-perm-btn { padding:7px 9px; border-radius:10px; background:rgba(59,130,246,.15); color:#bfdbfe; font-size:11px; font-weight:900; }
.member-remove-btn { padding:7px 9px; border-radius:10px; background:rgba(239,68,68,.14); color:#fca5a5; font-size:11px; font-weight:900; }
.member-tag-chip { display:inline-flex; align-items:center; margin-inline-start:6px; padding:2px 7px; border-radius:999px; background:#14532d; color:#bbf7d0; font-size:10px; vertical-align:middle; }
.member-perm-card { width:min(520px, calc(100vw - 24px)); max-height:86dvh; overflow:auto; border-radius:24px; background:#101820; border:1px solid rgba(148,163,184,.22); box-shadow:0 24px 70px rgba(0,0,0,.55); padding:18px; color:#e5e7eb; }
.member-perm-head { display:flex; align-items:center; justify-content:space-between; padding-bottom:12px; border-bottom:1px solid rgba(255,255,255,.08); margin-bottom:14px; }
.member-perm-user { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.member-perm-user small { display:block; color:#94a3b8; font-size:11px; margin-top:3px; }
.member-tag-label { display:flex; flex-direction:column; gap:8px; color:#cbd5e1; font-size:12px; font-weight:800; margin-bottom:14px; }
.member-perm-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:14px; }
#messages-container .message-bubble { border-radius:18px !important; background:#14202b !important; color:#dbe7f3 !important; border:1px solid rgba(148,163,184,.16) !important; box-shadow:0 9px 22px rgba(0,0,0,.22) !important; }
#messages-container .message-row-me .message-bubble { background:#2563eb !important; color:white !important; border-bottom-left-radius:6px !important; border-bottom-right-radius:18px !important; }
#messages-container .message-row-other .message-bubble { background:#14202b !important; color:#dbe7f3 !important; border-bottom-right-radius:6px !important; border-bottom-left-radius:18px !important; }
.group-message-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:7px; min-width:150px; }
.group-sender-name { color:#67e8f9; font-size:12px; font-weight:900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.group-sender-tag { display:inline-flex; align-items:center; justify-content:center; padding:2px 7px; border-radius:8px; background:#14532d; color:#86efac; font-size:10.5px; font-weight:900; border:1px solid rgba(34,197,94,.2); }
@media (max-width:768px){ .member-actions { max-width:100%; justify-content:flex-start; margin-top:8px; } .group-member-row { flex-direction:column; } .perm-box { padding:12px; } }

/* ===== v34 group permissions + forward/system polish ===== */
.perm-switch {
  width: 46px !important;
  height: 24px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  position: relative !important;
  transition: .18s ease !important;
  background: #ef4444 !important;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15) !important;
}
.perm-switch.on { background: #22c55e !important; }
.perm-switch.off { background: #ef4444 !important; }
.perm-switch span {
  position:absolute; top:3px; width:18px; height:18px; border-radius:999px; background:#fff;
  box-shadow:0 3px 8px rgba(0,0,0,.35); transition:.18s ease;
}
html[dir="rtl"] .perm-switch span { right:3px; }
html[dir="rtl"] .perm-switch.on span { right:23px; }
html[dir="rtl"] .perm-switch.off span { right:3px; }
.system-message-row { pointer-events:none; }
.system-message-pill {
  max-width:min(78vw,520px); padding:7px 13px; border-radius:999px;
  background:rgba(148,163,184,.12); color:#cbd5e1; border:1px solid rgba(148,163,184,.18);
  font-size:11px; font-weight:800; text-align:center; box-shadow:0 8px 20px rgba(0,0,0,.18);
}
.forwarded-from {
  display:inline-flex; align-items:center; gap:5px; padding:4px 8px; margin-bottom:6px;
  border-radius:9px; background:rgba(34,197,94,.12); color:#86efac !important;
  font-size:10px; font-weight:900; border:1px solid rgba(34,197,94,.22);
}
.forwarded-from:hover { background:rgba(34,197,94,.2); }
.group-avatar-manage { display:flex; align-items:center; gap:12px; margin:12px 0; }
.group-avatar-preview {
  width:64px; height:64px; min-width:64px; border-radius:20px; overflow:hidden;
  display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,.06);
  border:1px solid rgba(148,163,184,.22); color:#bfdbfe; font-weight:900;
}
.group-avatar-preview img { width:100%; height:100%; object-fit:cover; filter:none !important; }
.group-save-btn { color:#05070b !important; }

/* ===== v35 stability hotfix ===== */


/* ===== v37 group avatar + permission switch hard colors ===== */
html body .perm-box .perm-row .perm-switch,
html body .member-perm-card .perm-row .perm-switch,
html body .group-manage-card .perm-row .perm-switch {
  width: 48px !important;
  min-width: 48px !important;
  height: 26px !important;
  border-radius: 999px !important;
  padding: 0 !important;
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  overflow: hidden !important;
  opacity: 1 !important;
}
html body .perm-box .perm-row .perm-switch.on,
html body .perm-box .perm-row .perm-switch[data-state="on"],
html body .member-perm-card .perm-row .perm-switch.on,
html body .member-perm-card .perm-row .perm-switch[data-state="on"],
html body .group-manage-card .perm-row .perm-switch.on,
html body .group-manage-card .perm-row .perm-switch[data-state="on"] {
  background: #16a34a !important;
  background-color: #16a34a !important;
  border-color: #22c55e !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 0 0 2px rgba(34,197,94,.08) !important;
}
html body .perm-box .perm-row .perm-switch.off,
html body .perm-box .perm-row .perm-switch:not(.on),
html body .perm-box .perm-row .perm-switch[data-state="off"],
html body .member-perm-card .perm-row .perm-switch.off,
html body .member-perm-card .perm-row .perm-switch:not(.on),
html body .member-perm-card .perm-row .perm-switch[data-state="off"],
html body .group-manage-card .perm-row .perm-switch.off,
html body .group-manage-card .perm-row .perm-switch:not(.on),
html body .group-manage-card .perm-row .perm-switch[data-state="off"] {
  background: #dc2626 !important;
  background-color: #dc2626 !important;
  border-color: #ef4444 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 0 0 2px rgba(239,68,68,.08) !important;
}
html body .perm-switch span {
  background: #ffffff !important;
  filter: none !important;
  width: 20px !important;
  height: 20px !important;
  top: 2px !important;
}
html[dir="rtl"] body .perm-switch.on span,
html[dir="rtl"] body .perm-switch[data-state="on"] span { right: 24px !important; }
html[dir="rtl"] body .perm-switch.off span,
html[dir="rtl"] body .perm-switch:not(.on) span,
html[dir="rtl"] body .perm-switch[data-state="off"] span { right: 2px !important; }
html body .group-avatar-preview img,
html body #group-manage-avatar-preview img {
  filter: none !important;
  mix-blend-mode: normal !important;
  object-fit: cover !important;
}

/* ===== v38 fixes ===== */
.system-message-clickable{cursor:pointer;color:#93c5fd;text-decoration:none}
.system-message-clickable:hover{color:#dbeafe;background:rgba(37,99,235,.16)}
.dir-ltr{direction:ltr}

/* v41 sms queue force processing diagnostics */

/* ===== v49 granular group permissions + PWA guide ===== */
.composer-permission-notice {
  min-height: 54px;
  border-radius: 22px;
  border: 1px solid rgba(239,68,68,.22);
  background: rgba(127,29,29,.18);
  color: #fecaca;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.composer-permission-notice.hidden { display: none !important; }
.composer-circle:disabled { opacity: .35; cursor: not-allowed; filter: grayscale(1); }
.system-message-row { pointer-events: auto !important; }
.system-message-pill.system-message-clickable { pointer-events: auto !important; cursor: pointer !important; }
.pwa-guide-backdrop { z-index: 9999; background: rgba(0,0,0,.78); backdrop-filter: blur(8px); }
.pwa-guide-card {
  width: min(430px, calc(100vw - 28px));
  border-radius: 28px;
  border: 1px solid rgba(96,165,250,.28);
  background: #151820;
  color: #eef2ff;
  padding: 24px;
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
  text-align: right;
}
.pwa-guide-icon { width: 64px; height: 64px; border-radius: 22px; background: rgba(37,99,235,.16); border: 1px solid rgba(59,130,246,.28); display:flex; align-items:center; justify-content:center; font-size:32px; margin:0 auto 14px; }
.pwa-guide-card h3 { text-align:center; font-size:21px; font-weight:950; margin-bottom:8px; }
.pwa-guide-card p { color:#aeb8c8; font-size:13px; line-height:1.9; text-align:center; margin-bottom:14px; }
.pwa-guide-card ol { list-style: decimal; padding-inline-start: 22px; color:#dbeafe; font-size:13px; line-height:2.15; margin: 0 0 18px; }
.pwa-guide-close { width:100%; height:46px; border-radius:16px; background:#2563eb; color:#05070b; font-weight:950; }

/* ===== v50 phase 2/6/7 additions ===== */
.message-reaction-bar{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px;align-items:center}
.message-reaction-pill{font-size:11px;line-height:1;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.08);border-radius:999px;padding:4px 7px;color:#e5e7eb;display:inline-flex;gap:4px;align-items:center}
.message-reaction-pill.mine{background:rgba(59,130,246,.22);border-color:rgba(59,130,246,.45)}
.message-save-mark{font-size:11px;color:#fbbf24;margin-right:6px}
.message-quick-actions{display:flex;gap:4px;margin-top:5px;opacity:.0;transition:opacity .15s ease}
.message-bubble:hover .message-quick-actions{opacity:1}
.message-quick-actions button{font-size:11px;border-radius:10px;padding:4px 6px;background:rgba(255,255,255,.07);color:#d1d5db;border:1px solid rgba(255,255,255,.08)}
.admin-health-good{color:#22c55e}.admin-health-bad{color:#ef4444}

/* ===== v63 smoother UI + no sidebar/status blink ===== */
.conversation-item,
.conversation-item * {
  animation: none !important;
}
.conversation-item {
  opacity: 1 !important;
  transition: background-color .22s cubic-bezier(.22,1,.36,1), border-color .22s cubic-bezier(.22,1,.36,1), box-shadow .22s cubic-bezier(.22,1,.36,1), transform .18s cubic-bezier(.22,1,.36,1) !important;
  will-change: auto !important;
}
.conversation-item.is-updating {
  opacity: 1 !important;
  filter: none !important;
  transform: translateZ(0) !important;
}
.conversation-avatar img,
.chat-header-avatar img,
.avatar-img {
  transition: opacity .18s cubic-bezier(.22,1,.36,1) !important;
}
.app-connection-dot.updating,
.app-connection-dot.waiting,
.app-connection-dot.connected,
.app-connection-dot.offline {
  animation: none !important;
  opacity: 1 !important;
  transition: background-color .28s cubic-bezier(.22,1,.36,1), box-shadow .28s cubic-bezier(.22,1,.36,1) !important;
}
.new-message-soft .message-bubble {
  animation: newMessageSoftInV63 .24s cubic-bezier(.22,1,.36,1) both !important;
}
@keyframes newMessageSoftInV63 {
  from { opacity: .92; transform: translateY(4px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.message-highlight {
  animation: msgPulseV63 1.15s cubic-bezier(.22,1,.36,1) !important;
}
@keyframes msgPulseV63 {
  0% { box-shadow: 0 0 0 0 rgba(96,165,250,.0); }
  35% { box-shadow: 0 0 0 5px rgba(96,165,250,.18); }
  100% { box-shadow: 0 0 0 0 rgba(96,165,250,.0); }
}
@media (prefers-reduced-motion: reduce) {
  .new-message-soft .message-bubble,
  .message-highlight,
  .conversation-item,
  .app-connection-dot { animation: none !important; transition: none !important; }
}


/* ===== v64 polish: stable connection, centered reactions, no mobile text selection, pro create UI, secure media blur ===== */
#app-connection-status{display:inline-block;min-width:78px;text-align:center;transition:color .28s cubic-bezier(.22,1,.36,1)!important}
.app-connection-dot.updating,.app-connection-dot.waiting{animation:none!important;opacity:1!important;background:#22c55e!important;box-shadow:0 0 0 3px rgba(34,197,94,.14)!important}
.app-connection-dot.offline{animation:none!important}

.message-reaction-picker{gap:6px!important;padding:9px 9px 8px!important;direction:ltr!important}
.reaction-picker-btn{display:inline-flex!important;align-items:center!important;justify-content:center!important;text-align:center!important;padding:0!important;line-height:1!important;width:33px!important;height:33px!important;font-size:18px!important;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",system-ui,sans-serif!important;border-radius:12px!important;background:rgba(255,255,255,.035)!important;border:1px solid rgba(255,255,255,.06)!important}
.reaction-picker-btn:hover,.reaction-picker-btn.selected{background:rgba(56,139,255,.22)!important;transform:translateY(-1px)!important}
.message-reaction-pill span{display:inline-flex;align-items:center;justify-content:center;line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",system-ui,sans-serif!important}

#messages-container,.message-row,.message-bubble,.message-bubble *,.album-tile,.album-tile *,.message-text,.media-caption{-webkit-user-select:none!important;user-select:none!important;-webkit-touch-callout:none!important}
#message-input,#message-input *,input,textarea{user-select:text!important;-webkit-user-select:text!important;-webkit-touch-callout:default!important}

.quick-create-wrap{right:18px!important;bottom:18px!important;z-index:110!important;align-items:flex-end!important}
.quick-create-fab{width:58px!important;height:58px!important;border-radius:22px!important;background:linear-gradient(135deg,#3992ff,#1d4ed8 58%,#163a8a)!important;box-shadow:0 18px 46px rgba(37,99,235,.38), inset 0 0 0 1px rgba(255,255,255,.16)!important;border:1px solid rgba(147,197,253,.22)!important;font-size:0!important;position:relative;transition:transform .2s cubic-bezier(.22,1,.36,1),box-shadow .2s cubic-bezier(.22,1,.36,1)!important}
.quick-create-fab::before,.quick-create-fab::after{content:"";position:absolute;left:50%;top:50%;width:23px;height:3px;border-radius:10px;background:white;transform:translate(-50%,-50%)}
.quick-create-fab::after{transform:translate(-50%,-50%) rotate(90deg)}
.quick-create-fab:hover{transform:translateY(-2px);box-shadow:0 22px 55px rgba(37,99,235,.46), inset 0 0 0 1px rgba(255,255,255,.2)!important}
.quick-create-menu{min-width:210px!important;padding:10px!important;border-radius:24px!important;background:rgba(9,19,34,.96)!important;border:1px solid rgba(96,165,250,.20)!important;box-shadow:0 28px 80px rgba(0,0,0,.58)!important;backdrop-filter:blur(18px)!important;-webkit-backdrop-filter:blur(18px)!important;gap:8px!important;animation:quickCreateInV64 .18s cubic-bezier(.22,1,.36,1) both;}
@keyframes quickCreateInV64{from{opacity:0;transform:translateY(8px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}
.quick-create-menu button{height:52px!important;padding:0 12px!important;border-radius:18px!important;background:rgba(255,255,255,.045)!important;border:1px solid rgba(255,255,255,.07)!important;color:#eef6ff!important;font-size:13px!important;font-weight:950!important;justify-content:flex-start!important;transition:background .18s cubic-bezier(.22,1,.36,1), transform .18s cubic-bezier(.22,1,.36,1)!important}
.quick-create-menu button:hover{background:rgba(56,139,255,.18)!important;transform:translateX(-2px)}
.quick-create-menu-icon{width:36px!important;height:36px!important;min-width:36px!important;border-radius:15px!important;background:linear-gradient(135deg,rgba(59,130,246,.26),rgba(14,165,233,.12))!important;border:1px solid rgba(96,165,250,.16)!important}

#group-modal.create-group-pro-modal .modal-card,#group-modal .modal-card{max-width:520px!important;border-radius:28px!important;background:linear-gradient(180deg,#101d31,#091422)!important;border:1px solid rgba(96,165,250,.18)!important;box-shadow:0 32px 95px rgba(0,0,0,.66)!important;overflow:hidden!important;color:#eef6ff!important}
#group-modal .modal-card>div:first-child{padding:20px 22px!important;background:linear-gradient(135deg,rgba(56,139,255,.16),rgba(15,23,42,.24))!important;border-bottom:1px solid rgba(96,165,250,.16)!important}
#group-modal .modal-card h3{font-size:18px!important;font-weight:950!important;color:#fff!important}
#group-modal .modal-card input{height:50px!important;background:#071421!important;border:1px solid rgba(148,163,184,.18)!important;border-radius:16px!important;color:#fff!important;box-shadow:none!important;transition:border-color .18s ease,box-shadow .18s ease!important}
#group-modal .modal-card input:focus{border-color:rgba(96,165,250,.7)!important;box-shadow:0 0 0 4px rgba(59,130,246,.12)!important}
#selected-users>div{height:34px!important;background:rgba(59,130,246,.16)!important;color:#bfdbfe!important;border:1px solid rgba(96,165,250,.25)!important;border-radius:999px!important}
#group-search-results{margin-top:8px!important;border-radius:18px!important;background:#071421!important;border:1px solid rgba(148,163,184,.14)!important;overflow:hidden!important;max-height:220px!important}
#group-search-results.hidden{display:none!important}
#group-search-results .user-search-row{padding:12px!important;border-bottom:1px solid rgba(148,163,184,.08)!important;background:transparent!important;color:#f8fafc!important}
#group-search-results .user-search-row:hover{background:rgba(59,130,246,.13)!important}
#group-modal .modal-card>div:last-child{padding:16px 22px!important;background:rgba(3,7,18,.32)!important;border-top:1px solid rgba(148,163,184,.10)!important}
#group-modal .modal-card>div:last-child button{height:48px!important;border-radius:16px!important;background:linear-gradient(135deg,#3388ff,#1d4ed8)!important;color:#fff!important;font-weight:950!important;padding:0 22px!important}

.lazy-media{isolation:isolate;background:linear-gradient(135deg,#10233d,#0a1020 70%)!important;border:1px solid rgba(96,165,250,.22)!important;box-shadow:inset 0 0 0 1px rgba(255,255,255,.035)!important;transition:transform .22s cubic-bezier(.22,1,.36,1),border-color .22s ease!important}
.lazy-media.has-thumb{background-size:cover!important;background-position:center!important}
.lazy-media.has-thumb .lazy-blur{position:absolute!important;inset:-18px!important;background:inherit!important;background-size:cover!important;background-position:center!important;filter:blur(18px) saturate(.88) brightness(.78)!important;transform:scale(1.18)!important;opacity:.95!important;z-index:0!important}
.lazy-media .lazy-shade{position:absolute;inset:0;z-index:1;background:radial-gradient(circle at center,rgba(0,0,0,.10),rgba(0,0,0,.46))}
.lazy-media:not(.has-thumb)::after{content:"";position:absolute;inset:0;z-index:0;opacity:.74;background:radial-gradient(circle at 22% 24%,rgba(56,189,248,.24),transparent 30%),radial-gradient(circle at 78% 72%,rgba(99,102,241,.24),transparent 34%),linear-gradient(135deg,rgba(255,255,255,.055),transparent 55%);filter:blur(8px);transform:scale(1.04)}
.lazy-download{z-index:2!important;background:rgba(2,6,23,.68)!important;border:1px solid rgba(255,255,255,.16)!important;backdrop-filter:blur(10px)!important;-webkit-backdrop-filter:blur(10px)!important}
.lazy-media:hover{transform:translateY(-1px);border-color:rgba(96,165,250,.42)!important}
.lazy-media.loaded{box-shadow:none!important;transform:none!important}
@media(max-width:768px){.quick-create-wrap{right:14px!important;bottom:14px!important}.quick-create-menu{min-width:200px!important}.quick-create-fab{width:54px!important;height:54px!important;border-radius:20px!important}}


/* ===== v65 media-cache, gallery, folders and productivity UI ===== */
.v65-media-preview.has-thumb{background-size:cover!important;background-position:center!important;min-height:170px!important;border-color:rgba(96,165,250,.25)!important}
.v65-media-preview.has-thumb .lazy-thumb-sharp{position:absolute!important;inset:0!important;background:inherit!important;background-size:cover!important;background-position:center!important;filter:blur(2px) saturate(1.08) brightness(.86)!important;transform:scale(1.02)!important;z-index:0!important;opacity:.72!important}
.v65-media-preview.has-thumb .lazy-blur{position:absolute!important;inset:-22px!important;background:inherit!important;background-size:cover!important;background-position:center!important;filter:blur(22px) saturate(1.18) brightness(.78)!important;transform:scale(1.20)!important;z-index:0!important;opacity:.90!important}
.v65-media-preview .lazy-shade{background:linear-gradient(180deg,rgba(2,6,23,.16),rgba(2,6,23,.46))!important}
.v65-media-preview .v65-media-state{position:absolute;right:10px;bottom:8px;z-index:2;font-size:10px;font-weight:900;background:rgba(2,6,23,.62);border:1px solid rgba(255,255,255,.12);color:#dbeafe;border-radius:999px;padding:4px 8px;backdrop-filter:blur(9px)}
.v65-media-preview.cached-ready .lazy-download{display:none!important}.v65-media-preview.cached-ready .v65-media-state{background:rgba(22,163,74,.72);color:#fff}.v65-media-preview.loaded .v65-media-state{display:none!important}
.album-video-loaded{width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit}.video-preview-ready{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.18);z-index:2}
.v65-file-row{width:100%;border:1px solid rgba(148,163,184,.14);background:rgba(15,23,42,.55);border-radius:16px;padding:10px;display:flex;align-items:center;gap:10px;color:#e5eefb!important;text-align:right}.v65-file-row.cached-ready{border-color:rgba(34,197,94,.32);background:rgba(20,83,45,.18)}.v65-file-state{font-size:10px;color:#94a3b8;margin-top:3px}.v65-file-row.cached-ready .v65-file-state{color:#86efac}.v65-file-icon{width:42px;height:42px;border-radius:14px;background:rgba(59,130,246,.14);display:flex;align-items:center;justify-content:center}.v65-file-row.cached-ready .v65-file-icon{background:rgba(34,197,94,.18)}
.v65-folder-bar{display:flex;gap:7px;overflow-x:auto;padding:8px 12px 10px;border-bottom:1px solid rgba(148,163,184,.08);scrollbar-width:none}.v65-folder-bar::-webkit-scrollbar{display:none}.v65-folder-bar button{white-space:nowrap;height:32px;padding:0 12px;border-radius:999px;border:1px solid rgba(148,163,184,.12);background:rgba(255,255,255,.035);color:#9fb3cd;font-size:11px;font-weight:900}.v65-folder-bar button.active{background:linear-gradient(135deg,#3388ff,#1d4ed8);color:white;border-color:transparent;box-shadow:0 10px 28px rgba(37,99,235,.24)}
.v65-schedule-btn{font-size:22px!important;color:#dbeafe!important}.v65-schedule-btn:hover{background:rgba(59,130,246,.18)!important}.v65-modal{z-index:10020!important;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}.v65-modal-card{width:min(680px,calc(100vw - 20px))!important;max-height:min(82dvh,760px)!important;overflow:hidden!important;background:linear-gradient(180deg,#0f1d31,#071421)!important;border:1px solid rgba(96,165,250,.18)!important;border-radius:28px!important;color:#eaf3ff!important}.v65-modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid rgba(148,163,184,.12);background:rgba(59,130,246,.09)}.v65-modal-head h3{font-size:17px;font-weight:950}.v65-modal-head button{width:38px;height:38px;border-radius:13px;background:rgba(255,255,255,.06);display:flex;align-items:center;justify-content:center}.v65-modal-body{padding:18px;overflow:auto;max-height:calc(min(82dvh,760px) - 76px)}
.v65-media-panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}.v65-media-panel-head b{font-size:15px;color:#fff}.v65-media-panel-head small{display:block;color:#8ca3c1;font-size:11px;margin-top:2px}.v65-media-tabs{display:flex;gap:7px;overflow-x:auto;margin-bottom:12px}.v65-media-tabs button{height:34px;border-radius:999px;background:rgba(255,255,255,.045);border:1px solid rgba(148,163,184,.12);color:#aabbd2;font-size:11px;font-weight:850;padding:0 12px}.v65-media-tabs button.active{background:#2563eb;color:#fff;border-color:transparent}.v65-media-filters{display:grid;grid-template-columns:1.4fr .9fr .8fr auto;gap:8px;margin-bottom:14px}.v65-media-filters input,.v65-media-filters select{height:38px;border:1px solid rgba(148,163,184,.14);background:#081523;color:#fff;border-radius:12px;padding:0 10px;font-size:12px}.v65-media-filters button{height:38px;border-radius:12px;background:#e5e7eb;color:#111827;font-size:12px;font-weight:900;padding:0 12px}.v65-media-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.v65-media-grid.list{grid-template-columns:1fr}.v65-media-thumb{position:relative;height:118px;border-radius:18px!important;background-size:cover!important;background-position:center!important;overflow:hidden}.v65-media-thumb .v65-gallery-blur{position:absolute;inset:-16px;background:inherit;background-size:cover;background-position:center;filter:blur(14px) saturate(1.08);transform:scale(1.14);opacity:.95}.v65-media-thumb .v65-gallery-type{position:relative;z-index:2;width:42px;height:42px;border-radius:999px;background:rgba(2,6,23,.58);display:flex;align-items:center;justify-content:center;margin:auto}.v65-media-thumb small{position:absolute;right:8px;bottom:7px;z-index:2;max-width:80%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#e5eefb;font-size:10px;background:rgba(2,6,23,.48);padding:3px 7px;border-radius:999px}.v65-media-list-row,.v65-saved-row{width:100%;min-height:56px;display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;background:rgba(255,255,255,.04);border:1px solid rgba(148,163,184,.10);border-radius:16px;color:#eaf3ff;text-align:right;padding:10px;margin-bottom:8px}.v65-media-list-row span,.v65-saved-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.v65-media-list-row small,.v65-saved-row small{color:#8ca3c1;font-size:10px}.v65-saved-row{display:flex;flex-direction:column;align-items:flex-start}.v65-saved-row b{font-size:12px}.v65-saved-row span{white-space:normal;font-size:12px;color:#dbeafe}.v65-empty-media,.v65-loading{text-align:center;color:#8ca3c1;padding:28px 12px}.v65-cache-card{border-radius:20px;background:rgba(37,99,235,.12);border:1px solid rgba(96,165,250,.18);padding:18px;display:flex;align-items:center;justify-content:space-between;gap:12px}.v65-cache-card b{font-size:34px;color:#fff}.v65-hint{font-size:12px;color:#9fb3cd;line-height:1.9;margin:12px 0}.v65-danger-btn{height:44px;border-radius:14px;background:rgba(239,68,68,.15);border:1px solid rgba(248,113,113,.24);color:#fecaca;font-weight:900;padding:0 15px}.v65-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.v65-settings-grid button{height:48px;border-radius:15px;background:rgba(255,255,255,.045);border:1px solid rgba(148,163,184,.12);color:#eaf3ff;font-size:12px;font-weight:900}.v65-settings-grid button.active{background:#2563eb;color:#fff}.v65-compact-mode .conversation-item-clean{padding:6px!important}.v65-compact-mode .message-wrap{max-width:66%!important}.v65-compact-mode .message-bubble{padding:8px 10px!important}.v65-compact-mode .message-text{font-size:12px!important}.v65-compact-mode #messages-container{gap:8px!important;padding-top:12px!important;padding-bottom:12px!important}
@media(max-width:768px){.v65-media-filters{grid-template-columns:1fr}.v65-media-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.v65-modal-card{width:calc(100vw - 14px)!important}.v65-settings-grid{grid-template-columns:1fr}.v65-media-preview.has-thumb{min-height:150px!important}}.v66-saved-avatar,.v66-saved-chat-avatar{background:linear-gradient(135deg,#2563eb,#06b6d4)!important;color:#fff!important;width:100%;height:100%;display:flex;align-items:center;justify-content:center;border-radius:inherit}.v66-saved-chat-avatar{width:44px;height:44px;border-radius:18px}.v66-saved-empty{margin:auto;max-width:420px;text-align:center;border:1px solid rgba(96,165,250,.18);background:rgba(37,99,235,.10);border-radius:28px;padding:28px;display:flex;flex-direction:column;gap:10px;color:#dbeafe}.v66-saved-empty b{font-size:18px}.v66-saved-empty span{font-size:13px;line-height:1.9;color:#9fb3cd}.v66-folder-editor{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.v66-folder-check{min-height:48px;border-radius:16px;background:rgba(255,255,255,.045);border:1px solid rgba(148,163,184,.12);display:flex;align-items:center;gap:10px;padding:0 12px;color:#eaf3ff;font-weight:900;font-size:12px}.v66-folder-check input{width:18px;height:18px;accent-color:#2563eb}.v66-folder-check input:disabled{opacity:.5}.v66-tools-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}.v66-primary-btn,.v66-secondary-btn{height:42px;border-radius:14px;font-size:12px;font-weight:950;padding:0 15px}.v66-primary-btn{background:#2563eb;color:#fff}.v66-secondary-btn{background:rgba(148,163,184,.12);color:#dbeafe;border:1px solid rgba(148,163,184,.18)}.v66-tools-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.v66-conversation-row{min-height:58px}.v66-comfortable-mode .v66-conversation-row{min-height:68px!important;padding:12px!important;margin-top:6px!important;margin-bottom:6px!important;border-radius:22px!important}.v65-compact-mode .v66-conversation-row{min-height:48px!important;padding:6px 8px!important;margin-top:2px!important;margin-bottom:2px!important;border-radius:16px!important}.v66-comfortable-mode .message-bubble{padding:13px 15px!important;border-radius:22px!important}.v66-comfortable-mode .message-text{font-size:14px!important;line-height:1.95!important}.v66-comfortable-mode #messages-container{gap:14px!important;padding:18px 14px!important}.v66-comfortable-mode .conversation-title{font-size:14px!important}.v66-comfortable-mode .conversation-preview{font-size:11px!important;line-height:1.35!important}.v65-compact-mode #sidebar{--conv-gap:2px}.v65-compact-mode .conversation-title{font-size:12px!important}.v65-compact-mode .conversation-preview{font-size:9px!important}.v65-compact-mode .conversation-avatar{width:34px!important;height:34px!important;border-radius:14px!important}.v65-compact-mode .message-row{gap:5px!important}.v65-compact-mode .message-wrap{max-width:74%!important}.v65-compact-mode .message-bubble{padding:7px 9px!important;border-radius:16px!important}.v65-compact-mode .message-text{font-size:12px!important;line-height:1.55!important}.v65-compact-mode .message-meta{font-size:9px!important}.v65-compact-mode #messages-container{gap:6px!important;padding:10px 8px!important}.v65-compact-mode #chat-header{padding-top:8px!important;padding-bottom:8px!important}.v65-compact-mode #chat-footer{padding-top:8px!important;padding-bottom:8px!important}.v65-compact-mode .composer-input-wrap{min-height:42px!important}.v65-compact-mode .composer-circle{width:38px!important;height:38px!important}
@media(max-width:768px){.v66-folder-editor{grid-template-columns:1fr}.v66-tools-grid{grid-template-columns:1fr!important}.v66-comfortable-mode .v66-conversation-row{min-height:64px!important}.v65-compact-mode .message-wrap{max-width:82%!important}}


/* ===== v67 theme, saved chat, quick-create and voice-call fixes ===== */
#v65-schedule-btn{display:none!important}.v65-schedule-btn{display:none!important}
.quick-create-wrap{position:absolute!important;right:18px!important;left:auto!important;bottom:18px!important;z-index:220!important;align-items:flex-end!important;display:flex!important;flex-direction:column!important;gap:10px!important;pointer-events:none!important}
.quick-create-wrap>*{pointer-events:auto!important}.quick-create-menu{position:absolute!important;right:0!important;left:auto!important;bottom:72px!important;transform-origin:bottom right!important;margin:0!important}.quick-create-fab{position:relative!important;right:auto!important;left:auto!important;bottom:auto!important;margin:0!important}
@media(max-width:768px){.quick-create-wrap{right:14px!important;left:auto!important;bottom:calc(14px + env(safe-area-inset-bottom))!important}.quick-create-menu{right:0!important;bottom:66px!important;left:auto!important}}
.v67-saved-fixed-avatar,.v67-saved-list-avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:inherit;background:linear-gradient(135deg,#2563eb,#06b6d4)!important;color:#fff!important}.v67-saved-fixed-avatar{width:46px;height:46px;border-radius:18px}.v67-saved-list-avatar .ui-icon-small,.v67-saved-fixed-avatar .ui-icon-small{filter:brightness(0) invert(1)!important}
.v67-saved-row-main .conversation-avatar{background:transparent!important}.v67-saved-row-main .conversation-title{font-weight:950!important}.v67-call-btn.hidden{display:none!important}.v67-call-panel{position:fixed;inset:0;z-index:20000;display:flex;align-items:center;justify-content:center;background:rgba(2,6,23,.54);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}.v67-call-panel.hidden{display:none!important}.v67-call-card{width:min(360px,calc(100vw - 28px));border-radius:32px;background:linear-gradient(180deg,#0f1d31,#071421);border:1px solid rgba(96,165,250,.22);box-shadow:0 34px 100px rgba(0,0,0,.68);padding:28px;text-align:center;color:#eef6ff}.v67-call-pulse{width:78px;height:78px;border-radius:30px;margin:0 auto 16px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#2563eb,#06b6d4);box-shadow:0 0 0 0 rgba(59,130,246,.45);animation:v67CallPulse 1.8s infinite}.v67-call-pulse .ui-icon{filter:brightness(0) invert(1)!important;width:34px;height:34px}.v67-call-title{font-size:20px;font-weight:950;margin-bottom:6px}.v67-call-subtitle{font-size:13px;color:#b7c7dd;min-height:22px}.v67-call-actions{display:flex;gap:10px;justify-content:center;margin-top:22px}.v67-call-actions button{height:46px;border-radius:16px;padding:0 22px;font-weight:950}.v67-call-accept{background:#16a34a;color:#fff}.v67-call-end{background:#dc2626;color:#fff}@keyframes v67CallPulse{0%{box-shadow:0 0 0 0 rgba(59,130,246,.42)}70%{box-shadow:0 0 0 18px rgba(59,130,246,0)}100%{box-shadow:0 0 0 0 rgba(59,130,246,0)}}.v68-call-log-toggle{margin-top:12px;height:36px;border-radius:13px;padding:0 12px;background:rgba(148,163,184,.12);border:1px solid rgba(148,163,184,.18);color:inherit;font-weight:900;font-size:12px}.v68-call-log{margin-top:12px;max-height:150px;overflow:auto;text-align:left;direction:ltr;background:rgba(2,6,23,.32);border:1px solid rgba(148,163,184,.16);border-radius:16px;padding:10px;font-size:11px;line-height:1.55;color:#b7c7dd;white-space:pre-wrap}.v68-call-tools{display:flex;gap:8px;justify-content:center;margin-top:10px;flex-wrap:wrap}.v68-call-tools button{height:34px;border-radius:12px;padding:0 10px;background:rgba(59,130,246,.16);border:1px solid rgba(59,130,246,.22);color:inherit;font-size:11px;font-weight:900}.v68-call-debug-modal .modal-card{max-width:720px}.v68-call-debug-pre{direction:ltr;text-align:left;white-space:pre-wrap;max-height:60vh;overflow:auto;background:#07111f;color:#dbeafe;border:1px solid rgba(148,163,184,.18);border-radius:18px;padding:14px;font-size:12px;line-height:1.65}

/* ===== v70 dark-only call controls ===== */
html,body{color-scheme:dark;}
.v70-call-panel{position:fixed;inset:0;z-index:9999;display:flex;align-items:stretch;justify-content:center;background:linear-gradient(165deg,#0ea5c4 0%,#1d7fe4 55%,#172554 100%);color:#fff;direction:rtl;overflow:hidden;}
.v70-call-panel.hidden{display:none!important;}
.v70-call-panel:before{content:"";position:absolute;inset:-20%;background:radial-gradient(circle at 50% 24%,rgba(255,255,255,.24),transparent 16%),radial-gradient(circle at 25% 80%,rgba(255,255,255,.10),transparent 22%);filter:blur(6px);opacity:.7;}
.v70-call-card{position:relative;z-index:1;width:min(100%,540px);height:100%;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:calc(env(safe-area-inset-top,0px) + 52px) 22px calc(env(safe-area-inset-bottom,0px) + 32px);text-align:center;}
.v70-call-top{position:absolute;top:calc(env(safe-area-inset-top,0px) + 18px);left:18px;right:18px;display:flex;justify-content:space-between;align-items:center;pointer-events:none;}
.v70-call-top button{pointer-events:auto;width:44px;height:44px;border-radius:16px;border:1px solid rgba(255,255,255,.28);background:rgba(255,255,255,.12);color:#fff;display:grid;place-items:center;backdrop-filter:blur(12px);}
.v70-call-top button img{filter:brightness(0) invert(1)!important;width:22px;height:22px;}
.v70-call-hero{margin-top:12vh;display:flex;flex-direction:column;align-items:center;gap:16px;}
.v70-call-avatar{width:132px;height:132px;border-radius:999px;overflow:hidden;background:rgba(255,255,255,.16);border:3px solid rgba(255,255,255,.28);display:grid;place-items:center;box-shadow:0 24px 70px rgba(2,6,23,.32);}
.v70-call-avatar img{width:100%;height:100%;object-fit:cover;}
.v70-call-avatar .ui-icon{width:54px;height:54px;filter:brightness(0) invert(1)!important;}
.v70-call-name{font-size:clamp(28px,7vw,44px);line-height:1.25;font-weight:700;text-shadow:0 12px 34px rgba(0,0,0,.24);}
.v70-call-subtitle{font-size:17px;font-weight:600;opacity:.92;min-height:28px;}
.v70-call-controls{width:100%;display:grid;grid-template-columns:repeat(3,1fr);gap:18px;align-items:end;}
.v70-call-control{border:0;background:transparent;color:#fff;display:flex;flex-direction:column;align-items:center;gap:10px;font-weight:800;font-size:13px;}
.v70-call-control .v70-circle{width:70px;height:70px;border-radius:999px;display:grid;place-items:center;background:rgba(255,255,255,.18);box-shadow:0 16px 40px rgba(2,6,23,.18);backdrop-filter:blur(16px);transition:transform .18s ease,background .18s ease;}
.v70-call-control:active .v70-circle{transform:scale(.94);}
.v70-call-control img{width:30px;height:30px;filter:brightness(0) invert(1)!important;}
.v70-call-control.active .v70-circle{background:#fff;color:#1d4ed8;}
.v70-call-control.active img{filter:brightness(0) saturate(100%) invert(39%) sepia(72%) saturate(1873%) hue-rotate(200deg) brightness(94%) contrast(91%)!important;}
.v70-call-end .v70-circle{background:#ef233c!important;}
.v70-call-accept{position:absolute;bottom:calc(env(safe-area-inset-bottom,0px) + 128px);left:50%;transform:translateX(-50%);border:0;border-radius:999px;background:#22c55e;color:#fff;padding:14px 30px;font-weight:950;box-shadow:0 18px 45px rgba(34,197,94,.35);}
.v70-call-accept.hidden{display:none!important;}
.v70-call-note{position:absolute;bottom:calc(env(safe-area-inset-bottom,0px) + 118px);left:22px;right:22px;font-size:12px;opacity:.72;}
.v70-call-log-toggle{position:absolute;top:calc(env(safe-area-inset-top,0px) + 18px);right:18px;border:1px solid rgba(255,255,255,.28);background:rgba(255,255,255,.12);color:#fff;border-radius:14px;padding:10px 12px;font-weight:800;}
.v68-call-log,.v68-call-tools{position:absolute;left:18px;right:18px;bottom:calc(env(safe-area-inset-bottom,0px) + 124px);max-height:30vh;overflow:auto;text-align:left;direction:ltr;background:rgba(2,6,23,.72);border:1px solid rgba(255,255,255,.18);border-radius:16px;padding:12px;color:#dbeafe;font-size:11px;}
.v68-call-tools{bottom:calc(env(safe-area-inset-bottom,0px) + 80px);display:flex;gap:8px;justify-content:center;direction:rtl;background:transparent;border:0;padding:0;}
.v68-call-tools.hidden,.v68-call-log.hidden{display:none!important;}
@media(max-width:560px){.v70-call-card{padding-left:18px;padding-right:18px}.v70-call-controls{gap:10px}.v70-call-control .v70-circle{width:62px;height:62px}.v70-call-avatar{width:112px;height:112px}}
.v70-call-panel.v70-minimized{inset:auto 16px calc(env(safe-area-inset-bottom,0px) + 16px) auto;width:86px;height:86px;border-radius:999px;background:#0f172a;box-shadow:0 22px 60px rgba(0,0,0,.35);overflow:hidden;}
.v70-call-panel.v70-minimized:before,.v70-call-panel.v70-minimized .v70-call-hero,.v70-call-panel.v70-minimized .v70-call-controls,.v70-call-panel.v70-minimized .v70-call-log-toggle,.v70-call-panel.v70-minimized .v68-call-log,.v70-call-panel.v70-minimized .v68-call-tools,.v70-call-panel.v70-minimized #v67-call-accept{display:none!important;}
.v70-call-panel.v70-minimized .v70-call-card{padding:0;display:grid;place-items:center;width:100%;height:100%;}
.v70-call-panel.v70-minimized .v70-call-top{position:static;display:grid;place-items:center;}
.v70-call-panel.v70-minimized #v70-call-minimize{width:86px;height:86px;border:0;border-radius:999px;background:rgba(255,255,255,.08);}
