/* ------------------------------------------------------------------
   Nidus Community — visual language shared with Nidus Videos, Music,
   Studio and the rest of the Nidus services.
   ------------------------------------------------------------------ */

:root {
  --bg: #0f1714;
  --surface: #16211c;
  --surface-raised: #1b2923;
  --surface-soft: #121c17;
  --border: #2f473c;
  --border-soft: #25382f;
  --text: #f0f7f2;
  --text-soft: #cfe0d4;
  --muted: #93a89a;
  --accent: #49b88e;
  --accent-hover: #3aa67d;
  --accent-soft: rgba(73, 184, 142, 0.16);
  --accent-line: rgba(73, 184, 142, 0.42);
  --accent-text: #8fe0b9;
  --on-accent: #071a12;
  --green: #62d68a;
  --green-dark: #4bbd78;
  --danger: #ef6570;
  --header: rgba(15, 23, 20, 0.94);
  --glow: rgba(73, 184, 142, 0.14);
  --line: var(--border);
  --radius: 15px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root.light {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #eaf3ed;
  --border: #d9e7de;
  --border-soft: #e7f0ea;
  --text: #1b2a22;
  --text-soft: #3d5245;
  --muted: #6f8377;
  --accent: #2e9e6b;
  --accent-hover: #278a5c;
  --accent-soft: rgba(46, 158, 107, 0.12);
  --accent-line: rgba(46, 158, 107, 0.32);
  --accent-text: #237a54;
  --on-accent: #ffffff;
  --green: #2f9e5f;
  --green-dark: #287e50;
  --danger: #d64552;
  --header: rgba(244, 248, 245, 0.94);
  --glow: rgba(46, 158, 107, 0.1);
  --shadow: 0 14px 38px rgba(27, 66, 47, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, var(--glow), transparent 45%) fixed,
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ------------------------------------------------------------------ */
/* Header                                                             */
/* ------------------------------------------------------------------ */

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 12px clamp(14px, 3vw, 38px);
  background: var(--header);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--text);
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-name {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.7px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 560px;
  min-height: 44px;
  padding: 4px 5px 4px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-row > i {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
}

.search-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
}

.search-row input::placeholder {
  color: var(--muted);
}

.search-clear {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--muted);
}

.search-toggle {
  display: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  position: relative;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.notification-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border: 2px solid var(--header);
  border-radius: 50%;
}

.profile-wrap {
  position: relative;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0 3px 15px;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--border);
  color: var(--text);
  text-align: left;
}

.profile-text {
  display: block;
  min-width: 0;
}

.profile-text b {
  display: block;
  max-width: 150px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-text small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.tiny {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
}

.profile-menu {
  position: absolute;
  top: 51px;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 205px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.profile-menu button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  text-align: left;
}

.profile-menu button:hover {
  background: var(--accent-soft);
}

.profile-menu button i {
  width: 18px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Avatars                                                            */
/* ------------------------------------------------------------------ */

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  overflow: hidden;
  background: linear-gradient(135deg, #49b88e, #267c62);
  border-radius: 50%;
  color: #fff;
  font-family: Manrope, Inter, sans-serif;
  font-weight: 800;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.deleted-avatar {
  background: var(--surface-soft);
  color: var(--muted);
}

.deleted-account {
  color: var(--muted);
  font-weight: 600;
}

.avatar-small {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar-tiny {
  width: 23px;
  height: 23px;
  font-size: 9px;
}

.avatar-tiny.alt {
  background: linear-gradient(135deg, #7bc9a7, #3d8f6c);
}

/* ------------------------------------------------------------------ */
/* Buttons and shared controls                                        */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-raised);
}

.btn-small {
  min-height: 32px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.text-btn {
  padding: 5px 6px;
  background: transparent;
  border: 0;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 650;
}

.text-btn:hover {
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Layout                                                             */
/* ------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  width: 100%;
  max-width: 1180px;
  margin: 26px auto 80px;
  padding: 0 clamp(16px, 3vw, 38px);
}

.left-rail {
  position: sticky;
  top: 98px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rail-compose {
  min-height: 44px;
}

.main-column {
  min-width: 0;
}

/* ------------------------------------------------------------------ */
/* Rail cards                                                         */
/* ------------------------------------------------------------------ */

.rail-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.rail-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.rail-title i {
  color: var(--accent-text);
  font-size: 12px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.rail-link i {
  width: 17px;
  text-align: center;
}

.rail-link:hover,
.rail-link.active {
  background: var(--accent-soft);
  color: var(--text);
}

.rail-link.active i {
  color: var(--accent-text);
}

.online-pip {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: auto;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(98, 214, 138, 0.12);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-chip {
  padding: 6px 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tag-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 2px 4px;
  color: var(--muted);
  font-size: 11px;
}

.rail-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.rail-footer a {
  color: var(--muted);
}

.rail-footer a:hover,
.rail-shortcut:hover {
  color: var(--text);
}

.rail-footer span {
  margin: 0 5px;
}

.rail-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Page heading and composer                                          */
/* ------------------------------------------------------------------ */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(25px, 2.6vw, 33px);
  font-weight: 750;
  letter-spacing: -1px;
  line-height: 1.1;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tag-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 9px 13px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 600;
}

.composer-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.composer-card:hover {
  border-color: var(--accent-line);
}

.composer-card.signed-out {
  opacity: 0.9;
}

.composer-prompt {
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}

.composer-prompt:hover {
  border-color: var(--accent);
  color: var(--text);
}

.composer-quick {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
}

.composer-quick:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ------------------------------------------------------------------ */
/* Posts                                                              */
/* ------------------------------------------------------------------ */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.post-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s;
}

.post-card:hover {
  border-color: var(--accent-line);
}

.post-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.post-author {
  min-width: 0;
}

.author-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.author-line button {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.author-line button:hover {
  color: var(--accent-text);
}

.post-time {
  color: var(--muted);
  font-size: 11.5px;
}

.post-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.post-type.question {
  background: rgba(81, 131, 209, 0.14);
  border-color: rgba(81, 131, 209, 0.38);
  color: #8db4f2;
}

.post-type.showcase {
  background: rgba(58, 147, 68, 0.15);
  border-color: rgba(58, 147, 68, 0.38);
  color: #7bd68b;
}

.post-type.announcement {
  background: rgba(211, 158, 62, 0.14);
  border-color: rgba(211, 158, 62, 0.38);
  color: #e5bd75;
}

.post-type.poll {
  background: rgba(71, 162, 170, 0.14);
  border-color: rgba(71, 162, 170, 0.38);
  color: #7ecfd4;
}

.post-type.link {
  background: rgba(171, 94, 196, 0.14);
  border-color: rgba(171, 94, 196, 0.38);
  color: #d2a1e3;
}

:root.light .post-type.question {
  color: #315fae;
}

:root.light .post-type.showcase {
  color: #287e50;
}

:root.light .post-type.announcement {
  color: #8a6114;
}

:root.light .post-type.poll {
  color: #26777c;
}

:root.light .post-type.link {
  color: #7c3b92;
}

.post-menu {
  position: relative;
  margin-left: auto;
}

.post-menu > button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
}

.post-menu > button:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.post-menu-list {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 60;
  width: 202px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.post-card.menu-open {
  position: relative;
  z-index: 30;
}

.post-menu-list button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
}

.post-menu-list button:hover {
  background: var(--accent-soft);
}

.post-menu-list button i {
  width: 16px;
  color: var(--muted);
  text-align: center;
}

.post-menu-list button.danger {
  color: var(--danger);
}

.post-menu-list button.danger i {
  color: var(--danger);
}

.post-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.35px;
  line-height: 1.25;
}

.post-title button {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.post-title button:hover {
  color: var(--accent-text);
}

.post-body {
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body > :last-child {
  margin-bottom: 0;
}

.post-body a,
.reply-body a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body code,
.reply-body code {
  padding: 2px 5px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--accent-text);
  font-size: 0.92em;
}

.post-body pre,
.reply-body pre {
  overflow: auto;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.post-body pre code,
.reply-body pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

.post-body blockquote,
.reply-body blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.spoiler {
  padding: 0 3px;
  background: var(--text);
  border-radius: 4px;
  color: transparent;
  cursor: pointer;
}

.spoiler.revealed,
.spoiler:hover,
.spoiler:focus {
  background: var(--surface-soft);
  color: var(--text);
}

.post-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.post-images.one {
  grid-template-columns: 1fr;
}

.post-images img {
  width: 100%;
  max-height: 330px;
  object-fit: cover;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: zoom-in;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.post-tag {
  padding: 4px 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 11px;
}

.post-tag:hover {
  border-color: var(--accent);
  color: var(--text);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.action-btn:hover {
  background: var(--accent-soft);
  border-color: var(--border);
  color: var(--text);
}

.action-btn.voted-up {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-text);
}

.action-btn.voted-down {
  background: rgba(239, 101, 112, 0.1);
  border-color: rgba(239, 101, 112, 0.32);
  color: var(--danger);
}

.action-btn .score {
  font-weight: 700;
}

.action-spacer {
  flex: 1;
}

/* Polls */

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 13px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.poll-option:hover {
  border-color: var(--accent);
}

.poll-option > span:not(.poll-bar) {
  position: relative;
  z-index: 1;
}

.poll-option .poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  background: var(--accent-soft);
  transition: width 0.25s ease;
}

.poll-option.selected {
  border-color: var(--accent);
}

.poll-option.selected .poll-bar {
  background: var(--accent-soft);
}

.poll-percent {
  margin-left: auto;
  color: var(--accent-text);
  font-size: 11.5px;
  font-weight: 700;
}

.poll-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ */
/* Detail / replies / profile                                         */
/* ------------------------------------------------------------------ */

.detail-post .post-card {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.detail-post .post-card:hover {
  border: 0;
}

.detail-post .post-title {
  font-size: 24px;
}

.detail-post .post-body {
  font-size: 14.5px;
}

.reply-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.reply-section > h3 {
  margin: 0 0 13px;
  font-size: 14px;
  font-weight: 700;
}

.reply-form {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 14px;
}

.reply-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  resize: vertical;
}

.reply-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.reply-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.reply-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.reply-content {
  flex: 1;
  min-width: 0;
}

.reply-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.reply-head b {
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}

.reply-head b:hover {
  color: var(--accent-text);
}

.reply-head small {
  color: var(--muted);
  font-size: 10.5px;
}

.reply-body {
  margin: 5px 0;
  color: var(--text-soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.reply-actions button {
  padding: 4px 6px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.reply-actions button:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.reply-nested {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 9px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.profile-hero .avatar {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.profile-hero h3 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.4px;
}

.profile-hero p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.profile-stats b {
  color: var(--text);
}

.profile-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.profile-tabs button {
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.profile-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* Notifications and preferences */

.notification-item {
  display: flex;
  gap: 10px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.notification-item.unread {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.notification-item p {
  margin: 0;
  font-size: 13px;
}

.notification-item small {
  color: var(--muted);
  font-size: 11px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row b {
  display: block;
  font-size: 13px;
}

.settings-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.settings-row select {
  min-width: 120px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Forms                                                              */
/* ------------------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.field small {
  color: var(--muted);
  font-size: 11px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.modal-form {
  display: block;
}

.form-error {
  min-height: 1em;
  margin: 0 0 4px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.auth-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--surface-raised);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  color: var(--accent-text);
}

.auth-intro {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 10px;
}

.auth-link {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent-text);
  font-size: 11.5px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:hover {
  color: var(--text);
}

.auth-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-error.ok {
  color: var(--ok, #86e6a7);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 46px !important;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
}

.password-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.field-hint {
  min-height: 0;
  color: var(--muted);
  font-size: 11px;
}

.field-hint.ok {
  color: var(--green-dark);
}

.field-hint.bad {
  color: var(--danger);
}

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.auth-terms input {
  width: auto;
  margin-top: 2px;
  accent-color: var(--accent);
}

.auth-terms a {
  color: var(--accent-text);
  font-weight: 600;
}

.unread-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mobile-nav button {
  position: relative;
}

.mobile-nav .unread-dot {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.tag-input {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tag-input input {
  flex: 1;
  min-width: 130px;
  padding: 3px 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 11.5px;
}

.tag-pill button {
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 10px;
}

.option-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.option-input-row input {
  flex: 1;
}

.option-input-row button {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.option-input-row button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.upload-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.upload-box:hover {
  border-color: var(--accent);
}

.upload-box > i {
  color: var(--accent-text);
  font-size: 20px;
}

.upload-box p {
  margin: 0;
  font-size: 11.5px;
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.image-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.image-preview button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: rgba(10, 5, 13, 0.8);
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
}

.switch {
  width: 40px;
  height: 22px;
  accent-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Chat                                                               */
/* ------------------------------------------------------------------ */

.chat-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.8px;
}

.chat-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  background: rgba(98, 214, 138, 0.1);
  border: 1px solid rgba(98, 214, 138, 0.28);
  border-radius: 999px;
  color: var(--green);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.live-label .online-pip {
  margin: 0;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(58vh, 540px);
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.chat-message-content {
  max-width: min(78%, 640px);
  padding: 8px 11px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.chat-message-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.chat-message-head b {
  color: var(--accent-text);
  font-size: 12px;
  cursor: pointer;
}

.chat-message-head time {
  color: var(--muted);
  font-size: 10.5px;
}

.chat-message-text {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chat-compose {
  display: flex;
  gap: 8px;
}

.chat-compose input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
}

.chat-compose input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-notice {
  color: var(--muted);
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ */
/* Empty / loading                                                    */
/* ------------------------------------------------------------------ */

.empty-state {
  padding: 44px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 15px;
  color: var(--accent-text);
  font-size: 21px;
}

.empty-state h3 {
  margin: 13px 0 4px;
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12.5px;
}

.loading-state {
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}

.loading-state p {
  margin: 10px 0 0;
  font-size: 12.5px;
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ */
/* Modal and toasts                                                   */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 4, 10, 0.72);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.5px;
}

#modalBody {
  padding: 18px 24px 24px;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(440px, calc(100vw - 40px));
}

.toast {
  padding: 12px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12.5px;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Mobile navigation                                                  */
/* ------------------------------------------------------------------ */

.mobile-nav {
  display: none;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  justify-content: space-around;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: var(--header);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  padding: 6px 4px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.mobile-nav button i {
  font-size: 16px;
}

.mobile-nav button.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 45;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--accent-text);
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.back-to-top:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.draft-status {
  color: var(--muted);
  font-size: 11px;
}

#discardDraft {
  margin-right: auto;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-soft);
  font-size: 13px;
}

.shortcut-row:last-child {
  border-bottom: 0;
}

kbd {
  flex-shrink: 0;
  min-width: 28px;
  padding: 3px 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: 600 11px ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 222px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .layout {
    display: block;
    margin-top: 20px;
    padding-bottom: 78px;
  }

  .left-rail {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .page-heading {
    align-items: center;
  }

  .profile-text small {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-logo {
    width: 37px;
    height: 37px;
  }

  .brand-name {
    font-size: 19px;
  }

  .search-row {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    min-height: 42px;
  }

  .top-actions {
    gap: 2px;
  }

  .profile-button {
    padding-left: 9px;
    gap: 7px;
  }

  .profile-text b {
    max-width: 100px;
    font-size: 12px;
  }

  .tiny {
    display: none;
  }

  .page-heading {
    margin-bottom: 16px;
  }

  .page-heading h1 {
    font-size: 26px;
  }

  .desktop-compose {
    padding: 9px 11px;
    font-size: 12px;
  }

  .composer-quick {
    display: none;
  }

  .post-card {
    padding: 15px;
  }

  .post-title {
    font-size: 18px;
  }

  .post-images {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .modal-header {
    padding: 17px 17px 12px;
  }

  #modalBody {
    padding: 15px 17px 22px;
  }

  .toast-region {
    right: 12px;
    bottom: 78px;
    left: 12px;
    max-width: none;
  }

  .back-to-top {
    right: 16px;
    bottom: 82px;
  }

  .chat-message-content {
    max-width: 88%;
  }
}

@media (max-width: 460px) {
  .search-row .btn {
    display: none;
  }

  .profile-text {
    display: none;
  }

  .profile-button {
    padding-left: 8px;
  }

  .notification-btn {
    width: 34px;
  }

  .action-btn {
    padding: 6px;
  }
}

/* Nidus Account sign-in */
#modal:has(.auth-modal){width:min(460px,100%)}
.auth-modal .auth-brand{display:flex;align-items:center;gap:10px;margin:0 0 16px}
.auth-modal .auth-brand img{width:34px;height:34px;padding:0;object-fit:cover;border:0;border-radius:5px;background:transparent}
.auth-brand-text{display:flex;flex-direction:column;line-height:1.15}
.auth-brand-text b{font-size:15px;letter-spacing:.2px}
.auth-brand-text span{color:var(--muted);font-size:11px;letter-spacing:.8px;text-transform:uppercase}
.auth-modal .auth-intro{margin-top:0}
.auth-modal .auth-tabs{margin-bottom:16px}
.auth-modal .modal-actions{margin-top:16px}
.auth-modal .btn-primary{background:linear-gradient(135deg,var(--accent),var(--accent-hover));border-color:var(--accent);box-shadow:0 10px 24px -12px var(--accent)}
