
:root {
  --bg: #1a1d21; --sidebar: #1a1d21; --main: #222529;
  --panel: #2c2f33; --border: #333; --text: #dcddde;
  --muted: #72767d; --accent: #4a9eff; --green: #43b581;
  --red: #f04747; --yellow: #faa61a; --white: #fff;
  --radius: 6px; --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Ensure full width always */
html, body { width: 100%; max-width: 100%; }
.app { width: 100%; }

/* ── Aliases for template CSS that uses different var names ── */
:root {
  --text-muted: var(--muted);
  --bg-elevated: var(--panel);
  --bg-input: rgba(255,255,255,.06);
  --bg-2: var(--panel);
  --bg-3: rgba(255,255,255,.06);
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg: #f0f2f5;
  --sidebar: #e4e8ed;
  --main: #ffffff;
  --panel: #ffffff;
  --border: #dde1e7;
  --text: #1c1e21;
  --muted: #65676b;
  --accent: #0a66c2;
  --green: #31a24c;
  --red: #e03030;
  --yellow: #d97706;
  --white: #fff;
  --text-muted: #65676b;
  --bg-elevated: #ffffff;
  --bg-input: #f0f2f5;
  --bg-2: #f7f8fa;
  --bg-3: #e4e6ea;
}
[data-theme="light"] body { color: var(--text); }
[data-theme="light"] .form-input { background: var(--bg-input); }
[data-theme="light"] .msg-content code { background: rgba(0,0,0,.07); }
[data-theme="light"] .msg-content pre { background: #f6f7f9; }
[data-theme="light"] .channel-item:hover { background: rgba(0,0,0,.05); }
[data-theme="light"] .msg-item:hover { background: rgba(0,0,0,.03); }
[data-theme="light"] .reaction-btn { background: rgba(0,0,0,.05); }
[data-theme="light"] .reaction-btn.mine { background: rgba(10,102,194,.12); }

/* ── Theme toggle button ── */
.theme-toggle {
  background: none; border: none; cursor: pointer; font-size: 18px;
  color: var(--muted); padding: 4px; border-radius: 4px; line-height: 1;
}
.theme-toggle:hover { color: var(--text); background: rgba(128,128,128,.1); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; height: 100vh; overflow: hidden; display: flex; }

/* Layout */
.app { display: flex; width: 100%; height: 100vh; overflow: hidden; }
.sidebar { width: 240px; min-width: 240px; background: var(--sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto; }
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--main); }
.channel-area { flex: 1; display: flex; overflow: hidden; }
.messages-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.thread-panel { width: 360px; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; background: var(--panel); }

/* Sidebar */
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.workspace-name { font-weight: 700; font-size: 16px; }
.sidebar-section { padding: 8px 0; }
.sidebar-section-title { padding: 8px 16px 4px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; color: var(--muted); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; }
.channel-item { display: flex; align-items: center; padding: 4px 16px;
  cursor: pointer; color: var(--muted); text-decoration: none; border-radius: 4px;
  margin: 1px 8px; transition: background .1s; }
.channel-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.channel-item.active { background: rgba(74,158,255,.2); color: var(--white); }
.channel-item .icon { margin-right: 6px; font-size: 13px; }
.channel-item .badge { margin-left: auto; background: var(--accent); color: white;
  border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.add-channel-btn { display: flex; align-items: center; padding: 4px 16px;
  color: var(--muted); cursor: pointer; font-size: 14px; border-radius: 4px; margin: 1px 8px; }
.add-channel-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }

/* Top bar */
.topbar { padding: 0 16px; height: 48px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; background: var(--panel);
  flex-shrink: 0; }
.topbar-title { font-weight: 700; font-size: 16px; flex: 1; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-btn { background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.topbar-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }

/* Messages */
.messages-list { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.msg-item { display: flex; gap: 12px; padding: 4px 8px; border-radius: 4px;
  transition: background .1s; position: relative; }
.msg-item:hover { background: rgba(255,255,255,.03); }
.msg-item:hover .msg-actions { display: flex; }
.msg-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 14px; color: white; flex-shrink: 0; overflow: hidden; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-weight: 700; font-size: 15px; color: var(--text); }
.msg-time { font-size: 11px; color: var(--muted); }
.msg-content { line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.msg-content code { background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 4px;
  font-family: 'Consolas','Monaco',monospace; font-size: 13px; }
.msg-content pre { background: #1e2227; border-radius: 6px; padding: 12px 16px;
  overflow-x: auto; margin: 8px 0; border: 1px solid var(--border); }
.msg-content pre code { background: none; padding: 0; }
.msg-content a { color: var(--accent); }
.edited-mark { color: var(--muted); font-size: 12px; font-style: italic; }
.deleted-msg { color: var(--muted); font-style: italic; }
.forwarded-label { color: var(--muted); font-size: 12px; border-left: 3px solid var(--border);
  padding-left: 8px; margin-bottom: 4px; }
.system-msg { color: var(--muted); font-size: 13px; text-align: center;
  padding: 4px 0; font-style: italic; }

/* Message actions popup */
.msg-actions { display: none; position: absolute; right: 8px; top: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 4px; gap: 2px; z-index: 10; }
.msg-action-btn { background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px 6px; border-radius: 4px; font-size: 16px; }
.msg-action-btn:hover { background: rgba(255,255,255,.1); color: var(--text); }

/* Reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-btn { background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 8px; cursor: pointer; font-size: 14px;
  transition: background .1s; color: var(--text); }
.reaction-btn.mine { background: rgba(74,158,255,.2); border-color: var(--accent); }
.reaction-btn:hover { background: rgba(255,255,255,.12); }
.quick-react { display: flex; gap: 4px; }

/* Message input */
.msg-input-area { padding: 16px 20px; flex-shrink: 0; }
.msg-input-wrap { background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; display: flex; flex-direction: column; }
.input-toolbar { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--border); }
.toolbar-btn { background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px 8px; border-radius: 4px; font-size: 14px; }
.toolbar-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.msg-input-row { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; }
.msg-textarea { flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; resize: none; min-height: 38px;
  max-height: 200px; font-family: var(--font); line-height: 1.5; }
.msg-textarea::placeholder { color: var(--muted); }
.send-btn { background: var(--accent); border: none; color: white; padding: 8px 16px;
  border-radius: 6px; cursor: pointer; font-weight: 600; flex-shrink: 0; }
.send-btn:hover { opacity: .9; }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }
.typing-indicator { font-size: 12px; color: var(--muted); padding: 4px 12px;
  min-height: 20px; font-style: italic; }

/* Thread panel */
.thread-header { padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.thread-close { background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; }
.thread-messages { flex: 1; overflow-y: auto; padding: 12px; }
.thread-reply { padding: 12px; border-top: 1px solid var(--border); }
.thread-reply textarea { width: 100%; background: var(--main); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px; font-size: 14px;
  resize: none; min-height: 60px; font-family: var(--font); }

/* Search */
.search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; margin: 8px; }
.search-input { background: none; border: none; outline: none; color: var(--text);
  font-size: 14px; flex: 1; }

/* User sidebar */
.user-status { display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  margin-top: auto; border-top: 1px solid var(--border); cursor: pointer; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot.offline { background: var(--muted); }
.status-dot.dnd { background: var(--red); }
.status-dot.away { background: var(--yellow); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px;
  color: var(--muted); text-transform: uppercase; }
.form-input { width: 100%; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 10px 12px; font-size: 15px;
  outline: none; transition: border-color .15s; }
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2372767d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.btn { padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 600; transition: opacity .15s; }
.btn:hover { opacity: .9; }
.btn-primary { background: var(--accent); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); overflow-y: auto; }
.auth-card { width: 420px; max-width: 95vw; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 40px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { font-size: 28px; font-weight: 800; color: var(--accent); }
.auth-logo p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.auth-error { background: rgba(240,71,71,.15); border: 1px solid var(--red);
  color: var(--red); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-link a { color: var(--accent); }

/* Toasts */
.toast { padding: 10px 16px; border-radius: 6px; font-size: 14px; }
.toast.success { background: rgba(67,181,129,.2); border: 1px solid var(--green); color: var(--green); }
.toast.warning { background: rgba(250,166,26,.15); border: 1px solid var(--yellow); color: var(--yellow); }
.toast.error { background: rgba(240,71,71,.15); border: 1px solid var(--red); color: var(--red); }

/* Admin/pages */
.page { flex: 1; overflow-y: auto; padding: 24px 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 16px; }
.card-header { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; text-align: center; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 14px; }
tr:hover td { background: rgba(255,255,255,.03); }

/* Polls */
.poll-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 8px 0; }
.poll-question { font-weight: 600; margin-bottom: 12px; }
.poll-option { margin-bottom: 8px; }
.poll-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.poll-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.poll-label { display: flex; justify-content: space-between; font-size: 13px; }

/* Inbox */
.inbox-list { overflow-y: auto; }
.convo-item { padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; gap: 12px; align-items: flex-start; }
.convo-item:hover { background: rgba(255,255,255,.04); }
.convo-item.unread .convo-name { font-weight: 700; }
.convo-name { font-weight: 600; font-size: 14px; }
.convo-preview { color: var(--muted); font-size: 13px; }
.convo-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Calendar */
.cal-event-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; margin-bottom: 12px; display: flex; gap: 16px; }
.cal-date { font-size: 12px; color: var(--muted); width: 80px; flex-shrink: 0; }
.cal-date .day { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; }
.cal-date .month { text-transform: uppercase; font-size: 11px; }
.cal-info { flex: 1; }
.cal-title { font-weight: 700; font-size: 16px; }
.cal-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Mobile */

/* ── Hamburger + sidebar toggle ── */
.hamburger {
  background: none; border: none; cursor: pointer; font-size: 18px;
  color: var(--muted); padding: 4px 6px; border-radius: var(--radius); flex-shrink: 0;
}
.hamburger:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ── Sidebar-closed state ── */
[data-sidebar="closed"] .app { flex-direction: column !important; width: 100% !important; }
[data-sidebar="closed"] .sidebar { display: none !important; }
[data-sidebar="closed"] .top-nav { display: flex !important; }

/* ── Top Nav (hidden until sidebar minimized) ── */
.top-nav {
  display: none; height: 52px; flex-shrink: 0;
  background: var(--sidebar); border-bottom: 1px solid var(--border);
  align-items: center; padding: 0 10px; gap: 2px;
  position: relative; z-index: 50; overflow: visible;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); flex-shrink: 0;
  padding-right: 12px; border-right: 1px solid var(--border); margin-right: 4px;
}
.nav-logo-text { font-weight: 700; font-size: 15px; }
.nav-version { font-size: 10px; color: var(--muted); }
.nav-hamburger { margin-right: 4px; }
.nav-channels {
  display: flex; align-items: center; gap: 1px;
  overflow-x: auto; flex: 1; scrollbar-width: none; min-width: 0;
}
.nav-channels::-webkit-scrollbar { display: none; }
.nav-ch {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-size: 13px;
  white-space: nowrap; flex-shrink: 0; transition: background .1s, color .1s;
}
.nav-ch:hover { background: rgba(255,255,255,.06); color: var(--text); }
.nav-ch.active { background: rgba(74,158,255,.2); color: var(--white); }
.nav-btn {
  background: none; border: none; cursor: pointer; font-size: 17px;
  color: var(--muted); padding: 5px 7px; border-radius: var(--radius);
  text-decoration: none; display: inline-flex; align-items: center;
  flex-shrink: 0; transition: color .1s, background .1s; line-height: 1;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.nav-user {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text); flex-shrink: 0;
  padding: 4px 8px; border-radius: var(--radius);
  border-left: 1px solid var(--border); margin-left: 4px;
}
.nav-user:hover { background: rgba(255,255,255,.06); }
.nav-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; overflow: hidden; text-transform: uppercase;
}
.nav-username {
  font-size: 13px; font-weight: 600;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Federation dropdown in sidebar ── */
.fed-links { display: none; }
#fed-section.open .fed-links { display: block; }
.fed-arrow { transition: transform .2s; display: inline-block; }
#fed-section.open .fed-arrow { transform: rotate(180deg); }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .thread-panel { display: none; }
  .page { padding: 16px; }
}

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

/* Link preview */
.link-preview { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
  margin-top: 6px; display: flex; gap: 12px; max-width: 480px; }
.link-preview img { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.link-preview-info .title { font-weight: 600; font-size: 14px; }
.link-preview-info .domain { font-size: 12px; color: var(--muted); margin-top: 2px; }

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

/* ── Call bar ── */
.call-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #1a3a2a; border-bottom: 1px solid #2d5c3f;
  padding: 8px 16px; gap: 12px; flex-wrap: wrap;
}
.call-bar-info { display:flex; align-items:center; gap:8px; font-size:14px; color:#7dcea0; }
.call-bar-count { font-size:12px; color:var(--muted); }
.call-bar-controls { display:flex; gap:6px; align-items:center; }
.ctrl-pill {
  padding: 4px 10px; border-radius: 20px; border: none; cursor: pointer;
  font-size: 14px; display:flex; align-items:center; gap:4px;
}
.ctrl-pill.on { background: #333; color: #fff; }
.ctrl-pill.off { background: var(--red,#e53e3e); color: #fff; }
.ctrl-pill.leave { background: var(--red,#e53e3e); color: #fff; font-size:12px; }

/* ── Embedded video panel ── */
.video-panel {
  border-bottom: 1px solid var(--border);
  flex-direction: column; background: #111;
  max-height: 240px;
}
.video-panel-header {
  display:flex; justify-content:space-between; align-items:center;
  padding: 6px 12px; font-size:12px; color:var(--muted); background:#1a1d21;
}
.video-grid-embed {
  display: flex; gap: 4px; padding: 8px; overflow-x: auto; flex:1;
}
.vtile {
  width: 180px; height: 120px; flex-shrink: 0; border-radius: 6px;
  background: #1a1d21; position: relative; overflow: hidden;
}
.vtile-name {
  position: absolute; bottom: 6px; left: 8px; z-index: 1;
  background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px;
  border-radius: 8px; font-size: 11px;
}

/* ── Readable text overrides — no accent on plain text ── */
.workspace-name { color: var(--text); }
.sidebar-section-title { color: var(--muted); }
.topbar-title { color: var(--text); }
.channel-name-display { color: var(--text); }
.msg-author { color: var(--text); }
.stat-num { color: var(--text); font-weight: 700; }

/* Auth pages — headings readable */
.auth-logo h1 { color: var(--text) !important; }
.auth-logo p  { color: var(--muted) !important; }
.auth-link a  { color: var(--accent); }

/* Federation cards — override blue on text */
.pcard-name, .net-name, .pcard-title { color: var(--text) !important; }
.pcard-desc, .net-desc, .pcard-cat   { color: var(--muted) !important; }
.pcard-server, .net-stat              { color: var(--muted) !important; }
.ftag { background: rgba(74,158,255,.12); color: var(--accent); border-radius: 4px; padding: 2px 7px; font-size: 12px; }

/* Nav username and version */
.nav-username { color: var(--text); }
.nav-version  { color: var(--muted); }

/* Cap accent on text-only contexts */
p > a, li > a { color: var(--accent); }
.description, .about-text { color: var(--muted) !important; }

/* ── Nav right group ── */
.nav-right { display:flex; align-items:center; gap:2px; flex-shrink:0; padding-left:8px; border-left:1px solid var(--border); margin-left:6px; }
/* ── Dropdowns ── */
.nav-dropdown { position:relative; flex-shrink:0; }
.nav-dropdown-btn { display:inline-flex; align-items:center; gap:2px; }
.nav-dropdown-menu {
  display:none; position:absolute; top:calc(100% + 4px); left:0;
  min-width:200px; background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:4px 0; z-index:500;
  box-shadow:0 4px 16px rgba(0,0,0,.35);
}
.nav-dropdown-right { left:auto; right:0; }
.nav-dropdown.open .nav-dropdown-menu { display:block; }
.nav-dd-item {
  display:flex; align-items:center; gap:8px;
  padding:7px 14px; color:var(--text); text-decoration:none;
  font-size:13px; transition:background .1s; white-space:nowrap;
}
.nav-dd-item:hover { background:rgba(255,255,255,.06); }
.nav-dd-divider { height:1px; background:var(--border); margin:4px 0; }
.nav-dd-arrow { font-size:10px; opacity:.7; }
.nav-notif { position:relative; }

.nav-channels { overflow: visible !important; }


/* ── PWA + Mobile improvements ── */
@media (max-width: 768px) {
  /* Show top-nav on mobile regardless of sidebar state */
  .top-nav { display: flex !important; }
  .sidebar { display: none !important; }
  /* Make main area fill full height below top-nav */
  .app { flex-direction: column !important; }
  .main-area { height: calc(100vh - 52px); }
  /* Input area safe area for iOS home indicator */
  .msg-input-area { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  /* Fit auth card on small screens */
  .auth-card { padding: 28px 20px; }
  /* Thread panel full-screen overlay on mobile */
  .thread-panel:not(.hidden) {
    position: fixed; inset: 0; width: 100% !important; z-index: 100;
    border-left: none;
  }
  /* Top-nav text items — smaller on mobile */
  .nav-text-btn { font-size: 12px !important; padding: 5px 7px !important; }
  /* Page content padding */
  .page { padding: 12px 14px; }
}
/* PWA standalone mode — hide browser chrome indicators */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
}
