* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
  :root {
    --bg: #0f0f13;
    --bg2: #16161d;
    --bg3: #1e1e2a;
    --bg4: #252535;
    --accent: #7c3aed;
    --accent2: #9d5ff0;
    --accent3: #5b21b6;
    --text: #e8e8f0;
    --text2: #a0a0b8;
    --text3: #6b6b85;
    --border: #2a2a3d;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --card: #1a1a26;
  }
  [data-theme="light"] {
    --bg: #f0f0f5;
    --bg2: #e8e8f0;
    --bg3: #ffffff;
    --bg4: #f5f5fa;
    --text: #1a1a2e;
    --text2: #4a4a6a;
    --text3: #8a8aaa;
    --border: #d0d0e0;
    --card: #ffffff;
  }
  [data-theme="ocean"] {
    --bg: #08101e;
    --bg2: #0d1b2a;
    --bg3: #14283f;
    --bg4: #1c3552;
    --accent: #0284c7;
    --accent2: #38bdf8;
    --accent3: #0369a1;
    --text: #f0f9ff;
    --text2: #bae6fd;
    --text3: #64748b;
    --border: #1e3a5f;
    --card: #0f2238;
  }
  [data-theme="emerald"] {
    --bg: #06140e;
    --bg2: #0b1f17;
    --bg3: #122f23;
    --bg4: #193f30;
    --accent: #10b981;
    --accent2: #34d399;
    --accent3: #059669;
    --text: #ecfdf5;
    --text2: #a7f3d0;
    --text3: #52796f;
    --border: #1f4e3c;
    --card: #0e271d;
  }
  [data-theme="sunset"] {
    --bg: #150a14;
    --bg2: #1e0f1d;
    --bg3: #2c152a;
    --bg4: #3c1e3a;
    --accent: #f43f5e;
    --accent2: #fb7185;
    --accent3: #e11d48;
    --text: #fff1f2;
    --text2: #fecdd3;
    --text3: #9f708a;
    --border: #4a2147;
    --card: #241123;
  }
  [data-theme="oled"] {
    --bg: #000000;
    --bg2: #0a0a0a;
    --bg3: #141414;
    --bg4: #1e1e1e;
    --accent: #8b5cf6;
    --accent2: #a78bfa;
    --accent3: #6d28d9;
    --text: #ffffff;
    --text2: #cccccc;
    --text3: #777777;
    --border: #262626;
    --card: #0d0d0d;
  }
  [data-theme="ussr"] {
    --bg: #dfcca9;
    --bg2: #cbb48e;
    --bg3: #be9e72;
    --bg4: #af8d5f;
    --accent: #991b1b;
    --accent2: #b91c1c;
    --accent3: #7f1d1d;
    --text: #2b1108;
    --text2: #4e1c12;
    --text3: #7a3524;
    --border: #8c261e;
    --green: #15803d;
    --red: #991b1b;
    --yellow: #b45309;
    --card: #d4bf9a;
  }
  [data-theme="ussr"] .sidebar-logo {
    background: linear-gradient(135deg, #991b1b, #b91c1c) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    letter-spacing: 2px;
  }
  [data-theme="ussr"] .sidebar-logo::before { content: '★ '; -webkit-text-fill-color: #991b1b; }
  [data-theme="ussr"] .sidebar-logo::after { content: ' ★'; -webkit-text-fill-color: #991b1b; }
  [data-theme="ussr"] .auth-logo h1 {
    background: linear-gradient(135deg, #991b1b, #c22727) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
  }
  [data-theme="ussr"] .role-owner {
    background: rgba(153,27,27,0.2) !important;
    color: #991b1b !important;
    border: 1px solid rgba(153,27,27,0.4) !important;
  }
  [data-theme="potuzhno"] {
    --bg: #09121f;
    --bg2: #0f1c2e;
    --bg3: #16273d;
    --bg4: #1f3552;
    --accent: #0284c7;
    --accent2: #eab308;
    --accent3: #1d4ed8;
    --text: #f0f9ff;
    --text2: #bae6fd;
    --text3: #7dd3fc;
    --border: #1e3a5f;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #facc15;
    --card: #132237;
  }
  [data-theme="potuzhno"] .sidebar-logo {
    background: linear-gradient(135deg, #38bdf8, #facc15) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    letter-spacing: 1.5px;
  }
  [data-theme="potuzhno"] .sidebar-logo::before { content: '🚀 '; -webkit-text-fill-color: #38bdf8; }
  [data-theme="potuzhno"] .sidebar-logo::after { content: ' ⚡'; -webkit-text-fill-color: #facc15; }
  [data-theme="potuzhno"] .auth-logo h1 {
    background: linear-gradient(135deg, #0284c7, #facc15) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
  }
  [data-theme="potuzhno"] .msg-bubble.mine {
    background: linear-gradient(135deg, #0284c7 35%, #ca8a04 100%) !important;
    color: #ffffff !important;
    font-weight: 500;
  }
  [data-theme="potuzhno"] .role-owner {
    background: linear-gradient(135deg, rgba(2,132,199,0.25), rgba(234,179,8,0.25)) !important;
    color: #facc15 !important;
    border: 1px solid #0284c7 !important;
  }
  [data-theme="sakura"] {
    --bg: #150913; --bg2: #200f1c; --bg3: #2d1627; --bg4: #3d1f35;
    --accent: #ec4899; --accent2: #f472b6; --accent3: #db2777;
    --text: #fdf2f8; --text2: #fbcfe8; --text3: #a87291; --border: #4a2140;
    --green: #22c55e; --red: #ef4444; --yellow: #eab308; --card: #261122;
  }
  [data-theme="amber"] {
    --bg: #140e06; --bg2: #1e150a; --bg3: #2b1f10; --bg4: #3a2b16;
    --accent: #f59e0b; --accent2: #fbbf24; --accent3: #d97706;
    --text: #fffbeb; --text2: #fde68a; --text3: #a38c62; --border: #45331a;
    --green: #22c55e; --red: #ef4444; --yellow: #f59e0b; --card: #23180c;
  }
  [data-theme="arctic"] {
    --bg: #071018; --bg2: #0d1924; --bg3: #142433; --bg4: #1c3245;
    --accent: #06b6d4; --accent2: #67e8f9; --accent3: #0891b2;
    --text: #ecfeff; --text2: #cffafe; --text3: #6b8f9e; --border: #1a3c54;
    --green: #22c55e; --red: #ef4444; --yellow: #eab308; --card: #0f1e2c;
  }
  [data-theme="gold"] {
    --bg: #120f08; --bg2: #1c180d; --bg3: #292314; --bg4: #38301b;
    --accent: #d97706; --accent2: #fbbf24; --accent3: #b45309;
    --text: #fefce8; --text2: #fef08a; --text3: #998960; --border: #42381f;
    --green: #22c55e; --red: #ef4444; --yellow: #fbbf24; --card: #211c10;
  }

  /* CHAT INFO & PROFILE MODAL STYLES */
  .info-header-box {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 16px; background: var(--bg3); border-radius: 14px; margin-bottom: 14px;
    border: 1px solid var(--border);
  }
  .info-avatar-large {
    width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--accent); margin-bottom: 10px; cursor: pointer;
    transition: transform 0.2s; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  }
  .info-avatar-large:hover { transform: scale(1.06); }
  .info-actions-row {
    display: flex; gap: 6px; width: 100%; margin-top: 10px;
  }
  .info-action-btn {
    flex: 1; padding: 8px 6px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg4); color: var(--text); font-size: 11px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px;
    transition: all 0.2s; font-family: inherit;
  }
  .info-action-btn:hover { border-color: var(--accent); background: var(--accent); color: white; }
  .info-action-btn.danger { color: #f87171; border-color: rgba(239,68,68,0.3); }
  .info-action-btn.danger:hover { background: var(--red); color: white; border-color: var(--red); }
  .info-action-btn.active-contact { background: rgba(34,197,94,0.2); color: #4ade80; border-color: rgba(34,197,94,0.4); }

  /* EMOJI & STICKER TABS */
  .emoji-picker-container {
    display: flex; flex-direction: column; height: 100%;
  }
  .emoji-category-tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 8px; overflow-x: auto;
  }
  .emoji-cat-btn {
    padding: 4px 8px; border-radius: 6px; border: none; background: transparent;
    cursor: pointer; font-size: 14px; opacity: 0.6; transition: all 0.2s;
  }
  .emoji-cat-btn.active, .emoji-cat-btn:hover { opacity: 1; background: var(--bg3); }
  .emoji-grid-box {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
    max-height: 160px; overflow-y: auto; font-size: 18px; text-align: center;
  }
  .emoji-item-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; border: none; background: transparent; cursor: pointer;
    transition: transform 0.15s, background 0.15s; font-size: 18px;
  }
  .emoji-item-btn:hover { transform: scale(1.25); background: var(--bg4); }

  /* VIDEO & FILE MESSAGE BUBBLES */
  .msg-video-card {
    border-radius: 10px; overflow: hidden; max-width: 260px; margin-top: 4px;
  }
  .msg-video-card video { width: 100%; border-radius: 8px; max-height: 220px; background: #000; display: block; }
  .msg-file-card {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    background: rgba(0,0,0,0.15); border-radius: 8px; margin-top: 4px; border: 1px solid rgba(255,255,255,0.08);
  }
  .msg-file-icon { font-size: 24px; flex-shrink: 0; }
  .msg-file-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
  .msg-file-size { font-size: 10px; opacity: 0.6; }


  
  /* DUCK ID & BOT BADGES */
  .badge-duck { background: rgba(234,179,8,0.25); color: #facc15; border: 1px solid #eab308; }
  .badge-bot { background: rgba(14,165,233,0.2); color: #38bdf8; border: 1px solid #0284c7; }

  /* STICKER BUTTON & POPOVER */
  .sticker-btn {
    width: 34px; height: 34px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; font-size: 16px; flex-shrink: 0;
  }
  .sticker-btn:hover { color: var(--accent2); background: rgba(124,58,237,0.1); }
  .sticker-popover {
    position: absolute; bottom: calc(100% + 10px); left: 10px;
    width: 290px; max-height: 260px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 12px; z-index: 150; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none; flex-direction: column; gap: 8px;
    animation: popIn 0.2s ease;
  }
  .sticker-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    max-height: 180px; overflow-y: auto; padding-right: 2px;
  }
  .sticker-item {
    width: 56px; height: 56px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg3); transition: transform 0.2s, background 0.2s;
    font-size: 26px;
  }
  .sticker-item:hover { transform: scale(1.12); background: var(--bg4); }
  .sticker-item img { width: 44px; height: 44px; object-fit: contain; }

  /* CODE EDITOR FOR BOT STUDIO */
  .code-editor-area {
    width: 100%; font-family: 'Consolas', 'Courier New', monospace; font-size: 12px;
    line-height: 1.45; background: #080c14; color: #38bdf8; border: 1.5px solid var(--border);
    border-radius: 10px; padding: 12px; resize: vertical; min-height: 140px; max-height: 280px;
    tab-size: 2; outline: none;
  }
  .code-editor-area:focus { border-color: var(--accent); }

  
  /* MESSAGE HOVER ACTIONS TOOLBAR */
  .msg-actions-bar {
    position: absolute; top: -14px; right: 8px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 18px; padding: 2px 4px;
    display: none; align-items: center; gap: 2px; z-index: 50;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4); animation: popIn 0.15s ease;
  }
  .msg-wrapper:hover .msg-actions-bar { display: flex; }
  .msg-action-icon-btn {
    width: 24px; height: 24px; border-radius: 50%; border: none;
    background: transparent; color: var(--text2); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 11px;
    transition: all 0.15s;
  }
  .msg-action-icon-btn:hover { background: var(--bg4); color: var(--text); transform: scale(1.15); }
  .msg-action-icon-btn.danger:hover { color: #ef4444; }

  /* REPLY PREVIEW BAR ABOVE INPUT */
  .reply-preview-bar {
    display: none; align-items: center; justify-content: space-between;
    padding: 6px 12px; background: var(--bg3); border-top: 1px solid var(--border);
    border-left: 3px solid var(--accent); margin-bottom: 6px; border-radius: 8px;
    animation: fadeIn 0.15s ease;
  }
  .reply-preview-author { font-size: 11px; font-weight: 700; color: var(--accent2); }
  .reply-preview-text { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%; }

  /* QUOTE BOX INSIDE MESSAGE BUBBLE */
  .msg-quote-box {
    padding: 4px 8px; background: rgba(0,0,0,0.18); border-left: 2.5px solid var(--accent2);
    border-radius: 6px; margin-bottom: 4px; cursor: pointer; transition: opacity 0.2s;
  }
  .msg-quote-box:hover { opacity: 0.85; }
  .msg-quote-author { font-size: 10px; font-weight: 700; color: var(--accent2); }
  .msg-quote-text { font-size: 10px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

  /* REACTION PILLS BELOW BUBBLE */
  .msg-reactions-row {
    display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px;
  }
  .reaction-pill {
    padding: 1px 5px; border-radius: 10px; background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08); font-size: 11px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 3px; transition: all 0.15s;
  }
  .reaction-pill:hover { transform: scale(1.1); background: rgba(0,0,0,0.35); }
  .reaction-pill.reacted {
    background: rgba(124,58,237,0.25); border-color: var(--accent); color: var(--accent2);
  }
  .reaction-picker-bar {
    position: absolute; top: -38px; right: 0; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 20px; padding: 3px 8px;
    display: none; align-items: center; gap: 4px; z-index: 60;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5); animation: popIn 0.15s ease;
  }
  .reaction-pick-emoji {
    font-size: 16px; cursor: pointer; transition: transform 0.15s; background: none; border: none;
  }
  .reaction-pick-emoji:hover { transform: scale(1.3); }

  /* FORWARD MODAL LIST */
  .forward-user-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 8px; cursor: pointer; transition: background 0.2s;
  }
  .forward-user-item:hover { background: var(--bg3); }

  /* THEME PICKER STYLES */
  .theme-picker-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px;
    max-height: 220px; overflow-y: auto; padding-right: 2px;
  }
  @media (min-width: 480px) {
    .theme-picker-grid { grid-template-columns: repeat(4, 1fr); }
  }
  .theme-card {
    background: var(--bg3); border: 1.5px solid var(--border); border-radius: 10px;
    padding: 8px; cursor: pointer; text-align: center; transition: all 0.2s;
  }
  .theme-card:hover { transform: translateY(-2px); border-color: var(--accent); }
  .theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: var(--bg4); }
  .theme-card-preview {
    height: 22px; border-radius: 6px; display: flex; align-items: center; gap: 6px; padding: 0 6px; margin-bottom: 6px;
  }
  .theme-card-name { font-size: 11px; font-weight: 600; color: var(--text); }
  body {
    background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, system-ui, sans-serif;
    height: 100vh; height: 100dvh; overflow: hidden; transition: background 0.3s, color 0.3s;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  }

  /* ANIMATIONS */
  @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes slideRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
  @keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-8px)} 80%{transform:translateX(8px)} }
  @keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
  @keyframes glow { 0%,100%{box-shadow:0 0 10px rgba(124,58,237,0.3)} 50%{box-shadow:0 0 25px rgba(124,58,237,0.7)} }
  @keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
  @keyframes popIn { from{opacity:0;transform:scale(0.8)} to{opacity:1;transform:scale(1)} }

  .fade-in { animation: fadeIn 0.4s ease forwards; }
  .slide-in { animation: slideIn 0.4s ease forwards; }
  .slide-right { animation: slideRight 0.4s ease forwards; }
  .shake { animation: shake 0.5s ease; }
  .pop-in { animation: popIn 0.3s ease forwards; }

  /* NEW CHAT BUTTON */
  .new-chat-btn {
    width: 100%; padding: 8px 12px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--text2); font-size: 12px; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s; font-family: inherit;
  }
  .new-chat-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

  /* NEW CHAT MENU */
  .new-chat-menu {
    position: absolute; top: calc(100% - 4px); left: 12px; right: 12px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: popIn 0.2s ease;
  }
  .new-chat-menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; cursor: pointer; transition: background 0.2s;
  }
  .new-chat-menu-item:hover { background: var(--bg3); }
  .new-chat-menu-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .chat-icon { background: rgba(124,58,237,0.2); color: var(--accent2); }
  .group-icon { background: rgba(34,197,94,0.2); color: var(--green); }
  .channel-icon { background: rgba(234,179,8,0.2); color: var(--yellow); }
  .new-chat-menu-label { font-size: 13px; font-weight: 600; color: var(--text); }
  .new-chat-menu-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }

  /* USER SEARCH LIST */
  .user-search-list { max-height: 220px; overflow-y: auto; margin-top: 8px; padding-right: 4px; -webkit-overflow-scrolling: touch; }
  .user-search-list::-webkit-scrollbar { width: 4px; }
  .user-search-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .user-search-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 8px; cursor: pointer; transition: background 0.2s;
  }
  .user-search-item:hover { background: var(--bg3); }
  .user-search-item.selected { background: rgba(124,58,237,0.2); border: 1px solid var(--accent); }
  .user-search-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
  .user-search-item-info { flex: 1; min-width: 0; }
  .user-search-item-name { font-size: 13px; font-weight: 600; }
  .user-search-item-username { font-size: 11px; color: var(--text3); }
  .user-select-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

  /* AUTH SCREENS */
  #auth-screen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    z-index: 100;
  }
  .auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: 430px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: fadeIn 0.5s ease;
  }
  .auth-logo {
    text-align: center;
    margin-bottom: 22px;
  }
  .auth-logo h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
  }
  .auth-logo p { color: var(--text3); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }

  /* STEPS */
  .steps-indicator {
    display: flex; gap: 8px; justify-content: center; margin-bottom: 22px;
  }
  .step-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); transition: all 0.3s;
  }
  .step-dot.active { width: 24px; border-radius: 4px; background: var(--accent); }
  .step-dot.done { background: var(--green); }

  /* FORM */
  .form-group { margin-bottom: 14px; position: relative; }
  .form-group label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
  .form-group label span.req { color: var(--accent2); margin-left: 2px; }
  .form-group label span.opt { color: var(--text3); font-size: 11px; margin-left: 4px; }
  .form-control {
    width: 100%; padding: 11px 14px;
    background: var(--bg3); border: 1.5px solid var(--border);
    border-radius: 10px; color: var(--text);
    font-size: 14px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
  }
  .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
  .form-control.error { border-color: var(--red); }
  .form-control.success { border-color: var(--green); }
  .form-error { color: var(--red); font-size: 11px; margin-top: 4px; display: none; }
  .form-error.show { display: block; animation: fadeIn 0.2s; }
  .form-success-msg { color: var(--green); font-size: 11px; margin-top: 4px; display: none; }
  .form-success-msg.show { display: block; }

  /* BUTTONS */
  .btn {
    width: 100%; padding: 12px; border: none;
    border-radius: 10px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
    letter-spacing: 0.5px; display: inline-flex; align-items: center; justify-content: center;
  }
  .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white; box-shadow: 0 4px 15px rgba(124,58,237,0.4);
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.5); }
  .btn-primary:active { transform: translateY(0); }
  .btn-ghost { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
  .btn-ghost:hover { background: var(--bg3); color: var(--text); }
  .btn-sm { width: auto; padding: 7px 14px; font-size: 12px; border-radius: 8px; }
  .btn-danger { background: var(--red); color: white; }
  .btn-danger:hover { background: #dc2626; }
  .btn-warning { background: #d97706; color: white; }

  .auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text3); }
  .auth-switch a { color: var(--accent2); cursor: pointer; text-decoration: none; font-weight: 500; }
  .auth-switch a:hover { text-decoration: underline; }

  /* PASSWORD STRENGTH */
  .pass-strength { margin-top: 6px; }
  .pass-strength-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
  .pass-strength-fill { height: 100%; border-radius: 2px; transition: all 0.3s; width: 0; }
  .pass-strength-text { font-size: 11px; color: var(--text3); margin-top: 3px; }

  /* AVATAR PICKER & PREVIEW */
  .avatar-preview-box {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin-bottom: 16px; padding: 12px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 14px;
    animation: fadeIn 0.3s;
  }
  .avatar-preview-img-wrap {
    position: relative; width: 90px; height: 90px; margin-bottom: 8px;
  }
  .avatar-preview-img {
    width: 90px; height: 90px; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--accent);
    box-shadow: 0 4px 18px rgba(124,58,237,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .avatar-preview-badge {
    position: absolute; bottom: 2px; right: 2px;
    background: var(--accent); color: white; border-radius: 50%;
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; border: 2px solid var(--bg3);
  }
  .avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
  .avatar-option {
    width: 48px; height: 48px; border-radius: 50%;
    cursor: pointer; border: 2px solid transparent;
    transition: all 0.2s; overflow: hidden;
  }
  .avatar-option:hover { transform: scale(1.08); border-color: var(--accent); }
  .avatar-option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.3); animation: glow 1.5s infinite; }
  .avatar-option img { width: 100%; height: 100%; object-fit: cover; }

  /* LOADER */
  .loader { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }

  /* WELCOME MESSAGE */
  .welcome-box { text-align: center; padding: 16px 0; }
  .welcome-box .welcome-avatar {
    width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
    border: 3px solid var(--accent); animation: glow 2s infinite; object-fit: cover;
  }
  .welcome-box h2 { font-size: 20px; margin-bottom: 4px; }
  .welcome-box h2 span { color: var(--accent2); }
  .welcome-box p { color: var(--text3); font-size: 13px; }

  /* FORGOT PASSWORD */
  .forgot-result {
    padding: 14px; border-radius: 10px; text-align: center;
    margin-bottom: 14px; display: none;
  }
  .forgot-result.show { display: block; animation: popIn 0.3s; }
  .forgot-result.ok { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); }
  .forgot-result.bad { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); }
  .forgot-result.ok h3 { color: var(--green); margin-bottom: 6px; }
  .forgot-result.bad h3 { color: var(--red); margin-bottom: 6px; font-size: 18px; }
  .forgot-result p { font-size: 13px; color: var(--text2); line-height: 1.4; }

  /* DIVIDER */
  .divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
  .divider span { color: var(--text3); font-size: 12px; }
  .divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

  /* USERNAME FIELD */
  .username-prefix {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--accent2); font-weight: 600; font-size: 14px;
    pointer-events: none;
  }
  .username-input { padding-left: 28px !important; }

  /* SKIP LINK */
  .skip-link { text-align: center; margin-top: 10px; }
  .skip-link a { color: var(--text3); font-size: 12px; cursor: pointer; }
  .skip-link a:hover { color: var(--text2); }

  /* ===================== MAIN APP ===================== */
  #app {
    display: none;
    height: 100vh;
    height: 100dvh;
    flex-direction: row;
    position: relative;
    overflow: hidden;
  }
  #app.visible { display: flex; }

  /* SIDEBAR */
  .sidebar {
    width: 270px; min-width: 270px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }
  .sidebar-logo {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .sidebar-search {
    margin: 12px; position: relative;
  }
  .sidebar-search input {
    width: 100%; padding: 9px 12px 9px 34px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 13px;
    outline: none; font-family: inherit;
    transition: border-color 0.2s;
  }
  .sidebar-search input:focus { border-color: var(--accent); }
  .sidebar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); }

  .sidebar-nav {
    display: flex; gap: 4px; padding: 6px 12px 10px;
  }
  .nav-btn {
    flex: 1; padding: 7px 4px; border-radius: 8px; border: none;
    background: transparent; color: var(--text3);
    cursor: pointer; font-size: 11px; font-weight: 500;
    transition: all 0.2s; font-family: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
  }
  .nav-btn svg { width: 16px; height: 16px; }
  .nav-btn.active { background: rgba(124,58,237,0.15); color: var(--accent2); }
  .nav-btn:hover:not(.active) { background: var(--bg3); color: var(--text); }

  .chat-list { flex: 1; overflow-y: auto; padding: 4px 8px; -webkit-overflow-scrolling: touch; }
  .chat-list::-webkit-scrollbar { width: 4px; }
  .chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .chat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 10px; cursor: pointer;
    transition: all 0.2s; margin-bottom: 2px;
    position: relative;
  }
  .chat-item:hover { background: var(--bg3); }
  .chat-item.active { background: rgba(124,58,237,0.15); }
  .chat-item-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    flex-shrink: 0; position: relative; overflow: hidden;
    background: var(--bg4);
  }
  .chat-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .online-dot {
    position: absolute; bottom: 1px; right: 1px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--green); border: 2px solid var(--bg2);
  }
  .chat-item-info { flex: 1; min-width: 0; }
  .chat-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-item-last { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
  .chat-item-time { font-size: 10px; color: var(--text3); }
  .chat-unread {
    background: var(--accent); color: white; font-size: 10px;
    border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center;
  }

  /* SIDEBAR BOTTOM */
  .sidebar-bottom {
    padding: 12px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }
  .my-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden; cursor: pointer; border: 2px solid var(--accent);
    transition: transform 0.2s; position: relative;
  }
  .my-avatar:hover { transform: scale(1.05); }
  .my-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .my-info { flex: 1; min-width: 0; }
  .my-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .my-role { font-size: 10px; color: var(--accent2); }
  .sidebar-icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
  }
  .sidebar-icon-btn:hover { background: var(--bg3); color: var(--text); }

  /* MAIN CHAT AREA */
  .main-area {
    flex: 1; display: flex; flex-direction: column; height: 100%;
    background: var(--bg); position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* MOBILE BACK BUTTON */
  .mobile-back-btn {
    display: none; width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); cursor: pointer; align-items: center; justify-content: center;
    margin-right: 4px; flex-shrink: 0;
  }
  .mobile-back-btn:hover { background: var(--bg4); }

  /* CHAT HEADER */
  .chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    background: var(--bg2);
  }
  .chat-header-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    overflow: hidden; position: relative; flex-shrink: 0;
  }
  .chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .chat-header-info { flex: 1; min-width: 0; }
  .chat-header-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-header-status { font-size: 11px; color: var(--green); }
  .chat-header-actions { display: flex; gap: 6px; }
  .header-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
  }
  .header-btn:hover { background: var(--bg4); color: var(--text); }
  .header-btn.call { background: rgba(34,197,94,0.1); color: var(--green); border-color: rgba(34,197,94,0.3); }
  .header-btn.call:hover { background: var(--green); color: white; }
  .header-btn.report { background: rgba(239,68,68,0.1); color: var(--red); border-color: rgba(239,68,68,0.25); }
  .header-btn.report:hover { background: var(--red); color: white; }

  /* MESSAGES */
  .messages-area {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .messages-area::-webkit-scrollbar { width: 4px; }
  .messages-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .msg-group {
    display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px;
  }
  .msg-wrapper {
    position: relative; display: flex; align-items: flex-end; gap: 6px; margin-bottom: 2px;
  }
  .msg-wrapper.first-in-group { margin-top: 4px; }
  .msg-avatar-placeholder {
    width: 28px; height: 28px; flex-shrink: 0;
  }
  .msg-bubble {
    max-width: 72%; padding: 6px 11px 5px 11px;
    border-radius: 14px; font-size: 13px; line-height: 1.38;
    word-break: break-word; animation: popIn 0.15s ease; position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  }
  [data-theme="ussr"] .msg-bubble.other {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
  }
  .msg-bubble.mine {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white; margin-left: auto;
    border-bottom-right-radius: 4px;
  }
  .msg-bubble.other {
    background: var(--bg3); color: var(--text);
    border-bottom-left-radius: 4px;
  }
  .msg-time { font-size: 10px; opacity: 0.65; margin-top: 4px; text-align: right; }

  .msg-date-divider {
    text-align: center; color: var(--text3);
    font-size: 11px; margin: 10px 0;
    display: flex; align-items: center; gap: 10px;
  }
  .msg-date-divider::before, .msg-date-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

  /* MESSAGE INPUT */
  .input-area {
    padding: 14px 20px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
  }
  .input-box {
    display: flex; align-items: flex-end; gap: 10px;
    background: var(--bg3); border: 1.5px solid var(--border);
    border-radius: 14px; padding: 10px 14px;
    transition: border-color 0.2s;
  }
  .input-box:focus-within { border-color: var(--accent); }
  .msg-input {
    flex: 1; background: transparent; border: none;
    color: var(--text); font-size: 14px; outline: none;
    resize: none; max-height: 120px; font-family: inherit;
    line-height: 1.5;
  }
  .msg-input::placeholder { color: var(--text3); }
  .input-btn {
    width: 34px; height: 34px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
  }
  .input-btn:hover { color: var(--accent2); background: rgba(124,58,237,0.1); }
  .send-btn {
    background: var(--accent); color: white;
    width: 34px; height: 34px; border-radius: 8px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
  }
  .send-btn:hover { background: var(--accent2); transform: scale(1.05); }

  /* EMPTY STATE */
  .no-chat {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 14px; padding: 20px;
    text-align: center;
  }
  .no-chat-icon { font-size: 64px; opacity: 0.4; animation: bounce 2s infinite; }
  .no-chat h2 { color: var(--text2); }
  .no-chat p { color: var(--text3); font-size: 13px; max-width: 320px; line-height: 1.4; }

  /* PANELS */
  .panel {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  .panel.open { opacity: 1; pointer-events: all; }
  .panel-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 24px; width: 440px;
    max-width: 95vw; max-height: 85vh; overflow-y: auto;
    transform: scale(0.92); transition: transform 0.2s;
    -webkit-overflow-scrolling: touch;
  }
  .panel.open .panel-card { transform: scale(1); }
  .panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .panel-header h2 { font-size: 18px; font-weight: 700; }
  .close-btn {
    width: 32px; height: 32px; border-radius: 8px; background: var(--bg3);
    border: none; color: var(--text2); cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
  }
  .close-btn:hover { background: var(--red); color: white; }

  /* ADMIN TABS & AI MODERATOR STYLES */
  .admin-tabs {
    display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px;
  }
  .admin-tab-btn {
    flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid transparent;
    background: var(--bg3); color: var(--text3); font-weight: 600; font-size: 12px;
    cursor: pointer; transition: all 0.2s; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px;
  }
  .admin-tab-btn.active {
    background: var(--accent); color: white; box-shadow: 0 4px 12px rgba(124,58,237,0.3);
  }
  .ai-badge {
    font-size: 11px; padding: 3px 8px; border-radius: 6px;
    background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(34,197,94,0.2));
    border: 1px solid var(--accent); color: var(--accent2); font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .ai-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px;
  }
  .ai-stat-card {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px; text-align: center;
  }
  .ai-stat-num { font-size: 18px; font-weight: 800; color: var(--accent2); }
  .ai-stat-title { font-size: 10px; color: var(--text3); margin-top: 2px; text-transform: uppercase; }
  .ai-log-box {
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px; margin-bottom: 16px; font-size: 12px; max-height: 140px; overflow-y: auto;
    font-family: monospace; display: none; -webkit-overflow-scrolling: touch;
  }
  .ai-log-item { margin-bottom: 4px; line-height: 1.4; }

  /* REPORT CARDS */
  .report-card {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px; margin-bottom: 10px; transition: border-color 0.2s;
  }
  .report-card:hover { border-color: var(--accent); }
  .report-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .report-target { font-size: 13px; font-weight: 700; color: var(--text); }
  .report-reason { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(239,68,68,0.2); color: #f87171; font-weight: 600; }
  .report-desc { font-size: 12px; color: var(--text2); background: var(--bg4); padding: 8px; border-radius: 8px; margin-bottom: 8px; line-height: 1.4; }
  .report-ai-verdict {
    background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.3);
    border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 11px;
  }
  .report-ai-verdict-title { font-weight: 700; color: var(--accent2); display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }

  /* REASONS BUTTONS IN REPORT MODAL */
  .report-reason-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .report-reason-btn {
    padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--border);
    background: var(--bg3); color: var(--text); font-size: 13px; cursor: pointer;
    text-align: left; transition: all 0.2s; font-family: inherit; font-weight: 500;
  }
  .report-reason-btn:hover { background: var(--bg4); border-color: var(--accent); }
  .report-reason-btn.selected { background: rgba(239,68,68,0.15); border-color: var(--red); color: #fca5a5; }

  /* SETTINGS */
  .setting-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .setting-item:last-child { border-bottom: none; }
  .setting-label { font-size: 14px; }
  .setting-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
  .toggle {
    width: 44px; height: 24px; border-radius: 12px;
    background: var(--border); cursor: pointer;
    position: relative; transition: background 0.3s; border: none;
  }
  .toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: white; transition: transform 0.3s;
  }
  .toggle.on { background: var(--accent); }
  .toggle.on::after { transform: translateX(20px); }

  /* ROLE BADGE */
  .role-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 20px;
    font-weight: 600; letter-spacing: 0.5px; display: inline-block;
  }
  .role-owner { background: rgba(234,179,8,0.2); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
  .role-sovl { background: rgba(124,58,237,0.2); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
  .role-adm { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
  .role-user { background: rgba(160,160,184,0.1); color: var(--text3); border: 1px solid var(--border); }
  .role-banned { background: rgba(239,68,68,0.25); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); }

  /* CALL SCREEN */
  #call-screen {
    position: fixed; inset: 0; background: rgba(0,0,0,0.92);
    z-index: 300; display: none;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 18px;
  }
  #call-screen.active { display: flex; animation: fadeIn 0.3s; }
  .call-avatar { width: 100px; height: 100px; border-radius: 50%; overflow: hidden; border: 3px solid var(--accent); animation: glow 2s infinite; }
  .call-name { font-size: 22px; font-weight: 700; text-align: center; }
  .call-status { color: var(--text3); font-size: 14px; }
  .call-timer { font-size: 20px; color: var(--accent2); font-weight: 600; }
  .call-actions { display: flex; gap: 20px; margin-top: 20px; }
  .call-btn {
    width: 56px; height: 56px; border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; transition: all 0.2s;
  }
  .call-btn:hover { transform: scale(1.1); }
  .call-btn.end { background: var(--red); color: white; }
  .call-btn.mute { background: var(--bg3); color: var(--text); }
  .call-btn.cam { background: var(--bg3); color: var(--text); }

  /* INCOMING CALL */
  #incoming-call {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px 20px;
    z-index: 250; display: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: slideRight 0.3s;
  }
  #incoming-call.show { display: flex; flex-direction: column; gap: 12px; }
  .incoming-info { display: flex; align-items: center; gap: 10px; }
  .incoming-avatar { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; }
  .incoming-actions { display: flex; gap: 8px; }
  .incoming-btn { flex: 1; padding: 8px 12px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; transition: all 0.2s; }
  .incoming-btn.accept { background: var(--green); color: white; }
  .incoming-btn.decline { background: var(--red); color: white; }

  /* TOAST */
  #toast-container {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%); z-index: 400;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
  }
  .toast {
    padding: 10px 20px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
    animation: popIn 0.3s; min-width: 220px; text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); pointer-events: auto;
  }
  .toast.success { background: var(--green); color: white; }
  .toast.error { background: var(--red); color: white; }
  .toast.info { background: var(--accent); color: white; }

  /* ADMIN PANEL USER ITEM */
  .user-admin-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 10px;
    background: var(--bg3); margin-bottom: 8px;
  }
  .user-admin-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
  .user-admin-info { flex: 1; min-width: 0; }
  .user-admin-name { font-size: 13px; font-weight: 600; }
  .user-admin-username { font-size: 11px; color: var(--text3); }
  .role-select {
    background: var(--bg4); border: 1px solid var(--border);
    color: var(--text); border-radius: 6px; padding: 4px 8px;
    font-size: 12px; outline: none; cursor: pointer;
    font-family: inherit;
  }

  /* IMAGE UPLOAD */
  .img-upload-label {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border: 1.5px dashed var(--border);
    border-radius: 10px; cursor: pointer; color: var(--text3);
    font-size: 13px; transition: all 0.2s;
  }
  .img-upload-label:hover { border-color: var(--accent); color: var(--accent2); background: rgba(124,58,237,0.05); }
  #file-input { display: none; }

  /* SECTION TITLE */
  .section-title {
    font-size: 10px; color: var(--text3); font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    padding: 8px 12px 4px;
  }

  input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }
  [data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }

  /* ================================================================
     RESPONSIVE MOBILE ADAPTATION (< 768px) FOR CLOUDFLARE PAGES
     ================================================================ */
  @media (max-width: 768px) {
    .mobile-back-btn { display: flex; }
    .sidebar {
      width: 100%; min-width: 100%; height: 100%;
      position: absolute; inset: 0; z-index: 10;
    }
    .main-area {
      width: 100%; min-width: 100%; height: 100%;
      position: absolute; inset: 0; z-index: 20;
      transform: translateX(100%);
    }
    body.mobile-chat-open .sidebar {
      transform: translateX(-25%);
      pointer-events: none;
      opacity: 0.5;
    }
    body.mobile-chat-open .main-area {
      transform: translateX(0);
      pointer-events: all;
    }
    .panel-card {
      width: 94vw !important;
      padding: 18px !important;
      max-height: 90vh !important;
    }
    .auth-card {
      padding: 24px 20px !important;
      border-radius: 16px !important;
      width: 92vw !important;
    }
    .chat-header {
      padding: 10px 12px !important;
    }
    .input-area {
      padding: 10px 12px !important;
    }
    .messages-area {
      padding: 12px 10px !important;
    }
    .msg-bubble {
      max-width: 84% !important;
    }
    .ai-stats-grid {
      grid-template-columns: repeat(3, 1fr) !important;
      gap: 6px !important;
    }
    .ai-stat-card {
      padding: 6px !important;
    }
  }

  /* MULTI-BADGES */
  .badges-container {
    display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center;
  }
  .badge-tag {
    font-size: 10px; padding: 2px 7px; border-radius: 12px;
    font-weight: 700; letter-spacing: 0.3px; display: inline-flex; align-items: center; gap: 3px;
  }
  .badge-owner { background: rgba(234,179,8,0.2); color: #eab308; border: 1px solid rgba(234,179,8,0.4); }
  .badge-sovl { background: rgba(124,58,237,0.2); color: #a78bfa; border: 1px solid rgba(124,58,237,0.4); }
  .badge-adm { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.4); }
  .badge-blogger {
    background: linear-gradient(135deg, rgba(2,132,199,0.25), rgba(234,179,8,0.25));
    color: #38bdf8; border: 1px solid #0284c7;
  }
  .badge-blogger-check {
    background: #0284c7; color: white; border-radius: 50%; width: 12px; height: 12px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 900;
  }
  .badge-tester { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.4); }
  .badge-rp { background: rgba(244,63,94,0.2); color: #fb7185; border: 1px solid rgba(244,63,94,0.4); font-weight: 700; }

  /* MESSAGE STATUS TICKS */
  .msg-meta-row {
    display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; font-size: 10px;
  }
  .msg-ticks {
    display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; line-height: 1; letter-spacing: -2px; margin-left: 2px;
  }
  .msg-ticks.sent { opacity: 0.6; }
  .msg-ticks.read { color: #38bdf8; opacity: 1; text-shadow: 0 0 6px rgba(56,189,248,0.7); }

  /* ROLEPLAY CHAT HEADER & BADGES */
  .rp-badge-btn {
    padding: 4px 8px; border-radius: 6px; background: rgba(244,63,94,0.15);
    border: 1px solid rgba(244,63,94,0.3); color: #fb7185; font-size: 11px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 4px; transition: all 0.2s;
  }
  .rp-badge-btn:hover { background: rgba(244,63,94,0.3); }

  /* WEBRTC VIDEO OVERLAYS */
  #remote-video {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 305; background: #000;
  }
  #local-video {
    position: absolute; top: 20px; right: 20px; width: 120px; height: 160px; object-fit: cover;
    border-radius: 12px; border: 2px solid var(--accent); z-index: 325; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  }


  /* 7-DIGIT OTP VERIFICATION BOXES */
  .otp-7-container {
    display: flex; gap: 6px; justify-content: center; margin: 18px 0;
  }
  .otp-7-input {
    width: 40px; height: 50px; border-radius: 10px; background: var(--bg3);
    border: 1.5px solid var(--border); color: var(--text); font-size: 22px;
    font-weight: 800; text-align: center; outline: none; transition: all 0.2s;
    font-family: monospace;
  }
  .otp-7-input:focus {
    border-color: var(--accent); background: var(--bg2);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
  }
  @media (max-width: 400px) {
    .otp-7-input { width: 34px; height: 44px; font-size: 18px; }
  }


  /* PINNED MESSAGE BAR */
  .pinned-message-bar {
    display: none; padding: 8px 16px; background: var(--bg3);
    border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between;
    gap: 10px; cursor: pointer; transition: background 0.15s; z-index: 4;
  }
  .pinned-message-bar:hover { background: var(--bg4); }
  .pinned-message-content { flex: 1; min-width: 0; font-size: 12px; }
  .pinned-message-title { font-weight: 700; color: var(--accent2); display: flex; align-items: center; gap: 4px; }
  .pinned-message-snippet { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* EDITING PREVIEW BAR */
  .edit-preview-bar {
    display: none; padding: 6px 16px; background: rgba(124, 58, 237, 0.15);
    border-top: 1px solid var(--accent); align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--accent2);
  }

  /* MESSAGE ACTIONS HOVER TOOLBAR */
  .msg-actions-bar {
    position: absolute; top: -14px; right: 8px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 18px; padding: 2px 6px;
    display: none; align-items: center; gap: 4px; z-index: 20; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }
  .msg-wrapper:hover .msg-actions-bar { display: flex; }
  .msg-action-icon-btn {
    background: transparent; border: none; color: var(--text2); cursor: pointer;
    font-size: 13px; width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; transition: all 0.15s;
  }
  .msg-action-icon-btn:hover { background: var(--bg3); color: var(--accent2); transform: scale(1.1); }
  .msg-action-icon-btn.danger:hover { color: var(--red); }

  /* REACTION PICKER BAR */
  .reaction-picker-bar {
    position: absolute; bottom: 100%; right: 0; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 20px; padding: 4px 8px;
    display: none; gap: 6px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    animation: popIn 0.15s ease;
  }
  .reaction-pick-emoji {
    background: transparent; border: none; font-size: 18px; cursor: pointer;
    transition: transform 0.15s; padding: 2px 4px; border-radius: 6px;
  }
  .reaction-pick-emoji:hover { transform: scale(1.3); background: var(--bg3); }


  /* ================================================================
     ULTRA-SMOOTH ANIMATIONS & MODERN UI ENHANCEMENTS
     ================================================================ */
  
  /* Smooth Custom Scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    transition: background 0.2s;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

  /* Message Smooth Entrance Animation */
  .msg-wrapper {
    animation: msgSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  }
  @keyframes msgSlideIn {
    0% { opacity: 0; transform: translateY(12px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* Interactive Button Micro-interactions */
  .btn, .sidebar-icon-btn, .chat-call-btn, .nav-btn, .new-chat-btn, .send-btn {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .btn:active, .sidebar-icon-btn:active, .chat-call-btn:active, .send-btn:active {
    transform: scale(0.94);
  }

  /* Typing Indicator Animation */
  .typing-indicator-box {
    display: none; align-items: center; gap: 6px; padding: 4px 16px;
    font-size: 11.5px; color: var(--accent2); font-weight: 600;
  }
  .typing-dots { display: inline-flex; gap: 3px; align-items: center; margin-left: 2px; }
  .typing-dot {
    width: 4px; height: 4px; border-radius: 50%; background: var(--accent2);
    animation: typingBounce 1.4s infinite ease-in-out both;
  }
  .typing-dot:nth-child(1) { animation-delay: -0.32s; }
  .typing-dot:nth-child(2) { animation-delay: -0.16s; }
  @keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
  }

  /* In-Chat Message Search Bar */
  .in-chat-search-bar {
    display: none; padding: 8px 16px; background: var(--bg3);
    border-bottom: 1px solid var(--border); align-items: center; gap: 8px;
    animation: slideDown 0.2s ease;
  }
  .in-chat-search-input {
    flex: 1; background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 12px; color: var(--text); font-size: 13px; outline: none;
  }
  .in-chat-search-input:focus { border-color: var(--accent); }

  /* Voice Recording Controls */
  .voice-record-btn {
    width: 34px; height: 34px; border-radius: 50%; background: transparent;
    border: none; color: var(--text2); cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.2s;
  }
  .voice-record-btn:hover { color: var(--red); background: rgba(239,68,68,0.15); }
  .voice-record-btn.recording {
    background: var(--red); color: white; animation: pulseRed 1s infinite;
  }
  @keyframes pulseRed {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239,68,68,0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  }

  .voice-message-card {
    display: flex; align-items: center; gap: 10px; padding: 6px 8px;
    background: rgba(0,0,0,0.15); border-radius: 12px; min-width: 180px; margin: 4px 0;
  }
  .voice-play-btn {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
    color: white; border: none; cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 13px; flex-shrink: 0;
  }
  .voice-waveform-wrap { flex: 1; display: flex; align-items: center; gap: 2px; height: 20px; }
  .voice-bar {
    width: 3px; background: var(--accent2); border-radius: 2px; transition: height 0.15s;
  }

  @keyframes slideDown {
    0% { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
  }


  /* ================================================================
     ULTRA-MODERN GLASSMORPHISM & ERGONOMIC UI
     ================================================================ */
  
  :root {
    --bubble-radius: 16px;
    --dock-bg: rgba(22, 22, 31, 0.85);
  }

  /* Chat Filter Chips */
  .chat-filter-chips {
    display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto;
    scrollbar-width: none;
  }
  .chat-filter-chips::-webkit-scrollbar { display: none; }
  .filter-chip {
    padding: 4px 10px; border-radius: 14px; background: var(--bg3);
    border: 1px solid var(--border); color: var(--text3); font-size: 11.5px;
    font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s;
  }
  .filter-chip:hover { color: var(--text); background: var(--bg4); }
  .filter-chip.active {
    background: var(--accent); color: #ffffff; border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
  }

  /* Glassmorphism Headers & Floating Docks */
  .chat-header {
    background: rgba(22, 22, 31, 0.82) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
  }
  .input-box-container {
    background: rgba(22, 22, 31, 0.82) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
  }

  /* Message Bubble Enhancements */
  .msg-bubble {
    border-radius: var(--bubble-radius);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .msg-bubble:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }
  .msg-bubble.mine {
    background: linear-gradient(135deg, var(--accent), var(--accent2)) !important;
    border-bottom-right-radius: 4px !important;
  }
  .msg-bubble.other {
    background: var(--bg3) !important;
    border-bottom-left-radius: 4px !important;
    border: 1px solid var(--border) !important;
  }

  /* Lightbox Gallery Modal */
  .image-lightbox-modal {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 9999;
    display: none; align-items: center; justify-content: center; backdrop-filter: blur(10px);
    animation: popIn 0.2s ease;
  }
  .image-lightbox-modal.open { display: flex; }
  .lightbox-img {
    max-width: 92vw; max-height: 88vh; border-radius: 12px; object-fit: contain;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8); transition: transform 0.2s;
  }
  .lightbox-toolbar {
    position: absolute; top: 20px; right: 20px; display: flex; gap: 10px;
  }

  /* Attachment Floating Tray */
  .attachment-tray {
    position: absolute; bottom: 70px; left: 16px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 16px; padding: 12px;
    display: none; grid-template-columns: repeat(4, 1fr); gap: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5); z-index: 60; animation: popIn 0.2s ease;
  }
  .attachment-tray-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; padding: 8px 10px; border-radius: 10px; transition: background 0.15s;
  }
  .attachment-tray-item:hover { background: var(--bg3); }
  .attachment-tray-icon {
    width: 42px; height: 42px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 20px;
  }

  /* HD Smart Compression Progress Bar */
  .compression-progress-badge {
    position: fixed; bottom: 85px; right: 20px; background: var(--bg2);
    border: 1px solid var(--accent); border-radius: 20px; padding: 6px 14px;
    font-size: 11.5px; font-weight: 700; color: var(--accent2); display: none;
    align-items: center; gap: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); z-index: 100;
  }


  /* STORIES TRAY */
  .stories-tray {
    display: flex; gap: 10px; padding: 10px 14px 8px; overflow-x: auto;
    scrollbar-width: none; border-bottom: 1px solid var(--border);
  }
  .stories-tray::-webkit-scrollbar { display: none; }
  .story-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer; flex-shrink: 0; width: 56px;
  }
  .story-ring {
    width: 48px; height: 48px; border-radius: 50%; padding: 2px;
    background: linear-gradient(45deg, #f43f5e, #7c3aed, #0284c7);
    display: flex; align-items: center; justify-content: center; transition: transform 0.2s;
  }
  .story-ring.seen { background: var(--border); }
  .story-ring.add { background: var(--bg3); border: 1.5px dashed var(--accent2); }
  .story-ring:hover { transform: scale(1.08); }
  .story-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg2); }
  .story-name { font-size: 10.5px; color: var(--text2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 54px; }

  /* STORY VIEWER MODAL */
  .story-viewer-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.94); z-index: 10000;
    display: none; align-items: center; justify-content: center; backdrop-filter: blur(12px);
  }
  .story-viewer-modal.open { display: flex; }

  /* UNIVERSAL MODAL OVERLAY SYSTEM (kosoftiks v2 restored) */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.68);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
    z-index: 9500; padding: 20px;
  }
  .modal-overlay.open { display: flex; animation: fadeIn 0.18s ease; }
  .modal-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    animation: popIn 0.22s ease; max-height: 90vh; overflow-y: auto;
  }
  .story-viewer-card {
    width: 380px; max-width: 95vw; height: 600px; max-height: 90vh;
    background: var(--bg2); border-radius: 20px; overflow: hidden; position: relative;
    display: flex; flex-direction: column; justify-content: space-between; padding: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  }
  .story-progress-bar-wrap { display: flex; gap: 4px; width: 100%; margin-bottom: 10px; }
  .story-progress-segment { height: 3px; background: rgba(255,255,255,0.3); flex: 1; border-radius: 2px; overflow: hidden; }
  .story-progress-fill { height: 100%; background: #ffffff; width: 0%; transition: width 0.1s linear; }

  /* POLLS CARD */
  .poll-card {
    background: rgba(0,0,0,0.18); border: 1px solid var(--border);
    border-radius: 14px; padding: 12px 14px; min-width: 240px; max-width: 320px; margin: 4px 0;
  }
  .poll-question { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
  .poll-option-btn {
    width: 100%; text-align: left; padding: 8px 12px; border-radius: 10px;
    background: var(--bg3); border: 1px solid var(--border); color: var(--text);
    font-size: 12px; font-weight: 600; cursor: pointer; margin-bottom: 6px;
    position: relative; overflow: hidden; transition: all 0.2s;
  }
  .poll-option-btn:hover { border-color: var(--accent); }
  .poll-option-fill {
    position: absolute; top: 0; left: 0; bottom: 0; background: rgba(124, 58, 237, 0.25);
    z-index: 1; pointer-events: none; transition: width 0.3s ease;
  }
  .poll-option-content { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; }

  /* TRANSLATION & SELF-DESTRUCT BADGES */
  .msg-translation-box {
    margin-top: 6px; padding: 6px 10px; background: rgba(0,0,0,0.2);
    border-left: 2px solid var(--accent2); border-radius: 4px; font-size: 12px; color: var(--text);
  }
  .self-destruct-badge {
    display: inline-flex; align-items: center; gap: 3px; font-size: 10px;
    color: #f43f5e; font-weight: 800; animation: pulseRed 1s infinite;
  }


  /* VIDEO CIRCLE MESSAGES */
  .video-circle-wrap {
    width: 200px; height: 200px; border-radius: 50%; overflow: hidden;
    position: relative; border: 3px solid var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    background: #000; margin: 4px 0; cursor: pointer;
  }
  .video-circle-wrap video { width: 100%; height: 100%; object-fit: cover; }
  .video-circle-play-badge {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); font-size: 32px; color: #fff; transition: opacity 0.2s;
  }

  /* CODE BLOCKS TERMINAL CARD */
  .code-block-card {
    background: #09090d; border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; overflow: hidden; margin: 6px 0; font-family: monospace;
  }
  .code-block-header {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.05); padding: 4px 10px; font-size: 11px; color: var(--text3);
  }
  .code-block-body {
    padding: 10px 12px; font-size: 12.5px; color: #a78bfa; overflow-x: auto; white-space: pre-wrap;
  }

  /* AI SMART SUGGESTIONS CHIPS */
  .ai-suggestions-tray {
    display: flex; gap: 6px; padding: 4px 16px 6px; overflow-x: auto; scrollbar-width: none;
  }
  .ai-suggestions-tray::-webkit-scrollbar { display: none; }
  .ai-suggestion-chip {
    background: rgba(124, 58, 237, 0.15); border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: 14px; padding: 3px 10px; font-size: 11.5px; color: var(--accent2);
    font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s;
  }
  .ai-suggestion-chip:hover {
    background: var(--accent); color: white; transform: translateY(-1px);
  }

  /* SELF-DESTRUCT FLAME ANIMATION */
  @keyframes vaporizeFlame {
    0% { opacity: 1; transform: scale(1); filter: blur(0); }
    50% { opacity: 0.8; transform: scale(1.05) translateY(-4px); filter: blur(2px); }
    100% { opacity: 0; transform: scale(0.6) translateY(-16px); filter: blur(8px); }
  }
  .msg-vaporize {
    animation: vaporizeFlame 0.6s ease forwards !important;
  }


  /* ================================================================
     MILITARY-GRADE SECURITY & E2EE ENCRYPTION SUITE
     ================================================================ */

  /* E2EE Chat Header Shield Badge */
  .e2ee-shield-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
    border-radius: 12px; font-size: 10px; font-weight: 800; cursor: pointer;
    background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.35);
    transition: all 0.2s;
  }
  .e2ee-shield-badge:hover { background: rgba(34, 197, 94, 0.25); transform: scale(1.04); }

  /* App Lock PIN Screen Overlay */
  .app-lock-screen {
    position: fixed; inset: 0; background: #07070a; z-index: 999999;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    animation: popIn 0.25s ease;
  }
  .app-lock-screen.active { display: flex; }
  .app-lock-card {
    text-align: center; max-width: 320px; width: 100%;
  }
  .pin-dots-row { display: flex; gap: 14px; justify-content: center; margin: 20px 0 28px; }
  .pin-dot {
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .pin-dot.filled { background: var(--accent); transform: scale(1.15); box-shadow: 0 0 10px var(--accent); }
  .pin-keypad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 260px; margin: 0 auto;
  }
  .pin-key {
    width: 64px; height: 64px; border-radius: 50%; background: var(--bg3);
    border: 1px solid var(--border); color: var(--text); font-size: 22px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; user-select: none;
  }
  .pin-key:hover { background: var(--accent); color: white; border-color: var(--accent); transform: scale(1.06); }
  .pin-key:active { transform: scale(0.92); }

  /* Security Score Card in Settings */
  .security-score-box {
    background: linear-gradient(135deg, rgba(34,197,94,0.1), rgba(124,58,237,0.1));
    border: 1px solid rgba(34,197,94,0.3); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px;
  }
  .security-score-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .security-score-meter { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
  .security-score-fill { height: 100%; background: var(--green); width: 100%; transition: width 0.4s ease; }

  /* Active Sessions List */
  .session-card {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 8px; font-size: 12px;
  }


  /* ================================================================
     GRAND SETTINGS HUB (MODERN CATEGORIZED ARCHITECTURE)
     ================================================================ */
  .settings-hub-card {
    width: 820px; max-width: 96vw; height: 640px; max-height: 90vh;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6); animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .settings-hub-layout {
    display: flex; flex: 1; min-height: 0;
  }

  /* Left Category Navigation */
  .settings-nav-sidebar {
    width: 240px; background: var(--bg3); border-right: 1px solid var(--border);
    padding: 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
    flex-shrink: 0;
  }
  .settings-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-radius: 12px; color: var(--text2); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; background: transparent; border: none; width: 100%; text-align: left;
  }
  .settings-nav-item:hover { background: var(--bg4); color: var(--text); }
  .settings-nav-item.active {
    background: var(--accent) !important; color: #ffffff !important; font-weight: 700;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
  }
  .settings-nav-icon { font-size: 16px; flex-shrink: 0; }

  /* Right Category Content Area */
  .settings-content-body {
    flex: 1; overflow-y: auto; padding: 24px 28px; background: var(--bg2);
  }
  .settings-section-pane {
    display: none; animation: fadeIn 0.2s ease;
  }
  .settings-section-pane.active { display: block; }
  .settings-pane-header {
    font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px;
  }
  .settings-pane-sub {
    font-size: 12.5px; color: var(--text3); margin-bottom: 20px;
  }

  /* Hero Profile Header in Settings */
  .settings-hero-card {
    display: flex; align-items: center; gap: 16px; padding: 16px;
    background: var(--bg3); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 20px;
  }
  .settings-hero-avatar-wrap {
    width: 68px; height: 68px; border-radius: 50%; position: relative; flex-shrink: 0;
    border: 2.5px solid var(--accent); cursor: pointer; overflow: hidden;
  }
  .settings-hero-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
  .settings-hero-avatar-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: none;
    align-items: center; justify-content: center; font-size: 18px; color: #fff;
  }
  .settings-hero-avatar-wrap:hover .settings-hero-avatar-overlay { display: flex; }

  @media (max-width: 768px) {
    .settings-hub-layout { flex-direction: column; }
    .settings-nav-sidebar {
      width: 100%; border-right: none; border-bottom: 1px solid var(--border);
      flex-direction: row; overflow-x: auto; padding: 8px; flex-shrink: 0;
    }
    .settings-nav-item { white-space: nowrap; padding: 8px 12px; font-size: 12px; }
    .settings-content-body { padding: 16px; }
  }


  /* ================================================================
     KOSOFTIKS v2.2 — MOBILE UI 2.0 + НОВЫЙ ВИЗАРД РЕГИСТРАЦИИ
     ================================================================ */
  #bottom-nav { display: none; }
  /* КОМПОЗЕР v2 — современная форма отправки */
  .composer-v2 .composer-row {
    display: flex; align-items: flex-end; gap: 2px;
    background: var(--bg3); border: 1.5px solid var(--border);
    border-radius: 24px; padding: 5px 5px 5px 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .composer-v2 .composer-row:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
  }
  .composer-btn {
    width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent;
    color: var(--text3); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0; -webkit-tap-highlight-color: transparent;
  }
  .composer-btn:hover { background: var(--bg4); color: var(--accent2); }
  .composer-btn:active { transform: scale(0.9); }
  .composer-v2 .msg-input { padding: 9px 8px !important; }
  .composer-send {
    width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(124,58,237,0.4);
    transition: transform 0.15s, box-shadow 0.15s; -webkit-tap-highlight-color: transparent;
  }
  .composer-send:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(124,58,237,0.6); }
  .composer-send:active { transform: scale(0.92); }

  /* ================================================================
     🛡 KOSOFTIKS SECURITY CENTER (/api/v3/kosoftiks/security/) — v2.5
     ================================================================ */
  .ksec-overlay {
    position: fixed; inset: 0; z-index: 9800;
    background: rgba(4,4,10,0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    display: none; align-items: center; justify-content: center; padding: 16px;
  }
  .ksec-overlay.open { display: flex; animation: fadeIn 0.25s ease; }
  .ksec-card {
    width: 100%; max-width: 460px; max-height: 92dvh; overflow-y: auto;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
    padding: 22px; animation: popIn 0.25s ease;
  }
  .ksec-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
  .ksec-title h2 { font-size: 17px; font-weight: 900; color: var(--text); margin: 0; }
  .ksec-sub { font-size: 11.5px; color: var(--text3); margin-bottom: 18px; word-break: break-all; }
  .ksec-menu-btn {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    background: var(--bg3); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px; cursor: pointer; margin-bottom: 10px; color: var(--text);
    font-family: inherit; transition: all 0.2s;
  }
  .ksec-menu-btn:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,58,237,0.25); }
  .ksec-menu-btn .ksec-ico { font-size: 26px; width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .ksec-menu-btn h3 { font-size: 14px; font-weight: 800; margin: 0 0 3px; }
  .ksec-menu-btn p { font-size: 11px; color: var(--text3); margin: 0; line-height: 1.45; }
  .ksec-token-box {
    font-family: 'Courier New', monospace; font-size: 12px; color: var(--accent2);
    background: var(--bg3); border: 1px dashed var(--accent); border-radius: 10px;
    padding: 10px 12px; word-break: break-all; user-select: all; line-height: 1.5;
  }
  .ksec-ring-wrap { position: relative; width: 210px; height: 210px; margin: 14px auto 6px; }
  .ksec-ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
  .ksec-ring-bg { fill: none; stroke: var(--bg4); stroke-width: 9; }
  .ksec-ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
  .ksec-ring-label {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
  }
  .ksec-shield { font-size: 38px; animation: pulse 2s infinite; }
  .ksec-pct { font-size: 27px; font-weight: 900; color: var(--text); font-family: 'Courier New', monospace; }
  .ksec-stage { text-align: center; color: var(--accent2); font-size: 12.5px; min-height: 20px; font-weight: 700; }
  .ksec-timer { text-align: center; color: var(--text3); font-size: 11px; margin-top: 4px; font-family: monospace; }
  .ksec-particles { position: absolute; inset: 0; overflow: hidden; border-radius: 20px; pointer-events: none; }
  .ksec-particles span {
    position: absolute; bottom: -10px; border-radius: 50%;
    background: rgba(124,58,237,0.5); animation: ksecFloat linear infinite;
  }
  @keyframes ksecFloat {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    12% { opacity: 0.9; }
    100% { transform: translateY(-520px) scale(0.2); opacity: 0; }
  }
  .ksec-block-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; gap: 12px; padding: 24px; text-align: center;
  }

  /* 🎉 ПРИГЛАСИТЬ ДРУГА */
  .invite-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 8px 10px 2px; padding: 11px 14px; width: calc(100% - 20px);
    background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(59,130,246,0.15));
    border: 1.5px solid rgba(124,58,237,0.5); border-radius: 12px;
    color: var(--text); font-size: 12.5px; font-weight: 800; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
  }
  .invite-btn:hover { border-color: var(--accent2); box-shadow: 0 4px 18px rgba(124,58,237,0.35); transform: translateY(-1px); }
  .invite-target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
  .invite-target-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    padding: 12px 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
    cursor: pointer; color: var(--text); font-size: 11.5px; font-weight: 700; font-family: inherit;
    transition: all 0.15s; text-align: center;
  }
  .invite-target-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
  .invite-target-btn .it-ico { font-size: 21px; }
  .invite-user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background 0.15s; }
  .invite-user-row:hover { background: var(--bg3); }

  /* 🏷 ВЕРСИИ И БРЕНДИНГ KOSOFTIKS */
  .kosoftiks-version {
    padding: 10px 2px 0; margin-top: 10px; border-top: 1px solid var(--border);
    font-size: 9.5px; color: var(--text3); font-family: monospace;
    text-align: center; line-height: 1.6; opacity: 0.85; word-break: break-word;
  }
  .kosoftiks-power {
    text-align: center; font-size: 10px; font-weight: 800; color: var(--text3);
    letter-spacing: 0.4px; margin-top: 10px;
  }

  .reg-card { padding: 22px 20px !important; }
  .reg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .reg-head-logo {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900; color: #fff;
    box-shadow: 0 6px 18px rgba(124,58,237,0.4);
  }
  .reg-head-title { font-size: 19px; font-weight: 900; color: var(--text); margin: 0; line-height: 1.1; }
  .reg-head-sub { font-size: 11.5px; color: var(--text3); margin: 2px 0 0; }
  .reg-steps-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
  .reg-step-pill {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    font-size: 10.5px; font-weight: 800; color: var(--text3);
    background: var(--bg3); border: 1px solid var(--border);
    padding: 6px 4px; border-radius: 9px; white-space: nowrap; transition: all 0.25s;
  }
  .reg-step-pill span {
    width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
    background: var(--bg4); color: var(--text3); font-size: 9.5px;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 900;
  }
  .reg-step-pill.active { color: var(--accent2); border-color: var(--accent); background: rgba(124,58,237,0.12); }
  .reg-step-pill.active span { background: var(--accent2); color: #fff; }
  .reg-step-pill.done { color: var(--green); border-color: rgba(34,197,94,0.4); }
  .reg-step-pill.done span { background: var(--green); color: #fff; }
  .reg-step-line { flex: 0 0 10px; height: 2px; border-radius: 2px; background: var(--border); transition: background 0.25s; }
  .reg-step-line.done { background: var(--green); }
  /* 🤖 SMART CAPTCHA v2 */
  .ksc2-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 16px; border-radius: 12px; cursor: pointer;
    background: var(--bg3); border: 1.5px solid var(--border);
    color: var(--text); font-size: 13px; font-weight: 800; font-family: inherit;
    transition: all 0.2s;
  }
  .ksc2-btn:hover:not(:disabled) { border-color: var(--accent); }
  .ksc2-btn.passed { border-color: var(--green); background: rgba(34,197,94,0.1); }
  .ksc2-btn:disabled { opacity: 0.6; cursor: wait; }
  .ksc2-check { font-size: 15px; color: var(--text3); }
  .ksc2-btn.passed .ksc2-check { color: var(--green); }
  .ksc2-status { display: block; font-size: 11px; color: var(--text3); margin-top: 5px; }
  .ksc2-status.ok { color: var(--green); font-weight: 700; }
  .ksc2-status.bad { color: var(--red); font-weight: 700; }
  .ksc2-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 14px 0; }
  .ksc2-tile {
    position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
    border: 2.5px solid transparent; background: var(--bg3); aspect-ratio: 1;
    transition: border-color 0.15s, transform 0.15s;
  }
  .ksc2-tile svg { width: 100%; height: 100%; display: block; pointer-events: none; }
  .ksc2-tile:hover { transform: scale(1.03); }
  .ksc2-tile.sel { border-color: var(--accent2); }
  .ksc2-tile.sel::after {
    content: '✓'; position: absolute; top: 4px; right: 6px; color: #fff;
    font-size: 13px; font-weight: 900; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  }
  .ksc2-shake { animation: shake 0.5s; }
  .reg-card .form-group { margin-bottom: 10px !important; }
  .reg-card .form-control { padding: 9px 12px !important; font-size: 14px !important; }
  .reg-card .form-group label { font-size: 11px !important; margin-bottom: 4px !important; }
  .reg-card .btn { padding: 10px 14px !important; font-size: 13.5px !important; }
  .reg-card .avatar-grid { grid-template-columns: repeat(6, 1fr) !important; gap: 6px !important; }
  .reg-card .avatar-option { width: 100% !important; aspect-ratio: 1 !important; }
  .reg-card .avatar-option img { width: 100%; height: 100%; object-fit: cover; }
  .reg-card .avatar-preview-box { flex-direction: row !important; text-align: left; gap: 12px; align-items: center; }
  .reg-card .avatar-preview-img-wrap { width: 64px !important; height: 64px !important; margin: 0 !important; }

  @media (max-width: 768px) {
    #app { height: 100dvh; }
    .sidebar { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
    .sidebar-header { padding: 12px 14px 6px !important; }
    .sidebar-logo { font-size: 20px !important; }
    .sidebar-nav { display: none; }
    .stories-tray { padding: 8px 10px 2px !important; }
    .story-ring { width: 50px !important; height: 50px !important; }
    .story-ring.add { width: 50px !important; height: 50px !important; }
    .chat-filter-chips { padding: 4px 10px !important; overflow-x: auto; }
    .filter-chip { font-size: 11px !important; padding: 5px 10px !important; }
    .section-title { padding: 6px 14px 2px !important; font-size: 11.5px !important; }
    .chat-item { padding: 9px 10px !important; }
    .sidebar-bottom { padding: 8px 10px !important; }

    #bottom-nav {
      display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 400;
      background: var(--bg2); border-top: 1px solid var(--border);
      box-shadow: 0 -8px 30px rgba(0,0,0,0.35);
      padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    }
    body.mobile-chat-open #bottom-nav { display: none; }
    .bottom-nav-btn {
      flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
      background: none; border: none; cursor: pointer;
      color: var(--text3); font-size: 9.5px; font-weight: 800; padding: 6px 2px;
      border-radius: 12px; transition: all 0.15s; font-family: inherit;
      -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav-btn .bnav-emoji { font-size: 20px; line-height: 1; }
    .bottom-nav-btn.active { color: var(--accent2); background: rgba(124,58,237,0.12); }
    .bottom-nav-btn.danger { color: #f87171; }

    .chat-header { padding: 8px 10px !important; min-height: 52px; gap: 8px !important; }
    .chat-header-name { font-size: 14.5px !important; }
    .chat-header-status { font-size: 10.5px !important; }
    .input-area { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important; gap: 6px !important; }
    .messages-area { padding: 10px 8px !important; }
    .msg-bubble { max-width: 86% !important; font-size: 14px !important; }
    .msg-input { font-size: 14.5px !important; }

    .panel { align-items: flex-end; }
    .panel-card {
      width: 100% !important; max-width: 100% !important;
      max-height: 92dvh !important;
      border-radius: 20px 20px 0 0 !important;
      padding: 16px !important;
      padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
      animation: sheetUp 0.25s cubic-bezier(0.2,0.9,0.3,1);
    }
    .modal-overlay { align-items: flex-end; }
    .modal-card {
      width: 100% !important; max-width: 100% !important;
      max-height: 92dvh !important;
      border-radius: 20px 20px 0 0 !important;
      padding: 16px !important;
      padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
      animation: sheetUp 0.25s cubic-bezier(0.2,0.9,0.3,1);
    }
    .settings-hub-card { width: 100% !important; max-width: 100% !important; height: 100dvh !important; border-radius: 0 !important; }
    @keyframes sheetUp { from { transform: translateY(48px); opacity: 0.35; } to { transform: translateY(0); opacity: 1; } }

    #auth-screen { padding: 14px 10px !important; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .auth-card { padding: 20px 16px !important; width: 100% !important; max-width: 430px; margin: auto; }
    .auth-logo { margin-bottom: 14px !important; }
    .auth-logo h1 { font-size: 26px !important; }
    .auth-logo p { font-size: 12px !important; }
    .form-group { margin-bottom: 11px !important; }
    .form-group label { font-size: 11.5px !important; }
    .form-control { padding: 10px 12px !important; font-size: 15px !important; }
    .btn { padding: 11px 14px !important; font-size: 14px !important; }
    .otp-7-input { width: min(40px, calc((100vw - 92px) / 7)) !important; height: 46px !important; font-size: 19px !important; }
    .otp-7-container { gap: 5px !important; margin: 14px 0 !important; }
    .welcome-box { padding: 12px !important; }
    .app-lock-card { max-width: 300px; }
    .pin-key { width: 62px !important; height: 62px !important; font-size: 20px !important; }
  }


  /* ================================================================
     🌌 KOSOFTIKS DESIGN 2.0 «AURORA» — полный визуальный ребут
     ================================================================ */
  html:not([data-theme="light"]) body { background: #0b0b12; }

  /* --- Aurora фон: три мягких световых пятна, только transform --- */
  .aurora-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
  .aurora-blob { position: absolute; border-radius: 50%; will-change: transform; }
  .ab1 { width: 55vmax; height: 55vmax; top: -18vmax; left: -12vmax;
    background: radial-gradient(circle at 35% 35%, rgba(124,58,237,0.34), transparent 62%);
    animation: auroraDrift1 26s ease-in-out infinite alternate; }
  .ab2 { width: 48vmax; height: 48vmax; bottom: -16vmax; right: -10vmax;
    background: radial-gradient(circle at 60% 40%, rgba(59,130,246,0.26), transparent 62%);
    animation: auroraDrift2 32s ease-in-out infinite alternate; }
  .ab3 { width: 34vmax; height: 34vmax; top: 34%; left: 46%;
    background: radial-gradient(circle at 50% 50%, rgba(157,95,240,0.16), transparent 60%);
    animation: auroraDrift3 24s ease-in-out infinite alternate; }
  @keyframes auroraDrift1 { to { transform: translate(9vmax, 7vmax) scale(1.12); } }
  @keyframes auroraDrift2 { to { transform: translate(-8vmax, -6vmax) scale(1.08); } }
  @keyframes auroraDrift3 { to { transform: translate(-6vmax, 5vmax) scale(1.18); } }
  [data-theme="light"] .aurora-blob { opacity: 0.4; }
  @media (prefers-reduced-motion: reduce) { .aurora-blob { animation: none; } }

  #auth-screen, #app { position: relative; z-index: 1; }

  /* --- Стекло и панели --- */
  html:not([data-theme="light"]) .sidebar {
    background: rgba(19,19,27,0.78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.05);
  }
  html:not([data-theme="light"]) .main-area {
    background: rgba(13,13,19,0.88);
  }
  .panel-card, .modal-card, .settings-hub-card {
    background: rgba(24,24,34,0.92);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 24px 70px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  }
  [data-theme="light"] .panel-card, [data-theme="light"] .modal-card, [data-theme="light"] .settings-hub-card {
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.07);
  }

  /* --- Логотипы с градиентом --- */
  .sidebar-logo, .auth-logo h1, .reg-head-title {
    background: linear-gradient(120deg, #a78bfa, #60a5fa 55%, #e879f9);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    letter-spacing: -0.5px;
  }

  /* --- Список чатов --- */
  .chat-item {
    border-radius: 14px; margin: 2px 8px; border: 1px solid transparent;
    transition: background 0.18s, transform 0.18s, border-color 0.18s;
  }
  .chat-item:hover { background: rgba(255,255,255,0.045); transform: translateX(4px); border-color: rgba(255,255,255,0.05); }
  .chat-item.active { background: linear-gradient(120deg, rgba(124,58,237,0.22), rgba(59,130,246,0.13)); border-color: rgba(124,58,237,0.4); }
  .chat-item img, .chat-item .chat-avatar { border-radius: 14px !important; }

  .story-ring { border: 2.5px solid transparent; background:
    linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(135deg, #a78bfa, #60a5fa, #e879f9) border-box; }

  /* --- Сообщения --- */
  .msg-bubble { border-radius: 18px; }
  .msg-bubble.mine {
    background: linear-gradient(135deg, var(--accent), #6d28d9 70%, #4f46e5);
    border: none; color: #fff;
    box-shadow: 0 6px 22px rgba(124,58,237,0.32);
  }
  .msg-bubble.mine .msg-meta-row { color: rgba(255,255,255,0.75); }
  .msg-bubble.other {
    background: rgba(30,30,44,0.88); border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  }
  [data-theme="light"] .msg-bubble.other { background: #ffffff; border: 1px solid rgba(0,0,0,0.07); }
  .msg-wrapper.first-in-group .msg-bubble.mine { border-bottom-right-radius: 6px; }
  .msg-wrapper.first-in-group .msg-bubble.other { border-bottom-left-radius: 6px; }

  /* --- Кнопки --- */
  .btn-primary {
    background: linear-gradient(135deg, var(--accent), #6d28d9 60%, #4f46e5);
    border: none; position: relative; overflow: hidden;
    box-shadow: 0 6px 20px rgba(124,58,237,0.35);
    transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 9px 28px rgba(124,58,237,0.5); filter: brightness(1.06); }
  .btn-primary:active { transform: translateY(0) scale(0.985); }
  .btn-primary::after {
    content: ''; position: absolute; top: 0; left: -80%; width: 45%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,0.28), transparent);
    transform: skewX(-20deg); transition: left 0.5s ease;
  }
  .btn-primary:hover::after { left: 130%; }

  /* --- Поля ввода --- */
  .form-control {
    background: rgba(15,15,22,0.6); border: 1.5px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  }
  html:not([data-theme="light"]) .form-control { background: rgba(15,15,22,0.6); }
  .form-control:focus { border-color: var(--accent); background: rgba(20,20,30,0.8); box-shadow: 0 0 0 4px rgba(124,58,237,0.14); }

  /* --- Композер: свечение --- */
  .composer-v2 .composer-row { background: rgba(24,24,36,0.85); }
  [data-theme="light"] .composer-v2 .composer-row { background: #fff; }

  /* --- Чат-хедер: стекло --- */
  .chat-header {
    background: rgba(17,17,25,0.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  [data-theme="light"] .chat-header { background: rgba(255,255,255,0.85); border-bottom: 1px solid rgba(0,0,0,0.06); }

  /* --- Скроллбары --- */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.35); border-radius: 6px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.6); }
  * { scrollbar-width: thin; scrollbar-color: rgba(124,58,237,0.35) transparent; }
  ::selection { background: rgba(124,58,237,0.45); color: #fff; }

  /* --- Тонкая типографика --- */
  .section-title { text-transform: uppercase; letter-spacing: 1.2px; font-weight: 800; }
  .chat-header-name { letter-spacing: -0.2px; }

  /* --- Мобильная версия: плавающее стекло --- */
  @media (max-width: 768px) {
    #bottom-nav {
      left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom));
      border-radius: 22px; border: 1px solid rgba(255,255,255,0.08);
      background: rgba(20,20,30,0.82);
      backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
      box-shadow: 0 12px 40px rgba(0,0,0,0.5);
      padding: 6px;
    }
    .bottom-nav-btn { border-radius: 16px; }
    .bottom-nav-btn.active { background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(59,130,246,0.25)); color: #c4b5fd; }
    .panel-card, .modal-card { border-radius: 22px 22px 0 0 !important; }
    .msg-bubble { max-width: 84% !important; }
    .chat-item { margin: 2px 6px; }
    .aurora-blob { opacity: 0.8; }
  }

  /* --- Версия внизу --- */
  .kosoftiks-version { background: linear-gradient(90deg, transparent, rgba(124,58,237,0.1), transparent); border-top-color: rgba(255,255,255,0.05); }
