/* ---------- unread markers and badges ---------- */

.rail-badge {
  position: absolute;
  right: 12px;
  bottom: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--status-dnd);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  box-shadow: 0 0 0 3px var(--bg-rail);
  pointer-events: none;
}
.rail-pill.unread {
  opacity: 1;
  height: 8px;
  transform: translate(0, -50%) scale(1);
}
.count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bg-active);
  color: var(--text-header);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  margin-left: auto;
}
.count-badge.red {
  background: var(--status-dnd);
  color: #fff;
}
.channel-row .unread-dot {
  position: absolute;
  left: -8px;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--text-header);
  transition: height 150ms var(--ease);
}
.channel-row {
  position: relative;
}
.channel-row.unread {
  color: var(--text-header);
  font-weight: 600;
}
.channel-row.unread .unread-dot {
  height: 8px;
}
.channel-row.unread .channel-icon {
  color: var(--text-header);
}
.channel-row.muted {
  opacity: 0.5;
}
.dm-row.convo {
  height: 42px;
  gap: 12px;
  padding: 0 8px;
  color: var(--channel-icon);
}
.dm-row.convo.unread .dm-name {
  color: var(--text-header);
  font-weight: 600;
}
.dm-text {
  min-width: 0;
  flex: 1;
  text-align: left;
}
.dm-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 500;
  color: inherit;
}
.dm-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}
.group-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}
.dm-row.convo .status-dot {
  --status-ring: var(--bg-sidebar);
}
.dm-row.convo:hover .status-dot,
.dm-row.convo.active .status-dot {
  --status-ring: var(--bg-hover);
}

/* ---------- friends ---------- */

.friends-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.friends-tabs {
  flex: none;
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--header-shadow);
}
.friends-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-header);
}
.friends-title .icon {
  color: var(--channel-icon);
}
.friends-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}
.friends-tab {
  height: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--interactive-normal);
  font-size: 16px;
  font-weight: 500;
}
.friends-tab:hover {
  background: var(--bg-hover);
  color: var(--interactive-hover);
}
.friends-tab.on {
  background: var(--bg-active);
  color: var(--interactive-active);
}
.friends-tab.add {
  background: var(--status-online);
  color: #fff;
}
.friends-tab.add.on {
  background: transparent;
  color: var(--status-online);
}
.friends-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px 30px;
}
.friends-heading {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.person-row {
  position: relative;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-top: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  --status-ring: var(--bg-main);
}
.person-row:hover {
  background: var(--bg-hover);
  border-color: transparent;
  --status-ring: var(--bg-hover);
}
.person-text {
  flex: 1;
  min-width: 0;
}
.person-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-header);
}
.person-handle {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0;
}
.person-row:hover .person-handle {
  opacity: 1;
}
.person-sub {
  font-size: 14px;
  color: var(--text-muted);
}
.person-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.round-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--bg-sidebar);
  color: var(--interactive-normal);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.person-row:hover .round-btn {
  background: var(--bg-rail);
}
.round-btn:hover {
  color: var(--interactive-hover);
}
.round-btn.good:hover {
  color: var(--status-online);
}
.round-btn.bad:hover {
  color: var(--status-dnd);
}
.friends-empty,
.forum-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}
.friends-empty p,
.forum-empty p {
  max-width: 360px;
  margin: 0;
}
.forum-empty h3 {
  margin: 0;
  color: var(--text-header);
}
.add-friend {
  padding: 20px 30px;
}
.add-friend h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-header);
  text-transform: uppercase;
}
.add-friend p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.add-friend-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
  height: 52px;
  border-radius: 8px;
  background: var(--bg-input-inset);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.add-friend-box:focus-within {
  box-shadow: inset 0 0 0 1px var(--brand);
}
.add-friend-box.good {
  box-shadow: inset 0 0 0 1px var(--status-online);
}
.add-friend-box.bad {
  box-shadow: inset 0 0 0 1px var(--status-dnd);
}
.add-friend-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-normal);
}
.add-friend-note {
  margin-top: 8px;
  font-size: 14px;
}
.add-friend-note.good { color: var(--status-online); }
.add-friend-note.bad { color: var(--text-danger); }
.pick-list {
  max-height: 280px;
  overflow-y: auto;
  margin: 12px 0 4px;
}
.pick-row {
  width: 100%;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-normal);
  text-align: left;
}
.pick-row:hover {
  background: var(--bg-hover);
}
.pick-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-weight: 500;
}
.pick-name small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.checkbox {
  flex: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--interactive-normal);
  border-radius: 4px;
  color: #fff;
}
.checkbox.on {
  border-color: var(--brand);
  background: var(--brand);
}

/* ---------- messages, extended ---------- */

.message-wrap {
  position: relative;
}
.message {
  flex-direction: column;
  gap: 0;
}
.message-row {
  display: flex;
  gap: 16px;
}
.message.mentioned {
  background: rgba(240, 178, 50, 0.1);
  box-shadow: inset 2px 0 0 var(--status-idle);
}
.message.mentioned:hover {
  background: rgba(240, 178, 50, 0.14);
}
.message-pin {
  display: inline-flex;
  color: var(--text-faint);
}
.new-line {
  position: relative;
  height: 0;
  margin: 16px 16px 0 8px;
  border-top: 1px solid var(--status-dnd);
}
.new-line span {
  position: absolute;
  right: 0;
  top: -9px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--status-dnd);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
}
.day-divider {
  margin: 20px 16px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
}
.day-divider::before,
.day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.older-loading {
  display: flex;
  justify-content: center;
  padding: 12px;
}
.older-loading .dots-loader i {
  background: var(--text-muted);
}

.reply-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px 20px;
  padding-left: 36px;
  position: relative;
  font-size: 14px;
  color: var(--text-muted);
  height: 20px;
}
.reply-spine {
  position: absolute;
  left: 18px;
  top: 8px;
  width: 30px;
  height: 12px;
  border-left: 2px solid #4e5058;
  border-top: 2px solid #4e5058;
  border-top-left-radius: 6px;
}
.reply-name {
  font-weight: 500;
  color: var(--text-header);
  white-space: nowrap;
}
.reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-text * {
  display: inline;
}
.reply-line.missing {
  font-style: italic;
}

.message-content.jumbo {
  font-size: 2.75em;
  line-height: 1.2;
}
.message-content.jumbo .emoji {
  width: 2.75em;
  height: 2.75em;
}
.md .emoji {
  width: 1.375em;
  height: 1.375em;
  vertical-align: bottom;
  object-fit: contain;
}
.mention {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--bg-mention);
  color: #c9cdfb;
  font-weight: 500;
  cursor: pointer;
}
.mention:hover {
  background: var(--bg-mention-hover);
  color: #fff;
}
.mention.me {
  background: rgba(240, 178, 50, 0.25);
  color: #f5d48a;
}
:root[data-theme="light"] .mention {
  color: #3c45a5;
}

.forwarded {
  margin-top: 4px;
  padding: 4px 0 4px 12px;
  border-left: 4px solid #4e5058;
  max-width: 520px;
}
.forwarded-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.forwarded-foot {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.sticker {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin-top: 4px;
}
.attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.att-image {
  max-width: min(400px, 100%);
  max-height: 350px;
  padding: 0;
  display: block;
  overflow: hidden;
  border: none;
  border-radius: 8px;
  background: var(--bg-skeleton);
  cursor: zoom-in;
}
.att-image img {
  display: block;
  max-width: 100%;
  max-height: 350px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.att-file {
  width: 400px;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-sidebar);
  color: var(--text-normal);
}
.att-file:hover {
  background: var(--bg-hover);
}
.att-file-icon {
  color: var(--text-link);
}
.att-file-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.att-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-link);
  font-weight: 500;
}
.att-file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.embed {
  max-width: 520px;
  margin-top: 6px;
  padding: 8px 16px 16px 12px;
  border-left: 4px solid #1e1f22;
  border-radius: 4px;
  background: var(--bg-sidebar);
}
.embed-main {
  display: flex;
  gap: 16px;
}
.embed-text {
  flex: 1;
  min-width: 0;
}
.embed-provider {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.embed-author {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header);
}
.embed-author img,
.embed-footer img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.embed-title {
  display: block;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-link);
}
.embed-title.plain {
  color: var(--text-header);
}
.embed-title:hover {
  text-decoration: underline;
}
.embed-desc {
  margin-top: 8px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.embed-fields {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.embed-field {
  grid-column: 1 / -1;
  min-width: 0;
}
.embed-field.inline {
  grid-column: auto;
}
.embed-field-name {
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header);
}
.embed-field-value {
  font-size: 14px;
  white-space: pre-wrap;
}
.embed-thumb {
  flex: none;
  width: 80px;
  height: 80px;
  margin-top: 8px;
  border-radius: 4px;
  object-fit: cover;
}
.embed-image {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin-top: 16px;
  border-radius: 4px;
}
.embed-image-only img {
  display: block;
  max-width: 400px;
  max-height: 300px;
  margin-top: 6px;
  border-radius: 8px;
}
.embed-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.embed-footer img {
  width: 20px;
  height: 20px;
}

.invite-embed {
  width: 432px;
  max-width: 100%;
  margin-top: 6px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-sidebar);
}
.invite-label {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.invite-body {
  display: flex;
  align-items: center;
  gap: 16px;
}
.invite-icon {
  flex: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.invite-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.invite-icon.dead {
  background: var(--bg-active);
  color: var(--text-muted);
}
.invite-info {
  flex: 1;
  min-width: 0;
}
.invite-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-header);
}
.invite-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.invite-stats .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--status-offline);
}
.invite-stats .dot.online {
  background: var(--status-online);
}
.invite-loading {
  color: var(--text-muted);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reaction {
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg-sidebar);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.reaction:hover {
  border-color: var(--interactive-muted);
}
.reaction.me {
  border-color: var(--brand);
  background: var(--brand-faint);
  color: #c9cdfb;
}
.reaction.add {
  opacity: 0;
  width: 36px;
  justify-content: center;
}
.reactions:hover .reaction.add {
  opacity: 1;
}
.reaction-emoji {
  font-size: 16px;
}
.reaction .emoji {
  width: 16px;
  height: 16px;
}
.reaction.burst {
  border-color: #f0b232;
  background: rgba(240, 178, 50, 0.15);
  color: #f5d48a;
  animation: burst 700ms var(--ease);
}
@keyframes burst {
  0% { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(240, 178, 50, 0.7); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(240, 178, 50, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(240, 178, 50, 0); }
}
.reaction.burst .reaction-emoji {
  animation: burst-emoji 1.6s infinite var(--ease);
}
@keyframes burst-emoji {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.18) rotate(-6deg); }
}

.thread-chip {
  margin-top: 6px;
  max-width: 420px;
  height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-sidebar);
  color: var(--text-muted);
  font-size: 14px;
}
.thread-chip:hover {
  background: var(--bg-hover);
  color: var(--text-normal);
}
.thread-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-link);
}
.thread-chip-cta {
  margin-left: auto;
  font-size: 12px;
}

.editor {
  max-width: 100%;
}
.editor-box {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  outline: none;
  resize: vertical;
  background: var(--bg-input);
  font-size: var(--chat-font-size, 16px);
  color: var(--text-normal);
}
.editor-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- composer, extended ---------- */

.composer-wrap {
  position: relative;
}
.composer.locked {
  height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--text-muted);
  background: var(--bg-input);
  opacity: 0.8;
}
.composer.dragging {
  box-shadow: 0 0 0 2px var(--brand);
}
.reply-bar {
  height: 32px;
  margin-bottom: -4px;
  padding: 0 8px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px 8px 0 0;
  background: var(--bg-sidebar);
  font-size: 14px;
  color: var(--text-muted);
}
.reply-bar b {
  color: var(--text-header);
}
.pending-files {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  overflow-x: auto;
  border-radius: 8px 8px 0 0;
  background: var(--bg-input);
  margin-bottom: -4px;
}
.pending-file {
  position: relative;
  flex: none;
  width: 120px;
  padding: 8px;
  border-radius: 6px;
  background: var(--bg-sidebar);
}
.pending-file.failed {
  box-shadow: inset 0 0 0 1px var(--status-dnd);
}
.pending-thumb {
  position: relative;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-rail);
  color: var(--text-muted);
}
.pending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pending-busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
.pending-name {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-normal);
}
.pending-error {
  font-size: 11px;
  color: var(--text-danger);
}
.pending-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--status-dnd);
  color: #fff;
}
.mention-list {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 56px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-floating);
  box-shadow: var(--elevation-high), var(--elevation-stroke);
  z-index: 30;
  animation: pop-up 120ms var(--ease);
}
.mention-head {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mention-row {
  width: 100%;
  height: 40px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-normal);
  text-align: left;
}
.mention-row.on,
.mention-row:hover {
  background: var(--bg-hover);
}
.mention-name {
  font-weight: 600;
}
.mention-sub {
  margin-left: auto;
  font-size: 14px;
  color: var(--text-muted);
}
.typing-bar {
  gap: 4px;
  color: var(--text-normal);
  font-weight: 500;
  font-size: 14px;
}
.chat.in-panel .composer-wrap {
  padding: 0 12px;
}
.chat.in-panel .message {
  padding-right: 16px;
}

/* ---------- side panels ---------- */

.side-panel {
  flex: none;
  width: 340px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-member-list);
  min-height: 0;
}
.side-panel.wide {
  width: min(520px, 46%);
  background: var(--bg-main);
}
.panel-head {
  flex: none;
  height: 48px;
  padding: 0 8px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--header-shadow);
}
.panel-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-header);
}
.thread-head .icon {
  color: var(--channel-icon);
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}
.panel-empty-title {
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text-header);
}
.panel-empty p {
  margin: 0;
  font-size: 14px;
}
.panel-card {
  position: relative;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-main);
}
.panel-card-x {
  position: absolute;
  top: 6px;
  right: 6px;
}
.panel-count,
.search-hints {
  padding: 4px 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.mini-channel {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.mini-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-author {
  font-weight: 600;
  color: var(--text-header);
}
.mini-time {
  font-size: 12px;
  color: var(--text-faint);
}
.mini-body {
  margin-top: 4px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mini-att {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-link);
}
.thread-row {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  border-radius: 8px;
  background: var(--bg-main);
  color: var(--text-muted);
  text-align: left;
}
.thread-row:hover {
  background: var(--bg-hover);
}
.thread-row-name {
  font-weight: 600;
  color: var(--text-header);
}
.thread-row-sub {
  font-size: 12px;
}

/* ---------- forums ---------- */

.forum {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
}
.forum-top {
  flex: none;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.forum-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.forum-title-block h1 {
  margin: 0;
  font-size: 24px;
  color: var(--text-header);
}
.forum-guidelines {
  margin: 6px 0 0;
  max-width: 560px;
  font-size: 14px;
  color: var(--text-muted);
}
.forum-actions {
  display: flex;
  gap: 8px;
}
.forum-filters {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.forum-filter-label {
  margin-right: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.forum-spacer {
  flex: 1;
}
.forum-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: var(--bg-sidebar);
  color: var(--text-normal);
  font-size: 14px;
}
.tag-chip {
  --tag: #5865f2;
  height: 28px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--tag) 55%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--tag) 14%, transparent);
  color: var(--text-normal);
  font-size: 14px;
  font-weight: 500;
}
.tag-chip:hover {
  background: color-mix(in srgb, var(--tag) 26%, transparent);
}
.tag-chip.on {
  background: var(--tag);
  border-color: var(--tag);
  color: #fff;
}
.tag-chip.small {
  height: 20px;
  padding: 0 8px;
  font-size: 12px;
  cursor: inherit;
}
.forum-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.post-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-sidebar);
  color: var(--text-normal);
  text-align: left;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.post-card:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}
.post-card.unread .post-title {
  color: #fff;
}
.post-main {
  flex: 1;
  min-width: 0;
}
.post-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.post-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-header);
}
.post-pin {
  color: var(--text-muted);
}
.post-preview {
  margin-top: 6px;
  max-height: 44px;
  overflow: hidden;
  font-size: 14px;
  color: var(--text-muted);
}
.post-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.post-author,
.post-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-author {
  font-weight: 600;
  color: var(--text-normal);
}
.post-thumb {
  flex: none;
  width: 110px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
}
.tag-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.tag-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- emoji picker ---------- */

.emoji-picker {
  position: fixed;
  z-index: 900;
  width: 400px;
  height: 420px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: var(--bg-floating);
  box-shadow: var(--elevation-high), var(--elevation-stroke);
  animation: pop 150ms var(--ease);
  transform-origin: bottom right;
}
.picker-top {
  flex: none;
  padding: 12px 12px 8px;
}
.picker-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.picker-tab {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--interactive-normal);
  font-weight: 600;
}
.picker-tab.on {
  background: var(--bg-active);
  color: var(--interactive-active);
}
.picker-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--bg-input-inset);
  color: var(--text-muted);
}
.picker-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-normal);
}
.picker-main {
  flex: 1;
  min-height: 0;
  display: flex;
}
.picker-cats {
  flex: none;
  width: 44px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: none;
}
.picker-cat {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--interactive-normal);
}
.picker-cat:hover {
  background: var(--bg-hover);
  color: var(--interactive-hover);
}
.picker-body {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 0 8px 8px 4px;
}
.picker-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 4px 4px;
  background: var(--bg-floating);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.picker-cell {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  transition: transform 80ms var(--ease), background-color 80ms var(--ease);
}
.picker-cell:hover {
  background: var(--bg-hover);
  transform: scale(1.2);
}
.picker-cell .emoji {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.picker-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.picker-foot {
  flex: none;
  height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  border-radius: 0 0 8px 8px;
}
.picker-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-normal);
}
.picker-preview-emoji {
  font-size: 24px;
}
.super-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.super-toggle.on {
  border-color: #f0b232;
  background: rgba(240, 178, 50, 0.15);
  color: #f5d48a;
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
}
.sticker-cell {
  aspect-ratio: 1;
  padding: 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
}
.sticker-cell:hover {
  background: var(--bg-hover);
}
.sticker-cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- status editor, lightbox, profile actions ---------- */

.status-edit {
  position: relative;
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.status-emoji-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 3px;
  background: var(--bg-input-inset);
  color: var(--interactive-normal);
}
.status-emoji-btn:hover {
  color: var(--interactive-hover);
}
.status-emoji {
  font-size: 22px;
}
.status-clear {
  position: absolute;
  right: 8px;
  top: 8px;
}
.status-edit .field-input {
  padding-right: 36px;
}
.status-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  --status-ring: var(--bg-sidebar);
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.85);
  animation: fade-in 150ms var(--ease);
}
.lightbox img {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: 6px;
  animation: modal-in 150ms var(--ease);
}
.lightbox-open {
  color: #dbdee1;
  font-size: 14px;
}
.profile-message {
  width: 100%;
  height: 36px;
  margin-top: 12px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  outline: none;
  background: rgba(0, 0, 0, 0.3);
  font-size: 14px;
  color: #f2f3f5;
}
.profile-message:focus {
  border-color: var(--brand);
}
.profile-message::placeholder {
  color: #b5bac1;
}
.profile-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- syntax colours ---------- */

.md-code {
  --tok-k: #ff7b72;
  --tok-s: #a5d6ff;
  --tok-c: #8b949e;
  --tok-n: #79c0ff;
  --tok-f: #d2a8ff;
  --tok-t: #ffa657;
}
:root[data-theme="light"] .md-code {
  --tok-k: #cf222e;
  --tok-s: #0a3069;
  --tok-c: #6e7781;
  --tok-n: #0550ae;
  --tok-f: #8250df;
  --tok-t: #953800;
}
.tok-k { color: var(--tok-k); }
.tok-s { color: var(--tok-s); }
.tok-c { color: var(--tok-c); font-style: italic; }
.tok-n { color: var(--tok-n); }
.tok-f { color: var(--tok-f); }
.tok-t { color: var(--tok-t); }

.friends-tab { white-space: nowrap; }
.message-edited { display: inline; margin-left: 4px; }

.forum-head-row { flex-wrap: wrap; }
.forum-title-block { flex: 1 1 200px; min-width: 0; }
.forum-actions { flex: none; }
.chat.in-panel .chat-welcome h1 { font-size: 22px; line-height: 28px; }
.chat.in-panel .chat-welcome { padding-top: 24px; }
.chat.in-panel .composer textarea { min-width: 0; }
.side-panel.wide { min-width: 360px; }

/* ---------- server settings ---------- */

.roles-layout { display: flex; gap: 24px; align-items: flex-start; }
.roles-list { flex: none; width: 220px; display: flex; flex-direction: column; gap: 2px; }
.roles-list .btn { margin-bottom: 8px; align-self: flex-start; }
.role-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 4px; color: var(--interactive-normal); cursor: pointer; }
.role-row:hover { background: var(--bg-hover); color: var(--interactive-hover); }
.role-row.active { background: var(--bg-active); color: var(--interactive-active); }
.role-row[draggable="true"] { cursor: grab; }
.role-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.role-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-grip { opacity: 0; color: var(--text-muted); }
.role-row:hover .role-grip { opacity: 1; }
.role-editor { flex: 1; min-width: 0; padding-bottom: 80px; }
.role-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch { width: 28px; height: 28px; border: 2px solid transparent; border-radius: 6px; }
.swatch.on { border-color: #fff; }
.perm-group { margin-top: 24px; }
.pref-row.tight { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.member-roles { margin-top: 4px; align-items: center; }
.chip-x { margin-left: 4px; padding: 0 2px; border: none; background: transparent; color: inherit; font-size: 14px; line-height: 1; cursor: pointer; opacity: .7; }
.chip-x:hover { opacity: 1; }
.select.add-role { height: 22px; font-size: 12px; padding: 0 4px; }
.expr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 20px; }
.expr-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border-radius: 8px; background: var(--bg-card); }
.expr-card img { width: 96px; height: 96px; object-fit: contain; }
.expr-card img.small { width: 40px; height: 40px; }
.expr-card .icon-btn { position: absolute; top: 4px; right: 4px; }
.expr-name { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.guild-icon-preview { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 24px; background: var(--brand); color: #fff; font-size: 24px; font-weight: 600; }
.guild-icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.banner-preview { height: 100px; overflow: hidden; border-radius: 8px; background: var(--bg-card); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.vanity { display: flex; align-items: center; gap: 8px; }
.vanity span { color: var(--text-muted); white-space: nowrap; }

/* ---------- community ---------- */
.rules-list { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-normal); }
.prompt { margin-bottom: 20px; }
.prompt-title { margin-bottom: 8px; font-weight: 700; color: var(--text-header); }
.prompt-options { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-input-inset); color: var(--text-normal); text-align: left; }
.prompt-option small { color: var(--text-muted); }
.prompt-option:hover { background: var(--bg-hover); }
.prompt-option.on { border-color: var(--brand); background: var(--brand-faint); }
.prompt-edit { margin-bottom: 16px; padding: 12px; border-radius: 8px; background: var(--bg-card); display: flex; flex-direction: column; gap: 8px; }
.prompt-opt { padding-left: 16px; }
.discover-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-height: 60vh; overflow-y: auto; }
.discover-card { overflow: hidden; border-radius: 8px; background: var(--bg-card); }
.discover-banner { height: 80px; background: var(--brand); }
.discover-banner img { width: 100%; height: 100%; object-fit: cover; }
.discover-body { padding: 12px; }
.discover-name { font-weight: 700; color: var(--text-header); }
.discover-desc { min-height: 36px; margin: 4px 0 8px; font-size: 13px; color: var(--text-muted); }
.discover-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.ov-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.tri { display: flex; border-radius: 6px; overflow: hidden; background: var(--bg-input-inset); }
.tri-btn { width: 34px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); }
.tri-btn.deny.on { background: var(--status-dnd); color: #fff; }
.tri-btn.inherit.on { background: var(--bg-active); color: #fff; }
.tri-btn.allow.on { background: var(--status-online); color: #fff; }
.follow-btn { margin-right: 6px; }

/* ---------- custom controls ---------- */
.select-wrap { position: relative; display: inline-block; min-width: 160px; }
.select-wrap:not(.compact) { display: block; }
.select-btn { width: 100%; height: 40px; padding: 0 10px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: none; border-radius: 4px; background: var(--bg-input-inset); color: var(--text-normal); font-size: 16px; text-align: left; }
.select-wrap.compact .select-btn { height: 32px; font-size: 14px; }
.select-btn:hover { background: var(--bg-hover); }
.select-btn.open { box-shadow: 0 0 0 2px var(--brand); }
.select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chevron { display: flex; color: var(--interactive-normal); transition: transform 150ms var(--ease); }
.select-btn.open .select-chevron { transform: rotate(180deg); }
.select-backdrop { position: fixed; inset: 0; z-index: 940; }
.select-list { position: absolute; z-index: 950; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; padding: 6px; border-radius: 6px; background: var(--bg-floating); box-shadow: var(--elevation-high), var(--elevation-stroke); animation: pop 120ms var(--ease); transform-origin: top; min-width: 160px; }
.select-opt { width: 100%; min-height: 32px; padding: 6px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: none; border-radius: 4px; background: transparent; color: var(--interactive-normal); font-size: 14px; text-align: left; }
.select-opt:hover { background: var(--brand); color: #fff; }
.select-opt.on { color: var(--text-header); background: var(--bg-active); }
.cp-wrap { position: relative; display: inline-block; }
.cp-swatch { width: 44px; height: 36px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border-subtle); border-radius: 6px; cursor: pointer; }
.cp-none { color: #fff; mix-blend-mode: difference; }
.cp-pop { position: absolute; z-index: 950; top: calc(100% + 6px); left: 0; width: 240px; padding: 12px; border-radius: 8px; background: var(--bg-floating); box-shadow: var(--elevation-high), var(--elevation-stroke); animation: pop 120ms var(--ease); transform-origin: top left; }
.cp-sv { position: relative; height: 140px; border-radius: 6px; cursor: crosshair; touch-action: none; background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent); }
.cp-sv-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cp-hue { position: relative; height: 12px; margin: 12px 0; border-radius: 6px; cursor: pointer; touch-action: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hue-dot { position: absolute; top: -2px; width: 16px; height: 16px; margin-left: -8px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cp-row { display: flex; gap: 8px; }
.cp-hex { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: none; border-radius: 4px; outline: none; background: var(--bg-input-inset); color: var(--text-normal); font-family: var(--font-mono); font-size: 14px; }
.cp-reset { padding: 0 10px; border: none; border-radius: 4px; background: var(--bg-active); color: var(--text-normal); font-size: 13px; }
.cp-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.cp-preset { aspect-ratio: 1; border: 2px solid transparent; border-radius: 6px; }
.cp-preset:hover { border-color: #fff; }
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; z-index: 960; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 6px 10px; border-radius: 5px; background: var(--bg-floating); color: var(--text-header); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: var(--elevation-high); pointer-events: none; animation: pop 120ms var(--ease); }
[data-tip]:hover::before { content: ""; position: absolute; z-index: 961; left: 50%; bottom: calc(100% + 4px); width: 8px; height: 8px; background: var(--bg-floating); transform: translateX(-50%) rotate(45deg); pointer-events: none; }

/* ---------- server settings form ---------- */
.snav-title { padding: 6px 10px 10px; font-size: 16px; font-weight: 700; color: var(--text-header); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sform-section { margin-bottom: 20px; padding: 20px; border-radius: 8px; background: var(--bg-card); }
.sform-head { margin-bottom: 16px; }
.sform-title { font-size: 16px; font-weight: 700; color: var(--text-header); }
.sform-desc { margin-top: 4px; font-size: 14px; color: var(--text-muted); }
.sform-body { display: flex; flex-direction: column; gap: 12px; }
.sform-row { display: flex; align-items: center; gap: 20px; }
.sform-col { display: flex; flex-direction: column; gap: 8px; }
.sform-body .field { margin-bottom: 0; }
.field-error-line { margin-top: 6px; font-size: 13px; color: var(--text-danger); }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.status-line.good { color: var(--status-online); }
.status-line.wait { color: var(--status-idle); }
.status-line.bad { color: var(--text-danger); }
.guild-header-wrap.has-banner { height: 135px; }
.guild-banner { position: absolute; inset: 0; width: 100%; height: 135px; object-fit: cover; }
.guild-header-wrap.has-banner .guild-header { position: absolute; inset: 0; height: 135px; align-items: flex-end; padding-bottom: 12px; background: linear-gradient(to top, rgba(0,0,0,.65), transparent 60%); color: #fff; box-shadow: none; }
.guild-header-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.guild-badges { display: flex; gap: 4px; margin-right: 6px; }
.guild-badge { display: flex; color: var(--interactive-normal); }
.guild-badge.global { color: var(--status-online); }
.guild-header-wrap.has-banner .guild-badge { color: #fff; }
.guild-menu { top: calc(100% + 8px); }

.bot-tag { margin-left: 6px; padding: 0 5px; border-radius: 3px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; vertical-align: middle; }
.app-row { width: 100%; border: none; cursor: pointer; text-align: left; color: var(--text-normal); }
.app-row:hover { background: var(--bg-hover); }
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; }
.perm-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; border: none; background: transparent; color: var(--text-normal); font-size: 14px; text-align: left; }
.bot-card { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px; border-radius: 8px; background: var(--bg-card); }
.back { margin-bottom: 12px; padding-left: 0; }

.badges [data-tip]:hover::after { left: auto; right: -6px; transform: none; max-width: 220px; white-space: normal; text-align: right; }
.badges [data-tip]:hover::before { left: auto; right: 6px; transform: rotate(45deg); }
.profile-badges { position: relative; z-index: 5; }
.profile-card { overflow: visible; }
.profile-banner { border-radius: 8px 8px 0 0; }

/* ---------- desktop window frame ---------- */
.titlebar { position: fixed; top: 0; left: 0; right: 0; height: 32px; z-index: 10001; display: flex; align-items: center; justify-content: space-between; background: #1e1f22; color: var(--text-muted); user-select: none; }
.titlebar-brand { display: flex; align-items: center; gap: 8px; padding-left: 12px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--text-normal); }
.titlebar-brand svg { color: var(--brand); }
.titlebar-controls { display: flex; height: 100%; }
.tb-btn { width: 46px; height: 100%; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--interactive-normal); }
.tb-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.tb-btn.close:hover { background: #e81123; color: #fff; }
:root[data-desktop="1"] .app-root { top: 32px; }
:root[data-desktop="1"] .loading-screen { top: 32px; }
:root[data-desktop="1"] .settings-overlay, :root[data-desktop="1"] .modal-backdrop, :root[data-desktop="1"] .lightbox { top: 32px; }

/* bigger, centred badges */
.badges { gap: 6px; padding: 6px 8px; }
.badge { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.badge svg { width: 16px; height: 16px; display: block; margin: 0; }
.profile-card.full .badges { transform: scale(1.1); transform-origin: right center; }

/* ---------- bot components ---------- */
.comp-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; max-width: 520px; }
.comp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cbtn { min-height: 32px; padding: 2px 16px; display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 3px; color: #fff; font-size: 14px; font-weight: 500; transition: background-color var(--dur) var(--ease); }
.cbtn:disabled { opacity: .5; cursor: not-allowed; }
.cbtn.s1 { background: var(--brand); } .cbtn.s1:hover:not(:disabled) { background: var(--brand-hover); }
.cbtn.s2 { background: #4e5058; } .cbtn.s2:hover:not(:disabled) { background: #6d6f78; }
.cbtn.s3 { background: var(--positive); } .cbtn.s3:hover:not(:disabled) { background: var(--positive-hover); }
.cbtn.s4 { background: var(--danger); } .cbtn.s4:hover:not(:disabled) { background: var(--danger-hover); }
.cbtn.s5 { background: #4e5058; }
.comp-select { width: 100%; max-width: 360px; }
.ephemeral-note { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

/* badges: no box, thick coloured glyph */
.badge { width: 32px; height: 32px; background: none !important; border-radius: 0; }
.badge svg { width: 24px; height: 24px; stroke-width: 2.6; fill: currentColor; fill-opacity: .22; filter: drop-shadow(0 0 5px currentColor); }

/* ---------- voice ---------- */
.voice-users { padding: 0 8px 2px 38px; display: flex; flex-direction: column; gap: 1px; }
.voice-user { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; border-radius: 4px; color: var(--text-muted); font-size: 14px; }
.voice-user:hover { background: var(--bg-hover); color: var(--text-normal); }
.voice-user .avatar { box-shadow: 0 0 0 2px transparent; transition: box-shadow var(--dur) var(--ease); border-radius: 50%; }
.voice-user.speaking .avatar { box-shadow: 0 0 0 2px var(--positive); }
.voice-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-live { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.voice-dock { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 12px; background: var(--bg-rail); border-bottom: 1px solid var(--border-subtle); }
.voice-dock-info { flex: 1; min-width: 0; }
.voice-dock-title { display: flex; align-items: center; gap: 6px; color: var(--positive); font-size: 13px; font-weight: 600; }
.voice-dock-sub { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.voice-bars i { width: 3px; background: var(--positive); border-radius: 1px; animation: vbar 1s var(--ease) infinite alternate; }
.voice-bars i:nth-child(1) { height: 5px; } .voice-bars i:nth-child(2) { height: 11px; animation-delay: .2s; } .voice-bars i:nth-child(3) { height: 7px; animation-delay: .4s; }
@keyframes vbar { to { transform: scaleY(.45); } }
.icon-btn.lit { color: var(--positive); }
.icon-btn.hangup:hover { color: var(--danger); }
.voice-room { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #000; }
.voice-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 8px; padding: 16px; }
.voice-grid.solo { grid-template-columns: minmax(0, 560px); justify-content: center; }
.voice-tile { position: relative; display: flex; align-items: center; justify-content: center; background: var(--bg-sidebar); border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow var(--dur) var(--ease); min-height: 160px; }
.voice-tile.speaking { box-shadow: inset 0 0 0 3px var(--positive); }
.voice-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.voice-tile-name { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; padding: 3px 8px; background: rgba(0,0,0,.65); color: #fff; border-radius: 4px; font-size: 13px; font-weight: 500; }
.voice-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); text-align: center; }
.voice-empty h2 { color: var(--text-normal); }
.voice-controls { display: flex; justify-content: center; gap: 12px; padding: 16px; }
.vbtn { width: 52px; height: 52px; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #2b2d31; color: #fff; transition: background-color var(--dur) var(--ease); }
.vbtn:hover { background: #3b3d44; }
.vbtn.off { background: #fff; color: #1e1f22; }
.vbtn.lit { background: var(--positive); }
.vbtn.hangup { background: var(--danger); } .vbtn.hangup:hover { background: var(--danger-hover); }

/* ---------- developer.kindrel.top ---------- */
.dev-site { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg-main); overflow: hidden; }
.dev-site-bar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 24px; background: var(--bg-rail); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.dev-site-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.dev-site-brand em { font-style: normal; font-weight: 500; color: var(--text-muted); font-size: 15px; }
.dev-site-right { display: flex; align-items: center; gap: 10px; }
.dev-site-name { font-weight: 500; }
.dev-site-main { flex: 1; overflow-y: auto; padding: 32px 24px 80px; }
.dev-site-main > * { max-width: 820px; margin-left: auto; margin-right: auto; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- profile badges, small and tidy ---------- */
.badges { gap: 2px; padding: 4px 6px; border-radius: 10px; background: rgba(0, 0, 0, .35); }
.badge { width: 24px; height: 24px; }
.badge svg { width: 18px; height: 18px; stroke-width: 2.2; fill-opacity: .18; filter: none; }
.profile-card.full .badges { transform: none; }
.profile-badges { min-height: 0; padding: 8px 12px 0; }

/* ---------- roles on profiles ---------- */
.role-chip { position: relative; }
.role-x { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border: none; border-radius: 50%; background: transparent; color: var(--text-muted); }
.role-x:hover { background: var(--danger); color: #fff; }
.role-chip.add { width: 28px; height: 28px; padding: 0; justify-content: center; border: 1px dashed var(--text-muted); background: transparent; color: var(--text-muted); border-radius: 50%; }
.role-chip.add:hover { color: var(--text-normal); border-color: var(--text-normal); }

/* ---------- full-screen settings pages ---------- */
.modal-backdrop.fs { background: var(--bg-main); align-items: stretch; justify-content: stretch; padding: 0; animation: none; }
.modal.fs { width: 100% !important; max-width: none; height: 100%; border-radius: 0; background: var(--bg-main); box-shadow: none; overflow-y: auto; padding: 72px 24px 96px; }
.modal.fs > :not(.modal-close) { max-width: 740px; margin-left: auto; margin-right: auto; }
.modal.fs .modal-head h2 { font-size: 24px; }
.modal.fs .modal-close { position: fixed; top: 56px; right: 40px; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 38px; height: 38px; border: 2px solid var(--text-muted); border-radius: 50%; justify-content: center; }
.modal.fs .modal-close small { position: absolute; top: 44px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
:root[data-desktop="1"] .modal.fs .modal-close { top: 80px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.perm-list li { display: flex; align-items: center; gap: 8px; color: var(--text-normal); font-size: 14px; }
.perm-list li svg { color: var(--positive); }

.msg-row { display: contents; }

/* ---------- save bar: loading dots and fade out ---------- */
.save-bar.leaving { animation: save-out 240ms var(--ease) forwards; pointer-events: none; }
@keyframes save-out { to { opacity: 0; transform: translate(-50%, 12px); } }
.save-btn { min-width: 128px; display: inline-flex; align-items: center; justify-content: center; }
.save-bar .dots-loader i { background: #fff; }
.modal.fs .save-bar { max-width: min(680px, calc(100vw - 32px)); }

/* ---------- typing indicator ---------- */
.typing-avatars { display: flex; align-items: center; margin-right: 8px; }
.typing-avatars .avatar { border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-main); }
.typing-avatars .avatar + .avatar { margin-left: -6px; }
.typing-bar .typing-dots { margin-right: 6px; }
.typing-bar .typing-dots i { width: 6px; height: 6px; }
.typing-text { color: var(--text-normal); }
.typing-text strong { font-weight: 700; color: var(--text-header); }

/* ---------- image viewer ---------- */
.lightbox { overflow: hidden; background: rgba(0, 0, 0, .9); }
.lightbox img { max-width: 92vw; max-height: 84vh; transition: transform 160ms var(--ease); user-select: none; will-change: transform; }
.lightbox img.zoomed { transition: none; max-width: none; max-height: none; }
.lightbox-x { position: absolute; top: 20px; right: 24px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; z-index: 2; }
.lightbox-x:hover { background: rgba(255,255,255,.25); }
.lightbox-bar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 16px; align-items: center; padding: 8px 14px; border-radius: 8px; background: rgba(0,0,0,.55); font-size: 13px; z-index: 2; }
.lightbox-hint { color: #949ba4; }
.ctx-menu { z-index: 1100; }
:root[data-desktop="1"] .lightbox-x { top: 52px; }

/* ---------- webhooks.kindrel.top ---------- */
.wh-main { flex: 1; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 28px 32px 80px; max-width: 1400px; width: 100%; margin: 0 auto; }
.wh-editor, .wh-preview { min-width: 0; }
.wh-preview { position: sticky; top: 0; align-self: start; }
.wh-msg { display: flex; gap: 14px; padding: 16px; border-radius: 8px; background: var(--bg-main); border: 1px solid var(--border-subtle); }
.wh-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.wh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wh-body { min-width: 0; flex: 1; }
.wh-name { font-weight: 600; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.wh-embed { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 12px; margin: 12px 0; background: var(--bg-sidebar); }
.wh-embed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wh-embed-toggle { flex: 1; text-align: left; background: none; border: none; color: var(--text-header); font-weight: 600; font-size: 15px; }
.wh-colour { width: 36px; height: 28px; border: none; background: none; padding: 0; }
.wh-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; padding: 8px; margin-bottom: 8px; border-radius: 6px; background: var(--bg-main); }
.wh-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.wh-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
@media (max-width: 900px) { .wh-main { grid-template-columns: 1fr; padding: 16px; } .wh-preview { position: static; } }

.theme-cards { flex-wrap: wrap; }

/* ---------- quick switcher ---------- */
.modal-backdrop.switch { align-items: flex-start; padding-top: 14vh; }
.switcher { width: 560px; max-width: 94vw; border-radius: 10px; background: var(--bg-modal); box-shadow: var(--elevation-high); overflow: hidden; animation: modal-in 140ms var(--ease); }
.switcher-input { width: 100%; padding: 18px 20px; border: none; outline: none; background: var(--bg-input-inset); color: var(--text-normal); font-size: 20px; }
.switcher-list { padding: 8px; max-height: 50vh; overflow-y: auto; }
.switcher-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px; border: none; border-radius: 6px; background: none; color: var(--text-normal); font-size: 16px; text-align: left; }
.switcher-row.on { background: var(--bg-active); }
.switcher-sub { color: var(--text-muted); font-size: 13px; }
.switcher-foot { padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--bg-modal-footer); }

/* ---------- polls, history, saved ---------- */
.poll { margin-top: 6px; max-width: 440px; padding: 14px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; }
.poll-q { font-weight: 700; font-size: 16px; color: var(--text-header); }
.poll-sub { color: var(--text-muted); font-size: 13px; }
.poll-answer { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 12px; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--bg-input-inset); color: var(--text-normal); text-align: left; }
.poll-answer.on { border-color: var(--brand); }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: var(--brand-faint); transition: width 300ms var(--ease); }
.poll-answer.on .poll-fill { background: rgba(88, 101, 242, .3); }
.poll-text, .poll-count { position: relative; }
.poll-count { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.message-edited { background: none; border: none; padding: 0; margin-left: 4px; font-size: 10px; color: var(--text-muted); }
.message-edited:hover { text-decoration: underline; }
.edit-ver { padding: 10px 12px; margin-bottom: 8px; border-radius: 6px; background: var(--bg-card); }
.edit-ver.current { box-shadow: inset 3px 0 0 var(--brand); }
.edit-ver-when { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.edit-ver-text { white-space: pre-wrap; word-break: break-word; }
.saved-row { padding: 12px; margin-bottom: 8px; border-radius: 8px; background: var(--bg-card); }
.saved-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; } .saved-meta span { color: var(--text-muted); font-size: 12px; }
.saved-text { white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; }
.saved-actions { display: flex; gap: 8px; margin-top: 8px; }
.saved-btn { display: flex; align-items: center; gap: 10px; margin: 0 8px 4px; padding: 8px 10px; border: none; border-radius: 6px; background: none; color: var(--interactive-normal); font-size: 16px; font-weight: 500; text-align: left; }
.saved-btn:hover { background: var(--bg-hover); color: var(--interactive-hover); }

.dm-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-col > .chat { flex: 1; min-height: 0; }
.dm-call { height: 320px; flex: none; display: flex; border-bottom: 1px solid var(--border-subtle); }
.dm-call .voice-room { flex: 1; }

/* ---------- jump to present, accounts, hint spacing ---------- */
.jump-wrap { position: sticky; bottom: 0; height: 0; overflow: visible; z-index: 5; }
.jump-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 20px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--elevation-high); animation: save-in 160ms var(--ease); }
.jump-bar:hover { background: var(--brand-hover); }
.acct-av { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.acct-av.plus { background: var(--bg-active); font-size: 16px; }
.field-hint + .inline-controls, .field-hint + .wh-actions { margin-top: 12px; }
.modal-body > .field-hint { margin-bottom: 12px; }

/* ---------- GIF picker ---------- */
.gif-modal { width: 520px; max-width: 94vw; height: 560px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.gif-search { margin: 16px; padding: 12px 14px; border: none; border-radius: 6px; outline: none; background: var(--bg-input-inset); color: var(--text-normal); font-size: 16px; }
.gif-grid { flex: 1; overflow-y: auto; padding: 0 16px 8px; columns: 2; column-gap: 8px; }
.gif-item { display: block; width: 100%; margin-bottom: 8px; padding: 0; border: none; border-radius: 6px; overflow: hidden; background: var(--bg-card); break-inside: avoid; }
.gif-item img { display: block; width: 100%; height: auto; }
.gif-item:hover { outline: 2px solid var(--brand); }
.gif-foot { padding: 8px 16px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-align: right; background: var(--bg-modal-footer); }
.composer-tools .gif-btn { height: 24px; padding: 0 6px; margin: 0 2px; border: none; border-radius: 4px; background: none; color: var(--interactive-normal); font-size: 12px; font-weight: 800; }

/* ---------- server preview ---------- */
.preview-bg { z-index: 820; }
.preview-close { position: fixed; top: 24px; right: 32px; z-index: 5; display: flex; flex-direction: column; align-items: center; width: 38px; height: 38px; border: 2px solid var(--text-muted); border-radius: 50%; justify-content: center; }
.preview-close small { position: absolute; top: 44px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.preview-shell { display: flex; width: 100%; height: 100%; }
.preview-side { width: 240px; flex: none; padding: 16px 8px; background: var(--bg-sidebar); overflow-y: auto; }
.preview-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-main); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 80px 16px 24px; border-bottom: 1px solid var(--border-subtle); }
.preview-title { font-size: 18px; font-weight: 700; color: var(--text-header); padding: 0 8px; }
.preview-head .preview-title { padding: 0; font-size: 20px; }
.preview-sub { font-size: 13px; color: var(--text-muted); padding: 0 8px 10px; }
.preview-head .preview-sub { padding: 0; }
.preview-msgs { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.preview-msg { display: flex; gap: 14px; }
.preview-author { font-weight: 600; color: var(--text-header); } .preview-author span { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.preview-foot { padding: 14px 24px; text-align: center; color: var(--text-muted); background: var(--bg-input-inset); }
:root[data-desktop="1"] .preview-close { top: 56px; }

.theme-cards + .section-title { margin-top: 28px; }

/* ---------- show password, tooltips ---------- */
.field-input-wrap { position: relative; display: flex; }
.field-input-wrap .field-input { width: 100%; padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 4px; background: none; color: var(--interactive-normal); }
.pw-eye:hover { color: var(--interactive-hover); }
[data-tip]::before, [data-tip]::after { display: none !important; }
.ki-tip { position: fixed; z-index: 3000; max-width: 240px; padding: 6px 10px; border-radius: 5px; background: var(--bg-floating); color: var(--text-header); font-size: 13px; font-weight: 600; line-height: 1.35; box-shadow: var(--elevation-high), var(--elevation-stroke); pointer-events: none; opacity: 0; transition: opacity 90ms var(--ease); }
.ki-tip.on { opacity: 1; }
.select-list.up { top: auto; bottom: calc(100% + 4px); transform-origin: bottom; }

/* ---------- preview overlay ---------- */
.preview-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; background: var(--bg-main); animation: fade-in 150ms var(--ease); }
:root[data-desktop="1"] .preview-overlay { top: 32px; }
.preview-rail { width: 72px; flex: none; padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; overflow-y: auto; background: var(--bg-rail); }
.preview-rail-icon { width: 48px; height: 48px; border: none; border-radius: 50%; background: var(--bg-main); color: var(--text-normal); font-weight: 600; transition: border-radius var(--dur) var(--ease), background var(--dur) var(--ease); }
.preview-rail-icon:hover { border-radius: 16px; background: var(--brand); color: #fff; }
.preview-loading { flex: 1; display: flex; align-items: center; justify-content: center; }
.preview-cat { padding: 14px 8px 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.preview-head { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 80px 0 16px; border-bottom: 1px solid var(--border-subtle); box-shadow: var(--header-shadow); }
.preview-head .preview-sub { padding: 0; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--brand); color: var(--text-on-brand); }
.preview-bar-text { flex: 1; display: flex; flex-direction: column; } .preview-bar-text span { font-size: 13px; opacity: .85; }
.bar-btn { height: 36px; padding: 0 20px; border: none; border-radius: 4px; font-size: 15px; font-weight: 500; }
.bar-btn.ghost { background: transparent; color: #fff; } .bar-btn.ghost:hover { text-decoration: underline; }
.bar-btn.solid { background: #fff; color: var(--brand); } .bar-btn.solid:hover { background: rgba(255,255,255,.88); }
@keyframes flash-blue { 0%, 55% { background: rgba(0, 168, 252, .38); box-shadow: 0 0 0 2px rgba(0, 168, 252, .8); } 100% { background: transparent; box-shadow: 0 0 0 0 transparent; } }
.flash { animation: flash-blue 1.5s var(--ease); }

/* ---------- permission picker ---------- */
.perm-picker { position: relative; margin-bottom: 8px; }
.perm-picker-panel { margin-top: 8px; padding: 8px; border-radius: 8px; background: var(--bg-floating); box-shadow: var(--elevation-high); }
.perm-picker-list { max-height: 280px; overflow-y: auto; margin-top: 8px; }
.perm-head { padding: 8px 8px 4px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.perm-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: none; border-radius: 4px; background: none; color: var(--text-normal); font-size: 14px; text-align: left; }
.perm-opt:hover:not(:disabled) { background: var(--bg-hover); }
.perm-opt:disabled { opacity: .55; }
.perm-opt small { margin-left: auto; color: var(--text-muted); }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.channel-row.locked, .channel-row .icon-lock { opacity: .6; }

.preview-img { display: block; max-width: 420px; max-height: 320px; margin-top: 6px; border-radius: 6px; }
.preview-file { margin-top: 6px; padding: 8px 12px; border-radius: 6px; background: var(--bg-card); font-size: 14px; }

/* ---------- server folders ---------- */
.rail-folder { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 4px 0; border-radius: 16px; transition: background var(--dur) var(--ease); }
.rail-folder.open { background: color-mix(in srgb, var(--fc) 22%, transparent); }
.rail-folder-btn { color: var(--text-normal); }
.folder-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 28px; height: 28px; }
.folder-minis i { display: flex; align-items: center; justify-content: center; border-radius: 4px; background: var(--bg-active); font-style: normal; font-size: 9px; font-weight: 700; }

/* ---------- events, chips, mobile ---------- */
.events-row { display: flex; align-items: center; gap: 10px; margin: 6px 8px 0; padding: 8px 10px; border: none; border-radius: 6px; background: none; color: var(--interactive-normal); font-size: 15px; font-weight: 500; text-align: left; }
.events-row:hover { background: var(--bg-hover); color: var(--interactive-hover); }
.event-form { padding: 12px; margin: 12px 0; border-radius: 8px; background: var(--bg-card); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border: 1px solid var(--border-subtle); border-radius: 14px; background: none; color: var(--text-muted); font-size: 13px; }
.chip.on { background: var(--brand-faint); border-color: var(--brand); color: var(--text-normal); }
.mobile-menu-btn { display: none; }
@media (max-width: 760px) {
  .mobile-menu-btn { display: inline-flex; }
  .rail { position: fixed; z-index: 700; left: 0; top: 0; bottom: 0; transform: translateX(-110%); transition: transform 200ms var(--ease); }
  .sidebar { position: fixed; z-index: 699; left: 72px; top: 0; bottom: 0; width: min(272px, calc(100vw - 72px)); transform: translateX(-130%); transition: transform 200ms var(--ease); }
  body.nav-open .rail, body.nav-open .sidebar { transform: none; }
  body.nav-open .content::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 5; }
  .members { display: none; }
  .modal { max-width: 100vw; }
  .message-actions { display: none; }
  .composer-wrap { padding: 0 8px; }
  .settings-nav { width: 100%; }
  .voice-grid { grid-template-columns: 1fr; }
  .dev-site-main, .wh-main { padding-left: 12px; padding-right: 12px; }
}

/* ---------- stage ---------- */
.vbtn.hide { display: none; }
.stage-audience { padding: 8px 20px; border-top: 1px solid var(--border-subtle); background: var(--bg-sidebar); max-height: 34vh; overflow-y: auto; }
.stage-head { margin: 6px 0; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.stage-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border-radius: 16px; background: var(--bg-card); font-size: 14px; }
.hand-up { color: var(--warning); display: inline-flex; }

/* ---------- the public website ---------- */
.site { position: absolute; inset: 0; overflow-y: auto; background: #1b1a19; color: #e7e3de; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 17px; line-height: 1.65; }
.site a { color: #f4a27d; text-decoration: none; } .site a:hover { text-decoration: underline; }
.site h1, .site h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; color: #f3efe9; line-height: 1.2; }
.site-head { display: flex; align-items: center; justify-content: space-between; max-width: 1000px; margin: 0 auto; padding: 22px 24px; }
.site-mark { display: flex; align-items: center; gap: 10px; color: #f3efe9 !important; font-family: Georgia, serif; font-size: 24px; font-weight: 600; }
.site-nav { display: flex; align-items: center; gap: 26px; font-size: 16px; }
.site-nav a { color: #cfc9c1; }
.site-nav a.site-login { padding: 7px 18px; border: 1px solid #6a625a; border-radius: 4px; color: #f3efe9; }
.site-nav a.site-login:hover { background: #2a2826; text-decoration: none; }
.site-main, .site-doc { max-width: 1000px; margin: 0 auto; padding: 24px 24px 64px; }
.site-doc { max-width: 760px; }
.site-hero { display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: 48px 0 56px; border-bottom: 1px solid #38342f; }
.site-hero h1 { margin: 0 0 18px; font-size: 46px; max-width: 14em; }
.site-hero p { max-width: 34em; margin: 0 0 22px; color: #cfc9c1; font-size: 19px; }
.site-hero-art { flex: none; opacity: .95; }
.site-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.site-btn { display: inline-block; padding: 11px 22px; border: 1px solid #6a625a; border-radius: 4px; background: none; color: #f3efe9 !important; font: inherit; font-size: 16px; cursor: pointer; }
.site-btn:hover { background: #2a2826; text-decoration: none !important; }
.site-btn.solid { background: #e4572e; border-color: #e4572e; color: #fff !important; }
.site-btn.solid:hover { background: #cf4a24; }
.site-small { color: #958e85 !important; font-size: 14px !important; }
.site-block { padding: 44px 0 8px; }
.site-block.narrow { max-width: 640px; }
.site-block h2, .site-doc h2 { margin: 32px 0 10px; font-size: 26px; }
.site-block p, .site-doc p { color: #d6d0c8; }
.site-list { padding-left: 20px; color: #d6d0c8; }
.site-list li { margin: 6px 0; }
.site-list.two { columns: 2; column-gap: 40px; } .site-list.two li { break-inside: avoid; }
.site-doc h1 { margin: 20px 0 6px; font-size: 38px; }
.site-entry { margin: 30px 0; padding-top: 12px; border-top: 1px solid #38342f; }
.site-entry h2 { margin: 8px 0 0; }
.site-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px; }
.site-table th, .site-table td { padding: 10px 12px; border: 1px solid #38342f; text-align: left; vertical-align: top; }
.site-table th { background: #242220; color: #f3efe9; }
.site-foot { max-width: 1000px; margin: 40px auto 0; padding: 28px 24px 56px; border-top: 1px solid #38342f; color: #958e85; font-size: 15px; }
.site-foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; }
.site-foot p { margin: 6px 0; }
@media (max-width: 720px) {
  .site-hero { flex-direction: column-reverse; align-items: flex-start; padding-top: 28px; } .site-hero h1 { font-size: 34px; } .site-hero-art svg { width: 110px; height: 110px; }
  .site-list.two { columns: 1; } .site-nav { gap: 14px; font-size: 15px; } .site-table { font-size: 14px; display: block; overflow-x: auto; }
}

.site { --brand: #e4572e; }
