/* ---------- 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; }
