/* GoldZone – Luxury Purple + Gold Theme */
:root, [data-theme="light"] {
  --bg-deep: #f4f0fb;
  --bg-app: #f4f0fb;
  --bg: #f4f0fb;
  --bg-panel: #ffffff;
  --bg-elevated: #efe8fb;
  --bg-hover: #e4d7fa;
  --border: rgba(124, 58, 237, 0.16);
  --border-strong: rgba(124, 58, 237, 0.32);
  --text: #2a1748;
  --text-muted: #5b4a78;
  --text-dim: #7c6b99;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-glow: rgba(124, 58, 237, 0.22);
  --gold: #b45309;
  --gold-dim: #92400e;
  --success: #059669;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', var(--font);
  --sidebar-w: 72px;
  --rooms-w: 260px;
  --users-w: 280px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--gold); }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(139, 92, 246, 0.25), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(251, 191, 36, 0.12), transparent),
    var(--bg-deep);
  z-index: 0;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.auth-card {
  background: rgba(26, 18, 41, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.logo-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #0f0a1a;
  box-shadow: 0 0 24px var(--primary-glow);
}

.logo-mark.small {
  width: 36px;
  height: 36px;
  font-size: 1rem;
  border-radius: 10px;
  margin: 0;
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }

.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }

.input-icon {
  position: relative;
}
.input-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}
.input-icon input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-icon input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-muted); }
.link-muted { color: var(--text-muted); }
.link-muted:hover { color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 6px 24px var(--primary-glow); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-block { width: 100%; }
.btn-send {
  background: var(--primary);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span { padding: 0 12px; }

.auth-switch { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text-muted); }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: var(--text-dim); }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: rgba(248, 113, 113, 0.15); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; }
.alert-success { background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); color: #6ee7b7; }

/* ---------- App Shell ---------- */
.app-body { height: 100vh; overflow: hidden; }

.app-shell {
  display: flex;
  height: 100%;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
}
.brand-text {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.65rem;
  transition: background 0.2s, color 0.2s;
}
.nav-item i { font-size: 1.2rem; }
.nav-item:hover, .nav-item.active {
  background: var(--bg-hover);
  color: var(--primary);
}
.nav-item.active { color: var(--gold); }

.sidebar-footer {
  width: 100%;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.user-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.user-mini .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}
.user-mini .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-mini-info { display: none; }
.logout-form { width: 100%; }
.logout { width: 100%; background: none; border: none; cursor: pointer; }

/* ---------- Chat Layout ---------- */
.main-content {
  flex: 1;
  display: flex;
  min-width: 0;
  height: 100%;
}

.chat-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  height: 100%;
}

.rooms-panel { width: var(--rooms-w); flex-shrink: 0; }
.chat-panel { flex: 1; min-width: 0; border-right: none; }
.users-panel { width: var(--users-w); flex-shrink: 0; border-right: none; border-left: 1px solid var(--border); }

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.room-list, .user-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background 0.15s;
  margin-bottom: 2px;
}
.room-item:hover { background: var(--bg-hover); }
.room-item.active {
  background: linear-gradient(90deg, rgba(167,139,250,0.15), transparent);
  border-left: 3px solid var(--primary);
}
.room-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.room-meta { flex: 1; min-width: 0; }
.room-meta strong { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta small { color: var(--text-dim); font-size: 0.75rem; }
.room-lock { color: var(--text-dim); font-size: 0.8rem; }

/* Chat header */
.chat-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.chat-title h1 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}
.topic { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--primary); }

/* Messages */
.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.msg-body {
  background: var(--bg-elevated);
  border-radius: 4px 16px 16px 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.msg-name { font-weight: 600; font-size: 0.9rem; }
.rank-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid;
  opacity: 0.9;
}
.msg-meta time { font-size: 0.7rem; color: var(--text-dim); margin-left: auto; }
.msg-content { font-size: 0.925rem; word-break: break-word; }

/* Composer */
.composer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer-inner:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
#message-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  padding: 8px 0;
  line-height: 1.4;
}
#message-input:focus { outline: none; }
#message-input::placeholder { color: var(--text-dim); }

/* User list */
.user-section { margin-bottom: 16px; }
.user-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 4px 8px 8px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  cursor: pointer;
}
.user-item:hover { background: var(--bg-hover); }

.user-item .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.user-item .avatar img { width: 100%; height: 100%; object-fit: cover; }

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
  background: var(--text-dim);
}
.online-dot.on {
  background: #22d3ee;
  box-shadow: 0 0 6px #22d3ee;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px #22d3ee; }
  50% { box-shadow: 0 0 10px #22d3ee; }
}

.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .mood { font-size: 0.7rem; color: var(--text-dim); }

.rank-pill {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
  flex-shrink: 0;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  gap: 12px;
}
.empty-state i { font-size: 2.5rem; opacity: 0.4; }

/* Mobile */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.mob-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 10px 16px;
  cursor: pointer;
}
.mob-btn.active { color: var(--gold); }

.mobile-only { display: none; }

@media (max-width: 900px) {
  .rooms-panel, .users-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .rooms-panel.open { transform: translateX(0); }
  .users-panel {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }
  .users-panel.open { transform: translateX(0); }

  .mobile-nav { display: flex; }
  .mobile-only { display: flex; }
  .app-shell { padding-bottom: 60px; }
  .sidebar { display: none; }
  .chat-panel { border: none; }
}

@media (max-width: 600px) {
  .rooms-panel, .users-panel { width: 85vw; max-width: 320px; }
  .message { max-width: 95%; }
}

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

/* Private Messages */
.pm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.pm-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pm-preview { display: block; color: var(--text-dim); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.message.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}
.message.mine .msg-body {
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(167,139,250,0.15));
  border-color: rgba(167,139,250,0.3);
  border-radius: 16px 4px 16px 16px;
}
.message.mine time { text-align: right; display: block; font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }
.message:not(.mine) time { display: block; font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }

.empty-hint {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.pm-list-panel .room-item .avatar { margin-right: 0; }

/* Page panels (wall, stories, games) */
.page-panel { flex:1; overflow-y:auto; padding:20px 24px; }
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.page-header h1 { font-family:var(--font-display); font-size:1.3rem; }

.composer-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; margin-bottom:20px;
}
.composer-card textarea {
  width:100%; background:var(--bg-elevated); border:1px solid var(--border); border-radius:10px;
  color:var(--text); padding:12px; font-family:inherit; resize:vertical; margin-bottom:10px;
}
.composer-card textarea:focus { outline:none; border-color:var(--primary); }

.wall-post {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; margin-bottom:12px;
}
.wall-post-header { display:flex; gap:12px; align-items:center; margin-bottom:10px; }
.wall-post-header .avatar {
  width:36px; height:36px; border-radius:50%; background:var(--bg-elevated);
  display:flex; align-items:center; justify-content:center; font-weight:600;
}
.wall-post-header time { display:block; font-size:.75rem; color:var(--text-dim); }
.wall-post-body { font-size:.95rem; margin-bottom:10px; word-break:break-word; }
.wall-post-actions { display:flex; gap:16px; align-items:center; font-size:.85rem; color:var(--text-muted); }

.stories-rail { display:flex; gap:12px; overflow-x:auto; padding-bottom:12px; }
.story-card {
  min-width:140px; max-width:160px; height:220px; border-radius:16px; padding:14px;
  display:flex; flex-direction:column; justify-content:flex-end; color:#fff; flex-shrink:0;
}
.story-author { font-weight:600; font-size:.85rem; margin-bottom:6px; }
.story-text { font-size:.9rem; flex:1; overflow:hidden; }
.story-meta { font-size:.7rem; opacity:.8; margin-top:8px; }

.games-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; }
.game-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px;
}
.game-card h3 { font-family:var(--font-display); margin-bottom:8px; }
.game-card p { color:var(--text-muted); font-size:.85rem; margin-bottom:12px; }
.rps-btns { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.game-result { margin-top:12px; font-weight:600; color:var(--gold); min-height:1.2em; }

.emoji-panel {
  position: absolute; bottom: 100%; left: 0; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px;
  display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; z-index: 40;
}
.emoji-item {
  background: none; border: none; font-size: 1.25rem; cursor: pointer;
  padding: 4px; border-radius: 6px;
}
.emoji-item:hover { background: var(--bg-hover); }

.msg-actions { display: none; gap: 4px; margin-top: 4px; }
.message:hover .msg-actions { display: flex; }
.msg-actions button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.75rem; padding: 2px 6px; border-radius: 4px;
}
.msg-actions button:hover { background: var(--bg-hover); color: var(--primary); }

.reply-bar {
  display: none; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--bg-elevated); border-radius: 8px; margin-bottom: 6px;
  font-size: 0.8rem; color: var(--text-muted);
}
.reply-preview {
  font-size: 0.8rem; color: var(--text-dim); border-left: 2px solid var(--primary);
  padding-left: 8px; margin-bottom: 4px;
}
.typing-indicator {
  font-size: 0.8rem; color: var(--text-dim); padding: 4px 20px; min-height: 1.2em;
}
.rule-card {
  display: flex; gap: 14px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
}
.rule-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.friend-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg-panel); border-radius: 10px; margin-bottom: 8px;
}
.msg-image { max-width: 240px; border-radius: 10px; margin-top: 6px; }

/* Phase 3 – Wallet / Gifts / VIP */
.wallet-balances { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:16px; }
.bal-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; display:flex; align-items:center; gap:12px;
}
.bal-card strong { display:block; font-size:1.3rem; font-family:var(--font-display); }
.bal-card small { color:var(--text-muted); font-size:.75rem; }
.bal-icon { font-size:1.75rem; }
.bal-card.gold { border-color:rgba(251,191,36,.3); }
.bal-card.ruby { border-color:rgba(239,68,68,.3); }
.bal-card.coins { border-color:rgba(167,139,250,.3); }

.vip-banner {
  background:linear-gradient(90deg,rgba(251,191,36,.2),rgba(167,139,250,.15));
  border:1px solid rgba(251,191,36,.4); border-radius:12px; padding:12px 16px; margin-bottom:16px;
  color:var(--gold);
}
.vip-banner.active { font-weight:600; }

.gift-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:12px; }
.gift-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:14px;
  padding:16px 12px; text-align:center; transition:transform .15s,border-color .15s;
}
.gift-card:hover { transform:translateY(-2px); border-color:var(--primary); }
.gift-card.vip-only { border-color:rgba(251,191,36,.35); }
.gift-icon { font-size:2.2rem; margin-bottom:8px; }
.gift-price { font-size:.8rem; color:var(--text-muted); margin:6px 0 10px; }

.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.modal-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:16px;
  padding:24px; width:100%; max-width:360px;
}
.modal-card .form-group { margin-bottom:12px; }
.modal-card label { display:block; font-size:.8rem; color:var(--text-muted); margin-bottom:4px; }
.modal-card input, .modal-card select {
  width:100%; padding:10px; background:var(--bg-elevated); border:1px solid var(--border);
  border-radius:8px; color:var(--text);
}

.gift-animation {
  position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center;
  font-size:5rem; pointer-events:none; animation:giftPop .8s ease;
  background:rgba(15,10,26,.5);
}
@keyframes giftPop {
  0% { transform:scale(.3); opacity:0; }
  50% { transform:scale(1.2); opacity:1; }
  100% { transform:scale(1); opacity:1; }
}

.vip-plans { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:16px; margin-top:16px; }
.vip-plan-card {
  background:var(--bg-panel); border:1px solid var(--border); border-radius:16px; padding:20px;
}
.vip-plan-card h3 { font-family:var(--font-display); color:var(--gold); margin-bottom:8px; }
.vip-price { font-size:1.5rem; font-weight:700; }
.vip-days { color:var(--text-muted); font-size:.85rem; margin-bottom:12px; }
.vip-features { list-style:none; margin-bottom:16px; font-size:.85rem; }
.vip-features li { padding:4px 0; color:var(--text-muted); }
.vip-features li::before { content:'✓ '; color:var(--success); }
.vip-plan-card select {
  width:100%; margin-bottom:10px; padding:8px; background:var(--bg-elevated);
  border:1px solid var(--border); border-radius:8px; color:var(--text);
}
.wallet-mini { font-size:.9rem; color:var(--text-muted); }
.gift-hist-item { padding:8px 0; border-bottom:1px solid var(--border); font-size:.9rem; }
.text-danger { color:var(--danger); }
.text-success { color:var(--success); }

@media (max-width:600px) {
  .wallet-balances { grid-template-columns:1fr; }
}

/* Phase 4 – Radio & Media */
.radio-hero {
  background: linear-gradient(135deg, rgba(236,72,153,.2), rgba(167,139,250,.15));
  border: 1px solid var(--border); border-radius: 16px; padding: 24px;
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between;
}
.radio-hero h2 { font-family: var(--font-display); margin-bottom: 8px; }
.live-badge {
  background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700;
  padding: 2px 8px; border-radius: 6px; margin-right: 6px; animation: pulse 1.5s infinite;
}
.off-badge {
  background: var(--bg-elevated); color: var(--text-muted); font-size: .65rem;
  font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 6px;
}
.radio-controls-lg { display: flex; align-items: center; gap: 12px; }
.dj-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dj-form input { padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.schedule-item {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 12px; background: var(--bg-panel); border-radius: 10px; margin-bottom: 8px;
  border: 1px solid var(--border);
}
.schedule-item small { color: var(--text-dim); width: 100%; }

.mini-radio {
  position: fixed; bottom: 70px; right: 16px; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px 6px 6px; box-shadow: var(--shadow);
}
.mini-radio button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; cursor: pointer;
}
.mini-radio button.playing { background: #ef4444; }
.mini-radio-label { font-size: .8rem; color: var(--text-muted); }

.gif-panel {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; max-height: 280px; overflow-y: auto; z-index: 50;
  margin-bottom: 8px;
}
.gif-search-row { display: flex; gap: 6px; margin-bottom: 8px; }
.gif-search-row input {
  flex: 1; padding: 8px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
}
.gif-search-row button {
  padding: 8px 12px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer;
}
.gif-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.gif-thumb { padding: 0; border: none; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.gif-thumb img { width: 100%; height: 70px; object-fit: cover; display: block; }

.msg-gif { max-width: 220px; border-radius: 10px; margin-top: 6px; }
.msg-audio { margin-top: 6px; max-width: 280px; }
.yt-embed {
  margin-top: 8px; position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 10px; max-width: 360px;
}
.yt-embed iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
#voice-btn.recording { color: #ef4444; animation: pulse 1s infinite; }

@media (min-width: 901px) {
  .mini-radio { bottom: 24px; }
}

/* Themes */
:root, [data-theme="dark"] {
  --bg: #0f0a1a; --bg-panel: #1a1229; --bg-elevated: #241833; --bg-hover: #2d2040;
  --text: #f3eefc; --text-muted: #a89bbf; --text-dim: #7a6d94;
  --primary: #a78bfa; --gold: #fbbf24; --border: rgba(167,139,250,.18);
}
[data-theme="light"] {
  --bg: #f5f3fa; --bg-panel: #ffffff; --bg-elevated: #efeaf8; --bg-hover: #e4dcf4;
  --text: #1a1229; --text-muted: #5c5270; --text-dim: #8a8199;
  --primary: #7c3aed; --gold: #d97706; --border: rgba(124,58,237,.15);
}
[data-theme="purple"] {
  --bg: #1a0a2e; --bg-panel: #2d1b4e; --bg-elevated: #3b2663; --bg-hover: #4a327a;
  --text: #fce7ff; --text-muted: #d8b4fe; --text-dim: #c084fc;
  --primary: #e879f9; --gold: #f0abfc; --border: rgba(232,121,249,.25);
}
[data-theme="midnight"] {
  --bg: #020617; --bg-panel: #0f172a; --bg-elevated: #1e293b; --bg-hover: #334155;
  --text: #e2e8f0; --text-muted: #94a3b8; --text-dim: #64748b;
  --primary: #38bdf8; --gold: #fbbf24; --border: rgba(56,189,248,.2);
}

.theme-picker { display:flex; flex-wrap:wrap; gap:8px; }
.theme-swatch {
  padding:10px 16px; border-radius:10px; border:2px solid var(--border);
  background:var(--bg-elevated); color:var(--text); cursor:pointer;
}
.theme-swatch.active { border-color:var(--primary); box-shadow:0 0 0 2px var(--primary); }
#notif-badge {
  display:none; min-width:18px; height:18px; border-radius:9px; background:#ef4444;
  color:#fff; font-size:.65rem; align-items:center; justify-content:center; padding:0 5px;
  margin-left:4px;
}
.alert { padding:10px 14px; border-radius:8px; margin-bottom:12px; }
.alert.success { background:rgba(34,197,94,.15); color:#4ade80; }
.alert.error { background:rgba(239,68,68,.15); color:#f87171; }

/* ===== Phase 7 – Layout / Responsive fixes ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 35;
}
.sidebar-overlay.open { display: block; }

.page-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 80px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--primary); }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
}
.empty-hint { color: var(--text-dim); padding: 20px 0; }

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.admin-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.admin-card h3 { margin-bottom: 12px; font-family: var(--font-display); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }

/* Mobile: hide left rail, use drawer */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px !important;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform .25s ease;
    align-items: stretch !important;
    padding: 16px 0;
    z-index: 40;
    display: flex !important;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand-text { display: block; }
  .sidebar-nav { align-items: stretch; padding: 0 12px; }
  .nav-item {
    flex-direction: row !important;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    font-size: .9rem;
  }
  .nav-item i { font-size: 1.1rem; width: 22px; text-align: center; }
  .user-mini {
    flex-direction: row !important;
    width: 100%;
    padding: 0 12px;
    gap: 10px;
    text-align: left;
  }
  .user-mini-info { display: block !important; }
  .mobile-nav {
    display: flex !important;
  }
  .mobile-nav .mob-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: .65rem;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    padding: 8px;
  }
  .mobile-nav .mob-btn i { font-size: 1.15rem; }
  .app-shell { padding-bottom: 64px; }
  .page-panel { padding: 16px 14px 90px; }
  .mini-radio { display: none !important; }
}

@media (min-width: 901px) {
  .mobile-nav { display: none !important; }
  .sidebar-overlay { display: none !important; }
  .sidebar {
    transform: none !important;
    width: var(--sidebar-w);
  }
}

/* Search page */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-box input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
}
.search-results { display: flex; flex-direction: column; gap: 8px; }
.search-hit {
  padding: 12px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Profile */
.profile-hero {
  background: linear-gradient(135deg, rgba(167,139,250,.25), rgba(251,191,36,.1));
  border-radius: 16px;
  padding: 28px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.profile-avatar-lg {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  overflow: hidden;
  border: 3px solid var(--primary);
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

/* Stickers */
.sticker-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  max-height: 120px;
  overflow-y: auto;
}
.sticker-btn {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.sticker-btn:hover { background: var(--bg-hover); }

/* Mention highlight */
.mention { color: var(--gold); font-weight: 600; }

/* ===== Phase 8 – Mobile chat box fix ===== */
.chat-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.composer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  position: relative;
  z-index: 5;
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 8px;
}
#message-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  resize: none;
  min-height: 24px;
  max-height: 120px;
  font: inherit;
  padding: 8px 4px;
  outline: none;
}

@media (max-width: 900px) {
  .chat-layout {
    position: relative;
    height: 100%;
    overflow: hidden;
  }
  .chat-panel {
    width: 100% !important;
    flex: 1 1 100%;
    height: 100%;
    z-index: 1;
  }
  .rooms-panel,
  .users-panel {
    position: fixed !important;
    top: 0;
    bottom: 64px;
    width: min(320px, 88vw) !important;
    z-index: 45;
    background: var(--bg-panel);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease;
  }
  .rooms-panel {
    left: 0;
    transform: translateX(-110%);
  }
  .rooms-panel.open {
    transform: translateX(0);
  }
  .users-panel {
    right: 0;
    left: auto;
    transform: translateX(110%);
  }
  .users-panel.open {
    transform: translateX(0);
  }
  .mobile-only {
    display: inline-flex !important;
  }
  .chat-header {
    padding: 10px 12px;
    gap: 8px;
  }
  .chat-title h1 {
    font-size: 1rem;
  }
  .message-list {
    padding: 10px 12px;
    padding-bottom: 8px;
  }
  .composer {
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .app-shell {
    height: 100dvh;
    height: 100vh;
    padding-bottom: 64px;
  }
  .main-content {
    height: 100%;
  }
  .message {
    max-width: 92%;
  }
  .panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 64px;
    background: rgba(0,0,0,.45);
    z-index: 40;
  }
  .panel-backdrop.show {
    display: block;
  }
}

/* User list sections */
.user-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  padding: 10px 12px 4px;
  font-weight: 600;
}
.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 2px;
}
.user-item:hover { background: var(--bg-hover); }
.user-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.user-item .avatar img { width: 100%; height: 100%; object-fit: cover; }
.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  border: 2px solid var(--bg-panel);
}
.online-dot.on {
  background: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56,189,248,.5);
  animation: pulse-online 2s infinite;
}
@keyframes pulse-online {
  0% { box-shadow: 0 0 0 0 rgba(56,189,248,.5); }
  70% { box-shadow: 0 0 0 6px rgba(56,189,248,0); }
  100% { box-shadow: 0 0 0 0 rgba(56,189,248,0); }
}
.badge-vip {
  font-size: .6rem;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #1a1229;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.badge-staff {
  font-size: .6rem;
  background: rgba(167,139,250,.25);
  color: #a78bfa;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.welcome-banner {
  margin: 8px 16px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(167,139,250,.2), rgba(251,191,36,.1));
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .9rem;
}

/* —— Shared page forms (settings, wallet, gifts, vip, radio, calls) —— */
.page-panel .form-group,
.admin-card .form-group {
  margin-bottom: 14px;
  display: block;
  width: 100%;
  max-width: 420px;
}
.page-panel .form-group label,
.admin-card .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: .8rem;
  color: var(--text-muted, #94a3b8);
}
.page-panel input[type="text"],
.page-panel input[type="password"],
.page-panel input[type="number"],
.page-panel input[type="email"],
.page-panel input[type="url"],
.page-panel select,
.page-panel textarea,
.admin-card input[type="text"],
.admin-card input[type="password"],
.admin-card input[type="number"],
.admin-card input[type="email"],
.admin-card input[type="url"],
.admin-card select,
.admin-card textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--bg-elevated, #241a36);
  border: 1px solid rgba(167,139,250,.25);
  border-radius: 10px;
  color: var(--text, #e2e8f0);
  font-size: .9rem;
}

/* Gift shop grid */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 8px 0 24px;
}
.gift-card {
  background: var(--bg-panel, #1a1229);
  border: 1px solid rgba(167,139,250,.15);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}
.gift-card .gift-icon { font-size: 2rem; margin-bottom: 8px; }
.gift-card .gift-name { font-weight: 600; margin-bottom: 4px; }
.gift-card .gift-price { color: var(--gold, #fbbf24); font-size: .85rem; margin-bottom: 10px; }
.gift-card .btn { width: 100%; justify-content: center; }

/* VIP cards */
.vip-plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.vip-card {
  background: var(--bg-panel, #1a1229);
  border: 1px solid rgba(167,139,250,.2);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vip-card h3 { margin: 0; font-family: var(--font-display, Outfit, sans-serif); }
.vip-card .btn {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  margin-top: auto;
}

/* Message actions — compact icons */
.msg-actions {
  display: none;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.message:hover .msg-actions,
.message:focus-within .msg-actions,
.message.show-actions .msg-actions {
  display: flex;
}
.msg-actions button {
  border: 1px solid rgba(167,139,250,.2);
  background: var(--bg-elevated, #241a36);
  color: var(--text-muted, #94a3b8);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: .7rem;
  cursor: pointer;
  line-height: 1.2;
}
.msg-actions button:hover {
  color: #a78bfa;
  border-color: rgba(167,139,250,.45);
}

/* Mobile bottom nav — icon first */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: rgba(15, 10, 26, .96);
  border-top: 1px solid rgba(167,139,250,.15);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  backdrop-filter: blur(12px);
}
.bottom-nav a,
.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #64748b;
  background: none;
  border: none;
  font-size: .65rem;
  text-decoration: none;
  padding: 6px 2px;
  min-width: 0;
}
.bottom-nav a i,
.bottom-nav button i {
  font-size: 1.15rem;
}
.bottom-nav a.active,
.bottom-nav button.active {
  color: #a78bfa;
}
.bottom-nav .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* User list clickable */
.user-row {
  cursor: pointer;
  border-radius: 10px;
  padding: 8px;
  transition: background .15s;
}
.user-row:hover { background: rgba(167,139,250,.08); }

/* User action sheet */
.user-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 80;
  display: none;
}
.user-sheet-backdrop.open { display: block; }
.user-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(420px, 100%);
  background: var(--bg-panel, #ffffff);
  border-radius: 16px 16px 0 0;
  border: 1px solid rgba(167,139,250,.2);
  padding: 18px;
  z-index: 81;
  display: none;
  max-height: 80vh;
  overflow-y: auto;
}
.user-sheet.open { display: block; }
.user-sheet h3 { margin: 0 0 8px; }
.user-sheet .sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.user-sheet .sheet-actions .btn { width: 100%; justify-content: center; }

@media (max-width: 900px) {
  .bottom-nav { display: flex; }
  .chat-layout,
  .shell-chat {
    padding-bottom: 0;
  }
  .composer {
    bottom: 56px !important;
  }
  .msg-actions {
    display: flex !important;
  }
  .msg-actions button {
    padding: 6px 8px;
    font-size: .65rem;
  }
  /* Hide text labels on very small screens — icons only */
  .bottom-nav .nav-label { display: none; }
  .bottom-nav a i,
  .bottom-nav button i { font-size: 1.25rem; }
}
@media (min-width: 380px) and (max-width: 900px) {
  .bottom-nav .nav-label { display: block; font-size: .6rem; }
}

/* ========== LAYOUT RECOVERY (critical) ========== */
.chat-layout {
  display: grid !important;
  grid-template-columns: 260px 1fr 280px;
  height: calc(100vh - 0px);
  min-height: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
}
.chat-layout > .panel {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-panel {
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-deep, #f4f0fb);
}
.message-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
  min-height: 0;
}
.composer {
  flex: 0 0 auto;
  position: relative !important;
  bottom: auto !important;
  padding: 10px 12px;
  border-top: 1px solid rgba(167,139,250,.15);
  background: var(--bg-panel, #1a1229);
  z-index: 5;
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--bg-elevated, #241a36);
  border: 1px solid rgba(167,139,250,.2);
  border-radius: 14px;
  padding: 6px 8px;
}
.composer-inner textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: #e2e8f0;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 8px;
  font-size: .95rem;
}
.composer-inner textarea:focus { outline: none; }

/* User action MODAL — never a layout column */
.user-modal-backdrop {
  position: fixed !important;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
}
.user-modal {
  position: fixed !important;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  width: min(400px, calc(100vw - 24px));
  max-height: 80vh;
  overflow: auto;
}
.user-modal[hidden],
.user-modal-backdrop[hidden],
.panel-backdrop[hidden] {
  display: none !important;
}
.user-modal-inner {
  background: #ffffff;
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(88,40,160,.16);
  color: #2a1748;
}
.user-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}
.user-modal-actions .btn {
  justify-content: center;
  width: 100%;
}
.btn-block { width: 100%; justify-content: center; }

.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
}

/* Kill old broken sheet styles */
.user-sheet,
.user-sheet-backdrop {
  display: none !important;
}

@media (max-width: 960px) {
  .chat-layout {
    grid-template-columns: 1fr !important;
  }
  .rooms-panel,
  .users-panel {
    position: fixed !important;
    top: 0;
    bottom: 56px;
    width: min(300px, 88vw);
    z-index: 45;
    background: var(--bg-panel, #1a1229);
    transform: translateX(-110%);
    transition: transform .25s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.4);
  }
  .users-panel {
    right: 0;
    left: auto;
    transform: translateX(110%);
  }
  .rooms-panel.open,
  .users-panel.open {
    transform: translateX(0) !important;
  }
  .chat-panel {
    width: 100%;
    height: 100%;
  }
  .composer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    margin-bottom: 0; /* gap removed */
  }
  .mobile-only { display: inline-flex !important; }
  .bottom-nav { display: flex !important; }
}

@media (min-width: 961px) {
  .mobile-only { display: none !important; }
  .bottom-nav { display: none !important; }
  .panel-backdrop { display: none !important; }
}

/* ===== Rooms panel: scrollable menu + rooms ===== */
.rooms-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rooms-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(167,139,250,.12);
}
.rooms-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 20px;
  min-height: 0;
}
.menu-heading {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  margin: 12px 6px 6px;
}
.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text, #2a1748);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
}
.menu-link i { width: 18px; text-align: center; color: #94a3b8; }
.menu-link:hover { background: rgba(167,139,250,.1); color: #fff; }
.menu-section { margin-bottom: 8px; }

/* Desktop collapse rooms column */
@media (min-width: 961px) {
  body.rooms-collapsed .chat-layout {
    grid-template-columns: 0 1fr 280px !important;
  }
  body.rooms-collapsed .rooms-panel {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    border: none !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
  }
  #close-rooms { display: none; }
}

/* Mobile drawers — high z-index, always closable */
@media (max-width: 960px) {
  .panel-backdrop {
    position: fixed !important;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 90 !important;
    display: none;
  }
  .panel-backdrop:not([hidden]) {
    display: block !important;
  }
  .rooms-panel,
  .users-panel {
    position: fixed !important;
    top: 0;
    bottom: 56px;
    width: min(320px, 90vw) !important;
    z-index: 95 !important;
    background: var(--bg-panel, #ffffff) !important;
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.5);
  }
  .rooms-panel {
    left: 0;
    transform: translateX(-105%);
  }
  .users-panel {
    right: 0;
    left: auto;
    transform: translateX(105%);
  }
  .rooms-panel.open,
  .users-panel.open {
    transform: translateX(0) !important;
  }
  .users-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .bottom-nav {
    z-index: 100 !important;
    pointer-events: auto !important;
  }
  .bottom-nav a,
  .bottom-nav button {
    pointer-events: auto !important;
    cursor: pointer;
  }
  /* When panel open, bottom nav still works */
  .composer {
    margin-bottom: 0;
  }
}

/* ===== ONE left menu on chat (hide icon rail) ===== */
body.chat-page .sidebar {
  display: none !important;
}
body.chat-page .sidebar-overlay {
  display: none !important;
}
body.chat-page .app-shell {
  display: block !important;
}
body.chat-page .app-main,
body.chat-page .main-content,
body.chat-page .content {
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}
body.chat-page .chat-layout {
  height: 100vh;
  height: 100dvh;
}

.rooms-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rooms-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rooms-brand strong {
  font-family: Outfit, sans-serif;
  font-size: 1rem;
}

/* Overlay must NEVER block when closed */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  display: none !important;
  pointer-events: none !important;
}
body.panel-open .panel-backdrop {
  display: block !important;
  pointer-events: auto !important;
}
.user-modal-backdrop {
  display: none;
  pointer-events: none;
}
.user-modal-backdrop[aria-hidden="false"] {
  display: block !important;
  pointer-events: auto !important;
}

@media (max-width: 960px) {
  body.panel-open {
    overflow: hidden;
  }
  /* only show overlay on mobile when panel-open */
  body.panel-open .panel-backdrop {
    display: block !important;
    pointer-events: auto !important;
  }
}
@media (min-width: 961px) {
  /* never grey overlay on desktop */
  .panel-backdrop {
    display: none !important;
    pointer-events: none !important;
  }
  body.panel-open .panel-backdrop {
    display: none !important;
  }
  #close-rooms {
    display: none; /* desktop uses header hamburger to collapse */
  }
  body.rooms-collapsed #close-rooms {
    display: none;
  }
}

/* ===== MOBILE FINAL (v6) — clear chat, working nav ===== */
#panel-backdrop.panel-backdrop,
.panel-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,.4) !important;
  z-index: 90 !important;
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
#panel-backdrop.show,
.panel-backdrop.show,
body.panel-open #panel-backdrop {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58px;
  z-index: 100;
  background: #120c1f;
  border-top: 1px solid rgba(167,139,250,.2);
  justify-content: space-around;
  align-items: center;
  padding: 0 4px env(safe-area-inset-bottom);
}
.mobile-nav .mob-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: .65rem;
  text-decoration: none;
  padding: 8px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav .mob-btn i { font-size: 1.2rem; }
.mobile-nav .mob-btn:active { color: #a78bfa; }

@media (max-width: 960px) {
  .mobile-nav { display: none !important; }
  body.chat-page .main-content {
    padding-bottom: 0 !important;
  }
  .chat-layout {
    height: calc(100dvh - 58px) !important;
  }
  .composer {
    margin-bottom: 0 !important;
    padding-bottom: 8px !important;
  }
  .rooms-panel,
  .users-panel {
    z-index: 95 !important;
    bottom: 58px !important;
  }
  /* Chat stays bright when closed */
  body:not(.panel-open) .chat-panel {
    filter: none !important;
    opacity: 1 !important;
  }
}

@media (min-width: 961px) {
  .mobile-nav { display: none !important; }
  #panel-backdrop { display: none !important; opacity: 0 !important; }
}

/* Chat must fill viewport so message-list can scroll to last msg */
html, body.app-body.chat-page {
  height: 100%;
  overflow: hidden;
}
body.app-body:not(.chat-page) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
body.chat-page .main-content {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.chat-page .chat-layout {
  flex: 1;
  height: 100% !important;
  max-height: 100%;
  min-height: 0;
}
body.chat-page .chat-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex !important;
  flex-direction: column !important;
}
body.chat-page .message-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
body.chat-page .composer {
  flex: 0 0 auto !important;
}
@media (max-width: 960px) {
  body.chat-page .chat-layout {
    height: calc(100% - 58px) !important;
  }
}

/* Remove gap between composer and mobile bottom bar */
@media (max-width: 960px) {
  body.chat-page .composer {
    margin-bottom: 0 !important;
    padding-bottom: 8px !important;
  }
  body.chat-page .chat-layout {
    height: calc(100dvh - 56px) !important;
    max-height: calc(100dvh - 56px) !important;
  }
  body.chat-page .main-content {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  .mobile-nav {
    height: 56px !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
  }
  body.chat-page .message-list {
    padding-bottom: 8px !important;
  }
}

/* ===== Composer + menu (media tools) ===== */
.composer-plus-wrap {
  position: relative;
  flex-shrink: 0;
}
.composer-plus {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
  background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.25);
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.composer-plus.open {
  transform: rotate(45deg);
  background: rgba(167,139,250,.25);
  color: #c4b5fd;
}
.composer-tools {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid rgba(124,58,237,.28);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(88,40,160,.16);
  z-index: 30;
}
.composer-tools[hidden] {
  display: none !important;
}
.composer-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #2a1748;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.composer-tool:hover {
  background: #efe8fb;
  color: #5b21b6;
}
.composer-tool i,
.composer-tool .gif-label,
.composer-tool span {
  color: #5b21b6;
}
.composer-tool i,
.composer-tool .gif-label {
  width: 20px;
  text-align: center;
}
.composer-tool .gif-label {
  font-size: .65rem;
  font-weight: 800;
  display: inline-block;
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.composer-inner #message-input {
  flex: 1;
  min-width: 0;
}

/* ===== ZERO gap: composer sits on mobile-nav ===== */
@media (max-width: 960px) {
  .composer,
  body.chat-page .composer,
  .chat-panel .composer,
  footer.composer {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 8px !important;
    padding-top: 8px !important;
    position: relative !important;
    bottom: auto !important;
    border-bottom: none !important;
  }
  body.chat-page .main-content {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  body.chat-page .chat-layout {
    height: calc(100dvh - 56px) !important;
    max-height: calc(100dvh - 56px) !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  .mobile-nav {
    height: 56px !important;
    margin: 0 !important;
    padding: 0 4px !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    border-top: 1px solid rgba(167,139,250,.2);
  }
  body.chat-page .message-list {
    padding-bottom: 4px !important;
  }
}

/* Profile menu button (top-right) */
.profile-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(167,139,250,.45);
  padding: 0;
  overflow: hidden;
  background: #241a36;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-menu-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-menu-float {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  width: 40px;
  height: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.chat-header .profile-menu-btn {
  margin-left: 6px;
}

.profile-dropdown-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 120;
}
.profile-dropdown-backdrop[hidden] { display: none !important; }

.profile-dropdown {
  position: fixed;
  top: 56px;
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  background: var(--bg-panel, #ffffff);
  border: 1px solid rgba(167,139,250,.25);
  border-radius: 16px;
  z-index: 121;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  overflow: hidden;
}
.profile-dropdown[hidden] { display: none !important; }
.pd-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(167,139,250,.12);
}
.pd-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #241a36;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-edit {
  display: block;
  font-size: .8rem;
  color: #a78bfa;
  text-decoration: none;
}
.pd-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.pd-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.pd-nav a,
.pd-onair,
.pd-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  color: #e2e8f0;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  font-size: .95rem;
  cursor: pointer;
  text-align: left;
}
.pd-nav a i,
.pd-onair-ico,
.pd-logout i { width: 20px; color: #a78bfa; text-align: center; display:inline-flex; align-items:center; justify-content:center; }
.pd-onair { color: #2a1748; }
.pd-nav a:hover,
.pd-onair:hover,
.pd-logout:hover { background: rgba(167,139,250,.1); }
.pd-divider {
  height: 1px;
  background: rgba(167,139,250,.12);
  margin: 6px 8px;
}
.pd-logout { color: #f87171; }
.pd-logout i { color: #f87171; }

/* Unique welcome card */
.welcome-card {
  position: relative;
  margin: 10px 14px 6px;
  padding: 14px 16px 14px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(251,191,36,.08));
  border: 1px solid rgba(167,139,250,.28);
  color: #e2e8f0;
  font-size: .92rem;
  line-height: 1.45;
}
.welcome-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.welcome-card p { margin: 0; color: var(--text, #2a1748); }
.welcome-card strong { color: #fbbf24; }
.welcome-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 960px) {
  .profile-dropdown {
    top: auto;
    bottom: 64px;
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* ===== Profile page – responsive (mobile → desktop) ===== */
.profile-page {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px !important;
  overflow-x: hidden;
}
.profile-shell {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  box-sizing: border-box;
}
.profile-card {
  background: rgba(26, 18, 41, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.profile-cover {
  width: 100%;
  height: 140px;
  background-size: cover;
  background-position: center;
  border: none;
  margin: 0;
  border-radius: 0;
}
.profile-cover-empty {
  background: linear-gradient(135deg, #2d1b4e 0%, #1a1229 55%, #3b2066 100%);
}
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 0 16px 20px;
  margin-top: -48px;
}
.profile-avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #241a36;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  overflow: hidden;
  border: 4px solid #1a1229;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.45);
  flex-shrink: 0;
}
.profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-main {
  width: 100%;
  min-width: 0;
}
.profile-main h1 {
  margin: 0 0 4px;
  font-family: Outfit, system-ui, sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  word-break: break-word;
}
.profile-meta {
  color: #94a3b8;
  margin: 0 0 8px;
  font-size: 0.9rem;
}
.profile-rank {
  margin-left: 6px;
  font-weight: 600;
}
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.profile-stats span {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--text, #2a1748);
}
.profile-stats .is-online { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.profile-stats .is-offline { color: #94a3b8; }
.profile-mood,
.profile-bio,
.profile-extra {
  margin: 6px 0;
  color: #e2e8f0;
  line-height: 1.45;
  word-break: break-word;
}
.profile-bio { color: var(--text, #2a1748); }
.profile-joined {
  font-size: 0.8rem;
  color: #64748b;
  margin: 8px 0 0;
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.profile-badges,
.profile-gifts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.badge-chip {
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
}
.profile-edit-card {
  margin-top: 20px;
  background: rgba(26, 18, 41, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 18px;
  padding: 18px 16px 20px;
  width: 100%;
  box-sizing: border-box;
}
.profile-edit-card h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}
.profile-form .form-group {
  margin-bottom: 14px;
  width: 100%;
}
.profile-form label {
  display: block;
  margin-bottom: 6px;
  color: #94a3b8;
  font-size: 0.8rem;
}
.profile-form input[type="text"],
.profile-form input[type="file"],
.profile-form textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  background: #241a36;
  color: #e2e8f0;
  font-size: 0.95rem;
}
.profile-form .form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 16px;
}
.profile-form .btn-primary {
  width: 100%;
  max-width: 280px;
  padding: 12px 18px;
  background: #8b5cf6;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.flash-ok {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.flash-err {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* Tablet */
@media (min-width: 640px) {
  .profile-page { padding: 20px !important; }
  .profile-cover { height: 180px; }
  .profile-hero {
    flex-direction: row;
    align-items: flex-end;
    text-align: left;
    padding: 0 24px 24px;
    margin-top: -56px;
  }
  .profile-avatar-lg {
    width: 112px;
    height: 112px;
  }
  .profile-stats,
  .profile-actions,
  .profile-badges,
  .profile-gifts {
    justify-content: flex-start;
  }
  .profile-form .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .profile-edit-card {
    padding: 22px 24px 24px;
  }
}

/* Laptop / desktop */
@media (min-width: 1024px) {
  .profile-page { padding: 28px 32px !important; }
  .profile-shell { max-width: 960px; }
  .profile-cover { height: 220px; }
  .profile-avatar-lg {
    width: 128px;
    height: 128px;
    font-size: 2.6rem;
  }
  .profile-hero {
    padding: 0 28px 28px;
    margin-top: -64px;
    gap: 22px;
  }
}

/* Wide screens – keep content readable, not stretched edge-to-edge */
@media (min-width: 1280px) {
  .profile-shell { max-width: 1000px; }
}

/* Profile page should scroll (not locked like chat) */
body:not(.chat-page) .main-content {
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
  padding-bottom: 40px;
}
body:not(.chat-page) {
  overflow-y: auto !important;
  height: auto !important;
}

/* ===== FIX: Profile (and non-chat pages) must SCROLL ===== */
body.app-body:not(.chat-page) {
  height: auto !important;
  min-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
body.app-body:not(.chat-page) .app-shell {
  height: auto !important;
  min-height: 100vh !important;
  overflow: visible !important;
}
body.app-body:not(.chat-page) .main-content {
  height: auto !important;
  min-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  flex: 1 1 auto !important;
}
body.app-body:not(.chat-page) .page-panel {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
  padding-bottom: 48px !important;
}

/* Profile: ensure edit form is fully reachable */
.profile-page {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  padding-bottom: 64px !important;
}
.profile-shell {
  height: auto !important;
  overflow: visible !important;
  padding-bottom: 32px;
}
.profile-edit-card {
  margin-bottom: 40px !important;
}

/* Desktop: keep shell as flex row but allow main to grow/scroll with body */
@media (min-width: 961px) {
  body.app-body:not(.chat-page) .app-shell {
    display: flex !important;
    align-items: flex-start !important;
  }
  body.app-body:not(.chat-page) .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    flex-shrink: 0 !important;
  }
  body.app-body:not(.chat-page) .main-content {
    flex: 1 1 auto !important;
    width: 0 !important; /* flex grow */
    min-width: 0 !important;
  }
}

/* ===== Profile / settings scroll — scrollbar on RIGHT main panel ===== */
body.app-body:not(.chat-page),
body.app-body.profile-route {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}
body.app-body:not(.chat-page) .app-shell,
body.app-body.profile-route .app-shell {
  height: 100% !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  display: flex !important;
}
body.app-body:not(.chat-page) .main-content,
body.app-body.profile-route .main-content {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important; /* force scrollbar track */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
body.app-body:not(.chat-page) .page-panel,
body.app-body.profile-route .page-panel,
body.app-body:not(.chat-page) .profile-page {
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
  padding-bottom: 100px !important;
}
body.app-body:not(.chat-page) .profile-shell {
  padding-bottom: 48px !important;
}
body.app-body:not(.chat-page) .profile-edit-card {
  display: block !important;
  visibility: visible !important;
  margin-bottom: 80px !important;
  padding-bottom: 24px !important;
}

/* Visible scrollbar styling (desktop) */
body.app-body:not(.chat-page) .main-content::-webkit-scrollbar {
  width: 10px;
}
body.app-body:not(.chat-page) .main-content::-webkit-scrollbar-track {
  background: rgba(15, 10, 26, 0.6);
}
body.app-body:not(.chat-page) .main-content::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.45);
  border-radius: 8px;
}
body.app-body:not(.chat-page) .main-content::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.7);
}

/* Chat: message-list MUST be the scroll container with fixed flex height */
body.chat-page .app-shell {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}
body.chat-page .main-content {
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}
body.chat-page .chat-layout {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
}
body.chat-page .chat-panel {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
body.chat-page .chat-header {
  flex: 0 0 auto !important;
}
body.chat-page .message-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
body.chat-page .composer {
  flex: 0 0 auto !important;
}
@media (max-width: 960px) {
  body.chat-page .chat-layout {
    height: calc(100dvh - 56px) !important;
    max-height: calc(100dvh - 56px) !important;
  }
}

/* Notification bell */
.notif-bell {
  position: fixed;
  top: 12px;
  right: 60px;
  z-index: 70;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(167,139,250,.35);
  background: rgba(26,18,41,.92);
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.chat-header .notif-bell { position: static; margin-right: 6px; box-shadow: none; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1a1229;
}
.notif-panel {
  position: fixed;
  top: 58px;
  right: 12px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  background: var(--bg-panel, #ffffff);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 16px;
  z-index: 80;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel[hidden] { display: none !important; }
.notif-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(167,139,250,.15);
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(167,139,250,.08);
  color: #e2e8f0;
  text-decoration: none;
}
.notif-item:hover { background: rgba(167,139,250,.1); }
.notif-item strong { display: block; font-size: .9rem; margin-bottom: 2px; }
.notif-item span { display: block; font-size: .8rem; color: #94a3b8; }
.notif-item time { font-size: .7rem; color: #64748b; }

/* Toasts */
.toast-host {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(30,22,48,.97), rgba(20,14,36,.98));
  border: 1px solid rgba(167,139,250,.35);
  box-shadow: 0 16px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04) inset;
  color: #e2e8f0;
  opacity: 0;
  transform: translateY(-12px) scale(.98);
  transition: opacity .28s ease, transform .28s ease;
  backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: #a78bfa;
  box-shadow: 0 0 12px rgba(167,139,250,.8);
}
.toast-success { border-color: rgba(52,211,153,.45); }
.toast-success .toast-icon { background: #34d399; box-shadow: 0 0 12px rgba(52,211,153,.8); }
.toast-warn { border-color: rgba(251,191,36,.45); }
.toast-warn .toast-icon { background: #fbbf24; box-shadow: 0 0 12px rgba(251,191,36,.8); }
.toast-error { border-color: rgba(248,113,113,.5); }
.toast-error .toast-icon { background: #f87171; box-shadow: 0 0 12px rgba(248,113,113,.8); }
.toast-body { flex: 1; min-width: 0; }
.toast-body strong { display: block; font-size: .92rem; margin-bottom: 2px; }
.toast-body span { display: block; font-size: .8rem; color: #94a3b8; line-height: 1.35; }
.toast-x {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
@media (max-width: 960px) {
  .notif-bell { top: 10px; right: 56px; }
  .toast-host { top: auto; bottom: 72px; }
}

/* DM unread badges */
.nav-item { position: relative; }
.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1.5px solid #1a1229;
}
.mob-btn { position: relative; }
.mob-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #0f0a1a;
}

/* DM badge – always visible when .show (desktop sidebar + mobile) */
.nav-item {
  position: relative !important;
  overflow: visible !important;
}
.nav-badge {
  position: absolute !important;
  top: 2px !important;
  right: 4px !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #f43f5e, #e11d48) !important;
  color: #fff !important;
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  border: 2px solid #1a1229 !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.55) !important;
  z-index: 5 !important;
  pointer-events: none !important;
}
.nav-badge.show {
  display: flex !important;
}
.sidebar-nav {
  overflow: visible !important;
}
.mob-btn {
  position: relative !important;
  overflow: visible !important;
}
.mob-badge {
  position: absolute !important;
  top: 0 !important;
  right: calc(50% - 20px) !important;
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 4px !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #f43f5e, #e11d48) !important;
  color: #fff !important;
  font-size: 0.58rem !important;
  font-weight: 800 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1.5px solid #0f0a1a !important;
  z-index: 5 !important;
}
.mob-badge.show {
  display: flex !important;
}


/* Navigate menu – Messages unread counter (chat left panel) */
.menu-link-dm,
.menu-link#menu-dm {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-dm-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #1a1229;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.5);
  line-height: 1;
}
.menu-dm-badge.show {
  display: flex !important;
}

/* Chat header actions: DM + Notif + Users + Profile */
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.header-dm-btn {
  position: relative;
  text-decoration: none;
  color: inherit;
}
.header-dm-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #1a1229;
}
.header-dm-badge.show {
  display: flex !important;
}
.chat-header .notif-bell.header-notif {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  box-shadow: none;
}
.chat-header .profile-menu-btn {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  margin: 0;
}

/* Desktop: Navigate closed by default (rooms-collapsed) */
@media (min-width: 961px) {
  body.chat-page.rooms-collapsed .chat-layout {
    grid-template-columns: 0 minmax(0, 1fr) 280px !important;
  }
  body.chat-page.rooms-collapsed .rooms-panel {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    border: none !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
  }
  body.chat-page:not(.rooms-collapsed) .rooms-panel {
    opacity: 1;
    pointer-events: auto;
  }
  body.chat-page .users-panel {
    display: flex !important;
    width: 280px !important;
    min-width: 280px !important;
  }
  /* When navigate open, overlay style optional drawer from left */
  body.chat-page:not(.rooms-collapsed) .rooms-panel {
    width: var(--rooms-w, 260px) !important;
    max-width: 280px !important;
  }
}

/* Stickers / custom emoji panels */
.emoji-panel, .sticker-bar, .custom-emoji-panel {
  position: absolute;
  bottom: 56px;
  left: 8px;
  right: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 12px;
  z-index: 40;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.sticker-btn {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.sticker-btn:hover { background: rgba(167,139,250,.15); }
.custom-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.custom-emoji-btn img, .custom-emoji {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
}
.custom-emoji-btn:hover { background: rgba(167,139,250,.15); }
.msg-content .custom-emoji, .pm-msg-body .custom-emoji {
  width: 28px;
  height: 28px;
  vertical-align: text-bottom;
}
.composer-tool.recording, #voice-btn.recording {
  color: #f87171 !important;
  animation: pulse-rec 1s infinite;
}
@keyframes pulse-rec {
  50% { opacity: .5; }
}
.msg-audio, .pm-msg-body audio {
  max-width: 100%;
  min-width: 180px;
}
.rich-img, .msg-image, .msg-gif {
  max-width: min(320px, 100%);
  border-radius: 10px;
  display: block;
}


/* Radio inside + menu */
.composer-plus-wrap {
  position: relative;
}
.composer-radio-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 240px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 60;
}
.composer-radio-panel[hidden] {
  display: none !important;
}
.composer-radio-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.composer-radio-head strong {
  color: #e2e8f0;
  font-size: 0.9rem;
}
.composer-radio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.composer-radio-controls input[type=range] {
  flex: 1;
  accent-color: #8b5cf6;
}
.composer-radio-link {
  display: block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: #a78bfa;
  text-decoration: none;
}
#radio-tool-btn i {
  color: #c4b5fd;
}


/* Live message rank / name / time must always show */
.message .msg-name {
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}
.message .rank-badge {
  display: inline-block !important;
  font-size: 0.65rem !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  border: 1px solid !important;
  opacity: 0.95 !important;
  background: rgba(0,0,0,.2) !important;
}
.message .msg-meta time {
  display: inline !important;
  font-size: 0.7rem !important;
  color: var(--text-dim, #94a3b8) !important;
  margin-left: auto !important;
}
.message .msg-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
}

.composer-disabled, .composer-locked {
  padding: 14px 16px !important;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  border-top: 1px solid rgba(167,139,250,.15);
  background: rgba(15,10,26,.9);
}
.composer-disabled .composer-locked { border: none; }

.message.msg-system {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
}
.message.msg-system .msg-avatar {
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
}
.message.msg-system .msg-body {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.message.msg-system .msg-meta,
.message.msg-system .msg-actions { display: none !important; }
.message.msg-system .msg-content {
  font-size: 0.88rem !important;
  color: #94a3b8 !important;
}
.message.msg-system .msg-content .sys-name {
  color: #e2e8f0;
  font-weight: 600;
}

/* ===== Unique user list ===== */
.gz-active-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 10px 4px;
  border-radius: 14px;
  background: linear-gradient(105deg, rgba(124,58,237,.35), rgba(15,10,26,.9) 55%, rgba(56,189,248,.12));
  border: 1px solid rgba(167,139,250,.25);
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.gz-active-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  flex: 1;
}
.gz-active-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
}
.gz-active-count {
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  background: rgba(15,10,26,.7);
  border: 1px solid rgba(167,139,250,.4);
  color: #c4b5fd;
}
.gz-user-list { padding: 4px 8px 16px; overflow-y: auto; }
.gz-list-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin: 12px 6px 6px;
  font-weight: 600;
}
.gz-list-label.offline-label { color: #475569; }
.gz-rank-block { margin-bottom: 10px; }
.gz-rank-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  margin: 0 2px 6px;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rank-c, #a78bfa) 35%, transparent), transparent 85%);
  border-left: 3px solid var(--rank-c, #a78bfa);
  position: relative;
}
.gz-rank-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--rank-c, #a78bfa);
  flex: 1;
}
.gz-rank-n {
  font-size: .7rem;
  color: #94a3b8;
  background: rgba(0,0,0,.25);
  padding: 2px 7px;
  border-radius: 999px;
}
.gz-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.gz-user:hover { background: rgba(167,139,250,.08); }
.gz-user.is-offline { opacity: .55; }
.gz-user-av {
  width: 36px; height: 36px; border-radius: 50%;
  position: relative; flex-shrink: 0;
  background: #2a1f3d;
  overflow: hidden;
  display: grid; place-items: center;
  font-weight: 700; color: #c4b5fd;
}
.gz-user-av img { width: 100%; height: 100%; object-fit: cover; }
.gz-presence {
  position: absolute; right: 0; bottom: 0;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--bg-panel, #1a1229);
}
.gz-presence.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.gz-presence.off { background: #64748b; }
.gz-user-meta { flex: 1; min-width: 0; }
.gz-user-meta strong {
  display: block;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gz-user-meta small {
  display: block;
  font-size: .72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gz-flag {
  font-size: .65rem;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(255,255,255,.05);
  padding: 2px 5px;
  border-radius: 6px;
}


/* ===== User list compact fix ===== */
.users-panel {
  background: var(--bg-panel, #faf7ff) !important;
  background-image: none !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.users-panel .panel-header { display: none; }
.gz-active-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 10px 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(100deg, #efe8fb 0%, #ffffff 60%, #f3edff 100%) !important;
  border: 1px solid rgba(167,139,250,.28);
  box-shadow: none;
}
.gz-active-left { font-size: .85rem; color: var(--text, #2a1748); }
.gz-active-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.gz-active-count {
  margin-left: auto;
  min-width: 32px;
  height: 26px;
  border-radius: 999px;
  background: rgba(124,58,237,.25);
  border: 1px solid rgba(167,139,250,.35);
  color: #ddd6fe;
  font-size: .8rem;
}
.gz-user-list,
.user-list.gz-user-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 8px 20px !important;
  background: var(--bg-panel, #faf7ff) !important;
}
.gz-list-label {
  font-size: .65rem;
  margin: 10px 8px 4px;
  color: #7c8aa5;
}
.gz-rank-block {
  margin: 0 0 8px;
  background: rgba(255,255,255,.02);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.04);
  overflow: hidden;
}
.gz-rank-head {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 7px 10px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border-left: 3px solid var(--rank-c, #a78bfa) !important;
  background: color-mix(in srgb, var(--rank-c, #a78bfa) 16%, #161022) !important;
}
.gz-rank-title {
  flex: 1;
  font-size: .72rem !important;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--rank-c, #c4b5fd) !important;
}
.gz-rank-n {
  font-size: .68rem;
  min-width: 1.4rem;
  text-align: center;
  color: var(--text, #2a1748);
  background: rgba(0,0,0,.35);
  padding: 2px 6px;
  border-radius: 999px;
}
.gz-user {
  padding: 6px 10px !important;
  gap: 8px !important;
  border-radius: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.gz-user:last-child { border-bottom: none; }
.gz-user-av {
  width: 32px !important;
  height: 32px !important;
  background: var(--bg-elevated, #efe8fb) !important;
}
.gz-user-meta strong { font-size: .82rem !important; }
.gz-user-meta small { font-size: .68rem !important; }
.gz-user.is-offline { opacity: .5; }
.is-offline-block { opacity: .85; }

@media (max-width: 900px) {
  .users-panel {
    width: min(320px, 88vw) !important;
    max-width: 88vw !important;
    background: var(--bg-panel, #faf7ff) !important;
  }
  .gz-user-list { max-height: calc(100vh - 120px); }
}

/* Staff / Online / Offline sections */
.users-panel {
  background: var(--bg-panel, #faf7ff) !important;
  background-image: none !important;
}
.users-panel-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.users-panel-head h2 {
  margin: 0;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.users-panel-head .badge,
#online-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #7c3aed;
  border: 1px solid #6d28d9;
  color: #ffffff;
  font-size: .75rem;
  font-weight: 700;
}
.user-list .user-section {
  padding: 8px 10px 4px;
}
.user-list .user-section h3 {
  margin: 0 0 8px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-list .user-section h3 .sec-count {
  color: #64748b;
  font-weight: 600;
}
.user-list .offline-section h3 { color: #64748b; }
.user-list .list-empty {
  font-size: .8rem;
  color: #475569;
  margin: 0 0 8px 4px;
}
.user-list .gz-user.is-offline,
.user-list .user-item.is-offline {
  opacity: .55;
}

/* Admin branding in main chat */
.rooms-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.rooms-brand-img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(124,58,237,.2);
  border: 1px solid rgba(167,139,250,.35);
}
.rooms-brand strong {
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(167,139,250,.3);
  margin-right: 4px;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ===== Auth landing — responsive + SEO ===== */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.auth-container-wide {
  max-width: 1080px !important;
  width: 100%;
  padding: 20px 16px 40px;
  margin: 0 auto;
}
.auth-card {
  max-width: 100%;
}
.auth-landing {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.auth-login-col { min-width: 0; }
.auth-form input,
.auth-form button,
.auth-form .btn { width: 100%; max-width: 100%; box-sizing: border-box; }
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.seo-title {
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  margin: 0 0 8px;
  color: #f1e9ff;
}
.seo-lead {
  color: #94a3b8;
  font-size: .95rem;
  line-height: 1.55;
  margin: 0 0 16px;
}
.seo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.seo-card {
  background: rgba(15, 10, 26, .55);
  border: 1px solid rgba(167,139,250,.16);
  border-radius: 14px;
  padding: 14px 14px 12px;
}
.seo-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(124,58,237,.35), rgba(245,158,11,.2));
  color: #ddd6fe;
  margin-bottom: 8px;
}
.seo-card h3 {
  margin: 0 0 6px;
  font-size: .95rem;
  color: #e2e8f0;
}
.seo-card p {
  margin: 0;
  font-size: .82rem;
  color: #94a3b8;
  line-height: 1.45;
}
.seo-copy h2 {
  font-size: 1.05rem;
  margin: 8px 0 8px;
  color: #e9e0ff;
}
.seo-copy p {
  color: #94a3b8;
  font-size: .88rem;
  line-height: 1.55;
  margin: 0 0 10px;
}
.seo-bullets {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.seo-bullets li {
  font-size: .82rem;
  color: var(--text, #2a1748);
  display: flex;
  align-items: center;
  gap: 8px;
}
.seo-bullets i { color: #a78bfa; width: 16px; }
.gz-brand-logo { max-height: 52px; width: auto; margin: 0 auto 10px; display: block; }
.gz-brand-icon { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }

@media (max-width: 860px) {
  .auth-landing {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .seo-grid { grid-template-columns: 1fr; }
  .seo-bullets { grid-template-columns: 1fr; }
  .auth-card { padding: 22px 16px !important; }
  .auth-container-wide { padding: 12px 12px 32px; }
}
@media (max-width: 420px) {
  .auth-brand h1 { font-size: 1.4rem; }
  .form-row { flex-direction: column; align-items: flex-start; }
}


/* Login: form first, content below, visible page scrollbar */
html:has(.auth-body),
.auth-body {
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  align-items: flex-start !important;
  justify-content: center !important;
  scrollbar-gutter: stable;
}
.auth-body::-webkit-scrollbar { width: 12px; }
.auth-body::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,.55);
  border-radius: 8px;
  border: 2px solid #1a1229;
}
.auth-body::-webkit-scrollbar-track { background: var(--bg-panel, #ffffff); }

.auth-container-wide {
  max-width: 720px !important;
  width: 100% !important;
  margin: 24px auto 48px !important;
  padding: 12px 16px 40px !important;
}
.auth-card {
  width: 100% !important;
  max-width: 720px !important;
  padding: 28px 24px !important;
  box-sizing: border-box;
}
.auth-landing {
  display: flex !important;
  flex-direction: column !important;
  gap: 28px !important;
  grid-template-columns: none !important;
}
.auth-login-col {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
.auth-seo {
  width: 100%;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid rgba(167,139,250,.15);
}
.auth-form input {
  width: 100% !important;
  box-sizing: border-box;
  padding-left: 42px !important;
  background: #1e1630 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(167,139,250,.28) !important;
}
.auth-form .input-icon i {
  left: 14px;
  z-index: 2;
  color: #a78bfa;
  pointer-events: none;
}
.auth-form .btn-block { width: 100%; }
.seo-grid {
  grid-template-columns: 1fr 1fr !important;
}

@media (max-width: 700px) {
  .auth-container-wide { margin: 10px auto 32px !important; padding: 8px 10px 28px !important; }
  .auth-card { padding: 20px 14px !important; }
  .auth-login-col { max-width: 100%; }
  .seo-grid { grid-template-columns: 1fr !important; }
  .seo-bullets { grid-template-columns: 1fr !important; }
}

#last-message, .msg-last { scroll-margin-bottom: 24px; }
body.chat-page .message-list { scroll-behavior: auto; }

.msg-reactions { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.reaction-chip {
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(124,58,237,.18); border:1px solid rgba(167,139,250,.3);
  border-radius:999px; padding:2px 8px; font-size:.75rem; color:#e2e8f0;
}
.reply-bar {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:6px 10px; margin:0 8px 6px; border-radius:10px;
  background:rgba(124,58,237,.15); border:1px solid rgba(167,139,250,.25);
  font-size:.8rem; color:#c4b5fd;
}
.msg-reply {
  font-size:.75rem; color:#a78bfa; border-left:2px solid #a78bfa;
  padding:2px 8px; margin-bottom:4px; opacity:.9;
}

.chat-mention, .mention, span.mention {
  background: #7c3aed !important;
  color: #ffffff !important;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
}
.wall-comment { font-size:.85rem; padding:6px 0; border-top:1px solid rgba(255,255,255,.06); }
.wall-comment-form { display:flex; gap:8px; margin-top:8px; }
.wall-comment-form input[type=text] { flex:1; }
.wall-composer textarea { width:100%; margin-bottom:8px; }

body.chat-page .message-list { font-size: 13px; }
body.chat-page .msg-content { font-size: 13px; line-height: 1.35; }
body.chat-page .msg-name { font-size: 13px; }
body.chat-page .rank-badge { font-size: 10px; }
body.chat-page .msg-meta time { font-size: 11px; }
body.chat-page .msg-reply { font-size: 12px; }

.wall-post-header { display:flex; align-items:center; gap:10px; }
.wall-post-header .avatar {
  width:40px; height:40px; border-radius:50%; overflow:hidden;
  background:rgba(124,58,237,.25); display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.wall-post-header .avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.menu-link .menu-dm-badge.show { display:inline-flex; margin-left:6px; }

.nav-toggle-wrap { position: relative; }
.nav-wall-badges {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center;
}
.onair-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .75rem; color: #fda4af; margin-top: 4px;
}
.onair-name { font-weight: 600; }
.onair-tag { display:inline-flex; align-items:center; gap:4px; color:#f43f5e; font-size:.7rem; }
#mob-wall-badge.show { display:inline-flex; }

.wall-page .wall-post-header { display:flex; align-items:center; gap:10px; }
.wall-page .wall-post-header .avatar,
.wall-post-header .avatar {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}
.wall-page .wall-post-header .avatar img,
.wall-post-header .avatar img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50%;
}

.wall-page .wall-post {
  background: rgba(26,18,41,.92) !important;
  background-image: none !important;
  overflow: hidden;
}
.wall-page .wall-post img {
  max-width: 36px !important;
  max-height: 36px !important;
}
.wall-page .wall-post-body img,
.wall-page .wall-comments img {
  max-width: 36px !important;
  max-height: 36px !important;
}
.wall-av { width:36px !important; height:36px !important; }
.wall-who time { display:block; font-size:.75rem; color:#94a3b8; }

.rooms-panel.rooms-only .menu-navigate { display: none !important; }
.rooms-panel.rooms-only .menu-rooms { display: block !important; }
.users-panel-head { display:flex; align-items:center; gap:8px; }
.users-panel-head h2 { flex:1; }

[data-theme="gold"] {
  --bg: #1a1408; --bg-app:#1a1408; --bg-panel:#2a2110; --bg-elevated:#3a2e16; --bg-hover:#4a3a1c;
  --text:#fef3c7; --text-muted:#d6bb7a; --text-dim:#a16207;
  --primary:#eab308; --gold:#facc15; --border:rgba(234,179,8,.28);
}
[data-theme="ocean"] {
  --bg:#06202b; --bg-app:#06202b; --bg-panel:#0b2e3d; --bg-elevated:#124155; --bg-hover:#16556e;
  --text:#e0f2fe; --text-muted:#7dd3fc; --text-dim:#0284c7;
  --primary:#22d3ee; --gold:#fbbf24; --border:rgba(34,211,238,.25);
}
[data-theme="rose"] {
  --bg:#1f1016; --bg-app:#1f1016; --bg-panel:#2c1520; --bg-elevated:#3d1c2b; --bg-hover:#4c2236;
  --text:#ffe4e6; --text-muted:#fda4af; --text-dim:#e11d48;
  --primary:#fb7185; --gold:#fbbf24; --border:rgba(251,113,133,.28);
}
[data-theme="light"] {
  --bg:#f1f5f9; --bg-app:#f1f5f9; --bg-panel:#ffffff; --bg-elevated:#e2e8f0; --bg-hover:#cbd5e1;
  --text:#0f172a; --text-muted:#475569; --text-dim:#64748b;
  --primary:#7c3aed; --gold:#b45309; --border:rgba(15,23,42,.12);
}
html[data-theme] body { background: var(--bg-app, var(--bg)); color: var(--text); }

.msg-voice { margin-top:6px; max-width:280px; }
.msg-audio { width:100%; height:36px; }
#voice-btn.recording { color:#f43f5e; background:rgba(244,63,94,.15); }


/* Light purple default — keep text readable everywhere */
[data-theme="light"] body,
html[data-theme="light"] body,
body {
  background: var(--bg-deep);
  color: var(--text);
}
[data-theme="light"] .auth-card,
[data-theme="light"] .admin-card,
[data-theme="light"] .page-panel,
[data-theme="light"] .panel,
[data-theme="light"] .composer,
[data-theme="light"] .chat-header,
[data-theme="light"] .users-panel,
[data-theme="light"] .rooms-panel,
[data-theme="light"] .wall-post,
[data-theme="light"] .message .msg-body {
  background: var(--bg-panel);
  color: var(--text);
}
[data-theme="light"] .auth-card { background: rgba(255,255,255,.92); }
[data-theme="light"] .auth-bg {
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(124,58,237,.18), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(251,191,36,.10), transparent),
    #f4f0fb;
}
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: #fff !important;
  color: #2a1748 !important;
  border-color: rgba(124,58,237,.25) !important;
}
[data-theme="light"] .text-muted { color: var(--text-muted) !important; }
[data-theme="light"] .menu-link,
[data-theme="light"] .admin-nav-item { color: var(--text-muted); }
[data-theme="light"] .menu-link:hover,
[data-theme="light"] .admin-nav-item:hover,
[data-theme="light"] .admin-nav-item.active {
  background: var(--bg-hover);
  color: var(--primary);
}


/* ========== LIGHT THEME FULL-SYSTEM OVERRIDE ========== */
html[data-theme="light"],
html[data-theme="light"] body,
[data-theme="light"] {
  --bg-deep: #f4f0fb;
  --bg-app: #f4f0fb;
  --bg: #f4f0fb;
  --bg-panel: #ffffff;
  --bg-elevated: #f3edff;
  --bg-hover: #ebe3ff;
  --text: #2a1748;
  --text-muted: #5b4a78;
  --text-dim: #7c6b99;
  --primary: #7c3aed;
  --border: rgba(124,58,237,.18);
}

html[data-theme="light"] body { background:#f4f0fb !important; color:#2a1748 !important; }

html[data-theme="light"] .panel,
html[data-theme="light"] .rooms-panel,
html[data-theme="light"] .users-panel,
html[data-theme="light"] .chat-panel,
html[data-theme="light"] .chat-header,
html[data-theme="light"] .composer,
html[data-theme="light"] .page-panel,
html[data-theme="light"] .admin-card,
html[data-theme="light"] .wall-post,
html[data-theme="light"] .gift-card,
html[data-theme="light"] .vip-card {
  background: #ffffff !important;
  color: #2a1748 !important;
  border-color: rgba(124,58,237,.16) !important;
}

html[data-theme="light"] .users-panel,
html[data-theme="light"] .rooms-panel {
  background: #faf7ff !important;
}

html[data-theme="light"] .user-item,
html[data-theme="light"] .room-item,
html[data-theme="light"] .menu-link {
  color: #2a1748 !important;
  background: transparent !important;
}
html[data-theme="light"] .user-item:hover,
html[data-theme="light"] .room-item:hover,
html[data-theme="light"] .menu-link:hover {
  background: #efe8fb !important;
  color: #5b21b6 !important;
}
html[data-theme="light"] .menu-link i,
html[data-theme="light"] .room-icon,
html[data-theme="light"] .user-section h3,
html[data-theme="light"] .menu-heading,
html[data-theme="light"] .panel-header h2,
html[data-theme="light"] .users-panel-head h2 {
  color: #5b21b6 !important;
}
html[data-theme="light"] .user-item .mood,
html[data-theme="light"] .user-item .last-seen,
html[data-theme="light"] .list-empty,
html[data-theme="light"] .text-muted {
  color: #6b5b86 !important;
}

html[data-theme="light"] .profile-dropdown,
html[data-theme="light"] .notif-panel,
html[data-theme="light"] .user-modal,
html[data-theme="light"] .composer-tools,
html[data-theme="light"] .composer-radio-panel,
html[data-theme="light"] .emoji-panel,
html[data-theme="light"] .sticker-panel,
html[data-theme="light"] .gif-panel {
  background: #ffffff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.22) !important;
  box-shadow: 0 12px 32px rgba(88,40,160,.12) !important;
}
html[data-theme="light"] .profile-dropdown a,
html[data-theme="light"] .profile-dropdown button,
html[data-theme="light"] .pd-edit,
html[data-theme="light"] .notif-item {
  color: #2a1748 !important;
  background: transparent !important;
}
html[data-theme="light"] .profile-dropdown a:hover,
html[data-theme="light"] .notif-item:hover {
  background: #efe8fb !important;
  color: #5b21b6 !important;
}
html[data-theme="light"] .profile-menu-btn,
html[data-theme="light"] .btn-icon,
html[data-theme="light"] .chat-header-actions .btn-icon,
html[data-theme="light"] .notif-bell {
  background: #efe8fb !important;
  color: #5b21b6 !important;
  border-color: rgba(124,58,237,.3) !important;
}
html[data-theme="light"] .mobile-nav {
  background: #ffffff !important;
  border-top: 1px solid rgba(124,58,237,.18) !important;
}
html[data-theme="light"] .mobile-nav .mob-btn,
html[data-theme="light"] .mobile-nav .mob-btn i,
html[data-theme="light"] .mobile-nav .mob-btn span {
  color: #5b21b6 !important;
}
html[data-theme="light"] .message .msg-body {
  background: #f7f3ff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.12);
}
html[data-theme="light"] .composer input,
html[data-theme="light"] #message-input,
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select {
  background: #ffffff !important;
  color: #2a1748 !important;
  border-color: rgba(124,58,237,.22) !important;
}
html[data-theme="light"] .welcome-card { background: linear-gradient(90deg,#f3e8ff,#fff7ed) !important; color:#2a1748 !important; }
html[data-theme="light"] .pd-close { background:#efe8fb !important; color:#5b21b6 !important; border-color:#ddd6fe !important; }

.message .rank-badge {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border-color: #c4b5fd !important;
  font-weight: 700 !important;
}
.message .rank-badge.rank-owner, .rank-badge[data-rank="owner"] { background:#fef3c7 !important; color:#92400e !important; border-color:#f59e0b !important; }
.message .rank-badge.rank-admin, .rank-badge[data-rank="admin"] { background:#ede9fe !important; color:#6d28d9 !important; border-color:#8b5cf6 !important; }
.message .rank-badge.rank-vip, .rank-badge[data-rank="vip"] { background:#ffedd5 !important; color:#c2410c !important; border-color:#fb923c !important; }
.message .rank-badge.rank-mod, .rank-badge[data-rank="moderator"] { background:#dbeafe !important; color:#1d4ed8 !important; border-color:#60a5fa !important; }
.message .rank-badge.rank-dj, .rank-badge[data-rank="dj"], .rank-badge[data-rank="rj"] { background:#fce7f3 !important; color:#be185d !important; border-color:#f472b6 !important; }
.message .rank-badge.rank-guest, .rank-badge[data-rank="guest"] { background:#f1f5f9 !important; color:#475569 !important; border-color:#94a3b8 !important; }
.message .rank-badge.rank-member, .rank-badge[data-rank="member"] { background:#e0e7ff !important; color:#3730a3 !important; border-color:#818cf8 !important; }
.users-panel-head h2 { color:#2a1748 !important; }
.user-list .user-section h3 { color:#6d28d9 !important; }

/* Light unique login */
html .auth-body, body.auth-body {
  background: #f3edff !important;
  color: #2a1748 !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
}
.auth-body .auth-bg {
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(124,58,237,.18), transparent),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(251,191,36,.12), transparent),
    #f3edff !important;
}
.auth-body .auth-card {
  background: #ffffff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.16) !important;
  box-shadow: 0 18px 50px rgba(88,40,160,.12) !important;
}
.auth-body .auth-card h1, .auth-body .auth-brand, .auth-body label,
.auth-body .auth-seo h2, .auth-body .auth-seo p, .auth-body .seo-card h3,
.auth-body .seo-card p { color: #2a1748 !important; }
.auth-body .auth-form input,
.auth-body input[type="text"],
.auth-body input[type="password"] {
  background: #f8f5ff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.25) !important;
}
.auth-body .input-icon i { color: #7c3aed !important; }
.auth-body .seo-card {
  background: #faf7ff !important;
  border: 1px solid rgba(124,58,237,.14) !important;
  color: #2a1748 !important;
}
.auth-body .seo-card:nth-child(1) { border-top: 3px solid #7c3aed; }
.auth-body .seo-card:nth-child(2) { border-top: 3px solid #db2777; }
.auth-body .seo-card:nth-child(3) { border-top: 3px solid #ea580c; }
.auth-body .seo-card:nth-child(4) { border-top: 3px solid #2563eb; }
.auth-body .link-muted { color: #6d28d9 !important; }

@media (max-width: 800px) {
  .dm-monitor-grid { grid-template-columns: 1fr !important; }
}

html:has(.admin-body) { overflow: hidden; }
.admin-body { overflow: hidden !important; }
.admin-content { overflow-y: auto !important; }
.admin-nav { overflow-y: auto !important; }
.admin-main { overflow: hidden !important; }

html[data-theme="light"] .admin-page input,
html[data-theme="light"] .admin-page select,
html[data-theme="light"] .admin-page textarea,
.admin-page input, .admin-page select, .admin-page textarea,
.admin-form input, .admin-form select, .admin-form textarea {
  background: #ffffff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.25) !important;
}

/* Light unique profile */
.profile-page, .profile-shell { background: transparent !important; color: #2a1748 !important; }
.profile-card, .profile-page .admin-card, .profile-page .page-panel {
  background: #ffffff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.16) !important;
  box-shadow: 0 10px 28px rgba(88,40,160,.08) !important;
}
.profile-cover-empty {
  background: linear-gradient(135deg,#ede9fe 0%,#f5f3ff 50%,#fff7ed 100%) !important;
}
.profile-avatar-lg {
  background: #efe8fb !important;
  border-color: #ffffff !important;
  color: #5b21b6 !important;
}
.profile-page h1, .profile-page h2, .profile-page h3, .profile-page label,
.profile-page p, .profile-meta, .profile-stats, .profile-page .form-group {
  color: #2a1748 !important;
}
.profile-page input, .profile-page select, .profile-page textarea {
  background: #f8f5ff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.25) !important;
}
.profile-page .btn-ghost { color: #5b21b6 !important; border-color: rgba(124,58,237,.3) !important; }
.profile-page i.fa-solid, .profile-page i.fa-regular { color: #7c3aed !important; }

.user-modal-inner h3, #sheet-name { color:#2a1748 !important; }
.user-modal-inner .text-muted, #sheet-meta, #sheet-ip { color:#5b4a78 !important; }
.user-modal-actions .btn,
.user-modal-inner .btn-ghost {
  background:#f6f1ff !important;
  color:#2a1748 !important;
  border:1px solid rgba(124,58,237,.22) !important;
}
.user-modal-actions .btn i { color:#7c3aed !important; margin-right:6px; }
.user-modal-actions .btn:hover { background:#ede9fe !important; color:#5b21b6 !important; }
.user-modal-inner select,
.user-modal-inner input {
  background:#fff !important;
  color:#2a1748 !important;
  border:1px solid rgba(124,58,237,.25) !important;
}
.user-modal-inner label { color:#2a1748 !important; }
.user-modal-inner .btn-primary { color:#fff !important; background:#7c3aed !important; }

/* Force consistent light UI (matches approved screenshots) */
html, body.app-body, body.admin-body, body.auth-body, body.chat-page {
  background: #f4f0fb !important;
  color: #2a1748 !important;
}
.rooms-panel, .users-panel, .chat-panel, .chat-header, .composer,
.profile-dropdown, .notif-panel, .user-modal-inner, .composer-tools,
.admin-sidebar, .admin-content, .admin-card, .admin-topbar, .page-panel,
.menu-link, .mobile-nav {
  background-color: #ffffff !important;
  color: #2a1748 !important;
}
.rooms-panel, .users-panel, .admin-sidebar { background: #faf7ff !important; }
.menu-link, .admin-nav-item, .user-item, .composer-tool { color: #2a1748 !important; }
.menu-link i, .admin-nav-item i, .composer-tool i { color: #7c3aed !important; }
.message .msg-body { background: #f7f3ff !important; color: #2a1748 !important; }
.composer-inner, .composer-inner textarea, #message-input {
  background: #ffffff !important;
  color: #2a1748 !important;
}

.msg-reply { font-size:12px; color:#5b4a78; background:#efe8fb; border-left:3px solid #7c3aed; padding:6px 8px; margin:0 0 6px; border-radius:8px; }
#refresh-users.spin svg { animation: gzspin .7s linear infinite; }
@keyframes gzspin { to { transform: rotate(360deg); } }

/* Force light forms everywhere */
.profile-page, .profile-card, .profile-edit-card, .page-panel, .admin-card,
.page-panel .admin-card, .settings-form, .pm-thread, .pm-page {
  background: #ffffff !important;
  color: #2a1748 !important;
}
.profile-edit-card h3, .page-panel h1, .page-panel h2, .page-panel h3,
.profile-edit-card label, .page-panel label, .admin-card label, .form-group label {
  color: #2a1748 !important;
}
input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="search"], input[type="tel"], input[type="color"],
input[type="date"], input[type="time"], input[type="file"],
select, textarea,
.page-panel input, .page-panel select, .page-panel textarea,
.admin-card input, .admin-card select, .admin-card textarea,
.profile-edit-card input, .profile-edit-card select, .profile-edit-card textarea,
.admin-page input, .admin-page select, .admin-page textarea,
.pm-compose input, .pm-compose textarea {
  background: #ffffff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.28) !important;
  caret-color: #2a1748;
}
input::placeholder, textarea::placeholder { color: #7c6b99 !important; }

.app-drawer-back {
  position:fixed;inset:0;background:rgba(40,20,70,.28);z-index:80;
}
.app-drawer {
  position:fixed;top:0;left:0;bottom:0;width:min(560px,92vw);z-index:81;
  background:#fff;color:#2a1748;box-shadow:12px 0 40px rgba(80,40,140,.18);
  display:flex;flex-direction:column;
}
.app-drawer[hidden], .app-drawer-back[hidden] { display:none !important; }
.app-drawer-close {
  position:absolute;top:10px;right:10px;z-index:2;width:36px;height:36px;
  border:0;border-radius:50%;background:#ede9fe;color:#5b21b6;font-size:22px;cursor:pointer;
}
.app-drawer iframe { border:0;width:100%;height:100%;background:#fff; }
@media (max-width: 700px) {
  .app-drawer { width:100vw; }
}

.app-drawer-back.open, .app-drawer-back:not([hidden]) {
  display:block !important;
  position:fixed !important; inset:0 !important;
  background:rgba(40,20,70,.32) !important;
  z-index:10050 !important;
}
.app-drawer.open, .app-drawer:not([hidden]) {
  display:flex !important;
  position:fixed !important;
  top:0 !important; left:0 !important; bottom:0 !important;
  width:min(560px, 94vw) !important;
  z-index:10060 !important;
  background:#fff !important;
  box-shadow:16px 0 40px rgba(80,40,140,.2) !important;
}
.app-drawer iframe { flex:1; width:100%; height:100%; border:0; background:#fff; }

.dm-pop {
  position: fixed !important;
  top: 58px !important;
  right: 12px !important;
  width: min(420px, calc(100vw - 16px)) !important;
  height: min(70vh, 560px) !important;
  max-height: min(70vh, 560px) !important;
  z-index: 12000 !important;
  background: #fff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.22) !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 40px rgba(80,40,140,.18) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.dm-pop[hidden] { display: none !important; }
.dm-pop iframe, .nav-fly iframe { flex:1; width:100%; border:0; background:#fff; min-height: 280px; }
.nav-fly {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  bottom: 12px !important;
  width: min(480px, 92vw) !important;
  z-index: 11900 !important;
  background: #fff !important;
  color: #2a1748 !important;
  border: 1px solid rgba(124,58,237,.22) !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 40px rgba(80,40,140,.18) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.nav-fly[hidden] { display: none !important; }
@media (max-width: 700px) {
  .dm-pop { right: 8px; left: 8px; width: auto !important; top: 52px !important; }
  .nav-fly { left: 8px; right: 8px; width: auto !important; }
}

.page-panel h1, .embed-shell h1, .admin-page h1, .pm-sidebar-head h2, .page-header h1 {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
}
.page-panel h2, .embed-shell h2, .admin-page h2 { font-size: 1.02rem !important; }
.page-panel h3, .embed-shell h3, .admin-card h3 { font-size: .95rem !important; }
.nav-fly, .dm-pop { overflow: hidden; }
.nav-fly iframe, .dm-pop iframe { overflow: auto; }
.embed-shell, .embed-mode, body.embed-mode { overflow-y: auto !important; height: auto !important; min-height: 100%; }
.pm-page, .pm-layout, .pm-messages, .pm-conv-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 700px) {
  .dm-pop.open, .dm-pop:not([hidden]) {
    top: 48px !important; left: 8px !important; right: 8px !important;
    width: auto !important; height: min(75vh, 520px) !important;
  }
  .nav-fly:not([hidden]) {
    top: 48px !important; left: 8px !important; right: 8px !important; bottom: 64px !important;
    width: auto !important;
  }
}

/* DM card = same corner as Notifications */
.dm-pop,
.dm-pop.notif-panel,
.dm-pop.open,
.dm-pop:not([hidden]) {
  position: fixed !important;
  top: 58px !important;
  right: 12px !important;
  left: auto !important;
  bottom: auto !important;
  width: min(360px, calc(100vw - 24px)) !important;
  height: min(70vh, 480px) !important;
  max-height: min(70vh, 480px) !important;
  z-index: 12050 !important;
  background: #fff !important;
  border: 1px solid rgba(167,139,250,.3) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(40,20,80,.16) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.dm-pop[hidden] { display: none !important; }
.dm-pop iframe {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  width: 100% !important;
  border: 0 !important;
}
@media (max-width: 700px) {
  .dm-pop,
  .dm-pop.open,
  .dm-pop:not([hidden]) {
    top: 52px !important;
    right: 8px !important;
    left: auto !important;
    width: min(360px, calc(100vw - 16px)) !important;
    height: min(75vh, 520px) !important;
    max-height: min(75vh, 520px) !important;
  }
}


/* Mobile dock hidden by default; small up/down handle */
.message{animation:none !important;opacity:1 !important;transform:none !important}
.mob-dock-toggle{
  display:none;
  position:fixed;
  left:10px;
  bottom:10px;
  z-index:160;
  width:42px;height:42px;
  border:1px solid #ddd6fe;
  border-radius:14px;
  background:linear-gradient(180deg,#fff,#f3e8ff);
  color:#6d28d9;
  box-shadow:0 8px 20px rgba(88,28,135,.18);
  align-items:center;justify-content:center;
  padding:0;
}
@media (max-width:900px){
  .mob-dock-toggle{display:inline-flex}
  .mobile-nav.is-hidden{display:none !important}
  .mobile-nav:not(.is-hidden){display:flex !important}
  body.chat-page .main-content{padding-bottom:0 !important}
  .chat-layout{height:100dvh !important}
}

.mobile-nav,.mob-dock-toggle{display:none !important}
@media (max-width:960px){
  .mobile-nav,.mob-dock-toggle{display:none !important}
  .app-shell{padding-bottom:0 !important}
  .chat-layout{height:100dvh !important;min-height:100dvh !important}
  body.chat-page .main-content{padding-bottom:0 !important}
}
.message{animation:none !important;opacity:1 !important;transform:none !important}


/* Flush composer to the bottom — no reserved mobile-bar gap */
.mobile-nav,.mob-dock-toggle{display:none !important;height:0 !important;overflow:hidden !important}
.app-shell,.page-panel{padding-bottom:0 !important}
@media (max-width:960px){
  html,body{height:100%;height:100dvh}
  body.chat-page .app-shell,
  body.chat-page .main-content,
  body.chat-page .content-wrap{
    padding-bottom:0 !important;
    margin-bottom:0 !important;
    height:100dvh !important;
    max-height:100dvh !important;
  }
  .chat-layout,
  body.chat-page .chat-layout{
    height:100dvh !important;
    max-height:100dvh !important;
    min-height:100dvh !important;
    padding-bottom:0 !important;
    margin-bottom:0 !important;
    display:flex !important;
    flex-direction:column !important;
  }
  .chat-main,.chat-window,.chat-col{
    flex:1 1 auto !important;
    min-height:0 !important;
    display:flex !important;
    flex-direction:column !important;
  }
  #message-list,.message-list,.chat-messages{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
  }
  .composer,body.chat-page .composer{
    position:relative !important;
    bottom:auto !important;
    left:auto !important;
    right:auto !important;
    margin:0 !important;
    padding:8px 10px max(8px, env(safe-area-inset-bottom)) !important;
    flex:0 0 auto !important;
  }
}
