/* BearCord original stylesheet; preserved in source order. */
:root {
      --bg: #09090b;
      --surface: #111114;
      --surface-2: #18181c;
      --surface-3: #202026;
      --surface-4: #2a2a31;
      --line: rgba(255, 255, 255, 0.07);
      --line-2: rgba(255, 255, 255, 0.12);
      --text: #f4f4f5;
      --text-2: #a1a1aa;
      --text-3: #71717a;
      --accent: #ffd60a;
      --accent-2: #ffb800;
      --accent-ink: #151100;
      --accent-soft: rgba(255, 214, 10, 0.12);
      --accent-line: rgba(255, 214, 10, 0.38);
      --accent-glow: rgba(255, 214, 10, 0.28);
      --accent-grad: linear-gradient(135deg, #ffe14d 0%, #ffd60a 45%, #ffb800 100%);
      --online: #34d399;
      --away: #fbbf24;
      --dnd: #f87171;
      --offline: #52525b;
      --danger: #ff5a5f;
      --bubble-in: #1c1c21;
      --r-xs: 8px;
      --r-sm: 12px;
      --r-md: 16px;
      --r-lg: 22px;
      --r-xl: 28px;
      --sidebar-w: 380px;
      --ease: cubic-bezier(0.22, 1, 0.36, 1);
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
    }
    * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
    ::selection { background: var(--accent); color: var(--accent-ink); }
    html, body { height: 100%; overflow: hidden; }
    body { background: var(--bg); color: var(--text); height: 100vh; height: 100dvh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overscroll-behavior: none; font-size: 15px; }
    button { font: inherit; color: inherit; }
    a { color: inherit; }
    #app { width: 100%; height: 100%; position: relative; }
    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(255, 214, 10, 0.45); background-clip: content-box; border: 2px solid transparent; }

    .av-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
    .av { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-3); flex-shrink: 0; }
    .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .av .av-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.05em; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
    .av-wrap.sm .av { width: 34px; height: 34px; font-size: 13px; }
    .av-wrap.md .av { width: 42px; height: 42px; font-size: 15px; }
    .av-wrap.lg .av { width: 48px; height: 48px; font-size: 17px; }
    .av-wrap.xl .av { width: 72px; height: 72px; font-size: 26px; }
    .av-wrap.ring .av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

    .status-indicator { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--bg); box-sizing: content-box; transition: background 0.25s; }
    .av-wrap.sm .status-indicator { width: 10px; height: 10px; border-width: 2px; }
    .av-wrap.xl .status-indicator { width: 16px; height: 16px; border-width: 4px; right: 0; bottom: 0; }
    .status-indicator.online { background: var(--online); }
    .status-indicator.away { background: var(--away); }
    .status-indicator.dnd { background: var(--dnd); }
    .status-indicator.dnd::after { content: ''; position: absolute; left: 50%; top: 50%; width: 55%; height: 2px; background: var(--bg); transform: translate(-50%, -50%); border-radius: 2px; }
    .status-indicator.offline { background: var(--offline); }
    .sidebar .status-indicator { border-color: var(--surface); }
    .room-item:hover .status-indicator { border-color: var(--surface-2); }
    .room-item.active .status-indicator { border-color: #1d1b10; }
    .status-text.online { color: var(--online); }
    .status-text.away { color: var(--away); }
    .status-text.dnd { color: var(--dnd); }
    .status-text.offline { color: var(--text-3); }

    .icon-btn { width: 38px; height: 38px; border-radius: var(--r-sm); border: none; background: transparent; color: var(--text-2); font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background 0.18s, color 0.18s, transform 0.12s; flex-shrink: 0; }
    .icon-btn:hover { background: var(--surface-3); color: var(--text); }
    .icon-btn:active { transform: scale(0.92); }
    .icon-btn.accent:hover { background: var(--accent-soft); color: var(--accent); }
    .icon-btn.danger:hover { background: rgba(255, 90, 95, 0.14); color: var(--danger); }

    .btn { border: none; border-radius: var(--r-md); padding: 13px 18px; font-size: 14.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.12s, box-shadow 0.2s, background 0.2s, opacity 0.2s; }
    .btn:active { transform: scale(0.98); }
    .btn:disabled { opacity: 0.55; cursor: default; }
    .btn.primary { background: var(--accent-grad); color: var(--accent-ink); box-shadow: 0 6px 22px rgba(255, 214, 10, 0.25); }
    .btn.primary:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(255, 214, 10, 0.4); transform: translateY(-1px); }
    .btn.secondary { background: var(--surface-3); color: var(--text); }
    .btn.secondary:hover { background: var(--surface-4); }
    .btn.danger { background: var(--danger); color: #fff; }
    .btn.danger:hover { filter: brightness(1.08); }

    .auth-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; background: radial-gradient(900px 500px at 15% -10%, rgba(255, 214, 10, 0.16), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(255, 184, 0, 0.1), transparent 60%), var(--bg); }
    .auth-container::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px); background-size: 26px 26px; mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%); pointer-events: none; }
    .auth-card { width: 420px; max-width: 100%; background: rgba(20, 20, 24, 0.72); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 36px 32px 30px; position: relative; z-index: 1; box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 80px rgba(255, 214, 10, 0.07), inset 0 1px 0 rgba(255,255,255,0.06); animation: popIn 0.55s var(--ease); }
    @keyframes popIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: none; } }
    .auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 26px; }
    .auth-logo { width: 76px; height: 76px; border-radius: 24px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 34px; color: var(--accent-ink); box-shadow: 0 14px 40px rgba(255, 214, 10, 0.3), inset 0 1px 0 rgba(255,255,255,0.4); margin-bottom: 16px; }
    .auth-logo img { width: 100%; height: 100%; object-fit: cover; }
    .auth-brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.8px; }
    .auth-brand h1 span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    .auth-brand p { color: var(--text-2); font-size: 14px; margin-top: 6px; }

    .segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; margin-bottom: 22px; position: relative; }
    .segmented button { border: none; background: none; cursor: pointer; padding: 10px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: all 0.25s var(--ease); position: relative; z-index: 1; }
    .segmented button.active { background: var(--surface-4); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,0.35); }

    .field { margin-bottom: 14px; }
    .field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; letter-spacing: 0.2px; }
    .field .control { position: relative; }
    .field .control > i.lead { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 14px; pointer-events: none; transition: color 0.2s; }
    .field .control:focus-within > i.lead { color: var(--accent); }
    .field input, .modal input[type=text], .modal input[type=password] { width: 100%; padding: 13px 16px 13px 42px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); font-size: 15px; outline: none; transition: border 0.2s, box-shadow 0.2s, background 0.2s; }
    .modal input[type=text], .modal input[type=password] { padding-left: 16px; margin-bottom: 14px; }
    .field input:focus, .modal input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-3); }
    .field input::placeholder, .modal input::placeholder { color: var(--text-3); }
    .field .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: none; background: none; color: var(--text-3); cursor: pointer; border-radius: 10px; }
    .field .eye:hover { color: var(--text); background: var(--surface-4); }

    .auth-error { display: none; align-items: center; gap: 8px; background: rgba(255, 90, 95, 0.1); border: 1px solid rgba(255, 90, 95, 0.3); color: #ff8a8e; padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 14px; }
    .auth-error:not(:empty) { display: flex; }
    .auth-card .btn.primary { width: 100%; margin-top: 6px; padding: 14px; }

    .main-layout { display: flex; width: 100%; height: 100%; background: var(--bg); }

    .sidebar { width: var(--sidebar-w); min-width: 300px; height: 100%; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0; position: relative; z-index: 5; }
    .sidebar-header { padding: calc(16px + var(--safe-top)) 16px 10px 20px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
    .brand-logo { width: 36px; height: 36px; border-radius: 11px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--accent-ink); font-size: 17px; box-shadow: 0 4px 16px rgba(255, 214, 10, 0.25); flex-shrink: 0; }
    .brand-logo img { width: 100%; height: 100%; object-fit: cover; }
    .brand-text { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
    .brand-text-wrap { display: flex; flex-direction: column; min-width: 0; }
    .connection-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-3); line-height: 1; margin-top: 3px; }
    .connection-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--online); box-shadow: 0 0 8px var(--online); animation: pulse 2.4s ease-in-out infinite; }
    .connection-badge.offline .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: none; }
    /* жёлтый крутящийся кружок при подключении */
.connection-badge.connecting {
  color: var(--away);
}

.connection-badge.connecting .dot {
  background: transparent;
  border: 2px solid var(--away);
  border-top-color: transparent;
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  box-shadow: none;
  animation: ws-spin 0.8s linear infinite;
}

@keyframes ws-spin {
  to { transform: rotate(360deg); }
}
    @keyframes pulse { 50% { opacity: 0.45; } }

    .sidebar-search { padding: 8px 16px 6px; flex-shrink: 0; }
    .search-wrapper { position: relative; }
    .search-wrapper i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
    .search-wrapper input { width: 100%; padding: 11px 14px 11px 38px; border-radius: 14px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; transition: border 0.2s, box-shadow 0.2s, background 0.2s; }
    .search-wrapper input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-3); }
    .search-wrapper input::placeholder { color: var(--text-3); }

    .filter-tabs { display: flex; gap: 6px; padding: 8px 16px 8px; flex-shrink: 0; }
    .filter-tabs button { border: none; background: transparent; color: var(--text-2); padding: 7px 13px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
    .filter-tabs button:hover { background: var(--surface-2); color: var(--text); }
    .filter-tabs button.active { background: var(--accent-soft); color: var(--accent); }
    .filter-tabs .tab-count { font-size: 11px; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 1px 6px; font-weight: 700; }

    .room-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
    .room-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px; border-radius: 16px; cursor: pointer; transition: background 0.15s; position: relative; }
    .room-item:hover { background: var(--surface-2); }
    .room-item.active { background: linear-gradient(90deg, rgba(255,214,10,0.14), rgba(255,214,10,0.05)); }
    .room-item.active::before { content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
    .room-item .info { flex: 1; min-width: 0; }
    .room-item .row-top { display: flex; align-items: center; gap: 8px; }
    .room-item .name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .room-item .time { font-size: 11.5px; color: var(--text-3); flex-shrink: 0; }
    .room-item .row-bottom { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
    .room-item .preview { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .room-item .preview.has-unread { color: var(--text); }
    .room-item .unread { background: var(--accent-grad); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; min-width: 21px; height: 21px; padding: 0 7px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 14px var(--accent-glow); flex-shrink: 0; }

    .list-empty { text-align: center; padding: 50px 20px; color: var(--text-3); font-size: 14px; }
    .list-empty i { font-size: 34px; opacity: 0.35; display: block; margin-bottom: 12px; }

    .sidebar-user { padding: 12px 14px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-shrink: 0; background: var(--surface); }
    .sidebar-user .user-info { flex: 1; min-width: 0; cursor: pointer; border-radius: 12px; padding: 2px 4px; transition: background 0.15s; }
    .sidebar-user .user-info:hover { background: var(--surface-2); }
    .sidebar-user .user-nick { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-user .user-status { font-size: 12px; margin-top: 1px; }
    .sidebar-user .user-actions { display: flex; gap: 2px; }
    .sidebar-user .user-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

    .chat-area { flex: 1; min-width: 0; position: relative; display: flex; }
    .chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: radial-gradient(800px 420px at 85% -5%, rgba(255, 214, 10, 0.07), transparent 60%), radial-gradient(600px 420px at 0% 100%, rgba(255, 184, 0, 0.05), transparent 60%), var(--bg); }
    .chat-pane::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent); }

    .chat-header { padding: calc(12px + var(--safe-top)) 20px 12px; display: flex; align-items: center; gap: 12px; background: rgba(12, 12, 14, 0.72); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); border-bottom: 1px solid var(--line); flex-shrink: 0; min-height: 68px; position: relative; z-index: 3; }
    .back-btn { display: none; }
    .chat-info { flex: 1; min-width: 0; }
    .chat-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.2px; }
    .chat-status { font-size: 12.5px; color: var(--text-2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
    .badge { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
    .chat-actions { display: flex; gap: 2px; }


.bubble.call-event-end {
  background: rgba(255, 90, 95, 0.1);
  border-color: rgba(255, 90, 95, 0.35);
  color: #ff8a8e;
}
.msg-row.self .bubble.call-event-end {
  background: rgba(255, 90, 95, 0.1);
  border-color: rgba(255, 90, 95, 0.35);
  color: #ff8a8e;
}


    .bubble.call-event {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 18px;
  box-shadow: none;
}
.msg-row.self .bubble.call-event {
  background: var(--accent-soft);
  color: var(--accent);
}
.call-event-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
    
    .messages-container { flex: 1; overflow-y: auto; padding: 12px 24px 14px; display: flex; flex-direction: column; position: relative; z-index: 1; }
    .messages-container .spacer { flex: 1; }
    .date-divider { display: flex; justify-content: center; position: sticky; top: 8px; z-index: 4; margin: 14px 0 8px; pointer-events: none; }
    .date-pill { background: rgba(24, 24, 28, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text-2); }

    .msg-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; animation: msgIn 0.28s var(--ease); }
    .msg-row.new-group { margin-top: 12px; }
    .msg-row.self { justify-content: flex-end; }
    @keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
    .msg-avatar-slot { width: 34px; flex-shrink: 0; align-self: flex-end; }
    .msg-stack { display: flex; flex-direction: column; align-items: flex-start; max-width: min(74%, 580px); min-width: 0; }
    .msg-row.self .msg-stack { align-items: flex-end; }
    .bubble { position: relative; padding: 8px 12px 7px; border-radius: 20px; background: var(--bubble-in); border: 1px solid var(--line); color: var(--text); font-size: 15px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; min-width: 0; max-width: 100%; cursor: context-menu; transition: filter 0.15s, transform 0.12s; }
    .bubble:active { transform: scale(0.99); }
    .msg-row:not(.self) .bubble.gp { border-top-left-radius: 6px; }
    .msg-row:not(.self) .bubble.gn { border-bottom-left-radius: 6px; }
    .msg-row.self .bubble.gp { border-top-right-radius: 6px; }
    .msg-row.self .bubble.gn { border-bottom-right-radius: 6px; }
    .msg-row.self .bubble { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 22px rgba(255, 184, 0, 0.14); }
    .msg-row.self .bubble a { color: #3d2e00; text-decoration-color: rgba(61, 46, 0, 0.5); }
    .bubble a { color: var(--accent); text-underline-offset: 2px; word-break: break-all; }
    .bubble.deleted { background: transparent; border: 1px dashed var(--line-2); color: var(--text-3); box-shadow: none; font-style: italic; font-size: 13.5px; }
    .msg-row.self .bubble.deleted { background: transparent; color: var(--text-3); }
    .b-author { font-size: 13px; font-weight: 700; margin-bottom: 2px; letter-spacing: -0.1px; }
    .b-text { white-space: pre-wrap; -webkit-user-select: text; user-select: text; }
    .b-meta { font-size: 11px; opacity: 0.6; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; float: right; margin: 7px 0 -3px 12px; line-height: 1; white-space: nowrap; -webkit-user-select: none; user-select: none; }
    .b-meta.block { float: none; display: flex; justify-content: flex-end; margin: 4px 2px 0; }
    .msg-row.self .b-meta { opacity: 0.65; }
    .bubble.media { padding: 4px; }
    .bubble.media .b-author { padding: 4px 8px 2px; }
    .bubble.media .b-text { padding: 4px 8px 2px; }
    .bubble.media .b-meta.block { padding: 0 6px 3px; }
    .bubble.media img { display: block; max-width: 340px; max-height: 340px; width: 100%; border-radius: 16px; cursor: zoom-in; object-fit: cover; -webkit-user-select: none; user-select: none; transition: filter 0.2s; }
    .bubble.media img:hover { filter: brightness(1.08); }
    .bubble.media video { display: block; max-width: 340px; max-height: 340px; width: 100%; border-radius: 16px; background: #000; }
    .bubble.media audio { display: block; width: 280px; max-width: 100%; margin: 4px; }

    .file-attachment { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; margin: 2px; border-radius: 16px; text-decoration: none; background: rgba(0,0,0,0.22); min-width: 220px; max-width: 320px; transition: background 0.2s; }
    .msg-row:not(.self) .file-attachment { background: rgba(255,255,255,0.05); }
    .file-attachment:hover { background: rgba(0,0,0,0.32); }
    .msg-row:not(.self) .file-attachment:hover { background: rgba(255,255,255,0.09); }
    .file-icon { width: 44px; height: 44px; border-radius: 13px; background: rgba(0,0,0,0.78); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
    .msg-row:not(.self) .file-icon { background: var(--accent-soft); }
    .file-info { min-width: 0; }
    .file-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .file-size { font-size: 12px; opacity: 0.65; margin-top: 2px; }

    .msg-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
    .msg-row.self .msg-reactions { justify-content: flex-end; }
    .reaction { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 3px 9px 3px 8px; font-size: 14px; cursor: pointer; transition: all 0.18s var(--ease); -webkit-user-select: none; user-select: none; }
    .reaction:hover { border-color: var(--accent-line); transform: translateY(-1px); }
    .reaction.mine { background: var(--accent-soft); border-color: var(--accent-line); }
    .reaction .count { font-size: 12px; font-weight: 700; color: var(--text-2); }
    .reaction.mine .count { color: var(--accent); }

    .msg-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
    .msg-skeleton div { height: 40px; border-radius: 18px; width: 52%; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
    .msg-skeleton div:nth-child(even) { align-self: flex-end; width: 38%; }
    .msg-skeleton div:nth-child(3) { width: 64%; height: 56px; }
    @keyframes shimmer { to { background-position: -200% 0; } }

    .chat-empty { margin: auto; text-align: center; color: var(--text-3); padding: 40px 20px; }
    .chat-empty .big { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 28px; }
    .chat-empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

    .composer { padding: 8px 20px calc(14px + var(--safe-bottom)); position: relative; z-index: 3; flex-shrink: 0; }
    .edit-banner { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--accent-line); border-radius: var(--r-md) var(--r-md) 6px 6px; padding: 9px 10px 9px 14px; margin-bottom: 6px; animation: msgIn 0.25s var(--ease); }
    .edit-banner[hidden] { display: none; }
    .edit-banner .eb-icon { color: var(--accent); font-size: 14px; }
    .edit-banner .eb-body { flex: 1; min-width: 0; }
    .edit-banner .eb-title { font-size: 12px; font-weight: 700; color: var(--accent); }
    .edit-banner .eb-text { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .composer-row { display: flex; align-items: flex-end; gap: 8px; }
    .c-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(24, 24, 28, 0.85); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--text-2); font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
    .c-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--surface-3); }
    .c-btn:active { transform: scale(0.92); }

    .c-field { flex: 1; display: flex; align-items: flex-end; background: rgba(24, 24, 28, 0.85); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line-2); border-radius: 24px; padding: 0 6px 0 18px; transition: border 0.2s, box-shadow 0.2s; }
    .c-field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
    .c-field textarea { flex: 1; background: none; border: none; outline: none; resize: none; color: var(--text); font-size: 15px; line-height: 1.45; padding: 12px 0; max-height: 140px; min-height: 46px; }
    .c-field textarea::placeholder { color: var(--text-3); }
    .c-field .emoji-btn { width: 40px; height: 44px; border: none; background: none; color: var(--text-3); font-size: 19px; cursor: pointer; border-radius: 50%; transition: color 0.2s; flex-shrink: 0; }
    .c-field .emoji-btn:hover { color: var(--accent); }

    .send-btn { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--surface-3); color: var(--text-3); font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.25s var(--ease); flex-shrink: 0; }
    .send-btn.ready { background: var(--accent-grad); color: var(--accent-ink); box-shadow: 0 6px 22px rgba(255, 214, 10, 0.35); }
    .send-btn.ready:hover { transform: translateY(-1px) scale(1.04); box-shadow: 0 8px 28px rgba(255, 214, 10, 0.5); }
    .send-btn.ready:active { transform: scale(0.92); }
    .send-btn i { transform: translateX(-1px); }

    .emoji-picker { position: absolute; bottom: calc(100% - 4px); right: 76px; width: 312px; max-height: 260px; overflow-y: auto; background: rgba(28, 28, 33, 0.92); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); border: 1px solid var(--line-2); border-radius: 20px; padding: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); animation: menuIn 0.18s var(--ease); transform-origin: bottom right; z-index: 20; }
    .emoji-picker button { background: none; border: none; font-size: 22px; padding: 6px 0; cursor: pointer; border-radius: 10px; transition: transform 0.12s, background 0.12s; }
    .emoji-picker button:hover { background: var(--accent-soft); transform: scale(1.18); }

    .scroll-bottom-btn { position: absolute; right: 24px; bottom: calc(92px + var(--safe-bottom)); width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text); font-size: 15px; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: popIn 0.25s var(--ease); transition: background 0.2s, color 0.2s; }
    .scroll-bottom-btn:hover { background: var(--accent); color: var(--accent-ink); }
    .scroll-bottom-btn .unread-bubble { position: absolute; top: -7px; right: -5px; background: var(--accent-grad); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 10px; border: 2px solid var(--bg); }

    .drop-overlay { position: absolute; inset: 12px; z-index: 30; border: 2px dashed var(--accent-line); border-radius: var(--r-xl); background: rgba(9, 9, 11, 0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--accent); font-weight: 700; font-size: 17px; pointer-events: none; }
    .drop-overlay i { font-size: 38px; }
    .drop-overlay.show { display: flex; }

    .chat-actions .call-btn { color: var(--text-2); }
    .chat-actions .call-btn:hover { color: var(--accent); background: var(--accent-soft); }

    /* ===== CALL UI ===== */
    .call-overlay { position: fixed; inset: 0; z-index: 6000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); animation: fadeIn .2s ease; }
    .call-card { position: relative; overflow: hidden; width: 400px; max-width: 100%; height: min(700px, 92dvh); border-radius: 32px; border: 1px solid var(--line-2); background: #0c0c0f; box-shadow: 0 40px 110px rgba(0,0,0,.8), 0 0 80px rgba(255,214,10,.08); display: flex; flex-direction: column; align-items: center; animation: modalIn .4s var(--ease); isolation: isolate; }
    .call-bg { position: absolute; inset: -40px; z-index: -3; background: radial-gradient(500px 340px at 50% 0%, rgba(255,214,10,.22), transparent 65%), #101014; background-size: cover; background-position: center; filter: blur(46px) saturate(1.5); transform: scale(1.2); opacity: .75; }
    .call-shade { position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.15) 40%, rgba(0,0,0,.7) 100%); }
    .call-remote { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .4s; }
    .call-overlay.has-video .call-remote { opacity: 1; }
    .call-overlay.has-video .call-avatar-wrap, .call-overlay.has-video .call-bg { display: none; }
    .call-overlay.has-video .call-center { margin-top: 0; margin-bottom: auto; align-self: flex-start; align-items: flex-start; text-align: left; padding: 8px 22px; }
    .call-overlay.has-video .call-name { font-size: 18px; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
    .call-overlay.has-video .call-status { text-shadow: 0 2px 10px rgba(0,0,0,.6); }
    .call-top { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 0; font-size: 12px; font-weight: 700; }
    .call-kind { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,.1); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--accent); letter-spacing: .4px; }
    .call-lock { color: rgba(255,255,255,.55); font-weight: 600; }
    .call-lock i { font-size: 10px; margin-right: 4px; }
    .call-center { margin-top: auto; margin-bottom: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 20px; }
    .call-avatar-wrap { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
    .call-avatar { position: relative; z-index: 2; width: 132px; height: 132px; border-radius: 50%; overflow: hidden; background: var(--surface-3); box-shadow: 0 0 0 4px rgba(255,255,255,.12), 0 20px 50px rgba(0,0,0,.55); }
    .call-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .call-avatar .av-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: 800; background: var(--accent-grad); color: var(--accent-ink); }
    .call-avatar-wrap .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; z-index: 1; animation: callRing 2.4s ease-out infinite; }
    .call-avatar-wrap .ring.r2 { animation-delay: 1.2s; }
    .call-overlay.connected .ring { animation: none; opacity: 0; }
    @keyframes callRing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.7); opacity: 0; } }
    .call-name { font-size: 26px; font-weight: 800; letter-spacing: -.6px; }
    .call-status { margin-top: 8px; color: rgba(255,255,255,.7); font-size: 14px; }
    .call-timer { margin-top: 6px; color: var(--accent); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 20px; }
    .call-local { position: absolute; right: 16px; top: 74px; width: 108px; height: 150px; object-fit: cover; border-radius: 18px; background: #000; border: 2px solid rgba(255,255,255,.2); box-shadow: 0 12px 32px rgba(0,0,0,.6); transform: scaleX(-1); z-index: 3; }
    .call-controls { display: flex; justify-content: center; gap: 16px; padding: 18px 22px; margin: 0 18px 18px; border-radius: 30px; background: rgba(24,24,28,.6); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); border: 1px solid var(--line-2); }
    .call-control { width: 58px; height: 58px; border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; transition: all .2s var(--ease); }
    .call-control:hover { background: rgba(255,255,255,.2); transform: translateY(-2px); }
    .call-control:active { transform: scale(.92); }
    .call-control.active { background: #fff; color: #111; }
    .call-control.end { background: var(--danger); box-shadow: 0 8px 26px rgba(255,90,95,.45); }
    .call-control.end:hover { background: var(--danger); filter: brightness(1.1); }
    .call-actions { display: flex; justify-content: space-around; width: 100%; padding: 18px 28px 34px; }
    .call-act { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.8); }
    .call-round { width: 70px; height: 70px; border-radius: 50%; border: none; cursor: pointer; font-size: 24px; color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
    .call-round:active { transform: scale(.92); }
    .call-round.end { background: var(--danger); box-shadow: 0 10px 30px rgba(255,90,95,.45); }
    .call-round.accept { background: var(--online); color: #04210f; box-shadow: 0 10px 30px rgba(52,211,153,.45); animation: acceptWiggle 1.6s ease-in-out infinite; }
    @keyframes acceptWiggle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }

    @media (max-width: 768px) {
      .call-overlay { padding: 0; }
      .call-card { width: 100%; height: 100%; max-height: none; border-radius: 0; border: none; }
      .call-top { padding-top: calc(20px + var(--safe-top)); }
      .call-controls { margin-bottom: calc(18px + var(--safe-bottom)); }
      .call-actions { padding-bottom: calc(34px + var(--safe-bottom)); }
      .call-local { top: calc(74px + var(--safe-top)); }
    }

    .empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px; text-align: center; position: relative; z-index: 1; background: radial-gradient(700px 420px at 50% 40%, rgba(255, 214, 10, 0.08), transparent 65%), var(--bg); }
    .empty-state .icon { width: 96px; height: 96px; border-radius: 30px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; font-size: 42px; color: var(--accent-ink); overflow: hidden; box-shadow: 0 20px 60px rgba(255, 214, 10, 0.3), inset 0 2px 0 rgba(255,255,255,0.4); animation: floaty 5s ease-in-out infinite; }
    .empty-state .icon img { width: 100%; height: 100%; object-fit: cover; }
    @keyframes floaty { 50% { transform: translateY(-10px) rotate(2deg); } }
    .empty-state .title { font-size: 24px; font-weight: 800; letter-spacing: -0.6px; margin-top: 8px; }
    .empty-state .desc { font-size: 14.5px; color: var(--text-2); max-width: 360px; line-height: 1.6; }
    .empty-state .hint { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
    .kbd { background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px; padding: 2px 8px; border-radius: 7px; font-size: 12px; color: var(--text-2); font-family: ui-monospace, monospace; margin-right: 6px; }

    .modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.2s ease; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    .modal { width: 460px; max-width: 100%; max-height: 90vh; max-height: 90dvh; overflow-y: auto; background: rgba(22, 22, 26, 0.95); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 26px 24px 24px; box-shadow: 0 30px 90px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05); animation: modalIn 0.35s var(--ease); }
    @keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
    .modal h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
    .modal-icon { width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px; }
    .modal-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.55; margin-bottom: 20px; }
    .modal label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
    .btn-row { display: flex; gap: 10px; margin-top: 8px; }
    .btn-row .btn { flex: 1; }

    .confirm { text-align: center; padding: 6px 4px 0; }
    .confirm-icon { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--accent-soft); color: var(--accent); }
    .confirm-icon.danger { background: rgba(255, 90, 95, 0.14); color: var(--danger); }
    .confirm h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
    .confirm p { font-size: 14px; color: var(--text-2); line-height: 1.5; margin-bottom: 20px; }

    .profile-hero { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
    .profile-hero .name { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
    .profile-hero .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

    .status-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
    .status-selector button { padding: 11px 12px; border-radius: 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 9px; transition: all 0.2s; }
    .status-selector button:hover { border-color: var(--line-2); color: var(--text); }
    .status-selector button.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
    .status-selector .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .status-selector .dot.online { background: var(--online); }
    .status-selector .dot.away { background: var(--away); }
    .status-selector .dot.dnd { background: var(--dnd); }
    .status-selector .dot.offline { background: var(--offline); }

    .search-results { max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
    .user-result { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; transition: background 0.15s; }
    .user-result:hover { background: var(--accent-soft); }
    .user-result .nick { font-size: 14.5px; font-weight: 600; }
    .user-result .login { font-size: 12.5px; color: var(--text-3); }
    .user-result .status-indicator { border-color: #161619; }

    .context-menu { position: fixed; z-index: 4000; min-width: 220px; background: rgba(28, 28, 33, 0.92); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--line-2); border-radius: 18px; padding: 6px; box-shadow: 0 24px 70px rgba(0,0,0,0.7); animation: menuIn 0.18s var(--ease); transform-origin: top left; }
    @keyframes menuIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
    .ctx-reactions { display: flex; justify-content: space-between; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
    .ctx-reactions button { width: 36px; height: 36px; border: none; background: none; font-size: 21px; cursor: pointer; border-radius: 12px; transition: transform 0.15s var(--ease), background 0.15s; }
    .ctx-reactions button:hover { background: var(--accent-soft); transform: scale(1.22); }
    .ctx-reactions button.mine { background: var(--accent-soft); }
    .context-menu .ctx-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; background: none; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; border-radius: 12px; color: var(--text); transition: background 0.15s, color 0.15s; }
    .context-menu .ctx-item i { width: 18px; text-align: center; font-size: 14px; color: var(--text-2); }
    .context-menu .ctx-item:hover { background: var(--surface-4); }
    .context-menu .ctx-item.danger, .context-menu .ctx-item.danger i { color: var(--danger); }
    .context-menu .ctx-item.danger:hover { background: rgba(255, 90, 95, 0.12); }

    .toast-container { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(26px + var(--safe-bottom)); z-index: 7000; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 28px); pointer-events: none; }
    .toast { display: flex; align-items: center; gap: 10px; background: rgba(32, 32, 38, 0.92); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--line-2); border-radius: 16px; padding: 11px 16px; font-size: 13.5px; font-weight: 500; box-shadow: 0 14px 40px rgba(0,0,0,0.55); animation: toastIn 0.35s var(--ease); pointer-events: auto; }
    .toast i { font-size: 15px; color: var(--accent); }
    .toast.error i { color: var(--danger); }
    .toast.success i { color: var(--online); }
    .toast.out { opacity: 0; transform: translateY(10px) scale(0.96); transition: all 0.28s; }
    @keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: none; } }

    .ios-notifications-container { position: fixed; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 7100; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 410px; padding: 0 12px; pointer-events: none; }
    .ios-notification { background: rgba(34, 34, 40, 0.78); -webkit-backdrop-filter: blur(40px) saturate(200%); backdrop-filter: blur(40px) saturate(200%); border-radius: 22px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 16px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08); pointer-events: auto; cursor: pointer; position: relative; overflow: hidden; animation: iosIn 0.5s var(--ease); }
    @keyframes iosIn { from { opacity: 0; transform: translateY(-34px) scale(0.92); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
    .ios-notification.dismiss { animation: iosOut 0.35s var(--ease) forwards; }
    @keyframes iosOut { to { opacity: 0; transform: translateY(-26px) scale(0.94); filter: blur(6px); } }
    .notif-icon { width: 42px; height: 42px; border-radius: 12px; overflow: hidden; flex-shrink: 0; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); }
    .notif-icon img { width: 100%; height: 100%; object-fit: cover; }
    .notif-body { flex: 1; min-width: 0; }
    .notif-app { font-size: 10.5px; font-weight: 700; letter-spacing: 0.7px; color: var(--accent); margin-bottom: 2px; }
    .notif-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .notif-text { font-size: 13px; color: rgba(255,255,255,0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .notif-time { font-size: 11px; color: rgba(255,255,255,0.45); align-self: flex-start; }
    .notif-close { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,0.5); color: rgba(255,255,255,0.7); font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
    .ios-notification:hover .notif-close { opacity: 1; }

    .pwa-prompt { position: fixed; left: 24px; bottom: calc(24px + var(--safe-bottom)); z-index: 1900; background: rgba(30,30,36,0.92); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 16px; max-width: 350px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); display: flex; gap: 12px; align-items: flex-start; animation: popIn 0.4s var(--ease); }
    .pwa-icon { width: 44px; height: 44px; border-radius: 13px; background: var(--accent-grad); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; font-size: 19px; }
    .pwa-icon img { width: 100%; height: 100%; object-fit: cover; }
    .pwa-title { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
    .pwa-text { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
    .pwa-actions { display: flex; gap: 6px; margin-top: 10px; }
    .pwa-actions button { padding: 8px 14px; border-radius: 11px; border: none; font-size: 12.5px; font-weight: 700; cursor: pointer; }
    .pwa-actions .allow { background: var(--accent-grad); color: var(--accent-ink); }
    .pwa-actions .deny { background: var(--surface-4); color: var(--text-2); }

    .lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,0.92); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); display: flex; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; animation: fadeIn 0.2s; }
    .lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 16px; box-shadow: 0 0 80px rgba(255,214,10,0.18); }
    .lightbox .close-btn { position: absolute; top: calc(18px + var(--safe-top)); right: 18px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(40,40,46,0.8); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
    .lightbox .close-btn:hover { background: var(--accent); color: var(--accent-ink); }

    .spinner { width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,0.2); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .fa-solid, .fa-regular, .fa-brands { line-height: 1; }
    
    
    
    /* ============================================================
   GIF PICKER — ПОЛНЫЙ СТИЛЬ (FLEX-ВЕРСИЯ)
   ============================================================ */

.gif-picker {
  position: absolute;
  bottom: calc(100% - 4px);
  right: 76px;
  width: 360px;
  max-width: calc(100vw - 20px);
  height: 420px;
  max-height: 60vh;
  background: rgba(28, 28, 33, 0.96);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: menuIn 0.18s var(--ease);
  transform-origin: bottom right;
  z-index: 20;
}

.gif-picker-header {
  padding: 10px 10px 6px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.gif-picker-header input {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}

.gif-picker-header input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.gif-picker-header .close-btn {
  width: 36px; 
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gif-picker-header .close-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Тело пикера: используем flex, чтобы полностью исключить баги сетки */
.gif-picker-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

/* Контейнер гифки */
.gif-picker-body .gif-item {
  position: relative;
  display: block;
  width: calc(50% - 3px);
  aspect-ratio: 1 / 1; /* Идеальный квадрат */
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}

.gif-picker-body .gif-item:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  z-index: 1;
}

/* Картинка внутри */
.gif-picker-body .gif-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Плашка "GIF" */
.gif-picker-body .gif-item::after {
  content: 'GIF';
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 2;
  pointer-events: none;
}

/* Загрузка и пустота */
.gif-picker-body .gif-loading,
.gif-picker-body .gif-empty {
  width: 100%;
  text-align: center;
  padding: 30px 12px;
  color: var(--text-3);
  font-size: 13px;
}

.gif-picker-body .gif-loading .spinner {
  border-color: rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  margin-right: 8px;
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 768px) {
  .gif-picker {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(100% - 2px);
    max-height: 55vh;
  }
  
  /* На мобилке по 3 колонки (33% минус отступы) */
  .gif-picker-body .gif-item {
    width: calc(33.333% - 4px);
  }
}
    
    
   /* ============================================================
   GROUP CALL v4
   ============================================================ */

.gc-card {
  position: relative;
  width: min(1560px, 96vw);
  height: min(1066px, 88dvh);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  overflow: hidden;
  background: #0c0c0f;
  animation: modalIn .35s var(--ease);
}

.gc-card.is-hidden {
  display: none !important;
}

.gc-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 6px;
}

.gc-top-actions {
  margin-left: auto;
}

.gc-min-btn {
  background: rgba(255,255,255,.08);
  color: #fff;
  transition: background .18s, transform .12s;
}
.gc-min-btn:hover { background: rgba(255,255,255,.18); }
.gc-min-btn:active { transform: scale(.92); }

/* ---------- STAGE / GRID ---------- */

.gc-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 8px 12px;
}

.gc-grid {
  flex: 1;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(140px, 1fr);
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.gc-grid::-webkit-scrollbar { width: 6px; }
.gc-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}

/* режим с пином */
.gc-grid.has-pinned {
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  align-content: stretch;
}

.gc-grid.has-pinned .gc-tile.pinned {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 0;
  aspect-ratio: auto;
}

.gc-grid.has-pinned .gc-tile:not(.pinned) {
  display: none;
}

/* ---------- TILE ---------- */


.gc-tile-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1a1a20, #0c0c0f 70%);
  z-index: 1;
}

.gc-tile-avatar[hidden] { display: none; }

.gc-tile-avatar .av {
  width: clamp(56px, 34%, 120px);
  height: auto;
  aspect-ratio: 1 / 1;   /* высота = ширине, всегда круг */
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  font-size: clamp(22px, 14%, 48px);
}

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

.gc-tile-avatar .av .av-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

.gc-tile.has-video .gc-tile-avatar { display: none; }
.gc-tile.is-local .gc-tile-avatar .av { transform: none; }

.gc-tile {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0c0c0f;
  cursor: pointer;
  isolation: isolate;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  min-height: 120px;
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05);
}

.gc-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 24px rgba(0,0,0,.4);
}

.gc-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.gc-tile.is-local video {
  transform: scaleX(-1);
}

.gc-tile.screen-share {
  grid-column: span 2;
  grid-row: span 2;
  min-height: 220px;
}

.gc-tile.screen-share video {
  object-fit: contain;
  transform: none !important;
  background: #000;
}

.gc-overlay {
  /* когда звонок развёрнут — как обычно, с blur */
  background: rgba(0,0,0,.7);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: background .25s var(--ease), backdrop-filter .25s var(--ease);
}

/* когда свёрнут — оверлей невидим и не перехватывает клики */
.gc-overlay.gc-minimized {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
  padding: 0;
}

/* mini-панель внутри свёрнутого оверлея — снова кликабельна */
.gc-overlay.gc-minimized .gc-mini {
  pointer-events: auto;
}

.gc-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 30px);
}

.gc-mute-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 90, 95, .95);
  color: #fff;
  font-size: 11px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  animation: popIn .2s var(--ease);
}

/* рамка активного спикера */
.gc-speaking-ring {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .18s var(--ease);
  z-index: 3;              /* ← выше видео (0) и аватарки (1) */
}

.gc-tile.speaking .gc-speaking-ring {
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 24px var(--accent-glow),
    inset 0 0 0 1px rgba(255,214,10,.3);
}

.gc-tile.speaking {
  transform: translateY(-2px);
}

/* кнопка expand */
.gc-tile-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px; height: 32px;
  border-radius: 10px;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s, background .18s, transform .12s;
  backdrop-filter: blur(8px);
  z-index: 2;
}
.gc-tile:hover .gc-tile-expand { opacity: 1; }
.gc-tile-expand:hover {
  background: var(--accent);
  color: var(--accent-ink);
}
.gc-tile-expand:active { transform: scale(.92); }

/* ---------- BOTTOM BAR ---------- */

.gc-bottom-bar {
  padding: 12px 18px calc(16px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.4));
  flex-shrink: 0;
}

.gc-controls {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(24, 24, 28, .72);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.gc-controls .call-control {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

/* ---------- MINI (свёрнутый) ---------- */

.gc-mini {
  position: fixed;
  right: 20px;
  bottom: calc(96px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  background: rgba(20, 20, 24, .88);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(0,0,0,.6), 0 0 40px rgba(255,214,10,.12);
  cursor: pointer;
  z-index: 7000;
  animation: popIn .3s var(--ease);
  transition: transform .18s var(--ease), box-shadow .18s;
}

.gc-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 52px rgba(0,0,0,.7), 0 0 48px rgba(255,214,10,.16);
}

/* ВАЖНО: скрытие через класс, не через hidden */
.gc-mini.is-hidden {
  display: none !important;
}
.gc-mini[hidden] {
  display: none !important;
}

.gc-mini-avatars {
  display: flex;
  align-items: center;
}

.gc-mini-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid #14141a;
  margin-left: -8px;
  text-transform: uppercase;
}
.gc-mini-avatar:first-child { margin-left: 0; }
.gc-mini-avatar.is-local { background: var(--surface-4); color: #fff; }

.gc-mini-more {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-4);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #14141a;
  margin-left: -8px;
}

.gc-mini-actions {
  display: flex;
  gap: 4px;
}

.gc-mini-actions .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

/* ---------- MOBILE ---------- */

@media (max-width: 768px) {
  .gc-card {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .gc-top {
    padding: calc(14px + var(--safe-top)) 14px 4px;
  }
  .gc-stage { padding: 4px; }
  .gc-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
  }
  .gc-tile {
    border-radius: 12px;
    min-height: 100px;
  }
  .gc-tile.screen-share {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 160px;
  }
  .gc-controls {
    gap: 6px;
    padding: 8px 12px;
  }
  .gc-controls .call-control {
    width: 46px;
    height: 46px;
    font-size: 16px;
  }
  .gc-bottom-bar {
    padding-bottom: calc(14px + var(--safe-bottom));
  }
  .gc-mini {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    padding: 8px 10px;
  }
  .gc-mini-avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
  .gc-tile-expand { opacity: 1; }
}

/* ---------- MOBILE ---------- */

@media (max-width: 768px) {
  .gc-card {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .gc-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
    padding: 0;
  }
  .gc-stage { padding: 6px; }
  .gc-tile { border-radius: 12px; min-height: 100px; }
  .gc-tile.screen-share { grid-column: span 2; grid-row: span 1; min-height: 160px; }
  .gc-controls .call-control { width: 46px; height: 46px; font-size: 16px; }
  .gc-mini {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    padding: 8px 10px;
  }
  .gc-tile-expand { opacity: 1; }
}

    @media (max-width: 768px) {
      .sidebar { width: 100%; min-width: 0; position: absolute; inset: 0; z-index: 100; transition: transform 0.38s var(--ease); border-right: none; }
      .sidebar.hidden { transform: translateX(-100%); pointer-events: none; }
      .back-btn { display: inline-flex; }
      .chat-header { padding: calc(10px + var(--safe-top)) 10px 10px 8px; min-height: 62px; }
      .messages-container { padding: 10px 10px 12px; }
      .msg-stack { max-width: 82%; }
      .bubble.media img, .bubble.media video { max-width: 250px; }
      .bubble.media audio { width: 220px; }
      .composer { padding: 6px 10px calc(10px + var(--safe-bottom)); }
      .emoji-picker { right: 10px; left: 10px; width: auto; bottom: calc(100% - 2px); }
      .scroll-bottom-btn { right: 14px; bottom: calc(80px + var(--safe-bottom)); }
      .auth-card { padding: 28px 22px 24px; }
      .empty-state { display: none; }
      .modal-overlay { align-items: flex-end; padding: 0; }
      .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: calc(24px + var(--safe-bottom)); animation: sheetIn 0.4s var(--ease); max-height: 92dvh; }
      @keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
      .toast-container { bottom: calc(86px + var(--safe-bottom)); }
      .pwa-prompt { left: 12px; right: 12px; max-width: none; }
    }

    @media (hover: none) {
      .icon-btn:hover, .c-btn:hover { background: transparent; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    }
