#app-shell { height: 100%; display: flex; flex-direction: column; position: relative; }

#topbar {
  height: 52px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}
#topbar .brand { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
#topbar .brand span { color: var(--accent); }
#topbar .tabs { display: flex; gap: 4px; flex: 1; min-width: 0; align-items: center; }
#topbar .tabs.top-right { flex: 0 0 auto; margin-left: auto; }
#topbar .tab { background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
#topbar .tab[hidden] { display: none; }
#topbar #oneira-update {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 165, 89, 0.18);
  color: #23a559;
}
#topbar #oneira-update[hidden] { display: none; }
#topbar #oneira-update svg { width: 18px; height: 18px; display: block; }
#topbar #oneira-update:hover { background: rgba(35, 165, 89, 0.32); color: #23a559; }
#connection-status {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #faa61a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#connection-status[hidden] { display: none; }
#topbar .tab.active { color: var(--text); background: var(--panel-alt); }
#topbar .tab:hover { color: var(--text); }
#topbar .tab.is-later,
#topbar .tab:disabled {
  opacity: 0.4;
  cursor: default;
  color: var(--text-dim);
}
#topbar .tab.is-later:hover,
#topbar .tab:disabled:hover {
  color: var(--text-dim);
  background: transparent;
}
#topbar .top-right { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12px; }

#mail-tab { position: relative; }
.mail-badge {
  display: inline-flex; position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}
.mail-badge[hidden] { display: none !important; }

#mail-tray {
  position: fixed; z-index: 1000; min-width: 260px; max-width: 320px; max-height: min(420px, 70vh);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); overflow: hidden;
}
#mail-tray[hidden] { display: none !important; }
#mail-tray-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.mail-tray-empty {
  padding: 18px 16px; text-align: center; color: var(--text-dim); font-size: 13px; font-weight: 600;
}
.mail-tray-item {
  padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text);
}
.mail-tray-item.is-read { opacity: 0.65; }
.mail-tray-item-title { font-size: 13px; font-weight: 600; }
.mail-tray-item-detail {
  margin-top: 2px; font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#mail-clear-btn {
  flex: 0 0 auto; width: 100%; padding: 10px 14px;
  background: var(--panel-alt); border: none; border-top: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
#mail-clear-btn:hover { background: var(--rail); color: var(--text); }
#mail-clear-btn[hidden] { display: none !important; }

.feed-family-chip {
  flex: 0 0 auto; align-self: flex-start;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-dim); background: var(--panel);
}
.feed-family-chip.is-activity { color: var(--accent); border-color: var(--accent); }
.feed-family-chip.is-profile { color: var(--accent-submenu); border-color: var(--accent-submenu); }
.feed-family-chip.is-moderation { color: var(--danger); border-color: var(--danger); }
.feed-family-chip.is-feedback { color: var(--text); border-color: var(--text-dim); }

.feed-alert-card {
  border-left: 3px solid var(--border);
}
.feed-alert-card.is-activity { border-left-color: var(--accent); }
.feed-alert-card.is-profile { border-left-color: var(--accent-submenu); }
.feed-alert-card.is-moderation { border-left-color: var(--danger); }
.feed-alert-card.is-feedback { border-left-color: var(--text-dim); }

.feed-alert-face.is-moderation { outline: 2px solid var(--danger); outline-offset: 1px; }
.feed-alert-face.is-feedback { outline: 2px solid var(--text-dim); outline-offset: 1px; }
.feed-alert-face {
  position: relative; overflow: hidden; flex: 0 0 auto;
}
.feed-server-icon-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.feed-alert-card .announce-divider { margin: 0 0 12px; }

.mail-tray-item-head {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.mail-tray-item-head .mail-tray-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-tray-item.is-activity { border-left: 3px solid var(--accent); }
.mail-tray-item.is-profile { border-left: 3px solid var(--accent-submenu); }
.mail-tray-item.is-moderation { border-left: 3px solid var(--danger); }
.mail-tray-item.is-feedback { border-left: 3px solid var(--text-dim); }

/* grid-template-rows is required here, not optional — without it, the
   single implicit row auto-sizes to fit its content (all messages ever
   rendered) instead of being locked to the available screen height.
   That silently breaks overflow/scrolling everywhere downstream,
   including #chat-body, since a Grid row's sizing doesn't automatically
   inherit a constrained height from its flex parent the way nested
   Flexbox containers do. */
#main-grid { flex: 1 1 auto; display: grid; grid-template-columns: 72px 240px 1fr; grid-template-rows: 1fr; min-height: 0; }
#main-grid.has-member-list { grid-template-columns: 72px 240px minmax(0, 1fr) minmax(0, 240px); }
#main-grid.has-member-list.has-search-results { grid-template-columns: 72px 240px minmax(0, 1fr) minmax(280px, 380px); }

#server-rail { background: var(--rail); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 0; min-height: 0; }
#server-rail-main {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 10px;
}
.rail-icon {
  position: relative;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel-alt); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  transition: border-radius 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.rail-icon:hover, .rail-icon.active { border-radius: 16px; background: var(--accent); color: #fff; }
.rail-divider { width: 32px; height: 1px; background: var(--border); margin: 2px 0; }

/* Holds the server icons between the Home divider and the pinned
   Create-Server button. flex: 1 1 auto lets it absorb all the rail's
   spare height so create-server-icon stays pinned at the very bottom
   regardless of how many/few servers are in the list — matching the
   "Home top, Create Server bottom" symmetry from Session 9's design
   call. Its own overflow-y means a long server list scrolls internally
   without ever pushing Create Server off the visible rail. */
#server-list {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  overflow-y: auto;
}
.server-icon-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}
.rail-unread-pill {
  display: none;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: #fff;
}
.server-icon-wrap.has-unread .rail-unread-pill { display: block; }
/* Server icons reuse .rail-icon's circle/rounded-square hover behavior
   for visual consistency with Home, but get their own class so
   server-specific states (drag handles, unread dot, etc. — all later
   features) have somewhere to hang without touching Home's styling. */
.rail-icon.server-icon { font-size: 14px; }
.rail-icon.server-icon.has-icon { color: transparent; }
.rail-icon.server-icon .server-icon-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Sits below #server-list, always visible — see the flex: 1 1 auto
   comment above. Uses --accent-submenu (not --accent) since clicking it
   opens a pop-up modal rather than navigating the main screen, the same
   "you're entering a layered pop-up" color cue the party modal and
   context menu already use. */
.rail-icon.create-server-icon { background: var(--panel-alt); color: var(--accent-submenu); font-size: 20px; font-weight: 700; }
.rail-icon.create-server-icon:hover { background: var(--accent-submenu); color: #fff; }

.icon-badge {
  display: none; position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--rail);
}

#secondary-panel { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; width: 100%; }
#secondary-nav { padding: 8px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; box-sizing: border-box; }
.nav-item { position: relative; display: flex; align-items: center; align-self: stretch; width: 100%; box-sizing: border-box; min-height: 32px; background: transparent; color: var(--text-dim); text-align: left; font-size: 14px; font-weight: 600; padding: 6px 8px; border-radius: 6px; }
.nav-item:hover, .nav-item.active { background: var(--panel-alt); color: var(--text); }
.nav-item.is-later,
.nav-item:disabled {
  opacity: 0.4;
  cursor: default;
  color: var(--text-dim);
}
.nav-item.is-later:hover,
.nav-item:disabled:hover {
  background: transparent;
  color: var(--text-dim);
}

.pending-badge {
  display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; align-items: center; justify-content: center; padding: 0 4px;
}

/* Only one of these three is ever visible at once — see openServer(),
   goHome(), and openSettings(). Each needs its own flex column so
   the nav/header + scrolling body layout inside it still works exactly
   like #secondary-panel's own flex column did before the split. */
#dm-sidebar-view, #server-sidebar-view, #settings-sidebar-view, #profile-sidebar-view { flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; display: flex; flex-direction: column; align-items: stretch; }

#secondary-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px 8px; width: 100%; box-sizing: border-box; min-width: 0; }

/* ---- Server sidebar (categories + channels) ---- */
#server-sidebar-face {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#server-sidebar-banner {
  display: none;
  flex: 0 0 auto;
  width: 100%;
  height: 96px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#server-sidebar-view.has-banner #server-sidebar-face {
  position: relative;
  height: 96px;
  overflow: hidden;
}
#server-sidebar-view.has-banner #server-sidebar-banner {
  display: block;
  position: absolute;
  inset: 0;
  height: auto;
}
#server-sidebar-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
#server-sidebar-header:hover { background: var(--panel-alt); }
#server-sidebar-view.has-banner #server-sidebar-header {
  position: absolute;
  inset: 0;
  z-index: 3;
  align-items: flex-start;
  border-bottom: none;
  color: #fff;
  background: linear-gradient(180deg, rgba(8, 18, 28, 0.78) 0%, rgba(8, 18, 28, 0) 70%);
}
#server-sidebar-view.has-banner #server-sidebar-header:hover {
  background: linear-gradient(180deg, rgba(8, 18, 28, 0.88) 0%, rgba(8, 18, 28, 0.08) 80%);
}
#server-sidebar-view.has-banner #server-sidebar-caret { color: rgba(255, 255, 255, 0.8); }
#server-sidebar-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#server-sidebar-caret {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1;
}
#server-sidebar-body { flex: 1 1 auto; overflow-y: auto; padding: 10px 8px 12px; }

.server-sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 8px 6px;
  user-select: none;
}
#server-sections {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
#server-channels-label { margin: 8px 0 6px; }
.server-section-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.server-section-row:hover { background: var(--panel-alt); color: var(--text); }
.server-section-icon {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 13px;
  line-height: 1;
  opacity: 0.85;
}
.server-section-label { flex: 1 1 auto; min-width: 0; }

.category-block { margin-bottom: 14px; }
.category-block:last-child { margin-bottom: 4px; }
.category-header {
  display: flex; align-items: center; gap: 4px; padding: 8px 6px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer; user-select: none;
}
.category-header:hover { color: var(--text); }
.category-arrow { display: inline-block; font-size: 9px; width: 12px; text-align: center; transition: transform 0.15s ease; flex: 0 0 auto; }
.category-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-block.collapsed .category-arrow { transform: rotate(-90deg); }
.category-block.collapsed .category-channels { display: none; }

.category-add-btn {
  background: transparent; color: var(--text-dim); font-size: 14px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.category-add-btn:hover { color: var(--text); background: var(--panel-alt); }

.category-channels { display: flex; flex-direction: column; gap: 0; padding-top: 2px; }
.channel-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--text-dim); cursor: pointer; font-size: 15px; line-height: 1.2; }
.channel-row:hover, .channel-row.active { background: var(--panel-alt); color: var(--text); }
.channel-row.has-unread .channel-label { color: var(--text); font-weight: 600; }
.channel-mention-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.channel-icon {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}
.channel-settings-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  margin-left: 4px;
}
.channel-row > .channel-settings-btn:first-of-type,
.channel-row .channel-label + .channel-settings-btn { margin-left: auto; }
.channel-row .channel-mention-badge + .channel-settings-btn { margin-left: 4px; }
.channel-row:hover .channel-settings-btn,
.channel-row.active .channel-settings-btn,
.category-header:hover .channel-settings-btn {
  display: flex;
}
.channel-settings-btn:hover { color: var(--text); background: var(--panel); }
.category-header .channel-settings-btn { margin-left: 0; }

#channel-settings-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 52px;
  z-index: 81;
  display: flex;
  min-height: 0;
  background: var(--bg);
}
#channel-settings-overlay[hidden] { display: none !important; }
#channel-settings-index {
  flex: 0 0 220px;
  width: 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 10px 18px;
  background: var(--rail);
  border-right: 1px solid var(--border);
}
#channel-settings-index-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#channel-settings-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#channel-settings-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow-y: auto;
  padding: 24px 40px 40px;
}
#channel-settings-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
#channel-settings-close span:first-child {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
#channel-settings-close:hover { color: var(--text); }
#channel-settings-close:hover span:first-child { border-color: var(--text); }
#channel-settings-private-host .settings-opt { padding-left: 0; padding-right: 0; }

.channel-perms-layout {
  display: flex;
  gap: 16px;
  min-height: 420px;
  margin-top: 12px;
  align-items: stretch;
}
.channel-perms-roles {
  flex: 0 0 220px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 0;
  min-height: 0;
}
.channel-perms-roles-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-perms-roles-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.channel-perms-role-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.channel-perms-role-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
}
.channel-perms-role-row:hover,
.channel-perms-role-row.is-active {
  background: var(--panel-alt);
  color: var(--text);
}
.channel-perms-role-row.is-sample { opacity: 0.75; }
.channel-perms-role-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.channel-perms-role-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.channel-perms-editor {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.channel-perms-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.channel-perms-editor-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.channel-perms-editor-actions {
  display: flex;
  gap: 8px;
}
.channel-perms-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.channel-perms-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.channel-perms-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.channel-perms-section .channel-perms-row:last-child { border-bottom: none; }
.channel-perms-row.is-later { opacity: 0.55; }
.channel-perms-row-text { flex: 1 1 auto; min-width: 0; }
.channel-perms-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.channel-perms-row-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.35;
}
#channel-settings-invites .server-invites-row.is-empty-row td {
  text-align: left;
  padding: 16px 10px;
}

.server-icon-wrap.dnd-dragging,
.category-block.dnd-dragging,
.channel-row.dnd-dragging,
.server-role-item.dnd-dragging,
.profile-page-item.dnd-dragging { opacity: 0.45; }
.server-icon-wrap.dnd-drop-before::before,
.category-block.dnd-drop-before::before,
.channel-row.dnd-drop-before::before,
.server-role-item.dnd-drop-before::before,
.profile-page-item.dnd-drop-before::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  pointer-events: none;
}
.server-icon-wrap.dnd-drop-after::after,
.category-block.dnd-drop-after::after,
.channel-row.dnd-drop-after::after,
.server-role-item.dnd-drop-after::after,
.profile-page-item.dnd-drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  pointer-events: none;
}
.server-icon-wrap,
.category-block,
.channel-row { position: relative; }
.category-header.dnd-drop-into,
.category-channels.dnd-drop-into {
  outline: 1px dashed var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}
.category-header[draggable="true"],
.channel-row[draggable="true"],
.server-icon-wrap[draggable="true"] { cursor: grab; }
.category-header[draggable="true"]:active,
.channel-row[draggable="true"]:active,
.server-icon-wrap[draggable="true"]:active { cursor: grabbing; }
#secondary-body h3 {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim);
  margin: 12px 8px 8px; padding-top: 10px; border-top: 1px solid var(--border);
}
#dm-rows { display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; }
.dm-item {
  position: relative;
  display: flex;
  align-items: center;
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  gap: 10px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
}
.dm-item:hover, .dm-item.active { background: var(--panel-alt); color: var(--text); }
.dm-item .avatar-dot {
  width: 32px;
  height: 32px;
  flex: none;
  aspect-ratio: 1;
  align-self: center;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  overflow: hidden;
}
.avatar-dot {
  position: relative;
  width: 32px; height: 32px; border-radius: 50%;
  aspect-ratio: 1; align-self: center; overflow: hidden; line-height: 1;
  background: #3b3e4a; border: 1px solid var(--border); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #cfd1e0; text-transform: uppercase;
}
.avatar-dot:has(.status-dot) { overflow: visible; }
.empty-note { font-size: 12px; color: var(--text-dim); padding: 6px 8px 14px; line-height: 1.5; }
.placeholder-panel { font-size: 12px; color: var(--text-dim); padding: 10px 8px; line-height: 1.6; }

#account-footer { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--border); background: var(--panel-alt); }
#footer-profile-btn {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: transparent; color: inherit; text-align: left;
  padding: 4px; border-radius: 8px; flex: 0 1 auto;
}
#footer-profile-btn:hover { background: var(--rail); }
#account-footer .avatar-dot { position: relative; }
#account-footer .status-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--online); border: 2px solid var(--panel-alt); right: -2px; bottom: -2px; z-index: 1; }
#account-footer .who { font-size: 13px; font-weight: 600; }
#account-footer .status-label { font-size: 11px; color: var(--text-dim); }
#account-footer .spacer { flex: 1; }
#account-footer button { background: transparent; color: var(--text-dim); font-size: 11px; padding: 4px 8px; border-radius: 4px; }
#account-footer button:hover { color: var(--text); background: var(--rail); }

/* min-width: 0 is exactly as load-bearing here as min-height: 0, and for
   the mirror-image reason. #main-panel is the 1fr track of #main-grid,
   and a grid item's automatic minimum size means that track refuses to
   shrink below its content's min-content width. A forum card's single
   nowrap line has a min-content width as wide as the whole unbroken
   string, so without this the panel widens past the viewport and the
   page grows a horizontal scrollbar instead of the line ellipsing. */
#main-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.main-view { display: none; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.main-view.active { display: flex; }

.view-header {
  min-height: 52px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 700;
  position: relative; gap: 12px;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.header-title-group { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.header-title-stack {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.2;
}
.header-title-stack > span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-description {
  font-size: 12px; font-weight: 500; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-pins-btn:disabled {
  opacity: 0.7; cursor: default; color: var(--text-dim);
}
.chat-pins-btn:disabled:hover {
  color: var(--text-dim); background: transparent;
}
.chat-search-slot { display: flex; align-items: center; min-width: 0; position: relative; }
.chat-search-slot[hidden] { display: none !important; }
.chat-search-shell {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  min-width: 0;
  width: 200px;
  box-sizing: border-box;
}
.user-list-search .chat-search-shell { width: 100%; }
.chat-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.chat-search-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-search-chip:hover { background: var(--panel-alt); border-color: var(--accent); }
.chat-search-input {
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 4px 4px;
  font-size: 12px;
  color: var(--text);
  flex: 1 1 80px;
  min-width: 64px;
  width: auto;
  outline: none;
}
.chat-search-input::placeholder { color: var(--text-dim); }
.chat-search-shell:focus-within { border-color: var(--accent); }
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 0;
  max-height: min(60vh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
  padding: 4px 0;
  box-sizing: border-box;
}
.user-list-search .search-dropdown {
  left: 0;
  right: 0;
  width: auto;
  max-width: 100%;
}
.chat-search-slot .search-dropdown {
  left: auto;
  right: 0;
  width: min(300px, calc(100vw - 16px));
}
.search-dropdown-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px 4px;
}
.search-dropdown-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-right: 8px;
}
.search-dropdown-clear {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
}
.search-dropdown-clear:hover { color: var(--text); background: var(--panel-alt); }
.search-dropdown-item,
.search-dropdown-history-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  box-sizing: border-box;
}
.search-dropdown-item:hover,
.search-dropdown-history-item:hover { background: var(--panel-alt); }
.search-dropdown-item-title { font-size: 12px; font-weight: 600; }
.search-dropdown-item-detail { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.search-dropdown-empty {
  padding: 8px 12px 12px;
  font-size: 11px;
  color: var(--text-dim);
}
.search-dropdown-history-item {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-box { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--text); width: 160px; }
.search-box::placeholder { color: var(--text-dim); }
.pill-btn { background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.pill-btn:hover { background: var(--accent-hover); }

/* Secondary chat-header actions (Call, Pins, chat settings) — quieter
   than pill-btn since these aren't the primary call-to-action of the
   view. Inert placeholders until the underlying features exist. */
.icon-btn { background: transparent; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--panel-alt); }

.view-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }
.view-body h3 { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 10px; }
.view-body h3:not(:first-child) { margin-top: 20px; }

.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; }
.friend-row:hover { background: var(--panel-alt); }
.friend-row .who { font-size: 13px; font-weight: 600; }
.friend-row > .who { flex: 1; }
.friend-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.friend-status { font-size: 12px; line-height: 1.2; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row .row-actions { display: flex; gap: 6px; }
.accept-btn, .deny-btn { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 5px; color: #fff; }
.accept-btn { background: var(--online); }
.accept-btn:hover { background: #359456; }
.deny-btn { background: var(--danger); }
.deny-btn:hover { background: #c93a3d; }

.add-friend-bar { display: none; align-items: center; gap: 8px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 16px; }
.add-friend-bar input { flex: 1; background: var(--rail); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 13px; }
.add-friend-bar input:focus { outline: none; border-color: var(--accent); }
#add-friend-status { font-size: 12px; color: var(--text-dim); }

#settings-sidebar-view { padding: 10px 8px 12px; gap: 8px; }
#settings-user-card {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; color: inherit; text-align: left;
  padding: 8px; border-radius: 8px; flex: 0 0 auto;
}
#settings-user-card:hover { background: var(--panel-alt); }
.settings-user-card-text { min-width: 0; }
#settings-user-card .who { font-size: 14px; font-weight: 700; color: var(--text); }
#settings-search {
  flex: 0 0 auto;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; color: var(--text); font-size: 13px;
  margin: 0 4px;
}
#settings-search:focus { outline: none; border-color: var(--accent); }
#settings-nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 4px 12px; }
.settings-nav-group {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); padding: 14px 10px 6px;
}
.settings-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  background: transparent; color: var(--text-dim); text-align: left;
  font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 6px;
}
.settings-nav-item:hover, .settings-nav-item.is-open { background: var(--panel-alt); color: var(--text); }
.settings-nav-caret { font-size: 10px; color: var(--text-dim); transform: rotate(-90deg); }
.settings-nav-item.is-open .settings-nav-caret { transform: none; }
.settings-nav-item.is-later { opacity: 0.55; }
.settings-nav-child {
  display: block; width: calc(100% - 14px);
  background: transparent; color: var(--text-dim); text-align: left;
  font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px;
  margin-left: 14px; border-left: 2px solid var(--border);
}
.settings-nav-child:hover, .settings-nav-child.active { color: var(--text); background: var(--panel-alt); }
.settings-nav-child.active { border-left-color: var(--accent); }
.settings-nav-logout {
  display: block; width: 100%;
  background: transparent; color: var(--danger); text-align: left;
  font-size: 13px; font-weight: 700; padding: 10px 10px; border-radius: 6px;
  margin-top: 16px;
}
.settings-nav-logout:hover { background: var(--panel-alt); color: var(--danger); }
.settings-pane {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 28px 36px 48px;
  display: flex; flex-direction: column; align-items: center;
  /* Type scale — page → section → option → description (Rules hierarchy) */
  --settings-page-title: 24px;
  --settings-section-title: 20px;
  --settings-opt-title: 16px;
  --settings-opt-desc: 12px;
  --settings-note: 12px;
}
.settings-pane[hidden] { display: none !important; }
.settings-pane > * { width: 100%; max-width: 560px; }
.settings-block { max-width: 560px; margin: 0 auto 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.settings-block:last-child { border-bottom: none; margin-bottom: 0; }
.settings-block-title {
  font-size: var(--settings-page-title);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 18px;
}
.settings-subblock { margin: 0 0 22px; }
.settings-subblock:last-child { margin-bottom: 0; }
.settings-subblock-title {
  font-size: var(--settings-section-title);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}
.settings-blurb {
  font-size: var(--settings-opt-desc);
  line-height: 1.45;
  color: var(--text-dim);
  margin: 0 0 16px;
}
.settings-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background: transparent; color: inherit; text-align: left;
}
.settings-subblock .settings-row:last-child { border-bottom: none; }
.settings-row-label { flex: 0 0 200px; font-size: 16px; font-weight: 600; color: var(--text); }
.settings-row-value { flex: 1 1 auto; text-align: right; font-size: 16px; color: var(--text); min-width: 0; }
.settings-row-value.is-empty, .settings-row-value .is-empty { color: var(--text-dim); }
.settings-row-btn {
  flex: 0 0 auto; min-width: 72px;
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; font-weight: 600; padding: 8px 16px;
}
.settings-row-btn:hover { background: var(--border); }
.settings-row-link { cursor: pointer; }
.settings-row-link:hover { background: transparent; }
.settings-row-chevron { flex: 0 0 auto; color: var(--text-dim); font-size: 18px; line-height: 1; }
.settings-inline-link {
  background: transparent; color: var(--accent); font-size: 15px; font-weight: 600; padding: 0;
  border: none; cursor: pointer; display: inline; font-family: inherit;
}
.settings-inline-link:hover { text-decoration: underline; }
.settings-inline-link.is-static { cursor: default; }
.settings-back {
  background: transparent; color: var(--text-dim);
  font-size: 15px; font-weight: 700; padding: 0 0 16px;
}
.settings-back:hover { color: var(--text); }
.settings-danger-btn {
  background: var(--danger); color: #fff;
  font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 4px;
}
.settings-danger-btn:hover { filter: brightness(1.08); }
.settings-form-overlay {
  position: fixed; inset: 0; z-index: 960;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.settings-form {
  width: 440px; max-width: calc(100% - 32px);
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  padding: 20px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.settings-form h3 { font-size: 16px; font-weight: 800; color: var(--text); margin: 0 0 16px; }
.settings-form label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 12px; }
.settings-form input {
  display: block; width: 100%; margin-top: 6px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 14px; padding: 9px 10px;
}
.settings-form input:focus { outline: none; border-color: var(--accent); }
.settings-form-status { min-height: 16px; font-size: 12px; color: var(--danger); margin-bottom: 10px; }
.settings-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.settings-form-actions button {
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-weight: 600; padding: 7px 14px;
}
.settings-form-save {
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: 4px;
  font-size: 13px; font-weight: 700; padding: 8px 14px;
}
.settings-form-save:hover { background: var(--accent-hover); }
.settings-form-actions .settings-form-save { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.settings-form-actions .settings-danger-btn { background: var(--danger); color: #fff; border-color: var(--danger); }
.device-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.device-icon {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 8px;
  background: var(--panel-alt); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.device-meta { flex: 1 1 auto; min-width: 0; }
.device-name { font-size: 16px; font-weight: 700; color: var(--text); }
.device-sub { font-size: 14px; color: var(--text-dim); margin-top: 2px; }
.device-revoke {
  flex: 0 0 auto; background: transparent; color: var(--text-dim);
  font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 4px;
}
.device-revoke:hover { color: var(--text); background: var(--panel-alt); }
.mfa-setup { margin-top: 16px; max-width: 420px; }
.mfa-setup .settings-form-save { margin-top: 4px; }
.mfa-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em; font-size: 15px; font-weight: 700;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px; margin: 0 0 14px; cursor: pointer; word-break: break-all;
}
.mfa-secret.copied { border-color: var(--accent); }
.mfa-code-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 12px; }
.mfa-code-label input {
  display: block; width: 100%; margin-top: 6px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 16px; padding: 9px 10px; letter-spacing: 0.12em;
}
.settings-opt {
  display: flex; align-items: flex-start; gap: 16px;
  width: 100%; padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.settings-subblock .settings-opt:last-child { border-bottom: none; }
.settings-opt-text { flex: 1 1 auto; min-width: 0; }
.settings-opt-title {
  font-size: var(--settings-opt-title, 16px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.settings-opt-desc {
  font-size: var(--settings-opt-desc, 12px);
  line-height: 1.45;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 400;
}
.settings-opt-control { flex: 0 0 auto; padding-top: 2px; }
.settings-opt:has(.settings-select) { position: relative; }
.settings-opt:has(.settings-select) .settings-opt-title { padding-right: 240px; }
.settings-opt:has(.settings-select) .settings-opt-control {
  position: absolute;
  top: 16px;
  right: 0;
  z-index: 1;
  width: min(240px, 46%);
}
.settings-opt:has(.settings-select) .settings-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.settings-note {
  margin-top: 8px;
  font-size: var(--settings-note, 12px);
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}
.settings-note.is-later { color: var(--accent); }
.settings-toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-switch.is-disabled { cursor: default; opacity: 0.55; pointer-events: none; }
.settings-row-btn:disabled { opacity: 0.55; cursor: default; }
.settings-radio-list { margin: 8px 0 12px; }
.settings-radio {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; padding: 10px 0; background: transparent; color: inherit; text-align: left;
  cursor: pointer; border: none; font: inherit;
}
.settings-radio:disabled { cursor: default; opacity: 0.7; }
.settings-radio-dot {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  border: 2px solid var(--text-dim); box-sizing: border-box;
}
.settings-radio.is-on .settings-radio-dot {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px);
}
.settings-related-wrap { margin-top: 18px; }
.settings-related {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px; text-align: left;
  background: var(--panel-alt); color: inherit; border-radius: 8px;
}
.settings-related:hover { background: var(--border); }
.settings-related-text { flex: 1 1 auto; min-width: 0; }
.settings-disabled-search {
  width: 100%; margin: 4px 0 8px; padding: 10px 12px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-dim); font-size: 14px; cursor: default;
}
.settings-filter-grid { display: flex; gap: 18px; margin: 12px 0 8px; align-items: flex-start; }
.settings-filter-cats { flex: 0 0 180px; display: flex; flex-direction: column; gap: 4px; }
.settings-filter-cat {
  background: transparent; color: var(--text-dim); text-align: left;
  font-size: 14px; font-weight: 700; padding: 8px 10px; border-radius: 4px;
  border-left: 3px solid transparent;
}
.settings-filter-cat.is-on { color: var(--text); border-left-color: var(--accent); background: var(--panel-alt); }
.settings-filter-main { flex: 1 1 auto; min-width: 0; }
.settings-filter-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.settings-block.has-sections .settings-filter-row {
  border-bottom: none;
  padding-top: 8px;
  padding-bottom: 8px;
}
.settings-related-title {
  font-size: var(--settings-opt-title, 16px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.settings-related-desc {
  font-size: var(--settings-opt-desc, 12px);
  line-height: 1.45;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 400;
}
.settings-select {
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 14px; padding: 8px 10px; min-width: 160px;
}
.settings-subblock > .settings-select { width: 100%; margin: 8px 0 12px; }
.settings-select:disabled { opacity: 0.55; cursor: default; }
.settings-radio-list.is-disabled { opacity: 0.7; pointer-events: none; }
.settings-empty-card {
  background: var(--panel-alt); border-radius: 8px; padding: 18px 16px; margin: 12px 0;
  text-align: center;
}
.settings-empty-card.is-left { text-align: left; }
.settings-callout {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0 12px;
}
.settings-callout.is-warn { border-color: var(--away); }
.settings-callout-icon {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.settings-callout.is-warn .settings-callout-icon { background: var(--away); color: #1a1a1e; }
.settings-callout-copy { flex: 1 1 auto; min-width: 0; }
.settings-callout .settings-row-btn { margin-left: auto; align-self: center; }
.system-toolbar { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.settings-keybind-labels {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 44px;
  gap: 12px; margin: 12px 0 6px;
}
.settings-keybind-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 44px;
  gap: 12px; align-items: center;
}
.settings-keybind-row .settings-select { min-width: 0; width: 100%; }
.settings-keybind-combo {
  display: flex; align-items: stretch; min-width: 0;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: var(--rail); color: var(--text-dim); font-size: 13px;
}
.settings-keybind-combo span {
  flex: 1 1 auto; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.settings-keybind-combo .settings-row-btn {
  border: none; border-left: 1px solid var(--border); border-radius: 0; min-width: 0;
}
.settings-language-pick {
  display: flex; align-items: center; gap: 10px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 8px 4px 12px; margin: 8px 0 10px;
}
.settings-language-flag { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.settings-language-select {
  flex: 1 1 auto; min-width: 0; width: auto;
  background: transparent; border: none; text-align: right;
  font-weight: 600;
}
.settings-game-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
}
.settings-game-row.is-current {
  background: var(--panel-alt); border-radius: 10px;
  padding: 14px 16px;
}
.settings-game-row.is-current.is-empty .settings-game-name { letter-spacing: 0; font-weight: 700; }
.settings-game-row.is-empty { opacity: 0.7; }
.settings-game-copy { flex: 1 1 auto; min-width: 0; }
.settings-game-name-row { display: flex; align-items: center; gap: 6px; }
.settings-game-name { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: 0.04em; }
.settings-game-row:not(.is-current) .settings-game-name { letter-spacing: 0; font-weight: 700; }
.settings-game-verified {
  display: inline-flex; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 9px; font-weight: 800;
  align-items: center; justify-content: center; flex: 0 0 auto;
}
.settings-game-detail { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.settings-activity-search {
  width: 100%; margin: 12px 0 8px; padding: 10px 12px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 14px;
}
.settings-activity-search:focus { outline: none; border-color: var(--accent); }
.settings-activity-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 4px 0 8px;
}
.settings-activity-tools .settings-select { min-width: 140px; }
.settings-activity-server {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
}
.settings-activity-server-copy { flex: 1 1 auto; min-width: 0; }
.settings-activity-server .avatar-dot { width: 32px; height: 32px; font-size: 12px; }
.overlay-row-controls { display: flex; align-items: center; gap: 8px; }
.overlay-playing {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
}
.overlay-playing-tag {
  font-size: 12px; font-weight: 700; color: var(--online);
  margin-bottom: 8px;
}
.overlay-playing .settings-game-row { padding: 0; }
.overlay-widget-preview {
  background: var(--rail); border-radius: 10px;
  min-height: 180px; margin: 8px 0 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}
.overlay-widget-stack { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.overlay-widget-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--panel);
}
.overlay-widget-chip {
  background: var(--panel-alt); color: var(--text-dim);
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px;
}
.connections-add-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 10px 0 4px;
}
.connection-provider {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.connection-provider:disabled:not(.is-more) {
  opacity: 0.38; filter: grayscale(1); cursor: default;
}
.connection-provider.is-more {
  background: var(--panel-alt); color: var(--text-dim);
  font-size: 22px; font-weight: 600; line-height: 1;
}
.connection-face {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.connection-logo { width: 22px; height: 22px; display: block; }
.connection-count { margin-top: 22px; }
.connection-card {
  background: var(--panel);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
}
.connection-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--panel-alt);
}
.connection-card.is-open .connection-card-head { border-bottom: 1px solid var(--border); }
.connection-card-parts { padding: 6px 16px 8px; }
.connection-card-parts[hidden] { display: none; }
.connection-card-foot { border-top: 1px solid var(--border); padding: 8px 16px; }
.connection-disconnect {
  display: inline-flex; width: auto; background: transparent; color: var(--danger);
  font-size: 14px; font-weight: 600; padding: 4px 0; border-radius: 4px;
}
.connection-disconnect:hover { background: var(--panel-alt); }
.connection-card-who { flex: 1 1 auto; min-width: 0; }
.connection-card-name {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.connection-card-service {
  font-size: 12px; font-weight: 500; color: var(--text-dim); margin-top: 2px;
}
.connection-card-toggle {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0;
  background: transparent; color: var(--text-dim); border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.connection-card-toggle:hover { color: var(--text); background: var(--panel); }
.connection-chevron {
  width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.connection-card.is-open .connection-chevron { margin-top: 4px; transform: rotate(-135deg); }
#connection-disconnect-overlay {
  position: fixed; inset: 0; z-index: 970;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#connection-disconnect-overlay[hidden] { display: none; }
.connection-disconnect-modal {
  width: 400px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.connection-disconnect-modal .view-header { height: auto; padding: 16px 16px 0; border-bottom: none; }
.connection-disconnect-modal .view-body { padding: 12px 16px 16px; }
.connection-disconnect-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.connection-disconnect-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 16px 16px;
}
.connection-part {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0;
}
.connection-part-title {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.settings-block-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.settings-block-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appearance-seg {
  display: flex; overflow: hidden; min-width: 168px;
  border: 1px solid var(--border); border-radius: 8px;
}
.appearance-seg button {
  flex: 1 1 0; background: var(--rail); color: var(--text-dim);
  font-size: 13px; font-weight: 700; padding: 8px 12px;
}
.appearance-seg button:hover { color: var(--text); background: var(--panel-alt); }
.appearance-seg button.is-on { background: var(--accent); color: #fff; }
.appearance-tabs { width: 100%; margin: 8px 0 4px; }
.theme-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.theme-tile {
  background: var(--panel-alt); color: var(--text);
  border: 2px solid transparent; border-radius: 10px;
  padding: 12px 8px 10px;
}
.theme-tile:hover { border-color: var(--border); }
.theme-tile.is-on { border-color: var(--accent); }
.theme-dots { display: flex; justify-content: center; gap: 5px; margin-bottom: 8px; }
.theme-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.theme-tile-name { font-size: 12px; font-weight: 700; color: var(--text-dim); text-align: center; }
.theme-tile.is-on .theme-tile-name { color: var(--text); }
.appearance-color-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.appearance-color-control { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.appearance-color-control input[type="color"] {
  width: 36px; height: 36px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: transparent;
}
.appearance-hex {
  width: 92px; background: var(--rail); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; padding: 8px 10px;
}
.settings-block.has-sections { border-bottom: none; padding-bottom: 0; }
.settings-block.has-sections > .settings-subblock {
  margin: 0; padding: 24px 0;
  border-top: 1px solid var(--border);
}
.settings-block.has-sections > .settings-subblock:first-of-type {
  border-top: none; padding-top: 0;
}
.settings-block.has-sections > .settings-subblock > .settings-subblock-title {
  font-size: var(--settings-section-title);
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text);
}
.settings-block.has-sections .settings-opt,
.settings-block.has-sections .appearance-color-row,
.settings-block.has-sections .settings-block-row {
  border-bottom: none;
  padding-top: 10px;
  padding-bottom: 10px;
}
.settings-block.has-sections .settings-radio { padding-top: 8px; padding-bottom: 8px; }
.settings-related-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 14px 0 8px;
}
.settings-notify-heading {
  margin: 16px 0 8px;
}
.online-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9200;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  pointer-events: none;
}
.online-toast {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-sizing: border-box;
  min-width: 220px;
  max-width: 320px;
  max-height: 200px;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  overflow: hidden;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease, max-height 0.28s ease, margin-top 0.28s ease, padding 0.28s ease;
}
.online-toast.is-in {
  transform: translateX(0);
  opacity: 1;
}
.online-toast.is-out {
  transform: translateX(120%);
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.online-toast-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
}
.online-toast-copy { min-width: 0; flex: 1 1 auto; }
.online-toast-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.online-toast-line {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.call-toast { position: relative; }
.call-toast::after {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: inherit;
  pointer-events: none;
  animation: call-breathe 3s ease-in-out infinite;
}
.call-toast.is-out::after { animation: none; opacity: 0; }
@keyframes call-breathe {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}
html.reduced-motion .call-toast::after {
  animation-duration: 3s !important;
  animation-iteration-count: infinite !important;
}
.call-toast-actions {
  display: flex;
  gap: 8px;
  flex: 1 0 100%;
}
.call-toast-actions button {
  flex: 1 1 0;
  border: 0;
  border-radius: 4px;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
}
.call-toast-decline { background: #ed4245; }
.call-toast-decline:hover { background: #d83a3e; }
.call-toast-answer { background: #3ba55d; }
.call-toast-answer:hover { background: #2d8a4e; }
.settings-slider {
  width: 160px; accent-color: var(--accent);
}
.settings-slider:disabled { opacity: 0.55; cursor: default; }
.voice-advanced-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-advanced-actions .settings-danger-btn:disabled { opacity: 0.55; cursor: default; }
.video-bg-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 8px 0 12px;
}
.video-bg-tile {
  min-height: 88px; border-radius: 8px;
  background: var(--panel-alt); color: var(--text-dim);
  border: 2px solid transparent; font-size: 13px; font-weight: 700;
}
.video-bg-tile.is-on { border-color: var(--accent); color: var(--text); }
.video-bg-tile:disabled { cursor: default; opacity: 0.75; }

.a11y-slider { width: 100%; margin: 4px 0 12px; }
.a11y-ticks {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-dim); margin-top: 4px;
}
.a11y-preview {
  position: sticky; top: 0; z-index: 6;
  background: var(--bg); padding: 4px 0 16px; margin-bottom: 8px;
  overflow: hidden;
}
.a11y-preview-label {
  font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 8px;
}
.a11y-preview-window {
  position: relative;
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); padding: 12px;
  width: 100%; box-sizing: border-box;
}
.a11y-preview-chat { flex: 1 1 auto; min-width: 0; }
.a11y-preview-cluster { display: flex; gap: 8px; align-items: flex-start; }
.a11y-preview-cluster + .a11y-preview-cluster { margin-top: var(--preview-gap, 16px); }
.a11y-preview-avatar {
  width: calc(32px * var(--message-scale)); height: calc(32px * var(--message-scale));
  border-radius: 50%; background: var(--panel-alt); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(13px * var(--message-scale)); font-weight: 700; flex: 0 0 auto;
}
.a11y-preview-body { min-width: 0; }
.a11y-preview-header { display: flex; gap: 6px; align-items: baseline; margin-bottom: 4px; }
.a11y-preview-name { font-weight: 700; color: var(--accent); font-size: calc(13px * var(--message-scale)); }
.a11y-preview-time { color: var(--text-dim); font-size: calc(11px * var(--message-scale)); }
.a11y-preview-bubble {
  background: var(--panel-alt); border-radius: 12px;
  padding: calc(8px * var(--message-scale)) calc(10px * var(--message-scale));
  width: fit-content; max-width: 100%;
}
.a11y-preview-line { font-size: calc(15px * var(--message-scale)); color: var(--text); line-height: 1.45; }
.a11y-preview-reacts { display: flex; gap: 6px; margin-top: 6px; }
.a11y-preview-react {
  font-size: 12px; background: var(--rail); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 6px;
}
.a11y-preview-btn {
  margin-top: 8px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 6px;
}
.a11y-preview-members { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
html.ui-density-compact .a11y-preview-members { gap: 2px; }
html.ui-density-spacious .a11y-preview-members { gap: 16px; }
.a11y-preview-member { width: 22px; height: 22px; border-radius: 50%; }
html.ui-density-compact .a11y-preview-member { width: 16px; height: 16px; }
html.ui-density-spacious .a11y-preview-member { width: 28px; height: 28px; }
.a11y-preview-toggle { position: absolute; right: 12px; bottom: 12px; }
.a11y-preview-gif {
  margin-top: 8px; width: 120px; height: 54px; border-radius: 6px;
  background: linear-gradient(90deg, var(--online), var(--away), var(--danger));
  background-size: 200% 100%;
  color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  animation: a11y-gif 2.4s linear infinite;
}
.a11y-preview-window.still-gif .a11y-preview-gif { animation: none; }
.a11y-preview-emoji { display: inline-block; animation: a11y-pop 1.2s ease-in-out infinite; }
.a11y-preview-window.still-emoji .a11y-preview-emoji { animation: none; }
html.chat-compact .a11y-preview-avatar { display: none; }
html.chat-compact .a11y-preview-header { display: inline; margin-right: 6px; }
html.chat-compact .a11y-preview-bubble {
  display: inline; background: transparent; padding: 0; border-radius: 0;
}
.a11y-preview-window.name-styles:not(.role-off) .a11y-preview-name {
  background: linear-gradient(90deg, var(--accent), var(--accent-submenu));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.a11y-preview-window.role-off .a11y-preview-name { color: var(--text); }
@keyframes a11y-gif {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes a11y-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
html.underline-links .msg-link { text-decoration: underline; }
html.high-contrast .settings-opt-title,
html.high-contrast .cluster-name,
html.high-contrast .a11y-preview-name { font-weight: 800; }
html.high-contrast .a11y-preview-window { border-width: 2px; }
html.high-contrast .channel-row,
html.high-contrast .dm-item,
html.high-contrast .member-row,
html.high-contrast .nav-item,
html.high-contrast .friend-row,
html.high-contrast .pill-btn,
html.high-contrast .a11y-preview-btn,
html.high-contrast .settings-row-btn {
  outline: 1px solid var(--border);
}
html.high-contrast .msg-link {
  text-decoration: underline;
  font-weight: 700;
}
html.high-contrast :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
html.show-toggle-icons .toggle-track::after {
  content: "\2715";
  position: absolute; right: 5px; top: 1px;
  font-size: 9px; color: var(--text-dim); pointer-events: none;
}
html.show-toggle-icons .toggle-switch input:checked + .toggle-track::after {
  content: "\2713"; left: 5px; right: auto; color: #fff;
}
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

html.ui-density-compact #server-rail { padding: 8px 0; gap: 6px; }
html.ui-density-compact #server-list { gap: 8px; }
html.ui-density-compact .nav-item { padding: 4px 10px; }
html.ui-density-compact #secondary-nav { padding: 8px 8px 6px; }
html.ui-density-compact #secondary-body { padding: 8px 8px; }
html.ui-density-compact .dm-item { height: 36px; min-height: 36px; padding: 0 6px; gap: 8px; }
html.ui-density-compact #server-sidebar-header { padding: 8px 10px; }
html.ui-density-compact #server-sidebar-body { padding: 6px 4px; }
html.ui-density-compact .category-block { margin-bottom: 8px; }
html.ui-density-compact .category-header { padding: 4px 6px 2px; }
html.ui-density-compact .channel-row { padding: 3px 8px; font-size: 14px; }
html.ui-density-compact .server-section-row { padding: 5px 8px; }
html.ui-density-compact #server-sections { margin-bottom: 6px; padding-bottom: 6px; }
html.ui-density-compact #member-list-body { padding: 8px 6px 8px; }
html.ui-density-compact .member-group-header { padding: 4px 8px 2px; }
html.ui-density-compact .member-row { padding: 2px 6px; gap: 6px; }
html.ui-density-compact .friend-row { padding: 4px 6px; }
html.ui-density-compact .dm-item .avatar-dot,
html.ui-density-compact .member-row .avatar-dot,
html.ui-density-compact .friend-row .avatar-dot {
  width: 24px; height: 24px; flex: none; font-size: 11px;
}

html.ui-density-spacious #server-rail { padding: 16px 0; gap: 16px; }
html.ui-density-spacious #server-list { gap: 22px; }
html.ui-density-spacious .nav-item { padding: 12px 10px; }
html.ui-density-spacious #secondary-nav { padding: 16px 10px 12px; }
html.ui-density-spacious #secondary-body { padding: 16px 12px; }
html.ui-density-spacious .dm-item { height: 52px; min-height: 52px; padding: 0 8px; gap: 12px; }
html.ui-density-spacious #server-sidebar-header { padding: 16px 14px; }
html.ui-density-spacious #server-sidebar-body { padding: 14px 10px; }
html.ui-density-spacious .category-block { margin-bottom: 20px; }
html.ui-density-spacious .category-header { padding: 12px 6px 6px; }
html.ui-density-spacious .channel-row { padding: 8px 8px; }
html.ui-density-spacious .server-section-row { padding: 10px 8px; }
html.ui-density-spacious #server-sections { margin-bottom: 14px; padding-bottom: 12px; }
html.ui-density-spacious #member-list-body { padding: 20px 10px 16px; }
html.ui-density-spacious .member-group-header { padding: 12px 8px 6px; }
html.ui-density-spacious .member-row { padding: 10px 8px; gap: 10px; }
html.ui-density-spacious .friend-row { padding: 12px 8px; }
html.ui-density-spacious .dm-item .avatar-dot,
html.ui-density-spacious .member-row .avatar-dot,
html.ui-density-spacious .friend-row .avatar-dot {
  width: 40px; height: 40px; flex: none; font-size: 15px;
}

html.chat-compact .cluster-avatar { display: none; }
html.chat-compact .msg-cluster { gap: 0; }
html.chat-compact .cluster-body { max-width: 100%; }
html.chat-compact .cluster-header {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 8px 0 0;
}
html.chat-compact .cluster-bubble {
  display: inline-flex;
  vertical-align: top;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
html.chat-compact .msg-cluster.other .cluster-bubble,
html.chat-compact .msg-cluster.self .cluster-bubble { background: transparent; }
html.chat-compact .msg-cluster.self .bubble-line { color: var(--text); }
html.chat-compact .msg-cluster.self .bubble-line .edited-tag { color: var(--text-dim); opacity: 0.8; }
html.chat-compact .msg-cluster.self .bubble-line a.msg-link { color: #69c0ff; }
html.chat-compact .msg-cluster.self .mention-chip {
  background: rgba(88, 101, 242, 0.35);
  color: #dee0fc;
}
html.chat-compact .msg-cluster.self .mention-chip.mention-self,
html.chat-compact .msg-cluster.self .mention-chip.mention-special {
  background: var(--away);
  color: #1a1a1e;
}
html.chat-compact .msg-cluster.self .reaction-pill {
  background: var(--rail);
  color: var(--text);
  border-color: var(--border);
}
html.chat-compact .msg-cluster.self .reaction-pill.mine {
  border-color: var(--accent);
  background: var(--panel);
}
html.chat-compact #chat-messages.self-right .msg-cluster.self,
html.chat-compact #channel-messages.self-right .msg-cluster.self { flex-direction: row; }
html.chat-compact #chat-messages.self-right .msg-cluster.self .cluster-body,
html.chat-compact #channel-messages.self-right .msg-cluster.self .cluster-body { align-items: flex-start; }
html.chat-compact #chat-messages.self-right .msg-cluster.self .bubble-line,
html.chat-compact #channel-messages.self-right .msg-cluster.self .bubble-line,
html.chat-compact #chat-messages.self-right .msg-cluster.self .msg-media,
html.chat-compact #channel-messages.self-right .msg-cluster.self .msg-media,
html.chat-compact #chat-messages.self-right .msg-cluster.self .link-embed,
html.chat-compact #channel-messages.self-right .msg-cluster.self .link-embed,
html.chat-compact #chat-messages.self-right .msg-cluster.self .invite-card,
html.chat-compact #channel-messages.self-right .msg-cluster.self .invite-card { text-align: left; align-self: flex-start; }

html.legacy-chat-input .composer-highlight { display: none !important; }
html.legacy-chat-input .composer-field textarea,
html.legacy-chat-input #composer .composer-field textarea,
html.legacy-chat-input #channel-composer .composer-field textarea,
html.legacy-chat-input .edit-composer .composer-field textarea {
  color: var(--text);
}
html.legacy-chat-input #composer-emoji-btn,
html.legacy-chat-input #channel-composer-emoji-btn,
html.legacy-chat-input #announce-composer-emoji-btn,
html.legacy-chat-input #forum-composer-emoji-btn,
html.legacy-chat-input .edit-composer-emoji {
  display: none !important;
}
html.legacy-chat-input #mention-picker { display: none !important; }

/* justify-content: flex-end is deliberately NOT used here — it has a
   well-known Flexbox quirk where content that overflows specifically
   *because of* flex-end alignment becomes unscrollable in most browsers
   (the scrollable-overflow calculation only accounts for the "natural"
   growth direction). #chat-messages uses margin-top: auto instead to
   get the same "hug the bottom when short" effect without that bug. */
#chat-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }
/* #channel-messages joins every #chat-messages rule below rather than
   getting its own duplicate block — the two are meant to behave
   identically (same clustering, same self-right layout), same reasoning
   as .centered-empty-state being a single shared class instead of two
   near-duplicate ID blocks that could quietly drift apart. */
#chat-messages, #channel-messages { margin-top: auto; }
/* Shared by the DM empty state and the channel welcome state — both are
   meant to look identical (centered, not offset), per this session's
   design call, so this is a real shared class rather than two
   near-duplicate ID-based blocks that could quietly drift apart. */
.centered-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--text-dim); max-width: 320px; margin: 0 auto; }
.centered-empty-state .badge {
  width: 64px; height: 64px; border-radius: 50%; background: var(--panel-alt); margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--accent);
}
.centered-empty-state p { font-size: 13px; line-height: 1.6; }
.centered-empty-state .welcome-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.centered-empty-state .welcome-sub { font-size: 13px; color: var(--text-dim); }

#channel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; }

.forum-thread-opener {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
  padding: 10px 16px 12px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
}
.forum-thread-opener-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.forum-thread-opener-avatar {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.forum-thread-opener-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.forum-thread-opener-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.forum-thread-opener-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.forum-thread-opener-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.forum-thread-opener-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  width: fit-content;
}
.forum-thread-opener-body {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.forum-thread-opener-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.forum-thread-opener .post-media { margin-top: 4px; }
.forum-thread-opener .post-media img,
.forum-thread-opener .post-media video { max-width: min(100%, 360px); }

.forum-post-avatar {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* #channel-composer joins every #composer rule below — same reasoning
   as #channel-messages joining #chat-messages above: identical behavior,
   separate element only because both views coexist in the DOM and ids
   must be unique. */
#composer, #channel-composer { flex: 0 0 auto; padding: 16px; border-top: 1px solid var(--border); position: relative; }
.typing-indicator {
  position: absolute;
  left: 20px;
  right: 16px;
  top: 0;
  height: 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.typing-indicator[hidden] { display: none !important; }
#channel-composer.has-slowmode .typing-indicator { right: 148px; }
.slowmode-indicator {
  position: absolute;
  right: 20px;
  top: 0;
  height: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
  pointer-events: none;
  white-space: nowrap;
}
.slowmode-indicator[hidden] { display: none !important; }
.slowmode-indicator.is-inline {
  position: static;
  justify-content: flex-end;
  height: auto;
  margin: 0 0 8px;
}
.slowmode-indicator svg { display: block; flex: 0 0 auto; }
#composer.attach-drop, #channel-composer.attach-drop { outline: 1px dashed var(--accent); outline-offset: -8px; }
#composer.attach-drop, #channel-composer.attach-drop { outline: 1px dashed var(--accent); outline-offset: -8px; }
.attach-preview { margin-bottom: 8px; }
.attach-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; max-width: 360px;
}
.attach-chip img, .attach-chip video {
  width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #000;
}
.attach-chip-meta { min-width: 0; flex: 1; }
.attach-chip-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip-size { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
#composer button.attach-chip-remove, #channel-composer button.attach-chip-remove {
  height: 28px; width: 28px; padding: 0; border-radius: 6px;
  background: transparent; color: var(--text-dim); font-size: 18px; font-weight: 600;
}
#composer button.attach-chip-remove:hover, #channel-composer button.attach-chip-remove:hover {
  background: var(--panel); color: var(--text);
}
.msg-media { max-width: 320px; }
.msg-media img, .msg-media video {
  display: block; max-width: 100%; max-height: 360px; border-radius: 10px;
  background: #000;
}
.msg-media img { cursor: pointer; }
#chat-messages.self-right .msg-cluster.self .msg-media,
#channel-messages.self-right .msg-cluster.self .msg-media { align-self: flex-end; }
#chat-messages:not(.self-right) .msg-cluster.self .msg-media,
#channel-messages:not(.self-right) .msg-cluster.self .msg-media { align-self: flex-start; }
#composer .box, #channel-composer .box { display: flex; align-items: flex-end; gap: 6px; background: transparent; border: none; border-radius: 0; padding: 6px; }
.composer-card {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.composer-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.composer-reply-bar[hidden] { display: none !important; }
.composer-reply-label { flex: 1; min-width: 0; }
.composer-reply-name { color: var(--text); font-weight: 700; }
#composer button.composer-reply-cancel, #channel-composer button.composer-reply-cancel {
  height: 22px; width: 22px; padding: 0; border-radius: 4px;
  background: transparent; color: var(--text-dim); font-size: 16px; font-weight: 700;
  align-self: center; flex: 0 0 auto;
}
#composer button.composer-reply-cancel:hover, #channel-composer button.composer-reply-cancel:hover {
  background: var(--panel); color: var(--text);
}
.composer-field {
  position: relative;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  overflow: hidden;
}
.composer-highlight {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  padding: 8px 6px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
}
.composer-mention {
  background: rgba(88, 101, 242, 0.35);
  color: #dee0fc;
  border-radius: 3px;
  font-weight: 600;
}
#composer textarea, #channel-composer textarea, .edit-composer textarea {
  flex: 1; width: 100%; min-width: 0; box-sizing: border-box;
  background: transparent; border: none; color: var(--text); font-size: 14px;
  font-family: inherit; padding: 8px 6px; resize: none; overflow-y: auto;
  line-height: 1.4; max-height: calc(1.4em * 5); /* caps growth at 5 lines, then scrolls */
}
.composer-field textarea {
  color: transparent;
  caret-color: var(--text);
  position: relative;
  z-index: 1;
}
#composer .composer-field textarea,
#channel-composer .composer-field textarea,
.edit-composer .composer-field textarea {
  color: transparent;
  caret-color: var(--text);
}
.composer-field textarea::placeholder { color: var(--text-dim); }
.composer-field textarea:disabled,
#composer .composer-field textarea:disabled,
#channel-composer .composer-field textarea:disabled {
  color: transparent;
  caret-color: var(--text-dim);
  cursor: not-allowed;
}
#composer textarea:focus, #channel-composer textarea:focus { outline: none; }
#composer textarea:disabled, #channel-composer textarea:disabled { color: var(--text-dim); cursor: not-allowed; }
#composer button:disabled, #channel-composer button:disabled, .composer-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#composer button:disabled:hover, #channel-composer button:disabled:hover { background: var(--accent); } /* don't hover-highlight while disabled */
#composer button, #channel-composer button {
  height: 36px; padding: 0 16px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; align-self: flex-end;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
#composer button:hover, #channel-composer button:hover { background: var(--accent-hover); }
#composer-send-btn, #channel-composer-send-btn { display: none; }
html.show-send-btn #composer-send-btn, html.show-send-btn #channel-composer-send-btn { display: flex; }
html.hide-reactions .reaction-row,
html.hide-reactions .announce-reactions,
html.hide-reactions .announce-comment-reactions,
html.hide-reactions .forum-post-reactions,
html.hide-reactions .announce-add-reaction-btn { display: none !important; }

/* + and emoji-face buttons flanking the textarea — quiet icon
   buttons rather than primary actions like Send. Matches Send's height
   so all three sit flush along the same bottom edge. #composer button
   is more specific than .composer-icon-btn alone, so these need the
   extra id prefix or they inherit Send's filled accent look. */
#composer .composer-icon-btn, #channel-composer .composer-icon-btn {
  background: transparent; color: var(--text-dim); font-size: 18px; font-weight: 600;
  width: 36px; height: 36px; padding: 0; flex: 0 0 auto; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; align-self: flex-end;
}
#composer .composer-icon-btn:hover, #channel-composer .composer-icon-btn:hover {
  color: var(--text); background: var(--rail);
}

#mention-picker {
  display: none;
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 100%;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 0;
}
.edit-composer #mention-picker {
  left: 8px;
  right: 8px;
}
#mention-picker.visible { display: block; }
#mention-picker.mention-picker-below {
  bottom: auto;
  top: 100%;
  margin-top: 4px;
  left: 0;
  right: 0;
}
.announce-composer-editing #mention-picker,
.announce-composer-editing-body #mention-picker,
.announce-comment-composer #mention-picker {
  left: 0;
  right: 0;
}
.mention-picker-heading {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mention-picker-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  border-radius: 0;
  height: auto;
  align-self: stretch;
}
#composer #mention-picker .mention-picker-row,
#channel-composer #mention-picker .mention-picker-row,
.edit-composer #mention-picker .mention-picker-row,
.announce-composer-editing #mention-picker .mention-picker-row,
.announce-comment-composer #mention-picker .mention-picker-row {
  background: transparent;
  color: var(--text);
  height: auto;
  padding: 6px 12px;
  justify-content: flex-start;
}
.mention-picker-row:hover,
.mention-picker-row.selected {
  background: var(--panel-alt);
}
#composer #mention-picker .mention-picker-row:hover,
#channel-composer #mention-picker .mention-picker-row:hover,
#composer #mention-picker .mention-picker-row.selected,
#channel-composer #mention-picker .mention-picker-row.selected,
.edit-composer #mention-picker .mention-picker-row:hover,
.edit-composer #mention-picker .mention-picker-row.selected,
.announce-composer-editing #mention-picker .mention-picker-row:hover,
.announce-composer-editing #mention-picker .mention-picker-row.selected,
.announce-comment-composer #mention-picker .mention-picker-row:hover,
.announce-comment-composer #mention-picker .mention-picker-row.selected {
  background: var(--panel-alt);
  color: var(--text);
}
.mention-picker-row:disabled,
#composer #mention-picker .mention-picker-row:disabled,
#channel-composer #mention-picker .mention-picker-row:disabled {
  opacity: 0.55;
  cursor: default;
  color: var(--text-dim);
}
.mention-picker-avatar {
  position: relative;
  overflow: hidden;
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: #3b3e4a; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #cfd1e0; text-transform: uppercase;
}
.mention-picker-avatar.mention-picker-at {
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-size: 16px;
}
.mention-picker-name { flex: 0 0 auto; font-weight: 600; }
.mention-picker-meta {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Announcements channel ---- */
/* Deliberately its own layout, not a variant of the clustered chat feed
   above — composer at the TOP (post-first, scroll-down-for-older),
   posts as self-contained cards rather than message bubbles. Reuses
   .cluster-avatar for the avatar circles (same sizing/scale as every
   other avatar in the app) but everything else here is new, since
   nothing about a titled post with comments/reactions maps onto the
   existing bubble shape. Visual pass only for now — see Handoff.md's
   "Announcements channel" design log for the full build-order plan
   (layout now, creation/persistence/deletion in later passes). */
#announcements-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#view-feed { flex: 1 1 auto; min-height: 0; }

.announce-composer-bar {
  flex: 0 0 auto; margin: 16px; padding: 10px 14px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px;
  position: relative;
  overflow: visible;
}

#announcements-posts,
#feed-posts { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.announce-posts-spacer { flex: 1 0 auto; }
.announce-post.is-highlight { box-shadow: inset 3px 0 0 var(--accent-submenu); }

.announce-post {
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column;
}

.announce-post-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.announce-post-meta { flex: 1 1 auto; min-width: 0; }
.announce-post-name { font-weight: 700; font-size: 14px; color: var(--text); }
.announce-post-role { font-size: 12px; color: var(--text-dim); }
.announce-post-menu-btn {
  background: transparent; color: var(--text-dim); font-size: 16px; font-weight: 700;
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.announce-post-menu-btn:hover { color: var(--text); background: var(--rail); }

.announce-post-title-row {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px;
  margin-bottom: 6px;
}
.announce-post-title { font-size: 16px; font-weight: 700; color: var(--text); }
.announce-post-body { font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.announce-post-content.announce-post-editing { margin-bottom: 4px; }
.announce-post-date { font-size: 12px; color: var(--text-dim); margin-top: 10px; }

/* Full-width within the post's own padding — deliberately edge-to-edge
   against the content above it (title/body's left edge, the 3-dot
   menu's right edge), not inset from the card's own border. Reused
   between EVERY section of the post (content/reactions/comments), not
   just once, since reactions and comments are now stacked as their own
   separate rows rather than a single combined footer. */
.announce-divider { height: 1px; background: var(--border); margin: 14px 0; }

.announce-reactions-row { display: flex; align-items: center; }
.announce-reactions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.announce-add-reaction-btn {
  background: transparent; color: var(--text-dim); font-size: 15px; font-weight: 700;
  width: 26px; height: 26px; border-radius: 6px; border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
}
.announce-add-reaction-btn:hover { color: var(--text); border-color: var(--text-dim); }

.announce-comments-row { display: flex; align-items: center; }
.announce-comments-btn {
  background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 600;
  padding: 4px 0;
}
.announce-comments-btn:hover { color: var(--text); }

/* ---- Comment thread ---- */
/* Collapsed by default (see toggleCommentThread) — this whole block is
   display:none until the comments button is clicked. Reuses
   .cluster-avatar for the small avatar circles, matching every other
   avatar in the app, same as the post cards themselves already do. */
.announce-comments-section {
  flex-direction: column; gap: 10px; margin-top: 12px;
}
.announce-comments-list { display: flex; flex-direction: column; }
.announce-comment { display: flex; gap: 10px; padding: 10px 0; }
/* A border on every comment except the first, rather than a separate
   divider element — this way it's correct regardless of WHEN a comment
   gets appended (initial load, "load more", a freshly-posted comment,
   or a live broadcast from someone else), without needing divider
   logic duplicated across all four of those call sites. */
.announce-comment + .announce-comment { border-top: 1px solid var(--border); }
.announce-comment .cluster-avatar { width: 28px; height: 28px; font-size: 12px; flex: 0 0 auto; }
.announce-comment-body { flex: 1 1 auto; min-width: 0; }
.announce-comment-header { display: flex; align-items: baseline; gap: 8px; }
.announce-comment-name { font-size: 13px; font-weight: 700; color: var(--text); }
.announce-comment-time { font-size: 11px; color: var(--text-dim); }
/* Pushed to the far right of the header row via margin-left: auto —
   only ever rendered by buildCommentElement when the current user can
   actually delete this comment, so there's no need for a disabled/inert
   state here the way .announce-post-menu-btn has for Edit. */
.announce-comment-menu-btn {
  margin-left: auto; background: transparent; color: var(--text-dim); font-size: 14px; font-weight: 700;
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.announce-comment-menu-btn:hover { color: var(--text); background: var(--rail); }
.announce-comment-content { font-size: 13px; color: var(--text); line-height: 1.4; word-wrap: break-word; }
.announce-comment-reactions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.announce-comment-reactions .announce-add-reaction-btn { width: 22px; height: 22px; font-size: 13px; }

.announce-comments-loadmore-btn {
  background: transparent; color: var(--accent); font-size: 12px; font-weight: 600;
  align-self: flex-start; padding: 2px 0;
}
.announce-comments-loadmore-btn:hover { text-decoration: underline; }

.announce-comment-composer {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  position: relative;
}
.announce-comment-composer .composer-field {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.announce-comment-composer .composer-field:focus-within {
  border-color: var(--accent-submenu);
}
.announce-comment-composer .composer-highlight {
  padding: 6px 10px;
  font-size: 13px;
  line-height: normal;
  white-space: pre;
  overflow: hidden;
}
.announce-comment-input {
  flex: 1 1 auto; width: 100%; background: transparent; border: none; border-radius: 6px;
  padding: 6px 10px; color: var(--text); font-size: 13px; font-family: inherit;
}
.announce-comment-composer .composer-field .announce-comment-input {
  color: transparent;
  caret-color: var(--text);
}
.announce-comment-input:focus { outline: none; }
.announce-comment-input::placeholder { color: var(--text-dim); }
.announce-comment-send-btn {
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 6px; flex: 0 0 auto;
}
.announce-comment-send-btn:hover { background: var(--accent-hover); }

.announce-end-marker { text-align: center; color: var(--text-dim); font-size: 13px; padding: 8px 0 4px; }

/* ---- Forums channel ---- */
/* Two things here run opposite to every other list in the app, both
   deliberate: the most-recently-active post sits at the TOP and
   pagination loads DOWNWARD, and the order is frozen once rendered - a
   live update may only retext a card, never move it. Reopening the
   channel is what re-sorts. See Team Chat/ForumsPlan.md. */
#forums-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#forum-posts {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px;
}

.forum-filter-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}
.forum-sort-btn {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.forum-sort-btn:hover { border-color: var(--text-dim); }
.forum-tag-filters {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.forum-tag-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.forum-tag-chip:hover { color: var(--text); border-color: var(--text-dim); }
.forum-tag-chip.is-active {
  color: var(--text);
  border-color: var(--accent, var(--text-dim));
  background: color-mix(in srgb, var(--accent, var(--text-dim)) 18%, transparent);
}
.forum-guidelines-box {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.4;
  max-height: 7.5em;
  overflow-y: auto;
}
.forum-composer-tags { display: flex; flex-direction: column; gap: 6px; }
.forum-composer-tags-label { font-size: 12px; color: var(--text-dim); }
.forum-composer-tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.forum-post-tag-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}
.forum-settings-tags-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.forum-settings-tags-list:empty { display: none; }
.forum-settings-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
}
.forum-settings-tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forum-settings-tag-remove {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.forum-settings-tag-pill:hover .forum-settings-tag-remove,
.forum-settings-tag-pill:focus-within .forum-settings-tag-remove { display: inline-flex; }
.forum-settings-tag-remove:hover { color: var(--text); }
.forum-settings-tag-add-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.forum-settings-tag-add-row .server-settings-input { flex: 1 1 auto; min-width: 0; }
.forum-settings-require-host { margin-top: 12px; }
.forum-settings-require-host .settings-opt { padding-left: 0; padding-right: 0; }
.forum-settings-reaction-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.forum-settings-reaction-preview { font-size: 22px; line-height: 1; min-width: 1.2em; }

/* flex: 0 0 auto matters: #forum-posts is a flex column, so without it a
   long list squashes every card down to fit instead of scrolling. */
.forum-post {
  flex: 0 0 auto;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: row; align-items: center; gap: 12px;
}
.forum-post-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.forum-post-thumb {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
  background: var(--panel); position: relative;
}
.forum-post-thumb img, .forum-post-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.forum-post-thumb-more {
  position: absolute; right: 2px; bottom: 2px;
  min-width: 18px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.forum-post:hover { border-color: var(--text-dim); }
.forum-post.is-editing {
  flex-direction: column; align-items: stretch;
}
.forum-post.is-editing:hover { border-color: var(--border); }
.forum-post-title-row {
  display: flex; align-items: center; gap: 8px;
}
.forum-post-title-row .forum-post-title { flex: 1 1 auto; min-width: 0; }
.forum-post-title-row .edited-tag { flex: 0 0 auto; }
.forum-post-title-row .announce-post-menu-btn { flex: 0 0 auto; margin-left: auto; }
.forum-start-title-row {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  column-gap: 8px;
}

/* Deliberately empty until tags are real, but kept in the DOM with a
   reserved height so a card is exactly as tall now as it will be once
   tags land - otherwise every card grows the day they arrive. */
.forum-post-tags { display: flex; align-items: center; gap: 6px; min-height: 16px; }
.forum-flag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.forum-post-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* This single clipped line is what makes every card the same height -
   no hard-coded pixel height anywhere. Author and body sit inline and
   the line as a whole ellipses at the card's edge, which is why it's a
   plain block with nowrap rather than a flex row (ellipsis on a flex
   child needs extra min-width plumbing to behave). */
.forum-post-line {
  font-size: 13px; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.forum-post-author { font-weight: 700; color: var(--text); margin-right: 6px; }
.forum-post-body { color: var(--text-dim); }

/* Reactions, message count and last-activity sit side by side, grouped
   left - matching the reference screenshot rather than being spread
   across the card's full width. */
.forum-post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-dim); }
.forum-post-reactions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.forum-post-reactions .reaction-pill { height: 22px; font-size: 12px; padding: 0 7px; }
/* The reaction button reuses .announce-add-reaction-btn outright rather
   than restyling a lookalike, so both channel types stay one edit apart
   when reactions become real. Only the box is shrunk to sit on a 12px
   metadata row instead of the announcement post's own dedicated row. */
.forum-post-meta .announce-add-reaction-btn { width: 20px; height: 20px; font-size: 13px; }

#user-list {
  display: none; flex-direction: column; min-height: 0; min-width: 0;
  border-left: 1px solid var(--border); background: var(--panel);
  overflow: hidden;
}
.user-list-search {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  min-width: 0;
}
.user-list-search[hidden] { display: none !important; }
.user-list-search .chat-search-input { width: 100%; min-width: 0; }
.user-list-search .chat-search-chip { max-width: 96px; font-size: 10px; padding: 1px 5px; }
#search-results-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
#search-results-panel[hidden] { display: none !important; }
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 8px 8px 10px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  min-width: 0;
}
#search-results-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results-close {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  flex: 0 0 auto;
}
.search-results-close:hover { color: var(--text); background: var(--panel-alt); }
.search-results-body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 6px;
  min-height: 0;
  min-width: 0;
}
.search-results-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
}
.search-results-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  min-width: 0;
}
.search-result-row {
  padding: 8px 6px 7px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: var(--panel-alt); }
.search-result-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-message {
  pointer-events: none;
  min-width: 0;
  overflow: hidden;
}
.search-result-message .msg-cluster {
  margin: 0;
  gap: 8px;
  flex-direction: row !important;
  max-width: 100%;
  min-width: 0;
}
.search-result-message .cluster-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}
.search-result-message .cluster-body {
  max-width: calc(100% - 36px);
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-start !important;
}
.search-result-message .cluster-header {
  font-size: 12px;
  gap: 5px;
  margin-bottom: 3px;
  min-width: 0;
}
.search-result-message .cluster-header .cluster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.search-result-message .cluster-header .cluster-time { font-size: 11px; flex: 0 0 auto; }
.search-result-message .cluster-bubble {
  max-width: 100%;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 12px;
  gap: 3px;
  box-sizing: border-box;
  overflow: hidden;
}
.search-result-message .bubble-line {
  font-size: 13px;
  line-height: 1.4;
}
.search-result-message .bubble-line.emoji-only { font-size: 28px; }
.search-result-message .bubble-line,
.search-result-message .msg-cluster.self .bubble-line { text-align: left !important; }
.search-result-message .msg-media,
.search-result-message .link-embed,
.search-result-message .invite-card {
  max-width: 100% !important;
  width: 100%;
  box-sizing: border-box;
  align-self: stretch !important;
}
.search-result-message .invite-card {
  padding: 10px;
  gap: 7px;
}
.search-result-message .invite-card-badge { width: 32px; height: 32px; font-size: 13px; }
.search-result-message .invite-card-name { font-size: 13px; }
.search-result-message .invite-card-subtitle,
.search-result-message .invite-card-invalid-text { font-size: 11px; }
.search-result-message .invite-card-btn { font-size: 11px; padding: 5px 9px; }
.search-result-message .msg-media img,
.search-result-message .msg-media video {
  max-width: 100%;
  height: auto;
}
#member-list-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 8px 12px; }
#member-list-body[hidden] { display: none !important; }
.member-group-header {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 8px 4px;
}
.member-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; color: var(--text);
}
.member-row:hover { background: var(--panel-alt); }
.member-row.offline { color: var(--text-dim); }
.member-row .avatar-dot { position: relative; width: 32px; height: 32px; }
.member-row .status-dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--panel); right: -2px; bottom: -2px; z-index: 1;
}
.member-row:hover .status-dot { border-color: var(--panel-alt); }
.status-dot.status-online { background: var(--online); }
.status-dot.status-away { background: var(--away); }
.status-dot.status-dnd { background: var(--danger); }
.status-dot.status-offline { background: var(--offline); }
.member-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.member-name { flex: 0 1 auto; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-status-line { font-size: 12px; line-height: 1.2; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-place { padding: 28px 32px; }
.site-place-title { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }

/* Sits once at the very top of message history — signals "you've
   reached the start, nothing more to load" and hosts quick actions.
   Rebuilt on every renderMessages() call along with the rest of the
   list, same reflow-from-scratch approach as the clusters below it. */
.convo-start-card { text-align: center; padding: 24px 16px 28px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.convo-start-avatar {
  position: relative;
  overflow: hidden;
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
  background: #3b3e4a; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #cfd1e0; text-transform: uppercase;
}
.convo-start-name { font-size: 20px; font-weight: 700; color: var(--text); }
.convo-start-meta { min-height: 16px; margin: 4px 0 12px; font-size: 12px; color: var(--text-dim); } /* placeholder line for mutual-servers-style info, later */
.convo-start-desc { font-size: 14px; color: var(--text-dim); margin-bottom: 16px; }
.convo-start-card .post-media { margin-top: 12px; display: flex; justify-content: center; }
.convo-start-card .post-media img,
.convo-start-card .post-media video { max-width: min(100%, 420px); }
.convo-start-actions { display: flex; gap: 8px; justify-content: center; }
.convo-start-actions .icon-btn { border: 1px solid var(--border); }
.convo-start-actions .danger-btn { background: transparent; border: 1px solid var(--danger); color: var(--danger); font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.convo-start-actions .danger-btn:hover { background: var(--danger); color: #fff; }
.convo-start-status { font-size: 12px; color: var(--text-dim); font-style: italic; }

.msg-cluster {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: var(--cluster-gap, 20px);
  max-width: 100%;
}
html.no-chat-bubbles .msg-cluster { margin-bottom: calc(var(--cluster-gap, 20px) + 4px); }
.msg-cluster.mention-highlight {
  background: rgba(250, 168, 26, 0.14);
  box-shadow: inset 2px 0 0 var(--away);
  border-radius: 4px;
  padding: 6px 8px;
  margin-left: -8px;
  margin-right: -8px;
}
.bubble-line.mention-highlight {
  background: rgba(250, 168, 26, 0.14);
  box-shadow: inset 2px 0 0 var(--away);
  border-radius: 4px;
  margin-left: -8px;
  padding: 2px 8px;
}
.msg-reply {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 4px;
  min-width: 0;
  cursor: pointer;
}
.msg-reply-bar {
  width: 2px;
  align-self: stretch;
  min-height: 12px;
  background: var(--text-dim);
  border-radius: 1px;
  flex: 0 0 auto;
}
.msg-reply-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex: 0 0 auto;
}
.msg-reply-text {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.mention-chip {
  display: inline;
  background: rgba(88, 101, 242, 0.35);
  color: #dee0fc;
  border-radius: 3px;
  padding: 0 4px;
  font-weight: 600;
  cursor: pointer;
}
.mention-chip:hover { filter: brightness(1.15); }
.mention-chip.mention-self,
.mention-chip.mention-special {
  background: var(--away);
  color: #1a1a1e;
}
.mention-chip.mention-role {
  cursor: default;
  background: color-mix(in srgb, var(--role-color, #99aab5) 28%, transparent);
  color: var(--role-color, #dee0fc);
}
.msg-cluster.self .mention-chip {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.msg-cluster.self .mention-chip.mention-self,
.msg-cluster.self .mention-chip.mention-special {
  background: var(--away);
  color: #1a1a1e;
}
.msg-cluster.self .mention-chip.mention-role {
  background: color-mix(in srgb, var(--role-color, #99aab5) 35%, transparent);
  color: #fff;
}

/* Others always render avatar-left, body-left, regardless of settings. */
.msg-cluster.other { flex-direction: row; }

/* Self direction is controlled entirely by the parent's modifier class
   (#chat-messages.self-right / a future .self-left) so the eventual
   settings toggle only ever has to flip one class, not rewrite layout. */
#chat-messages.self-right .msg-cluster.self,
#channel-messages.self-right .msg-cluster.self { flex-direction: row-reverse; }
#chat-messages:not(.self-right) .msg-cluster.self,
#channel-messages:not(.self-right) .msg-cluster.self { flex-direction: row; }

.cluster-avatar {
  position: relative;
  overflow: hidden;
  width: calc(40px * var(--message-scale)); height: calc(40px * var(--message-scale));
  border-radius: 50%; flex: 0 0 auto;
  background: #3b3e4a; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(15px * var(--message-scale)); font-weight: 700; color: #cfd1e0; text-transform: uppercase;
}

.cluster-body { display: flex; flex-direction: column; min-width: 0; max-width: 70%; }
#chat-messages.self-right .msg-cluster.self .cluster-body,
#channel-messages.self-right .msg-cluster.self .cluster-body { align-items: flex-end; }
#chat-messages:not(.self-right) .msg-cluster.self .cluster-body,
#channel-messages:not(.self-right) .msg-cluster.self .cluster-body { align-items: flex-start; }
.msg-cluster.other .cluster-body { align-items: flex-start; }

.cluster-header { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; font-size: calc(13px * var(--message-scale)); }
.cluster-header .cluster-name { font-weight: 700; color: var(--text); }
.name-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-right: 6px;
  vertical-align: middle;
}
.has-name-color-dot { display: inline-flex; align-items: center; }
.cluster-header .cluster-time { color: var(--text-dim); font-size: calc(12px * var(--message-scale)); }

/* Bubble is the visual layer; the settings toggle to disable bubbles
   should override just this rule (flat background, square corners, no
   padding) without touching .msg-cluster/.cluster-body/.bubble-line at
   all — same markup either way. */
.cluster-bubble {
  display: flex; flex-direction: column; gap: 4px;
  border-radius: 16px; width: fit-content; max-width: 100%;
  padding: calc(10px * var(--message-scale)) calc(14px * var(--message-scale));
}
.msg-cluster.other .cluster-bubble { background: var(--panel-alt); }
.msg-cluster.self .cluster-bubble { background: var(--accent); }

.bubble-line { font-size: calc(15px * var(--message-scale)); line-height: 1.5; word-wrap: break-word; white-space: pre-wrap; }
.bubble-line.emoji-only { font-size: calc(48px * var(--message-scale)); line-height: 1.15; }
.msg-cluster.self .bubble-line { color: #fff; }

/* Text alignment inside the bubble follows whichever side that sender's
   messages render on — tied to the same #chat-messages modifier class
   as the layout direction above, so a future side-swap setting flips
   both at once instead of needing a second toggle. */
.msg-cluster.other .bubble-line { text-align: left; }
#chat-messages.self-right .msg-cluster.self .bubble-line,
#channel-messages.self-right .msg-cluster.self .bubble-line { text-align: right; }
#chat-messages:not(.self-right) .msg-cluster.self .bubble-line,
#channel-messages:not(.self-right) .msg-cluster.self .bubble-line { text-align: left; }

.edited-tag {
  font-size: 11px; font-weight: 400; font-style: italic;
  color: var(--text-dim); opacity: 0.8; margin-left: 2px;
  user-select: none; pointer-events: none;
}
.bubble-line .edited-tag {
  font-size: calc(11px * var(--message-scale));
  margin-left: 8px;
}
.msg-cluster.self .bubble-line .edited-tag { color: rgba(255,255,255,0.42); opacity: 1; }

html.no-chat-bubbles .msg-cluster.self .cluster-bubble,
html.no-chat-bubbles .msg-cluster.other .cluster-bubble {
  background: transparent;
  border-radius: 0;
  padding: 0;
}
html.no-chat-bubbles .msg-cluster.self .bubble-line { color: var(--text); }
html.no-chat-bubbles .msg-cluster.self .bubble-line .edited-tag { color: var(--text-dim); opacity: 0.8; }
html.no-chat-bubbles .msg-cluster.self .mention-chip {
  background: rgba(88, 101, 242, 0.35);
  color: #dee0fc;
}
html.no-chat-bubbles .msg-cluster.self .mention-chip.mention-self,
html.no-chat-bubbles .msg-cluster.self .mention-chip.mention-special {
  background: var(--away);
  color: #1a1a1e;
}
html.no-chat-bubbles .msg-cluster.self .bubble-line a.msg-link { color: #69c0ff; text-decoration: none; }
html.no-chat-bubbles .msg-cluster.self .reaction-pill {
  background: var(--rail);
  color: var(--text);
  border-color: var(--border);
}
html.no-chat-bubbles .msg-cluster.self .reaction-pill.mine {
  border-color: var(--accent);
  background: var(--panel);
}

/* System divider — full-width line with its text centered on top,
   Discord's date-divider trick (two flex:1 lines flanking the text,
   rather than a line running underneath it). Any message with
   sender_id === null renders as one of these instead of a normal
   cluster/bubble — currently just "leave party" notices, but the
   backend's NULL-sender convention is deliberately generic, so this is
   the one rendering path for every future system message too. */
.system-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0 14px;
  color: var(--text-dim); font-size: calc(12px * var(--message-scale));
}
.system-divider::before, .system-divider::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--border);
}

.deletion-card, .deletion-tombstone {
  width: fit-content;
  max-width: 100%;
  padding: calc(10px * var(--message-scale)) calc(14px * var(--message-scale));
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: calc(13px * var(--message-scale));
}
.deletion-card { cursor: pointer; }
.deletion-card.expanded { cursor: default; }
.deletion-card-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.deletion-card-caret {
  font-size: 11px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.deletion-card.expanded .deletion-card-caret { transform: rotate(180deg); }
.deletion-card-detail { display: none; flex-direction: column; gap: 10px; margin-top: 10px; }
.deletion-card.expanded .deletion-card-detail { display: flex; }
.deletion-card-original { color: var(--text); }
.deletion-card-original .bubble-line { color: var(--text); text-align: left; }
.deletion-card-original .edited-tag { color: var(--text-dim); opacity: 0.8; }
.deletion-card-when { font-size: calc(12px * var(--message-scale)); color: var(--text-dim); }
.deletion-card-detail .pill-btn { align-self: flex-start; }
.deletion-tombstone { cursor: default; }

.permaban-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 12px;
  color: var(--text-dim);
  font-size: calc(12px * var(--message-scale));
  font-style: italic;
  text-align: center;
  user-select: none;
}

.edit-cluster .cluster-body { max-width: min(100%, 560px); width: 100%; }
.edit-composer {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  position: relative;
}
.edit-composer.attach-drop { outline: 1px dashed var(--accent); outline-offset: 2px; }
.edit-composer-top { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.edit-composer-top .icon-btn { width: 28px; height: 28px; font-size: 18px; }
.edit-composer .box {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px;
}
.edit-composer textarea {
  flex: 1; width: 100%; min-width: 0; box-sizing: border-box;
  background: transparent; border: none; color: var(--text); font-size: 14px;
  font-family: inherit; padding: 8px 6px; resize: none; overflow-y: auto;
  line-height: 1.4; max-height: calc(1.4em * 5);
}
.edit-composer textarea:focus { outline: none; }
.edit-composer .composer-icon-btn {
  background: transparent; color: var(--text-dim); font-size: 18px; font-weight: 600;
  width: 36px; height: 36px; padding: 0; flex: 0 0 auto; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; align-self: flex-end;
}
.edit-composer .composer-icon-btn:hover { color: var(--text); background: var(--rail); }
.edit-composer-footer { display: flex; justify-content: flex-end; margin-top: 8px; }
.edit-composer button.attach-chip-remove {
  height: 28px; width: 28px; padding: 0; border-radius: 6px;
  background: transparent; color: var(--text-dim); font-size: 18px; font-weight: 600;
}
.edit-composer button.attach-chip-remove:hover { background: var(--panel); color: var(--text); }

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--rail);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.reaction-pill:hover { border-color: var(--accent); }
.reaction-pill.mine { border-color: var(--accent); background: var(--panel); }
.msg-cluster.self .reaction-pill { background: rgba(0, 0, 0, 0.18); color: #fff; border-color: rgba(255,255,255,0.25); }
.msg-cluster.self .reaction-pill.mine { border-color: #fff; }

.dm-item .who { font-size: 14px; font-weight: 600; line-height: 1.2; }
.dm-item.has-unread .who { color: var(--text); font-weight: 700; }
.dm-item .dm-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.dm-item:hover .dm-close { opacity: 1; }
.dm-item:hover .dm-item-text { padding-right: 18px; }
.dm-item .dm-close:hover { background: var(--rail); color: var(--text); }

.dm-unread-badge {
  display: none; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; align-items: center; justify-content: center; padding: 0 4px;
}

/* Text column for a DM/party row — name plus the subtitle line below it
   (status placeholder for a person, member count for a party). Needs
   its own flex column since .who and .dm-subtitle previously sat
   directly in the row; min-width: 0 is required for the ellipsis rules
   below to actually take effect inside a flex child. */
.dm-item-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.dm-item-text .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-subtitle { font-size: 12px; line-height: 1.2; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Party creation modal ---- */
/* A sub-menu (pop-up, not a main screen) — border uses --accent-submenu
   to match the context menu's treatment, same reasoning as there. */
#party-modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#party-modal {
  width: 420px; max-height: 70vh;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#party-modal .view-header { flex: 0 0 auto; }
#party-modal .view-body { flex: 1 1 auto; }
#party-modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
#party-modal-footer span { font-size: 12px; color: var(--text-dim); }
#party-modal-friend-rows .friend-row input[type=checkbox] { width: 16px; height: 16px; }
#party-modal-friend-rows .friend-row input[type=checkbox]:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Server creation modal ---- */
/* Same overlay/box treatment as the party modal (border uses
   --accent-submenu, same "you're in a pop-up" cue) — kept as its own
   block with its own ids rather than sharing selectors, matching how
   the party modal was already built as a standalone block. */
#server-modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#server-modal {
  width: 360px;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#server-modal .view-header { flex: 0 0 auto; }
#server-modal .view-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.server-modal-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.server-name-input {
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; color: var(--text); font-size: 13px;
}
.server-name-input:focus { outline: none; border-color: var(--accent-submenu); }
#server-modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

/* ---- Shared toggle switch + ghost button ---- */
/* Generic, not category-specific — the upcoming channel-creation
   modal's Private Channel toggle reuses these same three classes
   rather than duplicating the CSS. Checked state uses --accent-submenu
   (not --accent) since every toggle so far only exists inside a
   pop-up modal, matching that family's accent color. */
.toggle-switch { position: relative; display: inline-block; cursor: pointer; line-height: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  display: inline-block; width: 36px; height: 20px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px;
  position: relative; transition: background 0.15s ease, border-color 0.15s ease;
}
.toggle-thumb {
  position: absolute; top: 1px; left: 1px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-dim);
  transition: transform 0.15s ease, background 0.15s ease;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent-submenu); border-color: var(--accent-submenu); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: #fff; }

/* Cancel-style secondary button — every earlier modal only had a
   primary action + the X, so this is the first Cancel button in the
   app. Kept generic (not category-modal-specific) for the same reuse
   reason as the toggle above. */
.ghost-btn { background: transparent; border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 6px; }
.ghost-btn:hover { background: var(--panel-alt); }
.ghost-btn.is-active { background: var(--panel-alt); border-color: var(--accent); color: var(--accent); }
#feed-filter-btn { flex: 0 0 auto; }

/* ---- Category creation modal ---- */
/* Same overlay/box treatment as the server modal. Reused
   .server-modal-label/.server-name-input classes rather than adding
   category-specific duplicates of the exact same styling. */
#category-modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#category-modal {
  width: 420px;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#category-modal .view-header { flex: 0 0 auto; }
#category-modal .view-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.private-toggle-row { margin-top: 18px; }
.private-toggle-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; }
.private-toggle-desc { margin-top: 8px; font-size: 12px; color: var(--text-dim); line-height: 1.5; }
#category-modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

/* ---- Delete category/channel confirm ---- */
/* Compact centered card, same overlay family as create category/channel.
   Not a nested context menu — that swap was too easy to miss. */
#confirm-delete-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#confirm-delete-modal {
  width: 400px;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#confirm-delete-modal .view-header {
  height: auto; padding: 16px 16px 0; border-bottom: none;
}
#confirm-delete-modal .view-body { padding: 12px 16px 16px; }
#confirm-delete-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
#confirm-delete-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 16px 16px;
}
#confirm-delete-action { font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 6px; }

#moderation-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#moderation-modal {
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#moderation-modal .view-header { height: auto; padding: 16px 16px 0; border-bottom: none; }
#moderation-modal .view-body { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.moderation-copy { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.moderation-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.moderation-chip {
  background: var(--panel-alt); color: var(--text); border-radius: 999px;
  font-size: 12px; font-weight: 600; padding: 6px 10px;
}
.moderation-chip.is-on { background: var(--accent); color: #fff; }
.moderation-reason {
  width: 100%; min-height: 72px; resize: vertical;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; font: inherit;
}
#moderation-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 16px 16px; flex-wrap: wrap;
}
#moderation-error { margin: 0 auto 0 0; flex: 1 1 100%; }
#moderation-clear { margin-right: auto; }

#bulk-kick-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#bulk-kick-modal {
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#bulk-kick-modal .view-header { height: auto; padding: 16px 16px 0; border-bottom: none; }
#bulk-kick-modal .view-body { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
#bulk-kick-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 16px 16px; flex-wrap: wrap;
}
#bulk-kick-error { margin: 0 auto 0 0; flex: 1 1 100%; }

/* ---- Announcement composer (inline, not a modal) ---- */
/* Two states living in the SAME .announce-composer-bar slot, toggled by
   JS (showAnnounceComposerEditing/hideAnnounceComposerEditing) — a
   previous pass here used a popup modal, which was a deviation from
   this channel type's whole point ("composer at the top", decided back
   when Announcements was first designed) and got corrected once it was
   actually compared side-by-side against the reference design. */
.announce-composer-default { display: flex; align-items: center; gap: 10px; }
.announce-composer-search { flex: 1 1 auto; }
/* The search box is a non-functional placeholder for now — no backend
   search route exists yet (posts aren't even persisted across a reload
   yet), so it's disabled rather than pretending to work. */
.announce-composer-search:disabled { cursor: default; opacity: 0.7; }

.announce-composer-editing { display: flex; flex-direction: column; position: relative; overflow: visible; }
.announce-composer-editing-header { display: flex; align-items: center; gap: 8px; }
.announce-composer-title-input {
  flex: 1 1 auto; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 16px; font-weight: 700;
}
.announce-composer-title-input::placeholder { color: var(--text-dim); font-weight: 700; }
.announce-composer-editing-main {
  display: flex; align-items: flex-start; gap: 12px;
}
.announce-composer-editing-fields {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
/* Border lives on the wrapper, not the textarea: scrollHeight ignores
   borders, so a box on the textarea itself makes auto-grow stop a
   line early. :focus-within lights it when the body is being typed. */
.announce-composer-editing-body {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  position: relative;
}
.announce-composer-editing-body:focus-within { border-color: var(--accent-submenu); }
.announce-composer-editing-body .composer-field {
  display: block;
  overflow: hidden;
  align-self: auto;
}
.announce-composer-editing-body .composer-highlight {
  padding: 0;
  font-size: 14px;
  line-height: 1.4;
}
.announce-composer-editing-body .composer-field textarea {
  color: transparent;
  caret-color: var(--text);
}
/* Shared by Announcements and Forums. Same capped auto-grow as chat:
   CSS owns the 3-to-5-line ceiling, JS only measures. resize:none so
   the drag handle cannot stretch the page. */
.announce-composer-body-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14px; font-family: inherit;
  padding: 0; box-sizing: content-box; resize: none; overflow-y: auto;
  line-height: 1.4; min-height: calc(1.4em * 3); max-height: calc(1.4em * 5);
}
.announce-composer-body-input::placeholder { color: var(--text-dim); }
.announce-composer-media-strip {
  display: flex; align-items: flex-start; justify-content: flex-end; gap: 6px;
  flex: 0 0 auto; padding-top: 2px; position: relative;
}
.announce-composer-image-btn {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px;
  background: var(--panel); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; cursor: pointer; padding: 0; border: none;
}
.announce-composer-image-thumb {
  transition: margin-right 0.16s ease;
}
.announce-composer-image-btn:hover { color: var(--text); }
.announce-composer-image-btn.has-file { color: var(--text); }
.announce-composer-image-btn img,
.announce-composer-image-btn video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.announce-composer-image-clear {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border: none; border-radius: 50%; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 14px; line-height: 18px;
}
/* Rest: one stacked pile. Hover slides thumbs aside and shows add. */
.announce-composer-media-strip.has-files:not(:hover):not(:focus-within) {
  gap: 0;
}
.announce-composer-media-strip.has-files:not(:hover):not(:focus-within) .announce-composer-image-thumb:not(:last-of-type) {
  margin-right: -56px;
  pointer-events: none;
}
.announce-composer-media-strip.has-files:not(:hover):not(:focus-within) .announce-composer-image-add,
.announce-composer-media-strip.has-files:not(:hover):not(:focus-within) .announce-composer-image-clear,
.announce-composer-media-strip.is-full .announce-composer-image-add {
  display: none;
}
.announce-post .post-media { margin-top: 10px; }
.post-media img, .post-media video {
  max-width: 100%; max-height: 360px; border-radius: 8px; display: block;
}
.post-media-multi {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.post-media-multi img, .post-media-multi video {
  width: 100%; max-height: 220px; object-fit: cover;
}
.announce-composer-editing-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.announce-composer-editing-footer .composer-icon-btn {
  background: transparent; color: var(--text-dim); font-size: 18px;
  width: 36px; height: 36px; padding: 0; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.announce-composer-editing-footer .composer-icon-btn:hover {
  color: var(--text); background: var(--rail);
}
.announce-composer-tools {
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
.announce-format-btn { font-size: 15px; font-weight: 700; }
.announce-format-btn.is-italic { font-style: italic; font-weight: 600; }
.announce-format-btn.is-underline { text-decoration: underline; font-weight: 600; }
.announce-notify-all {
  display: flex; align-items: center; gap: 8px;
  margin-left: 8px; color: var(--text-dim); font-size: 13px; white-space: nowrap;
}
.announce-comment-edit { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 4px; width: 100%; }
.announce-comment-edit textarea.announce-comment-input {
  width: 100%; resize: none; border: 1px solid var(--border); background: var(--panel);
  white-space: pre-wrap;
}
#server-overview {
  flex: 1; min-height: 0; display: none; flex-direction: column;
  padding: 20px 24px; overflow: auto;
}
.server-overview-title { margin: 0; font-size: 22px; }
.server-overview-sub { margin: 6px 0 16px; color: var(--text-dim); font-size: 14px; }
.server-overview-empty { color: var(--text-dim); padding: 12px 0; }
.server-overview-card {
  display: block; width: 100%; text-align: left;
  background: var(--panel, var(--rail)); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
}
.server-overview-card:hover { border-color: var(--accent, var(--text-dim)); }
.server-overview-channel { color: var(--text-dim); font-size: 12px; }
.server-overview-card-title { font-size: 16px; margin-top: 4px; }
.server-overview-card-meta { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.announce-public-link {
  background: none; border: 0; padding: 0; margin: 4px 0 0;
  color: var(--text-dim); font-size: 13px; cursor: pointer;
}
.announce-public-link:hover { color: var(--text); }
.channel-follow-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.channel-follow-add { display: flex; gap: 8px; margin-top: 12px; }
.channel-follow-add select { flex: 1; min-width: 0; }
#lists-view {
  flex: 1; min-height: 0; display: none; flex-direction: column;
}
#lists-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px 0 24px; }
.list-block {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 16px 8px;
  overflow: hidden;
}
.list-block:hover { border-color: var(--text-dim); }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; min-height: 44px;
}
.list-row[draggable="true"] { cursor: grab; }
.list-row[draggable="true"] .list-icon-btn,
.list-row[draggable="true"] .list-check { cursor: pointer; }
.list-add {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 16px 8px;
  padding: 4px 12px 8px;
}
.list-check {
  width: 18px; height: 18px; flex: 0 0 auto; box-sizing: border-box;
  border: 2px solid var(--text-dim); border-radius: 50%; background: transparent;
  color: #1e1f22; font-size: 12px; line-height: 1; padding: 0; cursor: pointer;
}
.list-check.is-on { background: #e3b341; border-color: #e3b341; }
.list-row-title { flex: 1; min-width: 0; font-size: 15px; }
.list-row.is-done .list-row-title { color: var(--text-dim); }
.list-row-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.list-icon-btn {
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  min-width: 28px; height: 28px; border-radius: 4px; padding: 0 6px;
}
.list-icon-btn:hover { color: var(--text); background: var(--panel); }
.list-icon-btn.has-note { color: var(--text); }
.list-add-row { display: flex; align-items: center; gap: 8px; }
#lists-title-input, .list-edit-input, .list-thread-input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text);
  font: inherit; font-size: 15px; padding: 8px 0;
}
#lists-title-input:focus, .list-edit-input:focus, .list-thread-input:focus { outline: none; }
.list-note-field[hidden] { display: none; }
.list-note-field {
  display: block; width: 100%; box-sizing: border-box;
  background: var(--rail); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 14px; line-height: 1.45;
  padding: 10px 12px; margin-top: 4px; resize: none;
  white-space: pre-wrap; overflow-wrap: anywhere;
  min-height: calc(1.45em * 5 + 20px); max-height: 220px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.list-note-field::-webkit-scrollbar { width: 8px; height: 8px; }
.list-note-field::-webkit-scrollbar-track,
.list-note-field::-webkit-scrollbar-corner { background: transparent; }
.list-note-field::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.list-note-field:focus { outline: none; border-color: var(--text-dim); }
.lists-composer-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.lists-completed-toggle {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text-dim);
  font-size: 13px; font-weight: 700; padding: 14px 16px; cursor: pointer;
}
.lists-completed-toggle:hover { color: var(--text); }
.list-thread { padding: 4px 16px 12px 44px; }
.list-thread-msg { margin: 8px 0; }
.list-thread-name { font-size: 13px; font-weight: 700; margin-right: 6px; }
.list-thread-text { font-size: 14px; white-space: pre-wrap; }
.list-thread-compose { display: flex; gap: 8px; margin-top: 8px; }
#list-note-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#list-note-overlay[hidden] { display: none; }
#list-note-card {
  width: 520px; max-width: calc(100% - 32px); max-height: 70vh;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#list-note-card .view-header { font-size: 18px; }
#list-note-card .view-body {
  padding: 14px 16px 16px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#list-note-card .view-body::-webkit-scrollbar { width: 8px; }
#list-note-card .view-body::-webkit-scrollbar-track { background: transparent; }
#list-note-card .view-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.list-note-task {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.list-note-task-title { font-size: 15px; font-weight: 600; color: var(--text); min-width: 0; }
.list-note-task-title.is-done { color: var(--text-dim); }
.list-note-by { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.list-note-face { width: 28px; height: 28px; font-size: 12px; cursor: pointer; }
.list-note-by-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.list-note-name {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: left;
}
.list-note-name:hover { text-decoration: underline; }
.list-note-time { color: var(--text-dim); font-size: 12px; font-weight: 500; }
.list-note-count {
  margin-left: auto; color: var(--text-dim); font-size: 12px; font-weight: 700;
}
.list-note-message {
  display: flex; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text);
}
.list-note-message:hover { border-color: var(--text-dim); }
.list-note-message-main { min-width: 0; flex: 1; }
.list-note-message-head { display: flex; align-items: baseline; gap: 8px; }
.list-note-message-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-top: 4px; }
.list-note-editor { display: flex; flex-direction: column; }

#calendar-view {
  flex: 1; min-height: 0; display: none; flex-direction: column;
}
#doc-channel-view {
  flex: 1; min-height: 0; display: none; flex-direction: column; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#doc-channel-view::-webkit-scrollbar { width: 8px; }
#doc-channel-view::-webkit-scrollbar-track { background: transparent; }
#doc-channel-view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.doc-channel-grid {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px;
  padding: 16px;
}
.doc-channel-empty { color: var(--text-dim); padding: 8px 0; }
.doc-channel-card {
  width: 280px; max-width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 0; display: flex; flex-direction: column; gap: 0;
  overflow: hidden;
}
.doc-channel-card:hover { border-color: var(--text-dim); }
.doc-channel-card-copy { background: var(--panel-alt); padding: 12px 12px 14px; }
.doc-channel-card-title {
  font-size: 15px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-channel-card-preview {
  color: var(--text-dim); font-size: 13px; line-height: 1.4; margin-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-channel-card-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 0;
  background: var(--panel); padding: 10px 12px;
}
.doc-channel-card .avatar-dot { width: 28px; height: 28px; font-size: 12px; }
.doc-channel-card-name { font-size: 13px; font-weight: 700; }
.doc-channel-card-when { font-size: 12px; color: var(--text-dim); }
#doc-channel-grid[hidden],
#doc-channel-page[hidden] { display: none; }
.doc-channel-page { padding: 24px 48px 48px 64px; max-width: 860px; }
.doc-channel-author { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.doc-channel-author-face {
  width: 40px; height: 40px; font-size: 16px; padding: 0; cursor: pointer;
}
.doc-channel-author-name {
  background: transparent; border: 0; padding: 0; font-size: 16px; font-weight: 700;
  color: var(--text); cursor: pointer;
}
.doc-channel-author-role { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.doc-channel-title-input, .doc-channel-title-read {
  display: block; width: 100%; margin: 0 0 16px; background: transparent; border: 0;
  color: var(--text); font-size: 28px; font-weight: 700; line-height: 1.25;
}
.doc-channel-title-input { outline: none; }
.doc-channel-title-input::placeholder { color: var(--text-dim); font-weight: 600; }
.doc-channel-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.doc-channel-toolbar button {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 4px 8px; font-size: 13px;
}
.doc-channel-body { width: 100%; min-height: 16em; }
.doc-channel-body-read { white-space: pre-wrap; font-size: 16px; line-height: 1.65; color: var(--text); }
.doc-channel-title-input[hidden],
.doc-channel-title-read[hidden],
.doc-channel-toolbar[hidden],
.doc-channel-body-read[hidden],
.doc-channel-author[hidden] { display: none; }
#media-channel-view {
  flex: 1; min-height: 0; display: none; flex-direction: column; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#media-channel-view::-webkit-scrollbar { width: 8px; }
#media-channel-view::-webkit-scrollbar-track { background: transparent; }
#media-channel-view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.media-channel-grid { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
#media-channel-grid[hidden],
#media-channel-page[hidden],
#media-channel-form[hidden],
#media-channel-form-file-row[hidden],
#media-channel-form-link-row[hidden],
#media-channel-read-body[hidden] { display: none; }
.media-channel-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.media-channel-empty { color: var(--text-dim); padding: 8px; }
.media-channel-card {
  display: flex; flex-direction: column; gap: 0; width: 100%;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); text-align: left; cursor: pointer; overflow: hidden;
}
.media-channel-card:hover { border-color: var(--text-dim); }
.media-channel-frame {
  position: relative; display: block; width: 100%; overflow: hidden; border-radius: 0; background: var(--panel);
}
.media-channel-frame img, .media-channel-frame video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-channel-linkface {
  display: flex; align-items: flex-end; width: 100%; height: 100%; padding: 10px;
  color: var(--text-dim); font-size: 13px; word-break: break-all;
}
.media-channel-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 36px; border-radius: 50%; background: rgba(0, 0, 0, 0.55);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.media-channel-copy { display: block; background: var(--panel-alt); padding: 10px 12px 8px; }
.media-channel-title { display: block; font-size: 14px; font-weight: 700; }
.media-channel-foot {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); padding: 8px 12px 10px;
}
.media-channel-card .avatar-dot { width: 22px; height: 22px; font-size: 10px; }
.media-channel-name { font-size: 13px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-channel-comments {
  margin-left: auto; color: var(--text-dim); font-size: 12px; flex: 0 0 auto;
}
.media-channel-comments::before { content: "\1F4AC"; margin-right: 4px; }
.media-channel-page {
  align-self: center; width: fit-content; max-width: min(920px, calc(100% - 96px));
  margin: 24px auto 48px; padding: 0; box-sizing: border-box;
}
.media-channel-stage { display: flex; justify-content: center; }
.media-channel-stage img, .media-channel-stage video {
  max-width: 100%; max-height: 70vh; width: auto; height: auto;
  border-radius: 8px; display: block; object-fit: contain;
}
.media-channel-stage iframe {
  width: min(920px, calc(100vw - 160px)); aspect-ratio: 16 / 9;
  border: 0; border-radius: 8px; display: block;
}
.media-channel-read-title { margin: 16px 0 10px; font-size: 24px; max-width: 100%; overflow-wrap: anywhere; }
.media-channel-author { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; max-width: 100%; }
.media-channel-author-face { width: 36px; height: 36px; padding: 0; cursor: pointer; }
.media-channel-author-name {
  background: transparent; border: 0; padding: 0; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
}
.media-channel-author-role { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.media-channel-read-body { white-space: pre-wrap; font-size: 15px; line-height: 1.55; max-width: 100%; overflow-wrap: anywhere; }
#media-channel-form {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.media-channel-form-card {
  width: min(480px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 18px 14px; display: flex; flex-direction: column;
}
.media-channel-form-heading { font-size: 20px; font-weight: 800; }
.media-channel-form-section {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 0;
}
.media-channel-form-section:not([hidden]) ~ .media-channel-form-section:not([hidden]) {
  border-top: 1px solid var(--border);
}
#media-channel-form-source[hidden] { display: none; }
.media-channel-form-section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.media-channel-form-seg { align-self: flex-start; width: auto; min-width: 280px; }
#media-channel-form .list-note-field { margin-top: 0; }
.media-channel-form-preview:empty { display: none; }
.media-channel-form-preview img, .media-channel-form-preview video {
  width: 100%; max-height: 220px; object-fit: contain; border-radius: 8px; display: block; background: #000;
}
.media-channel-form-preview video { min-height: 140px; }
.media-channel-form-row { display: flex; }
.media-channel-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
#schedule-view {
  flex: 1; min-height: 0; display: none; flex-direction: column;
}
#schedule-card[hidden],
#calendar-channel-row[hidden],
#calendar-slot-note[hidden] { display: none; }
.schedule-head {
  display: grid; grid-template-columns: 76px 28px 1fr 1fr 1fr 28px; align-items: center;
  border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.schedule-zone {
  padding: 10px 8px; font-size: 12px; font-weight: 700; color: var(--text-dim); text-align: center;
}
.schedule-head-days, .schedule-days { display: contents; }
.schedule-day-head {
  text-align: center; padding: 8px 4px 10px;
  background-color: var(--panel);
  background-image: linear-gradient(to right, var(--border) 0 1px, transparent 1px);
}
.schedule-day-head:last-child { box-shadow: inset -1px 0 0 var(--border); }
.schedule-day-head.is-alt { background-color: var(--panel-alt); }
.schedule-day-title { font-size: 15px; font-weight: 700; }
.schedule-day-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.schedule-scroll {
  flex: 1; min-height: 0; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.schedule-scroll::-webkit-scrollbar { width: 8px; }
.schedule-scroll::-webkit-scrollbar-track { background: transparent; }
.schedule-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.schedule-sheet {
  display: grid;
  grid-template-columns: 76px 28px 1fr 1fr 1fr 28px;
  grid-template-rows: repeat(24, 56px);
}
.schedule-hour-label {
  align-self: start; justify-self: end; transform: translateY(-50%);
  margin-right: 8px; font-size: 11px; color: var(--text-dim); line-height: 1;
  pointer-events: none;
}
.schedule-day {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--border);
}
.schedule-day.is-end { border-right: 1px solid var(--border); }
.schedule-day.is-alt { background: var(--panel-alt); }
.schedule-slot { flex: 1 1 0; min-height: 0; border-top: 1px solid var(--border); }
.schedule-now {
  position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px;
  background: #4c8dff; z-index: 1; pointer-events: none;
}
.schedule-block { position: absolute; width: 0; pointer-events: none; }
.schedule-line {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px; margin-left: -2px;
  border-radius: 4px; z-index: 1; pointer-events: auto;
}
.schedule-block.is-ghost {
  width: 4px; margin-left: -2px; background: #3ba55d; border-radius: 4px; z-index: 3;
}
.schedule-face {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  width: 28px; height: 28px; padding: 0; z-index: 6; pointer-events: auto; overflow: hidden;
}
.schedule-cap {
  position: absolute; left: 0; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; background: #fff; z-index: 2;
}
.schedule-cap-top { top: -4px; }
.schedule-cap-foot { bottom: -4px; }
.schedule-cap-foot.is-handle {
  pointer-events: auto; cursor: ns-resize; z-index: 8;
  width: 12px; height: 12px; margin-left: -6px; bottom: -6px;
}
.schedule-own {
  position: absolute; left: -16px; top: -16px; width: 54px; height: 36px;
  z-index: 6; pointer-events: auto;
}
.schedule-own .schedule-face { left: 2px; top: 2px; transform: none; }
.schedule-remove {
  display: none; position: absolute; right: 0; top: 4px; pointer-events: auto; z-index: 7;
  width: 18px; height: 18px; border-radius: 50%; background: var(--panel);
  color: var(--text); border: 1px solid var(--border); font-size: 12px; line-height: 1;
}
.schedule-own:hover .schedule-remove { display: inline-flex; align-items: center; justify-content: center; }
.schedule-card {
  position: fixed; z-index: 30; width: 240px; padding: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; gap: 8px;
}
.schedule-card-title { font-size: 16px; font-weight: 800; }
.schedule-card-count { font-size: 12px; color: var(--text-dim); }
.schedule-card-person {
  display: flex; align-items: center; gap: 8px; background: transparent;
  text-align: left; font-size: 13px; font-weight: 700; padding: 0;
}
.schedule-card-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.schedule-card-create { width: 100%; }
.calendar-slot-note { font-size: 13px; color: var(--text-dim); margin: 4px 0 8px; }
.calendar-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; flex: 0 0 auto;
}
.calendar-month-nav { display: flex; align-items: center; gap: 4px; font-size: 18px; font-weight: 700; }
.calendar-toolbar-actions { display: flex; align-items: center; gap: 6px; }
.calendar-zone-btn, .calendar-view-btn, .calendar-add-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 12px; font-weight: 700; border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
.calendar-zone-btn.is-on { color: #e3b341; border-color: #e3b341; }
.calendar-view-btn.is-on { color: var(--text); background: var(--panel-alt); }
.calendar-add-btn { color: var(--text); font-size: 16px; line-height: 1; padding: 4px 10px; }
.calendar-zone-btn:hover, .calendar-view-btn:hover, .calendar-add-btn:hover { color: var(--text); }
.calendar-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(72px, 1fr));
  border-top: 1px solid var(--border);
  overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.calendar-grid[hidden], .calendar-upcoming[hidden] { display: none; }
.calendar-grid::-webkit-scrollbar, .calendar-upcoming::-webkit-scrollbar { width: 8px; height: 8px; }
.calendar-grid::-webkit-scrollbar-track, .calendar-upcoming::-webkit-scrollbar-track { background: transparent; }
.calendar-grid::-webkit-scrollbar-thumb, .calendar-upcoming::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.calendar-dow {
  text-align: center; font-size: 12px; font-weight: 600; color: var(--text-dim);
  padding: 8px 4px; border-bottom: 1px solid var(--border);
}
.calendar-day {
  position: relative; min-width: 0; min-height: 0; overflow: auto;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.calendar-day::-webkit-scrollbar { width: 6px; }
.calendar-day::-webkit-scrollbar-track { background: transparent; }
.calendar-day::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.calendar-day:nth-child(7n + 8) { border-left: 0; }
.calendar-day.is-outside { background: rgba(0, 0, 0, 0.18); }
.calendar-day.is-outside .calendar-day-num { color: var(--text-dim); }
.calendar-day.is-today .calendar-day-num { color: var(--accent); }
.calendar-day:hover { background: var(--panel-alt); }
.calendar-day-top { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.calendar-day-num { font-size: 12px; font-weight: 600; }
.calendar-day-add {
  opacity: 0; background: transparent; border: 0; color: var(--text-dim);
  font-size: 16px; line-height: 1; width: 22px; height: 22px; cursor: pointer; border-radius: 4px;
}
.calendar-day:hover .calendar-day-add { opacity: 1; }
.calendar-day-add:hover { color: var(--text); background: var(--panel); }
.calendar-chip {
  display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0;
  background: transparent; border: 0; color: var(--text); text-align: left;
  font-size: 12px; padding: 1px 0; cursor: pointer;
}
.calendar-chip:hover { color: #fff; }
.calendar-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.calendar-chip-time { color: var(--text-dim); flex: 0 0 auto; }
.calendar-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-chip.is-cancelled .calendar-chip-name,
.calendar-chip.is-cancelled .calendar-chip-time { text-decoration: line-through; color: var(--text-dim); }
.calendar-upcoming {
  flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 24px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.calendar-upcoming-empty { color: var(--text-dim); padding: 16px 0; }
.calendar-upcoming-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.calendar-upcoming-row:hover { border-color: var(--text-dim); }
.calendar-upcoming-name { font-size: 15px; font-weight: 600; }
.calendar-upcoming-when { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
#calendar-event-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#calendar-event-overlay[hidden] { display: none; }
#calendar-info-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#calendar-info-overlay[hidden] { display: none; }
#calendar-info-card {
  width: 340px; max-width: calc(100% - 32px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); overflow: hidden;
}
.calendar-info-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px 8px 14px;
}
.calendar-info-head .calendar-dot { width: 10px; height: 10px; }
#calendar-info-title {
  flex: 1; min-width: 0; font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#calendar-info-title.is-cancelled { text-decoration: line-through; color: var(--text-dim); }
.calendar-info-body { padding: 6px 16px 12px; }
.calendar-info-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; }
.calendar-info-icon { color: var(--text-dim); width: 18px; flex: 0 0 auto; display: flex; justify-content: center; margin-top: 2px; }
.calendar-info-time, .calendar-info-alt { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.calendar-info-note {
  margin: 10px 0 0 28px; color: var(--text); font-size: 13px; white-space: pre-wrap;
  max-height: 7.5em; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.calendar-info-note::-webkit-scrollbar { width: 8px; }
.calendar-info-note::-webkit-scrollbar-track { background: transparent; }
.calendar-info-note::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.calendar-info-going { min-width: 0; }
.calendar-info-faces { display: flex; gap: 4px; margin-top: 6px; }
.calendar-info-face {
  width: 22px; height: 22px; border-radius: 50%; overflow: hidden; padding: 0;
  border: 0; background: var(--panel-alt); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.calendar-info-author { display: flex; align-items: center; gap: 0.35em; min-height: 22px; }
.calendar-info-name {
  background: transparent; border: 0; padding: 0; color: var(--accent); font-weight: 700;
  cursor: pointer; font-size: inherit;
}
.calendar-info-foot {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding: 10px 12px;
}
.calendar-info-foot:empty { display: none; }
.channel-row.event-rail-row,
html.ui-density-compact .channel-row.event-rail-row,
html.ui-density-spacious .channel-row.event-rail-row { padding-left: 36px; }
.event-rail-spine,
.event-rail-stem {
  position: absolute;
  left: 16px;
  box-sizing: border-box;
  pointer-events: none;
  border-color: var(--text-dim);
  opacity: 0.7;
}
.event-rail-spine {
  top: 0;
  width: 14px;
  height: 50%;
  border-left: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  border-bottom-left-radius: 8px;
}
.event-rail-row.is-first .event-rail-spine {
  top: -6px;
  height: calc(50% + 6px);
}
.event-rail-stem {
  top: 50%;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--text-dim);
}
#event-page {
  flex: 1; min-height: 0; display: none; flex-direction: row; min-width: 0;
}
.event-page-main {
  flex: 1; min-width: 0; overflow: auto; padding: 22px 28px 36px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.event-page-main::-webkit-scrollbar,
.event-page-rail::-webkit-scrollbar { width: 8px; }
.event-page-main::-webkit-scrollbar-track,
.event-page-rail::-webkit-scrollbar-track { background: transparent; }
.event-page-main::-webkit-scrollbar-thumb,
.event-page-rail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
#event-page-title { margin: 0 0 16px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.event-page-rsvp-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.event-rsvp-seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.event-rsvp-seg button {
  background: transparent; border: 0; border-right: 1px solid var(--border);
  color: var(--text); padding: 8px 16px; font-weight: 700; cursor: pointer;
}
.event-rsvp-seg button:last-child { border-right: 0; }
.event-rsvp-seg button.is-on { box-shadow: inset 0 0 0 1px var(--accent); }
.event-rsvp-seg button:disabled { opacity: 0.45; cursor: default; }
.event-page-invited { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.event-page-card {
  margin-top: 18px; background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 16px; display: flex; flex-direction: column; gap: 0;
}
.event-page-card .event-page-meta { margin-top: 0; gap: 0; }
.event-page-card .event-page-meta > * {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.event-page-card .event-page-meta > :first-child { border-top: 0; }
.event-page-split { height: 1px; background: var(--border); margin: 18px 0 16px; }
.event-page-discuss-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.event-page-discuss-title { font-weight: 700; margin-bottom: 4px; }
.event-page-join, .event-page-share, .event-page-format button {
  opacity: 0.45; cursor: default;
}
.event-page-join, .event-page-share {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 12px; font-weight: 700;
}
.event-page-card .announce-reactions { margin: 0; padding: 0; border-top: 0; }
.event-page-empty, .event-page-note.is-empty, .event-page-ago { color: var(--text-dim); }
.event-page-comments { margin-top: 12px; }
.event-page-comment { display: flex; gap: 10px; margin: 0 0 12px; }
.event-page-comment-body { min-width: 0; }
.event-page-comment-top { display: flex; align-items: baseline; gap: 8px; }
.event-page-comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.event-page-meta { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.event-page-line { display: flex; align-items: flex-start; gap: 10px; }
.event-page-icon { width: 18px; color: var(--text-dim); flex: 0 0 auto; margin-top: 2px; }
.event-page-line-body { min-width: 0; flex: 1; }
.event-page-line-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.event-page-time { color: var(--text-dim); }
.event-page-by, .event-page-foot { display: flex; align-items: center; gap: 8px; }
.event-page-author-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.event-page-ago { font-size: 13px; }
.event-page-foot { justify-content: space-between; }
.event-page-foot-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.event-page-foot-bar { color: var(--text-dim); }
.event-page-share { flex: 0 0 auto; }
.event-page-reply { margin-top: 18px; }
.event-page-reply-label { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.event-page-box {
  border: 1px solid var(--border); border-radius: 8px; background: var(--rail); padding: 8px 10px 4px;
}
.event-page-format { display: flex; gap: 2px; margin-bottom: 4px; }
.event-page-format button {
  background: transparent; border: 0; color: var(--text-dim); border-radius: 4px; padding: 4px 6px;
}
.event-page-box .list-note-field { border: 0; background: transparent; margin: 0; padding: 4px 2px 8px; }
.event-page-compose-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.event-page-face {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; padding: 0; flex: 0 0 auto;
  border: 0; background: var(--panel-alt); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.event-page-person-name {
  background: transparent; border: 0; padding: 0; color: var(--text); font-weight: 700;
  cursor: pointer; font-size: inherit;
}
.event-page-menu {
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer; font-size: 18px; line-height: 1;
}
.event-page-rail {
  width: 280px; flex: 0 0 280px; border-left: 1px solid var(--border);
  padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.event-page-counts { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; color: var(--text-dim); font-size: 13px; }
.event-page-see { background: transparent; border: 0; color: var(--text); cursor: pointer; font-weight: 700; }
.event-page-attend { color: var(--text-dim); }
.event-page-person { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.event-page-rsvp-edit {
  margin-left: auto; background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 12px; font-weight: 700;
}
.event-page-person .event-page-rsvp-edit + .event-page-remove { margin-left: 0; }
.event-page-remove {
  margin-left: auto; background: transparent; border: 0; color: var(--text-dim);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.event-page-invite-title { font-weight: 700; }
.event-page-invite { display: flex; gap: 8px; }
.event-page-invite .server-settings-input { flex: 1; min-width: 0; }
#calendar-event-card {
  width: 480px; max-width: calc(100% - 32px); max-height: 82vh;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#calendar-event-card .view-header { font-size: 18px; }
#calendar-event-card .view-body {
  padding: 14px 16px 16px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#calendar-event-card .view-body::-webkit-scrollbar { width: 8px; }
#calendar-event-card .view-body::-webkit-scrollbar-track { background: transparent; }
#calendar-event-card .view-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.calendar-label {
  display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: var(--text);
}
.calendar-label:first-child { margin-top: 0; }
.calendar-datetime { color-scheme: dark; }
.calendar-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.calendar-swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.calendar-swatch.is-on { border-color: var(--text); }
.calendar-later { margin-top: 8px; opacity: 0.45; color-scheme: dark; }
.calendar-later .server-settings-input,
.calendar-later .list-note-field,
.calendar-later .toggle-switch,
.calendar-later .ghost-btn { cursor: not-allowed; }
.calendar-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px;
}
.calendar-option-name { font-size: 14px; font-weight: 600; }
.calendar-later-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.calendar-rsvp { margin-top: 12px; }
.calendar-rsvp-bar { display: flex; gap: 8px; }
.calendar-rsvp-bar .ghost-btn.is-on { border-color: var(--accent-submenu); color: var(--text); }
.calendar-rsvp-summary { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.calendar-roles { display: flex; flex-direction: column; gap: 8px; }
.calendar-invite-row { display: flex; gap: 8px; align-items: center; }
.calendar-invite-row .server-settings-input { flex: 1; min-width: 0; }
.calendar-invites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.calendar-invite-chip {
  background: var(--panel-alt); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.calendar-event-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.calendar-delete { color: var(--danger); border-color: var(--danger); margin-right: auto; }

/* ---- Channel creation modal ---- */
/* Same overlay/box treatment as the category modal, plus the type-
   picker accordion. Only one .accordion-group carries .open at a time
   (see app.js's click handler) — collapsed by default, nothing
   expanded on modal open, matching "nothing pre-selected" for the
   radios themselves. */
#channel-modal-overlay,
#page-modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#channel-modal,
#page-modal {
  width: 460px; max-height: 82vh;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#channel-modal .view-header,
#page-modal .view-header { flex: 0 0 auto; }
#channel-modal .view-body,
#page-modal .view-body { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.channel-type-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }

.channel-type-accordion { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 18px; }
.accordion-group + .accordion-group { border-top: 1px solid var(--border); }
.accordion-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--panel-alt); color: var(--text); font-size: 13px; font-weight: 600;
  padding: 10px 12px; text-align: left;
}
.accordion-header:hover { background: var(--border); }
.accordion-caret { display: inline-block; color: var(--text-dim); font-size: 11px; transition: transform 0.15s ease; }
.accordion-group.open .accordion-caret { transform: rotate(180deg); }
.accordion-panel { display: none; padding: 4px 0; }
.accordion-group.open .accordion-panel { display: block; }

.channel-type-option { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; cursor: pointer; }
.channel-type-option:hover { background: var(--panel-alt); }
.channel-type-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.channel-type-name { font-size: 13px; font-weight: 600; color: var(--text); }
.channel-type-desc { font-size: 11.5px; color: var(--text-dim); }
.channel-type-option input:checked ~ .channel-type-name { color: var(--accent-submenu); }
.channel-type-option:has(input:checked) { background: rgba(217, 70, 239, 0.1); }

/* Deferred types (Events/Calendar, Tournaments, Watch Party) — visible
   so the eventual menu shape is clear, but not interactive. The
   "(Coming Soon)" <em> is a plain inline tag here, not a separate
   badge component — cheap to upgrade later if it needs to look more
   distinct. */
.channel-type-option.disabled { cursor: not-allowed; opacity: 0.45; }
.channel-type-option.disabled:hover { background: none; }
.channel-type-option.disabled .channel-type-name em { font-style: normal; font-weight: 500; }

.channel-type-accordion + .server-modal-label { margin-top: 4px; }
.page-layout-list {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 18px;
}
.page-layout-list .channel-type-option + .channel-type-option { border-top: 1px solid var(--border); }
#channel-modal-footer,
#page-modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
#channel-modal-create-btn:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }
#channel-modal-create-btn:disabled:hover { background: var(--border); }

/* ---- Invite panel ---- */
/* Same overlay/box treatment as the other two modals (border uses
   --accent-submenu, same pop-up cue). #invite-link-row holds the
   generated code as a read-only input (so it's trivially select-all-
   copyable even if the Copy button's clipboard call fails) plus the
   actual Copy button; the friend list below reuses the exact same
   .friend-row markup/styling the party modal already uses. */
#invite-modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
#invite-modal {
  width: 420px; max-height: 70vh;
  background: var(--panel); border: 1px solid var(--accent-submenu); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
#invite-modal .view-header { flex: 0 0 auto; }
#invite-modal .view-body { flex: 1 1 auto; overflow-y: auto; }
#invite-link-row { display: flex; gap: 8px; margin-bottom: 4px; }
#invite-link-display {
  flex: 1; min-width: 0; background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 13px;
}
#invite-link-display:focus { outline: none; border-color: var(--accent-submenu); }
#invite-copy-status { font-size: 12px; color: var(--online); min-height: 16px; margin-bottom: 10px; }
#invite-modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
#invite-modal-footer span { font-size: 12px; color: var(--text-dim); }

/* ---- In-chat invite card ---- */
/* Rendered underneath a message bubble-line whenever its content is
   exactly an invite link (see INVITE_LINK_REGEX in app.js) — the raw
   link text itself is left untouched above this, matching how a normal
   chat client unfurls a pasted link rather than replacing it. Sized
   narrower than the party/server invite mockups' full standalone-page
   treatment, since this has to sit comfortably inside a message bubble. */
.invite-card {
  margin-top: 6px; width: 260px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.invite-card-header { display: flex; align-items: center; gap: 10px; }
.invite-card-badge {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.invite-card-name { font-weight: 600; font-size: 14px; }
.invite-card-subtitle { font-size: 12px; color: var(--text-dim); }
.invite-card-btn {
  padding: 8px; border-radius: 6px; text-align: center;
  background: var(--online); color: #fff; font-size: 13px; font-weight: 600;
}
.invite-card-btn:hover { filter: brightness(1.1); }
.invite-card-btn:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }
/* Matches mockup 3's flat, dark "no longer usable" treatment — distinct
   from the normal card, not just a disabled version of it. */
.invite-card.invalid { border-color: var(--danger); }
.invite-card.invalid .invite-card-badge { background: var(--danger); }
.invite-card-invalid-text { color: var(--danger); font-size: 13px; font-weight: 600; }

.bubble-line a.msg-link { color: #69c0ff; text-decoration: none; word-break: break-all; }
.bubble-line a.msg-link:hover { text-decoration: underline; }
.msg-cluster.self .bubble-line a.msg-link { color: #fff; text-decoration: underline; }

.link-embed {
  position: relative;
  margin-top: 6px; width: 320px; max-width: 100%;
  background: var(--rail); border-radius: 4px;
  border-left: 4px solid #6b6680;
  padding: 8px 28px 8px 12px; box-sizing: border-box;
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px;
  align-items: start; align-self: flex-start;
}
.link-embed-youtube { border-left-color: #ff0000; }
.link-embed-reddit { border-left-color: #ff4500; }
.link-embed-twitter { border-left-color: #1d9bf0; }
.link-embed-twitch { border-left-color: #9146ff; }
.link-embed-spotify { border-left-color: #1db954; }
.link-embed-steam { border-left-color: #1b4f8a; }
/* Cards follow the same self-right parent class as the bubble text, so a
   future "my messages on the left" setting only flips that one class. */
#chat-messages.self-right .msg-cluster.self .link-embed,
#channel-messages.self-right .msg-cluster.self .link-embed,
#chat-messages.self-right .msg-cluster.self .invite-card,
#channel-messages.self-right .msg-cluster.self .invite-card { align-self: flex-end; }
#chat-messages:not(.self-right) .msg-cluster.self .link-embed,
#channel-messages:not(.self-right) .msg-cluster.self .link-embed,
#chat-messages:not(.self-right) .msg-cluster.self .invite-card,
#channel-messages:not(.self-right) .msg-cluster.self .invite-card { align-self: flex-start; }
.msg-cluster.other .link-embed,
.msg-cluster.other .invite-card { align-self: flex-start; }
.link-embed-hide {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; padding: 0; border-radius: 4px;
  background: transparent; color: var(--text-dim); font-size: 16px; line-height: 1;
  opacity: 0; display: flex; align-items: center; justify-content: center;
}
.link-embed:hover .link-embed-hide { opacity: 1; }
.link-embed-hide:hover { color: var(--text); background: var(--panel-alt); }
.link-embed-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.link-embed-title {
  color: #69c0ff; font-size: 14px; font-weight: 600;
  text-decoration: none; word-wrap: break-word;
}
.link-embed-title:hover { text-decoration: underline; }
.link-embed-desc {
  font-size: 13px; color: var(--text); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-embed-logo {
  width: 80px; height: 80px; object-fit: cover; border-radius: 8px;
}

#docs-editing-banner {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap;
  pointer-events: none;
}
#docs-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#docs-toolbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel);
}
#docs-toolbar select {
  background: var(--panel-alt); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.docs-fmt-btn {
  background: var(--panel-alt); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; width: 28px; height: 28px; font-size: 13px;
}
.docs-fmt-btn:hover { background: var(--rail); }
#docs-canvas {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  background: var(--rail); padding: 24px 16px;
}
#docs-page {
  box-sizing: border-box; width: min(816px, 100%); min-height: 1056px; margin: 0 auto;
  background: #fff; color: #000; padding: 72px 72px;
  font-family: Arial, sans-serif; font-size: 11pt; line-height: 1.5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
#docs-page:focus { outline: none; }
#docs-page h1 { font-size: 24pt; font-weight: 700; margin: 0 0 12px; }
#docs-page h2 { font-size: 18pt; font-weight: 700; margin: 0 0 10px; }
#docs-page h3 { font-size: 14pt; font-weight: 700; margin: 0 0 8px; }
#docs-page p { margin: 0 0 8px; }
#docs-page .doc-title { font-size: 26pt; font-weight: 700; margin: 0 0 16px; }

/* Composer emoji picker — one panel, opened from either composer.
   GIF / Stickers / Add emoji / Favorites are greyed placeholders.
   Header is two rows like Discord: tabs + Add emoji, then a full-width
   search. Cells must beat #emoji-picker button { font-size } or faces
   stay unreadably small. */
#emoji-picker {
  position: fixed;
  z-index: 980;
  width: 400px;
  height: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
#emoji-picker button {
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  padding: 0;
}
.emoji-picker-top {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.emoji-picker-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}
#emoji-picker .emoji-tab {
  height: 32px;
  padding: 0 12px;
  border-radius: 0;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
}
#emoji-picker .emoji-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.emoji-tab.disabled, .emoji-add-btn.disabled, .emoji-rail-btn.disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
#emoji-picker .emoji-add-btn {
  height: 32px;
  padding: 0 12px;
  margin-left: auto;
  border-radius: 6px;
  white-space: nowrap;
  color: var(--text-dim);
}
#emoji-picker-search {
  width: 100%;
  height: 36px;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 0 12px;
}
#emoji-picker-search:focus { outline: none; box-shadow: 0 0 0 1px var(--accent-submenu); }
.emoji-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
#emoji-cat-rail {
  flex: 0 0 52px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-right: 1px solid var(--border);
  background: var(--rail);
}
.emoji-rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.emoji-rail-btn:hover:not(:disabled) { background: var(--panel-alt); }
.emoji-rail-btn.active { background: var(--panel-alt); }
.emoji-rail-server-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.emoji-rail-server-letter {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
#emoji-picker-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 10px 10px 14px;
}
.emoji-section { margin-bottom: 14px; }
.emoji-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 4px 0 8px;
}
.emoji-section-empty { font-size: 13px; color: var(--text-dim); padding: 4px 0 8px; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
#emoji-picker .emoji-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 30px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: inherit;
  padding: 0;
}
#emoji-picker .emoji-cell:hover { background: var(--panel-alt); }
#emoji-picker .emoji-cell-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
#emoji-search-results { padding-top: 4px; }
#emoji-picker-footer {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-top: 1px solid var(--border);
  background: var(--rail);
  color: var(--text-dim);
  font-size: 14px;
  font-family: ui-monospace, Consolas, monospace;
}
.msg-custom-emoji {
  display: inline-block;
  vertical-align: -0.2em;
  line-height: 1;
}
.msg-custom-emoji-img {
  width: 1.35em;
  height: 1.35em;
  object-fit: contain;
  vertical-align: -0.2em;
}
.bubble-line.emoji-only .msg-custom-emoji-img {
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

#main-grid.is-profile-edit { grid-template-columns: 260px 240px 1fr; }
#main-grid.is-profile-edit.has-member-list { grid-template-columns: 260px 240px 1fr 240px; }
#main-grid.is-profile-edit #server-rail-main { display: none; }
#profile-palette {
  display: none;
  flex: 1 1 auto; min-height: 0; width: 100%;
  align-self: stretch;
  flex-direction: column;
  padding: 12px 10px;
  overflow: hidden;
}
#main-grid.is-profile-edit #profile-palette { display: flex; }
#main-grid.is-profile-edit #profile-palette[hidden] { display: none; }
.profile-palette-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); padding: 4px 6px 10px;
}
#profile-palette-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.profile-palette-group { margin-bottom: 8px; }
.profile-palette-group > button {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: transparent; color: var(--text); text-align: left;
  font-size: 13px; font-weight: 700; padding: 8px 8px; border-radius: 6px;
}
.profile-palette-group > button:hover { background: var(--panel-alt); }
.profile-palette-caret { font-size: 10px; color: var(--text-dim); transform: rotate(-90deg); }
.profile-palette-group.is-open .profile-palette-caret { transform: none; }
.profile-palette-items { display: none; padding: 0 2px 6px; }
.profile-palette-group.is-open .profile-palette-items { display: block; }
.profile-palette-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--panel-alt); color: var(--text);
  font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 6px;
  margin: 4px 0; cursor: grab;
}
.profile-palette-item:disabled, .profile-palette-item.is-later {
  opacity: 0.45; cursor: default;
}
.profile-palette-later { font-size: 12px; color: var(--text-dim); padding: 6px 8px; }

#profile-sidebar-header {
  flex: 0 0 auto; padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700;
}
#profile-page-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 6px; }
#profile-page-tools {
  flex: 0 0 auto; display: flex; justify-content: center; align-items: center;
  padding: 8px 10px 12px; border-top: 1px solid var(--border);
}
#profile-page-tools[hidden] { display: none; }
.profile-page-add {
  background: var(--accent); color: #fff; border-color: transparent;
}
.profile-page-add:hover { background: var(--accent-hover); }
.profile-page-split {
  height: 0; margin: 10px 8px 0; border-top: 1px solid var(--border);
}
.profile-page-group {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); padding: 12px 10px 6px;
}
.profile-page-item {
  position: relative;
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; color: var(--text-dim); text-align: left;
  font-size: 14px; font-weight: 600; padding: 8px 8px; border-radius: 6px;
}
.profile-page-item:hover, .profile-page-item.is-on { background: var(--panel-alt); color: var(--text); }
.profile-page-item span { flex: 1 1 auto; min-width: 0; }
.profile-page-tools-row { display: flex; gap: 4px; }
.profile-page-tools-row button {
  background: transparent; color: var(--text-dim); font-size: 12px; padding: 2px 6px; border-radius: 4px;
}
.profile-page-tools-row button:hover { color: var(--text); background: var(--rail); }

.profile-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
#profile-edit-btn {
  background: var(--panel-alt); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 6px;
}
#profile-edit-btn:hover { background: var(--border); }
#profile-edit-actions { display: flex; align-items: center; gap: 8px; }
#profile-edit-actions[hidden] { display: none; }
#profile-owner-label { margin-left: auto; font-size: 13px; color: var(--text-dim); }
#profile-board-scroll {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; align-items: center;
  scrollbar-gutter: stable;
}
#profile-board-fit {
  flex: 0 0 auto;
  position: relative;
}
#profile-board {
  display: grid;
  grid-template-columns: repeat(32, 36px);
  grid-auto-rows: 36px;
  gap: 0;
  width: calc(32 * 36px);
  padding: 16px 20px 48px;
  position: relative;
  align-content: start;
  box-sizing: content-box;
  transform-origin: top left;
}
#profile-board-fit:has(.is-mini-profile-page) {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 100%;
}
#profile-board.is-mini-profile-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  padding: 40px 20px;
  grid-template-columns: none;
  grid-auto-rows: auto;
}
.profile-grid-overlay {
  position: absolute;
  left: 20px; right: 20px; top: 16px;
  display: grid;
  grid-template-columns: repeat(32, 36px);
  pointer-events: none;
  z-index: 0;
}
.profile-grid-overlay div {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 36px;
}
.profile-board-empty {
  grid-column: 1 / -1;
  color: var(--text-dim); font-size: 14px; padding: 24px 8px;
}
#profile-limited-note {
  padding: 8px 20px 20px; font-size: 13px; color: var(--text-dim);
}
.profile-tile {
  background: var(--panel-alt); border: none; border-radius: 10px;
  min-width: 0; min-height: 0; overflow: hidden;
  position: relative; z-index: 1;
  box-sizing: border-box;
}
.profile-tile.is-banner {
  border: none; border-radius: 12px;
}
.profile-tile.is-avatar {
  background: transparent; border: none; overflow: visible;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.profile-tile.is-display_name {
  background: transparent; border: none;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
}
.profile-tile.is-display_name[data-text-align="left"] { align-items: flex-start; text-align: left; }
.profile-tile.is-display_name[data-text-align="center"] { align-items: center; text-align: center; }
.profile-tile.is-display_name[data-text-align="right"] { align-items: flex-end; text-align: right; }
.profile-tile-avatar {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 50%;
  background: var(--panel); border: 4px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: var(--text);
  flex: 0 0 auto;
}
.profile-tile-name { font-size: var(--profile-text-size, 18pt); font-weight: 800; color: var(--text); line-height: 1.15; }
.profile-tile-name-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.profile-tile.is-display_name[data-text-align="left"] .profile-tile-name-row { justify-content: flex-start; }
.profile-tile.is-display_name[data-text-align="right"] .profile-tile-name-row { justify-content: flex-end; }
.profile-alias-btn {
  background: transparent; color: var(--text-dim); font-size: calc(var(--profile-text-size, 18pt) * 0.55); padding: 2px 4px;
}
.profile-alias-btn:hover { color: var(--text); }
.profile-tile-handle { font-size: calc(var(--profile-text-size, 18pt) * 0.6); color: var(--text-dim); margin-top: 2px; }
.profile-tile-status { font-size: calc(var(--profile-text-size, 18pt) * 0.6); color: var(--text-dim); margin-top: 4px; }
.profile-tile.is-display_name[data-text-align="left"] .profile-tile-handle,
.profile-tile.is-display_name[data-text-align="left"] .profile-tile-status { text-align: left; }
.profile-tile.is-display_name[data-text-align="right"] .profile-tile-handle,
.profile-tile.is-display_name[data-text-align="right"] .profile-tile-status { text-align: right; }
.profile-tile-pronouns { font-size: 12px; color: var(--text-dim); margin-top: 2px; text-align: center; }
.profile-tile.is-member_since {
  container-type: size;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  overflow: hidden;
}
.profile-tile.is-member_since .profile-tile-head {
  padding: 0;
  font-size: clamp(9px, 16cqh, 11px);
  line-height: 1.2;
}
.profile-since-date {
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-size: clamp(13px, 42cqh, 26px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-tile-head {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim); padding: 10px 12px 0;
}
.profile-tile-body {
  padding: 8px 12px 12px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}
.profile-tile.is-friends,
.profile-tile.is-link_tree,
.profile-tile.is-display_server {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.profile-tile.is-friends .profile-tile-body,
.profile-tile.is-link_tree .profile-tile-body,
.profile-tile.is-display_server .profile-tile-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 4px 12px 12px;
}
.profile-tile.is-display_server .oneira-wall-head {
  padding: 10px 12px 0;
}
.profile-tile.is-display_server .oneira-wall-rule {
  margin: 8px 12px 0;
  width: auto;
}
.profile-tile.is-display_server[data-text-align="center"] .oneira-wall-title { text-align: center; width: 100%; }
.profile-tile.is-display_server[data-text-align="right"] .oneira-wall-title { text-align: right; width: 100%; }
.profile-server-row { cursor: pointer; }
.profile-tile.is-editing .profile-server-row { cursor: grab; }
.profile-tile.is-local_time,
.profile-tile.is-details,
.profile-tile.is-clock {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.profile-tile.is-local_time .profile-tile-body,
.profile-tile.is-details .profile-tile-body,
.profile-tile.is-clock .profile-tile-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  gap: 2px;
}
.profile-local-clock,
.profile-detail-clock {
  font-size: var(--profile-text-size, 18pt);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: 0.02em;
}
.profile-local-date {
  font-size: calc(var(--profile-text-size, 18pt) * 0.55);
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.profile-local-empty,
.profile-detail-empty {
  color: var(--text-dim);
  font-size: 13px;
}
.profile-tile.is-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-tile.is-meter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.profile-tile.is-meter > .profile-tile-head {
  padding: 6px 12px 0;
}
.profile-tile.is-meter > .profile-text-rule {
  margin: 4px 12px 0;
}
.profile-tile.is-meter .profile-tile-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  overflow: hidden;
}
.profile-meter-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-top: 14px;
}
.profile-tile.is-meter:not(.is-meter-named) .profile-meter-track,
.profile-tile.is-meter.is-compact-row .profile-meter-track {
  margin-top: 0;
}
.profile-meter-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  max-width: 100%;
}
.profile-meter-mark {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  pointer-events: none;
}
.profile-meter-mark-name {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dim);
}
.profile-tile.is-meter:not(.is-meter-named) .profile-meter-mark-name {
  display: none;
}
.profile-meter-readout {
  font-size: var(--profile-text-size, 14px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.profile-tile[data-text-align="center"] .profile-meter-readout { text-align: center; }
.profile-tile[data-text-align="right"] .profile-meter-readout { text-align: right; }
.profile-tile[data-text-align="justify"] .profile-meter-readout { text-align: justify; }
.profile-tile.is-meter.is-compact-row > .profile-tile-head,
.profile-tile.is-meter.is-compact-row > .profile-text-rule,
.profile-tile.is-meter.is-compact-row .profile-meter-readout,
.profile-tile.is-meter.is-compact-row .profile-meter-mark-name {
  display: none;
}
.profile-tile.is-meter.is-compact-row .profile-tile-body {
  justify-content: center;
  padding: 0 10px;
}
.profile-tile.is-image {
  overflow: hidden;
}
.profile-tile-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.profile-image-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  color: var(--text-dim);
  font-size: 13px;
}
.profile-opt-image-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px;
}
.profile-opt-image-actions .profile-link-add {
  margin: 0;
}
.profile-opt-image-actions button {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel-alt);
  color: var(--text);
}
.profile-opt-image-name {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-music-tracks { margin-bottom: 8px; }
.profile-music-track { padding: 4px 0 10px; }
.profile-music-track .profile-link-edit-row { margin-bottom: 8px; }
.profile-music-track .profile-opt-image-name { margin-bottom: 0; }
.profile-icon-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
}
.profile-icon-glyph {
  font-size: var(--profile-icon-glyph, 60px);
  line-height: 1;
  user-select: none;
}
.profile-opt-icon-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.profile-opt-icon-preview {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--rail);
}
.profile-opt-icon-value {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.profile-clock-label,
.profile-clock-zone {
  font-size: calc(var(--profile-text-size, 18pt) * 0.45);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.profile-clock-live {
  font-size: var(--profile-text-size, 18pt);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.profile-tile.is-clock[data-text-align="left"] .profile-tile-body,
.profile-tile.is-local_time[data-text-align="left"] .profile-tile-body,
.profile-tile.is-details[data-text-align="left"] .profile-tile-body {
  align-items: flex-start;
}
.profile-tile.is-clock[data-text-align="right"] .profile-tile-body,
.profile-tile.is-local_time[data-text-align="right"] .profile-tile-body,
.profile-tile.is-details[data-text-align="right"] .profile-tile-body {
  align-items: flex-end;
}
.profile-tile-body textarea {
  width: 100%; min-height: 120px; resize: none;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 14px; padding: 8px;
}
.profile-tile.is-header,
.profile-tile.is-body,
.profile-tile.is-footnote,
.profile-tile.is-list,
.profile-tile.is-spoiler,
.profile-tile.is-stats,
.profile-tile.is-callout,
.profile-tile.is-bio.is-text-chrome {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.profile-tile.is-text-chrome.is-clear,
.profile-tile.is-clear {
  background: transparent;
}
.profile-tile.is-clear:not(.has-widget-border) {
  border: none;
}
.profile-tile.has-surface {
  background: var(--panel-alt);
}
.profile-tile.has-surface:not(.has-widget-border) {
  border: none;
}
.profile-tile.has-widget-border {
  border-width: var(--profile-widget-border-width, 1px);
  border-style: var(--profile-widget-border-style, solid);
  border-color: var(--profile-widget-border-color, var(--border));
}
.profile-tile.has-widget-pad.is-text-chrome { padding: 0; }
.profile-tile.has-widget-pad .profile-text-shell { padding: var(--profile-pad); }
.profile-tile.has-widget-pad:not(.is-text-chrome) { padding: var(--profile-pad); }
.has-widget-frame::before,
.has-gradient-border::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}
.has-widget-frame::before {
  padding: var(--profile-frame-width, 4px);
  background: var(--profile-frame-paint, transparent);
}
.has-gradient-border::after {
  padding: var(--profile-widget-border-width, 2px);
  background: var(--profile-border-paint, transparent);
}
.profile-text-slot {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  font-size: var(--profile-text-size, 14pt);
}
.profile-text-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 8px 12px 10px;
}
.profile-text-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.profile-text-title.is-empty { font-weight: 500; }
.profile-tile[data-title-align="left"] .profile-text-title { text-align: left; }
.profile-tile[data-title-align="center"] .profile-text-title { text-align: center; }
.profile-tile[data-title-align="right"] .profile-text-title { text-align: right; }
.profile-text-rule {
  height: 1px;
  background: var(--border);
  margin: 6px 12px 8px;
  flex: 0 0 auto;
}
.profile-text-shell .profile-text-rule {
  margin: 6px 0 8px;
}
.profile-tile.is-compact-row .profile-text-shell {
  padding: 0 10px;
  justify-content: center;
}
.profile-tile.is-compact-row .profile-text-slot {
  overflow: hidden;
  justify-content: center;
}
.profile-tile.is-compact-row .profile-tile-header,
.profile-tile.is-compact-row .profile-tile-header.is-level-2,
.profile-tile.is-compact-row .profile-tile-header.is-level-3 {
  font-size: min(var(--profile-text-size, 18pt), 28px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
}
.profile-tile.is-button.is-compact-row {
  padding: 0;
}
.profile-tile.is-button.is-compact-row .profile-action-btn {
  padding: 0 10px;
  line-height: 1;
  height: 100%;
  min-height: 0;
  font-size: min(var(--profile-text-size, 14pt), 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-tile[data-text-align="left"] .profile-text-slot,
.profile-tile[data-text-align="left"] .profile-text-slot textarea,
.profile-tile[data-text-align="left"] .profile-text-slot input {
  text-align: left;
}
.profile-tile[data-text-align="center"] .profile-text-slot,
.profile-tile[data-text-align="center"] .profile-text-slot textarea,
.profile-tile[data-text-align="center"] .profile-text-slot input {
  text-align: center;
}
.profile-tile[data-text-align="right"] .profile-text-slot,
.profile-tile[data-text-align="right"] .profile-text-slot textarea,
.profile-tile[data-text-align="right"] .profile-text-slot input {
  text-align: right;
}
.profile-tile[data-text-align="justify"] .profile-text-slot,
.profile-tile[data-text-align="justify"] .profile-text-slot textarea,
.profile-tile[data-text-align="justify"] .profile-text-slot input,
.profile-tile.is-display_name[data-text-align="justify"],
.profile-tile[data-text-align="justify"] .profile-action-btn,
.profile-tile[data-text-align="justify"] .profile-tile-body,
.profile-tile[data-text-align="justify"] .oneira-wall-title,
.profile-tile[data-text-align="justify"] .oneira-wall-text {
  text-align: justify;
}
.profile-tile.has-text-font {
  font-family: var(--profile-text-font);
}
.profile-tile.has-text-track,
.profile-tile.has-text-track .profile-text-title {
  letter-spacing: var(--profile-letter-spacing);
}
.profile-tile.has-text-shadow {
  text-shadow: var(--profile-text-shadow);
}
.profile-tile.has-text-color :is(
  .profile-tile-name,
  .profile-tile-handle,
  .profile-tile-status,
  .profile-alias-btn,
  .profile-text-title,
  .profile-text-slot,
  .profile-tile-header,
  .profile-tile-copy,
  .profile-tile-footnote,
  .profile-tile-list,
  .profile-tile-list-edit,
  .profile-action-btn,
  .profile-tile-body,
  .profile-local-clock,
  .profile-local-date,
  .profile-clock-live,
  .profile-clock-label,
  .oneira-wall-title,
  .oneira-wall-name,
  .oneira-wall-text,
  .oneira-wall-time,
  .profile-friend-name,
  .profile-spoiler-title,
  .profile-callout-copy,
  .settings-opt-desc,
  .steam-recent-name,
  .steam-recent-time,
  .steam-achieve-desc,
  .steam-badge-xp,
  .profile-meter-title,
  .profile-meter-readout
) {
  color: var(--profile-text-color);
}
.profile-tile.has-text-gradient :is(
  .profile-tile-name,
  .profile-tile-handle,
  .profile-tile-status,
  .profile-alias-btn,
  .profile-text-title,
  .profile-text-slot,
  .profile-tile-header,
  .profile-tile-copy,
  .profile-tile-footnote,
  .profile-tile-list,
  .profile-tile-list-edit,
  .profile-action-btn,
  .profile-tile-body,
  .profile-local-clock,
  .profile-local-date,
  .profile-clock-live,
  .profile-clock-label,
  .oneira-wall-title,
  .oneira-wall-name,
  .oneira-wall-text,
  .oneira-wall-time,
  .profile-friend-name,
  .profile-spoiler-title,
  .profile-callout-copy,
  .settings-opt-desc,
  .steam-recent-name,
  .steam-recent-time,
  .steam-achieve-desc,
  .steam-badge-xp,
  .profile-meter-title,
  .profile-meter-readout
) {
  background-image: var(--profile-text-paint);
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.profile-tile.has-text-leading :is(
  .profile-tile-name,
  .profile-tile-handle,
  .profile-tile-status,
  .profile-text-slot,
  .profile-tile-header,
  .profile-tile-copy,
  .profile-tile-footnote,
  .profile-tile-list,
  .profile-action-btn,
  .profile-local-clock,
  .profile-clock-live,
  .oneira-wall-title,
  .oneira-wall-text,
  .steam-recent-name,
  .steam-recent-time,
  .steam-achieve-desc,
  .steam-badge-xp,
  .profile-meter-title,
  .profile-meter-readout
) {
  line-height: var(--profile-line-height);
}
.profile-text-slot > textarea,
.profile-text-slot > .profile-tile-header,
.profile-text-slot > .profile-tile-copy,
.profile-text-slot > .profile-tile-footnote,
.profile-text-slot > .profile-tile-list,
.profile-text-slot > .profile-tile-list-edit,
.profile-text-slot > .profile-spoiler,
.profile-text-slot > .profile-stats,
.profile-text-slot > .profile-callout-copy {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}
.profile-tile.has-border {
  background: var(--panel-alt);
  border: 1px solid var(--border);
}
.profile-tile.is-avatar.has-border,
.profile-tile.is-banner.has-border {
  background: transparent;
  border: none;
}
.profile-tile-header,
.profile-tile-copy,
.profile-tile-footnote,
.profile-tile-list-edit {
  width: 100%;
  min-height: 0;
  resize: none;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
  line-height: 1.35;
}
.profile-tile-header {
  font-weight: 800;
  font-size: 1.75em;
}
.profile-tile-header.is-level-2 { font-size: 1.3em; font-weight: 700; }
.profile-tile-header.is-level-3 { font-size: 1.1em; font-weight: 700; }
.profile-tile-copy { font-size: 1em; white-space: pre-wrap; }
.profile-tile-footnote { font-size: 0.85em; color: var(--text-dim); white-space: pre-wrap; }
.profile-tile-header.is-empty,
.profile-tile-copy.is-empty,
.profile-tile-footnote.is-empty,
.profile-tile-list .is-empty { color: var(--text-dim); font-weight: 500; }
.profile-tile-list {
  margin: 0;
  padding: 0 8px 0 1.4em;
  font-size: 1em;
  color: var(--text);
  line-height: 1.45;
  width: 100%;
}
.profile-tile[data-text-align="center"] .profile-tile-list,
.profile-tile[data-text-align="right"] .profile-tile-list { list-style-position: inside; padding-left: 0; }
.profile-tile-list.is-number { padding-left: 32px; }
.profile-tile-list-edit { font-size: 14px; white-space: pre-wrap; }
.profile-tile.is-spoiler,
.profile-tile.is-callout,
.profile-tile.is-stats {
  flex-direction: column;
}
.profile-spoiler {
  display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0;
}
.profile-spoiler-title {
  width: 100%;
  background: transparent; border: none; color: var(--text);
  font-size: 15px; font-weight: 700; text-align: left; padding: 2px 0;
  border-radius: 0;
}
.profile-spoiler button.profile-spoiler-title:hover {
  background: transparent; color: var(--text);
}
.profile-spoiler-title.is-empty { color: var(--text-dim); font-weight: 500; }
.profile-spoiler-copy {
  width: 100%; min-height: 0; flex: 1 1 auto; resize: none;
  background: transparent; border: none; color: var(--text);
  font-size: 14px; line-height: 1.4; white-space: pre-wrap; padding: 0;
}
.profile-spoiler-copy.is-empty { color: var(--text-dim); }
.profile-spoiler:not(.is-open) .profile-spoiler-title::before { content: "▸ "; color: var(--text-dim); }
.profile-spoiler.is-open .profile-spoiler-title::before { content: "▾ "; color: var(--text-dim); }
.profile-stats {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 16px;
  width: 100%; padding: 0; align-content: start;
}
.profile-stat-label { color: var(--text-dim); font-size: 13px; }
.profile-stat-value { color: var(--text); font-size: 13px; font-weight: 700; text-align: right; }
.profile-stats .is-empty { grid-column: 1 / -1; color: var(--text-dim); }
.profile-callout-copy {
  width: 100%; min-height: 0; resize: none;
  background: transparent; border: none; border-left: 4px solid var(--accent);
  color: var(--text); font-size: 1em; line-height: 1.4; white-space: pre-wrap;
  padding: 2px 10px;
}
.profile-callout-copy.is-warning { border-left-color: var(--away); }
.profile-callout-copy.is-empty { color: var(--text-dim); }
.settings-form select {
  display: block; width: 100%; margin-top: 6px;
  background: var(--rail); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px 10px;
}
.settings-form .settings-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); font-weight: 600;
}
.settings-form .settings-check input { width: auto; margin: 0; }
.settings-form input[type="color"] { width: 48px; height: 32px; padding: 2px; }
.profile-friend-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; min-width: 0; }
.profile-friend-row .avatar-dot {
  width: var(--profile-friend-icon, 28px);
  height: var(--profile-friend-icon, 28px);
  font-size: calc(var(--profile-friend-icon, 28px) * 0.4);
}
.profile-friend-name {
  min-width: 0;
  font-size: var(--profile-friend-text, 13px);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-tile.is-editing { outline: 2px solid var(--accent); cursor: grab; user-select: none; }
.profile-tile.is-editing textarea,
.profile-tile.is-editing input.profile-spoiler-title { pointer-events: none; cursor: inherit; }
.profile-tile.is-typing { cursor: text; }
.profile-tile.is-typing textarea,
.profile-tile.is-typing input.profile-spoiler-title { pointer-events: auto; cursor: text; }
.profile-tile.allows-overlap.is-editing { outline-style: dashed; }
.profile-tile.is-ghost { opacity: 0.45; }
.profile-resize {
  position: absolute; right: 4px; bottom: 4px; z-index: 6; width: 12px; height: 12px;
  border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  cursor: nwse-resize;
}
.profile-tile.is-button {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 8px;
}
.profile-action-btn {
  width: 100%;
  min-height: 100%;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: var(--profile-text-size, 14pt);
  font-weight: 800;
  cursor: pointer;
  padding: 8px 12px;
}
.profile-tile[data-text-align="left"] .profile-action-btn { text-align: left; }
.profile-tile[data-text-align="center"] .profile-action-btn { text-align: center; }
.profile-tile[data-text-align="right"] .profile-action-btn { text-align: right; }
.profile-action-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.profile-tile.is-editing .profile-action-btn,
.profile-tile.is-opt-preview .profile-action-btn {
  pointer-events: none;
  cursor: inherit;
}
.profile-placeholder-note {
  font-size: 13px; color: var(--text-dim); line-height: 1.4;
}
.profile-tile.is-steam_profile,
.profile-tile.is-steam_playing_now,
.profile-tile.is-steam_recently_played,
.profile-tile.is-steam_library,
.profile-tile.is-steam_achievements,
.profile-tile.is-steam_badges {
  display: flex; flex-direction: column; align-items: stretch; overflow: hidden;
}
.profile-tile[data-title-align="left"] > .profile-tile-head { text-align: left; }
.profile-tile[data-title-align="center"] > .profile-tile-head { text-align: center; }
.profile-tile[data-title-align="right"] > .profile-tile-head { text-align: right; }
.profile-tile.is-steam_profile > .steam-profile-card,
.profile-tile.is-steam_playing_now > .steam-playing-card,
.profile-tile.is-steam_recently_played > .steam-recent-card,
.profile-tile.is-steam_library > .steam-recent-card,
.profile-tile.is-steam_achievements > .steam-recent-card,
.profile-tile.is-steam_badges > .steam-recent-card {
  flex: 1 1 auto; min-height: 0; height: 0;
}
.steam-profile-card {
  height: 100%; min-height: 0; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; overflow: hidden;
}
.steam-profile-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.steam-profile-face { position: relative; width: 64px; height: 64px; flex: 0 0 auto; }
.steam-profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block;
  background: var(--panel);
}
.steam-profile-level {
  position: absolute; right: -4px; bottom: -4px;
  min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 22px; text-align: center;
}
.steam-profile-level.is-alone { position: static; }
.steam-profile-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.steam-profile-name {
  font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.steam-profile-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-dim); }
.steam-profile-status-text { min-width: 0; }
.steam-profile-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex: 0 0 auto; }
.steam-profile-dot.is-online { background: var(--online); }
.steam-profile-link {
  font-size: 12px; color: var(--text-dim); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.steam-profile-link:hover { color: var(--text); }
.steam-profile-lines { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.steam-profile-xp { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.steam-profile-xp-track { height: 6px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.steam-profile-xp-fill { height: 100%; background: var(--accent); }
.steam-profile-xp-text { font-size: 12px; color: var(--text-dim); }
.steam-profile-note {
  flex: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.4; padding: 8px;
}
.profile-tile.is-steam_playing_now { overflow: hidden; }
.steam-playing-card {
  height: 100%; min-height: 0; box-sizing: border-box;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; overflow: hidden;
}
.steam-playing-frame {
  flex: 0 1 auto; align-self: stretch; height: 100%; width: auto; max-width: 34%;
  aspect-ratio: 2 / 3; min-width: 0; min-height: 0; overflow: hidden; border-radius: 4px;
  background: var(--panel);
}
.steam-playing-art {
  width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block;
}
.steam-playing-copy { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.steam-playing-name {
  font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.2;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.steam-playing-time { font-size: 12px; color: var(--text-dim); }
.profile-tile.is-steam_recently_played > .profile-tile-head,
.profile-tile.is-steam_library > .profile-tile-head,
.profile-tile.is-steam_achievements > .profile-tile-head,
.profile-tile.is-steam_badges > .profile-tile-head {
  height: 28px; box-sizing: border-box; padding: 8px 12px 0; line-height: 20px;
}
.profile-tile.is-steam_recently_played > .profile-text-rule,
.profile-tile.is-steam_library > .profile-text-rule,
.profile-tile.is-steam_achievements > .profile-text-rule,
.profile-tile.is-steam_badges > .profile-text-rule {
  height: 1px; margin: 6px 12px 7px;
}
.steam-recent-card {
  height: 100%; min-height: 0; box-sizing: border-box;
  display: flex; flex-direction: column; overflow: hidden;
}
.steam-recent-flow {
  flex: 1 1 auto; min-height: 0; height: 0; box-sizing: border-box;
  display: flex; flex-wrap: wrap; align-content: flex-start; align-items: flex-start;
  gap: 8px; padding: 0 12px; overflow: hidden;
}
.steam-recent-flow.is-note {
  align-items: center; justify-content: center; align-content: center;
}
.steam-recent-flow.is-note > .steam-profile-note { flex: 0 1 auto; width: auto; }
.steam-recent-entry {
  flex: 0 0 auto; display: flex; align-items: stretch; gap: 8px;
  min-width: 0; overflow: hidden; box-sizing: border-box;
}
.steam-recent-icon {
  height: 100%; aspect-ratio: 1; flex: 0 0 auto; border-radius: 4px;
  background: var(--panel); overflow: hidden;
}
.steam-recent-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.steam-recent-copy {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 2px; overflow: hidden;
}
.steam-recent-name,
.steam-recent-time {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.steam-recent-name {
  font-size: calc(var(--profile-text-size, 14pt) * 0.72 * var(--steam-entry-scale, 1));
  font-weight: 800; color: var(--text); line-height: 1.15;
}
.steam-recent-time {
  font-size: calc(var(--profile-text-size, 14pt) * 0.58 * var(--steam-entry-scale, 1));
  color: var(--text-dim); line-height: 1.15;
}
.profile-tile[data-text-align="left"] .steam-recent-copy { text-align: left; }
.profile-tile[data-text-align="center"] .steam-recent-copy { text-align: center; }
.profile-tile[data-text-align="right"] .steam-recent-copy { text-align: right; }
.profile-tile[data-text-align="justify"] .steam-recent-copy { text-align: justify; }
.steam-recent-pages {
  flex: 0 0 36px; height: 36px; display: flex; align-items: center;
  justify-content: center; gap: 12px;
}
.steam-recent-page-btn {
  width: 24px; height: 24px; padding: 0; border-radius: 4px;
  background: transparent; color: var(--text); font-size: 18px; line-height: 24px;
  cursor: pointer;
}
.steam-recent-page-btn:disabled { opacity: 0.38; cursor: default; }
.steam-recent-page-count {
  min-width: 16px; text-align: center; color: var(--text);
  font-size: 13px; font-weight: 700;
}
.steam-achieve-entry { cursor: pointer; align-items: center; }
.steam-achieve-entry .steam-recent-icon { height: 66.67%; align-self: center; }
.steam-achieve-entry .steam-recent-icon img { object-fit: contain; }
.steam-badge-entry { cursor: pointer; align-items: center; }
.steam-badge-entry .steam-recent-icon img { object-fit: contain; }
.steam-badge-xp {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: calc(var(--profile-text-size, 14pt) * 0.58 * var(--steam-entry-scale, 1));
  color: var(--text-dim); line-height: 1.15;
}
.steam-achieve-desc {
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  font-size: calc(var(--profile-text-size, 14pt) * 0.58 * var(--steam-entry-scale, 1));
  color: var(--text-dim); line-height: 1.2;
}
#steam-achieve-overlay,
#steam-badge-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#steam-achieve-overlay[hidden],
#steam-badge-overlay[hidden] { display: none; }
.steam-achieve-modal {
  width: min(440px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45); overflow: hidden;
}
.steam-achieve-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 12px 14px 16px;
  background: var(--rail); border-bottom: 1px solid var(--border);
}
#steam-achieve-title,
#steam-badge-title {
  min-width: 0; font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.steam-achieve-body {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px 16px; max-height: min(420px, calc(100vh - 120px)); overflow: auto;
}
.steam-achieve-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.steam-achieve-art {
  width: 72px; height: 72px; flex: 0 0 auto; object-fit: contain;
  border-radius: 6px; background: var(--bg);
}
.steam-achieve-facts { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.steam-achieve-game { font-size: 15px; font-weight: 400; color: var(--text); line-height: 1.3; }
.steam-achieve-fact { font-size: 13px; color: var(--text-dim); line-height: 1.35; }
.steam-achieve-detail { font-size: 14px; color: var(--text); line-height: 1.45; }
.steam-achieve-body::-webkit-scrollbar { width: 8px; }
.steam-achieve-body::-webkit-scrollbar-track { background: transparent; }
.steam-achieve-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.profile-tile.is-placeholder {
  opacity: 0.92;
}
.profile-drop-hint {
  pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 10px; background: transparent;
}
.profile-tile.is-divider,
.profile-tile.is-rail,
.profile-tile.is-spacer {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-divider {
  width: calc(100% - 16px);
  border-top: 2px solid var(--border);
}
.profile-divider.is-dashed { border-top-style: dashed; }
.profile-divider.is-dotted { border-top-style: dotted; border-top-width: 3px; }
.profile-divider.is-vertical {
  width: 0;
  height: calc(100% - 16px);
  border-top: none;
  border-left: 2px solid var(--border);
}
.profile-divider.is-vertical.is-dashed { border-left-style: dashed; }
.profile-divider.is-vertical.is-dotted { border-left-style: dotted; border-left-width: 3px; }
.profile-rail {
  flex: 0 0 auto;
  background: var(--profile-rail-color, #ffffff);
  border-radius: 999px;
}
.profile-rail.is-horizontal {
  width: calc(100% - 8px);
  height: var(--profile-rail-thickness, 4px);
}
.profile-rail.is-vertical {
  height: calc(100% - 8px);
  width: var(--profile-rail-thickness, 4px);
}
.profile-rail.is-dashed,
.profile-rail.is-dotted,
.profile-rail.is-double {
  background: transparent;
  border-radius: 0;
}
.profile-rail.is-horizontal.is-dashed,
.profile-rail.is-horizontal.is-dotted,
.profile-rail.is-horizontal.is-double {
  height: 0;
  border-top-width: var(--profile-rail-thickness, 4px);
  border-top-style: dashed;
  border-top-color: var(--profile-rail-color, #ffffff);
}
.profile-rail.is-horizontal.is-dotted { border-top-style: dotted; }
.profile-rail.is-horizontal.is-double { border-top-style: double; }
.profile-rail.is-vertical.is-dashed,
.profile-rail.is-vertical.is-dotted,
.profile-rail.is-vertical.is-double {
  width: 0;
  border-left-width: var(--profile-rail-thickness, 4px);
  border-left-style: dashed;
  border-left-color: var(--profile-rail-color, #ffffff);
}
.profile-rail.is-vertical.is-dotted { border-left-style: dotted; }
.profile-rail.is-vertical.is-double { border-left-style: double; }
.profile-spacer-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-dim);
}
.profile-link-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; color: inherit; text-decoration: none;
  min-width: 0;
}
.profile-link-row .avatar-dot {
  width: var(--profile-link-icon, 24px);
  height: var(--profile-link-icon, 24px);
  font-size: calc(var(--profile-link-icon, 24px) * 0.42);
}
a.profile-link-row:hover { color: var(--accent); }
.profile-link-label {
  min-width: 0;
  font-size: var(--profile-link-text, 13px);
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-form.is-wide { width: 520px; }
.profile-link-editor { max-height: 180px; overflow: auto; margin-bottom: 12px; }
.profile-link-edit-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.profile-link-edit-label {
  font-size: 13px; color: var(--text); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-link-edit-row button {
  flex: 0 0 auto; font-size: 12px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px;
  background: var(--rail); color: var(--text);
}
.profile-link-add {
  margin: 0 0 14px;
  background: var(--panel-alt); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 6px;
}
.profile-opt {
  width: min(960px, calc(100% - 48px));
  height: min(640px, calc(100% - 48px));
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 52px;
  background: var(--panel);
  border: 1px solid var(--accent-submenu);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.profile-opt-top {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--rail);
}
.profile-opt-name {
  font-size: 15px; font-weight: 800; color: var(--text);
}
.profile-opt-split { color: var(--text-dim); font-weight: 700; }
.profile-opt-tabs { display: flex; gap: 4px; }
.profile-opt-tabs button {
  background: transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 6px;
}
.profile-opt-tabs button:hover { color: var(--text); background: var(--panel-alt); }
.profile-opt-tabs button.is-on { color: var(--text); background: var(--panel-alt); }
.profile-opt-close {
  margin-left: auto;
  background: transparent; color: var(--text-dim);
  font-size: 22px; line-height: 1; padding: 4px 10px; border-radius: 6px;
}
.profile-opt-close:hover { color: var(--text); background: var(--panel-alt); }
.profile-opt-main {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0;
}
.profile-opt-left {
  overflow: auto; padding: 16px 18px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.profile-opt-left label {
  display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 12px;
}
.profile-opt-left label[hidden] { display: none; }
.profile-opt-left .toggle-switch { display: inline-block; margin: 0; font-weight: 400; color: inherit; }
.profile-opt-left > .profile-name-opt,
.profile-opt-left > .profile-design-rule {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.profile-name-opt .settings-opt { border-bottom: none; padding-bottom: 8px; }
.profile-name-opt .profile-opt-border-extras.is-open { padding-top: 0; }
.profile-opt-left input:not([type="checkbox"]):not([type="range"]):not([type="color"]), .profile-opt-left select {
  display: block; width: 100%; margin-top: 6px;
  background: var(--rail); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 14px; padding: 9px 10px;
}
.profile-meter-editor { margin-bottom: 8px; }
.profile-meter-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.profile-opt-left .profile-meter-edit input {
  width: auto;
  margin-top: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.profile-opt-left .profile-meter-edit input.profile-meter-threshold {
  flex: 0 0 88px;
  width: 88px;
}
.profile-meter-edit button {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--rail);
  color: var(--text);
}
.profile-meter-add:disabled { opacity: 0.45; }
.profile-opt-border-extras { display: none; padding: 0 0 8px; }
.profile-opt-border-extras.is-open { display: block; }
.profile-opt-server-picks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 4px 0 8px;
}
.profile-opt-server-picks .settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-opt-border-block {
  border-bottom: 1px solid var(--border);
  padding: 4px 0 2px;
}
.profile-opt-border-block .settings-opt { border-bottom: none; }
.profile-opt-mode-extras .settings-opt { border-bottom: none; padding: 10px 0; }
.profile-opt-slider-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.profile-opt-slider-row .settings-slider { flex: 1 1 auto; width: auto; }
.profile-opt-slider-val {
  flex: 0 0 1.6em; font-size: 13px; font-weight: 700; color: var(--text); text-align: right;
}
.profile-opt-left .profile-opt-z-input {
  width: 72px;
  margin-top: 0;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
}
.profile-opt-left .profile-opt-z-input::-webkit-outer-spin-button,
.profile-opt-left .profile-opt-z-input::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}
.profile-opt-color-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.profile-opt-color-row input[type="color"] {
  width: 36px; height: 32px; padding: 0; border: 1px solid var(--border);
  border-radius: 6px; background: transparent; flex: 0 0 auto;
}
.profile-opt-color-row input[type="text"] { margin-top: 0; flex: 1 1 auto; }
.profile-opt-preview {
  overflow: hidden;
  padding: 40px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 0;
}
.profile-opt-preview-stage {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}
.profile-opt-preview .profile-tile.is-opt-preview {
  position: absolute;
  left: 0; top: 0;
}
.profile-opt-bottom {
  display: grid; grid-template-columns: 110px 1fr 110px;
  align-items: center; gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: var(--rail);
}
.profile-opt-bottom > button {
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-weight: 600; padding: 7px 14px;
}
.profile-opt-bottom .settings-form-save { justify-self: end; }
.profile-opt-hint {
  font-size: 12px; color: var(--text-dim); line-height: 1.35;
  text-align: center; min-height: 16px;
}
.profile-opt-empty { font-size: 13px; color: var(--text-dim); }
.profile-opt-field-label {
  font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 8px;
}
.profile-opt-seg { display: flex; gap: 6px; margin-bottom: 14px; }
.profile-opt-seg button {
  background: var(--panel-alt); color: var(--text-dim);
  font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 6px;
}
.profile-opt-seg button.is-on { background: var(--accent); color: #fff; }
.profile-opt-align { margin-top: 8px; }

.profile-opt.feedback-opt {
  width: min(480px, calc(100% - 48px));
  height: auto;
  max-height: min(640px, calc(100% - 48px));
  grid-template-rows: 48px auto 52px;
}
.feedback-opt-main {
  overflow: auto;
  padding: 16px 18px;
  min-width: 0;
}
.feedback-opt-main label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.feedback-opt-main select,
.feedback-opt-main textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--rail);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 10px;
}
.feedback-opt-main textarea {
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  min-height: calc(1.4em * 3);
  max-height: calc(1.4em * 8);
}
.feedback-media-row { margin-bottom: 0; }
.feedback-media-strip {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.feedback-media-row.has-files .feedback-media-strip {
  display: flex;
}
.feedback-media-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--rail);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px 6px 10px;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
}
.feedback-media-chip button {
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
}
.feedback-media-chip button:hover { color: var(--text); }
.feedback-sent {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 28px 8px;
  text-align: center;
}
.feedback-opt .profile-opt-bottom.is-sent {
  grid-template-columns: 1fr;
}
.feedback-opt .profile-opt-bottom.is-sent > button[hidden],
.feedback-opt .profile-opt-bottom.is-sent .profile-opt-hint {
  display: none;
}
.feedback-opt .profile-opt-bottom.is-sent .settings-form-save {
  justify-self: center;
}

.profile-tile.is-comments {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.profile-tile.is-editing.is-comments {
  user-select: none;
}
.profile-tile.is-editing.is-comments .oneira-wall {
  pointer-events: none;
}
.profile-tile.is-editing.is-comments .oneira-wall-input,
.profile-tile.is-editing.is-comments .oneira-wall-edit,
.profile-tile.is-editing.is-comments .oneira-wall-pager,
.profile-tile.is-editing.is-comments .oneira-wall-notify {
  pointer-events: auto;
}
.oneira-wall {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 10px 12px 8px;
  box-sizing: border-box;
}
.oneira-wall-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}
.oneira-wall-title {
  font-size: calc(var(--profile-text-size, 14pt) * 1.05);
  font-weight: 700;
  color: var(--text);
}
.profile-tile.is-comments[data-text-align="center"] .oneira-wall-title { text-align: center; }
.profile-tile.is-comments[data-text-align="right"] .oneira-wall-title { text-align: right; }
.oneira-wall-rule {
  flex: 0 0 auto;
  height: 0;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}
.oneira-wall-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}
.oneira-wall-pager[hidden] { display: none; }
.oneira-wall-pager button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}
.oneira-wall-pager button:disabled { opacity: 0.35; }
.oneira-wall-page { font-size: 12px; font-weight: 700; color: var(--text-dim); min-width: 1em; text-align: center; }
.oneira-wall-compose { flex: 0 0 auto; margin-bottom: 10px; }
.oneira-wall-input,
.oneira-wall-edit {
  display: block;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  background: var(--rail);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.oneira-wall-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.oneira-wall-empty {
  flex: 1 1 auto;
  color: var(--text-dim);
  font-size: calc(var(--profile-text-size, 14pt) * 0.92);
  padding: 12px 0;
}
.oneira-wall-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.oneira-wall-row:last-child { border-bottom: 0; }
.oneira-wall-avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.oneira-wall-body { min-width: 0; flex: 1 1 auto; }
.oneira-wall-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
}
.profile-tile.is-comments[data-text-align="center"] .oneira-wall-text,
.profile-tile.is-comments[data-text-align="center"] .oneira-wall-meta { justify-content: center; text-align: center; }
.profile-tile.is-comments[data-text-align="right"] .oneira-wall-text,
.profile-tile.is-comments[data-text-align="right"] .oneira-wall-meta { justify-content: flex-end; text-align: right; }
.oneira-wall-name { font-weight: 700; font-size: var(--profile-text-size, 14pt); color: var(--text); }
.oneira-wall-time { font-size: calc(var(--profile-text-size, 14pt) * 0.85); color: var(--text-dim); }
.oneira-wall-text {
  font-size: var(--profile-text-size, 14pt);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}
.oneira-wall-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 22px;
}
.oneira-wall-notify {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: calc(var(--profile-text-size, 14pt) * 0.85);
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.oneira-wall-notify[hidden] { display: none; }
.oneira-wall-notify input {
  margin: 0;
  width: 14px;
  height: 14px;
}

/* ---- Server Settings overlay ---- */
#server-settings-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 52px;
  z-index: 80;
  display: flex;
  min-height: 0;
  background: var(--bg);
}
#server-settings-overlay[hidden] { display: none !important; }

#server-settings-index {
  flex: 0 0 220px;
  width: 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 10px 18px;
  background: var(--rail);
  border-right: 1px solid var(--border);
}
#server-settings-index-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#server-settings-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.server-settings-nav-item {
  width: 100%;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
}
.server-settings-nav-item:hover,
.server-settings-nav-item.active {
  background: var(--panel-alt);
  color: var(--text);
}
.server-settings-nav-item.is-later,
.server-settings-nav-item:disabled {
  opacity: 0.4;
  cursor: default;
  color: var(--text-dim);
}
.server-settings-nav-item.is-later:hover,
.server-settings-nav-item:disabled:hover {
  background: transparent;
  color: var(--text-dim);
}
.server-settings-nav-item.is-danger {
  color: var(--danger);
  margin-top: 10px;
  opacity: 1;
}
.server-settings-nav-item.is-danger.is-later,
.server-settings-nav-item.is-danger:disabled {
  opacity: 0.45;
  color: var(--danger);
}

#server-settings-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}
#server-settings-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 40px;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
#server-settings-close span:first-child {
  width: 36px;
  height: 36px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
}
#server-settings-close:hover { color: var(--text); }
#server-settings-close:hover span:first-child { border-color: var(--text); }

#server-settings-page,
.server-settings-page {
  width: 100%;
  max-width: 640px;
  padding: 28px 36px 64px;
}
.server-settings-page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 28px;
}
.server-settings-field { margin: 0 0 28px; }
.server-settings-field-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.server-settings-help {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.server-settings-input {
  display: block;
  width: 100%;
  background: var(--rail);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 10px;
}
.server-settings-input:disabled { opacity: 0.7; cursor: default; }
.server-settings-textarea {
  min-height: 96px;
  resize: none;
  overflow: hidden;
  field-sizing: content;
}
.server-settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.server-settings-avatar {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  flex: 0 0 80px;
  overflow: hidden;
}
.server-settings-avatar.has-icon #server-settings-avatar-letter { display: none; }
.server-settings-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.server-settings-banner {
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1920 / 300;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.server-settings-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.server-settings-banner-color-row {
  margin-top: 10px;
}
.server-settings-name-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.server-settings-name-actions:not([hidden]) { display: flex; }
.server-settings-url-row {
  display: flex;
  align-items: stretch;
  max-width: 560px;
}
.server-settings-url-prefix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  background: var(--panel-alt);
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
}
.server-settings-url-row .server-settings-input {
  border-radius: 0 6px 6px 0;
}
.server-settings-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.server-settings-split .settings-select { width: 100%; }
.server-settings-select { width: 100%; max-width: 560px; }
.server-settings-later {
  opacity: 0.45;
  pointer-events: none;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ---- Server Settings Roles ---- */
.server-roles-page {
  display: grid;
  grid-template-columns: auto;
  align-items: start;
  gap: 24px;
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 52px);
  box-sizing: border-box;
  padding: 28px 72px 64px 36px;
}
#server-settings-overview[hidden],
#server-settings-roles[hidden],
#server-settings-members[hidden],
#server-settings-invites[hidden],
#server-settings-bans[hidden],
#server-settings-privacy[hidden],
.server-roles-page[hidden],
.server-members-page[hidden],
.server-invites-page[hidden],
.server-bans-page[hidden],
.server-emojis-page[hidden] {
  display: none;
}
.server-roles-page:has(#server-roles-review:not([hidden])) {
  grid-template-columns: auto minmax(280px, 1fr);
}
.server-roles-main {
  width: max-content;
  max-width: 100%;
  min-width: 0;
}
.server-roles-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
.server-roles-rail {
  flex: 0 0 220px;
  width: 220px;
  position: sticky;
  top: 28px;
}
.server-roles-add {
  width: 100%;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}
.server-roles-add:hover { background: var(--panel-alt); }
.server-roles-add:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.server-roles-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  margin-bottom: 12px;
}
.server-role-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
}
.server-role-item:hover,
.server-role-item.is-on { background: var(--panel-alt); }
.server-role-item.is-locked { opacity: 0.55; }
.server-role-item[draggable="true"] { cursor: grab; }
.server-role-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-role-dirty {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  pointer-events: none;
}
.server-roles-editor { flex: 1 1 auto; min-width: 0; max-width: 560px; }
#server-roles-review:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  position: sticky;
  top: 28px;
  width: 100%;
  min-width: 0;
  height: calc(100vh - 108px);
  background: transparent;
  border: none;
  padding: 0;
}
.server-roles-review-card {
  width: 280px;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 16px;
}
.server-roles-review-card > .server-settings-field-title {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.server-roles-review-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.server-roles-review-role { margin: 0; }
.server-roles-review-role + .server-roles-review-role {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.server-roles-review-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 17px;
  font-weight: 800;
  padding: 6px 0;
}
.server-roles-review-head-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 800;
}
.server-roles-review-caret {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
}
.server-roles-review-list { display: flex; flex-direction: column; gap: 8px; }
.server-roles-review-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.server-roles-review-copy { flex: 1 1 auto; min-width: 0; }
.server-roles-review-label { font-size: 12px; font-weight: 700; color: var(--text); }
.server-roles-review-diff {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.server-role-change-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--border);
}
.server-roles-review-row .ghost-btn {
  flex: 0 0 auto;
  padding: 4px 10px;
}
.server-roles-review-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.server-roles-seg { margin: 8px 0 12px; width: fit-content; }
.server-roles-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.server-role-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  background: var(--swatch, var(--panel-alt));
  box-sizing: border-box;
}
.server-role-swatch.is-on {
  border-color: var(--text);
  outline: 2px solid var(--bg);
  outline-offset: -4px;
}
.server-role-swatch-custom {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px dashed var(--text-dim);
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.server-role-swatch-custom:hover { border-color: var(--text); color: var(--text); }
.server-role-swatch-custom.is-on {
  border-style: solid;
  border-color: var(--text);
  color: transparent;
}
.server-roles-bulk { display: flex; gap: 8px; margin: 8px 0 18px; }
.server-roles-group { margin: 0 0 22px; }
.server-roles-group-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.server-roles-editor .settings-opt { padding: 12px 0; }
.server-roles-editor .settings-opt.is-later { opacity: 0.55; }
.server-roles-editor .settings-opt-title { font-size: 15px; }
.server-roles-editor .settings-opt-desc { font-size: 13px; }

/* Mini Profile — Guilded card shell. Placement will move after this
   first pass; keep the look (banner, overlapping avatar, section
   labels, + / pills, note box) and the stated Oneira moves. */
.mini-profile-card {
  width: 300px;
  overflow: auto;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
#mini-profile {
  position: fixed;
  z-index: 900;
  max-height: calc(100vh - 16px);
}
.mini-profile-card.is-page {
  position: relative;
  flex: 0 0 auto;
}
#mini-profile[hidden],
#mini-profile-role-picker[hidden] { display: none !important; }
.mini-profile-banner {
  position: relative;
  overflow: hidden;
  height: 88px;
  border-radius: 8px 8px 0 0;
}
.mini-profile-identity {
  position: relative;
  padding: 0 16px 12px;
}
.mini-profile-face {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -36px;
}
.mini-profile-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 8px;
}
.mini-profile-avatar {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3b3e4a;
  border: 6px solid var(--panel-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  color: #cfd1e0;
}
.mini-profile-avatar .status-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 4px solid var(--panel-alt);
  right: 0;
  bottom: 0;
  z-index: 2;
}
.mini-profile-highest {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}
.mini-profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.mini-profile-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-profile-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mini-profile-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mini-profile-icon-btn:hover { color: var(--text); background: var(--border); }
.mini-profile-icon-btn svg { width: 16px; height: 16px; display: block; }
.mini-profile-status {
  align-self: flex-start;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  background: var(--panel);
  border-radius: 12px;
  padding: 6px 10px;
}
.mini-profile-pronouns {
  font-size: 12px;
  color: var(--text-dim);
}
.mini-profile-status.is-empty,
.mini-profile-pronouns.is-empty,
.mini-profile-about.is-empty {
  color: var(--text-dim);
  font-style: italic;
}
.mini-profile-about {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.35;
  white-space: pre-wrap;
  border-radius: 6px;
  padding: 2px 0;
}
.mini-profile-card.is-editing .is-mini-edit {
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
  cursor: pointer;
}
.mini-profile-card.is-editing .mini-profile-banner.is-mini-edit {
  outline-offset: -3px;
}
.mini-profile-card.is-editing .mini-profile-about.is-empty {
  min-height: 36px;
  padding: 8px;
}
.mini-profile-bio-edit {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0;
}
.mini-profile-widgets {
  padding: 0 16px 16px;
}
.mini-profile-section-split {
  height: 0;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0 0 12px;
}
.mini-profile-widget-add {
  width: 100%;
  height: 72px;
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  padding: 0;
}
.mini-profile-widget-add:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}
.mini-profile-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.mini-profile-roles,
.mini-profile-footer { padding: 4px 16px 16px; }
.mini-profile-role-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mini-profile-role-add {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.mini-profile-role-add:hover { background: var(--panel); }
.mini-profile-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12px;
  font-weight: 600;
}
.mini-profile-role-pill.is-removable { cursor: pointer; }
.mini-profile-role-pill.is-removable:hover { background: var(--border); }
.mini-profile-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #99aab5;
  flex: 0 0 auto;
}
.mini-profile-role-more {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}
.mini-profile-role-more:hover { color: var(--text); }
.mini-profile-note {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: transparent;
  border: 1px solid var(--text);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.mini-profile-note:focus { outline: none; border-color: var(--accent); }
.mini-profile-edit-btn { width: 100%; margin-top: 8px; }
.mini-profile-footer .mini-profile-edit-btn:first-child { margin-top: 0; }
#mini-profile-role-picker {
  position: fixed;
  z-index: 950;
  min-width: 180px;
  max-height: 240px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}
.mini-profile-role-pick {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
}
.mini-profile-role-pick:hover { background: var(--panel-alt); }
.is-mini-profile-target { cursor: pointer; }
.cluster-avatar.is-mini-profile-target,
.cluster-name.is-mini-profile-target { cursor: pointer; }

.face-letter { position: relative; z-index: 1; }
.identity-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.identity-media.is-circle { border-radius: 50%; }
.identity-media img {
  position: absolute;
  max-width: none;
  max-height: none;
  display: block;
  pointer-events: none;
  user-select: none;
}
.identity-opt-preview {
  position: relative;
  overflow: hidden;
  background: var(--rail);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 0;
}
.identity-opt-preview.is-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
}
.identity-opt-preview.is-banner {
  width: 100%;
  height: 72px;
  border-radius: 8px;
}
.identity-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.identity-picker,
.identity-cropper {
  width: min(520px, calc(100% - 32px));
  background: var(--panel);
  border: 1px solid var(--accent-submenu);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.identity-picker h3,
.identity-cropper h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 14px;
}
.identity-picker-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.identity-picker-actions button {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel-alt);
  color: var(--text);
}
.identity-picker-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.identity-recents-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.identity-recents-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.identity-recent {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--rail);
  border: 1px dashed var(--border);
  padding: 0;
}
.identity-recent img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.identity-recent.is-empty { pointer-events: none; }
.identity-picker-cancel {
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
}
.identity-crop-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.4;
}
.identity-crop-stage {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.identity-crop-frame {
  position: relative;
  overflow: hidden;
  background: #111;
  cursor: grab;
  touch-action: none;
}
.identity-crop-frame.is-circle { border-radius: 50%; }
.identity-crop-frame.is-banner { border-radius: 8px; }
.identity-crop-frame:active { cursor: grabbing; }
.identity-crop-frame img {
  position: absolute;
  max-width: none;
  max-height: none;
  display: block;
  pointer-events: none;
  user-select: none;
}
.identity-crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.identity-crop-zoom input { flex: 1; }
.identity-crop-tools { margin-bottom: 16px; }
.identity-crop-tools button,
.identity-crop-actions button {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel-alt);
  color: var(--text);
}
.identity-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
#account-footer .avatar-dot .identity-media {
  border-radius: 50%;
}

/* ---- Server Settings Members roster ---- */
.server-members-page {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 52px);
  box-sizing: border-box;
  padding: 28px 36px 64px;
}
.server-members-channel-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}
.server-members-channel-list-copy .server-settings-field-title { margin-bottom: 4px; }
.server-members-channel-list-copy .server-settings-help { margin: 0; }
.server-members-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.server-members-toolbar-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: auto;
}
.server-members-search {
  flex: 0 1 260px;
  max-width: 280px;
  margin: 0;
}
.server-members-toolbar-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.server-members-toolbar-btn.is-danger-text {
  color: #f87171;
}
.server-members-bulk-kick {
  margin-left: 0;
}
.server-members-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}
.server-members-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
.server-members-table th,
.server-members-table td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.server-members-table thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--rail);
  white-space: nowrap;
}
.server-members-sort-head {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.server-members-sort-head:hover,
.server-members-sort-head.is-active {
  color: var(--text);
}
.server-members-table tbody tr:last-child td { border-bottom: none; }
.server-members-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.server-members-col-check { width: 36px; }
.server-members-col-user { min-width: 200px; }
.server-members-col-joined,
.server-members-col-account,
.server-members-col-method {
  width: 132px;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 13px;
}
.server-members-col-roles { min-width: 140px; }
.server-members-col-actions { width: 72px; white-space: nowrap; }
.server-members-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.server-members-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}
.server-members-user-labels {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}
.server-members-display {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-members-owner { color: var(--accent); font-size: 12px; }
.server-members-username {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-members-roles {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}
.server-members-roles.is-empty { min-height: 0; }
.server-members-role-pill {
  display: inline-flex;
  align-items: center;
  max-width: 140px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--role-color, var(--border)) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--role-color, var(--border)) 45%, transparent);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-members-role-more {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}
.server-members-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.server-members-icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.server-members-icon-btn:hover:not(:disabled) {
  background: var(--rail);
  color: var(--text);
}
.server-members-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.server-members-mod-icon {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  position: relative;
  display: block;
}
.server-members-mod-icon::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 7px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: var(--panel-alt);
  box-sizing: border-box;
}
#server-members-empty,
#server-members-status {
  margin-top: 12px;
}

/* ---- Server Settings Invites ---- */
.server-invites-page {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 52px);
  box-sizing: border-box;
  padding: 28px 36px 64px;
}
.server-invites-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.server-invites-toolbar-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: auto;
}
.server-invites-pause {
  color: #f87171;
  border: 1px solid color-mix(in srgb, #f87171 55%, transparent);
}
.server-invites-pause:disabled {
  opacity: 0.45;
  cursor: default;
}
.server-invites-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}
.server-invites-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.server-invites-table th,
.server-invites-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.server-invites-table thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--rail);
  white-space: nowrap;
}
.server-invites-table tbody tr:last-child td { border-bottom: none; }
.server-invites-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.server-invites-col-inviter { min-width: 200px; }
.server-invites-col-code { font-variant-numeric: tabular-nums; white-space: nowrap; }
.server-invites-col-uses,
.server-invites-col-expires {
  width: 100px;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 13px;
}
.server-invites-col-roles { min-width: 120px; }
.server-invites-inviter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.server-invites-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}
.server-invites-inviter-labels {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}
.server-invites-inviter-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-invites-inviter-channel {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#server-invites-empty,
#server-invites-status {
  margin-top: 12px;
}

/* ---- Server Settings Bans ---- */
.server-bans-page {
  width: 100%;
  max-width: 920px;
  min-height: calc(100vh - 52px);
  box-sizing: border-box;
  padding: 28px 36px 64px;
}
.server-bans-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}
.server-bans-search {
  flex: 1 1 280px;
  max-width: 420px;
  margin: 0;
}
.server-bans-list-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
  min-height: 200px;
  padding: 10px;
}
.server-bans-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.server-bans-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--rail);
  border: 1px solid var(--border);
}
.server-bans-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex: 1 1 180px;
}
.server-bans-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}
.server-bans-who-labels {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}
.server-bans-display {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-bans-username {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-bans-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  flex: 2 1 360px;
}
.server-bans-meta-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
  max-width: 200px;
}
.server-bans-meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.server-bans-meta-value {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#server-bans-empty,
#server-bans-status {
  margin-top: 12px;
}

/* ---- Server Settings Privacy ---- */
.server-privacy-page {
  max-width: 640px;
}
.server-privacy-mode-list .server-privacy-option {
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.server-privacy-mode-list .server-privacy-option:last-child {
  border-bottom: none;
}
.server-privacy-option-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.server-privacy-option-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.server-privacy-option-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
}
.server-privacy-discover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}
.server-privacy-discover-copy .server-settings-field-title { margin-bottom: 4px; }
.server-privacy-discover-copy .server-settings-help { margin: 0; }
#server-privacy-status { margin-top: 12px; }

/* ---- Server Settings Emojis (Guilded-like) ---- */
.server-emojis-page {
  width: 100%;
  max-width: 920px;
  min-height: calc(100vh - 52px);
  box-sizing: border-box;
  padding: 28px 36px 64px;
}
.server-emojis-upload {
  margin: 4px 0 10px;
  border-color: var(--accent);
  color: var(--accent);
}
.server-emojis-upload:disabled {
  opacity: 0.45;
  cursor: default;
}
.server-emojis-pack-note.is-muted {
  opacity: 0.55;
  margin-top: -4px;
}
.server-emojis-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
}
.server-emojis-search {
  flex: 1 1 240px;
  max-width: 360px;
  margin: 0;
}
.server-emojis-count {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.server-emojis-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
  overflow: hidden;
}
.server-emojis-table {
  width: 100%;
  border-collapse: collapse;
}
.server-emojis-table th,
.server-emojis-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.server-emojis-table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.server-emojis-table tbody tr:last-child td { border-bottom: none; }
.server-emojis-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.server-emojis-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.server-emojis-preview {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}
.server-emojis-name-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-emojis-name-btn:hover { text-decoration: underline; }
.server-emojis-uploader {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.server-emojis-avatar {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.server-emojis-uploader-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-emojis-col-at {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.server-emojis-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.server-emojis-delete {
  font-size: 13px;
  padding: 4px 10px;
}
#server-emojis-empty,
#server-emojis-status {
  margin-top: 12px;
}

.server-integrations-page {
  max-width: 720px;
}

.server-integrations-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.server-integrations-section:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.server-integrations-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.server-integrations-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.server-integrations-section-head .ghost-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.server-integrations-list:empty {
  display: none;
}

.server-integrations-list:not(:empty) + .server-settings-help {
  display: none;
}







.server-audit-page { max-width: 960px; }
.server-audit-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
}
.server-audit-search { flex: 1 1 auto; min-width: 0; max-width: 420px; }
#server-audit-filter-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.server-audit-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}
.server-audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.server-audit-table th,
.server-audit-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.server-audit-table thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--rail);
  white-space: nowrap;
}
.server-audit-table tbody tr:last-child td { border-bottom: none; }
.server-audit-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.server-audit-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.server-audit-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  font-size: 12px;
}
.server-audit-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-audit-col-action { white-space: nowrap; }
.server-audit-col-details {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}
.server-audit-col-when {
  white-space: nowrap;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
#server-audit-empty,
#server-audit-status { margin-top: 12px; }

#delete-server-overlay,
#delete-account-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#delete-server-overlay[hidden],
#delete-account-overlay[hidden] { display: none; }
#delete-server-modal,
#delete-account-modal,
.delete-server-modal {
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.delete-server-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}
#delete-server-title,
#delete-account-title,
.delete-danger-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
}
.delete-server-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 8px;
}
.delete-server-copy {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.45;
}
.delete-server-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}
.delete-server-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.delete-server-input:focus {
  outline: none;
  border-color: var(--accent);
}
.delete-server-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 16px 16px;
}
#delete-server-error,
#delete-account-error {
  margin: 0 auto 0 0;
  flex: 1 1 100%;
  color: var(--danger);
}

#feed-alert-prefs-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
#feed-alert-prefs-overlay[hidden] { display: none; }
.feed-prefs-modal {
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--accent-submenu);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.feed-prefs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
  flex: 0 0 auto;
}
.feed-prefs-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.feed-prefs-copy {
  margin: 8px 16px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.feed-prefs-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.feed-prefs-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.feed-prefs-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin: 0 0 6px;
}
.feed-prefs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.feed-prefs-section .feed-prefs-row:last-child { border-bottom: none; }
.feed-prefs-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.feed-prefs-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 16px 16px;
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
}
#feed-alert-prefs-error {
  margin: 0 auto 0 0;
  flex: 1 1 100%;
  color: var(--danger);
}
.settings-feed-prefs-btn { min-width: 140px; }

#pins-panel {
  position: absolute;
  top: 56px;
  right: 16px;
  width: min(420px, calc(100% - 32px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 40;
  overflow: hidden;
}
#pins-panel[hidden] { display: none !important; }
.pins-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.pins-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.pins-panel-pin-icon { font-size: 13px; }
.pins-panel-close {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.pins-panel-close:hover { color: var(--text); background: var(--panel-alt); }
.pins-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}
.pins-panel-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
}
.pins-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}
.pins-page-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.pin-row {
  position: relative;
  padding: 10px 10px 8px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.pin-row:last-child { border-bottom: none; }
.pin-row:hover { background: var(--panel-alt); }
.pin-row-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.pin-row:hover .pin-row-actions { display: flex; }
.pin-row-jump,
.pin-row-unpin {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
}
.pin-row-unpin {
  padding: 2px 7px;
  font-size: 14px;
  line-height: 1;
}
.pin-row-jump:hover,
.pin-row-unpin:hover { background: var(--panel-alt); }
.pin-row-message { pointer-events: none; }
.pin-row-message .msg-cluster { margin: 0; }
.pin-jump-flash {
  animation: pin-jump-flash 1.4s ease;
}
@keyframes pin-jump-flash {
  0% { background: color-mix(in srgb, var(--accent) 28%, transparent); }
  100% { background: transparent; }
}

#voice-user-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 8px 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-alt);
  position: relative;
}
#voice-user-card[hidden] { display: none; }
.voice-user-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.voice-user-copy { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.voice-user-status,
.voice-user-where { white-space: nowrap; overflow: hidden; line-height: 1.15; }
.voice-user-status { color: #23a559; font-size: 12px; font-weight: 700; }
.voice-user-where { color: var(--text-dim); font-size: 11px; }
.voice-user-signal,
.voice-user-icon,
#account-footer .footer-voice-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.voice-user-signal {
  width: 36px;
  height: 36px;
  border: 2px solid currentColor;
  border-radius: 6px;
  background: var(--panel);
}
.voice-user-signal { cursor: default; }
.voice-user-signal.is-good { color: #23a559; }
.voice-user-signal.is-fair { color: #f0b232; }
.voice-user-signal.is-poor { color: #ed4245; }
.voice-user-signal svg,
.voice-user-icon svg,
.voice-user-tool svg,
.footer-voice-btn svg { width: 20px; height: 20px; display: block; }
.voice-user-icon:hover,
.footer-voice-btn:hover { color: var(--text); background: var(--rail); }
.voice-user-tools { display: flex; align-items: stretch; gap: 8px; }
.voice-user-tool {
  position: relative;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.voice-user-tool:hover { color: var(--text); border-color: var(--text-dim); }
.footer-voice-btn,
.voice-ctrl { position: relative; }
#voice-user-screen.is-live,
#voice-ctrl-screen.is-live,
#chat-call-share.is-live { color: var(--accent); }
#voice-user-screen.is-live { border-color: var(--accent); }
.voice-user-tool.is-off,
.footer-voice-btn.is-off,
.voice-ctrl.is-off,
.call-tool.is-off { color: #ed4245; }
.voice-user-tool.is-off { border-color: #ed4245; }
.voice-user-tool.is-off::after,
.footer-voice-btn.is-off::after,
.voice-ctrl.is-off::after,
.call-tool.is-off::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: rotate(-45deg);
}
#voice-share-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
}
#voice-share-overlay[hidden] { display: none; }
#voice-share-card {
  position: relative;
  width: min(880px, calc(100% - 48px));
  height: min(620px, calc(100% - 48px));
  padding: 16px;
  border-radius: 12px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}
#voice-share-card.is-sources { height: auto; }
#voice-share-card.is-sources .voice-share-grid { display: none; }
.voice-share-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--rail);
}
.voice-share-tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.voice-share-tab svg { width: 18px; height: 18px; flex: 0 0 auto; }
.voice-share-tab.is-on {
  color: var(--text);
  background: var(--panel-alt);
  border-color: var(--border);
}
.voice-share-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
  align-content: start;
  overflow: auto;
  padding: 4px 6px 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.voice-share-grid::-webkit-scrollbar { width: 8px; }
.voice-share-grid::-webkit-scrollbar-track,
.voice-share-grid::-webkit-scrollbar-corner { background: transparent; }
.voice-share-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.voice-share-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.voice-share-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000;
  overflow: hidden;
  border: 2px solid transparent;
  box-sizing: border-box;
}
.voice-share-tile:hover .voice-share-preview { border-color: var(--text-dim); }
.voice-share-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.voice-share-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}
.voice-share-caption svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-dim); }
.voice-share-caption span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-share-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 0;
}
.voice-share-mode {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.voice-share-specs {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
.voice-share-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.voice-share-tiers {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--rail);
}
.voice-share-tiers button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 6px;
}
.voice-share-tiers button.is-on { background: var(--panel-alt); color: var(--text); }
.voice-share-tiers button:disabled { opacity: 0.4; cursor: default; }
#voice-share-cog {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--rail);
  color: var(--text);
  cursor: pointer;
}
#voice-share-cog svg { width: 18px; height: 18px; }
#voice-share-menu {
  position: absolute;
  right: 0;
  bottom: 46px;
  min-width: 230px;
  padding: 6px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--accent-submenu);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
#voice-share-menu[hidden] { display: none; }
#voice-share-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
#voice-share-menu button:hover { background: var(--panel-alt); }
.voice-share-check { visibility: hidden; font-weight: 700; }
#voice-share-menu button.is-on .voice-share-check { visibility: visible; }
.voice-share-menu-gap { height: 1px; margin: 6px 4px; background: var(--border); }
.voice-rail { display: flex; flex-direction: column; gap: 1px; margin: 0 0 4px; }
.voice-rail-user {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 3px 8px 3px 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.voice-rail-user:hover { background: var(--panel-alt); }
.voice-rail-face {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: visible;
  background: var(--panel);
}
.voice-rail-face img,
.voice-rail-face canvas,
.voice-rail-face video {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.voice-face-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  font-weight: 700;
}
.voice-rail-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #23a559;
  border: 2px solid var(--bg, var(--panel));
}
.voice-rail-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-rail-live {
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #ed4245;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.voice-rail-watch {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.voice-watch-banner {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0 0 8px;
  padding: 18px 20px;
  border-radius: 8px;
  background: var(--panel);
  box-sizing: border-box;
}
.voice-watch-banner strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
}
.voice-watch-banner span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}
.voice-watch-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
}
.voice-watch-btn:hover { background: var(--accent-hover); }
.voice-watch-leave {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
}
.voice-watch-leave:hover { background: rgba(0, 0, 0, 0.88); }
#voice-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  position: relative;
  background: #000;
}
#voice-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#voice-chat {
  flex: 0 0 340px;
  width: 340px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
}
#voice-chat[hidden] { display: none !important; }
#voice-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.voice-chat-compose {
  flex: 0 0 auto;
  padding: 0 12px 16px;
}
#voice-chat-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: 0;
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 22px;
  padding: 10px 12px;
  min-height: 130px;
  max-height: 130px;
  overflow: auto;
  white-space: pre-wrap;
}
#voice-chat-input::placeholder { color: var(--text-dim); }
#voice-chat-input:disabled { opacity: 0.7; }
.voice-rail-user.is-server-muted .voice-rail-name,
.voice-tile.is-server-muted { opacity: 0.55; }
#voice-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px;
  overflow: auto;
}
.voice-tile {
  flex: 0 0 auto;
  width: 320px;
  height: 180px;
  border-radius: 8px;
  border: 3px solid transparent;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.voice-tile.is-speaking { border-color: #23a559; }
#voice-stage:has(.voice-watch-banner) {
  align-content: flex-start;
  justify-content: flex-start;
}
#voice-stage.is-streaming {
  flex-direction: column;
  flex-wrap: nowrap;
  align-content: stretch;
  justify-content: flex-start;
}
.voice-stream {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
  background: #000;
}
.voice-stream video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.voice-stream-row {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  justify-content: center;
  overflow: auto;
  width: 100%;
  padding: 12px 16px 4px;
}
.voice-stream-row .voice-tile { width: 160px; height: 90px; }
.voice-stream-row .voice-tile-face { width: 40px; height: 40px; }
.voice-stream-row .voice-tile-face .voice-face-letter { font-size: 16px; }
.voice-tile-face {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-tile-face img,
.voice-tile-face canvas,
.voice-tile-face video { width: 100%; height: 100%; object-fit: cover; display: block; }
.voice-tile-face .voice-face-letter { font-size: 32px; }
#voice-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 18px;
  background: #000;
}
.voice-ctrl {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 4px;
  background: #2b2d31;
  color: #dbdee1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.voice-ctrl svg { width: 20px; height: 20px; display: block; }
.voice-ctrl:hover:not(:disabled) { background: #35373c; }
.voice-ctrl:disabled { opacity: 1; cursor: default; }
.voice-ctrl-leave,
.call-leave {
  width: auto;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: #ed4245;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.voice-ctrl.voice-ctrl-leave:hover,
.call-leave:hover { background: #d83a3e; }
#voice-user-leave {
  flex: 0 0 auto;
  width: auto;
  height: 26px;
  margin-left: auto;
  padding: 0 8px;
  font-size: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.voice-ctrl-more-wrap { position: relative; }
#voice-more {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  width: 280px;
  padding: 6px;
  border-radius: 8px;
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  z-index: 2;
}
#voice-more[hidden] { display: none; }
.voice-more-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #f2f3f5;
  font: inherit;
  font-size: 14px;
  text-align: left;
}
button.voice-more-row { cursor: pointer; }
button.voice-more-row:hover:not(:disabled) { background: #2b2d31; }
button.voice-more-row:disabled,
.voice-more-row.is-check { opacity: 0.55; cursor: default; }
.voice-more-mark { color: #5865f2; font-weight: 700; }
#main-grid.voice-stage-open.has-member-list,
#main-grid.voice-stage-open.has-member-list.has-search-results {
  grid-template-columns: 72px 240px minmax(0, 1fr);
}
#chat-call-banner[hidden] { display: none !important; }
#chat-call-banner {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 28px 16px 20px;
  background: #000;
  box-sizing: border-box;
}
#chat-call-video {
  width: min(720px, 100%);
  max-height: 320px;
  border-radius: 8px;
  background: #000;
  object-fit: contain;
}
#chat-call-faces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.call-face {
  width: 80px;
  height: 80px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 0 0 3px transparent;
}
.call-face img,
.call-face canvas,
.call-face video {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
}
.call-face.is-ringing {
  opacity: 0.45;
  filter: grayscale(1);
}
.call-face.is-speaking { box-shadow: 0 0 0 3px #23a559; }
#chat-call-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#chat-call-tools button[hidden] { display: none !important; }
.call-tool {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: #2b2d31;
  color: #dbdee1;
  cursor: pointer;
}
.call-tool svg { width: 20px; height: 20px; }
.call-tool:hover { background: #35373c; }
.call-join {
  border: 0;
  border-radius: 4px;
  background: #3ba55d;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
}
.call-join:hover { background: #2d8a4e; }
.call-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--text);
  font-size: calc(14px * var(--message-scale));
}
.call-line-phone {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #3ba55d;
}
.call-line-phone svg { width: 18px; height: 18px; display: block; }
.call-line-text { min-width: 0; }
.call-line-time {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: calc(12px * var(--message-scale));
  white-space: nowrap;
}
