/* ============================================================
   Whatsgram — Telegram Desktop (AyuGram Night) look.
   Purple accent, sage-green outgoing bubbles, doodle wallpaper.
   ============================================================ */

:root[data-theme="dark"] {
  --bg:            #0c131c;
  --sidebar-bg:    #121c26;
  --header-bg:     #121c26;
  --panel-bg:      #0c131c;
  --surface:       #1a2531;   /* incoming bubble + cards */
  --surface-2:     #222f3c;
  --surface-hover: #1f2b37;
  --active:        rgba(108,92,231,.20);
  --in-bubble:     #1b2733;
  --out-bubble:    linear-gradient(160deg, #3f9e7c 0%, #2e8067 100%); /* refined teal-green */
  --out-bubble-hi: #46a886;
  --out-text:      #f3fbf7;
  --out-meta:      rgba(243,251,247,.72);
  --text:          #e7eef4;
  --text-2:        #8295a4;
  --text-3:        #586878;
  --divider:       rgba(255,255,255,.06);
  --accent:        #6c5ce7;   /* premium indigo */
  --accent-hi:     #7d6ef0;
  --link:          #5fb6f2;
  --tick:          #7d93a3;
  --tick-read:     #54c5f0;
  --badge:         #6c5ce7;
  --badge-muted:   #5a6b7b;
  --danger:        #e8615c;
  --shadow:        rgba(0,0,0,.6);
  --elev:          0 12px 40px rgba(0,0,0,.6);
  --prem-grad:     linear-gradient(135deg, #f7b733, #fc8c3c);
  --wp-stroke:     %232a5a42;
  --wp-op:         .85;
}

:root[data-theme="light"] {
  --bg:            #ffffff;
  --sidebar-bg:    #ffffff;
  --header-bg:     #ffffff;
  --panel-bg:      #d3e0ea;
  --surface:       #ffffff;
  --surface-2:     #f1f4f7;
  --surface-hover: #f1f4f7;
  --active:        rgba(135,116,225,.14);
  --in-bubble:     #ffffff;
  --out-bubble:    #c5edca;
  --out-bubble-hi: #b6e7bc;
  --out-text:      #0f2f17;
  --out-meta:      #4a8a5e;
  --text:          #0f1419;
  --text-2:        #62707c;
  --text-3:        #95a1ad;
  --divider:       #e9edf1;
  --accent:        #7a64d6;
  --accent-hi:     #6a55c4;
  --link:          #2f8fc4;
  --tick:          #8aa0ad;
  --tick-read:     #34b7f1;
  --badge:         #7a64d6;
  --badge-muted:   #b3bfc9;
  --danger:        #e0322c;
  --shadow:        rgba(0,0,0,.14);
  --elev:          0 10px 34px rgba(20,40,60,.16);
  --prem-grad:     linear-gradient(135deg, #f7b733, #fc8c3c);
  --wp-stroke:     %23a9c9b4;
  --wp-op:         .5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
input, textarea, button { font-family: inherit; }

/* ============ Auth (split hero) ============ */
.auth-screen { height: 100%; display: flex; }
.auth-hero {
  flex: 1.1; position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, #3b2d6b 0%, #2a2750 46%, #1c2b54 100%);
  padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero::before {
  content: ""; position: absolute; width: 560px; height: 560px;
  right: -180px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(135,116,225,.5), transparent 68%);
}
.auth-hero::after {
  content: ""; position: absolute; width: 420px; height: 420px;
  left: -160px; bottom: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,141,239,.4), transparent 68%);
}
.hero-content { position: relative; z-index: 1; max-width: 470px; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 46px; }
.brand-mark { width: 46px; height: 46px; }
.brand-name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -.5px; }
.hero-title { font-family: 'Manrope', sans-serif; font-size: 42px; line-height: 1.1; font-weight: 800; letter-spacing: -1px; margin-bottom: 18px; }
.hero-sub { font-size: 17px; line-height: 1.5; color: rgba(255,255,255,.78); max-width: 410px; }
.hero-feats { list-style: none; margin-top: 36px; display: flex; flex-direction: column; gap: 15px; }
.hero-feats li { display: flex; align-items: center; gap: 14px; font-size: 15.5px; color: rgba(255,255,255,.92); }
.hf-ic { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.13); border-radius: 11px; font-size: 16px; font-weight: 700; }
.hero-deco { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 9px; max-width: 360px; }
.deco-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14.5px; animation: floatUp .55s ease both; }
.deco-bubble.in { align-self: flex-start; background: rgba(255,255,255,.15); border-bottom-left-radius: 5px; }
.deco-bubble.out { align-self: flex-end; background: rgba(135,116,225,.92); border-bottom-right-radius: 5px; }
.deco-bubble:nth-child(2) { animation-delay: .14s; }
.deco-bubble:nth-child(3) { animation-delay: .28s; }
.db-tick { margin-left: 8px; font-size: 12px; color: #d9d2ff; }
@keyframes floatUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth-panel { width: 480px; flex-shrink: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; }
.auth-box { width: 340px; max-width: 100%; }
.auth-mark-sm { display: none; width: 58px; height: 58px; margin: 0 auto 18px; }
.auth-h1 { font-family: 'Manrope', sans-serif; font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.auth-p { color: var(--text-2); font-size: 14.5px; margin: 6px 0 24px; }
.seg { position: relative; display: flex; background: var(--surface); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.seg button { flex: 1; position: relative; z-index: 1; padding: 10px; border: none; background: none;
  color: var(--text-2); font-size: 14.5px; font-weight: 600; cursor: pointer; border-radius: 9px; transition: color .2s; }
.seg button.active { color: #fff; }
.seg-pill { position: absolute; top: 4px; left: 4px; width: calc(50% - 4px); height: calc(100% - 8px);
  background: var(--accent); border-radius: 9px; z-index: 0; transition: transform .25s cubic-bezier(.4,0,.2,1); }
.seg.reg .seg-pill { transform: translateX(100%); }
.field2 { display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid transparent; border-radius: 12px; margin-bottom: 12px; transition: border-color .15s; }
.field2:focus-within { border-color: var(--accent); }
.field2-ic { color: var(--text-3); font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.field2 input { flex: 1; padding: 14px 0; background: none; border: none; outline: none; color: var(--text); font-size: 15px; }
.field2 input::placeholder { color: var(--text-3); }
.auth-foot { margin-top: 28px; color: var(--text-3); font-size: 12.5px; }
.auth-form { display: flex; flex-direction: column; }
.field { position: relative; }
.field input { width: 100%; padding: 14px 16px; background: var(--surface); color: var(--text);
  border: 1.5px solid transparent; border-radius: 11px; font-size: 15px; outline: none; transition: border-color .15s; }
.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-3); }
.btn-primary { width: 100%; padding: 14px; margin-top: 4px; background: var(--accent); color: #fff;
  border: none; border-radius: 11px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s; }
.btn-primary:hover { background: var(--accent-hi); }
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-secondary { width: 100%; padding: 13px; margin-top: 10px; background: var(--surface); color: var(--text);
  border: none; border-radius: 11px; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-secondary:hover { background: var(--surface-hover); }
.auth-error { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; margin: 2px 0 10px; }

/* ============ App layout ============ */
.app { height: 100%; display: flex; }

.sidebar {
  width: 380px; min-width: 280px; position: relative;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-right: 1px solid var(--divider);
}
.sidebar-header { height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.ham-btn { flex-shrink: 0; }

.icon-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 50%; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* search pill */
.search-wrap { position: relative; flex: 1; }
.search-wrap.inset { padding: 8px 14px 0; flex: none; }
.search-wrap .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search-wrap.inset .search-icon { left: 28px; }
.search-wrap input { width: 100%; padding: 9px 16px 9px 42px; background: var(--surface); color: var(--text);
  border: 1.5px solid transparent; border-radius: 22px; outline: none; font-size: 14.5px; transition: border-color .15s, background .15s; }
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-3); }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); font-size: 20px; cursor: pointer; }

/* ============ Chat list ============ */
.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px 70px; }
.chat-item { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.chat-item:hover { background: var(--surface-hover); }
.chat-item.active { background: var(--active); }
.chat-item.active .chat-name { color: var(--text); }

.avatar { width: 54px; height: 54px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 20px; position: relative;
  background: var(--accent); overflow: visible; }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.prem::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; padding: 2px;
  background: var(--prem-grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
.avatar .online-dot { position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%;
  background: #4dd078; border: 2.5px solid var(--sidebar-bg); }

/* archive row */
.archive-row { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.archive-row:hover { background: var(--surface-hover); }
.archive-ic { width: 54px; height: 54px; flex-shrink: 0; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.archive-ic svg { width: 24px; height: 24px; }

.chat-main { flex: 1; min-width: 0; }
.chat-top, .chat-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.chat-time { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.chat-snippet { font-size: 14px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-snippet .snip-tick { display: inline-flex; vertical-align: -3px; margin-right: 3px; }
.badge { flex-shrink: 0; min-width: 21px; height: 21px; padding: 0 6px; background: var(--badge); color: #fff; border-radius: 11px;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.badge.muted { background: var(--badge-muted); }

/* compose FAB */
.fab { position: absolute; right: 18px; bottom: 18px; width: 54px; height: 54px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(135,116,225,.45); transition: background .15s, transform .12s; z-index: 5; }
.fab:hover { background: var(--accent-hi); }
.fab:active { transform: scale(.94); }
.fab svg { width: 24px; height: 24px; }

/* ============ Drawer ============ */
.drawer-overlay { position: fixed; inset: 0; z-index: 49; background: rgba(0,0,0,.45); animation: fade .15s ease; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; z-index: 50; background: var(--sidebar-bg);
  display: flex; flex-direction: column; box-shadow: 6px 0 30px rgba(0,0,0,.4); animation: slideIn .22s cubic-bezier(.3,.7,.2,1); }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-acc { display: flex; align-items: center; gap: 12px; padding: 18px 16px 16px;
  background: linear-gradient(135deg, #2c2550, #1d2540); color: #fff; }
.drawer-acc-av { width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; background: var(--accent); }
.drawer-acc-av img { width: 100%; height: 100%; object-fit: cover; }
.drawer-acc-info { flex: 1; min-width: 0; }
.drawer-acc-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-acc-sub { font-size: 13px; color: rgba(255,255,255,.7); margin-top: 2px; }
.drawer-acc #drawer-theme { color: rgba(255,255,255,.85); }
.drawer-acc #drawer-theme:hover { background: rgba(255,255,255,.12); color: #fff; }
.drawer-menu { flex: 1; overflow-y: auto; padding: 8px 8px; }
.drawer-menu button { width: 100%; display: flex; align-items: center; gap: 16px; padding: 12px 12px;
  background: none; border: none; border-radius: 10px; color: var(--text); font-size: 14.5px; cursor: pointer; text-align: left; }
.drawer-menu button svg { width: 22px; height: 22px; color: var(--text-2); }
.drawer-menu button:hover { background: var(--surface-hover); }
.drawer-menu button.prem-item svg { color: #f7b733; }
.drawer-menu button.danger, .drawer-menu button.danger svg { color: var(--danger); }
.drawer-foot { padding: 14px 16px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--divider); }

/* ============ Chat pane ============ */
.chat-pane { flex: 1; display: flex; flex-direction: column; background: var(--panel-bg); position: relative; }
.chat-pane::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: var(--wp-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='190' viewBox='0 0 190 190'%3E%3Cg fill='none' stroke='%232f6248' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 30c-6 0-10 6-6 11 4 4 12 2 12-5 0-4-3-6-6-6z'/%3E%3Cpath d='M24 20c4 2 6 6 4 10'/%3E%3Cpath d='M62 18c8 0 8 12 0 12s-8-12 0-12zM58 30c0 6 8 6 8 0'/%3E%3Ccircle cx='60' cy='22' r='1'/%3E%3Cpath d='M110 22c-4-4-12 0-10 6 1 4 6 5 10 2 4 3 9 2 10-2 2-6-6-10-10-6z'/%3E%3Cpath d='M150 16l3 7 7 1-5 5 1 7-6-4-6 4 1-7-5-5 7-1z'/%3E%3Cpath d='M30 70c10-8 20 2 12 10-4 4-12 4-14-2'/%3E%3Cpath d='M28 78c-3 3-1 8 3 8'/%3E%3Cpath d='M75 64c6 0 10 5 8 11-2 5-10 6-13 1'/%3E%3Ccircle cx='74' cy='70' r='1'/%3E%3Cpath d='M120 66c-5 5 0 14 7 11 6-2 5-12-2-13-2 0-4 1-5 2z'/%3E%3Cpath d='M124 60v6'/%3E%3Cpath d='M158 72c-8 0-8 10 0 10s8-10 0-10z'/%3E%3Cpath d='M153 70l-3-3M163 70l3-3'/%3E%3Cpath d='M22 120c0-7 11-7 11 0 0 5-6 9-6 9s-5-4-5-9z'/%3E%3Cpath d='M64 116c6-4 13 2 10 9-2 5-10 6-13 0'/%3E%3Cpath d='M108 118c8 0 8 11 0 11s-8-11 0-11z'/%3E%3Ccircle cx='105' cy='123' r='1'/%3E%3Ccircle cx='111' cy='123' r='1'/%3E%3Cpath d='M150 112l4 8 8 1-6 5 2 8-8-5-8 5 2-8-6-5 8-1z'/%3E%3Cpath d='M26 162c-6-3-12 3-9 9 2 5 10 5 13-1'/%3E%3Cpath d='M70 158c8 0 8 12 0 12s-8-12 0-12z'/%3E%3Cpath d='M66 168c0 5 8 5 8 0'/%3E%3Cpath d='M112 160c-5 0-8 4-6 8 2 5 9 5 12 0 2-4-1-8-6-8z'/%3E%3Cpath d='M118 156l-2 5'/%3E%3Cpath d='M152 158c8-4 15 4 10 11-3 4-11 4-14-2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 380px 380px;
}
:root[data-theme="light"] .chat-pane::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='190' viewBox='0 0 190 190'%3E%3Cg fill='none' stroke='%23a9c9b4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 30c-6 0-10 6-6 11 4 4 12 2 12-5 0-4-3-6-6-6z'/%3E%3Cpath d='M62 18c8 0 8 12 0 12s-8-12 0-12z'/%3E%3Cpath d='M110 22c-4-4-12 0-10 6 1 4 6 5 10 2 4 3 9 2 10-2 2-6-6-10-10-6z'/%3E%3Cpath d='M150 16l3 7 7 1-5 5 1 7-6-4-6 4 1-7-5-5 7-1z'/%3E%3Cpath d='M30 70c10-8 20 2 12 10-4 4-12 4-14-2'/%3E%3Cpath d='M120 66c-5 5 0 14 7 11 6-2 5-12-2-13-2 0-4 1-5 2z'/%3E%3Cpath d='M22 120c0-7 11-7 11 0 0 5-6 9-6 9s-5-4-5-9z'/%3E%3Cpath d='M108 118c8 0 8 11 0 11s-8-11 0-11z'/%3E%3Cpath d='M150 112l4 8 8 1-6 5 2 8-8-5-8 5 2-8-6-5 8-1z'/%3E%3Cpath d='M70 158c8 0 8 12 0 12s-8-12 0-12z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 380px 380px;
}

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; z-index: 1; }
.empty-pill { font-size: 14px; color: var(--text); background: rgba(20,30,42,.7); backdrop-filter: blur(4px);
  padding: 8px 18px; border-radius: 18px; }
:root[data-theme="light"] .empty-pill { background: rgba(255,255,255,.85); color: var(--text-2); }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 1; }
.chat-header { height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px;
  background: var(--header-bg); border-bottom: 1px solid var(--divider); }
.chat-header .hdr-click { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  cursor: pointer; border-radius: 8px; padding: 4px 8px; margin-left: -8px; transition: background .12s; height: 46px; }
.chat-header .hdr-click:hover { background: var(--surface-hover); }
.chat-header .hdr-name { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.chat-header .hdr-status { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.chat-header .hdr-status.online, .chat-header .hdr-status.typing { color: var(--accent); }
.chat-header .hdr-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.chat-header #back-btn { display: none; }

/* translate bar */
.translate-bar { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  height: 38px; background: var(--header-bg); border-bottom: 1px solid var(--divider); }
.tb-main { display: inline-flex; align-items: center; gap: 7px; color: var(--link); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.tb-main svg { width: 17px; height: 17px; }
.tb-set { position: absolute; right: 8px; width: 32px; height: 32px; }
.tb-set svg { width: 18px; height: 18px; }

/* messages */
.messages { flex: 1; overflow-y: auto; padding: 14px 6% 10px; display: flex; flex-direction: column; gap: 2px; position: relative; z-index: 1; }
.msg-day { align-self: center; margin: 12px 0; padding: 4px 12px; background: rgba(20,30,42,.7); color: #cfd8e0;
  border-radius: 14px; font-size: 12.5px; font-weight: 500; backdrop-filter: blur(3px); }
:root[data-theme="light"] .msg-day { background: rgba(255,255,255,.85); color: var(--text-2); }

.msg { max-width: 62%; padding: 5px 9px 6px; border-radius: 13px; position: relative; font-size: 14px; line-height: 1.34;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: 0 1px 1.5px rgba(0,0,0,.16); }
.msg.enter { animation: bubble .2s cubic-bezier(.2,.7,.3,1); }
@keyframes bubble { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.in  { align-self: flex-start; background: var(--in-bubble); border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--out-bubble); color: var(--out-text); border-bottom-right-radius: 5px; }
.msg.first-in, .msg.first-out { margin-top: 6px; }
.msg .sender { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 1px; }
.msg .meta { float: right; margin: 5px 0 -2px 8px; font-size: 10.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 3px; }
.msg.out .meta { color: var(--out-meta); }
.msg .meta .tick { display: inline-flex; }
.msg.out .meta .tick { color: var(--out-meta); }
.msg .meta .tick.read { color: var(--tick-read); }
.msg.out .meta .tick.read { color: #cdeffb; }
.tick svg, .snip-tick svg { width: 16px; height: 12px; stroke-width: 1.7; }
.tick.sending svg { width: 13px; height: 13px; opacity: .8; }
.typing-row { align-self: flex-start; }

/* ============ Composer ============ */
.composer { flex-shrink: 0; display: flex; align-items: flex-end; gap: 4px; padding: 8px 12px 12px;
  background: var(--header-bg); border-top: 1px solid var(--divider); position: relative; }
.composer textarea { flex: 1; resize: none; max-height: 130px; padding: 11px 6px; background: none; color: var(--text);
  border: none; outline: none; font-size: 15px; line-height: 1.4; }
.composer textarea::placeholder { color: var(--text-3); }
.send-btn { width: 46px; height: 46px; flex-shrink: 0; border: none; border-radius: 50%; background: none; color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s, transform .12s; }
.send-btn:hover { background: var(--surface-hover); }
.send-btn:active { transform: scale(.92); }
.send-btn svg { width: 24px; height: 24px; }
.comp-btn { width: 44px; height: 44px; flex-shrink: 0; }
.comp-btn svg { width: 24px; height: 24px; }

.rec-bar { position: absolute; inset: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px 14px; background: var(--header-bg); }
.rec-cancel { color: var(--danger); }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); animation: blink 1.1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; }
.rec-hint { color: var(--text-2); font-size: 14px; flex: 1; }
.rec-bar .send-btn { color: #fff; background: var(--accent); }
.rec-bar .send-btn:hover { background: var(--accent-hi); }

/* ============ Attachments ============ */
.msg.media { padding: 4px; position: relative; }
.msg.media .meta { float: none; position: absolute; right: 10px; bottom: 9px; margin: 0;
  background: rgba(0,0,0,.45); color: #fff !important; padding: 2px 7px; border-radius: 10px; z-index: 2; }
.msg.media .meta .tick { color: #fff !important; }
.msg-image { display: block; max-width: 280px; max-height: 340px; width: 100%; border-radius: 9px; cursor: pointer; object-fit: cover; }
.msg.media .caption { padding: 5px 7px 2px; }
.msg-file { display: flex; align-items: center; gap: 12px; padding: 5px 6px; min-width: 200px; }
.file-ic { width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: #fff; }
.file-ic svg { width: 22px; height: 22px; }
.file-meta { min-width: 0; }
.file-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.file-size { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.msg.out .file-size { color: var(--out-meta); }
.msg a.file-dl { color: inherit; text-decoration: none; }
.msg-voice { display: flex; align-items: center; gap: 11px; padding: 4px 4px; min-width: 210px; }
.voice-play { width: 42px; height: 42px; flex-shrink: 0; border: none; border-radius: 50%; background: var(--accent); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.msg.out .voice-play { background: rgba(255,255,255,.25); color: #fff; }
.voice-play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.voice-body { flex: 1; }
.voice-track { height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); position: relative; cursor: pointer; }
.msg.out .voice-track { background: rgba(255,255,255,.3); }
.voice-fill { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 2px; background: var(--accent); }
.msg.out .voice-fill { background: #fff; }
.voice-dur { font-size: 12px; color: var(--text-2); margin-top: 5px; font-variant-numeric: tabular-nums; }
.msg.out .voice-dur { color: var(--out-meta); }

/* ============ Rich profile view ============ */
.profile-modal-rich { width: 400px; }
.profile-view { padding: 0; }
.pv-hero { position: relative; padding: 28px 20px 18px; text-align: center; }
.pv-actions-top { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; }
.pv-actions-top .icon-btn { color: var(--text-2); }
.pv-avatar { width: 100px; height: 100px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 40px; font-weight: 600; overflow: hidden; position: relative; }
.pv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pv-name { font-size: 21px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.pv-status { font-size: 14px; color: var(--text-2); margin-top: 3px; display: inline-flex; align-items: center; gap: 5px; }
.pv-status.online { color: var(--accent); }
.pv-status .warn { color: var(--danger); display: inline-flex; }
.pv-status .warn svg { width: 15px; height: 15px; }
.pv-quick { display: flex; gap: 8px; padding: 4px 16px 16px; }
.pv-quick button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
  background: var(--surface-2); border: none; border-radius: 12px; color: var(--accent); font-size: 12.5px; cursor: pointer; transition: background .12s; }
.pv-quick button:hover { background: var(--surface-hover); filter: brightness(1.15); }
.pv-quick button svg { width: 22px; height: 22px; }
.pv-section { border-top: 8px solid var(--bg); padding: 8px 0; }
.pv-row { display: flex; align-items: flex-start; gap: 16px; padding: 9px 18px; cursor: default; }
.pv-row.tap { cursor: pointer; }
.pv-row.tap:hover { background: var(--surface-hover); }
.pv-row .pv-ic { width: 24px; flex-shrink: 0; color: var(--text-2); display: flex; justify-content: center; padding-top: 2px; }
.pv-row .pv-body { flex: 1; min-width: 0; }
.pv-row .pv-value { font-size: 15px; color: var(--text); word-break: break-word; }
.pv-row .pv-value.link { color: var(--link); }
.pv-row .pv-label { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.pv-row .pv-trail { color: var(--text-3); flex-shrink: 0; align-self: center; }
.pv-row .pv-count { color: var(--text-2); font-size: 15px; align-self: center; }
.pv-row.danger .pv-value, .pv-row.danger .pv-ic { color: var(--danger); }
.pv-stories { border-top: 8px solid var(--bg); padding: 26px 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.group-count { padding: 4px 18px 8px; color: var(--text-2); font-size: 13px; }

/* ============ Settings ============ */
.settings-modal-box { width: 420px; }
.settings-head { border-bottom: none; }
.settings-head .head-actions { display: flex; align-items: center; gap: 2px; }
.settings-scroll { overflow-y: auto; }
.settings-card { display: flex; align-items: center; gap: 14px; padding: 6px 18px 18px; }
.settings-card .sc-av { width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 600; }
.settings-card .sc-av img { width: 100%; height: 100%; object-fit: cover; }
.settings-card .sc-info { flex: 1; min-width: 0; }
.settings-card .sc-name { font-size: 18px; font-weight: 600; display: flex; align-items: center; }
.settings-card .sc-sub { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.settings-card .sc-sub b { color: var(--text); font-weight: 400; }
.settings-group { border-top: 8px solid var(--bg); padding: 6px 0; }
.set-item { width: 100%; display: flex; align-items: center; gap: 16px; padding: 11px 18px; background: none; border: none;
  color: var(--text); font-size: 15px; cursor: pointer; text-align: left; }
.set-item:hover { background: var(--surface-hover); }
.set-item .si-ic { width: 26px; height: 26px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.set-item .si-ic svg { width: 22px; height: 22px; }
.set-item .si-ic.accent { color: var(--accent); }
.set-item .si-ic.gold { color: #f7b733; }
.set-item .si-ic.danger { color: var(--danger); }
.set-item .danger-txt { color: var(--danger); }
.set-item .si-val { margin-left: auto; color: var(--accent); font-size: 14px; }

/* ============ Image viewer ============ */
.img-viewer { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; animation: fade .15s ease; }
.img-viewer img { max-width: 92vw; max-height: 90vh; border-radius: 8px; }
.iv-close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 30px; }

/* ============ Modals ============ */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 420px; max-width: 94vw; max-height: 88vh; background: var(--sidebar-bg); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px var(--shadow); animation: pop .16s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97);} to {opacity:1;transform:none;} }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-field { padding: 12px 18px 0; }
.modal-field label { display: block; font-size: 12.5px; color: var(--accent); margin-bottom: 5px; padding-left: 2px; }
.modal-action { width: calc(100% - 36px); margin: 16px 18px; }

.user-list { overflow-y: auto; padding: 6px; flex: 1; min-height: 80px; }
.user-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.user-item:hover { background: var(--surface-hover); }
.user-item .ui-main { flex: 1; min-width: 0; }
.user-item .ui-name { font-size: 15px; font-weight: 500; display: flex; align-items: center; }
.user-item .ui-sub { font-size: 13px; color: var(--text-2); }
.user-item .check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-item.selected .check { background: var(--accent); border-color: var(--accent); }
.user-item .check svg { width: 13px; height: 13px; color: #fff; opacity: 0; }
.user-item.selected .check svg { opacity: 1; }
.empty-hint { text-align: center; color: var(--text-3); padding: 24px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 18px 0; }
.chip { display: flex; align-items: center; gap: 6px; padding: 5px 8px 5px 5px; background: var(--surface); border-radius: 16px; font-size: 13px; }
.chip .avatar { width: 24px; height: 24px; font-size: 11px; }
.chip .x { cursor: pointer; color: var(--text-3); font-size: 16px; line-height: 1; }

.create-avatar { text-align: center; padding: 18px 0 8px; }
.create-avatar-circle { width: 100px; height: 100px; margin: 0 auto; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--accent); color: #fff; font-size: 40px; font-weight: 600; position: relative; }
.create-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.create-avatar-circle svg { width: 34px; height: 34px; opacity: .9; }
.create-avatar-hint { color: var(--accent); font-size: 13px; margin-top: 8px; cursor: pointer; }
#profile-avatar { width: 96px; height: 96px; margin: 0 auto; }
.profile-username { text-align: center; color: var(--text-2); font-size: 14px; padding: 6px 0 2px; }

/* ============ Scrollbars ============ */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-thumb { background: var(--surface-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.chat-list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb { background: transparent; }
.chat-list:hover::-webkit-scrollbar-thumb, .messages:hover::-webkit-scrollbar-thumb { background: var(--surface-hover); }

/* ============ Badges & emoji status ============ */
.prem-badge { display: inline-flex; vertical-align: -2px; margin-left: 4px; width: 16px; height: 16px;
  align-items: center; justify-content: center; background: var(--prem-grad); border-radius: 50%; color: #fff; font-size: 10px; }
.emoji-st { margin-left: 4px; font-size: .92em; }

/* ============ Emoji / sticker panel ============ */
.emoji-panel { position: absolute; bottom: 64px; right: 12px; width: 340px; max-width: calc(100% - 24px); height: 300px;
  background: var(--sidebar-bg); border-radius: 14px; box-shadow: 0 12px 40px var(--shadow); display: flex; flex-direction: column; overflow: hidden; z-index: 30; animation: pop .14s ease; }
.ep-tabs { display: flex; border-bottom: 1px solid var(--divider); flex-shrink: 0; }
.ep-tabs button { flex: 1; padding: 11px; background: none; border: none; color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.ep-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.ep-body { flex: 1; overflow-y: auto; padding: 8px; }
.emoji-cat-title { font-size: 11.5px; color: var(--text-3); padding: 8px 4px 4px; text-transform: uppercase; letter-spacing: .04em; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button { background: none; border: none; font-size: 23px; padding: 5px 0; cursor: pointer; border-radius: 8px; line-height: 1.2; }
.emoji-grid button:hover { background: var(--surface-hover); }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sticker-grid button { background: none; border: none; font-size: 46px; padding: 8px 0; cursor: pointer; border-radius: 12px; }
.sticker-grid button:hover { background: var(--surface-hover); }
.sticker-pack-title { font-size: 12px; color: var(--text-3); padding: 10px 4px 4px; display: flex; align-items: center; gap: 6px; }
.sticker-locked { opacity: .45; }
.sticker-lock-note { text-align: center; color: var(--text-2); font-size: 13px; padding: 8px; }

.msg.sticker { background: transparent !important; box-shadow: none; padding: 0; max-width: 50%; }
.sticker-emoji { font-size: 78px; line-height: 1; display: block; }
.msg.sticker .meta { float: none; display: block; text-align: right; color: var(--text-3) !important; margin: 2px 4px 0; }

.prem-chip { display: inline-block; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--prem-grad);
  padding: 2px 7px; border-radius: 8px; margin-left: 6px; vertical-align: 1px; }
.status-pick { width: 100%; text-align: left; padding: 13px 14px; background: var(--surface); border: 1.5px solid transparent;
  border-radius: 12px; color: var(--text); font-size: 15px; cursor: pointer; }
.status-pick:hover { border-color: var(--accent); }

/* ============ Premium modal ============ */
.premium-modal { width: 420px; }
.premium-hero { text-align: center; padding: 26px 20px 14px; background: linear-gradient(150deg, #f7b733, #fc8c3c); color: #fff; }
.premium-star { font-size: 52px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.premium-title { font-family: 'Manrope', sans-serif; font-size: 24px; font-weight: 800; margin-top: 8px; }
.premium-sub { font-size: 14px; opacity: .92; margin-top: 4px; }
.premium-feats { padding: 14px 18px 4px; display: flex; flex-direction: column; gap: 6px; }
.pf { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 12px; }
.pf:hover { background: var(--surface-hover); }
.pf-ic { width: 40px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); border-radius: 11px; font-size: 19px; }
.pf b { display: block; font-size: 14.5px; }
.pf span { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 1px; }

/* ============ Channel locked composer ============ */
.locked-note { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px;
  background: var(--header-bg); border-top: 1px solid var(--divider); color: var(--text-2); font-size: 14px; }
.locked-note svg { width: 17px; height: 17px; }

/* ============ Message actions ============ */
.msg-menu-btn { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border: none; border-radius: 50%; cursor: pointer; padding: 0;
  background: rgba(10,16,22,.45); color: #fff; opacity: 0; display: flex; align-items: center; justify-content: center; transition: opacity .12s, background .12s; z-index: 3; }
.msg:hover .msg-menu-btn { opacity: .9; }
.msg-menu-btn:hover { background: rgba(10,16,22,.7); }
.msg-menu-btn svg { width: 15px; height: 15px; }
.msg.sticker .msg-menu-btn { background: rgba(10,16,22,.55); }

.reply-quote { display: block; border-left: 3px solid var(--accent); cursor: pointer; padding: 3px 9px; margin: 0 0 5px; border-radius: 5px;
  background: rgba(127,127,127,.14); max-width: 280px; }
.rq-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.rq-text { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.out .reply-quote { background: rgba(255,255,255,.16); border-left-color: rgba(255,255,255,.75); }
.msg.out .rq-name { color: #fff; }
.msg.out .rq-text { color: rgba(255,255,255,.82); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 2px 8px; border: none; border-radius: 13px; font-size: 14px;
  background: rgba(127,127,127,.2); color: var(--text); transition: transform .1s, filter .12s; }
.reaction span { font-size: 12px; font-weight: 700; }
.reaction.mine { background: var(--accent); color: #fff; }
.msg.out .reaction { background: rgba(255,255,255,.18); color: #fff; }
.msg.out .reaction.mine { background: rgba(255,255,255,.34); color: #fff; }
.reaction:hover { filter: brightness(1.08); }
.reaction:active { transform: scale(.92); }
.meta .edited { opacity: .8; font-style: italic; }

.msg.flash { animation: flashring 1.25s ease; }
@keyframes flashring { 0%, 100% { box-shadow: 0 1px 1px rgba(0,0,0,.18); } 25% { box-shadow: 0 0 0 3px var(--accent); } }

/* context menu */
.ctx-menu { position: fixed; z-index: 300; min-width: 190px; background: var(--surface); border-radius: 13px; padding: 6px; box-shadow: var(--elev); animation: pop .12s ease; }
.ctx-react { display: flex; gap: 2px; padding: 3px 2px 7px; margin-bottom: 5px; border-bottom: 1px solid var(--divider); }
.ctx-react button { flex: 1; background: none; border: none; font-size: 21px; cursor: pointer; padding: 5px 0; border-radius: 9px; transition: transform .1s, background .12s; }
.ctx-react button:hover { background: var(--surface-hover); transform: scale(1.25); }
.ctx-item { width: 100%; display: flex; align-items: center; gap: 13px; cursor: pointer; padding: 9px 12px; background: none; border: none; border-radius: 9px; color: var(--text); font-size: 14px; text-align: left; }
.ctx-item svg { width: 18px; height: 18px; color: var(--text-2); }
.ctx-item:hover { background: var(--surface-hover); }
.ctx-item.danger, .ctx-item.danger svg { color: var(--danger); }

/* composer reply/edit context */
.composer-context { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--header-bg); border-top: 1px solid var(--divider); }
.cc-bar { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding: 1px 10px; }
.cc-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.cc-text { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-context + .composer { border-top: none; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 400;
  background: #2a2440; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--elev); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }

/* ============ Folder tabs ============ */
.folder-tabs { display: flex; gap: 4px; padding: 0 8px 6px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.folder-tabs::-webkit-scrollbar { display: none; }
.folder-tab { flex-shrink: 0; padding: 7px 14px; background: none; border: none; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
.folder-tab:hover { background: var(--surface-hover); }
.folder-tab.active { color: #fff; background: var(--accent); }

/* mute icon in chat row */
.mute-ic { display: inline-flex; vertical-align: -3px; margin-right: 3px; color: var(--text-3); }
.mute-ic svg { width: 15px; height: 15px; }

/* ============ In-chat search ============ */
.chat-search { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: var(--header-bg); border-bottom: 1px solid var(--divider); }
.chat-search .search-wrap { flex: 1; }
.cs-count { font-size: 13px; color: var(--text-2); flex-shrink: 0; min-width: 18px; text-align: center; }
.chat-search-results { flex-shrink: 0; max-height: 40%; overflow-y: auto; background: var(--sidebar-bg);
  border-bottom: 1px solid var(--divider); z-index: 2; }
.cs-row { padding: 9px 16px; cursor: pointer; border-bottom: 1px solid var(--divider); }
.cs-row:hover { background: var(--surface-hover); }
.cs-who { font-size: 12.5px; color: var(--accent); }
.cs-text { font-size: 14px; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ Gift message + modal ============ */
.msg.gift-msg { background: transparent !important; box-shadow: none; padding: 0; max-width: 250px; }
.gift-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  padding: 18px 22px 15px; border-radius: 16px;
  background: linear-gradient(165deg, #2b2548 0%, #1c2742 100%); border: 1px solid rgba(255,255,255,.08); }
.gift-visual { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); }
.gift-visual img { width: 74px; height: 74px; }
.gift-visual .raw { font-size: 60px; line-height: 1; }
.gift-from { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.gift-from .gift-uic { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 700; }
.gift-note { font-size: 12.5px; color: var(--text-2); }
.gift-view { margin-top: 8px; padding: 7px 26px; border: none; border-radius: 16px;
  background: rgba(255,255,255,.13); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .12s; }
.gift-view:hover { background: rgba(255,255,255,.22); }
.msg.gift-msg .meta { display: block; text-align: right; color: var(--text-3) !important; margin: 4px 6px 0; float: none; }
.gift-bal { padding: 6px 18px 0; color: var(--text-2); font-size: 13.5px; }
.gift-bal b { color: var(--text); }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 16px 18px; }
.gift-grid button { background: var(--surface-2); border: none; border-radius: 14px; font-size: 38px; padding: 10px 0; cursor: pointer; transition: transform .1s, background .12s; }
.gift-grid button:hover { background: var(--surface-hover); transform: scale(1.06); }

/* ============ Stars modal ============ */
.stars-hero { text-align: center; padding: 26px 20px 8px; }
.stars-big { font-size: 60px; line-height: 1; color: #f7b733; filter: drop-shadow(0 4px 12px rgba(247,183,51,.4)); }
.stars-count { font-family: 'Manrope', sans-serif; font-size: 34px; font-weight: 800; margin-top: 6px; }
.stars-sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.stars-packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 14px 18px 18px; }
.star-pack { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 13px; background: var(--surface-2);
  border: none; border-radius: 14px; cursor: pointer; transition: background .12s, transform .1s; }
.star-pack:hover { background: var(--surface-hover); transform: translateY(-1px); }
.sp-amt { font-size: 16px; font-weight: 700; color: #f7b733; }
.sp-price { font-size: 13px; color: var(--text-2); }

/* ============ Settings switch & rows ============ */
.set-item .si-label { flex: 1; }
.switch { width: 38px; height: 22px; border-radius: 12px; background: var(--surface-2); position: relative; flex-shrink: 0; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

/* ============ Folders management ============ */
.folders-list { padding: 6px; max-height: 50vh; overflow-y: auto; }
.folder-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.folder-row:hover { background: var(--surface-hover); }
.folder-row-name { font-size: 15px; font-weight: 500; flex: 1; }
.folder-row-count { font-size: 13px; color: var(--text-2); }
.fr-edit svg, .fr-del svg { width: 18px; height: 18px; }
.fr-del { color: var(--danger); }

/* ============ Translation line ============ */
.tr-line { display: block; margin-top: 4px; padding-top: 4px; border-top: 1px dashed currentColor;
  font-size: 14px; opacity: .85; }
.msg.in .tr-line { border-color: rgba(255,255,255,.18); }
.translate-bar.on .tb-main { color: var(--accent); font-weight: 600; }

/* ============ Call overlay ============ */
.call-overlay { position: fixed; inset: 0; z-index: 350; display: flex; align-items: center; justify-content: center;
  background: rgba(8,12,18,.72); backdrop-filter: blur(8px); animation: fade .15s ease; }
.call-card { display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--sidebar-bg); padding: 38px 44px 30px; border-radius: 24px; box-shadow: var(--elev); min-width: 300px; }
.call-avatar { width: 110px; height: 110px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 44px; font-weight: 600; background: var(--accent); box-shadow: 0 0 0 0 rgba(135,116,225,.5); animation: callpulse 1.8s infinite; }
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
@keyframes callpulse { 0% { box-shadow: 0 0 0 0 rgba(135,116,225,.45); } 70% { box-shadow: 0 0 0 22px rgba(135,116,225,0); } 100% { box-shadow: 0 0 0 0 rgba(135,116,225,0); } }
.call-name { font-size: 22px; font-weight: 700; margin-top: 6px; }
.call-status { font-size: 14px; color: var(--text-2); }
.call-timer { font-size: 15px; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
.call-actions { display: flex; gap: 20px; margin-top: 22px; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; transition: transform .12s, filter .12s; }
.call-btn:hover { filter: brightness(1.1); }
.call-btn:active { transform: scale(.92); }
.call-btn svg { width: 26px; height: 26px; }
.call-btn.accept { background: #36c25e; }
.call-btn.decline { background: var(--danger); }
.call-btn.decline svg { transform: rotate(135deg); }
.call-btn.mute { background: var(--surface-2); color: var(--text); }
.call-btn.mute.off { background: var(--danger); color: #fff; }

/* ============ Twemoji images ============ */
img.emoji { width: 1.25em; height: 1.25em; vertical-align: -0.22em; margin: 0 .02em; object-fit: contain; }
.sticker-emoji img.emoji, .msg.sticker img.emoji { width: 104px; height: 104px; vertical-align: middle; }
.emoji-grid img.emoji { width: 26px; height: 26px; vertical-align: middle; }
.sticker-grid img.emoji { width: 58px; height: 58px; vertical-align: middle; }
.gift-grid img.emoji { width: 40px; height: 40px; vertical-align: middle; }
.gift-visual img.emoji { width: 74px; height: 74px; }
.emoji-st img.emoji, .prem-chip img.emoji { width: 1em; height: 1em; vertical-align: -.15em; }
.chat-name img.emoji, .hdr-name img.emoji, .pv-name img.emoji, .drawer-acc-name img.emoji, .sc-name img.emoji, .ui-name img.emoji { width: 1.1em; height: 1.1em; vertical-align: -.2em; }

/* ============ Reduce animations ============ */
:root[data-noanim] *, :root[data-noanim] *::before, :root[data-noanim] *::after {
  animation-duration: .001s !important; transition-duration: .001s !important;
}

/* ============ Responsive ============ */
@media (max-width: 920px) {
  .auth-hero { display: none; }
  .auth-panel { width: 100%; flex: 1; }
  .auth-mark-sm { display: block; }
}
@media (max-width: 720px) {
  .sidebar { width: 100%; position: absolute; inset: 0; z-index: 20; }
  .app.chat-open .sidebar { display: none; }
  .chat-pane { width: 100%; }
  .chat-header #back-btn { display: flex; }
  .drawer { width: 86%; max-width: 320px; }
}
