/* ═══════════════════════════════════════════════════════════════
   QURO — Mobile UI System (Complete Rewrite)
   Design: WhatsApp speed + Discord engagement + Zerodha clarity
   Touch: 44px min targets | 8px grid | iOS-native feel
   ═══════════════════════════════════════════════════════════════ */


/* ═══ BOTTOM NAV BAR ═══ */
/* Visible on phones + tablets (≤1024px, iPad landscape included) */
#mobileNav{
  display:none;
  position:fixed;bottom:0;left:0;right:0;
  height:calc(56px + env(safe-area-inset-bottom,0px));
  background:rgba(10,10,12,.95);
  -webkit-backdrop-filter:saturate(180%) blur(28px);
  backdrop-filter:saturate(180%) blur(28px);
  border-top:1px solid rgba(255,255,255,.06);
  padding:0 12px;
  padding-bottom:env(safe-area-inset-bottom,0px);
  z-index:var(--z-call);
  justify-content:space-around;
  align-items:center;
}
/* Fill any gap below the nav on devices where env() returns 0 but system bar exists */
#mobileNav::after{
  content:'';
  position:absolute;
  left:0;right:0;
  top:100%;
  height:50px;
  background:rgba(10,10,12,1);
  pointer-events:none;
}
.mob-nav-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;
  background:none;border:none;
  color:var(--muted);opacity:.5;
  cursor:pointer;padding:6px 12px;
  border-radius:var(--r-lg);
  transition:color 200ms var(--ease-out),opacity 200ms var(--ease-out),transform var(--dur-normal) var(--ease-spring);
  min-width:52px;min-height:48px;
  position:relative;
  -webkit-tap-highlight-color:transparent;
}
.mob-nav-btn:active{transform:scale(.9);transition-duration:80ms}
.mob-nav-btn.active{color:var(--primary);opacity:1}
.mob-nav-btn.active::before{
  content:'';position:absolute;
  top:2px;left:50%;
  width:16px;height:3px;
  border-radius:2px;
  background:var(--primary);
  transform:translateX(-50%);
  animation:navPillIn .3s var(--ease-spring);
  box-shadow:0 0 8px var(--primary-dim);
}
@keyframes navPillIn{from{transform:translateX(-50%) scaleX(0);opacity:0}to{transform:translateX(-50%) scaleX(1);opacity:1}}
.mob-nav-svg{width:22px;height:22px;opacity:.3;transition:opacity 200ms var(--ease-out),transform 200ms var(--ease-spring)}
.mob-nav-btn.active .mob-nav-svg{opacity:1;filter:drop-shadow(0 0 8px rgba(56,161,105,.35));transform:scale(1.05)}
.mob-nav-label{font-size:10px;font-weight:var(--weight-semi);letter-spacing:.3px;opacity:.45;transition:opacity 200ms var(--ease-out)}
.mob-nav-btn.active .mob-nav-label{opacity:1}

/* ═══ STRICT: Bottom nav ONLY on phones (≤767px) ═══ */
/* Above 767px the desktop sidebar provides navigation — no bottom nav needed */
@media(min-width:768px){
  #mobileNav{display:none!important}
}


/* ═══ MOBILE MEMBERS PANEL ═══ */
#mobileMembersPanel{
  position:fixed;inset:0;
  background:var(--bg);
  z-index:var(--z-modal);
  display:flex;flex-direction:column;
  transform:translateX(100%);
  transition:transform var(--dur-slow) cubic-bezier(.32,.72,.0,1);
  padding-top:var(--st);
}
#mobileMembersPanel.open{transform:translateX(0)}
.mm-head{
  display:flex;justify-content:space-between;align-items:center;
  padding:14px 16px;
  font-weight:var(--weight-bold);font-size:16px;color:var(--text);
  border-bottom:1px solid var(--border2);flex-shrink:0;
}
.mm-close{
  background:var(--surface-1);border:1px solid var(--border);
  color:var(--muted);width:36px;height:36px;
  border-radius:var(--r-md);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:transform var(--dur-fast) ease,background 150ms ease;
}
.mm-close:active{transform:scale(.95)}
#mobileMembersList{padding:8px 16px;flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}


/* ═══ SIDEBAR DRAWER ═══ */
#sidebarOverlay{
  position:fixed;inset:0;
  background:rgba(0,0,0,0);z-index:var(--z-overlay);
  pointer-events:none;
  transition:background 200ms var(--ease-out),opacity 200ms var(--ease-out);
}
#sidebarOverlay.open{background:rgba(0,0,0,.5);pointer-events:auto}
#sidebarDrawer{
  position:fixed;top:0;left:0;bottom:0;
  width:min(320px,85vw);
  background:var(--bg);
  border-right:1px solid var(--border2);
  display:flex;flex-direction:column;
  z-index:var(--z-sidebar);
  transform:translateX(-102%);
  transition:transform 320ms cubic-bezier(.32,.72,.0,1),box-shadow 320ms var(--ease-out);
  padding-top:var(--st);
  will-change:transform;
}
#sidebarDrawer.open{transform:translateX(0);box-shadow:8px 0 40px rgba(0,0,0,.35),2px 0 12px rgba(0,0,0,.15)}
#drawerScroll{flex:1;overflow-y:auto;padding:4px 10px;-webkit-overflow-scrolling:touch}
#drawerUserBar{
  padding:12px 16px calc(12px + 56px + var(--sb));
  border-top:1px solid var(--border2);
  display:flex;align-items:center;gap:12px;flex-shrink:0;
  background:var(--surface-0);
  min-height:60px;
}


/* ═══ DRAWER NAV SYSTEM ═══ */

/* Header bar with logo + close */
.dw-header{
  display:flex;align-items:center;gap:10px;
  padding:14px 16px;
  height:56px;
  border-bottom:1px solid var(--border2);
  flex-shrink:0;
  background:var(--bg);
}
.dw-logo-img{
  width:24px;height:24px;border-radius:var(--r-sm);
  object-fit:contain;
}
.dw-logo-text{
  font-size:18px;font-weight:var(--weight-bold);
  color:var(--text);flex:1;
  letter-spacing:.3px;
}
.dw-close{
  width:32px;height:32px;border-radius:var(--r-md);
  background:var(--surface-1);border:1px solid var(--border);
  color:var(--muted);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background var(--dur-fast),color var(--dur-fast),transform var(--dur-fast) ease;
  flex-shrink:0;
}
.dw-close:hover{background:var(--surface-3);color:var(--text)}
.dw-close:active{transform:scale(.95)}

/* Quick Actions — 2x2 grid */
.dw-actions{
  display:grid;grid-template-columns:repeat(2,1fr);
  gap:12px;padding:12px 12px 8px;
}
.dw-action{
  display:flex;flex-direction:row;align-items:center;gap:12px;
  padding:0 14px;
  height:56px;
  border-radius:var(--r-lg);border:1px solid var(--border2);
  background:var(--surface-1);
  cursor:pointer;font:inherit;color:inherit;
  transition:background var(--dur-fast) var(--ease-out),transform var(--dur-normal) var(--ease-spring),box-shadow var(--dur-normal),border-color var(--dur-fast);
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.dw-action:hover{background:var(--surface-hover);border-color:var(--border-hover);box-shadow:var(--shadow-sm)}
.dw-action:active{background:var(--surface-active);transform:scale(.95);transition-duration:60ms}
.dw-action-icon{
  width:36px;height:36px;
  border-radius:50%;
  background:var(--surface-2);
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  color:var(--muted);flex-shrink:0;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.dw-action-icon svg{width:20px;height:20px;stroke-width:1.8}
.dw-action:hover .dw-action-icon{
  border-color:var(--primary-dim);
  color:var(--text-secondary);
  background:var(--surface-3);
}
/* Colored accent variants */
.dw-action-market{color:var(--info)!important;border-color:rgba(66,153,225,.18)!important;background:rgba(66,153,225,.05)!important}
.dw-action:hover .dw-action-market{background:rgba(66,153,225,.1)!important;border-color:rgba(66,153,225,.3)!important}
.dw-action-discover{color:var(--warning)!important;border-color:rgba(214,158,46,.18)!important;background:rgba(214,158,46,.05)!important}
.dw-action:hover .dw-action-discover{background:rgba(214,158,46,.1)!important;border-color:rgba(214,158,46,.3)!important}
.dw-action-people{color:#a78bfa!important;border-color:rgba(167,139,250,.18)!important;background:rgba(167,139,250,.05)!important}
.dw-action:hover .dw-action-people{background:rgba(167,139,250,.1)!important;border-color:rgba(167,139,250,.3)!important}

.dw-action-label{
  font-size:13px;font-weight:var(--weight-semi);
  color:var(--text-secondary);letter-spacing:.2px;
}
.dw-action:hover .dw-action-label{color:var(--text)}

/* Section headers */
.dw-section-head{
  display:flex;align-items:center;gap:6px;
  padding:16px 8px 8px;
}
.dw-section-label{
  font-size:11px;font-weight:var(--weight-bold);
  color:var(--muted);text-transform:uppercase;
  letter-spacing:1.5px;flex:1;
  opacity:.7;
}
.dw-section-btn{
  width:28px;height:28px;border-radius:var(--r-sm);
  background:none;border:none;
  color:var(--muted);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background var(--dur-fast),color var(--dur-fast),transform 100ms ease;
  flex-shrink:0;opacity:.6;
}
.dw-section-btn:hover{background:var(--surface-hover);color:var(--text);opacity:1}
.dw-section-btn:active{transform:scale(.95)}

/* Browse servers button */
.dw-srv-browse{
  display:flex;align-items:center;justify-content:center;gap:8px;
  margin:8px 4px 4px;
  padding:10px 16px;
  border-radius:var(--r-lg);
  background:var(--surface-0);
  border:1px dashed var(--border);
  color:var(--muted);
  font-size:12px;font-weight:var(--weight-semi);
  cursor:pointer;
  transition:background var(--dur-fast),color var(--dur-fast),transform 100ms ease;
  user-select:none;
}
.dw-srv-browse:hover{
  background:var(--surface-1);
  border-color:var(--primary-dim);
  color:var(--text-secondary);
}
.dw-srv-browse:active{transform:scale(.95)}
.dw-srv-browse svg{opacity:.5}
.dw-srv-browse:hover svg{opacity:.8}


/* ═══ SETTINGS NAV CLOSE BUTTON (mobile) ═══ */
.sp-nav-close-btn{
  display:none;
  margin-left:auto;
  background:var(--surface-1);border:1px solid var(--border);
  color:var(--muted);width:36px;height:36px;
  border-radius:var(--r-md);cursor:pointer;
  align-items:center;justify-content:center;
  flex-shrink:0;transition:background var(--dur-fast),color var(--dur-fast),transform 100ms ease;
}
.sp-nav-close-btn:hover{background:var(--surface-3);color:var(--text)}
.sp-nav-close-btn:active{transform:scale(.95)}
@media(max-width:767px){
  .sp-nav-close-btn{display:flex}
}


/* ═══ TV / LARGE SCREENS (1400px+) ═══ */
@media(min-width:1400px){
  #sidebarNav{width:220px}#channelBar{width:260px}#membersBar{width:260px}
  .ch-item,.dm-item{font-size:var(--text-base);padding:var(--sp-3)}
  .chat-top{padding:var(--sp-5) var(--sp-8)}#msgsWrap{padding:var(--sp-6) var(--sp-8)}#inputArea{padding:var(--sp-4) var(--sp-8) var(--sp-5)}
  .msg-text{font-size:var(--text-base)}.form-input{font-size:var(--text-md)}#authCard{max-width:480px}
}
@media(min-width:1800px){
  #sidebarNav{width:240px}#channelBar{width:280px}#membersBar{width:290px}
  .msg-text{font-size:var(--text-md);line-height:1.65}
}


/* ═══ TABLET (768-1023px) ═══ */
@media(max-width:1023px){
  #membersBar{display:none}
  #sidebarNav{width:180px}
  #channelBar{width:200px}
}
@media(max-width:900px){
  #sidebarNav{width:170px}
  #channelBar{width:180px}
}


/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes mobileSlideUp{
  from{transform:translateY(100%) scale(.98);opacity:.9}
  to{transform:none;opacity:1}
}
@keyframes mobileSlideDown{
  from{transform:none;opacity:1}
  to{transform:translateY(100%) scale(.98);opacity:.9}
}
@keyframes mobileFadeIn{
  from{opacity:0}
  to{opacity:1}
}
@keyframes msgAppear{
  from{opacity:0;transform:translateY(12px) scale(.98)}
  to{opacity:1;transform:none}
}
@keyframes skeletonPulse{
  0%,100%{opacity:.05}
  50%{opacity:.1}
}
@keyframes staggerIn{
  from{opacity:0;transform:translateY(6px)}
  to{opacity:1;transform:none}
}
@keyframes sendBounce{
  0%{transform:scale(.82)}
  40%{transform:scale(1.08)}
  70%{transform:scale(.97)}
  100%{transform:scale(1)}
}
@keyframes tabUnderline{
  from{transform:scaleX(0)}
  to{transform:scaleX(1)}
}
@keyframes callPulse{
  0%,100%{box-shadow:0 0 0 6px var(--primary-dim),0 0 40px rgba(61,168,122,.08)}
  50%{box-shadow:0 0 0 10px var(--primary-dim),0 0 60px rgba(61,168,122,.15)}
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE (<767px) — The primary experience
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:767px){


  /* ──────────────────────────────────────────
     APP SHELL
     ────────────────────────────────────────── */
  #sidebarNav,#channelBar,#membersBar,#serverBar{display:none!important}
  #appScreen.visible{gap:0;padding:0;background:var(--bg)}
  #chatArea{border-radius:0;background:var(--bg)}
  #mobileNav{display:flex}
  #sidebarToggle{display:flex}

  /* Global smooth scrolling + overscroll containment */
  #msgsWrap,#drawerScroll,#mobileMembersList,.trd-body,#trdBottomBody,.fp-body,.lp-body,
  .stk-body,.srvb-body,.gcc-body,.us-body{
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    scroll-behavior:smooth;
  }


  /* ──────────────────────────────────────────
     SIDEBAR DRAWER — Full-screen primary view
     ────────────────────────────────────────── */
  #sidebarOverlay{
    display:none!important;
    background:none!important;
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
    pointer-events:none;
  }
  #sidebarDrawer{
    width:100vw!important;
    border-right:none;
    background:var(--bg);
    transition:transform var(--dur-normal) cubic-bezier(.32,.72,.0,1);
    bottom:0!important;
  }
  #sidebarDrawer.open{transform:translateX(0)}

  /* Pad drawer bottom for mobile nav bar */
  #drawerUserBar{
    padding-bottom:calc(56px + var(--sb) + 10px);
    min-height:60px;
  }
  #drawerScroll{
    padding:8px 16px;
    padding-bottom:calc(56px + var(--sb));
  }

  /* When drawer is open, hide chat + bottom nav */
  body.drawer-open #chatArea{visibility:hidden}
  body.drawer-open #inputArea{display:none!important}
  body.drawer-open #typingBar{display:none!important}
  body.drawer-open #mobileNav{display:none!important}

  /* Hide bottom nav when any full-screen overlay is open */
  body.overlay-open #mobileNav{display:none!important}

  /* Drawer header — safe area */
  .dw-header{
    padding:14px 16px;
    padding-top:calc(14px + var(--st));
    height:calc(56px + var(--st));
    background:var(--bg);
    border-bottom:1px solid var(--border2);
  }
  .dw-logo-img{width:24px;height:24px}
  .dw-logo-text{font-size:18px;font-weight:var(--weight-bold)}
  /* Hide close button on mobile — bottom nav handles it */
  .dw-close{display:none}

  /* Quick actions — 2x2 grid with row layout */
  .dw-actions{
    grid-template-columns:repeat(2,1fr);
    gap:12px;padding:14px 16px 10px;
  }
  .dw-action{
    flex-direction:row;align-items:center;
    height:56px;padding:0 14px;gap:12px;
    background:var(--surface-1);border-radius:var(--r-lg);
  }
  .dw-action-icon{width:36px;height:36px;border-radius:50%}
  .dw-action-icon svg{width:20px;height:20px}
  .dw-action-label{font-size:13px;font-weight:var(--weight-semi);text-align:left}

  /* Section heads */
  .dw-section-head{padding:16px 8px 8px}
  .dw-section-label{font-size:11px;letter-spacing:1.5px;text-transform:uppercase;color:var(--muted)}
  .dw-section-btn{width:30px;height:30px}

  /* Browse servers — full width */
  .dw-srv-browse{margin:10px 4px 8px;padding:12px 16px;font-size:13px;border-radius:var(--r-xl)}

  /* DM/GC items — 56px min-height, 40px avatar, comfortable touch targets */
  #drawerDmList .dm-item,
  #drawerGcList .gc-item{
    padding:12px 16px;
    min-height:56px;
    border-radius:var(--r-lg);
    gap:12px;
    transition:background var(--dur-fast) var(--ease-out),transform var(--dur-normal) var(--ease-spring);
  }
  #drawerDmList .dm-av,
  #drawerGcList .gc-av{
    width:40px;height:40px;font-size:15px;
  }
  #drawerDmList .dm-name,
  #drawerGcList .gc-name{
    font-size:14px;
  }
  .dm-section-header{padding:14px 8px 6px}
  .dm-badge{font-size:8px;padding:2px 6px;min-width:18px;height:18px;border-radius:var(--r-full)}

  /* Server items — comfortable touch targets */
  #drawerChannelItems .ch-item{
    padding:12px 16px;
    min-height:52px;
    font-size:14px;
  }
  /* Browse servers button in drawer */
  #drawerScroll .srvb-create-btn{
    margin:12px 4px 8px;
    width:calc(100% - 8px);
    padding:12px;font-size:12px;
    border-radius:var(--r-lg);
  }


  /* ──────────────────────────────────────────
     CHAT TOP BAR — Frosted glass
     ────────────────────────────────────────── */
  .chat-top{
    padding:10px 16px;
    padding-top:calc(10px + var(--st));
    height:calc(52px + var(--st));
    background:rgba(12,12,14,.96);
    -webkit-backdrop-filter:saturate(180%) blur(28px);backdrop-filter:saturate(180%) blur(28px);
    gap:10px;
    border-bottom:1px solid var(--border2);
    box-shadow:0 1px 8px rgba(0,0,0,.1);
    position:sticky;top:0;
    z-index:var(--z-sticky);
  }
  #sidebarToggle{
    width:40px;height:40px;
    border-radius:var(--r-md);
    background:var(--surface-1);
    border:1px solid var(--border);
    color:var(--text-secondary);
    display:flex;align-items:center;justify-content:center;
    flex-shrink:0;
    transition:transform 100ms ease,background 150ms ease;
  }
  #sidebarToggle:active{transform:scale(.95)}
  .chat-icon{width:32px;height:32px;border-radius:var(--r-md);font-size:12px}
  .chat-name{font-size:16px;font-weight:var(--weight-bold)}
  .chat-desc{display:none}

  /* Top action buttons — compact strip */
  .top-actions{
    padding:2px;gap:1px;border-radius:var(--r-lg);
    background:var(--surface-0);
    border:1px solid var(--border);
  }
  .top-btn{width:36px;height:36px}
  .top-btn svg{width:15px;height:15px}
  .top-btn:active{transform:scale(.95)}
  /* Show search, voice, video — hide pinned + members */
  .top-actions .top-btn:nth-child(n+5){display:none}


  /* ──────────────────────────────────────────
     MESSAGES
     ────────────────────────────────────────── */
  #msgsWrap{
    padding:12px 16px calc(116px + var(--sb));
    gap:4px;
    background:var(--bg);
    scroll-behavior:smooth;
  }
  .msg{
    padding:6px 8px;
    border-radius:0;
    gap:10px;
    margin-bottom:2px;
    animation:msgAppear .22s var(--ease-out) both;
  }
  .msg:hover{transform:none;background:transparent}
  .msg:active{background:transparent}
  .msg-av{width:34px;height:34px;min-width:34px;margin-top:2px}
  .msg-body{min-width:0;max-width:88%}
  .msg-text{
    font-size:15px;
    line-height:1.5;
    padding:12px 16px;
    border-radius:4px 18px 18px 18px;
    border-left:none;
    background:var(--surface-1);
    border:1px solid var(--border2);
    animation:msgAppear .2s var(--ease-out);
    position:relative;
  }
  .msg-own{flex-direction:row-reverse}
  .msg-own .msg-body{align-items:flex-end}
  .msg-own .msg-text{
    background:rgba(61,168,122,.1);
    border-color:rgba(61,168,122,.12);
    border-radius:18px 18px 4px 18px;
    box-shadow:0 1px 4px rgba(56,161,105,.06);
  }
  .msg-own .msg-author{display:none}
  .msg-author{font-size:12px;font-weight:var(--weight-semi);color:var(--primary);margin-bottom:1px}
  .msg-time{font-size:10px;opacity:.4}
  .msg-img{max-height:240px;max-width:75%;border-radius:var(--r-lg);border-width:1px}
  .msg-vid{max-height:240px;border-radius:var(--r-lg)}
  .msg-audio{max-width:100%;height:36px}
  .msg-file{font-size:12px;padding:8px 12px;border-radius:var(--r-lg)}

  /* Message actions — always visible (no hover on touch) */
  .msg-acts{display:flex!important;gap:6px;margin-top:8px}
  .msg-act{
    font-size:11px;padding:6px 12px;min-height:32px;
    border-radius:var(--r-md);
    background:var(--surface-0);
    border:1px solid var(--border2);
    transition:transform var(--dur-normal) var(--ease-spring),background 150ms ease;
  }
  .msg-act:active{background:var(--surface-2);transform:scale(.9);transition-duration:60ms}

  /* Reply quote */
  .reply-quote{
    padding:4px 8px;margin-bottom:4px;
    border-radius:0 var(--r-sm) var(--r-sm) 0;
  }

  /* Reactions */
  .msg-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
  .rxn{padding:4px 8px;font-size:13px;height:24px;border-radius:var(--r-full)}


  /* ──────────────────────────────────────────
     INPUT AREA — Fixed above bottom nav, frosted
     ────────────────────────────────────────── */
  #inputArea{
    position:fixed;
    bottom:calc(56px + var(--sb));
    left:0;right:0;
    z-index:var(--z-sidebar);
    padding:10px 16px;
    background:rgba(12,12,14,.96);
    -webkit-backdrop-filter:saturate(180%) blur(28px);backdrop-filter:saturate(180%) blur(28px);
    border-top:1px solid var(--border2);
  }
  .input-row{gap:8px}
  .input-tools{gap:2px}
  #msgInput{
    padding:10px 16px;
    font-size:15px;
    min-height:42px;
    border-radius:21px;
    background:var(--surface-1);
    border:1px solid var(--border2);
    flex:1;
    transition:border-color var(--dur-normal) var(--ease-out),background var(--dur-normal),box-shadow var(--dur-slow) var(--ease-out);
  }
  #msgInput:focus{
    border-color:rgba(56,161,105,.3);
    background:var(--surface-2);
    box-shadow:0 0 0 3px var(--primary-dim),0 0 20px rgba(56,161,105,.06);
  }
  .tool-btn{
    width:42px;height:42px;border-radius:50%;
    background:var(--surface-1);border-color:var(--border);
    transition:transform var(--dur-normal) var(--ease-spring),background 150ms ease;
  }
  .tool-btn:active{transform:scale(.88);transition-duration:60ms}
  .send-btn{
    width:42px;height:42px;border-radius:50%;
    background:var(--primary);color:#fff;
    transition:transform var(--dur-normal) var(--ease-spring),background 150ms ease,box-shadow var(--dur-normal);
    box-shadow:0 2px 10px rgba(56,161,105,.2);
  }
  .send-btn:active{animation:sendBounce 280ms var(--ease-spring)}

  /* Reply strip */
  #replyStrip{
    padding:8px 12px 6px;border-radius:var(--r-md);
    background:var(--surface-1);font-size:12px;
    margin-bottom:6px;
  }


  /* ──────────────────────────────────────────
     TYPING INDICATOR — Above input
     ────────────────────────────────────────── */
  #typingBar{
    position:fixed;
    bottom:calc(56px + var(--sb) + 52px);
    left:0;right:0;
    z-index:var(--z-sidebar);
    height:28px;
    padding:0 16px;
    font-size:12px;
    display:flex;flex-direction:row;align-items:center;gap:4px;
    background:var(--bg2);
  }
  #typingBar .typing-dot{
    width:5px;height:5px;border-radius:50%;
    background:var(--muted);
    animation:skeletonPulse 1.2s ease-in-out infinite;
  }
  #typingBar .typing-dot:nth-child(2){animation-delay:200ms}
  #typingBar .typing-dot:nth-child(3){animation-delay:400ms}


  /* ──────────────────────────────────────────
     NOTIFICATIONS — Above input area
     ────────────────────────────────────────── */
  #notifBox{
    bottom:calc(56px + var(--sb) + 68px);
    right:16px;left:16px;
    align-items:stretch;
  }
  .notif{
    max-width:none;font-size:13px;
    padding:12px 16px;
    border-radius:var(--r-xl);
    background:rgba(22,22,26,.96);
    border:1px solid var(--border);
    box-shadow:var(--shadow-lg),0 0 1px rgba(255,255,255,.05) inset;
    -webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);
    animation:cardReveal .25s var(--ease-out) both;
  }


  /* ──────────────────────────────────────────
     DM BANNER
     ────────────────────────────────────────── */
  .dm-banner{padding:24px 20px 16px}
  .dm-banner-av{width:56px;height:56px;font-size:22px}
  .dm-banner-name{font-size:17px}
  .dm-banner-sub{font-size:11px}


  /* ──────────────────────────────────────────
     EMPTY STATES
     ────────────────────────────────────────── */
  .empty{padding:48px 24px}
  .empty-icon{font-size:44px;opacity:.1}
  .empty-title{font-size:16px;font-weight:var(--weight-semi)}
  .empty-sub{font-size:13px;line-height:1.6}
  .empty-state{padding:48px 24px}
  .empty-state svg{width:44px;height:44px}
  .empty-state h3{font-size:16px}
  .empty-state p{font-size:13px;line-height:1.5}


  /* ──────────────────────────────────────────
     CALL — Full-screen mobile redesign
     ────────────────────────────────────────── */
  #callOverlay{
    align-items:stretch;justify-content:stretch;
    padding:0;
  }
  #callOverlay::before{display:none!important}

  /* Voice call card */
  #callCard{
    width:100vw;height:100vh;height:100dvh;
    border-radius:0;max-height:none;overflow:hidden;
    background:linear-gradient(180deg,#0c0c12 0%,#08080e 100%);
    border:none;
    display:flex;flex-direction:column;
  }
  .call-card-top{
    padding:calc(var(--st) + 10px) 16px 10px;
    background:transparent;border-bottom:none;
    position:relative;top:auto;left:auto;right:auto;
    z-index:2;flex-shrink:0;
  }
  .call-card-body{
    flex:1;display:flex;flex-direction:column;
    align-items:center;justify-content:center;
    padding:0 24px;gap:6px;
    position:relative;overflow:hidden;
  }

  /* Avatar — clean, no green circles or pseudo-elements */
  #callAvatarWrap{
    width:120px;height:120px;font-size:40px;
    margin-bottom:16px;flex-shrink:0;
    border:3px solid var(--primary-glow);
    box-shadow:0 0 0 6px var(--primary-dim),0 0 40px rgba(61,168,122,.08);
  }
  #callAvatarWrap.ringing{animation:callPulse 2s ease-out infinite}
  #callAvatarWrap.ringing::before,
  #callAvatarWrap.ringing::after{display:none!important}

  #callPersonName{font-size:24px;font-weight:var(--weight-bold);color:#fff;margin-bottom:2px;flex-shrink:0}
  #callStatus{font-size:14px;color:var(--muted);margin-bottom:0;flex-shrink:0}
  #callTimerDisplay{font-size:32px;color:var(--primary);font-variant-numeric:tabular-nums;margin-bottom:4px;margin-top:4px;flex-shrink:0}

  /* Action buttons — 4 in a row, 56px circles */
  .call-actions{
    display:flex;justify-content:center;
    gap:16px;padding:0 16px;
    margin:auto 0 8px;
    width:100%;max-width:340px;
    flex-shrink:0;
  }
  .call-act{min-width:0;flex:1;max-width:72px}
  .call-act-icon{
    width:56px;height:56px;border-radius:50%;
    background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.1);
    transition:transform 100ms ease,background 150ms ease;
  }
  .call-act-icon:active{transform:scale(.95)}
  .call-act-icon svg{width:24px;height:24px}
  .call-act-icon.active{
    background:rgba(61,168,122,.2);border-color:var(--primary-glow);
  }
  .call-act-label{font-size:10px;letter-spacing:.4px}

  /* End + minimize row */
  .call-bottom{
    display:flex;justify-content:center;align-items:center;
    gap:24px;padding:12px 0 calc(var(--sb) + 20px);
    width:100%;flex-shrink:0;
  }
  .call-end-btn{width:64px;height:64px;border-radius:50%;font-size:20px;background:var(--error)}
  .call-end-btn:active{transform:scale(.95)}
  .call-min-btn{width:40px;height:40px;position:absolute;top:calc(var(--st) + 10px);right:16px}

  /* Video mode — immersive */
  #callCard.video-mode{width:100vw;height:100vh;height:100dvh}
  #callCard.video-mode .call-card-top{
    background:linear-gradient(180deg,rgba(0,0,0,.7) 0%,transparent 100%);
    padding-top:calc(var(--st) + 10px);
    position:absolute;top:0;left:0;right:0;
  }
  #callCard.video-mode .call-card-body{padding:0;justify-content:flex-end}

  /* Remote video fills screen */
  #callVideoWrap{position:absolute;inset:0;border-radius:0;margin:0;z-index:0}
  #callRemoteVideo{width:100%;height:100%;max-height:none;min-height:100%;object-fit:cover}

  /* Local PiP */
  #callLocalVideo{
    width:90px;height:130px;
    bottom:calc(180px + var(--sb));right:12px;
    border-radius:var(--r-lg);border:2px solid rgba(255,255,255,.2);
    z-index:3;box-shadow:0 4px 20px rgba(0,0,0,.5);
  }
  #callCard.video-mode .call-actions{
    position:relative;z-index:2;
    margin:0;padding:12px 24px;
    background:linear-gradient(0deg,rgba(0,0,0,.8) 0%,transparent 100%);
    max-width:none;width:100%;
  }
  #callCard.video-mode .call-bottom{
    position:relative;z-index:2;
    background:rgba(0,0,0,.6);
    padding:8px 0 calc(var(--sb) + 16px);
  }
  #callCard.video-mode #callAvatarWrap{display:none}
  #callCard.video-mode #callPersonName{
    position:relative;z-index:2;color:#fff;text-shadow:0 2px 8px rgba(0,0,0,.5);
    font-size:16px;margin-bottom:0;
  }
  #callCard.video-mode #callStatus{
    position:relative;z-index:2;
    color:rgba(255,255,255,.6);text-shadow:0 1px 4px rgba(0,0,0,.5);
    font-size:11px;
  }
  #callCard.video-mode #callTimerDisplay{
    position:relative;z-index:2;
    font-size:14px;text-shadow:0 1px 4px rgba(0,0,0,.5);
  }

  /* GC video grid */
  #gcVideoGrid{
    grid-template-columns:repeat(2,1fr);gap:4px;
    position:absolute;inset:0;z-index:0;border-radius:0;
  }
  .gc-vid-tile{border-radius:0;aspect-ratio:auto}

  /* Incoming call — clean dark bg, NO pulse rings */
  #incomingCallOverlay::before,
  #incomingCallOverlay::after{display:none!important}
  #incomingCallCard{padding:0 20px}
  .ic-top-label{margin-bottom:24px;font-size:10px}
  .ic-avatar-area{width:120px;height:120px;margin-bottom:20px}
  .ic-pulse-ring{display:none}
  #icAvatar{
    width:100px;height:100px;font-size:36px;
    box-shadow:0 0 0 4px rgba(61,168,122,.08),0 0 40px rgba(61,168,122,.1);
  }
  #icCallerName{font-size:28px;font-weight:var(--weight-bold)}
  #icCallType{margin-bottom:40px}
  .ic-actions{gap:80px}
  .ic-btn span:first-child{width:64px;height:64px}
  .ic-btn:active span:first-child{transform:scale(.95)}

  /* Mini call bar — above bottom nav */
  #miniCallBar{
    bottom:calc(56px + var(--sb) + 8px);
    left:12px;right:12px;top:auto;
    border-radius:var(--r-lg);
  }


  /* ──────────────────────────────────────────
     SETTINGS — Full screen overlay
     ────────────────────────────────────────── */
  #settingsPanel{
    width:100vw!important;
    max-width:100vw!important;
    border-left:none;border-radius:0;
    inset:0;
  }
  /* Settings nav — full width list */
  #settingsPanel.sp-nav-mode .sp-nav{
    padding-top:var(--st);
    padding-bottom:calc(56px + var(--sb));
  }
  #settingsPanel .sp-main{padding-bottom:calc(56px + var(--sb))}
  .sp-section{padding:16px 20px}

  /* Nav items: 52px height, icon + label, chevron */
  .sp-nav-item{
    min-height:52px;
    display:flex;align-items:center;gap:12px;
    padding:0 16px;
  }
  .sp-nav-item svg{width:20px;height:20px}

  /* Content slides from right */
  .sp-main{
    transition:transform 300ms cubic-bezier(.32,.72,.0,1);
  }
  .sp-grid{grid-template-columns:1fr!important}


  /* ──────────────────────────────────────────
     EMOJI PICKER — Bottom sheet
     ────────────────────────────────────────── */
  .emoji-card{
    width:100vw;
    border-radius:var(--r-3xl) var(--r-3xl) 0 0;
    margin-bottom:0;
    max-height:50vh;
    padding:16px 16px calc(56px + var(--sb) + 16px);
    box-shadow:0 -8px 40px rgba(0,0,0,.3);
  }
  .emoji-head{font-size:14px;margin-bottom:10px}
  .emoji-grid{grid-template-columns:repeat(8,1fr);gap:2px}
  .emoji-btn{font-size:22px;padding:6px;min-height:44px}


  /* ──────────────────────────────────────────
     ALL MODALS — Bottom sheets
     ────────────────────────────────────────── */

  /* Shared bottom sheet base */
  #srvBrowserOverlay,
  #gcCreateOverlay,#gcSettingsOverlay,
  #userSearchOverlay,
  #srvSettingsOverlay{
    padding:0;align-items:flex-end;z-index:var(--z-call)!important;
  }
  #srvBrowserCard,
  #gcCreateCard,#gcSettingsCard,
  #userSearchCard,
  #srvSettingsCard{
    width:100%;
    max-height:85vh;
    border-radius:var(--r-3xl) var(--r-3xl) 0 0;
    box-shadow:0 -8px 40px rgba(0,0,0,.3),0 -2px 10px rgba(0,0,0,.1);
  }

  /* Drag handle for bottom sheets — premium pill */
  #srvBrowserCard::before,
  #gcCreateCard::before,#gcSettingsCard::before,
  #userSearchCard::before,
  #srvSettingsCard::before,
  #stkDetailCard::before{
    content:'';display:block;
    width:40px;height:4px;
    border-radius:var(--r-full);
    background:var(--muted);opacity:.25;
    margin:10px auto 6px;
    transition:opacity var(--dur-normal);
  }
  #srvBrowserCard:active::before,
  #gcCreateCard:active::before,#gcSettingsCard:active::before,
  #userSearchCard:active::before,
  #srvSettingsCard:active::before,
  #stkDetailCard:active::before{
    opacity:.5;
  }

  #inviteOverlay{padding:16px;z-index:var(--z-call)!important}
  #inviteCard{width:100%;border-radius:var(--r-xl)}
  #addChModal{padding:16px}
  .addch-card{width:100%;border-radius:var(--r-xl)}

  /* Overlay fade-in */
  #srvBrowserOverlay.open,
  #gcCreateOverlay.open,#gcSettingsOverlay.open,
  #userSearchOverlay.open,
  #srvSettingsOverlay.open{
    animation:mobileFadeIn 200ms ease;
  }


  /* ──────────────────────────────────────────
     SEARCH PANEL
     ────────────────────────────────────────── */
  .search-panel{border-radius:0}
  .search-input-wrap{padding:10px 16px}
  .search-field{font-size:15px}
  .search-results{max-height:50vh}
  .sr-item{padding:12px 16px;min-height:48px}


  /* ──────────────────────────────────────────
     REACT PICKER — Above input
     ────────────────────────────────────────── */
  #reactPicker{
    left:12px!important;right:12px!important;
    max-width:none;width:auto;
    bottom:calc(56px + var(--sb) + 56px)!important;
    top:auto!important;
    border-radius:var(--r-xl);
    padding:10px;
  }
  .rp-btn{font-size:24px;padding:8px 10px;min-height:44px}


  /* ──────────────────────────────────────────
     PROFILE POPUP — Bottom sheet
     ────────────────────────────────────────── */
  #profilePopup{padding:0;align-items:flex-end;z-index:calc(var(--z-call) + 10)!important}
  .pp-card{
    width:100%!important;max-width:none!important;
    border-radius:var(--r-3xl) var(--r-3xl) 0 0;
    margin-top:auto;max-height:85vh;
    animation:mobileSlideUp .3s cubic-bezier(.32,.72,.0,1);
    box-shadow:0 -8px 40px rgba(0,0,0,.3),0 -2px 10px rgba(0,0,0,.1);
  }
  .pp-banner{height:100px}
  .pp-body{padding:8px 20px calc(24px + var(--sb))}
  .pp-name{font-size:18px}
  .pp-actions{margin-top:12px}
  .pp-dm-btn{padding:10px 20px;font-size:13px;border-radius:var(--r-lg)}


  /* ──────────────────────────────────────────
     FRIENDS PAGE
     ────────────────────────────────────────── */
  #friendsPage{
    padding-bottom:0;
    bottom:calc(56px + var(--sb))!important;
    position:fixed;inset:0;
    background:var(--bg);
  }
  .fp-header{
    padding:14px 16px;
    padding-top:calc(14px + var(--st));
    height:52px;
    display:flex;align-items:center;
  }
  .fp-title{font-size:18px;font-weight:var(--weight-bold)}
  .fp-close{width:36px;height:36px;border-radius:var(--r-md)}
  .fp-close:active{transform:scale(.95)}

  /* Tabs — 2 equal, 40px height, underline indicator */
  .fp-tabs{
    padding:0 12px;overflow-x:auto;-webkit-overflow-scrolling:touch;gap:0;
    display:flex;
  }
  .fp-tab{
    padding:10px 14px;font-size:12px;white-space:nowrap;
    flex:1;text-align:center;
    height:40px;display:flex;align-items:center;justify-content:center;
    transition:color 200ms ease;
    position:relative;
  }
  .fp-tab.active::after{
    content:'';position:absolute;bottom:0;left:20%;right:20%;
    height:2px;background:var(--primary);border-radius:1px;
    animation:tabUnderline 200ms var(--ease-out);
  }

  .fp-body{padding:12px 16px;padding-bottom:calc(56px + var(--sb))}
  .fp-search{font-size:15px;padding:10px 16px;border-radius:var(--r-lg);height:44px}

  /* User items — 56px height, 40px avatar */
  .fp-user{padding:12px 16px;border-radius:var(--r-lg);gap:12px;min-height:56px}
  .fp-uav{width:40px;height:40px;font-size:15px}
  .fp-uname{font-size:15px}
  .fp-ustatus{font-size:10px}
  .fp-ubtn{
    padding:8px 12px;font-size:11px;border-radius:var(--r-md);min-height:36px;
    transition:transform 100ms ease,background 150ms ease;
  }
  .fp-ubtn:active{transform:scale(.95)}
  .fp-empty{font-size:14px}


  /* ──────────────────────────────────────────
     LEADERBOARD
     ────────────────────────────────────────── */
  #leaderPage{
    padding-bottom:0;
    bottom:calc(56px + var(--sb))!important;
    position:fixed;inset:0;
    background:var(--bg);
  }
  .lp-header{
    padding:12px 16px;
    padding-top:calc(12px + var(--st));
    display:flex;align-items:center;
    gap:10px;
  }
  .lp-title{font-size:16px;font-weight:var(--weight-bold)}
  .lp-header-actions{gap:6px}
  .lp-period-tab{font-size:11px;padding:4px 10px}
  .lp-close{width:34px;height:34px;border-radius:var(--r-md)}
  .lp-close:active{transform:scale(.95)}
  .lp-podium{padding:var(--sp-4) var(--sp-3) var(--sp-2)}
  .lp-pod{padding:var(--sp-3) var(--sp-2) var(--sp-2)}
  .lp-pod-av{width:44px;height:44px;font-size:var(--text-base)}
  .lp-pod-medal{font-size:20px}
  .lp-pod-name{font-size:var(--text-xs)}
  .lp-pod-pct{font-size:var(--text-sm)}
  .lp-pod-val{font-size:9px}
  .lp-body{padding:8px 16px;padding-bottom:calc(56px + var(--sb))}

  /* List items */
  .lp-item{
    padding:12px 16px;border-radius:var(--r-lg);gap:12px;
    min-height:52px;display:flex;align-items:center;
  }
  .lp-rank{width:26px;font-size:14px}
  .lp-av{width:34px;height:34px;font-size:14px}
  .lp-uname{font-size:14px}
  .lp-pct{font-size:14px}
  .lp-total{font-size:10px}


  /* ──────────────────────────────────────────
     TRADING PAGE — Fintech-Grade Mobile UI
     ─────────────────────────────────────────
     ✦ Full-screen dedicated layer (NOT a panel)
     ✦ Chat input & typing bar hidden via body.trading-open
     ✦ Slide-up 300ms entrance, z-index above chat
     ✦ Single scroll body: watchlist → stock → chart → order → holdings
     ✦ Sticky execute button at bottom
     ────────────────────────────────────────── */

  /* ▸ CRITICAL: hide chat input AND bottom nav when trading is open */
  body.trading-open #inputArea,
  body.trading-open #typingBar,
  body.trading-open #mobileNav{
    display:none!important;
    pointer-events:none!important;
  }

  /* ▸ Page shell — true full-screen overlay */
  #tradingPage{
    position:fixed!important;
    top:0!important;left:0!important;right:0!important;
    bottom:0!important;
    background:var(--bg)!important;
    z-index:calc(var(--z-popover) + 5)!important;
    display:flex!important;flex-direction:column!important;
    overflow:hidden!important;
    padding:0!important;margin:0!important;
    transform:translateY(100%)!important;
    transition:transform .3s cubic-bezier(.32,.72,.0,1)!important;
    animation:none!important;
    will-change:transform!important;
  }
  #tradingPage.open{
    transform:translateY(0)!important;
    animation:none!important;
  }

  /* ▸ Top header — 48px + safe area, frosted glass */
  .trd-topbar{
    display:flex!important;align-items:center!important;
    flex-wrap:nowrap!important;flex-shrink:0!important;
    padding:0 16px!important;
    padding-top:var(--st)!important;
    height:calc(48px + var(--st))!important;
    min-height:48px!important;
    gap:10px!important;
    background:rgba(var(--bg-rgb,10,10,14),.92)!important;
    -webkit-backdrop-filter:saturate(180%) blur(20px)!important;
    backdrop-filter:saturate(180%) blur(20px)!important;
    border-bottom:1px solid var(--border2)!important;
    position:relative!important;z-index:2!important;
  }
  .trd-brand{display:flex!important;align-items:center!important;gap:8px!important}
  .trd-brand-icon{width:18px!important;height:18px!important;color:var(--primary)!important}
  .trd-brand-name{
    font-size:16px!important;font-weight:var(--weight-extra)!important;
    letter-spacing:-.4px!important;color:var(--text)!important;
  }
  .trd-badge{font-size:7px!important;padding:2px 7px!important;border-radius:var(--r-full)!important}
  .trd-topbar-spacer{display:none!important}
  .trd-close-btn{
    width:36px!important;height:36px!important;margin-left:auto!important;
    font-size:14px!important;border-radius:var(--r-md)!important;
    background:var(--surface-1)!important;border:1px solid var(--border)!important;
    color:var(--text-secondary)!important;
    transition:transform 100ms ease,background 150ms ease!important;
  }
  .trd-close-btn:active{transform:scale(.92)!important}

  /* ▸ Portfolio stats — card strip below header */
  .trd-topbar-stats{
    display:none!important;
  }

  /* ▸ Body — THE scroll container (extra bottom for sticky exec button) */
  .trd-body{
    display:flex!important;flex-direction:column!important;
    gap:0!important;
    padding:0!important;
    padding-bottom:calc(74px + env(safe-area-inset-bottom,0px))!important;
    overflow-y:auto!important;overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    flex:1 1 0!important;min-height:0!important;
  }

  /* ── PORTFOLIO CARD — inline in scroll body ── */
  .trd-portfolio-card{
    display:grid!important;
    grid-template-columns:repeat(2,1fr)!important;
    gap:8px!important;
    padding:12px 16px!important;
    border-bottom:1px solid var(--border2)!important;
    background:var(--bg)!important;
    flex-shrink:0!important;
  }
  .trd-pc-row{
    display:contents!important;
    gap:0!important;margin:0!important;
  }
  .trd-pc-item{
    background:var(--surface-0)!important;
    border:1px solid var(--border2)!important;
    border-radius:var(--r-md)!important;
    padding:10px 12px!important;
  }
  .trd-pc-label{
    font-size:8px!important;font-weight:var(--weight-bold)!important;
    text-transform:uppercase!important;letter-spacing:1px!important;
    color:var(--text-faint)!important;line-height:1!important;
  }
  .trd-pc-val{
    font-size:14px!important;font-weight:var(--weight-extra)!important;
    margin-top:4px!important;line-height:1.2!important;
    letter-spacing:-.3px!important;
    font-variant-numeric:tabular-nums!important;
  }

  /* ── WATCHLIST — horizontal scroll strip ── */
  .trd-wl{
    display:flex!important;flex-direction:column!important;
    width:100%!important;max-height:none!important;
    border-right:none!important;
    border-bottom:1px solid var(--border2)!important;
    flex-shrink:0!important;
    overflow:hidden!important;
    background:var(--bg)!important;
  }
  .trd-wl-head{
    display:flex!important;flex-direction:row!important;
    align-items:center!important;gap:10px!important;
    padding:10px 16px 6px!important;
    border-bottom:none!important;
  }
  .trd-wl-head-title{
    margin-bottom:0!important;font-size:9px!important;
    flex-shrink:0!important;letter-spacing:1.2px!important;
    color:var(--text-faint)!important;
    text-transform:uppercase!important;font-weight:var(--weight-extra)!important;
  }
  .trd-wl-search{
    font-size:13px!important;padding:7px 14px!important;
    border-radius:var(--r-full)!important;flex:1!important;
    height:34px!important;
    background:var(--surface-0)!important;
    border:1px solid var(--border)!important;
  }

  /* Watchlist cards — horizontal scroll */
  .trd-wl-list{
    display:flex!important;flex-direction:row!important;
    overflow-x:auto!important;overflow-y:hidden!important;
    max-height:none!important;flex:none!important;
    padding:6px 16px 12px!important;gap:8px!important;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .trd-wl-list::-webkit-scrollbar{display:none}
  .trd-wl-item{
    flex:0 0 auto!important;
    min-width:100px!important;max-width:120px!important;
    flex-direction:column!important;align-items:flex-start!important;
    padding:10px 12px!important;
    border:1px solid var(--border2)!important;
    border-radius:var(--r-lg)!important;
    border-left:none!important;
    gap:2px!important;min-height:auto!important;
    background:var(--surface-0)!important;
    transition:transform 100ms ease,background 150ms ease,border-color 150ms ease!important;
  }
  .trd-wl-item:active{transform:scale(.96)!important}
  .trd-wl-item.active{
    border-color:var(--primary)!important;
    background:rgba(61,168,122,.06)!important;
    box-shadow:0 0 0 1px var(--primary) inset,0 2px 8px rgba(61,168,122,.1)!important;
  }
  .trd-wl-left{width:100%!important}
  .trd-wl-right{
    text-align:left!important;width:100%!important;
    display:flex!important;align-items:baseline!important;gap:6px!important;
  }
  .trd-wl-sym{
    font-size:12px!important;font-weight:var(--weight-extra)!important;
    letter-spacing:.2px!important;color:var(--text)!important;
  }
  .trd-wl-name{display:none!important}
  .trd-wl-price{font-size:14px!important;font-weight:var(--weight-bold)!important}
  .trd-wl-chg{font-size:10px!important;margin-top:0!important}

  /* ── STOCK DETAIL — name left, price right (Zerodha-style) ── */
  .trd-center{
    flex:none!important;min-height:0!important;
    overflow:hidden!important;width:100%!important;
  }
  .trd-center:not(.has-stock){display:none!important}
  .trd-center.has-stock .trd-no-select{display:none!important}

  .trd-stock-hd{
    display:flex!important;align-items:flex-start!important;
    justify-content:space-between!important;
    padding:16px 16px 12px!important;gap:16px!important;
    background:var(--bg)!important;
    border-bottom:none!important;
  }
  .trd-stock-left{min-width:0!important}
  .trd-stock-name{
    font-size:18px!important;font-weight:var(--weight-extra)!important;
    letter-spacing:-.4px!important;line-height:1.2!important;
    color:var(--text)!important;
  }
  .trd-stock-meta{
    font-size:10px!important;color:var(--text-faint)!important;
    margin-top:3px!important;
  }
  .trd-stock-right{text-align:right!important;flex-shrink:0!important}
  .trd-stock-price{
    font-size:24px!important;font-weight:var(--weight-extra)!important;
    letter-spacing:-1px!important;line-height:1!important;
    color:var(--text)!important;font-variant-numeric:tabular-nums!important;
  }
  .trd-stock-chg{font-size:12px!important;margin-top:4px!important;font-weight:var(--weight-bold)!important}
  .trd-held-strip{
    font-size:10px!important;padding:6px 12px!important;
    gap:10px!important;margin-top:8px!important;
    border-radius:var(--r-md)!important;
  }

  /* ── CHART — full width, 220px ── */
  .trd-chart-wrap{
    height:220px!important;flex:none!important;
    min-height:220px!important;overflow:hidden!important;
    background:var(--bg)!important;
  }

  /* ── ORDER SECTION — card-style form ── */
  .trd-order{
    width:100%!important;
    border-left:none!important;
    border-top:none!important;
    max-height:none!important;
    flex-shrink:0!important;
    overflow:hidden!important;
    background:var(--bg)!important;
    margin-top:0!important;
  }
  .trd-mini-chart{display:none!important}

  /* Buy/Sell toggle — segmented control with clear active state */
  .trd-tabs{
    display:flex!important;
    margin:0 16px!important;
    border-radius:var(--r-lg)!important;
    overflow:hidden!important;
    background:var(--bg2)!important;
    border:1px solid var(--border)!important;
    padding:3px!important;
    gap:4px!important;
  }
  .trd-tab{
    flex:1!important;padding:0!important;
    font-size:13px!important;font-weight:var(--weight-extra)!important;
    height:42px!important;letter-spacing:.3px!important;
    border:none!important;background:transparent!important;
    border-radius:var(--r-md)!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    transition:all 200ms ease!important;
    color:var(--text-faint)!important;
  }
  .trd-tab-buy.active{
    background:rgba(61,168,122,.15)!important;color:var(--success)!important;
    box-shadow:0 1px 4px rgba(61,168,122,.15)!important;
  }
  .trd-tab-sell.active{
    background:rgba(224,80,80,.15)!important;color:var(--error)!important;
    box-shadow:0 1px 4px rgba(224,80,80,.15)!important;
  }

  /* Order form — generous spacing (extra bottom for sticky exec button) */
  .trd-form{
    padding:16px 16px 8px!important;
    gap:14px!important;flex:none!important;
    display:flex!important;flex-direction:column!important;
  }
  .trd-field-label{
    font-size:9px!important;font-weight:var(--weight-extra)!important;
    letter-spacing:1.2px!important;text-transform:uppercase!important;
    margin-bottom:0!important;color:var(--text-faint)!important;
  }

  /* Quantity input — big, centered, prominent */
  .trd-qty-input{
    font-size:24px!important;padding:12px 16px!important;
    border-radius:var(--r-lg)!important;height:56px!important;
    text-align:center!important;
    font-weight:var(--weight-extra)!important;
    background:var(--surface-0)!important;
    border:1.5px solid var(--border)!important;
    transition:border-color 200ms ease!important;
  }
  .trd-qty-input:focus{border-color:var(--primary)!important}

  /* Preset buttons — pill row, 40px touch targets */
  .trd-qty-presets{gap:8px!important;display:flex!important;margin-top:2px!important}
  .trd-preset{
    padding:0!important;font-size:12px!important;
    font-weight:var(--weight-bold)!important;
    border-radius:var(--r-md)!important;height:40px!important;
    flex:1!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    background:var(--surface-0)!important;
    border:1px solid var(--border)!important;
    color:var(--text-secondary)!important;
    transition:transform 100ms ease,background 150ms ease,border-color 150ms ease!important;
  }
  .trd-preset:active{transform:scale(.94)!important}

  /* Order summary — card with section separation */
  .trd-order-summary{
    border-radius:var(--r-lg)!important;
    overflow:hidden!important;
    border:1px solid var(--border2)!important;
    background:var(--surface-0)!important;
  }
  .trd-orow{
    padding:12px 16px!important;font-size:13px!important;
    border-bottom:1px solid var(--border2)!important;
  }
  .trd-orow:last-child{border-bottom:none!important}
  .trd-orow.total{
    padding:14px 16px!important;font-size:15px!important;
    background:rgba(255,255,255,.02)!important;
  }
  .trd-olabel{font-size:13px!important;color:var(--text-faint)!important}
  .trd-oval{font-size:13px!important;color:var(--text)!important;font-weight:var(--weight-bold)!important}
  .trd-orow.total .trd-oval{font-size:16px!important;font-weight:var(--weight-extra)!important}

  /* Execute button — STICKY bottom bar, always in thumb reach */
  .trd-exec-btn{
    position:fixed!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
    left:16px!important;right:16px!important;
    width:auto!important;
    z-index:10!important;
    padding:0!important;font-size:16px!important;
    font-weight:var(--weight-extra)!important;
    letter-spacing:.3px!important;
    border-radius:var(--r-lg)!important;
    margin:0!important;
    height:54px!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    flex-shrink:0!important;
    transition:transform 100ms ease,box-shadow 200ms ease!important;
    box-shadow:0 -4px 20px rgba(0,0,0,.3)!important;
  }
  .trd-exec-btn:active:not(:disabled){transform:scale(.97)!important}
  .trd-exec-buy{box-shadow:0 -2px 20px rgba(61,168,122,.3),0 4px 20px rgba(61,168,122,.25)!important}
  .trd-exec-sell{box-shadow:0 -2px 20px rgba(224,80,80,.3),0 4px 20px rgba(224,80,80,.25)!important}
  .trd-exec-btn:disabled{
    background:var(--surface-1)!important;color:var(--text-faint)!important;
    box-shadow:0 -4px 16px rgba(0,0,0,.2)!important;
  }

  /* ── HOLDINGS/HISTORY — card section ── */
  .trd-bottom{
    border-top:none!important;
    height:auto!important;
    flex-shrink:0!important;
    overflow:hidden!important;
    background:var(--bg)!important;
    margin-top:8px!important;
    border-radius:var(--r-lg) var(--r-lg) 0 0!important;
    border:1px solid var(--border2)!important;
    border-bottom:none!important;
    margin-left:16px!important;margin-right:16px!important;
  }
  .trd-btabs{
    display:flex!important;align-items:center!important;
    padding:0 12px!important;gap:0!important;
    border-bottom:1px solid var(--border2)!important;
    background:var(--surface-0)!important;
    border-radius:var(--r-lg) var(--r-lg) 0 0!important;
  }
  .trd-btab{
    font-size:12px!important;padding:12px 16px!important;
    border-bottom:2px solid transparent!important;
    color:var(--text-faint)!important;font-weight:var(--weight-bold)!important;
    transition:color 200ms ease,border-color 200ms ease!important;
  }
  .trd-btab.active{
    border-bottom-color:var(--primary)!important;
    color:var(--text)!important;
  }
  .trd-btab-spacer{flex:1!important}
  .trd-reset-btn{font-size:9px!important;padding:5px 12px!important;border-radius:var(--r-md)!important}
  #trdBottomBody{
    max-height:240px!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    padding:0!important;
    background:var(--bg)!important;
  }
  .trd-hold-header{
    grid-template-columns:1fr auto auto!important;
    gap:10px!important;padding:8px 16px!important;
    position:sticky!important;top:0!important;
    background:var(--bg)!important;z-index:1!important;
    font-size:9px!important;
  }
  .trd-hold-header span:nth-child(2){display:none!important}
  .trd-hold-item{
    grid-template-columns:1fr auto auto!important;
    gap:10px!important;padding:12px 16px!important;
    min-height:52px!important;
    border-bottom:1px solid var(--border2)!important;
  }
  .trd-hold-item:last-child{border-bottom:none!important}
  .trd-hold-name{font-size:14px!important;font-weight:var(--weight-bold)!important}
  .trd-hold-val{font-size:14px!important;font-weight:var(--weight-bold)!important}
  .trd-hold-pnl{font-size:12px!important;font-weight:var(--weight-bold)!important}
  .trd-hold-qty{display:none!important}
  .trd-hold-sub{font-size:10px!important;color:var(--text-faint)!important}
  .trd-hist-item{padding:14px 16px!important;min-height:52px!important}
  .trd-hist-badge{width:28px!important;height:28px!important;border-radius:var(--r-md)!important}
  .trd-hist-name{font-size:14px!important}
  .trd-hist-amt{font-size:14px!important}
  .trd-hist-sub{font-size:10px!important}
  .trd-empty-msg{padding:32px 16px!important;font-size:14px!important}
  .trd-empty-msg svg{width:40px!important;height:40px!important}

  /* Extra bottom padding so scroll clears sticky button */
  .trd-order + .trd-bottom{margin-bottom:0!important}
  .trd-body > :last-child{margin-bottom:8px!important}

  /* ── CONFIRM MODAL — iOS bottom sheet ── */
  .trd-confirm-overlay{
    z-index:calc(var(--z-popover) + 20)!important;
    align-items:flex-end!important;
  }
  .trd-confirm-card{
    width:100%!important;max-width:none!important;
    padding:16px 20px calc(28px + env(safe-area-inset-bottom,0px))!important;
    border-radius:20px 20px 0 0!important;
    animation:mobileSlideUp .3s var(--ease-out)!important;
    background:var(--bg2)!important;
    border:1px solid var(--border)!important;
    border-bottom:none!important;
  }
  .trd-confirm-card::before{
    content:''!important;display:block!important;
    width:36px!important;height:4px!important;
    border-radius:var(--r-full)!important;
    background:var(--muted)!important;opacity:.25!important;
    margin:0 auto 16px!important;
  }
  .trd-confirm-title{font-size:18px!important;font-weight:var(--weight-extra)!important}
  .trd-confirm-subtitle{font-size:12px!important;color:var(--text-faint)!important;margin-top:2px!important}
  .trd-confirm-body{margin-bottom:16px!important}
  .trd-confirm-row{font-size:15px!important;padding:12px 0!important}
  .trd-confirm-row.total{
    font-size:17px!important;
    border-top:1px solid var(--border)!important;
    padding-top:14px!important;margin-top:4px!important;
  }
  .trd-confirm-label{color:var(--text-faint)!important}
  .trd-confirm-val{font-weight:var(--weight-bold)!important;color:var(--text)!important}
  .trd-confirm-btns{gap:12px!important;margin-top:4px!important}
  .trd-confirm-cancel,.trd-confirm-exec{
    padding:0!important;font-size:15px!important;font-weight:var(--weight-extra)!important;
    border-radius:var(--r-lg)!important;height:52px!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
  }
  .trd-confirm-cancel{background:var(--surface-1)!important;border:1px solid var(--border)!important}
  .trd-confirm-exec.buy{box-shadow:0 4px 16px rgba(61,168,122,.25)!important}
  .trd-confirm-exec.sell{box-shadow:0 4px 16px rgba(224,80,80,.25)!important}


  /* ──────────────────────────────────────────
     STOCKS PAGE
     ────────────────────────────────────────── */
  #stocksPage{
    padding-bottom:0;
    bottom:calc(56px + var(--sb))!important;
    position:fixed;inset:0;
    background:var(--bg);
  }
  .stk-header{
    height:52px;padding:0 16px;
    padding-top:var(--st);
    display:flex;align-items:center;
  }
  .stk-title{font-size:18px;font-weight:var(--weight-bold)}
  .stk-close:active,.stk-search-btn:active{transform:scale(.95)}

  /* Search bar — slide down, 44px pill */
  .stk-search-bar{
    height:44px;border-radius:var(--r-full);
    font-size:15px;padding:0 16px;
  }

  /* Indices — horizontal scroll, 3 cards, 140px wide, 80px tall */
  .stk-indices{
    display:flex;overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding:10px 16px;gap:10px;
    scrollbar-width:none;
  }
  .stk-indices::-webkit-scrollbar{display:none}
  .stk-index-card{
    flex:0 0 140px;height:80px;
    padding:12px;border-radius:var(--r-lg);
    background:var(--surface-1);
  }

  /* Filter row — horizontal scroll pills, 32px height */
  .stk-filters{
    display:flex;overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding:6px 16px;gap:8px;
    scrollbar-width:none;
  }
  .stk-filters::-webkit-scrollbar{display:none}
  .stk-filter{
    height:32px;padding:0 12px;border-radius:var(--r-full);
    font-size:12px;white-space:nowrap;flex-shrink:0;
    transition:transform 100ms ease,background 150ms ease;
  }
  .stk-filter:active{transform:scale(.95)}

  /* Stock grid — 2 columns, 10px gap, 16px side padding */
  .stk-grid{
    display:grid;grid-template-columns:repeat(2,1fr);
    gap:10px;padding:10px 16px;
    padding-bottom:calc(56px + var(--sb));
  }
  .stk-card{
    padding:14px;border-radius:var(--r-lg);
    background:var(--surface-1);
    transition:transform 100ms ease,background 150ms ease;
  }
  .stk-card:active{transform:scale(.95)}
  .stk-card-icon{width:32px;height:32px;border-radius:var(--r-md)}
  .stk-card-name{font-size:13px;font-weight:var(--weight-bold)}
  .stk-card-sector{font-size:10px;color:var(--muted)}
  .stk-card-price{font-size:15px;font-weight:var(--weight-bold)}
  .stk-card-chg{font-size:11px}


  /* ──────────────────────────────────────────
     STOCK DETAIL — Bottom sheet
     ────────────────────────────────────────── */
  #stkDetailOverlay{padding:0;align-items:flex-end}
  #stkDetailCard{
    width:100%;
    max-height:85vh;
    border-radius:var(--r-2xl) var(--r-2xl) 0 0;
    overflow-y:auto;-webkit-overflow-scrolling:touch;
    animation:mobileSlideUp .35s cubic-bezier(.32,.72,.0,1);
  }
  /* Drag handle */
  .stk-detail-handle,
  #stkDetailCard::before{
    width:36px;height:4px;
    border-radius:var(--r-full);
    background:var(--muted);opacity:.3;
    margin:8px auto 4px;
  }
  .stk-detail-header{
    padding:8px 16px;display:flex;align-items:center;
  }
  .stk-detail-name{font-size:18px;font-weight:var(--weight-bold)}
  .stk-detail-close:active{transform:scale(.95)}
  .stk-detail-price{font-size:28px;font-weight:var(--weight-extra);padding:0 16px}
  .stk-detail-chg{font-size:14px}

  /* Range buttons — flex row pills, 36px height */
  .stk-detail-ranges{
    display:flex;gap:4px;padding:8px 16px;
  }
  .stk-detail-range{
    height:36px;padding:0 12px;border-radius:var(--r-full);
    font-size:12px;
    transition:transform 100ms ease,background 150ms ease;
  }
  .stk-detail-range:active{transform:scale(.95)}

  /* Chart — full width, 220px */
  .stk-detail-chart{width:100%;height:220px;padding:0 8px}

  /* Stats — 2-column grid */
  .stk-detail-stats{
    display:grid;grid-template-columns:1fr 1fr;
    gap:10px;padding:14px 16px;
  }

  /* Trade button — sticky at bottom of stock detail sheet */
  .stkd-trade-bar{
    position:sticky;bottom:0;
    padding:12px 16px calc(12px + var(--sb));
    background:linear-gradient(to top,var(--bg) 70%,transparent);
  }
  .stkd-trade-btn{
    height:52px;
    font-size:15px;
    border-radius:var(--r-lg);
    box-shadow:0 4px 20px rgba(61,168,122,.3);
  }


  /* ──────────────────────────────────────────
     SERVER BROWSER / CREATE
     ────────────────────────────────────────── */
  .srvb-head{padding:16px 16px}
  .srvb-title{font-size:16px}
  .srvb-body{padding:8px 16px}
  .srvb-item{padding:14px 16px;border-radius:var(--r-lg);gap:12px;min-height:52px}
  .srvb-icon{width:40px;height:40px;font-size:16px;border-radius:var(--r-md)}
  .srvb-name{font-size:14px}
  .srvb-desc{font-size:11px}
  .srvb-join-btn{padding:8px 12px;font-size:11px;min-height:36px}
  .srvb-footer{padding:8px 12px calc(8px + var(--sb))}
  .srvb-create-btn{padding:12px;font-size:12px}
  .srvb-empty{font-size:14px;padding:40px 20px}


  /* ──────────────────────────────────────────
     GC CREATE / SETTINGS
     ────────────────────────────────────────── */
  .gcc-head{padding:16px 16px}
  .gcc-title{font-size:16px}
  .gcc-body{padding:16px}
  .gcc-input{font-size:15px;padding:12px 16px;min-height:48px}
  .gcc-search{font-size:14px;padding:10px 16px}
  .gcc-user{padding:12px;min-height:48px}
  .gcc-user-av{width:32px;height:32px}
  .gcc-user-name{font-size:14px}
  .gcc-create-btn{padding:14px;font-size:14px;min-height:48px}


  /* ──────────────────────────────────────────
     USER SEARCH
     ────────────────────────────────────────── */
  .us-head{padding:16px 16px}
  .us-title{font-size:16px}
  .us-search-wrap{padding:10px 16px 8px}
  .us-input{font-size:15px;padding:10px 16px;min-height:48px}
  .us-item{min-height:52px;padding:10px 16px}
  .us-av{width:38px;height:38px;font-size:15px}
  .us-uname{font-size:14px}
  .us-msg-btn{padding:8px 12px;font-size:11px;min-height:36px}


  /* ──────────────────────────────────────────
     INVITE MODAL
     ────────────────────────────────────────── */
  .invite-banner{height:90px}
  .invite-body{padding:0 20px calc(24px + var(--sb))}
  .invite-icon{width:52px;height:52px;font-size:20px}
  .invite-name{font-size:20px}
  .invite-desc{font-size:13px}
  .invite-join-btn{padding:14px;font-size:15px;border-radius:var(--r-lg);min-height:48px}
  .invite-close-btn{padding:10px;font-size:13px}


  /* ──────────────────────────────────────────
     SERVER SETTINGS
     ────────────────────────────────────────── */
  .srvs-head{padding:16px 16px}
  .srvs-title{font-size:16px}
  .srvs-body{padding:14px 16px}


  /* ──────────────────────────────────────────
     ADD CHANNEL MODAL
     ────────────────────────────────────────── */
  .addch-card{padding:20px}
  .addch-title{font-size:16px}
  .addch-input{font-size:15px;padding:12px 16px;min-height:48px}
  .addch-types{gap:10px}
  .addch-type{padding:14px 12px}
  .addch-btns button{padding:12px 20px;font-size:14px;min-height:48px}


  /* ──────────────────────────────────────────
     LOADING OVERLAY
     ────────────────────────────────────────── */
  #loadingOverlay .loading-text{font-size:13px}


  /* ──────────────────────────────────────────
     SKELETON LOADING STATES
     ────────────────────────────────────────── */
  .skeleton{animation:skeletonPulse 1.5s ease-in-out infinite}
  .skeleton-row{padding:8px 12px}
  .skeleton-avatar{width:40px;height:40px}
  .skeleton-text{height:12px}


  /* ──────────────────────────────────────────
     MICRO-INTERACTIONS — Premium touch feedback
     ────────────────────────────────────────── */

  /* Universal button spring bounce-back */
  button,
  [role="button"],
  .clickable{
    transition:transform var(--dur-normal) var(--ease-spring),background 150ms var(--ease-out);
  }

  /* Scale feedback on tap — snappy press, spring release */
  .dw-action:active,.dm-item:active,.ch-item:active,.gc-item:active,
  .stk-card:active,.trd-wl-item:active,.lp-item:active,.fp-user:active,
  .srv-btn:active,.sb-srv-item:active,
  .srvb-item:active,.gcc-user:active,.us-item:active{
    transform:scale(.95);
    transition:transform 60ms ease-out;
  }

  /* List items — subtle entrance animation */
  .dm-item,.ch-item,.gc-item,.fp-user,.lp-item,.srvb-item{
    animation:listItemIn .2s var(--ease-out) both;
  }

  /* Tab switch — smooth underline + color */
  .fp-tab,.trd-btab,.trd-tab{
    transition:color 200ms var(--ease-out),background 200ms var(--ease-out),transform var(--dur-normal) var(--ease-spring);
  }
  .fp-tab:active,.trd-btab:active,.trd-tab:active{transform:scale(.96);transition-duration:60ms}

  /* Overlay page slide-up entrances (tradingPage excluded — uses transition only) */
  #stocksPage.open,#leaderPage.open,#settingsPanel.open,#friendsPage.open{
    animation:mobileSlideUp .32s var(--ease-out);
  }

  /* Staggered entrance for drawer actions — premium cascade */
  .dw-action{animation:cardReveal .25s var(--ease-out) both}
  .dw-action:nth-child(1){animation-delay:.03s}
  .dw-action:nth-child(2){animation-delay:.06s}
  .dw-action:nth-child(3){animation-delay:.09s}
  .dw-action:nth-child(4){animation-delay:.12s}

  /* Drawer DM/GC items — staggered reveal */
  .dm-item,.gc-item{animation:listItemIn .2s var(--ease-out) both}
  .dm-item:nth-child(1),.gc-item:nth-child(1){animation-delay:.02s}
  .dm-item:nth-child(2),.gc-item:nth-child(2){animation-delay:.04s}
  .dm-item:nth-child(3),.gc-item:nth-child(3){animation-delay:.06s}
  .dm-item:nth-child(4),.gc-item:nth-child(4){animation-delay:.08s}
  .dm-item:nth-child(5),.gc-item:nth-child(5){animation-delay:.1s}
  .dm-item:nth-child(n+6),.gc-item:nth-child(n+6){animation-delay:.12s}

  /* Messages — staggered entrance for batch loads */
  .msg:nth-last-child(1){animation-delay:0s}
  .msg:nth-last-child(2){animation-delay:.02s}
  .msg:nth-last-child(3){animation-delay:.04s}
  .msg:nth-last-child(4){animation-delay:.06s}
  .msg:nth-last-child(5){animation-delay:.08s}

  /* Profile popup slide-up — bouncier */
  #profilePopup .pp-card{animation:mobileSlideUp .28s var(--ease-out)}

  /* Bottom sheet modals — spring entrance */
  #srvBrowserCard,#gcCreateCard,#gcSettingsCard,#userSearchCard,#srvSettingsCard{
    animation:mobileSlideUp .32s cubic-bezier(.32,.72,.0,1);
  }

  /* Unread badges — pop in */
  .dm-unread-badge,.gc-unread-badge,.sb-srv-badge{
    animation:badgePop .3s var(--ease-spring) both;
  }

  /* Message send — enhanced bounce */
  .send-btn:active{animation:sendBounce 280ms var(--ease-spring)}

  /* Primary buttons — bounce feedback on tap */
  .btn-primary:active,.invite-join-btn:active,.gcc-create-btn:active,
  .trd-exec-btn:active:not(:disabled),.mkt-closed-btn:active{
    animation:btnPress 200ms var(--ease-spring);
  }

  /* Smooth scroll snap for horizontal lists */
  .trd-wl-list{scroll-snap-type:x proximity;scroll-padding:0 16px}
  .trd-wl-item{scroll-snap-align:start}

  /* Input focus glow — subtle ring pulse */
  #msgInput:focus{
    box-shadow:0 0 0 3px var(--primary-dim),0 0 16px rgba(56,161,105,.08);
  }

  /* Trade success — mobile overlay size */
  .trade-success-check{width:56px;height:56px}
  .trade-success-check svg{width:24px;height:24px}

  /* Error feedback — shake input on invalid */
  .trd-qty-input.shake-error{animation:shakeError 350ms var(--ease-out)}

  /* Notification — slide from bottom-right on mobile */
  .notif{animation:cardReveal .25s var(--ease-out) both}

  /* Toggle — smooth state change */
  .toggle{transition:background var(--dur-slow) var(--ease-out),border-color var(--dur-slow),transform var(--dur-normal) var(--ease-spring)}
  .toggle:active{transform:scale(.92);transition-duration:80ms}

} /* end @media(max-width:767px) */


/* ═══════════════════════════════════════════════════════════════
   SMALL PHONES (<380px)
   Reduce all font sizes by 1px, shrink avatars by 4px
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:380px){

  /* Auth */
  #authCard{padding:28px 20px 24px}
  .auth-logo-text{font-size:22px;letter-spacing:4px}
  .auth-tag{font-size:9px;letter-spacing:2px;margin-bottom:24px}
  .form-input{font-size:13px!important;padding:10px 14px 10px 38px!important}
  .auth-btn{padding:11px 16px;font-size:13px}

  /* Nav — 20px icon, 9px label */
  .mob-nav-btn{padding:4px 6px;min-width:44px}
  .mob-nav-label{font-size:9px}
  .mob-nav-svg{width:20px;height:20px}

  /* Chat — 14px name, 14px message text, 14px input */
  .chat-top{padding:8px 12px;padding-top:calc(8px + var(--st))}
  .chat-name{font-size:14px}
  .msg-av{width:28px;height:28px;min-width:28px}
  .msg-text{font-size:14px;padding:8px 12px}
  .msg-author{font-size:11px}
  #msgInput{font-size:14px;padding:8px 12px}
  .tool-btn{width:36px;height:36px}
  .send-btn{width:36px;height:36px}

  /* Emoji */
  .emoji-grid{grid-template-columns:repeat(7,1fr)}
  .emoji-btn{font-size:20px;min-height:40px}

  /* Drawer — full width, smaller icons */
  #sidebarDrawer{width:100vw!important}
  .dw-actions{gap:8px;padding:10px 8px 8px}
  .dw-action{padding:0 10px;height:48px;gap:10px}
  .dw-action-icon{width:32px;height:32px}
  .dw-action-icon svg{width:17px;height:17px}
  .dw-action-label{font-size:12px}
  #drawerDmList .dm-item{padding:8px 10px;min-height:44px}
  #drawerDmList .dm-av{width:36px;height:36px}
  #drawerDmList .dm-name{font-size:13px}

  /* Trading — compact for small screens */
  .trd-wl-item{min-width:88px!important;max-width:105px!important;padding:8px 10px!important}
  .trd-wl-sym{font-size:11px!important}
  .trd-wl-price{font-size:12px!important}
  .trd-wl-chg{font-size:8px!important}
  .trd-chart-wrap{height:180px!important;min-height:180px!important}
  .trd-stock-name{font-size:16px!important}
  .trd-stock-price{font-size:20px!important}
  .trd-stock-chg{font-size:10px!important}
  .trd-pc-val{font-size:12px!important}
  .trd-pc-label{font-size:7px!important}
  .trd-qty-input{font-size:20px!important;height:50px!important}
  .trd-preset{height:36px!important;font-size:11px!important}
  .trd-exec-btn{height:50px!important;font-size:14px!important;left:12px!important;right:12px!important}
  .trd-hold-item{padding:10px 14px!important;min-height:48px!important}
  .trd-bottom{margin-left:12px!important;margin-right:12px!important}
  .trd-form{padding:12px 12px 16px!important}

  /* Friends/Leaderboard — shrink avatars -4px */
  .fp-uav{width:36px;height:36px}
  .lp-av{width:32px;height:32px}
  .fp-uname{font-size:14px}
  .lp-uname{font-size:13px}

  /* Modals */
  .gcc-input{font-size:14px}
  .us-input{font-size:14px}
  .addch-input{font-size:14px}
}


/* ═══════════════════════════════════════════════════════════════
   EXTRA SMALL (<340px) — Very compact phones
   Further reduce by 1px, hide chat description, compact padding
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:340px){

  /* Nav */
  .mob-nav-btn{min-width:38px;padding:4px 4px}
  .mob-nav-svg{width:18px;height:18px}
  .mob-nav-label{font-size:8px}

  /* Chat — compact */
  .chat-top{gap:4px;padding:6px 8px;padding-top:calc(6px + var(--st))}
  #sidebarToggle{width:34px;height:34px}
  .chat-icon{width:26px;height:26px}
  .chat-name{font-size:13px}
  .chat-desc{display:none!important}
  .top-btn{width:30px;height:30px}

  /* Messages — further reduce */
  .msg-av{width:26px;height:26px;min-width:26px}
  .msg-text{font-size:13px;padding:6px 10px}
  #msgInput{font-size:13px;padding:8px 12px}

  /* Compact padding throughout — still usable */
  #msgsWrap{padding:8px 10px calc(108px + var(--sb))}
  .fp-body{padding:8px 12px}
  .lp-body{padding:8px 12px}
  .trd-form{padding:10px 12px 16px}

  /* Drawer — compact */
  .dw-actions{gap:6px;padding:8px 6px}
  .dw-action{height:44px;padding:0 8px;gap:8px}
  .dw-action-label{font-size:11px}
}
