:root {
  --bg: #000000;
  --bg-panel: #16181c;
  --bg-hover: #1d1f23;
  --text-primary: #e7e9ea;
  --text-secondary: #71767b;
  --border: #2f3336;
  --accent: #ffffff;
  --danger: #f4212e;
  --success: #00ba7c;
  --font-display: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  line-height: 1.5;
  min-height: 100vh;
}

#space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0.25; }

/* ===== Layout: sidebar + content ===== */
.layout { display: flex; position: relative; z-index: 1; min-height: 100vh; }

.sidebar {
  width: 260px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1rem 1.25rem;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em;
}
.brand-glyph { font-size: 1.5rem; }

.nav-links-vertical { list-style: none; flex: 1; }

.nav-item-link {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.05rem; font-weight: 500;
  border-radius: 999px;
  transition: background 0.15s;
}
.nav-item-link .nav-ico { width: 1.5rem; text-align: center; }
.nav-item-link:hover { background: var(--bg-hover); }
.nav-item-link.active { font-weight: 800; }
.nav-item-link.owner-only { display: none; }
.nav-item-link.owner-only.visible { display: flex; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}

.btn-pill {
  display: block; width: 100%;
  padding: 0.7rem 1rem;
  background: var(--accent); color: #000;
  border: none; border-radius: 999px;
  font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-pill:hover { opacity: 0.85; }

.btn-pill.outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-pill.outline:hover { border-color: var(--text-primary); opacity: 1; }

.hamburger {
  display: none;
  position: fixed; top: 0.9rem; left: 0.9rem; z-index: 300;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-primary);
  width: 44px; height: 44px; font-size: 1.2rem;
  cursor: pointer;
}

.main-content {
  margin-left: 260px;
  width: calc(100% - 260px);
  min-height: 100vh;
  padding: 1.5rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Center every direct child in a fixed-width column */
.main-content > * {
  width: 100%;
  max-width: 980px;
}

.page-title {
  font-size: 1.4rem; font-weight: 800;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  position: sticky; top: 0;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
  z-index: 50;
}

/* ===== Hero (main) ===== */
.hero { text-align: center; padding: 3rem 1rem; margin-bottom: 2rem; }
.hero h1 { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 1.25rem; }

.status-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.status-badge.detected .status-dot { background: var(--danger); }
.status-badge.not_working .status-dot { background: var(--text-secondary); animation: none; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: #4a4f54; }
.card h2 { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.75rem; }
.card p { color: var(--text-secondary); font-size: 0.95rem; }

.code-block {
  display: flex; align-items: center; gap: 1rem;
  background: #0a0c0f;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.code-block code { flex: 1; color: var(--text-secondary); word-break: break-all; }
.code-block button {
  background: var(--accent); color: #000; border: none;
  padding: 0.5rem 1.1rem; border-radius: 999px;
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.copied-msg { color: var(--success); font-size: 0.85rem; margin-top: 0.5rem; opacity: 0; transition: opacity 0.3s; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.feature-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.35rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.88rem; }

.links-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
a.btn-link-primary {
  background: var(--accent); color: #000;
  padding: 0.7rem 1.4rem; border-radius: 999px;
  font-weight: 700; text-decoration: none; font-size: 0.95rem;
}
a.btn-link-secondary {
  border: 1px solid var(--border); color: var(--text-primary);
  padding: 0.7rem 1.4rem; border-radius: 999px;
  font-weight: 700; text-decoration: none; font-size: 0.95rem;
}

/* ===== Forum ===== */
.forum-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.tag-filter { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tag-chip {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem; border-radius: 999px;
  cursor: pointer; font-family: var(--font-mono); font-size: 0.8rem;
  transition: all 0.15s;
}
.tag-chip:hover, .tag-chip.active { border-color: var(--text-primary); color: var(--text-primary); }

.search-box { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.search-box input {
  flex: 1; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-primary); padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
}
.search-box input:focus { outline: none; border-color: #4a4f54; }
.search-box button {
  background: var(--accent); color: #000; border: none;
  padding: 0.7rem 1.2rem; border-radius: 999px;
  font-weight: 700; cursor: pointer;
}

.posts-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.post-card {
  display: flex; gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: var(--bg-hover); }
.post-detail .post-card { cursor: default; background: var(--bg-panel); }

.vote-column { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 36px; }
.vote-btn { background: none; border: none; color: var(--text-secondary); font-size: 1rem; cursor: pointer; padding: 0.1rem; transition: color 0.15s; }
.vote-btn:hover { color: var(--accent); }
.vote-btn.upvote.active { color: var(--success); }
.vote-btn.downvote.active { color: var(--danger); }
.vote-count { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }

.post-content { flex: 1; min-width: 0; }
.post-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; }
.post-meta { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.4rem; flex-wrap: wrap; }
.post-tag { font-family: var(--font-mono); color: var(--text-secondary); }
.post-preview { color: var(--text-secondary); font-size: 0.92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.user-cell { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.user-cell:hover span { text-decoration: underline; }

/* Avatars */
.avatar, .comment-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #000;
  background: var(--text-secondary); flex-shrink: 0; overflow: hidden;
}
.comment-avatar img, .avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-avatar-sm { width: 24px; height: 24px; font-size: 0.7rem; }
.comment-avatar-lg { width: 80px; height: 80px; font-size: 2rem; }

/* Comments */
.comment-item {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.comment-body-wrap { flex: 1; min-width: 0; }
.comment-author { font-weight: 700; font-size: 0.92rem; }
.comment-body { color: var(--text-secondary); font-size: 0.92rem; margin-top: 0.15rem; white-space: pre-wrap; }

.comment-form { display: flex; gap: 0.75rem; padding: 1rem 1.25rem; }
.comment-form textarea {
  flex: 1; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 12px;
  color: var(--text-primary); padding: 0.75rem 1rem;
  font-family: var(--font-display); font-size: 0.95rem;
  resize: vertical; min-height: 44px;
}
.comment-form textarea:focus { outline: none; border-color: #4a4f54; }
.comment-form button {
  background: var(--accent); color: #000; border: none;
  padding: 0.6rem 1.2rem; border-radius: 999px;
  font-weight: 700; cursor: pointer; align-self: flex-end;
}

.comments-section { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-top: 1rem; background: var(--bg-panel); }
.comments-section h3 { font-size: 1rem; font-weight: 800; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }

/* ===== Docs ===== */
.docs-layout { display: flex; gap: 2rem; align-items: flex-start; }

.docs-tabs {
  width: 220px; flex-shrink: 0;
  position: sticky; top: 70px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-panel); overflow: hidden;
}
.tab-btn {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none;
  color: var(--text-secondary);
  padding: 0.8rem 1.1rem;
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tab-btn.active { color: var(--text-primary); font-weight: 800; background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accent); }

.docs-content { flex: 1; min-width: 0; }
.doc-section h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.doc-feature { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.doc-feature:last-child { border-bottom: none; }
.doc-feature-name { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 700; margin-bottom: 0.2rem; }
.doc-feature-desc { color: var(--text-secondary); font-size: 0.92rem; }

.doc-edit-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem; border-radius: 999px;
  cursor: pointer; font-size: 0.78rem; margin-top: 0.4rem;
}
.doc-edit-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }

.executor-table { width: 100%; border-collapse: collapse; }
.executor-table th, .executor-table td { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--border); }
.executor-table th { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); }
.executor-status { padding: 0.2rem 0.6rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; }
.executor-status.full { background: var(--success); color: #000; }
.executor-status.partial { background: var(--text-secondary); color: #fff; }

.changelog-empty { color: var(--text-secondary); font-style: italic; }

/* ===== Dashboard ===== */
.dash-section { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; margin-bottom: 1.5rem; }
.dash-section h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 1rem; }

.status-controls { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.status-controls select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-primary); padding: 0.6rem 1rem;
  font-family: var(--font-mono); min-width: 180px;
}
.status-controls button {
  background: var(--accent); color: #000; border: none;
  padding: 0.6rem 1.4rem; border-radius: 999px;
  font-weight: 700; cursor: pointer;
}

.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dash-table th, .dash-table td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--border); }
.dash-table th { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-secondary); }

.mono { font-family: var(--font-mono); font-size: 0.85rem; }
.ip-cell { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-secondary); max-width: 110px; overflow: hidden; text-overflow: ellipsis; }

.role-badge { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; font-family: var(--font-mono); }
.role-badge.owner { background: var(--danger); color: #fff; }
.role-badge.user { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }

.user-status { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; font-family: var(--font-mono); white-space: nowrap; }
.user-status.banned { background: var(--danger); color: #fff; }
.user-status.muted { background: #ca8a04; color: #000; }
.user-status.warned { background: var(--bg-hover); color: #e7e9ea; border: 1px solid var(--border); }
.user-status.ok { background: var(--success); color: #000; }

.action-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.dash-action {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.35rem 0.6rem; border-radius: 999px;
  cursor: pointer; font-size: 0.78rem; white-space: nowrap;
  transition: all 0.15s;
}
.dash-action:hover { border-color: var(--text-primary); color: var(--text-primary); }
.dash-action.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ===== Modals ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 1rem;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 1.5rem;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.modal-content.modal-wide { max-width: 600px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header h3 { font-size: 1.15rem; font-weight: 800; }

.close-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-secondary);
  width: 32px; height: 32px; min-width: 32px;
  font-size: 1.1rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.close-btn:hover { color: var(--text-primary); border-color: var(--danger); }

.modal-content label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="url"],
.modal-content textarea,
.modal-content select {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px;
  color: var(--text-primary); padding: 0.7rem 0.9rem;
  font-size: 0.95rem; margin-bottom: 1rem;
  font-family: var(--font-display);
}
.modal-content input:focus, .modal-content textarea:focus { outline: none; border-color: #4a4f54; }

.modal-content button:not(.close-btn):not(.dash-action):not(.doc-edit-btn):not(.color-swatch):not(.profile-tab) {
  width: 100%; padding: 0.75rem;
  background: var(--accent); color: #000;
  border: none; border-radius: 999px;
  font-weight: 800; font-size: 0.95rem; cursor: pointer;
  transition: opacity 0.15s;
}
.modal-content button:not(.close-btn):hover { opacity: 0.85; }
.modal-content button.btn-outline {
  background: transparent; color: var(--text-primary); border: 1px solid var(--border);
}
.modal-content button.btn-outline:hover { border-color: var(--text-primary); opacity: 1; }

/* Avatar upload */
.avatar-section { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.4rem; }
.avatar-drop {
  border: 2px dashed var(--border); border-radius: 16px;
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  color: var(--text-secondary); font-size: 0.88rem;
  transition: all 0.2s;
}
.avatar-drop:hover, .avatar-drop.dragover { border-color: #4a4f54; background: var(--bg-hover); }
.avatar-preview { display: flex; align-items: center; justify-content: center; min-height: 60px; }
/* Perfect circle preview regardless of source aspect ratio */
.avatar-preview img {
  width: 120px; height: 120px;
  object-fit: cover; object-position: center;
  border-radius: 50%;
}
.avatar-divider { display: flex; align-items: center; gap: 0.75rem; color: var(--text-secondary); font-size: 0.78rem; }
.avatar-divider::before, .avatar-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.avatar-hint { color: var(--text-secondary); font-size: 0.75rem; font-family: var(--font-mono); margin-bottom: 0.75rem; }

/* Crop UI */

.color-picker { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.1s, border-color 0.15s; }
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected { border-color: var(--text-primary); }

/* Profile card in modal */
.profile-card { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.profile-details h4 { font-size: 1.1rem; font-weight: 800; }
.profile-details p { color: var(--text-secondary); font-size: 0.85rem; }

/* User info popup */
.user-popup-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.user-popup-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.user-popup-stat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem; }
.user-popup-stat .label { font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; font-family: var(--font-mono); }
.user-popup-stat .value { font-size: 1rem; font-weight: 800; }

/* Top-right actions (notifications + lang) */
.top-actions {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 400;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.top-actions .nav-icon-btn {
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
}

/* Notification panel (40% width slide-in) */
.notif-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 40vw;
  min-width: 340px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  z-index: 650;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}

.notif-panel.open {
  transform: translateX(0);
}

.notif-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-panel-header h3 { font-size: 1.1rem; font-weight: 800; }

.notif-panel-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* messages sit at the bottom */
}

.notif-panel-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-panel-footer button {
  width: 100%;
  padding: 0.7rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 700; cursor: pointer;
  transition: all 0.15s;
}

.notif-panel-footer button:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.notif-item { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); }
.notif-item.unread { background: rgba(255,255,255,0.03); }
.notif-item strong { font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; }
.notif-item strong.muted, .notif-item strong.banned, .notif-item strong.ipban { color: var(--danger); }
.notif-item strong.warn { color: #ca8a04; }
.notif-item strong.unmuted, .notif-item strong.unbanned { color: var(--success); }
.notif-item p { margin: 0.2rem 0 0; color: var(--text-secondary); font-size: 0.88rem; }
.notif-item .notif-time { font-size: 0.72rem; color: var(--text-secondary); font-family: var(--font-mono); }

.notif-panel-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 640;
}

/* Notifications */
.nav-actions { display: flex; gap: 0.5rem; align-items: center; }
.nav-icon-btn {
  position: relative;
  background: transparent; border: none;
  color: var(--text-secondary); font-size: 1.15rem;
  cursor: pointer; padding: 0.4rem; transition: color 0.15s;
}
.nav-icon-btn:hover { color: var(--text-primary); }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 0.65rem; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); padding: 0 4px;
}

.notif-dropdown {
  position: fixed;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 16px;
  z-index: 600; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.notif-item { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item strong { font-size: 0.8rem; font-family: var(--font-mono); text-transform: uppercase; }
.notif-item strong.muted, .notif-item strong.banned, .notif-item strong.ipban { color: var(--danger); }
.notif-item strong.warn { color: #ca8a04; }
.notif-item strong.unmuted, .notif-item strong.unbanned { color: var(--success); }
.notif-item p { margin: 0.2rem 0 0; color: var(--text-secondary); font-size: 0.88rem; }
.notif-item.unread { background: rgba(255,255,255,0.03); }

/* Misc */
.hidden { display: none !important; }
.empty-state { text-align: center; color: var(--text-secondary); padding: 2.5rem 1rem; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,0.6); }
  .hamburger { display: block; }
  .main-content { margin-left: 0; width: 100%; padding: 4.5rem 1rem 3rem; }
  .docs-layout { flex-direction: column; }
  .docs-tabs { width: 100%; position: static; display: flex; overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 90; }
  .notif-panel { width: 100vw; min-width: 100vw; }
  .profile-tabs-layout { flex-direction: column; }
  .profile-tabs { flex-direction: row; width: auto; }
}

/* ===== Profile modal: side tabs ===== */
.profile-tabs-layout { display: flex; gap: 1rem; align-items: flex-start; }

.profile-tabs {
  width: 130px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 0.25rem;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 0.4rem;
}

.profile-tab {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none;
  color: var(--text-secondary);
  padding: 0.65rem 0.85rem; border-radius: 10px;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.profile-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.profile-tab.active { background: var(--bg-hover); color: var(--text-primary); font-weight: 800; box-shadow: inset 3px 0 0 var(--accent); }

.profile-tab-panels { flex: 1; min-width: 0; }
.profile-panel { min-height: 200px; }

.profile-view-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.profile-view-title { display: flex; flex-direction: column; gap: 0.15rem; align-items: flex-start; }
.profile-view-title h4 { font-size: 1.2rem; font-weight: 800; }
.profile-public-id { color: var(--text-secondary); font-size: 0.78rem; letter-spacing: 0.04em; }

.profile-bio {
  color: var(--text-secondary); font-size: 0.92rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 1rem; margin-bottom: 1rem;
  white-space: pre-wrap; word-break: break-word;
}
.profile-bio.empty { font-style: italic; opacity: 0.6; }

.profile-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.mono { font-family: var(--font-mono); }
.value-sm { font-size: 0.85rem !important; font-family: var(--font-mono); font-weight: 600; }

.field-hint { color: var(--text-secondary); font-size: 0.75rem; font-family: var(--font-mono); margin: -0.6rem 0 1rem; }
.field-hint.center { text-align: center; margin-top: 0.75rem; }

/* Login modal */
.login-error {
  color: var(--danger); font-size: 0.85rem; font-weight: 600;
  background: rgba(244, 33, 46, 0.08);
  border: 1px solid rgba(244, 33, 46, 0.35);
  border-radius: 10px; padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}

.popup-bio {
  color: var(--text-secondary); font-size: 0.9rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.7rem 0.9rem; margin-bottom: 1rem;
  white-space: pre-wrap; word-break: break-word;
}

/* Password section in edit tab */
.password-section {
  border-top: 1px solid var(--border);
  margin-top: 1.25rem; padding-top: 1rem;
}
.password-section h4 { font-size: 0.95rem; font-weight: 800; margin-bottom: 0.75rem; }

/* Disabled color picker (photo is set) */
.color-picker.picker-disabled { opacity: 0.35; pointer-events: none; filter: grayscale(1); }
.color-picker.picker-disabled .color-swatch { cursor: not-allowed; }

/* Crop UI v2 (reusable picker, lives inside avatar-drop) */
.avatar-drop { position: relative; }

/* ===== Comment replies (threads) ===== */
.comment-thread { border-left: 2px solid var(--border); margin-left: 1.2rem; padding-left: 0.5rem; }
.comment-thread > .comment-thread { border-left-style: solid; opacity: 1; }
.comment-item.is-reply { position: relative; }
.comment-item.is-reply::before {
  content: '↳';
  position: absolute; left: -1.15rem; top: 1rem;
  color: var(--text-secondary); font-size: 0.85rem;
}
.comment-actions { display: flex; justify-content: flex-end; margin-top: 0.25rem; }
.comment-reply-btn {
  background: transparent; border: none;
  color: var(--text-secondary); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; padding: 0.15rem 0.5rem; border-radius: 999px;
  transition: all 0.15s;
}
.comment-reply-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.comment-reply-btn.active { color: #000; background: var(--accent); }

.reply-form { margin-top: 0.5rem; }
.reply-form textarea {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-primary); padding: 0.5rem 0.75rem;
  font-family: var(--font-display); font-size: 0.88rem;
  resize: vertical;
}
.reply-form textarea:focus { outline: none; border-color: #4a4f54; }
.reply-form .reply-cancel, .reply-form .reply-send {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.35rem 0.9rem;
  border-radius: 999px; font-weight: 700; font-size: 0.8rem; cursor: pointer;
}
.reply-form .reply-send { background: var(--accent); color: #000; border: none; }

/* Inline moderation buttons on post cards */
.mod-btn {
  background: transparent; border: 1px solid var(--border);
  padding: 0.25rem 0.6rem; border-radius: 999px;
  cursor: pointer; font-size: 0.75rem; font-weight: 700;
}
.mod-btn.danger { border-color: var(--danger); color: var(--danger); }
.mod-btn.success { border-color: var(--success); color: var(--success); }

/* ===== Dashboard overlay ===== */
.dashboard-overlay {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.dashboard-content {
  width: 100%; max-width: 980px;
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 1.5rem;
  max-height: calc(100vh - 4rem); overflow-y: auto;
}
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.dashboard-header h2 { font-size: 1.3rem; font-weight: 800; }

.dash-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.dash-tab {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1.1rem; border-radius: 999px;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.dash-tab:hover { color: var(--text-primary); border-color: var(--text-primary); }
.dash-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 800; }

.dash-tabs select, .dash-doc-tabs select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-primary); padding: 0.5rem 1rem;
  font-family: var(--font-mono); min-width: 160px; margin-bottom: 0.75rem;
}

.dash-table tr { cursor: pointer; transition: background 0.1s; }
.dash-table tr.selected { background: var(--bg-hover); }

.user-control {
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.25rem; margin-top: 1rem;
}
.user-control-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.user-control-header h3 { font-size: 1.05rem; font-weight: 800; }
.user-control-header p { color: var(--text-secondary); font-size: 0.85rem; }
.user-control-bio {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.5rem 0.75rem; margin-top: 0.4rem;
  color: var(--text-secondary); font-size: 0.85rem; white-space: pre-wrap;
}
.user-control .action-btns { margin-top: 0.5rem; }

.user-status.partial { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }

.dash-add-form {
  border-top: 1px solid var(--border);
  margin-top: 1.25rem; padding-top: 1rem;
}
.dash-add-form h3 { font-size: 0.95rem; font-weight: 800; margin-bottom: 0.75rem; }
.dash-add-form input, .dash-add-form textarea, .dash-add-form select {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-primary); padding: 0.55rem 0.8rem;
  font-size: 0.9rem; margin-bottom: 0.6rem;
  font-family: var(--font-display);
}
.dash-add-form select { width: auto; font-family: var(--font-mono); }
.dash-add-form button {
  background: var(--accent); color: #000; border: none;
  padding: 0.55rem 1.4rem; border-radius: 999px;
  font-weight: 800; cursor: pointer;
}

.changelog-entry {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.75rem 1rem; margin-bottom: 0.6rem;
}
.changelog-entry p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.3rem; white-space: pre-wrap; }

/* ===== Online / offline presence ===== */
/* The dot must override the photo: visible wrapper, photo clipped by its own radius */
.avatar-with-status { position: relative; overflow: visible !important; }
.avatar-with-status img { border-radius: 50%; }
.avatar-status {
  position: absolute; bottom: 0; right: 0;
  width: 8px; height: 8px; min-width: 8px; min-height: 8px;
  border-radius: 50%;
  border: 1.5px solid #000;
  box-sizing: content-box;
  z-index: 3;
  pointer-events: none;
}
.comment-avatar-sm .avatar-status { width: 5px; height: 5px; min-width: 5px; min-height: 5px; border-width: 1px; }
.avatar-lg .avatar-status { width: 12px; height: 12px; min-width: 12px; min-height: 12px; border-width: 2px; }
.avatar-status.online { background: var(--success); box-shadow: 0 0 4px rgba(0, 186, 124, 0.7); }
.avatar-status.offline { background: var(--danger); opacity: 0.8; }

.profile-presence { font-size: 0.75rem; font-weight: 700; font-family: var(--font-mono); }
.profile-presence.online { color: var(--success); }
.profile-presence.offline { color: var(--danger); }

/* ===== User search results panel ===== */
.user-search-results {
  position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 14px;
  z-index: 200; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  max-height: 320px; overflow-y: auto;
}
.user-search-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1rem; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.user-search-item:last-child { border-bottom: none; }
.user-search-item:hover { background: var(--bg-hover); }
.user-search-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-search-name { font-weight: 700; font-size: 0.92rem; }
.user-search-pid { color: var(--text-secondary); font-size: 0.72rem; }
.user-search-empty { padding: 0.8rem 1rem; color: var(--text-secondary); font-size: 0.85rem; text-align: center; }
.user-search-item .profile-presence { flex-shrink: 0; }

/* ===== Profile settings section ===== */
.settings-section {
  border-top: 1px solid var(--border);
  margin-top: 1.25rem; padding-top: 1rem;
}
.settings-section h4 { font-size: 0.95rem; font-weight: 800; margin-bottom: 0.75rem; }
.toggle-row {
  display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer; font-size: 0.92rem; color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.toggle-row input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer;
}
