/* ===========================================================
   NavoChat × NavoNews — Design System v2.0
   Premium Ecosystem | Apple · Linear · Notion · Stripe
   =========================================================== */

/* ------------------------------------------
   0. DESIGN TOKENS
   ------------------------------------------ */
:root {
  --primary: #0066FF;
  --primary-hover: #0055DD;
  --primary-pressed: #0044BB;
  --primary-alpha: rgba(0, 102, 255, 0.10);
  --primary-alpha-strong: rgba(0, 102, 255, 0.22);
  --accent: #6C63FF;
  --accent-alpha: rgba(108, 99, 255, 0.10);
  --gradient-primary: linear-gradient(135deg, #0066FF, #0055DD);
  --gradient-logo: linear-gradient(135deg, #6C63FF, #FF6B9D);

  --bg: #F5F7FA;
  --bg-elevated: #EDF0F5;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-glass: rgba(255,255,255,0.5);
  --surface-glass-strong: rgba(255,255,255,0.82);
  --surface-glass-weak: rgba(255,255,255,0.25);
  --surface-secondary: #EFEFF4;

  --text: #1C1C1E;
  --text-secondary: #8E8E93;
  --text-tertiary: #B0B0B5;

  --border: rgba(0,0,0,0.07);
  --border-hover: rgba(0,0,0,0.14);
  --glass-border: rgba(255,255,255,0.65);

  --success: #34C759;
  --warning: #FF9F0A;
  --error: #FF3B30;
  --info: #5AC8FA;

  --shadow-xs: 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.10), 0 8px 20px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 20px rgba(0,102,255,0.20);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.25s var(--ease-out);
  --transition-slow: 0.45s var(--ease-out);
  --transition-spring: 0.5s var(--ease-spring);

  --sidebar-w: 340px;
  --nav-h: 60px;
  --input-h: 64px;
  --chat-bg-own: var(--primary-alpha);
  --chat-bg-other: var(--bg-elevated);
}

[data-theme="dark"] {
  --bg: #05060A;
  --bg-elevated: #0C0E14;
  --surface: #0F1118;
  --surface-elevated: #161922;
  --surface-glass: rgba(15,17,24,0.65);
  --surface-glass-strong: rgba(15,17,24,0.88);
  --surface-glass-weak: rgba(15,17,24,0.35);
  --surface-secondary: #1A1D28;

  --text: #F5F5F7;
  --text-secondary: #86868B;
  --text-tertiary: #555559;

  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --glass-border: rgba(255,255,255,0.06);

  --shadow-xs: 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.40);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.50);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.60);
  --shadow-xl: 0 32px 80px rgba(0,0,0,0.70);
  --shadow-glow: 0 0 30px rgba(0,102,255,0.30);

  --primary-alpha: rgba(0, 102, 255, 0.14);
  --primary-alpha-strong: rgba(0, 102, 255, 0.26);
  --accent-alpha: rgba(108, 99, 255, 0.14);
  --chat-bg-own: rgba(0, 102, 255, 0.16);
  --chat-bg-other: #141417;
}

/* ------------------------------------------
   1. RESET & BASE
   ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100%;
  transition: background 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
input, button, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--primary-alpha-strong); color: inherit; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus:not(:focus-visible) {
  outline: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------
   2. BACKGROUND CANVAS
   ------------------------------------------ */
#bg-canvas {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
}

/* ------------------------------------------
   3. AUTH SCREEN
   ------------------------------------------ */
.auth-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.auth-screen.is-hidden {
  opacity: 0; transform: scale(0.95); pointer-events: none;
}
.auth__bg-orb {
  position: fixed; top: -30%; left: 50%; transform: translateX(-50%);
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(0,102,255,0.08) 0%, rgba(108,99,255,0.04) 40%, transparent 70%);
  pointer-events: none;
  animation: floatOrb 8s ease-in-out infinite;
}
.auth__bg-orb-2 {
  position: fixed; bottom: -20%; right: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(108,99,255,0.05) 0%, transparent 60%);
  pointer-events: none;
  animation: floatOrb 10s ease-in-out infinite reverse;
}
@keyframes floatOrb {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-20px); }
}
.auth__container {
  width: 100%; max-width: 420px; padding: 28px 24px;
  animation: fadeInUp 0.6s var(--ease-out-expo);
}
.auth__container--sm { max-width: 380px; }
.auth__header {
  text-align: center; margin-bottom: 32px;
}
.auth__logo-frame {
  width: 132px; height: 132px; margin: 0 auto 22px; overflow: visible;
  display: flex; align-items: center; justify-content: center;
}
.auth__logo-img { width: 100%; height: 100%; object-fit: contain; }
.auth__title {
  font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth__subtitle {
  font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.5;
}
.auth__tabs {
  display: flex; gap: 0; margin-bottom: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 3px;
}
.auth__tab {
  flex: 1; padding: 10px 16px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.auth__tab.is-active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__form.is-hidden { display: none; }
.auth__submit { width: 100%; padding: 14px 28px; font-size: 0.9375rem; margin-top: 4px; }
.auth__error {
  font-size: 0.8125rem; color: var(--error); text-align: center;
  min-height: 20px;
}

/* ------------------------------------------
   4. INPUTS
   ------------------------------------------ */
.input-group {
  display: flex; flex-direction: column; gap: 6px;
}
.input-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.input__label {
  font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary);
}
.input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-size: 0.9375rem; outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-alpha-strong);
  background: var(--surface-elevated);
}
.input:hover:not(:focus) {
  border-color: var(--border-hover);
}
.input::placeholder { color: var(--text-tertiary); }
.input--code {
  text-align: center; font-size: 1.5rem; letter-spacing: 8px; font-weight: 600; padding: 14px;
}

/* ------------------------------------------
   5. BUTTONS
   ------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-md); font-weight: 600; font-size: 0.9375rem;
  border: none; cursor: pointer; transition: all 0.2s var(--ease-out);
  text-decoration: none; white-space: nowrap; font-family: inherit; line-height: 1;
  padding: 12px 28px; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background 0.2s;
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active::after { background: rgba(255,255,255,0); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn--primary {
  background: var(--gradient-primary); color: #fff;
  box-shadow: 0 4px 14px rgba(0,102,255,0.35);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,102,255,0.45);
}
.btn--primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(0,102,255,0.30);
}
.btn--text {
  background: transparent; color: var(--primary); padding: 8px 16px;
  font-size: 0.875rem; font-weight: 500;
}
.btn--text:hover { background: var(--primary-alpha); }
.btn--tab {
  background: transparent; color: var(--text-secondary); padding: 6px 16px;
  font-size: 0.8125rem; font-weight: 500; border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: all var(--transition);
}
.btn--tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--send {
  width: 48px; height: 48px; padding: 0; border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease, background 0.2s ease;
}
.btn--send:hover { transform: scale(1.08); }
.btn--send:active { transform: scale(0.92); }

.icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition); touch-action: manipulation;
  position: relative;
}
.icon-btn::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: transparent; transition: background var(--transition);
}
.icon-btn:hover::after { background: var(--border); }
.icon-btn:active::after { background: var(--border-hover); }
.icon-btn svg { flex-shrink: 0; position: relative; z-index: 1; }
.call-header-btn { color: var(--text-secondary); }
.call-header-btn:hover { color: var(--primary); }
.call-header-btn:active { color: var(--primary-pressed); }
button { touch-action: manipulation; }

/* ------------------------------------------
   6. APP LAYOUT
   ------------------------------------------ */
.app-screen {
  display: flex; height: 100vh; height: 100dvh; background: var(--bg);
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}
.app-screen.is-hidden { opacity: 0; pointer-events: none; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  transition: transform var(--transition), background var(--transition-slow);
  position: relative; z-index: 10;
}
.sidebar__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; min-height: 70px;
  border-bottom: 1px solid var(--border);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1rem; flex-shrink: 0; }
.sidebar__brand-logo {
  width: 42px; height: 42px; overflow: visible; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sidebar__brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar__actions { display: flex; align-items: center; gap: 0px; justify-content: flex-end; flex-shrink: 0; }

.sidebar__search { padding: 8px 16px 12px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box__icon {
  position: absolute; left: 12px; color: var(--text-tertiary); pointer-events: none;
  z-index: 1;
}
.search-box__input {
  width: 100%; padding: 12px 12px 12px 36px; border: 1.5px solid transparent;
  border-radius: var(--radius-sm); background: var(--bg-elevated);
  color: var(--text); font-size: 0.9375rem; outline: none;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.search-box__input:focus {
  border-color: var(--primary-alpha-strong);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-alpha);
}
.search-box__input:hover:not(:focus) {
  background: var(--surface-secondary);
}
.search-box__input::placeholder { color: var(--text-tertiary); }

.sidebar__tabs { display: flex; gap: 4px; padding: 4px 16px 12px; }
.sidebar__tab {
  padding: 6px 14px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; border-radius: 20px; transition: all var(--transition);
}
.sidebar__tab.is-active {
  background: var(--primary-alpha); color: var(--primary);
}
.sidebar__list {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 8px; min-height: 0; overscroll-behavior: contain;
}
.sidebar__content { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.sidebar__profile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--border); cursor: pointer;
  transition: background var(--transition);
}
.sidebar__profile:hover { background: var(--bg-elevated); }
.sidebar__profile-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gradient-logo);
  flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 600; color: #fff;
}
.sidebar__profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar__profile-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sidebar__profile-name {
  font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar__profile-email {
  font-size: 0.75rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Bottom Navigation */
.sidebar__bottom {
  display: flex; align-items: stretch; justify-content: space-around;
  border-top: 1px solid var(--border); padding: 0; flex-shrink: 0; height: 56px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.sidebar__bottom-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  flex: 1; border: none; background: transparent;
  color: var(--text-tertiary); font-size: 0.625rem; cursor: pointer;
  transition: color 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  padding: 6px 0;
  pointer-events: auto;
}
.sidebar__bottom-btn:hover { color: var(--text-secondary); }
.sidebar__bottom-btn:active { transform: scale(0.92); }
.sidebar__bottom-btn.is-active { color: var(--primary); }
.sidebar__bottom-btn.is-active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 20px; height: 2.5px; background: var(--primary); border-radius: 0 0 3px 3px;
  pointer-events: none;
}
.sidebar__bottom-btn svg { display: block; margin-bottom: 2px; pointer-events: none; }
.sidebar-back { display: none; }

/* Connection Indicator */
.conn-indicator {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--success); transition: background 0.3s;
}
.conn-indicator.is-offline { background: var(--error); }

/* Chat Area */
.chat-area {
  flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--bg);
  position: relative;
}

/* Empty State */
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-secondary); padding: 24px;
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-empty__logo {
  width: 128px; height: 128px; overflow: visible; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.75; transition: opacity var(--transition);
}
.chat-empty__logo:hover { opacity: 1; }
.chat-empty__logo img { width: 100%; height: 100%; object-fit: contain; }
.chat-empty__title { font-size: 1.25rem; font-weight: 600; color: var(--text); }
.chat-empty__text { font-size: 0.875rem; }

/* Chat View */
.chat-view {
  flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative;
}
.chat-view.is-hidden,
.chat-empty.is-hidden { display: none; }

.chat-view__header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; height: auto; min-height: 64px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0; z-index: 5;
  transition: background var(--transition);
}
.chat-view__avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient-logo); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 1rem;
  overflow: hidden;
}
.chat-view__avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-view__info { flex: 1; min-width: 0; }
.chat-view__name {
  font-size: 0.9375rem; font-weight: 600; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-view__status { font-size: 0.75rem; color: var(--text-secondary); }
.chat-view__actions { display: flex; align-items: center; gap: 4px; }
.sidebar-toggle { display: none; }

/* Messages Area */
.chat-view__messages {
  flex: 1; overflow-y: auto; padding: 20px 20px 24px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 0; overscroll-behavior: contain;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    url('../images/bg-light.PNG');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
}
[data-theme="dark"] .chat-view__messages {
  background:
    linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
    url('../images/bg-dark.PNG');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
}

/* Message Bubbles */
.message {
  display: flex; align-items: flex-end; gap: 6px;
  max-width: 82%; padding: 1px 16px;
  animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: both;
}
.message:nth-child(1) { animation-delay: 0s; }
.message:nth-child(2) { animation-delay: 0.02s; }
.message:nth-child(3) { animation-delay: 0.04s; }
.message:nth-child(n+4) { animation-delay: 0.06s; }
.message--own { align-self: flex-end; flex-direction: row-reverse; }
.message--other { align-self: flex-start; }
.message--first-in-group { margin-top: 8px; }
.message--last-in-group { margin-bottom: 6px; }

.message__side { display: flex; align-items: flex-end; }
.message__body { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.message__sender-row { margin-bottom: 1px; }
.message__sender {
  font-size: 0.75rem; font-weight: 600; color: var(--primary);
  padding: 0 12px; cursor: pointer;
}
.message__sender:hover { text-decoration: underline; }

.message__bubble {
  padding: 10px 16px; border-radius: 18px;
  font-size: 0.95rem; line-height: 1.45; overflow-wrap: break-word;
  word-break: break-word; max-width: 100%;
  position: relative; hyphens: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.2s ease;
}
.message__bubble:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.message--own .message__bubble {
  background: var(--chat-bg-own);
  border-bottom-right-radius: 4px;
}
.message--own .message__bubble--no-tail-own {
  border-bottom-right-radius: 18px;
}
.message--other .message__bubble {
  background: var(--chat-bg-other);
  border-bottom-left-radius: 4px;
}
.message--other .message__bubble--no-tail {
  border-bottom-left-radius: 18px;
}
.message__text { white-space: pre-wrap; }
.message__time {
  font-size: 0.625rem; color: var(--text-tertiary);
  margin-top: 2px; display: inline-flex; align-items: center; gap: 3px;
  float: right; margin-left: 8px; line-height: 1;
}
.message--own .message__time { text-align: right; }
.message__status { color: var(--primary); display: inline-flex; vertical-align: middle; }
.message__edited { font-size: 0.625rem; color: var(--text-tertiary); margin-left: 4px; }
.message__reply {
  margin-bottom: 4px; padding: 4px 8px; background: var(--bg-elevated);
  border-radius: var(--radius-sm); border-left: 3px solid var(--primary);
  cursor: pointer; font-size: 0.75rem; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px;
}
.message__reply:hover { background: var(--surface-secondary); }
.message__reply-sender {
  font-weight: 600;
  color: var(--primary, #4A90D9);
  margin-right: 4px;
}
.message__reply-text {
  color: var(--text-tertiary);
}

.date-separator {
  text-align: center; font-size: 0.75rem; font-weight: 500; color: var(--text-tertiary);
  padding: 16px 0 8px;
  animation: fadeIn 0.3s var(--ease-out);
}

/* Input Area */
.chat-view__input {
  padding: 16px 20px; background: var(--surface-glass-strong);
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
  transition: background 0.3s ease;
  position: relative; cursor: text; touch-action: manipulation;
}
.message-input { display: flex; align-items: center; gap: 10px; cursor: text; }
.message-input__field {
  flex: 1; padding: 14px 18px; border: 1.5px solid var(--border);
  border-radius: var(--radius-xl); background: var(--bg-elevated);
  color: var(--text); font-size: 1rem; outline: none;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94); font-family: inherit;
  resize: none; overflow: hidden; max-height: 120px; line-height: 1.4;
  word-break: break-word; touch-action: manipulation; cursor: text;
  -webkit-user-select: text; user-select: text;
  -webkit-tap-highlight-color: transparent;
}
.message-input__field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-alpha-strong);
  background: var(--surface);
}
.message-input__field:hover:not(:focus):not(:disabled) {
  border-color: var(--border-hover);
}
.message-input__field::placeholder { color: var(--text-tertiary); }
.message-input__field:disabled { opacity: 0.4; pointer-events: none; }

/* Edit / Reply Bars */
.edit-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--primary-alpha);
  border-top: 1px solid var(--border);
  animation: slideDown 0.2s var(--ease-out);
}
.edit-bar.is-hidden { display: none; }
.edit-bar__info {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; color: var(--primary); font-weight: 500;
}

/* ------------------------------------------
   7. CHAT LIST ITEMS
   ------------------------------------------ */
.chat-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition), transform 0.15s;
  position: relative;
}
.chat-item:hover { background: var(--bg-elevated); }
.chat-item:active { transform: scale(0.99); }
.chat-item__fav:hover { opacity: 1 !important; }
.chat-section-label { padding: 10px 16px 4px; font-size: 0.6875rem; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.chat-item.is-active { background: var(--primary-alpha); }
.chat-item__avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient-logo); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 1rem;
  overflow: hidden;
}
.chat-item__avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-item__info { flex: 1; min-width: 0; }
.chat-item__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.chat-item__name { font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: break-word; }
.chat-item__time { font-size: 0.6875rem; color: var(--text-tertiary); flex-shrink: 0; }
.chat-item__bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-item__preview {
  font-size: 0.8125rem; color: var(--text-secondary); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1; word-break: break-word;
}
.chat-item__badge {
  background: var(--primary); color: #fff; font-size: 0.625rem; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,102,255,0.3);
  animation: badgeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgeIn {
  from { transform: scale(0); }
  50% { transform: scale(1.15); }
  to { transform: scale(1); }
}
.chat-item__status {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-tertiary);
}
.chat-item__status.is-online { background: var(--success); }

/* Voice Recording Bar — Telegram-style press-hold */
.voice-rec-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--surface-glass-strong);
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border-top: 1px solid var(--glass-border);
  animation: slideUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200;
}
.voice-rec-bar.is-hidden { display: none; }
.voice-rec-bar.is-cancelling { background: rgba(255,59,48,0.12); }
.voice-rec-bar.is-cancelling .voice-rec-label { color: var(--error); }

.voice-rec-bar.is-locked-mode { position: fixed; }
.voice-rec-bar.is-locked .voice-rec-dot { background: var(--success); animation: none; }
.voice-rec-bar.is-locked .voice-rec-timer { color: var(--success); }
.voice-rec-lock {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-tertiary); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s;
}
.voice-rec-lock.is-locked { color: var(--primary); background: var(--primary-alpha); }

.voice-rec-left { display: flex; align-items: center; gap: 8px; }
.voice-rec-center { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.voice-rec-right { display: flex; align-items: center; gap: 8px; width: auto; min-width: 36px; }
.voice-rec-indicator { display: flex; align-items: center; gap: 6px; }
.voice-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--error);
  animation: pulse 1s ease-in-out infinite;
}
.voice-rec-timer { font-size: 0.8125rem; font-weight: 600; color: var(--error); min-width: 36px; letter-spacing: 0.5px; }
.voice-rec-label { font-size: 0.6875rem; color: var(--text-tertiary); white-space: nowrap; }
.voice-rec-waveform {
  display: flex; align-items: center; gap: 2px; height: 24px;
}
.voice-rec-waveform span {
  width: 2px; border-radius: 1px; background: var(--primary);
  animation: waveform 0.5s ease-in-out infinite;
}
.voice-rec-cancel {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--surface-secondary);
  color: var(--text); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background 0.2s;
}
.voice-rec-cancel:hover { background: var(--border); }
@keyframes waveform {
  0%, 100% { height: 6px; }
  50% { height: 18px; }
}

/* Voice button recording state */
#voice-btn.is-recording {
  background: var(--primary) !important;
  color: #fff !important;
}
#voice-btn.is-sending {
  background: var(--success) !important;
  color: #fff !important;
  pointer-events: none;
  opacity: 0.7;
}

/* Voice Player */
.voice-player {
  padding: 8px 16px; background: var(--surface-glass-strong);
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border-top: 1px solid var(--glass-border);
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.voice-player.is-hidden { display: none; }
.voice-player-controls {
  display: flex; align-items: center; gap: 10px;
}
.voice-player-waveform {
  flex: 1; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); position: relative; overflow: hidden;
}
.voice-player-progress {
  height: 100%; background: var(--primary-alpha);
  border-radius: var(--radius-sm); transition: width 0.2s linear;
}
.voice-player-time {
  font-size: 0.75rem; color: var(--text-secondary);
  min-width: 32px; text-align: center;
}
.voice-player-delete {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-tertiary); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s;
}
.voice-player-delete:hover { color: var(--error); background: rgba(255,59,48,0.1); }

/* Camera */
.camera-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #000; display: flex; flex-direction: column;
}
.camera-overlay.is-hidden { display: none; }
.camera-view { flex: 1; position: relative; overflow: hidden; }
.camera-view video { width: 100%; height: 100%; object-fit: cover; }
.camera-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; padding: 16px;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}
.camera-top-right {
  display: flex; gap: 10px;
}
.camera-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 24px 20px; padding-bottom: calc(env(safe-area-inset-bottom, 24px) + 24px);
  z-index: 2;
  background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.camera-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.18);
  color: white; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.camera-btn:hover { background: rgba(255,255,255,0.3); }
.camera-btn.is-active { background: rgba(255,255,255,0.4); box-shadow: 0 0 16px rgba(255,255,255,0.3); }
.camera-capture-btn {
  width: 80px; height: 80px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.85);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
  box-shadow: 0 0 20px rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.camera-capture-btn:active { transform: scale(0.9); }
.camera-capture-inner {
  width: 64px; height: 64px; border-radius: 50%;
  background: white; transition: all 0.15s;
}
.camera-capture-btn:active .camera-capture-inner { background: #ccc; width: 56px; height: 56px; }
.camera-mode-btn { display: flex; align-items: center; justify-content: center; }
.camera-capture-row { display: flex; align-items: center; justify-content: center; gap: 24px; width: 100%; }
.camera-gallery { position: absolute; left: 20px; bottom: 24px; }
.camera-gallery-preview { width: 48px; height: 48px; border-radius: 14px; overflow: hidden; border: 2px solid rgba(255,255,255,0.4); }
.camera-gallery-preview img { width: 100%; height: 100%; object-fit: cover; }
.camera-timer {
  position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
  font-size: 0.875rem; color: white; font-weight: 600;
  background: rgba(0,0,0,0.4); padding: 4px 16px; border-radius: 20px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.camera-preview-overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: #000; z-index: 3;
}
.camera-preview-overlay.is-hidden { display: none; }
.camera-preview-actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 16px; padding: 24px 16px;
  padding-bottom: calc(env(safe-area-inset-bottom, 24px) + 24px);
  background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}

/* ------------------------------------------
   8. MODALS
   ------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
  opacity: 1;
  transition: opacity 0.35s var(--ease-out), backdrop-filter 0.35s ease;
}
.modal-overlay.is-hidden { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); pointer-events: none; }
.modal {
  width: 100%; max-width: 480px; max-height: 60vh;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); overflow: hidden;
  display: flex; flex-direction: column;
  animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 1.0625rem; font-weight: 600; }
.modal__search { padding: 12px 20px; }
.modal__list { flex: 1; overflow-y: auto; padding: 0 8px; }
.modal__empty {
  text-align: center; padding: 32px 20px;
  color: var(--text-secondary); font-size: 0.875rem;
}
.modal__footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__footer.is-hidden { display: none; }
.modal__selected-bar.is-hidden { display: none; }
.modal__selected-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 0; font-size: 0.8125rem; color: var(--text-secondary);
}
.modal__selected-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 16px 0; max-height: 120px; overflow-y: auto;
}
.modal__selected-chips.is-hidden { display: none; }
.selected-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--primary-alpha); color: var(--primary);
  border-radius: var(--radius-full); padding: 4px 10px 4px 8px;
  font-size: 0.75rem; font-weight: 500;
  animation: chipIn 0.2s var(--ease-spring);
  cursor: default; white-space: nowrap;
}
.selected-chip__remove {
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.625rem; line-height: 1; cursor: pointer;
  transition: transform 0.15s;
}
.selected-chip__remove:hover { transform: scale(1.15); }
@keyframes chipIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal__create-btn { width: 100%; }
.modal__body { padding: 8px 0; overflow-y: auto; flex: 1; min-height: 0; }

/* Settings Modal */
.modal--settings { max-width: 420px; }
.modal--sm { max-width: 380px; }

/* User Results */
.user-result {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition);
}
.user-result:hover { background: var(--bg-elevated); }
.user-result.is-selected { background: var(--primary-alpha); }
.user-result__avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient-logo); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; overflow: hidden;
}
.user-result__info { flex: 1; min-width: 0; }
.user-result__name { font-size: 0.875rem; font-weight: 600; }
.user-result__email { font-size: 0.75rem; color: var(--text-secondary); }
.user-result__check {
  margin-left: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.user-result__check.is-checked { background: var(--primary); border-color: var(--primary); }

/* ------------------------------------------
   9. SETTINGS
   ------------------------------------------ */
.settings-section { padding: 8px 0; }
.settings-section + .settings-section { border-top: 1px solid var(--border); }
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.settings-item__left {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; font-weight: 500;
}
.settings-item__left svg { color: var(--text-secondary); flex-shrink: 0; }
.settings-toggle {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.settings-toggle__label { font-size: 0.8125rem; color: var(--text-secondary); }
.toggle-switch {
  width: 44px; height: 26px; border-radius: 13px;
  background: var(--border); position: relative; cursor: pointer;
  transition: background 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.toggle-switch.is-on { background: var(--primary); }
.toggle-switch__knob {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  position: absolute; top: 2px; left: 2px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch.is-on .toggle-switch__knob { transform: translateX(18px); }
.settings-select {
  background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 4px 8px; font-size: 0.8125rem;
  font-family: inherit; outline: none; cursor: pointer;
}
.settings-version {
  text-align: center; padding: 16px 20px; font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Profile View */
.profile-view__avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--gradient-logo); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.5rem; font-weight: 600;
  overflow: hidden; box-shadow: 0 4px 20px rgba(108,99,255,0.15);
}
.profile-view__avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-view__name { font-size: 1.125rem; font-weight: 600; }
.profile-view__email { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 2px; }
.profile-view__username { font-size: 0.8125rem; color: var(--text-tertiary); margin-top: 2px; }
.profile-view__bio { font-size: 0.875rem; color: var(--text-secondary); margin-top: 12px; padding: 0 8px; }
.profile-view__meta { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 16px; }

/* Context Menu */
.context-menu {
  position: fixed; z-index: 300; min-width: 160px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-xl);
  padding: 4px; display: flex; flex-direction: column;
  animation: menuIn 0.2s var(--ease-out-expo);
}
.context-menu.is-hidden { display: none; }
.context-menu__item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: none; background: transparent;
  color: var(--text); font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-xs);
  transition: background var(--transition); width: 100%; text-align: left;
  font-family: inherit;
}
.context-menu__item:hover { background: var(--bg-elevated); }
.context-menu__item svg { flex-shrink: 0; }

/* ------------------------------------------
   10. SKELETON LOADING
   ------------------------------------------ */
.skeleton-list { padding: 8px; }
.skeleton-row {
  height: 56px; margin-bottom: 4px;
  background: var(--border);
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-msg {
  height: 60px; width: 60%; margin-bottom: 8px;
  background: var(--border);
  border-radius: var(--radius-lg);
  animation: shimmer 1.5s ease-in-out infinite;
}
.messages-loading { padding: 16px; }

@keyframes shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 0.9; }
  100% { opacity: 0.4; }
}
@keyframes shimmerSlide {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ------------------------------------------
   11. KEYFRAME ANIMATIONS
   ------------------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes messageInMobile {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ripple {
  from { transform: scale(0); opacity: 0.5; }
  to { transform: scale(4); opacity: 0; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0,102,255,0.2); }
  50% { box-shadow: 0 0 24px rgba(0,102,255,0.4); }
}
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Typing Indicator */
.typing-dots { display: flex; align-items: center; gap: 3px; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
  animation: typingDot 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ------------------------------------------
   12. REDUCED MOTION
   ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===========================================================
   13. RESPONSIVE — TABLET
   =========================================================== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 300px; }

  /* Tablet — bigger input buttons */
  .chat-view__input { padding: 14px 16px; }
  .message-input { gap: 8px; }
  .attach-plus-btn { width: 48px; height: 48px; }
  .emoji-inline-btn { width: 44px; height: 44px; }
  .btn--send { width: 48px; height: 48px; }
  .message-input__field { padding: 12px 16px; min-height: 44px; font-size: 1rem; }
  .sidebar__bottom { height: 60px; }
  .sidebar__bottom-btn { padding: 5px 0; gap: 2px; }
  .sidebar__bottom-btn svg { width: 24px; height: 24px; }
  .sidebar__bottom-btn span { font-size: 0.6875rem; }
}

/* ===========================================================
   14. RESPONSIVE — MOBILE (≤768px)
   =========================================================== */
@media (max-width: 768px) {
  :root { --nav-h: 52px; }

  .app-screen { position: relative; overflow: hidden; }

  /* Sidebar — slides from left */
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 35;
    width: 100vw; max-width: 100vw; min-width: 0;
    height: 100vh; height: 100dvh;
    border-right: none; background: var(--surface);
    box-shadow: none;
    transform: translateX(0);
    will-change: auto;
    pointer-events: auto;
  }
  .sidebar::before { display: none; }

  .sidebar__header {
    padding: env(safe-area-inset-top, 10px) 16px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: 90px;
  }
  .sidebar__brand-logo { width: 40px; height: 40px; }
  .sidebar__brand-logo img { object-fit: contain; }
  .sidebar__actions { gap: 0px; }
  .sidebar__actions .icon-btn { width: 32px; height: 32px; }
  .sidebar__search { padding: 12px 16px 14px; }
  .sidebar__search .search-box__input { padding: 14px 14px 14px 40px; font-size: 1rem; border-radius: var(--radius-lg); }
  .sidebar__search .search-box__icon { left: 14px; width: 18px; height: 18px; }
  .sidebar__tabs { padding: 6px 16px 14px; gap: 8px; }
  .sidebar__tab { padding: 10px 20px; font-size: 0.9375rem; border-radius: var(--radius-full); font-weight: 500; background: var(--bg-elevated); border: 1px solid var(--border); }
  .sidebar__tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
  .sidebar__list { padding: 0 4px 70px 4px; flex: 1; background: var(--surface); }
  .sidebar__profile { display: none; }
  .sidebar__bottom {
    display: flex; align-items: stretch; justify-content: space-around;
    background: var(--surface);
    width: 100%; height: 64px;
    position: fixed; bottom: 0; left: 0;
    padding: 3px 0 calc(3px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    border-right: none;
    border-radius: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 36;
    gap: 0;
  }
  .sidebar__bottom-btn {
    font-size: 0.75rem; font-weight: 500;
    padding: 7px 0; gap: 3px; flex: 1;
    width: auto; min-height: 56px;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-out);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
  }
  .sidebar__bottom-btn:active { transform: scale(0.92); background: var(--bg-elevated); }
  .sidebar__bottom-btn span { display: block; font-weight: 500; letter-spacing: 0.2px; pointer-events: none; }
  .sidebar__bottom-btn svg { width: 26px; height: 26px; margin-bottom: 3px; pointer-events: none; }
  .sidebar__bottom-btn.is-active { color: var(--primary); background: var(--primary-alpha); border-radius: var(--radius-sm); margin: 0 4px; width: auto; }
  .sidebar__content { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--surface); }

  /* Chat Area — slides from right */
  .chat-area {
    position: fixed; inset: 0; z-index: 50;
    background: var(--bg);
    transform: translateX(0);
    transition: transform 0.3s var(--ease-out-expo), opacity 0.3s ease;
    will-change: transform;
  }
  .chat-area.is-hidden { display: none; }
  .chat-area.is-slide-out {
    transform: translateX(100%);
    pointer-events: none;
  }

  .chat-view__header {
    padding: 12px 14px;
    min-height: 64px;
    padding-top: env(safe-area-inset-top, 12px);
    gap: 14px;
  }
  .chat-view__header .chat-view__avatar { width: 44px; height: 44px; font-size: 1rem; }
  .chat-view__header .chat-view__name { font-size: 1.0625rem; font-weight: 600; }
  .chat-view__header .chat-view__status { font-size: 0.8125rem; }

  .chat-area.is-slide-out .chat-empty { display: none; }
  .chat-view.is-hidden { display: none; }
  .chat-view { display: flex; }

  /* Back / hamburger */
  .sidebar-toggle { display: none !important; }
  .sidebar-back { display: flex !important; }
  #empty-sidebar-back { display: flex !important; }

  /* Messages */
  .chat-view__messages { padding: 12px 12px 16px; gap: 4px; }
  .message {
    max-width: 88%;
    padding: 1px 4px;
    animation: messageInMobile 0.3s var(--ease-out-expo);
  }
  .message:nth-child(2) { animation-delay: 0.03s; }
  .message:nth-child(3) { animation-delay: 0.06s; }
  .message__bubble { font-size: 0.9375rem; padding: 10px 14px; line-height: 1.45; }

  /* Input */
  .chat-view__input {
    padding: 14px 16px calc(env(safe-area-inset-bottom, 14px) + var(--kb, 0px));
    position: sticky; bottom: 0; z-index: 5;
    background: var(--surface-glass-strong);
    backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
    border-top: 1px solid var(--border);
  }
  .message-input { gap: 8px; }
  .message-input__field { padding: 10px 14px; font-size: 1rem; min-height: 42px; max-height: 120px; overflow: hidden; touch-action: manipulation; border-radius: var(--radius-xl); width: 100%; flex: 1; }
  .btn--send { width: 44px; height: 44px; box-shadow: 0 2px 8px rgba(0,102,255,0.3); }
  .attach-plus-btn { width: 42px; height: 42px; }
  .emoji-inline-btn { width: 38px; height: 38px; }

  /* Auth */
  .auth__container { padding: 20px 16px; }
  .auth__title { font-size: 1.65rem; }
  .auth__subtitle { font-size: 0.875rem; }
  .auth__logo-frame { width: 96px; height: 96px; }
  .auth__header { margin-bottom: 24px; }
  .auth__form { gap: 14px; }

  /* Modal — settings & contacts show on top of main menu */
  .modal-overlay {
    padding-top: 0; align-items: flex-end;
    background: rgba(0,0,0,0.15);
  }
  #settings-modal, #user-list-modal, #new-chat-modal, #profile-modal, #edit-profile-modal {
    align-items: stretch;
    background: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 0;
  }
  #settings-modal .modal, #user-list-modal .modal, #new-chat-modal .modal, #profile-modal .modal, #edit-profile-modal .modal {
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
    animation: fadeInScale 0.2s var(--ease-out);
    background: var(--surface);
  }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh; max-width: 100%;
    animation: slideUpSheet 0.4s var(--ease-out);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  }
  .modal:not(.modal--settings):not(.modal--admin) {
    margin-top: 40px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal__header { padding: 16px 16px; min-height: 52px; }
  .modal__body { padding: 4px 0; }
  .modal__list { padding: 0 4px; }
  .modal__footer { padding: 10px 16px; }
  .settings-item { padding: 12px 16px; }
  .settings-item__left { font-size: 0.875rem; }

  /* Chat items +0.3x bigger on mobile */
  .chat-item { padding: 18px 16px; gap: 16px; }
  .chat-item:active {
    background: var(--bg-elevated);
    transform: scale(0.98);
    transition: transform 0.15s, background 0.15s;
  }
  .chat-item__avatar { width: 65px; height: 65px; font-size: 1.3rem; }
  .chat-item__name { font-size: 1.22rem; font-weight: 600; word-break: break-word; }
  .chat-item__preview { font-size: 1.06rem; word-break: break-word; }
  .chat-item__time { font-size: 0.89rem; }

  /* Search */
  .search-box__input { padding: 14px 16px 14px 42px; font-size: 1rem; border-radius: var(--radius-md); }
  .search-box__icon { left: 12px; width: 18px; height: 18px; }

  /* Empty state */
  .chat-empty__logo { width: 96px; height: 96px; }
  .chat-empty__title { font-size: 1.1rem; }
  .chat-empty__text { font-size: 0.8125rem; }

  /* Toggle */
  .toggle-switch { width: 44px; height: 24px; }
  .toggle-switch__knob { width: 20px; height: 20px; }
  .toggle-switch.is-on .toggle-switch__knob { transform: translateX(20px); }

  /* News on mobile */
  .news-view {
    z-index: 55; border-left: none;
  }
  .news-view__header {
    padding: 6px 10px; min-height: 48px;
    padding-top: env(safe-area-inset-top, 6px);
  }
  .news-view__tabs { padding: 6px 10px; gap: 4px; }
  .news-tab { padding: 5px 12px; font-size: 0.75rem; }
  .news-view__content { padding: 6px 10px 80px; }
  .news-post { border-radius: var(--radius-md); margin-bottom: 10px; }
  .news-post__header { padding: 10px 10px 0; }
  .news-post__body { padding: 8px 10px 4px; }
  .news-post__text { font-size: 0.875rem; }
  .news-post__actions { padding: 4px 6px 6px; gap: 0; }
  .news-post__action { padding: 5px 8px; font-size: 0.6875rem; }
  .news-comments { padding: 8px 10px 10px; }
  .news-comments__input input { padding: 8px 12px; font-size: 0.75rem; }
  .news-profile { padding: 14px 12px; }
  .news-profile__avatar { width: 64px; height: 64px; font-size: 1.25rem; }
  .news-profile__name { font-size: 1.0625rem; }
  .news-profile__stats { gap: 20px; }
  .news-profile__stat-value { font-size: 1.0625rem; }
  .news-profile__links { gap: 6px; }
  .news-profile__link { font-size: 0.6875rem; padding: 4px 10px; }
  .news-image-modal img { max-width: 92vw; }
  .admin-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .admin-item__actions { width: 100%; justify-content: flex-end; }
  .modal--post { max-width: 100%; }
  .modal--admin { max-width: 100%; max-height: 90vh; }
}

/* ===========================================================
   15. RESPONSIVE — SMALL (≤480px)
   =========================================================== */
@media (max-width: 480px) {
  .auth__container { max-width: 100%; padding: 16px 12px; }
  .auth__title { font-size: 1.35rem; letter-spacing: -0.3px; }
  .auth__subtitle { font-size: 0.8125rem; }
  .auth__tabs { gap: 2px; border-radius: var(--radius-sm); }
  .auth__tab { padding: 10px 12px; font-size: 0.8125rem; }
  .auth__logo-frame { width: 88px; height: 88px; margin-bottom: 12px; }
  .auth__header { margin-bottom: 20px; }
  .auth__submit { padding: 14px 20px; font-size: 0.9375rem; }
  .input-row { flex-direction: column; gap: 0; }

  .chat-view__messages { padding: 10px 10px 14px; gap: 3px; }
  .chat-view__header {
    padding: 10px 10px;
    padding-top: env(safe-area-inset-top, 10px);
    min-height: 56px;
  }
  .chat-view__header .chat-view__avatar { width: 40px; height: 40px; font-size: 0.9375rem; }
  .chat-view__header .chat-view__name { font-size: 0.9375rem; }
  .chat-view__header .chat-view__status { font-size: 0.625rem; }
  .chat-view__input { padding: 8px 10px calc(env(safe-area-inset-bottom, 8px) + var(--kb, 0px)); }
  .message-input__field { padding: 8px 12px; font-size: 0.875rem; min-height: 36px; max-height: 100px; overflow: hidden; touch-action: manipulation; }
  .message { max-width: 90%; }
  .message__bubble { font-size: 0.875rem; padding: 10px 12px; }
  .message__time { font-size: 0.625rem; }
  .btn--send { width: 40px; height: 40px; }
  .attach-plus-btn { width: 38px; height: 38px; }
  .emoji-inline-btn { width: 34px; height: 34px; }

  .modal-overlay { padding-top: 0; align-items: flex-end; background: rgba(0,0,0,0.15); }
  #settings-modal, #user-list-modal, #new-chat-modal, #profile-modal, #edit-profile-modal { align-items: stretch; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; }
  #settings-modal .modal, #user-list-modal .modal, #new-chat-modal .modal, #profile-modal .modal, #edit-profile-modal .modal { max-height: 100vh; border-radius: 0; margin: 0; background: var(--surface); }
  .modal { max-height: 85vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal__header { padding: 14px 16px; }
  .modal__body { padding: 4px 0; }
  .modal__title { font-size: 1rem; }
  .settings-item { padding: 10px 16px; }
  .settings-item__left { font-size: 0.8125rem; }
  .settings-version { font-size: 0.6875rem; }

  /* Bigger touch targets for modal buttons */
  .btn--text { min-height: 44px; padding: 10px 16px; touch-action: manipulation; }
  .settings-item { min-height: 48px; touch-action: manipulation; }
  .context-menu__item { min-height: 44px; padding: 10px 16px; }

  .chat-item { padding: 18px 14px; gap: 14px; }
  .chat-item__avatar { width: 62px; height: 62px; font-size: 1.2rem; }
  .chat-item__name { font-size: 1.15rem; word-break: break-word; }
  .chat-item__preview { font-size: 1rem; word-break: break-word; }

  .sidebar { width: 100vw; max-width: 100vw; }
  .sidebar__search { padding: 8px 12px 8px; }
  .sidebar__tabs { padding: 2px 12px 8px; }
  .sidebar__header { padding: 10px 12px 6px; padding-top: env(safe-area-inset-top, 10px); }
  .sidebar__list { padding: 0 2px; }
  .sidebar__tab { font-size: 0.8125rem; padding: 8px 14px; }
  .sidebar__bottom { height: 64px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 3px); }
  .sidebar__bottom-btn { font-size: 0.75rem; padding: 7px 0; min-height: 56px; }
  .sidebar__bottom-btn svg { width: 26px; height: 26px; }

  .search-box__input { padding: 10px 14px 10px 36px; font-size: 0.875rem; }
  .search-box__icon { left: 10px; }

  .chat-empty__logo { width: 80px; height: 80px; }
  .chat-empty__title { font-size: 1rem; }
  .chat-empty__text { font-size: 0.8125rem; }

  /* News on small mobile */
  .news-view__header { padding: 4px 8px; min-height: 44px; }
  .news-view__tabs { padding: 4px 8px; gap: 3px; }
  .news-tab { padding: 4px 10px; font-size: 0.6875rem; }
  .news-view__content { padding: 4px 8px 70px; }
  .news-post__header { padding: 8px 8px 0; }
  .news-post__body { padding: 6px 8px 4px; }
  .news-post__text { font-size: 0.8125rem; }
  .news-post__action { padding: 4px 6px; font-size: 0.625rem; }
  .news-profile__avatar { width: 56px; height: 56px; }
  .news-profile__name { font-size: 1rem; }
  .news-profile__stats { gap: 16px; }
  .news-profile__stat-value { font-size: 0.9375rem; }
}

/* ===========================================================
   16. RESPONSIVE — VERY SMALL (≤360px)
   =========================================================== */
@media (max-width: 360px) {
  .sidebar { width: 100vw; min-width: 0; }
  .auth__container { padding: 12px 8px; }
  .auth__title { font-size: 1.15rem; }
  .auth__subtitle { font-size: 0.75rem; }
  .auth__tab { font-size: 0.75rem; padding: 8px 10px; }
  .auth__logo-frame { width: 72px; height: 72px; margin-bottom: 8px; }
  .auth__header { margin-bottom: 14px; }
  .auth__submit { padding: 10px 14px; font-size: 0.8125rem; }
  .input { font-size: 0.8125rem; padding: 10px 12px; }
  .auth__form { gap: 12px; }
  .message { max-width: 92%; }
  .chat-view__messages { padding: 8px 8px 12px; gap: 3px; }
  .message__bubble { font-size: 0.8125rem; padding: 8px 10px; }
  .modal { max-height: 90vh; }
  .modal__title { font-size: 0.9375rem; }
  .settings-item { padding: 8px 12px; }
  .settings-item__left { font-size: 0.8125rem; }
  .search-box__icon { left: 8px; }
  .search-box__input { padding: 8px 10px 8px 30px; font-size: 0.75rem; }
  .chat-item { padding: 16px 12px; gap: 12px; }
  .chat-item__avatar { width: 58px; height: 58px; font-size: 1.1rem; }
  .chat-item__name { font-size: 1.05rem; }
  .btn--send { width: 40px; height: 40px; }
  .sidebar__bottom { width: 100%; }

  /* News on very small */
  .news-tab { padding: 3px 8px; font-size: 0.625rem; }
  .news-view__content { padding: 4px 6px 60px; }
  .news-post { margin-bottom: 8px; }
  .news-post__header { gap: 6px; }
  .news-post__avatar { width: 28px; height: 28px; font-size: 0.625rem; }
  .news-post__name { font-size: 0.75rem; }
  .news-post__username { font-size: 0.625rem; }
  .news-post__text { font-size: 0.8125rem; }
  .news-post__action svg { width: 12px; height: 12px; }
  .news-profile { padding: 10px 8px; }
  .news-profile__avatar { width: 48px; height: 48px; }
  .news-profile__name { font-size: 0.875rem; }
  .news-profile__stats { gap: 12px; }
}

/* Language Selector — auth screen */
.auth__lang-picker {
  display: flex; justify-content: center; gap: 6px; margin-top: 14px;
  animation: authFadeSlideIn 0.5s var(--ease-out) 0.2s both;
}
.auth__lang-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  position: relative; overflow: hidden;
}
.auth__lang-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.25s;
  border-radius: inherit;
}
.auth__lang-flag { font-size: 1.1rem; line-height: 1; position: relative; z-index: 1; transition: transform 0.25s var(--ease-spring); }
.auth__lang-label { position: relative; z-index: 1; letter-spacing: 0.5px; text-transform: uppercase; }
.auth__lang-btn:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.auth__lang-btn:hover .auth__lang-flag { transform: scale(1.15); }
.auth__lang-btn.is-active {
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px var(--primary-alpha), 0 0 0 2px var(--primary-alpha);
  transform: translateY(-1px);
}
.auth__lang-btn.is-active::before { opacity: 1; }
.auth__lang-btn.is-active .auth__lang-flag { transform: scale(1.1); }
.auth__lang-btn:active { transform: translateY(0) scale(0.97); }

/* ===========================================================
   17. RESPONSIVE — LANDSCAPE SHORT
   =========================================================== */
@media (orientation: landscape) and (max-height: 500px) {
  .auth__container { padding: 8px; }
  .auth__title { font-size: 1.1rem; }
  .auth__logo-frame { width: 76px; height: 76px; }
  .auth__logo-img { width: 100%; height: 100%; object-fit: contain; }
  .auth__submit { padding: 10px 16px; font-size: 0.8125rem; }
  .modal { max-height: 90vh; }
  .settings-item { padding: 6px 12px; }
  .chat-view__messages { padding: 8px 8px 12px; }
  .sidebar { width: 75vw; max-width: 300px; }
}

/* ===========================================================
   ===========================================================
   NEWS FEED (Social) — Premium Redesign
   ===========================================================
   =========================================================== */

/* News View */
.news-view {
  position: fixed; inset: 0; z-index: 55;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: fadeInScale 0.35s var(--ease-out-expo);
}
@keyframes newsFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.chat-area.is-hidden { display: none; }
.news-view.is-hidden { display: none; }

/* On desktop, news sits beside sidebar */
@media (min-width: 769px) {
  .news-view {
    position: fixed; left: var(--sidebar-w, 340px); right: 0; top: 0; bottom: 0;
    z-index: 20; border-left: 1px solid var(--border);
  }
}

/* News Header */
.news-view__header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; min-height: 52px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0; z-index: 5;
  padding-top: env(safe-area-inset-top, 8px);
}
.news-view__brand { flex: 1; min-width: 0; }
.news-view__brand-text {
  font-weight: 800; font-size: 1.125rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}
.news-view__actions { display: flex; gap: 2px; flex-shrink: 0; }
.news-view__actions #news-create-btn { color: var(--primary, #4A90D9); background: rgba(74, 144, 217, 0.1); }

/* News Tabs */
.news-view__tabs {
  display: flex; gap: 6px; padding: 8px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.news-view__tabs::-webkit-scrollbar { display: none; }
.news-tab {
  padding: 6px 16px; white-space: nowrap; font-size: 0.8125rem;
  border: none; background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer; border-radius: var(--radius-full);
  transition: all 0.25s var(--ease-out);
  font-weight: 500; flex-shrink: 0;
}
.news-tab:hover { background: var(--surface-secondary); color: var(--text); }
.news-tab.is-active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,102,255,0.3);
}

/* News Content */
.news-view__content {
  flex: 1; overflow-y: auto; padding: 8px 12px 80px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}

/* Loading */
.news-loading { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.skeleton-post {
  height: 180px; background: var(--surface-secondary);
  border-radius: var(--radius-lg);
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Empty State */
.news-empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-tertiary); font-size: 0.875rem; line-height: 1.6;
  animation: fadeInUp 0.3s var(--ease-out);
}
.news-error-state { color: var(--error); }

/* News Post Card */
.news-post {
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 14px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s var(--ease-out), border-color 0.3s ease;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: both;
}
.news-post:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.news-post:active { transform: translateY(0) scale(0.99); box-shadow: var(--shadow-sm); }

/* Stagger card animations */
.news-post:nth-child(1) { animation-delay: 0s; }
.news-post:nth-child(2) { animation-delay: 0.05s; }
.news-post:nth-child(3) { animation-delay: 0.1s; }
.news-post:nth-child(4) { animation-delay: 0.15s; }
.news-post:nth-child(5) { animation-delay: 0.2s; }
.news-post:nth-child(n+6) { animation-delay: 0.25s; }

.news-post__header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 0; cursor: pointer;
}
.news-post__avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.8125rem; color: #fff;
  background: var(--gradient-logo);
  transition: transform 0.2s ease;
}
.news-post__avatar:hover { transform: scale(1.1); }
.news-post__avatar img { width: 100%; height: 100%; object-fit: cover; }
.news-post__author { flex: 1; min-width: 0; }
.news-post__name {
  font-size: 0.8125rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 4px;
}
.news-post__username { font-size: 0.6875rem; color: var(--text-tertiary); margin-top: 1px; }
.news-post__badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.news-post__badge svg { width: 14px; height: 14px; }
.news-post__time {
  font-size: 0.6875rem; color: var(--text-tertiary);
  white-space: nowrap; flex-shrink: 0;
}

.news-post__body { padding: 10px 14px 4px; }
.news-post__text {
  font-size: 0.9375rem; line-height: 1.6; color: var(--text);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word;
}

/* Post Images */
.news-post__images {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 10px 0 0; overflow: hidden;
  border-radius: var(--radius-sm);
}
.news-post__images img {
  width: 100%; object-fit: contain;
  cursor: pointer; border-radius: 4px;
  transition: transform 0.3s ease, opacity 0.2s;
}
.news-post__images img:hover { transform: scale(1.01); opacity: 0.95; }
.news-post__images.grid-2 img { width: calc(50% - 1px); }
.news-post__images.grid-3 img:first-child { width: 100%; }
.news-post__images.grid-3 img:nth-child(n+2) { width: calc(50% - 1px); }
.news-post__images.grid-4 img { width: calc(50% - 1px); }

/* Post Actions */
.news-post__actions {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 8px 8px; justify-content: space-around;
}
.news-post__action {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border: none; background: transparent;
  color: var(--text-tertiary); font-size: 0.75rem; cursor: pointer;
  border-radius: var(--radius-full);
  transition: all 0.2s var(--ease-out);
  font-weight: 500;
}
.news-post__action:hover { background: var(--surface-secondary); color: var(--text); }
.news-post__action.is-active-like { color: var(--primary); background: var(--primary-alpha); }
.news-post__action.is-active-dislike { color: var(--error); background: rgba(255,59,48,0.08); }
.news-post__action.is-active-save { color: var(--accent); background: var(--accent-alpha); }
.news-post__action svg { flex-shrink: 0; }

/* Comments */
.news-comments {
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.news-comments__input {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.news-comments__input input {
  flex: 1; padding: 10px 14px; border: none;
  border-radius: var(--radius-full);
  background: var(--surface-secondary); color: var(--text);
  font-size: 0.8125rem; outline: none;
  transition: box-shadow 0.2s ease;
}
.news-comments__input input:focus { box-shadow: 0 0 0 2px var(--primary-alpha-strong); }
.news-comment {
  display: flex; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.2s var(--ease-out);
}
.news-comment:last-child { border-bottom: none; }
.news-comment__avatar {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.625rem; color: #fff;
  background: var(--gradient-logo);
}
.news-comment__avatar img { width: 100%; height: 100%; object-fit: cover; }
.news-comment__body { flex: 1; min-width: 0; }
.news-comment__author { font-size: 0.75rem; font-weight: 600; color: var(--text); }
.news-comment__text { font-size: 0.8125rem; color: var(--text-secondary); word-break: break-word; overflow-wrap: break-word; }
.news-comment__time { font-size: 0.625rem; color: var(--text-tertiary); margin-top: 3px; }
.news-comment__delete {
  background: none; border: none; color: var(--error);
  cursor: pointer; font-size: 0.625rem; padding: 0 4px;
  opacity: 0.5; transition: opacity 0.2s;
}
.news-comment__delete:hover { opacity: 1; }
.news-comments__empty { text-align: center; padding: 16px; color: var(--text-tertiary); font-size: 0.8125rem; }

/* News Profile */
.news-profile {
  padding: 20px 16px; text-align: center;
  animation: fadeInUp 0.3s var(--ease-out);
}
.news-profile__avatar {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden;
  margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; font-weight: 700; color: #fff;
  background: var(--gradient-logo);
  box-shadow: 0 4px 20px rgba(108,99,255,0.15);
  transition: transform 0.2s ease;
}
.news-profile__avatar:hover { transform: scale(1.05); }
.news-profile__avatar img { width: 100%; height: 100%; object-fit: cover; }
.news-profile__name { font-size: 1.25rem; font-weight: 700; }
.news-profile__username { font-size: 0.8125rem; color: var(--text-tertiary); margin-bottom: 10px; }
.news-profile__bio {
  font-size: 0.875rem; color: var(--text-secondary);
  max-width: 400px; margin: 0 auto 14px; line-height: 1.5;
}
.news-profile__stats {
  display: flex; justify-content: center; gap: 32px; margin-bottom: 14px;
}
.news-profile__stat { text-align: center; }
.news-profile__stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.news-profile__stat-label {
  font-size: 0.6875rem; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.news-profile__actions { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.news-profile__links {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px;
}
.news-profile__link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; background: var(--surface-secondary);
  border-radius: var(--radius-full); font-size: 0.75rem; color: var(--text-secondary);
  text-decoration: none; transition: background 0.2s;
}
.news-profile__link:hover { background: var(--border); }
.news-profile__region { font-size: 0.75rem; color: var(--text-tertiary); margin-bottom: 8px; }
.news-profile__section-title {
  font-size: 0.875rem; font-weight: 600; padding: 14px 0 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}

/* Image Viewer Modal */
.news-image-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: fadeIn 0.25s ease;
}
.news-image-modal img {
  max-width: 95vw; max-height: 90vh; object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.news-image-modal__close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s;
}
.news-image-modal__close:hover { background: rgba(255,255,255,0.25); }

/* Toast in news */
.news-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-elevated);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
  pointer-events: none;
  border: 1px solid var(--border);
}
.news-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Onboarding modal select */
#onboarding-region, #onboarding-city, #onboarding-lang {
  padding: 10px 12px; font-size: 0.875rem;
}

/* Admin Panel */
.admin-tabs {
  display: flex; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.admin-tabs .btn--tab { font-size: 0.75rem; padding: 6px 12px; }
.admin-section { padding: 8px 12px; }
.admin-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.admin-item:last-child { border-bottom: none; }
.admin-item__info { flex: 1; min-width: 0; }
.admin-item__name { font-size: 0.8125rem; font-weight: 600; }
.admin-item__detail { font-size: 0.6875rem; color: var(--text-tertiary); }
.admin-item__actions { display: flex; gap: 4px; flex-shrink: 0; }
.admin-item__actions .btn--text { font-size: 0.6875rem; padding: 4px 8px; }

.modal--post { max-width: 560px; }
.modal--admin { max-width: 640px; max-height: 80vh; }

/* ===== PINNED MESSAGE BAR ===== */
.pinned-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: var(--surface-glass-strong);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; cursor: pointer;
  transition: background 0.2s;
  animation: slideDownFull 0.25s cubic-bezier(0.16,1,0.3,1);
}
.pinned-bar.is-hidden { display: none; }
.pinned-bar:hover { background: var(--bg-elevated); }
.pinned-bar__icon { font-size: 0.875rem; flex-shrink: 0; }
.pinned-bar__content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pinned-bar__label { font-size: 0.625rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.pinned-bar__text { font-size: 0.75rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-bar__count { font-size: 0.625rem; font-weight: 600; color: var(--primary); background: var(--primary-alpha); padding: 1px 6px; border-radius: var(--radius-full); margin-left: 6px; flex-shrink: 0; }
.pinned-bar__close {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 50%;
  cursor: pointer; color: var(--text-tertiary);
  transition: background 0.15s;
}
.pinned-bar__close:hover { background: var(--bg-elevated); }
@keyframes slideDownFull {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
  position: fixed; left: 0; right: 0;
  max-height: 280px; background: var(--surface-glass-strong);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden; z-index: 9999;
  display: flex; flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.25);
}
.emoji-picker.is-hidden { display: none; }
.emoji-picker__tabs {
  display: flex; gap: 2px; padding: 6px 8px;
  overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.emoji-picker__tab {
  flex-shrink: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  cursor: pointer; font-size: 1.125rem; line-height: 1;
  transition: background 0.15s;
}
.emoji-picker__tab:hover { background: var(--bg-elevated); }
.emoji-picker__tab.is-active { background: var(--primary-alpha); }
.emoji-picker__grid {
  flex: 1; overflow-y: auto; padding: 6px 8px;
  display: flex; flex-wrap: wrap; gap: 2px;
  align-content: flex-start;
}
.emoji-picker__item {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  cursor: pointer; font-size: 1.375rem; line-height: 1;
  transition: background 0.12s, transform 0.12s;
}
.emoji-picker__item:hover { background: var(--bg-elevated); transform: scale(1.15); }
.emoji-picker__item:active { transform: scale(0.9); }
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== MESSAGE REACTIONS ===== */
.message__reactions {
  display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px;
}
.message__reaction {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 6px; border-radius: 12px;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  font-size: 0.75rem; cursor: pointer;
  transition: all 0.15s; user-select: none;
}
.message__reaction:hover { background: var(--bg-elevated); transform: scale(1.05); }
.message__reaction.is-mine { background: var(--primary-alpha); border-color: var(--primary-alpha-strong); }
.message__reaction-count { font-size: 0.625rem; color: var(--text-tertiary); font-weight: 600; }
.message__reaction.is-mine .message__reaction-count { color: var(--primary); }

/* ===== MESSAGE ACTIONS MENU ===== */
.msg-actions-menu {
  position: fixed; z-index: 99999;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 4px;
  box-shadow: var(--shadow-xl);
  min-width: 150px;
  animation: modalIn 0.2s cubic-bezier(0.16,1,0.3,1);
}
.msg-actions-menu.is-hidden { display: none; }
/* ===== CALL OVERLAY ===== */
.call-overlay {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
}
.call-overlay.is-hidden { display: none; }
.call-overlay__bg {
  position: absolute; inset: 0; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
}
.call-overlay__content {
  position: relative; z-index: 1; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 420px; padding: 32px 24px;
}
.call-overlay__video {
  position: absolute; inset: 0; z-index: -1;
  display: none; background: #000;
}
.call-overlay__video:has(video:not([style*="display:none"])) { display: block; }
.call-overlay__video video#remote-video {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 0;
}
.call-overlay__video video#local-video {
  position: absolute; bottom: 100px; right: 16px;
  width: 100px; height: 140px;
  object-fit: cover; border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.3); background: #000; z-index: 2;
}
.call-overlay.is-video .call-overlay__content {
  position: absolute; bottom: 0; left: 0; right: 0;
  max-width: none; padding: 20px 24px 32px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  align-items: center;
}
.call-overlay.is-video .call-overlay__header { margin-bottom: 0; }
.call-overlay.is-video .call-overlay__avatar {
  width: 56px; height: 56px; font-size: 1.4rem;
}
.call-overlay.is-video .call-overlay__name { font-size: 1.125rem; }
.call-overlay.is-video .call-overlay__actions { margin-top: 8px; }
.call-overlay__header { margin-bottom: 40px; }
.call-overlay__avatar {
  width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--gradient-logo); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; font-weight: 600; overflow: hidden;
}
.call-overlay__avatar img { width: 100%; height: 100%; object-fit: cover; }
.call-overlay__name { font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.call-overlay__status { font-size: 0.8125rem; color: rgba(255,255,255,0.6); }
.call-overlay__timer { font-size: 1.125rem; color: rgba(255,255,255,0.8); font-weight: 500; }
.call-overlay__actions {
  display: flex; align-items: center; gap: 24px;
}
.call-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; color: #fff;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.call-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.call-btn:active { transform: scale(0.95); }
.call-btn--end { background: #FF3B30; width: 64px; height: 64px; }
.call-btn--end:hover { background: #E03026; }
.call-btn--accept { background: #34C759; width: 64px; height: 64px; }
.call-btn--accept:hover { background: #28B54D; }
.call-btn.is-off { background: rgba(255,59,48,0.3); color: #FF3B30; }

.msg-action-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  border: none; background: transparent; border-radius: 6px;
  cursor: pointer; font-size: 0.8125rem; color: var(--text);
  white-space: nowrap; transition: background 0.12s;
}
.msg-action-btn:hover { background: var(--bg-elevated); }
.msg-action-btn svg { flex-shrink: 0; color: var(--text-secondary); }

/* ===== CHANNELS ===== */
.subscribe-btn {
  padding: 2px 10px; border-radius: 12px; border: 1px solid var(--primary);
  background: transparent; color: var(--primary); font-size: 0.7rem;
  cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.subscribe-btn:hover { background: var(--primary-alpha); }
.subscribe-btn.is-subscribed { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-item[data-type="channel"] .chat-item__avatar {
  font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
}

/* File preview card download button */
.file-preview-download {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px;
  border-radius: var(--radius-sm); background: var(--primary-alpha);
  color: var(--primary); font-size: 0.75rem; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.file-preview-download:hover { background: var(--primary-alpha-strong); color: var(--primary); }

/* ===== SCROLL-TO-BOTTOM BUTTON ===== */
.scroll-bottom-btn {
  position: absolute; bottom: 80px; right: 16px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: opacity 0.2s, transform 0.2s var(--ease-spring);
  animation: fadeInScale 0.2s var(--ease-out);
}
.scroll-bottom-btn:hover { background: var(--bg-elevated); color: var(--text); transform: scale(1.1); }
.scroll-bottom-btn:active { transform: scale(0.9); }
.scroll-bottom-btn.is-hidden { display: none; }

/* ===== ATTACH POPUP MENU ===== */
.attach-popup {
  position: fixed; bottom: 80px; left: 16px; z-index: 200;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  animation: menuIn 0.2s var(--ease-out-expo);
  min-width: 170px;
}
.attach-popup.is-hidden { display: none; }
.attach-popup__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: none; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text); font-size: 0.875rem; font-weight: 500;
  transition: background 0.15s;
  font-family: inherit; text-align: left; white-space: nowrap;
}
.attach-popup__item:hover { background: var(--bg-elevated); }
.attach-popup__item:active { background: var(--border); transform: scale(0.98); }
.attach-popup__icon { font-size: 1.25rem; flex-shrink: 0; width: 28px; text-align: center; display: flex; align-items: center; justify-content: center; }
.attach-popup__icon svg { width: 20px; height: 20px; }
.attach-popup__label { flex: 1; }
.attach-plus-btn {
  flex-shrink: 0; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none;
  background: var(--primary-alpha); color: var(--primary);
  cursor: pointer; touch-action: manipulation;
  transition: all 0.2s var(--ease-spring);
}
.attach-plus-btn:hover { background: var(--primary-alpha-strong); transform: scale(1.08); }
.attach-plus-btn:active { transform: scale(0.92); }
.emoji-inline-btn {
  flex-shrink: 0; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none;
  background: transparent; cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s;
}
.emoji-inline-btn:hover { background: var(--bg-elevated); }
.emoji-inline-btn:active { transform: scale(0.9); }
@media (max-width: 768px) {
  .attach-popup { bottom: 84px; left: 12px; }
  .attach-popup__item { padding: 12px 16px; font-size: 0.9375rem; }
  .attach-popup__icon { font-size: 1.375rem; width: 32px; }
  .attach-plus-btn { width: 44px; height: 44px; }
  .emoji-inline-btn { width: 40px; height: 40px; }
}
@media (max-width: 480px) {
  .attach-popup { bottom: 80px; left: 8px; min-width: 160px; }
  .attach-popup__item { padding: 12px 14px; font-size: 0.875rem; }
}

/* ===========================================================
   20. PHOTO LIGHTBOX
   =========================================================== */
.lightbox {
  position: fixed !important; inset: 0; z-index: 99999 !important;
  background: rgba(0,0,0,0.95);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: fadeIn 0.2s var(--ease-out);
  isolation: isolate;
}
.lightbox.is-hidden { display: none; }
.lightbox__close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lightbox__close:hover { background: rgba(255,255,255,0.3); }
.lightbox__img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 60px 16px 80px; width: 100%; overflow: hidden;
}
.lightbox__img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 4px;
  animation: fadeInScale 0.25s var(--ease-out);
}
.lightbox__actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
}
.lightbox__btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background 0.2s;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.lightbox__btn:hover { background: rgba(255,255,255,0.25); }

/* ===== INVITATIONS ===== */
.invitation-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  gap: 12px; transition: background 0.15s;
}
.invitation-item:last-child { border-bottom: none; }
.invitation-item:hover { background: var(--surface-hover); }
.invitation-badge { display: none; }
.invitation-badge:not(.is-hidden) { display: flex; }
#invitations-btn.has-invitations { color: var(--primary); }
#invitations-btn { position: relative; }

/* ===========================================================
   21. MOBILE SEARCH & HEADER ADJUSTMENTS
   =========================================================== */
@media (max-width: 768px) {
  .sidebar__header { min-height: 76px; padding: env(safe-area-inset-top, 8px) 14px 10px; }
  .sidebar__brand-logo { width: 40px; height: 40px; }
  .sidebar__search .search-box__input { border-radius: var(--radius-full); }
}
@media (max-width: 480px) {
  .sidebar__header { min-height: 68px; padding: env(safe-area-inset-top, 6px) 12px 8px; }
  .sidebar__brand-logo { width: 38px; height: 38px; }
  .sidebar__search .search-box__input { border-radius: var(--radius-full); padding: 12px 14px 12px 40px; }
}
