/* ═══════════════════════════════════════════════════
   MESSENGER — DESIGN SYSTEM
   Источник токенов: design/web-shell.jsx (WEB_DARK + tokens.jsx).
═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand / accent (фиолетовый по умолчанию) ── */
  --accent:        #7C3AED;
  --accent-light:  #9F67FF;
  --accent-glow:   rgba(124,58,237,.35);
  --accent-soft:   rgba(124,58,237,.15);
  --accent-tick-read: #A78BFA;

  /* Legacy aliases (для уже написанного app.js / styles) */
  --p:       #7C3AED;
  --p2:      #9333EA;
  --pl:      #A78BFA;
  --pd:      #5B21B6;
  --grad:        linear-gradient(135deg, #7C3AED 0%, #9333EA 100%);
  --grad-bubble: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);

  /* ── Sidebar (dark) — WEB_DARK ── */
  --sb-bg:         #1A1626;
  --sb-hov:        rgba(255,255,255,.05);
  --sb-act:        rgba(124,58,237,.18);
  --sb-act-strong: rgba(124,58,237,.28);
  --sb-text:       rgba(255,255,255,.92);
  --sb-muted:      rgba(255,255,255,.5);
  --sb-dim:        rgba(255,255,255,.32);
  --sb-border:     rgba(255,255,255,.06);

  /* ── Chat area (light) ── */
  --chat-bg:    #F5F3FF;
  --chat-bg-deep: #EEE9FA;
  --msg-panel:  #FFFFFF;
  --b-in:       #FFFFFF;
  --b-out-s:    #8B5CF6;
  --b-out-e:    #7C3AED;
  --bubble-in:  #FFFFFF;

  /* ── UI ── */
  --bg:      #F7F5FA;
  --bg2:     #EEEAF6;
  --surface: #FFFFFF;
  --surface-alt: #F1EEF7;
  --surface-hi:  #E8E3F2;
  --border:  rgba(20,15,40,.08);
  --border-str: rgba(20,15,40,.14);
  --text:    #15102B;
  --text-sec:#5B5475;
  --text-mute: #9089A8;
  --muted:   #6B7280;   /* legacy alias */
  --green:   #10B981;
  --online:  #22C55E;
  --red:     #EF4444;
  --orange:  #F59E0B;

  /* ── Sizes / shadows ── */
  --hh:        64px;
  --r:         14px;
  --r-sm:      8px;
  --r-lg:      18px;
  --shadow:    0 4px 24px rgba(124,58,237,.12);
  --shadow-sm: 0 1px 6px rgba(0,0,0,.07);
  --shadow-accent: 0 12px 28px var(--accent-glow);
  --shadow-fab: 0 12px 28px var(--accent-glow);

  /* ── Font ── */
  font-family: 'Onest', 'Inter', 'Inter Tight', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; }

.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════════
   LIGHT THEME (body.theme-light)
   Хранится в localStorage('theme'). Toggle в profile modal.
   Sidebar становится светло-фиолетовым; messages — белые в чате.
═══════════════════════════════════════════════════ */
body.theme-light {
  --bg:         #F7F5FA;
  --bg2:        #EEEAF6;
  --surface:    #FFFFFF;
  --surface-alt:#F1EEF7;
  --surface-hi: #E8E3F2;
  --border:     rgba(20,15,40,.08);
  --border-str: rgba(20,15,40,.14);
  --text:       #15102B;
  --text-sec:   #5B5475;
  --text-mute:  #9089A8;

  /* Sidebar — теперь светло-фиолетовый */
  --sb-bg:         #F0EAFA;
  --sb-hov:        rgba(124,58,237,.06);
  --sb-act:        rgba(124,58,237,.10);
  --sb-act-strong: rgba(124,58,237,.16);
  --sb-text:       #15102B;
  --sb-muted:      rgba(21,16,43,.60);
  --sb-dim:        rgba(21,16,43,.36);
  --sb-border:     rgba(20,15,40,.08);

  /* Chat area — лёгкая лавандовая */
  --chat-bg:      #FAF8FF;
  --chat-bg-deep: #F1EEF9;
  --bubble-in:    #FFFFFF;
}
body.theme-light .auth-form input,
body.theme-light .sidebar-search input {
  color: var(--text);
}
body.theme-light .sidebar-search { background: rgba(20,15,40,.06); }
body.theme-light .input-bar      { background: var(--surface); }
body.theme-light .chat-header    { background: var(--surface); }
body.theme-light .send-btn       { color: var(--text-sec); }

/* Theme toggle button (profile modal) */
.btn-theme-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 9px 16px;
  border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-theme-toggle:hover { background: var(--surface-hi); border-color: var(--accent); }
.btn-theme-toggle .theme-icon-sun  { display: none; }
.btn-theme-toggle .theme-icon-moon { display: inline; }
body.theme-light .btn-theme-toggle .theme-icon-sun  { display: inline; }
body.theme-light .btn-theme-toggle .theme-icon-moon { display: none; }

/* ── Settings master-detail rows (in profile-modal) ── */
.settings-rows { padding: 4px 0; }
.set-group     { background: rgba(255,255,255,.03); border-radius: 14px; margin: 8px 16px 18px; overflow: hidden; }
body.theme-light .set-group { background: var(--surface-alt); }

.set-row {
  display: grid; grid-template-columns: 32px 1fr auto auto;
  align-items: center; gap: 12px;
  width: 100%; padding: 11px 14px;
  background: transparent; border: none; cursor: pointer;
  text-align: left; font-family: inherit;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
  transition: background .12s;
}
.set-row:last-child { border-bottom: none; }
.set-row:hover { background: rgba(124,58,237,.06); }

.set-tile {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
}
.set-title  { font-size: 14.5px; font-weight: 500; color: var(--text); letter-spacing: -.2px; }
.set-detail { font-size: 13px; color: var(--text-sec); }
.set-chev   { font-size: 18px; color: var(--text-mute); margin-left: 4px; }

.set-panel {
  background: rgba(255,255,255,.025);
  padding: 6px 14px 10px;
  border-bottom: 0.5px solid var(--border);
}
body.theme-light .set-panel { background: rgba(20,15,40,.03); }
.set-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; gap: 8px;
  font-size: 13.5px; color: var(--text);
}
.set-line select,
.set-line input[type="checkbox"] {
  font-size: 13px; padding: 4px 8px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.set-line input[type="checkbox"] { width: 38px; height: 22px; appearance: none; -webkit-appearance: none; position: relative; cursor: pointer; transition: background .15s; }
.set-line input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.set-line input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.set-line input[type="checkbox"]:checked::after { transform: translateX(16px); }

/* ─────────────────────────────────────────────────
   AUTH
───────────────────────────────────────────────── */
#auth-screen {
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 60% 10%, #3B1D8A 0%, #1a1626 60%, #0f0d1a 100%);
}
.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(90px); }
.blob1 { width: 500px; height: 500px; background: #7C3AED; opacity: .3; top: -120px; right: -80px; }
.blob2 { width: 360px; height: 360px; background: #9333EA; opacity: .2; bottom: -80px; left: -60px; }

.auth-container {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px; padding: 48px 42px;
  width: min(420px, 96vw);
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.auth-logo { animation: bob 3.5s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

.auth-title { font-size: 30px; font-weight: 700; color: #fff; letter-spacing: -.6px; }
.auth-subtitle { font-size: 14px; color: rgba(255,255,255,.45); margin-top: -10px; }

.auth-tabs {
  display: flex; background: rgba(255,255,255,.07); border-radius: 12px; padding: 4px; width: 100%;
}
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 9px 12px;
  border-radius: 9px; font-size: 14px; font-weight: 500; cursor: pointer;
  color: rgba(255,255,255,.45); transition: all .2s; font-family: inherit;
}
.auth-tab.active { background: rgba(255,255,255,.14); color: #fff; }

.auth-form { display: none; flex-direction: column; gap: 12px; width: 100%; }
.auth-form.active { display: flex; }

.input-group { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.35); pointer-events: none; }
.auth-form input {
  width: 100%; padding: 13px 14px 13px 44px;
  background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 12px; font-size: 15px; color: #fff; outline: none;
  transition: all .2s; font-family: inherit;
}
.auth-form input::placeholder { color: rgba(255,255,255,.3); }
.auth-form input:focus { border-color: var(--pl); background: rgba(255,255,255,.1); }

.btn-primary {
  width: 100%; padding: 14px; background: var(--grad);
  color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .2s; font-family: inherit;
  box-shadow: 0 6px 24px rgba(124,58,237,.5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(124,58,237,.6); }
.btn-primary:active { transform: translateY(0) scale(.98); }

.btn-secondary {
  width: 100%; padding: 13px; margin-top: 8px;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.btn-secondary:active { transform: scale(.98); }

/* QR-login overlay */
.qr-overlay {
  flex-direction: column; align-items: center; gap: 14px;
  padding: 16px 4px;
}
.qr-title { font-size: 20px; font-weight: 700; color: #fff; margin: 0; text-align: center; }
.qr-hint { font-size: 13px; color: rgba(255,255,255,.55); text-align: center; margin: 0; line-height: 1.45; }
.qr-canvas {
  width: 240px; height: 240px;
  background: #fff; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.qr-canvas canvas { display: block; }
.qr-status { font-size: 13px; color: var(--accent-light, #a78bfa); text-align: center; margin: 0; min-height: 18px; }

.auth-error { font-size: 13px; color: #FCA5A5; text-align: center; min-height: 16px; }

/* ─────────────────────────────────────────────────
   APP LAYOUT
───────────────────────────────────────────────── */
#app-screen { background: var(--bg); }
.app-layout { display: flex; width: 100%; height: 100%; }

/* ─────────────────────────────────────────────────
   SIDEBAR (DARK)
───────────────────────────────────────────────── */
.sidebar {
  width: 340px; min-width: 260px;
  background: var(--sb-bg);
  display: flex; flex-direction: column;
  flex-shrink: 0; position: relative;
  box-shadow: 2px 0 24px rgba(0,0,0,.3);
}

/* Header */
.sidebar-header {
  height: var(--hh); padding: 0 12px 0 16px;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--sb-border);
}
.my-avatar-btn {
  position: relative; width: 38px; height: 38px;
  border-radius: 50%; border: none; cursor: pointer; padding: 0; flex-shrink: 0; overflow: visible;
}
.my-avatar-btn img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: block; }
.online-dot-me { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--sb-bg); bottom: 0; right: 0; }
.sidebar-title { flex: 1; color: var(--sb-text); font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.sidebar-actions { display: flex; gap: 2px; }
.hdr-btn { background: none; border: none; cursor: pointer; padding: 7px; border-radius: 50%; color: var(--sb-muted); display: flex; align-items: center; justify-content: center; transition: all .15s; }
.hdr-btn:hover { background: var(--sb-hov); color: var(--sb-text); }

/* Header dropdown menu (⋯ → Профиль / Настройки / Выйти) */
.sidebar-actions { position: relative; }
.hdr-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 180px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 6px;
  z-index: 100;
  animation: popIn 0.15s ease;
}
.hdr-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s;
}
.hdr-menu-item:hover { background: var(--bubble-in); }
.hdr-menu-item.danger { color: var(--red, #EF4444); }
.hdr-menu-item.danger:hover { background: rgba(239, 68, 68, 0.08); }
.hdr-menu-item svg { color: currentColor; flex-shrink: 0; }

/* Stories */
.stories-bar { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--sb-border); flex-shrink: 0; overflow: hidden; }
.story-add-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; flex-shrink: 0; margin-right: 8px; }
.story-add-circle {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 1.5px dashed var(--sb-muted);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-light); transition: all .2s;
}
.story-add-btn:hover .story-add-circle {
  background: rgba(124,58,237,.18); border-color: var(--accent-light);
  color: #fff; transform: scale(1.06);
}
.story-add-btn span, .story-item span { font-size: 10.5px; color: var(--sb-muted); white-space: nowrap; max-width: 56px; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.stories-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px; -webkit-overflow-scrolling: touch; }
.stories-scroll::-webkit-scrollbar { display: none; }
.story-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; flex-shrink: 0; }
.story-ring {
  width: 48px; height: 48px; border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 220deg, var(--accent), #EC4899, #F59E0B, var(--accent));
  transition: transform .2s;
}
.story-ring.viewed { background: rgba(255,255,255,.18); }
.story-ring.mine   { background: conic-gradient(from 220deg, var(--accent-light), var(--accent), #EC4899, var(--accent-light)); }
.story-ring:hover  { transform: scale(1.08); }
.story-ring img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--sb-bg); display: block;
}

/* Search + tabs */
.sidebar-search-wrap { flex-shrink: 0; padding: 12px 14px 4px; }
.sidebar-search {
  height: 38px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: rgba(255,255,255,.06);
  border-radius: 12px;
}
.sidebar-search svg { color: var(--sb-muted); flex-shrink: 0; }
.sidebar-search input { flex: 1; border: none; outline: none; font-size: 13.5px; color: var(--sb-text); background: transparent; font-family: inherit; }
.sidebar-search input::placeholder { color: var(--sb-muted); }

.sidebar-tabs { display: flex; padding: 8px 14px 4px; gap: 6px; }
.stab {
  border: none; background: transparent;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
  color: var(--sb-muted); transition: all .15s;
  white-space: nowrap; font-family: inherit;
}
.stab:hover { color: var(--sb-text); }
.stab.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 10px var(--accent-glow);
}
.stab-count {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
}
.stab:not(.active) .stab-count {
  background: var(--sb-hov, rgba(255, 255, 255, 0.08));
  color: var(--sb-muted);
}

/* Chat list */
.chat-list { flex: 1; overflow-y: auto; }
.chat-list::-webkit-scrollbar { width: 3px; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.chat-item {
  display: flex; align-items: center; padding: 8px 14px; gap: 10px;
  cursor: pointer; transition: background .1s;
  border-left: 3px solid transparent;
}
.chat-item:hover  { background: var(--sb-hov); }
.chat-item.active {
  background: var(--sb-act-strong);
  border-left-color: var(--accent);
}

.chat-avatar-wrap { position: relative; flex-shrink: 0; }
.chat-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; }
.chat-online-dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--sb-bg); bottom: 1px; right: 1px; }
.chat-type-badge { position: absolute; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; bottom: 0; right: 0; border: 2px solid var(--sb-bg); }

.chat-info { flex: 1; min-width: 0; }
.chat-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.chat-name { font-size: 13.5px; font-weight: 600; color: var(--sb-text); letter-spacing: -.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 10.5px; color: var(--sb-dim); flex-shrink: 0; margin-left: 8px; }
.chat-item.has-unread .chat-time { color: var(--accent-light); font-weight: 600; }
.chat-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.chat-preview { font-size: 12px; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; line-height: 1.35; display: flex; align-items: center; gap: 4px; }
.unread-badge { background: var(--accent); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; padding: 0 5px; flex-shrink: 0; }
.unread-badge.muted { background: rgba(255,255,255,.18); color: var(--sb-muted); }
/* Иконки мут/пиннед справа от превью (design/web-shell.jsx::SidebarChatRow) */
.chat-meta-icon { color: var(--sb-dim); display: inline-flex; align-items: center; flex-shrink: 0; }
.ticks { font-size: 12px; color: var(--sb-muted); }
.ticks.read { color: var(--accent-light); }

/* Empty list */
.chat-empty-hint {
  padding: 32px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--sb-muted); font-size: 13.5px; line-height: 1.55;
}
.chat-empty-hint::before {
  content: '💬';
  font-size: 40px; margin-bottom: 6px;
  filter: grayscale(0.4) opacity(0.75);
}
.chat-empty-hint b { color: var(--accent-light); }

/* FAB */
.fab-wrap { position: absolute; bottom: 18px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 20; }
.fab { width: 52px; height: 52px; border-radius: 50%; background: var(--grad); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(124,58,237,.5); transition: all .2s; flex-shrink: 0; }
.fab:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 6px 28px rgba(124,58,237,.6); }
.fab.open { transform: rotate(45deg); }
.fab:active { transform: scale(.94); }

.fab-menu { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.fab-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(30,25,50,.95); border: 1px solid rgba(124,58,237,.3);
  border-radius: 22px; padding: 8px 14px 8px 10px;
  cursor: pointer; color: var(--sb-text); font-size: 13.5px; font-weight: 500;
  transition: all .2s; white-space: nowrap; backdrop-filter: blur(8px);
  animation: popIn .15s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.fab-item svg { color: var(--pl); flex-shrink: 0; }
.fab-item:hover { background: rgba(124,58,237,.3); border-color: var(--pl); transform: translateX(-3px); }

/* ─────────────────────────────────────────────────
   RIGHT PANEL — EMPTY
───────────────────────────────────────────────── */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 32px;
  background: var(--chat-bg);
  background-image:
    radial-gradient(circle at 30% 20%, var(--accent-soft) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(236,72,153,0.10) 0%, transparent 45%);
}
.empty-illustration {
  width: 96px; height: 96px; border-radius: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-accent);
  animation: bob 4s ease-in-out infinite;
  filter: drop-shadow(0 14px 32px var(--accent-glow));
}
.empty-state h2 {
  font-size: 26px; font-weight: 700; color: var(--text);
  letter-spacing: -0.4px;
}
.empty-state > p {
  font-size: 14.5px; color: var(--text-sec); text-align: center;
  max-width: 320px; line-height: 1.55;
}
.empty-state strong { color: var(--accent); }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.btn-outline {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-1px); }
.btn-outline:active { transform: translateY(0); }
.btn-channel { color: var(--orange); }
.btn-channel:hover { background: rgba(245,158,11,.08); border-color: var(--orange); }

/* ─────────────────────────────────────────────────
   CHAT VIEW
───────────────────────────────────────────────── */
.chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* Chat header */
.chat-header {
  height: var(--hh); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  flex-shrink: 0;
}
.back-btn { display: none; color: var(--accent); }
.icon-btn {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sec); transition: background .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.chat-header-avatar-wrap { position: relative; }
.chat-header-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.chat-header-online { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--online); border: 2px solid var(--surface); bottom: 0; right: 0; }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -.2px; line-height: 1.2; }
.chat-header-status { font-size: 12px; color: var(--text-sec); margin-top: 2px; transition: color 0.2s; }
.chat-header.online .chat-header-status,
.chat-header-status.online { color: var(--online, #22C55E); font-weight: 500; }

/* Messages area */
.messages-container {
  flex: 1; overflow-y: auto; padding: 20px 8%;
  display: flex; flex-direction: column;
  background: var(--chat-bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(124,58,237,.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(147,51,234,.04) 0%, transparent 50%);
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--pl); opacity: .2; border-radius: 4px; }
.messages-list { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }

/* Date divider */
.date-divider { text-align: center; margin: 18px 0 10px; }
.date-divider span { background: rgba(255,255,255,.85); backdrop-filter: blur(8px); padding: 4px 16px; border-radius: 14px; font-size: 12px; font-weight: 500; color: var(--muted); box-shadow: 0 1px 6px rgba(0,0,0,.07); }

/* Message bubbles */
.msg-wrap { display: flex; flex-direction: column; max-width: 62%; animation: popIn .16s ease; }
.msg-wrap.out { align-self: flex-end; align-items: flex-end; }
.msg-wrap.in  { align-self: flex-start; align-items: flex-start; }

@keyframes popIn {
  from { opacity: 0; transform: scale(.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.msg-sender-name { font-size: 11.5px; font-weight: 600; color: var(--p); margin-bottom: 2px; padding: 0 4px; }

.bubble {
  padding: 8px 14px 22px;
  border-radius: 18px;
  position: relative;
  font-size: 14.5px; line-height: 1.4;
  word-break: break-word;
}
.msg-wrap.out .bubble {
  background: var(--grad-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px var(--accent-soft);
}
.msg-wrap.in .bubble {
  background: var(--bubble-in);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 0 0 0 .5px rgba(0,0,0,.04);
}

.bubble-meta {
  position: absolute; bottom: 5px; right: 10px;
  display: flex; align-items: center; gap: 3px;
  font-size: 10.5px;
}
.msg-wrap.out .bubble-meta { color: rgba(255,255,255,.7); }
.msg-wrap.in  .bubble-meta { color: var(--muted); }
.msg-tick { font-size: 12px; }
.msg-tick.read { color: #38BDF8; }
.msg-wrap.in .msg-tick { display: none; }

/* Hover-actions — мини-панель на боковой стороне пузыря (😊 💬 ⋯) */
.msg-wrap { position: relative; }
.msg-hover-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
}
.msg-wrap.out .msg-hover-actions { right: 100%; margin-right: 6px; transform: translateY(-50%) translateX(6px); }
.msg-wrap.in  .msg-hover-actions { left: 100%;  margin-left: 6px;  transform: translateY(-50%) translateX(-6px); }
.msg-wrap:hover .msg-hover-actions {
  opacity: 1; pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.msg-hover-btn {
  width: 30px; height: 30px;
  border: none; background: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted, #6B7280);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}
.msg-hover-btn:hover { background: var(--bubble-in); color: var(--accent); }
/* Скрыть hover-actions на тач-устройствах — там работает long-press */
@media (hover: none) {
  .msg-hover-actions { display: none; }
}

/* Quick reaction picker (hover 😊 → emoji выбор) */
.quick-react-pop {
  position: fixed;
  display: flex;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  animation: popIn 0.15s ease;
}
.quick-react-btn {
  width: 36px; height: 36px;
  border: none; background: none;
  border-radius: 50%;
  font-size: 22px; line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
  padding: 0;
}
.quick-react-btn:hover { background: var(--bubble-in); transform: scale(1.2); }

/* Emoji-only сообщения — без фона, крупный шрифт, время под ними (Telegram/iMessage стиль) */
.bubble.bubble--emoji {
  background: transparent !important;
  box-shadow: none !important;
  padding: 2px 4px 0;
  border-radius: 0 !important;
}
.bubble.bubble--emoji .emoji-jumbo {
  font-size: 52px;
  line-height: 1.1;
  display: block;
  letter-spacing: -1px;
  /* Использовать системный эмодзи-шрифт чтобы выглядело красиво и одинаково */
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;
}
.bubble.bubble--emoji .emoji-jumbo[data-count="2"] { font-size: 46px; }
.bubble.bubble--emoji .emoji-jumbo[data-count="3"] { font-size: 38px; }
.bubble.bubble--emoji .bubble-meta {
  position: static;
  margin-top: 3px;
  justify-content: flex-end;
  color: var(--muted) !important;
}
.msg-wrap.out .bubble.bubble--emoji .bubble-meta { color: var(--muted) !important; }
.msg-wrap.out .bubble.bubble--emoji .msg-tick { color: var(--accent); }
.msg-wrap.out .bubble.bubble--emoji .msg-tick.read { color: #38BDF8; }

/* Media in bubble */
.bubble img.msg-img { max-width: 260px; max-height: 200px; border-radius: 14px; display: block; margin-bottom: 4px; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.file-attachment { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.08); border-radius: 12px; padding: 10px 12px; margin-bottom: 4px; text-decoration: none; color: inherit; transition: background .15s; }
.file-attachment:hover { background: rgba(0,0,0,.13); }
.msg-wrap.out .file-attachment { background: rgba(255,255,255,.15); }
.msg-wrap.out .file-attachment:hover { background: rgba(255,255,255,.22); }
.file-attachment-name { font-size: 13px; font-weight: 500; word-break: break-all; }

/* Voice */
.voice-player { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; min-width: 190px; }
.voice-play-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.voice-play-btn:hover { transform: scale(1.08); background: rgba(255,255,255,.3); }
.msg-wrap.in .voice-play-btn { background: var(--grad); }
.voice-waveform { flex: 1; height: 28px; display: flex; align-items: center; gap: 2.5px; }
.voice-bar { width: 3px; border-radius: 3px; background: currentColor; opacity: .4; flex-shrink: 0; }
.voice-duration { font-size: 11px; opacity: .7; min-width: 32px; }

/* Typing */
.typing-wrap { display: flex; align-items: center; gap: 8px; padding: 6px 8% 8px; }
.typing-bubble { background: var(--b-in); border-radius: 18px; border-bottom-left-radius: 4px; padding: 10px 14px; display: flex; gap: 5px; align-items: center; box-shadow: var(--shadow-sm); }
.typing-bubble span { width: 7px; height: 7px; border-radius: 50%; background: var(--pl); animation: td 1.2s infinite; }
.typing-bubble span:nth-child(2) { animation-delay: .2s; }
.typing-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes td { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-6px);opacity:1} }
.typing-text { font-size: 12px; color: var(--muted); }

/* Read-only */
.readonly-bar { background: #FFFBEB; border-top: 1px solid #FDE68A; padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: #92400E; flex-shrink: 0; }

/* ─────────────────────────────────────────────────
   INPUT BAR
───────────────────────────────────────────────── */
.input-bar {
  min-height: 60px; background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; position: relative;
}

.attach-btn { color: var(--text-sec); }
.attach-btn:hover { color: var(--accent); }

.text-input-wrap {
  flex: 1; background: #F5F3FA;
  border-radius: 20px; padding: 10px 16px;
  min-height: 40px;
  transition: background .15s;
}
.text-input-wrap:focus-within { background: #EEE9F6; }

#msg-input {
  width: 100%; border: none; outline: none; font-size: 14px; resize: none;
  max-height: 120px; overflow-y: auto; line-height: 1.45; color: var(--text);
  background: transparent; font-family: inherit;
}
#msg-input::placeholder { color: var(--text-mute); }

.send-btn {
  width: 40px; height: 40px; border-radius: 20px;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-sec);
  transition: all .15s;
}
.send-btn.has-text {
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 14px var(--accent-glow);
}
.send-btn:hover { transform: scale(1.06); }
.send-btn:active { transform: scale(.96); }

.recording-bar { position: absolute; inset: 0; background: var(--surface); display: flex; align-items: center; padding: 0 14px; gap: 10px; z-index: 10; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; flex-shrink: 0; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.15} }
#rec-time { font-size: 16px; font-weight: 600; color: var(--red); min-width: 36px; }

.file-preview { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.file-preview > .icon-btn { color: var(--muted); }
#preview-img { max-height: 60px; border-radius: 10px; }
#preview-file-info { flex: 1; font-size: 13px; color: var(--muted); }
.btn-send-file { display: flex; align-items: center; gap: 6px; background: var(--grad); color: #fff; border: none; border-radius: 20px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ─────────────────────────────────────────────────
   MODALS
───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn .2s;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal {
  background: var(--surface); border-radius: 22px;
  width: min(480px, 96vw);
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  overflow: hidden; animation: slideUp .22s ease;
  max-height: 90vh; overflow-y: auto;
}
@keyframes slideUp { from{transform:translateY(28px);opacity:0} to{transform:translateY(0);opacity:1} }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 5;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-close { color: var(--muted); }

.modal-search {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.modal-search svg { color: var(--muted); flex-shrink: 0; }
.modal-search input { flex: 1; border: none; outline: none; font-size: 15px; color: var(--text); background: transparent; font-family: inherit; }

.modal-user-list { max-height: 320px; overflow-y: auto; }
.modal-hint { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }
.modal-user-item { display: flex; align-items: center; padding: 10px 16px; gap: 12px; cursor: pointer; transition: background .1s; border-bottom: 1px solid rgba(0,0,0,.04); }
.modal-user-item:hover { background: var(--bg); }
.modal-user-item img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.modal-user-name { font-size: 15px; font-weight: 600; }
.modal-user-login { font-size: 13px; color: var(--muted); }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

.btn-invite-link { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; border: 1.5px dashed var(--p); border-radius: 12px; background: none; color: var(--p); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; font-family: inherit; }
.btn-invite-link:hover { background: rgba(124,58,237,.06); }

.modal-text-input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px; font-size: 15px; outline: none; transition: all .2s; font-family: inherit; color: var(--text); resize: none; background: var(--surface); }
.modal-text-input:focus { border-color: var(--pl); box-shadow: 0 0 0 3px rgba(124,58,237,.08); }

/* Create group body */
.create-group-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.group-avatar-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.group-avatar-circle { width: 84px; height: 84px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; transition: all .2s; overflow: hidden; box-shadow: 0 4px 16px rgba(124,58,237,.3); }
.group-avatar-circle:hover { transform: scale(1.06); }
.group-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.group-avatar-hint { font-size: 12px; color: var(--p); font-weight: 500; }
.members-section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.selected-members { display: flex; flex-wrap: wrap; gap: 6px; min-height: 4px; }
.selected-chip { display: flex; align-items: center; gap: 6px; background: rgba(124,58,237,.1); border-radius: 20px; padding: 4px 10px 4px 4px; font-size: 13px; font-weight: 500; color: var(--p); }
.selected-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.selected-chip button { background: none; border: none; cursor: pointer; color: var(--p); padding: 0; font-size: 18px; line-height: 1; display: flex; opacity: .7; }
.selected-chip button:hover { opacity: 1; }

/* Story editor */
.story-editor { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.story-preview-box { height: 200px; border-radius: 18px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; transition: background .3s; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.story-preview-text { color: #fff; font-size: 22px; font-weight: 700; text-align: center; padding: 20px; word-break: break-word; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.story-bg-colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bg-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; transition: all .2s; border: 3px solid transparent; }
.bg-swatch.active { border-color: rgba(0,0,0,.2); box-shadow: 0 0 0 3px rgba(124,58,237,.5); transform: scale(1.18); }
.bg-swatch:hover { transform: scale(1.1); }

/* Story viewer */
.story-viewer-overlay { background: rgba(0,0,0,.95) !important; backdrop-filter: none !important; z-index: 2000; }
.story-viewer-box { width: min(400px, 100vw); height: 100vh; max-height: 760px; position: relative; background: #000; overflow: hidden; display: flex; flex-direction: column; border-radius: 0; }
.story-progress-bar { display: flex; gap: 4px; padding: 12px 12px 0; position: absolute; top: 0; left: 0; right: 0; z-index: 10; }
.story-progress-seg { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.story-progress-seg .fill { height: 100%; background: #fff; width: 0; }
.story-viewer-header { display: flex; align-items: center; gap: 10px; padding: 32px 14px 10px; position: absolute; top: 0; left: 0; right: 0; z-index: 9; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent); }
.story-viewer-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.6); }
.story-viewer-name { font-size: 14px; font-weight: 600; color: #fff; }
.story-viewer-time { font-size: 11px; color: rgba(255,255,255,.55); }
.story-viewer-content { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.story-viewer-content img { width: 100%; height: 100%; object-fit: cover; }
.sv-text { color: #fff; font-size: 24px; font-weight: 700; text-align: center; padding: 32px; text-shadow: 0 2px 16px rgba(0,0,0,.5); word-break: break-word; width: 100%; }
.story-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 20px 10px; z-index: 10; }
.story-nav-prev { left: 0; }
.story-nav-next { right: 0; }

/* Invite */
.invite-content { padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.invite-desc { font-size: 14px; color: var(--muted); text-align: center; }
.invite-link-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
#invite-link-text { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn { display: flex; align-items: center; gap: 5px; background: var(--grad); color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; flex-shrink: 0; transition: all .2s; white-space: nowrap; font-family: inherit; }
.copy-btn.copied { background: linear-gradient(135deg, #10B981, #059669); }
.invite-share-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.share-btn { display: flex; align-items: center; gap: 7px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; font-family: inherit; }
.share-btn:hover { border-color: var(--p); color: var(--p); transform: translateY(-1px); }

/* Profile */
.profile-content { padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-avatar-wrap { position: relative; }
.profile-avatar-wrap img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--pl); }
.profile-avatar-edit { position: absolute; bottom: 2px; right: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-username { font-size: 14px; color: var(--muted); }

/* Auth invite hint */
.auth-invite-hint {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  margin-top: 14px; font-size: 12px; color: rgba(255,255,255,.35);
}
.auth-link {
  color: var(--accent-light, #a78bfa);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.auth-link:hover { color: #fff; text-decoration: underline; }

/* ─── Invite section (inside profile modal) ─── */
.invite-section { border-top: 1px solid var(--border); margin-top: 12px; padding: 16px 20px 4px; }
.invite-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.invite-section-title { font-size: 14px; font-weight: 600; color: var(--sb-text); }
.invite-section-sub   { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px; }

.btn-create-invite { background: var(--p); color: #fff; border: none; border-radius: 8px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: opacity .15s; }
.btn-create-invite:hover { opacity: .85; }

.invite-create-form { background: rgba(255,255,255,.04); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.invite-form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.invite-select { flex: 1; background: rgba(255,255,255,.06); color: var(--sb-text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; outline: none; cursor: pointer; }
.invite-note-input { width: 100%; background: rgba(255,255,255,.06); color: var(--sb-text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px;
  outline: none; margin-bottom: 8px; }
.invite-note-input::placeholder { color: rgba(255,255,255,.25); }
.btn-gen-invite { width: 100%; background: var(--grad); color: #fff; border: none; border-radius: 8px;
  padding: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }

.invite-link-result { background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.3);
  border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.invite-link-text { font-size: 11px; color: var(--pl); word-break: break-all; margin-bottom: 8px;
  font-family: monospace; }
.invite-link-actions { display: flex; gap: 6px; }
.inv-action-btn { flex: 1; background: rgba(124,58,237,.2); color: var(--pl); border: none;
  border-radius: 7px; padding: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s; }
.inv-action-btn:hover { background: rgba(124,58,237,.35); }

.invite-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.invite-item { background: rgba(255,255,255,.04); border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; }
.invite-item-info { flex: 1; min-width: 0; }
.invite-item-url  { font-size: 11px; color: var(--pl); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-family: monospace; margin-bottom: 3px; cursor: pointer; }
.invite-item-url:hover { text-decoration: underline; }
.invite-item-meta { font-size: 10px; color: rgba(255,255,255,.35); }
.invite-item-uses { font-size: 11px; font-weight: 600; color: var(--online); flex-shrink: 0; }
.invite-item-uses.full { color: rgba(255,255,255,.25); }
.invite-revoke-btn { background: none; border: none; color: rgba(255,255,255,.2); font-size: 16px;
  cursor: pointer; padding: 2px 4px; transition: color .15s; }
.invite-revoke-btn:hover { color: var(--red); }

/* Web Call overlay (video + group) — design/web-screens3.jsx::WebVideoCall/GroupCall */
.wc-btn {
  width: 56px; height: 56px; border-radius: 28px;
  background: rgba(255,255,255,.15);
  border: 0.5px solid rgba(255,255,255,.25);
  color: #fff; font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .08s;
  font-family: inherit;
}
.wc-btn:hover  { background: rgba(255,255,255,.25); }
.wc-btn:active { transform: scale(.95); }
.wc-btn.off    { background: rgba(255,0,0,.35); }
.wc-btn.end    { box-shadow: 0 12px 28px rgba(239,68,68,.5); }
.wc-tile {
  background: #2A1F38; border-radius: 18px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; position: relative;
  aspect-ratio: 1;
}
.wc-tile.self { border: 2px solid var(--accent); background: #34284A; }
.wc-tile .wc-tile-avatar {
  width: 64px; height: 64px; border-radius: 32px;
  background: linear-gradient(135deg,#7C3AED,#EC4899);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700;
}
.wc-tile .wc-tile-name { color: #fff; font-size: 14px; font-weight: 500; }
.wc-tile .wc-tile-muted {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px;
}

/* Toast — улучшено по design/screens4.jsx::ToastsScreen
   4 типа: success/info/warn/error. Type через .toast.success / .info / etc */
.toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  display: flex; align-items: center; gap: 10px;
  background: rgba(28,27,46,.95);
  color: #fff; padding: 11px 18px;
  border-radius: 14px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08);
  z-index: 9999;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
  opacity: 0; max-width: 480px;
  backdrop-filter: blur(8px);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast::before {
  content: '✓';
  display: inline-flex; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(255,255,255,.18);
  align-items: center; justify-content: center;
  font-size: 13px;
}
.toast.success { background: var(--green); color: #fff; }
.toast.success::before { content: '✓'; }
.toast.error   { background: var(--red); color: #fff; }
.toast.error::before { content: '✕'; }
.toast.warn    { background: var(--orange); color: #fff; }
.toast.warn::before { content: '⚠'; }
.toast.info    { background: #3B82F6; color: #fff; }
.toast.info::before { content: 'i'; font-family: serif; font-style: italic; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; z-index: 3000; cursor: zoom-out; animation: fadeIn .2s; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 0 80px rgba(124,58,237,.3); }

/* ─────────────────────────────────────────────────
   MOBILE
───────────────────────────────────────────────── */
@media (max-width: 720px) {
  /* Sidebar становится полным экраном; chat-panel — overlay */
  .sidebar {
    width: 100%; max-width: 100%;
    position: absolute; inset: 0; z-index: 10;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.hidden { transform: translateX(-100%); }
  .chat-panel { position: absolute; inset: 0; z-index: 5; }
  .back-btn { display: flex !important; }

  /* Header — компактнее */
  .chat-header   { padding: 0 12px; height: 56px; }
  .sidebar-header { padding: 0 12px; height: 56px; }
  :root { --hh: 56px; }

  /* Сообщения */
  .msg-wrap { max-width: 80%; }
  .messages-container { padding: 12px 4%; }
  .input-bar  { padding: 8px 12px; min-height: 56px; }
  .send-btn   { width: 36px; height: 36px; border-radius: 18px; }

  /* Sidebar tweaks для одного-экрана-режима */
  .sidebar-header .hdr-btn:nth-child(n+5) { display: none; } /* меньше иконок */
  .chat-item { padding: 8px 12px; }
  .chat-avatar { width: 42px; height: 42px; }
  .stab { padding: 5px 10px; font-size: 12px; }

  /* Modal → bottom sheet */
  .modal {
    border-radius: 20px 20px 0 0;
    position: absolute; bottom: 0;
    width: 100%; max-width: 100%; max-height: 92vh;
    animation: slideUpSheet .25s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes slideUpSheet {
    from { transform: translateY(100%); opacity: 0.7; }
    to   { transform: translateY(0);   opacity: 1; }
  }
  /* Grab handle сверху модалки */
  .modal::before {
    content: ''; display: block;
    width: 36px; height: 4px; border-radius: 2px;
    background: var(--border-str);
    margin: 8px auto 4px;
  }

  /* Story viewer fullscreen */
  .story-viewer-box { max-height: 100vh; border-radius: 0; }

  /* FAB ниже от bottom edge на iPhone (safe-area) */
  .fab-wrap { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .input-bar { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px) / 2); }
}

/* Очень узкие — phone landscape / small */
@media (max-width: 380px) {
  .stab { font-size: 11px; padding: 5px 8px; }
  .chat-avatar { width: 40px; height: 40px; }
  .chat-name { font-size: 13px; }
  .chat-preview { font-size: 11.5px; }
}

/* ─────────────────────────────────────────────────
   DESKTOP (wide)
───────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .sidebar { width: 380px; }
  .msg-wrap { max-width: 55%; }
  .messages-container { padding: 24px 12%; }
}

* { scrollbar-width: thin; scrollbar-color: rgba(124,58,237,.2) transparent; }

/* ─────────────────────────────────────────────────
   BOT MESSAGES — inline keyboard rendered inline в bubble area
───────────────────────────────────────────────── */
.bot-inline-kb {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: -6px; margin-bottom: 6px;
  max-width: 320px;
  align-self: flex-start;  /* у in-сообщений */
}
.bot-inline-kb-row { display: flex; gap: 4px; }
.bot-kb-btn {
  flex: 1; padding: 8px 12px; border-radius: 10px;
  background: var(--bubble-in);
  border: 1px solid var(--border);
  color: var(--accent-light); font-size: 13px; font-weight: 500;
  text-align: center; cursor: pointer;
  transition: background .12s, transform .08s;
  font-family: inherit;
}
.bot-kb-btn:hover  { background: var(--accent-soft); }
.bot-kb-btn:active { transform: scale(.97); }

/* Slash-command suggestions popup */
.slash-popup {
  position: absolute; left: 12px; right: 12px; bottom: 68px;
  background: var(--surface); border: 1px solid var(--border-str);
  border-radius: 14px; padding: 6px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.18);
  z-index: 50;
  max-height: 200px; overflow-y: auto;
}
.slash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.slash-row:hover, .slash-row.active { background: var(--accent-soft); }
.slash-row .cmd {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 13px; color: var(--accent-light); font-weight: 600;
}
.slash-row .desc { font-size: 12.5px; color: var(--text-sec); }

/* ─────────────────────────────────────────────────
   CHAT HEADER ACTIONS
───────────────────────────────────────────────── */
.chat-header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; position: relative; }
/* dropdown ⋯ в chat-header выравнивается под кнопку — наследует .hdr-menu */
.chat-header-actions .hdr-menu { min-width: 220px; }

/* Chat search bar */
.chat-search-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-search-bar svg { opacity: .4; flex-shrink: 0; }
.chat-search-bar input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; color: var(--text); }
.chat-search-results { background: var(--surface); border-bottom: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; transition: background .15s; }
.search-result-item:hover { background: rgba(124,58,237,.06); }
.search-result-item .sr-sender { font-size: 12px; color: var(--p); font-weight: 600; margin-bottom: 2px; }
.search-result-item .sr-text  { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.search-result-item .sr-time  { font-size: 11px; color: var(--muted); flex-shrink: 0; margin-left: auto; }
.sr-highlight { background: rgba(124,58,237,.2); border-radius: 2px; padding: 0 1px; }

/* ─────────────────────────────────────────────────
   REPLY BAR & EDIT BAR
───────────────────────────────────────────────── */
.reply-bar, .edit-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--border); animation: slideUp .15s ease; }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.reply-bar-line { width: 3px; height: 36px; border-radius: 2px; background: var(--grad); flex-shrink: 0; }
.reply-bar-info { flex: 1; min-width: 0; }
.reply-bar-name { font-size: 12px; font-weight: 600; color: var(--p); margin-bottom: 2px; }
.reply-bar-text { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-bar { font-size: 13px; color: var(--p); font-weight: 500; gap: 8px; }
.edit-bar span { flex: 1; }

/* Emoji toggle button */
.emoji-toggle-btn { font-size: 20px; line-height: 1; padding: 0 4px; opacity: .7; transition: opacity .15s; }
.emoji-toggle-btn:hover { opacity: 1; }

/* Emoji picker */
.emoji-picker { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 4px; max-height: 200px; overflow-y: auto; }
.emoji-picker button { font-size: 22px; border: none; background: none; cursor: pointer; padding: 4px; border-radius: 6px; line-height: 1; transition: background .1s; }
.emoji-picker button:hover { background: rgba(124,58,237,.12); }

/* ─────────────────────────────────────────────────
   REPLY QUOTE IN BUBBLE
───────────────────────────────────────────────── */
.reply-quote { background: rgba(0,0,0,.07); border-left: 3px solid var(--p); border-radius: 6px; padding: 5px 8px; margin-bottom: 6px; cursor: pointer; transition: background .15s; }
.reply-quote:hover { background: rgba(0,0,0,.12); }
.reply-quote-name { font-size: 11px; font-weight: 600; color: var(--p); margin-bottom: 2px; }
.reply-quote-text { font-size: 12px; color: rgba(0,0,0,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-wrap.out .reply-quote { background: rgba(255,255,255,.15); border-left-color: rgba(255,255,255,.7); }
.msg-wrap.out .reply-quote-name { color: rgba(255,255,255,.85); }
.msg-wrap.out .reply-quote-text { color: rgba(255,255,255,.65); }

/* ─────────────────────────────────────────────────
   MESSAGE: EDITED, DELETED, REACTIONS
───────────────────────────────────────────────── */
.msg-edited { font-size: 10px; color: rgba(0,0,0,.35); margin-right: 4px; font-style: italic; }
.msg-wrap.out .msg-edited { color: rgba(255,255,255,.45); }
.msg-deleted .bubble { opacity: .6; }
.msg-deleted .bubble span { color: var(--muted); font-style: italic; }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-pill { display: flex; align-items: center; gap: 3px; background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.2); border-radius: 12px; padding: 2px 8px; font-size: 14px; cursor: pointer; transition: all .15s; color: var(--text); }
.reaction-pill:hover { background: rgba(124,58,237,.2); }
.reaction-pill.my-reaction { background: rgba(124,58,237,.25); border-color: var(--p); }
.reaction-pill span { font-size: 12px; font-weight: 600; }

/* Load more button */
.load-more-wrap { text-align: center; padding: 10px 0 4px; }
.load-more-btn { background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.2); color: var(--p); border-radius: 20px; padding: 6px 18px; font-size: 13px; cursor: pointer; transition: background .15s; }
.load-more-btn:hover { background: rgba(124,58,237,.2); }

/* ─────────────────────────────────────────────────
   CONTEXT MENU
───────────────────────────────────────────────── */
.ctx-menu { position: fixed; background: var(--surface); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.07); z-index: 5000; min-width: 170px; overflow: hidden; animation: ctxIn .15s cubic-bezier(.34,1.56,.64,1); }
@keyframes ctxIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; padding: 12px 16px; font-size: 14px; color: var(--text); cursor: pointer; text-align: left; transition: background .12s; }
.ctx-item:hover { background: rgba(124,58,237,.08); }
.ctx-item svg { opacity: .6; flex-shrink: 0; }
.ctx-danger { color: var(--red) !important; }
.ctx-danger svg { opacity: .8; }

/* Quick react picker */
.react-picker { position: fixed; background: var(--surface); border-radius: 32px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.07); z-index: 5001; display: flex; gap: 4px; animation: ctxIn .15s cubic-bezier(.34,1.56,.64,1); }
.react-picker button { font-size: 24px; border: none; background: none; cursor: pointer; padding: 4px; border-radius: 50%; transition: transform .1s; }
.react-picker button:hover { transform: scale(1.3); }

/* ─────────────────────────────────────────────────
   GROUP SETTINGS MODAL
───────────────────────────────────────────────── */
.group-settings-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 16px; max-height: 60vh; overflow-y: auto; }
.gsettings-section { display: flex; flex-direction: column; gap: 8px; }
.gsettings-label { font-size: 11px; font-weight: 600; color: var(--p); text-transform: uppercase; letter-spacing: .5px; padding: 4px 0; }
.group-members-list { display: flex; flex-direction: column; gap: 4px; }
.gmember-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.03); }
.gmember-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.gmember-info { flex: 1; min-width: 0; }
.gmember-name { font-size: 13px; font-weight: 500; }
.gmember-role { font-size: 11px; color: var(--muted); }
.gmember-actions { display: flex; align-items: center; gap: 6px; }
.role-select { font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; background: var(--surface); color: var(--text); cursor: pointer; }
.gmember-remove { font-size: 18px; border: none; background: none; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: color .12s; }
.gmember-remove:hover { color: var(--red); }

/* ─────────────────────────────────────────────────
   MEDIA GALLERY
───────────────────────────────────────────────── */
.modal-wide { max-width: 600px; }
.gallery-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 20px; gap: 0; }
.gallery-tab { flex: 1; padding: 12px 0; font-size: 14px; font-weight: 500; border: none; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.gallery-tab.active { color: var(--p); border-bottom-color: var(--p); }
.gallery-content { padding: 16px 20px; min-height: 200px; max-height: 50vh; overflow-y: auto; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery-thumb { aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer; background: var(--border); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery-thumb:hover img { transform: scale(1.05); }
.gallery-empty { text-align: center; padding: 40px 20px; color: var(--text-mute); font-size: 14px; }
.gallery-content:empty {
  min-height: 200px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  padding: 60px 20px;
  color: var(--text-mute); font-size: 14px;
}
.gallery-content:empty::before {
  content: '🖼'; font-size: 44px; opacity: 0.5;
}
.gallery-content:empty::after {
  content: 'Медиа из этого чата появятся здесь';
}
.file-gallery-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.03); margin-bottom: 6px; text-decoration: none; color: var(--text); transition: background .15s; }
.file-gallery-item:hover { background: rgba(124,58,237,.06); }
.file-gallery-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(124,58,237,.12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-gallery-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-gallery-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─────────────────────────────────────────────────
   BUSINESS PANEL
───────────────────────────────────────────────── */
.biz-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.biz-tab { flex-shrink: 0; padding: 12px 14px; font-size: 13px; font-weight: 500; border: none; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; white-space: nowrap; }
.biz-tab.active { color: var(--p); border-bottom-color: var(--p); }
.biz-content { padding: 20px; max-height: 65vh; overflow-y: auto; }

/* biz-tab — hover + light-theme overrides */
.biz-tab:hover { color: var(--text); }
.biz-tab.active { box-shadow: inset 0 -2px 0 var(--accent); }
body.theme-light .biz-tab.active { color: var(--accent); }
.biz-content:empty::after,
.biz-content > .biz-empty {
  content: '';
  display: block; padding: 60px 20px; text-align: center;
  color: var(--text-mute); font-size: 14px;
}
.biz-content:empty::before { content: '🤖'; display: block; font-size: 40px; text-align: center; padding-top: 60px; opacity: 0.5; }
.biz-content:empty::after { content: 'Создайте бота — кнопка ниже\\Aили выберите вкладку выше'; white-space: pre; padding-top: 8px; }

/* Bot cards */
.bot-list { display: flex; flex-direction: column; gap: 12px; }
.bot-card { background: rgba(124,58,237,.04); border: 1px solid rgba(124,58,237,.12); border-radius: 14px; padding: 16px; }
.bot-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bot-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; overflow: hidden; }
.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bot-name { font-size: 15px; font-weight: 600; }
.bot-username { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bot-delete-btn { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; transition: all .15s; }
.bot-delete-btn:hover { color: var(--red); background: rgba(239,68,68,.08); }
.bot-token-row { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.04); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.bot-token-val { font-size: 11px; font-family: monospace; color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-token-copy, .bot-token-regen { font-size: 11px; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; cursor: pointer; color: var(--muted); white-space: nowrap; transition: all .15s; flex-shrink: 0; }
.bot-token-copy:hover  { background: rgba(124,58,237,.08); color: var(--p); border-color: var(--p); }
.bot-token-regen:hover { background: rgba(239,68,68,.08);  color: var(--red); border-color: var(--red); }
.bot-field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.bot-field-label { font-size: 11px; font-weight: 600; color: var(--p); text-transform: uppercase; letter-spacing: .4px; }
.bot-input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: var(--surface); color: var(--text); transition: border .15s; }
.bot-input:focus { outline: none; border-color: var(--p); }
.bot-autoreply-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bot-toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.bot-toggle input { opacity: 0; width: 0; height: 0; }
.bot-toggle-slider { position: absolute; inset: 0; background: rgba(0,0,0,.15); border-radius: 10px; cursor: pointer; transition: background .2s; }
.bot-toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.bot-toggle input:checked + .bot-toggle-slider { background: var(--p); }
.bot-toggle input:checked + .bot-toggle-slider::before { transform: translateX(16px); }
.bot-save-btn { width: 100%; margin-top: 10px; }
.btn-new-bot { width: 100%; margin-top: 16px; }

/* Business profile */
.biz-profile-form { display: flex; flex-direction: column; gap: 12px; }
.biz-section-title { font-size: 12px; font-weight: 600; color: var(--p); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; padding-top: 4px; }
.biz-hours-grid { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 6px; align-items: center; }
.biz-hours-day { font-size: 12px; font-weight: 500; }
.biz-hours-time { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 12px; background: var(--surface); color: var(--text); }
.biz-verified-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #059669; border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.biz-categories { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.biz-cat-chip { padding: 4px 10px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--muted); transition: all .15s; }
.biz-cat-chip.active { background: rgba(124,58,237,.12); border-color: var(--p); color: var(--p); }

/* Helpdesk tickets */
.ticket-filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ticket-filter { padding: 4px 12px; border-radius: 20px; font-size: 12px; border: 1px solid var(--border); background: none; cursor: pointer; color: var(--muted); transition: all .15s; }
.ticket-filter.active { background: var(--p); border-color: var(--p); color: #fff; }
.ticket-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; transition: box-shadow .15s; }
.ticket-card:hover { box-shadow: var(--shadow); }
.ticket-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.ticket-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.ticket-priority.high   { background: var(--red); }
.ticket-priority.medium { background: var(--orange); }
.ticket-priority.low    { background: var(--green); }
.ticket-title { font-size: 14px; font-weight: 600; flex: 1; }
.ticket-status-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; flex-shrink: 0; }
.ticket-status-badge.open        { background: rgba(239,68,68,.1);  color: var(--red); }
.ticket-status-badge.in_progress { background: rgba(245,158,11,.1); color: var(--orange); }
.ticket-status-badge.resolved    { background: rgba(16,185,129,.1); color: var(--green); }
.ticket-meta { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.ticket-create-form { background: rgba(124,58,237,.04); border: 1px solid rgba(124,58,237,.12); border-radius: 12px; padding: 16px; margin-top: 16px; }
.ticket-create-form .biz-section-title { margin-bottom: 10px; }
.ticket-priority-btns { display: flex; gap: 6px; }
.ticket-prio-btn { flex: 1; padding: 6px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: none; cursor: pointer; transition: all .15s; }
.ticket-prio-btn.high.active   { background: rgba(239,68,68,.12);  border-color: var(--red);    color: var(--red); }
.ticket-prio-btn.medium.active { background: rgba(245,158,11,.12); border-color: var(--orange); color: var(--orange); }
.ticket-prio-btn.low.active    { background: rgba(16,185,129,.12); border-color: var(--green);  color: var(--green); }

/* API Docs */
.api-docs { font-family: -apple-system, sans-serif; }
.api-endpoint { background: rgba(0,0,0,.03); border-radius: 10px; padding: 14px; margin-bottom: 12px; border-left: 3px solid var(--p); }
.api-method { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-right: 8px; }
.api-method.GET    { background: rgba(16,185,129,.15); color: #059669; }
.api-method.POST   { background: rgba(124,58,237,.15); color: var(--p); }
.api-method.PATCH  { background: rgba(245,158,11,.15); color: var(--orange); }
.api-method.DELETE { background: rgba(239,68,68,.15);  color: var(--red); }
.api-path { font-size: 13px; font-family: monospace; font-weight: 600; }
.api-desc { font-size: 12px; color: var(--muted); margin-top: 6px; }
.api-code { background: #1e1e2e; color: #cdd6f4; border-radius: 8px; padding: 12px; font-size: 11px; font-family: monospace; margin-top: 8px; overflow-x: auto; white-space: pre; }
.code-copy-btn { float: right; font-size: 10px; background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.6); border-radius: 4px; padding: 2px 6px; cursor: pointer; margin-left: 8px; }
