:root {
  --bg-base:        #0d0d11;
  --bg-surface:     #13131a;
  --bg-raised:      #1a1a24;
  --bg-hover:       #22222f;
  --border:         rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.15);
  --text-primary:   #f0f0f5;
  --text-secondary: #8b8b99;
  --text-muted:     #55555f;
  --accent:         #00ff88;
  --accent-dim:     rgba(0,255,136,0.15);
  --accent-blue:    #00e5ff;
  --accent-pink:    #ff007f;
  --accent-warn:    #f59e0b;
  --sidebar-w:      220px;
  --topbar-h:       56px;
  --radius:         10px;
  --radius-sm:      6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg-base); color: var(--text-primary); overflow: hidden; font-size: 14px; }

/* ── Shell Layout ── */
#forum-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
}
#sidebar-backdrop { display: none; }
.sidebar-mobile-close { display: none; }

/* ── Sidebar ── */
#sidebar {
  grid-row: 1 / 3;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease;
}
#sidebar.collapsed { width: 56px; }

.sidebar-logo {
  padding: 18px 20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.logo-nbd   { color: var(--text-primary); }
.logo-forum { color: var(--accent); margin-left: 4px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

#sidebar.collapsed .logo-forum { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}
#sidebar.collapsed .sidebar-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover  { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.nav-icon  { font-size: 15px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge { margin-left: auto; background: var(--accent-pink); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

#sidebar.collapsed .nav-label,
#sidebar.collapsed .nav-badge { display: none; }
#sidebar.collapsed .nav-item  { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .nav-icon  { font-size: 18px; }
#sidebar.collapsed .sidebar-logo { padding: 16px 0; text-align: center; font-size: 14px; }
#sidebar.collapsed .sidebar-footer { display: none; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.sidebar-terms-link { font-size: 11px; color: var(--text-muted); text-decoration: none; padding: 0 6px; transition: color 0.15s; }
.sidebar-terms-link:hover { color: var(--accent-blue); }

/* ── Topbar ── */
#topbar {
  grid-column: 2;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}
#sidebar-toggle {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 18px; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: color 0.15s; flex-shrink: 0;
}
#sidebar-toggle:hover { color: var(--text-primary); }
.topbar-breadcrumb { color: var(--text-primary); font-weight: 600; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-user-chip {
  background: var(--bg-raised); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px; font-size: 12px;
  color: var(--accent); font-weight: 600;
}
.topbar-user-chip.guest { color: var(--text-muted); }

.map-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 20px;
  background: transparent;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.map-pill-btn:hover {
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}

.topbar-login-btn {
  background: transparent;
  border: 2px solid var(--accent-green, #00ff88);
  color: var(--accent-green, #00ff88);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.topbar-login-btn:hover {
  background: rgba(0, 255, 136, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.25);
}

.topbar-profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--accent-blue);
  background: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.topbar-profile-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}
.topbar-profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.own-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 20px 0;
}

.own-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--accent-blue);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(0,0,0,0.5);
  box-shadow: 0 0 12px rgba(0, 150, 255, 0.35);
}

.own-profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}

.own-profile-field {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  width: 100%;
  transition: border-color 0.15s;
}
.own-profile-field:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.own-profile-field::placeholder { color: var(--text-muted); }

.own-profile-bio-wrap {
  padding: 12px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.own-profile-bio {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.own-profile-bio:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.own-profile-bio::placeholder { color: var(--text-muted); }

.own-profile-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.own-profile-save-btn {
  flex: 1;
  padding: 9px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.own-profile-save-btn:hover { background: rgba(0, 229, 255, 0.22); }

.own-profile-logout-btn {
  flex: 1;
  padding: 9px;
  background: rgba(255, 60, 60, 0.12);
  border: 1px solid rgba(255, 60, 60, 0.35);
  color: #ff6b6b;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.own-profile-logout-btn:hover { background: rgba(255, 60, 60, 0.22); }

/* ── Panels ── */
.panel {
  grid-column: 2;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 32px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h));
}
.panel.active { display: flex; }
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}
.panel-header h1 { font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 700; }
.panel-subtitle  { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

/* ── Thread Feed (list view) ── */
.thread-feed { display: flex; flex-direction: column; gap: 8px; }

.thread-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.thread-card:hover              { border-color: var(--border-strong); background: var(--bg-hover); }
.thread-card--pinned            { border-color: rgba(255,0,127,0.3); }
.thread-card--pinned:hover      { border-color: rgba(255,0,127,0.6); }

.thread-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.thread-card-meta  { display: flex; align-items: flex-start; gap: 8px; flex: 1; flex-wrap: wrap; }
.thread-title      { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.thread-card-stats { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stat-chip         { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.thread-card-footer { display: flex; align-items: center; gap: 8px; }
.author-chip       { font-size: 12px; color: var(--accent-blue); font-weight: 600; }
.time-chip         { font-size: 12px; color: var(--text-muted); }

.badge-pinned {
  display: inline-block; padding: 2px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,0,127,0.15); color: var(--accent-pink);
  border: 1px solid rgba(255,0,127,0.3); white-space: nowrap; flex-shrink: 0;
}

/* ── Thread View ── */
.thread-posts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* Tree node wrapper */
.post-thread-node { display: flex; flex-direction: column; }

/* Indented children with left thread line */
.post-children {
  margin-left: 24px;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Progressively dim the thread lines at depth */
.post-children .post-children { border-color: rgba(255,255,255,0.04); }

/* Post card */
.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-card--op { border-color: rgba(0,229,255,0.2); }

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.post-author-info  { display: flex; align-items: center; gap: 10px; }
.post-avatar       { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-raised); }
.post-author-name  { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.post-author-name.is-op { color: var(--accent-blue); }
.verified-badge    {
  font-size: 10px; font-weight: 700; color: var(--accent-pink);
  background: rgba(255,0,127,0.12); padding: 1px 6px; border-radius: 8px;
  border: 1px solid rgba(255,0,127,0.3); margin-left: 6px; vertical-align: middle;
}
.post-time { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

.post-action-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.vote-btn {
  display: flex; align-items: center; gap: 4px;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); padding: 3px 8px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
  transition: all 0.15s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); }

.reply-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary); padding: 3px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; font-weight: 500; transition: all 0.15s;
}
.reply-btn:hover  { border-color: var(--border-strong); color: var(--text-primary); }
.reply-btn.active { border-color: var(--accent-blue); color: var(--accent-blue); }

.post-body {
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}
.post-body p { margin-bottom: 8px; }
.post-body p:last-child { margin-bottom: 0; }
.post-body a { color: var(--accent-blue); }

/* Inline reply form (appears inside a post card, below the body) */
.inline-reply-box {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}
.inline-reply-box textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Inter', sans-serif; font-size: 13px;
  resize: vertical; min-height: 70px; transition: border-color 0.2s;
}
.inline-reply-box textarea:focus { outline: none; border-color: var(--accent-blue); }
.inline-reply-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Top-level reply form at bottom of thread view */
.top-reply-form {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.top-reply-form h4 {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px;
}
.top-reply-form textarea {
  width: 100%; padding: 12px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Inter', sans-serif; font-size: 14px;
  resize: vertical; min-height: 90px; transition: border-color 0.2s;
}
.top-reply-form textarea:focus { outline: none; border-color: var(--accent); }
.top-reply-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

.guest-reply-prompt {
  text-align: center; padding: 18px;
  color: var(--text-muted); font-size: 13px;
}
.guest-reply-prompt a { color: var(--accent); cursor: pointer; }

/* ── States ── */
.loading-state { text-align: center; color: var(--text-secondary); padding: 40px; font-size: 14px; }
.empty-state   { color: var(--text-muted); text-align: center; padding: 48px; font-size: 14px; }

/* ── Buttons ── */
.btn-primary-sm {
  background: var(--accent); color: #000; border: none;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-primary-sm:hover    { opacity: 0.85; }
.btn-primary-sm:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  color: var(--text-primary); padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; transition: background 0.15s; font-family: 'Inter', sans-serif;
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary); padding: 7px 14px;
  border-radius: var(--radius-sm); font-size: 13px;
  cursor: pointer; transition: all 0.15s; font-family: 'Inter', sans-serif;
}
.btn-ghost:hover     { border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost.btn-sm    { padding: 5px 10px; font-size: 12px; }

.modal-close-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
}
.modal-close-btn:hover { color: var(--text-primary); }

/* ── Modals ── */
.forum-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.forum-modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: 90vh; width: min(680px, 95vw);
  transition: width 0.25s ease, max-height 0.25s ease, border-radius 0.25s ease;
}
.forum-modal-content.expanded {
  width: 98vw;
  height: 96vh;
  max-height: 96vh;
  border-radius: 8px;
}
.forum-modal-content.expanded .forum-modal-body {
  flex: 1;
  min-height: 0;
}
.forum-modal-content.expanded .forum-modal-body > .form-group:last-of-type {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.forum-modal-content.expanded #quill-create {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.forum-modal-content.expanded #quill-create .ql-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.forum-modal-content.expanded #quill-create .ql-editor {
  min-height: 100%;
}
.forum-modal-sm { width: min(420px, 95vw); }

.modal-expand-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 16px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}
.modal-expand-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.forum-modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.forum-modal-header h2 { font-size: 16px; font-weight: 600; }
.forum-modal-body  { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.forum-modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  background: var(--bg-raised); border: 1px solid var(--border);
  color: var(--text-primary); padding: 9px 12px;
  border-radius: var(--radius-sm); font-size: 13px;
  font-family: inherit; transition: border-color 0.2s; width: 100%;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-error {
  background: rgba(255,0,0,0.1); border: 1px solid rgba(255,0,0,0.3);
  color: #ff6b6b; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px;
}

/* ── Quill dark overrides ── */
.ql-toolbar.ql-snow {
  background: var(--bg-raised) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
}
.ql-container.ql-snow {
  border-color: var(--border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
  background: var(--bg-base); min-height: 130px;
}
.ql-editor { color: var(--text-primary) !important; min-height: 130px; font-size: 14px; }
.ql-editor.ql-blank::before { color: var(--text-muted) !important; font-style: normal !important; }
.ql-stroke { stroke: var(--text-secondary) !important; }
.ql-fill   { fill:   var(--text-secondary) !important; }
.ql-picker  { color:  var(--text-secondary) !important; }
.ql-picker-options { background: var(--bg-raised) !important; border-color: var(--border) !important; }
.ql-editor p  { margin-bottom: 6px; }

/* Render Quill output in post bodies (same element, so compound selector not descendant) */
.post-body.ql-editor { padding: 14px 16px; min-height: auto; }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; min-width: 220px;
  animation: slideUp 0.25s ease;
}
.toast--success { border-color: rgba(0,255,136,0.4); }
.toast--error   { border-color: rgba(255,0,0,0.4); }
.toast--warn    { border-color: rgba(245,158,11,0.4); }
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── Admin Shield Button (topbar) — matches map page pink pill ── */
.forum-shield-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 2px solid var(--accent-pink);
  color: var(--accent-pink);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: box-shadow 0.2s;
  flex-shrink: 0;
}
.forum-shield-btn:hover {
  box-shadow: 0 0 12px rgba(255,0,127,0.4);
}

/* ── Sidebar Admin Section ── */
.sidebar-admin-section {
  padding: 8px 8px 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.new-channel-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  text-align: left;
}
.new-channel-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Icon input centered */
.channel-icon-input { font-size: 20px; text-align: center; }

/* ── Mod Controls (admin/reviewer overlay) ── */
.mod-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.mod-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-right: 2px;
  flex-shrink: 0;
}
.mod-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
}
.mod-btn:hover       { border-color: var(--border-strong); color: var(--text-primary); }
.mod-btn--danger     { color: rgba(255,60,60,0.7); border-color: rgba(255,60,60,0.2); }
.mod-btn--danger:hover {
  color: #ff5555;
  border-color: rgba(255,60,60,0.5);
  background: rgba(255,60,60,0.08);
}

.btn-danger {
  background: rgba(255,60,60,0.1);
  border: 1px solid rgba(255,60,60,0.35);
  color: #ff5555;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-danger:hover { background: rgba(255,60,60,0.18); border-color: rgba(255,60,60,0.6); }

/* ══ MOBILE ( ≤ 768px ) ════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body.sidebar-is-open { overflow: hidden; }

  #forum-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
  }
  #topbar { grid-column: 1; }

  #sidebar {
    grid-row: unset;
    position: fixed; top: 0; left: 0;
    height: 100dvh;
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.25,0.86,0.44,1);
    z-index: 800; overflow-y: auto;
  }
  #sidebar.mobile-open { transform: translateX(0); }

  /* Restore labels collapsed mode hides */
  #sidebar .nav-label,
  #sidebar .nav-badge,
  #sidebar .sidebar-footer  { display: unset; }
  #sidebar .sidebar-section-label { display: block; }
  #sidebar .nav-item { justify-content: flex-start; padding: 12px 16px; }
  #sidebar .nav-icon { font-size: 15px; }
  #sidebar .sidebar-logo { padding: 18px 20px; font-size: 18px; }

  .sidebar-mobile-close {
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; background: none; border: none;
    color: var(--text-muted); font-size: 18px; cursor: pointer;
    padding: 4px 6px; border-radius: var(--radius-sm);
  }
  .sidebar-mobile-close:hover { color: var(--text-primary); }

  #sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.65); z-index: 700;
    backdrop-filter: blur(2px);
  }
  #sidebar-backdrop.visible { display: block; }

  .panel { grid-column: 1; padding: 16px 14px; gap: 16px; }
  .panel-header { flex-direction: column; align-items: flex-start; }

  .post-children { margin-left: 12px; padding-left: 10px; }

  .topbar-user-chip { display: none; }
  #topbar { padding: 0 12px; gap: 8px; }

  .forum-modal-content { width: 96vw !important; max-height: 92dvh; }
  .forum-modal-body    { padding: 16px; }
  .forum-modal-footer  { padding: 12px 16px; }

  .top-reply-form { padding: 14px; }
  .user-profile-modal { width: 96vw; max-height: 88dvh; }

  /* Topbar pills — icon-only Map pill, smaller Login pill */
  .map-pill-btn {
    padding: 7px 10px;
    font-size: 0;        /* hide "Map" text, keep icon */
    gap: 0;
  }
  .map-pill-btn .material-symbols-outlined {
    font-size: 20px !important;
  }
  .topbar-login-btn {
    padding: 7px 12px;
    font-size: 13px;
  }

  /* Panel header — stack button below title, full width */
  .panel-header {
    gap: 12px;
  }
  #new-thread-btn {
    align-self: flex-start;
  }

  /* Own-profile modal */
  .own-profile-header   { padding: 16px 16px 0; }
  .own-profile-avatar   { width: 56px; height: 56px; }
  .own-profile-bio-wrap { padding: 10px 16px 10px; }
  .own-profile-footer   { padding: 10px 16px; }

  /* Inputs — 16px prevents iOS auto-zoom */
  .own-profile-field,
  .own-profile-bio,
  .form-input,
  textarea { font-size: 16px !important; }
}

/* ── Clickable author names ──────────────────────────────────────────────── */
.author-chip--link {
  cursor: pointer;
  transition: color 0.15s;
}
.author-chip--link:hover { color: var(--accent); }

.post-author-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-family: inherit;
}
.post-author-link:hover .post-author-name { color: var(--accent); }
.post-author-link:hover .post-avatar { outline: 2px solid var(--accent); }

/* ── User Profile Modal ──────────────────────────────────────────────────── */
.user-profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.user-profile-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: min(480px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.user-profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.user-profile-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.user-profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--accent-blue);
  object-fit: cover;
  background: rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.user-profile-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.user-profile-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.user-profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.user-profile-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 20px;
  cursor: pointer;
  transition: color 0.15s;
}
.user-profile-tab:hover { color: var(--text-primary); }
.user-profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.user-profile-body {
  overflow-y: auto;
  flex: 1;
}

.profile-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 28px;
  font-size: 13px;
}

.profile-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.profile-row:last-child { border-bottom: none; }
.profile-row:hover { background: var(--bg-hover); }

.profile-row-context {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.profile-row-title {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.profile-row-time {
  font-size: 11px;
  color: var(--text-muted);
}
