/* =====================================================================
   Cytara — Dark Telegram-style UI
   ===================================================================== */

/* Default = dark */
:root {
  --bg:       #0E1621;
  --bg2:      #17212B;
  --bg3:      #1F2C3A;
  --text:     #FFFFFF;
  --muted:    #7D8E9A;
  --line:     rgba(255,255,255,0.07);
  --blue:     #3390EC;
  --red:      #FF5252;
  --green:    #4FAD5B;
  --card:     #17212B;
  --input:    #1F2C3A;
  --shadow:   0 4px 24px rgba(0,0,0,0.55);
  --safe-top: calc(env(safe-area-inset-top)    + 14px);
  --safe-bot: calc(env(safe-area-inset-bottom) + 14px);
  --nav-h:    62px;
  --r-xl:     20px;
  --r-lg:     16px;
  --r-md:     12px;
  --r-sm:     8px;
}

[data-theme="light"] {
  --bg:    #F0F2F5;
  --bg2:   #FFFFFF;
  --bg3:   #E4E8ED;
  --text:  #1A1A2E;
  --muted: rgba(26,26,46,0.48);
  --line:  rgba(0,0,0,0.07);
  --blue:  #3390EC;
  --card:  #FFFFFF;
  --input: #E8ECF1;
  --shadow: 0 2px 16px rgba(0,0,0,0.09);
}

/* Reset */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  transition: background .22s, color .22s;
}
input, textarea, button, select { font: inherit; color: inherit; }
.wrap { height: 100dvh; width: 100vw; position: relative; overflow: hidden; }
.hidden { display: none !important; }

/* ===== KEYFRAMES ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dot {
  0%,80%,100% { opacity:.25; transform:scale(.72); }
  40%         { opacity:1;   transform:scale(1); }
}
@keyframes navPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  0%   { background-position:-200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes splashDot {
  0%,80%,100% { opacity:.2; transform:scale(.7); }
  40%         { opacity:1;  transform:scale(1); }
}

/* ===== SCREENS (auth/register steps) ===== */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  transition: opacity .26s cubic-bezier(.2,0,0,1), transform .26s cubic-bezier(.2,0,0,1);
  will-change: opacity, transform;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.screen.hidden { opacity: 0; pointer-events: none; transform: translateX(28px); }

/* Card */
.card {
  flex: 1; display: flex; flex-direction: column;
  padding: var(--safe-top) 22px var(--safe-bot);
  gap: 12px; overflow-y: auto;
}
.card::-webkit-scrollbar { display: none; }

/* Headings */
.h1 {
  font-family: 'Unbounded', sans-serif; font-size: 22px;
  font-weight: 900; letter-spacing: -.5px; color: var(--text); line-height: 1.2;
}
.sub { font-size: 13px; color: var(--muted); margin-top: -4px; }
.form { display: flex; flex-direction: column; gap: 10px; }

/* ===== BUTTONS ===== */
.btn {
  width: 100%; border: 0; padding: 15px;
  background: var(--blue); color: #fff;
  font: 600 16px/1 'Inter', sans-serif;
  border-radius: var(--r-lg); cursor: pointer;
  transition: transform .12s, opacity .14s, background .18s;
  -webkit-appearance: none; appearance: none;
}
.btn:active  { transform: scale(.97); opacity: .88; }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn-ghost   { background: var(--bg3); color: var(--text); }
.btn-outline { background: transparent; border: 1.5px solid var(--blue); color: var(--blue); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text);
  cursor: pointer; transition: background .14s, transform .1s; flex-shrink: 0;
}
.icon-btn:hover  { background: var(--bg3); }
.icon-btn:active { transform: scale(.9); }

/* Back button (registration) */
.back-btn {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--blue); font-size: 15px; font-weight: 500;
  padding: 2px 0; align-self: flex-start; margin-bottom: 2px;
  transition: opacity .14s;
}
.back-btn:active { opacity: .55; }
.back-btn svg { width: 19px; height: 19px; }

/* ===== INPUTS ===== */
.input, .textarea {
  width: 100%; padding: 13px 16px;
  background: var(--input); border: 1.5px solid transparent;
  border-radius: var(--r-md); color: var(--text);
  font-size: 16px; outline: none;
  transition: border-color .2s, background .2s; -webkit-appearance: none;
}
.input:focus, .textarea:focus { border-color: var(--blue); background: var(--bg2); }
.input::placeholder { color: var(--muted); }
.field-err { font-size: 12px; color: var(--red); min-height: 15px; padding: 0 2px; }

/* Suggestions */
.suggest { display: flex; flex-direction: column; gap: 4px; }
.sug-item {
  padding: 11px 14px; background: var(--bg3);
  border-radius: var(--r-sm); font-size: 14px; cursor: pointer; transition: background .14s;
}
.sug-item:active { background: var(--bg2); }

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* ===== THEME SELECTOR ===== */
.theme-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; padding: var(--safe-top) 20px var(--safe-bot);
}
.ka-logo { font-family:'Unbounded',sans-serif; font-size:26px; font-weight:900; color:var(--blue); letter-spacing:-1px; }
.theme-head { text-align:center; display:flex; flex-direction:column; gap:5px; }
.theme-title { font-family:'Unbounded',sans-serif; font-size:18px; font-weight:700; color:var(--text); }
.theme-sub { font-size:12px; color:var(--muted); }
.theme-cards { display:flex; gap:10px; width:100%; }
.theme-card {
  flex:1; display:flex; flex-direction:column; align-items:center;
  gap:8px; padding:12px 8px 14px; border-radius:var(--r-xl);
  border:2px solid transparent; background:var(--bg3);
  cursor:pointer; font-size:11px; font-weight:600; color:var(--text);
  transition:border-color .18s, transform .1s;
}
.theme-card:active { transform:scale(.94); }
.theme-card.active { border-color:var(--blue); }
.theme-preview {
  width:100%; height:56px; border-radius:8px; padding:7px;
  display:flex; flex-direction:column; gap:4px;
}
.tp-light { background:#fff; border:1px solid rgba(0,0,0,.1); }
.tp-dark  { background:#17212B; border:1px solid rgba(255,255,255,.1); }
.tp-sys   { background:linear-gradient(135deg,#fff 50%,#17212B 50%); border:1px solid rgba(128,128,128,.14); }
.tp-bar  { height:5px; border-radius:3px; background:#3390EC; width:55%; }
.tp-line { height:3px; border-radius:2px; background:rgba(128,128,128,.3); }
.tp-line.s { width:72%; }
.tp-btn  { height:6px; border-radius:3px; background:#3390EC; width:45%; margin-top:auto; opacity:.7; }

/* ===== AUTH ENTRY ===== */
.auth-entry {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  padding:var(--safe-top) 28px var(--safe-bot);
  background:var(--bg);
}
.auth-logo {
  font-family:'Unbounded',sans-serif; font-size:44px; font-weight:900;
  color:var(--blue); letter-spacing:-2px;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) both;
}
.auth-tagline {
  font-size:14px; color:var(--muted); margin-top:8px; margin-bottom:44px;
  text-align:center;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) .06s both;
}
.auth-btns {
  display:flex; flex-direction:column; gap:10px;
  width:100%; max-width:320px;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) .12s both;
}

/* ===== METHOD BUTTONS (reg) ===== */
.method-btn {
  display:flex; align-items:center; gap:14px;
  font-size:16px; text-align:left; padding:16px 20px; justify-content:flex-start;
}
.method-btn svg { width:22px; height:22px; flex-shrink:0; }

/* Phone input */
.phone-input-wrap {
  display:flex; align-items:center;
  background:var(--input); border:1.5px solid transparent;
  border-radius:var(--r-md); transition:border-color .2s;
}
.phone-input-wrap:focus-within { border-color:var(--blue); }
.phone-prefix { padding:13px 2px 13px 16px; font-size:16px; user-select:none; flex-shrink:0; }
.phone-inp { border:none !important; background:transparent !important; border-radius:0 !important; flex:1; padding-left:2px !important; }

/* OTP */
.otp-input { text-align:center; font-size:30px; letter-spacing:14px; font-weight:600; }

/* Demo hint */
.demo-hint {
  background:rgba(51,144,236,.11); border:1px solid rgba(51,144,236,.22);
  border-radius:var(--r-sm); padding:10px 14px; font-size:13px; color:var(--blue);
}

/* Avatar picker */
.avatar-picker { display:flex; flex-direction:column; align-items:center; gap:12px; }
.avatar-ring {
  width:104px; height:104px; border-radius:50%;
  border:2.5px dashed rgba(51,144,236,.38); background:var(--bg3);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; overflow:hidden; position:relative;
  transition:border-color .2s, transform .15s;
}
.avatar-ring.has-photo { border-style:solid; border-color:var(--blue); }
.avatar-ring:active { transform:scale(.94); }
.avatar-plus svg { width:32px; height:32px; color:var(--muted); }
.avatar-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.avatar-label { font-size:13px; color:var(--muted); text-align:center; }

/* ===== CHAT ROOT ===== */
.chat-root {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  background:var(--bg);
  animation:fadeIn .22s ease;
}

/* ===== MAIN VIEW (dialog list) ===== */
.main-view {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  padding-bottom:var(--nav-h);
  background:var(--bg);
}

/* App header */
.app-header {
  display:flex; align-items:center; gap:10px;
  padding:var(--safe-top) 14px 10px;
  flex-shrink:0;
}

/* Story stack */
.story-stack { display:flex; align-items:center; }
.story-item {
  width:38px; height:38px; border-radius:50%;
  padding:2px; flex-shrink:0;
  background:linear-gradient(135deg,#6C5CE7,#3390EC,#00B0B9);
  transition:transform .14s; cursor:pointer;
}
.story-item:active { transform:scale(.88); }
.story-item + .story-item { margin-left:-11px; }
.story-inner {
  width:100%; height:100%; border-radius:50%;
  background:var(--bg2); border:2px solid var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:12px; color:var(--text);
  overflow:hidden;
}
.story-inner img { width:100%; height:100%; object-fit:cover; }
.app-title {
  flex:1; font-family:'Unbounded',sans-serif;
  font-size:20px; font-weight:900; color:var(--text); letter-spacing:-.5px;
}

/* Search bar */
.search-wrap {
  position:relative; padding:0 12px 8px; flex-shrink:0;
}
.search-icon-pos {
  position:absolute; left:24px; top:50%; transform:translateY(-58%);
  width:17px; height:17px; color:var(--muted); pointer-events:none;
}
.search-input {
  width:100%; padding:10px 14px 10px 42px;
  background:var(--bg3); border:none; border-radius:12px;
  color:var(--text); font-size:15px; outline:none;
  -webkit-appearance:none; transition:background .18s;
}
.search-input::placeholder { color:var(--muted); }
.search-input:focus { background:var(--bg2); }

/* Chips */
.chips-row {
  display:flex; gap:7px; padding:0 12px 10px;
  overflow-x:auto; flex-shrink:0;
}
.chips-row::-webkit-scrollbar { display:none; }
.chip {
  display:flex; align-items:center; gap:6px; white-space:nowrap;
  padding:6px 13px; border-radius:18px; border:none;
  background:var(--bg3); color:var(--muted); font-size:14px; font-weight:500;
  cursor:pointer; transition:background .18s, color .18s, transform .1s; flex-shrink:0;
}
.chip:active { transform:scale(.93); }
.chip.active { background:var(--blue); color:#fff; }
.chip-count {
  min-width:19px; height:19px; border-radius:10px; padding:0 5px;
  background:rgba(255,255,255,.2); font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
}
.chip:not(.active) .chip-count { background:rgba(125,142,154,.22); color:var(--muted); }

/* Dialog list */
.dialog-list { flex:1; overflow-y:auto; list-style:none; }
.dialog-list::-webkit-scrollbar { width:3px; }
.dialog-list::-webkit-scrollbar-thumb { background:var(--bg3); border-radius:2px; }

.dialog-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px; cursor:pointer;
  border-bottom:1px solid var(--line);
  transition:background .13s;
  animation:fadeIn .18s ease;
}
.dialog-item:active { background:var(--bg3); }
.dialog-item.active { background:var(--bg2); }

.dialog-av-wrap { position:relative; flex-shrink:0; }
.dialog-avatar {
  width:54px; height:54px; border-radius:50%;
  background:var(--blue); display:flex; align-items:center; justify-content:center;
  color:white; font-weight:700; font-size:18px; overflow:hidden;
}
.online-dot {
  position:absolute; bottom:1px; right:1px;
  width:12px; height:12px; border-radius:50%;
  background:var(--green); border:2.5px solid var(--bg);
}

.dialog-body { flex:1; min-width:0; }
.dialog-row1 { display:flex; justify-content:space-between; align-items:baseline; gap:6px; margin-bottom:3px; }
.dialog-row2 { display:flex; justify-content:space-between; align-items:center; gap:6px; }
.dialog-name { font-size:15px; font-weight:600; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.dialog-time { font-size:12px; color:var(--muted); flex-shrink:0; }
.dialog-preview { font-size:14px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.dialog-badge {
  min-width:20px; height:20px; border-radius:10px; padding:0 6px;
  background:var(--blue); color:#fff; font-size:12px; font-weight:700;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}

/* Empty state */
.empty-pl {
  flex:1; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:14px; color:var(--muted); padding:40px 24px; text-align:center;
}
.empty-pl svg { opacity:.35; }
.empty-pl p { font-size:14px; line-height:1.6; max-width:200px; }

/* ===== CHAT VIEW — fixed full-screen, above tab bar ===== */
.chat-view {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--vh, 100dvh);
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,0,0,1);
  will-change: transform;
  z-index: 30; /* above .bottom-nav z-index:20 */
}
.chat-view.open { transform: translateX(0); }

/* On mobile: hide tab bar when chat is open */
@media (max-width: 767px) {
  .chat-root.is-in-chat .bottom-nav { display: none !important; }
  .chat-root.is-in-chat .main-view  { padding-bottom: 0 !important; }
}

/* Chat header — sticky top, keyboard never pushes it */
.chat-header-bar {
  display: flex; align-items: center; gap: 6px;
  padding: var(--safe-top) 8px 10px;
  background: var(--bg); flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.chat-partner-info  { flex:1; display:flex; align-items:center; gap:10px; min-width:0; cursor:pointer; }
.chat-partner-av {
  width:38px; height:38px; border-radius:50%;
  background:var(--blue); display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:14px; flex-shrink:0; overflow:hidden; position:relative;
}
.chat-partner-av .online-dot { width:10px; height:10px; border-width:2px; }
.chat-partner-texts { min-width:0; }
.partner-name   { font-size:16px; font-weight:600; line-height:1.2; }
.partner-status { font-size:12px; color:var(--muted); margin-top:1px; }
.partner-status.online { color:var(--green); }

/* Messages scroll container — takes all remaining space */
.messages-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
}
.messages-container::-webkit-scrollbar { width:3px; }
.messages-container::-webkit-scrollbar-thumb { background:var(--bg3); border-radius:2px; }

/* Inner list — pushes messages to bottom when few */
#messagesList {
  display: flex; flex-direction: column;
  min-height: 100%; padding: 8px 12px 10px;
}
.msgs-spacer { flex: 1; min-height: 8px; }

/* Date separator pill */
.date-sep {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 0 6px;
}
.date-sep-pill {
  background: rgba(0,0,0,.42); color: rgba(255,255,255,.78);
  font-size: 12px; font-weight: 500; line-height: 1.2;
  padding: 4px 12px; border-radius: 12px; user-select: none;
}
[data-theme="light"] .date-sep-pill { background: rgba(0,0,0,.14); color: rgba(0,0,0,.58); }

/* Message rows */
.message {
  display: flex; flex-direction: column;
  max-width: 75%; /* Telegram standard */
  margin-top: 2px;
  animation: messageIn .16s ease;
}
.message.new-block { margin-top: 8px; } /* different sender or time gap */
.message.own { align-self: flex-end; }

/* Bubble */
.bubble {
  padding: 8px 12px;
  background: var(--bg3);
  word-break: break-word; font-size: 15px; line-height: 1.45;
  overflow: hidden; /* contains the float */
  border-radius: 18px 18px 18px 4px; /* incoming: left corner */
}
.message.own .bubble {
  background: var(--blue); color: #fff;
  border-radius: 18px 18px 4px 18px; /* outgoing: right corner */
}

/* Time + ticks INSIDE bubble via float trick */
.bmeta {
  display: inline-flex; align-items: flex-end; gap: 3px;
  float: right;
  margin: 6px -2px -4px 8px;
  line-height: 1; pointer-events: none;
}
.btime {
  font-size: 11px; white-space: nowrap;
  color: var(--muted); opacity: .9;
}
.message.own .btime { color: rgba(255,255,255,.72); opacity: 1; }
.tick { width: 14px; height: 14px; flex-shrink: 0; opacity: .75; }

/* Typing indicator */
.typing-indicator {
  padding:7px 18px; font-size:13px; color:var(--muted);
  display:flex; align-items:center; gap:8px; flex-shrink:0;
  border-top:1px solid var(--line);
}
.typing-dots span {
  display:inline-block; width:6px; height:6px; border-radius:50%;
  background:var(--muted);
  animation:dot 1.1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay:.18s; }
.typing-dots span:nth-child(3) { animation-delay:.36s; }

/* Message form */
.message-form {
  display:flex; gap:8px; align-items:center;
  padding:10px 12px;
  padding-bottom:max(10px, calc(env(safe-area-inset-bottom) + 8px));
  background:var(--bg); flex-shrink:0;
  border-top:1px solid var(--line);
}
.message-input {
  flex:1; background:var(--bg3); border:none;
  padding:11px 16px; border-radius:22px; color:var(--text);
  font-size:15px; outline:none;
  -webkit-appearance:none; transition:background .18s;
}
.message-input::placeholder { color:var(--muted); }
.message-input:focus { background:var(--bg2); }
.send-btn {
  width:44px; height:44px; border-radius:50%;
  background:var(--blue); color:white; border:none;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
  transition:transform .12s, opacity .14s;
}
.send-btn:active { transform:scale(.88); }
.send-btn:disabled { background:var(--bg3); opacity:.45; cursor:default; }

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0;
  height:var(--nav-h); background:var(--bg2);
  border-top:1px solid var(--line);
  display:flex; align-items:stretch;
  padding-bottom:env(safe-area-inset-bottom);
  z-index:20;
}
.nav-item {
  flex:1; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:3px; padding:8px 4px;
  border:none; background:none;
  cursor:pointer; color:var(--muted);
  position:relative; transition:color .18s;
}
.nav-item.active { color:var(--blue); }
.nav-item svg { width:24px; height:24px; transition:transform .14s; }
.nav-item.active svg { animation:navPop .22s ease; }
.nav-label { font-size:11px; font-weight:500; }
.nav-badge {
  position:absolute; top:5px; left:50%;
  min-width:18px; height:18px; border-radius:9px;
  background:var(--blue); color:#fff;
  font-size:11px; font-weight:700; padding:0 5px;
  display:flex; align-items:center; justify-content:center;
  transform:translateX(2px);
  transition:opacity .2s;
}

/* ===== MODAL (bottom sheet) ===== */
.modal {
  position:fixed; inset:0; z-index:100;
  background:rgba(0,0,0,.58);
  display:flex; align-items:flex-end; justify-content:center;
  animation:fadeIn .18s ease;
}
.modal.hidden { display:none; }
.modal-inner {
  background:var(--bg); border-radius:20px 20px 0 0;
  width:100%; max-width:640px; max-height:82dvh;
  display:flex; flex-direction:column; overflow:hidden;
  animation:slideUp .26s cubic-bezier(.2,0,0,1);
}
.modal-header {
  padding:14px 14px 14px 20px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--line);
  font-size:17px; font-weight:600; flex-shrink:0;
}

/* ===== SETTINGS / PROFILE SCREEN (Telegram style) ===== */
.ps-screen {
  flex: 1; overflow-y: auto;
  padding-bottom: 24px;
  animation: fadeIn .2s ease;
}
.ps-screen::-webkit-scrollbar { display: none; }

/* Hero section */
.ps-hero {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 24px 20px 18px;
}
.ps-av-wrap { position: relative; margin-bottom: 2px; }
.ps-av {
  width: 82px; height: 82px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.ps-av-cam {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--bg2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .12s;
  color: var(--text);
}
.ps-av-cam svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.ps-av-cam:active { background: var(--blue); color: #fff; transform: scale(.9); }
.ps-hero-name { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.ps-hero-sub  { font-size: 14px; color: var(--muted); text-align: center; }

/* Section label */
.ps-section-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 16px 4px;
}

/* Card */
.ps-card {
  margin: 0 12px 10px;
  background: var(--bg2);
  border-radius: 14px;
  overflow: hidden;
}

/* Separator inside card — indented to align with text */
.ps-sep {
  height: 1px; background: var(--line);
  margin-left: 62px; /* icon(36) + gap(12) + padding(14) */
}

/* Row */
.ps-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  cursor: pointer; transition: background .13s;
}
.ps-row:active { background: rgba(255,255,255,.04); }
.ps-row-action { cursor: pointer; }

/* Icon box — colored rounded square */
.ps-icon-box {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ps-icon-box svg { width: 18px; height: 18px; }

/* Mini avatar (Accounts row) */
.ps-mini-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Row body — title + subtitle */
.ps-row-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ps-row-title { font-size: 15px; color: var(--text); line-height: 1.2; }
.ps-row-sub   { font-size: 12px; color: var(--muted); }

/* Row end — chevron + optional badge */
.ps-row-end {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; color: var(--muted);
}
.ps-row-end svg { stroke: var(--bg3); }

/* Badge (Accounts) */
.ps-badge {
  background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}

/* Danger row */
.ps-row-danger { cursor: pointer; }
.ps-row-danger:active { background: rgba(255,82,82,.07); }

/* Version text */
.ps-version {
  text-align: center; font-size: 13px;
  color: var(--muted); padding: 14px 20px 8px;
}

/* ===== PROFILE SCREEN — parallax collapsing cover ===== */
.pp-screen {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}

/* ── Floating toolbar — always visible, transparent → solid ── */
.pp-tb {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; align-items: flex-end; gap: 4px;
  padding: var(--safe-top) 8px 8px;
  background: transparent;
  /* transition handled by JS for scroll-sync */
}
.pp-tb-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: rgba(255,255,255,.92); /* white over cover image */
  cursor: pointer; flex-shrink: 0;
  transition: background .14s;
}
.pp-tb-btn:active { background: rgba(255,255,255,.15); }
.pp-tb-mid {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  gap: 1px;
}
.pp-tb-name { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pp-tb-sub  { font-size: 12px; color: var(--green); }

/* ── Scroll area (full height, cover starts at very top) ── */
.pp-scr { flex: 1; overflow-y: auto; overflow-x: hidden; }
.pp-scr::-webkit-scrollbar { display: none; }

/* ── Cover image section ── */
.pp-cover {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Parallax background — taller than cover for parallax room */
.pp-cbg {
  position: absolute;
  top: -25%; left: 0; right: 0;
  height: 150%; /* extra space for parallax upward travel */
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* Bottom gradient: darkens cover from bottom */
.pp-cgrad {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 70%;
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 50%, transparent 100%);
  pointer-events: none;
  will-change: opacity;
}

/* Camera edit button inside cover (top-right, below toolbar) */
.pp-ccam {
  position: absolute;
  top: calc(var(--safe-top) + 48px); right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.38); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .14s;
  will-change: opacity;
}
.pp-ccam:active { background: rgba(0,0,0,.6); }

/* Cover info: avatar circle + name + status at bottom of cover */
.pp-cinfo {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px 18px;
  display: flex; flex-direction: column; gap: 4px;
  will-change: transform, opacity;
}
.pp-cav-circle {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 6px;
  border: 2.5px solid rgba(255,255,255,.3);
}
.pp-cname {
  font-size: 22px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
  line-height: 1.2;
}
.pp-cstatus {
  font-size: 14px; color: rgba(255,255,255,.82);
}

/* Action buttons */
.pp-actions {
  display: flex; gap: 10px; padding: 0 14px 14px;
}
.pp-act {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 7px; padding: 12px 6px;
  background: var(--bg2); border-radius: 14px;
  border: none; cursor: pointer; color: var(--blue);
  font-size: 12px; font-weight: 500;
  transition: background .13s, transform .1s;
}
.pp-act:active { background: var(--bg3); transform: scale(.95); }
.pp-act-ic {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

/* Info card */
.pp-info {
  margin: 0 14px 12px;
  background: var(--bg2); border-radius: 14px; overflow: hidden;
}
.pp-irow { padding: 12px 16px; cursor: pointer; transition: background .13s; }
.pp-irow:active { background: var(--bg3); }
.pp-ival { font-size: 15px; color: var(--text); font-weight: 500; }
.pp-ilbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pp-isep { height: 1px; background: var(--line); margin-left: 16px; }

/* Tabs */
.pp-tabs {
  display: flex; position: relative;
  border-bottom: 1px solid var(--line);
}
.pp-tab {
  flex: 1; padding: 12px 8px; border: none; background: none;
  font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; position: relative; z-index: 1;
  transition: color .16s;
}
.pp-tab.active { color: var(--blue); }
.pp-tab-line {
  position: absolute; bottom: 0; left: 0;
  height: 2px; background: var(--blue); border-radius: 1px;
  transition: transform .22s cubic-bezier(.2,0,0,1), width .22s;
}

/* Grid */
.pp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2px; transition: opacity .16s;
}
.pp-cell {
  aspect-ratio: 1; cursor: pointer;
  transition: transform .12s, opacity .12s;
}
.pp-cell:active { transform: scale(.93); opacity: .8; }

/* FAB */
.pp-fab-w {
  position: absolute; bottom: 18px; left: 50%;
  transform: translateX(-50%);
  will-change: transform, opacity; z-index: 5;
}
.pp-fab {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 24px;
  background: var(--blue); color: #fff;
  border: none; font-size: 15px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(51,144,236,.42);
  transition: transform .12s, opacity .14s;
}
.pp-fab:active { transform: scale(.95); }

/* ===== PARTNER PROFILE BOTTOM SHEET ===== */
.pp-sheet {
  background: var(--bg2); border-radius: 24px 24px 0 0;
  width: 100%; max-width: 640px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  display: flex; flex-direction: column; align-items: center;
  animation: slideUp .28s cubic-bezier(.2,0,0,1);
  overflow: hidden;
}
.pp-drag-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 12px auto 4px;
  flex-shrink: 0;
}
.pp-avatar-wrap { padding: 10px 0 6px; }
.pp-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: #fff;
  border: 3px solid var(--bg);
}
.pp-name {
  font-size: 20px; font-weight: 700; color: var(--text);
  text-align: center; padding: 0 20px; line-height: 1.2;
}
.pp-username { font-size: 14px; color: var(--blue); margin-top: 2px; text-align: center; }
.pp-status { font-size: 13px; color: var(--muted); margin-top: 4px; text-align: center; }
.pp-online { color: var(--green); font-weight: 600; }
.pp-actions {
  display: flex; gap: 12px; padding: 18px 20px 20px; width: 100%;
}
.pp-action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border-radius: 16px;
  background: var(--bg3); border: none; cursor: pointer;
  color: var(--blue); font-size: 12px; font-weight: 600; font-family: inherit;
  transition: background .13s, transform .1s;
}
.pp-action-btn:active { transform: scale(.94); background: var(--bg); }
.pp-action-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

/* ===== CONTACTS PANEL ===== */
.cnt-srch-w {
  position: relative; padding: 0 12px 8px; flex-shrink: 0;
}
.cnt-srch-ic {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.cnt-input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--bg3); border: none; border-radius: 12px;
  color: var(--text); font-size: 15px; outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  transition: background .15s;
}
.cnt-input:focus { background: var(--bg2); }
.cnt-input::placeholder { color: var(--muted); }
.cnt-list { flex: 1; overflow-y: auto; list-style: none; }
.cnt-list::-webkit-scrollbar { display: none; }
.cnt-hint {
  padding: 48px 24px; text-align: center;
  font-size: 14px; color: var(--muted); line-height: 1.5;
}
.cnt-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; cursor: pointer;
  transition: background .12s;
}
.cnt-item:hover { background: var(--bg3); }
.cnt-item:active { background: var(--bg2); }
.cnt-av {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px; overflow: hidden; flex-shrink: 0;
}
.cnt-info { flex: 1; min-width: 0; }
.cnt-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnt-sub  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ===== QR CODE MODAL ===== */
.qr-inner {
  background: var(--bg); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 420px;
  animation: slideUp .26s cubic-bezier(.2,0,0,1);
  overflow: hidden;
}
.qr-body {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  padding: 20px 24px 32px;
}
.qr-img-wrap {
  width: 240px; height: 240px; border-radius: 16px;
  background: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
}
.qr-img { width: 240px; height: 240px; display: block; }
.qr-url {
  font-size: 13px; color: var(--muted);
  word-break: break-all; text-align: center; max-width: 280px;
}
.qr-hint { font-size: 13px; color: var(--muted); text-align: center; margin-top: -4px; }

/* ===== PUBLIC PROFILE (from /u/ or /p/ links) ===== */
.pub-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px; gap: 8px;
  background: var(--bg);
  animation: fadeIn .3s ease;
}
.pub-av-wrap { margin-bottom: 8px; }
.pub-av {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 3px solid var(--bg3);
}
.pub-name  { font-size: 22px; font-weight: 700; color: var(--text); text-align: center; }
.pub-uname { font-size: 15px; color: var(--muted); }
.pub-actions {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 280px; margin-top: 20px;
}

/* ===== DESKTOP ===== */
@media (min-width:768px) {
  .chat-root { flex-direction:row; max-width:1280px; margin:0 auto; height:100dvh; }
  .main-view { position:relative; width:380px; flex-shrink:0; border-right:1px solid var(--line); padding-bottom:0; height:100%; }
  .chat-view {
    position: relative !important; height: auto !important; flex: 1;
    transform: none !important; transition: none !important; z-index: auto !important;
  }
  .chat-root.is-in-chat .bottom-nav { display: flex !important; }
  .bottom-nav { position:relative; flex-direction:column; width:380px; height:auto; border-top:none; border-right:1px solid var(--line); padding:0; order:-1; }
  .bottom-nav .nav-item { flex-direction:row; gap:12px; padding:14px 20px; justify-content:flex-start; border-radius:var(--r-md); margin:2px 8px; }
  .bottom-nav .nav-item svg { width:22px; height:22px; }
  .bottom-nav .nav-label { font-size:14px; }
  .nav-badge { position:static; transform:none; margin-left:auto; }
}

/* ===== NEW FEATURES — appended ===== */

/* Forgot password link */
.forgot-link {
  text-align: center; display: block; color: var(--blue);
  font-size: 14px; text-decoration: none; margin-top: 4px;
  opacity: .85; transition: opacity .15s;
}
.forgot-link:active { opacity: .5; }

/* Reply bar */
.reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--bg2);
  border-top: 1px solid var(--line);
  animation: slideUp .16s ease;
}
.reply-bar-line {
  width: 3px; height: 36px; background: var(--blue);
  border-radius: 3px; flex-shrink: 0;
}
.reply-bar-body { flex: 1; min-width: 0; }
.reply-bar-name { font-size: 12px; font-weight: 600; color: var(--blue); margin-bottom: 2px; }
.reply-bar-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar-close {
  background: none; border: none; color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background .14s;
}
.reply-bar-close:active { background: var(--bg3); }

/* Reply preview inside bubble */
.reply-preview {
  border-left: 3px solid rgba(255,255,255,.5);
  padding: 4px 8px; margin-bottom: 6px;
  border-radius: 4px; background: rgba(0,0,0,.15);
}
.message:not(.own) .reply-preview {
  border-left-color: var(--blue);
  background: rgba(51,144,236,.1);
}
.reply-preview-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.8); margin-bottom: 2px; }
.message:not(.own) .reply-preview-name { color: var(--blue); }
.reply-preview-text { font-size: 12px; color: rgba(255,255,255,.65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message:not(.own) .reply-preview-text { color: var(--muted); }

/* Double tick (read) */
.tick-read { opacity: 1 !important; stroke: rgba(255,255,255,.9); }
.tick-pending { font-size: 11px; opacity: .7; }

/* Voice UI */
.voice-ui {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg);
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.voice-cancel {
  border: none; background: none; color: var(--red);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px;
}
.voice-status {
  flex: 1; display: flex; align-items: center; gap: 8px;
  justify-content: center; color: var(--text);
}
.voice-dot {
  color: var(--red); font-size: 16px;
  animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%,100% { opacity: 1; } 50% { opacity: .3; }
}
.voice-time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.voice-send {
  border: none; background: var(--blue); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 20px;
  transition: transform .1s, opacity .14s;
}
.voice-send:active { transform: scale(.93); }

/* Main menu dropdown */
.main-menu-dropdown {
  position: fixed; top: calc(var(--safe-top) + 46px); right: 10px;
  background: var(--bg2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); z-index: 300; min-width: 200px;
  overflow: hidden; opacity: 0; transform: scale(.9) translateY(-8px);
  transform-origin: top right;
  transition: opacity .15s ease, transform .15s ease;
}
.main-menu-dropdown.open { opacity: 1; transform: scale(1) translateY(0); }
.mmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; cursor: pointer; font-size: 15px;
  color: var(--text); transition: background .13s;
}
.mmd-item:active { background: var(--bg3); }
.mmd-sep { height: 1px; background: var(--line); }

/* Theme badge in settings */
.ps-theme-badge {
  font-size: 13px; color: var(--muted); margin-right: 4px;
}

/* ===== NEW GROUP SCREEN ===== */
.ng-screen {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}
.ng-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: var(--safe-top) 8px 10px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
  background: var(--bg);
}
.ng-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--text); padding-left: 4px; }
.ng-next-btn {
  background: none; border: none; color: var(--blue);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 6px 12px;
  border-radius: 20px; transition: background .15s;
  font-family: inherit;
}
.ng-next-btn:hover { background: rgba(51,144,236,.1); }
.ng-next-btn:disabled { opacity: .35; pointer-events: none; }

/* Chip row (selected members) */
.ng-sel-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ng-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(51,144,236,.15); color: var(--blue);
  border-radius: 20px; padding: 5px 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .13s;
}
.ng-chip:active { background: rgba(51,144,236,.28); }
.ng-chip svg { opacity: .7; }

/* Contact row check circle */
.ng-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, border-color .15s;
}
.ng-check-on {
  background: var(--blue); border-color: var(--blue);
}
.ng-contact-row { transition: background .12s; }
.ng-contact-row:hover { background: var(--bg3); }
.ng-contact-row.ng-selected { background: rgba(51,144,236,.07); }

/* Empty contacts placeholder */
.ng-empty-contacts {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; gap: 10px; text-align: center;
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.ng-empty-contacts svg { opacity: .35; margin-bottom: 4px; }

/* ── Step 2: avatar + name ─── */
.ng-step2-wrap {
  display: flex; align-items: center; gap: 20px;
  padding: 28px 20px 20px;
}
.ng-av-ring {
  position: relative; flex-shrink: 0;
  width: 86px; height: 86px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2.5px dashed var(--blue);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: visible;
  transition: background .15s;
}
.ng-av-ring:hover { background: rgba(51,144,236,.1); }
.ng-av-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; overflow: hidden;
}
.ng-av-label { font-size: 11px; color: var(--muted); }
.ng-av-plus {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  pointer-events: none;
}
.ng-step2-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ng-name-inp {
  width: 100%; padding: 13px 14px;
  background: var(--bg3); border: 2px solid transparent;
  border-radius: 14px; color: var(--text);
  font-size: 16px; font-weight: 500; font-family: inherit;
  outline: none; transition: border-color .18s, background .18s;
}
.ng-name-inp:focus { border-color: var(--blue); background: var(--bg2); }
.ng-name-inp::placeholder { color: var(--muted); }
.ng-name-hint { font-size: 12px; color: var(--muted); padding-left: 2px; }

/* ── Step 3: type cards ─── */
.ng-step3-wrap { padding: 16px; }
.ng-section-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 10px;
}
.ng-type-row { display: flex; gap: 10px; }
.ng-type-card {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px 14px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--bg3);
  cursor: pointer; transition: border-color .18s, background .18s;
  gap: 6px; position: relative;
}
.ng-type-card:hover { background: var(--bg2); }
.ng-type-active { border-color: var(--blue); background: rgba(51,144,236,.07); }
.ng-type-card-ic { color: var(--muted); margin-bottom: 2px; }
.ng-type-active .ng-type-card-ic { color: var(--blue); }
.ng-type-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ng-type-card-sub { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.3; }
.ng-type-radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); margin-top: 4px;
  transition: border-color .18s, background .18s;
}
.ng-type-radio.on { border-color: var(--blue); background: var(--blue); }

/* Username field in step 3 */
.ng-uname-section { overflow: hidden; }
.ng-uname-section.hidden { display: none; }
.ng-uname-field {
  display: flex; align-items: center;
  background: var(--bg3); border-radius: 14px;
  border: 2px solid transparent;
  padding: 0 12px;
  transition: border-color .18s;
}
.ng-uname-field:focus-within { border-color: var(--blue); background: var(--bg2); }
.ng-uname-prefix { font-size: 15px; color: var(--muted); flex-shrink: 0; }
.ng-uname-inp {
  flex: 1; padding: 13px 8px; background: none; border: none;
  color: var(--text); font-size: 15px; font-family: inherit; outline: none;
}
.ng-uname-inp::placeholder { color: var(--muted); }
.ng-uname-status { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.ng-uname-status.ok  { color: var(--green); }
.ng-uname-status.bad { color: var(--red); }

/* Favorites screen */
.fav-screen {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; animation: fadeIn .2s ease;
}
.fav-list { flex: 1; overflow-y: auto; list-style: none; padding: 8px 0; }
.fav-item {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.fav-content { font-size: 15px; color: var(--text); }
.fav-time { font-size: 12px; color: var(--muted); }

/* PWA install banner */
.pwa-banner {
  position: fixed; bottom: calc(var(--nav-h) + 8px); left: 8px; right: 8px;
  background: var(--bg2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); z-index: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  animation: slideUp .3s cubic-bezier(.2,0,0,1);
}
.pwa-banner-text { flex: 1; font-size: 14px; color: var(--text); }
.pwa-banner-btns { display: flex; align-items: center; gap: 8px; }
.pwa-install-btn {
  background: var(--blue); color: #fff; border: none;
  padding: 8px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .1s;
}
.pwa-install-btn:active { transform: scale(.93); }
.pwa-close-btn {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 6px;
}

/* ===== VOICE MESSAGE BUBBLE ===== */
.vb-bubble {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px 12px 8px;
  background: var(--bg3);
  border-radius: 18px 18px 18px 4px;
  min-width: 220px;
  max-width: 280px;
  position: relative;
  user-select: none;
}
.vb-bubble.vb-own {
  background: linear-gradient(135deg, #2B7FDB 0%, #3390EC 60%, #2196f3 100%);
  border-radius: 18px 18px 4px 18px;
}

/* Play button */
.vb-play-btn {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #3390EC;
  transition: transform .12s, opacity .14s;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.vb-play-btn:active { transform: scale(.88); opacity: .8; }

/* Center column */
.vb-center {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* Waveform */
.vb-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  cursor: pointer;
}
.vb-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.35);
  flex-shrink: 0;
  transition: background .08s;
}
.vb-bubble:not(.vb-own) .vb-bar {
  background: rgba(51,144,236,.45);
}
.vb-bar.vb-bar-played {
  background: rgba(255,255,255,.92);
}
.vb-bubble:not(.vb-own) .vb-bar.vb-bar-played {
  background: #3390EC;
}

/* Bottom row: timer + unread dot */
.vb-bottom-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.vb-timer {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.75);
  line-height: 1;
}
.vb-bubble:not(.vb-own) .vb-timer {
  color: var(--muted);
}
.vb-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #F4A62A;
  flex-shrink: 0;
}

/* Transcribe button */
.vb-transcribe-btn {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: none;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  transition: background .14s;
  align-self: start;
  margin-top: 2px;
}
.vb-bubble:not(.vb-own) .vb-transcribe-btn {
  background: rgba(51,144,236,.15);
  color: #3390EC;
}
.vb-transcribe-btn:active { background: rgba(255,255,255,.28); }
.vb-transcribe-btn svg { display: block; }

/* Meta: time + tick */
.vb-meta {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 3px;
  align-self: end;
  margin-bottom: 2px;
}
.vb-time {
  font-size: 11px;
  white-space: nowrap;
  color: rgba(255,255,255,.65);
}
.vb-bubble:not(.vb-own) .vb-time {
  color: var(--muted);
}
.vb-meta .tick,
.vb-meta .tick-read {
  width: 14px;
  height: 10px;
  stroke: rgba(255,255,255,.75);
}

/* Transcript text block */
.vb-transcript {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 2px 0;
  font-style: italic;
  line-height: 1.4;
}
