:root {
  --bg-darkest: #1a1b1e;
  --bg-dark: #26282c;
  --bg-mid: #2e3035;
  --bg-light: #383b41;
  --bg-hover: #35373d;
  --text-primary: #f2f3f5;
  --text-muted: #969aa3;
  --text-faint: #6b6f78;
  --accent: #5b6cf9;
  --accent-hover: #4a58d6;
  --online: #23c55e;
  --danger: #ef4b52;
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  background: var(--bg-mid);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Layout général ---------- */
.app {
  display: grid;
  grid-template-columns: 250px 1fr 230px;
  height: 100vh;
  overflow: hidden;
}

.mobile-topbar { display: none; }
.overlay-backdrop { display: none; }

/* ---------- Sidebar canaux ---------- */
.channels-sidebar {
  background: var(--bg-darkest);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.server-name {
  padding: 16px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.channel-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 10px;
  padding-left: calc(10px + var(--depth, 0) * 16px);
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.channel-item[style*="--depth"]::before {
  content: '';
}
.channel-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.channel-item.active { background: var(--accent); color: #fff; }
.hash { opacity: 0.7; font-weight: 600; flex-shrink: 0; }
.channel-item.active .hash { opacity: 1; }

.channel-category { margin-bottom: 2px; position: relative; }
.category-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 8px 6px calc(8px + var(--depth, 0) * 16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.category-toggle:hover { color: var(--text-primary); }
.category-icon { font-size: 13px; }
.chevron { font-size: 10px; transition: transform 0.15s; display: inline-block; flex-shrink: 0; }
.channel-category.collapsed .chevron { transform: rotate(-90deg); }
.channel-category.collapsed .category-children { display: none; }

.category-children {
  position: relative;
  margin-left: calc(14px + var(--depth, 0) * 4px);
  border-left: 1px solid rgba(255,255,255,0.07);
  padding-left: 2px;
}

.sidebar-footer {
  background: #1f2023;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.me {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
  background: none; border: none; color: var(--text-primary); cursor: pointer;
  padding: 6px 8px; border-radius: var(--radius-sm); min-width: 0;
}
.me:hover { background: var(--bg-hover); }
.me-avatar {
  font-size: 20px; flex-shrink: 0;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
}
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-actions { display: flex; gap: 10px; flex-shrink: 0; }
.footer-actions a { text-decoration: none; cursor: pointer; font-size: 16px; }

.icon-btn {
  background: none; border: none; color: var(--text-primary);
  font-size: 18px; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm);
}
.icon-btn:hover { background: var(--bg-hover); }

/* ---------- Zone principale ---------- */
.main-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-mid);
  min-width: 0;
  min-height: 0;
  position: relative;
}

.channel-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
#headerIcon {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
}

.pinned-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}
.pinned-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.pinned-toggle[hidden] { display: none; }

.pinned-panel {
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 10px 16px;
  max-height: 220px;
  overflow-y: auto;
}
.pinned-panel .pinned-item {
  display: flex; gap: 10px; padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px;
}
.pinned-panel .pinned-item:last-child { border-bottom: none; }
.pinned-panel .pinned-author { font-weight: 600; margin-right: 6px; }
.pinned-panel .pinned-meta { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.pinned-panel .pinned-empty { color: var(--text-muted); font-size: 13px; padding: 8px 4px; }

.messages-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px;
  -webkit-overflow-scrolling: touch;
}

.messages-list { display: flex; flex-direction: column; gap: 2px; }

.msg {
  display: flex;
  gap: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.msg:hover { background: rgba(255,255,255,0.025); }
.msg.is-pinned { background: rgba(91,108,249,0.07); }

.msg-avatar {
  font-size: 26px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  border-radius: 50%;
  flex-shrink: 0;
}

.msg-body { min-width: 0; flex: 1; }
.msg-pinned-tag { font-size: 11px; color: var(--accent); margin-bottom: 2px; font-weight: 600; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-weight: 600; font-size: 15px; }
.msg-time { font-size: 11px; color: var(--text-muted); }
.msg-edited-tag { font-size: 11px; color: var(--text-faint); }
.msg-content { font-size: 15px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }

.msg-attachment img {
  max-width: 320px; max-height: 320px; border-radius: var(--radius);
  margin-top: 4px; display: block; cursor: pointer;
}
.msg-attachment .file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 12px; border-radius: var(--radius);
  margin-top: 4px; text-decoration: none; color: var(--text-primary); font-size: 14px;
}

.msg-actions {
  display: none;
  gap: 2px;
  margin-left: auto;
  align-self: flex-start;
  flex-shrink: 0;
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-header { position: relative; }
.msg-action-btn {
  background: var(--bg-light);
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
}
.msg-action-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.msg-action-btn.pinned { color: var(--accent); }
.msg-action-btn.danger:hover { color: var(--danger); }

.msg-edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.msg-edit-form textarea {
  width: 100%; background: var(--bg-dark); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font);
  font-size: 15px; padding: 8px; resize: vertical; min-height: 40px;
}
.msg-edit-actions { display: flex; gap: 8px; }
.msg-edit-actions button {
  font-size: 12px; padding: 5px 12px; border-radius: var(--radius-sm); border: none; cursor: pointer;
}
.msg-edit-save { background: var(--accent); color: #fff; }
.msg-edit-save:hover { background: var(--accent-hover); }
.msg-edit-cancel { background: var(--bg-light); color: var(--text-muted); }
.msg-edit-cancel:hover { color: var(--text-primary); }

.msg-day-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  margin: 18px 0 10px;
}
.msg-day-divider::before, .msg-day-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.08);
}

/* ---------- Composer ---------- */
.composer {
  margin: 0 16px 16px 16px;
  background: var(--bg-light);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  gap: 8px;
}

.composer-input-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

#messageInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  max-height: 200px;
  line-height: 1.4;
}

.composer-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.composer-btn:hover { color: var(--text-primary); }
.send-btn { color: var(--accent); font-size: 22px; }

.upload-preview {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-dark); padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
}
.upload-preview img { max-height: 50px; border-radius: 4px; }
.upload-preview .remove-upload { cursor: pointer; color: var(--danger); font-weight: 700; margin-left: auto; }
.upload-preview[hidden] { display: none; }

/* ---------- Emoji picker ---------- */
.emoji-picker {
  position: absolute;
  right: 16px;
  bottom: 76px;
  width: 320px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--bg-dark);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 10px;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.emoji-picker[hidden] { display: none; }
.emoji-cat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 6px 4px 4px;
}
.emoji-cat-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-btn {
  background: none; border: none; font-size: 20px; cursor: pointer; padding: 5px; border-radius: var(--radius-sm);
}
.emoji-btn:hover { background: var(--bg-hover); }

/* ---------- Membres ---------- */
.members-sidebar { background: var(--bg-darkest); padding: 16px 12px; overflow-y: auto; }
.members-title {
  font-size: 12px; text-transform: uppercase; color: var(--text-muted);
  font-weight: 700; margin-bottom: 10px; letter-spacing: 0.03em;
}
.member-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 6px; font-size: 14px;
  border-radius: var(--radius-sm); cursor: pointer; background: none; border: none;
  width: 100%; text-align: left; color: var(--text-primary);
}
.member-item:hover { background: var(--bg-hover); }
.member-item.offline { opacity: 0.42; }
.member-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--online); flex-shrink: 0; }
.member-item.offline .dot { background: var(--text-faint); }
.member-item .m-avatar {
  font-size: 18px; width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%; overflow: hidden; flex-shrink: 0;
}
.member-item .m-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-item.dm-active { background: var(--accent); }
.member-item.dm-active .dot { background: #fff; }

/* ---------- Modale (profil / avatar) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-mid); border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 14px; }
.avatar-current {
  text-align: center; font-size: 40px; margin: 0 auto 14px;
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
}
.avatar-picker {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; max-height: 320px; overflow-y: auto;
}
.avatar-picker[hidden] { display: none; }
.avatar-option {
  background: var(--bg-light); border: 2px solid transparent; border-radius: var(--radius-sm);
  font-size: 20px; padding: 6px 0; cursor: pointer;
}
.avatar-option:hover { background: var(--bg-hover); }
.avatar-option.selected { border-color: var(--accent); background: rgba(91,108,249,0.15); }

/* ---------- Login page ---------- */
.login-body { display: flex; align-items: center; justify-content: center; background: var(--bg-darkest); min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--bg-mid); padding: 32px; border-radius: 12px;
  width: 100%; max-width: 420px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 4px 0; font-size: 22px; }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.login-card label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-top: 10px; }
.login-card input[type=text], .login-card input[type=password] {
  background: var(--bg-darkest); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 10px; color: var(--text-primary); font-size: 15px;
}
.login-card .avatar-picker { margin-top: 6px; }
.login-card button[type=submit] {
  margin-top: 18px; background: var(--accent); border: none; color: #fff;
  padding: 12px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 15px;
}
.login-card button[type=submit]:hover { background: var(--accent-hover); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- Admin (partagé) ---------- */
.admin-body { background: var(--bg-darkest); color: var(--text-primary); font-family: var(--font); margin: 0; }
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 24px; }
.admin-nav { display: flex; gap: 16px; margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 12px; flex-wrap: wrap; }
.admin-nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.admin-nav a.active, .admin-nav a:hover { color: var(--text-primary); }
.admin-card { background: var(--bg-mid); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.admin-table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge.admin { background: var(--accent); color: #fff; }
.badge.banned { background: var(--danger); color: #fff; }
.badge.ok { background: var(--online); color: #fff; }
.btn { background: var(--accent); border: none; color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; display: inline-block; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 8px; font-size: 12px; }
.admin-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-box { background: var(--bg-light); border-radius: var(--radius); padding: 16px 20px; min-width: 140px; }
.stat-box .stat-value { font-size: 28px; font-weight: 700; }
.stat-box .stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; }
.admin-form input, .admin-form select { background: var(--bg-darkest); border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary); padding: 8px; border-radius: 6px; font-size: 14px; }
.admin-form label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; margin-top: 10px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: rgba(35,197,94,0.15); color: var(--online); }
.flash.error { background: rgba(239,75,82,0.15); color: var(--danger); }

/* Sélecteur d'icône (admin canaux) */
.icon-picker { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.icon-picker-btn {
  background: var(--bg-darkest); border: 1px solid rgba(255,255,255,0.1); color: var(--text-primary);
  font-size: 18px; padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.icon-picker-btn:hover { background: var(--bg-hover); }
.icon-picker-grid {
  position: absolute; top: 36px; left: 0; z-index: 20;
  background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius);
  padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px;
  width: 260px; max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.icon-picker-grid[hidden] { display: none; }
.icon-picker-emoji { background: none; border: none; font-size: 17px; cursor: pointer; padding: 4px; border-radius: 4px; }
.icon-picker-emoji:hover { background: var(--bg-hover); }

/* ---------- Indicateur non-lu (salons) ---------- */
.channel-item .channel-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-item .unread-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  flex-shrink: 0; opacity: 0; transform: scale(0.5); transition: opacity 0.15s, transform 0.15s;
}
.channel-item.has-unread { color: var(--text-primary); font-weight: 700; }
.channel-item.has-unread .unread-dot { opacity: 1; transform: scale(1); }
.channel-item.active.has-unread { font-weight: 700; }

/* ---------- Avatars image (au lieu d'emoji) ---------- */
.msg-avatar img, .m-avatar img, .me-avatar img, #headerIcon img, #meAvatar img, #avatarCurrent img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}
.msg-avatar { overflow: hidden; }
.msg-avatar-deleted { background: var(--bg-dark); opacity: 0.6; }
.msg-author-deleted { color: var(--text-faint); font-style: italic; font-weight: 500; }

/* ---------- Réactions rapides ---------- */
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.reaction-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-light); border: 1px solid transparent;
  border-radius: 12px; padding: 2px 8px; font-size: 13px; cursor: pointer;
  color: var(--text-primary);
}
.reaction-pill:hover { background: var(--bg-hover); }
.reaction-pill.mine { background: rgba(91,108,249,0.18); border-color: var(--accent); }
.reaction-pill .reaction-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.reaction-pill.mine .reaction-count { color: var(--accent); }

.quick-react-popover {
  position: fixed; z-index: 60; display: flex; gap: 2px;
  background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
  padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.quick-react-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 4px 6px; border-radius: 999px; line-height: 1;
}
.quick-react-btn:hover { background: var(--bg-hover); }
.quick-react-more { font-size: 14px; opacity: 0.7; }

.emoji-picker.reaction-mode { border: 2px solid var(--accent); }

/* ---------- Mentions @pseudo ---------- */
.mention {
  background: rgba(91,108,249,0.18); color: var(--accent);
  padding: 1px 4px; border-radius: 4px; font-weight: 600;
}
.mention-me { background: var(--accent); color: #fff; }

.mention-picker {
  position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 6px;
  background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.35); z-index: 25;
}
.mention-picker[hidden] { display: none; }
.mention-option {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-primary); padding: 8px 12px; cursor: pointer; font-size: 14px;
}
.mention-option:hover { background: var(--bg-hover); }
.mention-option .m-avatar { font-size: 16px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.mention-option .mention-handle { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.composer-input-wrap { position: relative; }

/* ---------- Modale profil : onglets emoji / image ---------- */
.avatar-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.avatar-tab {
  flex: 1; background: var(--bg-light); border: none; color: var(--text-muted);
  padding: 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600;
}
.avatar-tab.active { background: var(--accent); color: #fff; }
.avatar-image-upload { text-align: center; padding: 20px 0; }
.btn-secondary {
  background: var(--bg-light); border: none; color: var(--text-primary);
  padding: 10px 18px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn-secondary:hover { background: var(--bg-hover); }

/* =====================================================================
   MOBILE
   ===================================================================== */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
  }

  .mobile-topbar {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-darkest); padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    grid-column: 1; grid-row: 1;
  }
  .mobile-title { font-weight: 700; font-size: 15px; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .overlay-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40;
  }
  .overlay-backdrop.visible { display: block; }

  .channels-sidebar, .members-sidebar {
    position: fixed; top: 0; bottom: 0; width: 82vw; max-width: 300px;
    z-index: 50; transition: transform 0.2s ease; box-shadow: 0 0 24px rgba(0,0,0,0.4);
  }
  .channels-sidebar { left: 0; transform: translateX(-100%); }
  .channels-sidebar.open { transform: translateX(0); }
  .members-sidebar { right: 0; transform: translateX(100%); }
  .members-sidebar.open { transform: translateX(0); }

  .main-area { grid-column: 1; grid-row: 2; min-height: 0; }

  .channel-header { display: none; }

  .composer { margin: 0 8px 8px 8px; }
  .messages-scroll { padding: 8px 10px; }

  .emoji-picker { right: 8px; left: 8px; width: auto; bottom: 70px; }

  .msg-actions { display: flex; }

  .modal { max-width: 92vw; }
}
